blob: 0ca5c0b825fc6008b30c0f99658a8f5472c92887 [file] [log] [blame]
Lev Walkin12984672004-09-24 21:00:15 +00001/*-
Lev Walkin2655eb32013-03-25 19:09:04 -07002 * Copyright (c) 2003, 2004, 2005, 2006, 2013
Lev Walkinc0d04912005-02-25 12:52:27 +00003 * Lev Walkin <vlm@lionet.info>. All rights reserved.
Lev Walkin12984672004-09-24 21:00:15 +00004 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id$
27 */
Lev Walkinf15320b2004-06-03 03:38:44 +000028/*
29 * This is the program that connects the libasn1* libraries together.
30 * It uses them in turn to parse, fix and then compile or print the ASN.1 tree.
31 */
Lev Walkinc0d04912005-02-25 12:52:27 +000032#include "sys-common.h"
Lev Walkinf15320b2004-06-03 03:38:44 +000033
Lev Walkinfb872bd2006-03-18 06:53:11 +000034#undef COPYRIGHT
35#define COPYRIGHT \
36 "Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin <vlm@lionet.info>\n"
37
Lev Walkinf15320b2004-06-03 03:38:44 +000038#include <asn1parser.h> /* Parse the ASN.1 file and build a tree */
39#include <asn1fix.h> /* Fix the ASN.1 tree */
40#include <asn1print.h> /* Print the ASN.1 tree */
41#include <asn1compiler.h> /* Compile the ASN.1 tree */
42
Lev Walkin79f54952004-08-13 16:58:19 +000043#include <asn1c_compat.h> /* Portable basename(3) and dirname(3) */
44
Lev Walkin93659562010-11-20 09:47:13 -080045#ifdef _WIN32
Lev Walkin46499872006-03-06 13:05:34 +000046#include <io.h>
47#include <direct.h>
48#else
49#include <dirent.h>
50#endif
51
Lev Walkinc0d04912005-02-25 12:52:27 +000052static void usage(const char *av0); /* Print the Usage screen and exit */
Lev Walkin46499872006-03-06 13:05:34 +000053static int importStandardModules(asn1p_t *asn, const char *skeletons_dir);
Lev Walkincbf218f2004-08-20 13:24:38 +000054
Lev Walkinf15320b2004-06-03 03:38:44 +000055int
56main(int ac, char **av) {
Lev Walkin7415bff2004-08-16 11:38:13 +000057 enum asn1p_flags asn1_parser_flags = A1P_NOFLAGS;
58 enum asn1f_flags asn1_fixer_flags = A1F_NOFLAGS;
Lev Walkincbf218f2004-08-20 13:24:38 +000059 enum asn1c_flags asn1_compiler_flags= A1C_NO_C99;
Lev Walkinab4bb292004-08-18 04:52:48 +000060 enum asn1print_flags asn1_printer_flags = APF_NOFLAGS;
Lev Walkinf15320b2004-06-03 03:38:44 +000061 int print_arg__print_out = 0; /* Don't compile, just print parsed */
62 int print_arg__fix_n_print = 0; /* Fix and print */
Lev Walkinf15320b2004-06-03 03:38:44 +000063 int warnings_as_errors = 0; /* Treat warnings as errors */
64 char *skeletons_dir = NULL; /* Directory with supplementary stuff */
65 asn1p_t *asn = 0; /* An ASN.1 parsed tree */
66 int ret; /* Return value from misc functions */
67 int ch; /* Command line character */
68 int i; /* Index in some loops */
69
70 /*
71 * Process command-line options.
72 */
Lev Walkin59b176e2005-11-26 11:25:14 +000073 while((ch = getopt(ac, av, "EFf:g:hLPp:RS:vW:X")) != -1)
Lev Walkinf15320b2004-06-03 03:38:44 +000074 switch(ch) {
75 case 'E':
76 print_arg__print_out = 1;
77 break;
78 case 'F':
79 print_arg__fix_n_print = 1;
80 break;
81 case 'f':
Lev Walkindd32b592004-09-06 08:07:29 +000082 if(strcmp(optarg, "all-defs-global") == 0) {
83 asn1_compiler_flags |= A1C_ALL_DEFS_GLOBAL;
84 } else if(strcmp(optarg, "bless-SIZE") == 0) {
85 asn1_fixer_flags |= A1F_EXTENDED_SizeConstraint;
Lev Walkin21d00002005-03-04 08:48:53 +000086 } else if(strcmp(optarg, "compound-names") == 0) {
87 asn1_compiler_flags |= A1C_COMPOUND_NAMES;
Lev Walkin72a0f5a2005-07-24 08:28:39 +000088 } else if(strcmp(optarg, "indirect-choice") == 0) {
89 asn1_compiler_flags |= A1C_INDIRECT_CHOICE;
Lev Walkin5555d532004-06-28 21:21:45 +000090 } else if(strncmp(optarg, "known-extern-type=", 18) == 0) {
91 char *known_type = optarg + 18;
92 ret = asn1f_make_known_external_type(known_type);
93 assert(ret == 0 || errno == EEXIST);
Lev Walkin46499872006-03-06 13:05:34 +000094 } else if(strcmp(optarg, "native-types") == 0) {
Lev Walkin2a744a72013-03-27 01:56:23 -070095 fprintf(stderr, "-f%s: Deprecated option\n", optarg);
96 asn1_compiler_flags &= ~A1C_USE_WIDE_TYPES;
97 } else if(strcmp(optarg, "wide-types") == 0) {
98 asn1_compiler_flags |= A1C_USE_WIDE_TYPES;
Lev Walkin4062b012013-10-11 14:29:38 -070099 } else if(strcmp(optarg, "line-refs") == 0) {
100 asn1_compiler_flags |= A1C_LINE_REFS;
Lev Walkin4e940a02004-09-26 13:13:13 +0000101 } else if(strcmp(optarg, "no-constraints") == 0) {
102 asn1_compiler_flags |= A1C_NO_CONSTRAINTS;
Lev Walkinb9b8b952005-03-05 00:33:27 +0000103 } else if(strcmp(optarg, "no-include-deps") == 0) {
104 asn1_compiler_flags |= A1C_NO_INCLUDE_DEPS;
Lev Walkin34944f22010-10-07 08:25:37 +0000105 } else if(strcmp(optarg, "includes-quoted") == 0) {
106 asn1_compiler_flags |= A1C_INCLUDES_QUOTED;
Lev Walkindd32b592004-09-06 08:07:29 +0000107 } else if(strcmp(optarg, "unnamed-unions") == 0) {
108 asn1_compiler_flags |= A1C_UNNAMED_UNIONS;
Lev Walkin2655eb32013-03-25 19:09:04 -0700109 } else if(strcmp(optarg, "skeletons-copy") == 0) {
110 fprintf(stderr, "-f%s: Deprecated option\n", optarg);
Lev Walkin2a744a72013-03-27 01:56:23 -0700111 asn1_compiler_flags &= ~A1C_LINK_SKELETONS;
Lev Walkin2655eb32013-03-25 19:09:04 -0700112 } else if(strcmp(optarg, "link-skeletons") == 0) {
113 asn1_compiler_flags |= A1C_LINK_SKELETONS;
Lev Walkinf15320b2004-06-03 03:38:44 +0000114 } else {
115 fprintf(stderr, "-f%s: Invalid argument\n", optarg);
116 exit(EX_USAGE);
117 }
118 break;
Lev Walkin59b176e2005-11-26 11:25:14 +0000119 case 'g':
120 if(strcmp(optarg, "en-PER") == 0) {
121 asn1_compiler_flags |= A1C_GEN_PER;
122 } else {
123 fprintf(stderr, "-g%s: Invalid argument\n", optarg);
124 exit(EX_USAGE);
125 }
126 break;
Lev Walkincbf218f2004-08-20 13:24:38 +0000127 case 'h':
128 usage(av[0]);
Lev Walkinf15320b2004-06-03 03:38:44 +0000129 case 'P':
130 asn1_compiler_flags |= A1C_PRINT_COMPILED;
Lev Walkincbf218f2004-08-20 13:24:38 +0000131 asn1_compiler_flags &= ~A1C_NO_C99;
Lev Walkinf15320b2004-06-03 03:38:44 +0000132 break;
Lev Walkinab4bb292004-08-18 04:52:48 +0000133 case 'p':
Lev Walkin59b176e2005-11-26 11:25:14 +0000134 if(strncmp(optarg, "du=", 3) == 0) {
135 char *pduname = optarg + 3;
Lev Walkin66adab42006-09-23 02:52:12 +0000136 if(strcmp(pduname, "all") == 0) {
137 asn1_compiler_flags |= A1C_PDU_ALL;
138 } else if(strcmp(pduname, "auto") == 0) {
139 asn1_compiler_flags |= A1C_PDU_AUTO;
140 } else if(pduname[0] >= 'A' && pduname[0] <= 'Z') {
141 asn1c__add_pdu_type(pduname);
142 asn1_compiler_flags |= A1C_PDU_TYPE;
143 } else {
144 fprintf(stderr, "-pdu=%s"
145 ": expected -pdu={all|auto|Type}\n",
Lev Walkin59b176e2005-11-26 11:25:14 +0000146 pduname);
147 exit(EX_USAGE);
148 }
Lev Walkind370e9f2006-03-16 10:03:35 +0000149 } else if(strcmp(optarg, "rint-class-matrix") == 0) {
150 asn1_printer_flags |= APF_PRINT_CLASS_MATRIX;
Lev Walkin59b176e2005-11-26 11:25:14 +0000151 } else if(strcmp(optarg, "rint-constraints") == 0) {
Lev Walkind370e9f2006-03-16 10:03:35 +0000152 asn1_printer_flags |= APF_PRINT_CONSTRAINTS;
Lev Walkincbf218f2004-08-20 13:24:38 +0000153 } else if(strcmp(optarg, "rint-lines") == 0) {
154 asn1_printer_flags |= APF_LINE_COMMENTS;
Lev Walkinab4bb292004-08-18 04:52:48 +0000155 } else {
156 fprintf(stderr, "-p%s: Invalid argument\n", optarg);
157 exit(EX_USAGE);
158 }
159 break;
Lev Walkinf15320b2004-06-03 03:38:44 +0000160 case 'R':
161 asn1_compiler_flags |= A1C_OMIT_SUPPORT_CODE;
162 break;
163 case 'S':
164 skeletons_dir = optarg;
165 break;
Lev Walkincbf218f2004-08-20 13:24:38 +0000166 case 'v':
167 fprintf(stderr, "ASN.1 Compiler, v" VERSION "\n" COPYRIGHT);
168 exit(0);
169 break;
Lev Walkinf15320b2004-06-03 03:38:44 +0000170 case 'W':
171 if(strcmp(optarg, "error") == 0) {
172 warnings_as_errors = 1;
173 break;
174 } else if(strcmp(optarg, "debug-lexer") == 0) {
175 asn1_parser_flags |= A1P_LEXER_DEBUG;
176 break;
177 } else if(strcmp(optarg, "debug-fixer") == 0) {
178 asn1_fixer_flags |= A1F_DEBUG;
179 break;
180 } else if(strcmp(optarg, "debug-compiler") == 0) {
181 asn1_compiler_flags |= A1C_DEBUG;
182 break;
183 } else {
184 fprintf(stderr, "-W%s: Invalid argument\n", optarg);
185 exit(EX_USAGE);
186 }
187 break;
Lev Walkinf7484512004-10-13 09:13:56 +0000188 case 'X':
189 print_arg__print_out = 1; /* Implicit -E */
190 print_arg__fix_n_print = 1; /* Implicit -F */
191 asn1_printer_flags |= APF_PRINT_XML_DTD;
192 break;
Lev Walkinf15320b2004-06-03 03:38:44 +0000193 default:
194 usage(av[0]);
195 }
196
197 /*
198 * Validate the options combination.
199 */
200 if(!print_arg__print_out) {
201 if(print_arg__fix_n_print) {
202 fprintf(stderr, "Error: -F requires -E\n");
203 exit(EX_USAGE);
204 }
Lev Walkinab4bb292004-08-18 04:52:48 +0000205 if(asn1_printer_flags) {
206 fprintf(stderr, "Error: "
Lev Walkincbf218f2004-08-20 13:24:38 +0000207 "-print-... arguments require -E\n");
Lev Walkinab4bb292004-08-18 04:52:48 +0000208 exit(EX_USAGE);
209 }
Lev Walkinf15320b2004-06-03 03:38:44 +0000210 }
211
212 /*
213 * Ensure that there are some input files present.
214 */
215 if(ac > optind) {
216 ac -= optind;
217 av += optind;
218 } else {
Lev Walkinbf430382005-11-05 12:28:16 +0000219 char *bin_name = a1c_basename(av[0]);
220 fprintf(stderr, "%s: No input files specified. "
221 "Try '%s -h' for more information\n",
222 bin_name, bin_name);
Lev Walkinf15320b2004-06-03 03:38:44 +0000223 exit(1);
224 }
225
226 /*
Lev Walkin46499872006-03-06 13:05:34 +0000227 * Make sure the skeleton directory is out there.
228 */
229 if(skeletons_dir == NULL) {
230 struct stat sb;
231 skeletons_dir = DATADIR;
232 if((av[-optind][0] == '.' || av[-optind][1] == '/')
233 && stat(skeletons_dir, &sb)) {
234 /*
235 * The default skeletons directory does not exist,
236 * compute it from my file name:
237 * ./asn1c/asn1c -> ./skeletons
238 */
239 char *p;
240 size_t len;
241
242 p = a1c_dirname(av[-optind]);
243
244 len = strlen(p) + sizeof("/../skeletons");
245 skeletons_dir = malloc(len);
246 assert(skeletons_dir);
247 snprintf(skeletons_dir, len, "%s/../skeletons", p);
248 if(stat(skeletons_dir, &sb)) {
249 fprintf(stderr,
250 "WARNING: skeletons are neither in "
251 "\"%s\" nor in \"%s\"!\n",
252 DATADIR, skeletons_dir);
253 if(warnings_as_errors)
254 exit(EX_OSFILE);
255 }
256 }
257 }
258
259 /*
Lev Walkinf15320b2004-06-03 03:38:44 +0000260 * Iterate over input files and parse each.
261 * All syntax trees from all files will be bundled together.
262 */
263 for(i = 0; i < ac; i++) {
264 asn1p_t *new_asn;
265
266 new_asn = asn1p_parse_file(av[i], asn1_parser_flags);
267 if(new_asn == NULL) {
268 fprintf(stderr, "Cannot parse \"%s\"\n", av[i]);
269 exit(EX_DATAERR);
270 }
271
272 /*
273 * Bundle the parsed tree with existing one.
274 */
275 if(asn) {
276 asn1p_module_t *mod;
277 while((mod = TQ_REMOVE(&(new_asn->modules), mod_next)))
278 TQ_ADD(&(asn->modules), mod, mod_next);
Lev Walkinf6fc04b2006-09-12 05:22:12 +0000279 asn1p_delete(new_asn);
Lev Walkinf15320b2004-06-03 03:38:44 +0000280 } else {
281 asn = new_asn;
282 }
Lev Walkinf15320b2004-06-03 03:38:44 +0000283 }
284
Lev Walkin46499872006-03-06 13:05:34 +0000285 /* These are mostly notes for the human readers */
286 assert(asn);
287 assert(skeletons_dir);
288
Lev Walkinf15320b2004-06-03 03:38:44 +0000289 /*
Lev Walkin7415bff2004-08-16 11:38:13 +0000290 * Dump the parsed ASN.1 tree if -E specified and -F is NOT given.
Lev Walkinf15320b2004-06-03 03:38:44 +0000291 */
292 if(print_arg__print_out && !print_arg__fix_n_print) {
Lev Walkinab4bb292004-08-18 04:52:48 +0000293 if(asn1print(asn, asn1_printer_flags))
Lev Walkinf15320b2004-06-03 03:38:44 +0000294 exit(EX_SOFTWARE);
295 return 0;
296 }
297
Lev Walkin46499872006-03-06 13:05:34 +0000298 /*
299 * Read in the files from skeletons/standard-modules
300 */
301 if(importStandardModules(asn, skeletons_dir)) {
302 if(warnings_as_errors)
303 exit(EX_DATAERR);
304 }
Lev Walkinf15320b2004-06-03 03:38:44 +0000305
306 /*
307 * Process the ASN.1 specification: perform semantic checks,
308 * expand references, etc, etc.
309 * This function will emit necessary warnings and error messages.
310 */
311 ret = asn1f_process(asn, asn1_fixer_flags,
312 NULL /* default fprintf(stderr) */);
313 switch(ret) {
314 case 1:
315 if(!warnings_as_errors)
316 /* Fall through */
317 case 0:
318 break; /* All clear */
319 case -1:
320 exit(EX_DATAERR); /* Fatal failure */
321 }
322
323 /*
324 * Dump the parsed ASN.1 tree if -E specified and -F is given.
325 */
326 if(print_arg__print_out && print_arg__fix_n_print) {
Lev Walkinab4bb292004-08-18 04:52:48 +0000327 if(asn1print(asn, asn1_printer_flags))
Lev Walkinf15320b2004-06-03 03:38:44 +0000328 exit(EX_SOFTWARE);
329 return 0;
330 }
331
332 /*
Lev Walkinf15320b2004-06-03 03:38:44 +0000333 * Compile the ASN.1 tree into a set of source files
334 * of another language.
335 */
Lev Walkin866cff12005-03-05 00:50:53 +0000336 if(asn1_compile(asn, skeletons_dir, asn1_compiler_flags,
Lev Walkin8253ea92006-03-17 01:47:57 +0000337 ac + optind, optind - 1, av - optind)) {
Lev Walkinf15320b2004-06-03 03:38:44 +0000338 exit(EX_SOFTWARE);
339 }
340
Lev Walkincbad2512005-03-24 16:27:02 +0000341 return 0;
Lev Walkinf15320b2004-06-03 03:38:44 +0000342}
343
344/*
Lev Walkin46499872006-03-06 13:05:34 +0000345 * Parse and import *.asn1 from skeletons/standard-modules
346 */
347static int
348importStandardModules(asn1p_t *asn, const char *skeletons_dir) {
349 asn1p_t *new_asn;
350 asn1p_module_t *mod;
351 const char *filename;
Lev Walkin20a7bf42006-03-17 00:20:52 +0000352 char *fullname;
Lev Walkin46499872006-03-06 13:05:34 +0000353 char *target_dir;
354 int target_dir_len;
355 int len;
Lev Walkin93659562010-11-20 09:47:13 -0800356#ifdef _WIN32
Lev Walkin46499872006-03-06 13:05:34 +0000357 intptr_t dir;
358 struct _finddata_t c_file;
359 char *pattern;
360#else
361 struct dirent *dp;
362 DIR *dir;
363#endif
364 int ret = 0;
365
366 /* Notes for the human reader */
367 assert(asn);
368 assert(skeletons_dir);
369
370 /*
371 * Figure out the standard-modules directory.
372 */
373 target_dir_len = strlen(skeletons_dir)
374 + sizeof("/standard-modules") - 1;
375 target_dir = malloc(target_dir_len + 1);
376 assert(target_dir);
377 snprintf(target_dir, target_dir_len + 1, "%s/standard-modules",
378 skeletons_dir);
379
Lev Walkin93659562010-11-20 09:47:13 -0800380#ifdef _WIN32
Lev Walkinc4b2be52006-03-16 22:23:57 +0000381 len = target_dir_len + sizeof("/*.asn1");
Lev Walkin46499872006-03-06 13:05:34 +0000382 pattern = malloc(len);
383 assert(pattern);
384 snprintf(pattern, len, "%s/*.asn1", target_dir);
385 dir = _findfirst(pattern, &c_file);
Lev Walkin20a7bf42006-03-17 00:20:52 +0000386 if(dir == -1L) {
Lev Walkin46499872006-03-06 13:05:34 +0000387#else
388 dir = opendir(target_dir);
389 if(!dir) {
390#endif
391 fprintf(stderr,
392 "WARNING: Cannot find standard modules in %s\n",
393 target_dir);
394 return -1;
395 }
396
Lev Walkin93659562010-11-20 09:47:13 -0800397#ifdef _WIN32
Lev Walkin46499872006-03-06 13:05:34 +0000398 do {
399 filename = c_file.name;
400#else
401 while((dp = readdir(dir))) {
Lev Walkin46499872006-03-06 13:05:34 +0000402 filename = dp->d_name;
Lev Walkin20a7bf42006-03-17 00:20:52 +0000403#endif
Lev Walkin46499872006-03-06 13:05:34 +0000404 len = strlen(filename);
405 if(len <= 5 || strcmp(filename + len - 5, ".asn1"))
406 continue;
407 len = target_dir_len + 1 + len + 1;
408 fullname = malloc(len);
409 if(!fullname) continue; /* Just skip it, no big deal */
410 snprintf(fullname, len, "%s/%s", target_dir, filename);
411 filename = fullname;
Lev Walkin46499872006-03-06 13:05:34 +0000412
413 new_asn = asn1p_parse_file(filename, A1P_NOFLAGS);
414 if(new_asn == NULL) {
415 fprintf(stderr, "WARNING: Cannot parse standard module \"%s\"\n", filename);
416 ret = -1;
417 continue;
418 }
419
420 /* Import these modules and mark them as "standard" */
421 while((mod = TQ_REMOVE(&(new_asn->modules), mod_next))) {
422 mod->_tags |= MT_STANDARD_MODULE;
423 TQ_ADD(&(asn->modules), mod, mod_next);
424 }
Lev Walkinf6fc04b2006-09-12 05:22:12 +0000425 asn1p_delete(new_asn);
Lev Walkin46499872006-03-06 13:05:34 +0000426
Lev Walkin93659562010-11-20 09:47:13 -0800427#ifdef _WIN32
Lev Walkin46499872006-03-06 13:05:34 +0000428 } while(_findnext(dir, &c_file) == 0);
429 _findclose(dir);
430#else
431 free(fullname);
432 } /* while(readdir()) */
433 closedir(dir);
434#endif
435
436 return ret;
437}
438
439/*
Lev Walkinf15320b2004-06-03 03:38:44 +0000440 * Print the usage screen and exit(EX_USAGE).
441 */
442static void
Lev Walkin06b8d7a2004-09-23 22:06:02 +0000443usage(const char *av0) {
Lev Walkinf15320b2004-06-03 03:38:44 +0000444 fprintf(stderr,
Lev Walkincbf218f2004-08-20 13:24:38 +0000445"ASN.1 Compiler, v" VERSION "\n" COPYRIGHT
Lev Walkin06b8d7a2004-09-23 22:06:02 +0000446"Usage: %s [options] file ...\n"
447"Options:\n"
Lev Walkincbf218f2004-08-20 13:24:38 +0000448" -E Run only the ASN.1 parser and print out the tree\n"
449" -F During -E operation, also perform tree fixing\n"
450"\n"
451" -P Concatenate and print the compiled text\n"
452" -R Restrict output (tables only, no support code)\n"
453" -S <dir> Directory with support (skeleton?) files\n"
454" (Default is \"%s\")\n"
Lev Walkinf7484512004-10-13 09:13:56 +0000455" -X Generate and print the XML DTD\n"
Lev Walkincbf218f2004-08-20 13:24:38 +0000456"\n"
457
Lev Walkincbf218f2004-08-20 13:24:38 +0000458" -Werror Treat warnings as errors; abort if any warning\n"
459" -Wdebug-lexer Enable verbose debugging output from lexer\n"
460" -Wdebug-fixer --//-- semantics processor\n"
461" -Wdebug-compiler --//-- compiler\n"
462"\n"
463
464" -fbless-SIZE Allow SIZE() constraint for INTEGER etc (non-std.)\n"
Lev Walkin21d00002005-03-04 08:48:53 +0000465" -fcompound-names Disambiguate C's struct NAME's inside top-level types\n"
Lev Walkin72a0f5a2005-07-24 08:28:39 +0000466" -findirect-choice Compile members of CHOICE as indirect pointers\n"
Lev Walkin34944f22010-10-07 08:25:37 +0000467" -fincludes-quoted Generate #includes in \"double\" instead of <angle> quotes\n"
Lev Walkin7c655122005-06-05 09:42:42 +0000468" -fknown-extern-type=<name> Pretend the specified type is known\n"
Lev Walkin4062b012013-10-11 14:29:38 -0700469" -fline-refs Include ASN.1 module's line numbers in comments\n"
Lev Walkin4e940a02004-09-26 13:13:13 +0000470" -fno-constraints Do not generate constraint checking code\n"
Lev Walkinb9b8b952005-03-05 00:33:27 +0000471" -fno-include-deps Do not generate courtesy #includes for dependencies\n"
Lev Walkincbf218f2004-08-20 13:24:38 +0000472" -funnamed-unions Enable unnamed unions in structures\n"
Lev Walkin2a744a72013-03-27 01:56:23 -0700473" -fwide-types Use INTEGER_t instead of \"long\" by default, etc.\n"
Lev Walkin59b176e2005-11-26 11:25:14 +0000474"\n"
475
476" -gen-PER Generate PER support code\n"
Lev Walkin66adab42006-09-23 02:52:12 +0000477" -pdu={all|auto|Type} Generate PDU table (discover PDUs automatically)\n"
Lev Walkincbf218f2004-08-20 13:24:38 +0000478"\n"
479
Lev Walkind370e9f2006-03-16 10:03:35 +0000480" -print-class-matrix Print out the collected object class matrix (debug)\n"
Lev Walkindafd95d2006-03-18 06:13:57 +0000481" -print-constraints Explain subtype constraints (debug)\n"
Lev Walkincbf218f2004-08-20 13:24:38 +0000482" -print-lines Generate \"-- #line\" comments in -E output\n"
483
Lev Walkinab4bb292004-08-18 04:52:48 +0000484 ,
485 a1c_basename(av0), DATADIR
Lev Walkinf15320b2004-06-03 03:38:44 +0000486 );
487 exit(EX_USAGE);
488}
489