diff options
author | Lev Walkin <vlm@lionet.info> | 2005-11-26 11:25:14 +0000 |
---|---|---|
committer | Lev Walkin <vlm@lionet.info> | 2005-11-26 11:25:14 +0000 |
commit | 59b176ee355b3e82e6a8649b164c187c7a17a28f (patch) | |
tree | 6d864f02cd16eb75f4ae6e40199d1879d8363152 /asn1c | |
parent | 708530582f5ba965fb596c3e189eec23c52337d9 (diff) |
upgrade: PER related changes
Diffstat (limited to 'asn1c')
-rw-r--r-- | asn1c/asn1c.1 | 15 | ||||
-rw-r--r-- | asn1c/asn1c.c | 30 | ||||
-rw-r--r-- | asn1c/tests/check-25.c | 4 | ||||
-rw-r--r-- | asn1c/tests/check-70.c | 8 |
4 files changed, 41 insertions, 16 deletions
diff --git a/asn1c/asn1c.1 b/asn1c/asn1c.1 index a4289355..3c07ec7f 100644 --- a/asn1c/asn1c.1 +++ b/asn1c/asn1c.1 @@ -4,7 +4,7 @@ asn1c \- ASN.1 Compiler .SH SYNOPSIS asn1c [\fB\-E\fR [\fB-F\fR] | \fB\-P\fR | \fB\-R\fR] [\fB\-S\fR\fIdir\fR] [\fB-X\fR] - [\fB\-W\fR\fIdebug-\fR...] [\fB\-f\fR\fIoption\fR...] [\fB\-p\fR\fIrint-\fR...] + [\fB\-W\fR\fIdebug-\fR...] [\fB\-f\fR\fIoption\fR] [\fB\-gen-\fR\fIoption\fR] [\fB\-print-\fR\fIoption\fR] \fIinfile\fR... .SH DESCRIPTION asn1c compiles the ASN.1 specifications into the set of @@ -25,7 +25,11 @@ and other encoding standards. .br \fB\-fall-defs-global \-fbless-SIZE \-fcompound-names \-findirect-choice .BI "\-fknown-extern-type="<name> -\fB\-fnative-types \-fno-constraints \-fno-include-deps \-funnamed-unions \-fskeletons-copy \-ftypes88\fR +\fB\-fnative-types \-fno-constraints \-fno-include-deps \-funnamed-unions \-fskeletons-copy +.TP +\fICodecs Generation Options\fR +.br +.B \-gen-PER .TP \fIOutput Options\fR .br @@ -117,11 +121,10 @@ Enable unnamed unions in the definitions of target language's structures. .TP .B \-fskeletons-copy Copy support files (skeletons) rather than symlink them. +.SH CODECS GENERATION OPTIONS .TP -.B \-ftypes88 -Pretend to support only ASN.1:1988 embedded types. Certain reserved words, -such as UniversalString and BMPString, become ordinary type references -and may be redefined by the specification. +.B \-gen-PER +Generate Packed Encoding Rules (PER) support code. .SH OUTPUT OPTIONS .TP .B \-print-constraints diff --git a/asn1c/asn1c.c b/asn1c/asn1c.c index ce1342f8..fa9773ce 100644 --- a/asn1c/asn1c.c +++ b/asn1c/asn1c.c @@ -62,7 +62,7 @@ main(int ac, char **av) { /* * Process command-line options. */ - while((ch = getopt(ac, av, "EFf:hLPp:RS:vW:X")) != -1) + while((ch = getopt(ac, av, "EFf:g:hLPp:RS:vW:X")) != -1) switch(ch) { case 'E': print_arg__print_out = 1; @@ -95,13 +95,19 @@ main(int ac, char **av) { asn1_compiler_flags |= A1C_UNNAMED_UNIONS; } else if(strcmp(optarg, "skeletons-copy") == 0) { asn1_compiler_flags |= A1C_SKELETONS_COPY; - } else if(strcmp(optarg, "types88") == 0) { - asn1_parser_flags |= A1P_TYPES_RESTRICT_TO_1988; } else { fprintf(stderr, "-f%s: Invalid argument\n", optarg); exit(EX_USAGE); } break; + case 'g': + if(strcmp(optarg, "en-PER") == 0) { + asn1_compiler_flags |= A1C_GEN_PER; + } else { + fprintf(stderr, "-g%s: Invalid argument\n", optarg); + exit(EX_USAGE); + } + break; case 'h': usage(av[0]); case 'P': @@ -109,7 +115,15 @@ main(int ac, char **av) { asn1_compiler_flags &= ~A1C_NO_C99; break; case 'p': - if(strcmp(optarg, "rint-constraints") == 0) { + if(strncmp(optarg, "du=", 3) == 0) { + char *pduname = optarg + 3; + if(strcmp(pduname, "auto")) { + fprintf(stderr, "-pdu=%s: expected -pdu=auto\n", + pduname); + exit(EX_USAGE); + } + asn1_compiler_flags |= A1C_PDU_AUTO; + } else if(strcmp(optarg, "rint-constraints") == 0) { asn1_printer_flags |= APF_DEBUG_CONSTRAINTS; } else if(strcmp(optarg, "rint-lines") == 0) { asn1_printer_flags |= APF_LINE_COMMENTS; @@ -250,7 +264,8 @@ main(int ac, char **av) { /* * Make sure the skeleton directory is out there. */ - if(skeletons_dir == NULL) { + if((asn1_compiler_flags & A1C_OMIT_SUPPORT_CODE) == 0 + && skeletons_dir == NULL) { struct stat sb; skeletons_dir = DATADIR; if((av[-optind][0] == '.' || av[-optind][1] == '/') @@ -326,7 +341,10 @@ usage(const char *av0) { " -fno-include-deps Do not generate courtesy #includes for dependencies\n" " -funnamed-unions Enable unnamed unions in structures\n" " -fskeletons-copy Force copying the support files\n" -" -ftypes88 Pretend to support only ASN.1:1988 embedded types\n" +"\n" + +" -gen-PER Generate PER support code\n" +" -pdu=auto Generate PDU table (discover PDUs automatically)\n" "\n" " -print-constraints Explain subtype constraints (debug)\n" diff --git a/asn1c/tests/check-25.c b/asn1c/tests/check-25.c index 90db5d0a..38c3580f 100644 --- a/asn1c/tests/check-25.c +++ b/asn1c/tests/check-25.c @@ -102,8 +102,8 @@ check(int is_ok, uint8_t *buf, int size, size_t consumed) { assert(rval.code == RC_OK); assert(rval.consumed == consumed); - assert(strcmp(t.e->buf, "xyz") == 0); - assert(strcmp(t.f->buf, "love_it") == 0); + assert(strcmp((char *)t.e->buf, "xyz") == 0); + assert(strcmp((char *)t.f->buf, "love_it") == 0); assert(t.g->size == 2); assert(t.g->bits_unused == 2); diff --git a/asn1c/tests/check-70.c b/asn1c/tests/check-70.c index 403369e7..4b51065f 100644 --- a/asn1c/tests/check-70.c +++ b/asn1c/tests/check-70.c @@ -36,8 +36,12 @@ _buf_writer(const void *buffer, size_t size, void *app_key) { b = buf + buf_offset; bend = b + size; fprintf(stderr, "=> ["); - for(; b < bend; b++) - fprintf(stderr, "%c", *b); + for(; b < bend; b++) { + if(*b >= 32 && *b < 127 && *b != '%') + fprintf(stderr, "%c", *b); + else + fprintf(stderr, "%%02x", *b); + } fprintf(stderr, "]:%ld\n", (long)size); buf_offset += size; return 0; |