102a7a6fef6454cd4437dee4c080b023ee1c3a24
[cacao.git] / native.h
1 /****************************** native.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 codegenerator for an Alpha processor.
8         This module generates Alpha machine code for a sequence of
9         pseudo commands (PCMDs).
10
11         Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
12
13         Last Change: 1997/03/12
14
15 *******************************************************************************/
16
17 /* Java Native Interface */
18 #include "jni.h"
19
20 /* structure for class java.lang.String */
21 struct java_lang_String;
22
23 /* for raising exceptions from native methods */
24 extern java_objectheader* exceptionptr;
25
26 /* javastring-hashtable */
27 extern hashtable string_hash; 
28
29 /* load classes required for native methods */
30 void native_loadclasses ();
31
32 /* set searchpath for classfiles */
33 void native_setclasspath (char *path);
34
35 /* find native function */
36 functionptr native_findfunction (utf *cname, utf *mname, 
37                                  utf *desc, bool isstatic);
38
39 /* creates a new object of type java/lang/String from a utf-text */
40 java_objectheader *javastring_new (utf *text);
41
42 /* creates a new object of type java/lang/String from a c-string */
43 java_objectheader *javastring_new_char (char *text);
44
45 /* make c-string from a javastring (debugging) */
46 char *javastring_tochar (java_objectheader *s);
47
48 /* create new object on the heap and call the initializer */
49 java_objectheader *native_new_and_init (classinfo *c);
50
51 /* add property to system-property vector */
52 void attach_property(char *name, char *value);
53
54 /* correct vftbl-entries of javastring-hash */
55 void stringtable_update();
56
57 /* throw classnotfoundexcetion */
58 void throw_classnotfoundexception();
59
60 /* make utf symbol from javastring */
61 utf *javastring_toutf(struct java_lang_String *string, bool isclassname);
62
63 /* make utf symbol from u2 array */
64 utf *utf_new_u2(u2 *unicodedata, u4 unicodelength, bool isclassname);
65
66 /* determine utf length in bytes of a u2 array */
67 u4 u2_utflength(u2 *text, u4 u2_length);
68
69 /* create systemclassloader object and initialize its instance fields  */
70 void init_systemclassloader();
71
72 /* search 'classinfo'-structure for a field with the specified name */
73 fieldinfo *class_findfield_approx (classinfo *c, utf *name);
74
75 /* creates a new javastring with the text of the utf-symbol */
76 java_objectheader *literalstring_new (utf *u);
77
78 /* creates a new javastring with the text of the u2-array */
79 java_objectheader *literalstring_u2 (java_chararray *a, u4 length, bool copymode);
80
81 /* dispose a javastring */
82 void literalstring_free (java_objectheader*);
83
84 void systemclassloader_addlibname(java_objectheader *o);
85 void systemclassloader_addlibrary(java_objectheader *o);
86
87 void copy_vftbl(vftbl **dest, vftbl *src);