move code from natcalls.h into native.h
[cacao.git] / src / native / native.h
index fb8d33cef2cd3e4ee7dd5a0c8e478529aa4cbba9..4241a5ad78ea9a43b224a30ea982167898b414e2 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 1331 2004-07-21 15:46:54Z twisti $
+   $Id: native.h 1655 2004-12-02 16:51:20Z carolyn $
 
 */
 
 #define _NATIVE_H
 
 
-#include "jni.h"
-#include "nat/java_lang_String.h"
-#include "nat/java_lang_ClassLoader.h"
-#include "nat/java_lang_Throwable.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"
 
 
 /* table for locating native methods */
@@ -65,10 +65,6 @@ struct nativecompref {
 };
 
 
-/* searchpath for classfiles */
-
-extern char *classpath;
-
 extern classinfo *class_java_lang_Class;
 extern classinfo *class_java_lang_VMClass;
 extern classinfo *class_java_lang_System;
@@ -98,9 +94,6 @@ 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);
@@ -131,15 +124,15 @@ java_objectheader *native_new_and_init_int(classinfo *c, s4 i);
    mainly used for exceptions with cause */
 java_objectheader *native_new_and_init_throwable(classinfo *c, java_lang_Throwable *t);
 
-/* add property to system-property vector */
-void attach_property(char *name, char *value);
+/* 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);
@@ -178,6 +171,79 @@ classinfo *get_returntype(methodinfo *m);
 java_objectarray *builtin_asm_createclasscontextarray(classinfo **end,classinfo **start);
 java_lang_ClassLoader *builtin_asm_getclassloader(classinfo **end,classinfo **start);
 
+/*----- For Static Analysis of Natives by parseRT -----*/
+
+/*---------- global variables ---------------------------*/
+typedef struct classMeth classMeth;
+typedef struct nativeCall   nativeCall;
+typedef struct methodCall   methodCall;
+typedef struct nativeMethod nativeMethod;
+
+typedef struct nativeCompCall   nativeCompCall;
+typedef struct methodCompCall   methodCompCall;
+typedef struct nativeCompMethod nativeCompMethod;
+
+/*---------- Define Constants ---------------------------*/
+#define MAXCALLS 30 
+
+struct classMeth {
+       int i_class;
+       int j_method;
+       int methCnt;
+};
+
+struct  methodCall{
+       char *classname;
+       char *methodname;
+       char *descriptor;
+};
+
+struct  nativeMethod  {
+       char *methodname;
+       char *descriptor;
+       struct methodCall methodCalls[MAXCALLS];
+};
+
+
+static struct nativeCall {
+       char *classname;
+       struct nativeMethod methods[MAXCALLS];
+       int methCnt;
+       int callCnt[MAXCALLS];
+} nativeCalls[] =
+{
+#include "nativecalls.inc"
+};
+
+#define NATIVECALLSSIZE  (sizeof(nativeCalls)/sizeof(struct nativeCall))
+
+
+struct methodCompCall {
+       utf *classname;
+       utf *methodname;
+       utf *descriptor;
+};
+
+
+struct nativeCompMethod {
+       utf *methodname;
+       utf *descriptor;
+       struct methodCompCall methodCalls[MAXCALLS];
+};
+
+
+struct nativeCompCall {
+       utf *classname;
+       struct nativeCompMethod methods[MAXCALLS];
+       int methCnt;
+       int callCnt[MAXCALLS];
+} nativeCompCalls[NATIVECALLSSIZE];
+
+
+bool natcall2utf(bool);
+void printNativeCall(nativeCall);
+void markNativeMethodsRT(utf *, utf* , utf* ); 
+
 #endif /* _NATIVE_H */