Porting TERMIO software


Next: Creating a new Up: Porting to other Previous: Porting to other

Porting TERMIO software

The TERMIO routines provide the basic terminal I/O for XANADU. Currently the TERMIO software reads and writes to the terminal using one of two completely different methods. One method involves standard Fortran I/O and the second method involves single-character I/O. The single-character method supports command line editing, which should be regarded as a convenience and not as a necessity. Therefore when porting TERMIO to a new operating system, it is a good idea to first get the code working without command line editing. Once the code is working and you have some free time, then you can go back and add the single character I/O routines.

The system dependent routines are in SYSIO.xxx. Initially SYSIO.xxx should be fairly simple and only allow standard Fortran I/O. To disable single character I/O, you will need to create a new version of SYSIO.xxx (where xxx is your system descriptor). This file should contain six routines, and five of these routines can return without doing anything. The routine FORTYP should return with the variable IFTYPE set equal to zero. When this is done, it becomes impossible to accidently turn on command line editing, which would cause the program to go into an infinite loop if the RDCHR and PUTSTR routines have not been implemented.

The [LIB.TERMIO] directory contains several makefile's, plus an example program TSTREC.FOR. You should try out the TSTREC program on your system to ensure that the basic terminal I/O routines are working.

Once you have the standard Fortran version working, and are fishing around for something to do, you should then implement the single character I/O routines. This means implementing the other routines found in SYSIO.FOR. Since many UNIX systems do not allow system functions to be called directly from Fortran, many systems use some C code to provide this interface. Under SUN UNIX some routines are implemented using the file ciosun.c. The SYSIO.FOR routine TTINIT should put the terminal into single character I/O mode (called cbreak in UNIX). TTRSET should return the terminal to normal mode (called cooked in UNIX). RDCHR should read a single character, and PUTSTR should write a string to the terminal. Both RDCHR and PUTSTR should work in passthru mode where control characters (such as escape) are not interpreted by the terminal driver but rather passed to the terminal. PUTSTR can buffer the output, until FLUSH is called, whereon all data should actually be written to the terminal. Finally, you will need to modify FORTYP to return either +1 or -1 depending on whether Fortran on your system outputs a return before or after each Fortran WRITE operation. This will also allow command line editing to be switched on.

To test command-line editing, try the TSTREC.FOR program and use the interactive %ED%ON command to switch it on. Once you are convinced that command-line editing is working you can then use the GTBUF_EDIT logical name/environment variable to automatically switch on editing for all XANADU software.



next up previous contents
Next: Creating a new Up: Porting to other Previous: Porting to other



Web Page Maintained by: Dr. Lawrence E. Brown elwin@redshift.gsfc.nasa.gov