gobject-introspection: support more number type constants.

master
John Benediktsson 2020-01-30 08:21:57 -08:00
parent 487141d440
commit 2200468755
1 changed files with 13 additions and 3 deletions

View File

@ -67,11 +67,21 @@ M: incorrect-type type>c-type drop void* ;
GENERIC: parse-const-value ( str data-type -- value )
: number-type? ( name -- ? )
{
[ "gint" head? ]
[ "guint" head? ]
[ "gchar" = ]
[ "guchar" = ]
[ "gdouble" = ]
[ "gfloat" = ]
} 1|| ;
M: atomic-type parse-const-value
name>> {
{ "gint" [ string>number ] }
{ "gdouble" [ string>number ] }
} case ;
{ [ dup number-type? ] [ drop string>number ] }
{ [ dup "gboolean" = ] [ drop "true" = ] }
} cond ;
M: utf8-type parse-const-value drop ;