From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP 15-SEP-1988 10:55
To:	ARISIA::EVERHART
Subj:	RNO-to-TeX (again)


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Thu, 15 SEP 88 06:37:04 PDT
Received: from relay.ubc.ca by KL.SRI.COM with TCP; Thu, 15 Sep 88 06:08:15 PDT
Received: by relay.ubc.ca (5.59/1.14)
	id AA00436; Thu, 15 Sep 88 06:07:29 PDT
Date: 15 Sep 88 12:54 -0500
From: John Edgecombe <edgecombe%ccrs.cdn@relay.ubc.ca>
To: <tnieland@wpafb-aamrl.arpa>, <philmds!philtis!lcn@mcvax.cwi.nl>,
        <info-vax@kl.sri.com>
Message-Id: <11*edgecombe@ccrs.cdn>
Subject: RNO-to-TeX (again)

I have been getting more messages recently about the .INI file missing
(including Ted Nieland's to the net).  Although I posted the revised
share files, the volume implies that I shall have to do so again.
So here goes -- in five parts:


$!.............................................................................
$! VAX/VMS archive file created by VMS_SHARE V06.00 26-May-1988.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user EDGECOMBE
$! on  6-APR-1866 20:07:23.76.
$!
$! ATTENTION: To keep each article below 66 blocks (33792 bytes), this
$!            program has been transmitted in 5 parts.  You should
$!            concatenate ALL parts to ONE file and execute (@) that file.
$!
$! It contains the following 19 files:
$!        ARGOPS.PAS
$!        BASICFILEOPS.PAS
$!        COMPILE_RNOTOTEX.COM
$!        CONVERSION.PAS
$!        DSROPS.PAS
$!        FLAGOPS.PAS
$!        GETCLI.FOR
$!        INIOPS.PAS
$!        LATEXOPS.PAS
$!        LINK_RNOTOTEX.COM
$!        RNOTOTEX.CLD
$!        RNOTOTEX.INI
$!        RNOTOTEX.PAS
$!        RNOTOTEX.RNH
$!        RNOTOTEX_GUIDE.TEX
$!        SCREENHANDLERS.PAS
$!        SETUP.COM
$!        TREEANDLISTOPS.PAS
$!        UTILITYOPS.PAS
$!
$!==============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.00 26-May-1988 requires VMS V4.4 or higher."
$ EXIT 44 
$VERSION_OK:
$ GOTO START
$
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY
b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) )
; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE
, b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors 
:= 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN 
& "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION
( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK( NONE 
) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 ); IF s_x = "+" THEN r_skip 
:= SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip <> 0 THEN s_x := ""
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF; ENDIF
; IF s_x = "-" THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ); IF r_skip <
> 0 THEN s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE )
; r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION
( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ); MOVE_VERTICAL( 1 )
; MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE
( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF
; IF s_x = "V" THEN s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1; MOVE_VERTICAL
( 1 ); ENDIF; IF s_x = "X" THEN s_x := ""; IF i_append_line <
> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF
; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> "" THEN i_errors 
:= i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT
( "The following line could not be unpacked properly:" ); SPLIT_LINE
; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL( 1 
); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH( "`"
, FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1 )
; IF CURRENT_CHARACTER = "`" THEN MOVE_HORIZONTAL( 1 ); ELSE COPY_TEXT( ASCII
( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDIF; ENDLOOP; IF i_errors = 0 THEN SET
( NO_WRITE, b_errors, ON ); ELSE POSITION( BEGINNING_OF( b_errors ) )
; COPY_TEXT( FAO( "The following !UL errors were detected while unpacking !AS"
, i_errors, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors
, "SYS$COMMAND" ); ENDIF; EXIT; 
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!,passed." )
$ RETURN
$
$START:
$ FILE_IS = "ARGOPS.PAS"
$ CHECKSUM_IS = 1669226973
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X{`009MODULE FOR LIST AND TREE OPERATIONS ARGUMENTS }
X{`009RANDALL VENHOLA JULY 8, 1987                  }
X                                                       
X
X[INHERIT('SCREENHANDLERS','UTILITYOPS')]
X
XMODULE ARGOPS;
X
XCONST
X
X   maxchars = 31;              {# of chars in arg literal }
X   maxargsinarray = 15;      {for conversion to an array of args}
X   indexofunknowntexcommand = 0;
X
XTYPE
X
X   pckstr = VARYING [ maxchars ] of char;
X
X   comparisons = (notvalid, lessthan, equal, greaterthan);
X
X   setofcomparisons = set of comparisons;
X
X   argtype = ( dsrverb, int, signedint, stylespecifier,
X`009    textpckstr, character, quotedpckstr, nulltype);
X
X   setofargtype = set of argtype;
X
X           argument =  record 
X`009                 source            : pckstr;                       
X`009                 isgeneralization : boolean;
X `009                 texindex         : integer;
X                         class             : setofargtype
X`009               end;        
X
X   argarray = array[1..maxargsinarray] of argument;
X
X                            
X            
X
X[GLOBAL] FUNCTION argliteral( arg : argument; smooth : boolean ) : pckstr;
X
Xvar 
X  s : pckstr;         
X  i,j, firstchar, lastchar : integer;
X  ch : char;
X
X procedure findfirstchar( s : pckstr; var firstchar : integer);
X begin
X    firstchar := 1;
X    while (firstchar < s.length) and (s.body[firstchar] <= blank) do
X      firstchar := firstchar + 1
X end;  
X
X procedure findlastchar( s : pckstr; var lastchar : integer );
X begin
X   lastchar := s.length;
X   while (lastchar > 1) and (s.body[lastchar] <= blank) do
X      lastchar := lastchar - 1
X end;
X                                                           
Xbegin       
X   if smooth then
X   begin
X     findfirstchar( arg.source, firstchar);
X     findlastchar( arg.source, lastchar);
X     j := 0;        
X     for i := firstchar to lastchar do
X     begin  
X       ch := arg.source.body[i];
X       if ch < blank then ch := blank;
X       if ch in ['a'..'z'] then ch := chr(ord(ch) - ord(blank));
X       j := j + 1;
X       s.body[j] := ch
X     end;                                                       
X     if (j = 1) and (s.body[1] = blank) then
X       s.length := 0
X     else
X       s.length := j             
X   end
X   else
X     s := arg.source;    
X   argliteral := s
Xend;
X          
X
X    
X
X
X[GLOBAL] FUNCTION pckstrisgeneralization( s : pckstr ) : boolean;
X  label
X    routineexit;
X  var
X    flag : boolean;
X  begin
X     flag := false;
X     if s = '[N]' then
X     begin
X       flag := true;
X       goto routineexit
X     end;
X     if s = '[C]' then
X     begin
X       flag := true;
X       goto routineexit
X     end;
X     if s = '[Y]' then
X     begin
X       flag := true;
X       goto routineexit
X     end;
X     if s = '[T]' then
X     begin
X       flag := true;
X       goto routineexit
X     end;
X     if s = '[Q]' then
X     begin
X       flag := true;
X       goto routineexit                                      
X     end;      
X     routineexit : pckstrisgeneralization := flag
Xend;            
X
X
X    
X     
X[GLOBAL] FUNCTION argisgeneralization( arg : argument ) : boolean;
Xbegin
X   argisgeneralization := arg.isgeneralization
Xend;
X   
X          
X
X
V[GLOBAL] FUNCTION textualmatch( arg1, arg2 : argument) : boolean;              
X                             
Xbegin
X   textualmatch := false;
X   if (arg1.source = '[T]') and (textpckstr in arg2.class) then
X`009textualmatch := true
X   else
X      if (arg2.source = '[T]') and (textpckstr in arg1.class) then
X`009textualmatch := true
Xend;
X
X
X
X        
X[GLOBAL] FUNCTION compareargs( leftarg, rightarg : argument ) : comparisons;
Xlabel
X  routineexit;
Xvar
X  lefts, rights : pckstr;
X  equalpckstrs : boolean;
X  comp : comparisons;       
X
X  procedure greaterorlessthancompare;
X  begin
X     if lefts < rights then
X       comp := lessthan
X     else              
X      comp := greaterthan
X  end;
X                                                
X  procedure checktexindex;
X  begin
X     if (leftarg.texindex  = indexofunknowntexcommand) or
X        (rightarg.texindex = indexofunknowntexcommand) then
X         comp := equal
X     else
X`009if leftarg.texindex = rightarg.texindex then
X`009  comp := equal
X`009else
X           greaterorlessthancompare
X  end;
X
Xbegin                        
X   if textualmatch( leftarg, rightarg) then
X   begin
X     comp := equal;
X     goto routineexit
X   end;
X   if (leftarg.class = [nulltype]) or (rightarg.class = [nulltype]) then
X   begin
X      comp := equal;
X      goto routineexit
X   end;
X   lefts := argliteral(leftarg, TRUE);
X   rights := argliteral(rightarg, TRUE);
X   equalpckstrs := (lefts = rights);
X   comp := notvalid;
X   if leftarg.class * rightarg.class <> [] then
X   begin                              
X     if equalpckstrs then                            
X        comp := equal
X     else  
X        if (leftarg.isgeneralization) or (rightarg.isgeneralization) then
X          checktexindex
X        else
X          greaterorlessthancompare
X   end
X   else
X     greaterorlessthancompare;
X   routineexit : compareargs := comp
Xend;      
X
X
X
X
X[GLOBAL] FUNCTION argtexindex( arg : argument ) : integer;    
Xbegin
X   argtexindex := arg.texindex
Xend;
X                                                              
X          
X
X
X[GLOBAL] FUNCTION argclass( arg : argument ) : setofargtype;
Xbegin
X   argclass := arg.class
Xend;
X
X
X
X
X[GLOBAL] PROCEDURE initarg( var arg : argument; classification : setofargtype;
X                   lit : pckstr; index : integer; general : boolean );
Xbegin
X   arg.source            := lit;
X   arg.class             := classification;
X   arg.texindex         := index;
X   arg.isgeneralization := general
Xend;
X
X
X                         
X
V[GLOBAL] PROCEDURE reassignargclass( var arg : argument; newclass : setofargtyp
Xe);
Xbegin
X   arg.class := newclass
Xend;                                            
X    
X
X
X
X[GLOBAL] PROCEDURE reassignargtexindex( var arg : argument; newindex:integer);
Xbegin
X  arg.texindex := newindex
Xend;
X
X                                   
X
V[GLOBAL] PROCEDURE reassignarggeneralization( var arg : argument;general:boolea
Xn);
Xbegin
X   arg.isgeneralization := general
Xend;
X
X
X
X
X[GLOBAL] PROCEDURE appendchartoarg( ch : char; var arg : argument );
Xbegin
X  if arg.source.length = maxchars then                              
X      warningmessage('appendchartoarg','argument too long')   
X  else
X  begin
X    arg.source.length := arg.source.length + 1;
X    arg.source.body[arg.source.length] := ch
X  end
Xend;
X
X
X
X
V[GLOBAL] PROCEDURE extractintegerfromargument( arg : argument; var successful :
X boolean;
X`009                               var int : integer;
X`009                               var signed : boolean );
Xvar                                    
X  s  : pckstr;
Xbegin
X   s := argliteral( arg, TRUE);
X   readv( s, int, error := continue );
X   if statusv <> 0 then
X     successful := false
X   else
X   begin
X      successful := true;
X      signed := (s.body[1] = '+') or (s.body[1] = '-')
X   end
Xend;
X
X
X
XEND.
X                                            
$ GOSUB UNPACK_FILE
$ FILE_IS = "BASICFILEOPS.PAS"
$ CHECKSUM_IS = 172942151
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X[INHERIT('UTILITYOPS','SCREENHANDLERS','ARGOPS')]
X
XMODULE BASICFILEOPS;
X
XCONST
X
X   maxfidchars = 255;
X   ndatetimechars = 11;                     
X   programversion = 'CVF02B';
X   inifilename = 'INIT$RNOTOTEX';
X   logfilename = 'RNOTOTEX.LOG';
X
X
XTYPE
X
Xfidtype = VARYING[maxfidchars] of char;
X
Xdatetimetype = packed array[1..ndatetimechars] of char;
X
X                                    
XVAR
X   inputcontainstexcommands : [EXTERNAL] boolean;
X   totallines, totalchars    : [EXTERNAL] integer;
X   LOG`009                       : [EXTERNAL] text;
X
X
X
X
X[GLOBAL] PROCEDURE noconversion;
Xbegin
X  writeln(log,'[no conversion performed]')
Xend;
X
X
X
X
X[GLOBAL] PROCEDURE greetuser ( var d, t : datetimetype );
Xbegin
X   date( d );
X   time( t );
X   clearscreen;
X   ttywritestring('RNOTOTEX ');
X   ttywritestring(programversion);
X   ttywritestring('    RUNOFF TO TEX CONVERSION    ');
X   ttywritestring( d );
X   ttywritestring( t );
X   ttywriteln;
X   ttywriteln;
X   ttywriteln
Xend;
X    
X
X
X
X
V[GLOBAL] PROCEDURE openinputfile( fid : fidtype; var f : text; var openerror : 
Xboolean );
Xbegin
X   open( file_variable := f,
X         file_name := fid,
X         history := readonly,
X         default := 'INPUT.RNO',
X         error := continue );                                     
X   if status(f) <> 0 then
X      openerror := true
X   else                  
X   begin 
X      reset( f );
X      openerror := false      
X   end
Xend;
X                       
X
X
X
X
V[GLOBAL] PROCEDURE openoutputfile(fid : fidtype; var f : text; var openerror:bo
Xolean);
Xbegin
X     open( file_variable := f,
X           file_name := fid,
X           history := new,
X           default := 'OUTPUT.TEX',
X           error := continue );
X     if status(f) <> 0 then
X        openerror := true
X     else
X     begin
X        openerror := false;
X        rewrite(f)
X     end;
Xend; 
X
X    
X
X[GLOBAL] PROCEDURE openinifile ( var f : text );
Xbegin
X    open( file_variable := f,
X          file_name := inifilename,
X          history := readonly,
X          error := message );
X    reset( f );                                            
X    ttywriteln;
X    ttywritestring('Loading INI file ...')
Xend;
X          
X    
X
X                                                    
X[GLOBAL] PROCEDURE openlogfile; { global var LOG : text used }
Xbegin
X   open( file_variable := log,
X`009 file_name := logfilename,
X`009 history := new,
X`009 error := continue );
X   rewrite( log )
Xend;
X
X
X
X[GLOBAL] PROCEDURE closelogfile; 
Xbegin
X   close( file_variable := log, error := continue )
Xend; 
X         
X[GLOBAL] PROCEDURE closeinifile( var f : text );
Xbegin
X    close( file_variable := f, error := continue );
X    ttywritestring('complete.');
X    ttywriteln;
Xend;
X
X
X
X
X
X[GLOBAL] PROCEDURE closefiles( var infile, outfile : text );
X
Xbegin
X   close(file_variable := infile, error := continue);
X   close(file_variable := outfile, error := continue);
X   ttywritestring('complete.');
X   ttywriteln;
X   ttywriteln;
X   ttywriteln;
X   if totallines = 1 then               
X      ttywritestring(' RNOTOTEX read only one line from the input file.')
X   else
X     if totallines = 0 then
X       ttywritestring(' No end of line was found in the input file.')
X     else                                                  
X     begin
X       ttywritestring(' RNOTOTEX processed a total of ');
X       ttywriteint( totallines );
X       ttywritestring(' lines.')
X     end;
X   ttywriteln;
X   if totalchars = 1 then
X      ttywritestring(' There was only one character in the file.')
X   else
X      if totalchars = 0 then
X        ttywritestring(' No printable characters were found in the file.')
X      else
X      begin
X         ttywritestring(' A total of ');
X         ttywriteint( totalchars );
X         ttywritestring(' characters were read.')                           
X      end;
X   ttywriteln
Xend;
X
X    
X
X
X
X
X[GLOBAL] PROCEDURE putcommentstooutput( var outfile : text; infid : fidtype;
X`009                                d, t : datetimetype );
Xbegin
X   writeln(outfile,'% document translated from DEC RUNOFF to LaTeX format');
V   writeln(outfile,'% by program RNOTOTEX version ',programversion,' at ',d,bla
Xnk,t);
X   writeln(outfile,'% Source file :',infid);
X   writeln(log,'[RNOTOTEX.LOG for ',infid,' ]');
X   writeln(log,'[Processing at ',d, blank, t,' ]')
Xend;               
X
X
X             
X
X
X[GLOBAL] PROCEDURE userinterface( var inputfid, outputfid : fidtype;
X`009                           var rno, tex : text );
X
Xtype
X    packedarray = packed array[1..255] of char;
X
Xvar
X   openerror : boolean;
X   slashtex : integer;
X
X   procedure getcli( var ifile, ofile : [class_s] packedarray;
X                     var slashtex : integer ); fortran;
Xbegin
X      getcli( inputfid.body, outputfid.body, slashtex );
X      inputfid.length := 75;
X      outputfid.length := 75;
X      openinputfile( inputfid, rno, openerror);
X      if openerror then
X        warningmessage('openinputfile','Could not open that input file.');
X      openoutputfile( outputfid, TEX, openerror);
X      if openerror then
X         warningmessage('openoutputfile','Could not open that output file.');
X      inputcontainstexcommands := slashtex <> 0
Xend;
X
X
XEND.
$ GOSUB UNPACK_FILE
$ FILE_IS = "COMPILE_RNOTOTEX.COM"
$ CHECKSUM_IS = 1635150220
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$ IF ("''P1'" .EQS. "") THEN $ P1="PASCAL/OPTIMIZE/NOCHECK/ENVIRONMENT"
X$ 'P1'  SCREENHANDLERS
X$ 'P1'  UTILITYOPS
X$ 'P1'  ARGOPS
X$ 'P1'  BASICFILEOPS
X$ 'P1'  TREEANDLISTOPS
X$ 'P1'  FLAGOPS
X$ 'P1'  LATEXOPS
X$ 'P1'  INIOPS
X$ 'P1'  CONVERSION
X$ 'P1'  DSROPS
X$ 'P1'  RNOTOTEX
X$ FORTRAN GETCLI
$ GOSUB UNPACK_FILE
$ FILE_IS = "CONVERSION.PAS"
$ CHECKSUM_IS = 777150295
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X[INHERIT('UTILITYOPS','ARGOPS','FLAGOPS',
X'TREEANDLISTOPS','LATEXOPS')]
X
XMODULE CONVERSION;
X
XCONST
X    maxlists = 8;     
X    maxheaderlevels = 6;
X    maxlongpckstrchars = 75;
XTYPE
X
Xlongpckstr = VARYING[maxlongpckstrchars] of char;
X
Xpagesizetype = record
X`009            length : integer;
X`009            width  : integer
X`009         end;
X
Xparagraphdeftype = record
X    `009                indent : integer;
X`009                vertskip : integer;
X`009                testpage : integer
X`009             end;
X
Xnumberlisttype = record
X`009              listlevel   : integer;
X`009              valuetoset : integer
X`009           end;
X
Xdisplayelementstype = record
X`009                  leftchar : char;
X`009                  style : styletype;
X`009                  rightchar : char
X`009                end;
X
Xleveltype = record
X`009   value : integer;                                                    
X`009   display : styletype
X`009end;
X
Xheaderleveltype = array[1..maxheaderlevels] of leveltype;
X
X
XVAR
X
X
Xinputcontainstexcommands : [GLOBAL] boolean;
X
Xtotallines, totalchars : [EXTERNAL] integer;
X
Xpagesize : [GLOBAL] pagesizetype;
X
Xnumberpage : [GLOBAL] integer;
X
Xnumberrunning : [GLOBAL] integer;
X
Xdisplaynumber : [GLOBAL] styletype;
X
Xcapitalizetext, lowercasetext : [GLOBAL] boolean;
X
Xleftmargin : [GLOBAL] integer;
X
Xrightmargin : [GLOBAL] integer;
X
Xfill : [GLOBAL] boolean;
X
Xstartnofillagain : [GLOBAL] boolean;
X
Xjustify : [GLOBAL] boolean;
X
Xspacing : [GLOBAL] integer;
X                              
Xindent  : [GLOBAL] integer;
X
Xcentering : [GLOBAL] boolean;
X
Xflushright : [GLOBAL] boolean;
X
Xminipageactive : [GLOBAL] boolean;
X
Xinmarginpar  : [GLOBAL] boolean;
X
Xinfootnote : [GLOBAL] boolean;
X
Xparagraphdef : [GLOBAL] paragraphdeftype;
X
Xnumberlist : [GLOBAL] numberlisttype;
X
Xdisplayelements : [GLOBAL] displayelementstype;
X
Xnumberchapter : [GLOBAL] integer;
X
Xdisplaychapter : [GLOBAL] styletype;
X
Xheaderlevel : [GLOBAL] headerleveltype;
X
Xnestlevel : [GLOBAL] integer;
X
Xnumberappendix : [GLOBAL] integer;
X
Xdisplayappendix : [GLOBAL] styletype;
X
Xwritetexcommands : [GLOBAL] boolean;
X
Xflagtable : [GLOBAL] flagtabletype;
X
Xinliteral : [GLOBAL] boolean;
X
Xtitle, subtitle : [GLOBAL] argarray;
X
Xdatestring : [GLOBAL] pckstr;
X
Xpagestyle : [GLOBAL] pagestyletype;
X                                                   
Xliststate : [GLOBAL] array[1..maxlists] of liststatetype;
X
Xnumberofelements : [GLOBAL] array[1..maxlists] of integer;
X
Xoutputfirstitem : [GLOBAL] array[1..maxlists] of boolean;
X
Xlistnestlevel : [GLOBAL] integer;
X
Xnofillbeforelist : [GLOBAL] boolean;
X
XLOG : [EXTERNAL] text;
X
Xunderlineactive : [GLOBAL] enhancmentstates;
X
Xboldactive : [GLOBAL] enhancmentstates;
X
X
X
X[GLOBAL] FUNCTION quotedcharacter( arg : argument ) : char;
Xvar
X  s : pckstr;
Xbegin
X   s := argliteral( arg, true );
X   if length(s) = 1 then
X      quotedcharacter := s[1]
X   else
X      if length(s) = 3 then
X`009quotedcharacter := s[2]
X      else
X`009quotedcharacter := blank
Xend;                                           
X                          
X
X
X[HIDDEN] PROCEDURE noconversion; EXTERN;
X
X
X
X
X
X
X                              
X[GLOBAL] PROCEDURE blankifypckstr( var s : pckstr );
Xbegin
X  s.body := blank;
X  s.length := 0
Xend;
X
X
X
X[GLOBAL] PROCEDURE initglobalvars;
Xvar
X  i : integer;
Xbegin
X   pagesize.length := 58;
X   pagesize.width := 60;
X   numberpage := 1;
X   numberrunning := 1;
X   displaynumber := decimal;
X   capitalizetext := false;
X   lowercasetext := false;
X   leftmargin := 0;
X   rightmargin := 60;
X   fill := true;
X   startnofillagain := false;
X   justify := true;              
X   centering := false;
X   flushright := false;
X   minipageactive := false;
X   indent := 5;
X   spacing := 1;
X   paragraphdef.indent := 5;
X   paragraphdef.vertskip := 2;
X   paragraphdef.testpage := 5;
X   numberlist.listlevel := 1;
X   numberlist.valuetoset := 0;
X   nofillbeforelist := false;
X   displayelements.leftchar := blank;
X   displayelements.style := decimal;
X   displayelements.rightchar := blank;
X   numberchapter := 0;
X   numberappendix := 0;
X   displaychapter := decimal;
X   for i := 1 to maxheaderlevels do
X   begin
X     headerlevel[i].value := 0;   
X     headerlevel[i].display := decimal
X   end;                       
X   nestlevel := 1;
X   inliteral := false;
X   makenullarray( title );
X   makenullarray( subtitle ); 
X   pagestyle := myheadings;
X   blankifypckstr( datestring );
X   for i := 1 to maxlists do
X   begin
X      liststate[i] := nostate;
X      numberofelements[i] := 0;
X      outputfirstitem[i] := false
X   end;
X   listnestlevel := 0;
X   underlineactive := notenhanced;
X   boldactive := notenhanced
Xend;
X                        
X
X
X
X[GLOBAL] PROCEDURE loglist( list : arglist; index : integer);
Xvar                                    
X  l : arglist;
Xbegin
X  writeln(log);
X  writeln(log,'INDEX >',index:1,' LENGTH >',arglistlength(list):1);
X  l := list;  
X  write(log,'RUNOFF >');
X  while l <> nulllist do
X  begin
X    write(log, argliteral(firstarg(l), false), blank);
X    l := nextinlist(l)
X  end;
X  writeln(log);
X  write(log,'TEX >') 
Xend;
X
X                    
X
X
X[GLOBAL] PROCEDURE dumpthelist( var outfile : text; list : arglist );
Xbegin
X   if list <> nulllist then
X   begin
X      texwritearg(outfile, firstarg(list));
X      dumpthelist(outfile, nextinlist(list))
X   end
Xend;
X
X
X
X
X[GLOBAL] PROCEDURE newintvalue( arg : argument; var current : integer; 
X       `009                 var modified : parameterchangestates; 
X`009                 var intextracted : integer );
Xvar  
X  signed : boolean;                      
X  successful : boolean;
Xbegin                                        
X  modified := nochange;
X  extractintegerfromargument(arg, successful, intextracted, signed );
X  if successful then
X  begin                                               
X    if signed then
X    begin
X      modified := altered;
X      current := intextracted + current
X    end
X    else                        
X    begin
X      modified := assigned;
X      current := intextracted
X    end
X  end
Xend;                      
X
X
X
X
X[GLOBAL] PROCEDURE newcountparameter( arg : argument; var current : integer;
X`009                                var modified : parameterchangestates;
X                                        var countervalueextracted : integer;
X`009                                var class : countparametertype);
Xbegin
X  modified := nochange
Xend;
X
X
V[GLOBAL] PROCEDURE newstyleparameter( arg : argument; var current : styletype )
X;
Xvar
X   s : styletype;
Xbegin
X  s := isastylespecifier( arg );
X  if s <> undetermined then
X      current := s
Xend;
X                     
X
X                                            
X  
X[LOCAL] FUNCTION  m( i : integer  ) : integer;
Xbegin
X  if i < 2 then
X   m := 1
X  else
X   m := i - 1
Xend;                                        
X                                                               
X
X[LOCAL] PROCEDURE C( var f : text );
Xbegin
X   writeln(f,'}');
X   writeln(log,'}')
Xend;
X
X
X
X
X[GLOBAL] PROCEDURE flagchange( f : dsrflagclasses; arg : argument );
Xvar
X  ch : char;
Xbegin
X   turnflagon( f );
X   ch := quotedcharacter( arg );
X   if ch <> blank then 
X     changeflagchar(f, ch)
Xend;
X
X
X
X                   
X[GLOBAL] PROCEDURE puttexcommand( var outfile : text; index : integer; 
X`009                   dsrlist : arglist; 
X`009                   var writeanothertexcommand : integer );
X
Xlabel 
X   routineexit;                                                          
Xconst                  
X  charwidth = true;
X  charheight = false;
Xvar 
X   arg : argarray;
X   i, j, n : integer;
X   modified : parameterchangestates; 
X   extractedvalue, skip, startindex : integer;     
X   class : countparametertype;
X   f : dsrflagclasses;
X   q : char;                            
X   startedwithfill : boolean;
X                   
Xbegin                                
X
Xif (index < 1) or (index > 130) then goto routineexit;
X                             
Xwriteanothertexcommand := indexofunknowntexcommand;
Xloglist( dsrlist, index );
Xn := arglistlength( dsrlist );
Xlisttoarray( dsrlist, index, arg, maxargsinarray);
Xstartedwithfill := fill;     
Xstopunderline( outfile );
Xstopbold( outfile );
X
X{
X  n      - number of arguments supplied with the DSR command 
X  m(n-1) - one less than that number, unless n < 2
X  m(n-2) - two less than the number of arguments, unless < 3
X  etc                                                         
X
X  arg[i] - the ith input dsr argument; e.g. four args could be : 
X 
X      1    2   3   4
X     PAGE SIZE 10, 20                                             }
X
X 
X                      
Xcase index of
X                                 
X   {***** PAGE SIZE *****}      
X  1 : begin                                                         
X`009newintvalue(arg[n], pagesize.width, modified, extractedvalue);
X`009newintvalue(arg[m(n)], pagesize.length, modified, extractedvalue);
V        adjustlength(outfile, modified, pagesize.width, extractedvalue,charwidt
Xh,'textwidth');
V`009adjustlength(outfile, modified, pagesize.length, extractedvalue,charheight,
X'textheight')
X      end;
X              
X   {***** HEADERS OFF *****} 
X  2 : adjustpagestyle(outfile, plain);
X
X   {***** HEADERS ON ***** }
X  3 : adjustpagestyle(outfile, headings);
X
X   {***** HEADERS UPPER ***** }
X  4 : noconversion;              
X                      
X   {***** HEADERS LOWER ***** }
X  5 : noconversion;
X
X   {***** HEADERS MIXED ***** }
X  6 : noconversion;
X                           
X   {***** ENABLE WRITING OF DATE *****} 
X  7 : begin
X        datestring := '\today';
X        if pagestyle = myheadings then
X          adjustpagestyle(outfile, myheadings)
X        else
X`009  noconversion
X      end;
X          
X  { ***** DISABLE WRITING OF DATE ***** }
X  8 : begin
X        blankifypckstr( datestring );
X        if pagestyle = myheadings then
X          adjustpagestyle(outfile, myheadings )
X        else
X          noconversion
X      end;
X`009     
X  { ***** LAYOUT ***** }
X  9 : noconversion;
X     
X  { ***** NO NUMBER ***** }
X 10 : adjustpagestyle(outfile, empty);
X
X  { ***** NUMBER PAGE ***** }
X 11 : begin                                                        
X`009newcountparameter(arg[n], numberpage, modified, extractedvalue,class);
X        adjustcounter(outfile, modified, numberpage, extractedvalue, 'page')
X      end;                        
X           
X  { ***** NUMBER RUNNING ***** }
X 12 : begin                                         
X        newintvalue(arg[n], numberrunning, modified, extractedvalue);
X        adjustcounter(outfile, modified, numberrunning, extractedvalue,'page')
X      end;
X      
X  { ***** DISPLAY NUMBER ***** }
X 13 : begin
X        newstyleparameter(arg[n], displaynumber);
X`009adjuststyle(outfile, displaynumber, 'page')
X      end;
X           
X  { ***** NO PAGING ***** }
X 14 : noconversion;
X
X  { ***** PAGING ***** }
X 15 : noconversion;
X
X  { ***** BEGIN SUBPAGE ***** }
X 16 : begin
X        if not minipageactive then
X`009begin
X`009  minipageactive := true;
X          if not startedwithfill then
X`009  begin
X`009    endnofill( outfile );
X`009    startnofillagain := true
X`009  end;
X`009  writeln(outfile,'\begin{minipage}');
X          writeln(    log,'\begin{minipage}');
X`009  if not startedwithfill then
X`009    beginnofill( outfile )
X        end
X`009else
X`009begin
X`009   writeln(outfile,'% RNOTOTEX - minipage already active');
X`009   writeln(    log,'% RNOTOTEX - minipage already active')
X`009end
X      end;
X
X  { ***** END SUBPAGE ***** }
X 17 : begin                     
X        if minipageactive then
X`009begin
X          if not fill then
X`009    endnofill( outfile );
X          writeln(outfile,'\end{minipage}');
X          writeln(    log,'\end{minipage}');
X          if startnofillagain then         
X`009  begin
X`009    startnofillagain := false;
X`009    beginnofill( outfile )     
X          end
X        end
X        else
X        begin
X`009   writeln(outfile,'% RNOTOTEX - minipage not active');
X`009   writeln(    log,'% RNOTOTEX - minipage not active')
X     `009end;
X        minipageactive := false
X      end;
X
X  { ***** NUMBER SUBPAGE ***** }
X 18 : noconversion;
X
X
X  { ***** DISPLAY SUBPAGE ***** }
X 19 : noconversion;
X
X  { ***** FIRST TITLE ***** }
X 20 : noconversion;
X
X  { ***** TITLE ***** }
X 21 : begin
X         for i := 2 to maxargsinarray do
X`009   title[i-1] := arg[i];
X         if pagestyle = myheadings then
X           adjustpagestyle(outfile, myheadings)
X         else
X`009   noconversion
X      end;
X
X  { ***** SUBTITLE ***** }
X 22 : begin
X         for i := 2 to maxargsinarray do
X`009    subtitle[i-1] := arg[i];
X         if pagestyle = myheadings then
X`009   adjustpagestyle(outfile, myheadings)
X         else
X`009   noconversion
X      end;
X
X  { ***** NO SUBTITLE ***** }
X  23 : begin
X          makenullarray( subtitle );
X          if pagestyle = myheadings then
X            adjustpagestyle(outfile, myheadings)
X          else
X`009    noconversion
X       end;
X
X  { ***** NO AUTOSUBTITLE ***** }
X  24 : begin
X         makenullarray( subtitle );
X         if pagestyle = myheadings then
X           adjustpagestyle(outfile, plain)
X         else
X           noconversion
X       end;
X
X  { ***** AUTOSUBTITLE ***** }
X  25 : adjustpagestyle(outfile, headings);
X
X
X  { ***** UPPERCASE ***** }
X  26 : begin
X        capitalizetext := true;
X        lowercasetext := false
X       end;
X
X  { ***** LOWERCASE ***** }
X  27 : begin
X`009capitalizetext := false;
X        lowercasetext := true
X       end;
X
X  { ***** LEFT MARGIN ***** }
X  28 : begin
X          newintvalue( arg[n], leftmargin, modified, extractedvalue);
X`009  noconversion
X       end;
X 
X  { ***** RIGHT MARGIN ***** }
X  29 : begin
-+-+-+-+-+ End of part 1 +-+-+-+-+-

