[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.
