+2004-10-06 Ken Raeburn <raeburn@mit.edu>
+
+ * et_c.awk, et_h.awk: Complain if the error table is too large.
+ * et_c.pl, et_h.pl: Regenerated.
+
2004-07-03 Ken Raeburn <raeburn@mit.edu>
* error_message.c (remove_error_table) [!ENABLE_THREADS &&
skipone=0
}
END {
+ if (table_item_count > 255) {
+ print "Error table too large!" | "cat 1>&2"
+ exit 1
+ }
print " 0" > outfile
print "};" > outfile
print "" > outfile
&Pick('>', $outfile) &&
(print $fh '');
&Pick('>', $outfile) &&
- (print $fh
-
- '#if !defined(_WIN32)');
+ (print $fh '#if !defined(_WIN32)');
&Pick('>', $outfile) &&
(print $fh 'extern void initialize_' . $table_name .
$skipone = 0;
}
+if ($table_item_count > 255) {
+ &Pick('|', 'cat 1>&2') &&
+ (print $fh 'Error table too large!');
+ exit 1;
+}
&Pick('>', $outfile) &&
(print $fh ' 0');
&Pick('>', $outfile) &&
&Pick('>', $outfile) &&
(print $fh '');
&Pick('>', $outfile) &&
- (print $fh
-
- '#if !defined(_WIN32)');
+ (print $fh '#if !defined(_WIN32)');
&Pick('>', $outfile) &&
(print $fh 'void initialize_' . $table_name . '_error_table (void)');
&Pick('>', $outfile) &&
&Pick('>', $outfile) &&
(print $fh '#endif');
+exit $ExitValue;
+
sub Pick {
local($mode,$name,$pipe) = @_;
$fh = $name;
}
END {
+ if (table_item_count > 255) {
+ print "Error table too large!" | "cat 1>&2"
+ exit 1
+ }
if (tab_base_high == 0) {
print "#define ERROR_TABLE_BASE_" table_name " (" \
sprintf("%d", tab_base_sign*tab_base_low) \
}
}
+if ($table_item_count > 255) {
+ &Pick('|', 'cat 1>&2') &&
+ (print $fh 'Error table too large!');
+ exit 1;
+}
if ($tab_base_high == 0) {
&Pick('>', $outfile) &&
(print $fh '#define ERROR_TABLE_BASE_' . $table_name . ' (' .
&Pick('>', $outfile) &&
(print $fh '');
&Pick('>', $outfile) &&
- (print $fh 'extern struct error_table et_' . $table_name .
+ (print $fh 'extern const struct error_table et_' . $table_name .
'_error_table;');
&Pick('>', $outfile) &&
(print $fh '');
&Pick('>', $outfile) &&
- (print $fh
-
- '#if !defined(_WIN32)');
+ (print $fh '#if !defined(_WIN32)');
&Pick('>', $outfile) &&
(print $fh '/* for compatibility with older versions... */');
&Pick('>', $outfile) &&
(print $fh 'extern void initialize_' . $table_name .
'_error_table () /*@modifies internalState@*/;');
+&Pick('>', $outfile) &&
+ (print $fh '#else');
+&Pick('>', $outfile) &&
+ (print $fh '#define initialize_' . $table_name . '_error_table()');
+&Pick('>', $outfile) &&
+ (print $fh '#endif');
+&Pick('>', $outfile) &&
+ (print $fh '');
+&Pick('>', $outfile) &&
+ (print $fh '#if !defined(_WIN32)');
&Pick('>', $outfile) &&
(print $fh '#define init_' . $table_name . '_err_tbl initialize_' .
(print $fh '#define ' . $table_name . '_err_base ERROR_TABLE_BASE_' .
$table_name);
-&Pick('>', $outfile) &&
- (print $fh '#else');
-&Pick('>', $outfile) &&
- (print $fh '#define initialize_' . $table_name . '_error_table()');
&Pick('>', $outfile) &&
(print $fh '#endif');
+exit $ExitValue;
+
sub Pick {
local($mode,$name,$pipe) = @_;
$fh = $name;