minor documentation corrections
[cacao.git] / tables.h
1 /* tables.h - 
2
3    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4    R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
5    M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
6    P. Tomsich, J. Wenninger
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: Reinhard Grafl
28
29    $Id: tables.h 881 2004-01-13 19:57:08Z edwin $
30
31 */
32
33
34 #ifndef _TABLES_H
35 #define _TABLES_H
36
37 #include <stdio.h>
38 #include "global.h" /* for unicode. -- phil */
39
40 #define CLASS(name)     (unicode_getclasslink(unicode_new_char(name)))
41
42 /* to determine the end of utf strings */
43 #define utf_end(utf) ((char *) utf->text+utf->blength)
44
45 /* function for disposing javastrings */
46 typedef void (*stringdeleter) (java_objectheader *string);
47     
48 /* creates hashtables for symboltables */
49 void tables_init();
50
51 /* free memory for hashtables */ 
52 void tables_close(stringdeleter del);
53
54 /* check if a UTF-8 string is valid */
55 bool is_valid_utf(char *utf_ptr, char *end_pos);
56
57 /* check if a UTF-8 string may be used as a class/field/method name */
58 bool is_valid_name(char *utf_ptr, char *end_pos);
59 bool is_valid_name_utf(utf *u);
60
61 /* write utf symbol to file/buffer */
62 void utf_sprint(char *buffer, utf *u);
63 void utf_fprint(FILE *file, utf *u);
64 void utf_display(utf *u);
65
66 /* write utf symbol to logfile/stdout */
67 void log_utf(utf *u);
68 void log_plain_utf(utf *u);
69
70 /* create new utf-symbol */
71 utf *utf_new(char *text, u2 length);
72 utf *utf_new_char(char *text);
73 utf *utf_new_char_classname(char *text);
74
75 /* show utf-table */
76 void utf_show();
77
78 /* get next unicode character of a utf-string */
79 u2 utf_nextu2(char **utf);
80
81 /* get number of unicode characters of a utf string */
82 u4 utf_strlen(utf *u);
83
84 /* search for class and create it if not found */
85 classinfo *class_new(utf *u);
86
87 /* return an array class with the given component class */
88 classinfo *class_array_of(classinfo *component);
89
90 /* return an array class with the given dimension and element class */
91 classinfo *class_multiarray_of(int dim, classinfo *element);
92
93 /* get javatype according to a typedescriptor */
94 u2 desc_to_type(utf *descriptor);
95
96 /* get length of a datatype */
97 u2 desc_typesize(utf *descriptor);
98
99 /* determine hashkey of a unicode-symbol */
100 u4 unicode_hashkey(u2 *text, u2 length);
101
102 /* create hashtable */
103 void init_hashtable(hashtable *hash, u4 size);
104
105 /* search for class in classtable */
106 classinfo *class_get(utf *u);
107
108 #endif /* _TABLES_H */
109
110
111 /*
112  * These are local overrides for various environment variables in Emacs.
113  * Please do not remove this and leave it at the end of the file, where
114  * Emacs will automagically detect them.
115  * ---------------------------------------------------------------------
116  * Local variables:
117  * mode: c
118  * indent-tabs-mode: t
119  * c-basic-offset: 4
120  * tab-width: 4
121  * End:
122  */