summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--girepository/ginfo.c3
-rw-r--r--girepository/ginvoke.c1
-rw-r--r--girepository/girepository.c2
-rw-r--r--girepository/girepository.h17
-rw-r--r--girepository/girnode.c1
-rw-r--r--girepository/girparser.c1
-rw-r--r--giscanner/ast.py6
-rw-r--r--tests/scanner/foo-expected.gir13
-rw-r--r--tests/scanner/foo.c5
-rw-r--r--tests/scanner/foo.h2
-rw-r--r--tools/generate.c1
11 files changed, 41 insertions, 11 deletions
diff --git a/girepository/ginfo.c b/girepository/ginfo.c
index 943d1c71..bc384722 100644
--- a/girepository/ginfo.c
+++ b/girepository/ginfo.c
@@ -1720,6 +1720,9 @@ g_constant_info_get_value (GIConstantInfo *info,
case GI_TYPE_TAG_DOUBLE:
value->v_double = *(gdouble*)&base->typelib->data[blob->offset];
break;
+ case GI_TYPE_TAG_TIME_T:
+ value->v_long = *(long*)&base->typelib->data[blob->offset];
+ break;
case GI_TYPE_TAG_INT:
value->v_int = *(gint*)&base->typelib->data[blob->offset];
break;
diff --git a/girepository/ginvoke.c b/girepository/ginvoke.c
index 919ca888..bbf152bf 100644
--- a/girepository/ginvoke.c
+++ b/girepository/ginvoke.c
@@ -89,6 +89,7 @@ get_ffi_type (GITypeInfo *info)
rettype = &ffi_type_slong;
break;
case GI_TYPE_TAG_SIZE: /* FIXME */
+ case GI_TYPE_TAG_TIME_T: /* May not be portable */
case GI_TYPE_TAG_ULONG:
rettype = &ffi_type_ulong;
break;
diff --git a/girepository/girepository.c b/girepository/girepository.c
index 5320fd9a..25170276 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -748,6 +748,8 @@ g_type_tag_to_string (GITypeTag type)
return "float";
case GI_TYPE_TAG_DOUBLE:
return "double";
+ case GI_TYPE_TAG_TIME_T:
+ return "time_t";
case GI_TYPE_TAG_UTF8:
return "utf8";
case GI_TYPE_TAG_FILENAME:
diff --git a/girepository/girepository.h b/girepository/girepository.h
index 0a7bbb78..d3f68185 100644
--- a/girepository/girepository.h
+++ b/girepository/girepository.h
@@ -285,14 +285,15 @@ typedef enum {
GI_TYPE_TAG_SIZE = 15,
GI_TYPE_TAG_FLOAT = 16,
GI_TYPE_TAG_DOUBLE = 17,
- GI_TYPE_TAG_UTF8 = 18,
- GI_TYPE_TAG_FILENAME = 19,
- GI_TYPE_TAG_ARRAY = 20,
- GI_TYPE_TAG_INTERFACE = 21,
- GI_TYPE_TAG_GLIST = 22,
- GI_TYPE_TAG_GSLIST = 23,
- GI_TYPE_TAG_GHASH = 24,
- GI_TYPE_TAG_ERROR = 25
+ GI_TYPE_TAG_TIME_T = 18,
+ GI_TYPE_TAG_UTF8 = 19,
+ GI_TYPE_TAG_FILENAME = 20,
+ GI_TYPE_TAG_ARRAY = 21,
+ GI_TYPE_TAG_INTERFACE = 22,
+ GI_TYPE_TAG_GLIST = 23,
+ GI_TYPE_TAG_GSLIST = 24,
+ GI_TYPE_TAG_GHASH = 25,
+ GI_TYPE_TAG_ERROR = 26
} GITypeTag;
const gchar* g_type_tag_to_string (GITypeTag type);
diff --git a/girepository/girnode.c b/girepository/girnode.c
index 47d40e1a..fe618ad3 100644
--- a/girepository/girnode.c
+++ b/girepository/girnode.c
@@ -2117,6 +2117,7 @@ g_ir_node_build_typelib (GIrNode *node,
*(glong*)&data[blob->offset] = (glong) parse_int_value (constant->value);
break;
case GI_TYPE_TAG_SIZE: /* FIXME */
+ case GI_TYPE_TAG_TIME_T:
case GI_TYPE_TAG_ULONG:
blob->size = sizeof (gulong);
*(gulong*)&data[blob->offset] = (gulong) parse_uint_value (constant->value);
diff --git a/girepository/girparser.c b/girepository/girparser.c
index fb95903b..e960fb50 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -252,6 +252,7 @@ static BasicTypeInfo basic_types[] = {
{ "size", GI_TYPE_TAG_SIZE, 0 },
{ "float", GI_TYPE_TAG_FLOAT, 0 },
{ "double", GI_TYPE_TAG_DOUBLE, 0 },
+ { "time_t", GI_TYPE_TAG_TIME_T, 0 },
{ "utf8", GI_TYPE_TAG_UTF8, 1 },
{ "filename", GI_TYPE_TAG_FILENAME,1 },
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 7cd90730..5b53417f 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -47,6 +47,7 @@ TYPE_LONG = 'long'
TYPE_ULONG = 'ulong'
TYPE_SSIZET = 'ssize_t'
TYPE_SIZET = 'size_t'
+TYPE_TIMET = 'time_t'
TYPE_FLOAT = 'float'
TYPE_DOUBLE = 'double'
TYPE_STRING = 'string' # requires zero-terminated
@@ -56,7 +57,7 @@ BASIC_GIR_TYPES = [TYPE_BOOLEAN, TYPE_INT8, TYPE_UINT8, TYPE_INT16,
TYPE_UINT16, TYPE_INT32, TYPE_UINT32, TYPE_INT64,
TYPE_UINT64, TYPE_INT, TYPE_UINT, TYPE_LONG,
TYPE_ULONG, TYPE_SSIZET, TYPE_SIZET, TYPE_FLOAT,
- TYPE_DOUBLE]
+ TYPE_DOUBLE, TYPE_TIMET]
GIR_TYPES = [TYPE_NONE, TYPE_ANY]
GIR_TYPES.extend(BASIC_GIR_TYPES)
GIR_TYPES.extend([TYPE_STRING, TYPE_FILENAME])
@@ -96,8 +97,7 @@ type_names['void*'] = TYPE_ANY
type_names['void'] = TYPE_NONE
type_names['size_t'] = TYPE_SIZET
type_names['ssize_t'] = TYPE_SSIZET
-# FIXME - we should be evaluating these per-platform; maybe check glibconfig.h?
-type_names['time_t'] = TYPE_LONG
+# FIXME - can we make libraries use GPid?
type_names['pid_t'] = TYPE_INT
# Suppress some GLib names
diff --git a/tests/scanner/foo-expected.gir b/tests/scanner/foo-expected.gir
index 14d3911f..512e9fce 100644
--- a/tests/scanner/foo-expected.gir
+++ b/tests/scanner/foo-expected.gir
@@ -103,6 +103,19 @@
</parameter>
</parameters>
</method>
+ <method name="is_it_time_yet" c:identifier="foo_object_is_it_time_yet">
+ <return-value>
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object" c:type="FooObject*"/>
+ </parameter>
+ <parameter name="time">
+ <type name="time_t" c:type="time_t"/>
+ </parameter>
+ </parameters>
+ </method>
<property name="string" writable="1">
<type name="string" c:type="gchararray"/>
</property>
diff --git a/tests/scanner/foo.c b/tests/scanner/foo.c
index 3ea4fbdf..ef841a33 100644
--- a/tests/scanner/foo.c
+++ b/tests/scanner/foo.c
@@ -144,6 +144,11 @@ foo_do_foo (FooInterface *self)
}
+void
+foo_object_is_it_time_yet (FooObject *object, time_t time)
+{
+}
+
G_DEFINE_TYPE (FooSubobject, foo_subobject, FOO_TYPE_OBJECT);
static void
diff --git a/tests/scanner/foo.h b/tests/scanner/foo.h
index a2c6ddb2..d00eff37 100644
--- a/tests/scanner/foo.h
+++ b/tests/scanner/foo.h
@@ -62,6 +62,8 @@ typedef gpointer FooObjectCookie;
FooObjectCookie foo_object_new_cookie (FooObject *object, const char *target);
+void foo_object_is_it_time_yet (FooObject *object, time_t time);
+
struct _FooSubobject
{
FooObject parent_instance;
diff --git a/tools/generate.c b/tools/generate.c
index ada48ccc..f10bdf91 100644
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -83,6 +83,7 @@ write_type_info (const gchar *namespace,
"size",
"float",
"double",
+ "time_t",
"utf8",
"filename"
};