20infile_name = sys.argv[1]
21id_out_name = sys.argv[2]
22name_out_name = sys.argv[3]
23txt_out_name = sys.argv[4]
24instrict_name = sys.argv[5]
25strict_out_name = sys.argv[6]
31with open(infile_name)
as infile:
35 line = line.split(
'#')[0]
39 m = re.match(
r'([a-zA-Z][a-zA-Z0-9]*)\s+([a-zA-Z0-9-.:\/]+)\s*$', line)
41 sys.exit(
'Invalid character in input data: ' + line)
42 namespaces[m.group(1)] = m.group(2)
47with open(instrict_name)
as infile_strict:
48 for line
in infile_strict:
51 line = line.split(
'#')[0]
55 m = re.match(
r'([a-zA-Z][a-zA-Z0-9]*)\s+([a-zA-Z0-9-.:\/]+)\s*$', line)
57 sys.exit(
"Error: invalid character in input data: " + line)
58 namespaces_strict[m.group(1)] = m.group(2)
62idfile = open(id_out_name,
'w')
63namefile = open(name_out_name,
'w')
64txtfile = open(txt_out_name,
'w')
65namefile_strict = open(strict_out_name,
'w')
70idfile.write(
"const size_t NMSP_SHIFT = {};\n".format(shift))
73for token
in sorted(namespaces.keys()):
74 idfile.write(
"const sal_Int32 NMSP_{} = {} << NMSP_SHIFT;\n".format(token, i))
76 namefile.write(
"{{ {}, \"{}\" }},\n".format(cur_id, namespaces[token]))
77 namefile_strict.write(
"{{ {}, \"{}\" }},\n".format(cur_id, namespaces_strict[token]))
78 txtfile.write(
"{} {} {}\n".format(cur_id, token, namespaces[token]))
79 txtfile.write(
"{} {} {}\n".format(cur_id, token, namespaces_strict[token]))
84namefile_strict.close()