From 51c3de9934f74616c8717ddd1ab2d0e9dcdf2dca Mon Sep 17 00:00:00 2001 From: vlm Date: Fri, 18 Mar 2005 03:53:05 +0000 Subject: [PATCH] better OID printing git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@807 59561ff5-6e30-0410-9f3c-9617f08c8826 --- libasn1print/asn1print.c | 23 +++++++++--------- tests/04-enum-SE.asn1.-E | 5 ++-- tests/07-int-OK.asn1.-EF | 5 ++-- tests/14-resolver-OK.asn1.-EF | 15 +++++------- tests/16-constraint-OK.asn1.-EF | 5 ++-- tests/19-param-OK.asn1.-EF | 5 ++-- tests/20-constr-OK.asn1.-EF | 5 ++-- tests/21-tags-OK.asn1.-EF | 10 +++----- tests/22-tags-OK.asn1.-EF | 5 ++-- tests/23-bits-OK.asn1.-EF | 5 ++-- tests/24-sequence-OK.asn1.-EF | 5 ++-- tests/31-set-of-OK.asn1.-EF | 5 ++-- tests/32-sequence-of-OK.asn1.-EF | 5 ++-- tests/34-class-OK.asn1.-EF | 5 ++-- tests/37-indirect-choice-OK.asn1.-EF | 5 ++-- tests/42-real-life-OK.asn1.-EF | 5 ++-- ...ype-SE.asn1.-EFfknown-extern-type=KnownExt | 5 ++-- tests/49-real-life-OK.asn1.-E | 5 ++-- ...50-constraint-OK.asn1.-EFprint-constraints | Bin 7548 -> 7548 bytes tests/55-components-of-OK.asn1.-EF | 5 ++-- tests/58-param-OK.asn1.-EF | 5 ++-- tests/60-any-OK.asn1.-EF | 5 ++-- tests/62-any-OK.asn1.-EF | 5 ++-- tests/70-xer-test-OK.asn1.-EF | 5 ++-- ...m-constraints-OK.asn1.-EFprint-constraints | 5 ++-- 25 files changed, 63 insertions(+), 90 deletions(-) diff --git a/libasn1print/asn1print.c b/libasn1print/asn1print.c index 43a3a0d6..abef0b5e 100644 --- a/libasn1print/asn1print.c +++ b/libasn1print/asn1print.c @@ -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(" }"); diff --git a/tests/04-enum-SE.asn1.-E b/tests/04-enum-SE.asn1.-E index 19b431cc..2036bd54 100644 --- a/tests/04-enum-SE.asn1.-E +++ b/tests/04-enum-SE.asn1.-E @@ -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 diff --git a/tests/07-int-OK.asn1.-EF b/tests/07-int-OK.asn1.-EF index 3b93cd37..86ee7f84 100644 --- a/tests/07-int-OK.asn1.-EF +++ b/tests/07-int-OK.asn1.-EF @@ -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 diff --git a/tests/14-resolver-OK.asn1.-EF b/tests/14-resolver-OK.asn1.-EF index 31793f22..2ab60ee2 100644 --- a/tests/14-resolver-OK.asn1.-EF +++ b/tests/14-resolver-OK.asn1.-EF @@ -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 diff --git a/tests/16-constraint-OK.asn1.-EF b/tests/16-constraint-OK.asn1.-EF index 61d81227..9fae28c7 100644 --- a/tests/16-constraint-OK.asn1.-EF +++ b/tests/16-constraint-OK.asn1.-EF @@ -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 diff --git a/tests/19-param-OK.asn1.-EF b/tests/19-param-OK.asn1.-EF index f2daaf39..c5792127 100644 --- a/tests/19-param-OK.asn1.-EF +++ b/tests/19-param-OK.asn1.-EF @@ -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 diff --git a/tests/20-constr-OK.asn1.-EF b/tests/20-constr-OK.asn1.-EF index fe61cfec..798f756e 100644 --- a/tests/20-constr-OK.asn1.-EF +++ b/tests/20-constr-OK.asn1.-EF @@ -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 diff --git a/tests/21-tags-OK.asn1.-EF b/tests/21-tags-OK.asn1.-EF index 857c581f..566e6a1e 100644 --- a/tests/21-tags-OK.asn1.-EF +++ b/tests/21-tags-OK.asn1.-EF @@ -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 diff --git a/tests/22-tags-OK.asn1.-EF b/tests/22-tags-OK.asn1.-EF index 50fce1e8..b1a0b8c4 100644 --- a/tests/22-tags-OK.asn1.-EF +++ b/tests/22-tags-OK.asn1.-EF @@ -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 diff --git a/tests/23-bits-OK.asn1.-EF b/tests/23-bits-OK.asn1.-EF index 45ff4da7..80648156 100644 --- a/tests/23-bits-OK.asn1.-EF +++ b/tests/23-bits-OK.asn1.-EF @@ -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 diff --git a/tests/24-sequence-OK.asn1.-EF b/tests/24-sequence-OK.asn1.-EF index e45e04ae..ecdc4b09 100644 --- a/tests/24-sequence-OK.asn1.-EF +++ b/tests/24-sequence-OK.asn1.-EF @@ -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 diff --git a/tests/31-set-of-OK.asn1.-EF b/tests/31-set-of-OK.asn1.-EF index 2efaccc5..f97ce2a3 100644 --- a/tests/31-set-of-OK.asn1.-EF +++ b/tests/31-set-of-OK.asn1.-EF @@ -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 diff --git a/tests/32-sequence-of-OK.asn1.-EF b/tests/32-sequence-of-OK.asn1.-EF index 3697ef12..9809141b 100644 --- a/tests/32-sequence-of-OK.asn1.-EF +++ b/tests/32-sequence-of-OK.asn1.-EF @@ -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 diff --git a/tests/34-class-OK.asn1.-EF b/tests/34-class-OK.asn1.-EF index 52ba8670..d0e379fe 100644 --- a/tests/34-class-OK.asn1.-EF +++ b/tests/34-class-OK.asn1.-EF @@ -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 diff --git a/tests/37-indirect-choice-OK.asn1.-EF b/tests/37-indirect-choice-OK.asn1.-EF index 4f8c80b7..89668156 100644 --- a/tests/37-indirect-choice-OK.asn1.-EF +++ b/tests/37-indirect-choice-OK.asn1.-EF @@ -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 diff --git a/tests/42-real-life-OK.asn1.-EF b/tests/42-real-life-OK.asn1.-EF index 6b5249d8..0543ee32 100644 --- a/tests/42-real-life-OK.asn1.-EF +++ b/tests/42-real-life-OK.asn1.-EF @@ -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 diff --git a/tests/45-undefined-type-SE.asn1.-EFfknown-extern-type=KnownExt b/tests/45-undefined-type-SE.asn1.-EFfknown-extern-type=KnownExt index 99dcd60f..994a8901 100644 --- a/tests/45-undefined-type-SE.asn1.-EFfknown-extern-type=KnownExt +++ b/tests/45-undefined-type-SE.asn1.-EFfknown-extern-type=KnownExt @@ -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 diff --git a/tests/49-real-life-OK.asn1.-E b/tests/49-real-life-OK.asn1.-E index e3d9d351..71677687 100644 --- a/tests/49-real-life-OK.asn1.-E +++ b/tests/49-real-life-OK.asn1.-E @@ -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 diff --git a/tests/50-constraint-OK.asn1.-EFprint-constraints b/tests/50-constraint-OK.asn1.-EFprint-constraints index b1b6e0ec1a0125bdd7ead6d58029632774d2fb8f..a3adae02709abd0df3e2fcb34f5a9e1f5fcbd29b 100644 GIT binary patch delta 50 zcmexk^~Y+09HYWSxkN^Vjg5=NK}-z+h19%~)S`l-%;HoHLrpHu$uSa|j0&6ECBCu% E0IXLJ^8f$< delta 27 ecmexk^~Y+0+(h|ACN9p6jf=%0tj+BbUs(W?1PPu1 diff --git a/tests/55-components-of-OK.asn1.-EF b/tests/55-components-of-OK.asn1.-EF index 1ace8593..3251d432 100644 --- a/tests/55-components-of-OK.asn1.-EF +++ b/tests/55-components-of-OK.asn1.-EF @@ -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 diff --git a/tests/58-param-OK.asn1.-EF b/tests/58-param-OK.asn1.-EF index 168b0577..c07b79d4 100644 --- a/tests/58-param-OK.asn1.-EF +++ b/tests/58-param-OK.asn1.-EF @@ -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 diff --git a/tests/60-any-OK.asn1.-EF b/tests/60-any-OK.asn1.-EF index 064a0b9f..520c6c9f 100644 --- a/tests/60-any-OK.asn1.-EF +++ b/tests/60-any-OK.asn1.-EF @@ -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 diff --git a/tests/62-any-OK.asn1.-EF b/tests/62-any-OK.asn1.-EF index a7917fc7..0316412e 100644 --- a/tests/62-any-OK.asn1.-EF +++ b/tests/62-any-OK.asn1.-EF @@ -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 diff --git a/tests/70-xer-test-OK.asn1.-EF b/tests/70-xer-test-OK.asn1.-EF index e40e679a..ecc23096 100644 --- a/tests/70-xer-test-OK.asn1.-EF +++ b/tests/70-xer-test-OK.asn1.-EF @@ -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 diff --git a/tests/74-int-enum-constraints-OK.asn1.-EFprint-constraints b/tests/74-int-enum-constraints-OK.asn1.-EFprint-constraints index 1776279d..45cb5156 100644 --- a/tests/74-int-enum-constraints-OK.asn1.-EFprint-constraints +++ b/tests/74-int-enum-constraints-OK.asn1.-EFprint-constraints @@ -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