diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/splint/scripts/unline.pl |
Initial commit
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", "$_"; + +# } + +} |