-/* 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,
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 */
};
-/* searchpath for classfiles */
-
-extern char *classpath;
-
extern classinfo *class_java_lang_Class;
extern classinfo *class_java_lang_VMClass;
extern classinfo *class_java_lang_System;
/* 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);
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);
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 */