3 # Updates http://svn.gnome.org/viewcvs/gtk%2B/trunk/gdk/gdkkeysyms.h?view=log from upstream (X.org 7.x),
4 # from http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h
6 # Author : Simos Xenitellis <simos at gnome dot org>.
9 # Input : http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h
10 # Output : http://svn.gnome.org/svn/gtk+/trunk/gdk/gdkkeysyms.h
12 # Notes : It downloads keysymdef.h from the Internet, if not found locally,
13 # Notes : and creates an updated gdkkeysyms.h
14 # Notes : This version updates the source of gdkkeysyms.h from CVS to the GIT server.
18 # Used for reading the keysymdef symbols.
21 if ( ! -f "keysymdef.h" )
23 print "Trying to download keysymdef.h from\n";
24 print "http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h\n";
25 die "Unable to download keysymdef.h from http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h\n"
26 unless system("wget -c -O keysymdef.h \"http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h\"") == 0;
31 print "We are using existing keysymdef.h found in this directory.\n";
32 print "It is assumed that you took care and it is a recent version\n";
33 print "as found at http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=keysymdef.h\n\n";
37 if ( -f "ibuskeysyms.h" )
39 print "There is already a ibuskeysyms.h file in this directory. We are not overwriting it.\n";
40 print "Please move it somewhere else in order to run this script.\n";
44 # Source: http://cvs.freedesktop.org/xorg/xc/include/keysymdef.h
45 die "Could not open file keysymdef.h: $!\n" unless open(IN_KEYSYMDEF, "<:utf8", "keysymdef.h");
47 # Output: gtk+/gdk/gdkkeysyms.h
48 die "Could not open file ibuskeysyms.h: $!\n" unless open(OUT_IBUSKEYSYMS, ">:utf8", "ibuskeysyms.h");
50 print OUT_IBUSKEYSYMS<<EOF;
51 /* ibus - The Input Bus
52 * Copyright (C) 2008-2009 Huang Peng <shawn.p.huang\@gmail.com>
54 * This library is free software; you can redistribute it and/or
55 * modify it under the terms of the GNU Lesser General Public
56 * License as published by the Free Software Foundation; either
57 * version 2 of the License, or (at your option) any later version.
59 * This library is distributed in the hope that it will be useful,
60 * but WITHOUT ANY WARRANTY; without even the implied warranty of
61 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
62 * Lesser General Public License for more details.
64 * You should have received a copy of the GNU Lesser General Public
65 * License along with this library; if not, write to the
66 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
67 * Boston, MA 02111-1307, USA.
70 #ifndef __IBUS_KEYSYMS_H__
71 #define __IBUS_KEYSYMS_H__
77 while (<IN_KEYSYMDEF>)
79 next if ( ! /^#define / );
81 @keysymelements = split(/\s+/);
82 die "Internal error, no \@keysymelements: $_\n" unless @keysymelements;
84 $_ = $keysymelements[1];
85 die "Internal error, was expecting \"XC_*\", found: $_\n" if ( ! /^XK_/ );
87 $_ = $keysymelements[2];
88 die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
90 $keysymelements[1] =~ s/^XK_/IBUS_/g;
92 printf OUT_IBUSKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]);
95 #$ibussyms{"0"} = "0000";
100 print OUT_IBUSKEYSYMS<<EOF;
102 #endif /* __IBUS_KEYSYMS_H__ */
105 printf "We just finished converting keysymdef.h to ibuskeysyms.h\nThank you\n";