gnomemm r1812 - in gstreamermm/trunk: . gstreamer/src tools/extra_defs_gen tools/m4



Author: jaalburqu
Date: Thu Nov 27 03:00:07 2008
New Revision: 1812
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1812&view=rev

Log:
2008-11-26  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/src/ghostpad.ccg: Restored because changes were committed
	accidentally (rev. 1808).
	* tools/m4/Makefile_list_of_sources.am_fragment: Added ctocpp_base.m4
	to list of m4 tool files.
	* tools/m4/ctocpp_base.m4: Added macro docs.  Added _CTOCPP_INCLUDE()
	macro to generate a C++ include directive, if necessary, from a ctype.
	Removed commented example usages because docs explain how to use
	macros.
	* tools/extra_defs_gen/generate_plugin_gmmproc_file.cc: Modified to
	use _CTOCPP_INCLUDE() macro so that C++ type declarations are included
	if necessary.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/ghostpad.ccg
   gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
   gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment
   gstreamermm/trunk/tools/m4/ctocpp_base.m4

Modified: gstreamermm/trunk/gstreamer/src/ghostpad.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/ghostpad.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/ghostpad.ccg	Thu Nov 27 03:00:07 2008
@@ -31,7 +31,7 @@
   : _CONSTRUCT("name", name.c_str(),
       "direction", (GstPadDirection) target->get_direction())
 {
-  if (!gst_ghost_pad_construct(gobj()))
+  if (!gst_ghost_pad_construct(gobj(), name.c_str(), target->gobj()))
     g_warning("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Pad>&): Unsuccessful construction of ghost pad.");
 }
@@ -39,7 +39,7 @@
 GhostPad::GhostPad(const Glib::ustring& name, PadDirection direction)
   : _CONSTRUCT("name", name.c_str(), "direction", (GstPadDirection) direction)
 {
-  if (!gst_ghost_pad_construct(gobj()))
+  if (!gst_ghost_pad_construct_no_target(gobj(), name.c_str(), (GstPadDirection) direction))
   {
     g_warning("Gst::GhostPad::GhostPad(const Glib::ustring&, PadDirection):"
     " Unsuccessful construction of ghost pad.");
@@ -51,7 +51,7 @@
     : _CONSTRUCT("name", name.c_str(), "direction",
         (GstPadDirection) target->get_direction(), "template", templ->gobj())
 {
-  if (!gst_ghost_pad_construct(gobj()))
+  if (!gst_ghost_pad_construct_from_template(gobj(), name.c_str(), target->gobj(), templ->gobj()))
   {
     g_warning("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Pad>&, const Glib::RefPtr<PadTemplate>&):"
@@ -63,7 +63,7 @@
     : _CONSTRUCT("name", name.c_str(), "direction", 
         (GstPadDirection) templ->get_direction(), "template", templ->gobj())
 {
-  if (!gst_ghost_pad_construct(gobj()))
+  if (!gst_ghost_pad_construct_no_target_from_template(gobj(), name.c_str(), templ->gobj()))
   {
     g_warning("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<PadTemplate>&): Unsuccessful construction of ghost"

Modified: gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
==============================================================================
--- gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc	(original)
+++ gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc	Thu Nov 27 03:00:07 2008
@@ -61,7 +61,7 @@
 }
 
 void get_property_wrap_statements(Glib::ustring& wrapStatements,
-  Glib::ustring& enumDefinitions)
+  Glib::ustring& includeMacroCalls, Glib::ustring& enumDefinitions)
 {
   std::string strResult;
   std::string strObjectName = g_type_name(type);
@@ -100,6 +100,8 @@
 
       wrapStatements += "  _WRAP_PROPERTY(\"" + propertyName + "\", " +
         "_CTOCPP(" + propertyCType + ") )\n";
+
+      includeMacroCalls += "_CTOCPP_INCLUDE(" + propertyCType + ")\n";
     }
   }
 
@@ -109,12 +111,15 @@
 void generate_hg_file()
 {
   Glib::ustring propertyWrapStatements;
+  Glib::ustring includeMacroCalls;
   Glib::ustring enumDefinitions;
 
-  get_property_wrap_statements(propertyWrapStatements, enumDefinitions);
+  get_property_wrap_statements(propertyWrapStatements, includeMacroCalls, enumDefinitions);
 
   std::cout << "#include <" << includeRoot << "/" <<
-    cppParentTypeName.lowercase() << ".h>" << std::endl << std::endl;
+    cppParentTypeName.lowercase() << ".h>" << std::endl;
+
+  std::cout << includeMacroCalls << std::endl;
 
   std::cout << "_DEFS(" << target << "," << defsFile << ")" << std::endl <<
     std::endl;

Modified: gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment
==============================================================================
--- gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment	(original)
+++ gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment	Thu Nov 27 03:00:07 2008
@@ -1,2 +1,3 @@
-files_tools_m4 = convert.m4 convert_gst.m4 convert_gstbase.m4 class_gstminiobject.m4 class_boxedtype_extra.m4
+files_tools_m4 = convert.m4 convert_gst.m4 convert_gstbase.m4 ctocpp_base.m4 \
+		 class_gstminiobject.m4 class_boxedtype_extra.m4
 

Modified: gstreamermm/trunk/tools/m4/ctocpp_base.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/ctocpp_base.m4	(original)
+++ gstreamermm/trunk/tools/m4/ctocpp_base.m4	Thu Nov 27 03:00:07 2008
@@ -2,15 +2,46 @@
 dnl Macros to convert from C to C++ types
 dnl
 
+dnl _CPPTYPE(ctype, param cpptype, return cpptype, cppinclude)
+dnl
+dnl Records a translation from a C type to a C++ type.  If a return cpptype is
+dnl not given, it is assumed to be the same as the param cpptype.  A cpp
+dnl include need not be specified (the <> or "" are required).  If an include
+dnl is specified, a C++ include directive may be generated with the
+dnl _CTOCPP_INCLUDE macro.
+dnl
 m4_define(`_CPPTYPE',`dnl
-m4_define(`TFP'__HASH(`$1'),`$2')'`dnl
+m4_define(`TFP'__HASH(`$1'),`$2')dnl
 m4_ifelse(`$3',,`dnl
 m4_define(`TFR'__HASH(`$1'),`$2')',`dnl
 m4_define(`TFR'__HASH(`$1'),`$3')dnl
+')`'dnl
+m4_ifelse(`$4',,,`m4_define(`IF'__HASH(`$1'),`$4')')`'dnl
 ')dnl
-m4_ifelse(`$4',,,`m4_define(`IF'__HASH(`$1'),`$4')')dnl
+
+dnl _CTOCPP_INCLUDE(ctype)
+dnl
+dnl Produces a C++ include direcive of the C++ header for the ctype if a
+dnl translation has been defined and an include parameter was included.  Only
+dnl one directive will be generated for multiple calls (i.e. none but the first
+dnl call produces anything).
+dnl
+m4_define(`_CTOCPP_INCLUDE',`dnl
+m4_ifdef(`IFC'__HASH(`$1'),,`dnl
+m4_ifdef(`IF'__HASH(`$1'),`dnl
+#include m4_indir(`IF'__HASH(`$1'))`'dnl
+m4_define(`IFC'__HASH(`$1'),`complete')dnl
+')`'dnl
+')`'dnl
 ')dnl
 
+dnl _CTOCPP(ctype, use return translation)
+dnl
+dnl Translates from a specified C type to a C++ param or return type.  If a
+dnl `use return translation' (boolean) parameter is included, the return C++
+dnl type is rendered.  If not (no second parameter), the C++ parameter type is
+dnl rendered.
+dnl
 m4_define(`_CTOCPP',`dnl
 m4_ifelse(`$2',,`dnl
 m4_ifdef(`TFP'__HASH(`$1'), `m4_indir(`TFP'__HASH(`$1'))',`dnl
@@ -24,13 +55,10 @@
 m4exit(1)`'dnl
 ')`'dnl
 ')`'dnl
-')`'dnl
+')dnl
 
 _CPPTYPE(`GParamBoolean',`bool')
 _CPPTYPE(`GParamInt',`int')
 _CPPTYPE(`GParamULong',`unsigned long')
-_CPPTYPE(`GParamUInt64',`guint64',,`<glib.h>')
+_CPPTYPE(`GParamUInt64',`guint64')
 _CPPTYPE(`GParamString',`Glib::ustring')
-
-dnl _CPPTYPE(`GstElement*',`const Glib::RefPtr<Gst::Element>&',`Glib::RefPtr<Gst::Element>',`<gstreamermm/element.h>')
-dnl _CPPTYPE(`GstElementFactory*',`const Glib::RefPtr<Gst::ElementFactory>&',`Glib::RefPtr<Gst::ElementFactory>',`<gstreamermm/elementfactory.h>')



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