File: vms_types.h

package info (click to toggle)
gv 1%3A3.5.8-17
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,924 kB
  • ctags: 3,078
  • sloc: ansic: 25,928; sh: 153; makefile: 57
file content (351 lines) | stat: -rw-r--r-- 9,553 bytes parent folder | download | duplicates (7)
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
/*  DEC/CMS REPLACEMENT HISTORY, Element VMS_TYPES.H */
/*  *4    13-AUG-1992 12:49:50 TP "Added IOSB_GET_T" */
/*  *3    10-AUG-1992 14:20:29 TP "MOVE" */
/*  *2    10-AUG-1992 14:19:45 TP "MOVE" */
/*  *1    10-AUG-1992 14:19:31 TP "VMS data type definitions and macros" */
/*  DEC/CMS REPLACEMENT HISTORY, Element VMS_TYPES.H */
/* VMS_TYPES.H
**=============================================================================
** Copyright (C) 1989 Jym Dyer (jym@wheaties.ai.mit.edu)
**
** This program 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 1, or (at your option)
** any later version.
**
** This program 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 this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**-----------------------------------------------------------------------------
** Version:	V1.0-001
**-----------------------------------------------------------------------------
** Facility:	None
**-----------------------------------------------------------------------------
** Prefix:	None
**-----------------------------------------------------------------------------
** Abstract
** ~~~~~~~~
**  These are typedefs and macro functions for various VMS data types.
**-----------------------------------------------------------------------------
** Contents
** ~~~~~~~~
** EXIT_BLOCK_T
** IOSB_T
** IOSB_ACP_T
** IOSB_CR_T
** IOSB_DISK_T
** IOSB_DISK_SENSEMODE_T
** IOSB_LPA_T
** IOSB_LP_WRITE_T
** IOSB_LP_SETMODE_T
** IOSB_MBX_READ_T
** IOSB_MBX_WRITE_T
** IOSB_MBX_SETPROTECTION_T
** IOSB_MT_T
** IOSB_TTY_ITEMLIST_READ_T
** IOSB_TTY_READ_T
** IOSB_TTY_SETSENSE_T
** IOSB_TTY_WRITE_T
** ITEM_2_T
** ITEM_3_T
** ITEM_LIST_2_T()
** ITEM_LIST_3_T()
**-----------------------------------------------------------------------------
** Environment
** ~~~~~~~~~~~
**  Should be portable to any compiler running on VMS.
**-----------------------------------------------------------------------------
** Author:	Jym Dyer - 15-May-1989
**-----------------------------------------------------------------------------
** Modifications
** ~~~~~~~~~~~~~
** 1.0-001 - Original version.  {Jym 15-May-1989}
** 1.0-002 - Added IOSB_GET_T {Terry Poot <tp@mccall.com> 8/10/1992}
**=============================================================================
*/

#ifndef __VMS_TYPES_H__
#define __VMS_TYPES_H__

/* -=- MACRO FUNCTIONS AND TYPEDEFS -=- */

/* --- Exit Handler Block --- */

/* The exit handler block is a variable-length structure.  What we provide
** here is a header for that structure.  For the simplest uses (exit
** handlers that don't take arguments) the typedef alone will suffice:
**
**	extern void  exit_function(unsigned int *  status_p);
**	unsigned int  exh_status;
**		. . .
**	  EXIT_BLOCK_T  exit_block =
**	   {NULL,exit_function,0,{0,0,0},&exh_status};
**		. . .
**	void
**	exit_function(status_p)
**	 unsigned int *  status_p;
**	{
**		. . .
**
** For more complicated uses (when you want to pass several arguments to
** the exit handler) the typedef can be used as a header in a structure:
**
**	extern void  exit_function(
**	  unsigned int *  status_p,int *  yin_p,int *  yang_p
**	);
**	unsigned int  exh_status;
**	int  that;
**	int  this;
**		. . .
**	  struct
**	  {
**	    EXIT_BLOCK_T  header;
**	    int *  this_p;
**	    int *  that_p;
**	  } = {{NULL,exit_function,0,{0,0,0},&exh_status},&this,&that};
**		. . .
**	void
**	exit_function(status_p,yin_p,yang_p)
**	 unsigned int *  status_p;
**	 int *  yin_p;
**	 int *  yang_p;
**	{
**		. . .
*/

typedef struct
{
  void *  flink_p;
  void  (*exit_handler_p)();
  unsigned char  arg_count;
  unsigned char  must_be_zero[3];
  unsigned int *  status_p;
}  EXIT_BLOCK_T;

/* --- All-Purpose IOSB --- */

/* This all-purpose IOSB can be used for any IO function (though it could
** be a bit of a hassle with terminal set and sense functions).  Just be
** careful with the device dependent data, remembering to use casts where
** appropriate.  Use of the other IOSB typedefs is recommended over use of
** this one, as their fields have more relevant names.
*/

typedef struct
{
  unsigned short int  status;
  unsigned short int  count;
  unsigned char  device_dependent_data[4];
}  IOSB_T;    

/* --- Ancillary Control Process (ACP) IOSB --- */

typedef struct
{
  unsigned short int  status;
  unsigned short int  not_used_0;
  unsigned long int  not_used_1;
}  IOSB_ACP_T;

/* --- CR11 Card Reader IOSB --- */

/* Identical to the all-purpose IOSB.
*/

#define IOSB_CR_T IOSB_T

/* --- Disk Device IOSBs --- */

/* IOSB_DISK_T is for all disk device functions except for sense mode;
** IOSB_DISK_SENSEMODE_T is for sense mode.
*/

typedef struct
{
  unsigned short int  status;
  unsigned short int  byte_count_low_order;
  unsigned short int  byte_count_high_order;
  unsigned short int  zero;
}  IOSB_DISK_T;

typedef struct
{
  unsigned short int  status;
  unsigned short int  zero;
  unsigned char  sectors;
  unsigned char  tracks;
  unsigned short int  cylinders;
}  IOSB_DISK_SENSEMODE_T;

/* --- Laboratory Peripheral Accelarator (LPA) IOSB --- */

typedef struct
{
  unsigned short int  status;
  unsigned short int  byte_count;
  unsigned short int  ready_out;
  unsigned short int  maintenance_status;
}  IOSB_LPA_T;

/* --- Line Printer IOSBs --- */

/* IOSB_LP_WRITE_T is for write functions; IOSB_LP_SETMODE_T is for
** set mode functions.  IOSB_LP_SETMODE_T is identical to IOSB_ACP_T.
*/

typedef struct
{
  unsigned short int  status;
  unsigned short int  byte_count;
  unsigned long int  num_lines_paper_moved;
}  IOSB_LP_WRITE_T;

#define IOSB_LP_SETMODE_T IOSB_ACP_T

/* --- Magnetic Tape IOSB --- */

/* Identical to the all-purpose IOSB.
*/

#define IOSB_MT_T IOSB_T

/* --- Mailbox (MBX) IOSBs --- */

/* IOSB_MBX_READ_T is for the read function; IOSB_MBX_WRITE_T
** is for the write function; IOSB_MBX_SETPROTECTION_T is for
** the set protection function.
*/

typedef struct
{
  unsigned short int  status;
  unsigned short int  byte_count;
  unsigned long int  sender_pid;
}  IOSB_MBX_READ_T;

typedef struct
{
  unsigned short int  status;
  unsigned short int  byte_count;
  unsigned long int  receiver_pid;
}  IOSB_MBX_WRITE_T;

typedef struct
{
  unsigned short int  status;
  unsigned short int  zero;
  unsigned long int  protection_mask_value;
}  IOSB_MBX_SETPROTECTION_T;

/* --- Terminal (TTY) IOSBs --- */

/* IOSB_TTY_READ_T is for the read function; IOSB_TTY_ITEMLIST_READ_T
** is for the itemlist read function; IOSB_TTY_WRITE_T is for the
** write function; IOSB_TTY_SETSENSE_T is for the set mode, set
** characteristscs, sense mode, and sense characteristics functions.
*/

typedef struct
{
  unsigned short int  status;
  unsigned short int  offset_to_terminator;
  unsigned short int  terminator;
  unsigned short int  terminator_size;
}  IOSB_TTY_READ_T;

typedef struct
{
  unsigned short int  status;
  unsigned short int  offset_to_terminator;
  unsigned char  terminator_character;
  unsigned char  reserved;
  unsigned char  terminator_length;
  unsigned char  cursor_position_from_eol;
}  IOSB_TTY_ITEMLIST_READ_T;

typedef struct
{
  unsigned short int  status;
  unsigned short int  byte_count;
  unsigned short int  zero_0;
  unsigned short int  zero_1;
}  IOSB_TTY_WRITE_T;

typedef struct
{
  unsigned short int  status;
  unsigned char  transmit_speed;
  unsigned char  receive_speed;
  unsigned char  cr_fill_count;
  unsigned char  lf_fill_count;
  unsigned char  parity_flags;
  unsigned char  zero;
}  IOSB_TTY_SETSENSE_T;

/* Many of the VMS GETxxx system services also use IOSB's, but they are laid
** out differently. IOSB_GET_T is such a structure. The first longword (not
** word) is the status code, and the second word is reserved to DEC.
*/ 

typedef struct
{
  unsigned long  int  status;
  unsigned long  int  reserved;
}  IOSB_GET_T;    

/* --- Item Lists --- */

/* The item list structures change dynamically according to the number
** of items in them.  For this reason, typedefs (ITEM_2_T and ITEM_3_T)
** are provided for the items, and macro functions (ITEM_LIST_2_T() and
** ITEM_LIST_3_T()) are provided for the item lists.  Here is an example
** showing the usage of an item list macro function:
**
**	static const ITEM_LIST_3_T(item_list,2) =
**	{
**	  {
**	    {sizeof pid,JPI$_PID,&pid,NULL},
**	    {sizeof username,JPI$_USERNAME,&username,&username_length}
**	  },
**	  0
**	};
**
** The number 2 means, of course, that there are two items in the
** itemlist (i.e., the PID and the username).
*/

typedef struct
{
  unsigned short int  component_size;
  unsigned short int  item_code;
  void *  component_p;
}  ITEM_2_T;

typedef struct
{
  unsigned short int  buffer_size;
  unsigned short int  item_code;
  void *  buffer_p;
  unsigned short int *  buffer_length_p;
}  ITEM_3_T;

#define ITEM_LIST_2_T(variable_name,num_items) \
  struct \
  { \
    ITEM_2_T  item[num_items]; \
    int  terminating_zero; \
  }  variable_name

#define ITEM_LIST_3_T(variable_name,num_items) \
  struct \
  { \
    ITEM_3_T  item[num_items]; \
    int  terminating_zero; \
  }  variable_name

#endif /* !__VMS_TYPES_H__ */