[glibmm/export-more-symbols: 1/3] tools/[gerror|enum].m4: Make template<> classes exportable



commit 8a446c0a380ee1f365cdb262e2cae63fc0835f5c
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Mar 30 21:54:28 2020 +0800

    tools/[gerror|enum].m4: Make template<> classes exportable
    
    Allow to apply the decl_prefix argument onto the template<> classes that
    we generate for the _WRAP_GERROR and _WRAP_ENUM directives in the
    various *.hg files, if specified.
    
    Please note that this is done in GNU m4 style for enum.m4 since we are
    using the 10th argument.

 tools/m4/enum.m4       |  7 ++++---
 tools/m4/gerror.m4     |  2 +-
 tools/pm/Output.pm     | 15 ++++++++-------
 tools/pm/WrapParser.pm |  4 ++--
 4 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/tools/m4/enum.m4 b/tools/m4/enum.m4
index 09f3111b..a6a27e1e 100644
--- a/tools/m4/enum.m4
+++ b/tools/m4/enum.m4
@@ -1,8 +1,8 @@
 dnl
 dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `gtype_func', `conv_to_int',
 dnl          $1       $2         $3             $4             $5            $6
-dnl in_class, `optional_refdoc_comment', 'deprecated')
-dnl   $7                $8                    $9
+dnl in_class, `optional_refdoc_comment', 'deprecated', 'decl_prefix')
+dnl   $7                $8                    $9            $10
 dnl
 m4_define(`_ENUM',`dnl
 _PUSH()
@@ -13,6 +13,7 @@ m4_define(`__ENUM_CLASS_CPPNAME__',m4_ifelse($7,0,,`__CPPNAME__::')`__ENUM_CPPNA
 m4_define(`__ENUM_INDENT1__',m4_ifelse($7,0,,`  '))
 m4_define(`__ENUM_INDENT2__',__ENUM_INDENT1__`'m4_ifelse($6,,,`  '))
 m4_define(`__ENUM_VALUE_BASE__',`Glib::Value_$3<__NAMESPACE__::__ENUM_CLASS_CPPNAME__>')
+m4_define(`__ENUM_DECL_PREFIX__', $10)
 
 _POP()
 dnl
@@ -121,7 +122,7 @@ namespace Glib
 
 ifelse(`$9',,,`_DEPRECATE_IFDEF_START')`'dnl
 template <>
-class Value<__NAMESPACE__::__ENUM_CLASS_CPPNAME__> : public __ENUM_VALUE_BASE__
+class __ENUM_DECL_PREFIX__ Value<__NAMESPACE__::__ENUM_CLASS_CPPNAME__> : public __ENUM_VALUE_BASE__
 {
 public:
   static GType value_type() G_GNUC_CONST;
diff --git a/tools/m4/gerror.m4 b/tools/m4/gerror.m4
index 4de1d0ab..46428da6 100644
--- a/tools/m4/gerror.m4
+++ b/tools/m4/gerror.m4
@@ -51,7 +51,7 @@ namespace Glib
 {
 
 ifelse(`$8',,,`_DEPRECATE_IFDEF_START')`'dnl
-template <>
+template $9 <>
 class Value<__NAMESPACE__::__CPPNAME__::Code> : public __VALUE_BASE__
 {
 public:
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index 7757d4e7..83da2326 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -685,12 +685,12 @@ sub output_wrap_sig_decl($$$$$$$$$$$$$$)
 
 # void output_wrap_enum($filename, $line_num, $cpp_type, $c_type,
 #   $comment, $ref_subst_in, $ref_subst_out, $gtype_func, $conv_to_int,
-#   $in_class, $deprecated, $deprecation_docs, $newin)
-sub output_wrap_enum($$$$$$$$$$$$$$)
+#   $in_class, $deprecated, $deprecation_docs, $newin, $decl_prefix)
+sub output_wrap_enum($$$$$$$$$$$$$$$)
 {
   my ($self, $filename, $line_num, $cpp_type, $c_type,
     $comment, $ref_subst_in, $ref_subst_out, $gtype_func, $conv_to_int,
-    $in_class, $deprecated, $deprecation_docs, $newin) = @_;
+    $in_class, $deprecated, $deprecation_docs, $newin, $decl_prefix) = @_;
 
   my $objEnum = GtkDefs::lookup_enum($c_type);
   if(!$objEnum)
@@ -729,7 +729,7 @@ sub output_wrap_enum($$$$$$$$$$$$$$)
   my $value_suffix = "Enum";
   $value_suffix = "Flags" if ($$objEnum{flags});
 
-  my $str = sprintf("_ENUM(%s,%s,%s,\`%s\',\`%s\',\`%s\',%d,\`%s\',\`%s\')dnl\n",
+  my $str = sprintf("_ENUM(%s,%s,%s,\`%s\',\`%s\',\`%s\',%d,\`%s\',\`%s\',\`%s\')dnl\n",
     $cpp_type,
     $c_type,
     $value_suffix,
@@ -738,15 +738,16 @@ sub output_wrap_enum($$$$$$$$$$$$$$)
     $conv_to_int,
     $in_class,
     $comment,
-    $deprecated
+    $deprecated,
+    $decl_prefix
   );
   $self->append($str);
 }
 
-sub output_wrap_enum_docs_only($$$$$$$$$$$$)
+sub output_wrap_enum_docs_only($$$$$$$$$$$$$)
 {
   my ($self, $filename, $line_num, $module_canonical, $cpp_type, $c_type,
-    $comment, $ref_subst_in, $ref_subst_out, $in_class, $deprecation_docs, $newin) = @_;
+    $comment, $ref_subst_in, $ref_subst_out, $in_class, $deprecation_docs, $newin, $decl_prefix) = @_;
 
   my $objEnum = GtkDefs::lookup_enum($c_type);
   if(!$objEnum)
diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm
index e6adaabe..9063bce6 100644
--- a/tools/pm/WrapParser.pm
+++ b/tools/pm/WrapParser.pm
@@ -1527,12 +1527,12 @@ sub on_wrap_enum($)
 
   # get the arguments
   my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, $gtype_func, $conv_to_int,
-    $argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(0);
+    $argDeprecated, $deprecation_docs, $newin, $decl_prefix) = $self->on_wrap_any_enum(0);
 
   $$self{objOutputter}->output_wrap_enum(
     $$self{filename}, $$self{line_num}, $cpp_type, $c_type,
     $comment, $ref_subst_in, $ref_subst_out, $gtype_func, $conv_to_int,
-    $$self{in_class}, $argDeprecated, $deprecation_docs, $newin);
+    $$self{in_class}, $argDeprecated, $deprecation_docs, $newin, $decl_prefix);
 }
 
 sub on_wrap_enum_docs_only($)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]