forked from spitbol/x64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspitblks.h
195 lines (164 loc) · 5.08 KB
/
spitblks.h
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
/*
Copyright 1987-2012 Robert B. K. Dewar and Mark Emmer.
Copyright 2012-2013 David Shields
This file is part of Macro SPITBOL.
Macro SPITBOL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Macro SPITBOL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Macro SPITBOL. If not, see <http://www.gnu.org/licenses/>.
*/
/*
/ File: SPITBLKS.H Version: 01.01
/ -------------------------------------------
/
/ This header file defines structures used by the Macro SPITBOL compiler
/ that are passed into the OS interface.
*/
/*
/ First, define the C type word to be the same size as a word used
/ by the Macro SPITBOL compiler. The type of a word is a signed
/ integer for now.
*/
/*
* BUFFER CONTROL BLOCK
*
* A buffer control block (BCBLK) is created by the BUFFER
* function, and serves as an indirect control header for the
* buffer. It contains the number of characters currently
* stored in the buffer.
*/
struct bcblk {
word typ; // type word
word idv; // identifier value
word len; // number of chars in use in bfblk
struct bsblk *bcbuf; // pointer to bfblk
};
/*
* STRING BUFFER BLOCK
*
* A string buffer block (BFBLK) contains the actual buffer
* memory area. It specifies the largest string that can be
* stored in the buffer.
*/
struct bsblk {
word typ; // type word
word bsalc; // allocated size of buffer
char bschr[1]; // characters of string
};
/*
* CODE BLOCK
*
* A code block (CDBLK) is present for every source statement.
*/
struct cdblk {
word cdjmp; // ptr to routine to execute statement
word cdstm; // statement number
word cdsln; // source file line number
word cdlen; // length of CDBLK in bytes
union {
struct cdblk *cdnxt; // if failure exit is next statement
struct vrblk *cdlab; // if failure exit is a simple label
char *cdnof; // no failure exit (-NOFAIL mode)
word cddir; // failure exit is complex or direct
} cdfal; // Failure exit
word cdcod[1]; // executable pseudo-code
};
/*
/ CHFCB - chain of FCBs block
/
/ For every FCB created by OSINT, the compiler creates a CHFCB pointing
/ to the FCB and links it onto a chain of CHFCBs. At EOJ the head of this
/ CHFCB chain is passed to the interface function SYSEJ so that all files
/ can be closed.
*/
struct chfcb {
word typ; // type word
word len; // block length
struct chfcb *nxt; // pointer to next chfcb
struct fcblk *fcp; // pointer to fcb
};
/*
/ EFBLK - external function block
/
*/
struct efblk {
word fcode; // type word
word fargs; // number of arguments
word eflen; // block length
word efuse; // usage count
void *efcod; // pointer to XNBLK
struct vrblk *efvar; // pointer to VRBLK
word efrsl; // result type
word eftar[1]; // argument types
};
/*
/ ICBLK - integer block
/
/ Integer values are stored in ICBLKs. Field icval should be defined
/ to be the appropriate type for the implementation.
*/
struct icblk {
word typ; // type word - b$icl
long val;
};
/*
/ RCBLK - real block
/
/ Real values are stored in RCBLKs. Field rcval should be defined
/ to be the appropriate type for the implementation.
*/
struct rcblk {
word typ; // type word - b$rcl
double rcval; // real value
};
/*
/ SCBLK - string block
/
/ String values are stored in SCBLKs. Notice that the scstr field
/ is defined as an array of characters of length 1. This is a slight
/ kludge to side-step C's lack of support for varying length strings.
/
/ The actual length of a SCBLK is 2 words + the number of words necessary
/ to hold a string of length sclen.
*/
struct scblk {
word typ; // type word - b$scl
word len; // string length
char str[1]; // string characters
};
/*
* VARIABLE BLOCK
*
* A variable block (VRBLK) is used to hold a program variable.
*/
struct vrblk {
word vrget; // routine to load variable onto stack
word vrsto; // routine to store stack top into var.
union block *vrval; // variable value
word vrtra; // routine to transfer to label
union block *vrlbl; // pointer to code for label
union block *vrfnc; // function block if name is function
struct vrblk *vrnxt; // next vrblk on hash chain
word vrlen; // length of name
char vrchs[1]; // characters of name
};
/*
/ BLOCK - an arbitrary block
*/
union block {
struct bcblk bcb;
struct bsblk bsb;
struct cdblk cdb;
struct chfcb fcb;
struct efblk efb;
struct icblk icb;
struct rcblk rcb;
struct scblk scb;
struct vrblk vrb;
};