subroutine
**********************************************************************
* wbp-doc-html: Display the wbp-doc file in html
* in: CMD (CGI parameter) - The command to do:
* INDEX - Displays the index of commands
* DETAIL- Detail the command
* MANUAL- Create a printable manual
* SUB The command to display the detail of
**********************************************************************
* [14] 01Dec99 jr Bring up to 2.1 standards, consider it rewritten, so
* remove old history
* [15] 28Mar00 jr Act 23891 Add support for ecom section
* [16] 29Mar00 jr Act 23894 Use correct section of template.
* [17] 10May00 jr Act 24005 Move parameters after syntax
* [18] 10Jul00 jr Act 24200 Add OMNIS section
* [19] 07Feb01 jr Act 24885 Add unpublished FCApplet section and rename
* E-commerce section to ATS. Renamed Omnis section
* FlashSTUDIO
* [20] 29Mar01 jr Act 25118 Rename Verb section commands
**********************************************************************
include wbp w3include
EQU SCRIPT to "/cgi-bin/fccgi.exe" ;* [05]
api.order = ''
api.order<-1> = 'Introduction'
api.order<-1> = 'Commands' ;* [20]
api.order<-1> = 'HTML'
api.order<-1> = 'Include'
api.order<-1> = 'Input'
api.order<-1> = 'Misc'
api.order<-1> = 'Output'
api.order<-1> = 'Variables'
api.order<-1> = 'mvDesigner' ;* [18][19]
*api.order<-1> = 'FCApplet' ;* [19]
api.order<-1> = "ATS" ;* [15][19]
api.order<-1> = 'Index' ;* [05]
api.orders = dcount(api.order,@am)
api.with.syntax = ""
api.with.syntax<-1> = 'Input'
api.with.syntax<-1> = 'Output'
api.with.syntax<-1> = 'HTML'
api.with.syntax<-1> = 'Misc'
api.with.syntax<-1> = 'ATS' ;* [15][19]
api.with.syntax<-1> = 'mvDesigner' ;* [18][19]
*api.with.syntax<-1> = 'FCApplet' ;* [19]
api.with.syntax.count = dcount(api.with.syntax, @am)
* Cheap way of getting attribute numbers from dicts
* - slower than file command
* -------------------------------------------------
open 'wbp-doc' to doc else stop 201,'wbp-doc'
open 'dict wbp-doc' to ddoc else stop 201,'dict wbp-doc'
x = 'desc' ; readv desc from ddoc,x,2 else stop 202,x
x = 'exmpl'; readv exmpl from ddoc,x,2 else stop 202,x
x = 'parm' ; readv parm from ddoc,x,2 else stop 202,x
x = 'flow' ; readv flow from ddoc,x,2 else stop 202,x
x = 'pdesc'; readv pdesc from ddoc,x,2 else stop 202,x
x = 'api' ; readv api from ddoc,x,2 else stop 202,x
x = 'exam' ; readv exam from ddoc,x,2 else stop 202,x
* What are we going to display?
* Entire MANUAL, the INDEX, or a DETAIL opage
* -------------------------------------------
call w3GetVal( CMD, 'CMD' )
call w3HtmlInit("doc", "")
begin case
case CMD = 'MANUAL'
subs = ""
call w3SubsGet("doc.manual.subs", subs)
call w3HtmlHeader("", subs)
for api.this = 1 to api.orders
if api.order<api.this> # "Index" then ;* skip showing the index
* select the methods in this section
execute 'sselect wbp-doc with api = "':api.order<api.this>:'"' capturing x
subs = ""
subs<-1> = "#SECTION#":@VM:api.order<api.this>
call w3HtmlInsertSection("doc.manual", subs, "section.head")
* show the detail for each method
loop
readnext SUB else exit
read item from doc,SUB then
gosub detail
call w3HtmlInsertSection("doc.manual", "", "section.tail")
end
repeat
end ;* [11]
next api.this
case CMD = 'INDEX'
call w3GetVal( SUB, 'SUB' ) ;* what section, if any, was
* requested
subs = ""
call w3SubsGet("doc.index.subs", subs)
call w3HtmlHeader("", subs)
call w3HtmlInsertSection("doc.index", "", "section.head")
* go through each documentation section. If it is the selected section
* also show all of the methods. If it is not the selected section
* show only the section name.
for i = 1 to api.orders
xapi=api.order<i>
if xapi=SUB then ;* This section was requested so
* show the methods for this section
first.time = 1 ;* first line has both section name & method
execute 'sselect wbp-doc with api = "':SUB:'"' capturing out
loop
readnext id else exit
subs = ""
subs<-1> = "#DETAIL#":@vm:id
if first.time then
first.time = 0
subs<-1>= "#SECTION#":@vm:xapi
end else
subs<-1>= "#SECTION#":@vm:""
end
call w3HtmlInsertSection("doc.index", subs, "section.detail")
repeat
end else ;* This section was not requested
* show the section name only
subs = ""
subs<-1>= "#SECTION#":@vm:xapi
subs<-1>= "#DETAIL#":@vm:""
call w3htmlInsertSection("doc.index", subs, "section.detail")
end
next i
call w3HtmlInsertSection("doc.index", "", "section.tail")
case CMD = 'DETAIL'
call w3GetVal( SUB, 'SUB' )
subs = ""
call w3SubsGet("doc.detail.subs", subs)
subs<-1> = "#DETAIL#":@VM:SUB
call w3HtmlHeader("", subs)
read item from doc,SUB
gosub detail
end case
call w3HtmlFooter("","")
return
**********************************************************************
detail: * Display the detailed information for a specific routine
**********************************************************************
* item contains the wbp-doc item to display
*
subs = ""
subs<-1> = "#TOPIC#":@vm:SUB
subs<-1> = "#DESC#":@vm:item<desc>
call w3HtmlInsertSection("doc.detail", subs, "detail.head")
* set a flag if the syntax needs displaying
* either because the item has syntax information or
* because the section requires the syntax to be displayed
print.syntax = 0
j = 1
loop
locate(item<api, j>, api.with.syntax; loc) then print.syntax = 1
until print.syntax = 1 or j >= api.with.syntax.count do
j += 1
repeat
* if there are parameters, or the instruction is in a
* section which requires syntax then prnit the Syntax
if trim(item<parm>)#'' or print.syntax then
dc = dcount(item<parm>,@vm)
if print.syntax then
subs = ""
subs<-1> = "#NAME#":@VM:SUB
call w3HtmlInsertSection("doc.detail", subs, "syntax.head")
for i = 1 to dc
subs = ""
subs<-1> = "#PARAM#":@VM:field(item<parm,i>,":", 1)
if i = 1 then ;* present "(parm"
call w3HtmlInsertSection("doc.detail", subs, "syntax.params.start")
end
if i > 1 then ;* present ", parm"
call w3HtmlInsertSection("doc.detail", subs, "syntax.params.next")
end
if i = dc then
* present ")"
call w3HtmlInsertSection("doc.detail", "", "syntax.params.last")
end
next i
call w3HtmlInsertSection("doc.detail", "", "syntax.tail")
end
* Show the input and output parameters
dc = dcount(item<parm>, @vm)
if dc > 0 then
call w3HtmlInsertSection("doc.detail", "", "parameters.head")
for i = 1 to dc
subs = ""
subs<-1> = "#NAME#":@vm:item<parm,i>
subs<-1> = "#DESC#":@VM:item<pdesc,i>
begin case
case item<flow,i> = "I"
call w3HtmlInsertSection("doc.detail", subs, "param.in")
case item<flow,i> = "O"
call w3HtmlInsertSection("doc.detail", subs, "param.out")
case item<flow,i> = "B"
call w3HtmlInsertSection("doc.detail", subs, "param.both")
end case
next i
call w3HtmlInsertSection("doc.detail", "", "parameters.tail")
end
* print the examples
dc = dcount(item<exam>, @vm)
if dc > 0 then
call w3HtmlInsertSection("doc.detail", "", "links.head")
for i = 1 to dc
subs = ""
subs<-1> = "#EXAMPLE#":@VM:item<exam,i>
call w3HtmlInsertSection("doc.detail", subs, "links.detail")
next i
end
call w3HtmlInsertSection("doc.detail", "", "links.tail")
end
* Show any examples included in the documentation
if trim(item<exmpl>)#'' then
call w3HtmlInsertSection("doc.detail", "", "examples.head")
dc = dcount(item<exmpl>,@vm)
for i = 1 to dc
subs = ""
subs<-1> = "#DESC#":@vm:item<exmpl, i>
call w3HtmlInsertSection("doc.detail", subs, "examples.detail")
next i
call w3HtmlInsertSection("doc.detail", "", "examples.tail")
end
return