New source tree.
[cacao.git] / src / native / native.h
index cfad6b615b2ad7ba55b8407a194da7d98c832e56..d2e766987204b2426ee9ac895e6a28641fd25643 100644 (file)
@@ -1,4 +1,4 @@
-/* native.h - table of native functions
+/* native/native.h - table of native functions
 
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
@@ -26,7 +26,7 @@
 
    Authors: Reinhard Grafl
 
-   $Id: native.h 930 2004-03-02 21:18:23Z jowenn $
+   $Id: native.h 1621 2004-11-30 13:06:55Z twisti $
 
 */
 
 #define _NATIVE_H
 
 
-#include "jni.h"
-#include "nat/java_lang_String.h"
-#include "nat/java_lang_ClassLoader.h"
+#include "native/jni.h"
+#include "native/include/java_lang_String.h"
+#include "native/include/java_lang_ClassLoader.h"
+#include "native/include/java_lang_Throwable.h"
 
 
-/* searchpath for classfiles */
-extern char *classpath;
+/* table for locating native methods */
+
+typedef struct nativeref nativeref;
+typedef struct nativecompref nativecompref;
+
+struct nativeref {
+       char       *classname;
+       char       *methodname;
+       char       *descriptor;
+       bool        isstatic;
+       functionptr func;
+};
+
+/* table for fast string comparison */
+
+struct nativecompref {
+       utf        *classname;
+       utf        *methodname;
+       utf        *descriptor;
+       bool        isstatic;
+       functionptr func;
+};
+
 
 extern classinfo *class_java_lang_Class;
 extern classinfo *class_java_lang_VMClass;
-extern methodinfo *method_vmclass_init;
-/* extern classinfo *class_java_lang_Cloneable=0; */ /* now in global.h */
-extern classinfo *class_java_lang_CloneNotSupportedException;
 extern classinfo *class_java_lang_System;
 extern classinfo *class_java_lang_ClassLoader;
-extern classinfo *class_java_lang_NoClassDefFoundError;
-extern classinfo *class_java_lang_ClassNotFoundException;
-extern classinfo *class_java_lang_LinkageError;
-extern classinfo *class_java_lang_InstantiationException;
-extern classinfo *class_java_lang_NoSuchMethodError;   
-extern classinfo *class_java_lang_NoSuchFieldError;
-extern classinfo *class_java_lang_ClassFormatError;
-extern classinfo *class_java_lang_IllegalArgumentException;
-extern classinfo *class_java_lang_ArrayIndexOutOfBoundsException;
-extern classinfo *class_java_lang_NoSuchFieldException;
-extern classinfo *class_java_io_SyncFailedException;
-extern classinfo *class_java_io_IOException;
-extern classinfo *class_java_io_FileNotFoundException;
-extern classinfo *class_java_io_UnixFileSystem;
-extern classinfo *class_java_security_PrivilegedActionException;
-extern classinfo *class_java_net_UnknownHostException;
-extern classinfo *class_java_net_SocketException;
-extern classinfo *class_java_lang_NoSuchMethodException;
 extern classinfo *class_java_lang_Double;
 extern classinfo *class_java_lang_Float;
 extern classinfo *class_java_lang_Long;
@@ -78,8 +79,9 @@ extern classinfo *class_java_lang_Void;
 extern classinfo *class_java_lang_Character;
 extern classinfo *class_java_lang_Integer;
 
+
 /* the system classloader object */
-extern struct java_lang_ClassLoader *SystemClassLoader;
+extern java_lang_ClassLoader *SystemClassLoader;
 
 /* for raising exceptions from native methods */
 /* extern java_objectheader* exceptionptr; */
@@ -87,21 +89,11 @@ extern struct java_lang_ClassLoader *SystemClassLoader;
 /* javastring-hashtable */
 extern hashtable string_hash; 
 
-
-/* throw classnotfoundexcetion with detail message */
-void throw_noclassdeffounderror_message(utf* classname);
-
-/* throw linkageerror with detail message */
-void throw_linkageerror_message(utf* classname);
-
 void use_class_as_object(classinfo *c);
 
 /* load classes required for native methods */
 void native_loadclasses();
 
-/* set searchpath for classfiles */
-void native_setclasspath(char *path);
-
 /* find native function */
 functionptr native_findfunction(utf *cname, utf *mname, 
                                                                utf *desc, bool isstatic);
@@ -120,21 +112,27 @@ char *javastring_tochar(java_objectheader *s);
 /* create new object on the heap and call the initializer */
 java_objectheader *native_new_and_init(classinfo *c);
 
-/* 
-   create new object on the heap and call the initializer 
-   mainly used for exceptions with a message
-*/
+/* create new object on the heap and call the initializer 
+   mainly used for exceptions with a message */
 java_objectheader *native_new_and_init_string(classinfo *c, java_lang_String *s);
 
-/* add property to system-property vector */
-void attach_property(char *name, char *value);
+/* create new object on the heap and call the initializer 
+   mainly used for exceptions with an index */
+java_objectheader *native_new_and_init_int(classinfo *c, s4 i);
+
+/* create new object on the heap and call the initializer 
+   mainly used for exceptions with cause */
+java_objectheader *native_new_and_init_throwable(classinfo *c, java_lang_Throwable *t);
+
+/* add property to temporary property list -- located in nat/VMRuntime.c */
+void create_property(char *key, char *value);
 
 /* correct vftbl-entries of javastring-hash */
 void stringtable_update();
 
 
 /* make utf symbol from javastring */
-utf *javastring_toutf(struct java_lang_String *string, bool isclassname);
+utf *javastring_toutf(java_lang_String *string, bool isclassname);
 
 /* make utf symbol from u2 array */
 utf *utf_new_u2(u2 *unicodedata, u4 unicodelength, bool isclassname);
@@ -159,10 +157,7 @@ java_objectheader *literalstring_u2(java_chararray *a, u4 length, u4 offset,
 /* dispose a javastring */
 void literalstring_free(java_objectheader*);
 
-void systemclassloader_addlibname(java_objectheader *o);
-void systemclassloader_addlibrary(java_objectheader *o);
-
-void copy_vftbl(vftbl **dest, vftbl *src);
+void copy_vftbl(vftbl_t **dest, vftbl_t *src);
 
 utf *create_methodsig(java_objectarray* types, char *retType);
 classinfo *get_type(char **utf_ptr,char *desc_end, bool skip);