print (2) --- easy to use semi-formatted print routine 01/07/83 _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n subroutine print (fd, fmt, a1, a2, ...) file_des fd character fmt (ARB) untyped a1, a2, ... Library: vswtlb (standard Subsystem library) _F_u_n_c_t_i_o_n 'Print' is an output routine designed for ease of use. It allows the user to specify a file on which to write, a format to control output to the file, and any number of items to be printed. The first argument is the file descriptor of the file to be used for output. The second argument is a format string (discussed below). The remain- ing arguments (zero or more) are items to be output accord- ing to format control. The format string is a EOS-terminated character string. It contains literal characters to be printed, as well as formatting control structures. Formatting control struc- tures consist of an asterisk (*) followed by a single lower- case letter describing the action to be performed on the next argument in the argument list. For a complete list of the available formats, see the documentation for the subroutine 'encode'. Characters in the format string that are not associated with a format control construct are output to the file without change. A few examples may clarify the use of 'print'. The follow- ing call will print two real numbers along with some text for identification, followed by a NEWLINE, on standard out- put: call print (STDOUT, "x = *r, y = *r*n"s, xcoord, ycoord) This example shows how a line of output may be built up by successive calls: call print (STDOUT, "absolute value = "s) if (x < 0) call print (STDOUT, "*i*n"s, -i) else call print (STDOUT, "*i*n"s, i) Further examples of formats may be found in the documenta- tion for 'encode'. For compatibility with earlier versions of the Subsystem, packed strings will still be accepted, but all new code should use standard EOS-terminated strings. print (2) - 1 - print (2) print (2) --- easy to use semi-formatted print routine 01/07/83 _I_m_p_l_e_m_e_n_t_a_t_i_o_n Since Fortran passes arguments to subroutines by reference, 'print' does not need to know the actual type of its printable arguments. A local character buffer is declared and passed along with the arguments to 'encode', which does the actual work of conversion. A call to 'putlin' then writes the result to the specified file. _C_a_l_l_s encode, ptoc, putlin _B_u_g_s At most ten items may be printed. _S_e_e _A_l_s_o encode (2), input (2), putlin (2), other conversion routines ('?*toc' and 'cto?*') (2) print (2) - 2 - print (2)