]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/compiler/back-ends/c-gen/rules2.c
Security-54.1.7.tar.gz
[apple/security.git] / SecuritySNACCRuntime / compiler / back-ends / c-gen / rules2.c
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 /*
20 * compiler/back-ends/c-gen/rules.c - initialized c rule structure
21 * inits a table that contains info about
22 * converting each ASN.1 type to C type
23 * Copyright (C) 1991, 1992 Michael Sample
24 * and the University of British Columbia
25 *
26 * This program is free software; you can redistribute it and/or modify
27 * it under the terms of the GNU General Public License as published by
28 * the Free Software Foundation; either version 2 of the License, or
29 * (at your option) any later version.
30 *
31 * $Header: /cvs/root/Security/SecuritySNACCRuntime/compiler/back-ends/c-gen/Attic/rules2.c,v 1.1.1.1 2001/05/18 23:14:09 mb Exp $
32 * $Log: rules2.c,v $
33 * Revision 1.1.1.1 2001/05/18 23:14:09 mb
34 * Move from private repository to open source repository
35 *
36 * Revision 1.2 2001/05/05 00:59:28 rmurphy
37 * Adding darwin license headers
38 *
39 * Revision 1.1.1.1 1999/03/16 18:06:44 aram
40 * Originals from SMIME Free Library.
41 *
42 * Revision 1.3 1995/07/25 18:46:34 rj
43 * file name has been shortened for redundant part: c-gen/c-rules -> c-gen/rules.
44 *
45 * Revision 1.2 1994/09/01 00:24:35 rj
46 * snacc_config.h removed.
47 *
48 * Revision 1.1 1994/08/28 09:48:35 rj
49 * first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
50 *
51 */
52
53 #include "asn-incl.h"
54 #include "asn1module.h"
55 #include "rules.h"
56
57 /*
58 * (see rule.h and asn1module.h)
59 *
60 */
61
62
63 CRules cRulesG =
64 {
65 4,
66 "choiceId",
67 "ChoiceId",
68 "a",
69 "ChoiceUnion",
70 TRUE,
71 "Print",
72 "Enc",
73 "Dec",
74 "Free",
75 {
76 {
77 BASICTYPE_UNKNOWN,
78 C_NO_TYPE,
79 NULL,
80 FALSE,
81 FALSE,
82 FALSE,
83 FALSE,
84 FALSE,
85 FALSE,
86 "NOT_NULL",
87 "unknown",
88 NULL,
89 NULL,
90 NULL,
91 NULL,
92 FALSE,
93 FALSE,
94 FALSE,
95 FALSE,
96 FALSE
97 },
98 {
99 BASICTYPE_BOOLEAN,
100 C_LIB,
101 "AsnBool",
102 FALSE,
103 TRUE,
104 FALSE,
105 FALSE,
106 FALSE,
107 TRUE,
108 "NOT_NULL",
109 "bool",
110 "PrintAsnBool",
111 "EncAsnBool",
112 "DecAsnBool",
113 "FreeAsnBool",
114 TRUE,
115 TRUE,
116 TRUE,
117 TRUE,
118 TRUE
119 },
120 {
121 BASICTYPE_INTEGER,
122 C_LIB,
123 "AsnInt",
124 FALSE,
125 TRUE,
126 FALSE,
127 FALSE,
128 FALSE,
129 TRUE,
130 "NOT_NULL",
131 "int",
132 "PrintAsnInt",
133 "EncAsnInt",
134 "DecAsnInt",
135 "FreeAsnInt",
136 TRUE,
137 TRUE,
138 TRUE,
139 TRUE,
140 TRUE
141 },
142 {
143 BASICTYPE_BITSTRING,
144 C_LIB,
145 "AsnBits",
146 FALSE,
147 TRUE,
148 FALSE,
149 FALSE,
150 TRUE,
151 FALSE,
152 "ASNBITS_PRESENT",
153 "bits",
154 "PrintAsnBits",
155 "EncAsnBits",
156 "DecAsnBits",
157 "FreeAsnBits",
158 TRUE,
159 TRUE,
160 TRUE,
161 TRUE,
162 TRUE
163 },
164 {
165 BASICTYPE_OCTETSTRING,
166 C_LIB,
167 "AsnOcts",
168 FALSE,
169 TRUE,
170 FALSE,
171 FALSE,
172 TRUE,
173 FALSE,
174 "ASNOCTS_PRESENT",
175 "octs",
176 "PrintAsnOcts",
177 "EncAsnOcts",
178 "DecAsnOcts",
179 "FreeAsnOcts",
180 TRUE,
181 TRUE,
182 TRUE,
183 TRUE,
184 TRUE
185 },
186 {
187 BASICTYPE_NULL,
188 C_LIB,
189 "AsnNull",
190 FALSE,
191 TRUE,
192 FALSE,
193 FALSE,
194 FALSE,
195 TRUE,
196 "NOT_NULL",
197 "null",
198 "PrintAsnNull",
199 "EncAsnNull",
200 "DecAsnNull",
201 "FreeAsnNull",
202 TRUE,
203 TRUE,
204 TRUE,
205 TRUE,
206 TRUE
207 },
208 {
209 BASICTYPE_OID,
210 C_LIB,
211 "AsnOid",
212 FALSE,
213 TRUE,
214 FALSE,
215 FALSE,
216 TRUE,
217 FALSE,
218 "ASNOID_PRESENT",
219 "oid",
220 "PrintAsnOid",
221 "EncAsnOid",
222 "DecAsnOid",
223 "FreeAsnOid",
224 TRUE,
225 TRUE,
226 TRUE,
227 TRUE,
228 TRUE
229 },
230 {
231 BASICTYPE_REAL,
232 C_LIB,
233 "AsnReal",
234 FALSE,
235 TRUE,
236 FALSE,
237 FALSE,
238 FALSE,
239 TRUE,
240 "NOT_NULL",
241 "real",
242 "PrintAsnReal",
243 "EncAsnReal",
244 "DecAsnReal",
245 "FreeAsnReal",
246 TRUE,
247 TRUE,
248 TRUE,
249 TRUE,
250 TRUE
251 },
252 {
253 BASICTYPE_ENUMERATED,
254 C_LIB,
255 "enum",
256 FALSE,
257 TRUE,
258 FALSE,
259 FALSE,
260 FALSE,
261 TRUE,
262 "NOT_NULL",
263 "enum",
264 "PrintAsnEnum",
265 "EncAsnEnum",
266 "DecAsnEnum",
267 "FreeAsnEnum",
268 TRUE,
269 TRUE,
270 TRUE,
271 TRUE,
272 TRUE
273 },
274 {
275 BASICTYPE_SEQUENCE,
276 C_STRUCT,
277 "struct",
278 FALSE,
279 TRUE,
280 FALSE,
281 TRUE,
282 TRUE,
283 TRUE,
284 "NOT_NULL",
285 "seq",
286 NULL,
287 NULL,
288 NULL,
289 NULL,
290 TRUE,
291 TRUE,
292 TRUE,
293 TRUE,
294 TRUE
295 },
296 {
297 BASICTYPE_SEQUENCEOF,
298 C_LIST,
299 "AsnList",
300 FALSE,
301 TRUE,
302 FALSE,
303 TRUE,
304 TRUE,
305 TRUE,
306 "NOT_NULL",
307 "list",
308 NULL,
309 NULL,
310 NULL,
311 NULL,
312 TRUE,
313 TRUE,
314 TRUE,
315 TRUE,
316 TRUE
317 },
318 {
319 BASICTYPE_SET,
320 C_STRUCT,
321 "struct",
322 FALSE,
323 TRUE,
324 FALSE,
325 TRUE,
326 TRUE,
327 TRUE,
328 "NOT_NULL",
329 "set",
330 NULL,
331 NULL,
332 NULL,
333 NULL,
334 TRUE,
335 TRUE,
336 TRUE,
337 TRUE,
338 TRUE
339 },
340 {
341 BASICTYPE_SETOF,
342 C_LIST,
343 "AsnList",
344 FALSE,
345 TRUE,
346 FALSE,
347 TRUE,
348 TRUE,
349 TRUE,
350 "NOT_NULL",
351 "list",
352 NULL,
353 NULL,
354 NULL,
355 NULL,
356 TRUE,
357 TRUE,
358 TRUE,
359 TRUE,
360 TRUE
361 },
362 {
363 BASICTYPE_CHOICE,
364 C_CHOICE,
365 NULL,
366 FALSE,
367 TRUE,
368 FALSE,
369 TRUE,
370 TRUE,
371 TRUE,
372 "NOT_NULL",
373 "choice",
374 NULL,
375 NULL,
376 NULL,
377 NULL,
378 TRUE,
379 TRUE,
380 TRUE,
381 TRUE,
382 TRUE
383 },
384 {
385 BASICTYPE_SELECTION,
386 C_NO_TYPE,
387 NULL,
388 FALSE,
389 TRUE,
390 FALSE,
391 FALSE,
392 FALSE,
393 FALSE,
394 "NOT_NULL",
395 "selection",
396 NULL,
397 NULL,
398 NULL,
399 NULL,
400 TRUE,
401 TRUE,
402 TRUE,
403 TRUE,
404 TRUE
405 },
406 {
407 BASICTYPE_COMPONENTSOF,
408 C_NO_TYPE,
409 NULL,
410 FALSE,
411 TRUE,
412 FALSE,
413 FALSE,
414 FALSE,
415 FALSE,
416 "NOT_NULL",
417 "compsOf",
418 NULL,
419 NULL,
420 NULL,
421 NULL,
422 TRUE,
423 TRUE,
424 TRUE,
425 TRUE,
426 TRUE
427 },
428 {
429 BASICTYPE_ANY,
430 C_ANY,
431 "AsnAny",
432 FALSE,
433 TRUE,
434 FALSE,
435 FALSE,
436 FALSE,
437 FALSE,
438 "NOT_NULL",
439 "any",
440 "PrintAsnAny",
441 "EncAsnAny",
442 "DecAsnAny",
443 "FreeAsnAny",
444 TRUE,
445 TRUE,
446 TRUE,
447 TRUE,
448 TRUE
449 },
450 {
451 BASICTYPE_ANYDEFINEDBY,
452 C_ANYDEFINEDBY,
453 "AsnAnyDefinedBy",
454 FALSE,
455 TRUE,
456 FALSE,
457 FALSE,
458 FALSE,
459 FALSE,
460 "NOT_NULL",
461 "anyDefBy",
462 "PrintAsnAnyDefinedBy",
463 "EncAsnAnyDefinedBy",
464 "DecAsnAnyDefinedBy",
465 "FreeAsnAnyDefinedBy",
466 TRUE,
467 TRUE,
468 TRUE,
469 TRUE,
470 TRUE
471 },
472 {
473 BASICTYPE_LOCALTYPEREF,
474 C_TYPEREF,
475 NULL,
476 FALSE,
477 TRUE,
478 FALSE,
479 FALSE,
480 FALSE,
481 FALSE,
482 "NOT_NULL",
483 "t",
484 NULL,
485 NULL,
486 NULL,
487 NULL,
488 TRUE,
489 TRUE,
490 TRUE,
491 TRUE,
492 TRUE
493 },
494 {
495 BASICTYPE_IMPORTTYPEREF,
496 C_TYPEREF,
497 NULL,
498 FALSE,
499 TRUE,
500 FALSE,
501 FALSE,
502 FALSE,
503 FALSE,
504 "NOT_NULL",
505 "t",
506 NULL,
507 NULL,
508 NULL,
509 NULL,
510 TRUE,
511 TRUE,
512 TRUE,
513 TRUE,
514 TRUE
515 },
516 {
517 BASICTYPE_MACROTYPE,
518 C_NO_TYPE,
519 NULL,
520 FALSE,
521 FALSE,
522 FALSE,
523 FALSE,
524 FALSE,
525 FALSE,
526 "NOT_NULL",
527 "macroType",
528 NULL,
529 NULL,
530 NULL,
531 NULL,
532 FALSE,
533 FALSE,
534 FALSE,
535 FALSE,
536 FALSE
537 },
538 {
539 BASICTYPE_MACRODEF,
540 C_NO_TYPE,
541 NULL,
542 FALSE,
543 FALSE,
544 FALSE,
545 FALSE,
546 FALSE,
547 FALSE,
548 "NOT_NULL",
549 "macroDef",
550 NULL,
551 NULL,
552 NULL,
553 NULL,
554 FALSE,
555 FALSE,
556 FALSE,
557 FALSE,
558 FALSE
559 }
560 }
561 };