X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e70833fb1dfa271e7b0c9dec11ad644880e03c6f..ebef1625fa59c555e45d2aa278de0ff5674d6142:/tests/regex/regex.pl diff --git a/tests/regex/regex.pl b/tests/regex/regex.pl index af0cfe8a78..d05363d8a4 100755 --- a/tests/regex/regex.pl +++ b/tests/regex/regex.pl @@ -1,4 +1,4 @@ -#!/usr/bin/env perl -w +#!/usr/bin/env perl ############################################################################# # Name: regex.pl # Purpose: Generate test code for wxRegEx from 'reg.test' @@ -24,6 +24,7 @@ # use strict; +use warnings; use File::Basename; #use encoding "UTF-8"; # enable in the future when perl 5.6.x is just a memory @@ -38,26 +39,26 @@ sub quotecxx { "\013" => "v", '"' => '"', "\\" => "\\" ); # working around lack of 'use encoding' - $_ = pack "U0C*", unpack "C*", $_; - use utf8; + if (!$utf) { + $_ = pack "U0C*", unpack "C*", $_; + use utf8; + } s/[\000-\037"\\\177-\x{ffff}]/ if ($esc{$&}) { "\\$esc{$&}"; - } elsif (ord($&) > 0x9f) { - if ($utf) { - $&; - } else { - sprintf "\\u%04x", ord($&); - } + } elsif (ord($&) > 0x9f && !$utf) { + sprintf "\\u%04x", ord($&); } else { sprintf "\\%03o", ord($&); } /ge; # working around lack of 'use encoding' - no utf8; - $_ = pack "C*", unpack "C*", $_; + if (!$utf) { + no utf8; + $_ = pack "C*", unpack "C*", $_; + } return ($utf ? '"' : 'L"') . $_ . '"' } @@ -291,8 +292,7 @@ Example: $prog -o regex.inc reg.test wxreg.test Input files should be in UTF-8. If no input files are specified input is read from stdin. If no output file is specified output is written to stdout. -See the comments in reg.test (in src/regex) for details of the input file -format. +See the comments in reg.test for details of the input file format. EOT exit 0; } @@ -426,7 +426,7 @@ for (@input) my $results = $opts =~ /-inline/ && $test ne 'f' ? $extras[$i+2] : ''; # get them all in the right order and print - unshift @args, $test, parsetcl($id), '-'; + unshift @args, $test, parsetcl($id), $results ? '-' : 'o'; push @args, parsetcl(parsetcl($results)) if $results; handle_test @args; }