Clean merge -> gc7-branch
[cacao.git] / src / vm / stringlocal.h
1 /* src/vm/stringlocal.h - string header
2
3    Copyright (C) 1996-2005, 2006, 2007, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #ifndef _STRINGLOCAL_H
27 #define _STRINGLOCAL_H
28
29 typedef struct literalstring literalstring;
30
31
32 #include "config.h"
33
34 #include "vmcore/system.h"
35
36 #include "vm/types.h"
37
38 #include "toolbox/hashtable.h"
39
40 #include "vm/global.h"
41
42 #include "vmcore/utf8.h"
43
44
45 /* data structure of internal javastrings stored in global hashtable **********/
46
47 struct literalstring {
48         literalstring     *hashlink;        /* link for external hash chain       */
49         java_object_t     *string;  
50 };
51
52
53 /* javastring-hashtable */
54 extern hashtable hashtable_string;
55
56
57 /* function prototypes ********************************************************/
58
59 /* initialize string subsystem */
60 bool string_init(void);
61
62 void stringtable_update(void);
63
64 /* creates a new object of type java/lang/String from a utf-text */
65 java_handle_t *javastring_new(utf *text);
66
67 /* creates a new object of type java/lang/String from a utf-text, changes slashes to dots */
68 java_handle_t *javastring_new_slash_to_dot(utf *text);
69
70 /* creates a new object of type java/lang/String from an ASCII c-string */
71 java_handle_t *javastring_new_from_ascii(const char *text);
72
73 /* creates a new object of type java/lang/String from UTF-8 */
74 java_handle_t *javastring_new_from_utf_string(const char *utfstr);
75
76 /* creates a new object of type java/lang/String from (possibly invalid) UTF-8 */
77 java_handle_t *javastring_safe_new_from_utf8(const char *text);
78
79 /* make c-string from a javastring (debugging) */
80 char *javastring_tochar(java_handle_t *string);
81
82 /* make utf symbol from javastring */
83 utf *javastring_toutf(java_handle_t *string, bool isclassname);
84
85 /* creates a new javastring with the text of the utf-symbol */
86 java_object_t *literalstring_new(utf *u);
87
88 java_handle_t *javastring_intern(java_handle_t *s);
89 void           javastring_fprint(java_handle_t *s, FILE *stream);
90
91 #endif /* _STRINGLOCAL_H */
92
93
94 /*
95  * These are local overrides for various environment variables in Emacs.
96  * Please do not remove this and leave it at the end of the file, where
97  * Emacs will automagically detect them.
98  * ---------------------------------------------------------------------
99  * Local variables:
100  * mode: c
101  * indent-tabs-mode: t
102  * c-basic-offset: 4
103  * tab-width: 4
104  * End:
105  * vim:noexpandtab:sw=4:ts=4:
106  */