ecpg_preproc_minimal_perl_cleanup.patch
application/octet-stream
Filename: ecpg_preproc_minimal_perl_cleanup.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/interfaces/ecpg/preproc/check_rules.pl | 0 | 0 |
| src/interfaces/ecpg/preproc/parse.pl | 0 | 0 |
diff --git a/src/interfaces/ecpg/preproc/check_rules.pl b/src/interfaces/ecpg/preproc/check_rules.pl
index 5e2b65f..7e66f1e 100755
*** a/src/interfaces/ecpg/preproc/check_rules.pl
--- b/src/interfaces/ecpg/preproc/check_rules.pl
*************** if (@ARGV) {
*** 15,22 ****
$parser = $ARGV[1];
}
- $[ = 1; # set array base to 1
-
if ($path eq '') { $path = "."; }
$filename = $path . "/ecpg.addons";
--- 15,20 ----
*************** $replace_line{'PrepareStmtPREPAREnamepre
*** 28,34 ****
$block = '';
$ret = 0;
! $yaccmod = 0;
$brace_indent = 0;
open GRAM, $parser or die $!;
--- 26,32 ----
$block = '';
$ret = 0;
! $yaccmode = 0;
$brace_indent = 0;
open GRAM, $parser or die $!;
*************** while (<GRAM>) {
*** 57,63 ****
$n = (@arr = split(' ', $S));
# Go through each field in turn
! for ($fieldIndexer = 1; $fieldIndexer <= $n; $fieldIndexer++) {
if ($arr[$fieldIndexer] eq '*/' && $comment) {
$comment = 0;
next;
--- 55,61 ----
$n = (@arr = split(' ', $S));
# Go through each field in turn
! for ($fieldIndexer = 0; $fieldIndexer < $n; $fieldIndexer++) {
if ($arr[$fieldIndexer] eq '*/' && $comment) {
$comment = 0;
next;
*************** line: while (<ECPG>) {
*** 116,123 ****
next line;
}
! if ($found{$Fld[2]} ne 'found') {
! printf $Fld[2] . " is not used for building parser!\n";
$ret = 1;
}
}
--- 114,121 ----
next line;
}
! if ($found{$Fld[1]} ne 'found') {
! printf $Fld[1] . " is not used for building parser!\n";
$ret = 1;
}
}
diff --git a/src/interfaces/ecpg/preproc/parse.pl b/src/interfaces/ecpg/preproc/parse.pl
index 2328010..df93261 100644
*** a/src/interfaces/ecpg/preproc/parse.pl
--- b/src/interfaces/ecpg/preproc/parse.pl
*************** if (@ARGV) {
*** 18,24 ****
if ($path eq '') { $path = "."; }
- $[ = 1; # set array base to 1
$, = ' '; # set output field separator
$\ = "\n"; # set output record separator
--- 18,23 ----
*************** line: while (<>) {
*** 126,137 ****
# Now split the line into individual fields
$n = (@arr = split(' ', $S));
! if ($arr[1] eq '%token' && $tokenmode == 0) {
$tokenmode = 1;
&include_stuff('tokens', 'ecpg.tokens', '', 1, 0);
$type = 1;
}
! elsif ($arr[1] eq '%type' && $header_included == 0) {
&include_stuff('header', 'ecpg.header', '', 1, 0);
&include_stuff('ecpgtype', 'ecpg.type', '', 1, 0);
$header_included = 1;
--- 125,136 ----
# Now split the line into individual fields
$n = (@arr = split(' ', $S));
! if ($arr[0] eq '%token' && $tokenmode == 0) {
$tokenmode = 1;
&include_stuff('tokens', 'ecpg.tokens', '', 1, 0);
$type = 1;
}
! elsif ($arr[0] eq '%type' && $header_included == 0) {
&include_stuff('header', 'ecpg.header', '', 1, 0);
&include_stuff('ecpgtype', 'ecpg.type', '', 1, 0);
$header_included = 1;
*************** line: while (<>) {
*** 139,145 ****
if ($tokenmode == 1) {
$str = '';
! for ($a = 1; $a <= $n; $a++) {
if ($arr[$a] eq '/*') {
$comment++;
next;
--- 138,144 ----
if ($tokenmode == 1) {
$str = '';
! for ($a = 0; $a < $n; $a++) {
if ($arr[$a] eq '/*') {
$comment++;
next;
*************** line: while (<>) {
*** 151,157 ****
if ($comment) {
next;
}
! if (substr($arr[$a], 1, 1) eq '<') {
next;
# its a type
}
--- 150,156 ----
if ($comment) {
next;
}
! if (substr($arr[$a], 0, 1) eq '<') {
next;
# its a type
}
*************** line: while (<>) {
*** 173,179 ****
}
# Go through each field in turn
! for ($fieldIndexer = 1; $fieldIndexer <= $n; $fieldIndexer++) {
if ($arr[$fieldIndexer] eq '*/' && $comment) {
$comment = 0;
next;
--- 172,178 ----
}
# Go through each field in turn
! for ($fieldIndexer = 0; $fieldIndexer < $n; $fieldIndexer++) {
if ($arr[$fieldIndexer] eq '*/' && $comment) {
$comment = 0;
next;
*************** sub include_stuff {
*** 329,339 ****
$inblock = 0;
$filename = $path . "/" . $includefilename;
while (($_ = &Getline2($filename),$getline_ok)) {
! if ($includeblock ne '' && $Fld[1] eq 'ECPG:' && $inblock == 0) {
! if ($Fld[2] eq $includeblock) {
$copy = 1;
$inblock = 1;
! $includetype = $Fld[3];
if ($includetype eq 'rule') {
&dump_fields($stmt_mode, *fields, $field_count, ' { ');
}
--- 328,338 ----
$inblock = 0;
$filename = $path . "/" . $includefilename;
while (($_ = &Getline2($filename),$getline_ok)) {
! if ($includeblock ne '' && $Fld[0] eq 'ECPG:' && $inblock == 0) {
! if ($Fld[1] eq $includeblock) {
$copy = 1;
$inblock = 1;
! $includetype = $Fld[2];
if ($includetype eq 'rule') {
&dump_fields($stmt_mode, *fields, $field_count, ' { ');
}
*************** sub include_stuff {
*** 346,352 ****
}
}
else {
! if ($copy == 1 && $Fld[1] ne 'ECPG:') {
&add_to_buffer($includestream, $_);
$copied = 1;
$inblock = 0;
--- 345,351 ----
}
}
else {
! if ($copy == 1 && $Fld[0] ne 'ECPG:') {
&add_to_buffer($includestream, $_);
$copied = 1;
$inblock = 0;
*************** sub dump_fields {
*** 400,406 ****
# Go through each field and try to 'aggregate' the tokens into a single 'mm_strdup' where possible
$cnt = 0;
for ($z = 0; $z < $len; $z++) {
! if (substr($flds{$z}, 1, 1) eq "\$") {
$flds_new{$cnt++} = $flds{$z};
next;
}
--- 399,405 ----
# Go through each field and try to 'aggregate' the tokens into a single 'mm_strdup' where possible
$cnt = 0;
for ($z = 0; $z < $len; $z++) {
! if (substr($flds{$z}, 0, 1) eq "\$") {
$flds_new{$cnt++} = $flds{$z};
next;
}
*************** sub dump_fields {
*** 408,414 ****
$str = $flds{$z};
while (1) {
! if ($z >= $len - 1 || substr($flds{$z + 1}, 1, 1) eq "\$") {
# We're at the end...
$flds_new{$cnt++} = "mm_strdup(\"" . $str . "\")";
last;
--- 407,413 ----
$str = $flds{$z};
while (1) {
! if ($z >= $len - 1 || substr($flds{$z + 1}, 0, 1) eq "\$") {
# We're at the end...
$flds_new{$cnt++} = "mm_strdup(\"" . $str . "\")";
last;
*************** sub dump_line {
*** 467,473 ****
return 0;
}
elsif ($replace_line{$block}) {
! if (index($line, '|') != 0) {
$line = '| ' . $replace_line{$block};
}
else {
--- 466,472 ----
return 0;
}
elsif ($replace_line{$block}) {
! if (index($line, '|') != -1) {
$line = '| ' . $replace_line{$block};
}
else {