2 Copyright (C) 2002-2005, The Perl Foundation.
3 License: Artistic/GPL, see README and LICENSES for details
8 src/datatypes.c - Parrot and native data types functions
12 The functions in this file are used in .ops files to access the C<enum>
13 and C string constants for Parrot and native data types defined in
14 F<include/parrot/datatypes.h>.
24 #include "parrot/parrot.h"
29 Parrot_get_datatype_enum(Interp *interpreter, STRING *typename)>
31 Return datatype C<enum> for C<STRING*> typename.
38 Parrot_get_datatype_enum(Interp
*interpreter
, STRING
*typename
)
40 char *type
= string_to_cstring(interpreter
, typename
);
43 for (i
= enum_first_type
; i
< enum_last_type
; i
++) {
44 if (!strcmp(data_types
[i
- enum_first_type
].name
, type
)) {
45 string_cstring_free(type
);
50 string_cstring_free(type
);
52 return enum_type_undef
;
58 Parrot_get_datatype_name(Interp *interpreter, INTVAL type)>
60 Return datatype name for C<type>.
67 Parrot_get_datatype_name(Interp
*interpreter
, INTVAL type
)
70 if (type
< enum_first_type
|| type
>= enum_last_type
)
73 s
= data_types
[type
- enum_first_type
].name
;
74 return string_make(interpreter
, s
, strlen(s
), NULL
, PObj_external_FLAG
);
83 F<include/parrot/datatypes.h>.
92 * c-file-style: "parrot"
94 * vim: expandtab shiftwidth=4: