1 /* src/native/native.h - table of native functions
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
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 $Id: native.h 8062 2007-06-11 08:12:14Z twisti $
35 #if !defined(WITH_STATIC_CLASSPATH)
39 #include "native/jni.h"
41 #include "vm/global.h"
43 #include "vmcore/class.h"
44 #include "vmcore/method.h"
45 #include "vmcore/utf8.h"
48 /* defines ********************************************************************/
50 #define NATIVE_METHODS_COUNT sizeof(methods) / sizeof(JNINativeMethod)
53 /* table for locating native methods */
55 typedef struct nativeref nativeref;
56 typedef struct nativecompref nativecompref;
59 #if !defined(WITH_STATIC_CLASSPATH)
60 typedef struct hashtable_library_loader_entry hashtable_library_loader_entry;
61 typedef struct hashtable_library_name_entry hashtable_library_name_entry;
64 /* native_methods_node_t ******************************************************/
66 typedef struct native_methods_node_t native_methods_node_t;
68 struct native_methods_node_t {
69 utf *classname; /* class name */
70 utf *name; /* method name */
71 utf *descriptor; /* descriptor name */
72 functionptr function; /* pointer to the implementation */
76 /* hashtable_library_loader_entry *********************************************/
78 struct hashtable_library_loader_entry {
79 java_objectheader *loader; /* class loader */
80 hashtable_library_name_entry *namelink;/* libs loaded by this loader */
81 hashtable_library_loader_entry *hashlink;/* link for external chaining */
85 /* hashtable_library_name_entry ***********************************************/
87 struct hashtable_library_name_entry {
88 utf *name; /* library name */
89 lt_dlhandle handle; /* libtool library handle */
90 hashtable_library_name_entry *hashlink; /* link for external chaining */
103 /* table for fast string comparison */
105 struct nativecompref {
114 /* function prototypes ********************************************************/
116 bool native_init(void);
118 void native_method_register(utf *classname, JNINativeMethod *methods, s4 count);
120 #if defined(WITH_STATIC_CLASSPATH)
122 functionptr native_findfunction(utf *cname, utf *mname, utf *desc,
125 #else /* defined(WITH_STATIC_CLASSPATH) */
127 lt_dlhandle native_library_open(utf *filename);
128 void native_library_add(utf *filename, java_objectheader *loader,
131 hashtable_library_name_entry *native_library_find(utf *filename,
132 java_objectheader *loader);
134 functionptr native_resolve_function(methodinfo *m);
136 #endif /* defined(WITH_STATIC_CLASSPATH) */
138 java_objectheader *native_new_and_init(classinfo *c);
140 java_objectheader *native_new_and_init_string(classinfo *c,
141 java_objectheader *s);
143 #endif /* _NATIVE_H */
147 * These are local overrides for various environment variables in Emacs.
148 * Please do not remove this and leave it at the end of the file, where
149 * Emacs will automagically detect them.
150 * ---------------------------------------------------------------------
153 * indent-tabs-mode: t