diff options
Diffstat (limited to 'support/splint/scripts/unline.pl')
-rwxr-xr-x | support/splint/scripts/unline.pl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/support/splint/scripts/unline.pl b/support/splint/scripts/unline.pl new file mode 100755 index 0000000000..5349156cb4 --- /dev/null +++ b/support/splint/scripts/unline.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +# a simple script to remove comments and #line directives left by CTANGLE +# this allows one to build Makefiles and linker scripts from inside CWEB +# by making a few simple changes to the macros (to facilitate typeseting) +# and using CWEB's @= ... @> facility. + +open FILE, "$ARGV[0]" or die "Cannot open input file $ARGV[0]\n"; +open FILEOUT, ">$ARGV[1]" or die "Cannot open output file $ARGV[1]\n"; + +while (<FILE>) { + + $inline = $_; + + s/^(\#line.*)\n$//g; + + if ( $ARGV[2] != 3 ) { + + s/\/\*.*\*\///g; + + } + + printf FILEOUT "%s", "$_"; + +# if ( m/^.*\S.*\n$/ ) { + +# printf FILEOUT "%s", "$_"; + +# } + +} |