06213ca23560b8f56f15d0a5311823849f89f5a2
[cacao.git] / loader.h
1 /* loader.c - class loader header
2
3    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4    R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
5    M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
6    P. Tomsich, J. Wenninger
7
8    This file is part of CACAO.
9
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.
14
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.
19
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., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Reinhard Grafl
28
29    $Id: loader.h 593 2003-11-09 19:50:55Z twisti $
30
31 */
32
33
34 #ifndef _LOADER_H
35 #define _LOADER_H
36
37 /************************* program switches ***********************************/
38
39 extern bool loadverbose;         /* Print debug messages during loading */
40 extern bool linkverbose;
41 extern bool initverbose;         /* Log class initialization */ 
42 extern bool makeinitializations; /* Initialize classes automatically */
43
44 extern bool getloadingtime;
45 extern long int loadingtime;     /* CPU time for class loading */
46
47 extern list unlinkedclasses;     /* List containing all unlinked classes */
48 extern list linkedclasses;       /* List containing all linked classes */
49
50
51 /************************ prototypes ******************************************/
52
53 /* initialize laoder, load important systemclasses */
54 void loader_init();
55
56 void suck_init(char *cpath);
57
58 /* free resources */
59 void loader_close();
60
61 /* load a class and all referenced classes */
62 classinfo *loader_load(utf *topname);
63
64 /* initializes all loaded classes */
65 void loader_initclasses();
66
67 void loader_compute_subclasses();
68
69 /* retrieve constantpool element */
70 voidptr class_getconstant(classinfo *class, u4 pos, u4 ctype);
71
72 /* determine type of a constantpool element */
73 u4 class_constanttype(classinfo *class, u4 pos);
74
75 /* search class for a field */
76 fieldinfo *class_findfield(classinfo *c, utf *name, utf *desc);
77
78 /* search for a method with a specified name and descriptor */
79 methodinfo *class_findmethod(classinfo *c, utf *name, utf *desc);
80 methodinfo *class_resolvemethod(classinfo *c, utf *name, utf *dest);
81
82 /* search for a method with specified name and arguments (returntype ignored) */
83 methodinfo *class_findmethod_approx(classinfo *c, utf *name, utf *desc);
84 methodinfo *class_resolvemethod_approx(classinfo *c, utf *name, utf *dest);
85
86 bool class_issubclass(classinfo *sub, classinfo *super);
87
88 /* call initializer of class */
89 void class_init(classinfo *c);
90
91 void class_showconstanti(classinfo *c, int ii);
92
93 /* debug purposes */
94 void class_showconstantpool(classinfo *c);
95 void class_showmethods(classinfo *c);
96
97 classinfo *loader_load(utf *topname);
98
99 /* set buffer for reading classdata */
100 void classload_buffer(u1 *buf,int len);
101
102 /* create class representing specific arraytype */
103 classinfo *create_array_class(utf *u);
104
105 /* create the arraydescriptor for the arraytype specified by the utf-string */
106 constant_arraydescriptor * buildarraydescriptor(char *utf, u4 namelen);
107
108 void class_link(classinfo *c);
109
110 void field_display(fieldinfo *f);
111
112 void method_display(methodinfo *m);
113
114 #endif /* _LOADER_H */
115
116
117 /*
118  * These are local overrides for various environment variables in Emacs.
119  * Please do not remove this and leave it at the end of the file, where
120  * Emacs will automagically detect them.
121  * ---------------------------------------------------------------------
122  * Local variables:
123  * mode: c
124  * indent-tabs-mode: t
125  * c-basic-offset: 4
126  * tab-width: 4
127  * End:
128  */