Skip to content

Commit

Permalink
0.8a
Browse files Browse the repository at this point in the history
  • Loading branch information
rudojaksa committed Jun 29, 2024
1 parent 2cfdedc commit 8dc82f8
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 47 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)

Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions doc/pcpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

2 changes: 1 addition & 1 deletion doc/uninclude.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 changes: 2 additions & 2 deletions include.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 9 additions & 14 deletions pcpp
Original file line number Diff line number Diff line change
@@ -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=<<EOF;
Expand All @@ -19,7 +19,8 @@ DESCRIPTION
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.
Expand Down Expand Up @@ -208,6 +209,7 @@ for(@ARGV) { if($_ eq "-ni") { $NOIND=1; $_=""; last }}
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
Expand Down Expand Up @@ -361,14 +363,14 @@ my sub report {
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

Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
15 changes: 5 additions & 10 deletions pcpp.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions uninclude
Original file line number Diff line number Diff line change
@@ -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=<<EOF;
Expand Down
23 changes: 9 additions & 14 deletions usr/bin/pcpp
Original file line number Diff line number Diff line change
@@ -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=<<EOF;
Expand All @@ -19,7 +19,8 @@ DESCRIPTION
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.
Expand Down Expand Up @@ -208,6 +209,7 @@ for(@ARGV) { if($_ eq "-ni") { $NOIND=1; $_=""; last }}
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
Expand Down Expand Up @@ -361,14 +363,14 @@ my sub report {
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

Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 8dc82f8

Please sign in to comment.