2 # FIPS assembly language preprocessor
3 # Renames all symbols in the file to
4 # their modified fips versions.
10 my $target = shift @ARGS;
14 if ($ARGS[0] eq "norunasm")
22 $enabled = 1 if $ENV{FIPSCANISTERINTERNAL} eq "y";
24 if ($enabled == 0 && $runasm)
31 # Open symbol rename file.
32 open(IN, "$top/fips/fipssyms.h") || die "Can't open fipssyms.h";
34 # Skip to assembler symbols
40 # Store all renames [noting minimal length].
44 if (/^#define\s+_?(\w+)\s+_?(\w+)\b/)
48 $minlen = $len if ($len<$minlen);
52 open(IN,"$target") || die "Can't open $target for reading";
54 @code = <IN>; # suck in whole file
58 open(OUT,">$target") || die "Can't open $target for writing";
62 $line =~ s/\b(_?)(\w{$minlen,})\b/$1.($edits{$2} or $2)/geo;
75 die "Error executing assembler!" if $rv != 0;