"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /* DEC/CMS REPLACEMENT HISTORY, Element VMS_TYPES.H */
2 /* *4 13-AUG-1992 12:49:50 TP "Added IOSB_GET_T" */
3 /* *3 10-AUG-1992 14:20:29 TP "MOVE" */
4 /* *2 10-AUG-1992 14:19:45 TP "MOVE" */
5 /* *1 10-AUG-1992 14:19:31 TP "VMS data type definitions and macros" */
6 /* DEC/CMS REPLACEMENT HISTORY, Element VMS_TYPES.H */
7 /* VMS_TYPES.H
8 **=============================================================================
9 ** Copyright (C) 1989 Jym Dyer (jym@wheaties.ai.mit.edu)
10 **
11 ** This program is free software; you can redistribute it and/or modify
12 ** it under the terms of the GNU General Public License as published by
13 ** the Free Software Foundation; either version 1, or (at your option)
14 ** any later version.
15 **
16 ** This program is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ** GNU General Public License for more details.
20 **
21 ** You should have received a copy of the GNU General Public License
22 ** along with this program; if not, write to the Free Software
23 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 **-----------------------------------------------------------------------------
25 ** Version: V1.0-001
26 **-----------------------------------------------------------------------------
27 ** Facility: None
28 **-----------------------------------------------------------------------------
29 ** Prefix: None
30 **-----------------------------------------------------------------------------
31 ** Abstract
32 ** ~~~~~~~~
33 ** These are typedefs and macro functions for various VMS data types.
34 **-----------------------------------------------------------------------------
35 ** Contents
36 ** ~~~~~~~~
37 ** EXIT_BLOCK_T
38 ** IOSB_T
39 ** IOSB_ACP_T
40 ** IOSB_CR_T
41 ** IOSB_DISK_T
42 ** IOSB_DISK_SENSEMODE_T
43 ** IOSB_LPA_T
44 ** IOSB_LP_WRITE_T
45 ** IOSB_LP_SETMODE_T
46 ** IOSB_MBX_READ_T
47 ** IOSB_MBX_WRITE_T
48 ** IOSB_MBX_SETPROTECTION_T
49 ** IOSB_MT_T
50 ** IOSB_TTY_ITEMLIST_READ_T
51 ** IOSB_TTY_READ_T
52 ** IOSB_TTY_SETSENSE_T
53 ** IOSB_TTY_WRITE_T
54 ** ITEM_2_T
55 ** ITEM_3_T
56 ** ITEM_LIST_2_T()
57 ** ITEM_LIST_3_T()
58 **-----------------------------------------------------------------------------
59 ** Environment
60 ** ~~~~~~~~~~~
61 ** Should be portable to any compiler running on VMS.
62 **-----------------------------------------------------------------------------
63 ** Author: Jym Dyer - 15-May-1989
64 **-----------------------------------------------------------------------------
65 ** Modifications
66 ** ~~~~~~~~~~~~~
67 ** 1.0-001 - Original version. {Jym 15-May-1989}
68 ** 1.0-002 - Added IOSB_GET_T {Terry Poot <tp@mccall.com> 8/10/1992}
69 **=============================================================================
70 */
71
72 #ifndef __VMS_TYPES_H__
73 #define __VMS_TYPES_H__
74
75 /* -=- MACRO FUNCTIONS AND TYPEDEFS -=- */
76
77 /* --- Exit Handler Block --- */
78
79 /* The exit handler block is a variable-length structure. What we provide
80 ** here is a header for that structure. For the simplest uses (exit
81 ** handlers that don't take arguments) the typedef alone will suffice:
82 **
83 ** extern void exit_function(unsigned int * status_p);
84 ** unsigned int exh_status;
85 ** . . .
86 ** EXIT_BLOCK_T exit_block =
87 ** {NULL,exit_function,0,{0,0,0},&exh_status};
88 ** . . .
89 ** void
90 ** exit_function(status_p)
91 ** unsigned int * status_p;
92 ** {
93 ** . . .
94 **
95 ** For more complicated uses (when you want to pass several arguments to
96 ** the exit handler) the typedef can be used as a header in a structure:
97 **
98 ** extern void exit_function(
99 ** unsigned int * status_p,int * yin_p,int * yang_p
100 ** );
101 ** unsigned int exh_status;
102 ** int that;
103 ** int this;
104 ** . . .
105 ** struct
106 ** {
107 ** EXIT_BLOCK_T header;
108 ** int * this_p;
109 ** int * that_p;
110 ** } = {{NULL,exit_function,0,{0,0,0},&exh_status},&this,&that};
111 ** . . .
112 ** void
113 ** exit_function(status_p,yin_p,yang_p)
114 ** unsigned int * status_p;
115 ** int * yin_p;
116 ** int * yang_p;
117 ** {
118 ** . . .
119 */
120
121 typedef struct
122 {
123 void * flink_p;
124 void (*exit_handler_p)();
125 unsigned char arg_count;
126 unsigned char must_be_zero[3];
127 unsigned int * status_p;
128 } EXIT_BLOCK_T;
129
130 /* --- All-Purpose IOSB --- */
131
132 /* This all-purpose IOSB can be used for any IO function (though it could
133 ** be a bit of a hassle with terminal set and sense functions). Just be
134 ** careful with the device dependent data, remembering to use casts where
135 ** appropriate. Use of the other IOSB typedefs is recommended over use of
136 ** this one, as their fields have more relevant names.
137 */
138
139 typedef struct
140 {
141 unsigned short int status;
142 unsigned short int count;
143 unsigned char device_dependent_data[4];
144 } IOSB_T;
145
146 /* --- Ancillary Control Process (ACP) IOSB --- */
147
148 typedef struct
149 {
150 unsigned short int status;
151 unsigned short int not_used_0;
152 unsigned long int not_used_1;
153 } IOSB_ACP_T;
154
155 /* --- CR11 Card Reader IOSB --- */
156
157 /* Identical to the all-purpose IOSB.
158 */
159
160 #define IOSB_CR_T IOSB_T
161
162 /* --- Disk Device IOSBs --- */
163
164 /* IOSB_DISK_T is for all disk device functions except for sense mode;
165 ** IOSB_DISK_SENSEMODE_T is for sense mode.
166 */
167
168 typedef struct
169 {
170 unsigned short int status;
171 unsigned short int byte_count_low_order;
172 unsigned short int byte_count_high_order;
173 unsigned short int zero;
174 } IOSB_DISK_T;
175
176 typedef struct
177 {
178 unsigned short int status;
179 unsigned short int zero;
180 unsigned char sectors;
181 unsigned char tracks;
182 unsigned short int cylinders;
183 } IOSB_DISK_SENSEMODE_T;
184
185 /* --- Laboratory Peripheral Accelarator (LPA) IOSB --- */
186
187 typedef struct
188 {
189 unsigned short int status;
190 unsigned short int byte_count;
191 unsigned short int ready_out;
192 unsigned short int maintenance_status;
193 } IOSB_LPA_T;
194
195 /* --- Line Printer IOSBs --- */
196
197 /* IOSB_LP_WRITE_T is for write functions; IOSB_LP_SETMODE_T is for
198 ** set mode functions. IOSB_LP_SETMODE_T is identical to IOSB_ACP_T.
199 */
200
201 typedef struct
202 {
203 unsigned short int status;
204 unsigned short int byte_count;
205 unsigned long int num_lines_paper_moved;
206 } IOSB_LP_WRITE_T;
207
208 #define IOSB_LP_SETMODE_T IOSB_ACP_T
209
210 /* --- Magnetic Tape IOSB --- */
211
212 /* Identical to the all-purpose IOSB.
213 */
214
215 #define IOSB_MT_T IOSB_T
216
217 /* --- Mailbox (MBX) IOSBs --- */
218
219 /* IOSB_MBX_READ_T is for the read function; IOSB_MBX_WRITE_T
220 ** is for the write function; IOSB_MBX_SETPROTECTION_T is for
221 ** the set protection function.
222 */
223
224 typedef struct
225 {
226 unsigned short int status;
227 unsigned short int byte_count;
228 unsigned long int sender_pid;
229 } IOSB_MBX_READ_T;
230
231 typedef struct
232 {
233 unsigned short int status;
234 unsigned short int byte_count;
235 unsigned long int receiver_pid;
236 } IOSB_MBX_WRITE_T;
237
238 typedef struct
239 {
240 unsigned short int status;
241 unsigned short int zero;
242 unsigned long int protection_mask_value;
243 } IOSB_MBX_SETPROTECTION_T;
244
245 /* --- Terminal (TTY) IOSBs --- */
246
247 /* IOSB_TTY_READ_T is for the read function; IOSB_TTY_ITEMLIST_READ_T
248 ** is for the itemlist read function; IOSB_TTY_WRITE_T is for the
249 ** write function; IOSB_TTY_SETSENSE_T is for the set mode, set
250 ** characteristscs, sense mode, and sense characteristics functions.
251 */
252
253 typedef struct
254 {
255 unsigned short int status;
256 unsigned short int offset_to_terminator;
257 unsigned short int terminator;
258 unsigned short int terminator_size;
259 } IOSB_TTY_READ_T;
260
261 typedef struct
262 {
263 unsigned short int status;
264 unsigned short int offset_to_terminator;
265 unsigned char terminator_character;
266 unsigned char reserved;
267 unsigned char terminator_length;
268 unsigned char cursor_position_from_eol;
269 } IOSB_TTY_ITEMLIST_READ_T;
270
271 typedef struct
272 {
273 unsigned short int status;
274 unsigned short int byte_count;
275 unsigned short int zero_0;
276 unsigned short int zero_1;
277 } IOSB_TTY_WRITE_T;
278
279 typedef struct
280 {
281 unsigned short int status;
282 unsigned char transmit_speed;
283 unsigned char receive_speed;
284 unsigned char cr_fill_count;
285 unsigned char lf_fill_count;
286 unsigned char parity_flags;
287 unsigned char zero;
288 } IOSB_TTY_SETSENSE_T;
289
290 /* Many of the VMS GETxxx system services also use IOSB's, but they are laid
291 ** out differently. IOSB_GET_T is such a structure. The first longword (not
292 ** word) is the status code, and the second word is reserved to DEC.
293 */
294
295 typedef struct
296 {
297 unsigned long int status;
298 unsigned long int reserved;
299 } IOSB_GET_T;
300
301 /* --- Item Lists --- */
302
303 /* The item list structures change dynamically according to the number
304 ** of items in them. For this reason, typedefs (ITEM_2_T and ITEM_3_T)
305 ** are provided for the items, and macro functions (ITEM_LIST_2_T() and
306 ** ITEM_LIST_3_T()) are provided for the item lists. Here is an example
307 ** showing the usage of an item list macro function:
308 **
309 ** static const ITEM_LIST_3_T(item_list,2) =
310 ** {
311 ** {
312 ** {sizeof pid,JPI$_PID,&pid,NULL},
313 ** {sizeof username,JPI$_USERNAME,&username,&username_length}
314 ** },
315 ** 0
316 ** };
317 **
318 ** The number 2 means, of course, that there are two items in the
319 ** itemlist (i.e., the PID and the username).
320 */
321
322 typedef struct
323 {
324 unsigned short int component_size;
325 unsigned short int item_code;
326 void * component_p;
327 } ITEM_2_T;
328
329 typedef struct
330 {
331 unsigned short int buffer_size;
332 unsigned short int item_code;
333 void * buffer_p;
334 unsigned short int * buffer_length_p;
335 } ITEM_3_T;
336
337 #define ITEM_LIST_2_T(variable_name,num_items) \
338 struct \
339 { \
340 ITEM_2_T item[num_items]; \
341 int terminating_zero; \
342 } variable_name
343
344 #define ITEM_LIST_3_T(variable_name,num_items) \
345 struct \
346 { \
347 ITEM_3_T item[num_items]; \
348 int terminating_zero; \
349 } variable_name
350
351 #endif /* !__VMS_TYPES_H__ */