1 /* src/vm/stringlocal.h - string header
3 Copyright (C) 1996-2005, 2006 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 Contact: cacao@cacaojvm.org
27 Authors: Christian Thalinger
31 $Id: stringlocal.h 4566 2006-03-07 10:36:42Z twisti $
36 #ifndef _STRINGLOCAL_H
37 #define _STRINGLOCAL_H
39 typedef struct literalstring literalstring;
45 #include "vm/global.h" /* required before java_lang_String.h */
46 #include "native/include/java_lang_String.h"
48 #include "vm/hashtable.h"
52 /* data structure of internal javastrings stored in global hashtable **********/
54 struct literalstring {
55 literalstring *hashlink; /* link for external hash chain */
56 java_objectheader *string;
60 /* javastring-hashtable */
61 extern hashtable hashtable_string;
64 /* global string definitions **************************************************/
66 /* exception/error super class */
68 extern const char *string_java_lang_Throwable;
69 extern const char *string_java_lang_VMThrowable;
72 /* specify some exception strings for code generation */
74 extern const char *string_java_lang_ArithmeticException;
75 extern const char *string_java_lang_ArithmeticException_message;
76 extern const char *string_java_lang_ArrayIndexOutOfBoundsException;
77 extern const char *string_java_lang_ArrayStoreException;
78 extern const char *string_java_lang_ClassCastException;
79 extern const char *string_java_lang_ClassNotFoundException;
80 extern const char *string_java_lang_CloneNotSupportedException;
81 extern const char *string_java_lang_Exception;
82 extern const char *string_java_lang_IllegalAccessException;
83 extern const char *string_java_lang_IllegalArgumentException;
84 extern const char *string_java_lang_IllegalMonitorStateException;
85 extern const char *string_java_lang_IndexOutOfBoundsException;
86 extern const char *string_java_lang_InstantiationException;
87 extern const char *string_java_lang_InterruptedException;
88 extern const char *string_java_lang_NegativeArraySizeException;
89 extern const char *string_java_lang_NoSuchFieldException;
90 extern const char *string_java_lang_NoSuchMethodException;
91 extern const char *string_java_lang_NullPointerException;
92 extern const char *string_java_lang_StringIndexOutOfBoundsException;
93 extern const char *string_java_lang_reflect_InvocationTargetException;
96 /* specify some error strings for code generation */
98 extern const char *string_java_lang_AbstractMethodError;
99 extern const char *string_java_lang_ClassCircularityError;
100 extern const char *string_java_lang_ClassFormatError;
101 extern const char *string_java_lang_Error;
102 extern const char *string_java_lang_ExceptionInInitializerError;
103 extern const char *string_java_lang_IncompatibleClassChangeError;
104 extern const char *string_java_lang_InternalError;
105 extern const char *string_java_lang_InstantiationError;
106 extern const char *string_java_lang_LinkageError;
107 extern const char *string_java_lang_NoClassDefFoundError;
108 extern const char *string_java_lang_NoSuchFieldError;
109 extern const char *string_java_lang_NoSuchMethodError;
110 extern const char *string_java_lang_OutOfMemoryError;
111 extern const char *string_java_lang_UnsatisfiedLinkError;
112 extern const char *string_java_lang_UnsupportedClassVersionError;
113 extern const char *string_java_lang_VerifyError;
114 extern const char *string_java_lang_VirtualMachineError;
117 /* function prototypes ********************************************************/
119 /* initialize string subsystem */
120 bool string_init(void);
122 void stringtable_update(void);
124 /* creates a new object of type java/lang/String from a utf-text */
125 java_lang_String *javastring_new(utf *text);
127 /* creates a new object of type java/lang/String from a utf-text, changes slashes to dots */
128 java_lang_String *javastring_new_slash_to_dot(utf *text);
130 /* creates a new object of type java/lang/String from a c-string */
131 java_lang_String *javastring_new_char(const char *text);
133 /* make c-string from a javastring (debugging) */
134 char *javastring_tochar(java_objectheader *s);
136 /* make utf symbol from javastring */
137 utf *javastring_toutf(java_lang_String *string, bool isclassname);
139 /* returns length of javastring */
140 s4 javastring_strlen(java_lang_String *s);
142 /* creates a new javastring with the text of the u2-array */
143 java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
146 /* creates a new javastring with the text of the utf-symbol */
147 java_objectheader *literalstring_new(utf *u);
149 /* dispose a javastring */
150 void literalstring_free(java_objectheader*);
152 #endif /* _STRINGLOCAL_H */
156 * These are local overrides for various environment variables in Emacs.
157 * Please do not remove this and leave it at the end of the file, where
158 * Emacs will automagically detect them.
159 * ---------------------------------------------------------------------
162 * indent-tabs-mode: t