Commit 0320d877 authored by Lev Walkin's avatar Lev Walkin

marked parametrized members

parent 4cd58bd2
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Compiler now checks 64-bit overflows in constraints range handling * Compiler now checks 64-bit overflows in constraints range handling
code. No effect on the code produced by the compiler. code. No effect on the code produced by the compiler.
* Compiler support for tagged parametrized members. * Compiler support for tagged and marked parametrized members.
* Empty tags to element map avoided. * Empty tags to element map avoided.
0.9.14: 2005-Apr-29 0.9.14: 2005-Apr-29
......
...@@ -377,9 +377,9 @@ process_line(const char *fname, char *line, int lineno) { ...@@ -377,9 +377,9 @@ process_line(const char *fname, char *line, int lineno) {
if(len != tlv_len) { if(len != tlv_len) {
if(no_validation) fprintf(stderr, "Warning: "); if(no_validation) fprintf(stderr, "Warning: ");
fprintf(stderr, fprintf(stderr,
"%s: Could not encode value of %d chars " "%s: Could not encode value of %ld chars "
"at line %d in %d bytes\n", "at line %d in %ld bytes\n",
fname, len, lineno, tlv_len); fname, (long)len, lineno, (long)tlv_len);
if(!no_validation) exit(EX_DATAERR); if(!no_validation) exit(EX_DATAERR);
} }
} }
......
...@@ -59,33 +59,53 @@ asn1f_fix_parametrized_assignment(arg_t *arg) { ...@@ -59,33 +59,53 @@ asn1f_fix_parametrized_assignment(arg_t *arg) {
} }
#define SUBSTITUTE(to, from) do { \ #define SUBSTITUTE(to, from) do { \
asn1p_expr_t tmp, *__v; \ asn1p_expr_t tmp, *__v; \
if((to)->tag.tag_class \ if((to)->tag.tag_class \
&& (from)->tag.tag_class) { \ && (from)->tag.tag_class) { \
FATAL("Layered tagging " \ FATAL("Layered tagging in parametrization " \
"in parametrization " \ "is not yet supported, " \
"is not yet supported, " \ "contact asn1c author for assistance with"); \
"contact asn1c author for"); \ return -1; \
return -1; \ } \
/* This code shall not be invoked too early */ \
assert((to)->combined_constraints == NULL); \
assert((from)->combined_constraints == NULL); \
/* Copy stuff, and merge some parameters */ \
tmp = *(to); \
*(to) = *(from); \
TQ_MOVE(&(to)->members, &(from)->members); \
*(from) = tmp; \
(to)->next = tmp.next; \
(to)->parent_expr = tmp.parent_expr; \
assert((to)->marker.flags == EM_NOMARK); \
(to)->marker = tmp.marker; \
if(tmp.tag.tag_class) \
(to)->tag = tmp.tag; \
if(tmp.constraints) { \
if((to)->constraints) { \
asn1p_constraint_t *ct; \
ct = asn1p_constraint_new( \
(to)->constraints->_lineno); \
ct->type = ACT_CA_SET; \
asn1p_constraint_insert(ct, \
(to)->constraints); \
asn1p_constraint_insert(ct, \
tmp.constraints); \
(to)->constraints = ct; \
} else { \
(to)->constraints = tmp.constraints; \
} \ } \
tmp = *(to); \ } \
*(to) = *(from); \ (from)->constraints = 0; \
TQ_MOVE(&(to)->members, &(from)->members); \ (from)->marker.default_value = 0; \
*(from) = tmp; \ memset(&((from)->next), 0, sizeof((from)->next)); \
(to)->next = tmp.next; \ memset(&((from)->members), 0, sizeof((from)->members)); \
(to)->parent_expr = tmp.parent_expr; \ asn1p_expr_free(from); \
if(tmp.tag.tag_class) \ TQ_FOR(__v, &((to)->members), next) { \
(to)->tag = tmp.tag; \ assert(__v->parent_expr == (from)); \
memset(&((from)->next), 0, \ __v->parent_expr = (to); \
sizeof((from)->next)); \ } \
memset(&((from)->members), 0, \ } while(0)
sizeof((from)->members)); \
asn1p_expr_free(from); \
TQ_FOR(__v, &((to)->members), next) { \
assert(__v->parent_expr == (from)); \
__v->parent_expr = (to); \
} \
} while(0)
static int static int
asn1f_parametrize(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *ptype) { asn1f_parametrize(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *ptype) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment