From 2c73ed781e61b91e0aef104746e074d19b88e00c Mon Sep 17 00:00:00 2001 From: David Lecompte <3gpp@metani.eu> Date: Fri, 12 Jun 2026 14:58:49 +0200 Subject: [PATCH 1/1] txt2asn-integrated: Usable on GNU/Linux, still needs cygwin checking. --- awk/txt2asn-integrated.awk | 84 ++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 7 deletions(-) diff --git a/awk/txt2asn-integrated.awk b/awk/txt2asn-integrated.awk index 4077154..061f8f3 100755 --- a/awk/txt2asn-integrated.awk +++ b/awk/txt2asn-integrated.awk @@ -137,11 +137,21 @@ BEGIN { } -/^[0-9]+\./ { +/^[0-9]+(\.[0-9]+)*\t/ { if (in_IE == "yes") { asn1_print(); } in_IE = "no" ; } +/^[A-Za-z0-9-]+ message$/ { + # No need to print this + next; +} + +/^[A-Za-z0-9-]+ information element$/ { + # No need to print this + next; +} + /^-- ASN1START/ { print ""; in_ASN1 = "yes"; @@ -152,6 +162,7 @@ BEGIN { /^-- ASN1STOP/ { in_ASN1 = "no"; + direct_print = "no" ; next; } @@ -168,7 +179,9 @@ BEGIN { #print separator ; } - next_line = "" ; + if (next_line != "field description") { + next_line = "" ; + } # #if (empty_line == "yes") { # next; # } @@ -197,11 +210,11 @@ BEGIN { } -/^–[[:space:]]+ParentIE-WithEM$/ { +/^-[[:space:]]+ParentIE-WithEM$/ { exit 0 ; } -/^–[[:space:]]+[A-Za-z0-9-]+$/ { +/^-[[:space:]]+[A-Za-z0-9-]+$/ { asn1_print(); # if (empty_line == "yes") { @@ -220,6 +233,51 @@ BEGIN { next ; } +/^-[[:space:]]+Multiplicity and type constraints? definitions?$/ { + + #print "Trouvé" ; + if (in_IE == "yes") { + asn1_print(); + } + in_IE = "yes" ; + #print "Trouvé 2" ; + + # In this case, directly print ASN.1 without processing + direct_print = "yes" ; + + print ie_separator; + print "-- IE: Constants"; + print "" ; + empty_line = "no" ; + conditions = "" ; + + next ; +} + +/^-[[:space:]]+End of [A-Za-z0-9-]+$/ { + if (in_IE == "yes") { + asn1_print(); + } + in_IE = "yes" ; + empty_line = "no" ; + conditions = "" ; +} + +/^NR-InterNodeDefinitions/ { + + print ie_separator; + print "-- IE: NR-InterNodeDefinitions"; + print "" ; + print ; + + empty_line = "no" ; + conditions = "" ; + + in_IE = "no" ; + direct_print = "yes" ; + next ; +} + /^Conditional [Pp]resence/ { add_line_after = ""; separator = "" ; @@ -263,7 +321,7 @@ BEGIN { #} # This is matched for any non-empty line -/^[A-Za-z0-9-]+/ { +/[A-Za-z0-9-]+/ { if ((in_IE == "yes") && (in_ASN1 == "no")){ @@ -338,6 +396,11 @@ BEGIN { } } } + + else if ((in_ASN1 == "yes") && (direct_print == "yes")) { + print ; + next ; + } } #/^[A-Za-z0-9-]+/ { @@ -406,7 +469,11 @@ BEGIN { if((line_number==0) && (/^[[:space:]]*$/)) { next ; } line_number++; text[line_number] = $0; - + + if (/Multiplicity/) { + print "Trouvé 3"; + print $0; + } #print "text[" line_number "] est " text[line_number]; if (/^[A-Za-z0-9-]+[[:space:]]+:/) { # remove suffix @@ -482,6 +549,9 @@ BEGIN { if (/-- Cond [A-Za-z0-9_-]+$/) { conditions = conditions " " $NF ; } - } + } + else if ((in_ASN1 == "yes") && (direct_print == "yes")) { + print ; + } } -- 2.47.3