summaryrefslogtreecommitdiff
path: root/fixpp
diff options
context:
space:
mode:
Diffstat (limited to 'fixpp')
-rwxr-xr-xfixpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/fixpp b/fixpp
new file mode 100755
index 0000000000..f75a175fb1
--- /dev/null
+++ b/fixpp
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+@lines = <>;
+for (@lines) {
+ $line++;
+
+ if (/^PP\(pp_(\w+)/) { $newname = $1; $fixed = 1; $mark = 0; next; }
+ if (/^}/) { $fixed{$newname} = $fixed; $mark{$newname} = $mark; $newname=''}
+
+ next unless $fixed;
+
+ if (/^#ifdef NOTDEF/) { $fixed = 0; }
+ if (/MSP;/) { $mark = 1; }
+
+ if (/\bMEXTEND/ && $mark == 0) { warn "Inconsistent mark line $line\n"; }
+ if (/\bMXPUSH/ && $mark == 0) { warn "Inconsistent mark line $line\n"; }
+ if (/\bMRETURN/ && $mark == 0) { warn "Inconsistent mark line $line\n"; }
+
+ if (/\bEXTEND/ && $mark == 1) { warn "Inconsistent mark line $line\n"; }
+ if (/\bXPUSH/ && $mark == 1) { warn "Inconsistent mark line $line\n"; }
+ if (/\bRETURN/ && $mark == 1) { warn "Inconsistent mark line $line\n"; }
+
+}
+
+for (@lines) {
+ if (m#^ 0, /\* pp_(\w+)#) {
+ $_ = " pp_$1,\n" if $fixed{$1};
+ }
+ elsif (m#^ [01], /\* (\w+)[^,]#) {
+ s/\d/$mark{$1} + 0/e;
+ }
+ last if /^PP/;
+}
+
+print @lines;