mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
Use GLib types consistently
Rather than have the scanner/parser handle both e.g. "glong" and "long", simply use the GLib types everywhere. This commit adds TYPE_LONG_LONG and TYPE_LONG_DOUBLE to the scanner types; however, rather than add them to the typelib, they're just marked as not-introspectable.
This commit is contained in:
parent
d853f196c1
commit
f5ec6f6698
@ -1445,27 +1445,27 @@ g_type_tag_to_string (GITypeTag type)
|
|||||||
case GI_TYPE_TAG_VOID:
|
case GI_TYPE_TAG_VOID:
|
||||||
return "void";
|
return "void";
|
||||||
case GI_TYPE_TAG_BOOLEAN:
|
case GI_TYPE_TAG_BOOLEAN:
|
||||||
return "boolean";
|
return "gboolean";
|
||||||
case GI_TYPE_TAG_INT8:
|
case GI_TYPE_TAG_INT8:
|
||||||
return "int8";
|
return "gint8";
|
||||||
case GI_TYPE_TAG_UINT8:
|
case GI_TYPE_TAG_UINT8:
|
||||||
return "uint8";
|
return "guint8";
|
||||||
case GI_TYPE_TAG_INT16:
|
case GI_TYPE_TAG_INT16:
|
||||||
return "int16";
|
return "gint16";
|
||||||
case GI_TYPE_TAG_UINT16:
|
case GI_TYPE_TAG_UINT16:
|
||||||
return "uint16";
|
return "guint16";
|
||||||
case GI_TYPE_TAG_INT32:
|
case GI_TYPE_TAG_INT32:
|
||||||
return "int32";
|
return "gint32";
|
||||||
case GI_TYPE_TAG_UINT32:
|
case GI_TYPE_TAG_UINT32:
|
||||||
return "uint32";
|
return "guint32";
|
||||||
case GI_TYPE_TAG_INT64:
|
case GI_TYPE_TAG_INT64:
|
||||||
return "int64";
|
return "gint64";
|
||||||
case GI_TYPE_TAG_UINT64:
|
case GI_TYPE_TAG_UINT64:
|
||||||
return "uint64";
|
return "guint64";
|
||||||
case GI_TYPE_TAG_FLOAT:
|
case GI_TYPE_TAG_FLOAT:
|
||||||
return "float";
|
return "gfloat";
|
||||||
case GI_TYPE_TAG_DOUBLE:
|
case GI_TYPE_TAG_DOUBLE:
|
||||||
return "double";
|
return "gdouble";
|
||||||
case GI_TYPE_TAG_GTYPE:
|
case GI_TYPE_TAG_GTYPE:
|
||||||
return "GType";
|
return "GType";
|
||||||
case GI_TYPE_TAG_UTF8:
|
case GI_TYPE_TAG_UTF8:
|
||||||
|
28
girnode.c
28
girnode.c
@ -1219,36 +1219,10 @@ serialize_type (GIrTypelibBuild *build,
|
|||||||
GString *str)
|
GString *str)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
const gchar* basic[] = {
|
|
||||||
"void",
|
|
||||||
"boolean",
|
|
||||||
"int8",
|
|
||||||
"uint8",
|
|
||||||
"int16",
|
|
||||||
"uint16",
|
|
||||||
"int32",
|
|
||||||
"uint32",
|
|
||||||
"int64",
|
|
||||||
"uint64",
|
|
||||||
"short",
|
|
||||||
"ushort",
|
|
||||||
"int",
|
|
||||||
"uint",
|
|
||||||
"long",
|
|
||||||
"ulong",
|
|
||||||
"ssize",
|
|
||||||
"size",
|
|
||||||
"float",
|
|
||||||
"double",
|
|
||||||
"time_t",
|
|
||||||
"GType",
|
|
||||||
"utf8",
|
|
||||||
"filename",
|
|
||||||
};
|
|
||||||
|
|
||||||
if (node->tag < GI_TYPE_TAG_ARRAY)
|
if (node->tag < GI_TYPE_TAG_ARRAY)
|
||||||
{
|
{
|
||||||
g_string_append_printf (str, "%s%s", basic[node->tag],
|
g_string_append_printf (str, "%s%s", g_type_tag_to_string (node->tag),
|
||||||
node->is_pointer ? "*" : "");
|
node->is_pointer ? "*" : "");
|
||||||
}
|
}
|
||||||
else if (node->tag == GI_TYPE_TAG_ARRAY)
|
else if (node->tag == GI_TYPE_TAG_ARRAY)
|
||||||
|
56
girparser.c
56
girparser.c
@ -359,13 +359,13 @@ typedef struct {
|
|||||||
} IntegerAliasInfo;
|
} IntegerAliasInfo;
|
||||||
|
|
||||||
static IntegerAliasInfo integer_aliases[] = {
|
static IntegerAliasInfo integer_aliases[] = {
|
||||||
{ "char", SIZEOF_CHAR, 0 },
|
{ "gchar", SIZEOF_CHAR, 0 },
|
||||||
{ "short", SIZEOF_SHORT, 1 },
|
{ "gshort", SIZEOF_SHORT, 1 },
|
||||||
{ "ushort", SIZEOF_SHORT, 0 },
|
{ "gushort", SIZEOF_SHORT, 0 },
|
||||||
{ "int", SIZEOF_INT, 1 },
|
{ "gint", SIZEOF_INT, 1 },
|
||||||
{ "uint", SIZEOF_INT, 0 },
|
{ "guint", SIZEOF_INT, 0 },
|
||||||
{ "long", SIZEOF_LONG, 1 },
|
{ "glong", SIZEOF_LONG, 1 },
|
||||||
{ "ulong", SIZEOF_LONG, 0 },
|
{ "gulong", SIZEOF_LONG, 0 },
|
||||||
{ "gsize", GLIB_SIZEOF_SIZE_T, 0 },
|
{ "gsize", GLIB_SIZEOF_SIZE_T, 0 },
|
||||||
{ "gssize", GLIB_SIZEOF_SIZE_T, 1 },
|
{ "gssize", GLIB_SIZEOF_SIZE_T, 1 },
|
||||||
};
|
};
|
||||||
@ -379,30 +379,30 @@ typedef struct {
|
|||||||
#define BASIC_TYPE_FIXED_OFFSET 3
|
#define BASIC_TYPE_FIXED_OFFSET 3
|
||||||
|
|
||||||
static BasicTypeInfo basic_types[] = {
|
static BasicTypeInfo basic_types[] = {
|
||||||
{ "none", GI_TYPE_TAG_VOID, 0 },
|
{ "none", GI_TYPE_TAG_VOID, 0 },
|
||||||
{ "any", GI_TYPE_TAG_VOID, 1 },
|
{ "gpointer", GI_TYPE_TAG_VOID, 1 },
|
||||||
|
|
||||||
{ "bool", GI_TYPE_TAG_BOOLEAN, 0 },
|
{ "gboolean", GI_TYPE_TAG_BOOLEAN, 0 },
|
||||||
{ "int8", GI_TYPE_TAG_INT8, 0 }, /* Start of BASIC_TYPE_FIXED_OFFSET */
|
{ "gint8", GI_TYPE_TAG_INT8, 0 }, /* Start of BASIC_TYPE_FIXED_OFFSET */
|
||||||
{ "uint8", GI_TYPE_TAG_UINT8, 0 },
|
{ "guint8", GI_TYPE_TAG_UINT8, 0 },
|
||||||
{ "int16", GI_TYPE_TAG_INT16, 0 },
|
{ "gint16", GI_TYPE_TAG_INT16, 0 },
|
||||||
{ "uint16", GI_TYPE_TAG_UINT16, 0 },
|
{ "guint16", GI_TYPE_TAG_UINT16, 0 },
|
||||||
{ "int32", GI_TYPE_TAG_INT32, 0 },
|
{ "gint32", GI_TYPE_TAG_INT32, 0 },
|
||||||
{ "uint32", GI_TYPE_TAG_UINT32, 0 },
|
{ "guint32", GI_TYPE_TAG_UINT32, 0 },
|
||||||
{ "int64", GI_TYPE_TAG_INT64, 0 },
|
{ "gint64", GI_TYPE_TAG_INT64, 0 },
|
||||||
{ "uint64", GI_TYPE_TAG_UINT64, 0 },
|
{ "guint64", GI_TYPE_TAG_UINT64, 0 },
|
||||||
{ "float", GI_TYPE_TAG_FLOAT, 0 },
|
{ "gfloat", GI_TYPE_TAG_FLOAT, 0 },
|
||||||
{ "double", GI_TYPE_TAG_DOUBLE, 0 },
|
{ "gdouble", GI_TYPE_TAG_DOUBLE, 0 },
|
||||||
{ "GType", GI_TYPE_TAG_GTYPE, 0 },
|
{ "GType", GI_TYPE_TAG_GTYPE, 0 },
|
||||||
{ "utf8", GI_TYPE_TAG_UTF8, 1 },
|
{ "utf8", GI_TYPE_TAG_UTF8, 1 },
|
||||||
{ "filename", GI_TYPE_TAG_FILENAME,1 },
|
{ "filename", GI_TYPE_TAG_FILENAME,1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const BasicTypeInfo *
|
static const BasicTypeInfo *
|
||||||
parse_basic (const char *str)
|
parse_basic (const char *str)
|
||||||
{
|
{
|
||||||
gint i;
|
guint i;
|
||||||
gint n_basic = G_N_ELEMENTS (basic_types);
|
guint n_basic = G_N_ELEMENTS (basic_types);
|
||||||
|
|
||||||
for (i = 0; i < n_basic; i++)
|
for (i = 0; i < n_basic; i++)
|
||||||
{
|
{
|
||||||
@ -1981,14 +1981,14 @@ end_type_top (ParseContext *ctx)
|
|||||||
typenode->tag == GI_TYPE_TAG_GSLIST)
|
typenode->tag == GI_TYPE_TAG_GSLIST)
|
||||||
{
|
{
|
||||||
if (typenode->parameter_type1 == NULL)
|
if (typenode->parameter_type1 == NULL)
|
||||||
typenode->parameter_type1 = parse_type (ctx, "any");
|
typenode->parameter_type1 = parse_type (ctx, "gpointer");
|
||||||
}
|
}
|
||||||
else if (typenode->tag == GI_TYPE_TAG_GHASH)
|
else if (typenode->tag == GI_TYPE_TAG_GHASH)
|
||||||
{
|
{
|
||||||
if (typenode->parameter_type1 == NULL)
|
if (typenode->parameter_type1 == NULL)
|
||||||
{
|
{
|
||||||
typenode->parameter_type1 = parse_type (ctx, "any");
|
typenode->parameter_type1 = parse_type (ctx, "gpointer");
|
||||||
typenode->parameter_type2 = parse_type (ctx, "any");
|
typenode->parameter_type2 = parse_type (ctx, "gpointer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user