summaryrefslogtreecommitdiff
path: root/support/rnototex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/rnototex
Initial commit
Diffstat (limited to 'support/rnototex')
-rw-r--r--support/rnototex/README22
-rw-r--r--support/rnototex/argops.pas293
-rw-r--r--support/rnototex/basicfileops.pas215
-rw-r--r--support/rnototex/compile_rnototex.com13
-rw-r--r--support/rnototex/conversion.pas1442
-rw-r--r--support/rnototex/dsrops.pas323
-rw-r--r--support/rnototex/flagops.pas675
-rw-r--r--support/rnototex/getcli.for52
-rw-r--r--support/rnototex/iniops.pas200
-rw-r--r--support/rnototex/latexops.pas276
-rw-r--r--support/rnototex/link_rnototex.com13
-rw-r--r--support/rnototex/rnototex.cld7
-rw-r--r--support/rnototex/rnototex.com7
-rw-r--r--support/rnototex/rnototex.ini251
-rw-r--r--support/rnototex/rnototex.pas60
-rw-r--r--support/rnototex/rnototex.rnhbin0 -> 1577 bytes
-rw-r--r--support/rnototex/rnototex.upd10
-rw-r--r--support/rnototex/rnototex_guide.tex340
-rw-r--r--support/rnototex/screenhandlers.pas189
-rw-r--r--support/rnototex/setup.com2
-rw-r--r--support/rnototex/treeandlistops.pas609
-rw-r--r--support/rnototex/utilityops.pas72
22 files changed, 5071 insertions, 0 deletions
diff --git a/support/rnototex/README b/support/rnototex/README
new file mode 100644
index 0000000000..540cb45324
--- /dev/null
+++ b/support/rnototex/README
@@ -0,0 +1,22 @@
+This is the distribution of rnototex that I used at my previous job.
+It took me ages to get it all working, but here it is.
+
+The sources are in VMS Pascal, and can be built using the files
+
+ compile_rnototex.com
+ link_rnototex.com
+
+For those who don't have Pascal, I've made an executable on the only
+VMS system I have access to nowadays, which is a VAX running OpenVMS
+v6.1; to avoid excitement with transferring to and from the Un*x-based
+CTAN archives, that executable is zip'ed using the info-zip package
+(an unzipper is available from tex-archive/tools/info-zip/VMS/
+unz512x-vax.exe -- just run it to extract the contents).
+
+The author of this stuff is Peter Vanroose (vanroose@esat.kuleuven.ac.be)
+but he no longer supports it. As far as I can tell, this distribution
+works, but in the absence of any serious runoff files, I've not tested
+it very fully.
+
+Robin Fairbairns
+rf@cl.cam.ac.uk
diff --git a/support/rnototex/argops.pas b/support/rnototex/argops.pas
new file mode 100644
index 0000000000..8123892abf
--- /dev/null
+++ b/support/rnototex/argops.pas
@@ -0,0 +1,293 @@
+{ MODULE FOR LIST AND TREE OPERATIONS ARGUMENTS }
+{ RANDALL VENHOLA JULY 8, 1987 }
+
+
+[INHERIT('SCREENHANDLERS','UTILITYOPS'), environment('argops')]
+
+MODULE ARGOPS;
+
+CONST
+
+ maxchars = 31; {# of chars in arg literal }
+ maxargsinarray = 30; {for conversion to an array of args}
+ indexofunknowntexcommand = 0;
+
+TYPE
+
+ pckstr = VARYING [ maxchars ] of char;
+
+ comparisons = (notvalid, lessthan, equal, greaterthan);
+
+ setofcomparisons = set of comparisons;
+
+ argtype = ( dsrverb, int, signedint, stylespecifier,
+ textpckstr, character, quotedpckstr, nulltype);
+
+ setofargtype = set of argtype;
+
+ argument = record
+ source : pckstr;
+ isgeneralization : boolean;
+ texindex : integer;
+ class : setofargtype
+ end;
+
+ argarray = array[1..maxargsinarray] of argument;
+
+
+
+
+[GLOBAL] FUNCTION argliteral( arg : argument; smooth : boolean ) : pckstr;
+
+var
+ s : pckstr;
+ i,j, firstchar, lastchar : integer;
+ ch : char;
+
+ procedure findfirstchar( s : pckstr; var firstchar : integer);
+ begin
+ firstchar := 1;
+ while (firstchar < s.length) and (s.body[firstchar] <= blank) do
+ firstchar := firstchar + 1
+ end;
+
+ procedure findlastchar( s : pckstr; var lastchar : integer );
+ begin
+ lastchar := s.length;
+ while (lastchar > 1) and (s.body[lastchar] <= blank) do
+ lastchar := lastchar - 1
+ end;
+
+begin
+ if smooth then
+ begin
+ findfirstchar( arg.source, firstchar);
+ findlastchar( arg.source, lastchar);
+ j := 0;
+ for i := firstchar to lastchar do
+ begin
+ ch := arg.source.body[i];
+ if ch < blank then ch := blank;
+ if ch in ['a'..'z'] then ch := chr(ord(ch) - ord(blank));
+ j := j + 1;
+ s.body[j] := ch
+ end;
+ if (j = 1) and (s.body[1] = blank) then
+ s.length := 0
+ else
+ s.length := j
+ end
+ else
+ s := arg.source;
+ argliteral := s
+end;
+
+
+
+
+
+[GLOBAL] FUNCTION pckstrisgeneralization( s : pckstr ) : boolean;
+ label
+ routineexit;
+ var
+ flag : boolean;
+ begin
+ flag := false;
+ if s = '[N]' then
+ begin
+ flag := true;
+ goto routineexit
+ end;
+ if s = '[C]' then
+ begin
+ flag := true;
+ goto routineexit
+ end;
+ if s = '[Y]' then
+ begin
+ flag := true;
+ goto routineexit
+ end;
+ if s = '[T]' then
+ begin
+ flag := true;
+ goto routineexit
+ end;
+ if s = '[Q]' then
+ begin
+ flag := true;
+ goto routineexit
+ end;
+ routineexit : pckstrisgeneralization := flag
+end;
+
+
+
+
+[GLOBAL] FUNCTION argisgeneralization( arg : argument ) : boolean;
+begin
+ argisgeneralization := arg.isgeneralization
+end;
+
+
+
+
+[GLOBAL] FUNCTION textualmatch( arg1, arg2 : argument) : boolean;
+begin
+ textualmatch := false;
+ if (arg1.source = '[T]') and (textpckstr in arg2.class) then
+ textualmatch := true
+ else
+ if (arg2.source = '[T]') and (textpckstr in arg1.class) then
+ textualmatch := true
+end;
+
+
+
+
+[GLOBAL] FUNCTION compareargs( leftarg, rightarg : argument ) : comparisons;
+label
+ routineexit;
+var
+ lefts, rights : pckstr;
+ equalpckstrs : boolean;
+ comp : comparisons;
+
+ procedure greaterorlessthancompare;
+ begin
+ if lefts < rights then
+ comp := lessthan
+ else
+ comp := greaterthan
+ end;
+
+ procedure checktexindex;
+ begin
+ if (leftarg.texindex = indexofunknowntexcommand) or
+ (rightarg.texindex = indexofunknowntexcommand) then
+ comp := equal
+ else
+ if leftarg.texindex = rightarg.texindex then
+ comp := equal
+ else
+ greaterorlessthancompare
+ end;
+
+begin
+ if textualmatch( leftarg, rightarg) then
+ begin
+ comp := equal;
+ goto routineexit
+ end;
+ if (leftarg.class = [nulltype]) or (rightarg.class = [nulltype]) then
+ begin
+ comp := equal;
+ goto routineexit
+ end;
+ lefts := argliteral(leftarg, TRUE);
+ rights := argliteral(rightarg, TRUE);
+ equalpckstrs := (lefts = rights);
+ comp := notvalid;
+ if leftarg.class * rightarg.class <> [] then
+ begin
+ if equalpckstrs then
+ comp := equal
+ else
+ if (leftarg.isgeneralization) or (rightarg.isgeneralization) then
+ checktexindex
+ else
+ greaterorlessthancompare
+ end
+ else
+ greaterorlessthancompare;
+ routineexit : compareargs := comp
+end;
+
+
+
+
+[GLOBAL] FUNCTION argtexindex( arg : argument ) : integer;
+begin
+ argtexindex := arg.texindex
+end;
+
+
+
+
+[GLOBAL] FUNCTION argclass( arg : argument ) : setofargtype;
+begin
+ argclass := arg.class
+end;
+
+
+
+
+[GLOBAL] PROCEDURE initarg( var arg : argument; classification : setofargtype;
+ lit : pckstr; index : integer; general : boolean );
+begin
+ arg.source := lit;
+ arg.class := classification;
+ arg.texindex := index;
+ arg.isgeneralization := general
+end;
+
+
+
+
+[GLOBAL] PROCEDURE reassignargclass( var arg : argument; newclass : setofargtype);
+begin
+ arg.class := newclass
+end;
+
+
+
+
+[GLOBAL] PROCEDURE reassignargtexindex( var arg : argument; newindex:integer);
+begin
+ arg.texindex := newindex
+end;
+
+
+
+[GLOBAL] PROCEDURE reassignarggeneralization( var arg : argument;general:boolean);
+begin
+ arg.isgeneralization := general
+end;
+
+
+
+
+[GLOBAL] PROCEDURE appendchartoarg( ch : char; var arg : argument );
+begin
+ if arg.source.length = maxchars then
+ warningmessage('appendchartoarg','argument too long')
+ else
+ begin
+ arg.source.length := arg.source.length + 1;
+ arg.source.body[arg.source.length] := ch
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE extractintegerfromargument( arg : argument; var successful : boolean;
+ var int : integer;
+ var signed : boolean );
+var
+ s : pckstr;
+begin
+ s := argliteral( arg, TRUE);
+ readv( s, int, error := continue );
+ if statusv <> 0 then
+ successful := false
+ else
+ begin
+ successful := true;
+ signed := (s.body[1] = '+') or (s.body[1] = '-')
+ end
+end;
+
+
+
+END.
diff --git a/support/rnototex/basicfileops.pas b/support/rnototex/basicfileops.pas
new file mode 100644
index 0000000000..8e3f1fde4e
--- /dev/null
+++ b/support/rnototex/basicfileops.pas
@@ -0,0 +1,215 @@
+[INHERIT('UTILITYOPS','SCREENHANDLERS','ARGOPS'), environment('basicfileops')]
+
+MODULE BASICFILEOPS;
+
+CONST
+
+ maxfidchars = 255;
+ ndatetimechars = 11;
+ programversion = 'CVF02B';
+ inifilename = 'INIT$RNOTOTEX';
+ logfilename = 'RNOTOTEX.LOG';
+
+
+TYPE
+
+fidtype = VARYING[maxfidchars] of char;
+
+datetimetype = packed array[1..ndatetimechars] of char;
+
+
+VAR
+ inputcontainstexcommands : [EXTERNAL] boolean;
+ totallines, totalchars : [EXTERNAL] integer;
+ LOG : [EXTERNAL] text;
+
+
+
+
+[GLOBAL] PROCEDURE noconversion;
+begin
+ writeln(log,'[no conversion performed]')
+end;
+
+
+
+
+[GLOBAL] PROCEDURE greetuser ( var d, t : datetimetype );
+begin
+ date( d );
+ time( t );
+ clearscreen;
+ ttywritestring('RNOTOTEX ');
+ ttywritestring(programversion);
+ ttywritestring(' RUNOFF TO TEX CONVERSION ');
+ ttywritestring( d );
+ ttywritestring( t );
+ ttywriteln;
+ ttywriteln;
+ ttywriteln
+end;
+
+
+
+
+
+[GLOBAL] PROCEDURE openinputfile( fid : fidtype; var f : text; var openerror : boolean );
+begin
+ open( file_variable := f,
+ file_name := fid,
+ history := readonly,
+ default := 'INPUT.RNO',
+ error := continue );
+ if status(f) <> 0 then
+ openerror := true
+ else
+ begin
+ reset( f );
+ openerror := false
+ end
+end;
+
+
+
+
+
+[GLOBAL] PROCEDURE openoutputfile(fid : fidtype; var f : text; var openerror:boolean);
+begin
+ open( file_variable := f,
+ file_name := fid,
+ history := new,
+ default := 'OUTPUT.TEX',
+ error := continue );
+ if status(f) <> 0 then
+ openerror := true
+ else
+ begin
+ openerror := false;
+ rewrite(f)
+ end;
+end;
+
+
+
+[GLOBAL] PROCEDURE openinifile ( var f : text );
+begin
+ open( file_variable := f,
+ file_name := inifilename,
+ history := readonly,
+ error := message );
+ reset( f );
+ ttywriteln;
+ ttywritestring('Loading INI file ...')
+end;
+
+
+
+
+[GLOBAL] PROCEDURE openlogfile; { global var LOG : text used }
+begin
+ open( file_variable := log,
+ file_name := logfilename,
+ history := new,
+ error := continue );
+ rewrite( log )
+end;
+
+
+
+[GLOBAL] PROCEDURE closelogfile;
+begin
+ close( file_variable := log, error := continue )
+end;
+
+[GLOBAL] PROCEDURE closeinifile( var f : text );
+begin
+ close( file_variable := f, error := continue );
+ ttywritestring('complete.');
+ ttywriteln;
+end;
+
+
+
+
+
+[GLOBAL] PROCEDURE closefiles( var infile, outfile : text );
+
+begin
+ close(file_variable := infile, error := continue);
+ close(file_variable := outfile, error := continue);
+ ttywritestring('complete.');
+ ttywriteln;
+ ttywriteln;
+ ttywriteln;
+ if totallines = 1 then
+ ttywritestring(' RNOTOTEX read only one line from the input file.')
+ else
+ if totallines = 0 then
+ ttywritestring(' No end of line was found in the input file.')
+ else
+ begin
+ ttywritestring(' RNOTOTEX processed a total of ');
+ ttywriteint( totallines );
+ ttywritestring(' lines.')
+ end;
+ ttywriteln;
+ if totalchars = 1 then
+ ttywritestring(' There was only one character in the file.')
+ else
+ if totalchars = 0 then
+ ttywritestring(' No printable characters were found in the file.')
+ else
+ begin
+ ttywritestring(' A total of ');
+ ttywriteint( totalchars );
+ ttywritestring(' characters were read.')
+ end;
+ ttywriteln
+end;
+
+
+
+
+
+
+[GLOBAL] PROCEDURE putcommentstooutput( var outfile : text; infid : fidtype;
+ d, t : datetimetype );
+begin
+ writeln(outfile,'% document translated from DEC RUNOFF to LaTeX format');
+ writeln(outfile,'% by program RNOTOTEX version ',programversion,' at ',d,blank,t);
+ writeln(outfile,'% Source file :',infid);
+ writeln(log,'[RNOTOTEX.LOG for ',infid,' ]');
+ writeln(log,'[Processing at ',d, blank, t,' ]')
+end;
+
+
+
+
+
+[GLOBAL] PROCEDURE userinterface( var inputfid, outputfid : fidtype;
+ var rno, tex : text );
+
+type
+ packedarray = packed array[1..255] of char;
+
+var
+ openerror : boolean;
+ slashtex : integer;
+
+ procedure getcli( var ifile, ofile : [class_s] packedarray;
+ var slashtex : integer ); fortran;
+begin
+ getcli( inputfid.body, outputfid.body, slashtex );
+ inputfid.length := 75;
+ outputfid.length := 75;
+ openinputfile( inputfid, rno, openerror);
+ if openerror then
+ warningmessage('openinputfile','Could not open that input file.');
+ openoutputfile( outputfid, TEX, openerror);
+ if openerror then
+ warningmessage('openoutputfile','Could not open that output file.');
+ inputcontainstexcommands := slashtex <> 0
+end;
+
+
+END.
diff --git a/support/rnototex/compile_rnototex.com b/support/rnototex/compile_rnototex.com
new file mode 100644
index 0000000000..043c91b7f8
--- /dev/null
+++ b/support/rnototex/compile_rnototex.com
@@ -0,0 +1,13 @@
+$ IF ("''P1'" .EQS. "") THEN $ P1="PASCAL/OPTIMIZE/NOCHECK"
+$ 'P1' SCREENHANDLERS
+$ 'P1' UTILITYOPS
+$ 'P1' ARGOPS
+$ 'P1' BASICFILEOPS
+$ 'P1' TREEANDLISTOPS
+$ 'P1' FLAGOPS
+$ 'P1' LATEXOPS
+$ 'P1' INIOPS
+$ 'P1' CONVERSION
+$ 'P1' DSROPS
+$ 'P1' RNOTOTEX
+$ FORTRAN GETCLI
diff --git a/support/rnototex/conversion.pas b/support/rnototex/conversion.pas
new file mode 100644
index 0000000000..62ac3cf0ae
--- /dev/null
+++ b/support/rnototex/conversion.pas
@@ -0,0 +1,1442 @@
+[INHERIT('UTILITYOPS','ARGOPS','FLAGOPS',
+'TREEANDLISTOPS','LATEXOPS'), environment('conversion')]
+
+MODULE CONVERSION;
+
+CONST
+ maxlists = 8;
+ maxheaderlevels = 6;
+ maxlongpckstrchars = 75;
+TYPE
+
+longpckstr = VARYING[maxlongpckstrchars] of char;
+
+pagesizetype = record
+ length : integer;
+ width : integer
+ end;
+
+paragraphdeftype = record
+ indent : integer;
+ vertskip : integer;
+ testpage : integer
+ end;
+
+numberlisttype = record
+ listlevel : integer;
+ valuetoset : integer
+ end;
+
+displayelementstype = record
+ leftchar : char;
+ style : styletype;
+ rightchar : char
+ end;
+
+leveltype = record
+ value : integer;
+ display : styletype
+ end;
+
+headerleveltype = array[1..maxheaderlevels] of leveltype;
+
+
+VAR
+
+
+inputcontainstexcommands : [GLOBAL] boolean;
+
+totallines, totalchars : [EXTERNAL] integer;
+
+pagesize : [GLOBAL] pagesizetype;
+
+numberpage : [GLOBAL] integer;
+
+numberrunning : [GLOBAL] integer;
+
+displaynumber : [GLOBAL] styletype;
+
+capitalizetext, lowercasetext : [GLOBAL] boolean;
+
+leftmargin : [GLOBAL] integer;
+
+rightmargin : [GLOBAL] integer;
+
+fill : [GLOBAL] boolean;
+
+startnofillagain : [GLOBAL] boolean;
+
+justify : [GLOBAL] boolean;
+
+spacing : [GLOBAL] integer;
+
+indent : [GLOBAL] integer;
+
+centering : [GLOBAL] boolean;
+
+flushright : [GLOBAL] boolean;
+
+minipageactive : [GLOBAL] boolean;
+
+inmarginpar : [GLOBAL] boolean;
+
+infootnote : [GLOBAL] boolean;
+
+paragraphdef : [GLOBAL] paragraphdeftype;
+
+numberlist : [GLOBAL] numberlisttype;
+
+displayelements : [GLOBAL] displayelementstype;
+
+numberchapter : [GLOBAL] integer;
+
+displaychapter : [GLOBAL] styletype;
+
+headerlevel : [GLOBAL] headerleveltype;
+
+nestlevel : [GLOBAL] integer;
+
+numberappendix : [GLOBAL] integer;
+
+displayappendix : [GLOBAL] styletype;
+
+writetexcommands : [GLOBAL] boolean;
+
+flagtable : [GLOBAL] flagtabletype;
+
+inliteral : [GLOBAL] boolean;
+
+title, subtitle : [GLOBAL] argarray;
+
+datestring : [GLOBAL] pckstr;
+
+pagestyle : [GLOBAL] pagestyletype;
+
+liststate : [GLOBAL] array[1..maxlists] of liststatetype;
+
+numberofelements : [GLOBAL] array[1..maxlists] of integer;
+
+outputfirstitem : [GLOBAL] array[1..maxlists] of boolean;
+
+listnestlevel : [GLOBAL] integer;
+
+nofillbeforelist : [GLOBAL] boolean;
+
+LOG : [EXTERNAL] text;
+
+underlineactive : [GLOBAL] enhancmentstates;
+
+boldactive : [GLOBAL] enhancmentstates;
+
+
+
+[GLOBAL] FUNCTION quotedcharacter( arg : argument ) : char;
+var
+ s : pckstr;
+begin
+ s := argliteral( arg, true );
+ if length(s) = 1 then
+ quotedcharacter := s[1]
+ else
+ if length(s) = 3 then
+ quotedcharacter := s[2]
+ else
+ quotedcharacter := blank
+end;
+
+
+
+[HIDDEN] PROCEDURE noconversion; EXTERN;
+
+
+
+
+
+
+
+[GLOBAL] PROCEDURE blankifypckstr( var s : pckstr );
+begin
+ s.body := blank;
+ s.length := 0
+end;
+
+
+
+[GLOBAL] PROCEDURE initglobalvars;
+var
+ i : integer;
+begin
+ pagesize.length := 58;
+ pagesize.width := 60;
+ numberpage := 1;
+ numberrunning := 1;
+ displaynumber := decimal;
+ capitalizetext := false;
+ lowercasetext := false;
+ leftmargin := 0;
+ rightmargin := 60;
+ fill := true;
+ startnofillagain := false;
+ justify := true;
+ centering := false;
+ flushright := false;
+ minipageactive := false;
+ indent := 5;
+ spacing := 1;
+ paragraphdef.indent := 5;
+ paragraphdef.vertskip := 2;
+ paragraphdef.testpage := 5;
+ numberlist.listlevel := 1;
+ numberlist.valuetoset := 0;
+ nofillbeforelist := false;
+ displayelements.leftchar := blank;
+ displayelements.style := decimal;
+ displayelements.rightchar := blank;
+ numberchapter := 0;
+ numberappendix := 0;
+ displaychapter := decimal;
+ for i := 1 to maxheaderlevels do
+ begin
+ headerlevel[i].value := 0;
+ headerlevel[i].display := decimal
+ end;
+ nestlevel := 1;
+ inliteral := false;
+ makenullarray( title );
+ makenullarray( subtitle );
+ pagestyle := myheadings;
+ blankifypckstr( datestring );
+ for i := 1 to maxlists do
+ begin
+ liststate[i] := nostate;
+ numberofelements[i] := 0;
+ outputfirstitem[i] := false
+ end;
+ listnestlevel := 0;
+ underlineactive := notenhanced;
+ boldactive := notenhanced
+end;
+
+
+
+
+[GLOBAL] PROCEDURE loglist( list : arglist; index : integer);
+var
+ l : arglist;
+begin
+ writeln(log);
+ writeln(log,'INDEX >',index:1,' LENGTH >',arglistlength(list):1);
+ l := list;
+ write(log,'RUNOFF >');
+ while l <> nulllist do
+ begin
+ write(log, argliteral(firstarg(l), false), blank);
+ l := nextinlist(l)
+ end;
+ writeln(log);
+ write(log,'TEX >')
+end;
+
+
+
+
+[GLOBAL] PROCEDURE dumpthelist( var outfile : text; list : arglist );
+begin
+ if list <> nulllist then
+ begin
+ texwritearg(outfile, firstarg(list));
+ dumpthelist(outfile, nextinlist(list))
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE newintvalue( arg : argument; var current : integer;
+ var modified : parameterchangestates;
+ var intextracted : integer );
+var
+ signed : boolean;
+ successful : boolean;
+begin
+ modified := nochange;
+ extractintegerfromargument(arg, successful, intextracted, signed );
+ if successful then
+ begin
+ if signed then
+ begin
+ modified := altered;
+ current := intextracted + current
+ end
+ else
+ begin
+ modified := assigned;
+ current := intextracted
+ end
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE newcountparameter( arg : argument; var current : integer;
+ var modified : parameterchangestates;
+ var countervalueextracted : integer;
+ var class : countparametertype);
+begin
+ modified := nochange
+end;
+
+
+[GLOBAL] PROCEDURE newstyleparameter( arg : argument; var current : styletype );
+var
+ s : styletype;
+begin
+ s := isastylespecifier( arg );
+ if s <> undetermined then
+ current := s
+end;
+
+
+
+
+[LOCAL] FUNCTION m( i : integer ) : integer;
+begin
+ if i < 2 then
+ m := 1
+ else
+ m := i - 1
+end;
+
+
+[LOCAL] PROCEDURE C( var f : text );
+begin
+ writeln(f,'}');
+ writeln(log,'}')
+end;
+
+
+
+
+[GLOBAL] PROCEDURE flagchange( f : dsrflagclasses; arg : argument );
+var
+ ch : char;
+begin
+ turnflagon( f );
+ ch := quotedcharacter( arg );
+ if ch <> blank then
+ changeflagchar(f, ch)
+end;
+
+
+
+
+[GLOBAL] PROCEDURE puttexcommand( var outfile : text; index : integer;
+ dsrlist : arglist;
+ var writeanothertexcommand : integer );
+
+label
+ routineexit;
+const
+ charwidth = true;
+ charheight = false;
+var
+ arg : argarray;
+ i, j, n : integer;
+ modified : parameterchangestates;
+ extractedvalue, skip, startindex : integer;
+ class : countparametertype;
+ f : dsrflagclasses;
+ q : char;
+ startedwithfill : boolean;
+
+begin
+
+if (index < 1) or (index > 130) then goto routineexit;
+
+writeanothertexcommand := indexofunknowntexcommand;
+loglist( dsrlist, index );
+n := arglistlength( dsrlist );
+listtoarray( dsrlist, index, arg, maxargsinarray);
+startedwithfill := fill;
+stopunderline( outfile );
+stopbold( outfile );
+
+{
+ n - number of arguments supplied with the DSR command
+ m(n-1) - one less than that number, unless n < 2
+ m(n-2) - two less than the number of arguments, unless < 3
+ etc
+
+ arg[i] - the ith input dsr argument; e.g. four args could be :
+
+ 1 2 3 4
+ PAGE SIZE 10, 20 }
+
+
+
+case index of
+
+ {***** PAGE SIZE *****}
+ 1 : begin
+ newintvalue(arg[n], pagesize.width, modified, extractedvalue);
+ newintvalue(arg[m(n)], pagesize.length, modified, extractedvalue);
+ adjustlength(outfile, modified, pagesize.width, extractedvalue,charwidth,'textwidth');
+ adjustlength(outfile, modified, pagesize.length, extractedvalue,charheight,'textheight')
+ end;
+
+ {***** HEADERS OFF *****}
+ 2 : adjustpagestyle(outfile, plain);
+
+ {***** HEADERS ON ***** }
+ 3 : adjustpagestyle(outfile, headings);
+
+ {***** HEADERS UPPER ***** }
+ 4 : noconversion;
+
+ {***** HEADERS LOWER ***** }
+ 5 : noconversion;
+
+ {***** HEADERS MIXED ***** }
+ 6 : noconversion;
+
+ {***** ENABLE WRITING OF DATE *****}
+ 7 : begin
+ datestring := '\today';
+ if pagestyle = myheadings then
+ adjustpagestyle(outfile, myheadings)
+ else
+ noconversion
+ end;
+
+ { ***** DISABLE WRITING OF DATE ***** }
+ 8 : begin
+ blankifypckstr( datestring );
+ if pagestyle = myheadings then
+ adjustpagestyle(outfile, myheadings )
+ else
+ noconversion
+ end;
+
+ { ***** LAYOUT ***** }
+ 9 : noconversion;
+
+ { ***** NO NUMBER ***** }
+ 10 : adjustpagestyle(outfile, empty);
+
+ { ***** NUMBER PAGE ***** }
+ 11 : begin
+ newcountparameter(arg[n], numberpage, modified, extractedvalue,class);
+ adjustcounter(outfile, modified, numberpage, extractedvalue, 'page')
+ end;
+
+ { ***** NUMBER RUNNING ***** }
+ 12 : begin
+ newintvalue(arg[n], numberrunning, modified, extractedvalue);
+ adjustcounter(outfile, modified, numberrunning, extractedvalue,'page')
+ end;
+
+ { ***** DISPLAY NUMBER ***** }
+ 13 : begin
+ newstyleparameter(arg[n], displaynumber);
+ adjuststyle(outfile, displaynumber, 'page')
+ end;
+
+ { ***** NO PAGING ***** }
+ 14 : noconversion;
+
+ { ***** PAGING ***** }
+ 15 : noconversion;
+
+ { ***** BEGIN SUBPAGE ***** }
+ 16 : begin
+ if not minipageactive then
+ begin
+ minipageactive := true;
+ if not startedwithfill then
+ begin
+ endnofill( outfile );
+ startnofillagain := true
+ end;
+ writeln(outfile,'\begin{minipage}');
+ writeln( log,'\begin{minipage}');
+ if not startedwithfill then
+ beginnofill( outfile )
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - minipage already active');
+ writeln( log,'% RNOTOTEX - minipage already active')
+ end
+ end;
+
+ { ***** END SUBPAGE ***** }
+ 17 : begin
+ if minipageactive then
+ begin
+ if not fill then
+ endnofill( outfile );
+ writeln(outfile,'\end{minipage}');
+ writeln( log,'\end{minipage}');
+ if startnofillagain then
+ begin
+ startnofillagain := false;
+ beginnofill( outfile )
+ end
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - minipage not active');
+ writeln( log,'% RNOTOTEX - minipage not active')
+ end;
+ minipageactive := false
+ end;
+
+ { ***** NUMBER SUBPAGE ***** }
+ 18 : noconversion;
+
+
+ { ***** DISPLAY SUBPAGE ***** }
+ 19 : noconversion;
+
+ { ***** FIRST TITLE ***** }
+ 20 : noconversion;
+
+ { ***** TITLE ***** }
+ 21 : begin
+ for i := 2 to maxargsinarray do
+ title[i-1] := arg[i];
+ if pagestyle = myheadings then
+ adjustpagestyle(outfile, myheadings)
+ else
+ noconversion
+ end;
+
+ { ***** SUBTITLE ***** }
+ 22 : begin
+ for i := 2 to maxargsinarray do
+ subtitle[i-1] := arg[i];
+ if pagestyle = myheadings then
+ adjustpagestyle(outfile, myheadings)
+ else
+ noconversion
+ end;
+
+ { ***** NO SUBTITLE ***** }
+ 23 : begin
+ makenullarray( subtitle );
+ if pagestyle = myheadings then
+ adjustpagestyle(outfile, myheadings)
+ else
+ noconversion
+ end;
+
+ { ***** NO AUTOSUBTITLE ***** }
+ 24 : begin
+ makenullarray( subtitle );
+ if pagestyle = myheadings then
+ adjustpagestyle(outfile, plain)
+ else
+ noconversion
+ end;
+
+ { ***** AUTOSUBTITLE ***** }
+ 25 : adjustpagestyle(outfile, headings);
+
+
+ { ***** UPPERCASE ***** }
+ 26 : begin
+ capitalizetext := true;
+ lowercasetext := false
+ end;
+
+ { ***** LOWERCASE ***** }
+ 27 : begin
+ capitalizetext := false;
+ lowercasetext := true
+ end;
+
+ { ***** LEFT MARGIN ***** }
+ 28 : begin
+ newintvalue( arg[n], leftmargin, modified, extractedvalue);
+ noconversion
+ end;
+
+ { ***** RIGHT MARGIN ***** }
+ 29 : begin
+ newintvalue( arg[n], rightmargin, modified, extractedvalue);
+ noconversion
+ end;
+
+ { ***** NO FILL ***** }
+ 30 : beginnofill( outfile );
+
+ { ***** FILL ***** }
+ 31 : endnofill( outfile );
+
+ { ***** NO JUSTIFY ***** }
+ 32 : begin
+ writeln(outfile,'\sloppy % - begin no justify');
+ writeln( log,'\sloppy % - begin no justify');
+ justify := false
+ end;
+
+ { ***** JUSTIFY ***** }
+ 33 : begin
+ writeln(outfile,'\fussy % - turn justification on');
+ writeln( log,'\fussy % - turn justification on');
+ justify := true
+ end;
+
+ { ***** BREAK ***** }
+ 34 : begin
+ if fill then
+ begin
+ writeln(outfile,'\hfil\linebreak');
+ writeln( log,'\hfil\linebreak')
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - forced break');
+ writeln( log,'% RNOTOTEX - forced break')
+ end
+ end;
+
+ { ***** SPACING ***** }
+ 35 : begin
+ newintvalue(arg[n], spacing, modified, extractedvalue );
+ adjustlength(outfile, modified, spacing, extractedvalue, charheight,'baselineskip')
+ end;
+
+ { ***** SKIP ***** }
+ 36 : begin
+ if n = 1 then
+ begin
+ if (spacing > 0) and (spacing < 4) then
+ case spacing of
+ 1 : begin
+ writeln(outfile,'\smallskip');
+ writeln( log,'\smallskip')
+ end;
+ 2 : begin
+ writeln(outfile,'\medskip');
+ writeln( log,'\medskip')
+ end;
+ 3 : begin
+ writeln(outfile,'\bigskip');
+ writeln( log,'\bigskip')
+ end
+ end
+ else
+ begin
+ writeln(outfile,'\smallskip % - default skip amount');
+ writeln( log,'\smallskip % - default skip amount')
+ end
+ end
+ else
+ begin
+ skip := 1;
+ newintvalue(arg[n], skip, modified, extractedvalue );
+ extractedvalue := extractedvalue * spacing;
+ write(outfile,'\vspace{');
+ write( log,'\vspace{');
+ writecharheight(outfile, extractedvalue);
+ c(outfile)
+ end
+ end;
+
+ { ***** BLANK ***** }
+ 37 : begin
+ if n = 1 then
+ begin
+ writeln(outfile,'\smallskip');
+ writeln( log,'\smallskip')
+ end
+ else
+ begin
+ skip := 1;
+ newintvalue(arg[n], skip, modified, extractedvalue );
+ write(outfile,'\vspace{');
+ write( log,'\vspace{');
+ writecharheight(outfile, extractedvalue);
+ c(outfile)
+ end
+ end;
+
+ { ***** PAGE ***** }
+ 38 : begin
+ writeln(outfile,'\pagebreak[0] \typeout{runoff page break encountered, may be ignored}');
+ writeln( log,'\pagebreak[0]')
+ end;
+
+ { ***** TEST PAGE ***** }
+ 39 : noconversion;
+
+ { ***** CENTRE ***** }
+ 40 : begin
+ if not centering then
+ begin
+ centering := true;
+ if not fill then
+ begin
+ startnofillagain := true;
+ endnofill( outfile )
+ end;
+ writeln(outfile,'\begin{centering}');
+ writeln( log,'\begin{centering}');
+ writeanothertexcommand := 40
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - centering already active');
+ writeln( log,'% RNOTOTEX - centering already active')
+ end
+ end;
+
+ { ***** TAB STOPS ***** }
+ 41 : noconversion;
+
+ { ***** INDENT ***** }
+ 42 : begin
+ indent := 5;
+ newintvalue(arg[n], indent, modified, extractedvalue);
+ if modified = nochange then
+ begin
+ write(outfile,'\indent ');
+ write( log,'\indent ')
+ end
+ else
+ begin
+ write(outfile,'\hspace*{');
+ write( log,'\hspace*{');
+ writecharwidth(outfile, indent);
+ write(outfile,'} ');
+ writeln(log,'}')
+ end
+ end;
+
+ { ***** LEFT ***** }
+ 43 : begin
+ indent := 5;
+ newintvalue(arg[n], indent, modified, extractedvalue);
+ if (modified = nochange) or (n = 1) then
+ begin
+ write(outfile,'\indent ');
+ write( log,'\indent ')
+ end
+ else
+ begin
+ write(outfile,'\hspace*{');
+ write( log,'\hspace*{');
+ writecharwidth(outfile, indent);
+ write(outfile,'} ');
+ writeln(log,'}')
+ end
+ end;
+
+ { ***** RIGHT ***** }
+ 44 : begin
+ if not flushright then
+ begin
+ if not fill then
+ begin
+ startnofillagain := true;
+ endnofill( outfile )
+ end;
+ flushright:= true;
+ writeln(outfile,'\begin{flushright}');
+ writeln( log,'\begin{flushright}');
+ writeanothertexcommand := 44
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - flush right already active');
+ writeln( log,'% RNOTOTEX - flush right already active')
+ end
+ end;
+
+ { ***** NO PERIOD ***** }
+ 45 : begin
+ writeln(outfile,'\frenchspacing');
+ writeln( log,'\frenchspacing')
+ end;
+
+ { ***** PERIOD ***** }
+ 46 : begin
+ writeln(outfile,'\nofrenchspacing');
+ writeln( log,'\nofrenchspacing')
+ end;
+
+ { ***** NO SPACE ***** }
+ 47 : noconversion;
+
+ { ***** PARAGRAPH ***** }
+ 48 : begin
+ if n > 1 then
+ begin
+ newintvalue(arg[2], paragraphdef.indent, modified, extractedvalue);
+ newintvalue(arg[3], paragraphdef.vertskip, modified, extractedvalue);
+ newintvalue(arg[4], paragraphdef.testpage, modified, extractedvalue)
+ end;
+ writeln(outfile,'\par');
+ writeln( log,'\par')
+ end;
+
+ { ***** SET PARAGRAPH ***** }
+ 49 : begin
+ newintvalue(arg[m(n-2)], paragraphdef.indent, modified, extractedvalue);
+ adjustlength(outfile, modified, paragraphdef.indent, extractedvalue,charwidth,'parindent');
+ newintvalue(arg[m(n-1)], paragraphdef.vertskip, modified, extractedvalue);
+ adjustlength(outfile, modified, paragraphdef.vertskip, extractedvalue,charheight,'parskip');
+ newintvalue(arg[m(n)], paragraphdef.testpage, modified, extractedvalue)
+ end;
+
+ { ***** AUTOPARAGRAPH ***** }
+ 50 : noconversion;
+
+ { ***** NO AUTOPARAGRAPH ***** }
+ 51 : noconversion;
+
+ { ***** AUTOTABLE ***** }
+ 52 : noconversion;
+
+ { ***** NO AUTOTABLE ***** }
+ 53 : noconversion;
+
+ { ***** DISABLE UNDERLINING ***** }
+ 54 : turnflagoff( underline );
+
+ { ***** ENABLE UNDERLINING ***** }
+ 55 : turnflagon( underline );
+
+ { ***** NO HYNPHENATION ***** }
+ 56 : turnflagoff( hyphenate );
+
+ { ***** HYPENATION ***** }
+ 57 : turnflagon( hyphenate );
+
+ { ***** DISABLE BOLDING ***** }
+ 58 : turnflagoff( bold );
+
+ { ***** ENABLE BOLDING ***** }
+ 59 : turnflagon( bold );
+
+ { ***** DISABLE OVERSTRIKE ***** }
+ 60 : turnflagoff( overstrike );
+
+ { ***** ENABLE OVERSTRIKE ***** }
+ 61 : turnflagon( overstrike );
+
+ { ***** ENABLE BAR ***** }
+ 62 : noconversion;
+
+ { ***** BEGIN BAR ***** }
+ 63 : noconversion;
+
+ { ***** END BAR ***** }
+ 64 : noconversion;
+
+ { ***** DISABLE BAR ***** }
+ 65 : noconversion;
+
+ { ***** FIGURE ***** }
+ 66 : begin
+ skip := 1;
+ newintvalue(arg[n], skip, modified, extractedvalue);
+ writeln(outfile,'\begin{figure}');
+ write(outfile,'\vspace{');
+ writeln( log,'\begin{figure}');
+ write( log,'\vspace{');
+ writecharheight(outfile, skip);
+ c(outfile);
+ writeln(outfile,'\caption{Another Figure}');
+ writeln(outfile,'\end{figure}');
+ writeln( log,'\caption{Another Figure}');
+ writeln( log,'\end{figure}')
+ end;
+
+ { ***** FIGURE DEFFERED ***** }
+ 67 : begin
+ skip := 1;
+ newintvalue(arg[n], skip, modified, extractedvalue);
+ writeln(outfile,'\begin{figure}');
+ writeln( log,'\begin{figure}');
+ write(outfile,'\vspace{');
+ write( log,'\vspace{');
+ writecharheight(outfile, skip);
+ c(outfile);
+ writeln(outfile,'\caption{Another Figure}');
+ writeln(outfile,'\end{figure}');
+ writeln( log,'\caption{Another Figure}');
+ writeln( log,'\end{figure}')
+ end;
+
+ { ***** LITERAL ***** }
+ 68 : begin
+ if not inliteral then
+ begin
+ if not fill then
+ begin
+ startnofillagain := true;
+ endnofill( outfile )
+ end;
+ inliteral := true;
+ writeln(outfile,'\begin{verbatim}');
+ writeln( log,'\begin{verbatim}')
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - literal already active');
+ writeln( log,'% RNOTOTEX - literal already active')
+ end
+ end;
+
+ { ***** END LITERAL ***** }
+ 69 : begin
+ if inliteral then
+ begin
+ writeln(outfile,'\end{verbatim}');
+ writeln( log,'\end{verbatim}');
+ inliteral := false;
+ if startnofillagain then
+ begin
+ startnofillagain := false;
+ beginnofill( outfile )
+ end
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - end literal not after literal');
+ writeln( log,'% RNOTOTEX - end literal not after literal')
+ end
+ end;
+
+ { ***** REPEAT ***** }
+ 70 : begin
+ skip := 1;
+ newintvalue(arg[2], skip, modified, extractedvalue);
+ q := quotedcharacter( arg[3] );
+ for i := 1 to skip do
+ begin
+ texwrite(outfile, q);
+ texwrite( log, q)
+ end
+ end;
+
+ { ***** LIST ***** }
+ 71 : begin
+ if (not fill) and (listnestlevel = 0) then
+ begin
+ nofillbeforelist := true;
+ endnofill( outfile )
+ end;
+ listnestlevel := listnestlevel + 1;
+ numberofelements[listnestlevel] := 0;
+ if n = 3 then
+ begin
+ q := quotedcharacter( arg[3] );
+ writeln(outfile,'\begin{itemize} % list nest ',listnestlevel:1);
+ writeln( log,'\begin{itemize}');
+ liststate[listnestlevel] := itemize;
+ write(outfile,'\item ');
+ outputfirstitem[listnestlevel] := true
+ end
+ else
+ begin
+ writeln(outfile,'\begin{enumerate} % list nest ',listnestlevel:1);
+ writeln( log,'\begin{enumerate}');
+ liststate[listnestlevel] := enumerate;
+ write(outfile,'\item ');
+ outputfirstitem[listnestlevel] := true
+ end
+ end;
+
+ { ***** END LIST ***** }
+ 72 : begin
+ if listnestlevel > 0 then
+ begin
+ case liststate[listnestlevel] of
+ nostate : writeln(outfile,'% - RNOTOTEX - close on list not open');
+ itemize : writeln(outfile,'\end{itemize} % - list nest ',listnestlevel:1);
+ enumerate : writeln(outfile,'\end{enumerate} % - list nest ',listnestlevel:1)
+ end;
+ case liststate[listnestlevel] of
+ nostate : writeln( log,'% - RNOTOTEX - close on list not open');
+ itemize : writeln( log,'\end{itemize}');
+ enumerate : writeln( log,'\end{enumerate}')
+ end;
+ numberofelements[listnestlevel] := 0;
+ liststate[listnestlevel] := nostate;
+ outputfirstitem[listnestlevel] := false;
+ listnestlevel := listnestlevel - 1;
+ if (listnestlevel = 1) and (nofillbeforelist) then
+ begin
+ nofillbeforelist := false;
+ beginnofill( outfile )
+ end
+ end
+ else
+ begin
+ writeln(outfile,'% - RNOTOTEX end list for none started');
+ writeln( log,'% - RNOTOTEX end list for none started')
+ end
+ end;
+
+ { ***** LIST ELEMENT ***** }
+ 73 : begin
+ if listnestlevel > 0 then
+ begin
+ if liststate[listnestlevel] = nostate then
+ begin
+ writeln(outfile,'% - RNOTOTEX - list element for non-existant-list');
+ writeln( log,'% - RNOTOTEX - list element for non-existant-list')
+ end
+ else
+ begin
+ if not outputfirstitem[listnestlevel] then
+ begin
+ write(outfile,'\item ');
+ writeln( log,'\item ')
+ end
+ else
+ outputfirstitem[listnestlevel] := false;
+ numberofelements[listnestlevel] := numberofelements[listnestlevel] + 1
+ end
+ end
+ else
+ begin
+ writeln(outfile,'% - RNOTOTEX - list element for unopened-list');
+ writeln( log,'% - RNOTOTEX - list element for unopened-list')
+ end
+ end;
+
+ { ***** NUMBER LIST ***** }
+ 74 : begin
+ newintvalue(arg[2], numberlist.listlevel, modified, extractedvalue);
+ newintvalue(arg[3], numberlist.valuetoset, modified, extractedvalue);
+ if (numberlist.listlevel > 0) and ( numberlist.listlevel < 5) then
+ case numberlist.valuetoset of
+ 1 : adjustcounter(outfile, modified, numberlist.valuetoset,extractedvalue,'enumi');
+ 2 : adjustcounter(outfile, modified, numberlist.valuetoset,extractedvalue,'enumii');
+ 3 : adjustcounter(outfile, modified, numberlist.valuetoset,extractedvalue,'enumiii');
+ 4 : adjustcounter(outfile, modified, numberlist.valuetoset,extractedvalue,'enumiv')
+ end
+ end;
+
+ { ***** DISPLAY ELEMENTS ***** }
+ 75 : noconversion;
+
+ { ***** NOTE ***** }
+ 76 : begin
+ if not inmarginpar then
+ begin
+ writeln(outfile,'\marginpar{\em ');
+ writeln( log,'\marginpar{\em ');
+ inmarginpar := true;
+ if n > 1 then
+ begin
+ dumpthelist(outfile, dsrlist);
+ dumpthelist( log, dsrlist);
+ inmarginpar := false;
+ c(outfile)
+ end
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - marginpar already active');
+ writeln( log,'% RNOTOTEX - marginpar already active')
+ end
+ end;
+
+ { ***** END NOTE ***** }
+ 77 : begin
+ if inmarginpar then
+ begin
+ writeln(outfile,'} % - end of margin par ');
+ writeln( log,'} % - end of margin par ')
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - marginpar not active');
+ writeln( log,'% RNOTOTEX - marginpar not active')
+ end;
+ inmarginpar := false
+ end;
+
+ { ***** FOOTNOTE ***** }
+ 78 : begin
+ if not infootnote then
+ begin
+ write(outfile,'\footnote{');
+ writeln( log,'\footnote{');
+ infootnote := true
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - already in footnote');
+ writeln( log,'% RNOTOTEX - already in footnote')
+ end
+ end;
+
+ { ***** END FOOTNOTE ***** }
+ 79 : begin
+ if infootnote then
+ begin
+ writeln(outfile,'} % - end of footnote');
+ writeln( log,'} % - end of footnote')
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - footnote not active');
+ writeln( log,'% RNOTOTEX - footnote not active')
+ end;
+ infootnote := false
+ end;
+
+ { ***** CHAPTER ***** }
+ 80 : begin
+ if not startedwithfill then
+ endnofill(outfile);
+ write(outfile,'\chapter{');
+ write( log,'\chapter{');
+ dumpthelist(outfile, nextinlist(dsrlist));
+ dumpthelist( log, nextinlist(dsrlist));
+ c(outfile);
+ if not startedwithfill then
+ beginnofill(outfile);
+ end;
+
+ { ***** NUMBER CHAPTER ***** }
+ 81 : begin
+ newcountparameter(arg[n], numberchapter, modified, extractedvalue, class);
+ adjustcounter(outfile, modified, numberchapter, extractedvalue,'chapter')
+ end;
+
+ { ***** DISPLAY CHAPTER ***** }
+ 82 : begin
+ newstyleparameter(arg[n], displaychapter);
+ adjuststyle(outfile, displaychapter, 'chapter')
+ end;
+
+ { ***** HEADER LEVEL ***** }
+ 83 : begin
+ newintvalue(arg[2], nestlevel, modified, extractedvalue);
+ if modified <> nochange then
+ startindex := 3
+ else
+ begin
+ newintvalue(arg[3], nestlevel, modified, extractedvalue);
+ startindex := 4
+ end;
+ if modified <> nochange then
+ begin
+ if (nestlevel > 0) and (nestlevel < 7) then
+ begin
+ case nestlevel of
+ 1 : write(outfile,'\section{');
+ 2 : write(outfile,'\subsection{');
+ 3 : write(outfile,'\subsubsection{');
+ 4 : write(outfile,'\paragraph{');
+ 5 : write(outfile,'\subparagraph{');
+ 6 : write(outfile,'\P ')
+ end;
+ case nestlevel of
+ 1 : write( log,'\section{');
+ 2 : write( log,'\subsection{');
+ 3 : write( log,'\subsubsection{');
+ 4 : write( log,'\paragraph{');
+ 5 : write( log,'\subparagraph{');
+ 6 : write( log,'\P ')
+ end;
+ for i := startindex to n do
+ begin
+ texwritearg(outfile, arg[i] );
+ texwritearg( log, arg[i] )
+ end;
+ if nestlevel < 6 then
+ c(outfile);
+ headerlevel[nestlevel].value := headerlevel[nestlevel].value + 1
+ end
+ end
+ end;
+
+ { ***** NUMBER LEVEL ***** }
+ 84 : begin
+ startindex := -1;
+ if n = 7 then startindex := 2;
+ if n = 8 then startindex := 3;
+ if startindex <> -1 then
+ begin
+ for i := startindex to (startindex + 5) do
+ begin
+ j := i - startindex + 1;
+ newintvalue(arg[i], headerlevel[j].value, modified,extractedvalue);
+ case j of
+ 1 : adjustcounter(outfile, modified, headerlevel[1].value,extractedvalue,'section');
+ 2 : adjustcounter(outfile, modified, headerlevel[2].value,extractedvalue,'subsection');
+ 3 : adjustcounter(outfile, modified, headerlevel[3].value,extractedvalue,'subsubsection');
+ 4 : adjustcounter(outfile, modified, headerlevel[4].value,extractedvalue,'paragraph');
+ 5 : adjustcounter(outfile, modified, headerlevel[5].value,extractedvalue,'subparagraph');
+ 6 : noconversion
+ end
+ end
+ end
+ end;
+
+ { ***** STYLE HEADERS ***** }
+ 85 : noconversion;
+
+ { ***** DISPLAY LEVELS ***** }
+ 86 : begin
+ startindex := -1;
+ if n = 7 then startindex := 2;
+ if n = 8 then startindex := 3;
+ if startindex <> -1 then
+ begin
+ for i := startindex to (startindex + 5) do
+ begin
+ j := i - startindex + 1;
+ newstyleparameter(arg[i], headerlevel[j].display);
+ case j of
+ 1 : adjuststyle(outfile, headerlevel[1].display, 'section');
+ 2 : adjuststyle(outfile, headerlevel[2].display, 'subsection');
+ 3 : adjuststyle(outfile, headerlevel[3].display, 'subsubsection');
+ 4 : adjuststyle(outfile, headerlevel[4].display, 'paragraph');
+ 5 : adjuststyle(outfile, headerlevel[5].display ,'subparagraph');
+ 6 : noconversion
+ end
+ end
+ end
+ end;
+
+ { ***** APPENDIX ***** }
+ 87 : begin
+ write(outfile,'\chapter{APPENDIX ');
+ write( log,'\chapter{APPENDIX ');
+ if n >= 2 then
+ begin
+ write(outfile,': ');
+ write( log,': ');
+ dumpthelist(outfile, nextinlist(dsrlist));
+ dumpthelist( log, nextinlist(dsrlist))
+ end;
+ c(outfile)
+ end;
+
+ { ***** NUMBER APPENDIX ***** }
+ 88 : begin
+ newcountparameter(arg[n], numberappendix, modified, extractedvalue,class);
+ adjustcounter(outfile, modified, numberappendix, extractedvalue, 'chapter')
+ end;
+
+ { ***** DISPLAY APPENDIX ***** }
+ 89 : begin
+ newstyleparameter(arg[n], displayappendix);
+ adjuststyle(outfile, displayappendix, 'chapter')
+ end;
+
+ { ***** STANDARD ***** }
+ 90 : noconversion;
+
+ { ***** COMMENT ***** }
+ 91 : begin
+ write(outfile,'% ');
+ dumpthelist(outfile, nextinlist(dsrlist));
+ write( log,'% ');
+ dumpthelist( log, nextinlist(dsrlist))
+ end;
+
+ { ***** REQUIRE ***** }
+ 92 : begin
+ write(outfile,'%%%%%% REQUIRE WAS HERE %%%%% \input {');
+ dumpthelist(outfile, nextinlist(dsrlist));
+ write( log,'\input {');
+ dumpthelist( log, nextinlist(dsrlist));
+ c(outfile)
+ end;
+
+ { ***** CONTROL CHARACTERS ***** }
+ 93 : noconversion;
+
+ { ***** NO CONTROL CHARACTERS ***** }
+ 94 : noconversion;
+
+ { ***** IF ***** }
+ 95 : noconversion;
+
+ { ***** ELSE ***** }
+ 96 : noconversion;
+
+ { ***** END IF ***** }
+ 97 : noconversion;
+
+ { ***** IFNOT ***** }
+ 98 : noconversion;
+
+ { ***** VARIABLE ***** }
+ 99 : noconversion;
+
+ { ***** SET DATE ***** }
+ 100 : noconversion;
+
+ { ***** SET TIME ***** }
+ 101 : noconversion;
+
+ { ***** FLAGS ALL ***** }
+ 102 : begin
+ for f := control to substitute do
+ turnflagon( f )
+ end;
+
+ { ***** NO FLAGS ALL ***** }
+ 103 : begin
+ for f := control to substitute do
+ turnflagoff( f );
+ turnflagon( control )
+ end;
+
+ { ***** NO FLAGS CONTROL ***** }
+ 104 : turnflagoff( control );
+
+ { ***** FLAGS CONTROL ***** }
+ 105 : flagchange(control, arg[n]);
+
+ { ***** NO FLAGS UPPERCASE ***** }
+ 106 : turnflagoff( uppercase );
+
+ { ***** FLAGS UPPERCASE ***** }
+ 107 : flagchange( uppercase, arg[n]);
+
+ { ***** NO FLAGS LOWERCASE ***** }
+ 108 : turnflagoff( lowercase );
+
+ { ***** FLAGS LOWERCASE ***** }
+ 109 : flagchange( lowercase, arg[n]);
+
+ { ***** NO FLAGS QUOTE ***** }
+ 110 : turnflagoff( quote );
+
+ { ***** FLAGS QUOTE ***** }
+ 111 : flagchange( quote, arg[n] );
+
+ { ***** NO FLAGS SPACE ***** }
+ 112 : turnflagoff( space );
+
+ { ***** FLAGS SPACE ***** }
+ 113 : flagchange( space, arg[n] );
+
+ { ***** NO FLAGS UNDERLINE ***** }
+ 114 : turnflagoff( underline );
+
+ { ***** FLAGS UNDERLINE ***** }
+ 115 : flagchange( underline, arg[n] );
+
+ { ***** NO FLAGS BOLD ***** }
+ 116 : turnflagoff( bold );
+
+ { ***** FLAGS BOLD ***** }
+ 117 : flagchange( bold, arg[n] );
+
+ { ***** NO FLAGS OVERSTRIKE ***** }
+ 118 : turnflagoff( overstrike );
+
+ { ***** FLAGS OVERSTRIKE ***** }
+ 119 : flagchange( overstrike, arg[n] );
+
+ { ***** NO FLAGS HYPHENATE ***** }
+ 120 : turnflagoff( hyphenate );
+
+ { ***** FLAGS HYPHENATE ***** }
+ 121 : flagchange( hyphenate, arg[n] );
+
+ { ***** NO FLAGS CAPITALIZE ***** }
+ 122 : turnflagoff( capitalize );
+
+ { ***** FLAGS CAPITALIZE ***** }
+ 123 : flagchange( capitalize, arg[n] );
+
+ { ***** NO FLAGS END FOOTNOTE ***** }
+ 124 : turnflagoff( endfootnote );
+
+ { ***** FLAGS END FOOTNOTE ***** }
+ 125 : flagchange( endfootnote, arg[n] );
+
+ { ***** NO FLAGS COMMENT ***** }
+ 126 : turnflagoff( comment );
+
+ { ***** FLAGS COMMENT ***** }
+ 127 : flagchange( comment, arg[n] );
+
+ { ***** NO FLAGS SUBSTITUTE ***** }
+ 128 : turnflagoff( substitute );
+
+ { ***** FLAGS SUBSTITUTE ***** }
+ 129 : flagchange( substitute, arg[n] );
+
+ { ***** INDEX ***** }
+ 130 : begin
+ write(outfile,'\index{');
+ dumpthelist(outfile, nextinlist(dsrlist));
+ write( log,'\index{');
+ dumpthelist( log, nextinlist(dsrlist));
+ c(outfile)
+ end
+
+end; {case of tex index extracted}
+
+
+routineexit : nullstatement
+end;
+
+
+
+[GLOBAL] PROCEDURE putsecondarytexcommand(var outfile : text;
+ var nextcommand : integer );
+begin
+
+ if nextcommand = 40 {centering} then
+ begin
+ if centering then
+ begin
+ centering := false;
+ writeln(outfile,'\end{centering}');
+ if startnofillagain then
+ begin
+ startnofillagain := false;
+ beginnofill( outfile )
+ end
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - end centering when centering not-active');
+ writeln( log,'% RNOTOTEX - end centering when centering not-active')
+ end
+ end;
+ if nextcommand = 44 {rightjustify} then
+ begin
+ if flushright then
+ begin
+ flushright := false;
+ writeln(outfile,'\end{flushright}');
+ if startnofillagain then
+ begin
+ startnofillagain := false;
+ beginnofill( outfile )
+ end
+ end
+ else
+ begin
+ writeln(outfile,'% RNOTOTEX - end flushright when not active');
+ writeln( log,'% RNOTOTEX - end flushright when not active')
+ end
+ end;
+
+ nextcommand := indexofunknowntexcommand
+
+end;
+
+
+
+
+
+END.
diff --git a/support/rnototex/dsrops.pas b/support/rnototex/dsrops.pas
new file mode 100644
index 0000000000..c83fe24033
--- /dev/null
+++ b/support/rnototex/dsrops.pas
@@ -0,0 +1,323 @@
+[INHERIT('SCREENHANDLERS','UTILITYOPS','ARGOPS',
+'TREEANDLISTOPS','FLAGOPS','CONVERSION'), environment('dsrops')]
+
+MODULE DSROPS;
+
+
+CONST
+
+ indexofpagecommand = 38;
+
+VAR
+
+ totallines : [EXTERNAL] integer;
+ totalgooddsrcommands : [EXTERNAL] integer;
+ totalbaddsrcommands : [EXTERNAL] integer;
+
+
+
+
+
+[GLOBAL] FUNCTION listispagecommand( list : arglist ) : boolean;
+var
+ s : pckstr;
+begin
+ listispagecommand := false;
+ if arglistlength(list) = 1 then
+ begin
+ s := argliteral(firstarg(list), TRUE );
+ if s = 'PAGE' then
+ listispagecommand := true
+ end
+end;
+
+
+
+[GLOBAL] PROCEDURE checkfordsrcommand( var infile, outfile : text;
+ var dsrcommand : boolean );
+var
+ gotten : boolean;
+begin
+ if flagclass(currentchar) = control then
+ begin
+ getnextchar(infile, gotten);
+ if gotten then
+ begin
+ if (flagclass(currentchar) <> comment) and (currentchar <> blank) then
+ dsrcommand := true
+ end
+ else
+ begin
+ dsrcommand := false;
+ texwrite(outfile, currentchar)
+ end
+ end
+ else
+ dsrcommand := false
+end;
+
+
+
+
+[GLOBAL] PROCEDURE parsedsrcommand( var infile, outfile : text; var list :
+ arglist; var anothercommand : boolean;
+ var carrychar : boolean; var charcarried : char);
+const
+ dontwritethem = false;
+type
+ charidentity = (letter, separator, number, semicolon, quote, commentchar,newdsrcommand);
+var
+ quotedchar : char;
+ argread : argument;
+ currentargclass : charidentity;
+ done, gotten, atseparator, endofdsrcommand : boolean;
+ i : integer;
+
+ function charclass( ch : char ) : charidentity;
+ label
+ localexit;
+ begin
+ charclass := separator;
+ if flagclass( ch ) = control then
+ begin
+ charclass := newdsrcommand;
+ goto localexit
+ end;
+ if ch in ['a'..'z','A'..'Z'] then
+ begin
+ charclass := letter;
+ goto localexit
+ end;
+ if ch in ['+','-','0'..'9'] then
+ begin
+ charclass := number;
+ goto localexit
+ end;
+ if ch in [chr(34), chr(39)] then
+ begin
+ charclass := quote;
+ goto localexit
+ end;
+ if flagclass(currentchar) = comment then
+ begin
+ charclass := commentchar;
+ goto localexit
+ end;
+ if ch = ';' then
+ charclass := semicolon;
+ localexit : nullstatement
+ end;
+
+ procedure startarg( ch : char; var arg : argument; startset : setofargtype);
+ begin
+ initarg(arg, startset, ch, indexofunknowntexcommand, false);
+ end;
+
+begin
+ list := nulllist;
+ atseparator := false;
+ endofdsrcommand := false;
+ anothercommand := false;
+ carrychar := false;
+ repeat
+ currentargclass := charclass(currentchar);
+ case currentargclass of
+ letter : begin
+ atseparator := false;
+ startarg(currentchar, argread, [dsrverb,stylespecifier, textpckstr,character]);
+ done := false;
+ repeat
+ getnextchar(infile, gotten);
+ if gotten then
+ begin
+ if charclass(currentchar) = letter then
+ appendchartoarg(currentchar, argread)
+ else
+ done := true
+ end
+ else
+ begin
+ done := true;
+ endofdsrcommand := true
+ end
+ until done;
+ appendargonlist(list, argread )
+ end;
+ number : begin
+ atseparator := false;
+ startarg(currentchar, argread, [int,signedint,textpckstr,nulltype]);
+ done := false;
+ repeat
+ getnextchar(infile, gotten);
+ if gotten then
+ begin
+ if charclass(currentchar) = number then
+ appendchartoarg(currentchar, argread)
+ else
+ done := true
+ end
+ else
+ begin
+ done := true;
+ endofdsrcommand := true
+ end
+ until done;
+ appendargonlist(list, argread )
+ end;
+ separator : begin
+ passblanks(infile, outfile, dontwritethem);
+ if (atseparator) and (currentchar <> lastinputchar) then
+ begin
+ startarg(blank, argread, [nulltype]);
+ appendargonlist(list, argread);
+ atseparator := false
+ end
+ else
+ begin
+ if flagclass(currentchar) = control then
+ endofdsrcommand := true
+ else
+ if charclass(currentchar) = separator then
+ begin
+ getnextchar(infile, gotten);
+ if gotten then
+ atseparator := true
+ else
+ begin
+ atseparator := false;
+ startarg(blank, argread, [nulltype]);
+ appendargonlist(list, argread);
+ endofdsrcommand := true
+ end
+ end
+ end
+ end;
+ semicolon : begin
+ endofdsrcommand := true;
+ getnextchar(infile, gotten);
+ if charclass(currentchar) = newdsrcommand then
+ currentargclass := newdsrcommand
+ else
+ begin
+ carrychar := true;
+ charcarried := currentchar
+ end
+ end;
+ quote : begin
+ quotedchar := currentchar;
+ getnextchar(infile, gotten);
+ if gotten then
+ begin
+ startarg(currentchar, argread, [quotedpckstr]);
+ done := false;
+ repeat
+ getnextchar(infile, gotten);
+ if gotten then
+ begin
+ if charclass(currentchar) = quote then
+ begin
+ getnextchar(infile, gotten);
+ done := true;
+ if not gotten then
+ endofdsrcommand := true
+ end
+ else
+ appendchartoarg(currentchar, argread)
+ end
+ else
+ begin
+ endofdsrcommand := true;
+ done := true
+ end
+ until done
+ end
+ else
+ startarg(quotedchar, argread,[textpckstr,character]);
+ appendargonlist(list, argread)
+ end;
+ commentchar : begin
+ endofdsrcommand := true
+ end;
+ newdsrcommand : begin
+ endofdsrcommand := true;
+ end
+ end; {case}
+ until endofdsrcommand;
+ if currentargclass <> newdsrcommand then
+ newline( infile, outfile, false)
+ else
+ anothercommand := true
+end;
+
+
+
+PROCEDURE parsefile( var infile, outfile : text; textree : argtree );
+const
+ nocrlf = false;
+ putcrlf = true;
+var
+ dsrcommandfound : boolean;
+ chargotten : boolean;
+ dsrarguments : arglist;
+ texcommandindex : integer;
+ nextcommandtowrite : integer;
+ successfulparse : boolean;
+ depthofsearch : integer;
+ anothercommand : boolean;
+ carrychar : boolean;
+ charcarried, copychar : char;
+begin
+ ttywritestring('Translating input ...');
+ totalgooddsrcommands := 0;
+ totalbaddsrcommands := 0;
+ nextcommandtowrite := indexofunknowntexcommand;
+ anothercommand := false;
+ repeat
+ putsecondarytexcommand( outfile, nextcommandtowrite);
+ repeat
+ checkfordsrcommand( infile, outfile, dsrcommandfound );
+ if dsrcommandfound then
+ begin
+ parsedsrcommand( infile, outfile, dsrarguments, anothercommand,carrychar,charcarried);
+ if listispagecommand( dsrarguments) then
+ begin
+ successfulparse := true;
+ texcommandindex := indexofpagecommand
+ end
+ else
+ searchtreeforlist( textree, dsrarguments,successfulparse, texcommandindex,
+ depthofsearch);
+ if successfulparse then
+ begin
+ totalgooddsrcommands := totalgooddsrcommands + 1;
+ puttexcommand(outfile, texcommandindex, dsrarguments, nextcommandtowrite);
+ if carrychar then
+ begin
+ copychar := currentchar;
+ currentchar := charcarried;
+ writecurrentchar( infile, outfile );
+ currentchar := copychar
+ end
+ end
+ else
+ begin
+ totalbaddsrcommands := totalbaddsrcommands + 1;
+ write(outfile,'%Unidentified RUNOFF command "');
+ dumpthelist(outfile, dsrarguments);
+ writeln(outfile,'"')
+ end
+ end
+ else
+ anothercommand := false
+ until (not dsrcommandfound) and (not anothercommand);
+ repeat
+ writecurrentchar( infile, outfile );
+ getnextchar(infile, chargotten)
+ until not chargotten;
+ newline(infile, outfile, putcrlf)
+ until eof(infile)
+end;
+
+
+
+END.
diff --git a/support/rnototex/flagops.pas b/support/rnototex/flagops.pas
new file mode 100644
index 0000000000..60603cc7d6
--- /dev/null
+++ b/support/rnototex/flagops.pas
@@ -0,0 +1,675 @@
+[INHERIT('UTILITYOPS','ARGOPS'), environment('flagops')]
+
+MODULE FLAGOPS;
+
+CONST
+
+ tab = 9;
+ ncharsintab = 8;
+
+TYPE
+
+dsrflagtype = record
+ representation : char;
+ turnedon : boolean
+ end;
+
+
+dsrflagclasses = (notaflag, control, uppercase, lowercase, quote,
+space, underline, bold, overstrike, hyphenate, break, period, capitalize,
+endfootnote, comment, substitute);
+
+flagtabletype = array[dsrflagclasses] of dsrflagtype;
+
+tabrecordtype = record
+ tabread : boolean;
+ charcountintab : integer
+ end;
+
+styletype = (undetermined, decimal, octal, hexidecimal, romanupper, romanlower,
+ romanmixed, letterupper, letterlower, lettermixed, nostyle);
+
+enhancmentstates = (notenhanced, singlecharenhanced, enhancmentlocked);
+
+
+
+VAR
+
+ lastinputchar, currentchar : [EXTERNAL] char;
+ capitalizetext, lowercasetext : [EXTERNAL] boolean;
+ inputcontainstexcommands : [EXTERNAL] boolean;
+ inliteral : [EXTERNAL] boolean;
+ totallines, totalchars : [EXTERNAL] integer;
+ flagtable : [EXTERNAL] flagtabletype;
+ tabrecord : [EXTERNAL] tabrecordtype;
+ LOG : [EXTERNAL] text;
+ columncounter : [EXTERNAL] integer;
+ infootnote : [EXTERNAL] boolean;
+ boldactive : [EXTERNAL] enhancmentstates;
+ underlineactive : [EXTERNAL] enhancmentstates;
+ startnofillagain : [EXTERNAL] boolean;
+ fill : [EXTERNAL] boolean;
+ listnestlevel : [EXTERNAL] integer;
+
+
+
+[GLOBAL] PROCEDURE beginnofill( var outfile : text );
+begin
+ if (fill) and (listnestlevel = 0) then
+ begin
+ writeln(outfile,'{\obeylines \obeyspaces % - begin no fill');
+ fill := false
+ end
+ else
+ begin
+ writeln(outfile,'% - RNOTOTEX obeylines, obeyspaces already active');
+ writeln( log,'% - RNOTOTEX obeylines, obeyspaces already active')
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE endnofill( var outfile : text );
+begin
+ if (not fill) and (listnestlevel = 0) then
+ begin
+ writeln(outfile,'} % - end of no fill');
+ fill := true
+ end
+ else
+ begin
+ writeln(outfile,'% - RNOTOTEX obeylines, obeyspaces not active');
+ writeln( log,'% - RNOTOTEX obeylines, obeyspaces not active')
+ end
+end;
+
+
+
+
+
+
+[GLOBAL] PROCEDURE writeflagname( var outfile : text; f : dsrflagclasses );
+begin
+ case f of
+ notaflag : write(outfile,'?????');
+ control : write(outfile,'CONTROL');
+ uppercase : write(outfile,'UPPERCASE');
+ lowercase : write(outfile,'LOWERCASE');
+ quote : write(outfile,'QUOTE');
+ space : write(outfile,'SPACE');
+ underline : write(outfile,'UNDERLINE');
+ bold : write(outfile,'BOLD');
+ overstrike : write(outfile,'OVERSTRIKE');
+ hyphenate : write(outfile,'HYPYENATE');
+ capitalize : write(outfile,'CAPITALIZE');
+ endfootnote : write(outfile,'END FOOTNOTE');
+ comment : write(outfile,'COMMENT');
+ substitute : write(outfile,'SUBSTITUTE')
+ end
+end;
+
+
+
+
+
+
+[GLOBAL] FUNCTION isastylespecifier( arg : argument ) : styletype;
+label
+ routineexit;
+var
+ s : pckstr;
+ classification : styletype;
+begin
+ s := argliteral( arg, TRUE );
+ classification := undetermined;
+ if (s.body[1] = 'D') and (s.length = 1) then
+ begin
+ classification := decimal;
+ goto routineexit
+ end;
+ if (s.body[1] = 'O') and (s.length = 1) then
+ begin
+ classification := octal;
+ goto routineexit
+ end;
+ if (s.body[1] = 'H') and (s.length = 1) then
+ begin
+ classification := hexidecimal;
+ goto routineexit
+ end;
+ if (s.body = 'RU') and (s.length = 2) then
+ begin
+ classification := romanupper;
+ goto routineexit
+ end;
+ if (s.body = 'RL') and (s.length = 2) then
+ begin
+ classification := romanlower;
+ goto routineexit
+ end;
+ if (s.body = 'RM') and (s.length = 2) then
+ begin
+ classification := romanmixed;
+ goto routineexit
+ end;
+ if (s.body = 'LU') and (s.length = 2) then
+ begin
+ classification := letterupper;
+ goto routineexit
+ end;
+ if (s.body = 'LL') and (s.length = 2) then
+ begin
+ classification := letterlower;
+ goto routineexit
+ end;
+ if (s.body = 'LM') and (s.length = 2) then
+ begin
+ classification := lettermixed;
+ goto routineexit
+ end;
+ routineexit : isastylespecifier := classification
+end;
+
+
+
+[GLOBAL] PROCEDURE initflagtable;
+var
+ f : dsrflagclasses;
+begin
+ for f := notaflag to substitute do
+ case f of
+ notaflag : begin
+ flagtable[f].representation := blank;
+ flagtable[f].turnedon := false
+ end;
+ control : begin
+ flagtable[f].representation := '.';
+ flagtable[f].turnedon := true
+ end;
+ uppercase : begin
+ flagtable[f].representation := '^';
+ flagtable[f].turnedon := true
+ end;
+ lowercase : begin
+ flagtable[f].representation := '\';
+ flagtable[f].turnedon := true
+ end;
+ quote : begin
+ flagtable[f].representation := '_';
+ flagtable[f].turnedon := true
+ end;
+ space : begin
+ flagtable[f].representation := '#';
+ flagtable[f].turnedon := true
+ end;
+ underline : begin
+ flagtable[f].representation := '&';
+ flagtable[f].turnedon := true
+ end;
+ bold : begin
+ flagtable[f].representation := '*';
+ flagtable[f].turnedon := false
+ end;
+ overstrike : begin
+ flagtable[f].representation := '%';
+ flagtable[f].turnedon := false
+ end;
+ hyphenate : begin
+ flagtable[f].representation := '=';
+ flagtable[f].turnedon := false
+ end;
+ break : begin
+ flagtable[f].representation := '|';
+ flagtable[f].turnedon := false
+ end;
+ period : begin
+ flagtable[f].representation := '+';
+ flagtable[f].turnedon := false
+ end;
+ capitalize : begin
+ flagtable[f].representation := '<';
+ flagtable[f].turnedon := false
+ end;
+ endfootnote : begin
+ flagtable[f].representation := '!';
+ flagtable[f].turnedon := false
+ end;
+ comment : begin
+ flagtable[f].representation := '!';
+ flagtable[f].turnedon := true
+ end;
+ substitute : begin
+ flagtable[f].representation := '$';
+ flagtable[f].turnedon := false
+ end
+ end { case }
+end; {initflagtable}
+
+
+
+
+[GLOBAL] FUNCTION flagclass( ch : char ) : dsrflagclasses;
+var
+ class : dsrflagclasses;
+ foundclass : boolean;
+begin
+ class := control;
+ foundclass := false;
+ while (class <> substitute) and ( not foundclass) do
+ if (ch = flagtable[class].representation) and (flagtable[class].turnedon)then
+ foundclass := true
+ else
+ class := succ(class);
+ if foundclass then
+ if inliteral then
+ if class = control then
+ flagclass := control
+ else
+ flagclass := notaflag
+ else
+ flagclass := class
+ else
+ flagclass := notaflag
+end;
+
+
+
+
+[GLOBAL] PROCEDURE initcharreader(var f : text );
+begin
+ reset(f);
+ lastinputchar := blank;
+ read(f, currentchar);
+ totallines := 0;
+ totalchars := 0;
+ columncounter := 1;
+ if ord(currentchar) = tab then
+ begin
+ tabrecord.tabread := true;
+ tabrecord.charcountintab := ncharsintab
+ end
+ else
+ begin
+ tabrecord.tabread := false;
+ tabrecord.charcountintab := 0
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE getnextchar( var f : text; var gotten : boolean );
+
+ function nexttabcolumn( startingcolumn : integer ) : integer;
+ var
+ i : integer;
+ begin
+ i := startingcolumn;
+ repeat
+ i := i + 1
+ until (i-1) mod ncharsintab = 0;
+ nexttabcolumn := i;
+ writeln(log,'nexttabcolumn input = ',startingcolumn:1,', output = ',i:1)
+ end;
+
+begin
+ gotten := false;
+ if NOT eof(f) then
+ if NOT eoln(f) then
+ with tabrecord do
+ begin
+ lastinputchar := currentchar;
+ gotten := true;
+ columncounter := columncounter + 1;
+ if (tabread) and (charcountintab > 0) then
+ begin
+ currentchar := blank;
+ charcountintab := charcountintab - 1;
+ if charcountintab = 0 then tabread := false
+ end
+ else
+ begin
+ totalchars := totalchars + 1;
+ read( f, currentchar );
+ if currentchar < blank then
+ begin
+ if ord(currentchar) = tab then
+ begin
+ tabread := true;
+ charcountintab := nexttabcolumn( columncounter ) - columncounter-1;
+ writeln(log,'charcountintab = ',charcountintab)
+ end;
+ currentchar := blank
+ end
+ end
+ end
+end;
+
+
+
+[GLOBAL] PROCEDURE startunderline( var outfile : text; class : enhancmentstates);
+begin
+ if class <> notenhanced then
+ case underlineactive of
+ notenhanced : begin
+ write(outfile,'\underline{');
+ underlineactive := class
+ end;
+ singlecharenhanced : nullstatement;
+ enhancmentlocked : nullstatement
+ end;
+ underlineactive := class
+end;
+
+
+
+
+[GLOBAL] PROCEDURE stopunderline( var outfile : text );
+begin
+ case underlineactive of
+ notenhanced : nullstatement;
+ singlecharenhanced : begin
+ write(outfile,'} ');
+ underlineactive := notenhanced
+ end;
+ enhancmentlocked : nullstatement
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE startbold( var outfile : text; class : enhancmentstates);
+begin
+ if class <> notenhanced then
+ case boldactive of
+ notenhanced : begin
+ write(outfile,'{\bf ');
+ boldactive := class
+ end;
+ singlecharenhanced : nullstatement;
+ enhancmentlocked : nullstatement
+ end;
+ boldactive := class
+end;
+
+
+
+
+[GLOBAL] PROCEDURE stopbold( var outfile : text );
+begin
+ case boldactive of
+ notenhanced : nullstatement;
+ singlecharenhanced : begin
+ write(outfile,'} ');
+ boldactive := notenhanced
+ end;
+ enhancmentlocked : nullstatement
+ end
+end;
+
+
+
+
+
+[GLOBAL] PROCEDURE passblanks( var infile, outfile : text; writethem : boolean );
+var
+ gotten, keeppassing : boolean;
+begin
+ keeppassing := true;
+ gotten := true;
+ repeat
+ if (currentchar = blank) and (gotten) then
+ begin
+ if writethem then write(outfile, blank );
+ getnextchar(infile, gotten)
+ end
+ else
+ keeppassing := false
+ until NOT keeppassing
+end;
+
+
+
+[GLOBAL] PROCEDURE texwrite( var f : text; ch : char );
+const
+ maxtrys = 2;
+var
+ ntrys : integer;
+ written : boolean;
+begin
+ ntrys := 0;
+ written := false;
+ repeat
+ if (inputcontainstexcommands) or (inliteral) then
+ write(f, ch, error := continue)
+ else
+ if ch >= blank then
+ if ch in ['#','$','%','&','_','^','{','}','~'] then
+ write(f, '\',ch, error := continue)
+ else
+ if ch = '\' then
+ write(f,'\backslash ', error := continue)
+ else
+ write(f, ch, error := continue);
+ if status(f) > 0 then
+ begin
+ writeln(f, error := continue);
+ ntrys := ntrys + 1
+ end
+ else
+ written := true
+ until (written) or (ntrys > maxtrys);
+ if ntrys > maxtrys then
+ errorexit('TEXWRITE','error writing to output')
+end;
+
+
+
+[GLOBAL] PROCEDURE writecurrentchar( var infile, outfile : text );
+var
+ gotten : boolean;
+begin
+ if capitalizetext then
+ currentchar := capchar( currentchar );
+ if lowercasetext then
+ currentchar := lcchar( currentchar );
+ case flagclass(currentchar) of
+ notaflag : begin
+ stopunderline( outfile );
+ stopbold( outfile );
+ texwrite(outfile, currentchar)
+ end;
+ control : begin
+ stopunderline( outfile );
+ stopbold( outfile );
+ texwrite(outfile, currentchar)
+ end;
+ uppercase : begin
+ getnextchar(infile, gotten);
+ if gotten then
+ case flagclass(currentchar) of
+ underline : startunderline( outfile, enhancmentlocked);
+ bold : startbold( outfile, enhancmentlocked );
+ otherwise texwrite(outfile, capchar(currentchar))
+ end
+ end;
+ lowercase : begin
+ getnextchar(infile, gotten);
+ if gotten then
+ case flagclass(currentchar) of
+ underline : begin
+ if underlineactive <> notenhanced then
+ write(outfile,'} ');
+ underlineactive := notenhanced
+ end;
+ bold : begin
+ if boldactive <> notenhanced then
+ write(outfile,'} ');
+ boldactive := notenhanced
+ end;
+ otherwise texwrite(outfile, lcchar(currentchar))
+ end
+ end;
+ quote : begin
+ getnextchar(infile, gotten);
+ if gotten then
+ texwrite(outfile, currentchar )
+ end;
+ space : write(outfile,'\ ');
+ underline : begin
+ getnextchar(infile, gotten );
+ if gotten then
+ begin
+ startunderline( outfile, singlecharenhanced);
+ texwrite(outfile, currentchar)
+ end
+ else
+ texwrite(outfile, currentchar)
+ end;
+ bold : begin
+ getnextchar(infile, gotten);
+ if gotten then
+ begin
+ startbold( outfile, singlecharenhanced);
+ texwrite(outfile, currentchar)
+ end
+ else
+ texwrite(outfile, currentchar)
+ end;
+ overstrike : begin
+ getnextchar(infile, gotten);
+ if gotten then
+ begin
+ startbold( outfile, singlecharenhanced);
+ texwrite(outfile, currentchar)
+ end
+ else
+ texwrite(outfile, currentchar)
+ end;
+ hyphenate : write(outfile,'--');
+ break : writeln(outfile,'\linebreak');
+ period : write(outfile,'\nonfrenchspacing ');
+ capitalize : begin
+ getnextchar( infile, gotten);
+ if gotten then
+ texwrite(outfile, capchar(currentchar))
+ end;
+ endfootnote : begin
+ if (columncounter = 1) and (infootnote) then
+ begin
+ if not fill then
+ endnofill( outfile );
+ writeln(outfile,'} % - end of footnote');
+ writeln( log,'} % - end of footnote');
+ infootnote := false;
+ if startnofillagain then
+ begin
+ startnofillagain := false;
+ beginnofill( outfile )
+ end
+ end
+ else
+ texwrite(outfile, currentchar)
+ end;
+ comment : begin
+ if flagclass(lastinputchar) = control then
+ write(outfile,'% ')
+ else
+ texwrite(outfile,currentchar)
+ end;
+ substitute : texwrite(outfile, currentchar)
+ end { case }
+end;
+
+
+
+
+[GLOBAL] PROCEDURE newline( var infile, outfile : text; putcrlf : boolean );
+var
+ gotten : boolean;
+begin
+ if eoln(infile) then
+ begin
+ readln(infile);
+ totallines := totallines + 1;
+ columncounter := 1
+ end;
+ if putcrlf then
+ writeln(outfile);
+ while (eoln(infile)) and (not eof(infile)) do
+ begin
+ readln(infile);
+ writeln(outfile);
+ columncounter := 1;
+ totallines := totallines + 1
+ end;
+ if not eof(infile) then
+ begin
+ read(infile, currentchar);
+ totalchars := totalchars + 1;
+ lastinputchar := blank
+ end;
+ if ord(currentchar) = tab then
+ begin
+ tabrecord.charcountintab := ncharsintab;
+ tabrecord.tabread := true
+ end
+ else
+ begin
+ tabrecord.charcountintab := 0;
+ tabrecord.tabread := false
+ end;
+ if currentchar < blank then currentchar := blank
+end;
+
+
+
+
+
+
+[GLOBAL] PROCEDURE changeflagchar( flag : dsrflagclasses; newchar:char);
+begin
+ flagtable[flag].representation := newchar;
+ write(log,'[internal flag representation change for ');
+ writeflagname(log, flag);
+ writeln(log,' to "',newchar,'"]')
+end;
+
+
+
+[GLOBAL] PROCEDURE turnflagon( flag : dsrflagclasses );
+begin
+ flagtable[flag].turnedon := true;
+ write(log,'[internal flag ');
+ writeflagname(log, flag);
+ writeln(log,' enabled]')
+end;
+
+
+
+[GLOBAL] PROCEDURE turnflagoff( flag : dsrflagclasses );
+begin
+ flagtable[flag].turnedon := false;
+ write(log,'[internal flag ');
+ writeflagname(log, flag);
+ writeln(log,' disabled]')
+end;
+
+
+
+
+[GLOBAL] PROCEDURE texwritearg( var outfile : text; arg : argument );
+var
+ s : pckstr;
+ i, l : integer;
+begin
+ s := argliteral( arg, false );
+ l := length( s );
+ for i := 1 to l do texwrite(outfile, s.body[i]);
+ write(outfile, blank)
+end;
+
+
+END.
diff --git a/support/rnototex/getcli.for b/support/rnototex/getcli.for
new file mode 100644
index 0000000000..ad5ebeaedb
--- /dev/null
+++ b/support/rnototex/getcli.for
@@ -0,0 +1,52 @@
+ SUBROUTINE GETCLI (IFILE,OFILE,TEX)
+
+ IMPLICIT NONE
+
+C
+C FUNCTIONAL DESCRIPTION:
+C
+C This routine gets the input and output file names for program
+C RNOTOTEX.
+C
+C DUMMY ARGUMENTS:
+C
+C none.
+C
+C IMPLICIT INPUTS:
+C
+C none
+C
+C IMPLICIT OUTPUTS:
+C
+ CHARACTER*(*) IFILE
+C INPUT FILE NAME
+C
+ CHARACTER*(*) OFILE
+C OUTPUT FILE NAME
+C
+ INTEGER TEX
+C TEX COMMANDS FLAG : 0 FOR NO, NOT 0 FOR YES
+C
+C SIDE EFFECTS:
+C
+C none
+C
+C
+C LOCALS
+C
+ INTEGER CLI$GET_VALUE
+ EXTERNAL CLI$GET_VALUE
+C system routine to get a value from a command line
+C
+ INTEGER STATUS
+C status of command line extraction
+C
+C BEGIN
+
+ STATUS = CLI$GET_VALUE('RNO_FILE',IFILE,)
+ STATUS = CLI$GET_VALUE('TEX_FILE',OFILE,)
+
+ TEX = 0
+
+ RETURN
+ END
diff --git a/support/rnototex/iniops.pas b/support/rnototex/iniops.pas
new file mode 100644
index 0000000000..055cf3ef28
--- /dev/null
+++ b/support/rnototex/iniops.pas
@@ -0,0 +1,200 @@
+{ INI FILE MODULE FOR RNO TO TEX CONVERSION }
+{ RANDALL VENHOLA JULY 7, 1987 }
+
+[INHERIT('UTILITYOPS','BASICFILEOPS','ARGOPS',
+ 'TREEANDLISTOPS','SCREENHANDLERS'), environment('iniops')]
+
+MODULE INIOPS;
+
+
+
+[GLOBAL] PROCEDURE readarglistfromini( var ini : text; var index : integer;
+ var list : arglist );
+const
+ iniseparator = '$';
+var
+ s : pckstr;
+ done : boolean;
+ gotten : boolean;
+ arg : argument;
+ inserted : boolean;
+
+ function endofline : boolean;
+ begin
+ if eof(ini) then
+ endofline := true
+ else
+ begin
+ if eoln(ini) then
+ endofline := true
+ else
+ begin
+ if ini^ = blank then
+ endofline := true
+ else
+ endofline := false
+ end
+ end
+ end;
+
+ function atseparator : boolean;
+ begin
+ atseparator := (ini^ = iniseparator)
+ end;
+
+ procedure readpckstr( var s : pckstr; var gotten : boolean );
+ var
+ ch : char;
+ done : boolean;
+ charindex : integer;
+ begin
+ s.body := blank;
+ done := false;
+ charindex := 0;
+ repeat
+ if endofline then
+ done := true
+ else
+ if atseparator then
+ done := true
+ else
+ if charindex = maxchars then
+ begin
+ warningmessage('readini','ini file argument size overflow');
+ done := true
+ end
+ else
+ begin
+ read(ini, ch);
+ charindex := charindex + 1;
+ s.body[charindex] := ch
+ end;
+ s.length := charindex
+ until done;
+ gotten := charindex > 0;
+ if atseparator then read(ini, ch)
+ end;
+
+ procedure readindex(var index : integer; var gotten : boolean );
+ const
+ ndigits = 3;
+ var
+ count : integer;
+ ch : char;
+ begin
+ gotten := true;
+ count := 0;
+ index := 0;
+ repeat
+ if endofline then
+ gotten := false
+ else
+ if count < ndigits then
+ begin
+ read(ini, ch);
+ count := count + 1;
+ if ch in ['0'..'9'] then
+ index := index*10 + ord(ch) - ord('0')
+ else
+ begin
+ warningmessage('readini','bad index digits in INI');
+ gotten := false
+ end
+ end
+ until (not gotten) or (count = ndigits);
+ if (gotten) and (not eof(ini)) then read(ini, ch)
+ end;
+
+ procedure pckstrtoarg( s : pckstr; index : integer; var arg : argument);
+ label
+ routineexit;
+ begin
+ initarg(arg, [dsrverb], s, index, false );
+ if s = '[N]' then
+ begin
+ reassignargclass(arg, [int,signedint,nulltype]);
+ reassignarggeneralization(arg, true);
+ goto routineexit
+ end;
+ if s = '[Y]' then
+ begin
+ reassignargclass(arg, [stylespecifier]);
+ reassignarggeneralization(arg, true);
+ goto routineexit
+ end;
+ if s = '[T]' then
+ begin
+ reassignargclass(arg, [textpckstr,character,nulltype]);
+ reassignarggeneralization(arg, true);
+ goto routineexit
+ end;
+ if s = '[C]' then
+ begin
+ reassignargclass(arg, [character,nulltype]);
+ reassignarggeneralization(arg, true);
+ goto routineexit
+ end;
+ if s = '[Q]' then
+ begin
+ reassignargclass(arg, [quotedpckstr,nulltype]);
+ reassignarggeneralization(arg, true);
+ goto routineexit
+ end;
+ routineexit : nullstatement
+ end;
+
+begin {readarglistfromini}
+ list := nulllist;
+ readindex(index, gotten );
+ if gotten then
+ begin
+ if index < 1 then
+ warningmessage('readini','bad INI index value');
+ repeat
+ readpckstr(s, gotten );
+ if gotten then
+ begin
+ pckstrtoarg(s, index, arg );
+ appendargonlist(list, arg);
+ end
+ until not gotten;
+ if arglistlength(list) = 0 then
+ warningmessage('readini','empty argument list in INI file')
+ end
+ else
+ begin
+ index := indexofunknowntexcommand;
+ warningmessage('readini','could not read index from INI file')
+ end;
+ if not eof(ini) then
+ readln(ini)
+end;
+
+
+
+
+
+
+[GLOBAL] PROCEDURE setuptree( var ini : text; var tree : argtree );
+var
+ list : arglist;
+ index : integer;
+begin
+ openinifile( ini );
+ tree := nulltree;
+ while not eof(ini) do
+ begin
+ readarglistfromini( ini, index, list);
+
+ { ***** ttywritestring(' index read = ');
+ ttywriteint(index);
+ ttywriteln; ***** }
+
+ insertlistintotree( list, tree )
+ end;
+ closeinifile( ini )
+end;
+
+
+
+END.
diff --git a/support/rnototex/latexops.pas b/support/rnototex/latexops.pas
new file mode 100644
index 0000000000..6df005a9f8
--- /dev/null
+++ b/support/rnototex/latexops.pas
@@ -0,0 +1,276 @@
+[INHERIT('UTILITYOPS','ARGOPS','BASICFILEOPS',
+'TREEANDLISTOPS','FLAGOPS'), environment('latexops')]
+
+MODULE LATEXOPS;
+
+
+TYPE
+
+
+countparametertype = (numericcounter, lowercasechars, uppercasechars );
+
+parameterchangestates = (nochange, altered, assigned);
+
+pagestyletype = (empty, plain, headings, myheadings);
+
+liststatetype = (nostate, itemize, enumerate);
+
+
+VAR
+
+ LOG : [EXTERNAL] TEXT;
+ pagestyle : [EXTERNAL] pagestyletype;
+ datestring : [EXTERNAL] pckstr;
+ title, subtitle : [EXTERNAL] argarray;
+ fill : [EXTERNAL] boolean;
+ centering : [EXTERNAL] boolean;
+ flushright : [EXTERNAL] boolean;
+ minipageactive : [EXTERNAL] boolean;
+ inmarginpar : [EXTERNAL] boolean;
+ infootnote : [EXTERNAL] boolean;
+ underlineactive : [EXTERNAL] enhancmentstates;
+ boldactive : [EXTERNAL] enhancmentstates;
+ listnestlevel : [EXTERNAL] integer;
+
+PROCEDURE startlatex( var outfile : text; outputfont : integer ; outputstyle: pckstr );
+const
+ minfont = 10;
+ maxfont = 12;
+var
+ pt : integer;
+begin
+ pt := outputfont;
+ if (pt < minfont) or (pt > maxfont) then
+ pt := minfont;
+ writeln(outfile,'%');
+ if pt = 10 then
+ writeln(outfile,'\documentstyle{',outputstyle,'}')
+ else
+ writeln(outfile,'\documentstyle[',pt:2,'pt]{',outputstyle,'}');
+ writeln(outfile,'%');
+ writeln(outfile,'% (put preamble statements here) ');
+ writeln(outfile,'%');
+ writeln(outfile,'\begin{document}');
+ writeln(outfile,'%')
+end;
+
+
+[GLOBAL] PROCEDURE closeanyopenbrackets( var outfile : text );
+var
+ i : integer;
+begin
+ if not fill then
+ writeln(outfile,'} % - end of obeylines and obeyspaces group');
+ if centering then
+ writeln(outfile,'\end{centering}');
+ if flushright then
+ writeln(outfile,'\end{flushright}');
+ if minipageactive then
+ writeln(outfile,'\end{minipage}');
+ if inmarginpar then
+ writeln(outfile,'} % - end of margin par ');
+ if infootnote then
+ writeln(outfile,'} % - end of footnote');
+ if inliteral then
+ writeln(outfile,'\end{verbatim}');
+ for i := 1 to listnestlevel do
+ writeln(outfile,'\end{itemize} % - RNOTOTEX forced list close');
+ stopunderline( outfile );
+ stopbold( outfile )
+end;
+
+
+
+[GLOBAL] PROCEDURE endlatex( var outfile : text );
+begin
+ closeanyopenbrackets( outfile );
+ writeln(outfile,'%');
+ writeln(outfile,'% (put postamble statements here) ');
+ writeln(outfile,'%');
+ writeln(outfile,'\end{document}')
+end;
+
+
+
+[GLOBAL] PROCEDURE adjustpagestyle( var f : text; newstyle : pagestyletype);
+begin
+ pagestyle := newstyle;
+ case pagestyle of
+ empty : writeln(f,'\pagestyle{empty}');
+ plain : writeln(f,'\pagestyle{plain}');
+ headings : writeln(f,'\pagestyle{headings}');
+ myheadings : begin
+ writeln(f,'\pagestyle{myheadings}');
+ write(f,'\markright{');
+ writeargarray(f, title);
+ writeargarray(f, subtitle);
+ write(f, datestring );
+ writeln(f,'}')
+ end
+ end;
+ case pagestyle of
+ empty : writeln(log,'\pagestyle{empty}');
+ plain : writeln(log,'\pagestyle{plain}');
+ headings : writeln(log,'\pagestyle{headings}');
+ myheadings : begin
+ writeln(log,'\pagestyle{myheadings}');
+ write(log,'\markright{');
+ writeargarray(log, title);
+ writeargarray(log, subtitle);
+ write(log, datestring );
+ writeln(log,'}')
+ end
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE writecharwidth( var f : text; nchars : integer);
+const
+ widthofcharincm = 0.254; { 10 chars per inch, 2.54 cm per inch }
+ maxwidth = 20.0;
+ minwidth = -20.0;
+var
+ cm : real;
+begin
+ cm := nchars * widthofcharincm;
+ if cm > maxwidth then
+ begin
+ writeln(log,'[too many chars to skip, ',nchars,' = ',cm:10:2,'cm]');
+ cm := 1.0
+ end;
+ if cm < minwidth then
+ begin
+ writeln(log,'[too many chars to skip ',nchars,' = ',cm:10:2,'cm]');
+ cm := -1.0
+ end;
+ write(f, cm:6:2, 'cm ');
+ write(log, cm:6:2,'cm ')
+end;
+
+
+
+[GLOBAL] PROCEDURE writecharheight( var f : text; nlines : integer );
+const
+ heightoftextincm = 0.425; { 6 lines per inch, 2.54 cm per inch }
+ maxheight = 25.0;
+ minheight = -25.0;
+var
+ cm : real;
+begin
+ cm := nlines * heightoftextincm;
+ if cm > maxheight then
+ begin
+ writeln(log,'[too many lines to skip, ',nlines,' = ',cm:10:2,'cm]');
+ cm := 1.0
+ end;
+ if cm < minheight then
+ begin
+ writeln(log,'[too many lines to skip ',nlines,' = ',cm:10:2,'cm]');
+ cm := -1.0
+ end;
+ write(f, cm:6:2,'cm ');
+ write(log, cm:6:2,'cm ')
+end;
+
+
+
+
+
+[GLOBAL] PROCEDURE adjustlength( var outfile : text; modified : parameterchangestates;
+lengthvalue : integer; adjustmentvalue : integer; charwidth : boolean;
+latexname : pckstr );
+begin
+ case modified of
+ nochange : nullstatement;
+ altered : begin
+ write(outfile,'\addtolength{',latexname,'}{');
+ if charwidth then
+ writecharwidth(outfile, adjustmentvalue)
+ else
+ writecharheight(outfile, adjustmentvalue);
+ writeln(outfile,'}')
+ end;
+ assigned : begin
+ write(outfile,'\setlength{',latexname,'}{');
+ if charwidth then
+ writecharwidth(outfile, lengthvalue)
+ else
+ writecharheight(outfile, lengthvalue);
+ writeln(outfile,'}')
+ end
+ end;
+ case modified of
+ nochange : noconversion;
+ altered : begin
+ write(log,'\addtolength{',latexname,'}{');
+ if charwidth then
+ writecharwidth(log, adjustmentvalue)
+ else
+ writecharheight(log, adjustmentvalue);
+ writeln(log,'}')
+ end;
+ assigned : begin
+ write(log,'\setlength{',latexname,'}{');
+ if charwidth then
+ writecharwidth(log, lengthvalue)
+ else
+ writecharheight(log, lengthvalue);
+ writeln(log,'}')
+ end
+ end
+end;
+
+
+
+[GLOBAL] PROCEDURE adjustcounter( var outfile : text; modified : parameterchangestates;
+countervalue : integer; adjustmentvalue : integer; latexname : pckstr );
+begin
+ case modified of
+ nochange : nullstatement;
+ altered : writeln(outfile,'\addtocounter{',latexname,'}{',adjustmentvalue,'}');
+ assigned : writeln(outfile,'\setcounter{',latexname,'}{',countervalue,'}')
+ end;
+ case modified of
+ nochange : noconversion;
+ altered : writeln(log,'\addtocounter{',latexname,'}{',adjustmentvalue,'}');
+ assigned : writeln(log,'\setcounter{',latexname,'}{',countervalue,'}')
+ end
+end;
+
+
+
+[GLOBAL] PROCEDURE adjuststyle(var outfile : text; s : styletype;
+ latexname : pckstr );
+begin
+ case s of
+ undetermined : nullstatement;
+ decimal : writeln(outfile,'\renewcommand{\the',latexname,'}{\arabic{',latexname,'}}');
+ octal : writeln(outfile,'\renewcommand{\the',latexname,'}{\arabic{',latexname,'}}');
+ hexidecimal : writeln(outfile,'\renewcommand{\the',latexname,'}{\arabic{',latexname,'}}');
+ romanupper : writeln(outfile,'\renewcommand{\the',latexname,'}{\Roman{',latexname,'}}');
+ romanlower : writeln(outfile,'\renewcommand{\the',latexname,'}{\roman{',latexname,'}}');
+ romanmixed : writeln(outfile,'\renewcommand{\the',latexname,'}{\roman{',latexname,'}}');
+ letterupper : writeln(outfile,'\renewcommand{\the',latexname,'}{\Alpha{',latexname,'}}');
+ letterlower : writeln(outfile,'\renewcommand{\the',latexname,'}{\alpha{',latexname,'}}');
+ lettermixed : writeln(outfile,'\renewcommand{\the',latexname,'}{\alpha{',latexname,'}}');
+ nostyle : nullstatement
+ end;
+ case s of
+ undetermined : noconversion;
+ decimal : writeln(log,'\renewcommand{\the',latexname,'}{\arabic{',latexname,'}}');
+ octal : writeln(log,'\renewcommand{\the',latexname,'}{\arabic{',latexname,'}}');
+ hexidecimal : writeln(log,'\renewcommand{\the',latexname,'}{\arabic{',latexname,'}}');
+ romanupper : writeln(log,'\renewcommand{\the',latexname,'}{\Roman{',latexname,'}}');
+ romanlower : writeln(log,'\renewcommand{\the',latexname,'}{\roman{',latexname,'}}');
+ romanmixed : writeln(log,'\renewcommand{\the',latexname,'}{\roman{',latexname,'}}');
+ letterupper : writeln(log,'\renewcommand{\the',latexname,'}{\Alpha{',latexname,'}}');
+ letterlower : writeln(log,'\renewcommand{\the',latexname,'}{\alpha{',latexname,'}}');
+ lettermixed : writeln(log,'\renewcommand{\the',latexname,'}{\alpha{',latexname,'}}');
+ nostyle : noconversion
+ end
+end;
+
+
+END.
diff --git a/support/rnototex/link_rnototex.com b/support/rnototex/link_rnototex.com
new file mode 100644
index 0000000000..8a3787a027
--- /dev/null
+++ b/support/rnototex/link_rnototex.com
@@ -0,0 +1,13 @@
+$ IF ("''P1'" .EQS. "") THEN P1="NODEBUG"
+$ LINK/'P1' RNOTOTEX,-
+ UTILITYOPS,-
+ SCREENHANDLERS,-
+ ARGOPS,-
+ BASICFILEOPS,-
+ FLAGOPS,-
+ TREEANDLISTOPS,-
+ LATEXOPS,-
+ INIOPS,-
+ CONVERSION,-
+ DSROPS,-
+ GETCLI
diff --git a/support/rnototex/rnototex.cld b/support/rnototex/rnototex.cld
new file mode 100644
index 0000000000..9142cf7f32
--- /dev/null
+++ b/support/rnototex/rnototex.cld
@@ -0,0 +1,7 @@
+!
+! FILE TO SET UP THE RNOTOTEX COMMAND
+DEFINE VERB RNOTOTEX
+ IMAGE tex_exe:RNOTOTEX
+ QUALIFIER TEX
+ PARAMETER P1 LABEL=RNO_FILE,PROMPT="RNO file",VALUE(TYPE=$FILE,REQUIRED)
+ PARAMETER P2 LABEL=TEX_FILE,PROMPT="TeX file",VALUE(TYPE=$FILE,REQUIRED)
diff --git a/support/rnototex/rnototex.com b/support/rnototex/rnototex.com
new file mode 100644
index 0000000000..7eeea058a2
--- /dev/null
+++ b/support/rnototex/rnototex.com
@@ -0,0 +1,7 @@
+$ v:='f$verify(0)'
+$ set command 'f$logical("sys$disk")[]rnototex
+$ define init$rnototex 'f$logical("sys$disk")[]rnototex.ini
+$ delete/symbol/global rnototex
+$ define/user sys$input sys$command
+$ rnototex 'p2' 'p3' 'p4' 'p5' 'p6' 'p7'
+$ if v then set verify
diff --git a/support/rnototex/rnototex.ini b/support/rnototex/rnototex.ini
new file mode 100644
index 0000000000..c78a60dfeb
--- /dev/null
+++ b/support/rnototex/rnototex.ini
@@ -0,0 +1,251 @@
+021 T$[T]
+022 SUBTITLE$[T] !SUBTITLE COMMAND
+016 SUBPAGE !CREATE SUBPAGE
+130 SUBINDEX$[T]
+085 STYLE$HEADERS$[N]$[N]$[N] !SET STYLE OF HEADERS
+101 STM$[N]$[N]$[N]
+085 STHL$[N]$[N]$[N]
+090 STANDARD$[N] !RESET TO STANDARD MODE
+022 ST$[T]
+049 SPR$[N]$[N]$[N]
+016 SPG
+035 SPACING$[N] !SET SPACING VALUE
+035 SP$[N]
+036 SKIP$[N] !SKIP SOME SPACES
+101 SET$TIME$[N]$[N]$[N] !SET TIME
+049 SET$PARAGRAPH$[N]$[N]$[N] !SET PARAGRAPH DEFAULT VALUES
+100 SET$DATE$[N]$[N]$[N] !SET DATE
+100 SDT$[N]$[N]$[N]
+090 SD$[N]
+036 S$[N]
+070 RPT$[N]$[Q]
+029 RM$[N]
+044 RIGHT$[N] !RIGHT FLUSH
+029 RIGHT$MARGIN$[N] !SETR RIGHT MARGIN
+092 REQUIRE$[Q] !GET A FILE
+070 REPEAT$[N]$[Q] !REPEAT CHARACTER
+044 R$[N]
+001 PS$[N]$[N]
+046 PR
+038 PG
+046 PERIOD !ENABLE PERIOD FLAG
+048 PARAGRAPH$[N]$[N]$[N] !NEW PAR
+001 PAPER$SIZE$[N]$[N] !PAPER SIZE [LENGTH] [WIDTH]
+015 PAGING !ENABLE PAGING MODE
+001 PAGE$SIZE$[N]$[N]
+038 PAGE !FORCE A PAGE BREAK
+015 PA
+048 P$[N]$[N]$[N]$[N]
+018 NUMBER$SUBPAGE$[C] !NUMBER SUBPAGE
+012 NUMBER$RUNNING$[C] !NUMBER RUNNING COUNTER
+011 NUMBER$PAGE$[C] !ENABLE PAGE NUMBERING
+074 NUMBER$LIST$[N]$[N] !NUMBER LIST
+084 NUMBER$LEVEL$[N]$[N]$[N]$[N]$[N]$[N] !SET SECTION NUMBERING LEVELS
+081 NUMBER$CHAPTER$[C] !SET CHAPTER NUMBERING STYLE
+088 NUMBER$APPENDIX$[C] !SET APPENDIX NUMBERING
+076 NT$[T]
+023 NST
+047 NSP
+045 NPR
+014 NPA
+076 NOTE$[T] !BEGIN NOTES
+032 NOJUST
+030 NOFILL
+023 NO$SUBTITLE !DISABLE SUBTITLE
+047 NO$SPACE !FRENCH SPACING
+045 NO$PERIOD !DISABLE PERIOD FLAG
+014 NO$PAGING !STOP PAGING MODE
+010 NO$NUMBER !DISABLE PAGE NUMBERING
+032 NO$JUSTIFY !STOP JUSTIFICATION
+032 NO$JUST
+056 NO$HYPHENATION !DISABLE HYNPHENATION
+002 NO$HEADERS !TURN HEADER WRITING OFF
+106 NO$FLAGS$UPPERCASE
+114 NO$FLAGS$UNDERLINE
+128 NO$FLAGS$SUBSTITUTE
+112 NO$FLAGS$SPACE
+110 NO$FLAGS$QUOTE
+118 NO$FLAGS$OVERSTRIKE
+108 NO$FLAGS$LOWERCASE
+120 NO$FLAGS$HYPHENATE
+124 NO$FLAGS$FOOTNOTE
+104 NO$FLAGS$CONTROL !NO CONTROL FLAGS
+126 NO$FLAGS$COMMENT
+122 NO$FLAGS$CAPTIALIZE
+103 NO$FLAGS$ALL !TURN OFF ALL FLAGS
+103 NO$FLAGS
+030 NO$FILL !DIABLE FILL
+008 NO$DATE !DISABLE DATE ON PAGE
+094 NO$CONTROL$CHARACTERS !NO CONTROL CHARACTERS ALLOWED
+053 NO$AUTOTABLE !DISABLE AUTOTABLE
+024 NO$AUTOSUBTITLE !DISABLE AUTOSUBTITLE
+051 NO$AUTOPARAGRAPH !DISABLE AUTOPARAGRAPHING
+010 NNM
+018 NMSPG$[C]
+012 NMR$[C]
+011 NMPG$[C]
+084 NMLV$[N]$[N]$[N]$[N]$[N]$[N]
+074 NMLS$[N]$[N]
+081 NMCH$[C]
+088 NMAX$[C]
+103 NLF
+032 NJ
+056 NHY
+002 NHD
+106 NFL$UPPERCASE
+114 NFL$UNDERLINE
+128 NFL$SUBSTITUTE
+112 NFL$SPACE
+110 NFL$QUOTE
+118 NFL$OVERSTRIKE
+108 NFL$LOWERCASE
+120 NFL$HYPHENATE
+124 NFL$FOOTNOTE
+104 NFL$CONTROL
+126 NFL$COMMENT
+122 NFL$CAPTIALIZE
+116 NFL$BOLD
+030 NF
+008 ND
+094 NCC
+053 NAT
+024 NAST
+051 NAP
+071 LS$[N]$[Q]
+027 LOWER$CASE !FORCE LOWER CASE TEXT
+009 LO$[N]$[N]
+028 LM$[N]
+068 LITERAL$[N] !LITERAL
+068 LIT
+071 LIST$[N]$[Q] !LIST COMMAND
+073 LIST$ELEMENT !LIST ELEMENT
+043 LEFT$[N] !SAME AS INDENT
+028 LEFT$MARGIN$[N] !SET LEFT MARGIN
+073 LE
+027 LC
+009 LAYOUT$[N]$[N] !SETUP LAYOUT
+043 L$[N]
+068 L
+033 JUSTIFY !ENABLEJUSTIFICATION
+033 J
+130 IX$[T]
+130 INDEX$[T]
+042 INDENT$[N] !INDENT TEXT
+098 IFNOT$[T] !IF NOT COMMAND
+095 IF$[T] !IF COMMAND
+042 I$[N]
+057 HYPHENATION !ENABLE HYNPHENATION
+057 HY
+083 HL$[N]$[T]
+004 HEADERS$UPPER !PAGE NUMBERING CASE
+003 HEADERS$ON !TURN HEADER WRITING ON
+006 HEADERS$MIXED
+005 HEADERS$LOWER
+083 HEADER$LEVEL$[N]$[T] !SECTIONING COMMAND
+003 HD$ON
+003 HD
+020 FT
+078 FOOTNOTE$[N] !BEGIN FOOTNOTE
+078 FN$[N]
+107 FLAGS$UPPERCASE$[C]
+115 FLAGS$UNDERLINE$[C]
+129 FLAGS$SUBSTITUTE$[C]
+113 FLAGS$SPACE$[C]
+111 FLAGS$QUOTE$[C]
+119 FLAGS$OVERSTRIKE$[C]
+109 FLAGS$LOWERCASE$[C]
+121 FLAGS$HYPHENATE$[C]
+125 FLAGS$FOOTNOTE$[C]
+105 FLAGS$CONTROL$[C] !TURN ON CONTROL FLAGS
+127 FLAGS$COMMENT
+123 FLAGS$CAPITALIZE$[C]
+117 FLAGS$BOLD$[C]
+102 FLAGS$ALL !TURN ON ALL FLAGS
+102 FLAGS
+107 FL$UPPERCASE$[C]
+115 FL$UNDERLINE$[C]
+129 FL$SUBSTITUTE$[C]
+113 FL$SPACE$[C]
+111 FL$QUOTE$[C]
+119 FL$OVERSTRIKE$[C]
+116 FL$NO$FLAGS$BOLD
+109 FL$LOWERCASE$[C]
+121 FL$HYNPHENATE$[C]
+125 FL$FOOTNOTE$[C]
+105 FL$CONTROL$[C]
+127 FL$COMMENT
+123 FL$CAPTIALIZE$[C]
+117 FL$BOLD$[C]
+102 FL
+020 FIRST$TITLE !ENABLE FIRST TITLE
+031 FILL !ENABLE FILL
+066 FIGURE$[N] !FIGURE COMMAND
+067 FIGURE$DEFERRED$[N] !FIGURE DEFERRED
+067 FGD$[N]
+066 FG$[N]
+031 F
+055 EUN
+017 ES
+061 EOV
+097 ENDIF$[T] !END IF COMMAND
+017 END$SUBPAGE !END SUBPAGE
+077 END$NOTE !END NOTES
+069 END$LITERAL !END LITERAL
+072 END$LIST !END LIST
+079 END$FOOTNOTE !END FOOTNOTE
+064 END$BAR !END BAR
+055 ENABLE$UNDERLINING !ENABLE CHARACTER UNDERLINING
+061 ENABLE$OVERSTRIKE !ENABLE OVERSTRIKING
+059 ENABLE$BOLDING !ENABLE BOLDING
+062 ENABLE$BAR !ENABLE BAR
+077 EN
+096 ELSE$[T] !ELSE
+072 ELS
+069 EL
+059 EBO
+062 EBB
+064 EB
+054 DUL
+019 DSP$[Y]
+060 DOV
+013 DNM$[Y]
+075 DLE$[Q]$[Y]$[Q]
+019 DISPLAY$SUBPAGE$[Y] !DISPLAY SUBPAGE
+013 DISPLAY$NUMBER$[Y] !DISPLAY NUMBER RUNNING
+086 DISPLAY$LEVELS$[Y]$[Y]$[Y]$[Y]$[Y]$[Y] !DISPLAY LEVELS COMMAND
+075 DISPLAY$ELEMENTS$[Q]$[Y]$[Q] !DISPLAY LIST ELEMENTS
+082 DISPLAY$CHAPTER$[Y] !DISPLAY CHAPTER STYLE
+089 DISPLAY$APPENDIX$[Y] !DISPLAY APPENDIS
+054 DISABLE$UNDERLINING !DISABLE CHARACTER UNDERLINING
+060 DISABLE$OVERSTRIKING !DISABLE OVERSTRIKING
+058 DISABLE$BOLDING !DISABLE BOLDING OF CHARACTERS
+065 DISABLE$BAR !DISABLE BAR
+086 DHL$[Y]$[Y]$[Y]$[Y]$[Y]$[Y]
+082 DCH$[Y]
+058 DBO
+065 DBB
+089 DAX$[Y]
+007 DATE !ENABLE DATE ON PAGE
+007 D
+093 CONTROL$CHARACTERS !ENABLE CONTROL CHARACTERS
+091 COMMENT$[T] !DSR COMMENT
+080 CHAPTER$[T] !NEW CHAPTER
+080 CH$[T]
+040 CENTRE$[N]
+040 CENTER$[N] !CENTRE A LINE OF TEXT
+093 CC
+040 C$[N]
+034 BREAK !CAUSE A BREAK
+034 BR
+037 BLANK$[N] !LEAVE BLANK LINES
+063 BEGIN$BAR !BEGIN BAR
+063 BB
+037 B$[N]
+087 AX$[T]
+052 AUTOTABLE !ENABLE AUTOTABLE
+025 AUTOSUBTITLE$[N] !ENABLE AUTOSUBTITLING
+050 AUTOPARAGRAPH !ENABLE AUTOPARGRAPHING
+052 AT
+025 AST$[N]
+087 APPENDIX$[T] !APPENDIX
+050 AP
diff --git a/support/rnototex/rnototex.pas b/support/rnototex/rnototex.pas
new file mode 100644
index 0000000000..804ce4d7a7
--- /dev/null
+++ b/support/rnototex/rnototex.pas
@@ -0,0 +1,60 @@
+[INHERIT('BASICFILEOPS','CONVERSION',
+'LATEXOPS','TREEANDLISTOPS','FLAGOPS','DSROPS','INIOPS')]
+
+PROGRAM RNOTOTEX( INPUT, OUTPUT);
+
+{ PROGRAM TO CONVERT A RUNOFF FORMAT FILE TO TEX FORMAT }
+{ DEVELOPED BY RANDALL VENHOLA, SUMMER 1987 ON CCRS SMOKE:: }
+{ USING VAX PASCAL }
+
+LABEL
+
+ ENDOFPROGRAM;
+
+CONST
+ DEFAULTFONT = 10;
+ DEFAULTSTYLE = 'report';
+
+VAR
+
+ RNO, TEX, INI : TEXT;
+ RUNOFFTREE : ARGTREE;
+ CURRENTDATE, CURRENTTIME : DATETIMETYPE;
+ INPUTFID, OUTPUTFID : FIDTYPE;
+ LASTINPUTCHAR, CURRENTCHAR : [GLOBAL] CHAR;
+ TOTALLINES, TOTALCHARS : [GLOBAL] INTEGER;
+ TOTALGOODDSRCOMMANDS : [GLOBAL] INTEGER;
+ TOTALBADDSRCOMMANDS : [GLOBAL] INTEGER;
+ TABRECORD : [GLOBAL] TABRECORDTYPE;
+ LOG : [GLOBAL] TEXT;
+ COLUMNCOUNTER : [GLOBAL] INTEGER;
+
+{emergency exit procedure}
+[GLOBAL] PROCEDURE GOTOENDOFPROGRAM;
+BEGIN
+ GOTO ENDOFPROGRAM
+END;
+
+
+BEGIN
+
+ OPENLOGFILE;
+ GREETUSER( CURRENTDATE, CURRENTTIME );
+ USERINTERFACE( INPUTFID, OUTPUTFID, RNO, TEX );
+ SETUPTREE( INI, RUNOFFTREE );
+ PUTCOMMENTSTOOUTPUT( TEX, INPUTFID, CURRENTDATE, CURRENTTIME);
+ STARTLATEX( TEX, DEFAULTFONT, DEFAULTSTYLE );
+ INITFLAGTABLE;
+ INITGLOBALVARS;
+ INITCHARREADER( RNO );
+ PARSEFILE(RNO, TEX, RUNOFFTREE );
+ ENDLATEX( TEX );
+
+ENDOFPROGRAM:
+
+ WRITELN(LOG,'[TOTAL GOOD DSR COMMANDS = ',TOTALGOODDSRCOMMANDS,']');
+ WRITELN(LOG,'[TOTAL BAD DSR COMMANDS = ',TOTALBADDSRCOMMANDS,']');
+ CLOSEFILES( RNO, TEX );
+ CLOSELOGFILE
+
+END.
diff --git a/support/rnototex/rnototex.rnh b/support/rnototex/rnototex.rnh
new file mode 100644
index 0000000000..bc5525a584
--- /dev/null
+++ b/support/rnototex/rnototex.rnh
Binary files differ
diff --git a/support/rnototex/rnototex.upd b/support/rnototex/rnototex.upd
new file mode 100644
index 0000000000..f935024569
--- /dev/null
+++ b/support/rnototex/rnototex.upd
@@ -0,0 +1,10 @@
+ 8-Jun-1989 ARGOPS.PAS - Robin Fairbairns
+ Change maxargsinarray from 15 to 30 (since arglistotarray seems
+ not to correctly moan if we go over the top, and the
+ Laser-Scan style seems to create very long argument lists)
+
+Created 8 Jun 1989, 'cos today's the first time I've tried actually to {\em use}
+RNOTOTEX, and I find a bug straight off...
+AL
+
+ TEX
diff --git a/support/rnototex/rnototex_guide.tex b/support/rnototex/rnototex_guide.tex
new file mode 100644
index 0000000000..f51e8d6fea
--- /dev/null
+++ b/support/rnototex/rnototex_guide.tex
@@ -0,0 +1,340 @@
+\documentstyle[a4wide,duplex20]{report}
+%
+% DOCUMENTATION FOR PROGRAM RNOTOTEX
+% WRITTEN IN LATEX USING LSE
+% R. VENHOLA, 9-MAR-88
+%
+% Revised by John Edgecombe, 6-JUL-1988, restricting to RNOTOTEX only
+%
+% put section headings on top of page
+\pagestyle{headings}
+
+% release the LaTeX boundaries for margins
+\setlength{\oddsidemargin}{0.5in}
+\setlength{\evensidemargin}{0.0in}
+\setlength{\topmargin}{0.0in}
+
+% make the page size wider and longer
+\setlength{\textwidth}{6.0in} % 8.5 by 11 page with 1 inch margins
+\setlength{\textheight}{8.0in} % on each side
+
+% generate a title page
+\author{R.~Venhola}
+\title{ { \Huge \TeX\ \& \LaTeX\ \\
+\vspace*{1.0ex}
+CONVERSION PROGRAM } \\
+RNOTOTEX
+}
+\maketitle
+
+% An IDX file is to be generated
+\makeindex
+
+% A short form command
+\newcommand{\lb}{\large\bf}
+
+\begin{document}
+
+\chapter{Quick Reference}
+Execute SETUP.COM ({\tt @SETUP.COM}) to set the DCL command syntax
+before using the RNOTOTEX command.
+
+\section{RNOTOTEX}
+DCL command format is :
+
+\begin{center}
+
+{\large\bf \$ RNOTOTEX[\ /qualifier] RNO-FILE-SPEC TEX-FILE-SPEC}
+
+\end{center}
+
+Reads a {\em Digital Standard Runoff} format file and creates the \LaTeX\
+equivalent.
+
+
+\subsection{Parameters}
+
+\begin{center}
+
+
+ {\large\sl RNO--FILE--SPEC }
+
+\end{center}
+
+$\ldots$ is the name of the input DSR format file. The default type
+is~{\tt{.RNO}}.
+\begin{center}
+
+
+ {\large\sl TEX--FILE--SPEC }
+
+\end{center}
+$\ldots$ is the name of the output~{\tt{TEX}} file spec. The default
+type is~{\tt{.TEX}}.
+
+\subsection{/TEX}
+
+\begin{center}
+
+{\large\sl /TEX }
+
+\end{center}
+
+Preserve embedded \TeX\ and \LaTeX\ commands in the input DSR file.
+Any commands found are copied directly to the output~{\tt{.TEX}} file. The
+default is /NOTEX.
+
+\subsection{Example}
+The following DCL
+commands convert the DSR file FOO.RNO to FOO.TEX and prints the
+LN3 file on the LN03. The log of the conversion is also printed
+and deleted.
+
+\begin{verbatim}
+
+ $ RNOTOTEX FOO.RNO
+ $ LATEX FOO.TEX
+ $ DVI2LN3 FOO.DVI
+ $ PRINT/FORM=TEX FOO.LN3
+ $ PRINT/DELETE RNOTOTEX.LOG
+
+\end{verbatim}
+
+Note that there isn't a one-to-one mapping of DSR commands to \LaTeX\
+commands and that more \LaTeX\ text fits on a page than a RUNOFF file.
+The first output may be messy! The output~{\tt{.TEX}} file must \index{messy RNOTOTEX output}
+edited after examining the first printing. It may take a few tries to
+get the output that you want.
+
+The program was designed for those familiar with both \LaTeX\ and DSR
+and would like to upgrade older documents to \LaTeX\ format.
+\vspace{10.0cm}
+\pagebreak
+
+\chapter{Introduction}
+\TeX\ and \LaTeX\ are programs that allow programmers to typeset manuscripts
+for high precision output devices, such as the \index{LN03} LN03 linked to the SMOKE
+system at CCRS. \LaTeX\ can be thought of as a usable extension of
+\TeX\ . Raw \TeX\ can be difficult to use.
+
+The input files to the program are created in the same
+manner as one would create a RUNOFF source file. The usual file type
+is ``{\tt{.TEX}}''.
+The files are in simple ASCII format, so that they may be created using an
+editor such as EDT, SED or \index{LSE} LSE ({\bf L}anguage
+{\bf S}ensitive {\bf E}ditor). As a note, the current version of
+LSE on SMOKE recognises {\tt{TEX}} files and initialises the programming
+language to be ``LATEX'', with the appropriate expandable placeholders.
+
+Commands such as ``\verb+\chapter{Introduction}+'' are
+embedded in the~{\tt{.TEX}}
+file. The file is run through either the \TeX\ or \LaTeX\ program,
+which will produces a~{\tt{.DVI}} file (for {\bf D}e{\bf{V}}ice {\bf I}ndependent).
+This {\tt{.DVI}} file must be converted to the local print format, which in our
+case is done by the program {\bf DVI2LN3}.
+
+Documentation on \TeX\ and \LaTeX\ commands are given in Knuth\cite{tex-manual}
+and Lamport\cite{latex-manual}\footnote{References are listed in the
+Bibliography}.
+The user requires some familiarity with either \TeX\ or \LaTeX\
+to use the conversion programs described in this document.
+
+Program {\bf RNOTOTEX} reads a DSR format file
+(i.e.~FOO.RNO) and writes the equivalent\footnote{Well, not {\em really}
+equivalent, as you will find out in later} TEX format
+file (FOO.TEX).
+
+\chapter{RNOTOTEX}
+Program {\bf RNOTOTEX} will read a DEC Standard RUNOFF (DSR) format text file,
+translate the RUNOFF commands to \LaTeX\ commands and write the corresponding
+TEX file. The output file may then be processed by \LaTeX\ and printed
+on the local high quality printer. To use {\bf RNOTOTEX} one must have
+executed the DCL command procedure
+``SETUP'' as described
+in the first chapter.
+
+\section{Execution}
+Program {\bf RNOTOTEX} requires two files names on the command line : the
+input~.RNO file and the output~{\tt{.TEX}} file. For example~:
+\begin{verbatim}
+
+ $ RNOTOTEX FOO.RNO FOO.TEX
+
+\end{verbatim}
+translates the file FOO.RNO to the file FOO.TEX. The program does not
+require any user input.
+
+\section{Translation Actions}
+The program does four tasks. It will translate RUNOFF sectioning commands
+to \LaTeX\ sectioning commands, translate RUNOFF flags to \LaTeX\ commands,
+translate RUNOFF page directives to \LaTeX\ page directives and adjust
+\LaTeX\ counters by the same amount as RUNOFF counters are to be adjusted.
+
+\subsection{Conversion of Sectioning Commands}
+{\bf RNOTOTEX} converts RUNOFF sectioning commands to \LaTeX\ sectioning
+commands.
+The output \LaTeX\ style is always {\tt report } in 10 point font.
+The sectioning command are converted in table~\ref{section-commands}.
+\begin{table}
+\begin{tabular}{ll}
+{\lb RUNOFF } & {\LaTeX\ \lb Command Generated} \\
+ .HL1 text & \verb+\chapter{text}+ \\
+ .HL2 text & \verb+\section{text}+ \\
+ .HL3 text & \verb+\subsection{text}+ \\
+ .HL4 text & \verb+\subsubsection{text}+ \\
+ .HL5 text & \verb+\paragraph{text}+ \\
+ .HL6 text & \verb+\subparagraph{text}+ \\
+\end{tabular}
+\caption{Conversion of RUNOFF Sectioning Commands\label{section-commands}}
+\end{table}
+
+\subsection{Conversion of RUNOFF Flags}
+RUNOFF flags are converted to \LaTeX\ commands by {\bf RNOTOTEX}.
+This is a direct
+conversion process, i.e.~a RUNOFF underline command is converted to a
+\LaTeX\ underline command. This does not always produce the prettiest
+results (as one can use {\bf bold} and {\it italic} fonts in \LaTeX\ ),
+but it is consistent. The author regrets that {\bf RNOTOTEX} does not
+have the aesthetic sense to decide when a font is more appropriate than \index{esthetic sense}
+a converted RUNOFF command. The conversion process for RUNOFF flags
+is table~\ref{flag-commands}.
+\begin{table}
+\begin{tabular}{lcl}
+{\lb RUNOFF Flag } & {\lb Flag } & {\LaTeX\ \lb Command Generated} \\
+{\lb Name } & {\lb Char } & \\
+Accept & \_ & \verb!\verb+?+! \\
+Bold & * & \verb+{\bf+$\cdots$\verb+}+ \\
+Break & \verb+|+ & \verb+\\+ \\
+Capitalize & \verb+<+ & (see below) \\
+Comment & ! & \% \\
+Hyphenate & = & \verb+\hyphenate{+$\cdots$\verb+}+ \\
+Index & \verb+>+ & \verb+\index{+$\cdots$\verb+}+ \\
+Lowercase & $\backslash $ & (see below) \\
+Overstrike & \% & \verb+{\bf+$\cdots$\verb+}+ \\
+Period & + & \verb+\frenchspacing+ \\
+Space & \# & \verb*+\ + \\
+Subindex & \verb+>+ & \verb+\index{+$\cdots$\verb+}+ \\
+Substitute & \$ & {\em not translated } \\
+Underline & \& & \verb+\underline{+$\cdots$\verb+}+ \\
+Uppercase & \verb+^+ & (see below) \\
+\end{tabular}
+\caption{Conversion of RUNOFF Flags\label{flag-commands}}
+\end{table}
+
+Characters following CAPITALIZE, LOWERCASE or UPPERCASE flags are converted
+to the appropriate case during the translation process by {\bf RNOTOTEX},
+unless they are paired with other flags. In these other cases, the flags in
+RUNOFF lock another flag on, such as the {\bf bold}ing flag described
+in the DSR manual\cite{dsr-manual} on page 3-6. {\bf RNOTOTEX} will lock the
+appropriate flag to the state it is in and produce the appropriate
+\LaTeX\ commands.
+\pagebreak
+For example, {\bf RNOTOTEX} will convert~:
+\begin{verbatim}
+
+ ^*These words are in bold face.\*
+
+ to
+
+ {\bf These words are in bold face.}
+
+\end{verbatim}
+
+\subsection{Conversion of RUNOFF Directives}
+RNOTOTEX converts RUNOFF directives to \LaTeX\ directives.
+RUNOFF allows one to enable or disable flags and change the
+default flag character for a flag. {\bf RNOTOTEX} will recognise these
+commands and change the internal parsing setup so that the flag is
+(or is not) recognised by the character specified. See the RUNOFF commands
+``ENABLE'', ``DISABLE'', ``FLAGS'' and ``NO FLAGS'' described in the
+RUNOFF manual.
+
+In addition, {\bf RNOTOTEX} will translate RUNOFF commands such as ``NOFILL'',
+``INDENT'' and ``LIST'' in the manner described in table~\ref{directive-commands}.
+\begin{table}
+\begin{tabular}{ll}
+{\lb RUNOFF } & {\LaTeX\ \lb Command Generated} \\
+.APPENDIX & \verb+\appendix+ \\
+.BLANK $n$ & \verb+\vspace{+$n$+\verb+}+ \\
+.BREAK & \verb+\linebreak+ \\
+.CENTRE {\it text } & \verb+\begin{centering}+ \\
+ & {\it text } \\
+ & \verb+\end{centering}+ \\
+.FOOTNOTE {\it text} & \verb+\footnote{+{\it text }\} \\
+.INDENT & \verb+\indent+ \\
+.JUSTIFY & \verb+\obeylines \obeyspaces+ \\
+.LIST $n$,``q'' & \verb+\begin{enumerate}+ \\
+.LITERAL & \verb+\begin{verbatim}+ etc. \\
+.NOFILL & \verb+\sloppy+ \\
+.PAGE & \verb+\pagebreak[4]+ \\
+.SPACING & \verb+\setlength{\baselineskip}{n}+ \\
+.SUBTITLE {\it text} & \verb+\pagestyle{myheadings}+ etc. \\
+.TITLE {\it text} & \verb+\pagestyle{myheadings}+ etc. \\
+\end{tabular}
+\caption{Conversion of RUNOFF Directives\label{directive-commands}}
+\end{table}
+
+\subsection{Conversion of RUNOFF Counters}
+{\bf RNOTOTEX} converts the RUNOFF counter changes to \LaTeX\ counter
+adjustment changes. The conversion process in described in
+table~\ref{counter-commands}.
+\begin{table}
+\begin{tabular}{ll}
+{\lb RUNOFF} & {\LaTeX\ \lb Command Generated} \\
+.NUMBER APPENDIX $n$ & \verb+\setcounter{\chapter}{+$n$\verb+}+ \\
+.NUMBER LEVEL $s,n$ & \verb+\setcounter{s}{n}+ \\
+.NUMBER LIST $n$ & \verb+\setcounter{\enumi}{n}+ \\
+.NUMBER PAGE $n$ & \verb+\setcounter{\page}{n}+ \\
+\end{tabular}
+\caption{Conversion of RUNOFF Numbering\label{counter-commands}}
+\end{table}
+
+\section{The Conversion LOG File}
+Each time {\bf RNOTOTEX} is executed, it generates the file {\tt RNOTOTEX.LOG}.
+It is a record of each conversion used to generate the output \LaTeX\ commands.
+It is useful to users less familiar with \LaTeX\ and wish to learn by
+trial and error rather than by reading the manual. It may also be
+useful to experienced \LaTeX\ users to quickly identify what \LaTeX\ will
+produce as output from the generated TEX file without going through
+a complete printing.
+
+It is recommended that the log file be printed and deleted for each
+execution. For example, the batch job~:
+\begin{verbatim}
+
+ $ @DCL:TEX_CONVERSION_SETUP
+ $ RNOTOTEX REPORT NEW_REPORT
+ $ PRINT/DELETE RNOTOTEX.LOG
+
+\end{verbatim}
+generates the file NEW\_REPORT.TEX from the file REPORT.RNO and prints
+the log of the conversion process. The user can the examine the printed
+log file and decide upon the editing required to produce a ``nice''
+\LaTeX\ output.
+
+
+\begin{thebibliography}{99}
+\addcontentsline{toc}{chapter}{Bibliography}
+
+\bibitem{latex-manual} Leslie Lamport {\em \LaTeX\ User Guide \& Reference} \\
+Addison-Wesley Publishing Company, 1986
+
+\bibitem{tex-manual} Donald E.~Knuth {\em The \TeX book} \\
+Addison-Wesley Publishing Company, 1984
+
+\bibitem{metafont-manual} Donald E.~Knuth {\em The METAFONT Book} \\
+Addison-Wesley Publishing Company, 1986
+
+\bibitem{dsr-manual} Digital Equipment Corporation {Digital Standard RUNOFF
+(DSR) Reference Manual } \\
+Order \# AA-Z301B-TE, July 1985
+
+\end{thebibliography}
+\clearpage
+
+\setcounter{page}{0}
+\pagenumbering{roman}
+\tableofcontents
+\listoftables
+
+\end{document}
diff --git a/support/rnototex/screenhandlers.pas b/support/rnototex/screenhandlers.pas
new file mode 100644
index 0000000000..2a99cc7c10
--- /dev/null
+++ b/support/rnototex/screenhandlers.pas
@@ -0,0 +1,189 @@
+{ operations for input/output of data from the terminal.
+ Randall Venhola 5-May-1987 }
+
+[environment('screenhandlers')] MODULE screenhandlers;
+
+
+TYPE
+ wordinteger = [WORD] 0..65535;
+ byterange = [BYTE] 0..255;
+
+
+
+VAR
+terminalerror : [HIDDEN,STATIC] integer := 0;
+cursorrow : [HIDDEN,STATIC] wordinteger := 1;
+cursorcolumn : [HIDDEN,STATIC] wordinteger := 1;
+
+
+
+[GLOBAL] PROCEDURE clearsubscreen( line, column : integer );
+
+ FUNCTION LIB$ERASE_PAGE(lineno, colno : wordinteger) : integer; extern;
+
+ VAR
+ l, c : wordinteger;
+
+BEGIN
+ l := line;
+ c := column;
+ terminalerror := lib$erase_page(l,c);
+END;
+
+
+
+
+[GLOBAL] PROCEDURE clearscreen;
+
+BEGIN
+ clearsubscreen(1,1);
+END;
+
+
+
+
+[GLOBAL] PROCEDURE positioncursor( line, column : integer );
+
+ FUNCTION LIB$SET_CURSOR( lineno, colno : wordinteger ) : integer; extern;
+
+ VAR
+ l, c : wordinteger;
+
+BEGIN
+ l := line;
+ c := column;
+ terminalerror := lib$set_cursor(l,c);
+ cursorrow := line;
+ cursorcolumn := column
+END;
+
+
+[GLOBAL] PROCEDURE rollttyforward;
+BEGIN
+ positioncursor(cursorrow+1, cursorcolumn)
+END;
+
+
+[GLOBAL] PROCEDURE rollttyback;
+BEGIN
+ if cursorrow > 1 then
+ positioncursor(cursorrow-1, cursorcolumn)
+END;
+
+
+[GLOBAL] PROCEDURE putstringtoterminal( string : VARYING [limit] of CHAR;
+ line, column : integer;
+ reversevideo : boolean;
+ blinking : boolean);
+CONST
+ maxscreenwidth = 132;
+
+VAR
+ l, c, flags, newcolumn : wordinteger;
+
+ FUNCTION LIB$PUT_SCREEN(outtext : VARYING [C] OF CHAR;
+ lineno : wordinteger; colno : wordinteger;
+ flags : wordinteger) : integer; extern;
+
+
+BEGIN
+ l := line;
+ c := column;
+ if reversevideo then
+ if blinking then
+ flags := 3
+ else
+ flags := 2
+ else
+ flags := 0;
+ terminalerror := lib$put_screen(string, l, c, flags);
+ newcolumn := 1 + length(string) + cursorcolumn;
+ if newcolumn > maxscreenwidth then
+ positioncursor(cursorrow + 1, 1)
+ else
+ positioncursor( cursorrow, newcolumn)
+END;
+
+
+[GLOBAL] PROCEDURE ttywriteln;
+const
+ carriagereturn = 13;
+ linefeed = 10;
+
+var
+ endofline : [STATIC] VARYING[2] of char;
+BEGIN
+ endofline.body[1] := chr(carriagereturn);
+ endofline.body[2] := chr(linefeed);
+ endofline.length := 2;
+ putstringtoterminal(endofline, cursorrow, cursorcolumn, false, false);
+ positioncursor(cursorrow + 1, 1)
+END;
+
+
+
+
+[GLOBAL] PROCEDURE ttyreadln( VAR string : VARYING [limit] of char );
+
+ FUNCTION LIB$GET_SCREEN(VAR inputtext : VARYING [lim1] OF CHAR;
+ promptstring : VARYING [lim2] OF CHAR; VAR outlen : wordinteger := %IMMED 0) : integer; extern;
+
+ VAR
+ len : wordinteger;
+ prompt : [STATIC] VARYING [2] OF CHAR := '>';
+
+BEGIN
+ terminalerror := lib$get_screen(string, prompt, len);
+ ttywriteln
+END;
+
+
+
+[GLOBAL] PROCEDURE findcursor( var line, column : integer );
+
+BEGIN
+ line := cursorrow;
+ column := cursorcolumn;
+END;
+
+
+
+[GLOBAL] FUNCTION terminalerrorcode : integer;
+
+BEGIN
+ terminalerrorcode := terminalerror;
+END;
+
+
+
+
+[GLOBAL] PROCEDURE ttywritestring( string : VARYING [limit] OF CHAR);
+
+BEGIN
+ putstringtoterminal(string, cursorrow, cursorcolumn, false, false);
+END;
+
+
+[GLOBAL] PROCEDURE ttywriteint( int : integer );
+const
+ maxintchars = 20;
+var
+ s : varying[maxintchars] of char;
+BEGIN
+ writev(s, int:1);
+ ttywritestring( s )
+END;
+
+
+[GLOBAL] PROCEDURE ttywritereal( floating : real; fieldwidth,
+ ndigits : integer);
+const
+ maxfieldwidth = 30;
+var
+ s : varying[maxfieldwidth] of char;
+BEGIN
+ writev(s, floating:fieldwidth:ndigits);
+ ttywritestring( s )
+END;
+
+END.
diff --git a/support/rnototex/setup.com b/support/rnototex/setup.com
new file mode 100644
index 0000000000..4b799b071e
--- /dev/null
+++ b/support/rnototex/setup.com
@@ -0,0 +1,2 @@
+$ set command rnototex
+$ define init$rnototex rnototex.ini
diff --git a/support/rnototex/treeandlistops.pas b/support/rnototex/treeandlistops.pas
new file mode 100644
index 0000000000..3a99d610a0
--- /dev/null
+++ b/support/rnototex/treeandlistops.pas
@@ -0,0 +1,609 @@
+{ TREE AND LIST OPERATIONS - VERSION CVF01A
+ RANDALL VENHOLA JUNE 30, 1987
+ DOCUMENTED IN MODULEAREA:TREEOPS.TEX }
+
+
+
+[INHERIT('SCREENHANDLERS','ARGOPS','UTILITYOPS'), environment('treeandlistops')]
+MODULE TREEANDLISTOPS;
+
+{ list and tree operations - requires the external declarations for
+ data structures
+
+ ARGUMENT - the item of the list
+ COMPARISONS - possible results of comparisons
+ SETOFCOMPARISONS - set of above ordinal type
+
+ the package is to be copied to the area of the source code and
+ recompiled. It expects to find the environment file for the above
+ data structures and at least the following routines :
+
+ function compareargs( leftarg, rightarg : argument ) : comparisons;
+ function argtexindex( arg : argument ) : integer;
+ }
+
+CONST
+
+ nulllist = NIL;
+ nulltree = NIL;
+
+TYPE
+
+arglist = ^listnode;
+
+argtree = ^treenode;
+
+ treenode = record
+ parentnode : argtree;
+ contents : arglist
+ end;
+
+ listnode = record
+ field : argument;
+ next : arglist;
+ subtree : argtree
+ end;
+
+
+
+
+[GLOBAL] FUNCTION nextinlist( list : arglist ) : arglist;
+begin
+ if list = nulllist then
+ errorexit('nextinlist','empty list')
+ else
+ nextinlist := list^.next
+end;
+
+
+
+
+[GLOBAL] FUNCTION firstarg( list : arglist ) : argument;
+begin
+ if list = nulllist then
+ errorexit('firstlistpointer','empty list')
+ else
+ firstarg := list^.field
+end;
+
+
+[GLOBAL] FUNCTION arglistlength( list : arglist ) : integer;
+begin
+ if list = nulllist then
+ arglistlength := 0
+ else
+ arglistlength := arglistlength(nextinlist(list)) + 1
+end;
+
+
+
+
+
+[GLOBAL] FUNCTION leadingnodesubtree( list : arglist ) : argtree;
+begin
+ if list = nulllist then
+ errorexit('listsubtree','empty list')
+ else
+ leadingnodesubtree := list^.subtree
+end;
+
+
+
+
+
+[GLOBAL] FUNCTION listofargsattree( tree : argtree ) : arglist;
+begin
+ if tree = nulltree then
+ errorexit('listofargsattree','empty tree')
+ else
+ listofargsattree := tree^.contents
+end;
+
+
+
+[GLOBAL] FUNCTION treeisroot( tree : argtree ) : boolean;
+begin
+ if tree = nulltree then
+ treeisroot := TRUE
+ else
+ treeisroot := tree^.parentnode = nulltree
+end;
+
+
+
+
+[GLOBAL] FUNCTION parenttree( tree : argtree ) : argtree;
+begin
+ if treeisroot( tree ) then
+ errorexit('parenttree','tree is root')
+ else
+ parenttree := tree^.parentnode
+end;
+
+
+
+
+[GLOBAL] PROCEDURE insertarginsortedlist( var list : arglist;
+ arg : argument; var pointertoarg : arglist );
+
+type
+ scanstates = (searching, atfrontoflist, positionfound, endoflist);
+var
+ state : scanstates;
+ p, prevp, newp : arglist;
+ comp : comparisons;
+
+ procedure allocatenewp;
+ begin
+ new( newp );
+ newp^.next := nulllist;
+ newp^.subtree := nulltree;
+ newp^.field := arg;
+ pointertoarg := newp
+ end;
+
+begin
+ if list = nulllist then
+ begin
+ allocatenewp;
+ list := newp
+ end
+ else
+ begin
+ p := list;
+ comp := compareargs(arg, firstarg(list));
+ if (comp = lessthan) or (comp = equal) then
+ state := atfrontoflist
+ else
+ begin
+ state := searching;
+ repeat
+ prevp := p;
+ p := nextinlist(p);
+ if p = nulllist then
+ state := endoflist
+ else
+ begin
+ comp := compareargs(arg, firstarg(p));
+ if (comp = lessthan) or (comp = equal) then
+ state := positionfound
+ end
+ until state <> searching
+ end;
+ if comp = equal then
+ warningmessage('insertarginsortedlist','already in list')
+ else
+ case state of
+ atfrontoflist : begin
+ allocatenewp;
+ newp^.next := list;
+ list := newp
+ end;
+ positionfound : begin
+ allocatenewp;
+ newp^.next := p;
+ prevp^.next := newp
+ end;
+ endoflist : begin
+ allocatenewp;
+ prevp^.next := newp
+ end
+ end {case}
+ end {else}
+end;
+
+
+
+
+[GLOBAL] PROCEDURE appendargonlist( var list : arglist; arg : argument );
+var
+ p, prevp, newp : arglist;
+begin
+ if list = nulllist then
+ begin
+ new( newp );
+ newp^.subtree := nulltree;
+ newp^.field := arg;
+ newp^.next := nulllist;
+ list := newp
+ end
+ else
+ begin
+ p := list;
+ repeat
+ prevp := p;
+ p := nextinlist(p)
+ until p = nulllist;
+ new( newp );
+ newp^.subtree := nulltree;
+ newp^.field := arg;
+ newp^.next := nulllist;
+ prevp^.next := newp
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE preceedargonlist( var list : arglist; arg : argument );
+var
+ newl : arglist;
+begin
+ new(newl);
+ newl^.subtree := nulltree;
+ newl^.field := arg;
+ newl^.next := list;
+ list := newl
+end;
+
+
+
+[GLOBAL] FUNCTION listcopy( list: arglist ) : arglist;
+var
+ l : arglist;
+
+ procedure prec( list : arglist );
+ begin
+ if list = nulllist then
+ l := nulllist
+ else
+ begin
+ prec( nextinlist(l) );
+ preceedargonlist( l, firstarg(l))
+ end
+ end;
+
+begin
+ if list = nulllist then
+ listcopy := nulllist
+ else
+ begin
+ prec( list );
+ listcopy := l
+ end
+end;
+
+
+
+[GLOBAL] FUNCTION reverseoflist( list: arglist ) : arglist;
+var
+ l : arglist;
+
+ procedure app( list : arglist );
+ begin
+ if list = nulllist then
+ l := nulllist
+ else
+ begin
+ app( nextinlist(l) );
+ appendargonlist( l, firstarg(l))
+ end
+ end;
+
+begin
+ if list = nulllist then
+ reverseoflist := nulllist
+ else
+ begin
+ app( list );
+ reverseoflist := l
+ end
+end;
+
+
+
+
+[GLOBAL] FUNCTION leadingnodehassubtree( list : arglist ) : boolean;
+begin
+ if list = nulllist then
+ leadingnodehassubtree := false
+ else
+ leadingnodehassubtree := list^.subtree <> nulltree
+end;
+
+
+
+
+
+
+[GLOBAL] PROCEDURE findarginsortedlist( list : arglist; arg : argument;
+ var found : boolean;
+ var pointertoarg : arglist );
+
+type
+ searchstates = (searching, positionfound, foundlessthanlocation, endoflist);
+var
+ p : arglist;
+ state : searchstates;
+ currentarg : argument;
+ comp : comparisons;
+begin
+ found := false;
+ if list <> nulllist then
+ begin
+ p := list;
+ state:= searching;
+ repeat
+ currentarg := firstarg(p);
+ comp := compareargs(arg, currentarg);
+ case comp of
+ notvalid : errorexit('findarginsortedlist','invalid-comparison');
+ lessthan : state := foundlessthanlocation;
+ equal : begin
+ state := positionfound;
+ pointertoarg := p;
+ found := true
+ end;
+ greaterthan : nullstatement
+ end; {case}
+ if not found then
+ begin
+ p := nextinlist(p);
+ if p = nulllist then
+ state := endoflist
+ end
+ until state <> searching
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE findarginlist( list : arglist; arg : argument;
+ var found : boolean;
+ var pointertoarg : arglist );
+var
+ p : arglist;
+ compare : comparisons;
+begin
+ found := false;
+ if list <> nulllist then
+ begin
+ p := list;
+ repeat
+ compare := compareargs( arg, firstarg(p) );
+ if compare = equal then
+ begin
+ found := true;
+ pointertoarg := p
+ end
+ else
+ p := nextinlist(p)
+ until (p = nulllist) or (found)
+ end
+end;
+
+
+
+
+
+[GLOBAL] FUNCTION nargsattreenode( tree : argtree ) : integer;
+begin
+ if tree = nulltree then
+ nargsattreenode := 0
+ else
+ nargsattreenode := arglistlength( tree^.contents )
+end;
+
+
+
+
+
+
+
+
+
+[GLOBAL] PROCEDURE insertlistintotree( list : arglist; var tree : argtree);
+
+procedure subinsert( list : arglist; var tree : argtree;
+ parentpointer : arglist );
+label
+ routineexit;
+var
+ newtree : argtree;
+ found : boolean;
+ arg : argument;
+ pointertoarg : arglist;
+begin
+ if list = nulllist then
+ goto routineexit;
+ arg := firstarg(list);
+ if tree = nulltree then
+ begin
+ new( newtree );
+ newtree^.contents := nulllist;
+ appendargonlist(newtree^.contents, arg);
+ if parentpointer = nulllist then
+ newtree^.parentnode := nulltree
+ else
+ newtree^.parentnode := parentpointer^.subtree;
+ subinsert(nextinlist(list), newtree^.contents^.subtree, newtree^.contents);
+ if parentpointer = nulllist then
+ tree := newtree
+ else
+ parentpointer^.subtree := newtree;
+ goto routineexit
+ end;
+ findarginsortedlist( tree^.contents, arg, found, pointertoarg);
+ if not found then
+ insertarginsortedlist(tree^.contents, arg, pointertoarg);
+ subinsert( nextinlist(list), pointertoarg^.subtree, pointertoarg);
+ routineexit : nullstatement
+end;
+
+begin
+ subinsert( list, tree, nulllist)
+end;
+
+
+
+[GLOBAL] PROCEDURE searchtreeforlist( tree : argtree; list : arglist;
+ var found : boolean; var indexfound, depthfoundat : integer);
+
+ procedure subsearch( tree : argtree; list : arglist );
+ label
+ routineexit;
+ var
+ findsuccessful : boolean;
+ arg: argument;
+ pointertoarg : arglist;
+ begin
+ if tree = nulltree then
+ goto routineexit;
+ if list = nulllist then
+ goto routineexit;
+ arg := firstarg(list);
+ depthfoundat := depthfoundat + 1;
+ findarginsortedlist(listofargsattree(tree), arg, findsuccessful, pointertoarg);
+ if findsuccessful then
+ begin
+ found := true;
+ indexfound := argtexindex(firstarg(pointertoarg));
+ if leadingnodehassubtree(pointertoarg) then
+ subsearch(leadingnodesubtree(pointertoarg), nextinlist(list))
+ end;
+ routineexit : nullstatement
+ end;
+
+begin {searchtree}
+ found := false;
+ indexfound := indexofunknowntexcommand;
+ if list = nulllist then
+ warningmessage('searchtree','given empty list')
+ else
+ subsearch(tree, list)
+end;
+
+
+
+
+
+
+[GLOBAL] PROCEDURE padwithnullarguments( var list : arglist; index : integer;
+ requiredlength : integer );
+var
+ arg : argument;
+ i, ntoappend : integer;
+begin
+ initarg(arg, [nulltype], blank, index, TRUE);
+ ntoappend := requiredlength - arglistlength(list);
+ for i := 1 to ntoappend do
+ appendargonlist(list, arg)
+end;
+
+
+
+
+[GLOBAL] PROCEDURE listtoarray(var list : arglist; index : integer;
+ var arr : argarray; requiredlength :integer );
+var
+ l : arglist;
+ i : integer;
+begin
+ if requiredlength > maxargsinarray then
+ errorexit('listtoarray','array size exceeded');
+ padwithnullarguments( list, index, requiredlength);
+ l := list;
+ for i := 1 to requiredlength do
+ begin
+ arr[i] := firstarg(l);
+ l := nextinlist(l)
+ end
+end;
+
+
+
+
+[GLOBAL] PROCEDURE dlist( var f : text; l : arglist );
+const
+ linelength = 75;
+var
+ nchars : integer;
+
+ procedure dl( l : arglist );
+ var
+ s : pckstr;
+ begin
+ if l = nulllist then
+ writeln(f)
+ else
+ begin
+ s := argliteral(firstarg(l), true);
+ if (length(s) + nchars + 1) > linelength then
+ begin
+ writeln(f);
+ nchars := 0
+ end;
+ nchars := nchars + length(s) + 1;
+ write(f, s, blank);
+ dl( nextinlist(l))
+ end
+end;
+
+begin
+ nchars := 0;
+ dl( l )
+end;
+
+
+[GLOBAL] PROCEDURE dtree( var f : text; tree : argtree);
+
+ procedure dt( name : pckstr; tree : argtree );
+ var
+ l : arglist;
+ s : pckstr;
+ begin
+ if tree <> nulltree then
+ begin
+ writeln(f);
+ writeln(f,'**** "',name,'" NODE HAS ****');
+ l := listofargsattree(tree);
+ dlist(f,l);
+ writeln(f,'**** ',name,' *************');
+ while l <> nulllist do
+ begin
+ if leadingnodehassubtree(l) then
+ begin
+ s := argliteral(firstarg(l), true);
+ dt(s, leadingnodesubtree(l))
+ end;
+ l := nextinlist(l)
+ end
+ end
+ end;
+
+ begin
+ dt('<ROOT>', tree)
+end;
+
+
+
+[HIDDEN] PROCEDURE texwritearg( var f : text; arg : argument);
+EXTERN;
+
+
+
+[GLOBAL] PROCEDURE writeargarray( var f : text; arr : argarray );
+var
+ i : integer;
+begin
+ for i := 1 to maxargsinarray do
+ if argclass(arr[i]) <> [nulltype] then
+ texwritearg(f, arr[i])
+end;
+
+
+
+
+[GLOBAL] PROCEDURE makenullarray( var arr : argarray );
+var
+ templist : arglist;
+begin
+ templist := nulllist;
+ padwithnullarguments(templist, indexofunknowntexcommand, maxargsinarray);
+ listtoarray( templist, indexofunknowntexcommand, arr, maxargsinarray)
+end;
+
+
+
+END.
diff --git a/support/rnototex/utilityops.pas b/support/rnototex/utilityops.pas
new file mode 100644
index 0000000000..b7989865d3
--- /dev/null
+++ b/support/rnototex/utilityops.pas
@@ -0,0 +1,72 @@
+[INHERIT('SCREENHANDLERS'), environment('utilityops')]
+
+MODULE UTILITYOPS;
+
+CONST
+ blank = ' ';
+
+
+
+PROCEDURE gotoendofprogram;
+EXTERN;
+
+
+
+[GLOBAL] PROCEDURE errorexit( caller : varying[limit1] of char;
+ message : varying[limit2] of char );
+begin
+ ttywriteln;
+ ttywritestring('?ERROR from ');
+ ttywritestring(caller);
+ ttywritestring(message);
+ ttywriteln;
+ gotoendofprogram
+end;
+
+
+
+
+[GLOBAL] PROCEDURE warningmessage( caller : varying[limit1] of char;
+ message : varying[limit2] of char );
+
+begin
+ ttywriteln;
+ ttywritestring('%WARNING from procedure ');
+ ttywritestring(caller);
+ ttywritestring('"');
+ ttywritestring(message);
+ ttywritestring('"');
+ ttywriteln
+end;
+
+
+
+
+[GLOBAL] PROCEDURE nullstatement;
+begin
+end;
+
+
+
+
+[GLOBAL] FUNCTION capchar ( ch : char ) : char;
+begin
+ if ch in ['a'..'z'] then
+ capchar := chr(ord(ch) - 32)
+ else
+ capchar := ch
+end;
+
+
+
+
+[GLOBAL] FUNCTION lcchar( ch : char ) : char;
+begin
+ if ch in ['A'..'Z'] then
+ lcchar := chr(ord(ch) + 32)
+ else
+ lcchar := ch
+end;
+
+
+END.