-
Notifications
You must be signed in to change notification settings - Fork 2
/
make_symbol_vector.tes
280 lines (264 loc) · 9.57 KB
/
make_symbol_vector.tes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
! !
! 2013 July 23 !
! !
! The author disclaims copyright to this source code. In place of !
! a legal notice, here is a blessing: !
! !
! May you do good and not evil. !
! May you find forgiveness for yourself and forgive others. !
! May you share freely, never taking more than you give. !
! !
!***********************************************************************!
! This module contains the code that builds the symbol vector !
! for UnQLite3. It does this by reading in an existing symbol table, !
! then the symbols defined in the object library. Any new symbols are !
! tacked on the end and the new symbol vector is saved. If any symbols!
! are not present in the object library that are listed in the symbol !
! vectore, are warning is issued. !
! !
@^A%MAKE_SYMBOL_VECTOR V1.0% ! Identify myself... !
13^T 10^T
0J Z"N <@FS%^ES% %;> ! Clean up the buffer, if it's there !
0J 0A-32"E D ' ! strip leading spaces !
ZJ -1A-32"E -D ' ! and trailing spaces !
' ! endif buffer there !
HXZ HK ! Save possible command !
! Set flags for our use, and close this file !
[S ^XUS [S EDUS [S EHUS [S ! Save all the existing flags !
ESUS [S EVUS [S ETUS [S EUUS [S ! so we can restore the user to !
! his original state on exit !
^D ! Set Radix to 10 !
0^X ! Case-sensitive search !
0ED ! ^ in search means ConTRL !
! Disable Y or _ if data loss !
2EH ! Full error messages !
0ES 0EV ! No typeout after search !
2#16#128#512#8192ET
! Set ET flag as follows - !
! 1 rw typeout in image mode !
! 2 rw terminal is a scope !
! 4 rw read lower case !
! 8 rw ^T reads with no echo !
! 16 rw cancel ^O on typeout !
! 32 rw read with no wait, returns -1 if no input !
! 64 rw detach flag !
! 128 rw abort on error !
! 256 rw truncate to set width !
! 512 ro terminal is scope and watch is present !
! 1024 ro terminal is refresh and watch is present !
! 2048 xx not used !
! 4096 rw 1 => 8bit, 0 => 7bit !
! 8192 rw Surrogate escape on !
! 16384 xx not used !
! 32768 rw trap ^C and reset !
-1EU ! No case flagging on output !
! EO is Teco's Version Number !
! 0EJ is Job Number !
! 1EJ is KB Number !
! 2EJ is PPN !
@EI%% ! Close this file !
! --------------------------------------------------------------------- !
! * !
! !
! X$ is library listing file name (input) !
! Y$ is symbol vector file name (input/output) !
! Z$ is platform specific transfer vector definition !
! N$ is new symbols from library listing !
! T$ is symbol table !
! H$ contains UNQLITE_APIEXPORT prefixed stuff from unqlite.h header file !
! !
! -- keep moving everything into mainline...arch-specific is only macros!
! A$ contains macro to generate Alpha/I64 symbol vector !
! L$ contains macro to build symbol vector !
! R$ contains macro to load library listing !
! V$ contains macro to generate VAX vector !
!!
! --------------------------------------------------------------------- !
GZ ! Dump command line into buffer !
0J Z"N <@FS%^ES% %;> ! Clean up the buffer, if there !
@^UX%% @^UY%% @^UZ%% ! init filename buffers !
0J 0A-32"E D ' ! strip leading spaces !
ZJ -1A-32"E -D ' ! and trailing spaces !
0J
< 0A:@^UY%% C 0A-^^="E C0;' >
.,ZXX
'
! --------------------------------------------------------------------- !
! Read in the library listing and convert to a ^ delimited list of !
! global symbols, all stored in N$. !
! --------------------------------------------------------------------- !
@^A%...Reading symbol vector table from library listing...%
HK ! Clear the buffer !
@^UN%% ! Clear input symbol list !
:@ER%^EQX%"F ! If could not open file then !
@^A%Can't find file "% :G.I @^A%"...% 13^T 2<10^T>
| ! else !
0U.F ! Clear "in module" !
< :EY; ! Yank in a page !
< ! loop over lines !
::@S%Module %"S ! If line starts Module !
-1U.F ! set "in module" !
| Q.F"S ! else if "in module" !
::@S%^X^EL%"S ! if line is blank !
^SC ! backup . before eol !
0U.F ! clear "in module" !
| ! else !
< ! loop over line !
< 0A-^^ "N 0;' C > ! skip leading space!
< 0A"C 0A:@^UN%% C | 0;' > ! put symbol name, !
^^,:@^UN%% ! and ',' into N$ !
0A-13"E 0;' > ! leave if at line end!
' ! end if !
' ' ! end if !
L .-Z;> ! next line, leave if none !
> ! page loop !
HK ! clear text buffer !
@^A%done...% 13^T 10^T
' ! end if !
! --------------------------------------------------------------------- !
! Here we load all lines from the header file that describes the public !
! interface to UnQLite, unqlite.h, and store it away in H$. This is !
! used to verify the global symbols read from the library listing are !
! in fact public routines (and data cells). !
! --------------------------------------------------------------------- !
:QN"N ! if lib listing loaded then !
@^A%...Loading public header file for comparison...%
@^UH%% ! Clear header file buffer !
:@ER%SRC_DIR:UNQLITE.H%"S ! Open public, if success !
< :EY; ! then Yank in a page !
< :@S%^ELUNQLITE_APIEXPORT^ES%; ! grab UNQLITE_APIEXPORT lines !
:@FB%^Xunqlite_%"S
^S+1C
:XH ! stick them in H$ !
'
> ! end loop !
> ! end loop !
@^A%sorting...%
HK GH 0J ! load in buffer for sort !
< 0U.F ! clear flag, begin loop !
0J <
0L X.A 7U.A
L
.-Z"E 0;'
8C
:Q.A-(Q.A+1) <
%.AQ.A"C
(Q.AQ.A#32)-(0A#32)"L
0;
| (Q.AQ.A#32)-(0A#32)"G
-1U.F
0L X.A K -L G.A
0;
|
C
' '
|
0;
'
>
> ! !
Q.F; > ! go again if line switched !
HXH ! store in H$ !
@^A%done...% 13^T 10^T ! report !
| ! else !
@^A%unable to open SRC_DIR:UNQLITE.H% 13^T 10^T
' ! endif !
' ! endif !
! --------------------------------------------------------------------- !
! Load the existing symbol table. We use this to test for missing !
! entries (useful when building a new version of UnQLite) as well as !
! retaining a record of the symbol table, so it can be updated without !
! losing compatability. !
! --------------------------------------------------------------------- !
:QN+:QH"N
@^A%...Loading existing symbol vector table...%
HK ! Clear text buffer !
:@ER%^EQY%"S ! If can open existing vector !
:EY ! then load it into buffer !
' ! endif !
0J ! reset . !
@^A%done...% 13^T 10^T
! --------------------------------------------------------------------- !
! Using the public interface definitions, previous symbol vector table !
! and the new symbols from the object library listing, we construct an !
! udpated table. !
! --------------------------------------------------------------------- !
@^A%...Building new symbol vector table...%
0U.P < ! Init pointer !
@^U.S%%
<
Q.PQN:@^U.S%%
%.PQN-^^,"E
%.P^[
0;
'
>
0J :@S%^EQ.S,^ED,^EA^X^EL%"F ! if no matching record !
HX2 .U2 ! store sym table !
HK GH ! load public interface !
0J :@S%^EQ.S%U3 Q3"S ! if public !
::@S%^ES%^[ ! skip whitespace !
0AU3 ! store next character !
' ! end if !
HK G2 Q2J ! restore sym table !
Q3"N ! if public !
ZJ G.S @I%,2,% ! then new record !
Q3-^^("E ! if function !
@I%P% ! set symbol type to P !
| ! else treat as data !
@I%D% ! set symbol type to D !
' ! end if !
13@I%% 10@I%% ! terminate record !
' ! end if !
| ! else !
-2@S%,% C ! backup to flag !
D @I%1% ! set it to known !
' ! end if !
:QN-Q.P"E 0;' >
@^A%...done...% 13^T 10^T
! --------------------------------------------------------------------- !
! Now, examine the flags attached to the symbols to determine if there !
! have been any changes to the symbol vector table and reports them. !
! --------------------------------------------------------------------- !
@^A%...Checking for changes in symbol vector table...%
-1UT ! Symbol table unchanged... !
HXT ! Store symbol table !
0J
<
@^A%.%
@^U.S%%
< 0A:@^U.S%% C 0A-^^,"E 0;' > ! fetch name into .S$ !
@S%,% \U.S ! fetch flag !
-D @I%0% ! clear flag !
Q.S-1"L ! if not found !
@S%,% 0A-^^S"N ! if not already aware of it !
13^T 10^T @^A% ...% :G.S @^A% is missing%
D @I%S% ! change so we are !
0UT ! indicate a change !
' ! end if !
| Q.S-1"G ! else if new symbol !
13^T 10^T @^A% ...% :G.S @^A% is new%
0UT ! indicate a change !
' ' ! end if !
L
.-Z; >
13^T 10^T
QT"F
@^A%...symbol table has changed%
:@EW%^EQY/STM%"S
HP EF
|
@^A%Could not open % :GY @^A% for output% 13^T 10^T
'
|
@^A%...symbol table has not changed%
'
@^A%...done...% 13^T 10^T
'
! --------------------------------------------------------------------- !
! * Now restore all the flags and exit !
! --------------------------------------------------------------------- !
]S QSEU ]S QSET ]S QSEV ]S QSES ]S ! Restore all the flags we !
QSEH ]S QSED ]S QS^X ]S ! saved at the start !
^C