; ; $Id: report2html1.xom 1.8 1996/09/04 18:23:19 rwm Exp $ ; down-translate ; include "library.xom" ; ; Global Shelf Declarations ; global counter acrocount variable global stream acrodefn variable global stream acronyms variable global stream acrostream global switch articleswitch global switch authorswitch global switch bookswitch global counter chapterfilenumber global switch citedpgnoswitch global switch collectionswitch global stream collectiontitle global switch collectiontitleswitch global counter cols global switch commaspaceswitch global switch confprocswitch global switch congressswitch global switch committeeswitch global switch communicationswitch global counter curcol global counter curftnote global switch dateswitch global switch docnumswitch global stream doctitle global switch editionswitch global switch editorswitch global switch emediaswitch global counter figurenumber global stream figurestream global counter ftnotenumber global stream ftnotestream global switch incluspgnosswitch global switch issueswitch global switch journalswitch global switch numswitch global switch partswitch global switch placeswitch global switch publisherswitch global stream referelem variable global counter refernumber global switch refererror global stream referfile global stream referstream variable global switch repseriesswitch global switch reptswitch global stream rulerow global switch sect1author global stream sect1authors variable global counter sect1number global counter sect2number global counter sect3number global counter sect4number global counter sect5number global counter sect6number global stream sectionstream global stream sourcestream variable global switch spannedrules global switch statusfinal global stream tabalign variable global stream tabbodyvalign global stream tabchar variable global stream tabcolname variable global counter tabcolnum variable global stream tabcolsep variable global stream tabcolwidth variable global stream tabfootvalign global stream tabframe variable global stream tabheadvalign global counter tabhspan variable global counter tableftnotenumber global stream tableftnotestream variable global stream tableftnotereferencestream variable global counter tablenumber global stream tablestream global stream taborient variable global stream tabpgwide variable global stream tabrotate variable global stream tabrowsep variable global stream tabvalign variable global counter tabvspan variable global counter tgroupnumber global switch thesisswitch global switch titleswitch global switch univswitch global switch volumeswitch ; translate "%n" ; Make all carriage returns dependent upon output output "%/%s_" ; statements ; break-width 72 ; replacement-break "%_" "%n" ; macro add-refer-element( arg pretext, arg elem, arg posttext, arg elemswitch) is do when stream referelem has key elem put referstream ", " when active commaspaceswitch put referstream pretext using stream referelem key elem put referstream "%g(referelem)" put referstream posttext activate commaspaceswitch deactivate elemswitch done macro-end ; macro copy-table-attributes( arg previous) is new stream tabalign set buffer tabalign to stream tabalign item previous new stream tabchar set buffer tabchar to stream tabchar item previous new stream tabcolname set buffer tabcolname to stream tabcolname item previous new counter tabcolnum reset tabcolnum to counter tabcolnum item previous new stream tabcolsep set buffer tabcolsep to stream tabcolsep item previous new stream tabcolwidth set buffer tabcolwidth to stream tabcolwidth item previous new stream tabframe set buffer tabframe to stream tabframe item previous new counter tabhspan reset tabhspan to counter tabhspan item previous new stream taborient set buffer taborient to stream taborient item previous new stream tabpgwide set buffer tabpgwide to stream tabpgwide item previous new stream tabrotate set buffer tabrotate to stream tabrotate item previous new stream tabrowsep set buffer tabrowsep to stream tabrowsep item previous new stream tabvalign set buffer tabvalign to stream tabvalign item previous new counter tabvspan reset tabvspan to counter tabvspan item previous macro-end ; macro load-referelem( arg elem) is do when stream referelem has key elem ; using referelem key elem om3632 if want to fix this ; do reopen referelem key elem as buffer put referelem key elem ", %c" close referelem key elem ; done else new stream referelem key elem set buffer referelem to "%c" done macro-end ; macro process-refer is do ;when attribute style is equal ul "chicagob" do when active (articleswitch and collectionswitch) reopen referstream as buffer add-refer-element("","author","",authorswitch) add-refer-element("","title","",titleswitch) add-refer-element("","collectiontitle","",collectiontitleswitch) add-refer-element("","editor","",editorswitch) add-refer-element("","publisher","",publisherswitch) add-refer-element("","place","",placeswitch) add-refer-element("","incluspgnos","",incluspgnosswitch) add-refer-element("","date","",dateswitch) deactivate articleswitch deactivate collectionswitch close referstream done do when active bookswitch reopen referstream as buffer add-refer-element("","author","",authorswitch) add-refer-element("","title","",titleswitch) add-refer-element("","edition","",editionswitch) add-refer-element("","editor","",editorswitch) add-refer-element("","publisher","",publisherswitch) add-refer-element("","place","",placeswitch) add-refer-element("","date","",dateswitch) deactivate bookswitch close referstream done do when active communicationswitch reopen referstream as buffer add-refer-element("","communication","",communicationswitch) deactivate communicationswitch close referstream done do ;when active reptswitch reopen referstream as buffer add-refer-element("","author","",authorswitch) deactivate commaspaceswitch when active dateswitch add-refer-element(" ","date",". ",dateswitch) deactivate commaspaceswitch when active titleswitch add-refer-element("","title","",titleswitch) add-refer-element("","docnum","",docnumswitch) add-refer-element("","publisher","",publisherswitch) add-refer-element("","place","",placeswitch) deactivate reptswitch close referstream done done deactivate refererror do when active refererror halt done macro-end ; macro remove-table-attributes is remove stream tabalign remove stream tabchar remove stream tabcolname remove counter tabcolnum remove stream tabcolsep remove stream tabcolwidth remove stream tabframe remove counter tabhspan remove stream taborient remove stream tabpgwide remove stream tabrotate remove stream tabrowsep remove stream tabvalign remove counter tabvspan macro-end ; macro remove-table-colspec-attributes is repeat remove-table-attributes exit when number of stream tabalign is equal 2 again macro-end ; document-start open acrostream as "ac.htm" open ftnotestream with referents-allowed as "ftnotes.htm" put ftnotestream "Footnotes
%n" ; clear stream referstream clear stream tableftnotestream clear stream tableftnotereferencestream activate statusfinal ; ; Set table default attributes ; set buffer tabalign to "left" set buffer tabchar to "." set buffer tabcolname to "" reset tabcolnum to 0 set buffer tabcolsep to "no" set buffer tabcolwidth to "0pt" set buffer tabframe to "none" reset tabhspan to 1 set buffer taborient to "portrait" set buffer tabpgwide to "no" set buffer tabrotate to "no" set buffer tabrowsep to "no" set buffer tabvalign to "top" reset tabvspan to 0 ; document-end close acrostream ; ; Handle the footnote listing ; put ftnotestream "
%n
.htm%">%n"
    put ftnotestream
        "%n"
    put ftnotestream "
%n" put ftnotestream "%n" close ftnotestream ; element abstract when parent is front set referent "cfn%d(chapterfilenumber)" to "" _ " ABSTRACT
%n" output "ABSTRACT

%n" ; ; Open stream to contain the whole abstract.htm file ; open sectionstream with referents-allowed as "abstract.htm" put sectionstream "" put sectionstream "ABSTRACT%n" put sectionstream "

ABSTRACT

" increment chapterfilenumber put sectionstream "%c" put sectionstream referent "cfn%d(chapterfilenumber)" set referent "cfn%d(chapterfilenumber)" to "
" put sectionstream "
.htm#abstract%">%n" put sectionstream " Contents " put sectionstream "

%n" put sectionstream "%n" close sectionstream reset figurenumber to 1 reset tablenumber to 1 ; element abstract when parent is sect1 local counter temp do when active sect1author output "

%g(sect1authors)

%n" when number of stream sect1authors is equal 1 do when number of stream sect1authors is equal 2 using stream sect1authors item 1 output "

%g(sect1authors) and " output "%g(sect1authors)

" done do when number of stream sect1authors is greater-than 2 reset temp to 2 output "

" repeat over stream sect1authors output "%g(sect1authors)" output ", " when counter temp is less-than number of stream sect1authors output ", and " when counter temp is equal number of stream sect1authors output "

%n" when counter temp is greater-than number of stream sect1authors increment temp again done deactivate sect1author done output "

ABSTRACT

%n" output "%c" ; element acknowl set referent "cfn%d(chapterfilenumber)" to "" _ " ACKNOWLEDGMENTS
%n" output "ACKNOWLEDGMENTS

%n" ; ; Open stream to contain the whole acknowl.htm file ; open sectionstream with referents-allowed as "acknowl.htm" put sectionstream "" put sectionstream "ACKNOWLEDGMENTS%n" put sectionstream "

ACKNOWLEDGMENTS

" increment chapterfilenumber put sectionstream "%c" put sectionstream referent "cfn%d(chapterfilenumber)" set referent "cfn%d(chapterfilenumber)" to "
" put sectionstream "
.htm#acknowl%">%n" put sectionstream " Contents " put sectionstream "

%n" put sectionstream "%n" close sectionstream reset figurenumber to 1 reset tablenumber to 1 ; element acro-defn new stream acronyms key "%v(ID)" new stream acrodefn key "%v(ID)" new counter acrocount key "%v(ID)" reset acrocount to 0 output "%c" put acrostream "<1>%10fv(ID)<2>%10fg(acronyms)<3>%g(acrodefn)<4>%n" ; element acro-ref when ancestor isnt table suppress using counter acrocount key "%v(idref)" do increment acrocount output "" when counter acrocount is equal 1 using stream acronyms key "%v(idref)" output "%g(acronyms)" output "" when counter acrocount is equal 1 done ; element acro-ref when ancestor is table suppress using stream acronyms key "%v(idref)" output "%g(acronyms)" ; element acrolist output "%c" ; element acronym set buffer acronyms to "%c" ; element appendix when parent is back ; ; The previous chapter put out a reference to its successor when it didn't ; know its successor's name. so it used a referent. Now we know what the ; successor is--we are processing it--so fill in the referent. ; set referent "cfn%d(chapterfilenumber)" to "%n" _ " Appendix %ua(sect1number)
%n" ; ; Reset acronyms ; repeat over counter acrocount reset acrocount to 0 again ; ; Open stream to contain the whole .htm file ; do when attribute ID is specified set referent "%lv(ID)" to "%lv(ID)" set referent "f-%lv(ID)" to "ap-%ua(sect1number).htm#" set referent "ap-%lv(ID)" to "%ua(sect1number). " done open sectionstream with referents-allowed as "ap-%ua(sect1number).htm" put sectionstream "" do when counter chapterfilenumber is greater-equal 1000 reset chapterfilenumber to 0 done increment chapterfilenumber put sectionstream "%c" ; ; Put out the reference to the succeeding chapter even though we don't know ; what it is yet. ; put sectionstream referent "cfn%d(chapterfilenumber)" set referent "cfn%d(chapterfilenumber)" to "
" put sectionstream ".htm#ap-%ua(sect1number)%">%n" put sectionstream " Contents " put sectionstream "

%n" put sectionstream "%n" close sectionstream increment sect1number reset sect2number reset figurenumber reset tablenumber ; element article when parent is refer activate articleswitch output "%c" ; element author when ancestor is refer activate authorswitch load-referelem("author") ; element author when parent is sect1 activate sect1author new stream sect1authors set buffer sect1authors to "%c" ; element author when parent is titleblk output "

%c

" ; element back reset sect1number output "%c" ; element bibliog set referent "cfn%d(chapterfilenumber)" to "" _ " BIBLIOGRAPHY
%n" output "BIBLIOGRAPHY

%n" ; ; Open stream to contain the whole bibliog.htm file ; open sectionstream with referents-allowed as "bibliog.htm" put sectionstream "" put sectionstream "BIBLIOGRAPHY%n" put sectionstream "

BIBLIOGRAPHY

" increment chapterfilenumber put sectionstream "%c" put sectionstream referent "cfn%d(chapterfilenumber)" set referent "cfn%d(chapterfilenumber)" to "
" put sectionstream "
.htm#bibliog%">%n" put sectionstream " Contents " put sectionstream "

%n" put sectionstream "%n" close sectionstream reset figurenumber to 1 reset tablenumber to 1 ; element body output "%c" set referent "cfn%d(chapterfilenumber)" to "" _ " REFERENCES
%n" output "REFERENCES

%n" open referfile with referents-allowed as "rf.htm" put referfile "" put referfile "REFERENCES%n" put referfile "

REFERENCES

" increment chapterfilenumber repeat over stream referstream put referfile "%g(referstream)%n" again put referfile referent "cfn%d(chapterfilenumber)" set referent "cfn%d(chapterfilenumber)" to "
" put referfile "
%n" put referfile " Contents " put referfile "

%n" put referfile "%n" close referfile reset figurenumber to 1 reset tablenumber to 1 ; element book when parent is refer activate bookswitch output "%c" ; element caption output "

%c

%n" ; element caution ; suppress ; do when attribute id is specified ; set referent "%lv(ID)" to ; "%d(sect1number).%d(figurenumber)" ; set referent "a-%lv(ID)" to ; "" _ ; "%d(sect1number).%d(figurenumber)" ; increment figurenumber ; done do when attribute ID is specified open figurestream with referents-allowed as "fg-ch-%d(sect1number)-%d(figurenumber).htm" when ancestor isnt appendix open figurestream with referents-allowed as "fg-ap-%ua(sect1number)-%d(figurenumber).htm" when ancestor is appendix put figurestream "%c" set referent "a-%lv(ID)" to "" _ "%d(sect1number).%d(figurenumber)" when ancestor isnt appendix set referent "a-%lv(ID)" to "" _ "%ua(sect1number).%d(figurenumber)" when ancestor is appendix set referent "%lv(ID)" to "%d(sect1number).%d(figurenumber)" when ancestor isnt appendix set referent "%lv(ID)" to "%ua(sect1number).%d(figurenumber)" when ancestor is appendix increment figurenumber close figurestream done ; element citation output "%c" ; element citedpgno when ancestor is refer activate citedpgnoswitch load-referelem("citedpgno") ; element collection when ancestor is refer activate collectionswitch output "%c" ; element colspec suppress ; ; Set colspec table attributes ; copy-table-attributes(3) ; ; Change any of the attributes set by colspec. Note that rowsep is ignored ; if set here. ; do when counter tgroupnumber is equal 1 set buffer tabalign to "%v(align)" when attribute align is specified set buffer tabchar to "%v(char)" when attribute char is specified set buffer tabcolname to "%v(colname)" when attribute colname is specified remove counter tabcolnum new counter tabcolnum key "%lv(colname)" reset tabcolnum to "%d(curcol)" set buffer tabcolsep to "%v(colsep)" when attribute colsep is specified set buffer tabcolwidth to "%v(colwidth)" when attribute colwidth is specified done increment curcol ; element committee when ancestor is refer activate committeeswitch load-referelem("committee") ; element communication when ancestor is refer activate communicationswitch load-referelem("communication") ; element confproc when ancestor is refer activate confprocswitch load-referelem("confproc") ; element congress when ancestor is refer activate congressswitch load-referelem("congress") ; element contract suppress ; elem is EMPTY ; element contrib output "%c" ; element date when ancestor is refer activate dateswitch load-referelem("date") ; element date when parent is titleblk output "%c

%n" ; element def when parent is acro-defn set buffer acrodefn to "%c" ; element def when parent is deflist output "

%c%n" ; element deflist output "
%c
%n" ; element distrib suppress ; element division output "%c

%n" ; element docnum when ancestor is refer activate docnumswitch load-referelem("docnum") ; element docnum when parent is titleblk output "%c

%n" ; element edition when ancestor is refer activate editionswitch load-referelem("edition") ; element editor when ancestor is refer activate editorswitch load-referelem("editor") ; element editor-comment output "

editor comment

%c

%n" when not active statusfinal suppress when active statusfinal ; element emedia when parent is refer activate emediaswitch load-referelem("emedia") ; element emphasis output "%c%n" when attribute TYPE isnt specified do when attribute TYPE is specified output "%c%n" when attribute TYPE is equal "CANCEL" output "%c%n" when attribute TYPE is equal ("1" or "ITALIC") output "%c%n" when attribute TYPE is equal ("2" or "BOLD") output "%c%n" when attribute TYPE is equal "3" output "%c%n" when attribute TYPE is equal "4" done put #error "EMPHASIS type is %v(type)%n" when attribute type isnt equal ("1" or "2" or "3" or "4" or "BOLD" or "CANCEL" or "ITALIC") ; element entry local counter itemno reset itemno to counter curcol increment itemno by 3 ; ; First, are we in an entry which was vertically spanned from above? ; If so, get out now! ; repeat exit when counter curcol is greater-than counter cols exit when counter tabvspan item "%d(itemno)" is equal 0 increment curcol increment itemno again ; do when counter curcol isnt greater-than counter cols ; ; Set entry table attributes ; copy-table-attributes("%d(itemno)") ; ; Change any of the attributes set by entry. Note that rowsep is ignored. ; set buffer tabalign to "%v(align)" when attribute align is specified set buffer tabchar to "%v(char)" when attribute char is specified set buffer tabcolsep to "%v(colsep)" when attribute colsep is specified set buffer tabrotate to "%v(rotate)" when attribute rotate is specified set buffer tabvalign to "%g(tabheadvalign)" when ancestor is thead set buffer tabvalign to "%g(tabbodyvalign)" when ancestor is tbody set buffer tabvalign to "%v(valign)" when attribute valign is specified ; ; Set tabhspan and tabvspan if needed ; do when attribute namest is specified using counter tabcolnum key "%lv(nameend)" reset tabhspan to counter tabcolnum using counter tabcolnum key "%lv(namest)" decrement tabhspan by counter tabcolnum increment tabhspan done reset tabvspan item "%d(itemno)" to "%v(morerows)" when attribute morerows is specified increment tabvspan item "%d(itemno)" done ; output "" put rulerow ">" output "   " when counter curcol is greater-than 1 output "%c" output "   " when counter curcol is less-than "%d(cols)" put rulerow "


" when attribute namest is specified output "" when ancestor isnt thead output "" when ancestor is thead put rulerow "" when ancestor is thead increment curcol ; element execsum set referent "cfn%d(chapterfilenumber)" to "" _ " EXECUTIVE SUMMARY
%n" output "EXECUTIVE SUMMARY

%n" ; ; Open stream to contain the whole ex.htm file ; open sectionstream with referents-allowed as "ex.htm" put sectionstream "" put sectionstream "EXECUTIVE SUMMARY%n" put sectionstream "

EXECUTIVE SUMMARY

" increment chapterfilenumber put sectionstream "%c" put sectionstream referent "cfn%d(chapterfilenumber)" set referent "cfn%d(chapterfilenumber)" to "
" put sectionstream "
.htm#ex%">%n" put sectionstream " Contents " put sectionstream "

%n" put sectionstream "%n" close sectionstream reset figurenumber to 1 reset tablenumber to 1 ; element figref when ancestor isnt (figure or sidebar) suppress ; ; Output the href version of the figure reference ; output referent "a-%lv(IDREF)" ; element figref when ancestor is figure suppress ; ; Output the non-href version of the figure reference ; output referent "%lv(IDREF)" ; element figure do when attribute ID isnt specified output "%c" done do when attribute ID is specified open figurestream with referents-allowed as "fg-ch-%d(sect1number)-%d(figurenumber).htm" when ancestor isnt appendix open figurestream with referents-allowed as "fg-ap-%ua(sect1number)-%d(figurenumber).htm" when ancestor is appendix put figurestream "%c" set referent "a-%lv(ID)" to "" _ "%d(sect1number).%d(figurenumber)" when ancestor isnt appendix set referent "a-%lv(ID)" to "" _ "%ua(sect1number).%d(figurenumber)" when ancestor is appendix set referent "%lv(ID)" to "%d(sect1number).%d(figurenumber)" when ancestor isnt appendix set referent "%lv(ID)" to "%ua(sect1number).%d(figurenumber)" when ancestor is appendix increment figurenumber close figurestream done ; element foreword set referent "cfn%d(chapterfilenumber)" to "" _ " FOREWORD
%n" output "FOREWORD

%n" ; ; Open stream to contain the whole foreword.htm file ; open sectionstream with referents-allowed as "foreword.htm" put sectionstream "" put sectionstream "FOREWORD%n" put sectionstream "

FOREWORD

" increment chapterfilenumber put sectionstream "%c" put sectionstream referent "cfn%d(chapterfilenumber)" set referent "cfn%d(chapterfilenumber)" to "
" put sectionstream "
.htm#foreword%">%n" put sectionstream " Contents " put sectionstream "

%n" put sectionstream "%n" close sectionstream reset figurenumber to 1 reset tablenumber to 1 ; element front output "%c" ; element ftnote when ancestor isnt (multilist or table) put ftnotestream "%d(ftnotenumber). %c

%n" set referent "%lv(ID)" to "%"ftnotes.htm#%lv(ID)%">Note %d(ftnotenumber). " increment ftnotenumber ; element ftnote when ancestor is (multilist or table) increment tableftnotenumber new stream tableftnotestream key "%d(tableftnotenumber)" set buffer tableftnotestream to "%la(tableftnotenumber)%c" put #error "Processing Footnote with attribute %lv(id)%n" new stream tableftnotereferencestream key "%lv(id)" set buffer tableftnotereferencestream to "%la(tableftnotenumber)" ; element ftnref when ancestor isnt (multilist or table) suppress output "" ; element ftnref when ancestor is (multilist or table) suppress using stream tableftnotereferencestream key "%lv(idref)" output "%g(tableftnotereferencestream)" ; element graphic suppress ; elem is EMPTY output "

%n" when attribute FORMAT isnt specified output file "hardcopy.htm" when attribute format is specified output "%n" output " Printable Version of this Graph " output "

%n" ; element incluspgnos when ancestor is refer activate incluspgnosswitch load-referelem("incluspgnos") ; element issue when ancestor is refer activate issueswitch load-referelem("issue") ; element item output "%c
%n" when attribute prefix of parent isnt specified do when attribute prefix of parent is specified output "

  • %c" when attribute prefix of parent isnt equal "NONE" output "%c
    %n" when attribute prefix of parent is equal "NONE" done ; element journal when ancestor is refer activate journalswitch load-referelem("journal") ; element list output "" when attribute prefix isnt specified do when attribute prefix is specified output "" when attribute prefix is equal ("BULLET" or "DASH") output "

    %n%c

    %n" when attribute prefix is equal "NONE" output "

      %c
    " when attribute prefix is equal ("ALPHA" or "NUMERIC") done ; element note output "
    NOTE

    " output "%c

    " ; element notice output "%c

    %n" ; element num when ancestor is refer activate numswitch load-referelem("num") ; element p output "%c

    %n" ; element part when ancestor is refer activate partswitch load-referelem("part") ; element place when ancestor is refer activate placeswitch load-referelem("place") ; element publisher when ancestor is refer activate publisherswitch load-referelem("publisher") ; element q output "``%c''" ; element refer when parent isnt referlist output "%c" process-refer output ".

    %n" ; element refer when parent is referlist deactivate commaspaceswitch deactivate articleswitch deactivate authorswitch deactivate bookswitch deactivate citedpgnoswitch deactivate collectionswitch deactivate collectiontitleswitch deactivate confprocswitch deactivate congressswitch deactivate committeeswitch deactivate communicationswitch deactivate dateswitch deactivate docnumswitch deactivate editionswitch deactivate editorswitch deactivate emediaswitch deactivate incluspgnosswitch deactivate issueswitch deactivate journalswitch deactivate numswitch deactivate partswitch deactivate placeswitch deactivate publisherswitch deactivate repseriesswitch deactivate reptswitch deactivate thesisswitch deactivate titleswitch deactivate univswitch deactivate volumeswitch ; new stream referstream key "%lv(ID)" clear stream referelem new stream referelem key "first" set buffer referelem to "" open referstream as buffer put referstream "%c" close referstream process-refer reopen referstream as buffer put referstream ".%n

    %n" close referstream increment refernumber ; element referef reset refernumber to item of stream referstream key "%lv(idref)" output "%c" output "%n" ; element referlist reset refernumber output "%c" ; element report output "%c" ; element repseries when ancestor is refer activate repseriesswitch load-referelem("repseries") ; element rept when parent is refer activate reptswitch output "%c" ; element row reset curcol deactivate spannedrules open rulerow as buffer output "%c%n" close rulerow output "%g(rulerow)%n" when (active spannedrules and ancestor is thead) repeat over counter tabvspan decrement tabvspan when counter tabvspan isnt equal 0 again ; Handle rowsep here later ; element sect1 when parent is body ; ; The previous chapter put out a reference to its successor when it didn't ; know its successor's name. so it used a referent. Now we know what the ; successor is--we are processing it--so fill in the referent. ; set referent "cfn%d(chapterfilenumber)" to "%n" _ " Chapter %d(sect1number)
    %n" ; ; Open stream to contain the whole .htm file ; do when attribute ID is specified set referent "%lv(ID)" to "%lv(ID)" set referent "f-%lv(ID)" to "ch-%d(sect1number).htm#" set referent "a-%lv(ID)" to "%d(sect1number). " done clear stream sect1authors open sectionstream with (referents-allowed and break-width 72) as "ch-%d(sect1number).htm" put #error "Processing ch-%d(sect1number).htm%n" put sectionstream "" do when counter chapterfilenumber is greater-equal 1000 reset chapterfilenumber to 0 done increment chapterfilenumber put sectionstream "%c" ; ; Put out the reference to the succeeding chapter even though we don't know ; what it is yet. ; put sectionstream "%n" put sectionstream " Contents " put sectionstream referent "cfn%d(chapterfilenumber)" set referent "cfn%d(chapterfilenumber)" to "
    " put sectionstream "

    %n" put sectionstream "%n" close sectionstream increment sect1number reset sect2number to 1 reset figurenumber to 1 reset tablenumber to 1 ; element sect2 local stream sectnumber set buffer sectnumber to "%ua(sect1number)" when ancestor is appendix set buffer sectnumber to "%d(sect1number)" when ancestor is sect1 ; ; Reset acronyms ; repeat over counter acrocount reset acrocount to 0 again do when attribute ID is specified set referent "%lv(ID)" to "%lv(ID)" set referent "f-%lv(ID)" to "ch-%g(sectnumber).htm#" when ancestor isnt appendix set referent "f-%lv(ID)" to "ap-%g(sectnumber).htm#" when ancestor is appendix set referent "a-%lv(ID)" to "%g(sectnumber).%d(sect2number) " done output "%c" increment sect2number reset sect3number to 1 ; element sect3 when parent is sect2 do when attribute ID is specified set referent "%lv(ID)" to "%lv(ID)" set referent "f-%lv(ID)" to "ch-%d(sect1number).htm#" when ancestor isnt appendix set referent "f-%lv(ID)" to "ap-%ua(sect1number).htm#" when ancestor is appendix set referent "a-%lv(ID)" to "%d(sect1number).%d(sect2number)." _ "%d(sect3number) " when ancestor isnt appendix set referent "a-%lv(ID)" to "%ua(sect1number).%d(sect2number)." _ "%d(sect3number) " when ancestor is appendix done output "%c" increment sect3number reset sect4number to 1 ; element sect4 when parent is sect3 do when attribute ID is specified set referent "%lv(ID)" to "%lv(ID)" set referent "f-%lv(ID)" to "ch-%d(sect1number).htm#" when ancestor isnt appendix set referent "f-%lv(ID)" to "ap-%ua(sect1number).htm#" when ancestor is appendix set referent "a-%lv(ID)" to "%d(sect1number).%d(sect2number)." _ "%d(sect3number).%d(sect4number) " when ancestor isnt appendix set referent "a-%lv(ID)" to "%ua(sect1number).%d(sect2number)." _ "%d(sect3number).%d(sect4number) " when ancestor is appendix done output "%c" increment sect4number reset sect5number to 1 ; element sect5 when parent is sect4 do when attribute ID is specified set referent "%lv(ID)" to "%lv(ID)" set referent "f-%lv(ID)" to "ch-%d(sect1number).htm#" when ancestor isnt appendix set referent "f-%lv(ID)" to "ap-%ua(sect1number).htm#" when ancestor is appendix set referent "a-%lv(ID)" to "%d(sect1number).%d(sect2number)." _ "%d(sect3number).%d(sect4number).%d(sect5number) " when ancestor isnt appendix set referent "a-%lv(ID)" to "%ua(sect1number).%d(sect2number)." _ "%d(sect3number).%d(sect4number).%d(sect5number) " when ancestor is appendix done output "%c" increment sect5number reset sect6number to 1 ; element sect6 when parent is sect5 do when attribute ID is specified set referent "%lv(ID)" to "%lv(ID)" set referent "f-%lv(ID)" to "ch-%d(sect1number).htm#" when ancestor isnt appendix set referent "f-%lv(ID)" to "ap-%ua(sect1number).htm#" when ancestor is appendix set referent "a-%lv(ID)" to "%d(sect1number).%d(sect2number)." _ "%d(sect3number).%d(sect4number).%d(sect5number).%d(sect6number) " when ancestor isnt appendix set referent "a-%lv(ID)" to "%ua(sect1number).%d(sect2number)." _ "%d(sect3number).%d(sect4number).%d(sect5number).%d(sect6number) " when ancestor is appendix done output "%c" increment sect6number ; element sectref suppress output "" output referent "a-%lv(IDREF)" output " " ; element sidebar suppress ; element source when parent is figure output "Source: %c

    %n" ; element source when parent is table new stream sourcestream set buffer sourcestream to "Source: %c

    %n" ; element specialtext reopen referelem as buffer put referelem "%c" close referelem ; element subscrpt output "%c" ; element supscrpt output "%c" ; element table ; ; Set table table attributes ; copy-table-attributes(1) ; ; Change any of the attributes set by table ; set buffer tabcolsep to "%v(colsep)" when attribute colsep is specified set buffer tabframe to "%v(frame)" when attribute frame is specified set buffer taborient to "%v(orient)" when attribute orient is specified set buffer tabpgwide to "%v(pgwide)" when attribute pgwide is specified set buffer tabrowsep to "%v(rowsep)" when attribute rowsep is specified ; reset tgroupnumber reset tableftnotenumber to 0 clear stream tableftnotestream clear stream tableftnotereferencestream clear stream sourcestream do when attribute ID is specified do when ancestor is appendix put #error "Processing Table %ua(sect1number).%d(tablenumber)%n" set referent "%lv(ID)" to "%ua(sect1number).%d(tablenumber)" set referent "a-%lv(ID)" to "" _ "%ua(sect1number).%d(tablenumber)" done do when ancestor is execsum put #error "Processing Table ex.%d(tablenumber)%n" set referent "%lv(ID)" to "ex.%d(tablenumber)" set referent "a-%lv(ID)" to "" _ "ex.%d(tablenumber)" done do when ancestor is sect1 put #error "Processing Table %d(sect1number).%d(tablenumber)%n" set referent "%lv(ID)" to "%d(sect1number).%d(tablenumber)" set referent "a-%lv(ID)" to "" _ "%d(sect1number).%d(tablenumber)" done output "%n" done do when attribute id isnt specified output "



    %n" output "

    %c" output "%n" reset curftnote to 0 repeat over stream tableftnotestream output "%n" again repeat over stream sourcestream output "%n" again output "

    " _ "%g(tableftnotestream)
    %g(sourcestream)
    %n" done do when attribute id is specified open tablestream with referents-allowed as "tb-ap-%ua(sect1number)-%d(tablenumber).htm" when ancestor is appendix open tablestream with referents-allowed as "tb-ex-%d(sect1number)-%d(tablenumber).htm" when ancestor is execsum open tablestream with referents-allowed as "tb-ch-%d(sect1number)-%d(tablenumber).htm" when ancestor is sect1 put tablestream "



    %n" put tablestream "

    %c" put tablestream "%n" reset curftnote to 0 repeat over stream tableftnotestream put tablestream "%n" again repeat over stream sourcestream put tablestream "%n" again put tablestream "

    " _ "%g(tableftnotestream)
    %g(sourcestream)
    %n" done put tablestream "
    %n" when attribute ID is specified put tablestream "



    %n" increment tablenumber when attribute ID is specified remove-table-attributes ; element tabref when ancestor isnt table suppress ; ; Output the href version of the table reference ; output referent "a-%lv(IDREF)" ; element tabref when ancestor is table suppress ; ; Output the non-href version of the table reference ; output referent "%lv(IDREF)" ; element tbody set buffer tabbodyvalign to stream tabvalign item 1 set buffer tabbodyvalign to "%v(valign)" when attribute valign is specified output "%c" ; element term when ancestor is deflist output "

    %c" ; element tgroup ; ; Set table table attributes ; copy-table-attributes(2) ; ; Change any of the attributes set by tgroup ; set buffer tabalign to "%v(align)" when attribute align is specified set buffer tabchar to "%v(char)" when attribute char is specified set buffer tabcolsep to "%v(colsep)" when attribute colsep is specified set buffer tabrowsep to "%v(rowsep)" when attribute rowsep is specified ; reset cols to "%v(cols)" reset curcol output "
    %n" output "%c" increment tgroupnumber by 1 remove-table-colspec-attributes ; element thead set buffer tabheadvalign to stream tabvalign item 1 set buffer tabheadvalign to "%v(valign)" when attribute valign is specified output "%c" output "
    %n" ; element thesis when parent is refer activate thesisswitch output "%c" ; element title when parent is appendix local stream contents set buffer contents to "%c" ; ; Output intended for the menu file ; put output "%ua(sect1number). " _ "%g(contents)

    %n" ; ; Output for the section file ; output "%ua(sect1number). %g(contents)" _ "%n%n" do when attribute ID of parent is specified output "" done output "

    %ua(sect1number). %g(contents)

    " output "" when attribute ID of parent is specified output "

    %n" do when attribute rev-date of parent is specified using attribute rev-date of parent output "%v(rev-date)

    %n" done ; ; Put out the next chapter button. ; output referent "cfn%d(chapterfilenumber)" ; ; Output the table of contents button. output "" output " Contents

    " ; element title when parent is bibliog local stream contents set buffer contents to "%c" ; ; Output intended for the menu file ; put output "Appendix %ua(sect1number). " _ "%g(contents)

    %n" ; ; Output for the section file ; output "Appendix %ua(sect1number). %g(contents)" _ "%n%n" do when attribute ID of parent is specified output "" done output "

    Appendix %ua(sect1number). %g(contents)

    " output "" when attribute ID of parent is specified output "

    %n" do when attribute rev-date of parent is specified using attribute rev-date of parent output "%v(rev-date)

    %n" done ; ; Put out the next chapter button. ; output referent "cfn%d(chapterfilenumber)" ; ; Output the table of contents button. ; output ".htm#ap-%ua(sect1number)%">" output " Contents

    " ; element title when (ancestor is refer and parent isnt collection) activate titleswitch load-referelem("title") ; element title when (ancestor is refer and parent is collection) activate collectiontitleswitch load-referelem("collectiontitle") ; element title when parent is sect1 local stream contents set buffer contents to "%c" ; ; Output intended for the menu file ; put output " %d(sect1number). %g(contents)

    %n" ; ; Output for the section file ; output "%d(sect1number). %g(contents)%n%n" do when attribute ID of parent is specified output "" done output "

    %d(sect1number). %g(contents)

    " output "" when attribute ID of parent is specified output "

    %n" do when attribute rev-date of parent is specified using attribute rev-date of parent output "%v(rev-date)

    %n" done ; ; Output the table of contents button. ; output "" output " Contents " ; ; Put out the previous chapter button. ; do when counter sect1number is greater-than 1 decrement sect1number output "" output " Chapter %d(sect1number) " increment sect1number done output "%n" output " Acronyms

    " ; element title when parent is sect2 local stream contents set buffer contents to "%c" ; ; Output intended for the menu file ; using attribute ID of parent put output "    " _ " " _ "%d(sect1number).%d(sect2number) %g(contents)

    %n" ; do when attribute ID of parent is specified output "" done output "

    " output "%ua(sect1number)" when ancestor is appendix output "%d(sect1number)" when ancestor is sect1 output ".%d(sect2number) %g(contents)

    " output "" when attribute ID of parent is specified output "

    %n" ; element title when parent is sect3 local stream contents set buffer contents to "%c" ; ; Output intended for the menu file ; using attribute ID of parent put output "        " _ " " _ "%d(sect1number).%d(sect2number).%d(sect3number) " _ "%g(contents)

    %n" ; do when attribute ID of parent is specified output "" done output "

    " output "%ua(sect1number)" when ancestor is appendix output "%d(sect1number)" when ancestor is sect1 output ".%d(sect2number).%d(sect3number) %g(contents)

    " output "" when attribute ID of parent is specified output "%n" ; element title when parent is sect4 do when attribute ID of parent is specified output "" done output "

    " output "%ua(sect1number)" when ancestor is appendix output "%d(sect1number)" when ancestor is sect1 output ".%d(sect2number).%d(sect3number).%d(sect4number) %c

    " output "
    " when attribute ID of parent is specified output "%n" ; element title when parent is sect5 do when attribute ID of parent is specified output "" done output "

    %c

    " output "
    " when attribute ID of parent is specified output "%n" ; element title when parent is sect6 do when attribute ID of parent is specified output "" done output "%c

    " output "" when attribute ID of parent is specified output "%n" ; element title when parent is table output "%c%n" ; element title when parent is titleblk set buffer doctitle to "%c" output "%g(doctitle)%n" output "

    %g(doctitle)

    %n" ; element titleblk output "%c" ; element univ when ancestor is refer activate univswitch load-referelem("univ") ; element volume when ancestor is refer activate volumeswitch load-referelem("volume") ; element warning suppress do when attribute id is specified set referent "%lv(ID)" to "%d(sect1number).%d(tablenumber)" set referent "a-%lv(ID)" to "" _ "%d(sect1number).%d(tablenumber)" increment tablenumber done ; element #IMPLIED output "%n%n%c%n"