Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libasn1common/asn1_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define ASN1_REFERENCE_H

struct asn1p_module_s;
struct asn1p_expr_s;

typedef struct asn1p_ref_s {

Expand Down Expand Up @@ -39,6 +40,7 @@ typedef struct asn1p_ref_s {
size_t comp_count; /* Number of the components in the reference name. */
size_t comp_size; /* Number of allocated structures */

struct asn1p_expr_s *ref_expr; /* De-referenced expression */
struct asn1p_module_s *module; /* Defined in module */
int _lineno; /* Number of line in the file */
} asn1p_ref_t;
Expand Down
6 changes: 3 additions & 3 deletions libasn1compiler/asn1c_ioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Given the table constraint or component relation constraint
* ({ObjectSetName}{...}) returns "ObjectSetName" as a reference.
*/
const asn1p_ref_t *
asn1p_ref_t *
asn1c_get_information_object_set_reference_from_constraint(arg_t *arg,
const asn1p_constraint_t *ct) {

Expand Down Expand Up @@ -68,14 +68,14 @@ asn1c_get_ioc_table(arg_t *arg) {
asn1p_expr_t *expr = arg->expr;
asn1p_expr_t *memb;
asn1p_expr_t *objset = 0;
const asn1p_ref_t *objset_ref = NULL;
asn1p_ref_t *objset_ref = NULL;
asn1c_ioc_table_and_objset_t safe_ioc_tao = {0, 0, 0};
asn1c_ioc_table_and_objset_t failed_ioc_tao = { 0, 0, 1 };

TQ_FOR(memb, &(expr->members), next) {
const asn1p_constraint_t *cr_ct =
asn1p_get_component_relation_constraint(memb->constraints);
const asn1p_ref_t *tmpref =
asn1p_ref_t *tmpref =
asn1c_get_information_object_set_reference_from_constraint(arg,
cr_ct);
if(tmpref) {
Expand Down
2 changes: 1 addition & 1 deletion libasn1compiler/asn1c_ioc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ asn1c_ioc_table_and_objset_t asn1c_get_ioc_table(arg_t *arg);
int emit_ioc_table(arg_t *arg, asn1p_expr_t *context,
asn1c_ioc_table_and_objset_t);

const asn1p_ref_t *asn1c_get_information_object_set_reference_from_constraint(
asn1p_ref_t *asn1c_get_information_object_set_reference_from_constraint(
arg_t *arg, const asn1p_constraint_t *ct);


Expand Down
6 changes: 6 additions & 0 deletions libasn1compiler/asn1c_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) {
if(expr->_mark & TM_NAMECLASH) {
size += strlen(expr->module->ModuleName) + 2;
sptr[sptr_cnt++] = expr->module->ModuleName;
} else if (expr->reference && expr->reference->ref_expr &&
(expr->reference->ref_expr->_mark & TM_NAMECLASH) &&
(strcmp(expr->Identifier, expr->reference->ref_expr->Identifier) == 0)) {
size += strlen(expr->reference->ref_expr->module->ModuleName) + 2;
sptr[sptr_cnt++] = expr->reference->ref_expr->module->ModuleName;
}

sptr[sptr_cnt++] = expr->Identifier;

size += strlen(expr->Identifier);
Expand Down
2 changes: 1 addition & 1 deletion libasn1fix/asn1fix_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ asn1f_lookup_module_ex(asn1p_t *asn, const char *module_name,

asn1p_expr_t *
asn1f_lookup_symbol_ex(asn1p_t *asn, asn1_namespace_t *ns, asn1p_expr_t *expr,
const asn1p_ref_t *ref) {
asn1p_ref_t *ref) {
arg_t arg;

memset(&arg, 0, sizeof(arg));
Expand Down
2 changes: 1 addition & 1 deletion libasn1fix/asn1fix_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ asn1p_expr_t *asn1f_lookup_symbol_ex(
asn1p_t *asn,
struct asn1_namespace_s *ns,
asn1p_expr_t *expr,
const asn1p_ref_t *ref);
asn1p_ref_t *ref);

/*
* Exportable version of an asn1f_class_access().
Expand Down
6 changes: 4 additions & 2 deletions libasn1fix/asn1fix_retrieve.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,10 @@ asn1f_lookup_symbol_impl(arg_t *arg, asn1p_expr_t *rhs_pspecs, const asn1p_ref_t

asn1p_expr_t *
asn1f_lookup_symbol(arg_t *arg, asn1p_expr_t *rhs_pspecs,
const asn1p_ref_t *ref) {
return asn1f_lookup_symbol_impl(arg, rhs_pspecs, ref, 0);
asn1p_ref_t *ref) {
asn1p_expr_t *expr = asn1f_lookup_symbol_impl(arg, rhs_pspecs, ref, 0);
if (ref) ref->ref_expr = expr;
return expr;
}

asn1p_expr_t *
Expand Down
2 changes: 1 addition & 1 deletion libasn1fix/asn1fix_retrieve.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ asn1p_module_t *asn1f_lookup_module(arg_t *arg,
* symbol lookup. Not a recursive function.
*/
asn1p_expr_t *asn1f_lookup_symbol(arg_t *arg, asn1p_expr_t *rhs_pspecs,
const asn1p_ref_t *ref);
asn1p_ref_t *ref);

/*
* Recursively find the original type for the given expression.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
-- OK: Everything is fine

-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .159

ModuleA
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 159 }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

Rate ::= INTEGER(0..65535)
c-Rate INTEGER ::= 2
EXT-TYPE ::= CLASS {
&extRef RefExt UNIQUE,
&ExtValue
}
WITH SYNTAX {&ExtValue IDENTIFIED BY &extRef}
RefExt::=INTEGER (0..255)

END

ModuleB
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

Rate ::= INTEGER(0..255)
c-Rate INTEGER ::= 1

END

ModuleC
DEFINITIONS IMPLICIT TAGS ::=
BEGIN
IMPORTS
Rate, EXT-TYPE FROM ModuleA
c-Repeat FROM ModuleB;

ExtTypes EXT-TYPE ::= {
{ Rate IDENTIFIED BY c-Rate },
...
}

END