prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/07/88)
Here is the Runoff to LaTeX converter -- 5 parts #rno_tex.1_of_5
prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/07/88)
#rno_tex.2_of_5
prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/07/88)
#rno_tex.3_of_5
prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/07/88)
#rno_tex.4_of_5
prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/07/88)
#rno_tex.5_of_5
prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/12/88)
Sorry about the previous send, I am still learning this mailer. I'll try again with a different method. ...................... Cut between dotted lines and save. ..................... $!............................................................................. $! VAX/VMS archive file created by VMS_SHARE V06.00 26-May-1988. $! $! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from $! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au). $! $! To unpack, simply save, concatinate all parts into one file and $! execute (@) that file. $! $! This archive was created by user EDGECOMBE $! on 6-APR-1866 20:07:23.76. $! $! ATTENTION: To keep each article below 62 blocks (31744 bytes), this $! program has been transmitted in 5 parts. You should $! concatenate ALL parts to ONE file and execute (@) that file. $! $! It contains the following 18 files: $! ARGOPS.PAS $! BASICFILEOPS.PAS $! COMPILE_RNOTOTEX.COM $! CONVERSION.PAS $! DSROPS.PAS $! FLAGOPS.PAS $! GETCLI.FOR $! INIOPS.PAS $! LATEXOPS.PAS $! LINK_RNOTOTEX.COM $! RNOTOTEX.CLD $! RNOTOTEX.PAS $! RNOTOTEX.RNH $! RNOTOTEX_GUIDE.TEX $! SCREENHANDLERS.PAS $! SETUP.COM $! TREEANDLISTOPS.PAS $! UTILITYOPS.PAS $! $!============================================================================== $ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL ) $ VERSION = F$GETSYI( "VERSION" ) $ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK $ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", - "VMS_SHARE V06.00 26-May-1988 requires VMS V4.4 or higher." $ EXIT 44 $VERSION_OK: $ GOTO START $ $UNPACK_FILE: $ WRITE SYS$OUTPUT "Creating ''FILE_IS'" $ DEFINE/USER_MODE SYS$OUTPUT NL: $ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION - VMS_SHARE_DUMMY.DUMMY b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) ) ; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE , b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors := 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN & "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION ( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK( NONE ) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 ); IF s_x = "+" THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip <> 0 THEN s_x := "" ; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF; ENDIF ; IF s_x = "-" THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ); IF r_skip < > 0 THEN s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE ) ; r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION ( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ); MOVE_VERTICAL( 1 ) ; MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE ( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF ; IF s_x = "V" THEN s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE ; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1; MOVE_VERTICAL ( 1 ); ENDIF; IF s_x = "X" THEN s_x := ""; IF i_append_line < > 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF ; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> "" THEN i_errors := i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT ( "The following line could not be unpacked properly:" ); SPLIT_LINE ; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH( "`" , FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1 ) ; IF CURRENT_CHARACTER = "`" THEN MOVE_HORIZONTAL( 1 ); ELSE COPY_TEXT( ASCII ( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDIF; ENDLOOP; IF i_errors = 0 THEN SET ( NO_WRITE, b_errors, ON ); ELSE POSITION( BEGINNING_OF( b_errors ) ) ; COPY_TEXT( FAO( "The following !UL errors were detected while unpacking !AS" , i_errors, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors , "SYS$COMMAND" ); ENDIF; EXIT; $ DELETE VMS_SHARE_DUMMY.DUMMY;* $ CHECKSUM 'FILE_IS $ WRITE SYS$OUTPUT " CHECKSUM ", - F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!,passed." ) $ RETURN $ $START: $ FILE_IS = "ARGOPS.PAS" $ CHECKSUM_IS = 1669226973 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X{`009MODULE FOR LIST AND TREE OPERATIONS ARGUMENTS } X{`009RANDALL VENHOLA JULY 8, 1987 } X X X[INHERIT('SCREENHANDLERS','UTILITYOPS')] X XMODULE ARGOPS; X XCONST X X maxchars = 31; {# of chars in arg literal } X maxargsinarray = 15; {for conversion to an array of args} X indexofunknowntexcommand = 0; X XTYPE X X pckstr = VARYING [ maxchars ] of char; X X comparisons = (notvalid, lessthan, equal, greaterthan); X X setofcomparisons = set of comparisons; X X argtype = ( dsrverb, int, signedint, stylespecifier, X`009 textpckstr, character, quotedpckstr, nulltype); X X setofargtype = set of argtype; X X argument = record X`009 source : pckstr; X`009 isgeneralization : boolean; X `009 texindex : integer; X class : setofargtype X`009 end; X X argarray = array[1..maxargsinarray] of argument; X X X X X[GLOBAL] FUNCTION argliteral( arg : argument; smooth : boolean ) : pckstr; X Xvar X s : pckstr; X i,j, firstchar, lastchar : integer; X ch : char; X X procedure findfirstchar( s : pckstr; var firstchar : integer); X begin X firstchar := 1; X while (firstchar < s.length) and (s.body[firstchar] <= blank) do X firstchar := firstchar + 1 X end; X X procedure findlastchar( s : pckstr; var lastchar : integer ); X begin X lastchar := s.length; X while (lastchar > 1) and (s.body[lastchar] <= blank) do X lastchar := lastchar - 1 X end; X Xbegin X if smooth then X begin X findfirstchar( arg.source, firstchar); X findlastchar( arg.source, lastchar); X j := 0; X for i := firstchar to lastchar do X begin X ch := arg.source.body[i]; X if ch < blank then ch := blank; X if ch in ['a'..'z'] then ch := chr(ord(ch) - ord(blank)); X j := j + 1; X s.body[j] := ch X end; X if (j = 1) and (s.body[1] = blank) then X s.length := 0 X else X s.length := j X end X else X s := arg.source; X argliteral := s Xend; X X X X X X[GLOBAL] FUNCTION pckstrisgeneralization( s : pckstr ) : boolean; X label X routineexit; X var X flag : boolean; X begin X flag := false; X if s = '[N]' then X begin X flag := true; X goto routineexit X end; X if s = '[C]' then X begin X flag := true; X goto routineexit X end; X if s = '[Y]' then X begin X flag := true; X goto routineexit X end; X if s = '[T]' then X begin X flag := true; X goto routineexit X end; X if s = '[Q]' then X begin X flag := true; X goto routineexit X end; X routineexit : pckstrisgeneralization := flag Xend; X X X X X[GLOBAL] FUNCTION argisgeneralization( arg : argument ) : boolean; Xbegin X argisgeneralization := arg.isgeneralization Xend; X X X X V[GLOBAL] FUNCTION textualmatch( arg1, arg2 : argument) : boolean; X Xbegin X textualmatch := false; X if (arg1.source = '[T]') and (textpckstr in arg2.class) then X`009textualmatch := true X else X if (arg2.source = '[T]') and (textpckstr in arg1.class) then X`009textualmatch := true Xend; X X X X X[GLOBAL] FUNCTION compareargs( leftarg, rightarg : argument ) : comparisons; Xlabel X routineexit; Xvar X lefts, rights : pckstr; X equalpckstrs : boolean; X comp : comparisons; X X procedure greaterorlessthancompare; X begin X if lefts < rights then X comp := lessthan X else X comp := greaterthan X end; X X procedure checktexindex; X begin X if (leftarg.texindex = indexofunknowntexcommand) or X (rightarg.texindex = indexofunknowntexcommand) then X comp := equal X else X`009if leftarg.texindex = rightarg.texindex then X`009 comp := equal X`009else X greaterorlessthancompare X end; X Xbegin X if textualmatch( leftarg, rightarg) then X begin X comp := equal; X goto routineexit X end; X if (leftarg.class = [nulltype]) or (rightarg.class = [nulltype]) then X begin X comp := equal; X goto routineexit X end; X lefts := argliteral(leftarg, TRUE); X rights := argliteral(rightarg, TRUE); X equalpckstrs := (lefts = rights); X comp := notvalid; X if leftarg.class * rightarg.class <> [] then X begin X if equalpckstrs then X comp := equal X else X if (leftarg.isgeneralization) or (rightarg.isgeneralization) then X checktexindex X else X greaterorlessthancompare X end X else X greaterorlessthancompare; X routineexit : compareargs := comp Xend; X X X X X[GLOBAL] FUNCTION argtexindex( arg : argument ) : integer; Xbegin X argtexindex := arg.texindex Xend; X X X X X[GLOBAL] FUNCTION argclass( arg : argument ) : setofargtype; Xbegin X argclass := arg.class Xend; X X X X X[GLOBAL] PROCEDURE initarg( var arg : argument; classification : setofargtype; X lit : pckstr; index : integer; general : boolean ); Xbegin X arg.source := lit; X arg.class := classification; X arg.texindex := index; X arg.isgeneralization := general Xend; X X X X V[GLOBAL] PROCEDURE reassignargclass( var arg : argument; newclass : setofargtyp Xe); Xbegin X arg.class := newclass Xend; X X X X X[GLOBAL] PROCEDURE reassignargtexindex( var arg : argument; newindex:integer); Xbegin X arg.texindex := newindex Xend; X X X V[GLOBAL] PROCEDURE reassignarggeneralization( var arg : argument;general:boolea Xn); Xbegin X arg.isgeneralization := general Xend; X X X X X[GLOBAL] PROCEDURE appendchartoarg( ch : char; var arg : argument ); Xbegin X if arg.source.length = maxchars then X warningmessage('appendchartoarg','argument too long') X else X begin X arg.source.length := arg.source.length + 1; X arg.source.body[arg.source.length] := ch X end Xend; X X X X V[GLOBAL] PROCEDURE extractintegerfromargument( arg : argument; var successful : X boolean; X`009 var int : integer; X`009 var signed : boolean ); Xvar X s : pckstr; Xbegin X s := argliteral( arg, TRUE); X readv( s, int, error := continue ); X if statusv <> 0 then X successful := false X else X begin X successful := true; X signed := (s.body[1] = '+') or (s.body[1] = '-') X end Xend; X X X XEND. X $ GOSUB UNPACK_FILE $ FILE_IS = "BASICFILEOPS.PAS" $ CHECKSUM_IS = 172942151 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X[INHERIT('UTILITYOPS','SCREENHANDLERS','ARGOPS')] X XMODULE BASICFILEOPS; X XCONST X X maxfidchars = 255; X ndatetimechars = 11; X programversion = 'CVF02B'; X inifilename = 'INIT$RNOTOTEX'; X logfilename = 'RNOTOTEX.LOG'; X X XTYPE X Xfidtype = VARYING[maxfidchars] of char; X Xdatetimetype = packed array[1..ndatetimechars] of char; X X XVAR X inputcontainstexcommands : [EXTERNAL] boolean; X totallines, totalchars : [EXTERNAL] integer; X LOG`009 : [EXTERNAL] text; X X X X X[GLOBAL] PROCEDURE noconversion; Xbegin X writeln(log,'[no conversion performed]') Xend; X X X X X[GLOBAL] PROCEDURE greetuser ( var d, t : datetimetype ); Xbegin X date( d ); X time( t ); X clearscreen; X ttywritestring('RNOTOTEX '); X ttywritestring(programversion); X ttywritestring(' RUNOFF TO TEX CONVERSION '); X ttywritestring( d ); X ttywritestring( t ); X ttywriteln; X ttywriteln; X ttywriteln Xend; X X X X X V[GLOBAL] PROCEDURE openinputfile( fid : fidtype; var f : text; var openerror : Xboolean ); Xbegin X open( file_variable := f, X file_name := fid, X history := readonly, X default := 'INPUT.RNO', X error := continue ); X if status(f) <> 0 then X openerror := true X else X begin X reset( f ); X openerror := false X end Xend; X X X X X V[GLOBAL] PROCEDURE openoutputfile(fid : fidtype; var f : text; var openerror:bo Xolean); Xbegin X open( file_variable := f, X file_name := fid, X history := new, X default := 'OUTPUT.TEX', X error := continue ); X if status(f) <> 0 then X openerror := true X else X begin X openerror := false; X rewrite(f) X end; Xend; X X X X[GLOBAL] PROCEDURE openinifile ( var f : text ); Xbegin X open( file_variable := f, X file_name := inifilename, X history := readonly, X error := message ); X reset( f ); X ttywriteln; X ttywritestring('Loading INI file ...') Xend; X X X X X[GLOBAL] PROCEDURE openlogfile; { global var LOG : text used } Xbegin X open( file_variable := log, X`009 file_name := logfilename, X`009 history := new, X`009 error := continue ); X rewrite( log ) Xend; X X X X[GLOBAL] PROCEDURE closelogfile; Xbegin X close( file_variable := log, error := continue ) Xend; X X[GLOBAL] PROCEDURE closeinifile( var f : text ); Xbegin X close( file_variable := f, error := continue ); X ttywritestring('complete.'); X ttywriteln; Xend; X X X X X X[GLOBAL] PROCEDURE closefiles( var infile, outfile : text ); X Xbegin X close(file_variable := infile, error := continue); X close(file_variable := outfile, error := continue); X ttywritestring('complete.'); X ttywriteln; X ttywriteln; X ttywriteln; X if totallines = 1 then X ttywritestring(' RNOTOTEX read only one line from the input file.') X else X if totallines = 0 then X ttywritestring(' No end of line was found in the input file.') X else X begin X ttywritestring(' RNOTOTEX processed a total of '); X ttywriteint( totallines ); X ttywritestring(' lines.') X end; X ttywriteln; X if totalchars = 1 then X ttywritestring(' There was only one character in the file.') X else X if totalchars = 0 then X ttywritestring(' No printable characters were found in the file.') X else X begin X ttywritestring(' A total of '); X ttywriteint( totalchars ); X ttywritestring(' characters were read.') X end; X ttywriteln Xend; X X X X X X X[GLOBAL] PROCEDURE putcommentstooutput( var outfile : text; infid : fidtype; X`009 d, t : datetimetype ); Xbegin X writeln(outfile,'% document translated from DEC RUNOFF to LaTeX format'); V writeln(outfile,'% by program RNOTOTEX version ',programversion,' at ',d,bla Xnk,t); X writeln(outfile,'% Source file :',infid); X writeln(log,'[RNOTOTEX.LOG for ',infid,' ]'); X writeln(log,'[Processing at ',d, blank, t,' ]') Xend; X X X X X X[GLOBAL] PROCEDURE userinterface( var inputfid, outputfid : fidtype; X`009 var rno, tex : text ); X Xtype X packedarray = packed array[1..255] of char; X Xvar X openerror : boolean; X slashtex : integer; X X procedure getcli( var ifile, ofile : [class_s] packedarray; X var slashtex : integer ); fortran; Xbegin X getcli( inputfid.body, outputfid.body, slashtex ); X inputfid.length := 75; X outputfid.length := 75; X openinputfile( inputfid, rno, openerror); X if openerror then X warningmessage('openinputfile','Could not open that input file.'); X openoutputfile( outputfid, TEX, openerror); X if openerror then X warningmessage('openoutputfile','Could not open that output file.'); X inputcontainstexcommands := slashtex <> 0 Xend; X X XEND. $ GOSUB UNPACK_FILE $ FILE_IS = "COMPILE_RNOTOTEX.COM" $ CHECKSUM_IS = 861748146 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$ IF ("''P1'" .EQS. "") THEN $ P1="PASCAL/OPTIMIZE/NOCHECK" X$ 'P1' SCREENHANDLERS X$ 'P1' UTILITYOPS X$ 'P1' ARGOPS X$ 'P1' BASICFILEOPS X$ 'P1' TREEANDLISTOPS X$ 'P1' FLAGOPS X$ 'P1' LATEXOPS X$ 'P1' INIOPS X$ 'P1' CONVERSION X$ 'P1' DSROPS X$ 'P1' RNOTOTEX X$ FORTRAN GETCLI $ GOSUB UNPACK_FILE $ FILE_IS = "CONVERSION.PAS" $ CHECKSUM_IS = 777150295 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X[INHERIT('UTILITYOPS','ARGOPS','FLAGOPS', X'TREEANDLISTOPS','LATEXOPS')] X XMODULE CONVERSION; X XCONST X maxlists = 8; X maxheaderlevels = 6; X maxlongpckstrchars = 75; XTYPE X Xlongpckstr = VARYING[maxlongpckstrchars] of char; X Xpagesizetype = record X`009 length : integer; X`009 width : integer X`009 end; X Xparagraphdeftype = record X `009 indent : integer; X`009 vertskip : integer; X`009 testpage : integer X`009 end; X Xnumberlisttype = record X`009 listlevel : integer; X`009 valuetoset : integer X`009 end; X Xdisplayelementstype = record X`009 leftchar : char; X`009 style : styletype; X`009 rightchar : char X`009 end; X Xleveltype = record X`009 value : integer; X`009 display : styletype X`009end; X Xheaderleveltype = array[1..maxheaderlevels] of leveltype; X X XVAR X X Xinputcontainstexcommands : [GLOBAL] boolean; X Xtotallines, totalchars : [EXTERNAL] integer; X Xpagesize : [GLOBAL] pagesizetype; X Xnumberpage : [GLOBAL] integer; X Xnumberrunning : [GLOBAL] integer; X Xdisplaynumber : [GLOBAL] styletype; X Xcapitalizetext, lowercasetext : [GLOBAL] boolean; X Xleftmargin : [GLOBAL] integer; X Xrightmargin : [GLOBAL] integer; X Xfill : [GLOBAL] boolean; X Xstartnofillagain : [GLOBAL] boolean; X Xjustify : [GLOBAL] boolean; X Xspacing : [GLOBAL] integer; X Xindent : [GLOBAL] integer; X Xcentering : [GLOBAL] boolean; X Xflushright : [GLOBAL] boolean; X Xminipageactive : [GLOBAL] boolean; X Xinmarginpar : [GLOBAL] boolean; X Xinfootnote : [GLOBAL] boolean; X Xparagraphdef : [GLOBAL] paragraphdeftype; X Xnumberlist : [GLOBAL] numberlisttype; X Xdisplayelements : [GLOBAL] displayelementstype; X Xnumberchapter : [GLOBAL] integer; X Xdisplaychapter : [GLOBAL] styletype; X Xheaderlevel : [GLOBAL] headerleveltype; X Xnestlevel : [GLOBAL] integer; X Xnumberappendix : [GLOBAL] integer; X Xdisplayappendix : [GLOBAL] styletype; X Xwritetexcommands : [GLOBAL] boolean; X Xflagtable : [GLOBAL] flagtabletype; X Xinliteral : [GLOBAL] boolean; X Xtitle, subtitle : [GLOBAL] argarray; X Xdatestring : [GLOBAL] pckstr; X Xpagestyle : [GLOBAL] pagestyletype; X Xliststate : [GLOBAL] array[1..maxlists] of liststatetype; X Xnumberofelements : [GLOBAL] array[1..maxlists] of integer; X Xoutputfirstitem : [GLOBAL] array[1..maxlists] of boolean; X Xlistnestlevel : [GLOBAL] integer; X Xnofillbeforelist : [GLOBAL] boolean; X XLOG : [EXTERNAL] text; X Xunderlineactive : [GLOBAL] enhancmentstates; X Xboldactive : [GLOBAL] enhancmentstates; X X X X[GLOBAL] FUNCTION quotedcharacter( arg : argument ) : char; Xvar X s : pckstr; Xbegin X s := argliteral( arg, true ); X if length(s) = 1 then X quotedcharacter := s[1] X else X if length(s) = 3 then X`009quotedcharacter := s[2] X else X`009quotedcharacter := blank Xend; X X X X[HIDDEN] PROCEDURE noconversion; EXTERN; X X X X X X X X[GLOBAL] PROCEDURE blankifypckstr( var s : pckstr ); Xbegin X s.body := blank; X s.length := 0 Xend; X X X X[GLOBAL] PROCEDURE initglobalvars; Xvar X i : integer; Xbegin X pagesize.length := 58; X pagesize.width := 60; X numberpage := 1; X numberrunning := 1; X displaynumber := decimal; X capitalizetext := false; X lowercasetext := false; X leftmargin := 0; X rightmargin := 60; X fill := true; X startnofillagain := false; X justify := true; X centering := false; X flushright := false; X minipageactive := false; X indent := 5; X spacing := 1; X paragraphdef.indent := 5; X paragraphdef.vertskip := 2; X paragraphdef.testpage := 5; X numberlist.listlevel := 1; X numberlist.valuetoset := 0; X nofillbeforelist := false; X displayelements.leftchar := blank; X displayelements.style := decimal; X displayelements.rightchar := blank; X numberchapter := 0; X numberappendix := 0; X displaychapter := decimal; X for i := 1 to maxheaderlevels do X begin X headerlevel[i].value := 0; X headerlevel[i].display := decimal X end; X nestlevel := 1; X inliteral := false; X makenullarray( title ); X makenullarray( subtitle ); X pagestyle := myheadings; X blankifypckstr( datestring ); X for i := 1 to maxlists do X begin X liststate[i] := nostate; X numberofelements[i] := 0; X outputfirstitem[i] := false X end; X listnestlevel := 0; X underlineactive := notenhanced; X boldactive := notenhanced Xend; X X X X X[GLOBAL] PROCEDURE loglist( list : arglist; index : integer); Xvar X l : arglist; Xbegin X writeln(log); X writeln(log,'INDEX >',index:1,' LENGTH >',arglistlength(list):1); X l := list; X write(log,'RUNOFF >'); X while l <> nulllist do X begin X write(log, argliteral(firstarg(l), false), blank); X l := nextinlist(l) X end; X writeln(log); X write(log,'TEX >') Xend; X X X X X[GLOBAL] PROCEDURE dumpthelist( var outfile : text; list : arglist ); Xbegin X if list <> nulllist then X begin X texwritearg(outfile, firstarg(list)); X dumpthelist(outfile, nextinlist(list)) X end Xend; X X X X X[GLOBAL] PROCEDURE newintvalue( arg : argument; var current : integer; X `009 var modified : parameterchangestates; X`009 var intextracted : integer ); Xvar X signed : boolean; X successful : boolean; Xbegin X modified := nochange; X extractintegerfromargument(arg, successful, intextracted, signed ); X if successful then X begin X if signed then X begin X modified := altered; X current := intextracted + current X end X else X begin X modified := assigned; X current := intextracted X end X end Xend; X X X X X[GLOBAL] PROCEDURE newcountparameter( arg : argument; var current : integer; X`009 var modified : parameterchangestates; X var countervalueextracted : integer; X`009 var class : countparametertype); Xbegin X modified := nochange Xend; X X V[GLOBAL] PROCEDURE newstyleparameter( arg : argument; var current : styletype ) X; Xvar X s : styletype; Xbegin X s := isastylespecifier( arg ); X if s <> undetermined then X current := s Xend; X X X X X[LOCAL] FUNCTION m( i : integer ) : integer; Xbegin X if i < 2 then X m := 1 X else X m := i - 1 Xend; X X X[LOCAL] PROCEDURE C( var f : text ); Xbegin X writeln(f,'}'); X writeln(log,'}') Xend; X X X X X[GLOBAL] PROCEDURE flagchange( f : dsrflagclasses; arg : argument ); Xvar X ch : char; Xbegin X turnflagon( f ); X ch := quotedcharacter( arg ); X if ch <> blank then X changeflagchar(f, ch) Xend; X X X X X[GLOBAL] PROCEDURE puttexcommand( var outfile : text; index : integer; X`009 dsrlist : arglist; X`009 var writeanothertexcommand : integer ); X Xlabel X routineexit; Xconst X charwidth = true; X charheight = false; Xvar X arg : argarray; X i, j, n : integer; X modified : parameterchangestates; X extractedvalue, skip, startindex : integer; X class : countparametertype; X f : dsrflagclasses; X q : char; X startedwithfill : boolean; X Xbegin X Xif (index < 1) or (index > 130) then goto routineexit; X Xwriteanothertexcommand := indexofunknowntexcommand; Xloglist( dsrlist, index ); Xn := arglistlength( dsrlist ); Xlisttoarray( dsrlist, index, arg, maxargsinarray); Xstartedwithfill := fill; Xstopunderline( outfile ); Xstopbold( outfile ); X X{ X n - number of arguments supplied with the DSR command X m(n-1) - one less than that number, unless n < 2 X m(n-2) - two less than the number of arguments, unless < 3 X etc X X arg[i] - the ith input dsr argument; e.g. four args could be : X X 1 2 3 4 X PAGE SIZE 10, 20 } X X X Xcase index of X X {***** PAGE SIZE *****} X 1 : begin X`009newintvalue(arg[n], pagesize.width, modified, extractedvalue); X`009newintvalue(arg[m(n)], pagesize.length, modified, extractedvalue); V adjustlength(outfile, modified, pagesize.width, extractedvalue,charwidt Xh,'textwidth'); V`009adjustlength(outfile, modified, pagesize.length, extractedvalue,charheight, X'textheight') X end; X X {***** HEADERS OFF *****} X 2 : adjustpagestyle(outfile, plain); X X {***** HEADERS ON ***** } X 3 : adjustpagestyle(outfile, headings); X X {***** HEADERS UPPER ***** } X 4 : noconversion; X X {***** HEADERS LOWER ***** } X 5 : noconversion; X X {***** HEADERS MIXED ***** } X 6 : noconversion; X X {***** ENABLE WRITING OF DATE *****} X 7 : begin X datestring := '\today'; X if pagestyle = myheadings then X adjustpagestyle(outfile, myheadings) X else X`009 noconversion X end; X X { ***** DISABLE WRITING OF DATE ***** } X 8 : begin X blankifypckstr( datestring ); X if pagestyle = myheadings then X adjustpagestyle(outfile, myheadings ) X else X noconversion X end; X`009 X { ***** LAYOUT ***** } X 9 : noconversion; X X { ***** NO NUMBER ***** } X 10 : adjustpagestyle(outfile, empty); X X { ***** NUMBER PAGE ***** } X 11 : begin X`009newcountparameter(arg[n], numberpage, modified, extractedvalue,class); X adjustcounter(outfile, modified, numberpage, extractedvalue, 'page') X end; X X { ***** NUMBER RUNNING ***** } X 12 : begin X newintvalue(arg[n], numberrunning, modified, extractedvalue); X adjustcounter(outfile, modified, numberrunning, extractedvalue,'page') X end; X X { ***** DISPLAY NUMBER ***** } X 13 : begin X newstyleparameter(arg[n], displaynumber); X`009adjuststyle(outfile, displaynumber, 'page') X end; X X { ***** NO PAGING ***** } X 14 : noconversion; X X { ***** PAGING ***** } X 15 : noconversion; X X { ***** BEGIN SUBPAGE ***** } X 16 : begin X if not minipageactive then X`009begin X`009 minipageactive := true; X if not startedwithfill then X`009 begin X`009 endnofill( outfile ); X`009 startnofillagain := true X`009 end; X`009 writeln(outfile,'\begin{minipage}'); X writeln( log,'\begin{minipage}'); X`009 if not startedwithfill then X`009 beginnofill( outfile ) X end X`009else X`009begin X`009 writeln(outfile,'% RNOTOTEX - minipage already active'); X`009 writeln( log,'% RNOTOTEX - minipage already active') X`009end X end; X X { ***** END SUBPAGE ***** } X 17 : begin X if minipageactive then X`009begin X if not fill then X`009 endnofill( outfile ); X writeln(outfile,'\end{minipage}'); X writeln( log,'\end{minipage}'); X if startnofillagain then X`009 begin X`009 startnofillagain := false; X`009 beginnofill( outfile ) X end X end X else -+-+-+-+-+ End of part 1 +-+-+-+-+-
prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/12/88)
Sorry about the previous send, I am still learning this mailer. I'll try again with a different method. +-+-+-+ Beginning of part 2 +-+-+-+ X begin X`009 writeln(outfile,'% RNOTOTEX - minipage not active'); X`009 writeln( log,'% RNOTOTEX - minipage not active') X `009end; X minipageactive := false X end; X X { ***** NUMBER SUBPAGE ***** } X 18 : noconversion; X X X { ***** DISPLAY SUBPAGE ***** } X 19 : noconversion; X X { ***** FIRST TITLE ***** } X 20 : noconversion; X X { ***** TITLE ***** } X 21 : begin X for i := 2 to maxargsinarray do X`009 title[i-1] := arg[i]; X if pagestyle = myheadings then X adjustpagestyle(outfile, myheadings) X else X`009 noconversion X end; X X { ***** SUBTITLE ***** } X 22 : begin X for i := 2 to maxargsinarray do X`009 subtitle[i-1] := arg[i]; X if pagestyle = myheadings then X`009 adjustpagestyle(outfile, myheadings) X else X`009 noconversion X end; X X { ***** NO SUBTITLE ***** } X 23 : begin X makenullarray( subtitle ); X if pagestyle = myheadings then X adjustpagestyle(outfile, myheadings) X else X`009 noconversion X end; X X { ***** NO AUTOSUBTITLE ***** } X 24 : begin X makenullarray( subtitle ); X if pagestyle = myheadings then X adjustpagestyle(outfile, plain) X else X noconversion X end; X X { ***** AUTOSUBTITLE ***** } X 25 : adjustpagestyle(outfile, headings); X X X { ***** UPPERCASE ***** } X 26 : begin X capitalizetext := true; X lowercasetext := false X end; X X { ***** LOWERCASE ***** } X 27 : begin X`009capitalizetext := false; X lowercasetext := true X end; X X { ***** LEFT MARGIN ***** } X 28 : begin X newintvalue( arg[n], leftmargin, modified, extractedvalue); X`009 noconversion X end; X X { ***** RIGHT MARGIN ***** } X 29 : begin X newintvalue( arg[n], rightmargin, modified, extractedvalue); X noconversion X end; X X { ***** NO FILL ***** } X 30 : beginnofill( outfile ); X X { ***** FILL ***** } X 31 : endnofill( outfile ); X X { ***** NO JUSTIFY ***** } X 32 : begin X writeln(outfile,'\sloppy % - begin no justify'); X writeln( log,'\sloppy % - begin no justify'); X justify := false X end; X X { ***** JUSTIFY ***** } X 33 : begin X writeln(outfile,'\fussy % - turn justification on'); X writeln( log,'\fussy % - turn justification on'); X justify := true X end; X X { ***** BREAK ***** } X 34 : begin X if fill then X`009 begin X`009 writeln(outfile,'\hfil\linebreak'); X`009 writeln( log,'\hfil\linebreak') X`009 end X else X`009 begin X`009 writeln(outfile,'% RNOTOTEX - forced break'); X`009 writeln( log,'% RNOTOTEX - forced break') X`009 end X end; X X { ***** SPACING ***** } X 35 : begin X newintvalue(arg[n], spacing, modified, extractedvalue ); V adjustlength(outfile, modified, spacing, extractedvalue, charheight,' Xbaselineskip') X end; X X { ***** SKIP ***** } X 36 : begin X if n = 1 then X`009 begin X`009 if (spacing > 0) and (spacing < 4) then X`009 case spacing of X`009 1 : begin X`009 writeln(outfile,'\smallskip'); X`009 writeln( log,'\smallskip') X`009 end; X`009 2 : begin X`009 writeln(outfile,'\medskip'); X`009 writeln( log,'\medskip') X`009 end; X`009 3 : begin X`009 writeln(outfile,'\bigskip'); X`009 writeln( log,'\bigskip') X`009 end X`009 end X`009 else X`009 begin X`009 writeln(outfile,'\smallskip % - default skip amount'); X`009 writeln( log,'\smallskip % - default skip amount') X`009 end X end X else X`009 begin X skip := 1; X newintvalue(arg[n], skip, modified, extractedvalue ); X extractedvalue := extractedvalue * spacing; X`009 write(outfile,'\vspace{'); X write( log,'\vspace{'); X writecharheight(outfile, extractedvalue); X c(outfile) X end X end; X X { ***** BLANK ***** } X 37 : begin X if n = 1 then X`009 begin X`009 writeln(outfile,'\smallskip'); X writeln( log,'\smallskip') X end X else X begin X`009 skip := 1; X newintvalue(arg[n], skip, modified, extractedvalue ); X write(outfile,'\vspace{'); X write( log,'\vspace{'); X`009 writecharheight(outfile, extractedvalue); X c(outfile) X end X end; X X { ***** PAGE ***** } X 38 : begin V`009 writeln(outfile,'\pagebreak[0] \typeout{runoff page break encountered, may X be ignored}'); X`009 writeln( log,'\pagebreak[0]') X end; X X { ***** TEST PAGE ***** } X 39 : noconversion; X X { ***** CENTRE ***** } X 40 : begin X if not centering then X`009 begin X centering := true; X`009 if not fill then X`009 begin X`009 startnofillagain := true; X`009 endnofill( outfile ) X end; X`009 writeln(outfile,'\begin{centering}'); X`009 writeln( log,'\begin{centering}'); X writeanothertexcommand := 40 X`009 end X`009 else X`009 begin X`009 writeln(outfile,'% RNOTOTEX - centering already active'); X`009 writeln( log,'% RNOTOTEX - centering already active') X`009 end X end; X X { ***** TAB STOPS ***** } X 41 : noconversion; X X { ***** INDENT ***** } X 42 : begin X indent := 5; X`009 newintvalue(arg[n], indent, modified, extractedvalue); X if modified = nochange then X begin X`009 write(outfile,'\indent '); X`009 write( log,'\indent ') X end X else X begin X write(outfile,'\hspace*{'); X write( log,'\hspace*{'); X writecharwidth(outfile, indent); X write(outfile,'} '); X writeln(log,'}') X end X end; X X { ***** LEFT ***** } X 43 : begin X indent := 5; X`009 newintvalue(arg[n], indent, modified, extractedvalue); X if (modified = nochange) or (n = 1) then X begin X`009 write(outfile,'\indent '); X`009 write( log,'\indent ') X`009 end X else X begin X write(outfile,'\hspace*{'); X write( log,'\hspace*{'); X writecharwidth(outfile, indent); X write(outfile,'} '); X`009 writeln(log,'}') X end X end; X X { ***** RIGHT ***** } X 44 : begin X if not flushright then X`009 begin X if not fill then X begin X`009 startnofillagain := true; X`009 endnofill( outfile ) X`009 end; X`009 flushright:= true; X`009 writeln(outfile,'\begin{flushright}'); X`009 writeln( log,'\begin{flushright}'); X writeanothertexcommand := 44 X`009 end X`009 else X`009 begin X`009 writeln(outfile,'% RNOTOTEX - flush right already active'); X`009 writeln( log,'% RNOTOTEX - flush right already active') X`009 end X end; X X { ***** NO PERIOD ***** } X 45 : begin X writeln(outfile,'\frenchspacing'); X writeln( log,'\frenchspacing') X end; X X { ***** PERIOD ***** } X 46 : begin X`009 writeln(outfile,'\nofrenchspacing'); X`009 writeln( log,'\nofrenchspacing') X end; X X { ***** NO SPACE ***** } X 47 : noconversion; X X { ***** PARAGRAPH ***** } X 48 : begin X`009if n > 1 then X `009begin X`009 newintvalue(arg[2], paragraphdef.indent, modified, extractedvalue); X `009 newintvalue(arg[3], paragraphdef.vertskip, modified, extractedvalue); X`009 newintvalue(arg[4], paragraphdef.testpage, modified, extractedvalue) X end; X`009writeln(outfile,'\par'); X`009writeln( log,'\par') X end; X X { ***** SET PARAGRAPH ***** } X 49 : begin X`009 newintvalue(arg[m(n-2)], paragraphdef.indent, modified, extractedvalue); V `009 adjustlength(outfile, modified, paragraphdef.indent, extractedvalue,charw Xidth,'parindent'); V `009 newintvalue(arg[m(n-1)], paragraphdef.vertskip, modified, extractedvalue) X; V`009 adjustlength(outfile, modified, paragraphdef.vertskip, extractedvalue,char Xheight,'parskip'); X`009 newintvalue(arg[m(n)], paragraphdef.testpage, modified, extractedvalue) X end; X X { ***** AUTOPARAGRAPH ***** } X 50 : noconversion; X X { ***** NO AUTOPARAGRAPH ***** } X 51 : noconversion; X X { ***** AUTOTABLE ***** } X 52 : noconversion; X X { ***** NO AUTOTABLE ***** } X 53 : noconversion; X X { ***** DISABLE UNDERLINING ***** } X 54 : turnflagoff( underline ); X V { ***** ENABLE UNDERLINING ***** } X X 55 : turnflagon( underline ); X X { ***** NO HYNPHENATION ***** } X 56 : turnflagoff( hyphenate ); X X { ***** HYPENATION ***** } X 57 : turnflagon( hyphenate ); X X { ***** DISABLE BOLDING ***** } X 58 : turnflagoff( bold ); X X { ***** ENABLE BOLDING ***** } X 59 : turnflagon( bold ); X X { ***** DISABLE OVERSTRIKE ***** } X 60 : turnflagoff( overstrike ); X X { ***** ENABLE OVERSTRIKE ***** } X 61 : turnflagon( overstrike ); X X { ***** ENABLE BAR ***** } X 62 : noconversion; X X { ***** BEGIN BAR ***** } X 63 : noconversion; X X { ***** END BAR ***** } X 64 : noconversion; X X { ***** DISABLE BAR ***** } X 65 : noconversion; X X { ***** FIGURE ***** } X 66 : begin X`009 skip := 1; X`009 newintvalue(arg[n], skip, modified, extractedvalue); X`009 writeln(outfile,'\begin{figure}'); X write(outfile,'\vspace{'); X`009 writeln( log,'\begin{figure}'); X write( log,'\vspace{'); X writecharheight(outfile, skip); X c(outfile); X`009 writeln(outfile,'\caption{Another Figure}'); X writeln(outfile,'\end{figure}'); X`009 writeln( log,'\caption{Another Figure}'); X writeln( log,'\end{figure}') X`009end; X X { ***** FIGURE DEFFERED ***** } X 67 : begin X`009 skip := 1; X`009 newintvalue(arg[n], skip, modified, extractedvalue); X`009 writeln(outfile,'\begin{figure}'); X`009 writeln( log,'\begin{figure}'); X write(outfile,'\vspace{'); X write( log,'\vspace{'); X writecharheight(outfile, skip); X c(outfile); X`009 writeln(outfile,'\caption{Another Figure}'); X writeln(outfile,'\end{figure}'); X`009 writeln( log,'\caption{Another Figure}'); X writeln( log,'\end{figure}') X`009end; X X { ***** LITERAL ***** } X 68 : begin X`009 if not inliteral then X`009 begin X`009 if not fill then X`009 begin X`009 startnofillagain := true; X`009 endnofill( outfile ) X`009 end; X`009 inliteral := true; X`009 writeln(outfile,'\begin{verbatim}'); X writeln( log,'\begin{verbatim}') X`009 end X`009 else X`009 begin X`009 writeln(outfile,'% RNOTOTEX - literal already active'); X`009 writeln( log,'% RNOTOTEX - literal already active') X`009 end X`009end;`009 X X { ***** END LITERAL ***** } X 69 : begin X`009 if inliteral then X`009 begin X`009 writeln(outfile,'\end{verbatim}'); X`009 writeln( log,'\end{verbatim}'); X`009 inliteral := false; X`009 if startnofillagain then X`009 begin X`009 startnofillagain := false; X`009 beginnofill( outfile ) X`009 end X end X`009 else X`009 begin X`009 writeln(outfile,'% RNOTOTEX - end literal not after literal'); X`009 writeln( log,'% RNOTOTEX - end literal not after literal') X`009 end X`009end; X X { ***** REPEAT ***** } X 70 : begin X skip := 1; X`009 newintvalue(arg[2], skip, modified, extractedvalue); X`009 q := quotedcharacter( arg[3] ); X for i := 1 to skip do X`009 begin X`009 texwrite(outfile, q); X`009 texwrite( log, q) X`009 end X end; X X { ***** LIST ***** } X 71 : begin X`009 if (not fill) and (listnestlevel = 0) then X`009 begin X`009 nofillbeforelist := true; X`009 endnofill( outfile ) X`009 end; X listnestlevel := listnestlevel + 1; X numberofelements[listnestlevel] := 0; X`009 if n = 3 then X`009 begin X`009 q := quotedcharacter( arg[3] ); X`009 writeln(outfile,'\begin{itemize} % list nest ',listnestlevel:1); X`009 writeln( log,'\begin{itemize}'); X`009 liststate[listnestlevel] := itemize; X`009 write(outfile,'\item '); X`009 outputfirstitem[listnestlevel] := true X`009 end X`009 else X`009 begin X`009 writeln(outfile,'\begin{enumerate} % list nest ',listnestlevel:1); X`009 writeln( log,'\begin{enumerate}'); X`009 liststate[listnestlevel] := enumerate; X`009 write(outfile,'\item '); X`009 outputfirstitem[listnestlevel] := true X`009 end X`009end; X X { ***** END LIST ***** } X 72 : begin X if listnestlevel > 0 then X begin X`009 case liststate[listnestlevel] of V`009 nostate : writeln(outfile,'% - RNOTOTEX - close on list not open' X); V`009 itemize : writeln(outfile,'\end{itemize} % - list nest ',listnes Xtlevel:1); V`009 enumerate : writeln(outfile,'\end{enumerate} % - list nest ',listn Xestlevel:1) X`009 end; X`009 case liststate[listnestlevel] of V`009 nostate : writeln( log,'% - RNOTOTEX - close on list not open' X); X`009 itemize : writeln( log,'\end{itemize}'); X`009 enumerate : writeln( log,'\end{enumerate}') X`009 end; X numberofelements[listnestlevel] := 0; X liststate[listnestlevel] := nostate; X`009 outputfirstitem[listnestlevel] := false; X `009 listnestlevel := listnestlevel - 1; X`009 if (listnestlevel = 1) and (nofillbeforelist) then X`009 begin X`009 nofillbeforelist := false; X`009 beginnofill( outfile ) X`009 end X end X`009 else X`009 begin X`009 writeln(outfile,'% - RNOTOTEX end list for none started'); X`009 writeln( log,'% - RNOTOTEX end list for none started') X`009 end X`009 end; X X { ***** LIST ELEMENT ***** } X 73 : begin X if listnestlevel > 0 then X`009 begin X if liststate[listnestlevel] = nostate then X begin V`009 writeln(outfile,'% - RNOTOTEX - list element for non-existant-list' X); V`009 writeln( log,'% - RNOTOTEX - list element for non-existant-list' X) X end X`009 else X begin X`009 if not outputfirstitem[listnestlevel] then X`009 begin X`009 write(outfile,'\item '); X `009 writeln( log,'\item ') X`009 end X`009 else X`009 outputfirstitem[listnestlevel] := false; V numberofelements[listnestlevel] := numberofelements[listnestleve Xl] + 1 X end X end X else X begin X`009 writeln(outfile,'% - RNOTOTEX - list element for unopened-list'); X`009 writeln( log,'% - RNOTOTEX - list element for unopened-list') X end X `009 end; X X { ***** NUMBER LIST ***** } X 74 : begin X`009 newintvalue(arg[2], numberlist.listlevel, modified, extractedvalue); X`009 newintvalue(arg[3], numberlist.valuetoset, modified, extractedvalue); X`009 if (numberlist.listlevel > 0) and ( numberlist.listlevel < 5) then X`009 case numberlist.valuetoset of V`009 1 : adjustcounter(outfile, modified, numberlist.valuetoset,extracte Xdvalue,'enumi'); V`009 2 : adjustcounter(outfile, modified, numberlist.valuetoset,extracte Xdvalue,'enumii'); V`009 3 : adjustcounter(outfile, modified, numberlist.valuetoset,extracte Xdvalue,'enumiii'); V`009 4 : adjustcounter(outfile, modified, numberlist.valuetoset,extracte Xdvalue,'enumiv') X`009 end X`009 end; X X { ***** DISPLAY ELEMENTS ***** } X 75 : noconversion; X X { ***** NOTE ***** } X 76 : begin X if not inmarginpar then X`009 begin X`009 writeln(outfile,'\marginpar{\em '); X`009 writeln( log,'\marginpar{\em '); X`009 inmarginpar := true; X`009 if n > 1 then X`009 begin X`009 dumpthelist(outfile, dsrlist); X`009 dumpthelist( log, dsrlist); X`009 inmarginpar := false; X`009 c(outfile) X end X end X`009 else X`009 begin X`009 writeln(outfile,'% RNOTOTEX - marginpar already active'); X`009 writeln( log,'% RNOTOTEX - marginpar already active') X`009 end X`009 end; X X { ***** END NOTE ***** } X 77 : begin X if inmarginpar then X begin X`009 writeln(outfile,'} % - end of margin par '); X`009 writeln( log,'} % - end of margin par ') X end X`009 else X`009 begin X`009 writeln(outfile,'% RNOTOTEX - marginpar not active'); X`009 writeln( log,'% RNOTOTEX - marginpar not active') X`009 end; X`009 inmarginpar := false X`009 end; X X { ***** FOOTNOTE ***** } X 78 : begin X if not infootnote then X`009 begin X`009 write(outfile,'\footnote{'); X`009 writeln( log,'\footnote{'); X `009 infootnote := true X end X`009 else X`009 begin X`009 writeln(outfile,'% RNOTOTEX - already in footnote'); X`009 writeln( log,'% RNOTOTEX - already in footnote') X end X`009 end; X X { ***** END FOOTNOTE ***** } X 79 : begin X `009 if infootnote then X begin X`009 writeln(outfile,'} % - end of footnote'); X`009 writeln( log,'} % - end of footnote') X`009 end X else X`009 begin X`009 writeln(outfile,'% RNOTOTEX - footnote not active'); X`009 writeln( log,'% RNOTOTEX - footnote not active') X end; X`009 infootnote := false X`009 end; X X { ***** CHAPTER ***** } X 80 : begin X if not startedwithfill then X`009 endnofill(outfile); X`009 write(outfile,'\chapter{'); X`009 write( log,'\chapter{'); X`009 dumpthelist(outfile, nextinlist(dsrlist)); X`009 dumpthelist( log, nextinlist(dsrlist)); X`009 c(outfile); X`009 if not startedwithfill then X`009 beginnofill(outfile); X`009 end; X X { ***** NUMBER CHAPTER ***** } X 81 : begin V`009 newcountparameter(arg[n], numberchapter, modified, extractedvalue, cla Xss); V`009 adjustcounter(outfile, modified, numberchapter, extractedvalue,'chapte Xr') X`009 end; X X { ***** DISPLAY CHAPTER ***** } X 82 : begin X`009 newstyleparameter(arg[n], displaychapter); X`009 adjuststyle(outfile, displaychapter, 'chapter') X`009 end; X X { ***** HEADER LEVEL ***** } X 83 : begin X`009 newintvalue(arg[2], nestlevel, modified, extractedvalue); X`009 if modified <> nochange then X`009 startindex := 3 X`009 else X`009 begin X`009 newintvalue(arg[3], nestlevel, modified, extractedvalue); X`009 startindex := 4 X`009 end; X`009 if modified <> nochange then X`009 begin X`009 if (nestlevel > 0) and (nestlevel < 7) then X`009 begin X`009 case nestlevel of X`009 1 : write(outfile,'\section{'); X`009 2 : write(outfile,'\subsection{'); X`009 3 : write(outfile,'\subsubsection{'); X`009 4 : write(outfile,'\paragraph{'); X`009 5 : write(outfile,'\subparagraph{'); X`009 6 : write(outfile,'\P ') X`009 end; X`009 case nestlevel of X`009 1 : write( log,'\section{'); X`009 2 : write( log,'\subsection{'); X`009 3 : write( log,'\subsubsection{'); X`009 4 : write( log,'\paragraph{'); X`009 5 : write( log,'\subparagraph{'); X`009 6 : write( log,'\P ') X`009 end; X`009 for i := startindex to n do X begin X`009 texwritearg(outfile, arg[i] ); X`009 texwritearg( log, arg[i] ) X end; X`009 if nestlevel < 6 then X`009 c(outfile); V `009 headerlevel[nestlevel].value := headerlevel[nestlevel].value + X 1 X`009 end X end X end; X X { ***** NUMBER LEVEL ***** } X 84 : begin X`009 startindex := -1; X`009 if n = 7 then startindex := 2; X`009 if n = 8 then startindex := 3; X`009 if startindex <> -1 then X`009 begin X `009 for i := startindex to (startindex + 5) do X`009 begin X`009 j := i - startindex + 1; V`009 newintvalue(arg[i], headerlevel[j].value, modified,extractedvalue) X; X`009 case j of V`009 1 : adjustcounter(outfile, modified, headerlevel[1].value,extra Xctedvalue,'section'); V`009 2 : adjustcounter(outfile, modified, headerlevel[2].value,extra Xctedvalue,'subsection'); V`009 3 : adjustcounter(outfile, modified, headerlevel[3].value,extra Xctedvalue,'subsubsection'); V`009 4 : adjustcounter(outfile, modified, headerlevel[4].value,extra Xctedvalue,'paragraph'); V`009 5 : adjustcounter(outfile, modified, headerlevel[5].value,extra Xctedvalue,'subparagraph'); X`009 6 : noconversion X`009 end X`009 end X end X`009 end; X X { ***** STYLE HEADERS ***** } X 85 : noconversion; X X { ***** DISPLAY LEVELS ***** } X 86 : begin X`009 startindex := -1; X`009 if n = 7 then startindex := 2; X`009 if n = 8 then startindex := 3; X`009 if startindex <> -1 then X`009 begin X `009 for i := startindex to (startindex + 5) do X`009 begin X`009 j := i - startindex + 1; X`009 newstyleparameter(arg[i], headerlevel[j].display); X`009 case j of X`009 1 : adjuststyle(outfile, headerlevel[1].display, 'section'); X`009 2 : adjuststyle(outfile, headerlevel[2].display, 'subsection'); V`009 3 : adjuststyle(outfile, headerlevel[3].display, 'subsubsection X'); X`009 4 : adjuststyle(outfile, headerlevel[4].display, 'paragraph'); V`009 5 : adjuststyle(outfile, headerlevel[5].display ,'subparagraph' X); X`009 6 : noconversion X`009 end X`009 end X end X`009 end; X X { ***** APPENDIX ***** } X 87 : begin X`009 write(outfile,'\chapter{APPENDIX '); X`009 write( log,'\chapter{APPENDIX '); X`009 if n >= 2 then X`009 begin X`009 write(outfile,': '); X`009 write( log,': '); X`009 dumpthelist(outfile, nextinlist(dsrlist)); X`009 dumpthelist( log, nextinlist(dsrlist)) X`009 end; X`009 c(outfile) X`009 end; X X { ***** NUMBER APPENDIX ***** } X 88 : begin V`009 newcountparameter(arg[n], numberappendix, modified, extractedvalue,cla Xss); V`009 adjustcounter(outfile, modified, numberappendix, extractedvalue, 'chap Xter') X`009 end; X X { ***** DISPLAY APPENDIX ***** } X 89 : begin X`009 newstyleparameter(arg[n], displayappendix); X`009 adjuststyle(outfile, displayappendix, 'chapter') X`009 end; X X { ***** STANDARD ***** } X 90 : noconversion; X X { ***** COMMENT ***** } X 91 : begin X`009 write(outfile,'% '); X`009 dumpthelist(outfile, nextinlist(dsrlist)); X`009 write( log,'% '); X`009 dumpthelist( log, nextinlist(dsrlist)) X`009 end; X X { ***** REQUIRE ***** } X 92 : begin X`009 write(outfile,'%%%%%% REQUIRE WAS HERE %%%%% \input {'); X`009 dumpthelist(outfile, nextinlist(dsrlist)); X`009 write( log,'\input {'); X`009 dumpthelist( log, nextinlist(dsrlist)); X`009 c(outfile) X`009 end; X X { ***** CONTROL CHARACTERS ***** } X 93 : noconversion; X X { ***** NO CONTROL CHARACTERS ***** } X 94 : noconversion; X X { ***** IF ***** } X 95 : noconversion; X X { ***** ELSE ***** } X 96 : noconversion; X X { ***** END IF ***** } X 97 : noconversion; X X { ***** IFNOT ***** } X 98 : noconversion; X X { ***** VARIABLE ***** } X 99 : noconversion; X X { ***** SET DATE ***** } X 100 : noconversion; X X { ***** SET TIME ***** } X 101 : noconversion; X X { ***** FLAGS ALL ***** } X 102 : begin X`009 for f := control to substitute do X`009 turnflagon( f ) X`009 end; X X { ***** NO FLAGS ALL ***** } X 103 : begin X`009 for f := control to substitute do X`009 turnflagoff( f ); X`009 turnflagon( control ) X`009 end; X X { ***** NO FLAGS CONTROL ***** } X 104 : turnflagoff( control ); X X { ***** FLAGS CONTROL ***** } X 105 : flagchange(control, arg[n]); X X { ***** NO FLAGS UPPERCASE ***** } X 106 : turnflagoff( uppercase ); X X { ***** FLAGS UPPERCASE ***** } X 107 : flagchange( uppercase, arg[n]); X X { ***** NO FLAGS LOWERCASE ***** } X 108 : turnflagoff( lowercase ); X X { ***** FLAGS LOWERCASE ***** } X 109 : flagchange( lowercase, arg[n]); X X { ***** NO FLAGS QUOTE ***** } X 110 : turnflagoff( quote ); X`009 X { ***** FLAGS QUOTE ***** } X 111 : flagchange( quote, arg[n] ); X X { ***** NO FLAGS SPACE ***** } X 112 : turnflagoff( space ); X X { ***** FLAGS SPACE ***** } X 113 : flagchange( space, arg[n] ); X X { ***** NO FLAGS UNDERLINE ***** } X 114 : turnflagoff( underline ); X X { ***** FLAGS UNDERLINE ***** } X 115 : flagchange( underline, arg[n] ); X X { ***** NO FLAGS BOLD ***** } X 116 : turnflagoff( bold ); X X { ***** FLAGS BOLD ***** } X 117 : flagchange( bold, arg[n] ); X X { ***** NO FLAGS OVERSTRIKE ***** } X 118 : turnflagoff( overstrike ); X X { ***** FLAGS OVERSTRIKE ***** } X 119 : flagchange( overstrike, arg[n] ); X X { ***** NO FLAGS HYPHENATE ***** } X 120 : turnflagoff( hyphenate ); X X { ***** FLAGS HYPHENATE ***** } X 121 : flagchange( hyphenate, arg[n] ); X X { ***** NO FLAGS CAPITALIZE ***** } X 122 : turnflagoff( capitalize ); X X { ***** FLAGS CAPITALIZE ***** } X 123 : flagchange( capitalize, arg[n] ); X X { ***** NO FLAGS END FOOTNOTE ***** } X 124 : turnflagoff( endfootnote ); X X { ***** FLAGS END FOOTNOTE ***** } X 125 : flagchange( endfootnote, arg[n] ); X X { ***** NO FLAGS COMMENT ***** } X 126 : turnflagoff( comment ); X X { ***** FLAGS COMMENT ***** } X 127 : flagchange( comment, arg[n] ); X X { ***** NO FLAGS SUBSTITUTE ***** } X 128 : turnflagoff( substitute ); X X { ***** FLAGS SUBSTITUTE ***** } X 129 : flagchange( substitute, arg[n] ); X X { ***** INDEX ***** } X 130 : begin X`009 write(outfile,'\index{'); X`009 dumpthelist(outfile, nextinlist(dsrlist)); X`009 write( log,'\index{'); X`009 dumpthelist( log, nextinlist(dsrlist)); X`009 c(outfile) X end X Xend; {case of tex index extracted}`009 X X Xroutineexit : nullstatement Xend; X X X X[GLOBAL] PROCEDURE putsecondarytexcommand(var outfile : text; X`009 var nextcommand : integer ); Xbegin X X if nextcommand = 40 {centering} then X begin X if centering then X begin X centering := false; X writeln(outfile,'\end{centering}'); X if startnofillagain then X begin X`009 startnofillagain := false; X`009 beginnofill( outfile ) X end X end X else X begin V`009writeln(outfile,'% RNOTOTEX - end centering when centering not-active');`00 X9 X`009writeln( log,'% RNOTOTEX - end centering when centering not-active') X end X end; X if nextcommand = 44 {rightjustify} then X begin X if flushright then X begin X flushright := false; X writeln(outfile,'\end{flushright}'); X if startnofillagain then X begin X`009 startnofillagain := false; X`009 beginnofill( outfile ) X end X end X else X begin X writeln(outfile,'% RNOTOTEX - end flushright when not active'); X writeln( log,'% RNOTOTEX - end flushright when not active') X end X end; X X nextcommand := indexofunknowntexcommand X Xend; X X X X X XEND. X X $ GOSUB UNPACK_FILE $ FILE_IS = "DSROPS.PAS" $ CHECKSUM_IS = 658424605 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X[INHERIT('SCREENHANDLERS','UTILITYOPS','ARGOPS', X'TREEANDLISTOPS','FLAGOPS','CONVERSION')] X XMODULE DSROPS; X X XCONST X X indexofpagecommand = 38; X XVAR X X totallines : [EXTERNAL] integer; X totalgooddsrcommands : [EXTERNAL] integer; X totalbaddsrcommands : [EXTERNAL] integer; X X X X X X[GLOBAL] FUNCTION listispagecommand( list : arglist ) : boolean; Xvar X s : pckstr; Xbegin X listispagecommand := false; X if arglistlength(list) = 1 then X begin X s := argliteral(firstarg(list), TRUE ); -+-+-+-+-+ End of part 2 +-+-+-+-+-
prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/12/88)
Sorry about the previous send, I am still learning this mailer. I'll try again with a different method. +-+-+-+ Beginning of part 3 +-+-+-+ X if s = 'PAGE' then X listispagecommand := true X end Xend; X X X X[GLOBAL] PROCEDURE checkfordsrcommand( var infile, outfile : text; X`009 var dsrcommand : boolean ); Xvar X gotten : boolean; Xbegin X if flagclass(currentchar) = control then X begin X getnextchar(infile, gotten); X if gotten then X begin X if (flagclass(currentchar) <> comment) and (currentchar <> blank) then X dsrcommand := true X end X else X begin X dsrcommand := false; X texwrite(outfile, currentchar) X end X end X else X dsrcommand := false Xend; X X X X X[GLOBAL] PROCEDURE parsedsrcommand( var infile, outfile : text; var list : X`009 arglist; var anothercommand : boolean; V`009 var carrychar : boolean; var charcarried : ch Xar); Xconst X dontwritethem = false; Xtype V charidentity = (letter, separator, number, semicolon, quote, commentchar,new Xdsrcommand); Xvar X quotedchar : char; X argread : argument; X currentargclass : charidentity; X done, gotten, atseparator, endofdsrcommand : boolean; X i : integer; X X function charclass( ch : char ) : charidentity; X label X localexit; X begin X charclass := separator; X if flagclass( ch ) = control then X begin X charclass := newdsrcommand; X goto localexit X end; X if ch in ['a'..'z','A'..'Z'] then X begin X charclass := letter; X goto localexit X end; X if ch in ['+','-','0'..'9'] then X begin X charclass := number; X`009 goto localexit X end; X if ch in [chr(34), chr(39)] then X begin X charclass := quote; X goto localexit X end; X if flagclass(currentchar) = comment then X begin X charclass := commentchar; X goto localexit X end; X if ch = ';' then X charclass := semicolon; X localexit : nullstatement X end; X X procedure startarg( ch : char; var arg : argument; startset : setofargtype); X begin X initarg(arg, startset, ch, indexofunknowntexcommand, false); X end; X Xbegin X list := nulllist; X atseparator := false; X endofdsrcommand := false; X anothercommand := false; X carrychar := false; X repeat X currentargclass := charclass(currentchar); X case currentargclass of X `009 letter : begin X`009 atseparator := false; V`009 startarg(currentchar, argread, [dsrverb,stylespecifier, tex Xtpckstr,character]); X done := false; X repeat X`009 getnextchar(infile, gotten); X if gotten then X`009 begin X`009 if charclass(currentchar) = letter then X appendchartoarg(currentchar, argread) X else X done := true X end X`009 else X begin X done := true; X`009 endofdsrcommand := true X`009 end X`009 until done; X`009 appendargonlist(list, argread ) X end; X `009 number : begin X`009 atseparator := false; V`009 startarg(currentchar, argread, [int,signedint,textpckstr,nu Xlltype]); X done := false; X repeat X`009 getnextchar(infile, gotten); X if gotten then X`009 begin X`009 if charclass(currentchar) = number then X appendchartoarg(currentchar, argread) X else X done := true X end X`009 else X begin X done := true; X`009 endofdsrcommand := true X`009 end X`009 until done; X`009 appendargonlist(list, argread ) X end; X`009 separator : begin X`009 passblanks(infile, outfile, dontwritethem); X`009 if (atseparator) and (currentchar <> lastinputchar) then X`009 begin X`009 startarg(blank, argread, [nulltype]); X`009 appendargonlist(list, argread); X atseparator := false X`009 end X`009 else X`009 begin X if flagclass(currentchar) = control then X`009 endofdsrcommand := true X else X if charclass(currentchar) = separator then X begin X getnextchar(infile, gotten); X`009 if gotten then X atseparator := true X`009 else X begin X atseparator := false; X`009 startarg(blank, argread, [nulltype]); X`009 appendargonlist(list, argread); X`009 endofdsrcommand := true X end X end X`009 end V`009 end; X X`009semicolon : begin X endofdsrcommand := true; X`009 getnextchar(infile, gotten); X`009 if charclass(currentchar) = newdsrcommand then X`009 currentargclass := newdsrcommand X`009 else X`009 begin X`009 carrychar := true; X`009 charcarried := currentchar X`009 end X`009 end; X`009 quote : begin X`009 quotedchar := currentchar; X`009 getnextchar(infile, gotten); X if gotten then X`009 begin X`009 startarg(currentchar, argread, [quotedpckstr]); X`009 done := false; X`009 repeat X`009 getnextchar(infile, gotten); X`009 if gotten then X`009 begin X`009 if charclass(currentchar) = quote then X`009 begin X`009 getnextchar(infile, gotten); X`009 done := true; X`009 if not gotten then X`009 endofdsrcommand := true X`009 end X`009 else X`009 appendchartoarg(currentchar, argread) X`009 end X else X`009 begin X`009 endofdsrcommand := true; X`009 done := true X`009 end X`009 until done X`009 end X`009 else X`009 startarg(quotedchar, argread,[textpckstr,character]); X appendargonlist(list, argread) X end; X commentchar : begin X`009 endofdsrcommand := true X end; X newdsrcommand : begin X endofdsrcommand := true; X end X end; {case} X until endofdsrcommand; X if currentargclass <> newdsrcommand then X newline( infile, outfile, false) X else X anothercommand := true Xend; X`009 X X XPROCEDURE parsefile( var infile, outfile : text; textree : argtree ); Xconst X nocrlf = false; X putcrlf = true; Xvar X dsrcommandfound : boolean; X chargotten : boolean; X dsrarguments : arglist; X texcommandindex : integer; X nextcommandtowrite : integer; X successfulparse : boolean; X depthofsearch : integer; X anothercommand : boolean; X carrychar : boolean; X charcarried, copychar : char; Xbegin X ttywritestring('Translating input ...'); X totalgooddsrcommands := 0; X totalbaddsrcommands := 0; X nextcommandtowrite := indexofunknowntexcommand; X anothercommand := false; X repeat X putsecondarytexcommand( outfile, nextcommandtowrite); X repeat X checkfordsrcommand( infile, outfile, dsrcommandfound ); X if dsrcommandfound then X begin V parsedsrcommand( infile, outfile, dsrarguments, anothercommand,carrycha Xr,charcarried); X if listispagecommand( dsrarguments) then X begin X successfulparse := true; X texcommandindex := indexofpagecommand X end X else V searchtreeforlist( textree, dsrarguments,successfulparse, texcommandi Xndex, X depthofsearch); X if successfulparse then X begin X totalgooddsrcommands := totalgooddsrcommands + 1; V puttexcommand(outfile, texcommandindex, dsrarguments, nextcommandtowr Xite); X if carrychar then X begin X`009 copychar := currentchar; X`009 currentchar := charcarried; X`009 writecurrentchar( infile, outfile ); X`009 currentchar := copychar X end X end X else X begin X totalbaddsrcommands := totalbaddsrcommands + 1; X write(outfile,'%Unidentified RUNOFF command "'); X dumpthelist(outfile, dsrarguments); X writeln(outfile,'"') X end X end X else X anothercommand := false X until (not dsrcommandfound) and (not anothercommand); X repeat X writecurrentchar( infile, outfile ); X getnextchar(infile, chargotten) X until not chargotten; X newline(infile, outfile, putcrlf) X until eof(infile) Xend; X X X XEND. X X $ GOSUB UNPACK_FILE $ FILE_IS = "FLAGOPS.PAS" $ CHECKSUM_IS = 125287985 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X[INHERIT('UTILITYOPS','ARGOPS')] X XMODULE FLAGOPS; X XCONST X X tab = 9; X ncharsintab = 8; X XTYPE X Xdsrflagtype = record X`009 representation : char; X`009 turnedon : boolean X `009 end; X X Xdsrflagclasses = (notaflag, control, uppercase, lowercase, quote, Xspace, underline, bold, overstrike, hyphenate, break, period, capitalize, Xendfootnote, comment, substitute); X Xflagtabletype = array[dsrflagclasses] of dsrflagtype; X Xtabrecordtype = record X`009 tabread : boolean; X`009 charcountintab : integer X`009 end; X Xstyletype = (undetermined, decimal, octal, hexidecimal, romanupper, romanlower, X`009 romanmixed, letterupper, letterlower, lettermixed, nostyle); X Xenhancmentstates = (notenhanced, singlecharenhanced, enhancmentlocked); X X X XVAR X X`009lastinputchar, currentchar : [EXTERNAL] char; X capitalizetext, lowercasetext : [EXTERNAL] boolean; X`009inputcontainstexcommands : [EXTERNAL] boolean; X inliteral : [EXTERNAL] boolean; X totallines, totalchars : [EXTERNAL] integer; X flagtable : [EXTERNAL] flagtabletype; X tabrecord : [EXTERNAL] tabrecordtype; X`009LOG : [EXTERNAL] text; X columncounter : [EXTERNAL] integer; X`009infootnote : [EXTERNAL] boolean; X`009boldactive : [EXTERNAL] enhancmentstates; X underlineactive : [EXTERNAL] enhancmentstates; X startnofillagain : [EXTERNAL] boolean; X fill : [EXTERNAL] boolean; X listnestlevel : [EXTERNAL] integer; X X X X[GLOBAL] PROCEDURE beginnofill( var outfile : text ); Xbegin X if (fill) and (listnestlevel = 0) then X begin X writeln(outfile,'{\obeylines \obeyspaces % - begin no fill'); X fill := false X end X else X begin X writeln(outfile,'% - RNOTOTEX obeylines, obeyspaces already active'); X writeln( log,'% - RNOTOTEX obeylines, obeyspaces already active') X end Xend; X X X X X[GLOBAL] PROCEDURE endnofill( var outfile : text ); Xbegin X if (not fill) and (listnestlevel = 0) then X begin X writeln(outfile,'} % - end of no fill'); X fill := true X end X else X begin X writeln(outfile,'% - RNOTOTEX obeylines, obeyspaces not active'); X writeln( log,'% - RNOTOTEX obeylines, obeyspaces not active') X end Xend; X X X X X X X[GLOBAL] PROCEDURE writeflagname( var outfile : text; f : dsrflagclasses ); Xbegin X case f of X notaflag : write(outfile,'?????'); X control : write(outfile,'CONTROL'); X uppercase : write(outfile,'UPPERCASE'); X lowercase : write(outfile,'LOWERCASE'); X quote : write(outfile,'QUOTE'); X space : write(outfile,'SPACE'); X underline : write(outfile,'UNDERLINE'); X bold : write(outfile,'BOLD'); X overstrike : write(outfile,'OVERSTRIKE'); X hyphenate : write(outfile,'HYPYENATE'); X capitalize : write(outfile,'CAPITALIZE'); X endfootnote : write(outfile,'END FOOTNOTE'); X comment : write(outfile,'COMMENT'); X substitute : write(outfile,'SUBSTITUTE') X end Xend; X X X X X X X[GLOBAL] FUNCTION isastylespecifier( arg : argument ) : styletype; Xlabel X routineexit; Xvar X s : pckstr; X classification : styletype; Xbegin X s := argliteral( arg, TRUE ); X classification := undetermined; X if (s.body[1] = 'D') and (s.length = 1) then X begin X classification := decimal; X goto routineexit X end; X if (s.body[1] = 'O') and (s.length = 1) then X begin X classification := octal; X goto routineexit X end; X if (s.body[1] = 'H') and (s.length = 1) then X begin X classification := hexidecimal; X goto routineexit X end; X if (s.body = 'RU') and (s.length = 2) then X begin X classification := romanupper; X goto routineexit X end; X if (s.body = 'RL') and (s.length = 2) then X begin X classification := romanlower; X goto routineexit X end; X if (s.body = 'RM') and (s.length = 2) then X begin X classification := romanmixed; X goto routineexit X end; X if (s.body = 'LU') and (s.length = 2) then X begin X classification := letterupper; X goto routineexit X end; X if (s.body = 'LL') and (s.length = 2) then X begin X classification := letterlower; X goto routineexit X end; X if (s.body = 'LM') and (s.length = 2) then X begin X classification := lettermixed; X goto routineexit X end; X routineexit : isastylespecifier := classification Xend; X X X X[GLOBAL] PROCEDURE initflagtable; Xvar X f : dsrflagclasses; Xbegin X for f := notaflag to substitute do X case f of X `009notaflag : begin X`009 flagtable[f].representation := blank; X`009 flagtable[f].turnedon := false X`009 end; X `009control : begin X`009 flagtable[f].representation := '.'; X`009 flagtable[f].turnedon := true X`009 end; X `009uppercase : begin X`009 flagtable[f].representation := '^'; X`009 flagtable[f].turnedon := true X`009 end; X `009lowercase : begin X`009 flagtable[f].representation := '\'; X`009 flagtable[f].turnedon := true X`009 end; X `009quote : begin X`009 flagtable[f].representation := '_'; X`009 flagtable[f].turnedon := true X`009 end; X `009space : begin X`009 flagtable[f].representation := '#'; X`009 flagtable[f].turnedon := true X`009 end; X `009underline : begin X`009 flagtable[f].representation := '&'; X`009 flagtable[f].turnedon := true X`009 end; X `009bold : begin X`009 flagtable[f].representation := '*'; X`009 flagtable[f].turnedon := false X`009 end; X `009overstrike : begin X`009 flagtable[f].representation := '%'; X`009 flagtable[f].turnedon := false X`009 end; X `009hyphenate : begin X`009 flagtable[f].representation := '='; X`009 flagtable[f].turnedon := false X`009 end; X `009break : begin X`009 flagtable[f].representation := '|'; X`009 flagtable[f].turnedon := false X`009 end; X `009period : begin X`009 flagtable[f].representation := '+'; X`009 flagtable[f].turnedon := false X`009 end; X `009capitalize : begin X`009 flagtable[f].representation := '<'; X`009 flagtable[f].turnedon := false X`009 end; X endfootnote : begin X flagtable[f].representation := '!'; X`009 flagtable[f].turnedon := false X`009 end; X `009comment : begin X`009 flagtable[f].representation := '!'; X`009 flagtable[f].turnedon := true X`009 end; X `009substitute : begin X`009 flagtable[f].representation := '$'; X`009 flagtable[f].turnedon := false X`009 end X end { case } Xend; {initflagtable} X X X X X[GLOBAL] FUNCTION flagclass( ch : char ) : dsrflagclasses; Xvar X class : dsrflagclasses; X foundclass : boolean; Xbegin X class := control; X foundclass := false; X while (class <> substitute) and ( not foundclass) do V if (ch = flagtable[class].representation) and (flagtable[class].turnedon)t Xhen X foundclass := true X else X class := succ(class); X if foundclass then X if inliteral then X`009if class = control then X`009 flagclass := control X`009else X`009 flagclass := notaflag X else X flagclass := class X else X flagclass := notaflag Xend; X X X X X[GLOBAL] PROCEDURE initcharreader(var f : text ); Xbegin X reset(f); X lastinputchar := blank; X read(f, currentchar); X totallines := 0; X totalchars := 0; X columncounter := 1; X if ord(currentchar) = tab then X begin X tabrecord.tabread := true; X tabrecord.charcountintab := ncharsintab X end X else X begin X tabrecord.tabread := false; X tabrecord.charcountintab := 0 X end Xend; X X X X X[GLOBAL] PROCEDURE getnextchar( var f : text; var gotten : boolean ); X X function nexttabcolumn( startingcolumn : integer ) : integer; X var X i : integer; X begin X i := startingcolumn; X repeat X i := i + 1 X until (i-1) mod ncharsintab = 0; X nexttabcolumn := i; X writeln(log,'nexttabcolumn input = ',startingcolumn:1,', output = ',i:1) X end; X Xbegin X gotten := false; X if NOT eof(f) then X if NOT eoln(f) then X with tabrecord do X begin X lastinputchar := currentchar; X gotten := true; X columncounter := columncounter + 1; X if (tabread) and (charcountintab > 0) then X begin X`009 currentchar := blank; X`009 charcountintab := charcountintab - 1; X`009 if charcountintab = 0 then tabread := false X`009end X`009else X`009begin X totalchars := totalchars + 1; X read( f, currentchar ); X if currentchar < blank then X begin X if ord(currentchar) = tab then X begin X tabread := true; V charcountintab := nexttabcolumn( columncounter ) - columncounter X-1; X writeln(log,'charcountintab = ',charcountintab) X end; X`009 currentchar := blank X end X end X end Xend; X X X V[GLOBAL] PROCEDURE startunderline( var outfile : text; class : enhancmentstates X); Xbegin X if class <> notenhanced then X case underlineactive of X notenhanced : begin X`009 write(outfile,'\underline{'); X`009 underlineactive := class X`009 end; X singlecharenhanced : nullstatement; X enhancmentlocked : nullstatement X end; X underlineactive := class Xend; X X X X X[GLOBAL] PROCEDURE stopunderline( var outfile : text ); Xbegin X case underlineactive of X notenhanced : nullstatement; X singlecharenhanced : begin X`009 write(outfile,'} '); X`009 underlineactive := notenhanced X`009 end; X enhancmentlocked : nullstatement X end Xend; X X X X X[GLOBAL] PROCEDURE startbold( var outfile : text; class : enhancmentstates); Xbegin X if class <> notenhanced then X case boldactive of X notenhanced : begin X`009 write(outfile,'{\bf '); X`009 boldactive := class X`009 end; X singlecharenhanced : nullstatement; X enhancmentlocked : nullstatement X end; X boldactive := class Xend; X X X X X[GLOBAL] PROCEDURE stopbold( var outfile : text ); Xbegin X case boldactive of X notenhanced : nullstatement; X singlecharenhanced : begin X`009 write(outfile,'} '); X`009 boldactive := notenhanced X`009 end; X enhancmentlocked : nullstatement X end Xend; X X X X X V[GLOBAL] PROCEDURE passblanks( var infile, outfile : text; writethem : boolean X); Xvar X gotten, keeppassing : boolean; Xbegin X keeppassing := true; X gotten := true; X repeat X if (currentchar = blank) and (gotten) then X begin X if writethem then write(outfile, blank ); X getnextchar(infile, gotten) X end X else X keeppassing := false X until NOT keeppassing Xend; X X X X[GLOBAL] PROCEDURE texwrite( var f : text; ch : char ); Xconst X maxtrys = 2; Xvar X ntrys : integer; X written : boolean; Xbegin X ntrys := 0; X written := false; X repeat X if (inputcontainstexcommands) or (inliteral) then X write(f, ch, error := continue) X else X if ch >= blank then X if ch in ['#','$','%','&','_','^','{','}','~'] then X write(f, '\',ch, error := continue) X else X if ch = '\' then X write(f,'\backslash ', error := continue) X else X write(f, ch, error := continue); X if status(f) > 0 then X begin X writeln(f, error := continue); X ntrys := ntrys + 1 X end X else X written := true X until (written) or (ntrys > maxtrys); X if ntrys > maxtrys then X errorexit('TEXWRITE','error writing to output') Xend; X X X X[GLOBAL] PROCEDURE writecurrentchar( var infile, outfile : text ); Xvar X gotten : boolean; Xbegin X if capitalizetext then X currentchar := capchar( currentchar ); X if lowercasetext then X currentchar := lcchar( currentchar ); X case flagclass(currentchar) of X notaflag : begin X`009 stopunderline( outfile ); X`009 stopbold( outfile ); X`009 texwrite(outfile, currentchar) X end; X`009control : begin X`009 stopunderline( outfile ); X`009 stopbold( outfile ); X`009 texwrite(outfile, currentchar) X end; X `009uppercase : begin X getnextchar(infile, gotten); X if gotten then X case flagclass(currentchar) of X`009`009 underline : startunderline( outfile, enhancmentlocked); X`009 bold : startbold( outfile, enhancmentlocked ); X otherwise texwrite(outfile, capchar(currentchar)) X end X`009 end; X `009lowercase : begin X getnextchar(infile, gotten); X if gotten then X`009 case flagclass(currentchar) of X`009`009 underline : begin X`009 if underlineactive <> notenhanced then X`009 write(outfile,'} '); X`009 underlineactive := notenhanced X`009 end; X`009 bold : begin X if boldactive <> notenhanced then X `009 write(outfile,'} '); X`009 boldactive := notenhanced X`009 end; X otherwise texwrite(outfile, lcchar(currentchar)) X end X`009 end; X `009quote : begin X`009 getnextchar(infile, gotten); X if gotten then X`009 texwrite(outfile, currentchar ) X`009 end; X `009space : write(outfile,'\ '); X `009underline : begin X getnextchar(infile, gotten ); X if gotten then X begin X startunderline( outfile, singlecharenhanced); X`009 texwrite(outfile, currentchar) X end X`009 else X`009 texwrite(outfile, currentchar) X end; X `009bold : begin X`009 getnextchar(infile, gotten); X if gotten then X begin X startbold( outfile, singlecharenhanced); X`009 texwrite(outfile, currentchar) X`009 end X`009 else X`009 texwrite(outfile, currentchar) X`009 end; X `009overstrike : begin X`009 getnextchar(infile, gotten); X if gotten then X begin X`009 startbold( outfile, singlecharenhanced); X`009 texwrite(outfile, currentchar) X`009 end X`009 else X`009 texwrite(outfile, currentchar) X`009 end; X `009hyphenate : write(outfile,'--'); X `009break : writeln(outfile,'\linebreak'); X `009period : write(outfile,'\nonfrenchspacing '); X `009capitalize : begin X`009 getnextchar( infile, gotten); X`009 if gotten then X`009 texwrite(outfile, capchar(currentchar)) X`009 end; X endfootnote : begin X`009 if (columncounter = 1) and (infootnote) then X`009 begin X if not fill then X`009 endnofill( outfile ); X`009 `009 writeln(outfile,'} % - end of footnote'); X`009 writeln( log,'} % - end of footnote'); X infootnote := false; X`009 if startnofillagain then X`009 begin X`009 startnofillagain := false; X`009 beginnofill( outfile ) X`009 end X`009 end X`009 else X`009 texwrite(outfile, currentchar) X`009 end; X `009comment : begin X if flagclass(lastinputchar) = control then X`009 write(outfile,'% ') X else X`009 texwrite(outfile,currentchar) X`009 end; X `009substitute : texwrite(outfile, currentchar) X end { case } Xend; X X X X X[GLOBAL] PROCEDURE newline( var infile, outfile : text; putcrlf : boolean ); Xvar -+-+-+-+-+ End of part 3 +-+-+-+-+-
prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/12/88)
Sorry about the previous send, I am still learning this mailer. I'll try again with a different method. +-+-+-+ Beginning of part 4 +-+-+-+ X gotten : boolean; Xbegin X if eoln(infile) then X begin X readln(infile); X totallines := totallines + 1; X columncounter := 1 X end; X if putcrlf then X writeln(outfile); X while (eoln(infile)) and (not eof(infile)) do X begin X readln(infile); X writeln(outfile); X columncounter := 1; X totallines := totallines + 1 X end; X if not eof(infile) then X begin X read(infile, currentchar); X totalchars := totalchars + 1; X lastinputchar := blank X end; X if ord(currentchar) = tab then X begin X tabrecord.charcountintab := ncharsintab; X tabrecord.tabread := true X end X else X begin X tabrecord.charcountintab := 0; X tabrecord.tabread := false X end; X if currentchar < blank then currentchar := blank Xend; X X X X X X X[GLOBAL] PROCEDURE changeflagchar( flag : dsrflagclasses; newchar:char); Xbegin X flagtable[flag].representation := newchar; X write(log,'[internal flag representation change for '); X writeflagname(log, flag); X writeln(log,' to "',newchar,'"]') Xend; X X X X[GLOBAL] PROCEDURE turnflagon( flag : dsrflagclasses ); Xbegin X flagtable[flag].turnedon := true; X write(log,'[internal flag '); X writeflagname(log, flag); X writeln(log,' enabled]') Xend; X X X X[GLOBAL] PROCEDURE turnflagoff( flag : dsrflagclasses ); Xbegin X flagtable[flag].turnedon := false; X write(log,'[internal flag '); X writeflagname(log, flag); X writeln(log,' disabled]') Xend; X X X X X[GLOBAL] PROCEDURE texwritearg( var outfile : text; arg : argument ); Xvar X s : pckstr; X i, l : integer; Xbegin X s := argliteral( arg, false ); X l := length( s ); X for i := 1 to l do texwrite(outfile, s.body[i]); X write(outfile, blank) Xend; X X XEND. $ GOSUB UNPACK_FILE $ FILE_IS = "GETCLI.FOR" $ CHECKSUM_IS = 53499580 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X`009SUBROUTINE GETCLI (IFILE,OFILE,TEX) X X`009IMPLICIT NONE X`009 XC XC FUNCTIONAL DESCRIPTION:`009 XC XC This routine gets the input and output file names for program XC RNOTOTEX. XC XC DUMMY ARGUMENTS: XC XC none. XC XC IMPLICIT INPUTS: XC XC none XC XC IMPLICIT OUTPUTS: XC X`009CHARACTER*(*) IFILE XC`009INPUT FILE NAME XC X`009CHARACTER*(*) OFILE XC`009OUTPUT FILE NAME XC X`009INTEGER TEX XC `009TEX COMMANDS FLAG : 0 FOR NO, NOT 0 FOR YES XC XC SIDE EFFECTS: XC XC none XC XC XC`009LOCALS XC X`009INTEGER CLI$GET_VALUE X`009EXTERNAL CLI$GET_VALUE XC`009system routine to get a value from a command line XC X`009INTEGER STATUS XC`009status of command line extraction XC`009 XC`009BEGIN X X`009STATUS = CLI$GET_VALUE('RNO_FILE',IFILE,) X`009STATUS = CLI$GET_VALUE('TEX_FILE',OFILE,) X X TEX = 0 X X`009RETURN X`009END $ GOSUB UNPACK_FILE $ FILE_IS = "INIOPS.PAS" $ CHECKSUM_IS = 608058111 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X{ `009INI FILE MODULE FOR RNO TO TEX CONVERSION } X{ `009RANDALL VENHOLA JULY 7, 1987 } X X[INHERIT('UTILITYOPS','BASICFILEOPS','ARGOPS', X 'TREEANDLISTOPS','SCREENHANDLERS')] X XMODULE INIOPS; X X X X[GLOBAL] PROCEDURE readarglistfromini( var ini : text; var index : integer; X`009 var list : arglist ); Xconst X iniseparator = '$'; Xvar X s : pckstr; X done : boolean; X gotten : boolean; X arg : argument; X inserted : boolean; X X function endofline : boolean; X begin X if eof(ini) then X endofline := true X else X begin X if eoln(ini) then X endofline := true X else X begin X if ini^ = blank then X endofline := true X else X endofline := false X end X end X end; X X function atseparator : boolean; X begin X atseparator := (ini^ = iniseparator) X end; X X procedure readpckstr( var s : pckstr; var gotten : boolean ); X var X ch : char; X done : boolean; X charindex : integer; X begin X s.body := blank; X done := false; X charindex := 0; X repeat X if endofline then X done := true X else X if atseparator then X done := true X else X if charindex = maxchars then X begin X`009 warningmessage('readini','ini file argument size overflow'); X done := true X end X`009 else X begin X read(ini, ch); X charindex := charindex + 1; X s.body[charindex] := ch X end; X s.length := charindex X until done; X gotten := charindex > 0; X if atseparator then read(ini, ch) X end; X X procedure readindex(var index : integer; var gotten : boolean ); X const X ndigits = 3; X var X count : integer; X ch : char; X begin X gotten := true; X count := 0; X index := 0; X repeat X if endofline then X gotten := false X else X if count < ndigits then X begin X read(ini, ch); X count := count + 1; X if ch in ['0'..'9'] then X index := index*10 + ord(ch) - ord('0') X else X begin X`009 warningmessage('readini','bad index digits in INI'); X`009 gotten := false X end X end X until (not gotten) or (count = ndigits); X if (gotten) and (not eof(ini)) then read(ini, ch) X end; X X procedure pckstrtoarg( s : pckstr; index : integer; var arg : argument); X label X routineexit; X begin X initarg(arg, [dsrverb], s, index, false ); X if s = '[N]' then X begin X reassignargclass(arg, [int,signedint,nulltype]); X reassignarggeneralization(arg, true); X goto routineexit X end; X if s = '[Y]' then X begin X reassignargclass(arg, [stylespecifier]); X reassignarggeneralization(arg, true); X goto routineexit X end; X if s = '[T]' then X begin X reassignargclass(arg, [textpckstr,character,nulltype]); X reassignarggeneralization(arg, true); X goto routineexit X end; X if s = '[C]' then X begin X reassignargclass(arg, [character,nulltype]); X reassignarggeneralization(arg, true); X goto routineexit X end; X if s = '[Q]' then X begin X reassignargclass(arg, [quotedpckstr,nulltype]); X reassignarggeneralization(arg, true); X goto routineexit X end; X routineexit : nullstatement X end; X Xbegin {readarglistfromini} X list := nulllist; X readindex(index, gotten ); X if gotten then X begin X if index < 1 then X warningmessage('readini','bad INI index value'); X repeat X readpckstr(s, gotten ); X if gotten then X begin X pckstrtoarg(s, index, arg ); X appendargonlist(list, arg); X end X until not gotten; X if arglistlength(list) = 0 then X warningmessage('readini','empty argument list in INI file') X end X else X begin X index := indexofunknowntexcommand; X warningmessage('readini','could not read index from INI file') X end; X if not eof(ini) then X readln(ini) Xend; X X X X X X X[GLOBAL] PROCEDURE setuptree( var ini : text; var tree : argtree ); Xvar X list : arglist; X index : integer; Xbegin X openinifile( ini ); X tree := nulltree; X while not eof(ini) do X begin X readarglistfromini( ini, index, list); X X { ***** ttywritestring(' index read = '); X ttywriteint(index); X ttywriteln; ***** } X X insertlistintotree( list, tree ) X end; X closeinifile( ini ) Xend; X X X XEND. $ GOSUB UNPACK_FILE $ FILE_IS = "LATEXOPS.PAS" $ CHECKSUM_IS = 964346211 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X[INHERIT('UTILITYOPS','ARGOPS','BASICFILEOPS', X'TREEANDLISTOPS','FLAGOPS')] X XMODULE LATEXOPS; X X XTYPE X X Xcountparametertype = (numericcounter, lowercasechars, uppercasechars ); X Xparameterchangestates = (nochange, altered, assigned); X Xpagestyletype = (empty, plain, headings, myheadings); X Xliststatetype = (nostate, itemize, enumerate); X X XVAR X X LOG : [EXTERNAL] TEXT; X pagestyle : [EXTERNAL] pagestyletype; X datestring : [EXTERNAL] pckstr; X title, subtitle : [EXTERNAL] argarray; X fill`009 : [EXTERNAL] boolean; X centering : [EXTERNAL] boolean; X flushright : [EXTERNAL] boolean; X minipageactive : [EXTERNAL] boolean; X inmarginpar : [EXTERNAL] boolean; X infootnote : [EXTERNAL] boolean; X underlineactive : [EXTERNAL] enhancmentstates; X boldactive : [EXTERNAL] enhancmentstates; X listnestlevel : [EXTERNAL] integer; X VPROCEDURE startlatex( var outfile : text; outputfont : integer ; outputstyle: p Xckstr ); Xconst X minfont = 10; X maxfont = 12; Xvar X pt : integer; Xbegin X pt := outputfont; X if (pt < minfont) or (pt > maxfont) then X pt := minfont; X writeln(outfile,'%'); X if pt = 10 then X writeln(outfile,'\documentstyle{',outputstyle,'}') X else X writeln(outfile,'\documentstyle[',pt:2,'pt]{',outputstyle,'}'); X writeln(outfile,'%'); X writeln(outfile,'% (put preamble statements here) '); X writeln(outfile,'%'); X writeln(outfile,'\begin{document}'); X writeln(outfile,'%') Xend; X X X[GLOBAL] PROCEDURE closeanyopenbrackets( var outfile : text ); Xvar X i : integer; Xbegin X if not fill then X writeln(outfile,'} % - end of obeylines and obeyspaces group'); X if centering then X writeln(outfile,'\end{centering}'); X if flushright then X writeln(outfile,'\end{flushright}'); X if minipageactive then X writeln(outfile,'\end{minipage}'); X if inmarginpar then X writeln(outfile,'} % - end of margin par '); X if infootnote then X writeln(outfile,'} % - end of footnote'); X if inliteral then X writeln(outfile,'\end{verbatim}'); X for i := 1 to listnestlevel do X writeln(outfile,'\end{itemize} % - RNOTOTEX forced list close'); X stopunderline( outfile ); X stopbold( outfile ) Xend; X X X X[GLOBAL] PROCEDURE endlatex( var outfile : text ); Xbegin X closeanyopenbrackets( outfile ); X writeln(outfile,'%'); X writeln(outfile,'% (put postamble statements here) '); X writeln(outfile,'%'); X writeln(outfile,'\end{document}') Xend; X X X X[GLOBAL] PROCEDURE adjustpagestyle( var f : text; newstyle : pagestyletype); Xbegin X pagestyle := newstyle; X case pagestyle of X empty : writeln(f,'\pagestyle{empty}'); X plain : writeln(f,'\pagestyle{plain}'); X headings : writeln(f,'\pagestyle{headings}'); X myheadings : begin X writeln(f,'\pagestyle{myheadings}'); X`009 write(f,'\markright{'); X writeargarray(f, title); X writeargarray(f, subtitle); X write(f, datestring ); X writeln(f,'}') X end X end; X case pagestyle of X empty : writeln(log,'\pagestyle{empty}'); X plain : writeln(log,'\pagestyle{plain}'); X headings : writeln(log,'\pagestyle{headings}'); X myheadings : begin X writeln(log,'\pagestyle{myheadings}'); X`009 write(log,'\markright{'); X writeargarray(log, title); X writeargarray(log, subtitle); X write(log, datestring ); X writeln(log,'}') X end X end Xend; X X X X X[GLOBAL] PROCEDURE writecharwidth( var f : text; nchars : integer); Xconst X widthofcharincm = 0.254; { 10 chars per inch, 2.54 cm per inch } X maxwidth = 20.0; X minwidth = -20.0; Xvar X cm : real; Xbegin X cm := nchars * widthofcharincm; X if cm > maxwidth then X begin X writeln(log,'[too many chars to skip, ',nchars,' = ',cm:10:2,'cm]'); X cm := 1.0 X end; X if cm < minwidth then X begin X writeln(log,'[too many chars to skip ',nchars,' = ',cm:10:2,'cm]'); X cm := -1.0 X end; X write(f, cm:6:2, 'cm '); X write(log, cm:6:2,'cm ') Xend; X X X X[GLOBAL] PROCEDURE writecharheight( var f : text; nlines : integer ); Xconst X heightoftextincm = 0.425; { 6 lines per inch, 2.54 cm per inch } X maxheight = 25.0; X minheight = -25.0; Xvar X cm : real; Xbegin X cm := nlines * heightoftextincm; X if cm > maxheight then X begin X writeln(log,'[too many lines to skip, ',nlines,' = ',cm:10:2,'cm]'); X cm := 1.0 X end; X if cm < minheight then X begin X writeln(log,'[too many lines to skip ',nlines,' = ',cm:10:2,'cm]'); X cm := -1.0 X end; X write(f, cm:6:2,'cm '); X write(log, cm:6:2,'cm ') Xend; X X X X X V[GLOBAL] PROCEDURE adjustlength( var outfile : text; modified : parameterchange Xstates; Xlengthvalue : integer; adjustmentvalue : integer; charwidth : boolean; Xlatexname : pckstr ); Xbegin X case modified of X nochange : nullstatement; X altered : begin X`009 write(outfile,'\addtolength{',latexname,'}{'); X if charwidth then X writecharwidth(outfile, adjustmentvalue) X else X writecharheight(outfile, adjustmentvalue); X writeln(outfile,'}') X end; X assigned : begin X`009 write(outfile,'\setlength{',latexname,'}{'); X if charwidth then X writecharwidth(outfile, lengthvalue) X`009 else X`009 writecharheight(outfile, lengthvalue); X writeln(outfile,'}') X end X end; X case modified of X nochange : noconversion; X altered : begin X`009 write(log,'\addtolength{',latexname,'}{'); X if charwidth then X writecharwidth(log, adjustmentvalue) X else X writecharheight(log, adjustmentvalue); X writeln(log,'}') X end; X assigned : begin X`009 write(log,'\setlength{',latexname,'}{'); X if charwidth then X writecharwidth(log, lengthvalue) X`009 else X`009 writecharheight(log, lengthvalue); X writeln(log,'}') X end X end Xend; X X X V[GLOBAL] PROCEDURE adjustcounter( var outfile : text; modified : parameterchan Xgestates; Xcountervalue : integer; adjustmentvalue : integer; latexname : pckstr ); Xbegin X case modified of X nochange : nullstatement; V altered : writeln(outfile,'\addtocounter{',latexname,'}{',adjustmentvalu Xe,'}'); V assigned : writeln(outfile,'\setcounter{',latexname,'}{',countervalue,'}' X) X end; X case modified of X nochange : noconversion; V altered : writeln(log,'\addtocounter{',latexname,'}{',adjustmentvalue,'} X'); V assigned : writeln(log,'\setcounter{',latexname,'}{',countervalue,'}') X X end Xend; X X X X[GLOBAL] PROCEDURE adjuststyle(var outfile : text; s : styletype; X`009 latexname : pckstr ); Xbegin X case s of X undetermined : nullstatement; V decimal : writeln(outfile,'\renewcommand{\the',latexname,'}{\arabic{' X,latexname,'}}'); V octal : writeln(outfile,'\renewcommand{\the',latexname,'}{\arabic{' X,latexname,'}}'); V hexidecimal : writeln(outfile,'\renewcommand{\the',latexname,'}{\arabic{' X,latexname,'}}'); V romanupper : writeln(outfile,'\renewcommand{\the',latexname,'}{\Roman{',l Xatexname,'}}'); V romanlower : writeln(outfile,'\renewcommand{\the',latexname,'}{\roman{',l Xatexname,'}}'); V romanmixed : writeln(outfile,'\renewcommand{\the',latexname,'}{\roman{',l Xatexname,'}}'); V letterupper : writeln(outfile,'\renewcommand{\the',latexname,'}{\Alpha{',l Xatexname,'}}'); V letterlower : writeln(outfile,'\renewcommand{\the',latexname,'}{\alpha{',l Xatexname,'}}'); V lettermixed : writeln(outfile,'\renewcommand{\the',latexname,'}{\alpha{',l Xatexname,'}}'); X nostyle : nullstatement X end; X case s of X undetermined : noconversion; V decimal : writeln(log,'\renewcommand{\the',latexname,'}{\arabic{',lat Xexname,'}}'); V octal : writeln(log,'\renewcommand{\the',latexname,'}{\arabic{',lat Xexname,'}}'); V hexidecimal : writeln(log,'\renewcommand{\the',latexname,'}{\arabic{',lat Xexname,'}}'); V romanupper : writeln(log,'\renewcommand{\the',latexname,'}{\Roman{',latex Xname,'}}'); V romanlower : writeln(log,'\renewcommand{\the',latexname,'}{\roman{',latex Xname,'}}'); V romanmixed : writeln(log,'\renewcommand{\the',latexname,'}{\roman{',latex Xname,'}}'); V letterupper : writeln(log,'\renewcommand{\the',latexname,'}{\Alpha{',latex Xname,'}}'); V letterlower : writeln(log,'\renewcommand{\the',latexname,'}{\alpha{',latex Xname,'}}'); V lettermixed : writeln(log,'\renewcommand{\the',latexname,'}{\alpha{',latex Xname,'}}'); X nostyle : noconversion X end Xend; X X XEND. X $ GOSUB UNPACK_FILE $ FILE_IS = "LINK_RNOTOTEX.COM" $ CHECKSUM_IS = 960643418 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$ IF ("''P1'" .EQS. "") THEN $ PI="NODEBUG" X$ LINK/'P1' RNOTOTEX,- X`009 UTILITYOPS,- X`009 SCREENHANDLERS,- X`009 ARGOPS,- X`009 BASICFILEOPS,- X`009 FLAGOPS,- X`009 TREEANDLISTOPS,- X`009 LATEXOPS,- X`009 INIOPS,- X`009 CONVERSION,- X`009 DSROPS,- X`009 GETCLI $ GOSUB UNPACK_FILE $ FILE_IS = "RNOTOTEX.CLD" $ CHECKSUM_IS = 958872892 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X!`009 X!`009FILE TO SET UP THE RNOTOTEX COMMAND XDEFINE VERB RNOTOTEX X IMAGE TEX_CONVERTAREA:RNOTOTEX.EXE X QUALIFIER TEX X PARAMETER P1 LABEL=RNO_FILE,PROMPT="RNO file",VALUE(TYPE=$FILE,REQUIRED) X PARAMETER P2 LABEL=TEX_FILE,PROMPT="TeX file",VALUE(TYPE=$FILE,REQUIRED) $ GOSUB UNPACK_FILE $ FILE_IS = "RNOTOTEX.PAS" $ CHECKSUM_IS = 1062041168 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X[INHERIT('BASICFILEOPS','CONVERSION', X'LATEXOPS','TREEANDLISTOPS','FLAGOPS','DSROPS','INIOPS')] X XPROGRAM RNOTOTEX( INPUT, OUTPUT); X X{ PROGRAM TO CONVERT A RUNOFF FORMAT FILE TO TEX FORMAT } X{ DEVELOPED BY RANDALL VENHOLA, SUMMER 1987 ON CCRS SMOKE:: } X{ USING VAX PASCAL } X XLABEL X X ENDOFPROGRAM; X XCONST X DEFAULTFONT = 10; X DEFAULTSTYLE = 'report'; X XVAR X X RNO, TEX, INI : TEXT; X RUNOFFTREE : ARGTREE; X CURRENTDATE, CURRENTTIME : DATETIMETYPE; X INPUTFID, OUTPUTFID : FIDTYPE; X LASTINPUTCHAR, CURRENTCHAR : [GLOBAL] CHAR; X TOTALLINES, TOTALCHARS : [GLOBAL] INTEGER; X TOTALGOODDSRCOMMANDS : [GLOBAL] INTEGER; X TOTALBADDSRCOMMANDS : [GLOBAL] INTEGER; X TABRECORD : [GLOBAL] TABRECORDTYPE; X LOG`009 : [GLOBAL] TEXT; X COLUMNCOUNTER : [GLOBAL] INTEGER; X X{emergency exit procedure} X[GLOBAL] PROCEDURE GOTOENDOFPROGRAM; XBEGIN X GOTO ENDOFPROGRAM XEND; X X XBEGIN X X OPENLOGFILE; X GREETUSER( CURRENTDATE, CURRENTTIME ); X USERINTERFACE( INPUTFID, OUTPUTFID, RNO, TEX ); X SETUPTREE( INI, RUNOFFTREE ); X PUTCOMMENTSTOOUTPUT( TEX, INPUTFID, CURRENTDATE, CURRENTTIME); X STARTLATEX( TEX, DEFAULTFONT, DEFAULTSTYLE ); X INITFLAGTABLE; X INITGLOBALVARS; X INITCHARREADER( RNO ); X PARSEFILE(RNO, TEX, RUNOFFTREE ); X ENDLATEX( TEX ); X XENDOFPROGRAM: X X WRITELN(LOG,'[TOTAL GOOD DSR COMMANDS = ',TOTALGOODDSRCOMMANDS,']'); X WRITELN(LOG,'[TOTAL BAD DSR COMMANDS = ',TOTALBADDSRCOMMANDS,']'); X CLOSEFILES( RNO, TEX ); X CLOSELOGFILE X XEND. X $ GOSUB UNPACK_FILE $ FILE_IS = "RNOTOTEX.RNH" $ CHECKSUM_IS = 808919667 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X.AP X.NOFLAGS ACCEPT X.NONUMBER X.LITERAL X X1 RNOTOTEX X X $ RNOTOTEX[ /qualifier] RNO-FILE-SPEC TEX-FILE-SPEC X X.END LITERAL X.LM+2 XReads a Digital Standard Runoff format file and creates the LaTeX Xequivalent. X.LM-2 X.LITERAL X X2 Parameters X X RNO-FILE-SPEC X X.END LITERAL X.LM+2 X ... is the name of the input DSR format file. The default type Xis .RNO. X.LITERAL X X TEX-FILE-SPEC X X.END LITERAL X X ... is the name of the output TEX file spec. The default Xtype is .TEX. X.LM-2 X.LITERAL X X2 Command-Qualifiers X X/TEX X X /TEX X X.END LITERAL X.LM+2 XPreserve embedded TeX and LaTeX commands in the input DSR file. XAny commands found are copied directly to the output .TEX file. The Xdefault is /NOTEX. X X.LM-2 X.LITERAL X X2 Example X X.END LITERAL X.LM+2 XThe following DCL Xcommands convert the DSR file FOO.RNO to FOO.TEX and prints the XLN3 file on the LN03. The log of the conversion is also printed Xand deleted. X.LITERAL X X $ RNOTOTEX FOO.RNO FOO.TEX X $ LATEX/BATCH FOO.TEX X $ DVI2LN3 FOO.DVI X $ PRINT/FORM=TEX FOO.LN3 X $ PRINT/DELETE RNOTOTEX.LOG X X.END LITERAL X XNote that there isn't a one-to-one mapping of DSR commands to LaTeX Xcommands and that more LaTeX text fits on a page than a RUNOFF file. XThe first output may be messy! The output .TEX file must be Xedited after examining the first printing. It may take a few tries to Xget the output that you want. X XThe program was designed for those familiar with both LaTeX and DSR Xand would like to upgrade older documents to LaTeX format. $ GOSUB UNPACK_FILE $ FILE_IS = "RNOTOTEX_GUIDE.TEX" $ CHECKSUM_IS = 1613414640 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X\documentstyle{report} X% X% DOCUMENTATION FOR PROGRAM RNOTOTEX X% WRITTEN IN LATEX USING LSE X% R. VENHOLA, 9-MAR-88 X% X% Revised by John Edgecombe, 6-JUL-1988, restricting to RNOTOTEX only X% X% put section headings on top of page X\pagestyle{headings} X X% release the LaTeX boundaries for margins X\setlength{\oddsidemargin}{0.5in} X\setlength{\evensidemargin}{0.0in} X\setlength{\topmargin}{0.0in} X X% make the page size wider and longer X\setlength{\textwidth}{6.0in} % 8.5 by 11 page with 1 inch margins X\setlength{\textheight}{8.0in} % on each side X X% generate a title page X\author{R.~Venhola} X\title{ { \Huge \TeX\ \& \LaTeX\ \\ X\vspace*{1.0ex} XCONVERSION PROGRAM } \\ XRNOTOTEX X} X\maketitle X X% An IDX file is to be generated X\makeindex X X% A short form command X\newcommand{\lb}{\large\bf} X X\begin{document} X X\chapter{Quick Reference} XExecute SETUP.COM ({\tt @SETUP.COM}) to set the DCL command syntax Xbefore using the RNOTOTEX command. X X\section{RNOTOTEX} XDCL command format is : X X\begin{center} X X{\large\bf \$ RNOTOTEX[\ /qualifier] RNO-FILE-SPEC TEX-FILE-SPEC} X X\end{center} X XReads a {\em Digital Standard Runoff} format file and creates the \LaTeX\ Xequivalent. X X X\subsection{Parameters} X X\begin{center} X X X {\large\sl RNO--FILE--SPEC } X X\end{center} X X$\ldots$ is the name of the input DSR format file. The default type Xis~{\tt{.RNO}}. X\begin{center} X X X {\large\sl TEX--FILE--SPEC } X X\end{center} X$\ldots$ is the name of the output~{\tt{TEX}} file spec. The default Xtype is~{\tt{.TEX}}. X X\subsection{/TEX} X X\begin{center} X X{\large\sl /TEX } X X\end{center} X XPreserve embedded \TeX\ and \LaTeX\ commands in the input DSR file. XAny commands found are copied directly to the output~{\tt{.TEX}} file. The Xdefault is /NOTEX. X X\subsection{Example} XThe following DCL Xcommands convert the DSR file FOO.RNO to FOO.TEX and prints the XLN3 file on the LN03. The log of the conversion is also printed Xand deleted. X X\begin{verbatim} X X $ RNOTOTEX FOO.RNO X $ LATEX FOO.TEX X $ DVI2LN3 FOO.DVI X $ PRINT/FORM=TEX FOO.LN3 X $ PRINT/DELETE RNOTOTEX.LOG X X\end{verbatim} X XNote that there isn't a one-to-one mapping of DSR commands to \LaTeX\ Xcommands and that more \LaTeX\ text fits on a page than a RUNOFF file. VThe first output may be messy! The output~{\tt{.TEX}} file must \index{messy X RNOTOTEX output} Xedited after examining the first printing. It may take a few tries to Xget the output that you want. X XThe program was designed for those familiar with both \LaTeX\ and DSR Xand would like to upgrade older documents to \LaTeX\ format. X\vspace{10.0cm} X\pagebreak X X\chapter{Introduction} X\TeX\ and \LaTeX\ are programs that allow programmers to typeset manuscripts Vfor high precision output devices, such as the \index{LN03} LN03 linked to the XSMOKE Xsystem at CCRS. \LaTeX\ can be thought of as a usable extension of X\TeX\ . Raw \TeX\ can be difficult to use. X XThe input files to the program are created in the same Xmanner as one would create a RUNOFF source file. The usual file type Xis ````{\tt{.TEX}}''. XThe files are in simple ASCII format, so that they may be created using an Xeditor such as EDT, SED or \index{LSE} LSE ({\bf L}anguage X{\bf S}ensitive {\bf E}ditor). As a note, the current version of XLSE on SMOKE recognizes {\tt{TEX}} files and initializes the programming Xlanguage to be ````LATEX'', with the appropriate expandable placeholders. X XCommands such as ````\verb+\chapter{Introduction}+'' are Xembedded in the~{\tt{.TEX}} Xfile. The file is run through either the \TeX\ or \LaTeX\ program, Vwhich will produces a~{\tt{.DVI}} file (for {\bf D}e{\bf{V}}ice {\bf I}ndepende Xnt). XThis {\tt{.DVI}} file must be converted to the local print format, which in our Xcase is done by the program {\bf DVI2LN3}. X XDocumentation on \TeX\ and \LaTeX\ commands are given in Knuth\cite{tex-manual} Xand Lamport\cite{latex-manual}\footnote{References are listed in the XBibliography}. XThe user requires some familiarity with either \TeX\ or \LaTeX\ Xto use the conversion programs described in this document. X XProgram {\bf RNOTOTEX} reads a DSR format file X(i.e.~FOO.RNO) and writes the equivalent\footnote{Well, not {\em really} Xequivalent, as you will find out in later} TEX format Xfile (FOO.TEX). X X\chapter{RNOTOTEX} XProgram {\bf RNOTOTEX} will read a DEC Standard RUNOFF (DSR) format text file, Xtranslate the RUNOFF commands to \LaTeX\ commands and write the corresponding XTEX file. The output file may then be processed by \LaTeX\ and printed Xon the local high quality printer. To use {\bf RNOTOTEX} one must have Xexecuted the DCL command procedure X````SETUP'' as described Xin the first chapter. X X\section{Execution} XProgram {\bf RNOTOTEX} requires two files names on the command line : the Xinput~.RNO file and the output~{\tt{.TEX}} file. For example~: X\begin{verbatim} X X $ RNOTOTEX FOO.RNO FOO.TEX X X\end{verbatim} Xtranslates the file FOO.RNO to the file FOO.TEX. The program does not Xrequire any user input. X X\section{Translation Actions} XThe program does four tasks. It will translate RUNOFF sectioning commands Xto \LaTeX\ sectioning commands, translate RUNOFF flags to \LaTeX\ commands, Xtranslate RUNOFF page directives to \LaTeX\ page directives and adjust X\LaTeX\ counters by the same amount as RUNOFF counters are to be adjusted. X X\subsection{Conversion of Sectioning Commands} X{\bf RNOTOTEX} converts RUNOFF sectioning commands to \LaTeX\ sectioning Xcommands. XThe output \LaTeX\ style is always {\tt report } in 10 point font. XThe sectioning command are converted in table~\ref{section-commands}. X\begin{table} X\begin{tabular}{ll} X{\lb RUNOFF }`009 & {\LaTeX\ \lb Command Generated} \\ X .HL1 text & \verb+\chapter{text}+ \\ X .HL2 text & \verb+\section{text}+ \\ X .HL3 text & \verb+\subsection{text}+ \\ X .HL4 text & \verb+\subsubsection{text}+ \\ X .HL5 text & \verb+\paragraph{text}+ \\ X .HL6 text & \verb+\subparagraph{text}+ \\ X\end{tabular} X\caption{Conversion of RUNOFF Sectioning Commands\label{section-commands}} X\end{table} X X\subsection{Conversion of RUNOFF Flags} XRUNOFF flags are converted to \LaTeX\ commands by {\bf RNOTOTEX}. XThis is a direct Xconversion process, i.e.~a RUNOFF underline command is converted to a X\LaTeX\ underline command. This does not always produce the prettiest Xresults (as one can use {\bf bold} and {\it italic} fonts in \LaTeX\ ), Xbut it is consistent. The author regrets that {\bf RNOTOTEX} does not Vhave the esthetic sense to decide when a font is more appropriate than \index{e Xsthetic sense} Xa converted RUNOFF command. The conversion process for RUNOFF flags Xis table~\ref{flag-commands}. X\begin{table} X\begin{tabular}{lcl} X{\lb RUNOFF Flag } & {\lb Flag } & {\LaTeX\ \lb Command Generated} \\ X{\lb Name } & {\lb Char } &`009`009\\ XAccept`009`009`009& \_`009`009 & \verb!\verb+?+! \\ XBold`009`009`009& *`009`009 & \verb+{\bf+$\cdots$\verb+}+ \\ XBreak`009`009`009& \verb+|+`009 & \verb+\\+ \\ XCapitalize`009`009& \verb+<+`009 & (see below) \\ XComment`009`009 & !`009`009 & \% \\ -+-+-+-+-+ End of part 4 +-+-+-+-+-
prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe) (07/12/88)
Sorry about the previous send, I am still learning this mailer. I'll try again with a different method. +-+-+-+ Beginning of part 5 +-+-+-+ XHyphenate`009`009& =`009`009 & \verb+\hyphenate{+$\cdots$\verb+}+ \\ XIndex`009`009`009& \verb+>+`009 & \verb+\index{+$\cdots$\verb+}+ \\ XLowercase`009`009& $\backslash`009$ & (see below) \\ XOverstrike`009`009& \%`009`009 & \verb+{\bf+$\cdots$\verb+}+ \\ XPeriod`009`009 & +`009`009 & \verb+\frenchspacing+ \\ XSpace`009`009`009& \#`009`009 & \verb*+\ + \\ XSubindex`009`009& \verb+>+ & \verb+\index{+$\cdots$\verb+}+ \\ XSubstitute`009`009& \$`009`009 & {\em not translated } \\ XUnderline`009`009& \&`009`009 & \verb+\underline{+$\cdots$\verb+}+ \\ XUppercase & \verb+^+ & (see below) \\ X\end{tabular} X\caption{Conversion of RUNOFF Flags\label{flag-commands}} X\end{table} X XCharacters following CAPITALIZE, LOWERCASE or UPPERCASE flags are converted Xto the appropriate case during the translation process by {\bf RNOTOTEX}, Xunless they are paired with other flags. In these other cases, the flags in XRUNOFF lock another flag on, such as the {\bf bold}ing flag described Xin the DSR manual\cite{dsr-manual} on page 3-6. {\bf RNOTOTEX} will lock the Xappropriate flag to the state it is in and produce the appropriate X\LaTeX\ commands. X\pagebreak XFor example, {\bf RNOTOTEX} will convert~: X\begin{verbatim} X X ^*These words are in bold face.\* X X to X X {\bf These words are in bold face.} X X\end{verbatim} X X\subsection{Conversion of RUNOFF Directives} XRNOTOTEX converts RUNOFF directives to \LaTeX\ directives. XRUNOFF allows one to enable or disable flags and change the Xdefault flag character for a flag. {\bf RNOTOTEX} will recognize these Xcommands and change the internal parsing setup so that the flag is X(or is not) recognized by the character specified. See the RUNOFF commands X````ENABLE'', ````DISABLE'', ````FLAGS'' and ````NO FLAGS'' described in the XRUNOFF manual. X VIn addition, {\bf RNOTOTEX} will translate RUNOFF commands such as ````NOFILL'' X, V````INDENT'' and ````LIST'' in the manner described in table~\ref{directive-com Xmands}. X\begin{table} X\begin{tabular}{ll} X{\lb RUNOFF }`009`009 & {\LaTeX\ \lb Command Generated} \\ X.APPENDIX`009`009 & \verb+\appendix+ \\ X.BLANK $n$`009`009 & \verb+\vspace{+$n$+\verb+}+ \\ X.BREAK`009`009`009 & \verb+\linebreak+ \\ X.CENTRE {\it text } & \verb+\begin{centering}+ \\ X`009`009`009 & {\it text } \\ X`009`009`009 & \verb+\end{centering}+ \\ X.FOOTNOTE {\it text}`009 & \verb+\footnote{+{\it text }\} \\ X.INDENT`009`009`009 & \verb+\indent+ \\ X.JUSTIFY`009`009 & \verb+\obeylines \obeyspaces+ \\ X.LIST $n$,````q''`009`009 & \verb+\begin{enumerate}+ \\ X.LITERAL`009`009 & \verb+\begin{verbatim}+ etc. \\ X.NOFILL`009`009`009 & \verb+\sloppy+ \\ X.PAGE`009`009`009 & \verb+\pagebreak[4]+ \\ X.SPACING`009`009 & \verb+\setlength{\baselineskip}{n}+ \\ X.SUBTITLE {\it text}`009 & \verb+\pagestyle{myheadings}+ etc. \\ X.TITLE {\it text}`009 & \verb+\pagestyle{myheadings}+ etc. \\ X\end{tabular} X\caption{Conversion of RUNOFF Directives\label{directive-commands}} X\end{table} X X\subsection{Conversion of RUNOFF Counters} X{\bf RNOTOTEX} converts the RUNOFF counter changes to \LaTeX\ counter Xadjustment changes. The conversion process in described in Xtable~\ref{counter-commands}. X\begin{table} X\begin{tabular}{ll} X{\lb RUNOFF}`009 & {\LaTeX\ \lb Command Generated} \\ X.NUMBER APPENDIX $n$ & \verb+\setcounter{\chapter}{+$n$\verb+}+ \\ X.NUMBER LEVEL $s,n$ & \verb+\setcounter{s}{n}+ \\ X.NUMBER LIST $n$ & \verb+\setcounter{\enumi}{n}+ \\ X.NUMBER PAGE $n$ & \verb+\setcounter{\page}{n}+ \\ X\end{tabular} X\caption{Conversion of RUNOFF Numbering\label{counter-commands}} X\end{table} X X\section{The Conversion LOG File} XEach time {\bf RNOTOTEX} is executed, it generates the file {\tt RNOTOTEX.LOG}. XIt is a record of each conversion used to generate the output \LaTeX\ commands. XIt is useful to users less familiar with \LaTeX\ and wish to learn by Xtrial and error rather than by reading the manual. It may also be Xuseful to experienced \LaTeX\ users to quickly identify what \LaTeX\ will Xproduce as output from the generated TEX file without going through Xa complete printing. X XIt is recommended that the log file be printed and deleted for each Xexecution. For example, the batch job~: X\begin{verbatim} X X $ @DCL:TEX_CONVERSION_SETUP X $ RNOTOTEX REPORT NEW_REPORT X $ PRINT/DELETE RNOTOTEX.LOG X X\end{verbatim} Xgenerates the file NEW\_REPORT.TEX from the file REPORT.RNO and prints Xthe log of the conversion process. The user can the examine the printed Xlog file and decide upon the editing required to produce a ````nice'' X\LaTeX\ output. X X X\begin{thebibliography}{99} X\addcontentsline{toc}{chapter}{Bibliography} X X\bibitem{latex-manual} Leslie Lamport {\em \LaTeX\ User Guide \& Reference} \\ XAddison-Wesley Publishing Company, 1986 X X\bibitem{tex-manual} Donald E.~Knuth {\em The \TeX book} \\ XAddison-Wesley Publishing Company, 1984 X X\bibitem{metafont-manual} Donald E.~Knuth {\em The METAFONT Book} \\ XAddison-Wesley Publishing Company, 1986 X X\bibitem{dsr-manual} Digital Equipment Corporation {Digital Standard RUNOFF X(DSR) Reference Manual } \\ XOrder \# AA-Z301B-TE, July 1985 X X\end{thebibliography} X\clearpage X X\setcounter{page}{0} X\pagenumbering{roman} X\tableofcontents X\listoftables X X\end{document} $ GOSUB UNPACK_FILE $ FILE_IS = "SCREENHANDLERS.PAS" $ CHECKSUM_IS = 860971282 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X{`009operations for input/output of data from the terminal. X`009Randall Venhola`009`0095-May-1987 } X XMODULE screenhandlers; X X XTYPE X wordinteger = [WORD] 0..65535; X byterange = [BYTE] 0..255; X X X XVAR Xterminalerror : [HIDDEN,STATIC] integer := 0; Xcursorrow : [HIDDEN,STATIC] wordinteger := 1; Xcursorcolumn : [HIDDEN,STATIC] wordinteger := 1; X X X X[GLOBAL] PROCEDURE clearsubscreen( line, column : integer ); X X FUNCTION LIB$ERASE_PAGE(lineno, colno : wordinteger) : integer; extern; X X VAR X l, c : wordinteger; X XBEGIN X l := line; X c := column; X terminalerror := lib$erase_page(l,c); XEND; X X X X X[GLOBAL] PROCEDURE clearscreen; X XBEGIN X clearsubscreen(1,1); XEND; X X X X X[GLOBAL] PROCEDURE positioncursor( line, column : integer ); X X FUNCTION LIB$SET_CURSOR( lineno, colno : wordinteger ) : integer; extern; X X VAR X l, c : wordinteger; X XBEGIN X l := line; X c := column; X terminalerror := lib$set_cursor(l,c); X cursorrow := line; X cursorcolumn := column XEND; X X X[GLOBAL] PROCEDURE rollttyforward; XBEGIN X positioncursor(cursorrow+1, cursorcolumn) XEND; X X X[GLOBAL] PROCEDURE rollttyback; XBEGIN X if cursorrow > 1 then X positioncursor(cursorrow-1, cursorcolumn) XEND; X X X[GLOBAL] PROCEDURE putstringtoterminal( string : VARYING [limit] of CHAR; X`009`009`009`009`009 line, column : integer; X`009`009`009`009`009 reversevideo : boolean; X`009`009 `009`009`009 blinking : boolean); XCONST X maxscreenwidth = 132; X XVAR X l, c, flags, newcolumn : wordinteger; X X FUNCTION LIB$PUT_SCREEN(outtext : VARYING [C] OF CHAR; X `009 `009 lineno : wordinteger; colno : wordinteger; X`009`009 `009 flags : wordinteger) : integer; extern; X X XBEGIN X l := line; X c := column; X if reversevideo then X if blinking then X flags := 3 X else X flags := 2 X else X flags := 0; X terminalerror := lib$put_screen(string, l, c, flags); X newcolumn := 1 + length(string) + cursorcolumn; X if newcolumn > maxscreenwidth then X positioncursor(cursorrow + 1, 1) X else X positioncursor( cursorrow, newcolumn) XEND; X X X[GLOBAL] PROCEDURE ttywriteln; Xconst X carriagereturn = 13; X linefeed = 10; X Xvar X endofline : [STATIC] VARYING[2] of char; XBEGIN X endofline.body[1] := chr(carriagereturn); X endofline.body[2] := chr(linefeed); X endofline.length := 2; X putstringtoterminal(endofline, cursorrow, cursorcolumn, false, false); X positioncursor(cursorrow + 1, 1) XEND; X X X X X[GLOBAL] PROCEDURE ttyreadln( VAR string : VARYING [limit] of char ); X X FUNCTION LIB$GET_SCREEN(VAR inputtext : VARYING [lim1] OF CHAR; V promptstring : VARYING [lim2] OF CHAR; VAR outlen : wordinteger := %IMMED 0) X : integer; extern; X X VAR X len : wordinteger; X prompt : [STATIC] VARYING [2] OF CHAR := '>'; X XBEGIN X terminalerror := lib$get_screen(string, prompt, len); X ttywriteln XEND; X X X X[GLOBAL] PROCEDURE findcursor( var line, column : integer ); X XBEGIN X line := cursorrow; X column := cursorcolumn; XEND; X X X X[GLOBAL] FUNCTION terminalerrorcode : integer; X XBEGIN X terminalerrorcode := terminalerror; XEND; X X X X X[GLOBAL] PROCEDURE ttywritestring( string : VARYING [limit] OF CHAR); X XBEGIN X putstringtoterminal(string, cursorrow, cursorcolumn, false, false); XEND; X X X[GLOBAL] PROCEDURE ttywriteint( int : integer ); Xconst X maxintchars = 20; Xvar X s : varying[maxintchars] of char; XBEGIN X writev(s, int:1); X ttywritestring( s ) XEND; X X X[GLOBAL] PROCEDURE ttywritereal( floating : real; fieldwidth, X`009 ndigits : integer); Xconst X maxfieldwidth = 30; Xvar X s : varying[maxfieldwidth] of char; XBEGIN X writev(s, floating:fieldwidth:ndigits); X ttywritestring( s ) XEND; X XEND. X X $ GOSUB UNPACK_FILE $ FILE_IS = "SETUP.COM" $ CHECKSUM_IS = 1043937621 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$ set command rnototex X$ define init$rnototex rnototex.ini $ GOSUB UNPACK_FILE $ FILE_IS = "TREEANDLISTOPS.PAS" $ CHECKSUM_IS = 894243433 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X{ TREE AND LIST OPERATIONS - VERSION CVF01A X `009 RANDALL VENHOLA JUNE 30, 1987 X`009 DOCUMENTED IN MODULEAREA:TREEOPS.TEX } X X X X[INHERIT('SCREENHANDLERS','ARGOPS','UTILITYOPS')] XMODULE TREEANDLISTOPS; X X{ list and tree operations - requires the external declarations for X data structures X X`009 ARGUMENT - the item of the list X`009 COMPARISONS - possible results of comparisons X`009 SETOFCOMPARISONS - set of above ordinal type X X the package is to be copied to the area of the source code and X recompiled. It expects to find the environment file for the above X data structures and at least the following routines : X X function compareargs( leftarg, rightarg : argument ) : comparisons; X function argtexindex( arg : argument ) : integer; X`009 } X XCONST X X nulllist = NIL; X nulltree = NIL; X XTYPE X Xarglist = ^listnode; X Xargtree = ^treenode; X X treenode = record X`009 parentnode : argtree; X`009 contents : arglist X`009 end; X X listnode = record X`009 field : argument; X`009 next : arglist; X`009 subtree : argtree X`009 end; X X X X X[GLOBAL] FUNCTION nextinlist( list : arglist ) : arglist; Xbegin X if list = nulllist then X errorexit('nextinlist','empty list') X else X nextinlist := list^.next Xend; X X X X X[GLOBAL] FUNCTION firstarg( list : arglist ) : argument; Xbegin X if list = nulllist then X errorexit('firstlistpointer','empty list') X else X firstarg := list^.field Xend; X X X[GLOBAL] FUNCTION arglistlength( list : arglist ) : integer; Xbegin X if list = nulllist then X arglistlength := 0 X else X arglistlength := arglistlength(nextinlist(list)) + 1 Xend; X X X X X X[GLOBAL] FUNCTION leadingnodesubtree( list : arglist ) : argtree; Xbegin X if list = nulllist then X errorexit('listsubtree','empty list') X else X leadingnodesubtree := list^.subtree Xend; X X X X X X[GLOBAL] FUNCTION listofargsattree( tree : argtree ) : arglist; Xbegin X if tree = nulltree then X errorexit('listofargsattree','empty tree') X else X listofargsattree := tree^.contents Xend; X X X X[GLOBAL] FUNCTION treeisroot( tree : argtree ) : boolean; Xbegin X if tree = nulltree then X treeisroot := TRUE X else X treeisroot := tree^.parentnode = nulltree Xend; X X X X X[GLOBAL] FUNCTION parenttree( tree : argtree ) : argtree; Xbegin X if treeisroot( tree ) then X errorexit('parenttree','tree is root') X else X parenttree := tree^.parentnode Xend; X X X X X[GLOBAL] PROCEDURE insertarginsortedlist( var list : arglist; X`009 arg : argument; var pointertoarg : arglist ); X`009 Xtype X scanstates = (searching, atfrontoflist, positionfound, endoflist); Xvar X state : scanstates; X p, prevp, newp : arglist; X comp : comparisons; X X procedure allocatenewp; X begin X new( newp ); X newp^.next := nulllist; X newp^.subtree := nulltree; X newp^.field := arg; X pointertoarg := newp X end; X Xbegin X if list = nulllist then X begin X allocatenewp; X list := newp X end X else X begin X p := list; X comp := compareargs(arg, firstarg(list)); X if (comp = lessthan) or (comp = equal) then X `009 state := atfrontoflist X else X begin X state := searching; X repeat X prevp := p; X p := nextinlist(p); X`009 if p = nulllist then X`009 state := endoflist X`009 else X`009 begin X`009 comp := compareargs(arg, firstarg(p)); X`009 if (comp = lessthan) or (comp = equal) then X`009 state := positionfound X`009 end X until state <> searching X end; X if comp = equal then X warningmessage('insertarginsortedlist','already in list') X else X case state of X atfrontoflist : begin X`009 allocatenewp; X`009 newp^.next := list; X`009 list := newp X`009 end; X positionfound : begin X`009 allocatenewp; X `009 newp^.next := p; X`009 prevp^.next := newp X `009 end; X`009 endoflist : begin X`009 allocatenewp; X`009 prevp^.next := newp X`009 end X end {case} X end {else} Xend; X `009 X X X X[GLOBAL] PROCEDURE appendargonlist( var list : arglist; arg : argument ); Xvar X p, prevp, newp : arglist; Xbegin X if list = nulllist then X begin X new( newp ); X`009newp^.subtree := nulltree;`009 X newp^.field := arg; X newp^.next := nulllist; X list := newp X end X else X begin X `009p := list; X repeat X`009 prevp := p; X p := nextinlist(p) X until p = nulllist; X new( newp ); X newp^.subtree := nulltree; X newp^.field := arg; X`009newp^.next := nulllist; X prevp^.next := newp X end Xend; X X X X X[GLOBAL] PROCEDURE preceedargonlist( var list : arglist; arg : argument ); Xvar X newl : arglist; Xbegin X new(newl); X newl^.subtree := nulltree; X newl^.field := arg; X newl^.next := list; X list := newl Xend; X X X X[GLOBAL] FUNCTION listcopy( list: arglist ) : arglist; Xvar X l : arglist; X X procedure prec( list : arglist ); X begin X if list = nulllist then X l := nulllist X else X begin X prec( nextinlist(l) ); X preceedargonlist( l, firstarg(l)) X end X end; X Xbegin X if list = nulllist then X listcopy := nulllist X else X begin X prec( list ); X listcopy := l X end Xend; X X X X[GLOBAL] FUNCTION reverseoflist( list: arglist ) : arglist; Xvar X l : arglist; X X procedure app( list : arglist ); X begin X if list = nulllist then X l := nulllist X else X begin X app( nextinlist(l) ); X appendargonlist( l, firstarg(l)) X end X end; X Xbegin X if list = nulllist then X reverseoflist := nulllist X else X begin X app( list ); X reverseoflist := l X end Xend; X X X X X[GLOBAL] FUNCTION leadingnodehassubtree( list : arglist ) : boolean; Xbegin X if list = nulllist then X leadingnodehassubtree := false X else X leadingnodehassubtree := list^.subtree <> nulltree Xend; X X X X X X X[GLOBAL] PROCEDURE findarginsortedlist( list : arglist; arg : argument; X`009 var found : boolean; X`009 var pointertoarg : arglist ); X Xtype X searchstates = (searching, positionfound, foundlessthanlocation, endoflist); Xvar X p : arglist; X state : searchstates; X currentarg : argument; X comp : comparisons; Xbegin X found := false; X if list <> nulllist then X begin X p := list; X state:= searching; X repeat X currentarg := firstarg(p); X`009 comp := compareargs(arg, currentarg); X`009 case comp of X notvalid : errorexit('findarginsortedlist','invalid-comparison'); X`009 lessthan : state := foundlessthanlocation; X equal : begin X`009 state := positionfound; X`009 pointertoarg := p; X`009`009 found := true X end; X greaterthan : nullstatement X end; {case} X if not found then X begin X`009 p := nextinlist(p); X if p = nulllist then X`009 state := endoflist X`009 end X until state <> searching X end Xend; X X X X X[GLOBAL] PROCEDURE findarginlist( list : arglist; arg : argument; X`009 var found : boolean; X`009 var pointertoarg : arglist ); Xvar X p : arglist; X compare : comparisons; Xbegin X found := false; X if list <> nulllist then X begin X p := list; X repeat X compare := compareargs( arg, firstarg(p) ); X if compare = equal then X begin X found := true; X`009 pointertoarg := p X end X else X p := nextinlist(p) X until (p = nulllist) or (found) X end Xend; X X X X X X[GLOBAL] FUNCTION nargsattreenode( tree : argtree ) : integer; Xbegin X if tree = nulltree then X nargsattreenode := 0 X else X nargsattreenode := arglistlength( tree^.contents ) Xend; X X X X X X X X X X[GLOBAL] PROCEDURE insertlistintotree( list : arglist; var tree : argtree); X`009 Xprocedure subinsert( list : arglist; var tree : argtree; X`009 parentpointer : arglist ); Xlabel X routineexit; Xvar X newtree : argtree; X found : boolean; X arg : argument; X pointertoarg : arglist; Xbegin X if list = nulllist then X goto routineexit; X arg := firstarg(list); X if tree = nulltree then X begin X new( newtree ); X newtree^.contents := nulllist; X appendargonlist(newtree^.contents, arg); X if parentpointer = nulllist then X newtree^.parentnode := nulltree X else X newtree^.parentnode := parentpointer^.subtree; V subinsert(nextinlist(list), newtree^.contents^.subtree, newtree^.contents X); X if parentpointer = nulllist then X tree := newtree X else X`009parentpointer^.subtree := newtree; X goto routineexit X end; X findarginsortedlist( tree^.contents, arg, found, pointertoarg); X if not found then X insertarginsortedlist(tree^.contents, arg, pointertoarg); X subinsert( nextinlist(list), pointertoarg^.subtree, pointertoarg); X routineexit : nullstatement Xend; X Xbegin X subinsert( list, tree, nulllist) Xend; X X X X[GLOBAL] PROCEDURE searchtreeforlist( tree : argtree; list : arglist; X var found : boolean; var indexfound, depthfoundat : integer); X X procedure subsearch( tree : argtree; list : arglist ); X label X routineexit; X var X findsuccessful : boolean; X arg: argument; X pointertoarg : arglist; X begin X if tree = nulltree then X goto routineexit; X if list = nulllist then X goto routineexit; X arg := firstarg(list); X depthfoundat := depthfoundat + 1; V findarginsortedlist(listofargsattree(tree), arg, findsuccessful, pointert Xoarg); X if findsuccessful then X begin X found := true; X indexfound := argtexindex(firstarg(pointertoarg)); X if leadingnodehassubtree(pointertoarg) then X subsearch(leadingnodesubtree(pointertoarg), nextinlist(list)) X end; X routineexit : nullstatement X end; X Xbegin {searchtree} X found := false; X indexfound := indexofunknowntexcommand; X if list = nulllist then X warningmessage('searchtree','given empty list') X else X subsearch(tree, list) Xend; X X X X X X X[GLOBAL] PROCEDURE padwithnullarguments( var list : arglist; index : integer; X`009 requiredlength : integer ); Xvar X arg : argument; X i, ntoappend : integer; Xbegin X initarg(arg, [nulltype], blank, index, TRUE); X ntoappend := requiredlength - arglistlength(list); X for i := 1 to ntoappend do X appendargonlist(list, arg) Xend; X X X X X[GLOBAL] PROCEDURE listtoarray(var list : arglist; index : integer; V var arr : argarray; requiredlength :integer ) X; Xvar X l : arglist; X i : integer; Xbegin X if requiredlength > maxargsinarray then X errorexit('listtoarray','array size exceeded'); X padwithnullarguments( list, index, requiredlength); X l := list; X for i := 1 to requiredlength do X begin X arr[i] := firstarg(l); X l := nextinlist(l) X end Xend; X X X X X[GLOBAL] PROCEDURE dlist( var f : text; l : arglist ); Xconst X linelength = 75; Xvar X nchars : integer; X X procedure dl( l : arglist ); X var X s : pckstr; X begin X if l = nulllist then X writeln(f) X else X begin X s := argliteral(firstarg(l), true); X if (length(s) + nchars + 1) > linelength then X begin X writeln(f); X nchars := 0 X end; X nchars := nchars + length(s) + 1; X write(f, s, blank); X dl( nextinlist(l)) X end Xend; X Xbegin X nchars := 0; X dl( l ) Xend; X X X[GLOBAL] PROCEDURE dtree( var f : text; tree : argtree); X X procedure dt( name : pckstr; tree : argtree ); X var X l : arglist; X s : pckstr; X begin X if tree <> nulltree then X begin X writeln(f); X writeln(f,'**** "',name,'" NODE HAS ****'); X l := listofargsattree(tree); X dlist(f,l); X writeln(f,'**** ',name,' *************'); X while l <> nulllist do X begin X if leadingnodehassubtree(l) then X begin X s := argliteral(firstarg(l), true); X dt(s, leadingnodesubtree(l)) X end; X l := nextinlist(l) X end X end X end; X X begin X dt('<ROOT>', tree) Xend; X X X X[HIDDEN] PROCEDURE texwritearg( var f : text; arg : argument); XEXTERN; X X X X[GLOBAL] PROCEDURE writeargarray( var f : text; arr : argarray ); Xvar X i : integer; Xbegin X for i := 1 to maxargsinarray do X if argclass(arr[i]) <> [nulltype] then X texwritearg(f, arr[i]) Xend; X X X X X[GLOBAL] PROCEDURE makenullarray( var arr : argarray ); Xvar X templist : arglist; Xbegin X templist := nulllist; X padwithnullarguments(templist, indexofunknowntexcommand, maxargsinarray); X listtoarray( templist, indexofunknowntexcommand, arr, maxargsinarray) Xend; X X X XEND. X $ GOSUB UNPACK_FILE $ FILE_IS = "UTILITYOPS.PAS" $ CHECKSUM_IS = 236858740 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X[INHERIT('SCREENHANDLERS')] X XMODULE UTILITYOPS; X XCONST X blank = ' '; X X X XPROCEDURE gotoendofprogram; XEXTERN; X X X X[GLOBAL] PROCEDURE errorexit( caller : varying[limit1] of char; X`009 message : varying[limit2] of char ); Xbegin X ttywriteln; X ttywritestring('?ERROR from '); X ttywritestring(caller); X ttywritestring(message); X ttywriteln; X gotoendofprogram Xend; X X X X X[GLOBAL] PROCEDURE warningmessage( caller : varying[limit1] of char; X`009 message : varying[limit2] of char ); X Xbegin X ttywriteln; X ttywritestring('%WARNING from procedure '); X ttywritestring(caller); X ttywritestring('"'); X ttywritestring(message); X ttywritestring('"'); X ttywriteln Xend; X X X X X[GLOBAL] PROCEDURE nullstatement; Xbegin Xend; X X X X X[GLOBAL] FUNCTION capchar ( ch : char ) : char; Xbegin X if ch in ['a'..'z'] then X capchar := chr(ord(ch) - 32) X else X capchar := ch Xend; X X X X X[GLOBAL] FUNCTION lcchar( ch : char ) : char; Xbegin X if ch in ['A'..'Z'] then X lcchar := chr(ord(ch) + 32) X else X lcchar := ch Xend; X X XEND. $ GOSUB UNPACK_FILE $ EXIT -+-+-+-+-+ End of part 5 +-+-+-+-+-