]> Pileus Git - ~andy/gtk/blob - gdk/gdkkeysyms-update.pl
Practically everything changed.
[~andy/gtk] / gdk / gdkkeysyms-update.pl
1 #!/usr/bin/env perl
2
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
5
6 # Author  : Simos Xenitellis <simos at gnome dot org>.
7 # Version : 1.2
8 #
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
11
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.
15
16 use strict;
17
18 # Used for reading the keysymdef symbols.
19 my @keysymelements;
20
21 if ( ! -f "keysymdef.h" )
22 {
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;
27         print " done.\n\n";
28 }
29 else
30 {
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";
34 }
35
36
37 if ( -f "gdkkeysyms.h" )
38 {
39         print "There is already a gdkkeysyms.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";
41         die "Exiting...\n\n";
42 }
43
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");
46
47 # Output: gtk+/gdk/gdkkeysyms.h
48 die "Could not open file gdkkeysyms.h: $!\n" unless open(OUT_GDKKEYSYMS, ">:utf8", "gdkkeysyms.h");
49
50 print OUT_GDKKEYSYMS<<EOF;
51 /* GDK - The GTK+ Drawing Kit
52  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
53  * Copyright (C) 2005, 2006, 2007 GNOME Foundation
54  *
55  * This library is free software; you can redistribute it and/or
56  * modify it under the terms of the GNU Lesser General Public
57  * License as published by the Free Software Foundation; either
58  * version 2 of the License, or (at your option) any later version.
59  *
60  * This library is distributed in the hope that it will be useful,
61  * but WITHOUT ANY WARRANTY; without even the implied warranty of
62  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
63  * Lesser General Public License for more details.
64  *
65  * You should have received a copy of the GNU Lesser General Public
66  * License along with this library; if not, write to the
67  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
68  * Boston, MA 02111-1307, USA.
69  */
70
71 /*
72  * File auto-generated from script http://svn.gnome.org/viewcvs/gtk%2B/trunk/gdk/gdkkeysyms-update.pl
73  * using the input file
74  * http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h
75  */
76
77 /*
78  * Modified by the GTK+ Team and others 1997-2007.  See the AUTHORS
79  * file for a list of people on the GTK+ Team.  See the ChangeLog
80  * files for a list of changes.  These files are distributed with
81  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
82  */
83
84 #ifndef __GDK_KEYSYMS_H__
85 #define __GDK_KEYSYMS_H__
86
87
88 EOF
89
90
91 while (<IN_KEYSYMDEF>)
92 {
93         next if ( ! /^#define / );
94
95         @keysymelements = split(/\s+/);
96         die "Internal error, no \@keysymelements: $_\n" unless @keysymelements;
97
98         $_ = $keysymelements[1];
99         die "Internal error, was expecting \"XC_*\", found: $_\n" if ( ! /^XK_/ );
100         
101         $_ = $keysymelements[2];
102         die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
103
104         $keysymelements[1] =~ s/^XK_/GDK_/g;
105
106         printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]);
107 }
108
109 #$gdksyms{"0"} = "0000";
110
111 close IN_KEYSYMDEF;
112
113
114 print OUT_GDKKEYSYMS<<EOF;
115
116 #endif /* __GDK_KEYSYMS_H__ */
117 EOF
118
119 printf "We just finished converting keysymdef.h to gdkkeysyms.h\nThank you\n";