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
97bdee2d
Commit
97bdee2d
authored
Jun 28, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-fknown-extern-type support
parent
8aba2c12
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
8 deletions
+95
-8
libasn1fix/asn1fix.h
libasn1fix/asn1fix.h
+6
-0
libasn1fix/asn1fix_dereft.c
libasn1fix/asn1fix_dereft.c
+12
-2
libasn1fix/asn1fix_internal.h
libasn1fix/asn1fix_internal.h
+4
-0
libasn1fix/asn1fix_misc.c
libasn1fix/asn1fix_misc.c
+57
-1
libasn1fix/asn1fix_misc.h
libasn1fix/asn1fix_misc.h
+5
-0
libasn1fix/asn1fix_retrieve.c
libasn1fix/asn1fix_retrieve.c
+11
-5
No files found.
libasn1fix/asn1fix.h
View file @
97bdee2d
...
...
@@ -27,4 +27,10 @@ int asn1f_process(asn1p_t *_asn,
enum
asn1f_flags
,
void
(
*
error_log_callback
)(
int
_severity
,
const
char
*
fmt
,
...));
/*
* Explicitly mark type as known.
*/
int
asn1f_make_known_external_type
(
const
char
*
);
#endif
/* ASN1FIX_H */
libasn1fix/asn1fix_dereft.c
View file @
97bdee2d
...
...
@@ -28,9 +28,19 @@ asn1f_fix_dereference_types(arg_t *arg) {
*/
type_expr
=
asn1f_find_terminal_type
(
arg
,
expr
,
0
);
if
(
type_expr
==
NULL
)
{
const
char
*
type_name
;
if
(
errno
==
EEXIST
)
{
/* Ignore missing type
* if known to be defined externally:
* -fknown-extern-type=<name>
*/
return
0
;
}
type_name
=
asn1f_printable_reference
(
expr
->
reference
);
FATAL
(
"Unknown type
\"
%s
\"
referenced by
\"
%s
\"
at line %d"
,
asn1f_printable_reference
(
expr
->
reference
),
expr
->
Identifier
,
expr
->
_lineno
);
type_name
,
expr
->
Identifier
,
expr
->
_lineno
);
return
-
1
;
}
...
...
libasn1fix/asn1fix_internal.h
View file @
97bdee2d
#ifndef _ASN1FIX_INTERNAL_H_
#define _ASN1FIX_INTERNAL_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/*
* System headers required in various modules.
*/
...
...
libasn1fix/asn1fix_misc.c
View file @
97bdee2d
#include "asn1fix_internal.h"
#include "asn1fix.h"
char
const
*
asn1f_printable_reference
(
asn1p_ref_t
*
ref
)
{
...
...
@@ -274,3 +274,59 @@ asn1f_count_children(asn1p_expr_t *expr) {
return
count
;
}
static
char
**
known_types
;
static
int
known_types_count
;
static
int
known_types_size
;
static
int
_known_types_cmp
(
const
void
*
ap
,
const
void
*
bp
)
{
const
char
*
a
=
*
(
const
char
*
const
*
)
ap
;
const
char
*
b
=
*
(
const
char
*
const
*
)
bp
;
return
strcmp
(
a
,
b
);
}
int
asn1f_make_known_external_type
(
const
char
*
type_name
)
{
char
*
tname
;
/* Check for duplicates */
if
(
asn1f_check_known_external_type
(
type_name
)
==
0
)
{
errno
=
EEXIST
;
return
-
1
;
}
/* Ensure enough space */
if
(
known_types_count
<=
known_types_size
)
{
int
n
=
known_types_size
?
known_types_size
<<
1
:
4
;
void
*
p
;
p
=
realloc
(
known_types
,
n
*
sizeof
(
known_types
[
0
]));
if
(
!
p
)
return
-
1
;
known_types
=
p
;
known_types_size
=
n
;
}
tname
=
strdup
(
type_name
);
if
(
!
tname
)
return
-
1
;
known_types
[
known_types_count
++
]
=
tname
;
#ifdef HAVE_MERGESORT
mergesort
#else
qsort
#endif
(
known_types
,
known_types_count
,
sizeof
(
known_types
[
0
]),
_known_types_cmp
);
return
0
;
}
int
asn1f_check_known_external_type
(
const
char
*
type_name
)
{
void
*
p
=
bsearch
(
&
type_name
,
known_types
,
known_types_count
,
sizeof
(
known_types
[
0
]),
_known_types_cmp
);
if
(
p
)
return
0
;
errno
=
ESRCH
;
return
-
1
;
}
libasn1fix/asn1fix_misc.h
View file @
97bdee2d
...
...
@@ -44,4 +44,9 @@ int asn1f_check_unique_expr_child(arg_t *arg, asn1p_expr_t *child,
*/
int
asn1f_count_children
(
asn1p_expr_t
*
parent
);
/*
* Check if type is explicitly known.
*/
int
asn1f_check_known_external_type
(
const
char
*
);
#endif
/* _ASN1FIX_MISC_H_ */
libasn1fix/asn1fix_retrieve.c
View file @
97bdee2d
...
...
@@ -228,12 +228,17 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_ref_t *ref, asn1p_module_t **module_r) {
}
if
(
ref_tc
==
NULL
)
{
DEBUG
(
"Module
\"
%s
\"
does not contain
\"
%s
\"
"
"mentioned at line %d"
,
"mentioned at line %d
: %s
"
,
src_mod
->
Identifier
,
identifier
,
ref
->
_lineno
ref
->
_lineno
,
strerror
(
errno
)
);
errno
=
ESRCH
;
if
(
asn1f_check_known_external_type
(
identifier
)
==
0
)
{
errno
=
EEXIST
;
/* Exists somewhere */
}
else
{
errno
=
ESRCH
;
}
return
NULL
;
}
...
...
@@ -312,8 +317,9 @@ asn1f_find_terminal_thing(arg_t *arg, asn1p_expr_t *expr,
*/
tc
=
asn1f_lookup_symbol
(
arg
,
ref
,
&
mod
);
if
(
tc
==
NULL
)
{
DEBUG
(
"
\t
Symbol
\"
%s
\"
not found"
,
asn1f_printable_reference
(
ref
));
DEBUG
(
"
\t
Symbol
\"
%s
\"
not found: %s"
,
asn1f_printable_reference
(
ref
),
strerror
(
errno
));
return
NULL
;
}
...
...
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