makegtkalias.pl 2.21 KB
Newer Older
Matthias Clasen's avatar
Matthias Clasen committed
1 2
#!/usr/bin/perl -w

3
print <<EOF;
Matthias Clasen's avatar
Matthias Clasen committed
4 5
/* Generated by makegtkalias.pl */

6 7
#ifndef DISABLE_VISIBILITY

8 9
#include <glib.h>

10
#ifdef G_HAVE_GNUC_VISIBILITY
Matthias Clasen's avatar
Matthias Clasen committed
11 12 13 14 15 16

#ifdef  GTK_ENABLE_BROKEN
#define WAS_BROKEN
#endif
#define GTK_ENABLE_BROKEN

17 18 19 20
#ifdef GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
#define WAS_UNSUPPORTED_TEXT_API
#endif
#define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
Matthias Clasen's avatar
Matthias Clasen committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34

#ifdef  GTK_DISABLE_DEPRECATED
#define WAS_NO_DEPR
#endif
#undef  GTK_DISABLE_DEPRECATED

#ifdef  G_DISABLE_DEPRECATED
#define WAS_NO_G_DEPR
#endif
#undef  G_DISABLE_DEPRECATED

#include "gtk.h"

#include "gtkfilesystem.h"
35
#ifdef G_OS_UNIX
Matthias Clasen's avatar
Matthias Clasen committed
36
#include "gtkfilesystemunix.h"
37 38 39 40
#endif
#ifdef G_OS_WIN32
#include "gtkfilesystemwin32.h"
#endif
Matthias Clasen's avatar
Matthias Clasen committed
41 42 43 44 45 46 47 48 49 50 51
#include "gtkhsv.h"
#include "gtkpathbar.h"
#include "gtktextdisplay.h"
#include "gtktextlayout.h"
#include "gtktextsegment.h"
#include "gtktexttypes.h"
#include "gtkthemes.h"
#include "gtkwindow-decorate.h"

EOF

52 53 54
my $in_comment = 0;
my $in_skipped_section = 0;

55 56 57 58 59
while (<>) {

  # ignore empty lines
  next if /^\s*$/;

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
  # skip comments
  if ($_ =~ /^\s*\/\*/)
  {
      $in_comment = 1;
  }
  
  if ($in_comment)
  {
      if ($_ =~  /\*\/\s$/)
      {
	  $in_comment = 0;
      }
      
      next;
  }

  # handle ifdefs
  if ($_ =~ /^\#endif/)
  {
      if (!$in_skipped_section)
      {
	  print $_;
      }

      $in_skipped_section = 0;

      next;
  }

  if ($_ =~ /^\#ifdef\s+INCLUDE_VARIABLES/)
  {
      $in_skipped_section = 1;
  }

  if ($in_skipped_section)
  {
      next;
  }

  if ($_ =~ /^\#ifdef\s+G/)
  {
      print $_;
      
      next;
  }
 

107 108
  my $str = $_;
  chomp($str);
109
  my $alias = "IA__".$str;
110
  
111 112 113 114 115 116
  print <<EOF
extern __typeof ($str) $alias __attribute((visibility("hidden")));
extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
\#define $str $alias

EOF
117 118 119
}

print <<EOF;
Matthias Clasen's avatar
Matthias Clasen committed
120 121 122 123 124 125 126

#ifndef WAS_BROKEN
#undef  GTK_ENABLE_BROKEN
#else
#undef  WAS_BROKEN
#endif

127 128 129 130 131 132
#ifndef WAS_UNSUPPORTED_TEXT_API
#undef GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
#else
#undef WAS_UNSUPPORTED_TEXT_API
#endif

Matthias Clasen's avatar
Matthias Clasen committed
133 134 135 136 137 138 139 140 141 142
#ifdef  WAS_NO_DEPR
#define GTK_DISABLE_DEPRECATED
#undef  WAS_NO_DEPR
#endif

#ifdef  WAS_NO_G_DEPR
#define G_DISABLE_DEPRECATED
#undef  WAS_NO_G_DEPR
#endif

143
#endif /* G_HAVE_GNUC_VISIBILITY */
144 145

#endif /* DISABLE_VISIBILITY */
Matthias Clasen's avatar
Matthias Clasen committed
146 147 148
EOF