

            file$p (2) --- connect Pascal file variables to Subsystem files  11/19/82


            _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

                 type file_name = array [1..7] of char;
                 procedure file$p (file: text; name: file_name); extern;

                 Library:  vswtlb (standard Subsystem library)


            _F_u_n_c_t_i_o_n

                 'File$p'  may  be called from a Pascal program to allow that
                 program to access the redirection and pipe features of  Sub-
                 system  I/O.   Each  call to 'file$p' can connect any Pascal
                 file variable to any Subsystem file.  The call  to  'file$p'
                 is equivalent to, and is used instead of, the Pascal "reset"
                 and "rewrite" statements.

                 To  use  'file$p',  it  should  be  declared  as  a  level 1
                 procedure:
                 
                    procedure file$p(var f: text; n: file_name); extern;
                 
                 It may then be called to connect input and output, for exam-
                 ple:
                 
                    file$p(input,'STDIN  ');
                    file$p(output,'STDOUT ');
                 
                 The name of the Subsystem file to be connected  must  be  in
                 upper  case  and  space  filled.   It may be any of the fol-
                 lowing:   STDIN,  STDIN1,  STDIN2,  STDIN3,  ERRIN,  STDOUT,
                 STDOUT1, STDOUT2, STDOUT3, or ERROUT.


            _I_m_p_l_e_m_e_n_t_a_t_i_o_n

                 'File$p'  searches  a  table  of  Subsystem  file  names  to
                 determine the standard unit number for the  requested  file.
                 If  the  name is not in the table, 'file$p' calls the Primos
                 routine ERRPR$ to signal a bad file name error.  If the name
                 is in the table, a call to 'mapsu' is made to map the  stan-
                 dard  unit  number  into  the  Subsystem  unit  number,  and
                 'flush$' is called to ensure that the file has been  written
                 to  disk.   Then  'mapfd'  is called to determine the Primos
                 file unit associated with the file, if  there  is  one.   If
                 there  is  no  associated  file  unit,  the  file  is on the
                 terminal and 'file$p' initializes the  Pascal  file  control
                 block  for  a  terminal file.  Otherwise, the Primos routine
                 ATTDEV is called to connect  the  requested  file,  and  the
          |      Pascal file control block is initialized.  After the type of
          |      file  is  determined (disk or terminal) the appropriate name
                 is copied into the Pascal  file  control  block;  'TTY'  for
                 terminal  files  and  for /dev/null, and the Primos treename
                 for disk files.




            file$p (2)                    - 1 -                    file$p (2)




            file$p (2) --- connect Pascal file variables to Subsystem files  11/19/82


            _A_r_g_u_m_e_n_t_s _M_o_d_i_f_i_e_d

                 file


            _C_a_l_l_s

                 ctop, equal, flush$, gfnam$,  mapfd,  mapsu,  mktr$,  move$,
                 ptoc, Primos attdev, Primos errpr$


            _B_u_g_s

                 Files redirected to /dev/null are not supported.

                 Pascal  terminal  input does not behave correctly, the back-
                 space key cannot be used to erase previously entered charac-
                 ters.


            _S_e_e _A_l_s_o

                 init$p (2)



































            file$p (2)                    - 2 -                    file$p (2)


