* exceptions_new_nosuchmethoderror: Added.
[cacao.git] / src / vm / stringlocal.h
1 /* vm/stringlocal.h - java.lang.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 3581 2005-11-05 19:44:38Z twisti $
32
33 */
34
35
36 #ifndef _STRINGLOCAL_H
37 #define _STRINGLOCAL_H
38
39 typedef struct literalstring literalstring;
40
41
42 #include "vm/global.h"                  /* required before java_lang_String.h */
43 #include "native/include/java_lang_String.h"
44
45 #include "vm/utf8.h"
46 #include "vm/tables.h"
47
48
49 /* data structure of internal javastrings stored in global hashtable **********/
50
51 struct literalstring {
52         literalstring     *hashlink;        /* link for external hash chain       */
53         java_objectheader *string;  
54 };
55
56 /* javastring-hashtable */
57 extern hashtable string_hash;
58
59
60 /* global string definitions **************************************************/
61
62 /* exception/error super class */
63
64 extern const char *string_java_lang_Throwable;
65 extern const char *string_java_lang_VMThrowable;
66
67
68 /* specify some exception strings for code generation */
69
70 extern const char *string_java_lang_ArithmeticException;
71 extern const char *string_java_lang_ArithmeticException_message;
72 extern const char *string_java_lang_ArrayIndexOutOfBoundsException;
73 extern const char *string_java_lang_ArrayStoreException;
74 extern const char *string_java_lang_ClassCastException;
75 extern const char *string_java_lang_ClassNotFoundException;
76 extern const char *string_java_lang_CloneNotSupportedException;
77 extern const char *string_java_lang_Exception;
78 extern const char *string_java_lang_IllegalAccessException;
79 extern const char *string_java_lang_IllegalArgumentException;
80 extern const char *string_java_lang_IllegalMonitorStateException;
81 extern const char *string_java_lang_IndexOutOfBoundsException;
82 extern const char *string_java_lang_InstantiationException;
83 extern const char *string_java_lang_InterruptedException;
84 extern const char *string_java_lang_NegativeArraySizeException;
85 extern const char *string_java_lang_NoSuchFieldException;
86 extern const char *string_java_lang_NoSuchMethodException;
87 extern const char *string_java_lang_NullPointerException;
88 extern const char *string_java_lang_reflect_InvocationTargetException;
89
90
91 /* specify some error strings for code generation */
92
93 extern const char *string_java_lang_AbstractMethodError;
94 extern const char *string_java_lang_ClassCircularityError;
95 extern const char *string_java_lang_ClassFormatError;
96 extern const char *string_java_lang_Error;
97 extern const char *string_java_lang_ExceptionInInitializerError;
98 extern const char *string_java_lang_IncompatibleClassChangeError;
99 extern const char *string_java_lang_InternalError;
100 extern const char *string_java_lang_InstantiationError;
101 extern const char *string_java_lang_LinkageError;
102 extern const char *string_java_lang_NoClassDefFoundError;
103 extern const char *string_java_lang_NoSuchFieldError;
104 extern const char *string_java_lang_NoSuchMethodError;
105 extern const char *string_java_lang_OutOfMemoryError;
106 extern const char *string_java_lang_UnsatisfiedLinkError;
107 extern const char *string_java_lang_UnsupportedClassVersionError;
108 extern const char *string_java_lang_VerifyError;
109 extern const char *string_java_lang_VirtualMachineError;
110
111
112 /* function prototypes ********************************************************/
113
114 void stringtable_update(void);
115
116 /* creates a new object of type java/lang/String from a utf-text */
117 java_lang_String *javastring_new(utf *text);
118
119 /* creates a new object of type java/lang/String from a utf-text, changes slashes to dots */
120 java_lang_String *javastring_new_slash_to_dot(utf *text);
121
122 /* creates a new object of type java/lang/String from a c-string */
123 java_lang_String *javastring_new_char(const char *text);
124
125 /* make c-string from a javastring (debugging) */
126 char *javastring_tochar(java_objectheader *s);
127
128 /* make utf symbol from javastring */
129 utf *javastring_toutf(java_lang_String *string, bool isclassname);
130
131 /* returns length of javastring */
132 s4 javastring_strlen(java_objectheader *so);
133
134 /* creates a new javastring with the text of the u2-array */
135 java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
136                                                                         bool copymode);
137
138 /* creates a new javastring with the text of the utf-symbol */
139 java_objectheader *literalstring_new(utf *u);
140
141 /* dispose a javastring */
142 void literalstring_free(java_objectheader*);
143
144 #endif /* _STRINGLOCAL_H */
145
146
147 /*
148  * These are local overrides for various environment variables in Emacs.
149  * Please do not remove this and leave it at the end of the file, where
150  * Emacs will automagically detect them.
151  * ---------------------------------------------------------------------
152  * Local variables:
153  * mode: c
154  * indent-tabs-mode: t
155  * c-basic-offset: 4
156  * tab-width: 4
157  * End:
158  */