Exceptions in class loading are catched.
[cacao.git] / loader.h
1 /******************************* loader.h **************************************
2
3         Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
4
5         See file COPYRIGHT for information on usage and disclaimer of warranties
6
7         Contains the prototypes for the class loader.
8
9         Author:  Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
10
11         Last Change: 1997/11/14
12
13 *******************************************************************************/
14
15
16
17 /************************* program switches ***********************************/
18
19 extern bool loadverbose;         /* Debug-Meldungen beim Laden ausgeben */
20 extern bool linkverbose;
21 extern bool initverbose;         /* Meldungen ausgeben, wenn Klasse 
22                                    initialisiert wird */
23 extern bool makeinitializations; /* Klassen automatisch initialisieren */
24
25 extern bool getloadingtime;
26 extern long int loadingtime;     /* CPU-Zeit f"urs Laden der Klassen */
27
28 extern list linkedclasses;       /* Liste aller fertig gelinkten Klassen */
29
30
31 /************************ prototypes ******************************************/
32
33 /* initialize laoder, load important systemclasses */
34 void loader_init ();
35
36 /* free resources */
37 void loader_close ();
38
39 /* load a class and all referenced classes */
40 classinfo *loader_load (utf *topname);
41
42 /* initializes all loaded classes */
43 void loader_initclasses ();
44
45 void loader_compute_subclasses ();
46
47 /* retrieve constantpool element */
48 voidptr class_getconstant (classinfo *class, u4 pos, u4 ctype);
49
50 /* determine type of a constantpool element */
51 u4 class_constanttype (classinfo *class, u4 pos);
52
53 /* search class for a field */
54 fieldinfo *class_findfield (classinfo *c, utf *name, utf *desc);
55
56 /* search for a method with a specified name and descriptor */
57 methodinfo *class_findmethod (classinfo *c, utf *name, utf *desc);
58 methodinfo *class_resolvemethod (classinfo *c, utf *name, utf *dest);
59
60 /* search for a method with specified name and arguments (returntype ignored) */
61 methodinfo *class_findmethod_approx (classinfo *c, utf *name, utf *desc);
62 methodinfo *class_resolvemethod_approx (classinfo *c, utf *name, utf *dest);
63
64 bool class_issubclass (classinfo *sub, classinfo *super);
65
66 /* call initializer of class */
67 void class_init (classinfo *c);
68
69 /* debug purposes */
70 void class_showmethods (classinfo *c);
71 void class_showconstantpool (classinfo *c);
72
73 /* set buffer for reading classdata */
74 void classload_buffer(u1 *buf,int len);
75
76 /* create class representing specific arraytype */
77 classinfo *create_array_class(utf *u);
78
79 /* create the arraydescriptor for the arraytype specified by the utf-string */
80 constant_arraydescriptor * buildarraydescriptor(char *utf, u4 namelen);
81
82
83