* renamed CACAO_TYPECHECK to ENABLE_VERIFIER
[cacao.git] / src / vm / stringlocal.h
1 /* src/vm/stringlocal.h - string header
2
3    Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
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.
14
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.
19
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., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Christian Thalinger
28
29    Changes:
30
31    $Id: stringlocal.h 3694 2005-11-17 13:47:28Z twisti $
32
33 */
34
35
36 #ifndef _STRINGLOCAL_H
37 #define _STRINGLOCAL_H
38
39 typedef struct literalstring literalstring;
40
41
42 #include "config.h"
43 #include "vm/types.h"
44
45 #include "vm/global.h"                  /* required before java_lang_String.h */
46 #include "native/include/java_lang_String.h"
47
48 #include "vm/utf8.h"
49 #include "vm/tables.h"
50
51
52 /* data structure of internal javastrings stored in global hashtable **********/
53
54 struct literalstring {
55         literalstring     *hashlink;        /* link for external hash chain       */
56         java_objectheader *string;  
57 };
58
59 /* javastring-hashtable */
60 extern hashtable string_hash;
61
62
63 /* global string definitions **************************************************/
64
65 /* exception/error super class */
66
67 extern const char *string_java_lang_Throwable;
68 extern const char *string_java_lang_VMThrowable;
69
70
71 /* specify some exception strings for code generation */
72
73 extern const char *string_java_lang_ArithmeticException;
74 extern const char *string_java_lang_ArithmeticException_message;
75 extern const char *string_java_lang_ArrayIndexOutOfBoundsException;
76 extern const char *string_java_lang_ArrayStoreException;
77 extern const char *string_java_lang_ClassCastException;
78 extern const char *string_java_lang_ClassNotFoundException;
79 extern const char *string_java_lang_CloneNotSupportedException;
80 extern const char *string_java_lang_Exception;
81 extern const char *string_java_lang_IllegalAccessException;
82 extern const char *string_java_lang_IllegalArgumentException;
83 extern const char *string_java_lang_IllegalMonitorStateException;
84 extern const char *string_java_lang_IndexOutOfBoundsException;
85 extern const char *string_java_lang_InstantiationException;
86 extern const char *string_java_lang_InterruptedException;
87 extern const char *string_java_lang_NegativeArraySizeException;
88 extern const char *string_java_lang_NoSuchFieldException;
89 extern const char *string_java_lang_NoSuchMethodException;
90 extern const char *string_java_lang_NullPointerException;
91 extern const char *string_java_lang_reflect_InvocationTargetException;
92
93
94 /* specify some error strings for code generation */
95
96 extern const char *string_java_lang_AbstractMethodError;
97 extern const char *string_java_lang_ClassCircularityError;
98 extern const char *string_java_lang_ClassFormatError;
99 extern const char *string_java_lang_Error;
100 extern const char *string_java_lang_ExceptionInInitializerError;
101 extern const char *string_java_lang_IncompatibleClassChangeError;
102 extern const char *string_java_lang_InternalError;
103 extern const char *string_java_lang_InstantiationError;
104 extern const char *string_java_lang_LinkageError;
105 extern const char *string_java_lang_NoClassDefFoundError;
106 extern const char *string_java_lang_NoSuchFieldError;
107 extern const char *string_java_lang_NoSuchMethodError;
108 extern const char *string_java_lang_OutOfMemoryError;
109 extern const char *string_java_lang_UnsatisfiedLinkError;
110 extern const char *string_java_lang_UnsupportedClassVersionError;
111 extern const char *string_java_lang_VerifyError;
112 extern const char *string_java_lang_VirtualMachineError;
113
114
115 /* function prototypes ********************************************************/
116
117 /* initialize string subsystem */
118 bool string_init(void);
119
120 void stringtable_update(void);
121
122 /* creates a new object of type java/lang/String from a utf-text */
123 java_lang_String *javastring_new(utf *text);
124
125 /* creates a new object of type java/lang/String from a utf-text, changes slashes to dots */
126 java_lang_String *javastring_new_slash_to_dot(utf *text);
127
128 /* creates a new object of type java/lang/String from a c-string */
129 java_lang_String *javastring_new_char(const char *text);
130
131 /* make c-string from a javastring (debugging) */
132 char *javastring_tochar(java_objectheader *s);
133
134 /* make utf symbol from javastring */
135 utf *javastring_toutf(java_lang_String *string, bool isclassname);
136
137 /* returns length of javastring */
138 s4 javastring_strlen(java_objectheader *so);
139
140 /* creates a new javastring with the text of the u2-array */
141 java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
142                                                                         bool copymode);
143
144 /* creates a new javastring with the text of the utf-symbol */
145 java_objectheader *literalstring_new(utf *u);
146
147 /* dispose a javastring */
148 void literalstring_free(java_objectheader*);
149
150 #endif /* _STRINGLOCAL_H */
151
152
153 /*
154  * These are local overrides for various environment variables in Emacs.
155  * Please do not remove this and leave it at the end of the file, where
156  * Emacs will automagically detect them.
157  * ---------------------------------------------------------------------
158  * Local variables:
159  * mode: c
160  * indent-tabs-mode: t
161  * c-basic-offset: 4
162  * tab-width: 4
163  * End:
164  */