| $!Here is a failry primitive com file for producing documents from SDML
$!called DODOC.COM.
$ goto Skip_schpeil !skip introductory comments
$!
$!Regards,
$!BobW
$!CXO Database Systems CSSE
$!
$!
$! This com file produces documents out of SDML's base GNC files
$!
$! Accepts:
$! p1 The name of the document, excluding any extension
$! based on document.GNC
$! p2 The document style
$! p3 Whether indices and TOCs are to be generated:
$! "CONTENTS" indicates to generate a TOC
$! "INDEX" indicates to generate in INDEX
$! "BOTH" says to generate an index and a TOC
$! "NONE" clears memory of the index option
$!
$! Returns:
$! document.LDF Local definitions File
$! document.GDF Global definitions File
$! document.DVI Intermediate document file
$! document.LIS Intermediate document file
$! document.TEX TEX translation of SDML GNC file
$! document_index.* Index file temporary files
$! document_contents.* Contents file temporary working data
$! + document.LNO LN01 printable output file (Print with the
$! /PASSALL qualifyer)
$! + document.LN3 LN03 printable output file (Print with the
$! /PASSALL qualifyer)
$! + document.LPR ASCII output file
$! + document.TT VT1/2/300 style terminal file
$!
$! Files indicated with (+) are the desired output of this process
$!
$! Invocation sequence:
$! @DODOC document style [{CONTENTS!INDEX!BOTH}]
$!
$! Example:
$! @DODOC TEST_DOCUMENT MEMO
$!
$! takes TEST_DOCUMENT.GNC; produces TEST_DOCUMENT.LNO, TEST_DOCUMENT.LPR
$! and TEST_DOCUMENT.LN3 without
$! generating either Index or TOC
$!
$! Once the com file has been executed, you can then just type
$!
$! @DODOC
$! and the last set of parameters you executed will be
$! recalled.
$!
$!***************
$! Caveat Emptor: This COM file has ALMOST NO error recovery. In addition,
$! Some Document errors will ultimately return a success code to VMS, so
$! not all errors cause error handling invocation (to be explored some).
$!***************
$!
$! To clean up the symbol-memory, execute a com file that has the
$! following commands
$! delete = "delete"
$! delete/sym/log/glo doc_com_file_name
$! delete = "delete"
$! delete/sym/log/glo doc_com_style_name
$! delete = "delete"
$! delete/sym/log/glo doc_com_options
$!
$! You are welcome to make modifications in ths COM file as you desire.
$! If you make any useful changes, please send them back to me so I can
$! make use of them also...
$! BobW 9/24/86 Original incarnation
$! 10/7/86 Spiff it up a bit
$! 3/26/87 Add test to see if MAKSDF
$! needs to run for BL06
$! but not for BL07
$! 4/1/87 add support for index and
$! TOC
$! -- also generate TTY file
$! 4/10/87 Add Cleanup of leftovers
$! 4/13/87 add symbol memory
$! 4/14/87 add control-y trapping
$! added comments on how to
$! clean up symbols
$!
$ Skip_schpeil:
$ on control_y then $ goto abort_routine
$ on warning Then $ gosub get_stat
$ on error then $ gosub get_stat
$ on severe_error then $ gosub get_stat
$!
$ Get_file:
$ if p1 .nes. "" then $ goto get_file_done !file name given at prompt
$ if f$type(Doc_Com_file_name) .eqs. "" then $ goto get_p1
$ p1 = Doc_Com_File_name ! retrieve the value from last time
$ Goto Get_Style
$ get_p1:
$ if p1 .eqs. "" then inquire p1 "_File"
$ if p1 .eqs. "" then $ goto get_p1
$ Get_File_Done:
$ Doc_Com_File_name :== 'p1 ! save the value for next time
$!
$ Get_Style:
$ if p2 .nes. "" then $ goto get_style_done !style name given at prompt
$ if f$type(Doc_Com_style_name) .eqs. "" then $ goto get_p2
$ p2 = Doc_Com_Style_name ! retrieve the value from last time
$ Goto Get_Options
$ get_p2:
$ if p2 .eqs. "" then inquire p2 "_Style"
$ if p2 .eqs. "" then $ goto get_p2
$ Get_Style_Done:
$ Doc_Com_Style_name :== 'p2 ! save the value for next time
$!
$ Get_Options:
$ If p3 .eqs. "" .and. f$type(doc_com_options) .eqs. "" then $ goto determine_baselevel
$ Test_options:
$ p3 = f$edit(p3,"upcase") !uppercase the response
$ if p3 .eqs. "" then $ gosub set_p3
$ if p3 .nes. "" then $ Doc_Com_Options :== 'p3 ! save the value for next time
$ if p3 .eqs. "NONE" then $ delete/symb/nolog/glob doc_com_options
$ if p3 .eqs. "NONE" then $ goto determine_baselevel
$ if p3 .eqs. "CONTENTS" .OR. p3 .eqs. "INDEX" .or. p3 .eqs. "BOTH" then $ goto determine_baselevel
$ inquire p3 "_Option"
$ goto test_options
$!
$ set_p3:
$ if f$type(doc_com_options) .nes. "" then p3 = doc_com_options
$ return
$!
$ determine_baselevel:
$!
$ if doc$$baselevel .eqs. "7" then $ goto try_debug
$!
$ write sys$output ""
$ write sys$output "Building symbols..."
$ write sys$output ""
$
$ makesdf 'p1
$
$ If .not. $status then gosub get_stat
$!
$ Try_debug:
$ write sys$output ""
$ write sys$output "Starting Debugging Run..."
$ write sys$output ""
$!
$ document/notext 'p1 'p2 line/noprint
$!
$ If .not. $status then gosub get_stat
$!
$ if p3 .eqs. "CONTENTS" then $ gosub do_contents
$ if p3 .eqs. "INDEX" then $ gosub do_index
$ if p3 .eqs. "BOTH" then $ gosub do_contents_and_index
$!
$ write sys$output ""
$ write sys$output "Building LN01 file..."
$ write sys$output ""
$!
$ document/notag 'p1 'p2 ln01/noprint
$!
$ If .not. $status then gosub get_stat
$!
$ write sys$output ""
$ write sys$output "Building LN03 file..."
$ write sys$output ""
$!
$ document/notag 'p1 'p2 ln03/noprint
$!
$ If .not. $status then gosub get_stat
$!
$ write sys$output ""
$ write sys$output "Building line printer file..."
$ write sys$output ""
$!
$ document/notag 'p1 'p2 line/noprint
$!
$ If .not. $status then gosub get_stat
$!
$ if doc$$baselevel .NES. "7" then $ goto done
$ write sys$output ""
$ write sys$output "Building terminal file..."
$ write sys$output ""
$!
$ document/notag 'p1 'p2 terminal/noprint
$!
$ If .not. $status then gosub get_stat
$!
$ done:
$!
$ write sys$output ""
$ write sys$output "Cleaning Up..."
$!
$ dvis = p1 + ".dvi*.*
$ delete 'dvis
$ liss = p1 + ".lis.*"
$ delete 'liss
$ texs = p1 + ".*tex*.*"
$ Delete 'texs
$ purfil = p1 + ".*"
$ purfilx = p1 + ".*gnc*"
$ purge = "purge/log"
$ purge 'purfil /exclude='purfilx
$!
$ write sys$output ""
$ write sys$output "Done..."
$ write sys$output ""
$!
$ exit
$!
$ Get_Stat:
$ stat = ""
$ Write sys$output "An error has occurred, ''f$message($status)"
$ get_stat_1:
$ Inquire stat "Continue (Y/N)?"
$! sho sym stat ! for debugging
$ If stat .eqs. "N" .or. "n" then exit
$ If stat .nes. "Y" .and. stat .nes. "y" then goto get_stat_1
$ Return
$!
$ do_contents:
$ write sys$output ""
$ write sys$output "Building contents..."
$ write sys$output ""
$!
$ Document/nodevice/contents 'p1 'p2 line/noprint
$ contents_file = p1 + "_contents"
$ Document/notag/nodevice 'contents_file 'p2 line/noprint
$ return
$!
$ do_index:
$ write sys$output ""
$ write sys$output "Building index..."
$ write sys$output ""
$!
$ Document/nodevice/index 'p1 'p2 line/noprint
$ index_file = p1 + "_index"
$ Document/notag/nodevice 'index_file 'p2 line/noprint
$ return
$!
$ do_contents_and_index:
$ gosub do_contents
$ gosub do_index
$ return
$!
$ abort_routine:
$ write sys$output " "
$ write sys$output "Aborting..."
$ write sys$output " "
$ goto done
|