diff --git a/Makefile b/Makefile index 7490050..d1f226a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PACKAGE := pcpp VERSION := 0.8 AUTHOR := R.Jaksa 2008,2024 GPLv3 -SUBVERSION := +SUBVERSION := a SHELL := /bin/bash PATH := usr/bin:$(PATH) @@ -13,7 +13,6 @@ DATE := $(shell date '+%Y-%m-%d') BIN := pcpp uninclude DEP := $(BIN:%=.%.d) DOC := $(BIN:%=doc/%.md) -#BDEP := $(shell usr/bin/pcpp -lp $(BIN:%=%.pl)) all: $(BIN) $(DOC) diff --git a/NEWS b/NEWS index 7b8faf7..6242eb9 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - better -l output 0.8 - raised version number to be above perlpp - added -d to generate Makefile dependencies lists 0.1 - rewritten simplified preprocessor diff --git a/doc/pcpp.md b/doc/pcpp.md index b9da2cf..6d0b217 100644 --- a/doc/pcpp.md +++ b/doc/pcpp.md @@ -12,7 +12,8 @@ Simple Perl/Python/C/C++ preprocessor for in-comment directives. ### OPTIONS -h This help. -v Verbose, -vv for more verbose. - -l Just list files to include, -l1/lp for level1 or paths. + -l List all files to be used, without producing actual output. + -ln Plain list of files to be included, -l1/lp for level1 or paths. -dd Print a list of dependencies (input file plus included ones). -d TGT Generate dependencies list for Makefile for the TGT target. -e DIR Exclude directory from a search, multiple -e possible. @@ -57,5 +58,5 @@ Simple Perl/Python/C/C++ preprocessor for in-comment directives. pcpp -d pcpp pcpp.pl > .pcpp.d ### VERSION -pcpp-0.8 R.Jaksa 2008,2024 GPLv3 +pcpp-0.8a R.Jaksa 2008,2024 GPLv3 diff --git a/doc/uninclude.md b/doc/uninclude.md index 8e8521b..0939341 100644 --- a/doc/uninclude.md +++ b/doc/uninclude.md @@ -16,5 +16,5 @@ but they are flattened to a single level direct includes. -ni Don't return back #include statements. ### VERSION -pcpp-0.8 R.Jaksa 2008,2024 GPLv3 +pcpp-0.8a R.Jaksa 2008,2024 GPLv3 diff --git a/include.pl b/include.pl index a719529..3412008 100644 --- a/include.pl +++ b/include.pl @@ -18,14 +18,14 @@ my $l2 = $L2; # $l2-= $ll-$L1 if $ll>$L1; # move L2 left if possible (L1 space available) - if($VERBOSE) { + if($VERBOSE or $LIST==1) { pf "$CK_$SY include $sp$c1%-*s$CD_ $CK_%*s$CD_",$l1,$file,$l2,"$how"; pr " $c2$path$CD_" if defined $path and $path ne $file; pr "\n" } if($LIST and $c1 ne $CK_ and $how ne "missing" and $level>=1) { if ($LIST==3) { print "$sp$path\n" } elsif($LIST==2) { print "$sp$file\n" if $level==1 } - else { print "$sp$file\n" }}} + elsif($LIST==4) { print "$sp$file\n" }}} # ------------------------------------------------------------------------------------- MAIN diff --git a/pcpp b/pcpp index 90d9506..a4ee03d 100755 --- a/pcpp +++ b/pcpp @@ -1,7 +1,7 @@ #!/usr/bin/perl -# pcpp generated from pcpp-0.8/pcpp.pl 2024-06-30 +# pcpp generated from pcpp-0.8a/pcpp.pl 2024-06-30 -$SIGN = "pcpp-0.8 R.Jaksa 2008,2024 GPLv3"; +$SIGN = "pcpp-0.8a R.Jaksa 2008,2024 GPLv3"; $HELP=<$L1; # move L2 left if possible (L1 space available) - if($VERBOSE) { + if($VERBOSE or $LIST==1) { pf "$CK_$SY include $sp$c1%-*s$CD_ $CK_%*s$CD_",$l1,$file,$l2,"$how"; pr " $c2$path$CD_" if defined $path and $path ne $file; pr "\n" } if($LIST and $c1 ne $CK_ and $how ne "missing" and $level>=1) { if ($LIST==3) { print "$sp$path\n" } elsif($LIST==2) { print "$sp$file\n" if $level==1 } - else { print "$sp$file\n" }}} + elsif($LIST==4) { print "$sp$file\n" }}} # ------------------------------------------------------------------------------------- MAIN @@ -483,15 +485,9 @@ push @output,addfile($_) for @FILES; exit if $LIST; # print deps -if($DEPS==1) { - print "$DEPLIST\n"; - exit } +print "$DEPLIST\n" and exit if $DEPS==1; +print "$DEPS: $DEPLIST\n" and exit if$DEPS; -if($DEPS) { - print "$DEPS: $DEPLIST\n"; - exit } - -if(1) { # remove tripled comments if(not $NOTRIPLE) { for my $i (0..$#output) { @@ -511,7 +507,6 @@ for my $i (0..$#output) { elsif($i<$#output and $output[$i+1] =~ /^\h*$/) { $output[$i] = "$SY:DEL\n" } else { $output[$i] = "\n" }} -} # :DEL tags and assembly of the final output string my $out; for my $i (0..$#output) { diff --git a/pcpp.pl b/pcpp.pl index a8a10da..1e69d32 100644 --- a/pcpp.pl +++ b/pcpp.pl @@ -14,7 +14,8 @@ OPTIONS -h This help. -v Verbose, CC(-vv) for more verbose. - -l Just list files to include, CC(-l1/lp) for level1 or paths. + -l List all files to be used, without producing actual output. + -ln Plain list of files to be included, CC(-l1/lp) for level1 or paths. -dd Print a list of dependencies (input file plus included ones). -d TGT Generate dependencies list for Makefile for the TGT target. -e DIR Exclude directory from a search, multiple -e possible. @@ -75,6 +76,7 @@ for(@ARGV) { if($_ eq "-l") { $LIST=1; $_=""; last }} for(@ARGV) { if($_ eq "-l1") { $LIST=2; $_=""; last }} for(@ARGV) { if($_ eq "-lp") { $LIST=3; $_=""; last }} +for(@ARGV) { if($_ eq "-ln") { $LIST=4; $_=""; last }} for(@ARGV) { if($_ eq "-dd") { $DEPS=1; $_=""; last }} # dependencies-list target @@ -141,15 +143,9 @@ exit if $LIST; # print deps -if($DEPS==1) { - print "$DEPLIST\n"; - exit } +print "$DEPLIST\n" and exit if $DEPS==1; +print "$DEPS: $DEPLIST\n" and exit if$DEPS; -if($DEPS) { - print "$DEPS: $DEPLIST\n"; - exit } - -if(1) { # remove tripled comments if(not $NOTRIPLE) { for my $i (0..$#output) { @@ -169,7 +165,6 @@ elsif($i<$#output and $output[$i+1] =~ /^\h*$/) { $output[$i] = "$SY:DEL\n" } else { $output[$i] = "\n" }} -} # :DEL tags and assembly of the final output string my $out; for my $i (0..$#output) { diff --git a/uninclude b/uninclude index 01217c7..e8dd36d 100755 --- a/uninclude +++ b/uninclude @@ -1,7 +1,7 @@ #!/usr/bin/perl -# uninclude generated from pcpp-0.8/uninclude.pl 2024-06-30 +# uninclude generated from pcpp-0.8a/uninclude.pl 2024-06-30 -$SIGN = "pcpp-0.8 R.Jaksa 2008,2024 GPLv3"; +$SIGN = "pcpp-0.8a R.Jaksa 2008,2024 GPLv3"; $HELP=<$L1; # move L2 left if possible (L1 space available) - if($VERBOSE) { + if($VERBOSE or $LIST==1) { pf "$CK_$SY include $sp$c1%-*s$CD_ $CK_%*s$CD_",$l1,$file,$l2,"$how"; pr " $c2$path$CD_" if defined $path and $path ne $file; pr "\n" } if($LIST and $c1 ne $CK_ and $how ne "missing" and $level>=1) { if ($LIST==3) { print "$sp$path\n" } elsif($LIST==2) { print "$sp$file\n" if $level==1 } - else { print "$sp$file\n" }}} + elsif($LIST==4) { print "$sp$file\n" }}} # ------------------------------------------------------------------------------------- MAIN @@ -483,15 +485,9 @@ push @output,addfile($_) for @FILES; exit if $LIST; # print deps -if($DEPS==1) { - print "$DEPLIST\n"; - exit } +print "$DEPLIST\n" and exit if $DEPS==1; +print "$DEPS: $DEPLIST\n" and exit if$DEPS; -if($DEPS) { - print "$DEPS: $DEPLIST\n"; - exit } - -if(1) { # remove tripled comments if(not $NOTRIPLE) { for my $i (0..$#output) { @@ -511,7 +507,6 @@ for my $i (0..$#output) { elsif($i<$#output and $output[$i+1] =~ /^\h*$/) { $output[$i] = "$SY:DEL\n" } else { $output[$i] = "\n" }} -} # :DEL tags and assembly of the final output string my $out; for my $i (0..$#output) {