Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
163db36d
Commit
163db36d
authored
Sep 15, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recursive importing
parent
caaf7a54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
13 deletions
+28
-13
libasn1fix/asn1fix_retrieve.c
libasn1fix/asn1fix_retrieve.c
+28
-13
No files found.
libasn1fix/asn1fix_retrieve.c
View file @
163db36d
...
...
@@ -23,15 +23,14 @@ asn1f_lookup_child(asn1p_expr_t *tc, const char *name) {
}
asn1p_module_t
*
asn1f_lookup_in_imports
(
arg_t
*
arg
,
const
char
*
name
)
{
asn1p_module_t
*
mod
;
asn1f_lookup_in_imports
(
arg_t
*
arg
,
asn1p_module_t
*
mod
,
const
char
*
name
)
{
asn1p_xports_t
*
xp
;
asn1p_expr_t
*
tc
;
/*
* Search in which exactly module this name is defined.
*/
TQ_FOR
(
xp
,
&
(
arg
->
mod
->
imports
),
xp_next
)
{
TQ_FOR
(
xp
,
&
(
mod
->
imports
),
xp_next
)
{
TQ_FOR
(
tc
,
&
(
xp
->
members
),
next
)
{
if
(
strcmp
(
name
,
tc
->
Identifier
)
==
0
)
break
;
...
...
@@ -137,7 +136,7 @@ asn1f_lookup_module(arg_t *arg, const char *module_name, asn1p_oid_t *oid) {
asn1p_expr_t
*
asn1f_lookup_symbol
(
arg_t
*
arg
,
asn1p_module_t
*
mod
,
asn1p_ref_t
*
ref
)
{
asn1p_expr_t
*
ref_tc
;
/* Referenced tc */
asn1p_module_t
*
src_mod
;
asn1p_module_t
*
imports_from
;
char
*
modulename
;
char
*
identifier
;
...
...
@@ -188,8 +187,8 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
* fetch that module.
*/
if
(
modulename
)
{
src_mod
=
asn1f_lookup_module
(
arg
,
modulename
,
0
);
if
(
src_mod
==
NULL
)
{
imports_from
=
asn1f_lookup_module
(
arg
,
modulename
,
0
);
if
(
imports_from
==
NULL
)
{
FATAL
(
"Module
\"
%s
\"
"
"mentioned at line %d is not found"
,
modulename
,
ref
->
_lineno
);
...
...
@@ -200,13 +199,13 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
* Check that the EXPORTS section of this module contains
* the symbol we care about, or it is EXPORTS ALL.
*/
if
(
asn1f_compatible_with_exports
(
arg
,
src_mod
,
identifier
))
{
if
(
asn1f_compatible_with_exports
(
arg
,
imports_from
,
identifier
))
{
errno
=
EPERM
;
return
NULL
;
}
}
else
{
src_mod
=
asn1f_lookup_in_imports
(
arg
,
identifier
);
if
(
src_mod
==
NULL
&&
errno
!=
ESRCH
)
{
imports_from
=
asn1f_lookup_in_imports
(
arg
,
mod
,
identifier
);
if
(
imports_from
==
NULL
&&
errno
!=
ESRCH
)
{
/*
* Return only of the name was not found.
* If module was not found or more serious error
...
...
@@ -216,12 +215,28 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
}
}
if
(
src_mod
==
0
)
src_mod
=
mod
;
/*
* The symbol is being imported from another module.
*/
if
(
imports_from
)
{
asn1p_ref_t
tmpref
=
*
ref
;
if
(
modulename
)
{
/*
* The modulename is specified inside this reference.
* To avoid recursion, reformat the reference
* as it were local to that module.
*/
tmpref
.
components
++
;
/* Hide the first element */
tmpref
.
comp_count
--
;
assert
(
tmpref
.
comp_count
>
0
);
}
return
asn1f_lookup_symbol
(
arg
,
imports_from
,
&
tmpref
);
}
/*
* Now we know where to search for a value.
* Now we know where to search for a value
: in the current module
.
*/
TQ_FOR
(
ref_tc
,
&
(
src_
mod
->
members
),
next
)
{
TQ_FOR
(
ref_tc
,
&
(
mod
->
members
),
next
)
{
if
(
ref_tc
->
Identifier
)
if
(
strcmp
(
ref_tc
->
Identifier
,
identifier
)
==
0
)
break
;
...
...
@@ -229,7 +244,7 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
if
(
ref_tc
==
NULL
)
{
DEBUG
(
"Module
\"
%s
\"
does not contain
\"
%s
\"
"
"mentioned at line %d: %s"
,
src_
mod
->
Identifier
,
mod
->
Identifier
,
identifier
,
ref
->
_lineno
,
strerror
(
errno
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment