return Py_None;
}
- return PyLong_FromLongLong ((long long)self->symbol->const_int);
+ if (self->symbol->const_int_is_unsigned)
+ return PyLong_FromUnsignedLongLong ((unsigned long long)self->symbol->const_int);
+ else
+ return PyLong_FromLongLong ((long long)self->symbol->const_int);
}
static PyObject *
-/* GObject introspection: C parser
+/* GObject introspection: C parser -*- indent-tabs-mode: t; tab-width: 8 -*-
*
* Copyright (c) 1997 Sandro Sigala <ssigala@globalnet.it>
* Copyright (c) 2007-2008 Jürg Billeter <j@bitron.ch>
}
| INTEGER
{
+ char *rest;
+ guint64 value;
$$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
$$->const_int_set = TRUE;
if (g_str_has_prefix (yytext, "0x") && strlen (yytext) > 2) {
- $$->const_int = g_ascii_strtoll (yytext + 2, NULL, 16);
+ value = g_ascii_strtoull (yytext + 2, &rest, 16);
} else if (g_str_has_prefix (yytext, "0") && strlen (yytext) > 1) {
- $$->const_int = g_ascii_strtoll (yytext + 1, NULL, 8);
+ value = g_ascii_strtoull (yytext + 1, &rest, 8);
} else {
- $$->const_int = g_ascii_strtoll (yytext, NULL, 10);
+ value = g_ascii_strtoull (yytext, &rest, 10);
}
+ $$->const_int = value;
+ $$->const_int_is_unsigned = (rest && (rest[0] == 'U'));
}
| CHARACTER
{
gboolean const_int_set;
gboolean private;
gint64 const_int; /* 64-bit we can handle signed and unsigned 32-bit values */
+ gboolean const_int_is_unsigned;
char *const_string;
gboolean const_double_set;
double const_double;
<type name="gdouble" c:type="double"/>
</field>
</record>
+ <constant name="MAXUINT64"
+ value="18446744073709551615"
+ c:type="REGRESS_MAXUINT64">
+ <type name="gint64" c:type="gint64"/>
+ </constant>
+ <constant name="MININT64"
+ value="-9223372036854775808"
+ c:type="REGRESS_MININT64">
+ <type name="gint64" c:type="gint64"/>
+ </constant>
<constant name="Mixed_Case_Constant"
value="4423"
c:type="REGRESS_Mixed_Case_Constant">
<type name="gint" c:type="gint"/>
</constant>
+ <constant name="NEGATIVE_INT_CONSTANT"
+ value="-42"
+ c:type="REGRESS_NEGATIVE_INT_CONSTANT">
+ <type name="gint" c:type="gint"/>
+ </constant>
<constant name="STRING_CONSTANT"
value="Some String"
c:type="REGRESS_STRING_CONSTANT">
/* constants */
+#define REGRESS_NEGATIVE_INT_CONSTANT -42
#define REGRESS_INT_CONSTANT 4422
#define REGRESS_DOUBLE_CONSTANT 44.22
#define REGRESS_STRING_CONSTANT "Some String"
*/
#define _DONTSCANTHIS 1
+/* https://bugzilla.gnome.org/show_bug.cgi?id=685022 */
+#define REGRESS_MININT64 ((gint64) G_GINT64_CONSTANT(0x8000000000000000))
+#define REGRESS_MAXUINT64 (G_GINT64_CONSTANT(0xffffffffffffffffU))
+
#endif /* __GITESTTYPES_H__ */