]> Pileus Git - ~andy/gtk/blob - gdk-pixbuf/makegdkpixbufalias.pl
No need for INCLUDE_INTERNAL_SYMBOLS anymore.
[~andy/gtk] / gdk-pixbuf / makegdkpixbufalias.pl
1 #!/usr/bin/perl -w
2
3 print <<EOF;
4 /* Generated by makegdkpixbufalias.pl */
5
6 #include <glib.h>
7
8 #ifdef G_HAVE_GNUC_VISIBILITY
9
10 #ifdef  GDK_PIXBUF_DISABLE_DEPRECATED
11 #define WAS_NO_DEPR
12 #endif
13 #undef  GDK_PIXBUF_DISABLE_DEPRECATED
14
15 #ifdef  G_DISABLE_DEPRECATED
16 #define WAS_NO_G_DEPR
17 #endif
18 #undef  G_DISABLE_DEPRECATED
19
20 #include "gdk-pixbuf.h"
21 #include "gdk-pixdata.h"
22
23 EOF
24
25 while (<>) {
26
27   # ignore empty lines
28   next if /^\s*$/;
29
30   # skip comments
31   if ($_ =~ /^\s*\/\*/)
32   {
33       $in_comment = 1;
34   }
35   
36   if ($in_comment)
37   {
38       if ($_ =~  /\*\/\s$/)
39       {
40           $in_comment = 0;
41       }
42       
43       next;
44   }
45
46   # handle ifdefs
47   if ($_ =~ /^\#endif/)
48   {
49       if (!$in_skipped_section)
50       {
51           print $_;
52       }
53
54       $in_skipped_section = 0;
55
56       next;
57   }
58
59   if ($_ =~ /^\#ifdef\s+INCLUDE_VARIABLES/)
60   {
61       $in_skipped_section = 1;
62   }
63
64   if ($in_skipped_section)
65   {
66       next;
67   }
68
69   if ($_ =~ /^\#ifdef\s+G/)
70   {
71       print $_;
72       
73       next;
74   }
75
76
77   my $str = $_;
78   chomp($str);
79   my $alias = $str."__internal_alias";
80   
81   print <<EOF
82 extern __typeof ($str) $alias __attribute((visibility("hidden")));
83 extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
84 \#define $str $alias
85
86 EOF
87 }
88
89 print <<EOF;
90
91 #ifdef  WAS_NO_DEPR
92 #define GDK_PIXBUF_DISABLE_DEPRECATED
93 #undef  WAS_NO_DEPR
94 #endif
95
96 #ifdef  WAS_NO_G_DEPR
97 #define G_DISABLE_DEPRECATED
98 #undef  WAS_NO_G_DEPR
99 #endif
100
101 #endif /* G_HAVE_GNUC_VISIBILITY */
102 EOF
103
104