]> Pileus Git - ~andy/gtk/blob - gtk/makegtkalias.pl
d33b08f2ba01feeffd85432a6fa1f85530f15eee
[~andy/gtk] / gtk / makegtkalias.pl
1 #!/usr/bin/perl -w
2
3 print <<EOF;
4 /* Generated by makegtkalias.pl */
5
6 #include <glib.h>
7
8 #ifdef G_HAVE_GNUC_VISIBILITY
9
10 #ifdef  GTK_ENABLE_BROKEN
11 #define WAS_BROKEN
12 #endif
13 #define GTK_ENABLE_BROKEN
14
15 #ifdef GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
16 #define WAS_UNSUPPORTED_TEXT_API
17 #endif
18 #define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
19
20 #ifdef  GTK_DISABLE_DEPRECATED
21 #define WAS_NO_DEPR
22 #endif
23 #undef  GTK_DISABLE_DEPRECATED
24
25 #ifdef  G_DISABLE_DEPRECATED
26 #define WAS_NO_G_DEPR
27 #endif
28 #undef  G_DISABLE_DEPRECATED
29
30 #include "gtk.h"
31
32 #include "gtkfilesystem.h"
33 #ifdef G_OS_UNIX
34 #include "gtkfilesystemunix.h"
35 #endif
36 #ifdef G_OS_WIN32
37 #include "gtkfilesystemwin32.h"
38 #endif
39 #include "gtkhsv.h"
40 #include "gtkpathbar.h"
41 #include "gtktextdisplay.h"
42 #include "gtktextlayout.h"
43 #include "gtktextsegment.h"
44 #include "gtktexttypes.h"
45 #include "gtkthemes.h"
46 #include "gtkwindow-decorate.h"
47
48 EOF
49
50 my $in_comment = 0;
51 my $in_skipped_section = 0;
52
53 while (<>) {
54
55   # ignore empty lines
56   next if /^\s*$/;
57
58   # skip comments
59   if ($_ =~ /^\s*\/\*/)
60   {
61       $in_comment = 1;
62   }
63   
64   if ($in_comment)
65   {
66       if ($_ =~  /\*\/\s$/)
67       {
68           $in_comment = 0;
69       }
70       
71       next;
72   }
73
74   # handle ifdefs
75   if ($_ =~ /^\#endif/)
76   {
77       if (!$in_skipped_section)
78       {
79           print $_;
80       }
81
82       $in_skipped_section = 0;
83
84       next;
85   }
86
87   if ($_ =~ /^\#ifdef\s+INCLUDE_VARIABLES/)
88   {
89       $in_skipped_section = 1;
90   }
91
92   if ($in_skipped_section)
93   {
94       next;
95   }
96
97   if ($_ =~ /^\#ifdef\s+G/)
98   {
99       print $_;
100       
101       next;
102   }
103  
104
105   my $str = $_;
106   chomp($str);
107   my $alias = "IA__".$str;
108   
109   print <<EOF
110 extern __typeof ($str) $alias __attribute((visibility("hidden")));
111 extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
112 \#define $str $alias
113
114 EOF
115 }
116
117 print <<EOF;
118
119 #ifndef WAS_BROKEN
120 #undef  GTK_ENABLE_BROKEN
121 #else
122 #undef  WAS_BROKEN
123 #endif
124
125 #ifndef WAS_UNSUPPORTED_TEXT_API
126 #undef GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
127 #else
128 #undef WAS_UNSUPPORTED_TEXT_API
129 #endif
130
131 #ifdef  WAS_NO_DEPR
132 #define GTK_DISABLE_DEPRECATED
133 #undef  WAS_NO_DEPR
134 #endif
135
136 #ifdef  WAS_NO_G_DEPR
137 #define G_DISABLE_DEPRECATED
138 #undef  WAS_NO_G_DEPR
139 #endif
140
141 #endif /* G_HAVE_GNUC_VISIBILITY */
142 EOF
143
144