PROC TERMIO; # TITLE TERMIO - TERMINAL INPUT/OUTPUT MODULE. # BEGIN # TERMIO # # *** TERMIO - TERMINAL INPUT/OUTPUT MODULE. * * *TERMIO* PROVIDES FETS, CIRCULAR BUFFERS, AND FUNDAMENTAL * I/O MACROS FOR THE FULL SCREEN EDITOR AND FOR PRODUCTS * BUILT ON THE VIRTUAL DISPLAY TERMINAL OBJECT ROUTINES. * * FOR THE FULL SCREEN EDITOR, *TERMIO* MAPS STORAGE INTO THE * GLOBAL COMMON BLOCK AND GENERATES CODE APPROPRIATE TO THE * SINGLE AND MULTI USER VERSIONS OF THE EDITOR. FOR OTHER * PRODUCTS, *TERMIO* STANDS ALONE. * * PROC TERMIO * * ENTRY OBJECT ROUTINE CALLED. * * EXIT OBJECT ROUTINE EXECUTED. * * NOTES THE *TERMIO* ROUTINES ALLOW USE OF BOTH *FORTRAN* * AND *COBOL* CALLING SEQUENCES. * * COPYRIGHT CONTROL DATA SYSTEMS INC. 1992. # # START OF MODIFY CONDITIONAL SEQUENCE # *IF DEF,EDITOR DEF LISTCON #0#; # DO NOT LIST COMDECKS # *ELSE DEF LISTCON #1#; # LIST COMDECKS # *ENDIF # END OF MODIFY CONDITIONAL # *IFCALL SINGLE,COMFSGL *IFCALL ONLY,COMFONL *IFCALL MULTI,COMFMLT *IFCALL EDITOR,COMFFSE # START OF CODE SEQUENCE CONDITIONALLY PRODUCED BY MODIFY UTILITY # *NIFCALL EDITOR,COMFTIO *IF UNDEF,EDITOR DEF SINGLE #1#; # SINGLE-USER VERSION # DEF MULTI #0#; # NOT MULTI-USER VERSION # DEF EDITORVDT #0#; # STANDALONE VERSION OF VIRTERM # DEF IOBEGIN(XXX) #BEGIN#; # BEGIN COMPOUND STATEMENT # DEF IOEND #END#; # END COMPOUND STATEMENT # DEF IORET #RETURN;#; # EXIT FROM SUBPROGRAM # CONTROL PRESET; *ENDIF *IF UNDEF,QTRM DEF QTRMV #0#; # NOT QTRM VERSION # *ELSE DEF QTRMV #1#; # QTRM VERSION # *ENDIF # END OF MODIFY CONDITIONAL # # COMMON DATA # CONTROL IFEQ MULTI,1; XREF ARRAY RENTSTK [1:MAXREENT] P(1); # SUBROUTINE STACK # BEGIN # ARRAY RENTSTK # ITEM RSTK I; # STACK WORD # END # ARRAY RENTSTK # XREF ITEM RSTKPTR I; # STACK POINTER # CONTROL FI; CONTROL IFEQ MULTI,1; XREF BEGIN PROC TTITRAP; # TELETYPE INPUT TRAP # PROC TTOTRAP; # TELETYPE OUTPUT TRAP # PROC VOLUNTEER; # VOLUNTEER PREEMPTIVE SWAPPING # FUNC NOSWDSZ; # NOS WORD SIZE # END CONTROL FI; XREF BEGIN *IFCALL EDITOR,COMFXSB CONTROL IFEQ SINGLE,1; PROC VDTLOF$; # SET LIST OF FILES # PROC VDTRD$; # READ AFTER EOR # PROC VDTREC$; # READ CODED LINE # PROC VDTREO$; # READ ONE WORD # PROC VDTWRC$; # WRITE CODED LINE # PROC VDTWRO$; # CIO WRITE WORD # PROC VDTWRR$; # WRITE EOR # *IF DEF,CRM # START OF MODIFY CONDITIONAL FOR TERMINAL OUTPUT. # PROC VDTCLO$; # CLOSE CRM OUTPUT FILE # PROC VDTOPN$; # OPEN CRM OUTPUT FILE # # END OF MODIFY CONDITIONAL FOR TERMINAL OUTPUT. # *ENDIF CONTROL FI; END XDEF BEGIN # COMFXTI # *CALL COMFXTI END # COMFXTI # # COMMON DATA BLOCK # *IFCALL EDITOR,COMFDS1 *IFCALL EDITOR,COMFVD2 *IFCALL EDITOR,COMFDS2 *NIFCALL EDITOR,COMFVD1 *NIFCALL EDITOR,COMFVD2 *NIFCALL EDITOR,COMFVD3 CONTROL EJECT; PROC VDTFLS; # TITLE VDTFLS - FLUSH OUTPUT BUFFER. # BEGIN # VDTFLS # # ** VDTFLS - FLUSH OUTPUT BUFFER. * * *VDTFLS* FLUSHES THE OUTPUT BUFFER. * * PROC VDTFLS * * EXIT TTYO - FET HAS RESET TO SHOW THE OUTPUT BUFFER * EMPTY. # CONTROL IFEQ SINGLE,1; TTYOIN = TTYOOT; # SET IN EQUAL TO OUT # CONTROL FI; END # VDTFLS # CONTROL EJECT; PROC VDTDRN; # TITLE VDTDRN - FLUSH THE INPUT BUFFER. # IOBEGIN(VDTDRN) # ** VDTDRN - FLUSH THE INPUT BUFFER. * * *VDTDRN* FLUSHES THE INPUT BUFFER. * * PROC VDTDRN * * EXIT TTYI - FET HAS EMPTY CIRCULAR BUFFER, IN EITHER * SINGLE-EDITOR OR STANDALONE VERSION. * * CALLS TTITRAP (MULTI ONLY). * * USES TTILEN (MULTI ONLY). # CONTROL IFEQ SINGLE,1; TTYIOT=TTYIIN; CONTROL FI; CONTROL IFEQ MULTI,1; TTILEN=-1; TTITRAP; CONTROL FI; IOEND # VDTDRN # CONTROL EJECT; PROC VDTRDO(L); # TITLE VDTRDO - READ ONE WORD OF INPUT. # IOBEGIN(VDTRDO) # ** VDTRDO - READ ONE WORD OF INPUT. * * *VDTRDO* READS ONE WORD OF INPUT INTO BUFFER *L*. * * PROC VDTRDO(L) * * ENTRY L - WORD TO BE READ INTO. * * CALLS READ, READO (SINGLE OR STANDALONE). * MORTAL (SINGLE-EDITOR ONLY). * TTITRAP, VOLUNTEER (MULTI-EDITOR ONLY). * * USES TTYI FET (SINGLE OR STANDALONE). * TTIADDR, TTILEN (MULTI ONLY). * TTYINPUT (SINGLE EDITOR ONLY) # ARRAY L [0:0] P(1); # WORD TO BE READ INTO # BEGIN # ARRAY L # ITEM LL I; # LINE OF INPUT # END # ARRAY L # CONTROL IFEQ MULTI,1; TTIADDR=LOC(L); TTILEN=1; TTITRAP; # GET FROM SMFEX # VOLUNTEER; # MOVE FAST IF LOW TTI # CONTROL FI; CONTROL IFEQ SINGLE,1; ITEM R I; # READ STATUS # LL = 0; # EMPTY LINE BY DEFAULT # R=-1; # EOF DETECTED ON FILE # IF TTYIIN EQ TTYIOT THEN BEGIN *IF DEF,DEBUG VDTDMP$; *ENDIF VDTRD$(TTYI,1); # READ MACRO # END IF TTYIIN NQ TTYIOT THEN VDTREO$(TTYI,L,R); # READO MACRO # # START OF CODE CONDITIONALLY PRODUCED BY MODIFY UTILITY # *IF DEF,EDITOR IF R NQ 0 AND NOT TTYINPUT THEN MORTAL(" QUIT IS REQUIRED FOR BATCH JOBS.$"); *ENDIF # END OF MODIFY UTILITY CONDITIONAL # CONTROL FI; IOEND # VDTRDO # CONTROL EJECT; PROC VDTWTO(A); # TITLE VDTWTO - WRITE ONE WORD OF OUTPUT. # IOBEGIN(VDTWTO) # ** VDTWTO - WRITE ONE WORD OF OUTPUT. * * *VDTWTO* WRITES ONE WORD OF OUTPUT FROM BUFFER *A*. * * PROC VDTWTO(A) * * ENTRY A - THE WORD. * * CALLS WRITEO (SINGLE-EDITOR OR STANDALONE). * TTOTRAP (MULTI ONLY). * * USES TTOLEN, TTOTYPE, TTOADDR (MULTI ONLY). # ARRAY A [0:0] P(1);; # WORD OF OUTPUT # CONTROL IFEQ MULTI,1; TTOADDR=LOC(A); TTOLEN=1; TTOTYPE=TTOST"NORMAL"; TTOTRAP; CONTROL FI; CONTROL IFEQ SINGLE,1; VDTWRO$(TTYO,A); # WRITEO MACRO # CONTROL FI; IOEND # VDTWTO # CONTROL EJECT; PROC VDTRDC(L,N); # TITLE VDTRDC - READ ONE LINE OF INPUT. # IOBEGIN(VDTRDC) # ** VDTRDC - READ ONE LINE OF INPUT. * * *VDTRDC* READS ONE LINE OF INPUT INTO BUFFER *L*. * * PROC VDTRDC(L,N) * * ENTRY L - LINE IMAGE BUFFER. * N - BUFFER CAPACITY IN WORDS. * * CALLS READ, READC (SINGLE OR STANDALONE). * MORTAL (SINGLE-EDITOR ONLY). * TTITRAP, VOLUNTEER (MULTI-EDITOR ONLY). * * USES TTYI FET (SINGLE OR STANDALONE). * TTIADDR, TTILEN (MULTI ONLY). * TTYINPUT (SINGLE EDITOR ONLY) # ARRAY L [0:0] P(1); # LINE IMAGE BUFFER # BEGIN # ARRAY L # ITEM LL I; # LINE IMAGE # END # ARRAY L # ITEM N I; # MAX NUM WORDS # CONTROL IFEQ MULTI,1; TTIADDR=LOC(L); TTILEN=N; TTITRAP; # GET FROM SMFEX # VOLUNTEER; # MOVE FAST IF LOW TTI # CONTROL FI; CONTROL IFEQ SINGLE,1; ITEM R I; # READ STATUS # LL = 0; # EMPTY LINE BY DEFAULT # R=-1; # EOF DETECTED ON FILE # IF TTYIIN EQ TTYIOT THEN VDTRD$(TTYI,1); # READ MACRO # IF TTYIIN NQ TTYIOT THEN VDTREC$(TTYI,L,N,R); # READC MACRO # # START OF SEQUENCE CONDITIONALLY PRODUCED BY MODIFY UTILITY # *IF DEF,EDITOR IF R NQ 0 AND NOT TTYINPUT THEN MORTAL(" QUIT IS REQUIRED FOR BATCH JOBS.$"); *ENDIF # END OF MODIFY CONDITIONAL # CONTROL FI; IOEND # VDTRDC # CONTROL EJECT; PROC VDTWTC(A); # TITLE VDTWTC - WRITE ONE LINE OF OUTPUT. # IOBEGIN(VDTWTC) # ** VDTWTC - WRITE ONE LINE OF OUTPUT. * * *VDTWTC* WRITES ONE LINE OF OUTPUT FROM BUFFER *A*. * * PROC VDTWTC(A) * * ENTRY A - LINE IMAGE BUFFER WITH ZERO BYTE TERMINATOR. * * CALLS WRITEC (SINGLE-EDITOR OR STANDALONE). * TTOTRAP (MULTI ONLY). * * USES TTOLEN, TTOTYPE, TTOADDR (MULTI ONLY). # ARRAY A [0:0] P(1);; # LINE IMAGE BUFFER # CONTROL IFEQ MULTI,1; TTOADDR=LOC(A); TTOLEN=NOSWDSZ(9999,A); TTOTYPE=TTOST"NORMAL"; TTOTRAP; CONTROL FI; CONTROL IFEQ SINGLE,1; VDTWRC$(TTYO,A); # WRITEC MACRO # CONTROL FI; IOEND # VDTWTC # CONTROL EJECT; PROC VDTCLO(RCL); # TITLE VDTCLO - DO A WRITER ON OUTPUT FET. # IOBEGIN(VDTCLO) # ** VDTCLO - DO A WRITER ON OUTPUT FET. * * *VDTCLO* CLOSES THE OUTPUT FET BY DOING A *WRITER*. * * PROC VDTCLO(RCL) * * CALLS VDTWRR$ (SINGLE EDITOR OR STANDALONE). *IF DEF,CRM * VDTCLO$ (CRM STANDALONE ONLY). *ENDIF # ITEM RCL I; # RECALL PARAMETER # CONTROL IFEQ SINGLE,1; *IF DEF,DEBUG VDTDMP$; *ENDIF VDTWRR$(TTYO,RCL); # WRITER MACRO # *IF DEF,CRM # START OF MODIFY CONDITIONAL FOR TERMINAL OUTPUT. # VDTCLO$; # CLOSE CRM OUTPUT FILE # # END OF MODIFY CONDITIONAL FOR TERMINAL OUTPUT. # *ENDIF CONTROL FI; IOEND # VDTCLO # CONTROL EJECT; PROC VDTFOS(RCL); # TITLE VDTFOS - FLUSH OUTPUT TO SCREEN. # IOBEGIN(VDTFOS) # ** VDTFOS - FLUSH OUTPUT TO SCREEN. * * *VDTFOS* FLUSHES THE OUTPUT TO SCREEN BY A WRITER ON OUTPUT FET. * * PROC VDTFOS(RCL) * * CALLS VDTWRR$ (SINGLE EDITOR OR STANDALONE). # ITEM RCL I; # RECALL PARAMETER # CONTROL IFEQ SINGLE,1; *IF DEF,DEBUG VDTDMP$; *ENDIF VDTWRR$(TTYO,RCL); # WRITER MACRO # CONTROL FI; IOEND # VDTFOS # CONTROL EJECT; PROC VDTOPN; # TITLE VDTOPN - INITIALIZE TERMIO MODULE. # IOBEGIN(VDTOPN) # ** VDTOPN - INITIALIZE TERMIO MODULE. * * *VDTOPN* OPENS THE INPUT AND OUTPUT FETS AND INITIALIZES * THEM. * * PROC VDTOPN * * ENTRY INTERACT - WHETHER TRULY INTERACTIVE (SINGLE EDITOR). * * EXIT TTYI, TTYO - FETS ARE INITIALIZED. * LIST OF FILES IS SET UP. * * CALLS MAKEFET (INTERNAL) (STANDALONE ONLY). * MAKEFET (EXTERNAL) (SINGLE-EDITOR ONLY). *IF UNDEF,CRM * VDTLOF$ (SINGLE EDITOR OR STANDALONE). *ELSE * VDTOPN$ (CRM STANDALONE ONLY). *ENDIF * * NOTE CURRENTLY A NO-OP FOR MULTI-EDITOR. # # START OF SEQUENCE CONDITIONALLY PRODUCED BY MODIFY UTILITY # *IF UNDEF EDITOR DEF INTERACT #TRUE#; # INTERACTIVE TERMINALS # PROC MAKEFET(FET,NAME,BUFFER,LENGTH); # TITLE MAKEFET - MAKE A FET. # BEGIN # MAKEFET # # ** MAKEFET - MAKE A FET. * * *MAKEFET* SETS UP THE FET AND INITIALIZES IT. * * PROC MAKEFET(FET,NAME,BUFFER,LENGTH) * * ENTRY NAME - FET NAME. * BUFFER - FIRST ADDRESS. * LENGTH - FET LENGTH. * * EXIT FET INITIALIZED. # ARRAY FET [0:0] S(5); BEGIN # ARRAY FET # ITEM FETNAME C(00,00,07); # FET NAME # ITEM FETCODE U(00,42,18); # FET STATUS CODES # ITEM FETFIRST I(01,00,60); # FIRST ADDRESS # ITEM FETIN I(02,00,60); # IN ADDRESS # ITEM FETOUT I(03,00,60); # OUT ADDRESS # ITEM FETLIMIT I(04,00,60); # LIMIT ADDRESS # END # ARRAY FET # ITEM NAME C(07); # FET NAME # ARRAY BUFFER [0:0] P(1);; # FIRST ADDRESS # ITEM LENGTH I; # FET LENGTH # ITEM TMP1 I; # TEMPORARY STORAGE # FETNAME=NAME; FOR TMP1=0 STEP 1 UNTIL 6 DO BEGIN IF CFETNAME EQ " " THEN CFETNAME=0; END FETCODE=1; FETFIRST=LOC(BUFFER); FETIN=FETFIRST; FETOUT=FETFIRST; FETLIMIT=FETFIRST+LENGTH; END # MAKEFET # *ENDIF # END OF MODIFY CONDITIONAL FOR MAKEFET # # START OF MAIN-LINE CODE FOR VDTOPN # CONTROL IFEQ SINGLE,1; MAKEFET(TTYI,INPTNAM,TTYIBF,TTYIBUFSIZ); # START OF MODIFY CONDITIONAL FOR TERMINAL OUTPUT. # *IF UNDEF,CRM MAKEFET(TTYO,OUTPNAM,TTYOBF,TTYOBUFSIZ); IF INTERACT THEN BEGIN B<12,18>LISTFETPTR=LOC(FETLIST); FETLSTNAM=TTYONM; FETLSTLOC=LOC(TTYO); TTYOFB=TRUE; VDTLOF$(LISTFETPTR); # SETLOF MACRO # END *ELSE VDTOPN$(LISTFETPTR); # OPEN CRM OUTPUT FILE # P=LISTFETPTR; # SET BASED ARRAY ADDRESS # *ENDIF # END OF MODIFY CONDITIONAL FOR TERMINAL OUTPUT. # CONTROL FI; IOEND # VDTOPN # *IF DEF,DEBUG CONTROL EJECT; PROC VDTDMP$; # TITLE VDTDMP$ - DUMP OUTPUT DATA TO XXXDUMP. # BEGIN # VDTDMP$ # # ** VDTDMP$ - DUMP OUTPUT DATA TO XXXDUMP. * * THIS PROCEDURE DUMPS THE CURRENT CONTENTS OF THE OUPUT FET TO * THE LOCAL FILE *XXXDUMP* OR DEBUGGING ANALYSIS. * * PROC VDTDMP$. * * EXIT DATA DUMPED TO XXXDUMP. * * CALLS VDTWRR$. # ARRAY XXXDUMP [0:0] P(5); BEGIN ITEM DUMPLFN U(00,00,60) = [O"3030 3004 2515 2000 0001"]; ITEM DUMPFT U(01,42,18); ITEM DUMPIN U(02,42,18); ITEM DUMPOT U(03,42,18); ITEM DUMPLM U(04,42,18); END DUMPFT = TTYOFT; # SET FET POINTERS # DUMPIN = TTYOIN; DUMPOT = TTYOOT; DUMPIN = TTYOLM; VDTWRR$(XXXDUMP,1); # DUMP BUFFER # END # VDTDMP$ # *ENDIF END # TERMIO # TERM