
MACRO SPITBOL VERSION 3.5(1.01)  24-MAR-1981 14:10
VAX - VMS  *Set Site-ID in SYSID.MAR!*  _DBB2:[XPORT.TOOLS]XDOC.SPT;7           


                                                                        PAGE 1

        * XDOC - A SNOBOL4 program to generate partial RUNOFF input
        *	from an XPORT data structure definition
1       
2       	spaces = ' 	'
3       	max_in_function = 10
4       	max_out_function = 10
5       	max_comment = 38
6       	space = ' '
7       	tab = '	'
8       	numbers = '0123456789'
9       
10      	breakup = (tab | space) (LEN(3) '$' BREAK(space tab)) . name
        +		( (BREAK('$') LEN(1) . key_flag BREAK(space tab) . type) |
        +			(BREAK('=') '= ' SPAN(numbers) . type) )
        +		BREAK('!') LEN(2) REM . comment
11      
12      	in_pat = '' $ in_function  '>' (BREAK('<') | REM) . in_function
13      	out_pat = '' $ out_function '<' (BREAK('>') | REM) . out_function
14      
15      	xtype = TABLE(15)
16      	xtype<'INTEGER'> = 'integer'
17      	xtype<'ADDRESS'> = 'address'
18      	xtype<'POINTER'> = 'pointer'
19      	xtype<'SUB_BLOCK'> = 'block'
20      	xtype<'DESCRIPTOR'> = 'desc'
21      	xtype<'BYTE'> = 'byte'
22      	xtype<'BYTES'> = 'bytes'
23      	xtype<'BIT'> = 'bit'
24      	xtype<'BITS'> = 'bits'
25      	xtype<'LENGTH'> = 'literal'
26      
27      ASK	TERMINAL =
28      	TERMINAL = 'Enter the name of the BLISS REQUIRE file to be scanned'
29      	require_file = TRIM(TERMINAL)				:F(END)
30      	require_file '.'					:S(ASK010)
31      	require_file = require_file '.REQ'
32      
33      ASK010	TERMINAL =
34      	TERMINAL = 'Enter the name of the control block to be documented'
35      	cb_name = TRIM(TERMINAL)	:F(END)
36      
37      OPEN	INPUT( 'source', 1, require_file )
38      
39      SEARCH	image = TRIM(source)	:F(NOT_FOUND)
40      	image '!' SPAN(spaces) cb_name	:F(SEARCH)
41      
42      OPENOUT	OUTPUT( 'runoff', 2, cb_name '.RNO' )
43      
44      START	image = TRIM(source)				:F(END)
45      	image 'CBDOC:' SPAN(space tab) 'FUNCTION' . funct_flag
        +							:S(START)
46      	image FENCE '$FIELD'				:F(START)
47      	max_comment = DIFFER(funct_flag) 40		:(READ010)
48      

                                                                        PAGE 2

49      READ	image = TRIM(source)				:F(DONE)
50      	image 'End of ' cb_name				:S(DONE)
51      	image 'END OF ' cb_name				:S(DONE)
52      	IDENT(image)					:S(BLANK_LINE)
53      
54      	image '$LITERAL'				:F(READ010)
55      	distinct = 0
56      
57      READ010	image '= [' = '= '				:F(READ020)
58      	image ']' =
59      
60      READ020	key_flag =
61      	image breakup					:F(READ)
62      
63      	IDENT(type,'DISTINCT')				:S(DISTINCT)
64      	IDENT(key_flag)					:S(COMMENT)
65      
66      	type 'SHORT_' =
67      	type 'LONG_' =
68      	type 'SUB_BLOCK(' ARB ')' = 'SUB_BLOCK'
69      	type 'DESCRIPTOR(' ARB ')' = 'DESCRIPTOR'
70      
71      	count =
72      	type '(' BREAK(')') . count ')' =
73      	type = xtype<type>
74      	IDENT(type)					:S(READ)
75      	type = DIFFER(count) count ' ' type		:(COMMENT)
76      
77      DISTINCT
78      	distinct = distinct + 1
79      	type = distinct
80      
81      COMMENT	IDENT(funct_flag)				:S(COMM010)
82      	comment in_pat =
83      	comment out_pat =
84      	in_function '  ' = '##'
85      	out_function '  ' = '##'
86      	in_function SPAN(tab space) RPOS(0) =
87      	out_function SPAN(tab space) RPOS(0) =
88      	comment SPAN(tab space) RPOS(0) =
89      
90      COMM010	comment '   ' = '##'				:S(COMM010)
91      COMM020	comment ' - ' = '#-#'				:S(COMM020)
92      
93      FOLD	IDENT(funct_flag)				:S(C_FOLD)
94      	extra_in_function =
95      I_LEN	LE(SIZE(in_function),max_in_function)		:S(O_FOLD)
96      I_EXTRA	in_function LEN(1) . extra RPOS(0) =
97      	extra_in_function = extra extra_in_function
98      	IDENT(extra,space)				:S(I_LEN)F(I_EXTRA)
99      
100     O_FOLD	extra_out_function =
101     O_LEN	LE(SIZE(out_function),max_out_function)		:S(C_FOLD)
102     O_EXTRA	out_function LEN(1) . extra RPOS(0) =
103     	extra_out_function = extra extra_out_function
104     	IDENT(extra,space)				:S(O_LEN)F(O_EXTRA)
105     
106     C_FOLD	extra_comment =

                                                                        PAGE 3

107     C_LEN	LE(SIZE(comment),max_comment)			:S(BUILD)
108     C_EXTRA	comment LEN(1) . extra RPOS(0) =
109     	extra_comment = extra extra_comment
110     	IDENT(extra,space)				:S(C_LEN)F(C_EXTRA)
111     
112     BUILD	DIFFER(funct_flag)				:S(BUILD1)
113     	image = '.br;| ' name
        +		tab '| ' type
        +		tab '| ' comment
        +		tab '|'					:(UNDER1)
114     
115     BUILD1	image = '.br;| ' name
        +		tab '| ' type
        +		tab '| ' in_function
        +		tab '| ' out_function
        +		tab '| ' comment
        +		tab '|'
116     
117     UNDER1	image '_' = '~'					:S(UNDER1)
118     UNDER2	image '~' = '__'				:S(UNDER2)
119     
120     	runoff = image
121     	blank_flag =
122     
123     	IDENT(extra_in_function)  IDENT(extra_out_function)
        +		IDENT(extra_comment)			:S(READ)
124     	name =
125     	type =
126     	in_function = '#' extra_in_function
127     	out_function = '#' extra_out_function
128     	comment FENCE (SPAN(' #') | '') . PREFIX REM = PREFIX '#' extra_comment
129     							:(FOLD)
130     
131     BLANK_LINE
132     	blank_flag = IDENT(blank_flag) "1 blank"	:F(READ)
133     	DIFFER(funct_flag)				:S(BLANK1)
134     	runoff = '.br;|	|	|	|'		:(READ)
135     BLANK1	runoff = '.br;|	|	|	|	|	|'
        +							:(READ)
136     
137     DONE	TERMINAL = ;  TERMINAL = cb_name '.RNO created'	:(END)
139     
140     NOT_FOUND
141     	TERMINAL = 'Definition for '  cb_name  ' not found in '  require_file
        +							:(END)
142     END

STORE USED     3653
STORE LEFT     9224
COMP ERRORS    0
REGENERATIONS  1
COMP TIME-MSEC 730


NORMAL END
IN STATEMENT   142
RUN TIME-MSEC  7040
STMTS EXECUTED 6589
MCSEC / STMT   1068
REGENERATIONS  12

