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