Fix `char' properties, fixes bug 529604
authorJuerg Billeter <j@bitron.ch>
Sat, 26 Apr 2008 07:56:21 +0000 (07:56 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 26 Apr 2008 07:56:21 +0000 (07:56 +0000)
2008-04-26  Juerg Billeter  <j@bitron.ch>

* gobject/valaccodegenerator.vala:
* gobject/valaccodetypesymbolbinding.vala:

Fix `char' properties, fixes bug 529604

svn path=/trunk/; revision=1318

ChangeLog
gobject/valaccodegenerator.vala
gobject/valaccodetypesymbolbinding.vala

index 1b18982..08087f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-04-26  Jürg Billeter  <j@bitron.ch>
 
+       * gobject/valaccodegenerator.vala:
+       * gobject/valaccodetypesymbolbinding.vala:
+
+       Fix `char' properties, fixes bug 529604
+
+2008-04-26  Jürg Billeter  <j@bitron.ch>
+
        * gobject/valaccodeclassbinding.vala:
 
        Fix DBus services with multiple methods, fixes bug 529571
index 3dc3797..75addc5 100644 (file)
@@ -93,6 +93,8 @@ public class Vala.CCodeGenerator : CodeGenerator {
        public DataType uint_type;
        public DataType long_type;
        public DataType ulong_type;
+       public DataType int8_type;
+       public DataType uint8_type;
        public DataType int64_type;
        public DataType uint64_type;
        public DataType string_type;
@@ -214,6 +216,8 @@ public class Vala.CCodeGenerator : CodeGenerator {
                uint_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("uint"));
                long_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("long"));
                ulong_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("ulong"));
+               int8_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int8"));
+               uint8_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("uint8"));
                int64_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int64"));
                uint64_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("uint64"));
                float_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("float"));
index a7a399c..3b0d430 100644 (file)
@@ -104,6 +104,16 @@ public abstract class Vala.CCodeTypesymbolBinding : CCodeBinding {
                        } else {
                                cspec.add_argument (new CCodeConstant ("FALSE"));
                        }
+               } else if (prop.type_reference.data_type == codegen.int8_type.data_type
+                          || prop.type_reference.data_type == codegen.char_type.data_type) {
+                       cspec.call = new CCodeIdentifier ("g_param_spec_char");
+                       cspec.add_argument (new CCodeConstant ("G_MININT8"));
+                       cspec.add_argument (new CCodeConstant ("G_MAXINT8"));
+                       if (prop.default_expression != null) {
+                               cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                       } else {
+                               cspec.add_argument (new CCodeConstant ("0"));
+                       }
                } else if (prop.type_reference.data_type == codegen.float_type.data_type) {
                        cspec.call = new CCodeIdentifier ("g_param_spec_float");
                        cspec.add_argument (new CCodeConstant ("-G_MAXFLOAT"));