!head('libraries')
There are a number of libraries set up to be used with the !fc compiler.
a library is specified by "-Lx" at the end of the !fc command. "x" is a
letter specifying the library. libraries currently available are:
!i(-LO) (ourlib) contains many statistical and mathematical routines.
see the appropriate writeup for details.
!i(-LP) (plotlib) contains plotter routines (P1130, SCALF, FPLOT, FGRID,
POINT, FCHAR, PENUP, PENDN).
!i(-LZ) (370lib) contains many IBM 370 routines (MASKMV, INFREE, EQCMP,
NECMP, SETC, COMC, MOVEC, LCOMP, INBITS,
MOVEI, FINDC, FINDST, IGC, TRNC, LCTRAN, UCTRAN).
!i(-LF) is the normal fortran library and is automatically provided by the
!fc command. it contains (amoung other things) the standard fortran library 
(SQRT, ABS, MIN, MAX, EXP, LOG) and the system library 
(CHDIR, CHMOD, CHOWN, CLOSE, CREAT, CSW, DUP, EXECL, FORK, FSTAT, GETGID, GETPID,
GETUID, GTTY, KILL, NICE, OPEN, PIPE, READ, SEEK, SETGID, SETUID,
SLEEP, STAT, STIME, STTY, TIME, TIMES)
the system library routines are basicly those described in the "Unix Programmers Manual".
the main advantage of the system READ and WRITE routines over the same
Fortran Statements is that they
are much more efficient.
!head('UNIX System Routines')
as mentioned above, there exist versions of almost all UNIX system calls
in the Fortran library. there are, however, a number of things to remember
about these routines:
!pt when mixing Fortran and C subroutines the Fortran library will be searched
first, resulting in the Fortran versions of the above routines be used,
this may cause problems if the C subroutines call the normal system  interface
routines for use from C.
!pt without exception, all these routines work exclusively with either
character strings or integers. most of the function names do not conform to the
Fortran naming convension so must either appear in an INTEGER statment
or better still, an IMPLICIT INTEGER (A-Z) statment should be used as all
function values returned are INTEGER*2.
!pt all the I/O routines work directly with file descriptors, while the
Fortran I/O statments work with logical unit numbers. currently it is not
possible to associate a UNIX file descriptor with a Fortran logical unit.
!pt all the routines accepting a character string as an argument, with
the exception of EXECL, allow the string to be terminated by either a NULL
or a BLANK, as these are path names and normally do not have embedded blanks.
the arguments to EXECL must be terminated by a NULL byte, and the last
parameter must be a zero, to indicate the end of the parameter list.
!head('Sample use of UNIX routines from Fortran')
the following series of commands forks off a sub-process, and after setting
its standard input to the file "/dev/tty" and its standard output to a
pipe that is then read by the parent process, executes the program "test".
)l2a
       implicit integer (a-z)
       integer pipes(2)
       pid = fork()
       if (pid.eq.0) then
c
c child process
c
              call close(pipe(0))
              call close(0)
              if (open('/dev/tty',0).ne.0) stop 'no /dev/tty'
              call execl('test\0','test\0','1=datafile\0',0)
              stop 'no test program'
       else
c
c parent process
c
              call close(pipe(1))
              ...
10              continue
              i = wait(status)
              if (i.ne.-1 .and. i.ne.pid) goto 10
              if (i.ne.0) stop 'bad status from test'
       endif
       ...
       stop
       end
) 
!head('C subroutines')
the calling sequence used is compatible with that used by C programs, so
that !fc routines may call C routines that are set up as !fc callable.
!p C is generally a more flexible language than Fortran and allows full
access to system routines.
!p generally, when C subroutines are called from fortran they have one
additional parameter, the first one, which is the number of arguments
actually supplied. the other parameters are the addresses of the
actual Fortran parameters.
!p similarly, if a C routine calls a Fortran subroutine, it must supply
as a first parameter the number of arguments that the Fortran routine
expects, and then the addresses of the variable to be passed as arguments.
