blob: 5349156cb483016aa0e7bf49683a348041cd5341 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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", "$_";
# }
}
|