$eject /*********************************************************** * * * t e x t p r o c e s s o r m a i n p r o g r a m * * * ***********************************************************/ main$program: do; /* e x t e r n a l d a t a & p r o c e d u r e s */ declare ernum address external, /* error number detected */ tabflag byte external, /* tabulation mode flag */ tbp byte external, /* text buffer pointer */ lbuff(128) byte external, /* line buffer */ eofset byte external, /* end of file flag */ huge literally '100', false literally '0', cr literally '0dh', /* carriage return character */ lf literally '10'; /* line feed character */ comtyp: procedure byte external; end comtyp; printline: procedure(numb) external; declare numb address; end printline; space: procedure(n) external; declare n byte; end space; print$msg: procedure(a) external; declare a address; end print$msg; command: procedure external; end command; text: procedure external; end text; getline: procedure external; end getline; finalwork: procedure external; end finalwork; start: procedure external; end start; $eject /************************************************************** * TEXT READ ONE LINE AT A TIME, AND CALLS COMMAND IF * * ENCOUNTERS COMMAND LINE, OTHERWISE CALLS TEXT HANDLER * **************************************************************/ call print$msg(.(cr,lf,' TEXT PROCESSOR VERSION I',cr,lf,'$')); tbp = 0; tabflag = false; /* reset the tabulation flag */ call start; /* - - - m a i n r o u t i n e - - - */ do while not eofset; if lbuff(0) = '.' then call command; /* command line */ else call text; /* text line */ call getline; /* get a new line */ end; call space(huge); /* complete the last page */ if ernum > 0 then do; call printline(ernum); call print$msg(.(' ERROR COMMAND(S) DETECTED',cr,lf,'$')); end; call finalwork; /* close all files and exit */ end main$program; eof