[beast] BSE: compile bseenums as C++ source



commit d59b3219f791d3082aab76426858c97ac839e544
Author: Stefan Westerfeld <stefan space twc de>
Date:   Fri Jul 22 12:45:48 2011 +0200

    BSE: compile bseenums as C++ source

 bse/Makefile.am                 |    2 +-
 bse/{bseenums.c => bseenums.cc} |   32 ++++++++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index 42728ea..f920d45 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -70,7 +70,7 @@ bse_sources = $(strip \
 	bsebus.cc		bsecategories.cc 	\
 	bsefilter.cc   		bsebiquadfilter.cc	bsefilter-ellf.c	\
 	bseconstant.cc		bseconstvalues.cc	bsecontainer.cc			bsecontextmerger.cc \
-	bsedatapocket.cc	bseeditablesample.cc	bseenums.c			bsegconfig.c \
+	bsedatapocket.cc	bseeditablesample.cc	bseenums.cc			bsegconfig.c \
 	bseglobals.c		bseglue.c		bseitem.c			bsejanitor.c \
 	bsemain.cc		bsemath.c		bsemathsignal.c			bseladspa.cc \
 	bsemidicontroller.c	bsemididevice.c 	bsedevice.cc 			\
diff --git a/bse/bseenums.c b/bse/bseenums.cc
similarity index 91%
rename from bse/bseenums.c
rename to bse/bseenums.cc
index ce3495f..26f559c 100644
--- a/bse/bseenums.c
+++ b/bse/bseenums.cc
@@ -19,7 +19,7 @@
 #include <errno.h>
 
 /* --- prototypes --- */
-extern void	bse_type_register_enums		(void);
+extern "C" void	bse_type_register_enums		(void);
 
 
 /* include generated enum value arrays and *.h files the enums steam from */
@@ -30,27 +30,27 @@ void
 bse_type_register_enums (void)
 {
   static const struct {
-    gchar   *name;
-    GType    parent_type;
-    GType   *type_p;
-    gpointer values;
+    const char *name;
+    GType       parent_type;
+    GType      *type_p;
+    void       *values;
   } enums[] = {
     /* include generated enum list */
 #include "bseenum_list.c"
   };
-  guint n_enums = sizeof (enums) / sizeof (enums[0]);
-  guint i;
+  unsigned int n_enums = sizeof (enums) / sizeof (enums[0]);
+  unsigned int i;
   
   for (i = 0; i < n_enums; i++)
     {
       if (enums[i].parent_type == G_TYPE_ENUM)
 	{
-	  *(enums[i].type_p) = g_enum_register_static (enums[i].name, enums[i].values);
+	  *(enums[i].type_p) = g_enum_register_static (enums[i].name, (GEnumValue*) enums[i].values);
 	  g_value_register_transform_func (SFI_TYPE_CHOICE, *(enums[i].type_p), sfi_value_choice2enum_simple);
 	  g_value_register_transform_func (*(enums[i].type_p), SFI_TYPE_CHOICE, sfi_value_enum2choice);
 	}
       else if (enums[i].parent_type == G_TYPE_FLAGS)
-	*(enums[i].type_p) = g_flags_register_static (enums[i].name, enums[i].values);
+	*(enums[i].type_p) = g_flags_register_static (enums[i].name, (GFlagsValue*) enums[i].values);
       else
 	g_assert_not_reached ();
     }
@@ -59,37 +59,37 @@ bse_type_register_enums (void)
 /* BseErrorType is a static type */
 static GEnumClass *bse_error_class = NULL;
 
-const gchar*
+const char*
 bse_error_name (BseErrorType error_value)
 {
   GEnumValue *ev;
   
   if (!bse_error_class)
-    bse_error_class = g_type_class_ref (BSE_TYPE_ERROR_TYPE);
+    bse_error_class = (GEnumClass*) g_type_class_ref (BSE_TYPE_ERROR_TYPE);
   
   ev = g_enum_get_value (bse_error_class, error_value);
   return ev ? ev->value_name : NULL;
 }
 
-const gchar*
+const char*
 bse_error_nick (BseErrorType error_value)
 {
   GEnumValue *ev;
   
   if (!bse_error_class)
-    bse_error_class = g_type_class_ref (BSE_TYPE_ERROR_TYPE);
+    bse_error_class = (GEnumClass*) g_type_class_ref (BSE_TYPE_ERROR_TYPE);
   
   ev = g_enum_get_value (bse_error_class, error_value);
   return ev ? ev->value_nick : NULL;
 }
 
-const gchar*
+const char*
 bse_error_blurb (BseErrorType error_value)
 {
   GEnumValue *ev;
   
   if (!bse_error_class)
-    bse_error_class = g_type_class_ref (BSE_TYPE_ERROR_TYPE);
+    bse_error_class = (GEnumClass*) g_type_class_ref (BSE_TYPE_ERROR_TYPE);
   
   switch (error_value)
     {
@@ -176,7 +176,7 @@ bse_error_blurb (BseErrorType error_value)
 }
 
 BseErrorType
-bse_error_from_errno (gint            v_errno,
+bse_error_from_errno (int             v_errno,
 		      BseErrorType    fallback)
 {
   return gsl_error_from_errno (v_errno, fallback);



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