diff --git a/gobject/ChangeLog b/gobject/ChangeLog index 29022c945..52266cc34 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,3 +1,9 @@ +Wed Oct 3 16:02:24 2001 Owen Taylor + + * glib-genmarshal.c gparamspecs.[ch] gvalue.h + gobject/gvaluetypes.[ch]: Add support for G_TYPE_INT64 + and storing it in GValue (Patch from Mathieu Lacage, #59254.) + 2001-10-03 jacob berkman * gtype.c (type_iface_retrieve_holder_info_Wm): diff --git a/gobject/glib-genmarshal.c b/gobject/glib-genmarshal.c index 555c34d84..ff21629f8 100644 --- a/gobject/glib-genmarshal.c +++ b/gobject/glib-genmarshal.c @@ -153,6 +153,10 @@ complete_in_arg (InArgument *iarg) { "BOXED", "BOXED", "gpointer", "g_value_get_boxed", }, { "POINTER", "POINTER", "gpointer", "g_value_get_pointer", }, { "OBJECT", "OBJECT", "gpointer", "g_value_get_object", }, +#ifdef G_HAVE_GINT64 + { "INT64", "INT64", "gint64", "g_value_get_int64", }, + { "UINT64", "UINT64", "guint64", "g_value_get_uint64", }, +#endif /* G_HAVE_GINT64 */ /* deprecated: */ { "NONE", "VOID", "void", NULL, }, { "BOOL", "BOOLEAN", "gboolean", "g_value_get_boolean", }, @@ -196,6 +200,10 @@ complete_out_arg (OutArgument *oarg) { "BOXED", "BOXED", "gpointer", "g_value_set_boxed_take_ownership", NULL, NULL }, { "POINTER", "POINTER", "gpointer", "g_value_set_pointer", NULL, NULL }, { "OBJECT", "OBJECT", "GObject*", "g_value_set_object", "g_object_unref", "NULL !=" }, +#ifdef G_HAVE_GINT64 + { "INT64", "INT64", "gint64", "g_value_set_int64", NULL, NULL }, + { "UINT64", "UINT64", "guint64", "g_value_set_uint64", NULL, NULL }, +#endif /* G_HAVE_GINT64 */ /* deprecated: */ { "NONE", "VOID", "void", NULL, NULL, NULL }, { "BOOL", "BOOLEAN", "gboolean", "g_value_set_boolean", NULL, NULL } diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c index 9b2f10461..182315fa5 100644 --- a/gobject/gparamspecs.c +++ b/gobject/gparamspecs.c @@ -1698,3 +1698,59 @@ g_param_spec_object (const gchar *name, return G_PARAM_SPEC (ospec); } + +#ifdef G_HAVE_GINT64 + +GParamSpec* +g_param_spec_int64 (const gchar *name, + const gchar *nick, + const gchar *blurb, + gint64 minimum, + gint64 maximum, + gint64 default_value, + GParamFlags flags) +{ + GParamSpecInt64 *ispec; + + g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL); + + ispec = g_param_spec_internal (G_TYPE_PARAM_INT64, + name, + nick, + blurb, + flags); + + ispec->minimum = minimum; + ispec->maximum = maximum; + ispec->default_value = default_value; + + return G_PARAM_SPEC (ispec); +} + +GParamSpec* +g_param_spec_uint64 (const gchar *name, + const gchar *nick, + const gchar *blurb, + guint64 minimum, + guint64 maximum, + guint64 default_value, + GParamFlags flags) +{ + GParamSpecUInt64 *ispec; + + g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL); + + ispec = g_param_spec_internal (G_TYPE_PARAM_UINT64, + name, + nick, + blurb, + flags); + + ispec->minimum = minimum; + ispec->maximum = maximum; + ispec->default_value = default_value; + + return G_PARAM_SPEC (ispec); +} + +#endif /* G_HAVE_GINT64 */ diff --git a/gobject/gparamspecs.h b/gobject/gparamspecs.h index 12dd120a6..ba480539e 100644 --- a/gobject/gparamspecs.h +++ b/gobject/gparamspecs.h @@ -90,6 +90,11 @@ typedef struct _GParamSpecPointer GParamSpecPointer; typedef struct _GParamSpecValueArray GParamSpecValueArray; typedef struct _GParamSpecClosure GParamSpecClosure; typedef struct _GParamSpecObject GParamSpecObject; +#ifdef G_HAVE_GINT64 +typedef struct _GParamSpecInt64 GParamSpecInt64; +typedef struct _GParamSpecUInt64 GParamSpecUInt64; +#endif /* G_HAVE_GINT64 */ + struct _GParamSpecChar { GParamSpec parent_instance; @@ -219,7 +224,24 @@ struct _GParamSpecObject { GParamSpec parent_instance; }; - +#ifdef G_HAVE_GINT64 +struct _GParamSpecInt64 +{ + GParamSpec parent_instance; + + gint64 minimum; + gint64 maximum; + gint64 default_value; +}; +struct _GParamSpecUInt64 +{ + GParamSpec parent_instance; + + guint64 minimum; + guint64 maximum; + guint64 default_value; +}; +#endif /* G_HAVE_GINT64 */ /* --- GParamSpec prototypes --- */ GParamSpec* g_param_spec_char (const gchar *name, @@ -333,6 +355,20 @@ GParamSpec* g_param_spec_object (const gchar *name, const gchar *blurb, GType object_type, GParamFlags flags); +GParamSpec* g_param_spec_int64 (const gchar *name, + const gchar *nick, + const gchar *blurb, + gint64 minimum, + gint64 maximum, + gint64 default_value, + GParamFlags flags); +GParamSpec* g_param_spec_uint64 (const gchar *name, + const gchar *nick, + const gchar *blurb, + guint64 minimum, + guint64 maximum, + guint64 default_value, + GParamFlags flags); G_END_DECLS diff --git a/gobject/gtype.h b/gobject/gtype.h index 64f82851b..686638a77 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -50,6 +50,8 @@ typedef enum /*< skip >*/ G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, + G_TYPE_INT64, + G_TYPE_UINT64, G_TYPE_ENUM, G_TYPE_FLAGS, G_TYPE_FLOAT, @@ -90,7 +92,10 @@ typedef enum /*< skip >*/ G_TYPE_PARAM_POINTER = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 16), G_TYPE_PARAM_VALUE_ARRAY = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 17), G_TYPE_PARAM_CLOSURE = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 18), - G_TYPE_PARAM_OBJECT = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 19) + G_TYPE_PARAM_OBJECT = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 19), + G_TYPE_PARAM_INT64 = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 20), + G_TYPE_PARAM_UINT64 = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 21) + } GTypeFundamentals; diff --git a/gobject/gvalue.h b/gobject/gvalue.h index 6217738d1..083cc5763 100644 --- a/gobject/gvalue.h +++ b/gobject/gvalue.h @@ -50,6 +50,10 @@ struct _GValue guint v_uint; glong v_long; gulong v_ulong; +#ifdef G_HAVE_GINT64 + gint64 v_int64; + guint64 v_uint64; +#endif /* G_HAVE_GINT64 */ gfloat v_float; gdouble v_double; gpointer v_pointer; diff --git a/gobject/gvaluetypes.c b/gobject/gvaluetypes.c index dde820b64..cdbcc070e 100644 --- a/gobject/gvaluetypes.c +++ b/gobject/gvaluetypes.c @@ -711,6 +711,41 @@ g_value_get_pointer (const GValue *value) return value->data[0].v_pointer; } +#ifdef G_HAVE_GINT64 +void +g_value_set_int64 (GValue *value, + gint64 v_int64) +{ + g_return_if_fail (G_VALUE_HOLDS_INT64 (value)); + + value->data[0].v_int64 = v_int64; +} + +gint64 +g_value_get_int64 (const GValue *value) +{ + g_return_val_if_fail (G_VALUE_HOLDS_INT64 (value), 0); + + return value->data[0].v_int64; +} + +void +g_value_set_uint64 (GValue *value, + guint64 v_uint64) +{ + g_return_if_fail (G_VALUE_HOLDS_UINT64 (value)); + + value->data[0].v_uint64 = v_uint64; +} + +guint64 +g_value_get_uint64 (const GValue *value) +{ + g_return_val_if_fail (G_VALUE_HOLDS_UINT64 (value), 0); + + return value->data[0].v_uint64; +} +#endif /* G_HAVE_GINT64 */ /* need extra includes for g_strdup_value_contents() ;( */ #include "gobject.h" diff --git a/gobject/gvaluetypes.h b/gobject/gvaluetypes.h index 371c846b5..00ebb8332 100644 --- a/gobject/gvaluetypes.h +++ b/gobject/gvaluetypes.h @@ -38,6 +38,8 @@ G_BEGIN_DECLS #define G_VALUE_HOLDS_DOUBLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_DOUBLE)) #define G_VALUE_HOLDS_STRING(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING)) #define G_VALUE_HOLDS_POINTER(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_POINTER)) +#define G_VALUE_HOLDS_INT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT64)) +#define G_VALUE_HOLDS_UINT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT64)) /* --- prototypes --- */ @@ -77,6 +79,14 @@ gchar* g_value_dup_string (const GValue *value); void g_value_set_pointer (GValue *value, gpointer v_pointer); gpointer g_value_get_pointer (const GValue *value); +#ifdef G_HAVE_GINT64 +void g_value_set_int64 (GValue *value, + gint64 v_int64); +gint64 g_value_get_int64 (const GValue *value); +void g_value_set_uint64 (GValue *value, + guint64 v_uint64); +guint64 g_value_get_uint64 (const GValue *value); +#endif /* G_HAVE_GINT64 */ /* debugging aid, describe value contents as string */