Update Documentation Generator - gendoc.ring - support <loadfile> command
# funcAfterClass = func cClassName { return string } # function to call
#===============================================
+load "stdlibcore.ring"
aList = str2list(cFile)
@@ -19,9 +20,27 @@ cOutput += copy("=",len(C_CHAPTERNAME)) + windowsnl()
cOutput += C_CHAPTERNAME + windowsnl()
cOutput += copy("=",len(C_CHAPTERNAME)) + windowsnl() + windowsnl()
+lLoop = False
+
+process_file(aList)
+
+write(C_OUTPUTFILE,cOutput)
+system(C_OUTPUTFILE)
+
+
+func process_file(aList)
for x = 1 to len(aList)
cLine = trim(aList[x])
+ if left(lower(cLine),10)="<loadfile>"
+ cSubFileName = trim(substr(cLine,11))
+ cSubFileText = read(cSubFileName)
+ cCurrentDir = currentdir()
+ chdir(justfilepath(cSubFileName))
+ process_file(str2list(cSubFileText))
+ chdir(cCurrentDir)
+ loop
+ ok
if left(lower(cLine),7)="<class>"
lStart = True
x++
@@ -61,14 +80,14 @@ for x = 1 to len(aList)
again left(lower(cLine),10) !="</comment>"
loop
ok
- avoidblock("code")
- avoidblock("funcstart")
- avoidblock("runcode")
- avoidblock("struct")
- avoidline("constant")
- avoidline("ignorecpointertype")
- avoidline("register")
- avoidline("filter")
+ x = avoidblock("code",cLine,x) checkloop()
+ x = avoidblock("funcstart",cLine,x) checkloop()
+ x = avoidblock("runcode",cLine,x) checkloop()
+ x = avoidblock("struct",cLine,x) checkloop()
+ avoidline("constant",cLine)
+ avoidline("ignorecpointertype",cLine)
+ avoidline("register",cLine)
+ avoidline("filter",cLine)
if lStart
if (cLine != NULL ) and len(cLine) > 1
@@ -78,22 +97,26 @@ for x = 1 to len(aList)
ok
next
-write(C_OUTPUTFILE,cOutput)
-system(C_OUTPUTFILE)
-
-
-func avoidblock cStr
+func avoidblock cStr,cLine,x
if left(lower(cLine),len(cStr)+2)="<"+cStr +">"
x++
do
cLine = trim(aList[x])
x++
again left(lower(cLine),len(cStr)+3) !="</"+cStr+">"
+ x++
+ lLoop = True
+ ok
+ return x
+
+func checkloop
+ if lLoop = True
+ lLoop = False
loop
ok
-func avoidline cStr
+func avoidline cStr,cLine
if ( left(lower(cLine),len(cStr)+2)="<"+cStr + ">" ) or ( left(lower(cLine),len(cStr)+3)="</"+cStr + ">" )
loop
ok
