]> Pileus Git - ~andy/gtk/blobdiff - gtk/makegtkalias.pl
Improve wording. String change! (#355128, David Lodge)
[~andy/gtk] / gtk / makegtkalias.pl
index d33b08f2ba01feeffd85432a6fa1f85530f15eee..3011a577cc0bffb8bafc305d422440cfa07911b4 100755 (executable)
@@ -1,51 +1,45 @@
 #!/usr/bin/perl -w
 
+my $do_def = 0;
+
+if (($#ARGV >= 0) && ($ARGV[0] eq "-def")) {
+    shift;
+    $do_def = 1;
+}
+
 print <<EOF;
 /* Generated by makegtkalias.pl */
 
+#ifndef DISABLE_VISIBILITY
+
 #include <glib.h>
 
 #ifdef G_HAVE_GNUC_VISIBILITY
 
-#ifdef  GTK_ENABLE_BROKEN
-#define WAS_BROKEN
-#endif
-#define GTK_ENABLE_BROKEN
-
-#ifdef GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
-#define WAS_UNSUPPORTED_TEXT_API
+#ifndef GTK_DISABLE_DEPRECATED
+#define GTK_DISABLE_DEPRECATED
+#define REENABLE_DEPRECATED
 #endif
-#define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
 
-#ifdef  GTK_DISABLE_DEPRECATED
-#define WAS_NO_DEPR
-#endif
-#undef  GTK_DISABLE_DEPRECATED
+EOF
 
-#ifdef  G_DISABLE_DEPRECATED
-#define WAS_NO_G_DEPR
-#endif
-#undef  G_DISABLE_DEPRECATED
+if ($do_def) {
+    print <<EOF
+#undef IN_FILE
+#define IN_FILE defined
 
-#include "gtk.h"
+#undef IN_HEADER
+#define IN_HEADER(x) 1
 
-#include "gtkfilesystem.h"
-#ifdef G_OS_UNIX
-#include "gtkfilesystemunix.h"
-#endif
-#ifdef G_OS_WIN32
-#include "gtkfilesystemwin32.h"
-#endif
-#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
+} 
+else { 
+    print <<EOF
+#define IN_FILE(x) 1
+#define IN_HEADER defined
 
 EOF
+}
 
 my $in_comment = 0;
 my $in_skipped_section = 0;
@@ -84,7 +78,7 @@ while (<>) {
       next;
   }
 
-  if ($_ =~ /^\#ifdef\s+INCLUDE_VARIABLES/)
+  if ($_ =~ /^\#ifdef\s+(INCLUDE_VARIABLES|ALL_FILES)/)
   {
       $in_skipped_section = 1;
   }
@@ -94,51 +88,58 @@ while (<>) {
       next;
   }
 
-  if ($_ =~ /^\#ifdef\s+G/)
+  if ($_ =~ /^\#ifn?def\s+G/)
   {
       print $_;
       
       next;
   }
  
+  if ($_ =~ /^\#if.*(IN_FILE|IN_HEADER)/)
+  {
+      print $_;
+      
+      next;
+  }
 
+  chop;
   my $str = $_;
+  my @words;
+  my $attributes = "";
+
+  @words = split(/ /, $str);
+  $str = shift(@words);
   chomp($str);
   my $alias = "IA__".$str;
   
-  print <<EOF
-extern __typeof ($str) $alias __attribute((visibility("hidden")));
-extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
+  # Drop any Win32 specific .def file syntax,  but keep attributes
+  foreach $word (@words) {
+      $attributes = "$attributes $word" unless $word eq "PRIVATE";
+  }
+      
+  if (!$do_def) {
+    print <<EOF
+extern __typeof ($str) $alias __attribute((visibility("hidden")))$attributes;
 \#define $str $alias
 
 EOF
+  }
+  else {
+    print <<EOF
+\#undef $str 
+extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
+
+EOF
+  }
 }
 
 print <<EOF;
-
-#ifndef WAS_BROKEN
-#undef  GTK_ENABLE_BROKEN
-#else
-#undef  WAS_BROKEN
-#endif
-
-#ifndef WAS_UNSUPPORTED_TEXT_API
-#undef GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
-#else
-#undef WAS_UNSUPPORTED_TEXT_API
-#endif
-
-#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
+#ifdef REENABLE_DEPRECATED
+#undef GTK_DISABLE_DEPRECATED
 #endif
 
 #endif /* G_HAVE_GNUC_VISIBILITY */
+#endif /* DISABLE_VISIBILITY */
 EOF