

            init$p (2) --- force Pascal i/o to recognize the Subsystem  01/07/83


            _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

                 procedure init$p;

                 Library:  vswtlb (standard Subsystem library)


            _F_u_n_c_t_i_o_n

                 A call to 'init$p' from a Pascal program attaches the Pascal
                 file  INPUT  to the file open as standard input (either disk
                 or terminal) and attaches the Pascal file OUTPUT to the file
                 open as standard output (either disk or terminal).

                 To use 'init$p', it must be declared as a level 1 procedure,
                 
                    procedure init$p; extern;
                 
                 and then called as the first statement after  the  BEGIN  in
                 the main program:
                 
                    init$p;
                 


            _I_m_p_l_e_m_e_n_t_a_t_i_o_n

                 First 'init$p' calls 'flush$' on standard input and standard
                 output  to  clean up any unfinished Subsystem I/O.  'Init$p'
                 then calls the Subsystem 'mapfd'  to  determine  the  Primos
                 file  unit attached to standard input.  If 'mapfd' returns a
                 file descriptor, 'init$p' tweaks  the  Pascal  file  control
                 block  'p$ainp'  and  calls  the  Primos  routine  ATTDEV to
                 establish the unit mapping.  Next 'init$p' calls 'gfnam$' to
                 obtain the pathname of the disk file.  If 'gfnam$' returns a
                 valid pathname, 'mktr$' is called to  convert  the  pathname
                 into  a  Primos  treename.  This treename is copied into the
                 Pascal file control block so that Pascal  can  use  it  when
                 reporting  I/O errors.  If 'gfnam$' returns ERR, the message
                 'pathname unobtainable'  is  copied  into  the  Pascal  file
                 control  block  as the file name.  Otherwise, since INPUT is
                 already directed to the  terminal,  'init$p'  does  nothing.
                 This  procedure is then repeated for standard output and the
                 Pascal file OUTPUT.


            _C_a_l_l_s

                 ctop, flush$, gfnam$, mapfd, mapsu, mktr$, Primos attdev


            _B_u_g_s

                 Files redirected to /dev/null are not supported.




            init$p (2)                    - 1 -                    init$p (2)




            init$p (2) --- force Pascal i/o to recognize the Subsystem  01/07/83


            _S_e_e _A_l_s_o

                 init$f (2), init$plg (2), file$p (2)























































            init$p (2)                    - 2 -                    init$p (2)


