00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 ::REQUIRES 'condhandler.cls'
00048
00049
00050 ::REQUIRES 'fsobjects.cls'
00051
00052
00053 ::REQUIRES 'hashfunction.cls'
00054
00055
00056 ::REQUIRES 'rexxprogram.cls'
00057
00058
00059 ::REQUIRES 'htmlout.cls'
00060
00061
00062 ::REQUIRES 'documents.cls'
00063
00064
00065 ::REQUIRES 'nodes.cls'
00066
00067
00068 ::REQUIRES 'htmltree.cls'
00069
00070
00071 ::REQUIRES 'htmlindex.cls'
00072
00073
00074 ::REQUIRES 'pathsep.cls'
00075
00076
00077 ::CLASS rexxliterateconfig PUBLIC
00078 ::ATTRIBUTE title
00079 ::ATTRIBUTE rsource
00080 ::ATTRIBUTE hdest
00081 ::ATTRIBUTE prefixcomment
00082 ::ATTRIBUTE trailericon
00083 ::ATTRIBUTE recurse
00084 ::ATTRIBUTE dynamicmethods
00085 ::METHOD init
00086 self~title = ''
00087 self~rsource = ''
00088 self~hdest = ''
00089 self~prefixcomment = .array~new
00090 self~trailericon = ''
00091 self~recurse = .true
00092 self~dynamicmethods = .true
00093
00094
00095 ::CLASS globalindex
00096 ::ATTRIBUTE folders
00097 ::ATTRIBUTE files
00098 ::ATTRIBUTE filix
00099 ::ATTRIBUTE labels
00100 ::ATTRIBUTE procedures
00101 ::ATTRIBUTE requires
00102 ::ATTRIBUTE routines
00103 ::ATTRIBUTE routinix
00104 ::ATTRIBUTE classes
00105 ::ATTRIBUTE classix
00106 ::ATTRIBUTE methods
00107 ::ATTRIBUTE methix
00108 ::ATTRIBUTE attributes
00109 ::ATTRIBUTE attrix
00110 ::ATTRIBUTE constants
00111 ::ATTRIBUTE constix
00112 ::ATTRIBUTE options
00113 ::ATTRIBUTE dynamicmethods
00114
00115 ::METHOD init
00116 self~folders = .queue~new
00117 self~files = .queue~new
00118 self~filix = .relation~new
00119 self~labels = .queue~new
00120 self~procedures = .queue~new
00121 self~requires = .queue~new
00122 self~routines = .queue~new
00123 self~routinix = .relation~new
00124 self~classes = .queue~new
00125 self~classix = .relation~new
00126 self~methix = .relation~new
00127 self~attrix = .relation~new
00128 self~methods = .queue~new
00129 self~attributes = .queue~new
00130 self~constants = .queue~new
00131 self~constix = .relation~new
00132 self~options = .queue~new
00133 self~dynamicmethods = .false
00134
00135
00136 ::CLASS rexxliterate PUBLIC
00137 ::ATTRIBUTE rsource
00138 ::ATTRIBUTE hdest
00139 ::ATTRIBUTE tree
00140 ::ATTRIBUTE title
00141 ::ATTRIBUTE prefixcomment
00142 ::ATTRIBUTE trailericon
00143 ::ATTRIBUTE pversion PRIVATE
00144
00145 ::ATTRIBUTE globalix
00146
00147 ::ATTRIBUTE recursive
00148
00149 ::ATTRIBUTE rexxdocs
00150
00151 ::ATTRIBUTE modules
00152
00153 ::ATTRIBUTE htmlout
00154
00155
00156
00157
00158 ::METHOD init
00159 use strict arg config
00160 self~pversion = '0.0.1'
00161
00162 self~rsource = config~rsource
00163 self~hdest = config~hdest
00164 self~title = config~title
00165 self~recursive = config~recurse
00166 self~trailericon = config~trailericon
00167 self~prefixcomment = config~prefixcomment
00168
00169 self~rexxdocs = .queue~new
00170 self~modules = .directory~new
00171
00172 self~globalix = .globalindex~new()
00173 self~globalix~dynamicmethods = config~dynamicmethods
00174
00175
00176 self~tree = self~buildtree(self~rsource)
00177 if self~tree~folders~items = 0,
00178 & self~tree~files~items = 0
00179 then do
00180 raise SYNTAX 93 ARRAY('no input files in' self~rsource)
00181 exit
00182 end
00183
00184 say 'parsing source'
00185
00186
00187 self~parser(self~tree)
00188
00189
00190 say 'cross referencing'
00191 self~xref(self~tree)
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 ::METHOD emit
00203 use strict arg treeframe
00204
00205 say 'writing boilerplate'
00206
00207
00208 call bwritefiles self~hdest
00209
00210 say 'adding html nature to documents'
00211 self~addnature(self~tree)
00212
00213
00214 self~htmlout = .htmlout~new(self, self~hdest, self~pversion, self~title, self~prefixcomment, self~trailericon)
00215
00216 say 'emitting html'
00217
00218
00219
00220 self~html(self~tree)
00221
00222 say 'emitting indices'
00223
00224 .htmlindex~emit(self~htmlout, self~globalix)
00225
00226
00227
00228 self~htmlout~firstpage(self~rexxdocs, treeframe)
00229
00230 self~htmlout~modules(self~modules)
00231
00232 if treeframe
00233 then do
00234 t = .htmltree~new(self~title, self~tree, self~hdest)
00235
00236 t~maketreehtml
00237 end
00238
00239
00240 if self~htmlout~pwrongdoc~items > 0
00241 then do
00242 say 'Documentation doesn''t match parameters in code:'
00243 do i over self~htmlout~pwrongdoc
00244 say ' 'i
00245 end
00246 end
00247 if self~htmlout~pmissingdoc~items > 0
00248 then do
00249 say 'Code parameters lack documentation:'
00250 do i over self~htmlout~pmissingdoc
00251 say ' 'i
00252 end
00253 end
00254
00255
00256
00257 ::METHOD xref PRIVATE
00258 use arg f
00259
00260
00261
00262 do i over f~files
00263 say 'xreffing' f~folderpath||i~filename
00264 select
00265 when i~isrexx
00266 then do
00267 i~document~xref(self~globalix)
00268 end
00269 when i~istxt
00270 then nop
00271 otherwise raise SYNTAX 93 ARRAY('Unrecognized filetype' i~filepath i~filename)
00272 end
00273 end
00274
00275
00276 do i over f~folders
00277 self~xref(i)
00278 end
00279
00280
00281
00282 ::METHOD addnature PRIVATE
00283 use arg f
00284
00285 do i over f~files
00286 say 'addnature' f~folderpath||i~filename
00287 select
00288 when i~isrexx
00289 then do
00290 i~document~addattribute('HDOCURL')
00291 i~document~addattribute('HSRCURL')
00292
00293
00294 i~document~hdocurl = i~document~prefix'_doc_'i~document~uniqueid'.html'
00295 i~document~hsrcurl = i~document~prefix'_src_'i~document~uniqueid'.html'
00296
00297 do e over i~document~featurelist
00298 e~addattribute('HDOCURL')
00299 e~addattribute('HDOCANCHOR')
00300 e~addattribute('HSRCANCHOR')
00301 e~hsrcanchor = 'SRC'e~feature~startline~right(5,'0')
00302
00303
00304 if e~type = 'COMT' | e~feature~objectname = 'QUOT'
00305 then preanchor = 'LITS'
00306 else do
00307 preanchor = e~feature~rname~translate(' ','''"')
00308 preanchor = preanchor~space(0)
00309 end
00310 e~hdocanchor = preanchor || e~feature~startline || e~feature~startcol,
00311 || e~feature~endline || e~feature~endcol
00312 select
00313 when e~type = 'CLAS'
00314 then e~hdocurl = 'CL_'e~hdocanchor||i~document~hdocurl
00315 when e~type = 'METH' | e~type = 'ATTR'
00316 then e~hdocurl = e~owner~hdocurl
00317 otherwise e~hdocurl = i~document~hdocurl
00318 end
00319 end
00320 do c over i~document~clauses
00321 if c~isreferenced
00322 then do
00323 c~addattribute('HDOCANCHOR')
00324 c~addattribute('HSRCANCHOR')
00325 c~hdocanchor = 'docanchor?'
00326 c~hsrcanchor = 'SRC'c~feature~startline~right(5,'0')
00327 end
00328 end
00329 end
00330 when i~istxt
00331 then do
00332 i~document~addattribute('HSRCURL')
00333 i~document~hsrcurl = i~document~prefix'_src_'i~document~uniqueid'.html'
00334 end
00335 otherwise raise SYNTAX 93 ARRAY('Unrecognized filetype' i~filepath i~filename)
00336 end
00337 end
00338
00339
00340 do i over f~folders
00341 self~addnature(i)
00342 end
00343
00344
00345
00346 ::METHOD parser PRIVATE
00347 use arg f
00348
00349 do i over f~files
00350 say 'parsing' f~folderpath||i~filename
00351 select
00352 when i~isrexx
00353 then do
00354 i~document = .rexxdocument~new(i, self~rsource, self~globalix)
00355 end
00356 when i~istxt
00357 then do
00358 i~document = .textdocument~new(i, self~rsource, self~rexxdocs, self~modules)
00359 end
00360 otherwise raise SYNTAX 93 ARRAY('Unrecognized filetype' i~filepath i~filename)
00361 end
00362 end
00363
00364
00365 do i over f~folders
00366 self~parser(i)
00367 end
00368
00369 return
00370
00371
00372
00373 ::METHOD html PRIVATE
00374 use arg f
00375
00376 do i over f~folders
00377 self~html(i)
00378 end
00379
00380
00381
00382
00383
00384
00385 j = 1
00386
00387 signal on ANY name fubar
00388
00389 resume:
00390 do j = j to f~files~items
00391 i = f~files[j]
00392 say 'emitting' f~folderpath||i~filename
00393 select
00394 when i~isrexx
00395 then do
00396
00397 self~htmlout~rhtmlpage(f, i, self~globalix)
00398 end
00399 when i~istxt
00400 then do
00401
00402 self~htmlout~thtmlpage(f, i)
00403 end
00404 otherwise raise SYNTAX 93 ARRAY('Unrecognized filetype' i~filepath i~filename)
00405 end
00406 iterate
00407 end
00408 return
00409
00410 fubar:
00411 say '-- unable to emit because'
00412 call conditionhandler condition('O'), sigl, sourceline(sigl)
00413 say '-- you may have found a bug in this program'
00414 say '-- or the input file named above may not be a valid Rexx program'
00415 say 'hit enter to continue'
00416 pull .
00417 j = j + 1
00418 signal resume
00419
00420
00421
00422
00423 ::METHOD buildtree
00424
00425 top = .folder~new(self~rsource)
00426
00427
00428 self~treewalk(top)
00429
00430 return top
00431
00432
00433
00434 ::METHOD treewalk PRIVATE
00435 use arg f
00436
00437
00438 self~globalix~folders~queue(f)
00439
00440 rexxfiles = 'REX REXX CLS RTN'
00441 txtfiles = 'TXT NOTES'
00442
00443
00444 rc = sysfiletree(f~folderpath'*', 'files.', 'F')
00445
00446 sep = .pathsep~sep
00447 do j = 1 to files.0
00448 parse value reverse(files.j) with fn (sep) .
00449 parse var fn ft '.'
00450 fn = fn~reverse
00451 ft = ft~reverse~translate
00452 if rexxfiles~wordpos(ft) > 0,
00453 | txtfiles~wordpos(ft) > 0
00454 then do
00455 i = .file~new(fn, f)
00456
00457 f~files~queue(i)
00458
00459 self~globalix~files~queue(i)
00460 self~globalix~filix[i~filename] = i
00461 end
00462 end
00463
00464 if \self~recursive
00465 then return
00466
00467
00468 rc = sysfiletree(f~folderpath'*', 'folders.', 'D')
00469 do j = 1 to folders.0
00470 parse value reverse(folders.j) with o (sep) .
00471 parse var folders.j . . . . fp
00472 o = o~reverse
00473 if o~left(1) <> '.'
00474 then do
00475 n = .folder~new(fp||.pathsep~sep)
00476 f~folders~queue(n)
00477 end
00478 end
00479
00480
00481 do i over f~folders
00482 self~treewalk(i)
00483 end
00484
00485 return
00486
00487
00488
00489
00490
00491
00492 ::ROUTINE sortq
00493 use strict arg q
00494
00495 a = q~makearray
00496
00497 a~sort
00498
00499 return a
00500