stop world
[cacao.git] / loader.h
index 35cd9bafc6125e0194689fe3429d2deb3b6fb6c9..43ad783804acd9524f3a7a14b5744e338e627489 100644 (file)
--- a/loader.h
+++ b/loader.h
@@ -1,4 +1,4 @@
-/* loader.c - class loader header
+/* loader.h - class loader header
 
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
 
    Authors: Reinhard Grafl
 
-   $Id: loader.h 669 2003-11-23 14:04:20Z edwin $
+   $Id: loader.h 1008 2004-03-31 20:13:14Z edwin $
 */
 
 
 #ifndef _LOADER_H
 #define _LOADER_H
 
-/************************* program switches ***********************************/
+#include <stdio.h>
 
-extern bool loadverbose;         /* Print debug messages during loading */
-extern bool linkverbose;
-extern bool initverbose;         /* Log class initialization */ 
-extern bool makeinitializations; /* Initialize classes automatically */
+#ifdef USE_ZLIB
+#include "unzip.h"
+#endif
 
-extern bool getloadingtime;
-extern long int loadingtime;     /* CPU time for class loading */
+/* export variables */
 
+extern list unloadedclasses;     /* list of all referenced but not loaded classes */
 extern list unlinkedclasses;     /* List containing all unlinked classes */
 extern list linkedclasses;       /* List containing all linked classes */
 
+#ifdef USE_THREADS
+extern int blockInts;
+#endif
+
 
 /************************ prototypes ******************************************/
 
@@ -71,12 +74,19 @@ voidptr class_getconstant(classinfo *class, u4 pos, u4 ctype);
 /* determine type of a constantpool element */
 u4 class_constanttype(classinfo *class, u4 pos);
 
+s4 class_findmethodIndex(classinfo *c, utf *name, utf *desc);
+
 /* search class for a field */
 fieldinfo *class_findfield(classinfo *c, utf *name, utf *desc);
+fieldinfo *class_resolvefield(classinfo *c, utf *name, utf *desc, classinfo *referer, bool except);
 
 /* search for a method with a specified name and descriptor */
 methodinfo *class_findmethod(classinfo *c, utf *name, utf *desc);
+methodinfo *class_fetchmethod(classinfo *c, utf *name, utf *desc);
+methodinfo *class_findmethod_w(classinfo *c, utf *name, utf *desc, char*);
 methodinfo *class_resolvemethod(classinfo *c, utf *name, utf *dest);
+methodinfo *class_resolveclassmethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool except);
+methodinfo *class_resolveinterfacemethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool except);
 
 /* search for a method with specified name and arguments (returntype ignored) */
 methodinfo *class_findmethod_approx(classinfo *c, utf *name, utf *desc);
@@ -90,23 +100,36 @@ void class_init(classinfo *c);
 void class_showconstanti(classinfo *c, int ii);
 
 /* debug purposes */
-void class_showmethods (classinfo *c);
-void class_showconstantpool (classinfo *c);
-void print_arraydescriptor(FILE *file,arraydescriptor *desc);
+void class_showmethods(classinfo *c);
+void class_showconstantpool(classinfo *c);
+void print_arraydescriptor(FILE *file, arraydescriptor *desc);
 
 classinfo *loader_load(utf *topname);
+classinfo *loader_load_sysclass(classinfo **top,utf *topname);
 
 /* set buffer for reading classdata */
-void classload_buffer(u1 *buf,int len);
+void classload_buffer(u1 *buf, int len);
 
 /* return the primitive class inidicated by the given signature character */
 classinfo *class_primitive_from_sig(char sig);
 
+
 /* return the class indicated by the given descriptor */
-#define CLASSLOAD_SKIP  0
-#define CLASSLOAD_NEW   1
-#define CLASSLOAD_LOAD  2
+/* (see loader.c for documentation) */
+#define CLASSLOAD_NEW           0      /* default */
+#define CLASSLOAD_LOAD          0x0001
+#define CLASSLOAD_SKIP          0x0002
+#define CLASSLOAD_PANIC         0      /* default */
+#define CLASSLOAD_NOPANIC       0x0010
+#define CLASSLOAD_PRIMITIVE     0      /* default */
+#define CLASSLOAD_NULLPRIMITIVE 0x0020
+#define CLASSLOAD_VOID          0      /* default */
+#define CLASSLOAD_NOVOID        0x0040
+#define CLASSLOAD_NOCHECKEND    0      /* default */
+#define CLASSLOAD_CHECKEND      0x1000
+
 classinfo *class_from_descriptor(char *utf_ptr,char *end_ptr,char **next,int mode);
+int type_from_descriptor(classinfo **cls,char *utf_ptr,char *end_ptr,char **next,int mode);
 
 /* (used by class_new, don't use directly) */
 void class_new_array(classinfo *c);
@@ -120,6 +143,27 @@ void method_display(methodinfo *m);
 utf* clinit_desc();
 utf* clinit_name();
 
+
+/******************************** CLASSPATH handling *******************/
+#define CLASSPATH_MAXFILENAME 1000                /* maximum length of a filename           */
+#define CLASSPATH_PATH 0
+#define CLASSPATH_ARCHIVE 1
+
+typedef union classpath_info {
+       struct {
+               int type;
+               union classpath_info *next;
+               char *filename;
+               int pathlen; } filepath;
+#ifdef USE_ZLIB
+       struct {
+               int type;
+               union classpath_info *next;
+               unzFile uf;
+       } archive;
+#endif 
+} classpath_info;
+
 #endif /* _LOADER_H */