]> nuage.metani.fr Git - 3GPP.git/blobdiff - awk/txt2asn.awk
txt2asn-integrated: Usable on GNU/Linux, still needs cygwin checking.
[3GPP.git] / awk / txt2asn.awk
old mode 100644 (file)
new mode 100755 (executable)
index 0c022e0..e949677
@@ -1,4 +1,4 @@
-#!/bin/gawk
+#!/bin/awk -f
 
 BEGIN {
     add_line_after != "" ;
@@ -15,8 +15,14 @@ BEGIN {
     }
 }
 
-/^[0-9]+\./ {
+# Section headers
+# This will also catch bits of Short Message description but that won't cause issues
+# A way not to catch those could be to check that the numbers are in sequence
+
+/^[0-9]+(\.[0-9]+)*\t/ {
     in_IE = "no" ;
+#    print "Titre" ;
+#    print ;
 }
 
 /^-- ASN1START/ {
@@ -34,6 +40,9 @@ BEGIN {
     next;
 }
 
+# Recording empty line (to avoid multiple empty lines)
+# Printing separators in some cases
+
 /^[[:space:]]*$/ {
 
      if (next_line == "condition") {
@@ -53,11 +62,15 @@ BEGIN {
 #    print ; 
 }
 
-/^–[[:space:]]+ParentIE-WithEM$/ {
+# Stopping before ASN.1 examples (end of specification)
+/^-[[:space:]]+ParentIE-WithEM$/ {
     exit 0 ;
 }
 
-/^–[[:space:]]+[A-Za-z0-9-]+$/ {
+# Start of IE definitions
+# This cannot catch "Multiplicity and type constraints"
+# This also cannot catch NR-InterNodeDefinitions
+/^-[[:space:]]+[A-Za-z0-9-]+$/ {
     if (empty_line == "yes") {
        print ie_separator;
        print "-- IE: " $2;
@@ -69,10 +82,42 @@ BEGIN {
     next ;
 }
 
+/^NR-InterNodeDefinitions/ {
+    if (empty_line == "yes") {
+       print ie_separator;
+       print "-- IE: NR-InterNodeDefinitions";
+       print "" ;
+       # Perhaps it could work without this if the "next" at the end is removed
+       print ;
+       empty_line = "no" ;
+       conditions = "" ;
+    }
+    in_IE = "yes" ;
+    next ;
+}
+
+
+# Sometimes there is an "s" to constraint, sometimes not
+/^-[[:space:]]+Multiplicity and type constraints? definitions$/ {
+    if (empty_line == "yes") {
+       print ie_separator;
+       print "-- IE: Constants";
+       empty_line = "no" ;
+       conditions = "" ;
+    }
+    in_IE = "yes" ;
+    next ;
+}
+
+#/^-[[:space:]]+Multiplicity and type constraints definitions/ {
+#    in_IE = "yes" ;
+#    next ;
+#}
+
 /^Conditional Presence/ {
     add_line_after = "";
     separator = "" ;
-
+    
     $0 = "Conditional presence" ;
     for(i=0;i<=140;i++) {
        separator = separator "-" ;