summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-07-01 12:43:59 -0600
committerKarl Williamson <khw@cpan.org>2018-07-05 14:47:18 -0600
commitc05125c57fd7868af65366bacb6fe40c04b1c719 (patch)
treee985aa77d5abf8cf39a464fe1efb8fa8e31e67cb /regen
parentf91173ad5a2134421b5148cb6d4b0e5570fb3715 (diff)
downloadperl-c05125c57fd7868af65366bacb6fe40c04b1c719.tar.gz
regen/ebcdic.pl: Add declaration of generated tables
This adds code to declare and define the tables only under DOINIT, and otherwise to just declare them. This allows the includer to not have to deal with them at all.
Diffstat (limited to 'regen')
-rw-r--r--regen/ebcdic.pl10
1 files changed, 8 insertions, 2 deletions
diff --git a/regen/ebcdic.pl b/regen/ebcdic.pl
index c979305b9f..56611cb2b4 100644
--- a/regen/ebcdic.pl
+++ b/regen/ebcdic.pl
@@ -22,7 +22,13 @@ sub output_table ($$;$) {
die "Requres 256 entries in table $name, got @$table_ref" if @$table_ref != 256;
- print $out_fh "EXTCONST U8 $name\[\] = {\n";
+ my $declaration = "EXTCONST U8 $name\[\]";
+ print $out_fh <<EOF;
+# ifndef DOINIT
+# $declaration;
+# else
+# $declaration = {
+EOF
my $column_numbers= "/*_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F*/\n";
print $out_fh $column_numbers if $print_in_hex;
@@ -40,7 +46,7 @@ sub output_table ($$;$) {
print $out_fh "\n" if $i % 16 == 15;
}
print $out_fh $column_numbers if $print_in_hex;
- print $out_fh "};\n\n";
+ print $out_fh "};\n# endif\n\n";
}
print $out_fh <<END;