diff --git a/.gitignore b/.gitignore index da42ba25c..ce3e51fdb 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,9 @@ doc/docsrc/*.xdv # /libasn1parser/ /libasn1parser/check_parser +/libasn1parser/asn1p_l.c +/libasn1parser/asn1p_y.c +/libasn1parser/asn1p_y.h # /skeletons/tests/ /skeletons/tests/check-* diff --git a/TODO b/TODO index 58666cc63..ee6fb1d24 100644 --- a/TODO +++ b/TODO @@ -7,5 +7,5 @@ 2. MEDIUM: -2.1 Support for EXTERNAL, EMBEDDED-PDV and CHARACTER STRING types. +2.1 Support for EMBEDDED-PDV and CHARACTER STRING types. Requires something from 1.2 (Information Object Classes). diff --git a/asn1c/tests/Makefile.am b/asn1c/tests/Makefile.am index 352122a6c..1ee434c16 100644 --- a/asn1c/tests/Makefile.am +++ b/asn1c/tests/Makefile.am @@ -14,6 +14,7 @@ TESTS += check-src/check-127.-gen-PER.c TESTS += check-src/check-131.-gen-PER.c TESTS += check-src/check-132.-gen-PER.c TESTS += check-src/check-133.-gen-PER.c +TESTS += check-src/check-135.c TESTS += check-src/check-19.c TESTS += check-src/check-22.-fwide-types.c TESTS += check-src/check-24.-fwide-types.c diff --git a/asn1c/tests/check-src/check-135.c b/asn1c/tests/check-src/check-135.c new file mode 100644 index 000000000..00c28960f --- /dev/null +++ b/asn1c/tests/check-src/check-135.c @@ -0,0 +1,135 @@ +#undef NDEBUG +#include +#include +#include +#include +#include + +#include "T.h" + + +uint8_t buf1[] = { + 0x28,0x18, + 0x06,0x07,0x00,0x11,0x86,0x05,0x01,0x01,0x01, + 0xa0,0x0d, + 0x60,0x0b, + 0xa1,0x09, + 0x06,0x07,0x04,0x00,0x00,0x01,0x00,0x05,0x03 +}; + + +uint8_t buf1_reconstr[] = { + 0x28,0x18, + 0x06,0x07,0x00,0x11,0x86,0x05,0x01,0x01,0x01, + 0xa0,0x0d, + 0x60,0x0b, + 0xa1,0x09, + 0x06,0x07,0x04,0x00,0x00,0x01,0x00,0x05,0x03 +}; + + +static void +check(T_t *tp, uint8_t *buf, size_t size, size_t consumed) { + asn_dec_rval_t rval; + + tp = memset(tp, 0, sizeof(*tp)); + + fprintf(stderr, "Buf %p (%zd)\n", buf, size); + rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); + fprintf(stderr, "Returned code %d, consumed %zd\n", + (int)rval.code, rval.consumed); + + assert(rval.code == RC_OK); + assert(rval.consumed == consumed); + + const uint8_t direct_reference[] = {0x00,0x11,0x86,0x05,0x01,0x01,0x01}; + assert(tp->direct_reference); + assert(tp->direct_reference->size == sizeof(direct_reference)); + assert(memcmp(tp->direct_reference->buf, direct_reference, + sizeof(direct_reference)) == 0); + + assert(tp->indirect_reference == NULL); + assert(tp->data_value_descriptor == NULL); + + const uint8_t single_asn1_type[] = { + 0x60,0x0b,0xa1,0x09,0x06,0x07,0x04,0x00,0x00,0x01,0x00,0x05,0x03}; + assert(tp->encoding.present == encoding_PR_single_ASN1_type); + assert(tp->encoding.choice.single_ASN1_type.size == sizeof(single_asn1_type)); + assert(memcmp(tp->encoding.choice.single_ASN1_type.buf, single_asn1_type, + sizeof(single_asn1_type)) == 0); +} + +size_t buf_pos; +size_t buf_size; +uint8_t *buf; + +static int +buf_fill(const void *buffer, size_t size, void *app_key) { + + (void)app_key; /* Unused argument */ + + if(buf_pos + size > buf_size) { + fprintf(stderr, "%zd + %zd > %zd\n", + buf_pos, size, buf_size); + return -1; + } + + memcpy(buf + buf_pos, buffer, size); + buf_pos += size; + fprintf(stderr, " written %zd (%zd)\n", size, buf_pos); + + return 0; +} + +static void +compare(T_t *tp, uint8_t *cmp_buf, ssize_t cmp_buf_size) { + asn_enc_rval_t erval; + int i; + + buf_size = cmp_buf_size + 100; + buf = alloca(buf_size); + buf_pos = 0; + + /* + * Try to re-create using DER encoding. + */ + erval = der_encode(&asn_DEF_T, tp, buf_fill, 0); + assert(erval.encoded != -1); + if(erval.encoded != cmp_buf_size) { + printf("%zd != %zd\n", erval.encoded, cmp_buf_size); + } + assert(erval.encoded == cmp_buf_size); + for(i = 0; i < cmp_buf_size; i++) { + if(buf[i] != cmp_buf[i]) { + fprintf(stderr, "Recreated buffer content mismatch:\n"); + fprintf(stderr, "Byte %d, %x != %x (%d != %d)\n", + i, + buf[i], cmp_buf[i], + buf[i], cmp_buf[i] + ); + } + assert(buf[i] == cmp_buf[i]); + } +} + +int +main(int ac, char **av) { + T_t t; + + (void)ac; /* Unused argument */ + (void)av; /* Unused argument */ + + /* Check exact buf1 */ + check(&t, buf1, sizeof(buf1), sizeof(buf1)); + compare(&t, buf1_reconstr, sizeof(buf1_reconstr)); + asn_fprint(stderr, &asn_DEF_T, &t); + asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); + + /* Check slightly more than buf1 */ + check(&t, buf1, sizeof(buf1) + 10, sizeof(buf1)); + compare(&t, buf1_reconstr, sizeof(buf1_reconstr)); + asn_fprint(stderr, &asn_DEF_T, &t); + asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); + + return 0; +} diff --git a/libasn1parser/Makefile.am b/libasn1parser/Makefile.am index 65a4f3ebd..8b80efedd 100644 --- a/libasn1parser/Makefile.am +++ b/libasn1parser/Makefile.am @@ -5,9 +5,12 @@ AM_LFLAGS = -s -p -Cem -Pasn1p_ -olex.yy.c noinst_LTLIBRARIES = libasn1parser.la +BUILT_SOURCES = asn1p_y.h + libasn1parser_la_SOURCES = \ asn1parser.c asn1parser.h \ - asn1p_y.c asn1p_y.h asn1p_l.c \ + asn1p_y.y \ + asn1p_l.l \ asn1p_module.c asn1p_module.h \ asn1p_oid.c asn1p_oid.h \ asn1p_value.c asn1p_value.h \ diff --git a/libasn1parser/asn1p_l.c b/libasn1parser/asn1p_l.c deleted file mode 100644 index cc4a6dd29..000000000 --- a/libasn1parser/asn1p_l.c +++ /dev/null @@ -1,4689 +0,0 @@ -#line 2 "lex.yy.c" - -#line 4 "lex.yy.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -/* %not-for-header */ - -/* %if-c-only */ -/* %if-not-reentrant */ -#define yy_create_buffer asn1p__create_buffer -#define yy_delete_buffer asn1p__delete_buffer -#define yy_flex_debug asn1p__flex_debug -#define yy_init_buffer asn1p__init_buffer -#define yy_flush_buffer asn1p__flush_buffer -#define yy_load_buffer_state asn1p__load_buffer_state -#define yy_switch_to_buffer asn1p__switch_to_buffer -#define yyin asn1p_in -#define yyleng asn1p_leng -#define yylex asn1p_lex -#define yylineno asn1p_lineno -#define yyout asn1p_out -#define yyrestart asn1p_restart -#define yytext asn1p_text -#define yywrap asn1p_wrap -#define yyalloc asn1p_alloc -#define yyrealloc asn1p_realloc -#define yyfree asn1p_free - -/* %endif */ -/* %endif */ -/* %ok-for-header */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* %if-c++-only */ -/* %endif */ - -/* %if-c-only */ - -/* %endif */ - -/* %if-c-only */ - -/* %endif */ - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -/* %if-c-only */ -#include -#include -#include -#include -/* %endif */ - -/* %if-tables-serialization */ -/* %endif */ -/* end standard C headers. */ - -/* %if-c-or-c++ */ -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! FLEXINT_H */ - -/* %endif */ - -/* %if-c++-only */ -/* %endif */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* %not-for-header */ - -/* Returned upon end-of-file. */ -#define YY_NULL 0 -/* %ok-for-header */ - -/* %not-for-header */ - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) -/* %ok-for-header */ - -/* %if-reentrant */ -/* %endif */ - -/* %if-not-reentrant */ - -/* %endif */ - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE asn1p_restart(asn1p_in ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -/* %if-not-reentrant */ -extern yy_size_t asn1p_leng; -/* %endif */ - -/* %if-c-only */ -/* %if-not-reentrant */ -extern FILE *asn1p_in, *asn1p_out; -/* %endif */ -/* %endif */ - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE asn1p_lex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-asn1p_lineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - yy_size_t yyl;\ - for ( yyl = n; yyl < asn1p_leng; ++yyl )\ - if ( asn1p_text[yyl] == '\n' )\ - --asn1p_lineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up asn1p_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up asn1p_text again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { -/* %if-c-only */ - FILE *yy_input_file; -/* %endif */ - -/* %if-c++-only */ -/* %endif */ - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via asn1p_restart()), so that the user can continue scanning by - * just pointing asn1p_in at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* %if-c-only Standard (non-C++) definition */ -/* %not-for-header */ - -/* %if-not-reentrant */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ -/* %endif */ -/* %ok-for-header */ - -/* %endif */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* %if-c-only Standard (non-C++) definition */ - -/* %if-not-reentrant */ -/* %not-for-header */ - -/* yy_hold_char holds the character lost when asn1p_text is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t asn1p_leng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow asn1p_wrap()'s to do buffer switches - * instead of setting up a fresh asn1p_in. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; -/* %ok-for-header */ - -/* %endif */ - -void asn1p_restart (FILE *input_file ); -void asn1p__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE asn1p__create_buffer (FILE *file,int size ); -void asn1p__delete_buffer (YY_BUFFER_STATE b ); -void asn1p__flush_buffer (YY_BUFFER_STATE b ); -void asn1p_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void asn1p_pop_buffer_state (void ); - -static void asn1p_ensure_buffer_stack (void ); -static void asn1p__load_buffer_state (void ); -static void asn1p__init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER asn1p__flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE asn1p__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE asn1p__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE asn1p__scan_bytes (yyconst char *bytes,yy_size_t len ); - -/* %endif */ - -void *asn1p_alloc (yy_size_t ); -void *asn1p_realloc (void *,yy_size_t ); -void asn1p_free (void * ); - -#define yy_new_buffer asn1p__create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - asn1p_ensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - asn1p__create_buffer(asn1p_in,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - asn1p_ensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - asn1p__create_buffer(asn1p_in,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* %% [1.0] asn1p_text/asn1p_in/asn1p_out/yy_state_type/asn1p_lineno etc. def's & init go here */ -/* Begin user sect3 */ - -#define asn1p_wrap(n) 1 -#define YY_SKIP_YYWRAP - -#define FLEX_DEBUG - -typedef unsigned char YY_CHAR; - -FILE *asn1p_in = (FILE *) 0, *asn1p_out = (FILE *) 0; - -typedef int yy_state_type; - -extern int asn1p_lineno; - -int asn1p_lineno = 1; - -extern char *asn1p_text; -#define yytext_ptr asn1p_text - -/* %if-c-only Standard (non-C++) definition */ - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* %endif */ - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up asn1p_text. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ -/* %% [2.0] code to fiddle asn1p_text and asn1p_leng for yymore() goes here \ */\ - asn1p_leng = (yy_size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ -/* %% [3.0] code to copy yytext_ptr to asn1p_text[] goes here, if %array \ */\ - (yy_c_buf_p) = yy_cp; - -/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ -#define YY_NUM_RULES 140 -#define YY_END_OF_BUFFER 141 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_acclist[1272] = - { 0, - 141, 139, 140, 132, 139, 140, 132, 140, 137, 139, - 140, 19, 139, 140, 137, 139, 140, 139, 140, 137, - 139, 140, 139, 140, 139, 140, 137, 139, 140, 139, - 140, 33, 139, 140, 32, 139, 140, 137, 139, 140, - 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, - 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, - 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, - 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, - 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, - 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, - - 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, - 120, 121, 139, 140, 120, 121, 139, 140, 137, 139, - 140, 137, 139, 140, 119, 139, 140, 137, 139, 140, - 9, 139, 140, 6, 140, 6, 139, 140, 8, 139, - 140, 8, 139, 140, 11, 13, 139, 140, 11, 140, - 13, 139, 140, 13, 139, 140, 13, 139, 140, 21, - 139, 140, 21, 140, 22, 139, 140, 16, 139, 140, - 16, 140, 18, 139, 140, 18, 139, 140, 14, 139, - 140, 15, 139, 140, 25, 27, 139, 140, 27, 139, - 140, 28, 140, 25, 26, 27, 139, 140, 25, 26, - - 27, 139, 140, 130, 139, 140, 130, 140, 139, 140, - 126, 139, 140, 139, 140, 139, 140, 125, 139, 140, - 128, 139, 140, 129, 139, 140, 127, 139, 140, 131, - 139, 140, 132, 19, 19, 117, 118, 5, 31, 124, - 10, 34, 32, 34, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, - 121, 120, 121, 120, 121, 44, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 121, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - - 120, 121, 120, 121, 121, 120, 121, 120, 121, 89, - 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, - 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 121, 120, 121, 120, 121, 121, 121, 120, 121, 135, - 136, 119, 9, 7, 7, 12, 21, 20, 16, 25, - 25, 26, 25, 26, 130, 5, 125, 138, 117, 118, - 31, 34, 123, 34, 122, 120, 121, 121, 120, 121, - 36, 120, 121, 37, 120, 121, 120, 121, 120, 121, - 120, 121, 41, 120, 121, 120, 121, 120, 121, 120, - - 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, - 121, 120, 121, 120, 121, 58, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 81, 120, 121, 82, - 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, - 121, 121, 120, 121, 92, 120, 121, 120, 121, 120, - 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, - 100, 120, 121, 120, 121, 120, 121, 120, 121, 120, - 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, - - 120, 121, 121, 121, 121, 120, 121, 119, 3, 17, - 25, 26, 24, 25, 26, 125, 117, 118, 30, 29, - 2, 1, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 66, 120, 121, 121, - 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, - 121, 120, 121, 120, 121, 120, 121, 120, 121, 84, - 120, 121, 121, 120, 121, 120, 121, 120, 121, 121, - - 120, 121, 120, 121, 120, 121, 120, 121, 121, 97, - 120, 121, 120, 121, 120, 121, 101, 120, 121, 120, - 121, 120, 121, 120, 121, 105, 120, 121, 107, 120, - 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 121, 121, 121, 116, 120, 121, 3, 25, - 26, 120, 121, 120, 121, 120, 121, 40, 120, 121, - 121, 120, 121, 120, 121, 120, 121, 47, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 65, 120, 121, 121, - - 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 120, 121, 121, 120, 121, 88, 120, 121, 120, 121, - 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, - 120, 121, 120, 121, 120, 121, 121, 121, 108, 120, - 121, 120, 121, 120, 121, 121, 120, 121, 121, 121, - 121, 133, 25, 26, 35, 120, 121, 120, 121, 120, - 121, 121, 120, 121, 120, 121, 46, 120, 121, 120, - 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, - 121, 120, 121, 120, 121, 120, 121, 120, 121, 60, - - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 121, 121, 121, 120, 121, 120, 121, 120, 121, 120, - 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, - 121, 120, 121, 121, 86, 120, 121, 120, 121, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, - 121, 120, 121, 102, 120, 121, 103, 120, 121, 121, - 121, 109, 120, 121, 120, 121, 121, 121, 121, 121, - 121, 25, 26, 120, 121, 120, 121, 121, 43, 120, - 121, 120, 121, 120, 121, 120, 121, 120, 121, 52, - 120, 121, 53, 120, 121, 120, 121, 120, 121, 56, - - 120, 121, 120, 121, 120, 121, 120, 121, 62, 120, - 121, 120, 121, 120, 121, 121, 121, 121, 120, 121, - 120, 121, 73, 120, 121, 74, 120, 121, 120, 121, - 120, 121, 120, 121, 78, 120, 121, 120, 121, 120, - 121, 120, 121, 121, 120, 121, 121, 91, 120, 121, - 120, 121, 94, 120, 121, 96, 120, 121, 121, 120, - 121, 120, 121, 121, 121, 120, 121, 112, 121, 121, - 121, 121, 121, 25, 26, 120, 121, 120, 121, 121, - 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, - 55, 120, 121, 120, 121, 120, 121, 61, 120, 121, - - 120, 121, 64, 120, 121, 121, 121, 121, 121, 120, - 121, 72, 120, 121, 75, 120, 121, 76, 120, 121, - 120, 121, 120, 121, 121, 120, 121, 121, 90, 120, - 121, 121, 120, 121, 121, 120, 121, 99, 120, 121, - 121, 121, 120, 121, 121, 121, 121, 121, 25, 26, - 120, 121, 39, 120, 121, 42, 121, 45, 120, 121, - 48, 120, 121, 120, 121, 120, 121, 120, 121, 120, - 121, 120, 121, 121, 121, 121, 70, 121, 120, 121, - 120, 121, 120, 121, 121, 120, 121, 121, 121, 120, - 121, 121, 104, 121, 121, 110, 120, 121, 121, 121, - - 121, 121, 134, 25, 120, 121, 49, 120, 121, 120, - 121, 51, 120, 121, 120, 121, 120, 121, 59, 120, - 121, 120, 121, 121, 121, 121, 71, 120, 121, 120, - 121, 120, 121, 121, 120, 121, 121, 121, 120, 121, - 121, 120, 121, 121, 113, 121, 121, 121, 121, 25, - 38, 120, 121, 50, 120, 121, 54, 120, 121, 120, - 121, 120, 121, 121, 121, 121, 120, 121, 120, 121, - 121, 120, 121, 121, 121, 120, 121, 121, 120, 121, - 121, 121, 121, 121, 25, 120, 121, 120, 121, 121, - 121, 121, 77, 120, 121, 79, 120, 121, 80, 121, - - 120, 121, 121, 121, 120, 121, 121, 98, 120, 121, - 121, 121, 121, 121, 25, 120, 121, 63, 120, 121, - 68, 121, 121, 69, 121, 120, 121, 85, 121, 121, - 93, 120, 121, 121, 106, 121, 121, 121, 115, 121, - 25, 120, 121, 121, 83, 120, 121, 121, 121, 121, - 114, 121, 25, 120, 121, 67, 121, 121, 95, 121, - 111, 121, 25, 57, 120, 121, 87, 121, 23, 25, - 4 - } ; - -static yyconst flex_int16_t yy_accept[747] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 4, 7, - 9, 12, 15, 18, 20, 23, 25, 27, 30, 32, - 35, 38, 41, 43, 47, 51, 55, 59, 63, 67, - 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, - 111, 115, 119, 122, 125, 128, 131, 134, 136, 139, - 142, 145, 149, 151, 154, 157, 160, 163, 165, 168, - 171, 173, 176, 179, 182, 185, 189, 192, 194, 199, - 204, 207, 209, 211, 214, 216, 218, 221, 224, 227, - 230, 233, 233, 234, 235, 236, 236, 237, 237, 238, - - 238, 238, 238, 239, 240, 241, 242, 242, 243, 243, - 245, 245, 245, 247, 249, 251, 253, 255, 257, 258, - 260, 262, 264, 266, 269, 271, 273, 275, 277, 279, - 281, 283, 285, 287, 288, 289, 291, 293, 295, 297, - 299, 301, 303, 305, 306, 308, 310, 313, 315, 316, - 318, 320, 322, 324, 325, 327, 329, 331, 333, 335, - 337, 339, 341, 342, 344, 346, 347, 348, 350, 351, - 352, 352, 353, 353, 353, 353, 354, 355, 356, 357, - 358, 359, 360, 360, 361, 363, 365, 366, 367, 367, - 368, 369, 369, 369, 370, 370, 371, 371, 371, 371, - - 371, 373, 374, 375, 375, 376, 378, 379, 381, 384, - 387, 389, 391, 391, 393, 396, 398, 400, 402, 404, - 406, 408, 410, 412, 414, 416, 419, 421, 423, 425, - 427, 429, 431, 432, 433, 435, 437, 439, 441, 443, - 445, 447, 450, 453, 455, 456, 458, 460, 462, 463, - 465, 468, 470, 472, 474, 475, 477, 479, 481, 484, - 486, 488, 490, 492, 494, 496, 497, 499, 501, 503, - 504, 505, 506, 508, 509, 509, 509, 510, 511, 513, - 516, 517, 517, 518, 519, 520, 521, 522, 523, 523, - 523, 523, 525, 527, 529, 531, 533, 535, 537, 539, - - 541, 543, 545, 547, 549, 551, 553, 555, 557, 559, - 561, 563, 565, 567, 570, 571, 572, 574, 576, 578, - 580, 582, 584, 586, 588, 590, 593, 594, 596, 598, - 600, 601, 603, 605, 607, 609, 610, 613, 615, 617, - 620, 622, 624, 626, 629, 632, 633, 635, 637, 639, - 641, 643, 644, 645, 646, 649, 649, 649, 649, 649, - 650, 652, 652, 654, 656, 658, 661, 662, 664, 666, - 668, 671, 673, 675, 677, 679, 681, 683, 685, 687, - 689, 691, 693, 695, 697, 700, 701, 702, 703, 705, - 707, 709, 711, 713, 715, 717, 719, 721, 723, 724, - - 726, 729, 731, 732, 734, 734, 736, 738, 739, 741, - 743, 745, 747, 748, 749, 752, 754, 756, 757, 759, - 760, 761, 762, 762, 762, 763, 765, 765, 768, 770, - 772, 773, 775, 777, 780, 782, 784, 786, 788, 790, - 792, 794, 796, 798, 800, 803, 805, 807, 809, 811, - 812, 813, 814, 816, 818, 820, 822, 824, 826, 828, - 830, 832, 834, 834, 835, 838, 840, 841, 843, 845, - 847, 849, 850, 852, 854, 857, 860, 861, 862, 865, - 867, 868, 869, 870, 871, 872, 872, 872, 874, 874, - 876, 878, 879, 882, 884, 886, 888, 890, 893, 896, - - 898, 900, 903, 905, 907, 909, 912, 914, 916, 917, - 918, 919, 921, 923, 926, 929, 931, 933, 935, 938, - 940, 942, 944, 945, 947, 948, 951, 953, 956, 959, - 960, 962, 964, 965, 966, 968, 970, 971, 972, 973, - 974, 974, 976, 976, 978, 980, 981, 983, 985, 987, - 989, 991, 994, 996, 998, 1001, 1003, 1006, 1007, 1008, - 1009, 1010, 1012, 1015, 1018, 1021, 1023, 1025, 1026, 1028, - 1029, 1032, 1033, 1035, 1036, 1038, 1041, 1042, 1043, 1045, - 1046, 1047, 1048, 1049, 1049, 1049, 1051, 1051, 1053, 1056, - 1058, 1061, 1064, 1066, 1068, 1070, 1070, 1072, 1074, 1075, - - 1076, 1077, 1079, 1081, 1083, 1085, 1086, 1088, 1089, 1090, - 1092, 1093, 1093, 1095, 1096, 1099, 1100, 1101, 1102, 1103, - 1103, 1104, 1105, 1105, 1107, 1110, 1112, 1115, 1117, 1119, - 1122, 1124, 1125, 1126, 1127, 1130, 1132, 1134, 1135, 1137, - 1138, 1139, 1141, 1142, 1144, 1145, 1147, 1148, 1149, 1150, - 1151, 1151, 1154, 1157, 1160, 1162, 1164, 1165, 1166, 1167, - 1169, 1171, 1172, 1174, 1175, 1176, 1178, 1179, 1181, 1182, - 1183, 1184, 1185, 1186, 1186, 1188, 1190, 1191, 1192, 1193, - 1196, 1199, 1201, 1203, 1204, 1205, 1207, 1208, 1211, 1212, - 1213, 1214, 1215, 1216, 1216, 1218, 1221, 1223, 1224, 1226, - - 1228, 1230, 1231, 1234, 1235, 1237, 1238, 1239, 1241, 1242, - 1242, 1244, 1245, 1248, 1249, 1250, 1251, 1253, 1254, 1254, - 1256, 1258, 1259, 1261, 1263, 1264, 1264, 1267, 1269, 1271, - 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, - 1271, 1271, 1271, 1271, 1272, 1272 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 6, 7, 1, 1, 1, 8, 9, 10, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 19, 20, 21, 22, 19, 23, 24, 25, 26, 27, - 28, 29, 1, 10, 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, 1, 57, 58, 1, 1, 59, 60, 61, 62, - - 63, 64, 65, 66, 67, 68, 64, 69, 70, 71, - 72, 73, 64, 74, 75, 76, 77, 78, 64, 79, - 64, 80, 81, 82, 83, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[84] = - { 0, - 1, 2, 3, 4, 4, 1, 5, 1, 6, 1, - 1, 1, 1, 7, 1, 1, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 1, 1, 9, 1, 10, - 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 1, 1, 1, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 12, 1, 13 - } ; - -static yyconst flex_int16_t yy_base[772] = - { 0, - 0, 0, 81, 84, 87, 99, 94, 96, 93, 108, - 91, 103, 186, 269, 352, 0, 1666, 1656, 130, 138, - 1650, 1648, 427, 146, 4507, 158, 207, 1640, 109, 230, - 493, 1629, 4507, 543, 268, 115, 274, 289, 488, 593, - 191, 599, 509, 215, 491, 621, 406, 638, 655, 658, - 678, 689, 1596, 100, 1634, 733, 0, 4507, 4507, 1632, - 1631, 4507, 4507, 1628, 1632, 4507, 0, 0, 1630, 0, - 0, 1608, 4507, 4507, 4507, 0, 4507, 4507, 757, 839, - 122, 166, 127, 4507, 1615, 1616, 1612, 4507, 4507, 4507, - 4507, 1613, 201, 0, 1611, 1606, 1596, 96, 1595, 656, - - 1594, 772, 103, 807, 1584, 4507, 839, 857, 886, 907, - 1569, 912, 681, 757, 892, 903, 909, 962, 1581, 963, - 978, 979, 994, 1000, 1016, 1022, 1033, 1046, 1049, 1069, - 1066, 1077, 1090, 147, 79, 1105, 1108, 1116, 1131, 1142, - 1153, 1159, 1170, 169, 1183, 1186, 1199, 1207, 94, 1210, - 1223, 1234, 1247, 152, 1263, 1269, 1280, 1286, 1297, 1308, - 1314, 1325, 193, 1331, 1347, 194, 226, 1346, 4507, 4507, - 0, 1579, 757, 943, 1381, 0, 4507, 1578, 4507, 0, - 4507, 0, 1558, 0, 1541, 257, 333, 4507, 0, 1568, - 4507, 1565, 0, 1561, 0, 1554, 186, 1529, 252, 143, - - 1391, 4507, 866, 894, 4507, 1441, 1550, 1385, 1386, 1401, - 1402, 1417, 1549, 1425, 1428, 1441, 1449, 1491, 1492, 1508, - 1509, 1524, 1540, 1546, 1557, 1563, 1574, 1580, 1591, 1597, - 1608, 1619, 196, 272, 1632, 1640, 1643, 1658, 1661, 1664, - 1690, 1682, 1693, 1706, 224, 1714, 1727, 1735, 277, 1738, - 1751, 1759, 1767, 1775, 438, 1788, 1791, 1799, 1812, 1820, - 1828, 1836, 1849, 1857, 1870, 506, 1878, 1894, 1895, 470, - 507, 249, 1910, 1548, 1954, 1962, 1547, 4507, 285, 1517, - 1543, 1491, 1533, 1532, 4507, 4507, 4507, 4507, 436, 207, - 1497, 1956, 1957, 1972, 1978, 1989, 1995, 2011, 2012, 2027, - - 2035, 2043, 2059, 2056, 2067, 2080, 2083, 2098, 2104, 2115, - 2121, 2132, 2147, 2153, 469, 535, 2164, 2170, 2185, 2186, - 2201, 2207, 2222, 2225, 2233, 2246, 554, 2254, 2257, 2270, - 510, 2278, 2291, 2299, 2307, 523, 2315, 2323, 2336, 2344, - 2347, 2365, 2362, 2368, 2383, 617, 2386, 2389, 2406, 2412, - 2423, 612, 528, 631, 2439, 2473, 2496, 2519, 2531, 1530, - 271, 1500, 2515, 2530, 2546, 2543, 623, 2564, 2567, 2570, - 2585, 2588, 2596, 2609, 2617, 2630, 2641, 2647, 2658, 2669, - 2684, 2690, 2701, 2707, 2722, 611, 613, 632, 2723, 2743, - 2740, 2761, 2760, 2776, 2782, 2793, 2806, 2817, 643, 2814, - - 2830, 2838, 639, 2846, 309, 2854, 2867, 619, 2880, 2883, - 2891, 2904, 668, 621, 2915, 2921, 2932, 634, 2943, 727, - 641, 625, 816, 2987, 4507, 303, 1513, 2971, 2987, 2984, - 649, 2995, 3008, 3011, 3028, 3034, 3045, 3051, 3066, 3072, - 3089, 3095, 3106, 3112, 3123, 3129, 3140, 3146, 3162, 730, - 511, 676, 3163, 3178, 3184, 3195, 3201, 3216, 3222, 3233, - 3248, 3254, 711, 783, 3265, 3281, 700, 3278, 1486, 3289, - 3302, 809, 3310, 3325, 3328, 3331, 878, 732, 3346, 3349, - 880, 734, 636, 905, 933, 3398, 3410, 1485, 1494, 3364, - 3404, 733, 3405, 3422, 3421, 3437, 3438, 3453, 3454, 3469, - - 3475, 3486, 3492, 3503, 3514, 3525, 3531, 3542, 984, 789, - 822, 3548, 3559, 3570, 3576, 3587, 3593, 3608, 3609, 3624, - 3630, 1482, 795, 3641, 937, 3647, 1489, 3658, 3664, 802, - 3679, 3685, 887, 988, 3701, 1479, 981, 955, 918, 1001, - 3735, 101, 0, 3729, 3730, 1003, 3745, 3753, 3756, 3769, - 3777, 3785, 3793, 3806, 3814, 3822, 3830, 925, 1002, 1012, - 1004, 3843, 3851, 3854, 3867, 3875, 3878, 1019, 1453, 1028, - 3891, 1020, 1443, 1016, 3912, 3899, 1040, 1041, 3915, 1042, - 1056, 1089, 1048, 3964, 1381, 1109, 1432, 3930, 3948, 1463, - 3959, 3965, 3980, 3981, 3996, 514, 4002, 4013, 1070, 1114, - - 1071, 1443, 4019, 4030, 4041, 1115, 1415, 1142, 1127, 1406, - 1116, 798, 1427, 1151, 4047, 1124, 1157, 1092, 1193, 1493, - 4507, 1408, 1376, 4058, 4064, 4079, 4080, 4095, 1374, 4096, - 4111, 1156, 1129, 1179, 4117, 4128, 4139, 1161, 1309, 1194, - 1196, 1303, 1204, 1299, 1205, 1320, 1207, 1225, 1220, 1238, - 1126, 4145, 4156, 4162, 1154, 4173, 1198, 1118, 1231, 4184, - 4190, 1233, 1157, 1249, 1229, 1120, 1248, 1127, 1272, 1287, - 1257, 1275, 1111, 1012, 1024, 4205, 1244, 1277, 1289, 4206, - 4221, 1057, 1009, 1302, 1164, 986, 1281, 0, 1357, 1293, - 1349, 1359, 906, 886, 891, 4222, 922, 1262, 824, 780, - - 819, 1407, 0, 1366, 818, 1379, 1409, 803, 763, 483, - 511, 1424, 0, 1393, 1420, 1462, 539, 501, 481, 489, - 441, 1291, 440, 434, 405, 374, 0, 430, 0, 367, - 412, 363, 304, 272, 276, 262, 231, 172, 159, 319, - 711, 115, 100, 4507, 4507, 4272, 4285, 4298, 4311, 4324, - 4337, 4349, 4353, 4364, 4377, 4390, 4401, 4412, 4417, 4422, - 4427, 4431, 4436, 4440, 4444, 4448, 4452, 4463, 4470, 4481, - 4493 - } ; - -static yyconst flex_int16_t yy_def[772] = - { 0, - 745, 1, 746, 746, 746, 746, 747, 747, 748, 748, - 749, 749, 750, 750, 745, 15, 745, 745, 745, 745, - 745, 751, 745, 752, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 745, 745, 753, 745, 754, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 755, 755, 745, 756, - 756, 745, 745, 745, 745, 757, 745, 745, 758, 758, - 745, 745, 23, 745, 745, 745, 759, 745, 745, 745, - 745, 745, 745, 751, 751, 745, 760, 745, 761, 752, - - 752, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 762, 34, 34, 34, 34, 34, 34, 763, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 763, 763, 34, 34, 34, 34, 34, - 34, 34, 34, 763, 34, 34, 34, 34, 763, 34, - 34, 34, 34, 763, 34, 34, 34, 34, 34, 34, - 34, 34, 763, 34, 34, 763, 763, 34, 745, 745, - 764, 753, 745, 745, 745, 754, 745, 745, 745, 755, - 745, 756, 745, 757, 80, 80, 745, 745, 765, 759, - 745, 745, 766, 760, 767, 761, 745, 745, 768, 745, - - 745, 745, 745, 745, 745, 762, 769, 34, 34, 34, - 34, 34, 769, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 763, 763, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 763, 34, 34, 34, 763, 34, - 34, 34, 34, 34, 763, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 763, 34, 34, 34, 763, - 763, 763, 34, 764, 745, 745, 745, 745, 80, 80, - 765, 745, 766, 767, 745, 745, 745, 745, 768, 745, - 745, 34, 34, 34, 34, 34, 34, 34, 34, 34, - - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 763, 763, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 763, 34, 34, 34, - 763, 34, 34, 34, 34, 763, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 763, 34, 34, 34, 34, - 34, 763, 763, 763, 34, 745, 745, 745, 745, 745, - 80, 745, 34, 34, 34, 34, 763, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 763, 763, 763, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 763, 34, - - 34, 34, 763, 34, 206, 34, 34, 763, 34, 34, - 34, 34, 763, 763, 34, 34, 34, 763, 34, 763, - 763, 763, 745, 745, 745, 80, 745, 34, 34, 34, - 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, - 763, 763, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 206, 763, 34, 34, 763, 34, 206, 34, - 34, 763, 34, 34, 34, 34, 763, 763, 34, 34, - 763, 763, 763, 763, 763, 745, 745, 80, 745, 34, - 34, 763, 34, 34, 34, 34, 34, 34, 34, 34, - - 34, 34, 34, 34, 34, 34, 34, 34, 763, 763, - 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 206, 763, 34, 763, 34, 206, 34, 34, 763, - 34, 34, 763, 763, 34, 763, 763, 763, 763, 763, - 745, 80, 770, 34, 34, 763, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 763, 763, 763, - 763, 34, 34, 34, 34, 34, 34, 763, 206, 763, - 34, 763, 206, 763, 34, 34, 763, 763, 34, 763, - 763, 763, 763, 745, 771, 80, 745, 34, 34, 763, - 34, 34, 34, 34, 34, 206, 34, 34, 763, 763, - - 763, 763, 34, 34, 34, 763, 206, 763, 763, 206, - 763, 206, 763, 763, 34, 763, 763, 763, 763, 745, - 745, 757, 745, 34, 34, 34, 34, 34, 206, 34, - 34, 763, 763, 763, 34, 34, 34, 763, 206, 763, - 763, 206, 763, 206, 763, 763, 763, 763, 763, 757, - 745, 34, 34, 34, 206, 34, 763, 763, 763, 34, - 34, 763, 206, 763, 763, 206, 763, 206, 763, 763, - 763, 763, 757, 745, 206, 34, 763, 763, 763, 34, - 34, 763, 206, 763, 763, 206, 763, 206, 763, 763, - 763, 763, 757, 745, 206, 34, 763, 763, 763, 206, - - 763, 763, 206, 763, 763, 763, 763, 763, 757, 745, - 206, 763, 206, 763, 763, 763, 763, 757, 745, 206, - 763, 763, 763, 763, 757, 745, 206, 763, 757, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 0, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745 - } ; - -static yyconst flex_int16_t yy_nxt[4591] = - { 0, - 18, 19, 20, 19, 19, 21, 22, 23, 24, 25, - 18, 26, 25, 27, 28, 29, 30, 31, 31, 31, - 31, 31, 31, 31, 32, 21, 33, 33, 18, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 41, 41, - 41, 43, 44, 45, 46, 41, 47, 48, 49, 50, - 51, 52, 41, 41, 41, 53, 54, 21, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 56, 21, 25, 58, 59, 59, 58, 59, 59, 58, - 59, 59, 213, 71, 60, 68, 63, 60, 63, 69, - - 61, 58, 59, 59, 64, 71, 64, 213, 92, 65, - 68, 65, 61, 744, 69, 72, 199, 92, 73, 106, - 66, 96, 66, 187, 187, 187, 187, 72, 743, 200, - 73, 93, 93, 93, 93, 745, 586, 234, 92, 93, - 93, 93, 93, 185, 290, 113, 92, 100, 100, 100, - 100, 125, 745, 98, 92, 126, 170, 113, 127, 113, - 213, 249, 100, 100, 113, 213, 92, 187, 187, 187, - 187, 74, 291, 75, 102, 102, 102, 102, 102, 102, - 102, 102, 213, 74, 745, 75, 76, 77, 78, 77, - 77, 76, 76, 76, 76, 76, 76, 76, 76, 76, - - 76, 76, 93, 93, 93, 93, 213, 213, 290, 213, - 76, 76, 76, 76, 76, 92, 285, 233, 255, 80, - 103, 113, 286, 102, 104, 104, 104, 104, 104, 104, - 104, 113, 740, 113, 739, 113, 291, 213, 245, 213, - 113, 76, 76, 76, 107, 113, 108, 108, 108, 108, - 108, 108, 108, 108, 288, 113, 288, 113, 315, 113, - 270, 266, 213, 109, 143, 289, 77, 76, 77, 76, - 77, 78, 77, 77, 76, 76, 76, 76, 76, 76, - 76, 76, 76, 76, 76, 213, 327, 271, 279, 280, - 213, 144, 109, 76, 76, 76, 76, 76, 113, 185, - - 272, 120, 80, 426, 113, 121, 738, 128, 113, 122, - 113, 123, 113, 185, 113, 354, 113, 113, 113, 113, - 741, 124, 745, 113, 76, 76, 76, 185, 361, 113, - 129, 130, 737, 113, 187, 187, 187, 187, 113, 331, - 488, 131, 736, 735, 316, 185, 469, 742, 734, 77, - 76, 77, 33, 81, 82, 81, 81, 33, 33, 83, - 33, 33, 33, 33, 84, 85, 33, 86, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, - - 87, 87, 87, 87, 87, 87, 87, 88, 89, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 90, 33, 91, 92, 113, 733, 288, 155, - 288, 732, 731, 213, 730, 729, 113, 213, 113, 289, - 113, 213, 96, 213, 213, 113, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 213, 213, 98, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - - 99, 99, 99, 99, 99, 99, 99, 107, 336, 110, - 110, 110, 110, 110, 110, 110, 110, 132, 113, 213, - 213, 145, 146, 213, 213, 147, 109, 745, 113, 727, - 113, 113, 113, 113, 133, 148, 213, 113, 141, 113, - 113, 213, 386, 726, 725, 629, 142, 352, 213, 113, - 149, 113, 213, 113, 720, 109, 112, 719, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 213, 346, 353, - 403, 510, 113, 114, 113, 113, 113, 113, 113, 113, - 113, 113, 113, 115, 113, 116, 113, 117, 113, 113, - 113, 113, 118, 113, 113, 113, 113, 113, 408, 421, - - 387, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 113, 213, 213, 213, 399, 136, 113, - 213, 137, 213, 113, 213, 113, 213, 113, 213, 113, - 138, 139, 113, 113, 213, 213, 140, 213, 113, 213, - 150, 113, 213, 151, 213, 134, 213, 100, 100, 100, - 100, 152, 213, 113, 197, 113, 135, 153, 113, 450, - 113, 156, 100, 100, 420, 157, 160, 472, 113, 451, - 113, 213, 113, 478, 161, 113, 158, 113, 113, 213, - 422, 159, 414, 485, 154, 113, 431, 113, 113, 113, - - 164, 162, 113, 481, 113, 452, 165, 113, 113, 464, - 538, 113, 741, 213, 467, 492, 484, 163, 113, 113, - 113, 113, 113, 113, 745, 113, 168, 113, 166, 113, - 113, 113, 525, 113, 173, 173, 173, 173, 113, 742, - 213, 477, 511, 213, 167, 213, 213, 213, 522, 174, - 174, 174, 174, 174, 174, 175, 175, 184, 173, 173, - 173, 173, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 174, 174, 174, 174, 174, 174, 175, - 175, 184, 184, 184, 184, 184, 107, 113, 108, 108, - 108, 108, 108, 108, 108, 108, 213, 113, 509, 113, - - 483, 113, 213, 546, 208, 109, 113, 537, 213, 718, - 534, 745, 184, 184, 184, 213, 213, 423, 423, 423, - 423, 107, 213, 201, 201, 201, 201, 201, 201, 201, - 201, 213, 213, 713, 109, 213, 560, 213, 184, 184, - 109, 644, 570, 523, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 203, 203, 203, 203, 203, - 203, 203, 203, 184, 184, 184, 184, 184, 530, 109, - 574, 107, 109, 108, 108, 108, 108, 108, 108, 108, - 108, 186, 203, 203, 203, 203, 203, 203, 203, 203, - 109, 213, 561, 213, 184, 184, 184, 204, 425, 204, - - 213, 109, 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, 213, 109, - 184, 107, 113, 110, 110, 110, 110, 110, 110, 110, - 110, 213, 209, 113, 113, 213, 113, 711, 213, 113, - 109, 113, 536, 113, 533, 113, 213, 113, 710, 113, - 213, 113, 113, 211, 709, 275, 210, 577, 113, 175, - 175, 175, 175, 175, 175, 175, 175, 539, 213, 109, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 113, 113, 213, 540, 582, 213, 214, 572, - - 599, 213, 113, 113, 113, 113, 113, 113, 113, 113, - 212, 113, 113, 581, 213, 213, 213, 213, 113, 113, - 113, 113, 113, 216, 113, 213, 215, 113, 113, 213, - 113, 558, 213, 213, 113, 578, 113, 217, 113, 703, - 113, 213, 113, 113, 113, 218, 113, 580, 583, 113, - 559, 220, 113, 213, 213, 213, 113, 700, 113, 219, - 113, 213, 113, 113, 113, 113, 113, 590, 602, 213, - 213, 113, 695, 113, 221, 222, 113, 113, 611, 224, - 223, 600, 113, 213, 213, 694, 113, 601, 113, 113, - 113, 113, 606, 113, 609, 113, 113, 228, 113, 113, - - 225, 226, 213, 608, 613, 213, 113, 113, 113, 113, - 229, 113, 616, 113, 230, 113, 614, 231, 227, 113, - 113, 113, 622, 619, 617, 235, 113, 213, 213, 213, - 113, 213, 113, 232, 113, 113, 618, 213, 113, 113, - 213, 236, 213, 632, 634, 113, 113, 113, 113, 113, - 113, 185, 113, 693, 113, 213, 113, 113, 113, 688, - 237, 113, 238, 643, 213, 113, 678, 648, 686, 213, - 213, 113, 113, 113, 213, 113, 633, 213, 239, 240, - 113, 638, 113, 113, 113, 241, 113, 641, 646, 113, - 658, 113, 213, 113, 683, 113, 675, 113, 674, 113, - - 113, 243, 113, 113, 647, 242, 213, 213, 113, 213, - 244, 213, 113, 113, 113, 640, 113, 213, 213, 113, - 213, 246, 657, 113, 645, 113, 113, 113, 113, 113, - 113, 662, 113, 213, 247, 113, 702, 113, 213, 113, - 113, 113, 213, 113, 213, 659, 213, 113, 113, 113, - 113, 113, 113, 113, 113, 248, 113, 213, 250, 113, - 664, 213, 213, 113, 113, 113, 649, 113, 677, 665, - 213, 669, 113, 251, 113, 213, 113, 113, 113, 667, - 253, 673, 670, 252, 254, 213, 672, 113, 213, 113, - 213, 113, 256, 113, 213, 685, 113, 682, 671, 113, - - 213, 679, 213, 257, 213, 113, 213, 113, 697, 113, - 113, 113, 113, 113, 258, 213, 113, 259, 113, 684, - 113, 687, 113, 691, 113, 263, 113, 113, 113, 113, - 113, 712, 261, 213, 260, 113, 668, 113, 113, 262, - 666, 113, 689, 698, 113, 692, 113, 704, 113, 264, - 113, 663, 113, 699, 113, 113, 113, 113, 113, 706, - 690, 113, 213, 113, 728, 113, 701, 113, 267, 113, - 213, 113, 213, 113, 265, 113, 113, 113, 268, 213, - 113, 269, 620, 620, 620, 620, 113, 113, 113, 113, - 113, 113, 213, 276, 273, 113, 113, 175, 175, 175, - - 175, 175, 175, 175, 175, 107, 213, 201, 201, 201, - 201, 201, 201, 201, 201, 113, 113, 655, 292, 707, - 213, 705, 213, 708, 109, 113, 113, 113, 113, 113, - 113, 113, 113, 213, 113, 113, 715, 213, 651, 650, - 213, 113, 293, 113, 113, 113, 113, 113, 642, 716, - 113, 113, 639, 109, 112, 113, 213, 113, 113, 113, - 294, 113, 295, 621, 722, 113, 113, 113, 113, 113, - 113, 113, 113, 717, 113, 213, 213, 113, 623, 113, - 610, 113, 714, 113, 723, 113, 721, 607, 296, 297, - 113, 113, 213, 113, 620, 620, 620, 620, 113, 207, - - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 113, 113, 573, 569, 543, 724, 542, 527, 299, - 489, 113, 113, 113, 113, 113, 113, 298, 113, 113, - 113, 113, 427, 360, 362, 195, 193, 191, 113, 113, - 113, 113, 113, 301, 113, 300, 189, 113, 113, 185, - 360, 171, 745, 213, 113, 286, 113, 195, 113, 304, - 113, 302, 303, 113, 193, 621, 113, 305, 282, 306, - 113, 189, 113, 185, 113, 278, 113, 113, 113, 113, - 113, 277, 171, 113, 213, 113, 205, 113, 202, 113, - - 307, 113, 198, 113, 113, 113, 113, 113, 195, 193, - 113, 192, 113, 309, 113, 308, 113, 191, 113, 191, - 113, 113, 113, 113, 113, 189, 106, 113, 188, 113, - 312, 310, 183, 113, 311, 113, 181, 113, 113, 113, - 113, 113, 106, 179, 178, 177, 113, 171, 113, 113, - 113, 169, 113, 111, 105, 313, 95, 113, 92, 113, - 314, 113, 113, 113, 92, 745, 745, 745, 113, 745, - 113, 745, 113, 113, 113, 745, 113, 745, 745, 317, - 113, 113, 318, 319, 113, 113, 320, 113, 113, 113, - 745, 113, 113, 745, 113, 745, 745, 323, 321, 745, - - 113, 113, 113, 113, 113, 113, 113, 113, 113, 322, - 113, 324, 113, 113, 745, 745, 745, 745, 745, 745, - 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, - 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, - 745, 745, 325, 745, 113, 745, 326, 328, 113, 745, - 113, 745, 745, 745, 113, 113, 113, 113, 113, 745, - 329, 745, 745, 113, 745, 113, 745, 113, 113, 113, - 745, 113, 330, 745, 745, 113, 113, 113, 113, 113, - 113, 113, 113, 745, 113, 745, 332, 113, 745, 113, - 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, - - 113, 113, 745, 113, 745, 113, 333, 113, 113, 113, - 745, 113, 745, 745, 334, 113, 113, 113, 113, 113, - 338, 113, 745, 745, 113, 335, 745, 745, 337, 113, - 113, 113, 113, 113, 745, 113, 745, 113, 745, 113, - 113, 113, 113, 113, 745, 745, 745, 745, 339, 745, - 113, 745, 113, 340, 113, 745, 113, 745, 113, 745, - 113, 113, 113, 745, 113, 341, 113, 745, 113, 113, - 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, - 113, 745, 745, 745, 342, 113, 745, 113, 745, 113, - 745, 113, 745, 113, 745, 745, 343, 113, 113, 113, - - 113, 113, 745, 345, 344, 745, 113, 745, 113, 745, - 113, 745, 113, 745, 113, 745, 745, 351, 113, 113, - 113, 347, 113, 348, 113, 113, 745, 113, 349, 745, - 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, - 113, 745, 350, 113, 113, 745, 355, 745, 745, 745, - 113, 745, 113, 745, 113, 356, 356, 356, 356, 113, - 745, 745, 745, 358, 358, 358, 358, 745, 745, 745, - 357, 357, 357, 357, 357, 357, 357, 357, 359, 359, - 359, 359, 359, 359, 359, 359, 113, 113, 745, 745, - 745, 745, 745, 745, 364, 745, 113, 113, 363, 113, - - 113, 113, 113, 745, 745, 113, 113, 745, 113, 745, - 745, 745, 113, 365, 113, 745, 113, 745, 113, 113, - 366, 113, 113, 745, 745, 113, 745, 113, 368, 113, - 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, - 369, 113, 113, 370, 113, 745, 745, 745, 745, 745, - 745, 113, 113, 113, 113, 113, 113, 113, 745, 745, - 113, 113, 745, 745, 367, 113, 745, 113, 745, 113, - 745, 113, 745, 113, 371, 113, 113, 113, 372, 113, - 745, 745, 745, 113, 113, 113, 113, 113, 374, 113, - 745, 373, 113, 745, 745, 745, 113, 113, 113, 113, - - 113, 113, 745, 113, 745, 375, 745, 113, 113, 376, - 113, 113, 377, 113, 745, 378, 113, 745, 745, 745, - 113, 745, 113, 113, 113, 113, 745, 113, 113, 113, - 745, 379, 113, 745, 113, 745, 745, 745, 113, 745, - 113, 745, 113, 745, 113, 113, 113, 113, 380, 745, - 745, 113, 381, 113, 745, 113, 745, 113, 745, 113, - 745, 113, 113, 113, 113, 113, 745, 382, 745, 745, - 113, 745, 113, 745, 383, 745, 113, 113, 384, 745, - 385, 113, 745, 113, 745, 745, 745, 113, 745, 113, - 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, - - 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, - 113, 745, 113, 113, 113, 113, 113, 745, 389, 113, - 745, 745, 390, 745, 745, 113, 113, 113, 113, 113, - 113, 113, 391, 745, 113, 113, 393, 113, 745, 388, - 745, 113, 745, 113, 397, 113, 745, 113, 745, 113, - 392, 113, 113, 394, 745, 113, 113, 395, 745, 745, - 745, 745, 113, 113, 113, 113, 113, 113, 396, 113, - 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, - 398, 745, 113, 745, 113, 400, 113, 113, 113, 745, - 113, 745, 745, 745, 113, 113, 113, 113, 113, 113, - - 113, 113, 745, 113, 405, 401, 113, 745, 113, 745, - 113, 404, 113, 402, 113, 745, 745, 745, 113, 113, - 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, - 745, 113, 406, 113, 745, 113, 407, 113, 745, 113, - 113, 113, 745, 113, 745, 113, 745, 113, 113, 113, - 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, - 745, 745, 745, 113, 113, 113, 113, 113, 745, 410, - 745, 409, 113, 745, 113, 745, 113, 113, 113, 745, - 113, 745, 745, 745, 113, 113, 113, 113, 113, 411, - 745, 113, 113, 113, 412, 113, 113, 745, 113, 745, - - 745, 745, 113, 745, 113, 113, 113, 113, 113, 113, - 113, 113, 113, 113, 113, 745, 113, 113, 745, 113, - 745, 745, 745, 113, 745, 113, 113, 113, 415, 113, - 113, 113, 113, 113, 745, 113, 113, 413, 416, 417, - 745, 745, 113, 745, 745, 745, 113, 745, 113, 745, - 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, - 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, - 419, 745, 113, 745, 356, 356, 356, 356, 418, 113, - 745, 113, 745, 113, 745, 745, 745, 745, 113, 357, - 357, 357, 357, 357, 357, 357, 357, 423, 423, 423, - - 423, 745, 745, 745, 745, 745, 745, 745, 424, 745, - 745, 745, 357, 357, 357, 357, 357, 357, 357, 357, - 358, 358, 358, 358, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 359, 359, 359, 359, 359, - 359, 359, 359, 424, 745, 113, 745, 359, 359, 359, - 359, 359, 359, 359, 359, 113, 745, 113, 745, 113, - 113, 429, 745, 428, 113, 745, 745, 745, 745, 745, - 113, 745, 113, 113, 113, 430, 113, 745, 425, 113, - 745, 745, 745, 113, 745, 113, 113, 113, 113, 745, - 113, 745, 113, 432, 113, 113, 745, 113, 433, 745, - - 113, 745, 745, 434, 113, 745, 113, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 745, 113, 113, - 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, - 435, 745, 113, 745, 113, 745, 113, 113, 113, 113, - 113, 745, 436, 745, 745, 113, 437, 113, 745, 113, - 745, 113, 745, 113, 745, 745, 745, 438, 113, 113, - 113, 113, 745, 439, 745, 745, 113, 440, 745, 745, - 113, 113, 113, 441, 113, 745, 745, 113, 745, 113, - 442, 113, 745, 113, 443, 113, 745, 113, 113, 113, - 113, 113, 745, 745, 745, 745, 113, 745, 113, 113, - - 113, 745, 113, 745, 444, 745, 745, 113, 745, 113, - 745, 113, 745, 113, 113, 446, 745, 445, 113, 745, - 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, - 113, 113, 113, 113, 113, 745, 745, 113, 447, 113, - 745, 113, 745, 113, 745, 113, 745, 113, 448, 449, - 113, 113, 113, 113, 745, 745, 113, 745, 745, 745, - 453, 745, 113, 113, 113, 113, 113, 113, 745, 745, - 113, 113, 113, 113, 454, 745, 455, 745, 745, 745, - 113, 745, 113, 113, 113, 113, 745, 113, 456, 113, - 113, 113, 113, 457, 745, 745, 745, 745, 745, 745, - - 113, 113, 458, 113, 113, 113, 113, 745, 745, 113, - 113, 745, 113, 745, 745, 460, 113, 745, 113, 745, - 113, 745, 113, 113, 113, 459, 113, 462, 745, 745, - 463, 113, 745, 113, 745, 113, 113, 113, 745, 745, - 461, 745, 113, 745, 113, 745, 113, 113, 113, 745, - 113, 745, 745, 745, 113, 113, 113, 113, 113, 113, - 113, 113, 465, 113, 745, 745, 113, 745, 113, 745, - 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, - 466, 745, 113, 745, 113, 745, 113, 113, 113, 745, - 113, 745, 468, 745, 113, 113, 470, 113, 113, 745, - - 745, 745, 745, 113, 745, 745, 745, 113, 745, 113, - 113, 113, 745, 113, 745, 471, 113, 473, 745, 745, - 113, 113, 113, 113, 113, 474, 475, 113, 745, 113, - 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, - 113, 745, 745, 745, 113, 113, 113, 745, 113, 745, - 745, 113, 745, 113, 479, 113, 476, 113, 745, 113, - 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, - 113, 745, 113, 113, 113, 745, 113, 745, 480, 745, - 745, 113, 745, 113, 745, 113, 745, 113, 486, 486, - 486, 486, 113, 745, 745, 745, 745, 745, 745, 745, - - 745, 113, 745, 487, 487, 487, 487, 487, 487, 487, - 487, 113, 745, 113, 113, 113, 490, 113, 482, 745, - 113, 745, 745, 745, 113, 113, 113, 113, 113, 113, - 745, 113, 491, 113, 745, 113, 113, 493, 113, 113, - 745, 113, 745, 745, 113, 745, 745, 745, 113, 745, - 113, 113, 113, 113, 745, 113, 494, 113, 113, 745, - 113, 495, 745, 496, 113, 745, 745, 745, 113, 745, - 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, - 745, 113, 745, 113, 745, 113, 745, 497, 745, 113, - 745, 113, 745, 113, 113, 113, 113, 745, 499, 498, - - 113, 745, 113, 745, 745, 745, 113, 745, 113, 745, - 113, 745, 113, 745, 113, 113, 113, 745, 745, 113, - 500, 113, 501, 745, 745, 113, 745, 502, 745, 113, - 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, - 745, 504, 113, 745, 113, 745, 113, 745, 503, 745, - 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, - 745, 113, 745, 113, 745, 113, 505, 113, 745, 113, - 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, - 113, 745, 113, 507, 113, 745, 113, 506, 113, 113, - 113, 508, 113, 113, 745, 113, 745, 512, 745, 745, - - 745, 745, 113, 113, 113, 113, 113, 113, 113, 745, - 745, 113, 113, 745, 113, 513, 514, 745, 113, 745, - 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, - 745, 113, 745, 113, 516, 113, 745, 113, 745, 113, - 745, 113, 515, 113, 113, 113, 113, 517, 745, 745, - 113, 745, 113, 518, 745, 745, 113, 745, 113, 745, - 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, - 745, 113, 745, 113, 745, 113, 745, 113, 113, 519, - 745, 520, 113, 745, 113, 745, 745, 745, 113, 745, - 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, - - 745, 521, 745, 113, 745, 113, 745, 113, 113, 113, - 524, 113, 745, 745, 113, 745, 745, 745, 113, 113, - 526, 113, 113, 113, 745, 113, 745, 113, 745, 113, - 113, 113, 113, 113, 745, 529, 745, 528, 113, 745, - 113, 745, 113, 745, 113, 745, 113, 745, 745, 745, - 113, 113, 113, 745, 113, 113, 532, 745, 113, 113, - 531, 113, 745, 745, 745, 113, 745, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, - 113, 745, 745, 745, 745, 745, 113, 745, 113, 113, - 113, 113, 745, 113, 113, 113, 535, 745, 113, 486, - - 486, 486, 486, 745, 113, 745, 113, 745, 113, 745, - 745, 745, 544, 113, 487, 487, 487, 487, 487, 487, - 487, 487, 541, 745, 745, 745, 487, 487, 487, 487, - 487, 487, 487, 487, 113, 113, 745, 745, 745, 745, - 745, 545, 745, 745, 113, 113, 113, 113, 113, 113, - 745, 113, 113, 113, 113, 547, 745, 745, 745, 745, - 745, 113, 113, 548, 113, 113, 113, 113, 113, 745, - 113, 113, 745, 745, 549, 550, 745, 113, 113, 113, - 113, 113, 113, 113, 113, 745, 113, 113, 745, 745, - 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, - - 745, 745, 113, 113, 745, 113, 551, 552, 745, 113, - 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, - 745, 745, 113, 745, 113, 745, 113, 553, 113, 745, - 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, - 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, - 745, 554, 113, 745, 113, 113, 113, 745, 113, 745, - 745, 556, 555, 113, 745, 113, 745, 113, 745, 113, - 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, - 113, 745, 557, 745, 113, 562, 113, 745, 113, 113, - 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, - - 113, 113, 745, 113, 745, 745, 113, 563, 113, 745, - 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, - 113, 745, 745, 113, 745, 113, 565, 113, 745, 113, - 745, 113, 745, 113, 564, 113, 113, 113, 113, 113, - 745, 745, 113, 745, 745, 745, 745, 745, 113, 113, - 113, 113, 113, 113, 113, 567, 566, 113, 113, 745, - 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, - 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, - 745, 571, 745, 113, 745, 113, 745, 113, 113, 113, - 113, 113, 745, 745, 113, 745, 113, 745, 113, 745, - - 113, 745, 113, 745, 113, 568, 113, 113, 113, 113, - 745, 745, 575, 113, 745, 113, 745, 745, 576, 113, - 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, - 579, 113, 745, 745, 113, 745, 584, 584, 584, 584, - 745, 113, 745, 113, 745, 113, 745, 745, 745, 745, - 113, 585, 585, 585, 585, 585, 585, 585, 585, 113, - 113, 589, 745, 745, 745, 745, 588, 745, 745, 113, - 113, 113, 113, 113, 113, 113, 745, 745, 113, 113, - 745, 745, 745, 113, 745, 113, 113, 113, 745, 113, - 745, 591, 745, 113, 113, 113, 113, 113, 593, 113, - - 113, 592, 113, 745, 745, 113, 596, 113, 745, 113, - 745, 594, 745, 113, 745, 113, 745, 113, 113, 113, - 595, 113, 745, 113, 745, 113, 113, 113, 745, 113, - 745, 745, 745, 113, 113, 113, 113, 113, 745, 597, - 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, - 113, 745, 113, 745, 113, 113, 113, 745, 113, 598, - 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, - 113, 113, 113, 113, 113, 745, 603, 745, 745, 113, - 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, - 745, 113, 113, 113, 113, 113, 113, 113, 113, 745, - - 113, 745, 745, 113, 745, 113, 745, 113, 113, 113, - 745, 113, 604, 745, 745, 113, 113, 113, 113, 113, - 113, 113, 113, 745, 113, 612, 605, 113, 745, 113, - 745, 113, 745, 113, 745, 113, 745, 745, 745, 113, - 113, 113, 113, 113, 745, 113, 745, 745, 113, 745, - 745, 745, 113, 745, 113, 615, 113, 113, 745, 113, - 113, 113, 745, 745, 113, 584, 584, 584, 584, 745, - 113, 745, 113, 624, 113, 745, 745, 745, 113, 113, - 585, 585, 585, 585, 585, 585, 585, 585, 113, 113, - 113, 745, 113, 745, 745, 113, 745, 113, 745, 113, - - 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, - 113, 113, 625, 626, 113, 745, 627, 745, 745, 745, - 113, 113, 113, 113, 113, 113, 113, 745, 745, 113, - 113, 745, 113, 745, 630, 745, 113, 745, 628, 745, - 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, - 745, 113, 745, 631, 745, 113, 745, 113, 745, 113, - 113, 113, 113, 113, 745, 635, 745, 745, 113, 745, - 113, 113, 113, 636, 113, 745, 745, 113, 637, 113, - 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, - 113, 113, 745, 745, 113, 745, 113, 745, 113, 745, - - 652, 745, 113, 745, 113, 745, 113, 113, 113, 113, - 113, 653, 745, 113, 745, 745, 745, 745, 745, 113, - 113, 113, 113, 113, 113, 113, 113, 745, 113, 113, - 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, - 113, 113, 654, 745, 113, 113, 745, 113, 656, 745, - 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, - 113, 113, 745, 745, 745, 745, 113, 745, 113, 113, - 660, 745, 113, 745, 745, 113, 745, 113, 745, 113, - 745, 113, 661, 113, 745, 113, 113, 113, 113, 113, - 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, - - 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, - 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, - 113, 676, 113, 745, 113, 745, 113, 745, 113, 745, - 113, 680, 681, 113, 113, 113, 113, 745, 745, 113, - 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, - 113, 113, 113, 745, 113, 113, 745, 745, 696, 745, - 745, 113, 113, 113, 113, 113, 113, 745, 745, 745, - 113, 113, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 67, 67, - - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 94, 94, 94, - 94, 745, 94, 94, 94, 94, 94, 94, 94, 94, - 101, 101, 101, 745, 101, 745, 101, 745, 101, 172, - 172, 745, 172, 172, 176, 176, 745, 745, 176, 176, - 745, 176, 176, 176, 176, 176, 176, 180, 180, 180, - 180, 745, 180, 180, 180, 180, 180, 180, 180, 180, - 182, 182, 182, 182, 182, 182, 182, 182, 745, 182, - - 182, 184, 745, 745, 745, 184, 184, 184, 184, 184, - 184, 184, 185, 745, 745, 745, 185, 185, 185, 185, - 185, 185, 185, 190, 190, 745, 190, 190, 194, 194, - 745, 194, 194, 196, 196, 745, 196, 196, 206, 745, - 206, 206, 119, 119, 745, 119, 119, 274, 745, 274, - 274, 281, 745, 281, 281, 283, 745, 283, 283, 284, - 745, 284, 284, 287, 287, 287, 287, 287, 287, 287, - 287, 287, 287, 287, 287, 287, 207, 207, 745, 207, - 207, 587, 587, 745, 587, 587, 587, 587, 587, 587, - 587, 587, 587, 587, 585, 585, 585, 745, 745, 745, - - 585, 745, 745, 745, 745, 585, 17, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745 - } ; - -static yyconst flex_int16_t yy_chk[4591] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 3, 3, 4, 4, 4, 5, - 5, 5, 135, 11, 3, 9, 7, 4, 8, 9, - - 5, 6, 6, 6, 7, 12, 8, 149, 54, 7, - 10, 8, 6, 743, 10, 11, 103, 29, 11, 29, - 7, 98, 8, 81, 81, 81, 81, 12, 742, 103, - 12, 19, 19, 19, 19, 83, 542, 135, 19, 20, - 20, 20, 20, 542, 200, 36, 20, 24, 24, 24, - 24, 36, 83, 98, 24, 36, 54, 36, 36, 36, - 134, 149, 24, 24, 36, 154, 26, 82, 82, 82, - 82, 11, 200, 11, 26, 26, 26, 26, 26, 26, - 26, 26, 144, 12, 83, 12, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - - 13, 13, 93, 93, 93, 93, 163, 166, 290, 233, - 13, 13, 13, 13, 13, 27, 197, 134, 154, 13, - 27, 41, 197, 27, 27, 27, 27, 27, 27, 27, - 27, 41, 739, 41, 738, 41, 290, 245, 144, 167, - 41, 13, 13, 13, 30, 44, 30, 30, 30, 30, - 30, 30, 30, 30, 199, 44, 199, 44, 233, 44, - 166, 163, 272, 30, 44, 199, 13, 13, 13, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 234, 245, 167, 186, 186, - 249, 44, 30, 14, 14, 14, 14, 14, 35, 186, - - 167, 35, 14, 361, 37, 35, 737, 37, 35, 35, - 35, 35, 35, 361, 37, 272, 37, 35, 37, 38, - 740, 35, 405, 37, 14, 14, 14, 279, 279, 38, - 38, 38, 736, 38, 187, 187, 187, 187, 38, 249, - 426, 38, 735, 734, 234, 426, 405, 740, 733, 14, - 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 23, 47, 732, 289, 47, - 289, 731, 730, 728, 726, 725, 47, 724, 47, 289, - 47, 255, 23, 723, 721, 47, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 315, 270, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - - 23, 23, 23, 23, 23, 23, 23, 31, 255, 31, - 31, 31, 31, 31, 31, 31, 31, 39, 39, 266, - 271, 45, 45, 331, 451, 45, 31, 596, 39, 720, - 39, 45, 39, 45, 39, 45, 336, 39, 43, 43, - 45, 353, 315, 719, 718, 596, 43, 270, 316, 43, - 45, 43, 717, 43, 711, 31, 34, 710, 43, 34, - 34, 34, 34, 34, 34, 34, 34, 327, 266, 271, - 331, 451, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 336, 353, - - 316, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 40, 386, 352, 387, 327, 42, 42, - 346, 42, 408, 40, 414, 40, 367, 40, 422, 42, - 42, 42, 40, 42, 354, 388, 42, 418, 42, 483, - 46, 46, 403, 46, 421, 40, 399, 100, 100, 100, - 100, 46, 431, 46, 100, 46, 40, 46, 48, 386, - 46, 48, 100, 100, 352, 48, 49, 408, 48, 387, - 48, 413, 48, 414, 49, 49, 48, 48, 50, 452, - 354, 48, 346, 422, 46, 49, 367, 49, 50, 49, - - 50, 49, 50, 418, 49, 388, 50, 50, 51, 399, - 483, 113, 741, 467, 403, 431, 421, 49, 51, 52, - 51, 113, 51, 113, 463, 113, 52, 51, 50, 52, - 113, 52, 467, 52, 56, 56, 56, 56, 52, 741, - 420, 413, 452, 450, 51, 478, 492, 482, 463, 56, - 56, 56, 56, 56, 56, 56, 56, 79, 173, 173, - 173, 173, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 173, 173, 173, 173, 173, 173, 173, - 173, 79, 79, 79, 79, 79, 102, 114, 102, 102, - 102, 102, 102, 102, 102, 102, 464, 114, 450, 114, - - 420, 114, 510, 492, 114, 102, 114, 482, 523, 709, - 478, 612, 79, 79, 79, 530, 708, 423, 423, 423, - 423, 104, 472, 104, 104, 104, 104, 104, 104, 104, - 104, 705, 701, 700, 102, 511, 510, 699, 79, 80, - 104, 612, 523, 464, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 107, 107, 107, 107, 107, - 107, 107, 107, 80, 80, 80, 80, 80, 472, 104, - 530, 108, 107, 108, 108, 108, 108, 108, 108, 108, - 108, 80, 203, 203, 203, 203, 203, 203, 203, 203, - 108, 477, 511, 481, 80, 80, 80, 109, 423, 109, - - 533, 107, 109, 109, 109, 109, 109, 109, 109, 109, - 204, 204, 204, 204, 204, 204, 204, 204, 484, 108, - 80, 110, 115, 110, 110, 110, 110, 110, 110, 110, - 110, 539, 115, 116, 115, 697, 115, 695, 558, 117, - 110, 115, 481, 116, 477, 116, 485, 116, 694, 117, - 525, 117, 116, 117, 693, 174, 116, 533, 117, 174, - 174, 174, 174, 174, 174, 174, 174, 484, 538, 110, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 118, 120, 537, 485, 539, 509, 120, 525, - - 558, 534, 118, 120, 118, 120, 118, 120, 121, 122, - 118, 118, 120, 538, 540, 559, 546, 561, 121, 122, - 121, 122, 121, 122, 123, 560, 121, 121, 122, 574, - 124, 509, 568, 572, 123, 534, 123, 123, 123, 686, - 124, 570, 124, 123, 124, 125, 125, 537, 540, 124, - 509, 126, 126, 577, 578, 580, 125, 683, 125, 125, - 125, 583, 126, 127, 126, 125, 126, 546, 561, 581, - 682, 126, 675, 127, 127, 127, 128, 127, 574, 129, - 128, 559, 127, 599, 601, 674, 128, 560, 128, 129, - 128, 129, 568, 129, 572, 128, 131, 131, 129, 130, - - 130, 130, 582, 570, 577, 618, 131, 132, 131, 130, - 131, 130, 580, 130, 131, 131, 578, 132, 130, 132, - 133, 132, 586, 583, 581, 136, 132, 600, 606, 611, - 133, 658, 133, 133, 133, 136, 582, 616, 137, 133, - 609, 137, 633, 599, 601, 136, 138, 136, 137, 136, - 137, 586, 137, 673, 136, 608, 138, 137, 138, 668, - 138, 139, 139, 611, 614, 138, 658, 618, 666, 632, - 617, 139, 140, 139, 638, 139, 600, 685, 139, 139, - 139, 606, 140, 141, 140, 140, 140, 609, 616, 142, - 633, 140, 634, 141, 663, 141, 655, 141, 651, 142, - - 143, 142, 141, 142, 617, 141, 619, 640, 142, 641, - 143, 657, 143, 145, 143, 608, 146, 643, 645, 143, - 647, 145, 632, 145, 614, 145, 146, 145, 146, 147, - 146, 638, 145, 649, 146, 146, 685, 148, 648, 147, - 150, 147, 665, 147, 659, 634, 662, 148, 147, 148, - 150, 148, 150, 151, 150, 148, 148, 677, 150, 150, - 640, 667, 664, 151, 152, 151, 619, 151, 657, 641, - 671, 645, 151, 151, 152, 698, 152, 153, 152, 643, - 153, 650, 647, 152, 153, 669, 649, 153, 672, 153, - 678, 153, 155, 155, 687, 665, 153, 662, 648, 156, - - 670, 659, 679, 155, 722, 155, 690, 155, 677, 156, - 157, 156, 155, 156, 156, 684, 158, 156, 156, 664, - 157, 667, 157, 671, 157, 160, 158, 159, 158, 157, - 158, 698, 158, 646, 157, 158, 644, 159, 160, 159, - 642, 159, 669, 678, 161, 672, 159, 687, 160, 161, - 160, 639, 160, 679, 161, 162, 161, 160, 161, 690, - 670, 164, 691, 161, 722, 162, 684, 162, 164, 162, - 689, 164, 692, 164, 162, 164, 168, 165, 165, 704, - 164, 165, 585, 585, 585, 585, 168, 165, 168, 165, - 168, 165, 706, 175, 168, 168, 165, 175, 175, 175, - - 175, 175, 175, 175, 175, 201, 714, 201, 201, 201, - 201, 201, 201, 201, 201, 208, 209, 629, 208, 691, - 702, 689, 707, 692, 201, 208, 209, 208, 209, 208, - 209, 210, 211, 715, 208, 209, 704, 712, 623, 622, - 613, 210, 211, 210, 211, 210, 211, 212, 610, 706, - 210, 211, 607, 201, 206, 214, 602, 212, 215, 212, - 212, 212, 214, 585, 714, 214, 212, 214, 215, 214, - 215, 216, 215, 707, 214, 716, 590, 215, 587, 217, - 573, 216, 702, 216, 715, 216, 712, 569, 216, 217, - 216, 217, 536, 217, 620, 620, 620, 620, 217, 206, - - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 218, 219, 527, 522, 489, 716, 488, 469, 219, - 427, 218, 219, 218, 219, 218, 219, 218, 220, 221, - 218, 219, 362, 360, 291, 284, 283, 282, 220, 221, - 220, 221, 220, 221, 222, 220, 281, 220, 221, 280, - 277, 274, 213, 207, 222, 198, 222, 196, 222, 223, - 223, 222, 222, 222, 194, 620, 224, 223, 192, 224, - 223, 190, 223, 185, 223, 183, 224, 225, 224, 223, - 224, 178, 172, 226, 119, 224, 111, 225, 105, 225, - - 225, 225, 101, 226, 227, 226, 225, 226, 99, 97, - 228, 96, 226, 228, 227, 227, 227, 95, 227, 92, - 228, 229, 228, 227, 228, 87, 86, 230, 85, 228, - 230, 229, 72, 229, 229, 229, 69, 230, 231, 230, - 229, 230, 65, 64, 61, 60, 230, 55, 231, 232, - 231, 53, 231, 32, 28, 231, 22, 231, 21, 232, - 232, 232, 235, 232, 18, 17, 0, 0, 232, 0, - 236, 0, 235, 237, 235, 0, 235, 0, 0, 235, - 236, 235, 236, 237, 236, 237, 237, 237, 238, 236, - 0, 239, 237, 0, 240, 0, 0, 240, 238, 0, - - 238, 239, 238, 239, 240, 239, 240, 238, 240, 239, - 239, 241, 242, 240, 0, 0, 0, 0, 0, 0, - 241, 0, 242, 243, 242, 0, 242, 0, 0, 0, - 241, 242, 241, 243, 241, 243, 244, 243, 0, 241, - 0, 0, 243, 0, 246, 0, 244, 246, 244, 0, - 244, 0, 0, 0, 246, 244, 246, 247, 246, 0, - 247, 0, 0, 246, 0, 248, 0, 247, 250, 247, - 0, 247, 248, 0, 0, 248, 247, 248, 250, 248, - 250, 251, 250, 0, 248, 0, 250, 250, 0, 252, - 0, 251, 0, 251, 0, 251, 0, 253, 0, 252, - - 251, 252, 0, 252, 0, 254, 252, 253, 252, 253, - 0, 253, 0, 0, 253, 254, 253, 254, 256, 254, - 257, 257, 0, 0, 254, 254, 0, 0, 256, 258, - 256, 257, 256, 257, 0, 257, 0, 256, 0, 258, - 257, 258, 259, 258, 0, 0, 0, 0, 258, 0, - 260, 0, 259, 260, 259, 0, 259, 0, 261, 0, - 260, 259, 260, 0, 260, 261, 262, 0, 261, 260, - 261, 0, 261, 0, 0, 0, 262, 261, 262, 263, - 262, 0, 0, 0, 262, 262, 0, 264, 0, 263, - 0, 263, 0, 263, 0, 0, 263, 264, 263, 264, - - 265, 264, 0, 265, 264, 0, 264, 0, 267, 0, - 265, 0, 265, 0, 265, 0, 0, 269, 267, 265, - 267, 267, 267, 267, 268, 269, 0, 267, 267, 0, - 0, 0, 0, 0, 268, 269, 268, 269, 268, 269, - 273, 0, 268, 268, 269, 0, 273, 0, 0, 0, - 273, 0, 273, 0, 273, 275, 275, 275, 275, 273, - 0, 0, 0, 276, 276, 276, 276, 0, 0, 0, - 275, 275, 275, 275, 275, 275, 275, 275, 276, 276, - 276, 276, 276, 276, 276, 276, 292, 293, 0, 0, - 0, 0, 0, 0, 293, 0, 292, 293, 292, 293, - - 292, 293, 294, 0, 0, 292, 293, 0, 295, 0, - 0, 0, 294, 294, 294, 0, 294, 0, 295, 296, - 295, 294, 295, 0, 0, 297, 0, 295, 297, 296, - 0, 296, 0, 296, 0, 297, 0, 297, 296, 297, - 298, 298, 299, 299, 297, 0, 0, 0, 0, 0, - 0, 298, 299, 298, 299, 298, 299, 300, 0, 0, - 298, 299, 0, 0, 296, 301, 0, 300, 0, 300, - 0, 300, 0, 302, 300, 301, 300, 301, 301, 301, - 0, 0, 0, 302, 301, 302, 304, 302, 303, 303, - 0, 302, 302, 0, 0, 0, 304, 305, 304, 303, - - 304, 303, 0, 303, 0, 304, 0, 305, 303, 305, - 306, 305, 306, 307, 0, 307, 305, 0, 0, 0, - 306, 0, 306, 307, 306, 307, 0, 307, 308, 306, - 0, 308, 307, 0, 309, 0, 0, 0, 308, 0, - 308, 0, 308, 0, 309, 310, 309, 308, 309, 0, - 0, 311, 310, 309, 0, 310, 0, 310, 0, 310, - 0, 311, 312, 311, 310, 311, 0, 311, 0, 0, - 311, 0, 312, 0, 312, 0, 312, 313, 312, 0, - 313, 312, 0, 314, 0, 0, 0, 313, 0, 313, - 0, 313, 0, 314, 317, 314, 313, 314, 0, 0, - - 318, 0, 314, 0, 317, 0, 317, 0, 317, 0, - 318, 0, 318, 317, 318, 319, 320, 0, 318, 318, - 0, 0, 319, 0, 0, 319, 320, 319, 320, 319, - 320, 321, 320, 0, 319, 320, 322, 322, 0, 317, - 0, 321, 0, 321, 324, 321, 0, 322, 0, 322, - 321, 322, 323, 322, 0, 324, 322, 323, 0, 0, - 0, 0, 323, 325, 323, 324, 323, 324, 323, 324, - 0, 323, 0, 325, 324, 325, 326, 325, 0, 0, - 325, 0, 325, 0, 328, 328, 326, 329, 326, 0, - 326, 0, 0, 0, 328, 326, 328, 329, 328, 329, - - 330, 329, 0, 328, 333, 329, 329, 0, 332, 0, - 330, 332, 330, 330, 330, 0, 0, 0, 332, 330, - 332, 333, 332, 0, 0, 0, 0, 332, 0, 334, - 0, 333, 334, 333, 0, 333, 335, 335, 0, 334, - 333, 334, 0, 334, 0, 337, 0, 335, 334, 335, - 0, 335, 0, 338, 0, 337, 335, 337, 0, 337, - 0, 0, 0, 338, 337, 338, 339, 338, 0, 339, - 0, 338, 338, 0, 340, 0, 339, 341, 339, 0, - 339, 0, 0, 0, 340, 339, 340, 341, 340, 341, - 0, 341, 343, 340, 342, 342, 341, 0, 344, 0, - - 0, 0, 343, 0, 343, 342, 343, 342, 344, 342, - 344, 343, 344, 345, 342, 0, 347, 344, 0, 348, - 0, 0, 0, 345, 0, 345, 347, 345, 347, 348, - 347, 348, 345, 348, 0, 347, 349, 343, 348, 349, - 0, 0, 350, 0, 0, 0, 349, 0, 349, 0, - 349, 0, 350, 351, 350, 349, 350, 0, 0, 0, - 0, 350, 0, 351, 0, 351, 0, 351, 0, 355, - 351, 0, 351, 0, 356, 356, 356, 356, 350, 355, - 0, 355, 0, 355, 0, 0, 0, 0, 355, 356, - 356, 356, 356, 356, 356, 356, 356, 357, 357, 357, - - 357, 0, 0, 0, 0, 0, 0, 0, 357, 0, - 0, 0, 357, 357, 357, 357, 357, 357, 357, 357, - 358, 358, 358, 358, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 358, 358, 358, 358, 358, - 358, 358, 358, 359, 0, 363, 0, 359, 359, 359, - 359, 359, 359, 359, 359, 363, 0, 363, 0, 363, - 364, 364, 0, 363, 363, 0, 0, 0, 0, 0, - 364, 0, 364, 366, 364, 365, 365, 0, 357, 364, - 0, 0, 0, 366, 0, 366, 365, 366, 365, 0, - 365, 0, 366, 368, 368, 365, 0, 369, 369, 0, - - 370, 0, 0, 370, 368, 0, 368, 369, 368, 369, - 370, 369, 370, 368, 370, 371, 369, 0, 372, 370, - 0, 0, 0, 0, 0, 371, 373, 371, 372, 371, - 372, 0, 372, 0, 371, 0, 373, 372, 373, 374, - 373, 0, 373, 0, 0, 373, 374, 375, 0, 374, - 0, 374, 0, 374, 0, 0, 0, 375, 374, 375, - 376, 375, 0, 376, 0, 0, 375, 376, 0, 0, - 376, 377, 376, 377, 376, 0, 0, 378, 0, 376, - 378, 377, 0, 377, 378, 377, 0, 378, 379, 378, - 377, 378, 0, 0, 0, 0, 378, 0, 379, 380, - - 379, 0, 379, 0, 379, 0, 0, 379, 0, 380, - 0, 380, 0, 380, 381, 381, 0, 380, 380, 0, - 382, 0, 0, 0, 381, 0, 381, 0, 381, 0, - 382, 383, 382, 381, 382, 0, 0, 384, 382, 382, - 0, 383, 0, 383, 0, 383, 0, 384, 383, 384, - 383, 384, 385, 389, 0, 0, 384, 0, 0, 0, - 389, 0, 385, 389, 385, 389, 385, 389, 0, 0, - 391, 385, 389, 390, 390, 0, 390, 0, 0, 0, - 391, 0, 391, 390, 391, 390, 0, 390, 391, 391, - 393, 392, 390, 392, 0, 0, 0, 0, 0, 0, - - 393, 392, 393, 392, 393, 392, 394, 0, 0, 393, - 392, 0, 395, 0, 0, 395, 394, 0, 394, 0, - 394, 0, 395, 396, 395, 394, 395, 397, 0, 0, - 398, 395, 0, 396, 0, 396, 397, 396, 0, 0, - 396, 0, 396, 0, 400, 0, 397, 398, 397, 0, - 397, 0, 0, 0, 400, 397, 400, 398, 400, 398, - 401, 398, 400, 400, 0, 0, 398, 0, 402, 0, - 401, 0, 401, 0, 401, 0, 404, 0, 402, 401, - 402, 0, 402, 0, 406, 0, 404, 402, 404, 0, - 404, 0, 404, 0, 406, 404, 406, 407, 406, 0, - - 0, 0, 0, 406, 0, 0, 0, 407, 0, 407, - 409, 407, 0, 410, 0, 407, 407, 409, 0, 0, - 409, 411, 409, 410, 409, 410, 411, 410, 0, 409, - 0, 411, 410, 411, 412, 411, 0, 0, 0, 0, - 411, 0, 0, 0, 412, 415, 412, 0, 412, 0, - 0, 416, 0, 412, 416, 415, 412, 415, 0, 415, - 0, 416, 417, 416, 415, 416, 0, 0, 0, 0, - 416, 0, 417, 419, 417, 0, 417, 0, 417, 0, - 0, 417, 0, 419, 0, 419, 0, 419, 424, 424, - 424, 424, 419, 0, 0, 0, 0, 0, 0, 0, - - 0, 428, 0, 424, 424, 424, 424, 424, 424, 424, - 424, 428, 0, 428, 430, 428, 429, 429, 419, 0, - 428, 0, 0, 0, 430, 432, 430, 429, 430, 429, - 0, 429, 430, 430, 0, 432, 429, 432, 433, 432, - 0, 434, 0, 0, 432, 0, 0, 0, 433, 0, - 433, 434, 433, 434, 0, 434, 433, 433, 435, 0, - 434, 435, 0, 436, 436, 0, 0, 0, 435, 0, - 435, 0, 435, 0, 436, 437, 436, 435, 436, 0, - 0, 438, 0, 436, 0, 437, 0, 437, 0, 437, - 0, 438, 0, 438, 437, 438, 439, 0, 439, 438, - - 438, 0, 440, 0, 0, 0, 439, 0, 439, 0, - 439, 0, 440, 0, 440, 439, 440, 0, 0, 441, - 440, 440, 441, 0, 0, 442, 0, 442, 0, 441, - 0, 441, 0, 441, 0, 442, 443, 442, 441, 442, - 0, 444, 444, 0, 442, 0, 443, 0, 443, 0, - 443, 0, 444, 445, 444, 443, 444, 0, 0, 446, - 0, 444, 0, 445, 0, 445, 446, 445, 0, 446, - 447, 446, 445, 446, 0, 0, 448, 0, 446, 0, - 447, 0, 447, 448, 447, 0, 448, 447, 448, 447, - 448, 449, 449, 453, 0, 448, 0, 453, 0, 0, - - 0, 0, 449, 453, 449, 453, 449, 453, 454, 0, - 0, 449, 453, 0, 455, 454, 455, 0, 454, 0, - 454, 0, 454, 0, 455, 456, 455, 454, 455, 0, - 0, 457, 0, 455, 457, 456, 0, 456, 0, 456, - 0, 457, 456, 457, 456, 457, 458, 458, 0, 0, - 457, 0, 459, 459, 0, 0, 458, 0, 458, 0, - 458, 0, 459, 460, 459, 458, 459, 0, 0, 0, - 0, 459, 0, 460, 0, 460, 0, 460, 461, 460, - 0, 461, 460, 0, 462, 0, 0, 0, 461, 0, - 461, 0, 461, 0, 462, 465, 462, 461, 462, 0, - - 0, 462, 0, 462, 0, 465, 0, 465, 468, 465, - 466, 466, 0, 0, 465, 0, 0, 0, 468, 470, - 468, 466, 468, 466, 0, 466, 0, 468, 0, 470, - 466, 470, 471, 470, 0, 471, 0, 470, 470, 0, - 473, 0, 471, 0, 471, 0, 471, 0, 0, 0, - 473, 471, 473, 0, 473, 474, 474, 0, 475, 473, - 473, 476, 0, 0, 0, 474, 0, 474, 475, 474, - 475, 476, 475, 476, 474, 476, 479, 475, 0, 480, - 476, 0, 0, 0, 0, 0, 479, 0, 479, 480, - 479, 480, 0, 480, 490, 479, 480, 0, 480, 486, - - 486, 486, 486, 0, 490, 0, 490, 0, 490, 0, - 0, 0, 490, 490, 486, 486, 486, 486, 486, 486, - 486, 486, 487, 0, 0, 0, 487, 487, 487, 487, - 487, 487, 487, 487, 491, 493, 0, 0, 0, 0, - 0, 491, 0, 0, 491, 493, 491, 493, 491, 493, - 0, 495, 494, 491, 493, 494, 0, 0, 0, 0, - 0, 495, 494, 495, 494, 495, 494, 496, 497, 0, - 495, 494, 0, 0, 496, 497, 0, 496, 497, 496, - 497, 496, 497, 498, 499, 0, 496, 497, 0, 0, - 0, 0, 0, 498, 499, 498, 499, 498, 499, 500, - - 0, 0, 498, 499, 0, 501, 500, 501, 0, 500, - 0, 500, 0, 500, 0, 501, 502, 501, 500, 501, - 0, 0, 503, 0, 501, 0, 502, 503, 502, 0, - 502, 0, 503, 504, 503, 502, 503, 0, 0, 0, - 0, 503, 0, 504, 505, 504, 0, 504, 0, 0, - 0, 504, 504, 0, 505, 506, 505, 0, 505, 0, - 0, 507, 505, 505, 0, 506, 0, 506, 0, 506, - 0, 507, 508, 507, 506, 507, 0, 0, 512, 0, - 507, 0, 508, 0, 508, 512, 508, 0, 512, 513, - 512, 508, 512, 0, 0, 0, 0, 512, 0, 513, - - 514, 513, 0, 513, 0, 0, 515, 513, 513, 0, - 514, 0, 514, 0, 514, 0, 515, 516, 515, 514, - 515, 0, 0, 517, 0, 515, 517, 516, 0, 516, - 0, 516, 0, 517, 516, 517, 516, 517, 518, 519, - 0, 0, 517, 0, 0, 0, 0, 0, 518, 519, - 518, 519, 518, 519, 520, 520, 518, 518, 519, 0, - 521, 0, 0, 0, 520, 0, 520, 0, 520, 0, - 521, 524, 521, 520, 521, 0, 0, 526, 0, 521, - 0, 524, 0, 524, 0, 524, 0, 526, 528, 526, - 524, 526, 0, 0, 529, 0, 526, 0, 528, 0, - - 528, 0, 528, 0, 529, 521, 529, 528, 529, 531, - 0, 0, 531, 529, 0, 532, 0, 0, 532, 531, - 0, 531, 0, 531, 0, 532, 0, 532, 531, 532, - 535, 535, 0, 0, 532, 0, 541, 541, 541, 541, - 0, 535, 0, 535, 0, 535, 0, 0, 0, 0, - 535, 541, 541, 541, 541, 541, 541, 541, 541, 544, - 545, 545, 0, 0, 0, 0, 544, 0, 0, 544, - 545, 544, 545, 544, 545, 547, 0, 0, 544, 545, - 0, 0, 0, 548, 0, 547, 549, 547, 0, 547, - 0, 547, 0, 548, 547, 548, 549, 548, 549, 550, - - 549, 548, 548, 0, 0, 549, 553, 551, 0, 550, - 0, 550, 0, 550, 0, 552, 0, 551, 550, 551, - 551, 551, 0, 553, 0, 552, 551, 552, 0, 552, - 0, 0, 0, 553, 552, 553, 554, 553, 0, 554, - 0, 0, 553, 0, 555, 0, 554, 0, 554, 0, - 554, 0, 556, 0, 555, 554, 555, 0, 555, 556, - 557, 0, 556, 555, 556, 0, 556, 0, 0, 0, - 557, 556, 557, 562, 557, 0, 562, 0, 0, 557, - 0, 563, 0, 562, 564, 562, 0, 562, 0, 0, - 0, 563, 562, 563, 564, 563, 564, 565, 564, 0, - - 563, 0, 0, 564, 0, 566, 0, 565, 567, 565, - 0, 565, 566, 0, 0, 566, 565, 566, 567, 566, - 567, 571, 567, 0, 566, 575, 567, 567, 0, 576, - 0, 571, 0, 571, 0, 571, 0, 0, 0, 576, - 571, 576, 575, 576, 0, 579, 0, 0, 576, 0, - 0, 0, 575, 0, 575, 579, 575, 579, 0, 579, - 588, 575, 0, 0, 579, 584, 584, 584, 584, 0, - 588, 0, 588, 588, 588, 0, 0, 0, 589, 588, - 584, 584, 584, 584, 584, 584, 584, 584, 589, 591, - 589, 0, 589, 0, 0, 592, 0, 589, 0, 591, - - 0, 591, 0, 591, 0, 592, 0, 592, 591, 592, - 593, 594, 592, 593, 592, 0, 594, 0, 0, 0, - 593, 594, 593, 594, 593, 594, 595, 0, 0, 593, - 594, 0, 597, 0, 597, 0, 595, 0, 595, 0, - 595, 0, 597, 598, 597, 595, 597, 0, 0, 603, - 0, 597, 0, 598, 0, 598, 0, 598, 0, 603, - 604, 603, 598, 603, 0, 603, 0, 0, 603, 0, - 604, 605, 604, 604, 604, 0, 0, 615, 605, 604, - 0, 605, 0, 605, 0, 605, 0, 615, 624, 615, - 605, 615, 0, 0, 625, 0, 615, 0, 624, 0, - - 624, 0, 624, 0, 625, 0, 625, 624, 625, 626, - 627, 626, 0, 625, 0, 0, 0, 0, 0, 626, - 627, 626, 627, 626, 627, 628, 630, 0, 626, 627, - 0, 0, 0, 0, 0, 628, 630, 628, 630, 628, - 630, 631, 628, 0, 628, 630, 0, 635, 631, 0, - 0, 631, 0, 631, 0, 631, 0, 635, 636, 635, - 631, 635, 0, 0, 0, 0, 635, 0, 636, 637, - 636, 0, 636, 0, 0, 652, 0, 636, 0, 637, - 0, 637, 637, 637, 0, 652, 653, 652, 637, 652, - 0, 0, 654, 0, 652, 0, 653, 0, 653, 0, - - 653, 0, 654, 656, 654, 653, 654, 0, 0, 0, - 0, 654, 0, 656, 660, 656, 0, 656, 0, 0, - 661, 656, 656, 0, 660, 0, 660, 0, 660, 0, - 661, 660, 661, 660, 661, 676, 680, 0, 0, 661, - 0, 0, 0, 0, 0, 676, 680, 676, 680, 676, - 680, 681, 696, 0, 676, 680, 0, 0, 676, 0, - 0, 681, 696, 681, 696, 681, 696, 0, 0, 0, - 681, 696, 746, 746, 746, 746, 746, 746, 746, 746, - 746, 746, 746, 746, 746, 747, 747, 747, 747, 747, - 747, 747, 747, 747, 747, 747, 747, 747, 748, 748, - - 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, - 748, 749, 749, 749, 749, 749, 749, 749, 749, 749, - 749, 749, 749, 749, 750, 750, 750, 750, 750, 750, - 750, 750, 750, 750, 750, 750, 750, 751, 751, 751, - 751, 0, 751, 751, 751, 751, 751, 751, 751, 751, - 752, 752, 752, 0, 752, 0, 752, 0, 752, 753, - 753, 0, 753, 753, 754, 754, 0, 0, 754, 754, - 0, 754, 754, 754, 754, 754, 754, 755, 755, 755, - 755, 0, 755, 755, 755, 755, 755, 755, 755, 755, - 756, 756, 756, 756, 756, 756, 756, 756, 0, 756, - - 756, 757, 0, 0, 0, 757, 757, 757, 757, 757, - 757, 757, 758, 0, 0, 0, 758, 758, 758, 758, - 758, 758, 758, 759, 759, 0, 759, 759, 760, 760, - 0, 760, 760, 761, 761, 0, 761, 761, 762, 0, - 762, 762, 763, 763, 0, 763, 763, 764, 0, 764, - 764, 765, 0, 765, 765, 766, 0, 766, 766, 767, - 0, 767, 767, 768, 768, 768, 768, 768, 768, 768, - 768, 768, 768, 768, 768, 768, 769, 769, 0, 769, - 769, 770, 770, 0, 770, 770, 770, 770, 770, 770, - 770, 770, 770, 770, 771, 771, 771, 0, 0, 0, - - 771, 0, 0, 0, 0, 771, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745 - } ; - -/* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[141] = - { 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, - 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, - 0, }; - -extern int asn1p__flex_debug; -int asn1p__flex_debug = 1; - -static yyconst flex_int16_t yy_rule_linenum[140] = - { 0, - 96, 97, 99, 102, 104, 107, 109, 110, 111, 114, - 116, 117, 118, 130, 137, 144, 150, 159, 167, 175, - 176, 178, 197, 203, 204, 205, 206, 207, 210, 216, - 223, 230, 237, 244, 251, 252, 253, 261, 262, 263, - 264, 265, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 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, 351, 352, 357, 358, 359, 362, 367, 373, 381, - 391, 396, 398, 399, 403, 408, 413, 419, 420, 422, - 428, 441, 444, 469, 513, 514, 516, 518, 529 - } ; - -static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; -static char *yy_full_match; -static int yy_lp; -#define REJECT \ -{ \ -*yy_cp = (yy_hold_char); /* undo effects of setting up asn1p_text */ \ -yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ -++(yy_lp); \ -goto find_rule; \ -} - -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *asn1p_text; -#line 1 "asn1p_l.l" -#line 2 "asn1p_l.l" - -#include -#include -#include - -#include "asn1parser.h" -#include "asn1p_y.h" - -int asn1p_lex(void); -void asn1p_lexer_hack_push_opaque_state(void); /* Used in .y */ -void asn1p_lexer_hack_enable_with_syntax(void); /* Used in .y */ -void asn1p_lexer_hack_push_encoding_control(void); /* Used in .y */ - -#define YY_FATAL_ERROR(msg) do { \ - fprintf(stderr, \ - "lexer error at line %d, " \ - "text \"%s\"\n", \ - asn1p_lineno, asn1p_text); \ - exit(1); \ - } while(0) - -int asn1p_lexer_pedantic_1990 = 0; -int asn1p_lexer_types_year = 0; -int asn1p_lexer_constructs_year = 0; - -int asn1p_as_pointer; - -static asn1c_integer_t _lex_atoi(const char *ptr); -static double _lex_atod(const char *ptr); - -/* - * Check that the type is defined in the year of the standard choosen. - */ -#define TYPE_LIFETIME(fyr, lyr) \ - (!asn1p_lexer_types_year \ - || (fyr && fyr <= asn1p_lexer_types_year) \ - || (lyr && lyr > asn1p_lexer_types_year)) - -/* - * Check the the construction (or concept, i.e. CLASS) is defined in - * a given year. - */ -#define CONSTRUCT_LIFETIME(fyr, lyr) \ - (!asn1p_lexer_constructs_year \ - || (fyr && fyr <= asn1p_lexer_constructs_year) \ - || (lyr && lyr > asn1p_lexer_constructs_year)) - -/* - * Append quoted string. - */ -#define QAPPEND(text, tlen) do { \ - char *prev_text = asn1p_lval.tv_opaque.buf; \ - int prev_len = asn1p_lval.tv_opaque.len; \ - char *p; \ - \ - p = malloc((tlen) + prev_len + 1); \ - if(p == NULL) return -1; \ - \ - if(prev_text) memcpy(p, prev_text, prev_len); \ - memcpy(p + prev_len, text, tlen); \ - p[prev_len + (tlen)] = '\0'; \ - \ - free(asn1p_lval.tv_opaque.buf); \ - asn1p_lval.tv_opaque.buf = p; \ - asn1p_lval.tv_opaque.len = (tlen) + prev_len; \ - } while(0) - -#define YY_NO_INPUT 1 -/* Performance penalty is OK */ -/* Controlled from within application */ - - - - - - - -/* Newline */ -/* White-space */ -#line 2090 "lex.yy.c" - -#define INITIAL 0 -#define dash_comment 1 -#define idash_comment 2 -#define cpp_comment 3 -#define quoted 4 -#define opaque 5 -#define encoding_control 6 -#define with_syntax 7 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -/* %if-c-only */ -#include -/* %endif */ -/* %if-c++-only */ -/* %endif */ -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -/* %if-c-only Reentrant structure and macros (non-C++). */ -/* %if-reentrant */ -/* %if-c-only */ - -static int yy_init_globals (void ); - -/* %endif */ -/* %if-reentrant */ -/* %endif */ -/* %endif End reentrant structures and macros. */ - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int asn1p_lex_destroy (void ); - -int asn1p_get_debug (void ); - -void asn1p_set_debug (int debug_flag ); - -YY_EXTRA_TYPE asn1p_get_extra (void ); - -void asn1p_set_extra (YY_EXTRA_TYPE user_defined ); - -FILE *asn1p_get_in (void ); - -void asn1p_set_in (FILE * in_str ); - -FILE *asn1p_get_out (void ); - -void asn1p_set_out (FILE * out_str ); - -yy_size_t asn1p_get_leng (void ); - -char *asn1p_get_text (void ); - -int asn1p_get_lineno (void ); - -void asn1p_set_lineno (int line_number ); - -/* %if-bison-bridge */ -/* %endif */ - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int asn1p_wrap (void ); -#else -extern int asn1p_wrap (void ); -#endif -#endif - -/* %not-for-header */ - - static void yyunput (int c,char *buf_ptr ); - -/* %ok-for-header */ - -/* %endif */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT -/* %if-c-only Standard (non-C++) definition */ -/* %not-for-header */ - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif -/* %ok-for-header */ - -/* %endif */ -#endif - -/* %if-c-only */ - - static int yy_start_stack_ptr = 0; - static int yy_start_stack_depth = 0; - static int *yy_start_stack = NULL; - - static void yy_push_state (int new_state ); - - static void yy_pop_state (void ); - - static int yy_top_state (void ); - -/* %endif */ - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* %if-c-only Standard (non-C++) definition */ -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO fwrite( asn1p_text, asn1p_leng, 1, asn1p_out ) -/* %endif */ -/* %if-c++-only C++ definition */ -/* %endif */ -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - yy_size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( asn1p_in )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( asn1p_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, asn1p_in))==0 && ferror(asn1p_in)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(asn1p_in); \ - } \ - }\ -\ -/* %if-c++-only C++ definition \ */\ -/* %endif */ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -/* %if-c-only */ -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -#endif - -/* %if-tables-serialization structures and prototypes */ -/* %not-for-header */ - -/* %ok-for-header */ - -/* %not-for-header */ - -/* %tables-yydmap generated elements */ -/* %endif */ -/* end tables serialization structures and prototypes */ - -/* %ok-for-header */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 -/* %if-c-only Standard (non-C++) definition */ - -extern int asn1p_lex (void); - -#define YY_DECL int asn1p_lex (void) -/* %endif */ -/* %if-c++-only C++ definition */ -/* %endif */ -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after asn1p_text and asn1p_leng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -/* %% [6.0] YY_RULE_SETUP definition goes here */ -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/* %not-for-header */ - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -/* %% [7.0] user's declarations go here */ -#line 94 "asn1p_l.l" - - -#line 2352 "lex.yy.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - /* Create the reject buffer large enough to save one state per allowed character. */ - if ( ! (yy_state_buf) ) - (yy_state_buf) = (yy_state_type *)asn1p_alloc(YY_STATE_BUF_SIZE ); - if ( ! (yy_state_buf) ) - YY_FATAL_ERROR( "out of dynamic memory in asn1p_lex()" ); - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! asn1p_in ) -/* %if-c-only */ - asn1p_in = stdin; -/* %endif */ -/* %if-c++-only */ -/* %endif */ - - if ( ! asn1p_out ) -/* %if-c-only */ - asn1p_out = stdout; -/* %endif */ -/* %if-c++-only */ -/* %endif */ - - if ( ! YY_CURRENT_BUFFER ) { - asn1p_ensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - asn1p__create_buffer(asn1p_in,YY_BUF_SIZE ); - } - - asn1p__load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -/* %% [8.0] yymore()-related code goes here */ - yy_cp = (yy_c_buf_p); - - /* Support of asn1p_text. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -/* %% [9.0] code to set up and find next match goes here */ - yy_current_state = (yy_start); - - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; - -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 746 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *(yy_state_ptr)++ = yy_current_state; - ++yy_cp; - } - while ( yy_current_state != 745 ); - -yy_find_action: -/* %% [10.0] code to find the action number goes here */ - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; -goto find_rule; /* Shut up GCC warning -Wall */ -find_rule: /* we branch to this label when backing up */ - for ( ; ; ) /* until we find what rule we matched */ - { - if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) - { - yy_act = yy_acclist[(yy_lp)]; - { - (yy_full_match) = yy_cp; - break; - } - } - --yy_cp; - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -/* %% [11.0] code for asn1p_lineno update goes here */ - - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - yy_size_t yyl; - for ( yyl = 0; yyl < asn1p_leng; ++yyl ) - if ( asn1p_text[yyl] == '\n' ) - - asn1p_lineno++; -; - } - -do_action: /* This label is used only to access EOF actions. */ - -/* %% [12.0] debug code goes here */ - if ( asn1p__flex_debug ) - { - if ( yy_act == 0 ) - fprintf( stderr, "--scanner backing up\n" ); - else if ( yy_act < 140 ) - fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", - (long)yy_rule_linenum[yy_act], asn1p_text ); - else if ( yy_act == 140 ) - fprintf( stderr, "--accepting default rule (\"%s\")\n", - asn1p_text ); - else if ( yy_act == 141 ) - fprintf( stderr, "--(end of buffer or a NUL)\n" ); - else - fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); - } - - switch ( yy_act ) - { /* beginning of action switch */ -/* %% [13.0] actions go here */ -case 1: -/* rule 1 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up asn1p_text */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up asn1p_text again */ -YY_RULE_SETUP -#line 96 "asn1p_l.l" -/* Immediately terminated long comment */ - YY_BREAK -case 2: -*yy_cp = (yy_hold_char); /* undo effects of setting up asn1p_text */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up asn1p_text again */ -YY_RULE_SETUP -#line 97 "asn1p_l.l" -yy_push_state(idash_comment); /* Incorrect, but acceptable */ - YY_BREAK - -case 3: -YY_RULE_SETUP -#line 99 "asn1p_l.l" -yy_pop_state(); /* Acceptable end of comment */ - YY_BREAK - -case 4: -YY_RULE_SETUP -#line 102 "asn1p_l.l" -asn1p_as_pointer = 1; - YY_BREAK -case 5: -YY_RULE_SETUP -#line 104 "asn1p_l.l" -yy_push_state(dash_comment); - YY_BREAK - -case 6: -/* rule 6 can match eol */ -YY_RULE_SETUP -#line 107 "asn1p_l.l" -yy_pop_state(); - YY_BREAK -case 7: -YY_RULE_SETUP -#line 109 "asn1p_l.l" -yy_pop_state(); /* End of comment */ - YY_BREAK -case 8: -YY_RULE_SETUP -#line 110 "asn1p_l.l" -/* Eat single dash */ - YY_BREAK -case 9: -YY_RULE_SETUP -#line 111 "asn1p_l.l" -/* Eat */ - YY_BREAK - -case 10: -YY_RULE_SETUP -#line 114 "asn1p_l.l" -yy_push_state(cpp_comment); - YY_BREAK - -case 11: -/* rule 11 can match eol */ -YY_RULE_SETUP -#line 116 "asn1p_l.l" -/* Eat */ - YY_BREAK -case 12: -YY_RULE_SETUP -#line 117 "asn1p_l.l" -yy_pop_state(); - YY_BREAK -case 13: -YY_RULE_SETUP -#line 118 "asn1p_l.l" -/* Eat */ - YY_BREAK - -/* - * This is state is being set from corresponding .y module when - * higher-level data is necessary to make proper parsing of the - * underlying data. Thus, we enter the state and save - * everything for later processing. - */ - -case 14: -YY_RULE_SETUP -#line 130 "asn1p_l.l" -{ - yy_push_state(opaque); - asn1p_lval.tv_opaque.buf = strdup(asn1p_text); - asn1p_lval.tv_opaque.len = asn1p_leng; - return TOK_opaque; - } - YY_BREAK -case 15: -YY_RULE_SETUP -#line 137 "asn1p_l.l" -{ - yy_pop_state(); - asn1p_lval.tv_opaque.buf = strdup(asn1p_text); - asn1p_lval.tv_opaque.len = asn1p_leng; - return TOK_opaque; - } - YY_BREAK -case 16: -/* rule 16 can match eol */ -YY_RULE_SETUP -#line 144 "asn1p_l.l" -{ - asn1p_lval.tv_opaque.buf = strdup(asn1p_text); - asn1p_lval.tv_opaque.len = asn1p_leng; - return TOK_opaque; - } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 150 "asn1p_l.l" -{ - fprintf(stderr, - "ASN.1 Parser syncronization failure: " - "\"%s\" at line %d must not appear " - "inside value definition\n", - asn1p_text, asn1p_lineno); - return -1; - } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 159 "asn1p_l.l" -{ - asn1p_lval.tv_opaque.buf = strdup(asn1p_text); - asn1p_lval.tv_opaque.len = asn1p_leng; - return TOK_opaque; - } - YY_BREAK - -case 19: -/* rule 19 can match eol */ -YY_RULE_SETUP -#line 167 "asn1p_l.l" -{ - asn1p_lval.tv_opaque.buf = 0; - asn1p_lval.tv_opaque.len = 0; - QAPPEND(asn1p_text+1, asn1p_leng-1); - yy_push_state(quoted); - } - YY_BREAK - -case 20: -YY_RULE_SETUP -#line 175 "asn1p_l.l" -{ QAPPEND(asn1p_text, asn1p_leng-1); } /* Add a single quote */ - YY_BREAK -case 21: -/* rule 21 can match eol */ -YY_RULE_SETUP -#line 176 "asn1p_l.l" -{ QAPPEND(asn1p_text, asn1p_leng); } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 178 "asn1p_l.l" -{ - yy_pop_state(); - /* Do not append last quote: - // QAPPEND(asn1p_text, asn1p_leng); */ - - if(asn1p_lexer_pedantic_1990 - && strchr(asn1p_text, '\n')) { - fprintf(stderr, "%s: " - "Newlines are prohibited by ASN.1:1990\n", - asn1p_lval.tv_opaque.buf); - return -1; - } - - return TOK_cstring; - } - YY_BREAK - - -case 23: -YY_RULE_SETUP -#line 197 "asn1p_l.l" -{ - const char *s = "ENCODING-CONTROL"; - const char *p = s + sizeof("ENCODING-CONTROL") - 2; - for(; p >= s; p--) unput(*p); - yy_pop_state(); - } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 203 "asn1p_l.l" -unput('D'); unput('N'); unput('E'); yy_pop_state(); - YY_BREAK -case 25: -YY_RULE_SETUP -#line 204 "asn1p_l.l" - - YY_BREAK -case 26: -YY_RULE_SETUP -#line 205 "asn1p_l.l" - - YY_BREAK -case 27: -YY_RULE_SETUP -#line 206 "asn1p_l.l" -/* Eat everything else */ - YY_BREAK -case 28: -/* rule 28 can match eol */ -YY_RULE_SETUP -#line 207 "asn1p_l.l" - - YY_BREAK - -case 29: -/* rule 29 can match eol */ -YY_RULE_SETUP -#line 210 "asn1p_l.l" -{ - /* " \t\r\n" weren't allowed in ASN.1:1990. */ - asn1p_lval.tv_str = asn1p_text; - return TOK_hstring; - } - YY_BREAK -case 30: -/* rule 30 can match eol */ -YY_RULE_SETUP -#line 216 "asn1p_l.l" -{ - /* " \t\r\n" weren't allowed in ASN.1:1990. */ - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_bstring; - } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 223 "asn1p_l.l" -{ - asn1p_lval.a_int = _lex_atoi(asn1p_text); - if(errno == ERANGE) - return -1; - return TOK_number_negative; - } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 230 "asn1p_l.l" -{ - asn1p_lval.a_int = _lex_atoi(asn1p_text); - if(errno == ERANGE) - return -1; - return TOK_number; - } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 237 "asn1p_l.l" -{ - asn1p_lval.a_int = _lex_atoi(asn1p_text); - if(errno == ERANGE) - return -1; - return TOK_number; - } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 244 "asn1p_l.l" -{ - asn1p_lval.a_dbl = _lex_atod(asn1p_text); - if(errno == ERANGE) - return -1; - return TOK_realnumber; - } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 251 "asn1p_l.l" -return TOK_ABSENT; - YY_BREAK -case 36: -YY_RULE_SETUP -#line 252 "asn1p_l.l" -return TOK_ALL; - YY_BREAK -case 37: -YY_RULE_SETUP -#line 253 "asn1p_l.l" -{ - /* Appeared in 1990, removed in 1997 */ - if(TYPE_LIFETIME(1990, 1997)) - return TOK_ANY; - fprintf(stderr, "Keyword \"%s\" at line %d " - "is obsolete\n", asn1p_text, asn1p_lineno); - REJECT; - } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 261 "asn1p_l.l" -return TOK_APPLICATION; - YY_BREAK -case 39: -YY_RULE_SETUP -#line 262 "asn1p_l.l" -return TOK_AUTOMATIC; - YY_BREAK -case 40: -YY_RULE_SETUP -#line 263 "asn1p_l.l" -return TOK_BEGIN; - YY_BREAK -case 41: -YY_RULE_SETUP -#line 264 "asn1p_l.l" -return TOK_BIT; - YY_BREAK -case 42: -YY_RULE_SETUP -#line 265 "asn1p_l.l" -{ - if(TYPE_LIFETIME(1994, 0)) - return TOK_BMPString; - REJECT; - } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 270 "asn1p_l.l" -return TOK_BOOLEAN; - YY_BREAK -case 44: -YY_RULE_SETUP -#line 271 "asn1p_l.l" -return TOK_BY; - YY_BREAK -case 45: -YY_RULE_SETUP -#line 272 "asn1p_l.l" -return TOK_CHARACTER; - YY_BREAK -case 46: -YY_RULE_SETUP -#line 273 "asn1p_l.l" -return TOK_CHOICE; - YY_BREAK -case 47: -YY_RULE_SETUP -#line 274 "asn1p_l.l" -return TOK_CLASS; - YY_BREAK -case 48: -YY_RULE_SETUP -#line 275 "asn1p_l.l" -return TOK_COMPONENT; - YY_BREAK -case 49: -YY_RULE_SETUP -#line 276 "asn1p_l.l" -return TOK_COMPONENTS; - YY_BREAK -case 50: -YY_RULE_SETUP -#line 277 "asn1p_l.l" -return TOK_CONSTRAINED; - YY_BREAK -case 51: -YY_RULE_SETUP -#line 278 "asn1p_l.l" -return TOK_CONTAINING; - YY_BREAK -case 52: -YY_RULE_SETUP -#line 279 "asn1p_l.l" -return TOK_DEFAULT; - YY_BREAK -case 53: -YY_RULE_SETUP -#line 280 "asn1p_l.l" -{ - /* Appeared in 1990, removed in 1997 */ - if(TYPE_LIFETIME(1990, 1997)) - return TOK_DEFINED; - fprintf(stderr, "Keyword \"%s\" at line %d " - "is obsolete\n", asn1p_text, asn1p_lineno); - /* Deprecated since */ - REJECT; - } - YY_BREAK -case 54: -YY_RULE_SETUP -#line 289 "asn1p_l.l" -return TOK_DEFINITIONS; - YY_BREAK -case 55: -YY_RULE_SETUP -#line 290 "asn1p_l.l" -return TOK_EMBEDDED; - YY_BREAK -case 56: -YY_RULE_SETUP -#line 291 "asn1p_l.l" -return TOK_ENCODED; - YY_BREAK -case 57: -YY_RULE_SETUP -#line 292 "asn1p_l.l" -return TOK_ENCODING_CONTROL; - YY_BREAK -case 58: -YY_RULE_SETUP -#line 293 "asn1p_l.l" -return TOK_END; - YY_BREAK -case 59: -YY_RULE_SETUP -#line 294 "asn1p_l.l" -return TOK_ENUMERATED; - YY_BREAK -case 60: -YY_RULE_SETUP -#line 295 "asn1p_l.l" -return TOK_EXCEPT; - YY_BREAK -case 61: -YY_RULE_SETUP -#line 296 "asn1p_l.l" -return TOK_EXPLICIT; - YY_BREAK -case 62: -YY_RULE_SETUP -#line 297 "asn1p_l.l" -return TOK_EXPORTS; - YY_BREAK -case 63: -YY_RULE_SETUP -#line 298 "asn1p_l.l" -return TOK_EXTENSIBILITY; - YY_BREAK -case 64: -YY_RULE_SETUP -#line 299 "asn1p_l.l" -return TOK_EXTERNAL; - YY_BREAK -case 65: -YY_RULE_SETUP -#line 300 "asn1p_l.l" -return TOK_FALSE; - YY_BREAK -case 66: -YY_RULE_SETUP -#line 301 "asn1p_l.l" -return TOK_FROM; - YY_BREAK -case 67: -YY_RULE_SETUP -#line 302 "asn1p_l.l" -return TOK_GeneralizedTime; - YY_BREAK -case 68: -YY_RULE_SETUP -#line 303 "asn1p_l.l" -return TOK_GeneralString; - YY_BREAK -case 69: -YY_RULE_SETUP -#line 304 "asn1p_l.l" -return TOK_GraphicString; - YY_BREAK -case 70: -YY_RULE_SETUP -#line 305 "asn1p_l.l" -return TOK_IA5String; - YY_BREAK -case 71: -YY_RULE_SETUP -#line 306 "asn1p_l.l" -return TOK_IDENTIFIER; - YY_BREAK -case 72: -YY_RULE_SETUP -#line 307 "asn1p_l.l" -return TOK_IMPLICIT; - YY_BREAK -case 73: -YY_RULE_SETUP -#line 308 "asn1p_l.l" -return TOK_IMPLIED; - YY_BREAK -case 74: -YY_RULE_SETUP -#line 309 "asn1p_l.l" -return TOK_IMPORTS; - YY_BREAK -case 75: -YY_RULE_SETUP -#line 310 "asn1p_l.l" -return TOK_INCLUDES; - YY_BREAK -case 76: -YY_RULE_SETUP -#line 311 "asn1p_l.l" -return TOK_INSTANCE; - YY_BREAK -case 77: -YY_RULE_SETUP -#line 312 "asn1p_l.l" -return TOK_INSTRUCTIONS; - YY_BREAK -case 78: -YY_RULE_SETUP -#line 313 "asn1p_l.l" -return TOK_INTEGER; - YY_BREAK -case 79: -YY_RULE_SETUP -#line 314 "asn1p_l.l" -return TOK_INTERSECTION; - YY_BREAK -case 80: -YY_RULE_SETUP -#line 315 "asn1p_l.l" -return TOK_ISO646String; - YY_BREAK -case 81: -YY_RULE_SETUP -#line 316 "asn1p_l.l" -return TOK_MAX; - YY_BREAK -case 82: -YY_RULE_SETUP -#line 317 "asn1p_l.l" -return TOK_MIN; - YY_BREAK -case 83: -YY_RULE_SETUP -#line 318 "asn1p_l.l" -return TOK_MINUS_INFINITY; - YY_BREAK -case 84: -YY_RULE_SETUP -#line 319 "asn1p_l.l" -return TOK_NULL; - YY_BREAK -case 85: -YY_RULE_SETUP -#line 320 "asn1p_l.l" -return TOK_NumericString; - YY_BREAK -case 86: -YY_RULE_SETUP -#line 321 "asn1p_l.l" -return TOK_OBJECT; - YY_BREAK -case 87: -YY_RULE_SETUP -#line 322 "asn1p_l.l" -return TOK_ObjectDescriptor; - YY_BREAK -case 88: -YY_RULE_SETUP -#line 323 "asn1p_l.l" -return TOK_OCTET; - YY_BREAK -case 89: -YY_RULE_SETUP -#line 324 "asn1p_l.l" -return TOK_OF; - YY_BREAK -case 90: -YY_RULE_SETUP -#line 325 "asn1p_l.l" -return TOK_OPTIONAL; - YY_BREAK -case 91: -YY_RULE_SETUP -#line 326 "asn1p_l.l" -return TOK_PATTERN; - YY_BREAK -case 92: -YY_RULE_SETUP -#line 327 "asn1p_l.l" -return TOK_PDV; - YY_BREAK -case 93: -YY_RULE_SETUP -#line 328 "asn1p_l.l" -return TOK_PLUS_INFINITY; - YY_BREAK -case 94: -YY_RULE_SETUP -#line 329 "asn1p_l.l" -return TOK_PRESENT; - YY_BREAK -case 95: -YY_RULE_SETUP -#line 330 "asn1p_l.l" -return TOK_PrintableString; - YY_BREAK -case 96: -YY_RULE_SETUP -#line 331 "asn1p_l.l" -return TOK_PRIVATE; - YY_BREAK -case 97: -YY_RULE_SETUP -#line 332 "asn1p_l.l" -return TOK_REAL; - YY_BREAK -case 98: -YY_RULE_SETUP -#line 333 "asn1p_l.l" -return TOK_RELATIVE_OID; - YY_BREAK -case 99: -YY_RULE_SETUP -#line 334 "asn1p_l.l" -return TOK_SEQUENCE; - YY_BREAK -case 100: -YY_RULE_SETUP -#line 335 "asn1p_l.l" -return TOK_SET; - YY_BREAK -case 101: -YY_RULE_SETUP -#line 336 "asn1p_l.l" -return TOK_SIZE; - YY_BREAK -case 102: -YY_RULE_SETUP -#line 337 "asn1p_l.l" -return TOK_STRING; - YY_BREAK -case 103: -YY_RULE_SETUP -#line 338 "asn1p_l.l" -return TOK_SYNTAX; - YY_BREAK -case 104: -YY_RULE_SETUP -#line 339 "asn1p_l.l" -return TOK_T61String; - YY_BREAK -case 105: -YY_RULE_SETUP -#line 340 "asn1p_l.l" -return TOK_TAGS; - YY_BREAK -case 106: -YY_RULE_SETUP -#line 341 "asn1p_l.l" -return TOK_TeletexString; - YY_BREAK -case 107: -YY_RULE_SETUP -#line 342 "asn1p_l.l" -return TOK_TRUE; - YY_BREAK -case 108: -YY_RULE_SETUP -#line 343 "asn1p_l.l" -return TOK_UNION; - YY_BREAK -case 109: -YY_RULE_SETUP -#line 344 "asn1p_l.l" -return TOK_UNIQUE; - YY_BREAK -case 110: -YY_RULE_SETUP -#line 345 "asn1p_l.l" -return TOK_UNIVERSAL; - YY_BREAK -case 111: -YY_RULE_SETUP -#line 346 "asn1p_l.l" -{ - if(TYPE_LIFETIME(1994, 0)) - return TOK_UniversalString; - REJECT; - } - YY_BREAK -case 112: -YY_RULE_SETUP -#line 351 "asn1p_l.l" -return TOK_UTCTime; - YY_BREAK -case 113: -YY_RULE_SETUP -#line 352 "asn1p_l.l" -{ - if(TYPE_LIFETIME(1994, 0)) - return TOK_UTF8String; - REJECT; - } - YY_BREAK -case 114: -YY_RULE_SETUP -#line 357 "asn1p_l.l" -return TOK_VideotexString; - YY_BREAK -case 115: -YY_RULE_SETUP -#line 358 "asn1p_l.l" -return TOK_VisibleString; - YY_BREAK -case 116: -YY_RULE_SETUP -#line 359 "asn1p_l.l" -return TOK_WITH; - YY_BREAK -case 117: -YY_RULE_SETUP -#line 362 "asn1p_l.l" -{ - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_typefieldreference; - } - YY_BREAK -case 118: -YY_RULE_SETUP -#line 367 "asn1p_l.l" -{ - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_valuefieldreference; - } - YY_BREAK -case 119: -YY_RULE_SETUP -#line 373 "asn1p_l.l" -{ - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_identifier; - } - YY_BREAK -/* - * objectclassreference - */ -case 120: -YY_RULE_SETUP -#line 381 "asn1p_l.l" -{ - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_capitalreference; - } - YY_BREAK -/* - * typereference, modulereference - * NOTE: TOK_objectclassreference must be combined - * with this token to produce true typereference. - */ -case 121: -YY_RULE_SETUP -#line 391 "asn1p_l.l" -{ - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_typereference; - } - YY_BREAK -case 122: -YY_RULE_SETUP -#line 396 "asn1p_l.l" -return TOK_PPEQ; - YY_BREAK -case 123: -YY_RULE_SETUP -#line 398 "asn1p_l.l" -return TOK_ThreeDots; - YY_BREAK -case 124: -YY_RULE_SETUP -#line 399 "asn1p_l.l" -return TOK_TwoDots; - YY_BREAK - -case 125: -YY_RULE_SETUP -#line 403 "asn1p_l.l" -{ - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_Literal; - } - YY_BREAK -case 126: -YY_RULE_SETUP -#line 408 "asn1p_l.l" -{ - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_Literal; - } - YY_BREAK -case 127: -YY_RULE_SETUP -#line 413 "asn1p_l.l" -{ - yy_push_state(with_syntax); - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_Literal; - } - YY_BREAK -case 128: -YY_RULE_SETUP -#line 419 "asn1p_l.l" -return '['; - YY_BREAK -case 129: -YY_RULE_SETUP -#line 420 "asn1p_l.l" -return ']'; - YY_BREAK -case 130: -/* rule 130 can match eol */ -YY_RULE_SETUP -#line 422 "asn1p_l.l" -{ - asn1p_lval.tv_opaque.buf = strdup(asn1p_text); - asn1p_lval.tv_opaque.len = asn1p_leng; - return TOK_whitespace; - } - YY_BREAK -case 131: -YY_RULE_SETUP -#line 428 "asn1p_l.l" -{ - yy_pop_state(); - if(YYSTATE == with_syntax) { - asn1p_lval.tv_str = strdup(asn1p_text); - return TOK_Literal; - } else { - return '}'; - } - } - YY_BREAK - -case 132: -/* rule 132 can match eol */ -YY_RULE_SETUP -#line 441 "asn1p_l.l" -/* Ignore whitespace */ - YY_BREAK -case 133: -/* rule 133 can match eol */ -YY_RULE_SETUP -#line 444 "asn1p_l.l" -{ - asn1c_integer_t v1 = -1, v2 = -1; - char *p; - for(p = asn1p_text; *p; p++) - if(*p >= '0' && *p <= '9') - { v1 = _lex_atoi(p); break; } - while(*p >= '0' && *p <= '9') p++; /* Skip digits */ - for(; *p; p++) if(*p >= '0' && *p <= '9') - { v2 = _lex_atoi(p); break; } - if(v1 < 0 || v1 > 7) { - fprintf(stderr, "%s at line %d: X.680:2003, #37.14 " - "mandates 0..7 range for Tuple's TableColumn\n", - asn1p_text, asn1p_lineno); - return -1; - } - if(v2 < 0 || v2 > 15) { - fprintf(stderr, "%s at line %d: X.680:2003, #37.14 " - "mandates 0..15 range for Tuple's TableRow\n", - asn1p_text, asn1p_lineno); - return -1; - } - asn1p_lval.a_int = (v1 << 4) + v2; - return TOK_tuple; - } - YY_BREAK -case 134: -/* rule 134 can match eol */ -YY_RULE_SETUP -#line 469 "asn1p_l.l" -{ - asn1c_integer_t v1 = -1, v2 = -1, v3 = -1, v4 = -1; - char *p; - for(p = asn1p_text; *p; p++) - if(*p >= '0' && *p <= '9') - { v1 = _lex_atoi(p); break; } - while(*p >= '0' && *p <= '9') p++; /* Skip digits */ - for(; *p; p++) if(*p >= '0' && *p <= '9') - { v2 = _lex_atoi(p); break; } - while(*p >= '0' && *p <= '9') p++; - for(; *p; p++) if(*p >= '0' && *p <= '9') - { v3 = _lex_atoi(p); break; } - while(*p >= '0' && *p <= '9') p++; - for(; *p; p++) if(*p >= '0' && *p <= '9') - { v4 = _lex_atoi(p); break; } - if(v1 < 0 || v1 > 127) { - fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " - "mandates 0..127 range for Quadruple's Group\n", - asn1p_text, asn1p_lineno); - return -1; - } - if(v2 < 0 || v2 > 255) { - fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " - "mandates 0..255 range for Quadruple's Plane\n", - asn1p_text, asn1p_lineno); - return -1; - } - if(v3 < 0 || v3 > 255) { - fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " - "mandates 0..255 range for Quadruple's Row\n", - asn1p_text, asn1p_lineno); - return -1; - } - if(v4 < 0 || v4 > 255) { - fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " - "mandates 0..255 range for Quadruple's Cell\n", - asn1p_text, asn1p_lineno); - return -1; - } - asn1p_lval.a_int = (v1 << 24) | (v2 << 16) | (v3 << 8) | v4; - return TOK_quadruple; - } - YY_BREAK -case 135: -YY_RULE_SETUP -#line 513 "asn1p_l.l" -return TOK_VBracketLeft; - YY_BREAK -case 136: -YY_RULE_SETUP -#line 514 "asn1p_l.l" -return TOK_VBracketRight; - YY_BREAK -case 137: -YY_RULE_SETUP -#line 516 "asn1p_l.l" -return asn1p_text[0]; - YY_BREAK -case 138: -/* rule 138 can match eol */ -YY_RULE_SETUP -#line 518 "asn1p_l.l" -{ - if(TYPE_LIFETIME(1994, 0)) - fprintf(stderr, "ERROR: "); - fprintf(stderr, - "Symbol '%c' at line %d is prohibited " - "by ASN.1:1994 and ASN.1:1997\n", - asn1p_text[0], asn1p_lineno); - if(TYPE_LIFETIME(1994, 0)) - return -1; - } - YY_BREAK -case 139: -YY_RULE_SETUP -#line 529 "asn1p_l.l" -{ - fprintf(stderr, - "Unexpected token at line %d: \"%s\"\n", - asn1p_lineno, asn1p_text); - while(YYSTATE != INITIAL) - yy_pop_state(); - if(0) { - yy_top_state(); /* Just to use this function. */ - yy_fatal_error("Parse error"); - } - return -1; -} - YY_BREAK -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(dash_comment): -case YY_STATE_EOF(idash_comment): -case YY_STATE_EOF(cpp_comment): -case YY_STATE_EOF(quoted): -case YY_STATE_EOF(opaque): -case YY_STATE_EOF(encoding_control): -case YY_STATE_EOF(with_syntax): -#line 542 "asn1p_l.l" -{ - while(YYSTATE != INITIAL) - yy_pop_state(); - yyterminate(); - } - YY_BREAK -case 140: -YY_RULE_SETUP -#line 549 "asn1p_l.l" -YY_FATAL_ERROR( "flex scanner jammed" ); - YY_BREAK -#line 3474 "lex.yy.c" - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed asn1p_in at a new source and called - * asn1p_lex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = asn1p_in; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( asn1p_wrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * asn1p_text, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of asn1p_lex */ -/* %ok-for-header */ - -/* %if-c++-only */ -/* %not-for-header */ - -/* %ok-for-header */ - -/* %endif */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -/* %if-c-only */ -static int yy_get_next_buffer (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - asn1p_restart(asn1p_in ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) asn1p_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -/* %if-c-only */ -/* %not-for-header */ - - static yy_state_type yy_get_previous_state (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - register yy_state_type yy_current_state; - register char *yy_cp; - -/* %% [15.0] code to get the start state into yy_current_state goes here */ - yy_current_state = (yy_start); - - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { -/* %% [16.0] code to find the next state goes here */ - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 746 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *(yy_state_ptr)++ = yy_current_state; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ -/* %if-c-only */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - register int yy_is_jam; - /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ - - register YY_CHAR yy_c = 1; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 746 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 745); - if ( ! yy_is_jam ) - *(yy_state_ptr)++ = yy_current_state; - - return yy_is_jam ? 0 : yy_current_state; -} - -/* %if-c-only */ - - static void yyunput (int c, register char * yy_bp ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up asn1p_text */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -/* %% [18.0] update asn1p_lineno here */ - - if ( c == '\n' ){ - --asn1p_lineno; - } - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} -/* %if-c-only */ - -/* %endif */ - -/* %if-c-only */ -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - asn1p_restart(asn1p_in ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( asn1p_wrap( ) ) - return 0; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve asn1p_text */ - (yy_hold_char) = *++(yy_c_buf_p); - -/* %% [19.0] update BOL and asn1p_lineno */ - if ( c == '\n' ) - - asn1p_lineno++; -; - - return c; -} -/* %if-c-only */ -#endif /* ifndef YY_NO_INPUT */ -/* %endif */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ -/* %if-c-only */ - void asn1p_restart (FILE * input_file ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - - if ( ! YY_CURRENT_BUFFER ){ - asn1p_ensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - asn1p__create_buffer(asn1p_in,YY_BUF_SIZE ); - } - - asn1p__init_buffer(YY_CURRENT_BUFFER,input_file ); - asn1p__load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ -/* %if-c-only */ - void asn1p__switch_to_buffer (YY_BUFFER_STATE new_buffer ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - - /* TODO. We should be able to replace this entire function body - * with - * asn1p_pop_buffer_state(); - * asn1p_push_buffer_state(new_buffer); - */ - asn1p_ensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - asn1p__load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (asn1p_wrap()) processing, but the only time this flag - * is looked at is after asn1p_wrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -/* %if-c-only */ -static void asn1p__load_buffer_state (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - asn1p_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ -/* %if-c-only */ - YY_BUFFER_STATE asn1p__create_buffer (FILE * file, int size ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) asn1p_alloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in asn1p__create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) asn1p_alloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in asn1p__create_buffer()" ); - - b->yy_is_our_buffer = 1; - - asn1p__init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with asn1p__create_buffer() - * - */ -/* %if-c-only */ - void asn1p__delete_buffer (YY_BUFFER_STATE b ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - asn1p_free((void *) b->yy_ch_buf ); - - asn1p_free((void *) b ); -} - -/* %if-c-only */ - -/* %endif */ - -/* %if-c++-only */ -/* %endif */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a asn1p_restart() or at EOF. - */ -/* %if-c-only */ - static void asn1p__init_buffer (YY_BUFFER_STATE b, FILE * file ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ - -{ - int oerrno = errno; - - asn1p__flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then asn1p__init_buffer was _probably_ - * called from asn1p_restart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - -/* %if-c-only */ - - b->yy_is_interactive = 0; - -/* %endif */ -/* %if-c++-only */ -/* %endif */ - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ -/* %if-c-only */ - void asn1p__flush_buffer (YY_BUFFER_STATE b ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - asn1p__load_buffer_state( ); -} - -/* %if-c-or-c++ */ -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -/* %if-c-only */ -void asn1p_push_buffer_state (YY_BUFFER_STATE new_buffer ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - if (new_buffer == NULL) - return; - - asn1p_ensure_buffer_stack(); - - /* This block is copied from asn1p__switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from asn1p__switch_to_buffer. */ - asn1p__load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} -/* %endif */ - -/* %if-c-or-c++ */ -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -/* %if-c-only */ -void asn1p_pop_buffer_state (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - if (!YY_CURRENT_BUFFER) - return; - - asn1p__delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - asn1p__load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} -/* %endif */ - -/* %if-c-or-c++ */ -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -/* %if-c-only */ -static void asn1p_ensure_buffer_stack (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)asn1p_alloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in asn1p_ensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)asn1p_realloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in asn1p_ensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} -/* %endif */ - -/* %if-c-only */ -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE asn1p__scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) asn1p_alloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in asn1p__scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - asn1p__switch_to_buffer(b ); - - return b; -} -/* %endif */ - -/* %if-c-only */ -/** Setup the input buffer state to scan a string. The next call to asn1p_lex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * asn1p__scan_bytes() instead. - */ -YY_BUFFER_STATE asn1p__scan_string (yyconst char * yystr ) -{ - - return asn1p__scan_bytes(yystr,strlen(yystr) ); -} -/* %endif */ - -/* %if-c-only */ -/** Setup the input buffer state to scan the given bytes. The next call to asn1p_lex() will - * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE asn1p__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n, i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) asn1p_alloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in asn1p__scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = asn1p__scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in asn1p__scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} -/* %endif */ - -/* %if-c-only */ - static void yy_push_state (int new_state ) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) - { - yy_size_t new_size; - - (yy_start_stack_depth) += YY_START_STACK_INCR; - new_size = (yy_start_stack_depth) * sizeof( int ); - - if ( ! (yy_start_stack) ) - (yy_start_stack) = (int *) asn1p_alloc(new_size ); - - else - (yy_start_stack) = (int *) asn1p_realloc((void *) (yy_start_stack),new_size ); - - if ( ! (yy_start_stack) ) - YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); - } - - (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; - - BEGIN(new_state); -} - -/* %if-c-only */ - static void yy_pop_state (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - if ( --(yy_start_stack_ptr) < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); -} - -/* %if-c-only */ - static int yy_top_state (void) -/* %endif */ -/* %if-c++-only */ -/* %endif */ -{ - return (yy_start_stack)[(yy_start_stack_ptr) - 1]; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -/* %if-c-only */ -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} -/* %endif */ -/* %if-c++-only */ -/* %endif */ - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up asn1p_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - asn1p_text[asn1p_leng] = (yy_hold_char); \ - (yy_c_buf_p) = asn1p_text + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - asn1p_leng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/* %if-c-only */ -/* %if-reentrant */ -/* %endif */ - -/** Get the current line number. - * - */ -int asn1p_get_lineno (void) -{ - - return asn1p_lineno; -} - -/** Get the input stream. - * - */ -FILE *asn1p_get_in (void) -{ - return asn1p_in; -} - -/** Get the output stream. - * - */ -FILE *asn1p_get_out (void) -{ - return asn1p_out; -} - -/** Get the length of the current token. - * - */ -yy_size_t asn1p_get_leng (void) -{ - return asn1p_leng; -} - -/** Get the current token. - * - */ - -char *asn1p_get_text (void) -{ - return asn1p_text; -} - -/* %if-reentrant */ -/* %endif */ - -/** Set the current line number. - * @param line_number - * - */ -void asn1p_set_lineno (int line_number ) -{ - - asn1p_lineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see asn1p__switch_to_buffer - */ -void asn1p_set_in (FILE * in_str ) -{ - asn1p_in = in_str ; -} - -void asn1p_set_out (FILE * out_str ) -{ - asn1p_out = out_str ; -} - -int asn1p_get_debug (void) -{ - return asn1p__flex_debug; -} - -void asn1p_set_debug (int bdebug ) -{ - asn1p__flex_debug = bdebug ; -} - -/* %endif */ - -/* %if-reentrant */ -/* %if-bison-bridge */ -/* %endif */ -/* %endif if-c-only */ - -/* %if-c-only */ -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from asn1p_lex_destroy(), so don't allocate here. - */ - - /* We do not touch asn1p_lineno unless the option is enabled. */ - asn1p_lineno = 1; - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - - (yy_start_stack_ptr) = 0; - (yy_start_stack_depth) = 0; - (yy_start_stack) = NULL; - - (yy_state_buf) = 0; - (yy_state_ptr) = 0; - (yy_full_match) = 0; - (yy_lp) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - asn1p_in = stdin; - asn1p_out = stdout; -#else - asn1p_in = (FILE *) 0; - asn1p_out = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * asn1p_lex_init() - */ - return 0; -} -/* %endif */ - -/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ -/* asn1p_lex_destroy is for both reentrant and non-reentrant scanners. */ -int asn1p_lex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - asn1p__delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - asn1p_pop_buffer_state(); - } - - /* Destroy the stack itself. */ - asn1p_free((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Destroy the start condition stack. */ - asn1p_free((yy_start_stack) ); - (yy_start_stack) = NULL; - - asn1p_free ( (yy_state_buf) ); - (yy_state_buf) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * asn1p_lex() is called, initialization will occur. */ - yy_init_globals( ); - -/* %if-reentrant */ -/* %endif */ - return 0; -} -/* %endif */ - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *asn1p_alloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *asn1p_realloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void asn1p_free (void * ptr ) -{ - free( (char *) ptr ); /* see asn1p_realloc() for (char *) cast */ -} - -/* %if-tables-serialization definitions */ -/* %define-yytables The name for this specific scanner's tables. */ -#define YYTABLES_NAME "yytables" -/* %endif */ - -/* %ok-for-header */ - -#line 549 "asn1p_l.l" - - - -/* - * Very dirty but wonderful hack allowing to rule states from within .y file. - */ -void asn1p_lexer_hack_push_opaque_state() { yy_push_state(opaque); } - -/* - * Another hack which disables recognizing some tokens when inside WITH SYNTAX. - */ -void asn1p_lexer_hack_enable_with_syntax() { yy_push_state(with_syntax); } - -/* Yet another */ -void asn1p_lexer_hack_push_encoding_control() { - yy_push_state(encoding_control); -} - -static asn1c_integer_t -_lex_atoi(const char *ptr) { - asn1c_integer_t value; - if(asn1p_atoi(ptr, &value)) { - fprintf(stderr, - "Value \"%s\" at line %d is too large " - "for this compiler! Please contact the asn1c author.\n", - ptr, asn1p_lineno); - errno = ERANGE; - } - return value; -} - -static double -_lex_atod(const char *ptr) { - double value; - errno = 0; - value = strtod(ptr, 0); - if(errno) { - fprintf(stderr, - "Value \"%s\" at line %d is outside of `double` range " - "in this compiler! Please contact the asn1c author.\n", - ptr, asn1p_lineno); - errno = ERANGE; - } - return value; -} - - diff --git a/libasn1parser/asn1p_l.l b/libasn1parser/asn1p_l.l index 6deeca76c..600f70ef7 100644 --- a/libasn1parser/asn1p_l.l +++ b/libasn1parser/asn1p_l.l @@ -296,7 +296,7 @@ EXCEPT return TOK_EXCEPT; EXPLICIT return TOK_EXPLICIT; EXPORTS return TOK_EXPORTS; EXTENSIBILITY return TOK_EXTENSIBILITY; -EXTERNAL return TOK_EXTERNAL; + /*EXTERNAL return TOK_EXTERNAL;*/ FALSE return TOK_FALSE; FROM return TOK_FROM; GeneralizedTime return TOK_GeneralizedTime; diff --git a/libasn1parser/asn1p_y.c b/libasn1parser/asn1p_y.c deleted file mode 100644 index b68ef5956..000000000 --- a/libasn1parser/asn1p_y.c +++ /dev/null @@ -1,5187 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - 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 2, 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.3" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - -/* Substitute the variable and function names. */ -#define yyparse asn1p_parse -#define yylex asn1p_lex -#define yyerror asn1p_error -#define yylval asn1p_lval -#define yychar asn1p_char -#define yydebug asn1p_debug -#define yynerrs asn1p_nerrs - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_PPEQ = 258, - TOK_VBracketLeft = 259, - TOK_VBracketRight = 260, - TOK_whitespace = 261, - TOK_opaque = 262, - TOK_bstring = 263, - TOK_cstring = 264, - TOK_hstring = 265, - TOK_identifier = 266, - TOK_number = 267, - TOK_number_negative = 268, - TOK_realnumber = 269, - TOK_tuple = 270, - TOK_quadruple = 271, - TOK_typereference = 272, - TOK_capitalreference = 273, - TOK_typefieldreference = 274, - TOK_valuefieldreference = 275, - TOK_Literal = 276, - TOK_ABSENT = 277, - TOK_ABSTRACT_SYNTAX = 278, - TOK_ALL = 279, - TOK_ANY = 280, - TOK_APPLICATION = 281, - TOK_AUTOMATIC = 282, - TOK_BEGIN = 283, - TOK_BIT = 284, - TOK_BMPString = 285, - TOK_BOOLEAN = 286, - TOK_BY = 287, - TOK_CHARACTER = 288, - TOK_CHOICE = 289, - TOK_CLASS = 290, - TOK_COMPONENT = 291, - TOK_COMPONENTS = 292, - TOK_CONSTRAINED = 293, - TOK_CONTAINING = 294, - TOK_DEFAULT = 295, - TOK_DEFINITIONS = 296, - TOK_DEFINED = 297, - TOK_EMBEDDED = 298, - TOK_ENCODED = 299, - TOK_ENCODING_CONTROL = 300, - TOK_END = 301, - TOK_ENUMERATED = 302, - TOK_EXPLICIT = 303, - TOK_EXPORTS = 304, - TOK_EXTENSIBILITY = 305, - TOK_EXTERNAL = 306, - TOK_FALSE = 307, - TOK_FROM = 308, - TOK_GeneralizedTime = 309, - TOK_GeneralString = 310, - TOK_GraphicString = 311, - TOK_IA5String = 312, - TOK_IDENTIFIER = 313, - TOK_IMPLICIT = 314, - TOK_IMPLIED = 315, - TOK_IMPORTS = 316, - TOK_INCLUDES = 317, - TOK_INSTANCE = 318, - TOK_INSTRUCTIONS = 319, - TOK_INTEGER = 320, - TOK_ISO646String = 321, - TOK_MAX = 322, - TOK_MIN = 323, - TOK_MINUS_INFINITY = 324, - TOK_NULL = 325, - TOK_NumericString = 326, - TOK_OBJECT = 327, - TOK_ObjectDescriptor = 328, - TOK_OCTET = 329, - TOK_OF = 330, - TOK_OPTIONAL = 331, - TOK_PATTERN = 332, - TOK_PDV = 333, - TOK_PLUS_INFINITY = 334, - TOK_PRESENT = 335, - TOK_PrintableString = 336, - TOK_PRIVATE = 337, - TOK_REAL = 338, - TOK_RELATIVE_OID = 339, - TOK_SEQUENCE = 340, - TOK_SET = 341, - TOK_SIZE = 342, - TOK_STRING = 343, - TOK_SYNTAX = 344, - TOK_T61String = 345, - TOK_TAGS = 346, - TOK_TeletexString = 347, - TOK_TRUE = 348, - TOK_TYPE_IDENTIFIER = 349, - TOK_UNIQUE = 350, - TOK_UNIVERSAL = 351, - TOK_UniversalString = 352, - TOK_UTCTime = 353, - TOK_UTF8String = 354, - TOK_VideotexString = 355, - TOK_VisibleString = 356, - TOK_WITH = 357, - TOK_EXCEPT = 358, - TOK_INTERSECTION = 359, - TOK_UNION = 360, - TOK_TwoDots = 361, - TOK_ThreeDots = 362 - }; -#endif -/* Tokens. */ -#define TOK_PPEQ 258 -#define TOK_VBracketLeft 259 -#define TOK_VBracketRight 260 -#define TOK_whitespace 261 -#define TOK_opaque 262 -#define TOK_bstring 263 -#define TOK_cstring 264 -#define TOK_hstring 265 -#define TOK_identifier 266 -#define TOK_number 267 -#define TOK_number_negative 268 -#define TOK_realnumber 269 -#define TOK_tuple 270 -#define TOK_quadruple 271 -#define TOK_typereference 272 -#define TOK_capitalreference 273 -#define TOK_typefieldreference 274 -#define TOK_valuefieldreference 275 -#define TOK_Literal 276 -#define TOK_ABSENT 277 -#define TOK_ABSTRACT_SYNTAX 278 -#define TOK_ALL 279 -#define TOK_ANY 280 -#define TOK_APPLICATION 281 -#define TOK_AUTOMATIC 282 -#define TOK_BEGIN 283 -#define TOK_BIT 284 -#define TOK_BMPString 285 -#define TOK_BOOLEAN 286 -#define TOK_BY 287 -#define TOK_CHARACTER 288 -#define TOK_CHOICE 289 -#define TOK_CLASS 290 -#define TOK_COMPONENT 291 -#define TOK_COMPONENTS 292 -#define TOK_CONSTRAINED 293 -#define TOK_CONTAINING 294 -#define TOK_DEFAULT 295 -#define TOK_DEFINITIONS 296 -#define TOK_DEFINED 297 -#define TOK_EMBEDDED 298 -#define TOK_ENCODED 299 -#define TOK_ENCODING_CONTROL 300 -#define TOK_END 301 -#define TOK_ENUMERATED 302 -#define TOK_EXPLICIT 303 -#define TOK_EXPORTS 304 -#define TOK_EXTENSIBILITY 305 -#define TOK_EXTERNAL 306 -#define TOK_FALSE 307 -#define TOK_FROM 308 -#define TOK_GeneralizedTime 309 -#define TOK_GeneralString 310 -#define TOK_GraphicString 311 -#define TOK_IA5String 312 -#define TOK_IDENTIFIER 313 -#define TOK_IMPLICIT 314 -#define TOK_IMPLIED 315 -#define TOK_IMPORTS 316 -#define TOK_INCLUDES 317 -#define TOK_INSTANCE 318 -#define TOK_INSTRUCTIONS 319 -#define TOK_INTEGER 320 -#define TOK_ISO646String 321 -#define TOK_MAX 322 -#define TOK_MIN 323 -#define TOK_MINUS_INFINITY 324 -#define TOK_NULL 325 -#define TOK_NumericString 326 -#define TOK_OBJECT 327 -#define TOK_ObjectDescriptor 328 -#define TOK_OCTET 329 -#define TOK_OF 330 -#define TOK_OPTIONAL 331 -#define TOK_PATTERN 332 -#define TOK_PDV 333 -#define TOK_PLUS_INFINITY 334 -#define TOK_PRESENT 335 -#define TOK_PrintableString 336 -#define TOK_PRIVATE 337 -#define TOK_REAL 338 -#define TOK_RELATIVE_OID 339 -#define TOK_SEQUENCE 340 -#define TOK_SET 341 -#define TOK_SIZE 342 -#define TOK_STRING 343 -#define TOK_SYNTAX 344 -#define TOK_T61String 345 -#define TOK_TAGS 346 -#define TOK_TeletexString 347 -#define TOK_TRUE 348 -#define TOK_TYPE_IDENTIFIER 349 -#define TOK_UNIQUE 350 -#define TOK_UNIVERSAL 351 -#define TOK_UniversalString 352 -#define TOK_UTCTime 353 -#define TOK_UTF8String 354 -#define TOK_VideotexString 355 -#define TOK_VisibleString 356 -#define TOK_WITH 357 -#define TOK_EXCEPT 358 -#define TOK_INTERSECTION 359 -#define TOK_UNION 360 -#define TOK_TwoDots 361 -#define TOK_ThreeDots 362 - - - - -/* Copy the first part of user declarations. */ -#line 1 "asn1p_y.y" - - -#include -#include -#include -#include -#include - -#include "asn1parser.h" - -#define YYPARSE_PARAM param -#define YYPARSE_PARAM_TYPE void ** -#define YYERROR_VERBOSE - -int yylex(void); -int yyerror(const char *msg); -#ifdef YYBYACC -int yyparse(void **param); /* byacc does not produce a prototype */ -#endif -void asn1p_lexer_hack_push_opaque_state(void); -void asn1p_lexer_hack_enable_with_syntax(void); -void asn1p_lexer_hack_push_encoding_control(void); -#define yylineno asn1p_lineno -extern int asn1p_lineno; - -/* - * Process directives as - */ -extern int asn1p_as_pointer; - -/* - * This temporary variable is used to solve the shortcomings of 1-lookahead - * parser. - */ -static struct AssignedIdentifier *saved_aid; - -static asn1p_value_t *_convert_bitstring2binary(char *str, int base); -static void _fixup_anonymous_identifier(asn1p_expr_t *expr); - -static asn1p_module_t *currentModule; -#define NEW_EXPR() (asn1p_expr_new(yylineno, currentModule)) - -#define checkmem(ptr) do { \ - if(!(ptr)) \ - return yyerror("Memory failure"); \ - } while(0) - -#define CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do { \ - if(arg1->type != constr_type) { \ - int __ret; \ - root = asn1p_constraint_new(yylineno); \ - checkmem(root); \ - root->type = constr_type; \ - __ret = asn1p_constraint_insert(root, \ - arg1); \ - checkmem(__ret == 0); \ - } else { \ - root = arg1; \ - } \ - if(arg2) { \ - int __ret \ - = asn1p_constraint_insert(root, arg2); \ - checkmem(__ret == 0); \ - } \ - } while(0) - -#ifdef AL_IMPORT -#error AL_IMPORT DEFINED ELSEWHERE! -#endif -#define AL_IMPORT(to,where,from,field) do { \ - if(!(from)) break; \ - while(TQ_FIRST(&((from)->where))) { \ - TQ_ADD(&((to)->where), \ - TQ_REMOVE(&((from)->where), field), \ - field); \ - } \ - assert(TQ_FIRST(&((from)->where)) == 0); \ - } while(0) - - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 88 "asn1p_y.y" -{ - asn1p_t *a_grammar; - asn1p_module_flags_e a_module_flags; - asn1p_module_t *a_module; - asn1p_expr_type_e a_type; /* ASN.1 Type */ - asn1p_expr_t *a_expr; /* Constructed collection */ - asn1p_constraint_t *a_constr; /* Constraint */ - enum asn1p_constraint_type_e a_ctype;/* Constraint type */ - asn1p_xports_t *a_xports; /* IMports/EXports */ - struct AssignedIdentifier a_aid; /* Assigned Identifier */ - asn1p_oid_t *a_oid; /* Object Identifier */ - asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */ - struct asn1p_type_tag_s a_tag; /* A tag */ - asn1p_ref_t *a_ref; /* Reference to custom type */ - asn1p_wsyntx_t *a_wsynt; /* WITH SYNTAX contents */ - asn1p_wsyntx_chunk_t *a_wchunk; /* WITH SYNTAX chunk */ - struct asn1p_ref_component_s a_refcomp; /* Component of a reference */ - asn1p_value_t *a_value; /* Number, DefinedValue, etc */ - struct asn1p_param_s a_parg; /* A parameter argument */ - asn1p_paramlist_t *a_plist; /* A pargs list */ - struct asn1p_expr_marker_s a_marker; /* OPTIONAL/DEFAULT */ - enum asn1p_constr_pres_e a_pres; /* PRESENT/ABSENT/OPTIONAL */ - asn1c_integer_t a_int; - double a_dbl; - char *tv_str; - struct { - char *buf; - int len; - } tv_opaque; - struct { - char *name; - struct asn1p_type_tag_s tag; - } tv_nametag; -} -/* Line 187 of yacc.c. */ -#line 434 "y.tab.c" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - - - -/* Copy the second part of user declarations. */ - - -/* Line 216 of yacc.c. */ -#line 447 "y.tab.c" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss; - YYSTYPE yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 7 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 803 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 123 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 124 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 316 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 477 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 362 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 119, 2, 2, 2, 2, 2, 2, - 112, 113, 2, 2, 115, 2, 120, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 116, 114, - 121, 2, 2, 2, 122, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 117, 2, 118, 104, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 110, 106, 111, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 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, 105, - 107, 108, 109 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 5, 7, 10, 11, 21, 22, 24, - 28, 31, 33, 36, 38, 43, 45, 46, 48, 50, - 53, 56, 59, 62, 65, 68, 69, 71, 75, 77, - 80, 82, 84, 86, 87, 91, 93, 94, 96, 100, - 103, 104, 106, 108, 111, 112, 114, 119, 121, 125, - 127, 131, 133, 134, 136, 140, 144, 147, 149, 153, - 155, 159, 161, 165, 170, 172, 174, 179, 183, 187, - 194, 201, 203, 207, 209, 213, 217, 221, 225, 227, - 231, 233, 235, 237, 239, 240, 242, 244, 248, 254, - 258, 261, 265, 267, 269, 273, 276, 278, 280, 286, - 287, 289, 291, 295, 298, 303, 307, 311, 315, 319, - 323, 324, 326, 327, 334, 336, 339, 341, 343, 345, - 349, 351, 355, 359, 363, 364, 367, 369, 374, 379, - 384, 391, 398, 400, 405, 409, 411, 415, 419, 423, - 425, 429, 431, 435, 437, 439, 441, 443, 447, 451, - 453, 458, 460, 462, 466, 467, 471, 473, 475, 477, - 479, 481, 483, 485, 487, 491, 493, 495, 497, 499, - 502, 504, 506, 508, 510, 513, 516, 518, 520, 523, - 526, 528, 530, 532, 534, 536, 539, 541, 544, 546, - 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, - 568, 570, 572, 574, 576, 578, 580, 581, 583, 585, - 587, 592, 596, 601, 603, 605, 607, 609, 613, 619, - 621, 625, 627, 631, 633, 637, 639, 643, 648, 652, - 654, 656, 660, 664, 668, 672, 674, 676, 677, 681, - 684, 687, 689, 691, 693, 695, 697, 699, 701, 703, - 705, 707, 709, 713, 719, 721, 725, 727, 731, 732, - 734, 736, 738, 740, 742, 744, 746, 747, 753, 756, - 758, 761, 764, 768, 770, 772, 776, 781, 783, 787, - 790, 794, 796, 800, 801, 803, 805, 808, 811, 815, - 817, 821, 823, 828, 833, 835, 837, 839, 841, 843, - 845, 846, 848, 851, 856, 857, 859, 861, 863, 864, - 866, 868, 870, 872, 874, 875, 877 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 124, 0, -1, 125, -1, 126, -1, 125, 126, -1, - -1, 243, 127, 128, 41, 132, 3, 28, 135, 46, - -1, -1, 129, -1, 110, 130, 111, -1, 110, 111, - -1, 131, -1, 130, 131, -1, 246, -1, 246, 112, - 12, 113, -1, 12, -1, -1, 133, -1, 134, -1, - 133, 134, -1, 48, 91, -1, 59, 91, -1, 27, - 91, -1, 50, 60, -1, 18, 64, -1, -1, 136, - -1, 148, 140, 137, -1, 138, -1, 137, 138, -1, - 155, -1, 185, -1, 153, -1, -1, 45, 18, 139, - -1, 195, -1, -1, 141, -1, 61, 142, 114, -1, - 61, 53, -1, -1, 143, -1, 145, -1, 143, 145, - -1, -1, 129, -1, 146, 53, 243, 144, -1, 147, - -1, 146, 115, 147, -1, 243, -1, 243, 110, 111, - -1, 246, -1, -1, 149, -1, 49, 150, 114, -1, - 49, 24, 114, -1, 49, 114, -1, 151, -1, 150, - 115, 151, -1, 243, -1, 243, 110, 111, -1, 246, - -1, 110, 203, 111, -1, 243, 154, 3, 152, -1, - 194, -1, 179, -1, 179, 110, 158, 111, -1, 243, - 3, 175, -1, 243, 3, 165, -1, 243, 110, 156, - 111, 3, 175, -1, 243, 110, 156, 111, 3, 165, - -1, 157, -1, 156, 115, 157, -1, 243, -1, 243, - 116, 246, -1, 243, 116, 243, -1, 192, 116, 246, - -1, 192, 116, 243, -1, 159, -1, 158, 115, 159, - -1, 175, -1, 188, -1, 246, -1, 152, -1, -1, - 161, -1, 162, -1, 161, 115, 162, -1, 161, 115, - 4, 161, 5, -1, 246, 175, 231, -1, 175, 231, - -1, 37, 75, 175, -1, 174, -1, 164, -1, 163, - 115, 164, -1, 246, 175, -1, 174, -1, 175, -1, - 35, 110, 167, 111, 169, -1, -1, 95, -1, 168, - -1, 167, 115, 168, -1, 19, 231, -1, 20, 175, - 166, 231, -1, 20, 183, 231, -1, 20, 184, 231, - -1, 19, 183, 231, -1, 19, 175, 231, -1, 19, - 184, 231, -1, -1, 170, -1, -1, 102, 89, 110, - 171, 172, 111, -1, 173, -1, 172, 173, -1, 6, - -1, 21, -1, 182, -1, 117, 172, 118, -1, 109, - -1, 109, 119, 189, -1, 109, 119, 236, -1, 238, - 177, 198, -1, -1, 176, 178, -1, 154, -1, 34, - 110, 163, 111, -1, 85, 110, 160, 111, -1, 86, - 110, 160, 111, -1, 85, 198, 75, 245, 238, 177, - -1, 86, 198, 75, 245, 238, 177, -1, 25, -1, - 25, 42, 32, 246, -1, 63, 75, 179, -1, 17, - -1, 17, 120, 243, -1, 244, 120, 243, -1, 17, - 120, 246, -1, 244, -1, 244, 120, 180, -1, 181, - -1, 180, 120, 181, -1, 182, -1, 19, -1, 20, - -1, 19, -1, 183, 120, 19, -1, 183, 120, 20, - -1, 18, -1, 246, 175, 3, 186, -1, 188, -1, - 189, -1, 246, 116, 186, -1, -1, 110, 187, 191, - -1, 70, -1, 52, -1, 93, -1, 8, -1, 10, - -1, 190, -1, 236, -1, 246, -1, 243, 120, 246, - -1, 9, -1, 15, -1, 16, -1, 7, -1, 191, - 7, -1, 31, -1, 70, -1, 83, -1, 193, -1, - 74, 88, -1, 72, 58, -1, 84, -1, 51, -1, - 43, 78, -1, 33, 88, -1, 98, -1, 54, -1, - 195, -1, 65, -1, 47, -1, 29, 88, -1, 192, - -1, 193, 233, -1, 30, -1, 55, -1, 56, -1, - 57, -1, 66, -1, 71, -1, 81, -1, 90, -1, - 92, -1, 97, -1, 99, -1, 100, -1, 101, -1, - 73, -1, 106, -1, 107, -1, 104, -1, 105, -1, - -1, 199, -1, 200, -1, 201, -1, 87, 112, 202, - 113, -1, 112, 202, 113, -1, 201, 112, 202, 113, - -1, 203, -1, 220, -1, 109, -1, 204, -1, 204, - 115, 109, -1, 204, 115, 109, 115, 204, -1, 205, - -1, 24, 103, 208, -1, 206, -1, 205, 196, 206, - -1, 207, -1, 206, 197, 207, -1, 208, -1, 208, - 103, 208, -1, 211, 112, 203, 113, -1, 112, 203, - 113, -1, 212, -1, 214, -1, 212, 224, 212, -1, - 68, 224, 212, -1, 212, 224, 67, -1, 68, 224, - 67, -1, 215, -1, 210, -1, -1, 110, 209, 191, - -1, 77, 9, -1, 77, 246, -1, 87, -1, 53, - -1, 52, -1, 93, -1, 237, -1, 190, -1, 213, - -1, 246, -1, 8, -1, 10, -1, 243, -1, 102, - 36, 201, -1, 102, 37, 110, 216, 111, -1, 217, - -1, 216, 115, 217, -1, 109, -1, 246, 198, 218, - -1, -1, 219, -1, 80, -1, 22, -1, 76, -1, - 221, -1, 225, -1, 223, -1, -1, 38, 32, 110, - 222, 191, -1, 39, 175, -1, 108, -1, 108, 121, - -1, 121, 108, -1, 121, 108, 121, -1, 226, -1, - 227, -1, 110, 243, 111, -1, 226, 110, 228, 111, - -1, 229, -1, 228, 115, 229, -1, 122, 230, -1, - 122, 120, 230, -1, 246, -1, 230, 120, 246, -1, - -1, 232, -1, 76, -1, 40, 186, -1, 110, 111, - -1, 110, 234, 111, -1, 235, -1, 234, 115, 235, - -1, 246, -1, 246, 112, 236, 113, -1, 246, 112, - 189, 113, -1, 236, -1, 109, -1, 12, -1, 13, - -1, 236, -1, 14, -1, -1, 239, -1, 240, 242, - -1, 117, 241, 12, 118, -1, -1, 96, -1, 26, - -1, 82, -1, -1, 59, -1, 48, -1, 17, -1, - 18, -1, 18, -1, -1, 246, -1, 11, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 358, 358, 364, 369, 386, 386, 415, 416, 420, - 423, 429, 435, 444, 448, 452, 462, 463, 472, 475, - 484, 487, 490, 493, 497, 518, 519, 528, 537, 540, - 556, 563, 576, 584, 583, 597, 610, 611, 614, 624, - 630, 631, 634, 639, 646, 647, 651, 662, 667, 674, - 680, 686, 696, 697, 709, 712, 715, 723, 728, 735, - 741, 747, 756, 759, 769, 782, 792, 812, 818, 834, - 840, 848, 857, 868, 872, 879, 886, 894, 905, 910, - 917, 920, 928, 939, 962, 963, 966, 971, 975, 982, - 989, 995, 1002, 1008, 1013, 1020, 1025, 1028, 1035, 1045, - 1046, 1050, 1057, 1067, 1077, 1088, 1098, 1109, 1119, 1130, - 1142, 1143, 1150, 1149, 1158, 1162, 1169, 1173, 1176, 1180, - 1186, 1194, 1203, 1215, 1237, 1244, 1263, 1266, 1272, 1278, - 1284, 1294, 1304, 1310, 1321, 1336, 1344, 1354, 1364, 1374, - 1382, 1404, 1412, 1421, 1425, 1430, 1439, 1443, 1447, 1454, - 1474, 1484, 1485, 1486, 1493, 1493, 1498, 1506, 1511, 1516, - 1520, 1524, 1527, 1533, 1544, 1562, 1566, 1571, 1579, 1588, - 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, - 1613, 1614, 1615, 1622, 1623, 1624, 1628, 1634, 1647, 1648, - 1652, 1656, 1657, 1658, 1659, 1660, 1664, 1665, 1666, 1667, - 1671, 1672, 1679, 1679, 1680, 1680, 1683, 1684, 1690, 1694, - 1697, 1707, 1710, 1716, 1719, 1725, 1729, 1732, 1738, 1749, - 1750, 1756, 1757, 1763, 1764, 1771, 1772, 1778, 1786, 1794, - 1800, 1806, 1813, 1821, 1829, 1838, 1841, 1844, 1844, 1854, - 1859, 1870, 1873, 1879, 1884, 1889, 1890, 1891, 1892, 1906, - 1910, 1917, 1931, 1934, 1940, 1943, 1949, 1955, 1969, 1970, - 1974, 1977, 1980, 1988, 1989, 1990, 1995, 1994, 2006, 2014, - 2015, 2016, 2017, 2020, 2023, 2032, 2047, 2053, 2059, 2073, - 2084, 2100, 2103, 2121, 2125, 2129, 2133, 2156, 2160, 2166, - 2171, 2178, 2185, 2193, 2201, 2208, 2219, 2223, 2230, 2231, - 2262, 2263, 2267, 2274, 2280, 2281, 2282, 2283, 2287, 2288, - 2289, 2293, 2297, 2305, 2312, 2313, 2319 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "TOK_PPEQ", "TOK_VBracketLeft", - "TOK_VBracketRight", "TOK_whitespace", "TOK_opaque", "TOK_bstring", - "TOK_cstring", "TOK_hstring", "TOK_identifier", "TOK_number", - "TOK_number_negative", "TOK_realnumber", "TOK_tuple", "TOK_quadruple", - "TOK_typereference", "TOK_capitalreference", "TOK_typefieldreference", - "TOK_valuefieldreference", "TOK_Literal", "TOK_ABSENT", - "TOK_ABSTRACT_SYNTAX", "TOK_ALL", "TOK_ANY", "TOK_APPLICATION", - "TOK_AUTOMATIC", "TOK_BEGIN", "TOK_BIT", "TOK_BMPString", "TOK_BOOLEAN", - "TOK_BY", "TOK_CHARACTER", "TOK_CHOICE", "TOK_CLASS", "TOK_COMPONENT", - "TOK_COMPONENTS", "TOK_CONSTRAINED", "TOK_CONTAINING", "TOK_DEFAULT", - "TOK_DEFINITIONS", "TOK_DEFINED", "TOK_EMBEDDED", "TOK_ENCODED", - "TOK_ENCODING_CONTROL", "TOK_END", "TOK_ENUMERATED", "TOK_EXPLICIT", - "TOK_EXPORTS", "TOK_EXTENSIBILITY", "TOK_EXTERNAL", "TOK_FALSE", - "TOK_FROM", "TOK_GeneralizedTime", "TOK_GeneralString", - "TOK_GraphicString", "TOK_IA5String", "TOK_IDENTIFIER", "TOK_IMPLICIT", - "TOK_IMPLIED", "TOK_IMPORTS", "TOK_INCLUDES", "TOK_INSTANCE", - "TOK_INSTRUCTIONS", "TOK_INTEGER", "TOK_ISO646String", "TOK_MAX", - "TOK_MIN", "TOK_MINUS_INFINITY", "TOK_NULL", "TOK_NumericString", - "TOK_OBJECT", "TOK_ObjectDescriptor", "TOK_OCTET", "TOK_OF", - "TOK_OPTIONAL", "TOK_PATTERN", "TOK_PDV", "TOK_PLUS_INFINITY", - "TOK_PRESENT", "TOK_PrintableString", "TOK_PRIVATE", "TOK_REAL", - "TOK_RELATIVE_OID", "TOK_SEQUENCE", "TOK_SET", "TOK_SIZE", "TOK_STRING", - "TOK_SYNTAX", "TOK_T61String", "TOK_TAGS", "TOK_TeletexString", - "TOK_TRUE", "TOK_TYPE_IDENTIFIER", "TOK_UNIQUE", "TOK_UNIVERSAL", - "TOK_UniversalString", "TOK_UTCTime", "TOK_UTF8String", - "TOK_VideotexString", "TOK_VisibleString", "TOK_WITH", "TOK_EXCEPT", - "'^'", "TOK_INTERSECTION", "'|'", "TOK_UNION", "TOK_TwoDots", - "TOK_ThreeDots", "'{'", "'}'", "'('", "')'", "';'", "','", "':'", "'['", - "']'", "'!'", "'.'", "'<'", "'@'", "$accept", "ParsedGrammar", - "ModuleList", "ModuleDefinition", "@1", "optObjectIdentifier", - "ObjectIdentifier", "ObjectIdentifierBody", "ObjectIdentifierElement", - "optModuleDefinitionFlags", "ModuleDefinitionFlags", - "ModuleDefinitionFlag", "optModuleBody", "ModuleBody", "AssignmentList", - "Assignment", "@2", "optImports", "ImportsDefinition", - "optImportsBundleSet", "ImportsBundleSet", "AssignedIdentifier", - "ImportsBundle", "ImportsList", "ImportsElement", "optExports", - "ExportsDefinition", "ExportsBody", "ExportsElement", "ValueSet", - "ValueSetTypeAssignment", "DefinedType", "DataTypeReference", - "ParameterArgumentList", "ParameterArgumentName", "ActualParameterList", - "ActualParameter", "optComponentTypeLists", "ComponentTypeLists", - "ComponentType", "AlternativeTypeLists", "AlternativeType", - "ObjectClass", "optUnique", "FieldSpec", "ClassField", "optWithSyntax", - "WithSyntax", "@3", "WithSyntaxList", "WithSyntaxToken", - "ExtensionAndException", "Type", "NSTD_IndirectMarker", - "TypeDeclaration", "TypeDeclarationSet", "ComplexTypeReference", - "ComplexTypeReferenceAmpList", "ComplexTypeReferenceElement", - "PrimitiveFieldReference", "FieldName", "DefinedObjectClass", - "ValueAssignment", "Value", "@4", "SimpleValue", "DefinedValue", - "RestrictedCharacterStringValue", "Opaque", "BasicTypeId", - "BasicTypeId_UniverationCompatible", "BasicType", "BasicString", - "UnionMark", "IntersectionMark", "optConstraints", "Constraint", - "SubtypeConstraint", "SetOfConstraints", "ConstraintSpecs", - "ElementSetSpecs", "ElementSetSpec", "Unions", "Intersections", - "IntersectionElements", "ConstraintSubtypeElement", "@5", - "PatternConstraint", "ConstraintSpec", "SingleValue", "BitStringValue", - "ContainedSubtype", "InnerTypeConstraint", "WithComponentsList", - "WithComponentsElement", "optPresenceConstraint", "PresenceConstraint", - "GeneralConstraint", "UserDefinedConstraint", "@6", "ContentsConstraint", - "ConstraintRangeSpec", "TableConstraint", "SimpleTableConstraint", - "ComponentRelationConstraint", "AtNotationList", "AtNotationElement", - "ComponentIdList", "optMarker", "Marker", "UniverationDefinition", - "UniverationList", "UniverationElement", "SignedNumber", "RealValue", - "optTag", "Tag", "TagTypeValue", "TagClass", "TagPlicit", "TypeRefName", - "ObjectClassReference", "optIdentifier", "Identifier", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 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, 352, 353, 354, - 355, 356, 357, 358, 94, 359, 124, 360, 361, 362, - 123, 125, 40, 41, 59, 44, 58, 91, 93, 33, - 46, 60, 64 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 123, 124, 125, 125, 127, 126, 128, 128, 129, - 129, 130, 130, 131, 131, 131, 132, 132, 133, 133, - 134, 134, 134, 134, 134, 135, 135, 136, 137, 137, - 138, 138, 138, 139, 138, 138, 140, 140, 141, 141, - 142, 142, 143, 143, 144, 144, 145, 146, 146, 147, - 147, 147, 148, 148, 149, 149, 149, 150, 150, 151, - 151, 151, 152, 153, 154, 154, 154, 155, 155, 155, - 155, 156, 156, 157, 157, 157, 157, 157, 158, 158, - 159, 159, 159, 159, 160, 160, 161, 161, 161, 162, - 162, 162, 162, 163, 163, 164, 164, 164, 165, 166, - 166, 167, 167, 168, 168, 168, 168, 168, 168, 168, - 169, 169, 171, 170, 172, 172, 173, 173, 173, 173, - 174, 174, 174, 175, 176, 177, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, - 179, 180, 180, 181, 182, 182, 183, 183, 183, 184, - 185, 186, 186, 186, 187, 186, 186, 188, 188, 188, - 188, 188, 188, 189, 189, 190, 190, 190, 191, 191, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 193, 193, 193, 194, 194, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 196, 196, 197, 197, 198, 198, 199, 200, - 200, 201, 201, 202, 202, 203, 203, 203, 203, 204, - 204, 205, 205, 206, 206, 207, 207, 208, 208, 208, - 208, 208, 208, 208, 208, 208, 208, 209, 208, 210, - 210, 211, 211, 212, 212, 212, 212, 212, 212, 213, - 213, 214, 215, 215, 216, 216, 217, 217, 218, 218, - 219, 219, 219, 220, 220, 220, 222, 221, 223, 224, - 224, 224, 224, 225, 225, 226, 227, 228, 228, 229, - 229, 230, 230, 231, 231, 232, 232, 233, 233, 234, - 234, 235, 235, 235, 235, 235, 236, 236, 237, 237, - 238, 238, 239, 240, 241, 241, 241, 241, 242, 242, - 242, 243, 243, 244, 245, 245, 246 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 2, 0, 9, 0, 1, 3, - 2, 1, 2, 1, 4, 1, 0, 1, 1, 2, - 2, 2, 2, 2, 2, 0, 1, 3, 1, 2, - 1, 1, 1, 0, 3, 1, 0, 1, 3, 2, - 0, 1, 1, 2, 0, 1, 4, 1, 3, 1, - 3, 1, 0, 1, 3, 3, 2, 1, 3, 1, - 3, 1, 3, 4, 1, 1, 4, 3, 3, 6, - 6, 1, 3, 1, 3, 3, 3, 3, 1, 3, - 1, 1, 1, 1, 0, 1, 1, 3, 5, 3, - 2, 3, 1, 1, 3, 2, 1, 1, 5, 0, - 1, 1, 3, 2, 4, 3, 3, 3, 3, 3, - 0, 1, 0, 6, 1, 2, 1, 1, 1, 3, - 1, 3, 3, 3, 0, 2, 1, 4, 4, 4, - 6, 6, 1, 4, 3, 1, 3, 3, 3, 1, - 3, 1, 3, 1, 1, 1, 1, 3, 3, 1, - 4, 1, 1, 3, 0, 3, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, - 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, - 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, - 4, 3, 4, 1, 1, 1, 1, 3, 5, 1, - 3, 1, 3, 1, 3, 1, 3, 4, 3, 1, - 1, 3, 3, 3, 3, 1, 1, 0, 3, 2, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 5, 1, 3, 1, 3, 0, 1, - 1, 1, 1, 1, 1, 1, 0, 5, 2, 1, - 2, 2, 3, 1, 1, 3, 4, 1, 3, 2, - 3, 1, 3, 0, 1, 1, 2, 2, 3, 1, - 3, 1, 4, 4, 1, 1, 1, 1, 1, 1, - 0, 1, 2, 4, 0, 1, 1, 1, 0, 1, - 1, 1, 1, 1, 0, 1, 1 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint16 yydefact[] = -{ - 0, 311, 312, 0, 2, 3, 5, 1, 4, 7, - 0, 0, 8, 316, 15, 10, 0, 11, 13, 16, - 9, 12, 0, 0, 0, 0, 0, 0, 0, 17, - 18, 0, 24, 22, 20, 23, 21, 0, 19, 14, - 52, 0, 0, 26, 36, 53, 0, 56, 0, 57, - 59, 61, 6, 40, 0, 37, 55, 54, 0, 0, - 39, 0, 41, 42, 0, 47, 49, 51, 188, 0, - 189, 190, 191, 192, 193, 201, 194, 195, 196, 197, - 198, 199, 200, 27, 28, 32, 30, 31, 35, 0, - 300, 58, 60, 38, 43, 0, 0, 0, 33, 29, - 300, 135, 313, 0, 170, 0, 0, 184, 177, 181, - 183, 171, 0, 0, 172, 176, 180, 0, 0, 65, - 186, 173, 64, 182, 139, 304, 0, 124, 301, 308, - 44, 48, 50, 34, 0, 68, 67, 0, 185, 179, - 178, 175, 174, 0, 71, 0, 173, 73, 0, 300, - 0, 187, 0, 306, 307, 305, 0, 0, 0, 206, - 310, 309, 302, 45, 46, 0, 136, 138, 0, 0, - 0, 0, 0, 63, 159, 165, 160, 296, 297, 166, - 167, 157, 158, 83, 0, 78, 80, 81, 161, 162, - 82, 295, 287, 0, 289, 294, 291, 144, 145, 140, - 141, 143, 137, 0, 156, 154, 150, 151, 152, 0, - 163, 132, 0, 0, 206, 206, 126, 125, 0, 0, - 123, 207, 208, 209, 300, 300, 0, 101, 300, 72, - 77, 76, 75, 74, 249, 250, 299, 0, 243, 242, - 0, 0, 241, 244, 0, 215, 237, 0, 246, 0, - 216, 219, 221, 223, 225, 236, 0, 229, 247, 230, - 235, 298, 245, 251, 248, 66, 300, 288, 0, 0, - 0, 303, 0, 0, 0, 0, 300, 0, 300, 0, - 300, 0, 0, 0, 300, 237, 0, 213, 214, 263, - 265, 264, 273, 274, 0, 149, 146, 0, 285, 283, - 283, 283, 103, 284, 99, 283, 283, 110, 0, 70, - 69, 0, 269, 0, 0, 239, 240, 0, 0, 0, - 0, 62, 0, 202, 203, 0, 204, 205, 0, 0, - 0, 0, 79, 290, 0, 0, 163, 142, 168, 155, - 164, 153, 0, 120, 0, 93, 96, 97, 300, 134, - 0, 0, 85, 86, 92, 283, 300, 314, 0, 314, - 0, 0, 268, 0, 211, 0, 0, 286, 108, 0, - 107, 109, 100, 283, 105, 106, 0, 98, 111, 102, - 220, 270, 271, 234, 232, 252, 0, 238, 228, 217, - 222, 224, 226, 0, 233, 231, 293, 292, 169, 133, - 0, 127, 300, 95, 300, 128, 300, 90, 283, 300, - 315, 129, 300, 210, 266, 275, 0, 0, 277, 212, - 147, 148, 104, 0, 272, 256, 0, 254, 206, 0, - 227, 121, 122, 94, 91, 300, 87, 89, 124, 124, - 0, 0, 279, 281, 276, 0, 112, 253, 0, 258, - 218, 0, 130, 131, 267, 280, 0, 278, 0, 255, - 261, 262, 260, 257, 259, 88, 282, 116, 117, 0, - 0, 114, 118, 0, 113, 115, 119 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 3, 4, 5, 9, 11, 12, 16, 17, 28, - 29, 30, 42, 43, 83, 84, 133, 54, 55, 61, - 62, 164, 63, 64, 65, 44, 45, 48, 49, 183, - 85, 118, 86, 143, 144, 184, 185, 351, 352, 353, - 344, 345, 135, 373, 226, 227, 377, 378, 458, 470, - 471, 354, 355, 158, 159, 217, 119, 199, 200, 472, - 300, 301, 87, 206, 272, 207, 208, 248, 339, 120, - 121, 122, 123, 325, 328, 220, 221, 222, 223, 286, - 287, 250, 251, 252, 253, 254, 319, 255, 256, 257, - 258, 259, 260, 426, 427, 463, 464, 288, 289, 440, - 290, 314, 291, 292, 293, 417, 418, 442, 302, 303, - 151, 193, 194, 261, 262, 127, 128, 129, 156, 162, - 263, 124, 409, 264 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -297 -static const yytype_int16 yypact[] = -{ - 133, -297, -297, 114, 133, -297, -297, -297, -297, -74, - 38, 19, -297, -297, -297, -297, 57, -297, 46, 155, - -297, -297, 152, 137, 119, 131, 156, 136, 232, 155, - -297, 124, -297, -297, -297, -297, -297, 239, -297, -297, - 229, 15, 214, -297, 228, -297, 191, -297, 168, -297, - 193, -297, -297, 175, 549, -297, -297, -297, 207, 198, - -297, 199, 207, -297, -23, -297, 204, -297, -297, 298, - -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, - -297, -297, -297, 549, -297, -297, -297, -297, -297, 385, - 206, -297, -297, -297, -297, 133, 207, 213, -297, -297, - 35, 205, -297, 240, -297, 241, 249, -297, -297, -297, - -297, -297, 272, 243, -297, -297, -297, 702, 330, 224, - -297, 226, -297, -297, 217, 73, 335, -297, -297, -19, - -74, -297, -297, -297, 230, -297, -297, 207, -297, -297, - -297, -297, -297, 69, -297, 223, -297, 225, 234, 94, - 72, -297, 235, -297, -297, -297, 334, 517, 626, -34, - -297, -297, -297, -297, -297, 273, -297, -297, 345, 702, - 207, 207, 488, -297, -297, -297, -297, -297, -297, -297, - -297, -297, -297, -297, 84, -297, -297, -297, -297, -297, - -297, -297, -297, 98, -297, -297, 250, -297, -297, 244, - -297, -297, -297, 245, -297, -297, -297, -297, -297, 247, - 252, 319, 255, 295, 107, 111, -297, -297, 257, 233, - -297, -297, -297, 259, 189, 6, 115, -297, 35, -297, - -297, -297, -297, -297, -297, -297, -297, 269, -297, -297, - 0, 87, -297, -297, 258, -297, -297, 488, -297, 262, - 260, 190, 194, -297, 271, -297, 265, 0, -297, -297, - -297, -297, -297, -297, -297, -297, 94, -297, 82, 221, - 288, -297, 380, 378, 517, 359, 61, 294, 79, 318, - 79, 322, 233, 366, 206, 133, 286, -297, -297, -297, - -297, -297, 290, -297, 233, -297, -297, 517, -297, 1, - -5, 1, -297, -297, 306, -5, 1, 302, 273, -297, - -297, 506, 287, 301, 370, -297, -297, 300, 297, 380, - 304, -297, 311, -297, -297, 506, -297, -297, 506, 506, - 488, 536, -297, -297, 308, 310, -297, -297, -297, 404, - -297, -297, 378, 305, 125, -297, -297, -297, 206, -297, - 338, 315, 312, -297, -297, 1, 206, 378, 323, 378, - 317, 333, -297, 336, -297, 326, 320, -297, -297, 299, - -297, -297, -297, 1, -297, -297, 356, -297, -297, -297, - -297, -297, 328, -297, -297, 259, 11, 404, -297, 346, - 194, -297, -297, 340, -297, -297, -297, -297, -297, -297, - 221, -297, 61, -297, 206, -297, 17, -297, 1, 206, - -297, -297, 206, -297, -297, -297, -1, 162, -297, -297, - -297, -297, -297, 350, -297, -297, 165, -297, -34, 342, - -297, -297, -297, -297, -297, 54, -297, -297, -297, -297, - 380, 378, 344, -297, -297, 326, -297, -297, 11, 126, - -297, 9, -297, -297, 404, 344, 378, -297, 60, -297, - -297, -297, -297, -297, -297, -297, -297, -297, -297, 60, - 55, -297, -297, 36, -297, -297, -297 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -297, -297, -297, 458, -297, -297, 337, -297, 449, -297, - -297, 441, -297, -297, -297, 388, -297, -297, -297, -297, - -297, -297, 410, -297, 377, -297, -297, -297, 416, 331, - -297, 329, -297, -297, 307, -297, 212, 200, 53, 75, - -297, 88, 261, -297, -297, 183, -297, -297, -297, 23, - -189, -259, -87, -297, -117, -297, 216, -297, 237, -125, - 283, 284, -297, -210, -297, -134, -265, -141, -296, -80, - -72, -297, -36, -297, -297, -213, -297, -297, 177, -82, - -165, 81, -297, 186, 185, -291, -297, -297, -297, -280, - -297, -297, -297, -297, 83, -297, -297, -297, -297, -297, - -297, 279, -297, -297, -297, -297, 92, 97, -188, -297, - -297, -297, 274, -138, -297, -121, -297, -297, -297, -297, - 5, -297, 180, -10 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -284 -static const yytype_int16 yytable[] = -{ - 18, 279, 281, 126, 334, 6, 18, 249, 188, 6, - 13, 189, 195, 136, 465, 187, 188, 346, 88, 189, - 380, 435, 13, 387, 295, 296, 13, 201, 13, 160, - 95, 51, 1, 2, 384, 297, 10, 145, 392, 46, - 161, 297, 467, 67, 90, 146, 50, 88, 51, 13, - 14, 395, 67, 218, 350, 197, 198, 468, 66, 89, - 19, 467, 186, 50, 341, 13, 467, 66, 13, 14, - 134, 298, 13, 90, 197, 198, 468, 298, 219, 197, - 198, 468, 320, 13, 177, 178, 67, 367, 89, 145, - 13, 350, 96, 13, 177, 178, 315, 146, 13, 153, - 130, 66, 174, 175, 176, 13, 177, 178, 312, 179, - 180, 368, 370, 371, 7, 369, 350, 374, 375, 441, - 425, 313, 147, 125, 406, 188, 343, 167, 189, 47, - 195, 335, 187, 188, 125, 431, 189, 299, 304, 190, - 196, 310, 166, 346, 454, 201, 181, 210, 460, 15, - 1, 2, 125, 469, 476, 154, 188, 202, 22, 189, - 231, 233, 209, 343, 31, 393, 474, 407, 20, 155, - 343, 125, 469, 23, 147, 230, 232, 469, 125, 186, - 168, 191, 24, 192, 169, 422, 13, 182, 343, 347, - -84, 191, 1, 2, 218, 265, 125, 362, 218, 266, - 360, 32, 461, 25, 172, 26, 462, 295, 296, 267, - 33, 125, 366, 268, 27, 449, 35, 278, 13, 219, - 437, 280, 34, 219, 1, 2, 307, 36, 60, 297, - 308, 316, 13, 177, 178, 37, 401, 39, 1, 2, - 402, 234, 175, 235, 13, 177, 178, 236, 179, 180, - 1, 2, 1, 2, 197, 198, 190, 237, 196, 336, - 52, 403, 432, 340, 210, 298, 348, 40, 356, 408, - 356, 283, 284, 444, 209, -25, 447, 445, 41, 209, - 448, 475, 57, 58, 475, 238, 239, 210, 438, 53, - 363, 439, 224, 225, 317, 318, 323, 324, 326, 327, - -283, 240, 209, 59, -283, 56, 125, 197, 198, 92, - 241, 101, 102, 93, 97, 347, 98, 434, 420, 421, - 242, 452, 453, 125, 132, 137, 243, 140, 138, 139, - 141, 142, 399, 148, 149, 244, 150, 152, 157, 170, - 165, 171, 245, 285, 172, 247, 203, 410, 228, 410, - 234, 175, 235, 13, 177, 178, 236, 179, 180, 1, - 2, 275, 269, 271, 270, 276, 237, 273, 274, 282, - 277, 294, 311, 321, 329, 322, 428, 330, 234, 175, - 235, 13, 177, 178, 236, 179, 180, 338, 100, 13, - 336, 342, 348, 357, 238, 239, 356, 359, 361, 364, - 365, 372, 101, 102, 376, 209, 443, 386, 381, 382, - 240, 398, 219, 404, 103, 68, 104, 388, 105, 241, - 389, 396, 238, 397, 400, 356, 405, 406, 106, 242, - 413, 443, 107, 419, 411, 243, 108, 383, 428, 109, - 70, 71, 72, 414, 244, 423, 466, 415, 416, 424, - 110, 73, 246, 430, 247, 111, 74, 112, 75, 113, - 446, 429, 8, 243, 456, 21, 76, 163, 114, 115, - 38, 99, 94, 131, 91, 77, 229, 78, 332, 173, - 358, 436, 79, 116, 80, 81, 82, 216, 451, 309, - 433, 379, 473, 349, 385, 117, 234, 175, 235, 13, - 177, 178, 236, 179, 180, 1, 2, 337, 305, 306, - 450, 390, 237, 391, 234, 175, 235, 13, 177, 178, - 236, 179, 180, 1, 2, 174, 175, 176, 13, 177, - 178, 459, 179, 180, 1, 2, 331, 457, 455, 412, - 238, 239, 333, 0, 234, 175, 235, 13, 177, 178, - 236, 179, 180, 0, 0, 0, 240, 0, 238, 239, - 13, 0, 0, 0, 0, 241, 1, 2, 0, 181, - 0, 0, 0, 0, 240, 242, 0, 0, 0, 68, - 0, 243, 0, 241, 0, 0, 0, 204, 238, 0, - 244, 0, 0, 242, 69, 0, 0, 245, 246, 243, - 247, 0, 0, 394, 70, 71, 72, 0, 244, 0, - 182, 0, 0, 0, 0, 73, 246, 0, 247, 0, - 74, 0, 75, 0, 0, 0, 0, 205, 0, 243, - 76, 0, 0, 0, 0, 0, 0, 0, 0, 77, - 0, 78, 0, 101, 102, 0, 79, 0, 80, 81, - 82, 211, 0, 0, 0, 103, 68, 104, 0, 105, - 212, 0, 0, 0, 0, 0, 0, 0, 0, 106, - 0, 0, 0, 107, 0, 0, 0, 108, 0, 0, - 109, 70, 71, 72, 0, 0, 0, 0, 0, 213, - 0, 110, 73, 0, 0, 0, 111, 74, 112, 75, - 113, 0, 0, 0, 0, 0, 0, 76, 0, 114, - 115, 214, 215, 0, 0, 0, 77, 0, 78, 1, - 2, 0, 0, 79, 116, 80, 81, 82, 0, 0, - 0, 103, 68, 104, 0, 105, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 106, 0, 0, 0, 107, - 0, 0, 0, 108, 0, 0, 109, 70, 71, 72, - 0, 0, 0, 0, 0, 0, 0, 110, 73, 0, - 0, 0, 111, 74, 112, 75, 113, 0, 0, 0, - 0, 0, 0, 76, 0, 114, 115, 0, 0, 0, - 0, 0, 77, 0, 78, 0, 0, 0, 0, 79, - 116, 80, 81, 82 -}; - -static const yytype_int16 yycheck[] = -{ - 10, 214, 215, 90, 269, 0, 16, 172, 149, 4, - 11, 149, 150, 100, 5, 149, 157, 276, 54, 157, - 311, 4, 11, 319, 18, 19, 11, 152, 11, 48, - 53, 41, 17, 18, 314, 40, 110, 117, 329, 24, - 59, 40, 6, 53, 54, 117, 41, 83, 58, 11, - 12, 331, 62, 87, 37, 19, 20, 21, 53, 54, - 41, 6, 149, 58, 274, 11, 6, 62, 11, 12, - 35, 76, 11, 83, 19, 20, 21, 76, 112, 19, - 20, 21, 247, 11, 12, 13, 96, 297, 83, 169, - 11, 37, 115, 11, 12, 13, 9, 169, 11, 26, - 95, 96, 8, 9, 10, 11, 12, 13, 108, 15, - 16, 299, 300, 301, 0, 120, 37, 305, 306, 120, - 109, 121, 117, 117, 115, 266, 109, 137, 266, 114, - 268, 269, 266, 274, 117, 400, 274, 224, 225, 149, - 150, 228, 137, 402, 440, 270, 52, 157, 22, 111, - 17, 18, 117, 117, 118, 82, 297, 152, 112, 297, - 170, 171, 157, 109, 12, 330, 111, 355, 111, 96, - 109, 117, 117, 18, 169, 170, 171, 117, 117, 266, - 111, 109, 27, 111, 115, 373, 11, 93, 109, 276, - 111, 109, 17, 18, 87, 111, 117, 284, 87, 115, - 282, 64, 76, 48, 110, 50, 80, 18, 19, 111, - 91, 117, 294, 115, 59, 428, 60, 110, 11, 112, - 408, 110, 91, 112, 17, 18, 111, 91, 53, 40, - 115, 241, 11, 12, 13, 3, 111, 113, 17, 18, - 115, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 17, 18, 19, 20, 266, 24, 268, 269, - 46, 348, 400, 273, 274, 76, 276, 28, 278, 356, - 280, 38, 39, 111, 269, 46, 111, 115, 49, 274, - 115, 470, 114, 115, 473, 52, 53, 297, 409, 61, - 285, 412, 19, 20, 36, 37, 106, 107, 104, 105, - 111, 68, 297, 110, 115, 114, 117, 19, 20, 111, - 77, 17, 18, 114, 110, 402, 18, 404, 19, 20, - 87, 438, 439, 117, 111, 120, 93, 78, 88, 88, - 58, 88, 342, 3, 110, 102, 110, 120, 3, 116, - 110, 116, 109, 110, 110, 112, 12, 357, 3, 359, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 42, 112, 118, 120, 110, 24, 120, 116, 112, - 75, 112, 103, 111, 103, 115, 386, 112, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 7, 3, 11, - 400, 32, 402, 75, 52, 53, 406, 75, 32, 113, - 110, 95, 17, 18, 102, 400, 416, 110, 121, 108, - 68, 7, 112, 75, 29, 30, 31, 113, 33, 77, - 109, 113, 52, 113, 119, 435, 111, 115, 43, 87, - 113, 441, 47, 113, 111, 93, 51, 67, 448, 54, - 55, 56, 57, 110, 102, 89, 456, 111, 122, 121, - 65, 66, 110, 113, 112, 70, 71, 72, 73, 74, - 110, 115, 4, 93, 120, 16, 81, 130, 83, 84, - 29, 83, 62, 96, 58, 90, 169, 92, 266, 148, - 280, 406, 97, 98, 99, 100, 101, 158, 435, 228, - 402, 308, 469, 277, 317, 110, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 270, 225, 225, - 429, 325, 24, 328, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 8, 9, 10, 11, 12, - 13, 448, 15, 16, 17, 18, 257, 445, 441, 359, - 52, 53, 268, -1, 8, 9, 10, 11, 12, 13, - 14, 15, 16, -1, -1, -1, 68, -1, 52, 53, - 11, -1, -1, -1, -1, 77, 17, 18, -1, 52, - -1, -1, -1, -1, 68, 87, -1, -1, -1, 30, - -1, 93, -1, 77, -1, -1, -1, 70, 52, -1, - 102, -1, -1, 87, 45, -1, -1, 109, 110, 93, - 112, -1, -1, 67, 55, 56, 57, -1, 102, -1, - 93, -1, -1, -1, -1, 66, 110, -1, 112, -1, - 71, -1, 73, -1, -1, -1, -1, 110, -1, 93, - 81, -1, -1, -1, -1, -1, -1, -1, -1, 90, - -1, 92, -1, 17, 18, -1, 97, -1, 99, 100, - 101, 25, -1, -1, -1, 29, 30, 31, -1, 33, - 34, -1, -1, -1, -1, -1, -1, -1, -1, 43, - -1, -1, -1, 47, -1, -1, -1, 51, -1, -1, - 54, 55, 56, 57, -1, -1, -1, -1, -1, 63, - -1, 65, 66, -1, -1, -1, 70, 71, 72, 73, - 74, -1, -1, -1, -1, -1, -1, 81, -1, 83, - 84, 85, 86, -1, -1, -1, 90, -1, 92, 17, - 18, -1, -1, 97, 98, 99, 100, 101, -1, -1, - -1, 29, 30, 31, -1, 33, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, - -1, -1, -1, 51, -1, -1, 54, 55, 56, 57, - -1, -1, -1, -1, -1, -1, -1, 65, 66, -1, - -1, -1, 70, 71, 72, 73, 74, -1, -1, -1, - -1, -1, -1, 81, -1, 83, 84, -1, -1, -1, - -1, -1, 90, -1, 92, -1, -1, -1, -1, 97, - 98, 99, 100, 101 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 17, 18, 124, 125, 126, 243, 0, 126, 127, - 110, 128, 129, 11, 12, 111, 130, 131, 246, 41, - 111, 131, 112, 18, 27, 48, 50, 59, 132, 133, - 134, 12, 64, 91, 91, 60, 91, 3, 134, 113, - 28, 49, 135, 136, 148, 149, 24, 114, 150, 151, - 243, 246, 46, 61, 140, 141, 114, 114, 115, 110, - 53, 142, 143, 145, 146, 147, 243, 246, 30, 45, - 55, 56, 57, 66, 71, 73, 81, 90, 92, 97, - 99, 100, 101, 137, 138, 153, 155, 185, 195, 243, - 246, 151, 111, 114, 145, 53, 115, 110, 18, 138, - 3, 17, 18, 29, 31, 33, 43, 47, 51, 54, - 65, 70, 72, 74, 83, 84, 98, 110, 154, 179, - 192, 193, 194, 195, 244, 117, 175, 238, 239, 240, - 243, 147, 111, 139, 35, 165, 175, 120, 88, 88, - 78, 58, 88, 156, 157, 192, 193, 243, 3, 110, - 110, 233, 120, 26, 82, 96, 241, 3, 176, 177, - 48, 59, 242, 129, 144, 110, 243, 246, 111, 115, - 116, 116, 110, 152, 8, 9, 10, 12, 13, 15, - 16, 52, 93, 152, 158, 159, 175, 188, 190, 236, - 246, 109, 111, 234, 235, 236, 246, 19, 20, 180, - 181, 182, 243, 12, 70, 110, 186, 188, 189, 243, - 246, 25, 34, 63, 85, 86, 154, 178, 87, 112, - 198, 199, 200, 201, 19, 20, 167, 168, 3, 157, - 243, 246, 243, 246, 8, 10, 14, 24, 52, 53, - 68, 77, 87, 93, 102, 109, 110, 112, 190, 203, - 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, - 215, 236, 237, 243, 246, 111, 115, 111, 115, 112, - 120, 118, 187, 120, 116, 42, 110, 75, 110, 198, - 110, 198, 112, 38, 39, 110, 202, 203, 220, 221, - 223, 225, 226, 227, 112, 18, 19, 40, 76, 175, - 183, 184, 231, 232, 175, 183, 184, 111, 115, 165, - 175, 103, 108, 121, 224, 9, 246, 36, 37, 209, - 203, 111, 115, 106, 107, 196, 104, 105, 197, 103, - 112, 224, 159, 235, 189, 236, 246, 181, 7, 191, - 246, 186, 32, 109, 163, 164, 174, 175, 246, 179, - 37, 160, 161, 162, 174, 175, 246, 75, 160, 75, - 202, 32, 175, 243, 113, 110, 202, 186, 231, 120, - 231, 231, 95, 166, 231, 231, 102, 169, 170, 168, - 208, 121, 108, 67, 212, 201, 110, 191, 113, 109, - 206, 207, 208, 203, 67, 212, 113, 113, 7, 246, - 119, 111, 115, 175, 75, 111, 115, 231, 175, 245, - 246, 111, 245, 113, 110, 111, 122, 228, 229, 113, - 19, 20, 231, 89, 121, 109, 216, 217, 246, 115, - 113, 189, 236, 164, 175, 4, 162, 231, 238, 238, - 222, 120, 230, 246, 111, 115, 110, 111, 115, 198, - 204, 161, 177, 177, 191, 230, 120, 229, 171, 217, - 22, 76, 80, 218, 219, 5, 246, 6, 21, 117, - 172, 173, 182, 172, 111, 173, 118 -}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*----------. -| yyparse. | -`----------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a look-ahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - if (yyn == YYFINAL) - YYACCEPT; - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 358 "asn1p_y.y" - { - *(void **)param = (yyvsp[(1) - (1)].a_grammar); - } - break; - - case 3: -#line 364 "asn1p_y.y" - { - (yyval.a_grammar) = asn1p_new(); - checkmem((yyval.a_grammar)); - TQ_ADD(&((yyval.a_grammar)->modules), (yyvsp[(1) - (1)].a_module), mod_next); - } - break; - - case 4: -#line 369 "asn1p_y.y" - { - (yyval.a_grammar) = (yyvsp[(1) - (2)].a_grammar); - TQ_ADD(&((yyval.a_grammar)->modules), (yyvsp[(2) - (2)].a_module), mod_next); - } - break; - - case 5: -#line 386 "asn1p_y.y" - { currentModule = asn1p_module_new(); } - break; - - case 6: -#line 391 "asn1p_y.y" - { - - (yyval.a_module) = currentModule; - - if((yyvsp[(8) - (9)].a_module)) { - asn1p_module_t tmp = *((yyval.a_module)); - *((yyval.a_module)) = *((yyvsp[(8) - (9)].a_module)); - *((yyvsp[(8) - (9)].a_module)) = tmp; - asn1p_module_free((yyvsp[(8) - (9)].a_module)); - } else { - /* There's a chance that a module is just plain empty */ - } - - (yyval.a_module)->ModuleName = (yyvsp[(1) - (9)].tv_str); - (yyval.a_module)->module_oid = (yyvsp[(3) - (9)].a_oid); - (yyval.a_module)->module_flags = (yyvsp[(5) - (9)].a_module_flags); - } - break; - - case 7: -#line 415 "asn1p_y.y" - { (yyval.a_oid) = 0; } - break; - - case 8: -#line 416 "asn1p_y.y" - { (yyval.a_oid) = (yyvsp[(1) - (1)].a_oid); } - break; - - case 9: -#line 420 "asn1p_y.y" - { - (yyval.a_oid) = (yyvsp[(2) - (3)].a_oid); - } - break; - - case 10: -#line 423 "asn1p_y.y" - { - (yyval.a_oid) = 0; - } - break; - - case 11: -#line 429 "asn1p_y.y" - { - (yyval.a_oid) = asn1p_oid_new(); - asn1p_oid_add_arc((yyval.a_oid), &(yyvsp[(1) - (1)].a_oid_arc)); - if((yyvsp[(1) - (1)].a_oid_arc).name) - free((yyvsp[(1) - (1)].a_oid_arc).name); - } - break; - - case 12: -#line 435 "asn1p_y.y" - { - (yyval.a_oid) = (yyvsp[(1) - (2)].a_oid); - asn1p_oid_add_arc((yyval.a_oid), &(yyvsp[(2) - (2)].a_oid_arc)); - if((yyvsp[(2) - (2)].a_oid_arc).name) - free((yyvsp[(2) - (2)].a_oid_arc).name); - } - break; - - case 13: -#line 444 "asn1p_y.y" - { /* iso */ - (yyval.a_oid_arc).name = (yyvsp[(1) - (1)].tv_str); - (yyval.a_oid_arc).number = -1; - } - break; - - case 14: -#line 448 "asn1p_y.y" - { /* iso(1) */ - (yyval.a_oid_arc).name = (yyvsp[(1) - (4)].tv_str); - (yyval.a_oid_arc).number = (yyvsp[(3) - (4)].a_int); - } - break; - - case 15: -#line 452 "asn1p_y.y" - { /* 1 */ - (yyval.a_oid_arc).name = 0; - (yyval.a_oid_arc).number = (yyvsp[(1) - (1)].a_int); - } - break; - - case 16: -#line 462 "asn1p_y.y" - { (yyval.a_module_flags) = MSF_NOFLAGS; } - break; - - case 17: -#line 463 "asn1p_y.y" - { - (yyval.a_module_flags) = (yyvsp[(1) - (1)].a_module_flags); - } - break; - - case 18: -#line 472 "asn1p_y.y" - { - (yyval.a_module_flags) = (yyvsp[(1) - (1)].a_module_flags); - } - break; - - case 19: -#line 475 "asn1p_y.y" - { - (yyval.a_module_flags) = (yyvsp[(1) - (2)].a_module_flags) | (yyvsp[(2) - (2)].a_module_flags); - } - break; - - case 20: -#line 484 "asn1p_y.y" - { - (yyval.a_module_flags) = MSF_EXPLICIT_TAGS; - } - break; - - case 21: -#line 487 "asn1p_y.y" - { - (yyval.a_module_flags) = MSF_IMPLICIT_TAGS; - } - break; - - case 22: -#line 490 "asn1p_y.y" - { - (yyval.a_module_flags) = MSF_AUTOMATIC_TAGS; - } - break; - - case 23: -#line 493 "asn1p_y.y" - { - (yyval.a_module_flags) = MSF_EXTENSIBILITY_IMPLIED; - } - break; - - case 24: -#line 497 "asn1p_y.y" - { - /* X.680Amd1 specifies TAG and XER */ - if(strcmp((yyvsp[(1) - (2)].tv_str), "TAG") == 0) { - (yyval.a_module_flags) = MSF_TAG_INSTRUCTIONS; - } else if(strcmp((yyvsp[(1) - (2)].tv_str), "XER") == 0) { - (yyval.a_module_flags) = MSF_XER_INSTRUCTIONS; - } else { - fprintf(stderr, - "WARNING: %s INSTRUCTIONS at line %d: " - "Unrecognized encoding reference\n", - (yyvsp[(1) - (2)].tv_str), yylineno); - (yyval.a_module_flags) = MSF_unk_INSTRUCTIONS; - } - free((yyvsp[(1) - (2)].tv_str)); - } - break; - - case 25: -#line 518 "asn1p_y.y" - { (yyval.a_module) = 0; } - break; - - case 26: -#line 519 "asn1p_y.y" - { - (yyval.a_module) = (yyvsp[(1) - (1)].a_module); - } - break; - - case 27: -#line 528 "asn1p_y.y" - { - (yyval.a_module) = asn1p_module_new(); - AL_IMPORT((yyval.a_module), exports, (yyvsp[(1) - (3)].a_module), xp_next); - AL_IMPORT((yyval.a_module), imports, (yyvsp[(2) - (3)].a_module), xp_next); - AL_IMPORT((yyval.a_module), members, (yyvsp[(3) - (3)].a_module), next); - } - break; - - case 28: -#line 537 "asn1p_y.y" - { - (yyval.a_module) = (yyvsp[(1) - (1)].a_module); - } - break; - - case 29: -#line 540 "asn1p_y.y" - { - if((yyvsp[(1) - (2)].a_module)) { - (yyval.a_module) = (yyvsp[(1) - (2)].a_module); - } else { - (yyval.a_module) = (yyvsp[(2) - (2)].a_module); - break; - } - AL_IMPORT((yyval.a_module), members, (yyvsp[(2) - (2)].a_module), next); - } - break; - - case 30: -#line 556 "asn1p_y.y" - { - (yyval.a_module) = asn1p_module_new(); - checkmem((yyval.a_module)); - assert((yyvsp[(1) - (1)].a_expr)->expr_type != A1TC_INVALID); - assert((yyvsp[(1) - (1)].a_expr)->meta_type != AMT_INVALID); - TQ_ADD(&((yyval.a_module)->members), (yyvsp[(1) - (1)].a_expr), next); - } - break; - - case 31: -#line 563 "asn1p_y.y" - { - (yyval.a_module) = asn1p_module_new(); - checkmem((yyval.a_module)); - assert((yyvsp[(1) - (1)].a_expr)->expr_type != A1TC_INVALID); - assert((yyvsp[(1) - (1)].a_expr)->meta_type != AMT_INVALID); - TQ_ADD(&((yyval.a_module)->members), (yyvsp[(1) - (1)].a_expr), next); - } - break; - - case 32: -#line 576 "asn1p_y.y" - { - (yyval.a_module) = asn1p_module_new(); - checkmem((yyval.a_module)); - assert((yyvsp[(1) - (1)].a_expr)->expr_type != A1TC_INVALID); - assert((yyvsp[(1) - (1)].a_expr)->meta_type != AMT_INVALID); - TQ_ADD(&((yyval.a_module)->members), (yyvsp[(1) - (1)].a_expr), next); - } - break; - - case 33: -#line 584 "asn1p_y.y" - { asn1p_lexer_hack_push_encoding_control(); } - break; - - case 34: -#line 585 "asn1p_y.y" - { - fprintf(stderr, - "WARNING: ENCODING-CONTROL %s " - "specification at line %d ignored\n", - (yyvsp[(2) - (3)].tv_str), yylineno); - free((yyvsp[(2) - (3)].tv_str)); - (yyval.a_module) = 0; - } - break; - - case 35: -#line 597 "asn1p_y.y" - { - return yyerror( - "Attempt to redefine a standard basic string type, " - "please comment out or remove this type redefinition."); - } - break; - - case 36: -#line 610 "asn1p_y.y" - { (yyval.a_module) = 0; } - break; - - case 38: -#line 614 "asn1p_y.y" - { - if(!saved_aid && 0) - return yyerror("Unterminated IMPORTS FROM, " - "expected semicolon ';'"); - saved_aid = 0; - (yyval.a_module) = (yyvsp[(2) - (3)].a_module); - } - break; - - case 39: -#line 624 "asn1p_y.y" - { - return yyerror("Empty IMPORTS list"); - } - break; - - case 40: -#line 630 "asn1p_y.y" - { (yyval.a_module) = asn1p_module_new(); } - break; - - case 42: -#line 634 "asn1p_y.y" - { - (yyval.a_module) = asn1p_module_new(); - checkmem((yyval.a_module)); - TQ_ADD(&((yyval.a_module)->imports), (yyvsp[(1) - (1)].a_xports), xp_next); - } - break; - - case 43: -#line 639 "asn1p_y.y" - { - (yyval.a_module) = (yyvsp[(1) - (2)].a_module); - TQ_ADD(&((yyval.a_module)->imports), (yyvsp[(2) - (2)].a_xports), xp_next); - } - break; - - case 44: -#line 646 "asn1p_y.y" - { memset(&(yyval.a_aid), 0, sizeof((yyval.a_aid))); } - break; - - case 45: -#line 647 "asn1p_y.y" - { (yyval.a_aid).oid = (yyvsp[(1) - (1)].a_oid); } - break; - - case 46: -#line 651 "asn1p_y.y" - { - (yyval.a_xports) = (yyvsp[(1) - (4)].a_xports); - (yyval.a_xports)->fromModuleName = (yyvsp[(3) - (4)].tv_str); - (yyval.a_xports)->identifier = (yyvsp[(4) - (4)].a_aid); - /* This stupid thing is used for look-back hack. */ - saved_aid = (yyval.a_xports)->identifier.oid ? 0 : &((yyval.a_xports)->identifier); - checkmem((yyval.a_xports)); - } - break; - - case 47: -#line 662 "asn1p_y.y" - { - (yyval.a_xports) = asn1p_xports_new(); - checkmem((yyval.a_xports)); - TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(1) - (1)].a_expr), next); - } - break; - - case 48: -#line 667 "asn1p_y.y" - { - (yyval.a_xports) = (yyvsp[(1) - (3)].a_xports); - TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(3) - (3)].a_expr), next); - } - break; - - case 49: -#line 674 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); - (yyval.a_expr)->expr_type = A1TC_REFERENCE; - } - break; - - case 50: -#line 680 "asn1p_y.y" - { /* Completely equivalent to above */ - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - (yyval.a_expr)->expr_type = A1TC_REFERENCE; - } - break; - - case 51: -#line 686 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); - (yyval.a_expr)->expr_type = A1TC_REFERENCE; - } - break; - - case 52: -#line 696 "asn1p_y.y" - { (yyval.a_module) = 0; } - break; - - case 53: -#line 697 "asn1p_y.y" - { - (yyval.a_module) = asn1p_module_new(); - checkmem((yyval.a_module)); - if((yyvsp[(1) - (1)].a_xports)) { - TQ_ADD(&((yyval.a_module)->exports), (yyvsp[(1) - (1)].a_xports), xp_next); - } else { - /* "EXPORTS ALL;" */ - } - } - break; - - case 54: -#line 709 "asn1p_y.y" - { - (yyval.a_xports) = (yyvsp[(2) - (3)].a_xports); - } - break; - - case 55: -#line 712 "asn1p_y.y" - { - (yyval.a_xports) = 0; - } - break; - - case 56: -#line 715 "asn1p_y.y" - { - /* Empty EXPORTS clause effectively prohibits export. */ - (yyval.a_xports) = asn1p_xports_new(); - checkmem((yyval.a_xports)); - } - break; - - case 57: -#line 723 "asn1p_y.y" - { - (yyval.a_xports) = asn1p_xports_new(); - assert((yyval.a_xports)); - TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(1) - (1)].a_expr), next); - } - break; - - case 58: -#line 728 "asn1p_y.y" - { - (yyval.a_xports) = (yyvsp[(1) - (3)].a_xports); - TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(3) - (3)].a_expr), next); - } - break; - - case 59: -#line 735 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); - (yyval.a_expr)->expr_type = A1TC_EXPORTVAR; - } - break; - - case 60: -#line 741 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - (yyval.a_expr)->expr_type = A1TC_EXPORTVAR; - } - break; - - case 61: -#line 747 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); - (yyval.a_expr)->expr_type = A1TC_EXPORTVAR; - } - break; - - case 62: -#line 756 "asn1p_y.y" - { (yyval.a_constr) = (yyvsp[(2) - (3)].a_constr); } - break; - - case 63: -#line 759 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(2) - (4)].a_expr); - assert((yyval.a_expr)->Identifier == 0); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); - (yyval.a_expr)->meta_type = AMT_VALUESET; - (yyval.a_expr)->constraints = (yyvsp[(4) - (4)].a_constr); - } - break; - - case 64: -#line 769 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); - } - break; - - case 65: -#line 782 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->reference = (yyvsp[(1) - (1)].a_ref); - (yyval.a_expr)->expr_type = A1TC_REFERENCE; - (yyval.a_expr)->meta_type = AMT_TYPEREF; - } - break; - - case 66: -#line 792 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->reference = (yyvsp[(1) - (4)].a_ref); - (yyval.a_expr)->rhs_pspecs = (yyvsp[(3) - (4)].a_expr); - (yyval.a_expr)->expr_type = A1TC_REFERENCE; - (yyval.a_expr)->meta_type = AMT_TYPEREF; - } - break; - - case 67: -#line 812 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(3) - (3)].a_expr); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - assert((yyval.a_expr)->expr_type); - assert((yyval.a_expr)->meta_type); - } - break; - - case 68: -#line 818 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(3) - (3)].a_expr); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - assert((yyval.a_expr)->expr_type == A1TC_CLASSDEF); - assert((yyval.a_expr)->meta_type == AMT_OBJECTCLASS); - } - break; - - case 69: -#line 834 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(6) - (6)].a_expr); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (6)].tv_str); - (yyval.a_expr)->lhs_params = (yyvsp[(3) - (6)].a_plist); - } - break; - - case 70: -#line 840 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(6) - (6)].a_expr); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (6)].tv_str); - (yyval.a_expr)->lhs_params = (yyvsp[(3) - (6)].a_plist); - } - break; - - case 71: -#line 848 "asn1p_y.y" - { - int ret; - (yyval.a_plist) = asn1p_paramlist_new(yylineno); - checkmem((yyval.a_plist)); - ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(1) - (1)].a_parg).governor, (yyvsp[(1) - (1)].a_parg).argument); - checkmem(ret == 0); - if((yyvsp[(1) - (1)].a_parg).governor) asn1p_ref_free((yyvsp[(1) - (1)].a_parg).governor); - if((yyvsp[(1) - (1)].a_parg).argument) free((yyvsp[(1) - (1)].a_parg).argument); - } - break; - - case 72: -#line 857 "asn1p_y.y" - { - int ret; - (yyval.a_plist) = (yyvsp[(1) - (3)].a_plist); - ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(3) - (3)].a_parg).governor, (yyvsp[(3) - (3)].a_parg).argument); - checkmem(ret == 0); - if((yyvsp[(3) - (3)].a_parg).governor) asn1p_ref_free((yyvsp[(3) - (3)].a_parg).governor); - if((yyvsp[(3) - (3)].a_parg).argument) free((yyvsp[(3) - (3)].a_parg).argument); - } - break; - - case 73: -#line 868 "asn1p_y.y" - { - (yyval.a_parg).governor = NULL; - (yyval.a_parg).argument = (yyvsp[(1) - (1)].tv_str); - } - break; - - case 74: -#line 872 "asn1p_y.y" - { - int ret; - (yyval.a_parg).governor = asn1p_ref_new(yylineno); - ret = asn1p_ref_add_component((yyval.a_parg).governor, (yyvsp[(1) - (3)].tv_str), 0); - checkmem(ret == 0); - (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str); - } - break; - - case 75: -#line 879 "asn1p_y.y" - { - int ret; - (yyval.a_parg).governor = asn1p_ref_new(yylineno); - ret = asn1p_ref_add_component((yyval.a_parg).governor, (yyvsp[(1) - (3)].tv_str), 0); - checkmem(ret == 0); - (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str); - } - break; - - case 76: -#line 886 "asn1p_y.y" - { - int ret; - (yyval.a_parg).governor = asn1p_ref_new(yylineno); - ret = asn1p_ref_add_component((yyval.a_parg).governor, - ASN_EXPR_TYPE2STR((yyvsp[(1) - (3)].a_type)), 1); - checkmem(ret == 0); - (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str); - } - break; - - case 77: -#line 894 "asn1p_y.y" - { - int ret; - (yyval.a_parg).governor = asn1p_ref_new(yylineno); - ret = asn1p_ref_add_component((yyval.a_parg).governor, - ASN_EXPR_TYPE2STR((yyvsp[(1) - (3)].a_type)), 1); - checkmem(ret == 0); - (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str); - } - break; - - case 78: -#line 905 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); - } - break; - - case 79: -#line 910 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); - asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); - } - break; - - case 80: -#line 917 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); - } - break; - - case 81: -#line 920 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = "?"; - (yyval.a_expr)->expr_type = A1TC_REFERENCE; - (yyval.a_expr)->meta_type = AMT_VALUE; - (yyval.a_expr)->value = (yyvsp[(1) - (1)].a_value); - } - break; - - case 82: -#line 928 "asn1p_y.y" - { - asn1p_ref_t *ref; - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); - (yyval.a_expr)->expr_type = A1TC_REFERENCE; - (yyval.a_expr)->meta_type = AMT_VALUE; - ref = asn1p_ref_new(yylineno); - asn1p_ref_add_component(ref, (yyvsp[(1) - (1)].tv_str), RLT_lowercase); - (yyval.a_expr)->value = asn1p_value_fromref(ref, 0); - } - break; - - case 83: -#line 939 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - (yyval.a_expr)->expr_type = A1TC_VALUESET; - (yyval.a_expr)->meta_type = AMT_VALUESET; - (yyval.a_expr)->constraints = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 84: -#line 962 "asn1p_y.y" - { (yyval.a_expr) = NEW_EXPR(); } - break; - - case 85: -#line 963 "asn1p_y.y" - { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } - break; - - case 86: -#line 966 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); - } - break; - - case 87: -#line 971 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); - asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); - } - break; - - case 88: -#line 975 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (5)].a_expr); - asn1p_expr_add_many((yyval.a_expr), (yyvsp[(4) - (5)].a_expr)); - } - break; - - case 89: -#line 982 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr); - assert((yyval.a_expr)->Identifier == 0); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - (yyvsp[(3) - (3)].a_marker).flags |= (yyval.a_expr)->marker.flags; - (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); - } - break; - - case 90: -#line 989 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (2)].a_expr); - (yyvsp[(2) - (2)].a_marker).flags |= (yyval.a_expr)->marker.flags; - (yyval.a_expr)->marker = (yyvsp[(2) - (2)].a_marker); - _fixup_anonymous_identifier((yyval.a_expr)); - } - break; - - case 91: -#line 995 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->meta_type = (yyvsp[(3) - (3)].a_expr)->meta_type; - (yyval.a_expr)->expr_type = A1TC_COMPONENTS_OF; - asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); - } - break; - - case 92: -#line 1002 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); - } - break; - - case 93: -#line 1008 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); - } - break; - - case 94: -#line 1013 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); - asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); - } - break; - - case 95: -#line 1020 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr); - assert((yyval.a_expr)->Identifier == 0); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (2)].tv_str); - } - break; - - case 96: -#line 1025 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); - } - break; - - case 97: -#line 1028 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); - _fixup_anonymous_identifier((yyval.a_expr)); - } - break; - - case 98: -#line 1035 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(3) - (5)].a_expr); - checkmem((yyval.a_expr)); - (yyval.a_expr)->with_syntax = (yyvsp[(5) - (5)].a_wsynt); - assert((yyval.a_expr)->expr_type == A1TC_CLASSDEF); - assert((yyval.a_expr)->meta_type == AMT_OBJECTCLASS); - } - break; - - case 99: -#line 1045 "asn1p_y.y" - { (yyval.a_int) = 0; } - break; - - case 100: -#line 1046 "asn1p_y.y" - { (yyval.a_int) = 1; } - break; - - case 101: -#line 1050 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->expr_type = A1TC_CLASSDEF; - (yyval.a_expr)->meta_type = AMT_OBJECTCLASS; - asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); - } - break; - - case 102: -#line 1057 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); - asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); - } - break; - - case 103: -#line 1067 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (2)].tv_str); - (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; - (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_TFS; /* TypeFieldSpec */ - (yyval.a_expr)->marker = (yyvsp[(2) - (2)].a_marker); - } - break; - - case 104: -#line 1077 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); - (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; - (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_FTVFS; /* FixedTypeValueFieldSpec */ - (yyval.a_expr)->unique = (yyvsp[(3) - (4)].a_int); - (yyval.a_expr)->marker = (yyvsp[(4) - (4)].a_marker); - asn1p_expr_add((yyval.a_expr), (yyvsp[(2) - (4)].a_expr)); - } - break; - - case 105: -#line 1088 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; - (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_VTVFS; - (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref); - (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); - } - break; - - case 106: -#line 1098 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref); - (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; - (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_OFS; - (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); - } - break; - - case 107: -#line 1109 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; - (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_VTVSFS; - (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref); - (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); - } - break; - - case 108: -#line 1119 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; - (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_FTVSFS; - asn1p_expr_add((yyval.a_expr), (yyvsp[(2) - (3)].a_expr)); - (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); - } - break; - - case 109: -#line 1130 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); - (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref); - (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; - (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_OSFS; - (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); - } - break; - - case 110: -#line 1142 "asn1p_y.y" - { (yyval.a_wsynt) = 0; } - break; - - case 111: -#line 1143 "asn1p_y.y" - { - (yyval.a_wsynt) = (yyvsp[(1) - (1)].a_wsynt); - } - break; - - case 112: -#line 1150 "asn1p_y.y" - { asn1p_lexer_hack_enable_with_syntax(); } - break; - - case 113: -#line 1152 "asn1p_y.y" - { - (yyval.a_wsynt) = (yyvsp[(5) - (6)].a_wsynt); - } - break; - - case 114: -#line 1158 "asn1p_y.y" - { - (yyval.a_wsynt) = asn1p_wsyntx_new(); - TQ_ADD(&((yyval.a_wsynt)->chunks), (yyvsp[(1) - (1)].a_wchunk), next); - } - break; - - case 115: -#line 1162 "asn1p_y.y" - { - (yyval.a_wsynt) = (yyvsp[(1) - (2)].a_wsynt); - TQ_ADD(&((yyval.a_wsynt)->chunks), (yyvsp[(2) - (2)].a_wchunk), next); - } - break; - - case 116: -#line 1169 "asn1p_y.y" - { - (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].tv_opaque).buf, 0); - (yyval.a_wchunk)->type = WC_WHITESPACE; - } - break; - - case 117: -#line 1173 "asn1p_y.y" - { - (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].tv_str), 0); - } - break; - - case 118: -#line 1176 "asn1p_y.y" - { - (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].a_refcomp).name, 0); - (yyval.a_wchunk)->type = WC_FIELD; - } - break; - - case 119: -#line 1180 "asn1p_y.y" - { - (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromsyntax((yyvsp[(2) - (3)].a_wsynt)); - } - break; - - case 120: -#line 1186 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = strdup("..."); - checkmem((yyval.a_expr)->Identifier); - (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE; - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 121: -#line 1194 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = strdup("..."); - checkmem((yyval.a_expr)->Identifier); - (yyval.a_expr)->value = (yyvsp[(3) - (3)].a_value); - (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE; - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 122: -#line 1203 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = strdup("..."); - (yyval.a_expr)->value = (yyvsp[(3) - (3)].a_value); - checkmem((yyval.a_expr)->Identifier); - (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE; - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 123: -#line 1215 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr); - (yyval.a_expr)->tag = (yyvsp[(1) - (3)].a_tag); - /* - * Outer constraint for SEQUENCE OF and SET OF applies - * to the inner type. - */ - if((yyval.a_expr)->expr_type == ASN_CONSTR_SEQUENCE_OF - || (yyval.a_expr)->expr_type == ASN_CONSTR_SET_OF) { - assert(!TQ_FIRST(&((yyval.a_expr)->members))->constraints); - TQ_FIRST(&((yyval.a_expr)->members))->constraints = (yyvsp[(3) - (3)].a_constr); - } else { - if((yyval.a_expr)->constraints) { - assert(!(yyvsp[(2) - (3)].a_expr)); - } else { - (yyval.a_expr)->constraints = (yyvsp[(3) - (3)].a_constr); - } - } - } - break; - - case 124: -#line 1237 "asn1p_y.y" - { - (yyval.a_int) = asn1p_as_pointer ? EM_INDIRECT : 0; - asn1p_as_pointer = 0; - } - break; - - case 125: -#line 1244 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr); - (yyval.a_expr)->marker.flags |= (yyvsp[(1) - (2)].a_int); - - if(((yyval.a_expr)->marker.flags & EM_INDIRECT) - && ((yyval.a_expr)->marker.flags & EM_OPTIONAL) != EM_OPTIONAL) { - fprintf(stderr, - "INFO: Directive " - "applied to %s at line %d\n", - ASN_EXPR_TYPE2STR((yyval.a_expr)->expr_type) - ? ASN_EXPR_TYPE2STR((yyval.a_expr)->expr_type) - : "member", - (yyval.a_expr)->_lineno - ); - } - } - break; - - case 126: -#line 1263 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); - } - break; - - case 127: -#line 1266 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr); - assert((yyval.a_expr)->expr_type == A1TC_INVALID); - (yyval.a_expr)->expr_type = ASN_CONSTR_CHOICE; - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 128: -#line 1272 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr); - assert((yyval.a_expr)->expr_type == A1TC_INVALID); - (yyval.a_expr)->expr_type = ASN_CONSTR_SEQUENCE; - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 129: -#line 1278 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr); - assert((yyval.a_expr)->expr_type == A1TC_INVALID); - (yyval.a_expr)->expr_type = ASN_CONSTR_SET; - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 130: -#line 1284 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->constraints = (yyvsp[(2) - (6)].a_constr); - (yyval.a_expr)->expr_type = ASN_CONSTR_SEQUENCE_OF; - (yyval.a_expr)->meta_type = AMT_TYPE; - (yyvsp[(6) - (6)].a_expr)->Identifier = (yyvsp[(4) - (6)].tv_str); - (yyvsp[(6) - (6)].a_expr)->tag = (yyvsp[(5) - (6)].a_tag); - asn1p_expr_add((yyval.a_expr), (yyvsp[(6) - (6)].a_expr)); - } - break; - - case 131: -#line 1294 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->constraints = (yyvsp[(2) - (6)].a_constr); - (yyval.a_expr)->expr_type = ASN_CONSTR_SET_OF; - (yyval.a_expr)->meta_type = AMT_TYPE; - (yyvsp[(6) - (6)].a_expr)->Identifier = (yyvsp[(4) - (6)].tv_str); - (yyvsp[(6) - (6)].a_expr)->tag = (yyvsp[(5) - (6)].a_tag); - asn1p_expr_add((yyval.a_expr), (yyvsp[(6) - (6)].a_expr)); - } - break; - - case 132: -#line 1304 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->expr_type = ASN_TYPE_ANY; - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 133: -#line 1310 "asn1p_y.y" - { - int ret; - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->reference = asn1p_ref_new(yylineno); - ret = asn1p_ref_add_component((yyval.a_expr)->reference, - (yyvsp[(4) - (4)].tv_str), RLT_lowercase); - checkmem(ret == 0); - (yyval.a_expr)->expr_type = ASN_TYPE_ANY; - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 134: -#line 1321 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->reference = (yyvsp[(3) - (3)].a_ref); - (yyval.a_expr)->expr_type = A1TC_INSTANCE; - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 135: -#line 1336 "asn1p_y.y" - { - int ret; - (yyval.a_ref) = asn1p_ref_new(yylineno); - checkmem((yyval.a_ref)); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_UNKNOWN); - checkmem(ret == 0); - free((yyvsp[(1) - (1)].tv_str)); - } - break; - - case 136: -#line 1344 "asn1p_y.y" - { - int ret; - (yyval.a_ref) = asn1p_ref_new(yylineno); - checkmem((yyval.a_ref)); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN); - checkmem(ret == 0); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_UNKNOWN); - checkmem(ret == 0); - free((yyvsp[(1) - (3)].tv_str)); - } - break; - - case 137: -#line 1354 "asn1p_y.y" - { - int ret; - (yyval.a_ref) = asn1p_ref_new(yylineno); - checkmem((yyval.a_ref)); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN); - checkmem(ret == 0); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_UNKNOWN); - checkmem(ret == 0); - free((yyvsp[(1) - (3)].tv_str)); - } - break; - - case 138: -#line 1364 "asn1p_y.y" - { - int ret; - (yyval.a_ref) = asn1p_ref_new(yylineno); - checkmem((yyval.a_ref)); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN); - checkmem(ret == 0); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_lowercase); - checkmem(ret == 0); - free((yyvsp[(1) - (3)].tv_str)); - } - break; - - case 139: -#line 1374 "asn1p_y.y" - { - int ret; - (yyval.a_ref) = asn1p_ref_new(yylineno); - checkmem((yyval.a_ref)); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_CAPITALS); - free((yyvsp[(1) - (1)].tv_str)); - checkmem(ret == 0); - } - break; - - case 140: -#line 1382 "asn1p_y.y" - { - int ret; - (yyval.a_ref) = (yyvsp[(3) - (3)].a_ref); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_CAPITALS); - free((yyvsp[(1) - (3)].tv_str)); - checkmem(ret == 0); - /* - * Move the last element infront. - */ - { - struct asn1p_ref_component_s tmp_comp; - tmp_comp = (yyval.a_ref)->components[(yyval.a_ref)->comp_count-1]; - memmove(&(yyval.a_ref)->components[1], - &(yyval.a_ref)->components[0], - sizeof((yyval.a_ref)->components[0]) - * ((yyval.a_ref)->comp_count - 1)); - (yyval.a_ref)->components[0] = tmp_comp; - } - } - break; - - case 141: -#line 1404 "asn1p_y.y" - { - int ret; - (yyval.a_ref) = asn1p_ref_new(yylineno); - checkmem((yyval.a_ref)); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].a_refcomp).name, (yyvsp[(1) - (1)].a_refcomp).lex_type); - free((yyvsp[(1) - (1)].a_refcomp).name); - checkmem(ret == 0); - } - break; - - case 142: -#line 1412 "asn1p_y.y" - { - int ret; - (yyval.a_ref) = (yyvsp[(1) - (3)].a_ref); - ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].a_refcomp).name, (yyvsp[(3) - (3)].a_refcomp).lex_type); - free((yyvsp[(3) - (3)].a_refcomp).name); - checkmem(ret == 0); - } - break; - - case 144: -#line 1425 "asn1p_y.y" - { - (yyval.a_refcomp).lex_type = RLT_AmpUppercase; - (yyval.a_refcomp).name = (yyvsp[(1) - (1)].tv_str); - } - break; - - case 145: -#line 1430 "asn1p_y.y" - { - (yyval.a_refcomp).lex_type = RLT_Amplowercase; - (yyval.a_refcomp).name = (yyvsp[(1) - (1)].tv_str); - } - break; - - case 146: -#line 1439 "asn1p_y.y" - { - (yyval.a_ref) = asn1p_ref_new(yylineno); - asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_AmpUppercase); - } - break; - - case 147: -#line 1443 "asn1p_y.y" - { - (yyval.a_ref) = (yyval.a_ref); - asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_AmpUppercase); - } - break; - - case 148: -#line 1447 "asn1p_y.y" - { - (yyval.a_ref) = (yyval.a_ref); - asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_Amplowercase); - } - break; - - case 149: -#line 1454 "asn1p_y.y" - { - (yyval.a_ref) = asn1p_ref_new(yylineno); - asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_CAPITALS); - } - break; - - case 150: -#line 1474 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(2) - (4)].a_expr); - assert((yyval.a_expr)->Identifier == NULL); - (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); - (yyval.a_expr)->meta_type = AMT_VALUE; - (yyval.a_expr)->value = (yyvsp[(4) - (4)].a_value); - } - break; - - case 153: -#line 1486 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint(0); - checkmem((yyval.a_value)); - (yyval.a_value)->type = ATV_CHOICE_IDENTIFIER; - (yyval.a_value)->value.choice_identifier.identifier = (yyvsp[(1) - (3)].tv_str); - (yyval.a_value)->value.choice_identifier.value = (yyvsp[(3) - (3)].a_value); - } - break; - - case 154: -#line 1493 "asn1p_y.y" - { asn1p_lexer_hack_push_opaque_state(); } - break; - - case 155: -#line 1493 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_frombuf((yyvsp[(3) - (3)].tv_opaque).buf, (yyvsp[(3) - (3)].tv_opaque).len, 0); - checkmem((yyval.a_value)); - (yyval.a_value)->type = ATV_UNPARSED; - } - break; - - case 156: -#line 1498 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint(0); - checkmem((yyval.a_value)); - (yyval.a_value)->type = ATV_NULL; - } - break; - - case 157: -#line 1506 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint(0); - checkmem((yyval.a_value)); - (yyval.a_value)->type = ATV_FALSE; - } - break; - - case 158: -#line 1511 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint(0); - checkmem((yyval.a_value)); - (yyval.a_value)->type = ATV_TRUE; - } - break; - - case 159: -#line 1516 "asn1p_y.y" - { - (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'B'); - checkmem((yyval.a_value)); - } - break; - - case 160: -#line 1520 "asn1p_y.y" - { - (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'H'); - checkmem((yyval.a_value)); - } - break; - - case 161: -#line 1524 "asn1p_y.y" - { - (yyval.a_value) = (yyval.a_value); - } - break; - - case 162: -#line 1527 "asn1p_y.y" - { - (yyval.a_value) = (yyvsp[(1) - (1)].a_value); - } - break; - - case 163: -#line 1533 "asn1p_y.y" - { - asn1p_ref_t *ref; - int ret; - ref = asn1p_ref_new(yylineno); - checkmem(ref); - ret = asn1p_ref_add_component(ref, (yyvsp[(1) - (1)].tv_str), RLT_lowercase); - checkmem(ret == 0); - (yyval.a_value) = asn1p_value_fromref(ref, 0); - checkmem((yyval.a_value)); - free((yyvsp[(1) - (1)].tv_str)); - } - break; - - case 164: -#line 1544 "asn1p_y.y" - { - asn1p_ref_t *ref; - int ret; - ref = asn1p_ref_new(yylineno); - checkmem(ref); - ret = asn1p_ref_add_component(ref, (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN); - checkmem(ret == 0); - ret = asn1p_ref_add_component(ref, (yyvsp[(3) - (3)].tv_str), RLT_lowercase); - checkmem(ret == 0); - (yyval.a_value) = asn1p_value_fromref(ref, 0); - checkmem((yyval.a_value)); - free((yyvsp[(1) - (3)].tv_str)); - free((yyvsp[(3) - (3)].tv_str)); - } - break; - - case 165: -#line 1562 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_frombuf((yyvsp[(1) - (1)].tv_opaque).buf, (yyvsp[(1) - (1)].tv_opaque).len, 0); - checkmem((yyval.a_value)); - } - break; - - case 166: -#line 1566 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); - checkmem((yyval.a_value)); - (yyval.a_value)->type = ATV_TUPLE; - } - break; - - case 167: -#line 1571 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); - checkmem((yyval.a_value)); - (yyval.a_value)->type = ATV_QUADRUPLE; - } - break; - - case 168: -#line 1579 "asn1p_y.y" - { - (yyval.tv_opaque).len = (yyvsp[(1) - (1)].tv_opaque).len + 1; - (yyval.tv_opaque).buf = malloc((yyval.tv_opaque).len + 1); - checkmem((yyval.tv_opaque).buf); - (yyval.tv_opaque).buf[0] = '{'; - memcpy((yyval.tv_opaque).buf + 1, (yyvsp[(1) - (1)].tv_opaque).buf, (yyvsp[(1) - (1)].tv_opaque).len); - (yyval.tv_opaque).buf[(yyval.tv_opaque).len] = '\0'; - free((yyvsp[(1) - (1)].tv_opaque).buf); - } - break; - - case 169: -#line 1588 "asn1p_y.y" - { - int newsize = (yyvsp[(1) - (2)].tv_opaque).len + (yyvsp[(2) - (2)].tv_opaque).len; - char *p = malloc(newsize + 1); - checkmem(p); - memcpy(p , (yyvsp[(1) - (2)].tv_opaque).buf, (yyvsp[(1) - (2)].tv_opaque).len); - memcpy(p + (yyvsp[(1) - (2)].tv_opaque).len, (yyvsp[(2) - (2)].tv_opaque).buf, (yyvsp[(2) - (2)].tv_opaque).len); - p[newsize] = '\0'; - free((yyvsp[(1) - (2)].tv_opaque).buf); - free((yyvsp[(2) - (2)].tv_opaque).buf); - (yyval.tv_opaque).buf = p; - (yyval.tv_opaque).len = newsize; - } - break; - - case 170: -#line 1603 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_BOOLEAN; } - break; - - case 171: -#line 1604 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_NULL; } - break; - - case 172: -#line 1605 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_REAL; } - break; - - case 173: -#line 1606 "asn1p_y.y" - { (yyval.a_type) = (yyvsp[(1) - (1)].a_type); } - break; - - case 174: -#line 1607 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_OCTET_STRING; } - break; - - case 175: -#line 1608 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_OBJECT_IDENTIFIER; } - break; - - case 176: -#line 1609 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_RELATIVE_OID; } - break; - - case 177: -#line 1610 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_EXTERNAL; } - break; - - case 178: -#line 1611 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_EMBEDDED_PDV; } - break; - - case 179: -#line 1612 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_CHARACTER_STRING; } - break; - - case 180: -#line 1613 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_UTCTime; } - break; - - case 181: -#line 1614 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_GeneralizedTime; } - break; - - case 182: -#line 1615 "asn1p_y.y" - { (yyval.a_type) = (yyvsp[(1) - (1)].a_type); } - break; - - case 183: -#line 1622 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_INTEGER; } - break; - - case 184: -#line 1623 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_ENUMERATED; } - break; - - case 185: -#line 1624 "asn1p_y.y" - { (yyval.a_type) = ASN_BASIC_BIT_STRING; } - break; - - case 186: -#line 1628 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->expr_type = (yyvsp[(1) - (1)].a_type); - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 187: -#line 1634 "asn1p_y.y" - { - if((yyvsp[(2) - (2)].a_expr)) { - (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr); - } else { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - } - (yyval.a_expr)->expr_type = (yyvsp[(1) - (2)].a_type); - (yyval.a_expr)->meta_type = AMT_TYPE; - } - break; - - case 188: -#line 1647 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_BMPString; } - break; - - case 189: -#line 1648 "asn1p_y.y" - { - (yyval.a_type) = ASN_STRING_GeneralString; - fprintf(stderr, "WARNING: GeneralString is not fully supported\n"); - } - break; - - case 190: -#line 1652 "asn1p_y.y" - { - (yyval.a_type) = ASN_STRING_GraphicString; - fprintf(stderr, "WARNING: GraphicString is not fully supported\n"); - } - break; - - case 191: -#line 1656 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_IA5String; } - break; - - case 192: -#line 1657 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_ISO646String; } - break; - - case 193: -#line 1658 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_NumericString; } - break; - - case 194: -#line 1659 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_PrintableString; } - break; - - case 195: -#line 1660 "asn1p_y.y" - { - (yyval.a_type) = ASN_STRING_T61String; - fprintf(stderr, "WARNING: T61String is not fully supported\n"); - } - break; - - case 196: -#line 1664 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_TeletexString; } - break; - - case 197: -#line 1665 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_UniversalString; } - break; - - case 198: -#line 1666 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_UTF8String; } - break; - - case 199: -#line 1667 "asn1p_y.y" - { - (yyval.a_type) = ASN_STRING_VideotexString; - fprintf(stderr, "WARNING: VideotexString is not fully supported\n"); - } - break; - - case 200: -#line 1671 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_VisibleString; } - break; - - case 201: -#line 1672 "asn1p_y.y" - { (yyval.a_type) = ASN_STRING_ObjectDescriptor; } - break; - - case 206: -#line 1683 "asn1p_y.y" - { (yyval.a_constr) = 0; } - break; - - case 207: -#line 1684 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 209: -#line 1694 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_SET, (yyvsp[(1) - (1)].a_constr), 0); - } - break; - - case 210: -#line 1697 "asn1p_y.y" - { - /* - * This is a special case, for compatibility purposes. - * It goes without parentheses. - */ - CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_SIZE, (yyvsp[(3) - (4)].a_constr), 0); - } - break; - - case 211: -#line 1707 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(2) - (3)].a_constr); - } - break; - - case 212: -#line 1710 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_SET, (yyvsp[(1) - (4)].a_constr), (yyvsp[(3) - (4)].a_constr)); - } - break; - - case 213: -#line 1716 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 214: -#line 1719 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 215: -#line 1725 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - (yyval.a_constr)->type = ACT_EL_EXT; - } - break; - - case 216: -#line 1729 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 217: -#line 1732 "asn1p_y.y" - { - asn1p_constraint_t *ct; - ct = asn1p_constraint_new(yylineno); - ct->type = ACT_EL_EXT; - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, (yyvsp[(1) - (3)].a_constr), ct); - } - break; - - case 218: -#line 1738 "asn1p_y.y" - { - asn1p_constraint_t *ct; - ct = asn1p_constraint_new(yylineno); - ct->type = ACT_EL_EXT; - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, (yyvsp[(1) - (5)].a_constr), ct); - ct = (yyval.a_constr); - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, ct, (yyvsp[(5) - (5)].a_constr)); - } - break; - - case 220: -#line 1750 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_AEX, (yyvsp[(3) - (3)].a_constr), 0); - } - break; - - case 222: -#line 1757 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_UNI, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); - } - break; - - case 224: -#line 1764 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_INT, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); - } - break; - - case 226: -#line 1772 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_EXC, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); - } - break; - - case 227: -#line 1778 "asn1p_y.y" - { - int ret; - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = (yyvsp[(1) - (4)].a_ctype); - ret = asn1p_constraint_insert((yyval.a_constr), (yyvsp[(3) - (4)].a_constr)); - checkmem(ret == 0); - } - break; - - case 228: -#line 1786 "asn1p_y.y" - { - int ret; - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = ACT_CA_SET; - ret = asn1p_constraint_insert((yyval.a_constr), (yyvsp[(2) - (3)].a_constr)); - checkmem(ret == 0); - } - break; - - case 229: -#line 1794 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = ACT_EL_VALUE; - (yyval.a_constr)->value = (yyvsp[(1) - (1)].a_value); - } - break; - - case 230: -#line 1800 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = ACT_EL_TYPE; - (yyval.a_constr)->containedSubtype = (yyvsp[(1) - (1)].a_value); - } - break; - - case 231: -#line 1806 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = (yyvsp[(2) - (3)].a_ctype); - (yyval.a_constr)->range_start = (yyvsp[(1) - (3)].a_value); - (yyval.a_constr)->range_stop = (yyvsp[(3) - (3)].a_value); - } - break; - - case 232: -#line 1813 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = (yyvsp[(2) - (3)].a_ctype); - (yyval.a_constr)->range_start = asn1p_value_fromint(-123); - (yyval.a_constr)->range_stop = (yyvsp[(3) - (3)].a_value); - (yyval.a_constr)->range_start->type = ATV_MIN; - } - break; - - case 233: -#line 1821 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = (yyvsp[(2) - (3)].a_ctype); - (yyval.a_constr)->range_start = (yyvsp[(1) - (3)].a_value); - (yyval.a_constr)->range_stop = asn1p_value_fromint(321); - (yyval.a_constr)->range_stop->type = ATV_MAX; - } - break; - - case 234: -#line 1829 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = (yyvsp[(2) - (3)].a_ctype); - (yyval.a_constr)->range_start = asn1p_value_fromint(-123); - (yyval.a_constr)->range_stop = asn1p_value_fromint(321); - (yyval.a_constr)->range_start->type = ATV_MIN; - (yyval.a_constr)->range_stop->type = ATV_MAX; - } - break; - - case 235: -#line 1838 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 236: -#line 1841 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 237: -#line 1844 "asn1p_y.y" - { asn1p_lexer_hack_push_opaque_state(); } - break; - - case 238: -#line 1844 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = ACT_EL_VALUE; - (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(3) - (3)].tv_opaque).buf, (yyvsp[(3) - (3)].tv_opaque).len, 0); - (yyval.a_constr)->value->type = ATV_UNPARSED; - } - break; - - case 239: -#line 1854 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - (yyval.a_constr)->type = ACT_CT_PATTERN; - (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(2) - (2)].tv_opaque).buf, (yyvsp[(2) - (2)].tv_opaque).len, 0); - } - break; - - case 240: -#line 1859 "asn1p_y.y" - { - asn1p_ref_t *ref; - (yyval.a_constr) = asn1p_constraint_new(yylineno); - (yyval.a_constr)->type = ACT_CT_PATTERN; - ref = asn1p_ref_new(yylineno); - asn1p_ref_add_component(ref, (yyvsp[(2) - (2)].tv_str), RLT_lowercase); - (yyval.a_constr)->value = asn1p_value_fromref(ref, 0); - } - break; - - case 241: -#line 1870 "asn1p_y.y" - { - (yyval.a_ctype) = ACT_CT_SIZE; - } - break; - - case 242: -#line 1873 "asn1p_y.y" - { - (yyval.a_ctype) = ACT_CT_FROM; - } - break; - - case 243: -#line 1879 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint(0); - checkmem((yyval.a_value)); - (yyval.a_value)->type = ATV_FALSE; - } - break; - - case 244: -#line 1884 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint(1); - checkmem((yyval.a_value)); - (yyval.a_value)->type = ATV_TRUE; - } - break; - - case 248: -#line 1892 "asn1p_y.y" - { - asn1p_ref_t *ref; - int ret; - ref = asn1p_ref_new(yylineno); - checkmem(ref); - ret = asn1p_ref_add_component(ref, (yyvsp[(1) - (1)].tv_str), RLT_lowercase); - checkmem(ret == 0); - (yyval.a_value) = asn1p_value_fromref(ref, 0); - checkmem((yyval.a_value)); - free((yyvsp[(1) - (1)].tv_str)); - } - break; - - case 249: -#line 1906 "asn1p_y.y" - { - (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'B'); - checkmem((yyval.a_value)); - } - break; - - case 250: -#line 1910 "asn1p_y.y" - { - (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'H'); - checkmem((yyval.a_value)); - } - break; - - case 251: -#line 1917 "asn1p_y.y" - { - asn1p_ref_t *ref; - int ret; - ref = asn1p_ref_new(yylineno); - checkmem(ref); - ret = asn1p_ref_add_component(ref, (yyvsp[(1) - (1)].tv_str), RLT_UNKNOWN); - checkmem(ret == 0); - (yyval.a_value) = asn1p_value_fromref(ref, 0); - checkmem((yyval.a_value)); - free((yyvsp[(1) - (1)].tv_str)); - } - break; - - case 252: -#line 1931 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMP, (yyvsp[(3) - (3)].a_constr), 0); - } - break; - - case 253: -#line 1934 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMPS, (yyvsp[(4) - (5)].a_constr), 0); - } - break; - - case 254: -#line 1940 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 255: -#line 1943 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMPS, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); - } - break; - - case 256: -#line 1949 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = ACT_EL_EXT; - (yyval.a_constr)->value = asn1p_value_frombuf("...", 3, 1); - } - break; - - case 257: -#line 1955 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = ACT_EL_VALUE; - (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(1) - (3)].tv_str), strlen((yyvsp[(1) - (3)].tv_str)), 0); - (yyval.a_constr)->presence = (yyvsp[(3) - (3)].a_pres); - if((yyvsp[(2) - (3)].a_constr)) asn1p_constraint_insert((yyval.a_constr), (yyvsp[(2) - (3)].a_constr)); - } - break; - - case 258: -#line 1969 "asn1p_y.y" - { (yyval.a_pres) = ACPRES_DEFAULT; } - break; - - case 259: -#line 1970 "asn1p_y.y" - { (yyval.a_pres) = (yyvsp[(1) - (1)].a_pres); } - break; - - case 260: -#line 1974 "asn1p_y.y" - { - (yyval.a_pres) = ACPRES_PRESENT; - } - break; - - case 261: -#line 1977 "asn1p_y.y" - { - (yyval.a_pres) = ACPRES_ABSENT; - } - break; - - case 262: -#line 1980 "asn1p_y.y" - { - (yyval.a_pres) = ACPRES_OPTIONAL; - } - break; - - case 266: -#line 1995 "asn1p_y.y" - { asn1p_lexer_hack_push_opaque_state(); } - break; - - case 267: -#line 1995 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = ACT_CT_CTDBY; - (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(5) - (5)].tv_opaque).buf, (yyvsp[(5) - (5)].tv_opaque).len, 0); - checkmem((yyval.a_constr)->value); - (yyval.a_constr)->value->type = ATV_UNPARSED; - } - break; - - case 268: -#line 2006 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - (yyval.a_constr)->type = ACT_CT_CTNG; - (yyval.a_constr)->value = asn1p_value_fromtype((yyvsp[(2) - (2)].a_expr)); - } - break; - - case 269: -#line 2014 "asn1p_y.y" - { (yyval.a_ctype) = ACT_EL_RANGE; } - break; - - case 270: -#line 2015 "asn1p_y.y" - { (yyval.a_ctype) = ACT_EL_RLRANGE; } - break; - - case 271: -#line 2016 "asn1p_y.y" - { (yyval.a_ctype) = ACT_EL_LLRANGE; } - break; - - case 272: -#line 2017 "asn1p_y.y" - { (yyval.a_ctype) = ACT_EL_ULRANGE; } - break; - - case 273: -#line 2020 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 274: -#line 2023 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 275: -#line 2032 "asn1p_y.y" - { - asn1p_ref_t *ref = asn1p_ref_new(yylineno); - asn1p_constraint_t *ct; - int ret; - ret = asn1p_ref_add_component(ref, (yyvsp[(2) - (3)].tv_str), 0); - checkmem(ret == 0); - ct = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - ct->type = ACT_EL_VALUE; - ct->value = asn1p_value_fromref(ref, 0); - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CRC, ct, 0); - } - break; - - case 276: -#line 2047 "asn1p_y.y" - { - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CRC, (yyvsp[(1) - (4)].a_constr), (yyvsp[(3) - (4)].a_constr)); - } - break; - - case 277: -#line 2053 "asn1p_y.y" - { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - checkmem((yyval.a_constr)); - (yyval.a_constr)->type = ACT_EL_VALUE; - (yyval.a_constr)->value = asn1p_value_fromref((yyvsp[(1) - (1)].a_ref), 0); - } - break; - - case 278: -#line 2059 "asn1p_y.y" - { - asn1p_constraint_t *ct; - ct = asn1p_constraint_new(yylineno); - checkmem(ct); - ct->type = ACT_EL_VALUE; - ct->value = asn1p_value_fromref((yyvsp[(3) - (3)].a_ref), 0); - CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, (yyvsp[(1) - (3)].a_constr), ct); - } - break; - - case 279: -#line 2073 "asn1p_y.y" - { - char *p = malloc(strlen((yyvsp[(2) - (2)].tv_str)) + 2); - int ret; - *p = '@'; - strcpy(p + 1, (yyvsp[(2) - (2)].tv_str)); - (yyval.a_ref) = asn1p_ref_new(yylineno); - ret = asn1p_ref_add_component((yyval.a_ref), p, 0); - checkmem(ret == 0); - free(p); - free((yyvsp[(2) - (2)].tv_str)); - } - break; - - case 280: -#line 2084 "asn1p_y.y" - { - char *p = malloc(strlen((yyvsp[(3) - (3)].tv_str)) + 3); - int ret; - p[0] = '@'; - p[1] = '.'; - strcpy(p + 2, (yyvsp[(3) - (3)].tv_str)); - (yyval.a_ref) = asn1p_ref_new(yylineno); - ret = asn1p_ref_add_component((yyval.a_ref), p, 0); - checkmem(ret == 0); - free(p); - free((yyvsp[(3) - (3)].tv_str)); - } - break; - - case 281: -#line 2100 "asn1p_y.y" - { - (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); - } - break; - - case 282: -#line 2103 "asn1p_y.y" - { - int l1 = strlen((yyvsp[(1) - (3)].tv_str)); - int l3 = strlen((yyvsp[(3) - (3)].tv_str)); - (yyval.tv_str) = malloc(l1 + 1 + l3 + 1); - memcpy((yyval.tv_str), (yyvsp[(1) - (3)].tv_str), l1); - (yyval.tv_str)[l1] = '.'; - memcpy((yyval.tv_str) + l1 + 1, (yyvsp[(3) - (3)].tv_str), l3); - (yyval.tv_str)[l1 + 1 + l3] = '\0'; - } - break; - - case 283: -#line 2121 "asn1p_y.y" - { - (yyval.a_marker).flags = EM_NOMARK; - (yyval.a_marker).default_value = 0; - } - break; - - case 284: -#line 2125 "asn1p_y.y" - { (yyval.a_marker) = (yyvsp[(1) - (1)].a_marker); } - break; - - case 285: -#line 2129 "asn1p_y.y" - { - (yyval.a_marker).flags = EM_OPTIONAL | EM_INDIRECT; - (yyval.a_marker).default_value = 0; - } - break; - - case 286: -#line 2133 "asn1p_y.y" - { - (yyval.a_marker).flags = EM_DEFAULT; - (yyval.a_marker).default_value = (yyvsp[(2) - (2)].a_value); - } - break; - - case 287: -#line 2156 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - } - break; - - case 288: -#line 2160 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr); - } - break; - - case 289: -#line 2166 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); - } - break; - - case 290: -#line 2171 "asn1p_y.y" - { - (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); - asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); - } - break; - - case 291: -#line 2178 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->expr_type = A1TC_UNIVERVAL; - (yyval.a_expr)->meta_type = AMT_VALUE; - (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); - } - break; - - case 292: -#line 2185 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->expr_type = A1TC_UNIVERVAL; - (yyval.a_expr)->meta_type = AMT_VALUE; - (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); - (yyval.a_expr)->value = (yyvsp[(3) - (4)].a_value); - } - break; - - case 293: -#line 2193 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->expr_type = A1TC_UNIVERVAL; - (yyval.a_expr)->meta_type = AMT_VALUE; - (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); - (yyval.a_expr)->value = (yyvsp[(3) - (4)].a_value); - } - break; - - case 294: -#line 2201 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->expr_type = A1TC_UNIVERVAL; - (yyval.a_expr)->meta_type = AMT_VALUE; - (yyval.a_expr)->value = (yyvsp[(1) - (1)].a_value); - } - break; - - case 295: -#line 2208 "asn1p_y.y" - { - (yyval.a_expr) = NEW_EXPR(); - checkmem((yyval.a_expr)); - (yyval.a_expr)->Identifier = strdup("..."); - checkmem((yyval.a_expr)->Identifier); - (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE; - (yyval.a_expr)->meta_type = AMT_VALUE; - } - break; - - case 296: -#line 2219 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); - checkmem((yyval.a_value)); - } - break; - - case 297: -#line 2223 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); - checkmem((yyval.a_value)); - } - break; - - case 299: -#line 2231 "asn1p_y.y" - { - (yyval.a_value) = asn1p_value_fromdouble((yyvsp[(1) - (1)].a_dbl)); - checkmem((yyval.a_value)); - } - break; - - case 300: -#line 2262 "asn1p_y.y" - { memset(&(yyval.a_tag), 0, sizeof((yyval.a_tag))); } - break; - - case 301: -#line 2263 "asn1p_y.y" - { (yyval.a_tag) = (yyvsp[(1) - (1)].a_tag); } - break; - - case 302: -#line 2267 "asn1p_y.y" - { - (yyval.a_tag) = (yyvsp[(1) - (2)].a_tag); - (yyval.a_tag).tag_mode = (yyvsp[(2) - (2)].a_tag).tag_mode; - } - break; - - case 303: -#line 2274 "asn1p_y.y" - { - (yyval.a_tag) = (yyvsp[(2) - (4)].a_tag); - (yyval.a_tag).tag_value = (yyvsp[(3) - (4)].a_int); - } - break; - - case 304: -#line 2280 "asn1p_y.y" - { (yyval.a_tag).tag_class = TC_CONTEXT_SPECIFIC; } - break; - - case 305: -#line 2281 "asn1p_y.y" - { (yyval.a_tag).tag_class = TC_UNIVERSAL; } - break; - - case 306: -#line 2282 "asn1p_y.y" - { (yyval.a_tag).tag_class = TC_APPLICATION; } - break; - - case 307: -#line 2283 "asn1p_y.y" - { (yyval.a_tag).tag_class = TC_PRIVATE; } - break; - - case 308: -#line 2287 "asn1p_y.y" - { (yyval.a_tag).tag_mode = TM_DEFAULT; } - break; - - case 309: -#line 2288 "asn1p_y.y" - { (yyval.a_tag).tag_mode = TM_IMPLICIT; } - break; - - case 310: -#line 2289 "asn1p_y.y" - { (yyval.a_tag).tag_mode = TM_EXPLICIT; } - break; - - case 311: -#line 2293 "asn1p_y.y" - { - checkmem((yyvsp[(1) - (1)].tv_str)); - (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); - } - break; - - case 312: -#line 2297 "asn1p_y.y" - { - checkmem((yyvsp[(1) - (1)].tv_str)); - (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); - } - break; - - case 313: -#line 2305 "asn1p_y.y" - { - checkmem((yyvsp[(1) - (1)].tv_str)); - (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); - } - break; - - case 314: -#line 2312 "asn1p_y.y" - { (yyval.tv_str) = 0; } - break; - - case 315: -#line 2313 "asn1p_y.y" - { - (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); - } - break; - - case 316: -#line 2319 "asn1p_y.y" - { - checkmem((yyvsp[(1) - (1)].tv_str)); - (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); - } - break; - - -/* Line 1267 of yacc.c. */ -#line 4824 "y.tab.c" - default: break; - } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse look-ahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - if (yyn == YYFINAL) - YYACCEPT; - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - -#line 2325 "asn1p_y.y" - - - -/* - * Convert Xstring ('0101'B or '5'H) to the binary vector. - */ -static asn1p_value_t * -_convert_bitstring2binary(char *str, int base) { - asn1p_value_t *val; - int slen; - int memlen; - int baselen; - int bits; - uint8_t *binary_vector; - uint8_t *bv_ptr; - uint8_t cur_val; - - assert(str); - assert(str[0] == '\''); - - switch(base) { - case 'B': - baselen = 1; - break; - case 'H': - baselen = 4; - break; - default: - assert(base == 'B' || base == 'H'); - errno = EINVAL; - return NULL; - } - - slen = strlen(str); - assert(str[slen - 1] == base); - assert(str[slen - 2] == '\''); - - memlen = slen / (8 / baselen); /* Conservative estimate */ - - bv_ptr = binary_vector = malloc(memlen + 1); - if(bv_ptr == NULL) - /* ENOMEM */ - return NULL; - - cur_val = 0; - bits = 0; - while(*(++str) != '\'') { - switch(baselen) { - case 1: - switch(*str) { - case '1': - cur_val |= 1 << (7 - (bits % 8)); - case '0': - break; - default: - assert(!"_y UNREACH1"); - case ' ': case '\r': case '\n': - continue; - } - break; - case 4: - switch(*str) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - cur_val |= (*str - '0') << (4 - (bits % 8)); - break; - case 'A': case 'B': case 'C': - case 'D': case 'E': case 'F': - cur_val |= ((*str - 'A') + 10) - << (4 - (bits % 8)); - break; - default: - assert(!"_y UNREACH2"); - case ' ': case '\r': case '\n': - continue; - } - break; - } - - bits += baselen; - if((bits % 8) == 0) { - *bv_ptr++ = cur_val; - cur_val = 0; - } - } - - *bv_ptr = cur_val; - assert((bv_ptr - binary_vector) <= memlen); - - val = asn1p_value_frombits(binary_vector, bits, 0); - if(val == NULL) { - free(binary_vector); - } - - return val; -} - -/* - * For unnamed types (used in old X.208 compliant modules) - * generate some sort of interim names, to not to force human being to fix - * the specification's compliance to modern ASN.1 standards. - */ -static void -_fixup_anonymous_identifier(asn1p_expr_t *expr) { - char *p; - assert(expr->Identifier == 0); - - /* - * Try to figure out the type name - * without going too much into details - */ - expr->Identifier = ASN_EXPR_TYPE2STR(expr->expr_type); - if(expr->reference && expr->reference->comp_count > 0) - expr->Identifier = expr->reference->components[0].name; - - fprintf(stderr, - "WARNING: Line %d: expected lower-case member identifier, " - "found an unnamed %s.\n" - "WARNING: Obsolete X.208 syntax detected, " - "please give the member a name.\n", - yylineno, expr->Identifier ? expr->Identifier : "type"); - - if(!expr->Identifier) - expr->Identifier = "unnamed"; - expr->Identifier = strdup(expr->Identifier); - assert(expr->Identifier); - /* Make a lowercase identifier from the type name */ - for(p = expr->Identifier; *p; p++) { - switch(*p) { - case 'A' ... 'Z': *p += 32; break; - case ' ': *p = '_'; break; - case '-': *p = '_'; break; - } - } - fprintf(stderr, "NOTE: Assigning temporary identifier \"%s\". " - "Name clash may occur later.\n", - expr->Identifier); -} - -int -yyerror(const char *msg) { - extern char *asn1p_text; - fprintf(stderr, - "ASN.1 grammar parse error " - "near line %d (token \"%s\"): %s\n", - yylineno, asn1p_text, msg); - return -1; -} - - diff --git a/libasn1parser/asn1p_y.h b/libasn1parser/asn1p_y.h deleted file mode 100644 index 30c4ee87c..000000000 --- a/libasn1parser/asn1p_y.h +++ /dev/null @@ -1,305 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - 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 2, 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_PPEQ = 258, - TOK_VBracketLeft = 259, - TOK_VBracketRight = 260, - TOK_whitespace = 261, - TOK_opaque = 262, - TOK_bstring = 263, - TOK_cstring = 264, - TOK_hstring = 265, - TOK_identifier = 266, - TOK_number = 267, - TOK_number_negative = 268, - TOK_realnumber = 269, - TOK_tuple = 270, - TOK_quadruple = 271, - TOK_typereference = 272, - TOK_capitalreference = 273, - TOK_typefieldreference = 274, - TOK_valuefieldreference = 275, - TOK_Literal = 276, - TOK_ABSENT = 277, - TOK_ABSTRACT_SYNTAX = 278, - TOK_ALL = 279, - TOK_ANY = 280, - TOK_APPLICATION = 281, - TOK_AUTOMATIC = 282, - TOK_BEGIN = 283, - TOK_BIT = 284, - TOK_BMPString = 285, - TOK_BOOLEAN = 286, - TOK_BY = 287, - TOK_CHARACTER = 288, - TOK_CHOICE = 289, - TOK_CLASS = 290, - TOK_COMPONENT = 291, - TOK_COMPONENTS = 292, - TOK_CONSTRAINED = 293, - TOK_CONTAINING = 294, - TOK_DEFAULT = 295, - TOK_DEFINITIONS = 296, - TOK_DEFINED = 297, - TOK_EMBEDDED = 298, - TOK_ENCODED = 299, - TOK_ENCODING_CONTROL = 300, - TOK_END = 301, - TOK_ENUMERATED = 302, - TOK_EXPLICIT = 303, - TOK_EXPORTS = 304, - TOK_EXTENSIBILITY = 305, - TOK_EXTERNAL = 306, - TOK_FALSE = 307, - TOK_FROM = 308, - TOK_GeneralizedTime = 309, - TOK_GeneralString = 310, - TOK_GraphicString = 311, - TOK_IA5String = 312, - TOK_IDENTIFIER = 313, - TOK_IMPLICIT = 314, - TOK_IMPLIED = 315, - TOK_IMPORTS = 316, - TOK_INCLUDES = 317, - TOK_INSTANCE = 318, - TOK_INSTRUCTIONS = 319, - TOK_INTEGER = 320, - TOK_ISO646String = 321, - TOK_MAX = 322, - TOK_MIN = 323, - TOK_MINUS_INFINITY = 324, - TOK_NULL = 325, - TOK_NumericString = 326, - TOK_OBJECT = 327, - TOK_ObjectDescriptor = 328, - TOK_OCTET = 329, - TOK_OF = 330, - TOK_OPTIONAL = 331, - TOK_PATTERN = 332, - TOK_PDV = 333, - TOK_PLUS_INFINITY = 334, - TOK_PRESENT = 335, - TOK_PrintableString = 336, - TOK_PRIVATE = 337, - TOK_REAL = 338, - TOK_RELATIVE_OID = 339, - TOK_SEQUENCE = 340, - TOK_SET = 341, - TOK_SIZE = 342, - TOK_STRING = 343, - TOK_SYNTAX = 344, - TOK_T61String = 345, - TOK_TAGS = 346, - TOK_TeletexString = 347, - TOK_TRUE = 348, - TOK_TYPE_IDENTIFIER = 349, - TOK_UNIQUE = 350, - TOK_UNIVERSAL = 351, - TOK_UniversalString = 352, - TOK_UTCTime = 353, - TOK_UTF8String = 354, - TOK_VideotexString = 355, - TOK_VisibleString = 356, - TOK_WITH = 357, - TOK_EXCEPT = 358, - TOK_INTERSECTION = 359, - TOK_UNION = 360, - TOK_TwoDots = 361, - TOK_ThreeDots = 362 - }; -#endif -/* Tokens. */ -#define TOK_PPEQ 258 -#define TOK_VBracketLeft 259 -#define TOK_VBracketRight 260 -#define TOK_whitespace 261 -#define TOK_opaque 262 -#define TOK_bstring 263 -#define TOK_cstring 264 -#define TOK_hstring 265 -#define TOK_identifier 266 -#define TOK_number 267 -#define TOK_number_negative 268 -#define TOK_realnumber 269 -#define TOK_tuple 270 -#define TOK_quadruple 271 -#define TOK_typereference 272 -#define TOK_capitalreference 273 -#define TOK_typefieldreference 274 -#define TOK_valuefieldreference 275 -#define TOK_Literal 276 -#define TOK_ABSENT 277 -#define TOK_ABSTRACT_SYNTAX 278 -#define TOK_ALL 279 -#define TOK_ANY 280 -#define TOK_APPLICATION 281 -#define TOK_AUTOMATIC 282 -#define TOK_BEGIN 283 -#define TOK_BIT 284 -#define TOK_BMPString 285 -#define TOK_BOOLEAN 286 -#define TOK_BY 287 -#define TOK_CHARACTER 288 -#define TOK_CHOICE 289 -#define TOK_CLASS 290 -#define TOK_COMPONENT 291 -#define TOK_COMPONENTS 292 -#define TOK_CONSTRAINED 293 -#define TOK_CONTAINING 294 -#define TOK_DEFAULT 295 -#define TOK_DEFINITIONS 296 -#define TOK_DEFINED 297 -#define TOK_EMBEDDED 298 -#define TOK_ENCODED 299 -#define TOK_ENCODING_CONTROL 300 -#define TOK_END 301 -#define TOK_ENUMERATED 302 -#define TOK_EXPLICIT 303 -#define TOK_EXPORTS 304 -#define TOK_EXTENSIBILITY 305 -#define TOK_EXTERNAL 306 -#define TOK_FALSE 307 -#define TOK_FROM 308 -#define TOK_GeneralizedTime 309 -#define TOK_GeneralString 310 -#define TOK_GraphicString 311 -#define TOK_IA5String 312 -#define TOK_IDENTIFIER 313 -#define TOK_IMPLICIT 314 -#define TOK_IMPLIED 315 -#define TOK_IMPORTS 316 -#define TOK_INCLUDES 317 -#define TOK_INSTANCE 318 -#define TOK_INSTRUCTIONS 319 -#define TOK_INTEGER 320 -#define TOK_ISO646String 321 -#define TOK_MAX 322 -#define TOK_MIN 323 -#define TOK_MINUS_INFINITY 324 -#define TOK_NULL 325 -#define TOK_NumericString 326 -#define TOK_OBJECT 327 -#define TOK_ObjectDescriptor 328 -#define TOK_OCTET 329 -#define TOK_OF 330 -#define TOK_OPTIONAL 331 -#define TOK_PATTERN 332 -#define TOK_PDV 333 -#define TOK_PLUS_INFINITY 334 -#define TOK_PRESENT 335 -#define TOK_PrintableString 336 -#define TOK_PRIVATE 337 -#define TOK_REAL 338 -#define TOK_RELATIVE_OID 339 -#define TOK_SEQUENCE 340 -#define TOK_SET 341 -#define TOK_SIZE 342 -#define TOK_STRING 343 -#define TOK_SYNTAX 344 -#define TOK_T61String 345 -#define TOK_TAGS 346 -#define TOK_TeletexString 347 -#define TOK_TRUE 348 -#define TOK_TYPE_IDENTIFIER 349 -#define TOK_UNIQUE 350 -#define TOK_UNIVERSAL 351 -#define TOK_UniversalString 352 -#define TOK_UTCTime 353 -#define TOK_UTF8String 354 -#define TOK_VideotexString 355 -#define TOK_VisibleString 356 -#define TOK_WITH 357 -#define TOK_EXCEPT 358 -#define TOK_INTERSECTION 359 -#define TOK_UNION 360 -#define TOK_TwoDots 361 -#define TOK_ThreeDots 362 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 88 "asn1p_y.y" -{ - asn1p_t *a_grammar; - asn1p_module_flags_e a_module_flags; - asn1p_module_t *a_module; - asn1p_expr_type_e a_type; /* ASN.1 Type */ - asn1p_expr_t *a_expr; /* Constructed collection */ - asn1p_constraint_t *a_constr; /* Constraint */ - enum asn1p_constraint_type_e a_ctype;/* Constraint type */ - asn1p_xports_t *a_xports; /* IMports/EXports */ - struct AssignedIdentifier a_aid; /* Assigned Identifier */ - asn1p_oid_t *a_oid; /* Object Identifier */ - asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */ - struct asn1p_type_tag_s a_tag; /* A tag */ - asn1p_ref_t *a_ref; /* Reference to custom type */ - asn1p_wsyntx_t *a_wsynt; /* WITH SYNTAX contents */ - asn1p_wsyntx_chunk_t *a_wchunk; /* WITH SYNTAX chunk */ - struct asn1p_ref_component_s a_refcomp; /* Component of a reference */ - asn1p_value_t *a_value; /* Number, DefinedValue, etc */ - struct asn1p_param_s a_parg; /* A parameter argument */ - asn1p_paramlist_t *a_plist; /* A pargs list */ - struct asn1p_expr_marker_s a_marker; /* OPTIONAL/DEFAULT */ - enum asn1p_constr_pres_e a_pres; /* PRESENT/ABSENT/OPTIONAL */ - asn1c_integer_t a_int; - double a_dbl; - char *tv_str; - struct { - char *buf; - int len; - } tv_opaque; - struct { - char *name; - struct asn1p_type_tag_s tag; - } tv_nametag; -} -/* Line 1489 of yacc.c. */ -#line 298 "y.tab.h" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - -extern YYSTYPE asn1p_lval; - diff --git a/libasn1parser/asn1p_y.y b/libasn1parser/asn1p_y.y index b8465cb27..a5ea97f33 100644 --- a/libasn1parser/asn1p_y.y +++ b/libasn1parser/asn1p_y.y @@ -1,3 +1,5 @@ +%parse-param { void **param } + %{ #include @@ -8,12 +10,10 @@ #include "asn1parser.h" -#define YYPARSE_PARAM param -#define YYPARSE_PARAM_TYPE void ** #define YYERROR_VERBOSE int yylex(void); -int yyerror(const char *msg); +int yyerror(void **param, const char *msg); #ifdef YYBYACC int yyparse(void **param); /* byacc does not produce a prototype */ #endif @@ -42,7 +42,7 @@ static asn1p_module_t *currentModule; #define checkmem(ptr) do { \ if(!(ptr)) \ - return yyerror("Memory failure"); \ + return yyerror(param, "Memory failure"); \ } while(0) #define CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do { \ @@ -174,7 +174,7 @@ static asn1p_module_t *currentModule; %token TOK_EXPLICIT %token TOK_EXPORTS %token TOK_EXTENSIBILITY -%token TOK_EXTERNAL +/*%token TOK_EXTERNAL*/ %token TOK_FALSE %token TOK_FROM %token TOK_GeneralizedTime @@ -595,7 +595,7 @@ Assignment: * Erroneous attemps */ | BasicString { - return yyerror( + return yyerror(param, "Attempt to redefine a standard basic string type, " "please comment out or remove this type redefinition."); } @@ -613,7 +613,7 @@ optImports: ImportsDefinition: TOK_IMPORTS optImportsBundleSet ';' { if(!saved_aid && 0) - return yyerror("Unterminated IMPORTS FROM, " + return yyerror(param, "Unterminated IMPORTS FROM, " "expected semicolon ';'"); saved_aid = 0; $$ = $2; @@ -622,7 +622,7 @@ ImportsDefinition: * Some error cases. */ | TOK_IMPORTS TOK_FROM /* ... */ { - return yyerror("Empty IMPORTS list"); + return yyerror(param, "Empty IMPORTS list"); } ; @@ -1607,7 +1607,7 @@ BasicTypeId: | TOK_OCTET TOK_STRING { $$ = ASN_BASIC_OCTET_STRING; } | TOK_OBJECT TOK_IDENTIFIER { $$ = ASN_BASIC_OBJECT_IDENTIFIER; } | TOK_RELATIVE_OID { $$ = ASN_BASIC_RELATIVE_OID; } - | TOK_EXTERNAL { $$ = ASN_BASIC_EXTERNAL; } + /* | TOK_EXTERNAL { $$ = ASN_BASIC_EXTERNAL; } */ | TOK_EMBEDDED TOK_PDV { $$ = ASN_BASIC_EMBEDDED_PDV; } | TOK_CHARACTER TOK_STRING { $$ = ASN_BASIC_CHARACTER_STRING; } | TOK_UTCTime { $$ = ASN_BASIC_UTCTime; } @@ -2462,7 +2462,8 @@ _fixup_anonymous_identifier(asn1p_expr_t *expr) { } int -yyerror(const char *msg) { +yyerror(void **param, const char *msg) { + assert(param); extern char *asn1p_text; fprintf(stderr, "ASN.1 grammar parse error " diff --git a/skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1 b/skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1 index 7ba2da4f0..5faa48acb 100644 --- a/skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1 +++ b/skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1 @@ -28,4 +28,16 @@ DEFINITIONS ::= BEGIN &property BIT STRING { handles-invalid-encodings(0) } DEFAULT {} } WITH SYNTAX { &Type IDENTIFIED BY &id [HAS PROPERTY &property] } + -- + -- From "ITU-T Recommendation X.208", "34 The external type" + -- + EXTERNAL ::= [UNIVERSAL 8] IMPLICIT SEQUENCE + {direct-reference OBJECT IDENTIFIER OPTIONAL, + indirect-reference INTEGER OPTIONAL, + data-value-descriptor ObjectDescriptor OPTIONAL, + encoding CHOICE + {single-ASN1-type [0] ANY, + octet-aligned [1] IMPLICIT OCTET STRING, + arbitrary [2] IMPLICIT BIT STRING}} + END diff --git a/tests/03-enum-OK.asn1.-Pfwide-types b/tests/03-enum-OK.asn1.-Pfwide-types index 281ad16ca..2e2c8a704 100644 --- a/tests/03-enum-OK.asn1.-Pfwide-types +++ b/tests/03-enum-OK.asn1.-Pfwide-types @@ -816,3 +816,204 @@ asn_TYPE_descriptor_t asn_DEF_Enum5 = { &asn_SPC_Enum5_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/104-param-1-OK.asn1.-Pfwide-types b/tests/104-param-1-OK.asn1.-Pfwide-types index 50e33bafd..9fe5fbeaf 100644 --- a/tests/104-param-1-OK.asn1.-Pfwide-types +++ b/tests/104-param-1-OK.asn1.-Pfwide-types @@ -199,3 +199,204 @@ asn_TYPE_descriptor_t asn_DEF_Bunch = { &asn_SPC_Bunch_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/105-param-2-OK.asn1.-Pfwide-types b/tests/105-param-2-OK.asn1.-Pfwide-types index 7ac005b3f..42b5f1770 100644 --- a/tests/105-param-2-OK.asn1.-Pfwide-types +++ b/tests/105-param-2-OK.asn1.-Pfwide-types @@ -462,3 +462,204 @@ asn_TYPE_descriptor_t asn_DEF_SignedSET = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/106-param-constr-OK.asn1.-P b/tests/106-param-constr-OK.asn1.-P index ac9be6305..4e5fbcabe 100644 --- a/tests/106-param-constr-OK.asn1.-P +++ b/tests/106-param-constr-OK.asn1.-P @@ -316,3 +316,204 @@ asn_TYPE_descriptor_t asn_DEF_NarrowInteger = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/108-param-constr-3-OK.asn1.-Pfwide-types b/tests/108-param-constr-3-OK.asn1.-Pfwide-types index 017d2ec24..44ce04410 100644 --- a/tests/108-param-constr-3-OK.asn1.-Pfwide-types +++ b/tests/108-param-constr-3-OK.asn1.-Pfwide-types @@ -300,3 +300,204 @@ asn_TYPE_descriptor_t asn_DEF_ThreePlus = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/110-param-3-OK.asn1.-Pfwide-types b/tests/110-param-3-OK.asn1.-Pfwide-types index dd7df4c49..4db3ce2c8 100644 --- a/tests/110-param-3-OK.asn1.-Pfwide-types +++ b/tests/110-param-3-OK.asn1.-Pfwide-types @@ -565,3 +565,204 @@ asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/119-per-strings-OK.asn1.-Pgen-PER b/tests/119-per-strings-OK.asn1.-Pgen-PER index 9dcacaf65..1ec500bc3 100644 --- a/tests/119-per-strings-OK.asn1.-Pgen-PER +++ b/tests/119-per-strings-OK.asn1.-Pgen-PER @@ -1584,3 +1584,218 @@ asn_TYPE_descriptor_t asn_DEF_PDU = { &asn_SPC_PDU_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +static asn_per_constraints_t asn_PER_type_encoding_constr_5 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0l, 2l } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_encoding_constr_5, + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "encoding" + }, +}; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/125-bitstring-constraint-OK.asn1.-P b/tests/125-bitstring-constraint-OK.asn1.-P index be32e0eb2..06b0acd10 100644 --- a/tests/125-bitstring-constraint-OK.asn1.-P +++ b/tests/125-bitstring-constraint-OK.asn1.-P @@ -148,3 +148,204 @@ asn_TYPE_descriptor_t asn_DEF_T = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/126-per-extensions-OK.asn1.-Pgen-PER b/tests/126-per-extensions-OK.asn1.-Pgen-PER index 399b87559..4d5f967c7 100644 --- a/tests/126-per-extensions-OK.asn1.-Pgen-PER +++ b/tests/126-per-extensions-OK.asn1.-Pgen-PER @@ -341,3 +341,218 @@ asn_TYPE_descriptor_t asn_DEF_PDU_2 = { &asn_SPC_PDU_2_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +static asn_per_constraints_t asn_PER_type_encoding_constr_5 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0l, 2l } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_encoding_constr_5, + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "encoding" + }, +}; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/127-per-long-OK.asn1.-Pgen-PER b/tests/127-per-long-OK.asn1.-Pgen-PER index 9ecad4791..05a02ba0e 100644 --- a/tests/127-per-long-OK.asn1.-Pgen-PER +++ b/tests/127-per-long-OK.asn1.-Pgen-PER @@ -543,3 +543,218 @@ asn_TYPE_descriptor_t asn_DEF_T = { &asn_SPC_T_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +static asn_per_constraints_t asn_PER_type_encoding_constr_5 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0l, 2l } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_encoding_constr_5, + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "encoding" + }, +}; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/131-per-empty-OK.asn1.-Pgen-PER b/tests/131-per-empty-OK.asn1.-Pgen-PER index 8e706f0ad..287c10d1f 100644 --- a/tests/131-per-empty-OK.asn1.-Pgen-PER +++ b/tests/131-per-empty-OK.asn1.-Pgen-PER @@ -55,3 +55,218 @@ asn_TYPE_descriptor_t asn_DEF_T = { &asn_SPC_T_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +static asn_per_constraints_t asn_PER_type_encoding_constr_5 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0l, 2l } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_encoding_constr_5, + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "encoding" + }, +}; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/134-per-long-OK.asn1.-Pgen-PER b/tests/134-per-long-OK.asn1.-Pgen-PER index 4eed86b09..f4fd953da 100644 --- a/tests/134-per-long-OK.asn1.-Pgen-PER +++ b/tests/134-per-long-OK.asn1.-Pgen-PER @@ -255,3 +255,218 @@ asn_TYPE_descriptor_t asn_DEF_T = { &asn_SPC_T_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +static asn_per_constraints_t asn_PER_type_encoding_constr_5 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0l, 2l } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_encoding_constr_5, + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "encoding" + }, +}; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/135-EXTERNAL-OK.asn1 b/tests/135-EXTERNAL-OK.asn1 new file mode 100644 index 000000000..1ee491300 --- /dev/null +++ b/tests/135-EXTERNAL-OK.asn1 @@ -0,0 +1,4 @@ +TEST DEFINITIONS ::= +BEGIN + T ::= EXTERNAL +END diff --git a/tests/19-param-OK.asn1.-Pfwide-types b/tests/19-param-OK.asn1.-Pfwide-types index 3937b11ca..b82df6fc1 100644 --- a/tests/19-param-OK.asn1.-Pfwide-types +++ b/tests/19-param-OK.asn1.-Pfwide-types @@ -530,3 +530,204 @@ asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName = { &asn_SPC_RelativeDistinguishedName_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/22-tags-OK.asn1.-Pfwide-types b/tests/22-tags-OK.asn1.-Pfwide-types index dcd881d3f..3d6a619af 100644 --- a/tests/22-tags-OK.asn1.-Pfwide-types +++ b/tests/22-tags-OK.asn1.-Pfwide-types @@ -170,3 +170,204 @@ asn_TYPE_descriptor_t asn_DEF_T1 = { &asn_SPC_T1_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/30-set-OK.asn1.-Pfwide-types b/tests/30-set-OK.asn1.-Pfwide-types index 1ee3aeb28..54e207397 100644 --- a/tests/30-set-OK.asn1.-Pfwide-types +++ b/tests/30-set-OK.asn1.-Pfwide-types @@ -119,3 +119,204 @@ asn_TYPE_descriptor_t asn_DEF_T = { &asn_SPC_T_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/31-set-of-OK.asn1.-Pfwide-types b/tests/31-set-of-OK.asn1.-Pfwide-types index 0e02f823e..f5738b396 100644 --- a/tests/31-set-of-OK.asn1.-Pfwide-types +++ b/tests/31-set-of-OK.asn1.-Pfwide-types @@ -527,3 +527,204 @@ asn_TYPE_descriptor_t asn_DEF_Stuff = { &asn_SPC_Stuff_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/32-sequence-of-OK.asn1.-P b/tests/32-sequence-of-OK.asn1.-P index 86e6e3c3d..975a9bd88 100644 --- a/tests/32-sequence-of-OK.asn1.-P +++ b/tests/32-sequence-of-OK.asn1.-P @@ -491,3 +491,204 @@ asn_TYPE_descriptor_t asn_DEF_SeqWithOptional = { &asn_SPC_SeqWithOptional_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/37-indirect-choice-OK.asn1.-Pfwide-types b/tests/37-indirect-choice-OK.asn1.-Pfwide-types index db445d11a..e3cf6c658 100644 --- a/tests/37-indirect-choice-OK.asn1.-Pfwide-types +++ b/tests/37-indirect-choice-OK.asn1.-Pfwide-types @@ -836,3 +836,204 @@ asn_TYPE_descriptor_t asn_DEF_Choice6 = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/39-sequence-of-OK.asn1.-Pfwide-types b/tests/39-sequence-of-OK.asn1.-Pfwide-types index 7a645e782..7070db9e9 100644 --- a/tests/39-sequence-of-OK.asn1.-Pfwide-types +++ b/tests/39-sequence-of-OK.asn1.-Pfwide-types @@ -225,3 +225,204 @@ asn_TYPE_descriptor_t asn_DEF_T2 = { &asn_SPC_T2_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/42-real-life-OK.asn1.-PR b/tests/42-real-life-OK.asn1.-PR index 7e2463c63..6b87e3228 100644 --- a/tests/42-real-life-OK.asn1.-PR +++ b/tests/42-real-life-OK.asn1.-PR @@ -946,3 +946,204 @@ asn_TYPE_descriptor_t asn_DEF_ActionItem = { &asn_SPC_ActionItem_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/43-recursion-OK.asn1.-Pfwide-types b/tests/43-recursion-OK.asn1.-Pfwide-types index 4376e0f58..2b1bd16ad 100644 --- a/tests/43-recursion-OK.asn1.-Pfwide-types +++ b/tests/43-recursion-OK.asn1.-Pfwide-types @@ -586,3 +586,204 @@ asn_TYPE_descriptor_t asn_DEF_Test_structure_3 = { &asn_SPC_Test_structure_3_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/44-choice-in-sequence-OK.asn1.-P b/tests/44-choice-in-sequence-OK.asn1.-P index c1a83dacf..c222faa88 100644 --- a/tests/44-choice-in-sequence-OK.asn1.-P +++ b/tests/44-choice-in-sequence-OK.asn1.-P @@ -331,3 +331,204 @@ asn_TYPE_descriptor_t asn_DEF_T = { &asn_SPC_T_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/46-redefine-OK.asn1.-PR b/tests/46-redefine-OK.asn1.-PR index 350654e3b..25e4f2e72 100644 --- a/tests/46-redefine-OK.asn1.-PR +++ b/tests/46-redefine-OK.asn1.-PR @@ -327,3 +327,204 @@ asn_TYPE_descriptor_t asn_DEF_T = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/47-set-ext-OK.asn1.-Pfwide-types b/tests/47-set-ext-OK.asn1.-Pfwide-types index 01477b07c..e25ca800a 100644 --- a/tests/47-set-ext-OK.asn1.-Pfwide-types +++ b/tests/47-set-ext-OK.asn1.-Pfwide-types @@ -356,3 +356,204 @@ asn_TYPE_descriptor_t asn_DEF_T4 = { &asn_SPC_T4_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/50-constraint-OK.asn1.-Pfwide-types b/tests/50-constraint-OK.asn1.-Pfwide-types index bc2b50c20..498d5bf2a 100644 --- a/tests/50-constraint-OK.asn1.-Pfwide-types +++ b/tests/50-constraint-OK.asn1.-Pfwide-types @@ -4566,3 +4566,204 @@ asn_TYPE_descriptor_t asn_DEF_Identifier = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/50-constraint-OK.asn1.-Pgen-PER b/tests/50-constraint-OK.asn1.-Pgen-PER index 725543465..bd3e22d72 100644 --- a/tests/50-constraint-OK.asn1.-Pgen-PER +++ b/tests/50-constraint-OK.asn1.-Pgen-PER @@ -5740,3 +5740,218 @@ asn_TYPE_descriptor_t asn_DEF_Identifier = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +static asn_per_constraints_t asn_PER_type_encoding_constr_5 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0l, 2l } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_encoding_constr_5, + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "encoding" + }, +}; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/59-choice-extended-OK.asn1.-Pfwide-types b/tests/59-choice-extended-OK.asn1.-Pfwide-types index efe57a9ca..f6b3e0394 100644 --- a/tests/59-choice-extended-OK.asn1.-Pfwide-types +++ b/tests/59-choice-extended-OK.asn1.-Pfwide-types @@ -118,3 +118,204 @@ asn_TYPE_descriptor_t asn_DEF_Choice = { &asn_SPC_Choice_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/60-any-OK.asn1.-Pfwide-types b/tests/60-any-OK.asn1.-Pfwide-types index ac007c196..0f9bd4f64 100644 --- a/tests/60-any-OK.asn1.-Pfwide-types +++ b/tests/60-any-OK.asn1.-Pfwide-types @@ -244,3 +244,204 @@ asn_TYPE_descriptor_t asn_DEF_T3 = { &asn_SPC_T3_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/65-multi-tag-OK.asn1.-Pfnative-types b/tests/65-multi-tag-OK.asn1.-Pfnative-types index cc2541748..8f49ee34d 100644 --- a/tests/65-multi-tag-OK.asn1.-Pfnative-types +++ b/tests/65-multi-tag-OK.asn1.-Pfnative-types @@ -1022,3 +1022,204 @@ asn_TYPE_descriptor_t asn_DEF_Ts = { &asn_SPC_Ts_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/65-multi-tag-OK.asn1.-Pfwide-types b/tests/65-multi-tag-OK.asn1.-Pfwide-types index ae083179b..f137c4ef0 100644 --- a/tests/65-multi-tag-OK.asn1.-Pfwide-types +++ b/tests/65-multi-tag-OK.asn1.-Pfwide-types @@ -1022,3 +1022,204 @@ asn_TYPE_descriptor_t asn_DEF_Ts = { &asn_SPC_Ts_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/66-ref-simple-OK.asn1.-Pfwide-types b/tests/66-ref-simple-OK.asn1.-Pfwide-types index f8c4f800d..9f7901d2c 100644 --- a/tests/66-ref-simple-OK.asn1.-Pfwide-types +++ b/tests/66-ref-simple-OK.asn1.-Pfwide-types @@ -219,3 +219,204 @@ asn_TYPE_descriptor_t asn_DEF_SimpleType = { &asn_SPC_SimpleType_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/69-reserved-words-OK.asn1.-Pfwide-types b/tests/69-reserved-words-OK.asn1.-Pfwide-types index 5e65ca492..88f1f7c44 100644 --- a/tests/69-reserved-words-OK.asn1.-Pfwide-types +++ b/tests/69-reserved-words-OK.asn1.-Pfwide-types @@ -198,3 +198,204 @@ asn_TYPE_descriptor_t asn_DEF_T = { &asn_SPC_T_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/70-xer-test-OK.asn1.-Pfwide-types b/tests/70-xer-test-OK.asn1.-Pfwide-types index 230d1ce46..db5923ac1 100644 --- a/tests/70-xer-test-OK.asn1.-Pfwide-types +++ b/tests/70-xer-test-OK.asn1.-Pfwide-types @@ -1938,3 +1938,204 @@ asn_TYPE_descriptor_t asn_DEF_SimpleChoice = { &asn_SPC_SimpleChoice_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/72-same-names-OK.asn1.-Pfwide-types b/tests/72-same-names-OK.asn1.-Pfwide-types index 47923c3fe..3f55d890a 100644 --- a/tests/72-same-names-OK.asn1.-Pfwide-types +++ b/tests/72-same-names-OK.asn1.-Pfwide-types @@ -769,3 +769,204 @@ asn_TYPE_descriptor_t asn_DEF_Type2 = { &asn_SPC_Type2_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/73-circular-OK.asn1.-Pfwide-types b/tests/73-circular-OK.asn1.-Pfwide-types index bb42973f0..3c38f2462 100644 --- a/tests/73-circular-OK.asn1.-Pfwide-types +++ b/tests/73-circular-OK.asn1.-Pfwide-types @@ -865,3 +865,204 @@ asn_TYPE_descriptor_t asn_DEF_EnumType = { &asn_SPC_EnumType_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/84-param-tags-OK.asn1.-Pfwide-types b/tests/84-param-tags-OK.asn1.-Pfwide-types index 9efa77a89..f33b8955d 100644 --- a/tests/84-param-tags-OK.asn1.-Pfwide-types +++ b/tests/84-param-tags-OK.asn1.-Pfwide-types @@ -557,3 +557,204 @@ asn_TYPE_descriptor_t asn_DEF_AutoChoice = { &asn_SPC_AutoChoice_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/88-integer-enum-OK.asn1.-Pfwide-types b/tests/88-integer-enum-OK.asn1.-Pfwide-types index 945ede0f8..efc5737c3 100644 --- a/tests/88-integer-enum-OK.asn1.-Pfwide-types +++ b/tests/88-integer-enum-OK.asn1.-Pfwide-types @@ -133,3 +133,204 @@ asn_TYPE_descriptor_t asn_DEF_T = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/89-bit-string-enum-OK.asn1.-Pfcompound-names b/tests/89-bit-string-enum-OK.asn1.-Pfcompound-names index adb8d81da..06b7f0316 100644 --- a/tests/89-bit-string-enum-OK.asn1.-Pfcompound-names +++ b/tests/89-bit-string-enum-OK.asn1.-Pfcompound-names @@ -80,3 +80,204 @@ asn_TYPE_descriptor_t asn_DEF_T = { &asn_SPC_T_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum EXTERNAL__encoding_PR { + EXTERNAL__encoding_PR_NOTHING, /* No components present */ + EXTERNAL__encoding_PR_single_ASN1_type, + EXTERNAL__encoding_PR_octet_aligned, + EXTERNAL__encoding_PR_arbitrary +} EXTERNAL__encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct EXTERNAL__encoding { + EXTERNAL__encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL__encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL__encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL__encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct EXTERNAL__encoding), + offsetof(struct EXTERNAL__encoding, _asn_ctx), + offsetof(struct EXTERNAL__encoding, present), + sizeof(((struct EXTERNAL__encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/89-bit-string-enum-OK.asn1.-Pfwide-types b/tests/89-bit-string-enum-OK.asn1.-Pfwide-types index 3d38ecde2..550153318 100644 --- a/tests/89-bit-string-enum-OK.asn1.-Pfwide-types +++ b/tests/89-bit-string-enum-OK.asn1.-Pfwide-types @@ -80,3 +80,204 @@ asn_TYPE_descriptor_t asn_DEF_T = { &asn_SPC_T_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/90-cond-int-type-OK.asn1.-P b/tests/90-cond-int-type-OK.asn1.-P index 661662281..7181a3023 100644 --- a/tests/90-cond-int-type-OK.asn1.-P +++ b/tests/90-cond-int-type-OK.asn1.-P @@ -2596,3 +2596,204 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2 = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/90-cond-int-type-OK.asn1.-Pfwide-types b/tests/90-cond-int-type-OK.asn1.-Pfwide-types index 7b91663a5..ff38bd87e 100644 --- a/tests/90-cond-int-type-OK.asn1.-Pfwide-types +++ b/tests/90-cond-int-type-OK.asn1.-Pfwide-types @@ -2615,3 +2615,204 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2 = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/90-cond-int-type-OK.asn1.-Pgen-PER b/tests/90-cond-int-type-OK.asn1.-Pgen-PER index 1fb41ae24..ce18dc284 100644 --- a/tests/90-cond-int-type-OK.asn1.-Pgen-PER +++ b/tests/90-cond-int-type-OK.asn1.-Pgen-PER @@ -3364,3 +3364,218 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2 = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +static asn_per_constraints_t asn_PER_type_encoding_constr_5 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0l, 2l } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_encoding_constr_5, + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "encoding" + }, +}; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE b/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE index 220076c35..f33b2fcbb 100644 --- a/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE +++ b/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE @@ -703,3 +703,204 @@ asn_TYPE_descriptor_t asn_DEF_NO_Integer5 = { 0 /* No specifics */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/92-circular-loops-OK.asn1.-Pfindirect-choice b/tests/92-circular-loops-OK.asn1.-Pfindirect-choice index b986dfdbb..507a6dd8b 100644 --- a/tests/92-circular-loops-OK.asn1.-Pfindirect-choice +++ b/tests/92-circular-loops-OK.asn1.-Pfindirect-choice @@ -1698,3 +1698,204 @@ asn_TYPE_descriptor_t asn_DEF_ThreeOne = { &asn_SPC_ThreeOne_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/92-circular-loops-OK.asn1.-Pfwide-types b/tests/92-circular-loops-OK.asn1.-Pfwide-types index 6d45e55f6..e0fe7f3fc 100644 --- a/tests/92-circular-loops-OK.asn1.-Pfwide-types +++ b/tests/92-circular-loops-OK.asn1.-Pfwide-types @@ -1697,3 +1697,204 @@ asn_TYPE_descriptor_t asn_DEF_ThreeOne = { &asn_SPC_ThreeOne_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/93-asn1c-controls-OK.asn1.-Pfwide-types b/tests/93-asn1c-controls-OK.asn1.-Pfwide-types index 7b20d16db..8ba9c4cce 100644 --- a/tests/93-asn1c-controls-OK.asn1.-Pfwide-types +++ b/tests/93-asn1c-controls-OK.asn1.-Pfwide-types @@ -356,3 +356,204 @@ asn_TYPE_descriptor_t asn_DEF_Choice = { &asn_SPC_Choice_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/94-set-optionals-OK.asn1.-P b/tests/94-set-optionals-OK.asn1.-P index 483d77021..901008502 100644 --- a/tests/94-set-optionals-OK.asn1.-P +++ b/tests/94-set-optionals-OK.asn1.-P @@ -202,3 +202,204 @@ asn_TYPE_descriptor_t asn_DEF_TestSet = { &asn_SPC_TestSet_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/95-choice-per-order-OK.asn1.-Pfwide-types b/tests/95-choice-per-order-OK.asn1.-Pfwide-types index a1884c4a0..a8c9be17d 100644 --- a/tests/95-choice-per-order-OK.asn1.-Pfwide-types +++ b/tests/95-choice-per-order-OK.asn1.-Pfwide-types @@ -285,3 +285,204 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { &asn_SPC_Choice2_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + INTEGER_t *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/95-choice-per-order-OK.asn1.-Pgen-PER b/tests/95-choice-per-order-OK.asn1.-Pgen-PER index d6f123daa..0e7525a99 100644 --- a/tests/95-choice-per-order-OK.asn1.-Pgen-PER +++ b/tests/95-choice-per-order-OK.asn1.-Pgen-PER @@ -314,3 +314,218 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { &asn_SPC_Choice2_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +static asn_per_constraints_t asn_PER_type_encoding_constr_5 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0l, 2l } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_encoding_constr_5, + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "encoding" + }, +}; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/tests/98-attribute-class-OK.asn1.-P b/tests/98-attribute-class-OK.asn1.-P index 547fc4ed9..dd0760791 100644 --- a/tests/98-attribute-class-OK.asn1.-P +++ b/tests/98-attribute-class-OK.asn1.-P @@ -104,3 +104,204 @@ asn_TYPE_descriptor_t asn_DEF_Attribute = { &asn_SPC_Attribute_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [EXTERNAL] >>> ***/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*** <<< DEPS [EXTERNAL] >>> ***/ + +typedef enum encoding_PR { + encoding_PR_NOTHING, /* No components present */ + encoding_PR_single_ASN1_type, + encoding_PR_octet_aligned, + encoding_PR_arbitrary +} encoding_PR; + +/*** <<< TYPE-DECLS [EXTERNAL] >>> ***/ + +typedef struct EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference /* OPTIONAL */; + long *indirect_reference /* OPTIONAL */; + ObjectDescriptor_t *data_value_descriptor /* OPTIONAL */; + struct encoding { + encoding_PR present; + union EXTERNAL__encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EXTERNAL_t; + +/*** <<< FUNC-DECLS [EXTERNAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EXTERNAL; + +/*** <<< STAT-DEFS [EXTERNAL] >>> ***/ + +static asn_TYPE_member_t asn_MBR_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.single_ASN1_type), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_ANY, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.octet_aligned), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_OCTET_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct encoding, choice.arbitrary), + .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_BIT_STRING, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_encoding_specs_5 = { + sizeof(struct encoding), + offsetof(struct encoding, _asn_ctx), + offsetof(struct encoding, present), + sizeof(((struct encoding *)0)->present), + asn_MAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + .canonical_order = 0, + .ext_start = -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_encoding_5 = { + "encoding", + "encoding", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_encoding_5, + 3, /* Elements count */ + &asn_SPC_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct EXTERNAL, direct_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + .tag_mode = 0, + .type = &asn_DEF_OBJECT_IDENTIFIER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct EXTERNAL, indirect_reference), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_NativeInteger, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct EXTERNAL, data_value_descriptor), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + .tag_mode = 0, + .type = &asn_DEF_ObjectDescriptor, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct EXTERNAL, encoding), + .tag = -1 /* Ambiguous tag (CHOICE?) */, + .tag_mode = 0, + .type = &asn_DEF_encoding_5, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "encoding" + }, +}; +static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { + sizeof(struct EXTERNAL), + offsetof(struct EXTERNAL, _asn_ctx), + asn_MAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EXTERNAL_tags_1, + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_EXTERNAL_tags_1) + /sizeof(asn_DEF_EXTERNAL_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_EXTERNAL_specs_1 /* Additional specs */ +}; +