Commit a13a5ab0 authored by Michele Berionne's avatar Michele Berionne
Browse files

Update tools/extract_asn1.py

parent ca9e7cea
Loading
Loading
Loading
Loading

tools/extract_asn1.py

0 → 100644
+23 −0
Original line number Diff line number Diff line
# Script to extract complete ASN.1 code from ETSI TS 103 666 series of specifications
# Steps to run:
# 1. Download the specification as a word document and open it
# 2. In "view" menu, select draft or web layout (needed to removed page header and footers)
# 3. Save the document as a text file
#      If requested, select "Text ending: MS-DOS" and "End lines with: CR only"
# 4. Call the script: python extract_asn1.py "<text_file>"
# The script generates ETSI_TS_103_666_asn1_definitions.asn
import sys

inFile = open(sys.argv[1])
outFile = open("ETSI_TS_103_666_asn1_definitions.asn", "w")

copy = False
for line in inFile:
    if line.strip() == "-- ASN1START":
        copy = True
    elif line.strip() == "-- ASN1STOP":
        copy = False
    elif copy:
        outFile.write(line)
inFile.close()
outFile.close()