summaryrefslogtreecommitdiff
path: root/zlib2ansi
diff options
context:
space:
mode:
Diffstat (limited to 'zlib2ansi')
-rwxr-xr-xzlib2ansi28
1 files changed, 14 insertions, 14 deletions
diff --git a/zlib2ansi b/zlib2ansi
index 0695f6b..15e3e16 100755
--- a/zlib2ansi
+++ b/zlib2ansi
@@ -25,7 +25,7 @@ my $decl = qr{ $sp (?: \w+ $sp )+ $d1 }xo ;
25my $dList = qr{ $sp $decl (?: $sp , $d1 )* $sp ; $sp }xo ; 25my $dList = qr{ $sp $decl (?: $sp , $d1 )* $sp ; $sp }xo ;
26 26
27 27
28while (s/^ 28while (s/^
29 ( # Start $1 29 ( # Start $1
30 ( # Start $2 30 ( # Start $2
31 .*? # Minimal eat content 31 .*? # Minimal eat content
@@ -57,7 +57,7 @@ while (s/^
57 my $i = 0 ; 57 my $i = 0 ;
58 my %pList = map { $_ => $i++ } 58 my %pList = map { $_ => $i++ }
59 split /\s*,\s*/, $param_list; 59 split /\s*,\s*/, $param_list;
60 my $pMatch = '(\b' . join('|', keys %pList) . '\b)\W*$' ; 60 my $pMatch = '(\b' . join('|', keys %pList) . '\b)\W*$' ;
61 61
62 my @params = split /\s*;\s*/, $params; 62 my @params = split /\s*;\s*/, $params;
63 my @outParams = (); 63 my @outParams = ();
@@ -80,16 +80,16 @@ while (s/^
80 } 80 }
81 } 81 }
82 82
83 83
84 my %tmp = map { /$pMatch/; $_ => $pList{$1} } 84 my %tmp = map { /$pMatch/; $_ => $pList{$1} }
85 @outParams ; 85 @outParams ;
86 86
87 @outParams = map { " $_" } 87 @outParams = map { " $_" }
88 sort { $tmp{$a} <=> $tmp{$b} } 88 sort { $tmp{$a} <=> $tmp{$b} }
89 @outParams ; 89 @outParams ;
90 90
91 print $prefix ; 91 print $prefix ;
92 print "(\n" . join(",\n", @outParams) . ")\n"; 92 print "(\n" . join(",\n", @outParams) . ")\n";
93 print "{" ; 93 print "{" ;
94 94
95} 95}
@@ -116,13 +116,13 @@ sub StripComments
116 )* ## 0-or-more things which don't start with / 116 )* ## 0-or-more things which don't start with /
117 ## but do end with '*' 117 ## but do end with '*'
118 / ## End of /* ... */ comment 118 / ## End of /* ... */ comment
119 119
120 | ## OR C++ Comment 120 | ## OR C++ Comment
121 // ## Start of C++ comment // 121 // ## Start of C++ comment //
122 [^\n]* ## followed by 0-or-more non end of line characters 122 [^\n]* ## followed by 0-or-more non end of line characters
123 123
124 | ## OR various things which aren't comments: 124 | ## OR various things which aren't comments:
125 125
126 ( 126 (
127 " ## Start of " ... " string 127 " ## Start of " ... " string
128 ( 128 (
@@ -131,9 +131,9 @@ sub StripComments
131 [^"\\] ## Non "\ 131 [^"\\] ## Non "\
132 )* 132 )*
133 " ## End of " ... " string 133 " ## End of " ... " string
134 134
135 | ## OR 135 | ## OR
136 136
137 ' ## Start of ' ... ' string 137 ' ## Start of ' ... ' string
138 ( 138 (
139 \\. ## Escaped char 139 \\. ## Escaped char
@@ -141,9 +141,9 @@ sub StripComments
141 [^'\\] ## Non '\ 141 [^'\\] ## Non '\
142 )* 142 )*
143 ' ## End of ' ... ' string 143 ' ## End of ' ... ' string
144 144
145 | ## OR 145 | ## OR
146 146
147 . ## Anything other char 147 . ## Anything other char
148 [^/"'\\]* ## Chars which doesn't start a comment, string or escape 148 [^/"'\\]* ## Chars which doesn't start a comment, string or escape
149 ) 149 )