.hd ctov "convert EOS-terminated string to varying string" 03/01/83
integer function ctov (str, i, var, len)
character str (ARB)
integer i, len
packed_char var (len)
.sp
Library:  vswtlb (standard Subsystem library)
.fs
'Ctov' converts [ul Software Tools] style EOS-terminated strings
to PL/I style "character varying" strings.
Character varying strings consist of a one-word length field,
followed by up to 32767 words of packed character data.
.sp
The argument 'str' contains the EOS-terminated string to be
converted.
The integer 'i' gives the position of the first character in
the string to be converted, i.e. the starting point of the
substring to be packed.
'Var' is the array which is to receive the character varying
string, and 'len' is  the number of words in 'var' available
for holding characters  plus one (for the string length word).
Conversion starts at the 'i'th position in 'str' and continues
until an EOS is encountered in 'str' or 'var' is completely
filled.
The function return is the number of characters packed.
.im
'Ctov', like 'ctop', makes repeated calls on the standard macro
'spchar' to pack characters into the destination array.
Once all characters in the string have been packed, or no
room remains in the destination, 'ctov' sets the first word
of the destination array to the number of characters it
contains and returns this number as the function value.
.am
i, var
.sa
other conversion routines ('cto?*' and '?*toc') (2)
