Comment ============================================================= Copyright 1996-2000 by Marc Perkel This program is used to generate a new MarxMenu HTML web pages. ============================================================= EndComment var Out Inp Toc Line Chapter ChapterNumber ChapterName ChapterNameClean Catagory CatIndex Ph Pass LastCh Start CodeMode Footer Title BaseDir Var STime ETime Include 'g:\banners.inc' STime = Timer Main ETime = Timer Writeln 'Time: ' (ETime - STime) Procedure DoChapter var FileName Ch St P Line ReadChapter Trim(Chapter) FileName = MakeFileName(ChapterNumber) FileAssign(Out,BaseDir + FileName) FileCreate(Out) if Ph >= 3 St = ChapterNameClean while (St > '') and (Left(St,1) < 'A') delete(St,1,1) endwhile Ch = Left(St,1) if (Ch = 'A') and (LastCh <> 'A') Start endif if (Ch >= 'A') and Start if Ch > LastCh Write Ch ' ' WrToc '' WrToc '
' WrToc AddLine WrToc 'Top - ' WrToc 'Categories - ' WrToc HomePage WrToc '

- ' Ch ' -

' LastCh = Ch endif endif endif WrToc '' WrToc '' if Ph >= 3 WrToc Chapter[1] '
' else WrToc ChapterName '
' endif WriteHeader(Loc Out,ChapterNameClean) Indexes Wr '

' AddLine Wr '

' NameColor Chapter[1] '

' delete(Chapter,1,1) Substitute(Chapter,'<','<') Substitute(Chapter,'>','>') Loop Chapter Line = LoopVal if Line = '' Wr '

' elseif Line StartsWith '..' delete(Line,1,2) St = UpperCase(NextWordDelim(Line,'')) if St = 'DOWNLOAD' if ExistFile('g:\ctyme\download\share\' + Line) Wr 'Download:' Wr '' Wr UpperCase(Line) '' else Writeln 'File ' Line ' missing.' endif endif elseif Line StartsWith ' ' SetCodeMode On if LoopVal contains 'Example:' Wr 'Example:
' else Wr LoopVal endif elseif Line StartsWith 'See Also:' SetCodeMode Off delete(Line,1,9) trim(Line) Wr '' if not (Chapter[LoopIndex-1] StartsWith 'See Also:') Wr '' endif while Line > '' St = NextWordDelim(Line,',') if HashExist(St) P = Hash(St)[1] else Writeln 'Error: See Also [' St '] in ' ChapterNameClean endif Wr '' endwhile Wr '
See Also:' Wr St '
' elseif Line StartsWith 'Category:' SetCodeMode Off delete(Line,1,9) trim(Line) Wr '' Wr '' while Line > '' St = NextWordDelim(Line,',') Wr '' AddToCatagory(St,ChapterNameClean) endwhile Wr '
Category:' Wr St '
' else ;- normal line SetCodeMode Off Wr(Line) endif EndLoop SetCodeMode Off Wr '

' Wr AddLine Indexes PageFooter FileClose(Out) EndProc Procedure PageFooter Var Sponsor, Conf, Mail, Index, Home Wr Wr '' Wr Wr '

' Sponsor = 'http://www.ctyme.com/sponsor.htm' Conf = 'http://talk.ctyme.com/webx.cgi?13@@.ee6b2b8' Mail = 'http://www.ctyme.com/mail.htm' Index = 'http://www.ctyme.com/map.htm' Home = 'http://www.ctyme.com' MyLinks (Sponsor, Conf, Home, Index, Mail) Loop MyLinksArray Wr LoopVal EndLoop Wr Loop Footer Wr LoopVal EndLoop Wr ; ModValueClick ; AddBanner VC ; AddRandomBanner(SponsorList) Wr AddLine Wr Wr '' Wr '' Wr '' Wr '' EndProc Procedure AddToCatagory (Cat,Name) var C C = PosInList(Cat,Catagory) if C = 0 AppendArray(Catagory,Cat) C = NumberOfElements(Catagory) endif AppendArray(CatIndex[C],Name) EndProc Procedure SetCodeMode (F) if F = CodeMode then Return if F Wr '
' PreColor
     CodeMode
   else
     Wr '
' CodeMode Off endif EndProc Procedure Indexes var St Wr '' if Ph = 1 St = 'utiltoc.htm' else St = 'marxtoc.htm' endif Wr '
' if ChapterNumber > 1 Wr '' else Wr '' endif Wr 'Prev' if EndOfFile(Inp) and ((Ph = 1) or (Ph = 4)) Wr '' else Wr '' endif Wr Set[ Next Home Home ] Wr ' Wr Set[ Table Of Contents Index
] EndProc Procedure WriteHeader (F, Title) var St FileWriteln(F,'') FileWriteln(F,Title,'') FileWriteln(F,'','') Substitute(St,'<','') if St > '' then FileWriteln(F,St) EndLoop FileWriteln(F,'">') FileWriteln(F,'') FileWriteln(F,'') FileWriteln(F,'') FileWriteln(F,'') FileWriteln(F,'
') FileWriteln(F,'

' Title '

') EndProc Procedure WriteFooter (F) FileWriteln(F,Footer) FileClose(F) EndProc Procedure ReadChapter var P ChapterNumber = ChapterNumber + 1 delete(Line,1,3) P = Pos('.',Line) ChapterName = Left(Line,P-1) Trim(ChapterName) ChapterNameClean = ChapterName while pos('--',ChapterNameClean) > 0 delete(ChapterNameClean,pos('--',ChapterNameClean),2) endwhile Trim(ChapterNameClean) dispose(Chapter) while not EndOfFile(Inp) Line = FileReadln(Inp) if Line StartsWith '.tc' Return endif AppendArray(Chapter,Line) endwhile EndProc Procedure MakeFileName (N) var St St = Str(N) while length(St) < 4 St = '0' + St endwhile Return 'doc' + St + '.htm' EndProc Procedure DoFile (Phase) var Ch Ph = Phase if Phase = 1 FileAssign(Inp,'BOX.DOC') FileOpen(Inp) elseif Phase = 2 FileAssign(Inp,'MARX2A') FileOpen(Inp) elseif Phase = 3 FileAssign(Inp,'MARX2B') FileOpen(Inp) elseif Phase = 4 FileAssign(Inp,'MARX2C') FileOpen(Inp) endif if Phase = 1 FileAssign(Toc,BaseDir + 'utiltoc.htm') FileCreate(Toc) WriteHeader(Loc Toc,'DOS ToolBox * Table of Contents') WrToc '
' WrToc 'MarxMenu Manual' WrToc HomePage elseif Phase = 2 FileAssign(Toc,BaseDir + 'marxtoc.htm') FileCreate(Toc) WriteHeader(Loc Toc,'MarxMenu * Table of Contents') WrToc '' WrToc 'Index' WrToc '' WrToc 'Dos ToolBox' WrToc HomePage WrToc '
' Loop 26 Ch = Char(LoopIndex + 64) WrToc '' Ch '' EndLoop WrToc '' WrToc 'Download MarxMenu' WrToc '

' AddLine endif if Phase = 3 while not (Line StartsWith '..') Line = FileReadln(Inp) endwhile elseif Phase = 4 else while Line <> '..html' Line = FileReadln(Inp) endwhile endif Line = FileReadln(Inp) while not EndOfFile(Inp) DoChapter endwhile FileClose(Inp) if (Phase <> 2) and (Phase <> 3) WriteFooter(Loc Toc) endif EndProc Procedure AddToIndex var Rec Rec[1] = ChapterNumber Rec[2] = Chapter[1] Hash(ChapterNameClean) = Rec EndProc Procedure IndexPass Pass = 1 FileAssign(Inp,'BOX.DOC') FileOpen(Inp) while Line <> '..html' Line = FileReadln(Inp) endwhile Line = FileReadln(Inp) while not EndOfFile(Inp) ReadChapter AddToIndex endwhile FileClose(Inp) FileAssign(Inp,'MARX2A') FileOpen(Inp) while Line <> '..html' Line = FileReadln(Inp) endwhile Line = FileReadln(Inp) while not EndOfFile(Inp) ReadChapter AddToIndex endwhile FileClose(Inp) FileAssign(Inp,'MARX2B') FileOpen(Inp) while not (Line StartsWith '..') Line = FileReadln(Inp) endwhile Line = FileReadln(Inp) while not EndOfFile(Inp) ReadChapter AddToIndex endwhile FileClose(Inp) FileAssign(Inp,'MARX2C') FileOpen(Inp) Line = FileReadln(Inp) while not EndOfFile(Inp) ReadChapter AddToIndex endwhile FileClose(Inp) Pass = 2 EndProc Procedure Wr ($St) FileWriteln(Out,St) EndProc Procedure WrToc ($St) FileWriteln(Toc,St) EndProc Procedure AddLine Return '

' EndProc Procedure PreColor Return '' EndProc Procedure NameColor Return '' EndProc Procedure HomePage Return 'Home Page' EndProc Procedure CreateCatagoryFile var P Rec SortArrayLinked(CatIndex,Catagory) Loop CatIndex SortArray(LoopVal) EndLoop FileAssign(Toc,BaseDir + 'marxcat.htm') FileCreate(Toc) WriteHeader(Loc Toc,'MarxMenu Command Catagories') WrToc '' WrToc 'Table of Contents' WrToc HomePage '

' WrToc ' WrToc '' Loop Catagory if (LoopIndex > 1) and (LoopIndex - 1 mod 7 = 0) WrToc '' endif WrToc '' EndLoop WrToc '' WrToc '
' LoopVal '
' Loop CatIndex WrToc '' WrToc '

' AddLine WrToc '

' Catagory[LoopIndex] '

' Loop LoopVal Rec = Hash(LoopVal) WrToc '' Rec[2] '
' EndLoop EndLoop WriteFooter(Loc Toc) EndProc Procedure Setup StandardIO BaseDir = 'r:\nobackup\marxdoc\' UpperCaseCompare BlankTime = 0 ReadTextFile 'FOOT.TXT' Footer Trim(Footer) EndProc Procedure Main StandardIO Setup ChapterNumber = 0 Writeln 'IndexPass' IndexPass ChapterNumber = 0 Writeln 'File 1' DoFile(1) Writeln 'File 2' DoFile(2) WrToc AddLine Writeln 'File 3' DoFile(3) Writeln Writeln 'File 4' DoFile(4) Writeln Writeln 'Catagories' CreateCatagoryFile EndProc