* src/native/native.c (native_get_parametertypes): Removed.
[cacao.git] / src / native / native.h
1 /* src/native/native.h - table of native functions
2
3    Copyright (C) 1996-2005, 2006, 2007 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
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., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    $Id: native.h 7573 2007-03-25 18:55:02Z twisti $
26
27 */
28
29
30 #ifndef _NATIVE_H
31 #define _NATIVE_H
32
33 #include "config.h"
34
35 #if !defined(WITH_STATIC_CLASSPATH)
36 # include <ltdl.h>
37 #endif
38
39 #include "vm/global.h"
40
41 #include "vmcore/class.h"
42 #include "vmcore/method.h"
43 #include "vmcore/utf8.h"
44
45
46 /* table for locating native methods */
47
48 typedef struct nativeref nativeref;
49 typedef struct nativecompref nativecompref;
50
51
52 #if !defined(WITH_STATIC_CLASSPATH)
53 typedef struct hashtable_library_loader_entry hashtable_library_loader_entry;
54 typedef struct hashtable_library_name_entry hashtable_library_name_entry;
55
56
57 /* hashtable_library_loader_entry *********************************************/
58
59 struct hashtable_library_loader_entry {
60         java_objectheader              *loader;  /* class loader                  */
61         hashtable_library_name_entry   *namelink;/* libs loaded by this loader    */
62         hashtable_library_loader_entry *hashlink;/* link for external chaining    */
63 };
64
65
66 /* hashtable_library_name_entry ***********************************************/
67
68 struct hashtable_library_name_entry {
69         utf                          *name;      /* library name                  */
70         lt_dlhandle                   handle;    /* libtool library handle        */
71         hashtable_library_name_entry *hashlink;  /* link for external chaining    */
72 };
73 #endif
74
75
76 struct nativeref {
77         char       *classname;
78         char       *methodname;
79         char       *descriptor;
80         bool        isstatic;
81         functionptr func;
82 };
83
84 /* table for fast string comparison */
85
86 struct nativecompref {
87         utf        *classname;
88         utf        *methodname;
89         utf        *descriptor;
90         bool        isstatic;
91         functionptr func;
92 };
93
94
95 /* initialize native subsystem */
96 bool native_init(void);
97
98 #if defined(WITH_STATIC_CLASSPATH)
99
100 /* find native function */
101 functionptr native_findfunction(utf *cname, utf *mname, utf *desc,
102                                                                 bool isstatic);
103
104 #else /* defined(WITH_STATIC_CLASSPATH) */
105
106 /* add a library to the library hash */
107 void native_hashtable_library_add(utf *filename, java_objectheader *loader,
108                                                                   lt_dlhandle handle);
109
110 /* find a library entry in the library hash */
111 hashtable_library_name_entry *native_hashtable_library_find(utf *filename,
112                                                                                                                         java_objectheader *loader);
113
114 /* resolve native function */
115 functionptr native_resolve_function(methodinfo *m);
116
117 #endif /* defined(WITH_STATIC_CLASSPATH) */
118
119 /* create new object on the heap and call the initializer */
120 java_objectheader *native_new_and_init(classinfo *c);
121
122 /* create new object on the heap and call the initializer 
123    mainly used for exceptions with a message */
124 java_objectheader *native_new_and_init_string(classinfo *c,
125                                                                                           java_objectheader *s);
126
127 /* create new object on the heap and call the initializer 
128    mainly used for exceptions with an index */
129 java_objectheader *native_new_and_init_int(classinfo *c, s4 i);
130
131 /* create new object on the heap and call the initializer 
132    mainly used for exceptions with cause */
133 java_objectheader *native_new_and_init_throwable(classinfo *c,
134                                                                                                  java_objectheader *t);
135
136 #endif /* _NATIVE_H */
137
138
139 /*
140  * These are local overrides for various environment variables in Emacs.
141  * Please do not remove this and leave it at the end of the file, where
142  * Emacs will automagically detect them.
143  * ---------------------------------------------------------------------
144  * Local variables:
145  * mode: c
146  * indent-tabs-mode: t
147  * c-basic-offset: 4
148  * tab-width: 4
149  * End:
150  */