

            ptov (2) --- convert packed string to PL/I varying string  09/23/83


          | _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

          |      integer function ptov (pstr, term, vstr, len)
          |      packed_char pstr (ARB), vstr (len)
          |      integer len
          |      character term

          |      Library:  vswtlb (standard Subsystem library)


          | _F_u_n_c_t_i_o_n

          |      'Ptov'  converts  a  packed  character string (e.g., Fortran
          |      Hollerith  literals)  into  a   PL/I-compatible   "character
          |      varying"  string.   Character  varying  strings consist of a
          |      one-word length field, followed by up to 32767 words of pac-
          |      ked character data.

          |      The argument 'pstr' is the packed  array  to  be  converted.
          |      'Term'  specifies a "termination character"; if the termina-
          |      tion character appears unescaped in the packed string,  then
          |      'ptov'  terminates  the  copying  operation  without copying
          |      'term'.  (For  example,  most  uses  of  packed  strings  in
          |      _S_o_f_t_w_a_r_e _T_o_o_l_s included a period as a termination character,
          |      since  in  general there is no other way for a subprogram to
          |      tell where a Hollerith literal ends.)  The  argument  'vstr'
          |      is  an  array  which  receives the character-varying string;
          |      'len' gives the number of words available in 'vstr', includ-
          |      ing the leading one-word length field.

          |      The function returns the number of  characters  copied  into
          |      'vstr'.

          |      Many Primos routines return packed character strings that do
          |      not  have  a  termination  character,  but do have a maximum
          |      length.  When using 'ptov' to convert the  output  of  these
          |      routines,  one  may  use EOS as the termination character to
          |      obtain a fixed-length result.


          | _I_m_p_l_e_m_e_n_t_a_t_i_o_n

          |      'Ptov' first checks that 'len' is large enough to  allow  it
          |      to store characters in 'vstr'.  If there is room for charac-
          |      ters in 'vstr', 'ptov' fetches successive words from 'pstr',
          |      unpacks  the  characters,  checks for escaped characters and
          |      'term', and then packs the characters into 'vstr'.  When  it
          |      encounters  'term'  or  if  it  fills 'len' words with data,
          |      'ptov' returns the number of characters copied.


          | _A_r_g_u_m_e_n_t_s _M_o_d_i_f_i_e_d

          |      vstr




            ptov (2)                      - 1 -                      ptov (2)




            ptov (2) --- convert packed string to PL/I varying string  09/23/83


          | _S_e_e _A_l_s_o

          |      other   conversion   routines   ('pto?*'    and    '?*tov'),
          |      particularly 'vtop' (2), 'ctop' (2), 'ptoc' (2), 'vtoc' (2),
          |      and 'ctov' (2)





















































            ptov (2)                      - 2 -                      ptov (2)


