restructured member variable names

This commit is contained in:
Lev Walkin 2005-08-12 10:09:10 +00:00
parent 2c14a696f3
commit b36317c2a8
11 changed files with 1199 additions and 1175 deletions

View File

@ -208,7 +208,7 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps) {
" * From ASN.1 module \"%s\"\n" " * From ASN.1 module \"%s\"\n"
" * \tfound in \"%s\"\n" " * \tfound in \"%s\"\n"
" */\n\n", " */\n\n",
arg->mod->Identifier, arg->mod->ModuleName,
arg->mod->source_file_name arg->mod->source_file_name
); );
fprintf(fp_h, fprintf(fp_h,
@ -217,7 +217,7 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps) {
" * From ASN.1 module \"%s\"\n" " * From ASN.1 module \"%s\"\n"
" * \tfound in \"%s\"\n" " * \tfound in \"%s\"\n"
" */\n\n", " */\n\n",
arg->mod->Identifier, arg->mod->ModuleName,
arg->mod->source_file_name arg->mod->source_file_name
); );

View File

@ -118,7 +118,7 @@ asn1f_fix_module__phase_1(arg_t *arg) {
TQ_FOR(omod, &arg->asn->modules, mod_next) { TQ_FOR(omod, &arg->asn->modules, mod_next) {
int sameNames; int sameNames;
if(omod == arg->mod) break; if(omod == arg->mod) break;
sameNames = strcmp(omod->Identifier, arg->mod->Identifier)?0:1; sameNames = strcmp(omod->ModuleName, arg->mod->ModuleName)?0:1;
if(omod->module_oid && arg->mod->module_oid) { if(omod->module_oid && arg->mod->module_oid) {
/* Compare only the OID. */ /* Compare only the OID. */
if(asn1p_oid_compare(omod->module_oid, if(asn1p_oid_compare(omod->module_oid,
@ -126,18 +126,18 @@ asn1f_fix_module__phase_1(arg_t *arg) {
FATAL("ASN.1 module %s in %s " FATAL("ASN.1 module %s in %s "
"has the same OBJECT IDENTIFIER" "has the same OBJECT IDENTIFIER"
" as module %s", " as module %s",
omod->Identifier, omod->ModuleName,
omod->source_file_name, omod->source_file_name,
arg->mod->Identifier arg->mod->ModuleName
); );
RET2RVAL(-1, rvalue); RET2RVAL(-1, rvalue);
} else if(sameNames) { } else if(sameNames) {
WARNING("ASN.1 module %s is defined more than once, with different OIDs", omod->Identifier); WARNING("ASN.1 module %s is defined more than once, with different OIDs", omod->ModuleName);
RET2RVAL(1, rvalue); RET2RVAL(1, rvalue);
} }
} else if(sameNames) { } else if(sameNames) {
FATAL("ASN.1 module %s is defined more than once", FATAL("ASN.1 module %s is defined more than once",
omod->Identifier); omod->ModuleName);
RET2RVAL(-1, rvalue); RET2RVAL(-1, rvalue);
} }
} }
@ -150,7 +150,7 @@ asn1f_fix_module__phase_1(arg_t *arg) {
break; break;
default: default:
FATAL("Module %s defined with ambiguous global tagging mode", FATAL("Module %s defined with ambiguous global tagging mode",
arg->mod->Identifier); arg->mod->ModuleName);
RET2RVAL(-1, rvalue); RET2RVAL(-1, rvalue);
} }
@ -162,7 +162,7 @@ asn1f_fix_module__phase_1(arg_t *arg) {
break; break;
case MSF_unk_INSTRUCTIONS: case MSF_unk_INSTRUCTIONS:
WARNING("Module %s defined with unrecognized " WARNING("Module %s defined with unrecognized "
"encoding reference", arg->mod->Identifier); "encoding reference", arg->mod->ModuleName);
RET2RVAL(1, rvalue); RET2RVAL(1, rvalue);
/* Fall through */ /* Fall through */
case MSF_TAG_INSTRUCTIONS: case MSF_TAG_INSTRUCTIONS:
@ -170,7 +170,7 @@ asn1f_fix_module__phase_1(arg_t *arg) {
break; break;
default: default:
FATAL("Module %s defined with ambiguous encoding reference", FATAL("Module %s defined with ambiguous encoding reference",
arg->mod->Identifier); arg->mod->ModuleName);
RET2RVAL(-1, rvalue); RET2RVAL(-1, rvalue);
} }
@ -452,10 +452,10 @@ asn1f_check_duplicate(arg_t *arg) {
"Please rename either instance to resolve the conflict", "Please rename either instance to resolve the conflict",
arg->expr->Identifier, arg->expr->Identifier,
arg->expr->_lineno, arg->expr->_lineno,
arg->mod->Identifier, arg->mod->ModuleName,
tmparg.expr->Identifier, tmparg.expr->Identifier,
tmparg.expr->_lineno, tmparg.expr->_lineno,
tmparg.mod->Identifier, tmparg.mod->ModuleName,
diff_files ? " (" : "", diff_files ? " (" : "",
diff_files ? tmparg.mod->source_file_name : "", diff_files ? tmparg.mod->source_file_name : "",
diff_files ? ")" : "" diff_files ? ")" : ""

View File

@ -446,7 +446,7 @@ _asn1f_compare_tags(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) {
"improper use of " "improper use of "
"EXTENSIBILITY IMPLIED flag " "EXTENSIBILITY IMPLIED flag "
"of module %s", "of module %s",
arg->mod->Identifier); arg->mod->ModuleName);
} }
return -1; return -1;
} else { } else {

View File

@ -51,7 +51,7 @@ asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const char *name) {
* Okay, right now we have a module name and, hopefully, an OID. * Okay, right now we have a module name and, hopefully, an OID.
* Search the arg->asn for the specified module. * Search the arg->asn for the specified module.
*/ */
mod = asn1f_lookup_module(arg, xp->from, xp->from_oid); mod = asn1f_lookup_module(arg, xp->fromModuleName, xp->identifier.oid);
if(mod == NULL) { if(mod == NULL) {
/* Conditional debug */ /* Conditional debug */
if(!(arg->expr->_mark & TM_BROKEN)) { if(!(arg->expr->_mark & TM_BROKEN)) {
@ -59,7 +59,7 @@ asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const char *name) {
FATAL("Cannot find external module \"%s\" " FATAL("Cannot find external module \"%s\" "
"mentioned for " "mentioned for "
"\"%s\" at line %d", "\"%s\" at line %d",
xp->from, name, arg->expr->_lineno); xp->fromModuleName, name, arg->expr->_lineno);
} }
/* ENOENT/ETOOMANYREFS */ /* ENOENT/ETOOMANYREFS */
return NULL; return NULL;
@ -97,7 +97,7 @@ asn1f_lookup_module(arg_t *arg, const char *module_name, asn1p_oid_t *oid) {
* somewhere in the IMPORTS section AND OID is given. * somewhere in the IMPORTS section AND OID is given.
*/ */
TQ_FOR(xp, &(arg->mod->imports), xp_next) { TQ_FOR(xp, &(arg->mod->imports), xp_next) {
if(strcmp(module_name, xp->from)) if(strcmp(module_name, xp->fromModuleName))
continue; continue;
if(oid) { if(oid) {
FATAL("Ambiguous reference: " FATAL("Ambiguous reference: "
@ -111,7 +111,7 @@ asn1f_lookup_module(arg_t *arg, const char *module_name, asn1p_oid_t *oid) {
* Yes, there is a renaming. * Yes, there is a renaming.
* Make lookup use OID instead. * Make lookup use OID instead.
*/ */
oid = xp->from_oid; oid = xp->identifier.oid;
} }
} }
@ -134,7 +134,7 @@ asn1f_lookup_module(arg_t *arg, const char *module_name, asn1p_oid_t *oid) {
} }
} }
if(strcmp(module_name, mod->Identifier) == 0) if(strcmp(module_name, mod->ModuleName) == 0)
return mod; return mod;
} }
@ -167,7 +167,7 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
DEBUG("(%s) in %s for line %d", DEBUG("(%s) in %s for line %d",
asn1f_printable_reference(ref), asn1f_printable_reference(ref),
mod->Identifier, mod->ModuleName,
ref->_lineno); ref->_lineno);
if(ref->comp_count == 1) { if(ref->comp_count == 1) {
@ -251,16 +251,16 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
if(modulename) { if(modulename) {
FATAL("Module %s referred by %s in module %s " FATAL("Module %s referred by %s in module %s "
"does not contain the requested symbol", "does not contain the requested symbol",
imports_from->Identifier, imports_from->ModuleName,
asn1f_printable_reference(ref), asn1f_printable_reference(ref),
mod->Identifier); mod->ModuleName);
} else { } else {
FATAL("Module %s referred in IMPORTS section " FATAL("Module %s referred in IMPORTS section "
"for %s of module %s does not contain " "for %s of module %s does not contain "
"the requested symbol", "the requested symbol",
imports_from->Identifier, imports_from->ModuleName,
asn1f_printable_reference(ref), asn1f_printable_reference(ref),
mod->Identifier); mod->ModuleName);
} }
} }
return expr; return expr;
@ -277,7 +277,7 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
if(ref_tc == NULL) { if(ref_tc == NULL) {
DEBUG("Module \"%s\" does not contain \"%s\" " DEBUG("Module \"%s\" does not contain \"%s\" "
"mentioned at line %d: %s", "mentioned at line %d: %s",
mod->Identifier, mod->ModuleName,
identifier, identifier,
ref->_lineno, ref->_lineno,
strerror(errno) strerror(errno)
@ -406,7 +406,7 @@ asn1f_compatible_with_exports(arg_t *arg, asn1p_module_t *mod, const char *name)
arg->expr->_mark |= TM_BROKEN; arg->expr->_mark |= TM_BROKEN;
FATAL("EXPORTS section of module %s in %s " FATAL("EXPORTS section of module %s in %s "
"does not mention %s at line %d", "does not mention %s at line %d",
mod->Identifier, mod->source_file_name, name, mod->ModuleName, mod->source_file_name, name,
arg->expr->_lineno); arg->expr->_lineno);
} }

View File

@ -27,8 +27,8 @@ asn1p_module_free(asn1p_module_t *mod) {
if(mod) { if(mod) {
asn1p_expr_t *expr; asn1p_expr_t *expr;
if(mod->Identifier) if(mod->ModuleName)
free(mod->Identifier); free(mod->ModuleName);
if(mod->module_oid) if(mod->module_oid)
asn1p_oid_free(mod->module_oid); asn1p_oid_free(mod->module_oid);

View File

@ -36,9 +36,9 @@ typedef struct asn1p_module_s {
char *source_file_name; char *source_file_name;
/* /*
* Human-readable module identifier. * Human-readable module reference.
*/ */
char *Identifier; /* Module name */ char *ModuleName;
/* /*
* Unique module identifier, OID. * Unique module identifier, OID.

View File

@ -25,10 +25,10 @@ asn1p_xports_new() {
void void
asn1p_xports_free(asn1p_xports_t *xp) { asn1p_xports_free(asn1p_xports_t *xp) {
if(xp) { if(xp) {
if(xp->from) if(xp->fromModuleName)
free(xp->from); free(xp->fromModuleName);
if(xp->from_oid) if(xp->identifier.oid)
asn1p_oid_free(xp->from_oid); asn1p_oid_free(xp->identifier.oid);
free(xp); free(xp);
} }
} }

View File

@ -17,8 +17,11 @@ typedef struct asn1p_xports_s {
/* /*
* Module name and optional OID, occur after FROM. * Module name and optional OID, occur after FROM.
*/ */
char *from; /* Name of the module */ char *fromModuleName; /* Name of the module */
asn1p_oid_t *from_oid; /* Optional OID of the module */ struct AssignedIdentifier {
asn1p_oid_t *oid; /* Optional OID of the module */
asn1p_value_t *value; /* DefinedValue */
} identifier;
/* /*
* Number of entities to import. * Number of entities to import.

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@ typedef union {
asn1p_constraint_t *a_constr; /* Constraint */ asn1p_constraint_t *a_constr; /* Constraint */
enum asn1p_constraint_type_e a_ctype;/* Constraint type */ enum asn1p_constraint_type_e a_ctype;/* Constraint type */
asn1p_xports_t *a_xports; /* IMports/EXports */ asn1p_xports_t *a_xports; /* IMports/EXports */
struct AssignedIdentifier a_aid; /* Assigned Identifier */
asn1p_oid_t *a_oid; /* Object Identifier */ asn1p_oid_t *a_oid; /* Object Identifier */
asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */ asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */
struct asn1p_type_tag_s a_tag; /* A tag */ struct asn1p_type_tag_s a_tag; /* A tag */

View File

@ -65,9 +65,9 @@ asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags)
if(flags & APF_PRINT_XML_DTD) if(flags & APF_PRINT_XML_DTD)
printf("<!-- ASN.1 module\n"); printf("<!-- ASN.1 module\n");
printf("%s ", mod->Identifier); printf("%s ", mod->ModuleName);
if(mod->module_oid) { if(mod->module_oid) {
asn1print_oid(strlen(mod->Identifier), mod->module_oid, flags); asn1print_oid(strlen(mod->ModuleName), mod->module_oid, flags);
printf("\n"); printf("\n");
} }