1 /* src/vmcore/primitive.c - primitive types
3 Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 $Id: linker.c 8042 2007-06-07 17:43:29Z twisti $
35 #include "vm/global.h"
37 #include "vmcore/class.h"
38 #include "vmcore/linker.h"
39 #include "vmcore/utf8.h"
42 /* primitive data types *******************************************************/
44 /* These values are used in parsed descriptors and in some other
45 places were the different types handled internally as TYPE_INT have
46 to be distinguished. */
48 #define PRIMITIVETYPE_COUNT 11 /* number of primitive types (+ dummies) */
50 /* CAUTION: Don't change the numerical values! These constants are
51 used as indices into the primitive type table. */
53 #define PRIMITIVETYPE_INT TYPE_INT
54 #define PRIMITIVETYPE_LONG TYPE_LNG
55 #define PRIMITIVETYPE_FLOAT TYPE_FLT
56 #define PRIMITIVETYPE_DOUBLE TYPE_DBL
57 #define PRIMITIVETYPE_DUMMY1 TYPE_ADR /* not used! */
58 #define PRIMITIVETYPE_BYTE 5
59 #define PRIMITIVETYPE_CHAR 6
60 #define PRIMITIVETYPE_SHORT 7
61 #define PRIMITIVETYPE_BOOLEAN 8
62 #define PRIMITIVETYPE_DUMMY2 9 /* not used! */
63 #define PRIMITIVETYPE_VOID TYPE_VOID
66 /* CAUTION: Don't change the numerical values! These constants (with
67 the exception of ARRAYTYPE_OBJECT) are used as indices in the
68 primitive type table. */
70 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
71 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
72 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
73 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
74 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
75 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
76 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
77 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
78 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
81 /* primitivetypeinfo **********************************************************/
83 struct primitivetypeinfo {
84 char *cname; /* char name of primitive class */
85 utf *name; /* name of primitive class */
86 classinfo *class_wrap; /* class for wrapping primitive type */
87 classinfo *class_primitive; /* primitive class */
88 char *wrapname; /* name of class for wrapping */
89 char typesig; /* one character type signature */
90 char *arrayname; /* name of primitive array class */
91 classinfo *arrayclass; /* primitive array class */
95 /* global variables ***********************************************************/
97 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
98 constants (except ARRAYTYPE_OBJECT). */
100 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
103 /* function prototypes ********************************************************/
105 bool primitive_init(void);
106 bool primitive_class_is_primitive(classinfo *c);
107 classinfo *primitive_class_get_by_name(utf *name);
108 classinfo *primitive_class_get_by_type(s4 type);
109 classinfo *primitive_class_get_by_char(char ch);
110 classinfo *primitive_arrayclass_get_by_type(s4 type);
112 #endif /* _PRIMITIVE_H */
116 * These are local overrides for various environment variables in Emacs.
117 * Please do not remove this and leave it at the end of the file, where
118 * Emacs will automagically detect them.
119 * ---------------------------------------------------------------------
122 * indent-tabs-mode: t
126 * vim:noexpandtab:sw=4:ts=4: