- my $str;
- my $suffix;
- if (defined $flag && $flag eq 'native') {
- die "Are you sure you want to run this on an above-Latin1 code point?" if $cp > 0xff;
- $suffix = '_NATIVE';
- $str = sprintf "0x%02X", $cp; # Is a numeric constant
- }
- else {
- $str = join "", map { sprintf "\\x%02X", ord $_ } split //, cp_2_utfbytes($U_cp, $charset);
-
- $suffix = '_UTF8';
- if (! defined $flag || $flag =~ /^ string (_skip_if_undef)? $/x) {
- $str = "\"$str\""; # Will be a string constant
- } elsif ($flag eq 'tail') {
- $str =~ s/\\x..//; # Remove the first byte
- $suffix .= '_TAIL';
- $str = "\"$str\""; # Will be a string constant
- }
- elsif ($flag eq 'first') {
- $str =~ s/ \\x ( .. ) .* /$1/x; # Get the two nibbles of the 1st byte
- $suffix .= '_FIRST_BYTE';
- $str = "0x$str"; # Is a numeric constant
+ my $str;
+ my $suffix;
+ if (defined $flag && $flag eq 'native') {
+ die "Are you sure you want to run this on an above-Latin1 code point?" if $cp > 0xff;
+ $suffix = '_NATIVE';
+ $str = sprintf "0x%02X", $cp; # Is a numeric constant