099861060d71ff33ae2d15a8dff6cd9148e09e00
[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 1926 2005-02-10 10:47:29Z twisti $
32
33 */
34
35
36 #ifndef _STRINGLOCAL_H
37 #define _STRINGLOCAL_H
38
39 typedef struct literalstring literalstring;
40
41
42 #include "native/include/java_lang_String.h"
43 #include "vm/global.h"
44 #include "vm/tables.h"
45 #include "vm/utf8.h"
46
47
48 /* data structure of internal javastrings stored in global hashtable **********/
49
50 struct literalstring {
51         literalstring     *hashlink;        /* link for external hash chain       */
52         java_objectheader *string;  
53 };
54
55 /* javastring-hashtable */
56 extern hashtable string_hash;
57
58
59 /* function prototypes ********************************************************/
60
61 void stringtable_update(void);
62
63 /* creates a new object of type java/lang/String from a utf-text */
64 java_lang_String *javastring_new(utf *text);
65
66 /* creates a new object of type java/lang/String from a c-string */
67 java_lang_String *javastring_new_char(const char *text);
68
69 /* make c-string from a javastring (debugging) */
70 char *javastring_tochar(java_objectheader *s);
71
72 /* make utf symbol from javastring */
73 utf *javastring_toutf(java_lang_String *string, bool isclassname);
74
75 /* creates a new javastring with the text of the u2-array */
76 java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
77                                                                         bool copymode);
78
79 /* creates a new javastring with the text of the utf-symbol */
80 java_objectheader *literalstring_new(utf *u);
81
82 /* dispose a javastring */
83 void literalstring_free(java_objectheader*);
84
85 #endif /* _STRINGLOCAL_H */
86
87
88 /*
89  * These are local overrides for various environment variables in Emacs.
90  * Please do not remove this and leave it at the end of the file, where
91  * Emacs will automagically detect them.
92  * ---------------------------------------------------------------------
93  * Local variables:
94  * mode: c
95  * indent-tabs-mode: t
96  * c-basic-offset: 4
97  * tab-width: 4
98  * End:
99  */