Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asn1c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
oai
asn1c
Commits
a2bf7240
Commit
a2bf7240
authored
20 years ago
by
Lev Walkin
Browse files
Options
Downloads
Patches
Plain Diff
real-lifing specs
parent
0634eb75
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/crfc2asn1.pl
+37
-10
37 additions, 10 deletions
examples/crfc2asn1.pl
with
37 additions
and
10 deletions
examples/crfc2asn1.pl
+
37
−
10
View file @
a2bf7240
...
...
@@ -11,6 +11,7 @@
my
$inasn
=
0
;
# Are we inside ASN.1 grammar?
my
$found
=
0
;
my
$currentFname
=
'';
if
(
-
t
STDIN
&&
$#ARGV
==
-
1
)
{
print
STDERR
"
Rip ASN.1 specification from RFC file
\n
";
...
...
@@ -35,6 +36,8 @@ while(<>) {
if
(
/^[ \t]*END[ \t]*$/
)
{
print
STDERR
"
Missed an ASN.1 grammar before line
"
.
$.
.
"
?
\n
";
unlink
(
$currentFile
)
or
die
"
Can't remove $!
";
print
STDERR
"
Removed
$currentFile
";
exit
(
1
);
}
...
...
@@ -42,12 +45,10 @@ while(<>) {
$rfcid
=
$
1
.
'
-
'
if
(
$ARGV
=~
/([a-z0-9]+)/i
);
if
(
/^[ \t]+([A-Za-z0-9-]+).*DEFINITIONS.*::=/
)
{
my
$fname
=
$rfcid
.
$
1
.
"
.asn1
";
open
(
O
,
"
>
$fname
")
or
die
"
Can't open
$fname
";
select
(
O
);
$currentFname
=
$rfcid
.
$
1
.
"
.asn1
";
$inasn
=
1
;
}
elsif
(
/^[ \t]*([A-Za-z0-9-]+).*{.*iso/
)
{
my
$f
name
=
$rfcid
.
$
1
.
"
.asn1
";
$currentF
name
=
$rfcid
.
$
1
.
"
.asn1
";
my
@a
=
(
$_
);
my
$i
;
for
(
$i
=
0
;
$i
<
8
;
$i
++
)
{
...
...
@@ -60,27 +61,53 @@ while(<>) {
}
}
next
unless
$inasn
;
open
(
O
,
"
>
$fname
")
or
die
"
Can't open
$fname
";
select
(
O
);
}
else
{
next
;
}
print
STDERR
"
Found $1 at line $. =>
$currentFname
\n
";
open
(
O
,
"
>
$currentFname
")
or
die
"
Can't open
$currentFname
";
select
(
O
);
$found
++
;
print
"
\n
";
print
"
--
\n
";
print
"
-- ASN.1 module found in
$ARGV
by $0 at
"
.
$.
.
"
\n
";
print
"
-- ASN.1 module found
by $0
in
$ARGV
at line
"
.
$.
.
"
\n
";
print
"
--
\n
";
print
"
\n
";
}
print
;
if
(
/^[ \t]*END[ \t]*$/
)
{
print
;
select
(
STDOUT
);
close
(
O
);
$inasn
=
0
;
next
;
}
#
# The following clauses are primarily designed to make
# asn1c command-line easier (i.e., to avoid "-ftypes88").
# You may want to get rid of them if you're doing generic
# ASN.1 extraction and do not want to alter the ASN.1 specs.
#
if
(
/^(.*)((UniversalString|BMPString|UTF8String)\s+::=\s+\[[A-Z]+\s\d+\]\sIMPLICIT\sOCTET\sSTRING)(.*)$/ms
)
{
print
"
\n
-- Legacy redefinition of $3 removed by $0:
\n
";
print
"
$1-- $2 -- $4
";
next
;
}
elsif
(
/delete following line if \"new\" types are supported/
)
{
print
;
print
"
/* Legacy stuff deleted by $0:
\n
";
$_
=
<>
;
print
;
print
"
*/
\n
";
next
;
}
print
;
# Dump the ASN.1 module line out.
}
die
"
No ASN.1
specification
s found
\n
"
unless
$found
;
die
"
No ASN.1
module
s found
\n
"
unless
$found
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment