(*************************************************************) PROGRAM SYSTEM ; (*************************************************************) CONST (* used by SysScr.INC *) (* appears in object code *) SysTitle = 'zINDENT.pas, Indent for dBASE / Turbo Pascal Source Files'; SysVersion1 = 'Command via : Line / File / User'; SysVersion2 = 'version 1000am, sat, 20.Sep.86, Glen Ellis'; SysCredit = ' '; SysPgmName = 'SYSLIST.DAT'; (* file containing filename list *) (* purpose of program 'System.Pas' : *) (* provide core program for applications development *) (* parameters FOR Compiler *) {$C+} {$U+} {$F4} (* parameters FOR LISTT.PAS, Borland's advanced Lister program *) {.U+} {.N-} {.P-} {.PO0} (*####################################################################*) (*$I B:SYSVAR.INC*) (* for core program *) (*$I A:STRING.INC*) (* required string utilties *) (*$I A:SYSSCR.INC*) (* screen display procedures *) (*$I A:SYSUTL.INC*) (* miscelaneous procedures *) (*$I A:SYSDSK.INC*) (* disk file procedures *) (*$I A:KEYDB.INC*) (* keyword dBASE *) (*$I A:KEYTP.INC*) (* keyword Pascal *) (********************************************************************) (*==================================================================*) (********************************************************************) BEGIN (* MAIN *) (*=======> INIT <=======*) (* programmer's options *) SysDisplay := true ; (* always true *) SysUserTrace := true ; (* display program path *) SysPgmTrace := true ; (* audit developmental path *) SysSpcTrace := false ; (* special, temporary *) pSayHeader; (* Display header *) (* SysScr.INC *) IF not SysPgmTrace then delay(3000); (*=======> FETCH <=======*) (* fetch command line from either paramstring or paramfile (* set defaults for operational vars : (* Filename, Indent, Comment, LineCount, Vertiate *) (* set mode flags true *) SysCmdLine := true ; SysCmdFile := true ; SysCmdUser := true ; (* parameter flags : if satisfied, then lower flag *) SysCmdUserFile := true ; (* enable fetch *) SysCmdUserParm := true ; (*=======> FETCH LINE ENTRY *) IF SysCmdLine then begin IF SysPgmTrace then writeln('--> SysCmdLINE'); (*$I B:SYSLINE.INC*) (*:::*) end; (*=======> FETCH FILE ENTRY *) IF SysCmdFile then begin IF SysPgmTrace then writeln('---> SysCmdFILE'); SysInFileName := SysPgmName; (* read data file name *) (*$I B:SYSFILE.INC*) (*:::*) end; (*=======> FETCH USER ENTRY *) IF SysCmdUser then begin IF SysPgmTrace then writeln('---> SysCmdUSER'); (*$I B:SYSUSER.INC*) (*:::*) end; (*=======> CORE CONTROLLER <=======*) (* if filename and parameters installed *) IF SysCmdLine or SysCmdFile or SysCmdUser then SysEnableCORE := true ELSE SysEnableCORE := false; IF SysUserTrace (* display list of file names *) then pSayFileList; (*::: SysUtl.INC *) IF SysPgmTrace then pSaySysVar; (* big VAR display prior to CORE *) (*=======> CORE <=======*) IF SysEnableCore then begin IF SysPgmTrace then begin writeln('--- Enable Core ---'); delay(1000); end; (* init : cmdline/cmdfile/cmduser *) IF (SysInSourceMax = 0) then SysInSourceMax := 1; (*=========================================*) FOR SysInSourceCnt := 1 to SysInSourceMax do begin (* Count Through InSource Array of FileNames *) (* fetch new filename *) (* parse for .typ *) (* start file *) (* read loop *) (* load the work var *) SysInFileName := SysInSource[SysInSourceCnt]; (*=======> Parse file.typ for mode : OL, DB, TP *) IF SysPgmTrace then begin writeln('--- Parse FileName --- ', SysInFileName); delay(1000); end; (*:::*) pSysParse( SysInFileName, SysPgmMod, SPMSL, SPMSR ); (*::: SysUtl.INC *) (*=======> Start Files *) (* create three file.type vars for .BAK, .(source), .$$$ (* Open, Reset, Rewrite files *) IF SysPgmTrace then begin writeln('--- Start Files ---'); delay(1000); end; IF SysPgmTrace then begin writeln('---> Before Start Files IOcheck = ',SysIOcheck); (* delay(1000); (**) end; SysIOcheck := true ; (* any one dead file will skip ! *) pSysStartFiles(SysIOcheck); (*::: SysUtl.INC *) (* IOcheck returned *) IF SysPgmTrace then begin writeln('<--- After Start Files IOcheck = ',SysIOcheck); (* delay(1000); (**) end; (*---------------*) IF SysIOcheck then begin IF SysUserTrace then begin writeln('--- Start Read Loop ---'); delay(1000); end; (* prep for linecnt during WHILE loop *) SysLineNum := 0; (* operational var set to zero *) pSysLvlInit; (*::: SysUtl.INC *) (*=======> Scan Through File *) WHILE not (eof(SysInFile)) do begin (* read text line from input file *) readln(SysInFile,SysInLine); (* assign output string to value read in *) SysOutLine := SysInLine; (*================================================ (* FOR SYSTEM.PAS this is the primary work core (* (* title: KEYWORD.INC (* (* current application flow: (* (* identify KEYWORD, and adjust indent (* SysUserTrace start/stop of structures (* toggle sysmarkwrite (* OutSTR = exit line (* indentPOS = current left margin position (* indentNUM = actual indent group length (* lineMAX = max length of text line = 79 (* markWRITE = enable comments write to disk *) (* writing parms are long for indentifiability *) (* procedure parms are small so line will be < 127 *) (* long vars to short vars *) pSysVarUPdt; (*::: SysUtl.INC *) (* (* Indent for dBASE-II (**) IF SysPgmMod = 'DB' then pKEYDB( SOLL, SIP, SIN, SLM, SMW, SLI, SLC, SLW); (*::: KeyDB.INC*) (* (* Indent for Turbo Pascal (**) IF SysPgmMod = 'TP' then pKEYTP( SOLL, SIP, SIN, SLM, SMW, SEB, SLI, SLC, SLW, SLB, SLR ); (*::: KeyTP.INC*) (* next application (* find string in file system , write to single file (* application in Treefile (* pFIND( RefStr, FndStr, fndcnt );*) (* short vars to long vars *) pSysVarDNdt; (*::: SysUtl.INC *) (* line count prefixer, handled in STRING.INC *) (* inc, concates number + string *) IF SysLineCnt then pLINECOUNT(SysOutLine, SysLineNum); (*::: string.inc *) (* WRITE the file data *) IF (SysMarkWrite) then writeLn(SysOutFile,SysOutLine); (* DISPLAY data string *) IF (SysDisplay) and (SysMarkWrite) then writeln(SysOutLine); end; (* WHILE not (eof(SysInFile)) do *) (*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*) (* KEYWORD.INC application routine *) (* appends level(stack) numbers to tail of OutFile *) (* level/error audit trail *) pSysLvlWrite; (*::: SysUtl.INC *) (*===================================*) IF SysPgmTrace then writeln('--- Close Files ---'); close(SysInFile); (* InFile.CMD *) close(SysOutFile); (* OutFile.TXT *) (* LineCnt would produce a un-runnable command file *) (* do not allow generated file to become file.CMD *) (* else, OK to rename files *) IF (not SysLineCnt) then begin (* if SysPgmMod not " " then type is recognized *) (* mode must be valid, else leave file as .$$$ *) pSysReName(SysIOcheck); (*::: SysUtl.INC *) end; (* KEYWORD application routine *) (* sends level(stack) numbers to video *) (* works with KEYWORD.INC *) IF SysDisplay then begin IF SysPgmMod = 'DB' then writeln(SPMSL, ':I:',SLI,' :C:',SLC,' :W:',SLW, SPMSR); IF SysPgmMod = 'TP' then writeln(SPMSL,'=B=',SLB,SPMSR); end; IF SysUserTrace then writeln('--- End Read Loop --- Close Files ---'); end; (* if SysIOcheck true *) IF not SysIOcheck then writeln('SysIOcheck = ',SysIOcheck); (*---------------------------*) end; (* FOR SysInSourceCnt := 1 to SysInSourceMAX *) (*================================================*) (* bottom of count through insource array *) end; (* IF SysEnableCore *) (*///////////////////////*) (*=======> NOT CORE <=======*) (* IF no parameters entered, *) (* then default is documentation / InStructions *) IF not SysEnableCore then pSaySysDoc; (*::: SysScr.INC *) END. (* MAIN *) (*=====================================================================*) (*:B:0*) (*:B:0*) (*:B:0*) (*:B:0*) (*:B:0*) (*:B:0*)