Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
/*
31
    AUTOMATICALLY GENERATED FROM ALGEBRA disk (VERSION 1.1)
32
    BY calculus (VERSION 1.2)
33
*/
34
 
35
#ifndef WRITE_DEF_H_INCLUDED
36
#define WRITE_DEF_H_INCLUDED
37
 
38
#include "disk.h"
39
#include "type_ops.h"
40
 
41
/* Disk writing function declarations */
42
 
43
#ifndef WRITE_disk_list_ptr_type
44
#define WRITE_disk_list_ptr_type( A ) WRITE_list_ptr_type ( A )
45
#endif
46
 
47
#ifndef WRITE_list_ptr_type
48
static void WRITE_list_ptr_type PROTO_S ( ( LIST ( PTR ( TYPE ) ) ) ) ;
49
#endif
50
 
51
#ifndef WRITE_disk_string
52
#define WRITE_disk_string( A ) WRITE_string ( A )
53
#endif
54
 
55
#ifndef WRITE_disk_int
56
#define WRITE_disk_int( A ) WRITE_int ( A )
57
#endif
58
 
59
#ifndef WRITE_type
60
static void WRITE_type PROTO_S ( ( TYPE ) ) ;
61
#endif
62
 
63
#ifndef WRITE_zero_int
64
#define WRITE_zero_int( A ) WRITE_int ( A )
65
#endif
66
 
67
#ifndef WRITE_PRIMITIVE_P
68
#define WRITE_PRIMITIVE_P( A ) WRITE_ptr_prim ( A )
69
#endif
70
 
71
#ifndef WRITE_ptr_prim
72
static void WRITE_ptr_prim PROTO_S ( ( PTR ( PRIMITIVE ) ) ) ;
73
#endif
74
 
75
#ifndef WRITE_prim
76
static void WRITE_prim PROTO_S ( ( PRIMITIVE ) ) ;
77
#endif
78
 
79
#ifndef WRITE_CLASS_ID_P
80
#define WRITE_CLASS_ID_P( A ) WRITE_ptr_cid ( A )
81
#endif
82
 
83
#ifndef WRITE_ptr_cid
84
static void WRITE_ptr_cid PROTO_S ( ( PTR ( CLASS_ID ) ) ) ;
85
#endif
86
 
87
#ifndef WRITE_cid
88
static void WRITE_cid PROTO_S ( ( CLASS_ID ) ) ;
89
#endif
90
 
91
#ifndef WRITE_name_string
92
#define WRITE_name_string( A ) WRITE_string ( A )
93
#endif
94
 
95
#ifndef WRITE_IDENTITY_P
96
#define WRITE_IDENTITY_P( A ) WRITE_ptr_ident ( A )
97
#endif
98
 
99
#ifndef WRITE_ptr_ident
100
static void WRITE_ptr_ident PROTO_S ( ( PTR ( IDENTITY ) ) ) ;
101
#endif
102
 
103
#ifndef WRITE_ident
104
static void WRITE_ident PROTO_S ( ( IDENTITY ) ) ;
105
#endif
106
 
107
#ifndef WRITE_TYPE_P
108
#define WRITE_TYPE_P( A ) WRITE_ptr_type ( A )
109
#endif
110
 
111
#ifndef WRITE_ptr_type
112
static void WRITE_ptr_type PROTO_S ( ( PTR ( TYPE ) ) ) ;
113
#endif
114
 
115
#ifndef WRITE_ENUM_P
116
#define WRITE_ENUM_P( A ) WRITE_ptr_en ( A )
117
#endif
118
 
119
#ifndef WRITE_ptr_en
120
static void WRITE_ptr_en PROTO_S ( ( PTR ( ENUM ) ) ) ;
121
#endif
122
 
123
#ifndef WRITE_en
124
static void WRITE_en PROTO_S ( ( ENUM ) ) ;
125
#endif
126
 
127
#ifndef WRITE_list_ptr_ec
128
static void WRITE_list_ptr_ec PROTO_S ( ( LIST ( PTR ( ECONST ) ) ) ) ;
129
#endif
130
 
131
#ifndef WRITE_list_ECONST_P
132
#define WRITE_list_ECONST_P( A ) WRITE_list_ptr_ec ( A )
133
#endif
134
 
135
#ifndef WRITE_ECONST_P
136
#define WRITE_ECONST_P( A ) WRITE_ptr_ec ( A )
137
#endif
138
 
139
#ifndef WRITE_ptr_ec
140
static void WRITE_ptr_ec PROTO_S ( ( PTR ( ECONST ) ) ) ;
141
#endif
142
 
143
#ifndef WRITE_ec
144
static void WRITE_ec PROTO_S ( ( ECONST ) ) ;
145
#endif
146
 
147
#ifndef WRITE_STRUCTURE_P
148
#define WRITE_STRUCTURE_P( A ) WRITE_ptr_str ( A )
149
#endif
150
 
151
#ifndef WRITE_ptr_str
152
static void WRITE_ptr_str PROTO_S ( ( PTR ( STRUCTURE ) ) ) ;
153
#endif
154
 
155
#ifndef WRITE_str
156
static void WRITE_str PROTO_S ( ( STRUCTURE ) ) ;
157
#endif
158
 
159
#ifndef WRITE_list_ptr_cmp
160
static void WRITE_list_ptr_cmp PROTO_S ( ( LIST ( PTR ( COMPONENT ) ) ) ) ;
161
#endif
162
 
163
#ifndef WRITE_list_COMPONENT_P
164
#define WRITE_list_COMPONENT_P( A ) WRITE_list_ptr_cmp ( A )
165
#endif
166
 
167
#ifndef WRITE_COMPONENT_P
168
#define WRITE_COMPONENT_P( A ) WRITE_ptr_cmp ( A )
169
#endif
170
 
171
#ifndef WRITE_ptr_cmp
172
static void WRITE_ptr_cmp PROTO_S ( ( PTR ( COMPONENT ) ) ) ;
173
#endif
174
 
175
#ifndef WRITE_cmp
176
static void WRITE_cmp PROTO_S ( ( COMPONENT ) ) ;
177
#endif
178
 
179
#ifndef WRITE_UNION_P
180
#define WRITE_UNION_P( A ) WRITE_ptr_un ( A )
181
#endif
182
 
183
#ifndef WRITE_ptr_un
184
static void WRITE_ptr_un PROTO_S ( ( PTR ( UNION ) ) ) ;
185
#endif
186
 
187
#ifndef WRITE_un
188
static void WRITE_un PROTO_S ( ( UNION ) ) ;
189
#endif
190
 
191
#ifndef WRITE_list_ptr_fld
192
static void WRITE_list_ptr_fld PROTO_S ( ( LIST ( PTR ( FIELD ) ) ) ) ;
193
#endif
194
 
195
#ifndef WRITE_list_FIELD_P
196
#define WRITE_list_FIELD_P( A ) WRITE_list_ptr_fld ( A )
197
#endif
198
 
199
#ifndef WRITE_FIELD_P
200
#define WRITE_FIELD_P( A ) WRITE_ptr_fld ( A )
201
#endif
202
 
203
#ifndef WRITE_ptr_fld
204
static void WRITE_ptr_fld PROTO_S ( ( PTR ( FIELD ) ) ) ;
205
#endif
206
 
207
#ifndef WRITE_fld
208
static void WRITE_fld PROTO_S ( ( FIELD ) ) ;
209
#endif
210
 
211
#ifndef WRITE_list_ptr_map
212
static void WRITE_list_ptr_map PROTO_S ( ( LIST ( PTR ( MAP ) ) ) ) ;
213
#endif
214
 
215
#ifndef WRITE_list_MAP_P
216
#define WRITE_list_MAP_P( A ) WRITE_list_ptr_map ( A )
217
#endif
218
 
219
#ifndef WRITE_MAP_P
220
#define WRITE_MAP_P( A ) WRITE_ptr_map ( A )
221
#endif
222
 
223
#ifndef WRITE_ptr_map
224
static void WRITE_ptr_map PROTO_S ( ( PTR ( MAP ) ) ) ;
225
#endif
226
 
227
#ifndef WRITE_map
228
static void WRITE_map PROTO_S ( ( MAP ) ) ;
229
#endif
230
 
231
#ifndef WRITE_list_ptr_arg
232
static void WRITE_list_ptr_arg PROTO_S ( ( LIST ( PTR ( ARGUMENT ) ) ) ) ;
233
#endif
234
 
235
#ifndef WRITE_list_ARGUMENT_P
236
#define WRITE_list_ARGUMENT_P( A ) WRITE_list_ptr_arg ( A )
237
#endif
238
 
239
#ifndef WRITE_ARGUMENT_P
240
#define WRITE_ARGUMENT_P( A ) WRITE_ptr_arg ( A )
241
#endif
242
 
243
#ifndef WRITE_ptr_arg
244
static void WRITE_ptr_arg PROTO_S ( ( PTR ( ARGUMENT ) ) ) ;
245
#endif
246
 
247
#ifndef WRITE_arg
248
static void WRITE_arg PROTO_S ( ( ARGUMENT ) ) ;
249
#endif
250
 
251
 
252
/* Disk writing routine for LIST ( PTR ( TYPE ) ) */
253
 
254
#ifndef WRITE_list_ptr_type
255
 
256
static void WRITE_list_ptr_type
257
    PROTO_N ( ( x_ ) )
258
    PROTO_T ( LIST ( PTR ( TYPE ) ) x_ )
259
{
260
    while ( !IS_NULL_list ( x_ ) ) {
261
	PTR ( TYPE ) y_ ;
262
	y_ = DEREF_ptr ( HEAD_list ( x_ ) ) ;
263
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
264
	WRITE_ptr_type ( y_ ) ;
265
	x_ = TAIL_list ( x_ ) ;
266
    }
267
    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
268
    return ;
269
}
270
 
271
#endif
272
 
273
 
274
/* Disk writing routine for TYPE */
275
 
276
#ifndef WRITE_type
277
 
278
static void WRITE_type
279
    PROTO_N ( ( x_ ) )
280
    PROTO_T ( TYPE x_ )
281
{
282
    if ( IS_NULL_type ( x_ ) ) {
283
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
284
    } else {
285
	zero_int size ;
286
	unsigned tag_ = TAG_type ( x_ ) ;
287
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
288
	WRITE_BITS ( 4, tag_ ) ;
289
	switch ( tag_ ) {
290
	    case type_primitive_tag : {
291
		PRIMITIVE_P prim ;
292
		unsigned alias_ = GET_ALIAS_type_primitive ( x_ ) ;
293
		if ( alias_ ) {
294
		    WRITE_ALIAS ( alias_ ) ;
295
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
296
		    break ;
297
		}
298
		alias_ = ++crt_disk_alias ;
299
		SET_ALIAS_type_primitive ( x_, alias_ ) ;
300
		WRITE_ALIAS ( alias_ ) ;
301
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
302
		DECONS_type_primitive ( size, prim,  x_ ) ;
303
		WRITE_zero_int ( size ) ;
304
		WRITE_PRIMITIVE_P ( prim ) ;
305
		break ;
306
	    }
307
	    case type_ident_tag : {
308
		IDENTITY_P id ;
309
		unsigned alias_ = GET_ALIAS_type_ident ( x_ ) ;
310
		if ( alias_ ) {
311
		    WRITE_ALIAS ( alias_ ) ;
312
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
313
		    break ;
314
		}
315
		alias_ = ++crt_disk_alias ;
316
		SET_ALIAS_type_ident ( x_, alias_ ) ;
317
		WRITE_ALIAS ( alias_ ) ;
318
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
319
		DECONS_type_ident ( size, id,  x_ ) ;
320
		WRITE_zero_int ( size ) ;
321
		WRITE_IDENTITY_P ( id ) ;
322
		break ;
323
	    }
324
	    case type_enumeration_tag : {
325
		ENUM_P en ;
326
		unsigned alias_ = GET_ALIAS_type_enumeration ( x_ ) ;
327
		if ( alias_ ) {
328
		    WRITE_ALIAS ( alias_ ) ;
329
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
330
		    break ;
331
		}
332
		alias_ = ++crt_disk_alias ;
333
		SET_ALIAS_type_enumeration ( x_, alias_ ) ;
334
		WRITE_ALIAS ( alias_ ) ;
335
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
336
		DECONS_type_enumeration ( size, en,  x_ ) ;
337
		WRITE_zero_int ( size ) ;
338
		WRITE_ENUM_P ( en ) ;
339
		break ;
340
	    }
341
	    case type_structure_tag : {
342
		STRUCTURE_P struc ;
343
		unsigned alias_ = GET_ALIAS_type_structure ( x_ ) ;
344
		if ( alias_ ) {
345
		    WRITE_ALIAS ( alias_ ) ;
346
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
347
		    break ;
348
		}
349
		alias_ = ++crt_disk_alias ;
350
		SET_ALIAS_type_structure ( x_, alias_ ) ;
351
		WRITE_ALIAS ( alias_ ) ;
352
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
353
		DECONS_type_structure ( size, struc,  x_ ) ;
354
		WRITE_zero_int ( size ) ;
355
		WRITE_STRUCTURE_P ( struc ) ;
356
		break ;
357
	    }
358
	    case type_onion_tag : {
359
		UNION_P un ;
360
		unsigned alias_ = GET_ALIAS_type_onion ( x_ ) ;
361
		if ( alias_ ) {
362
		    WRITE_ALIAS ( alias_ ) ;
363
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
364
		    break ;
365
		}
366
		alias_ = ++crt_disk_alias ;
367
		SET_ALIAS_type_onion ( x_, alias_ ) ;
368
		WRITE_ALIAS ( alias_ ) ;
369
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
370
		DECONS_type_onion ( size, un,  x_ ) ;
371
		WRITE_zero_int ( size ) ;
372
		WRITE_UNION_P ( un ) ;
373
		break ;
374
	    }
375
	    case type_ptr_tag : {
376
		TYPE_P sub ;
377
		unsigned alias_ = GET_ALIAS_type_ptr ( x_ ) ;
378
		if ( alias_ ) {
379
		    WRITE_ALIAS ( alias_ ) ;
380
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
381
		    break ;
382
		}
383
		alias_ = ++crt_disk_alias ;
384
		SET_ALIAS_type_ptr ( x_, alias_ ) ;
385
		WRITE_ALIAS ( alias_ ) ;
386
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
387
		DECONS_type_ptr ( size, sub,  x_ ) ;
388
		WRITE_zero_int ( size ) ;
389
		WRITE_TYPE_P ( sub ) ;
390
		break ;
391
	    }
392
	    case type_list_tag : {
393
		TYPE_P sub ;
394
		unsigned alias_ = GET_ALIAS_type_list ( x_ ) ;
395
		if ( alias_ ) {
396
		    WRITE_ALIAS ( alias_ ) ;
397
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
398
		    break ;
399
		}
400
		alias_ = ++crt_disk_alias ;
401
		SET_ALIAS_type_list ( x_, alias_ ) ;
402
		WRITE_ALIAS ( alias_ ) ;
403
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
404
		DECONS_type_list ( size, sub,  x_ ) ;
405
		WRITE_zero_int ( size ) ;
406
		WRITE_TYPE_P ( sub ) ;
407
		break ;
408
	    }
409
	    case type_stack_tag : {
410
		TYPE_P sub ;
411
		unsigned alias_ = GET_ALIAS_type_stack ( x_ ) ;
412
		if ( alias_ ) {
413
		    WRITE_ALIAS ( alias_ ) ;
414
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
415
		    break ;
416
		}
417
		alias_ = ++crt_disk_alias ;
418
		SET_ALIAS_type_stack ( x_, alias_ ) ;
419
		WRITE_ALIAS ( alias_ ) ;
420
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
421
		DECONS_type_stack ( size, sub,  x_ ) ;
422
		WRITE_zero_int ( size ) ;
423
		WRITE_TYPE_P ( sub ) ;
424
		break ;
425
	    }
426
	    case type_vec_tag : {
427
		TYPE_P sub ;
428
		unsigned alias_ = GET_ALIAS_type_vec ( x_ ) ;
429
		if ( alias_ ) {
430
		    WRITE_ALIAS ( alias_ ) ;
431
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
432
		    break ;
433
		}
434
		alias_ = ++crt_disk_alias ;
435
		SET_ALIAS_type_vec ( x_, alias_ ) ;
436
		WRITE_ALIAS ( alias_ ) ;
437
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
438
		DECONS_type_vec ( size, sub,  x_ ) ;
439
		WRITE_zero_int ( size ) ;
440
		WRITE_TYPE_P ( sub ) ;
441
		break ;
442
	    }
443
	    case type_vec_ptr_tag : {
444
		TYPE_P sub ;
445
		unsigned alias_ = GET_ALIAS_type_vec_ptr ( x_ ) ;
446
		if ( alias_ ) {
447
		    WRITE_ALIAS ( alias_ ) ;
448
		    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
449
		    break ;
450
		}
451
		alias_ = ++crt_disk_alias ;
452
		SET_ALIAS_type_vec_ptr ( x_, alias_ ) ;
453
		WRITE_ALIAS ( alias_ ) ;
454
		WRITE_BITS ( 1, ( unsigned ) 1 ) ;
455
		DECONS_type_vec_ptr ( size, sub,  x_ ) ;
456
		WRITE_zero_int ( size ) ;
457
		WRITE_TYPE_P ( sub ) ;
458
		break ;
459
	    }
460
	    case type_quote_tag : {
461
		string defn ;
462
		DECONS_type_quote ( size, defn,  x_ ) ;
463
		WRITE_zero_int ( size ) ;
464
		WRITE_string ( defn ) ;
465
		break ;
466
	    }
467
	    case type_undef_tag : {
468
		string name ;
469
		DECONS_type_undef ( size, name,  x_ ) ;
470
		WRITE_zero_int ( size ) ;
471
		WRITE_string ( name ) ;
472
		break ;
473
	    }
474
	}
475
    }
476
    return ;
477
}
478
 
479
#endif
480
 
481
 
482
/* Disk writing routine for PTR ( PRIMITIVE ) */
483
 
484
#ifndef WRITE_ptr_prim
485
 
486
static void WRITE_ptr_prim
487
    PROTO_N ( ( x_ ) )
488
    PROTO_T ( PTR ( PRIMITIVE ) x_ )
489
{
490
    if ( IS_NULL_ptr ( x_ ) ) {
491
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
492
    } else {
493
	PRIMITIVE y_ ;
494
	DEREF_prim ( x_, y_ ) ;
495
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
496
	WRITE_prim ( y_ ) ;
497
    }
498
    return ;
499
}
500
 
501
#endif
502
 
503
 
504
/* Disk writing routine for PRIMITIVE */
505
 
506
#ifndef WRITE_prim
507
 
508
static void WRITE_prim
509
    PROTO_N ( ( x_ ) )
510
    PROTO_T ( PRIMITIVE x_ )
511
{
512
    WRITE_CLASS_ID_P ( x_.id ) ;
513
    WRITE_string ( x_.defn ) ;
514
    return ;
515
}
516
 
517
#endif
518
 
519
 
520
/* Disk writing routine for PTR ( CLASS_ID ) */
521
 
522
#ifndef WRITE_ptr_cid
523
 
524
static void WRITE_ptr_cid
525
    PROTO_N ( ( x_ ) )
526
    PROTO_T ( PTR ( CLASS_ID ) x_ )
527
{
528
    if ( IS_NULL_ptr ( x_ ) ) {
529
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
530
    } else {
531
	CLASS_ID y_ ;
532
	DEREF_cid ( x_, y_ ) ;
533
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
534
	WRITE_cid ( y_ ) ;
535
    }
536
    return ;
537
}
538
 
539
#endif
540
 
541
 
542
/* Disk writing routine for CLASS_ID */
543
 
544
#ifndef WRITE_cid
545
 
546
static void WRITE_cid
547
    PROTO_N ( ( x_ ) )
548
    PROTO_T ( CLASS_ID x_ )
549
{
550
    WRITE_string ( x_.name ) ;
551
    WRITE_string ( x_.name_aux ) ;
552
    WRITE_int ( x_.flag ) ;
553
    WRITE_name_string ( x_.file ) ;
554
    WRITE_int ( x_.line ) ;
555
    return ;
556
}
557
 
558
#endif
559
 
560
 
561
/* Disk writing routine for PTR ( IDENTITY ) */
562
 
563
#ifndef WRITE_ptr_ident
564
 
565
static void WRITE_ptr_ident
566
    PROTO_N ( ( x_ ) )
567
    PROTO_T ( PTR ( IDENTITY ) x_ )
568
{
569
    if ( IS_NULL_ptr ( x_ ) ) {
570
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
571
    } else {
572
	IDENTITY y_ ;
573
	DEREF_ident ( x_, y_ ) ;
574
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
575
	WRITE_ident ( y_ ) ;
576
    }
577
    return ;
578
}
579
 
580
#endif
581
 
582
 
583
/* Disk writing routine for IDENTITY */
584
 
585
#ifndef WRITE_ident
586
 
587
static void WRITE_ident
588
    PROTO_N ( ( x_ ) )
589
    PROTO_T ( IDENTITY x_ )
590
{
591
    WRITE_CLASS_ID_P ( x_.id ) ;
592
    WRITE_TYPE_P ( x_.defn ) ;
593
    return ;
594
}
595
 
596
#endif
597
 
598
 
599
/* Disk writing routine for PTR ( TYPE ) */
600
 
601
#ifndef WRITE_ptr_type
602
 
603
static void WRITE_ptr_type
604
    PROTO_N ( ( x_ ) )
605
    PROTO_T ( PTR ( TYPE ) x_ )
606
{
607
    if ( IS_NULL_ptr ( x_ ) ) {
608
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
609
    } else {
610
	TYPE y_ ;
611
	y_ = DEREF_type ( x_ ) ;
612
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
613
	WRITE_type ( y_ ) ;
614
    }
615
    return ;
616
}
617
 
618
#endif
619
 
620
 
621
/* Disk writing routine for PTR ( ENUM ) */
622
 
623
#ifndef WRITE_ptr_en
624
 
625
static void WRITE_ptr_en
626
    PROTO_N ( ( x_ ) )
627
    PROTO_T ( PTR ( ENUM ) x_ )
628
{
629
    if ( IS_NULL_ptr ( x_ ) ) {
630
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
631
    } else {
632
	ENUM y_ ;
633
	DEREF_en ( x_, y_ ) ;
634
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
635
	WRITE_en ( y_ ) ;
636
    }
637
    return ;
638
}
639
 
640
#endif
641
 
642
 
643
/* Disk writing routine for ENUM */
644
 
645
#ifndef WRITE_en
646
 
647
static void WRITE_en
648
    PROTO_N ( ( x_ ) )
649
    PROTO_T ( ENUM x_ )
650
{
651
    WRITE_CLASS_ID_P ( x_.id ) ;
652
    WRITE_list_ECONST_P ( x_.consts ) ;
653
    WRITE_number ( x_.order ) ;
654
    WRITE_int ( x_.lists ) ;
655
    return ;
656
}
657
 
658
#endif
659
 
660
 
661
/* Disk writing routine for LIST ( PTR ( ECONST ) ) */
662
 
663
#ifndef WRITE_list_ptr_ec
664
 
665
static void WRITE_list_ptr_ec
666
    PROTO_N ( ( x_ ) )
667
    PROTO_T ( LIST ( PTR ( ECONST ) ) x_ )
668
{
669
    while ( !IS_NULL_list ( x_ ) ) {
670
	PTR ( ECONST ) y_ ;
671
	y_ = DEREF_ptr ( HEAD_list ( x_ ) ) ;
672
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
673
	WRITE_ptr_ec ( y_ ) ;
674
	x_ = TAIL_list ( x_ ) ;
675
    }
676
    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
677
    return ;
678
}
679
 
680
#endif
681
 
682
 
683
/* Disk writing routine for PTR ( ECONST ) */
684
 
685
#ifndef WRITE_ptr_ec
686
 
687
static void WRITE_ptr_ec
688
    PROTO_N ( ( x_ ) )
689
    PROTO_T ( PTR ( ECONST ) x_ )
690
{
691
    if ( IS_NULL_ptr ( x_ ) ) {
692
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
693
    } else {
694
	ECONST y_ ;
695
	DEREF_ec ( x_, y_ ) ;
696
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
697
	WRITE_ec ( y_ ) ;
698
    }
699
    return ;
700
}
701
 
702
#endif
703
 
704
 
705
/* Disk writing routine for ECONST */
706
 
707
#ifndef WRITE_ec
708
 
709
static void WRITE_ec
710
    PROTO_N ( ( x_ ) )
711
    PROTO_T ( ECONST x_ )
712
{
713
    WRITE_string ( x_.name ) ;
714
    WRITE_number ( x_.value ) ;
715
    return ;
716
}
717
 
718
#endif
719
 
720
 
721
/* Disk writing routine for PTR ( STRUCTURE ) */
722
 
723
#ifndef WRITE_ptr_str
724
 
725
static void WRITE_ptr_str
726
    PROTO_N ( ( x_ ) )
727
    PROTO_T ( PTR ( STRUCTURE ) x_ )
728
{
729
    if ( IS_NULL_ptr ( x_ ) ) {
730
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
731
    } else {
732
	STRUCTURE y_ ;
733
	DEREF_str ( x_, y_ ) ;
734
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
735
	WRITE_str ( y_ ) ;
736
    }
737
    return ;
738
}
739
 
740
#endif
741
 
742
 
743
/* Disk writing routine for STRUCTURE */
744
 
745
#ifndef WRITE_str
746
 
747
static void WRITE_str
748
    PROTO_N ( ( x_ ) )
749
    PROTO_T ( STRUCTURE x_ )
750
{
751
    WRITE_CLASS_ID_P ( x_.id ) ;
752
    WRITE_STRUCTURE_P ( x_.base ) ;
753
    WRITE_list_COMPONENT_P ( x_.defn ) ;
754
    WRITE_zero_int ( x_.output ) ;
755
    return ;
756
}
757
 
758
#endif
759
 
760
 
761
/* Disk writing routine for LIST ( PTR ( COMPONENT ) ) */
762
 
763
#ifndef WRITE_list_ptr_cmp
764
 
765
static void WRITE_list_ptr_cmp
766
    PROTO_N ( ( x_ ) )
767
    PROTO_T ( LIST ( PTR ( COMPONENT ) ) x_ )
768
{
769
    while ( !IS_NULL_list ( x_ ) ) {
770
	PTR ( COMPONENT ) y_ ;
771
	y_ = DEREF_ptr ( HEAD_list ( x_ ) ) ;
772
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
773
	WRITE_ptr_cmp ( y_ ) ;
774
	x_ = TAIL_list ( x_ ) ;
775
    }
776
    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
777
    return ;
778
}
779
 
780
#endif
781
 
782
 
783
/* Disk writing routine for PTR ( COMPONENT ) */
784
 
785
#ifndef WRITE_ptr_cmp
786
 
787
static void WRITE_ptr_cmp
788
    PROTO_N ( ( x_ ) )
789
    PROTO_T ( PTR ( COMPONENT ) x_ )
790
{
791
    if ( IS_NULL_ptr ( x_ ) ) {
792
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
793
    } else {
794
	COMPONENT y_ ;
795
	DEREF_cmp ( x_, y_ ) ;
796
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
797
	WRITE_cmp ( y_ ) ;
798
    }
799
    return ;
800
}
801
 
802
#endif
803
 
804
 
805
/* Disk writing routine for COMPONENT */
806
 
807
#ifndef WRITE_cmp
808
 
809
static void WRITE_cmp
810
    PROTO_N ( ( x_ ) )
811
    PROTO_T ( COMPONENT x_ )
812
{
813
    WRITE_string ( x_.name ) ;
814
    WRITE_TYPE_P ( x_.type ) ;
815
    WRITE_string ( x_.value ) ;
816
    return ;
817
}
818
 
819
#endif
820
 
821
 
822
/* Disk writing routine for PTR ( UNION ) */
823
 
824
#ifndef WRITE_ptr_un
825
 
826
static void WRITE_ptr_un
827
    PROTO_N ( ( x_ ) )
828
    PROTO_T ( PTR ( UNION ) x_ )
829
{
830
    if ( IS_NULL_ptr ( x_ ) ) {
831
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
832
    } else {
833
	UNION y_ ;
834
	DEREF_un ( x_, y_ ) ;
835
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
836
	WRITE_un ( y_ ) ;
837
    }
838
    return ;
839
}
840
 
841
#endif
842
 
843
 
844
/* Disk writing routine for UNION */
845
 
846
#ifndef WRITE_un
847
 
848
static void WRITE_un
849
    PROTO_N ( ( x_ ) )
850
    PROTO_T ( UNION x_ )
851
{
852
    WRITE_CLASS_ID_P ( x_.id ) ;
853
    WRITE_UNION_P ( x_.base ) ;
854
    WRITE_list_COMPONENT_P ( x_.s_defn ) ;
855
    WRITE_list_FIELD_P ( x_.u_defn ) ;
856
    WRITE_list_MAP_P ( x_.map ) ;
857
    WRITE_int ( x_.no_fields ) ;
858
    return ;
859
}
860
 
861
#endif
862
 
863
 
864
/* Disk writing routine for LIST ( PTR ( FIELD ) ) */
865
 
866
#ifndef WRITE_list_ptr_fld
867
 
868
static void WRITE_list_ptr_fld
869
    PROTO_N ( ( x_ ) )
870
    PROTO_T ( LIST ( PTR ( FIELD ) ) x_ )
871
{
872
    while ( !IS_NULL_list ( x_ ) ) {
873
	PTR ( FIELD ) y_ ;
874
	y_ = DEREF_ptr ( HEAD_list ( x_ ) ) ;
875
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
876
	WRITE_ptr_fld ( y_ ) ;
877
	x_ = TAIL_list ( x_ ) ;
878
    }
879
    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
880
    return ;
881
}
882
 
883
#endif
884
 
885
 
886
/* Disk writing routine for PTR ( FIELD ) */
887
 
888
#ifndef WRITE_ptr_fld
889
 
890
static void WRITE_ptr_fld
891
    PROTO_N ( ( x_ ) )
892
    PROTO_T ( PTR ( FIELD ) x_ )
893
{
894
    if ( IS_NULL_ptr ( x_ ) ) {
895
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
896
    } else {
897
	FIELD y_ ;
898
	DEREF_fld ( x_, y_ ) ;
899
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
900
	WRITE_fld ( y_ ) ;
901
    }
902
    return ;
903
}
904
 
905
#endif
906
 
907
 
908
/* Disk writing routine for FIELD */
909
 
910
#ifndef WRITE_fld
911
 
912
static void WRITE_fld
913
    PROTO_N ( ( x_ ) )
914
    PROTO_T ( FIELD x_ )
915
{
916
    WRITE_string ( x_.name ) ;
917
    WRITE_int ( x_.tag ) ;
918
    WRITE_int ( x_.flag ) ;
919
    WRITE_int ( x_.set ) ;
920
    WRITE_FIELD_P ( x_.base ) ;
921
    WRITE_list_COMPONENT_P ( x_.defn ) ;
922
    return ;
923
}
924
 
925
#endif
926
 
927
 
928
/* Disk writing routine for LIST ( PTR ( MAP ) ) */
929
 
930
#ifndef WRITE_list_ptr_map
931
 
932
static void WRITE_list_ptr_map
933
    PROTO_N ( ( x_ ) )
934
    PROTO_T ( LIST ( PTR ( MAP ) ) x_ )
935
{
936
    while ( !IS_NULL_list ( x_ ) ) {
937
	PTR ( MAP ) y_ ;
938
	y_ = DEREF_ptr ( HEAD_list ( x_ ) ) ;
939
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
940
	WRITE_ptr_map ( y_ ) ;
941
	x_ = TAIL_list ( x_ ) ;
942
    }
943
    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
944
    return ;
945
}
946
 
947
#endif
948
 
949
 
950
/* Disk writing routine for PTR ( MAP ) */
951
 
952
#ifndef WRITE_ptr_map
953
 
954
static void WRITE_ptr_map
955
    PROTO_N ( ( x_ ) )
956
    PROTO_T ( PTR ( MAP ) x_ )
957
{
958
    if ( IS_NULL_ptr ( x_ ) ) {
959
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
960
    } else {
961
	MAP y_ ;
962
	DEREF_map ( x_, y_ ) ;
963
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
964
	WRITE_map ( y_ ) ;
965
    }
966
    return ;
967
}
968
 
969
#endif
970
 
971
 
972
/* Disk writing routine for MAP */
973
 
974
#ifndef WRITE_map
975
 
976
static void WRITE_map
977
    PROTO_N ( ( x_ ) )
978
    PROTO_T ( MAP x_ )
979
{
980
    WRITE_string ( x_.name ) ;
981
    WRITE_int ( x_.flag ) ;
982
    WRITE_TYPE_P ( x_.ret_type ) ;
983
    WRITE_list_ARGUMENT_P ( x_.args ) ;
984
    return ;
985
}
986
 
987
#endif
988
 
989
 
990
/* Disk writing routine for LIST ( PTR ( ARGUMENT ) ) */
991
 
992
#ifndef WRITE_list_ptr_arg
993
 
994
static void WRITE_list_ptr_arg
995
    PROTO_N ( ( x_ ) )
996
    PROTO_T ( LIST ( PTR ( ARGUMENT ) ) x_ )
997
{
998
    while ( !IS_NULL_list ( x_ ) ) {
999
	PTR ( ARGUMENT ) y_ ;
1000
	y_ = DEREF_ptr ( HEAD_list ( x_ ) ) ;
1001
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
1002
	WRITE_ptr_arg ( y_ ) ;
1003
	x_ = TAIL_list ( x_ ) ;
1004
    }
1005
    WRITE_BITS ( 1, ( unsigned ) 0 ) ;
1006
    return ;
1007
}
1008
 
1009
#endif
1010
 
1011
 
1012
/* Disk writing routine for PTR ( ARGUMENT ) */
1013
 
1014
#ifndef WRITE_ptr_arg
1015
 
1016
static void WRITE_ptr_arg
1017
    PROTO_N ( ( x_ ) )
1018
    PROTO_T ( PTR ( ARGUMENT ) x_ )
1019
{
1020
    if ( IS_NULL_ptr ( x_ ) ) {
1021
	WRITE_BITS ( 1, ( unsigned ) 0 ) ;
1022
    } else {
1023
	ARGUMENT y_ ;
1024
	DEREF_arg ( x_, y_ ) ;
1025
	WRITE_BITS ( 1, ( unsigned ) 1 ) ;
1026
	WRITE_arg ( y_ ) ;
1027
    }
1028
    return ;
1029
}
1030
 
1031
#endif
1032
 
1033
 
1034
/* Disk writing routine for ARGUMENT */
1035
 
1036
#ifndef WRITE_arg
1037
 
1038
static void WRITE_arg
1039
    PROTO_N ( ( x_ ) )
1040
    PROTO_T ( ARGUMENT x_ )
1041
{
1042
    WRITE_string ( x_.name ) ;
1043
    WRITE_TYPE_P ( x_.type ) ;
1044
    return ;
1045
}
1046
 
1047
#endif
1048
 
1049
 
1050
#endif