aboutsummaryrefslogtreecommitdiff
path: root/libX11/nls/compose-check.pl
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-11-19 10:38:33 +0100
committermarha <marha@users.sourceforge.net>2012-11-19 10:38:33 +0100
commit24635abae6008bef13e30d798b3f33abab412770 (patch)
treee799fbde24e0fd935af76b0bc48d30ef69f75d54 /libX11/nls/compose-check.pl
parente0844ae8b5ef87049537a7e0ebff81acc2695256 (diff)
parent6ce1d8f0f8c23e186175a7c84c21d7bfbe168dc5 (diff)
downloadvcxsrv-24635abae6008bef13e30d798b3f33abab412770.tar.gz
vcxsrv-24635abae6008bef13e30d798b3f33abab412770.tar.bz2
vcxsrv-24635abae6008bef13e30d798b3f33abab412770.zip
Merge remote-tracking branch 'origin/released'
* origin/released: Changed file permissions dos -> unix Conflicts: libX11/include/X11/Xregion.h libX11/src/ConvSel.c libX11/src/CrGlCur.c libX11/src/CrWindow.c libX11/src/GetDflt.c libX11/src/StrKeysym.c libX11/src/Window.c libX11/src/xkb/XKBBind.c libX11/src/xkb/XKBGetMap.c libX11/src/xkb/XKBSetGeom.c libX11/src/xkb/XKBUse.c libX11/src/xlibi18n/XimProto.h libX11/src/xlibi18n/lcDynamic.c libXdmcp/Key.c libXdmcp/Write.c libxcb/src/xcb_windefs.h xkbcomp/keycodes.c xkbcomp/xkbpath.c xorg-server/hw/xwin/glx/winpriv.h xorg-server/xkeyboard-config/rules/bin/ml1_s.sh xorg-server/xkeyboard-config/rules/bin/ml1v1_s.sh xorg-server/xkeyboard-config/rules/bin/ml1v_s.sh xorg-server/xkeyboard-config/rules/bin/ml_s.sh xorg-server/xkeyboard-config/rules/bin/mln_s.sh xorg-server/xkeyboard-config/rules/bin/mlnvn_s.sh xorg-server/xkeyboard-config/rules/bin/mlv_s.sh xorg-server/xkeyboard-config/rules/compat/.gitignore
Diffstat (limited to 'libX11/nls/compose-check.pl')
-rw-r--r--libX11/nls/compose-check.pl322
1 files changed, 161 insertions, 161 deletions
diff --git a/libX11/nls/compose-check.pl b/libX11/nls/compose-check.pl
index a12db0c82..399bfa99c 100644
--- a/libX11/nls/compose-check.pl
+++ b/libX11/nls/compose-check.pl
@@ -1,161 +1,161 @@
-#! /usr/bin/perl
-#
-# Copyright 2009 Oracle and/or its affiliates. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-
-#
-# Check a compose file for duplicate/conflicting entries and other common errors
-#
-
-# Compose file grammar is defined in modules/im/ximcp/imLcPrs.c
-
-use strict;
-use warnings;
-
-my $error_count = 0;
-
-if (scalar(@ARGV) == 0) {
- if ( -f 'Compose' ) {
- push @ARGV, 'Compose';
- } else {
- push @ARGV, glob '*/Compose';
- }
-}
-
-foreach my $cf (@ARGV) {
- # print "Checking $cf\n";
- $error_count += check_compose_file($cf);
-}
-
-exit($error_count);
-
-sub check_compose_file {
- my ($filename) = @_;
- my $errors = 0;
-
- my %compose_table = ();
- my $line = 0;
- my $pre_file = ($filename =~ m{\.pre$}) ? 1 : 0;
- my $in_c_comment = 0;
-
- open my $COMPOSE, '<', $filename or die "Could not open $filename: $!";
-
- COMPOSE_LINE:
- while (my $cl = <$COMPOSE>) {
- $line++;
- chomp($cl);
- my $original_line = $cl;
-
- # Special handling for changes cpp makes to .pre files
- if ($pre_file == 1) {
- if ($in_c_comment) { # Look for end of multi-line C comment
- if ($cl =~ m{\*/(.*)$}) {
- $cl = $1;
- $in_c_comment = 0;
- } else {
- next;
- }
- }
- $cl =~ s{/\*.\**/}{}; # Remove single line C comments
- if ($cl =~ m{^(.*)/\*}) { # Start of a multi-line C comment
- $cl = $1;
- $in_c_comment = 1;
- }
- next if $cl =~ m{^\s*XCOMM}; # Skip pre-processing comments
- }
-
- $cl =~ s{#.*$}{}; # Remove comments
- next if $cl =~ m{^\s*$}; # Skip blank (or comment-only) lines
- chomp($cl);
-
- if ($cl =~ m{^(STATE\s+|END_STATE)}) { # Sun extension to compose file syntax
- %compose_table = ();
- }
- elsif ($cl =~ m{^([^:]+)\s*:\s*(.+)$}) {
- my ($seq, $action) = ($1, $2);
- $seq =~ s{\s+$}{};
-
- my @keys = grep { $_ !~ m/^\s*$/ } split /[\s\<\>]+/, $seq;
-
- my $final_key = pop @keys;
- my $keytable = \%compose_table;
-
- foreach my $k (@keys) {
- if ($k =~ m{^U([[:xdigit:]]+)$}) {
- $k = 'U' . lc($1);
- }
- if (exists $keytable->{$k}) {
- $keytable = $keytable->{$k};
- if (ref($keytable) ne 'HASH') {
- print
- "Clash with existing sequence in $filename on line $line: $seq\n";
- print_sequences([$line, $original_line]);
- print_sequences($keytable);
- $errors++;
- next COMPOSE_LINE;
- }
- } else {
- my $new_keytable = {};
- $keytable->{$k} = $new_keytable;
- $keytable = $new_keytable;
- }
- }
-
- if (exists $keytable->{$final_key}) {
- print "Clash with existing sequence in $filename on line $line: $seq\n";
- print_sequences([$line, $original_line]);
- print_sequences($keytable->{$final_key});
- $errors++;
- } else {
- $keytable->{$final_key} = [$line, $original_line];
- }
- } elsif ($cl =~ m{^(STATE_TYPE:|\@StartDeadKeyMap|\@EndDeadKeyMap)}) {
- # ignore
- } elsif ($cl =~ m{^include "(.*)"}) {
- my $incpath = $1;
- if (($pre_file == 1) && ($incpath !~ m{^X11_LOCALEDATADIR/})) {
- print "Include path starts with $incpath instead of X11_LOCALEDATADIR\n",
- " -- may not find include files when installed in alternate paths\n\n";
- }
- } else {
- print 'Unrecognized pattern in ', $filename, ' on line #', $line, ":\n ",
- $cl, "\n";
- }
- }
- close $COMPOSE;
-
- return $errors;
-}
-
-sub print_sequences {
- my ($entry_ref) = @_;
-
- if (ref($entry_ref) eq 'HASH') {
- foreach my $h (values %{$entry_ref}) {
- print_sequences($h);
- }
- } else {
- my ($line, $seq) = @{$entry_ref};
-
- print " line #", $line, ": ", $seq, "\n";
- }
-}
+#! /usr/bin/perl
+#
+# Copyright 2009 Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+#
+# Check a compose file for duplicate/conflicting entries and other common errors
+#
+
+# Compose file grammar is defined in modules/im/ximcp/imLcPrs.c
+
+use strict;
+use warnings;
+
+my $error_count = 0;
+
+if (scalar(@ARGV) == 0) {
+ if ( -f 'Compose' ) {
+ push @ARGV, 'Compose';
+ } else {
+ push @ARGV, glob '*/Compose';
+ }
+}
+
+foreach my $cf (@ARGV) {
+ # print "Checking $cf\n";
+ $error_count += check_compose_file($cf);
+}
+
+exit($error_count);
+
+sub check_compose_file {
+ my ($filename) = @_;
+ my $errors = 0;
+
+ my %compose_table = ();
+ my $line = 0;
+ my $pre_file = ($filename =~ m{\.pre$}) ? 1 : 0;
+ my $in_c_comment = 0;
+
+ open my $COMPOSE, '<', $filename or die "Could not open $filename: $!";
+
+ COMPOSE_LINE:
+ while (my $cl = <$COMPOSE>) {
+ $line++;
+ chomp($cl);
+ my $original_line = $cl;
+
+ # Special handling for changes cpp makes to .pre files
+ if ($pre_file == 1) {
+ if ($in_c_comment) { # Look for end of multi-line C comment
+ if ($cl =~ m{\*/(.*)$}) {
+ $cl = $1;
+ $in_c_comment = 0;
+ } else {
+ next;
+ }
+ }
+ $cl =~ s{/\*.\**/}{}; # Remove single line C comments
+ if ($cl =~ m{^(.*)/\*}) { # Start of a multi-line C comment
+ $cl = $1;
+ $in_c_comment = 1;
+ }
+ next if $cl =~ m{^\s*XCOMM}; # Skip pre-processing comments
+ }
+
+ $cl =~ s{#.*$}{}; # Remove comments
+ next if $cl =~ m{^\s*$}; # Skip blank (or comment-only) lines
+ chomp($cl);
+
+ if ($cl =~ m{^(STATE\s+|END_STATE)}) { # Sun extension to compose file syntax
+ %compose_table = ();
+ }
+ elsif ($cl =~ m{^([^:]+)\s*:\s*(.+)$}) {
+ my ($seq, $action) = ($1, $2);
+ $seq =~ s{\s+$}{};
+
+ my @keys = grep { $_ !~ m/^\s*$/ } split /[\s\<\>]+/, $seq;
+
+ my $final_key = pop @keys;
+ my $keytable = \%compose_table;
+
+ foreach my $k (@keys) {
+ if ($k =~ m{^U([[:xdigit:]]+)$}) {
+ $k = 'U' . lc($1);
+ }
+ if (exists $keytable->{$k}) {
+ $keytable = $keytable->{$k};
+ if (ref($keytable) ne 'HASH') {
+ print
+ "Clash with existing sequence in $filename on line $line: $seq\n";
+ print_sequences([$line, $original_line]);
+ print_sequences($keytable);
+ $errors++;
+ next COMPOSE_LINE;
+ }
+ } else {
+ my $new_keytable = {};
+ $keytable->{$k} = $new_keytable;
+ $keytable = $new_keytable;
+ }
+ }
+
+ if (exists $keytable->{$final_key}) {
+ print "Clash with existing sequence in $filename on line $line: $seq\n";
+ print_sequences([$line, $original_line]);
+ print_sequences($keytable->{$final_key});
+ $errors++;
+ } else {
+ $keytable->{$final_key} = [$line, $original_line];
+ }
+ } elsif ($cl =~ m{^(STATE_TYPE:|\@StartDeadKeyMap|\@EndDeadKeyMap)}) {
+ # ignore
+ } elsif ($cl =~ m{^include "(.*)"}) {
+ my $incpath = $1;
+ if (($pre_file == 1) && ($incpath !~ m{^X11_LOCALEDATADIR/})) {
+ print "Include path starts with $incpath instead of X11_LOCALEDATADIR\n",
+ " -- may not find include files when installed in alternate paths\n\n";
+ }
+ } else {
+ print 'Unrecognized pattern in ', $filename, ' on line #', $line, ":\n ",
+ $cl, "\n";
+ }
+ }
+ close $COMPOSE;
+
+ return $errors;
+}
+
+sub print_sequences {
+ my ($entry_ref) = @_;
+
+ if (ref($entry_ref) eq 'HASH') {
+ foreach my $h (values %{$entry_ref}) {
+ print_sequences($h);
+ }
+ } else {
+ my ($line, $seq) = @{$entry_ref};
+
+ print " line #", $line, ": ", $seq, "\n";
+ }
+}