


2 PASIO
!
! PAS$INIT_IO
! Initialize Pascal I/O for a Pascal subroutine.
!
PAS$INIT_IO is a  procedure  that  initializes  the  Pascal  I/O
facilities to allow access to them from a Pascal subroutine that
has a non-Pascal main program.  In a normal  Pascal  environment
certain  initialization  steps  are  taken  in  the  Pascal main
program.  If the main program is not Pascal,  I/O  in  a  Pascal
subroutine  will  result  in  a  fatal  error.  PAS$INIT_IO is a
procedure for a  non-Pascal  main  program  to  call  that  will
initialize  the  Pascal  I/O system, preventing this error.  The
companion routine PAS$CLOSE_IO is then used to terminate  Pascal
I/O  in  progress before exiting.  It closes the predefined file
INPUT and OUTPUT correctly.
3 Author
These routines were written by Kevin Carosso  of  the  OMNIGRAPH
project.   Please  direct  any  comments  to  via system MAIL to
OMNIGRAPH.
3 Call
Calling Procedure:

The procedure declaration should be:

  PROCEDURE PAS$INIT_IO; EXTERN;
  PROCEDURE PAS$CLOSE_IO; EXTERN;

The Pascal example:

    module io (input,output);

        procedure PAS$INIT_IO; extern;
        procedure PAS$CLOSE_IO; extern;

        procedure write_it;

        var x:real;

        begin
            PAS$INIT_IO;
            write ('Prompt:');
            read (x);
            writeln ('X =',x);
            PAS$CLOSE_IO;
        end;

    end.

shows the use of these routines at the  start  and  end  of  the
Pascal subroutine that will be doing I/O.

The FORTRAN example:

            call PAS$INIT_IO
            call write_it
            call read_it
            call write_again
            call PAS$CLOSE_IO
            end

shows the initialization in the main  program  just  before  the
call  to  the  Pascal  subroutine.   In  this example, WRITE_IT,
READ_IT, and WRITE_AGAIN are  the  external  Pascal  subroutines
that  need  to  do  I/O.   This  is  useful  if  several  Pascal
subroutines are to be used.  You need only call PAS$INIT_IO once
in  the main program, and PAS$CLOSE_IO once after all Pascal I/O
is finished.
3 Location
PAS$INIT_IO is kept in the object library:

        TOOLS:POWELL.OLB

and can be accessed by the linker with the command line:

        $ LINK MAIN,PASCALSUBR,TOOLS:POWELL/LIB

Where MAIN is the main program  (probably  not  in  Pascal)  and
PASCALSUBR    is    the    Pascal   subroutine   that   requires
initialization.  The source to PASIO is the file:

        DEV:[OMNIGRAPH.UTILITY]PASIO.MAR
