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 7918 2007-05-20 20:42:18Z michi $
35 #if !defined(WITH_STATIC_CLASSPATH)
39 #include "native/jni.h"
41 #include "vm/global.h"
43 #include "vmcore/class.h"
44 #include "vmcore/loader.h"
45 #include "vmcore/method.h"
46 #include "vmcore/utf8.h"
49 /* defines ********************************************************************/
51 #define NATIVE_METHODS_COUNT sizeof(methods) / sizeof(JNINativeMethod)
54 /* table for locating native methods */
56 typedef struct nativeref nativeref;
57 typedef struct nativecompref nativecompref;
60 #if !defined(WITH_STATIC_CLASSPATH)
61 typedef struct hashtable_library_loader_entry hashtable_library_loader_entry;
62 typedef struct hashtable_library_name_entry hashtable_library_name_entry;
65 /* native_methods_node_t ******************************************************/
67 typedef struct native_methods_node_t native_methods_node_t;
69 struct native_methods_node_t {
70 utf *classname; /* class name */
71 utf *name; /* method name */
72 utf *descriptor; /* descriptor name */
73 functionptr function; /* pointer to the implementation */
77 /* hashtable_library_loader_entry *********************************************/
79 struct hashtable_library_loader_entry {
80 hashtable_classloader_entry *cle; /* class loader */
81 hashtable_library_name_entry *namelink;/* libs loaded by this loader */
82 hashtable_library_loader_entry *hashlink;/* link for external chaining */
86 /* hashtable_library_name_entry ***********************************************/
88 struct hashtable_library_name_entry {
89 utf *name; /* library name */
90 lt_dlhandle handle; /* libtool library handle */
91 hashtable_library_name_entry *hashlink; /* link for external chaining */
104 /* table for fast string comparison */
106 struct nativecompref {
115 /* function prototypes ********************************************************/
117 bool native_init(void);
119 void native_method_register(utf *classname, JNINativeMethod *methods, s4 count);
121 #if defined(WITH_STATIC_CLASSPATH)
123 functionptr native_findfunction(utf *cname, utf *mname, utf *desc,
126 #else /* defined(WITH_STATIC_CLASSPATH) */
128 lt_dlhandle native_library_open(utf *filename);
129 void native_library_add(utf *filename, java_objectheader *loader,
132 hashtable_library_name_entry *native_library_find(utf *filename,
133 java_objectheader *loader);
135 functionptr native_resolve_function(methodinfo *m);
137 #endif /* defined(WITH_STATIC_CLASSPATH) */
139 java_objectheader *native_new_and_init(classinfo *c);
141 java_objectheader *native_new_and_init_string(classinfo *c,
142 java_objectheader *s);
144 java_objectheader *native_new_and_init_int(classinfo *c, s4 i);
146 java_objectheader *native_new_and_init_throwable(classinfo *c,
147 java_objectheader *t);
149 #endif /* _NATIVE_H */
153 * These are local overrides for various environment variables in Emacs.
154 * Please do not remove this and leave it at the end of the file, where
155 * Emacs will automagically detect them.
156 * ---------------------------------------------------------------------
159 * indent-tabs-mode: t