3 ## "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
69 /^[ \t]*(error_table|et)[ \t]+[a-zA-Z][a-zA-Z0-9_]+/ {
73 for(i=1; i<=length(table_name); i++) {
74 table_number=(table_number*char_shift)+c2n[substr(table_name,i,1)]
76 # We start playing *_high, *low games here because the some
77 # awk programs do not have the necessary precision (sigh)
78 tab_base_low = table_number % mod_base
79 if (tab_base_low < 0) {
80 # Work around stupid bug in the ARM libm
81 tab_base_low = tab_base_low + mod_base
83 tab_base_high = int(table_number / mod_base)
86 # figure out: table_number_base=table_number*256
87 tab_base_low = tab_base_low * 256
88 tab_base_high = (tab_base_high * 256) + \
89 int(tab_base_low / mod_base)
90 tab_base_low = tab_base_low % mod_base
91 if (tab_base_low < 0) {
92 # Work around stupid bug in the ARM libm
93 tab_base_low = tab_base_low + mod_base
96 if (table_number > 128*256*256) {
97 # figure out: table_number_base -= 256*256*256*256
98 # sub_high, sub_low is 256*256*256*256
99 sub_low = 256*256*256 % mod_base
100 sub_high = int(256*256*256 / mod_base)
102 sub_low = sub_low * 256
103 sub_high = (sub_high * 256) + int(sub_low / mod_base)
104 sub_low = sub_low % mod_base
106 tab_base_low = sub_low - tab_base_low;
107 tab_base_high = sub_high - tab_base_high;
109 if (tab_base_low < 0) {
110 tab_base_low = tab_base_low + mod_base
114 curr_low = tab_base_low
115 curr_high = tab_base_high
116 curr_sign = tab_base_sign
118 print " * " outfile ":" > outfile
119 print " * This file is automatically generated; please do not edit it." > outfile
120 print " */" > outfile
124 /^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,/ {
125 tag=substr($2,1,length($2)-1)
126 if (curr_high == 0) {
127 printf "#define %-40s (%dL)\n", tag, \
128 curr_sign*curr_low > outfile
130 printf "#define %-40s (%d%06dL)\n", tag, curr_high*curr_sign, \
133 curr_low += curr_sign;
134 if (curr_low >= mod_base) {
135 curr_low -= mod_base;
145 print "extern void initialize_" table_name "_error_table(void);" > outfile
146 if (tab_base_high == 0) {
147 print "#define ERROR_TABLE_BASE_" table_name " (" \
148 sprintf("%d", tab_base_sign*tab_base_low) \
151 print "#define ERROR_TABLE_BASE_" table_name " (" \
152 sprintf("%d%06d", tab_base_sign*tab_base_high, \
153 tab_base_low) "L)" > outfile
156 print "/* for compatibility with older versions... */" > outfile
157 print "#define init_" table_name "_err_tbl initialize_" table_name "_error_table" > outfile
158 print "#define " table_name "_err_base ERROR_TABLE_BASE_" table_name > outfile