better OID printing

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@807 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2005-03-18 03:53:05 +00:00
parent 4620b56472
commit 51c3de9934
25 changed files with 63 additions and 90 deletions

View File

@ -18,7 +18,7 @@
} while(0)
static int asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags);
static int asn1print_oid(asn1p_oid_t *oid, enum asn1print_flags flags);
static int asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags);
static int asn1print_ref(asn1p_ref_t *ref, enum asn1print_flags flags);
static int asn1print_tag(asn1p_expr_t *tc, enum asn1print_flags flags);
static int asn1print_params(asn1p_paramlist_t *pl,enum asn1print_flags flags);
@ -67,7 +67,7 @@ asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags)
printf("%s ", mod->Identifier);
if(mod->module_oid) {
asn1print_oid(mod->module_oid, flags);
asn1print_oid(strlen(mod->Identifier), mod->module_oid, flags);
printf("\n");
}
@ -116,8 +116,8 @@ asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags)
}
static int
asn1print_oid(asn1p_oid_t *oid, enum asn1print_flags flags) {
size_t accum = 0;
asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags) {
size_t accum = prior_len;
int ac;
(void)flags; /* Unused argument */
@ -126,23 +126,22 @@ asn1print_oid(asn1p_oid_t *oid, enum asn1print_flags flags) {
for(ac = 0; ac < oid->arcs_count; ac++) {
const char *arcname = oid->arcs[ac].name;
if(accum + strlen(arcname ? arcname : "") > 50) {
if(accum + strlen(arcname ? arcname : "") > 75) {
printf("\n\t");
accum = 0;
} else if(ac) {
printf(" ");
} else {
accum += printf(" ");
}
if(arcname) {
printf("%s", arcname);
accum += printf("%s", arcname);
if(oid->arcs[ac].number >= 0) {
printf("(%" PRIdASN ")", oid->arcs[ac].number);
accum += printf("(%" PRIdASN ")",
oid->arcs[ac].number);
}
accum += strlen(oid->arcs[ac].name);
} else {
printf("%" PRIdASN, oid->arcs[ac].number);
accum += printf("%" PRIdASN, oid->arcs[ac].number);
}
accum += 4;
}
printf(" }");

View File

@ -1,6 +1,5 @@
ModuleTestEnum2 {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
4 }
ModuleTestEnum2 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 4 }
DEFINITIONS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestInt1 {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
7 }
ModuleTestInt1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363)
software(1) asn1c(5) test(1) 7 }
DEFINITIONS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestResolver2 {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
14 1 }
ModuleTestResolver2 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 14 1 }
DEFINITIONS ::=
BEGIN
@ -19,9 +18,8 @@ check-other INTEGER ::= 1
END
ModuleTestResolver3 {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
14 2 }
ModuleTestResolver3 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 14 2 }
DEFINITIONS ::=
BEGIN
@ -34,9 +32,8 @@ Enumeration ::= ENUMERATED {
END
HiddenModule {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
14 3 }
HiddenModule { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363)
software(1) asn1c(5) test(1) 14 3 }
DEFINITIONS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestConstraint {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
16 }
ModuleTestConstraint { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 16 }
DEFINITIONS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestParam {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
19 }
ModuleTestParam { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 19 }
DEFINITIONS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestConstr {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
20 }
ModuleTestConstr { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 20 }
DEFINITIONS IMPLICIT TAGS EXTENSIBILITY IMPLIED ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestTags1 {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
21 1 }
ModuleTestTags1 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 21 1 }
DEFINITIONS EXPLICIT TAGS ::=
BEGIN
@ -11,9 +10,8 @@ T1 ::= CHOICE {
END
ModuleTestTags2 {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
21 2 }
ModuleTestTags2 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 21 2 }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestTags3 {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
22 }
ModuleTestTags3 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 22 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestBitString {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
23 }
ModuleTestBitString { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 23 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestSequence {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
24 }
ModuleTestSequence { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 24 }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestSetOfSimple {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
31 }
ModuleTestSetOfSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 31 }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestSequenceSimple {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
32 }
ModuleTestSequenceSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 32 }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestClassSimple {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
34 }
ModuleTestClassSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 34 }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestIndirectChoiceFine {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
37 }
ModuleTestIndirectChoiceFine { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 37 }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleLAPStorage {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
42 }
ModuleLAPStorage { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 42 }
DEFINITIONS EXTENSIBILITY IMPLIED ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleKnownExternType {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
45 }
ModuleKnownExternType { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 45 }
DEFINITIONS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleSetChoiceExtensibility {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
49 }
ModuleSetChoiceExtensibility { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 49 }
DEFINITIONS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestComponentsOf {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
55 }
ModuleTestComponentsOf { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 55 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestParam {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
58 }
ModuleTestParam { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 58 }
DEFINITIONS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestANY {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
60 }
ModuleTestANY { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363)
software(1) asn1c(5) test(1) 60 }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestANYSyntax {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
62 }
ModuleTestANYSyntax { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 62 }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestXERDecoding {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
70 }
ModuleTestXERDecoding { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 70 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

View File

@ -1,6 +1,5 @@
ModuleTestIntegerAndEnumeratedConstraints {iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1)
74 }
ModuleTestIntegerAndEnumeratedConstraints { iso org(3) dod(6) internet(1)
private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 74 }
DEFINITIONS ::=
BEGIN