3 """ This script is used to generate built-in string tables for dos.library
4 They use very own format which is impossible to generate with FlexCat.
11 while line
.startswith(';'):
12 line
= fhandle
.readline()
14 return line
.rstrip('\n')
18 fhandle
= open(sys
.argv
[1], 'r')
23 id_line
= getline(fhandle
)
24 str_line
= getline(fhandle
)
25 if (id_line
== "") or (str_line
== ""):
31 tmp
= tmp
[1].split('(')
32 tmp
= tmp
[1].split('/')
33 numbers
.append(tmp
[0])
35 strings
.append(str_line
)
37 print "/* This file is automatically generated! Do not edit! */"
41 print " * Error codes index table."
42 print " * This table actually consists of pairs of values (begin, end)."
43 print " * One string in the table below corresponds to one error code"
44 print " * from the specified interval."
45 print " * The table is terminated by two zeros."
46 print " * This layout was recreated based on locale.library code brought from MorphOS."
48 print "const ULONG err_Numbers[] ="
53 while n
< len(numbers
) - 1:
54 prev
= int(numbers
[n
])
56 if int(numbers
[n
]) == prev
+ 1:
59 print " %s, %s," % (first
, last
)
67 print " * Strings follow each other."
68 print " * Every string is prefixed by length byte in BCPL manner. NULL terminator is counted too."
70 print "const char err_Strings[] ="
72 for str_line
in strings
:
73 print " %d," % (len(str_line
) + 1)
81 if __name__
== "__main__":