OSDN Git Service

* libjava/prims.cc: Some old cleanups. The collector now
[pf3gnuchains/gcc-fork.git] / libjava / gcj / javaprims.h
1 // javaprims.h - Main external header file for libgcj.  -*- c++ -*-
2
3 /* Copyright (C) 1998, 1999, 2000, 2001  Free Software Foundation
4
5    This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10
11 #ifndef __JAVAPRIMS_H__
12 #define __JAVAPRIMS_H__
13
14 // Force C++ compiler to use Java-style exceptions.
15 #pragma GCC java_exceptions
16
17 #include <gcj/libgcj-config.h>
18
19 // FIXME: this is a hack until we get a proper gcjh.
20 // It is needed to work around system header files that define TRUE
21 // and FALSE.
22 #undef TRUE
23 #define TRUE TRUE
24 #undef FALSE
25 #define FALSE FALSE
26
27 // To force selection of correct types that will mangle consistently
28 // across platforms.
29 extern "Java"
30 {
31   typedef __java_byte jbyte;
32   typedef __java_short jshort;
33   typedef __java_int jint;
34   typedef __java_long jlong;
35   typedef __java_float jfloat;
36   typedef __java_double jdouble;
37   typedef __java_char jchar;
38   typedef __java_boolean jboolean;
39   typedef jint jsize;
40
41   // The following class declarations are automatically generated by
42   // the `classes.pl' script.
43   namespace java
44   {
45     namespace io
46     {
47       class BufferedInputStream;
48       class BufferedOutputStream;
49       class BufferedReader;
50       class BufferedWriter;
51       class ByteArrayInputStream;
52       class ByteArrayOutputStream;
53       class CharArrayReader;
54       class CharArrayWriter;
55       class CharConversionException;
56       class DataInput;
57       class DataInputStream;
58       class DataOutput;
59       class DataOutputStream;
60       class EOFException;
61       class Externalizable;
62       class File;
63       class FileDescriptor;
64       class FileFilter;
65       class FileInputStream;
66       class FileNotFoundException;
67       class FileOutputStream;
68       class FilePermission;
69       class FileReader;
70       class FileWriter;
71       class FilenameFilter;
72       class FilterInputStream;
73       class FilterOutputStream;
74       class FilterReader;
75       class FilterWriter;
76       class IOException;
77       class InputStream;
78       class InputStreamReader;
79       class InterfaceComparator;
80       class InterruptedIOException;
81       class InvalidClassException;
82       class InvalidObjectException;
83       class LineNumberInputStream;
84       class LineNumberReader;
85       class MemberComparator;
86       class NotActiveException;
87       class NotSerializableException;
88       class ObjectInput;
89       class ObjectInputStream;
90       class ObjectInputStream$GetField;
91       class ObjectInputValidation;
92       class ObjectOutput;
93       class ObjectOutputStream;
94       class ObjectOutputStream$PutField;
95       class ObjectStreamClass;
96       class ObjectStreamConstants;
97       class ObjectStreamException;
98       class ObjectStreamField;
99       class OptionalDataException;
100       class OutputStream;
101       class OutputStreamWriter;
102       class PipedInputStream;
103       class PipedOutputStream;
104       class PipedReader;
105       class PipedWriter;
106       class PrintStream;
107       class PrintWriter;
108       class PushbackInputStream;
109       class PushbackReader;
110       class RandomAccessFile;
111       class Reader;
112       class SequenceInputStream;
113       class Serializable;
114       class SerializablePermission;
115       class StreamCorruptedException;
116       class StreamTokenizer;
117       class StringBufferInputStream;
118       class StringReader;
119       class StringWriter;
120       class SyncFailedException;
121       class UTFDataFormatException;
122       class UnsupportedEncodingException;
123       class ValidatorAndPriority;
124       class WriteAbortedException;
125       class Writer;
126     };
127
128     namespace lang
129     {
130       class AbstractMethodError;
131       class ArithmeticException;
132       class ArrayIndexOutOfBoundsException;
133       class ArrayStoreException;
134       class Boolean;
135       class Byte;
136       class CPlusPlusDemangler;
137       class CharSequence;
138       class Character;
139       class Character$Subset;
140       class Character$UnicodeBlock;
141       class Class;
142       class ClassCastException;
143       class ClassCircularityError;
144       class ClassFormatError;
145       class ClassLoader;
146       class ClassNotFoundException;
147       class CloneNotSupportedException;
148       class Cloneable;
149       class Comparable;
150       class Compiler;
151       class ConcreteProcess;
152       class Double;
153       class Error;
154       class Exception;
155       class ExceptionInInitializerError;
156       class Float;
157       class IllegalAccessError;
158       class IllegalAccessException;
159       class IllegalArgumentException;
160       class IllegalMonitorStateException;
161       class IllegalStateException;
162       class IllegalThreadStateException;
163       class IncompatibleClassChangeError;
164       class IndexOutOfBoundsException;
165       class InheritableThreadLocal;
166       class InstantiationError;
167       class InstantiationException;
168       class Integer;
169       class InternalError;
170       class InterruptedException;
171       class LinkageError;
172       class Long;
173       class Math;
174       class NegativeArraySizeException;
175       class NoClassDefFoundError;
176       class NoSuchFieldError;
177       class NoSuchFieldException;
178       class NoSuchMethodError;
179       class NoSuchMethodException;
180       class NullPointerException;
181       class Number;
182       class NumberFormatException;
183       class Object;
184       class OutOfMemoryError;
185       class Package;
186       class Process;
187       class Runnable;
188       class Runtime;
189       class RuntimeException;
190       class RuntimePermission;
191       class SecurityContext;
192       class SecurityException;
193       class SecurityManager;
194       class Short;
195       class StackOverflowError;
196       class String;
197       class String$CaseInsensitiveComparator;
198       class StringBuffer;
199       class StringIndexOutOfBoundsException;
200       class System;
201       class Thread;
202       class ThreadDeath;
203       class ThreadGroup;
204       class ThreadLocal;
205       class ThreadLocal$Value;
206       class Throwable;
207       class UnknownError;
208       class UnsatisfiedLinkError;
209       class UnsupportedClassVersionError;
210       class UnsupportedOperationException;
211       class VMClassLoader;
212       class VMSecurityManager;
213       class VerifyError;
214       class VirtualMachineError;
215       class Void;
216       namespace ref
217       {
218         class PhantomReference;
219         class Reference;
220         class ReferenceQueue;
221         class SoftReference;
222         class WeakReference;
223       };
224
225       namespace reflect
226       {
227         class AccessibleObject;
228         class Array;
229         class Constructor;
230         class Field;
231         class InvocationTargetException;
232         class Member;
233         class Method;
234         class Modifier;
235         class ReflectPermission;
236       };
237     };
238
239     namespace util
240     {
241       class AbstractCollection;
242       class AbstractList;
243       class AbstractList$AbstractListItr;
244       class AbstractMap;
245       class AbstractSequentialList;
246       class AbstractSet;
247       class ArrayList;
248       class Arrays;
249       class Arrays$ListImpl;
250       class BasicMapEntry;
251       class BitSet;
252       class Calendar;
253       class Collection;
254       class Collections;
255       class Collections$ReverseComparator;
256       class Collections$SynchronizedCollection;
257       class Collections$SynchronizedIterator;
258       class Collections$SynchronizedList;
259       class Collections$SynchronizedListIterator;
260       class Collections$SynchronizedMap;
261       class Collections$SynchronizedSet;
262       class Collections$SynchronizedSortedMap;
263       class Collections$SynchronizedSortedSet;
264       class Collections$UnmodifiableCollection;
265       class Collections$UnmodifiableIterator;
266       class Collections$UnmodifiableList;
267       class Collections$UnmodifiableListIterator;
268       class Collections$UnmodifiableMap;
269       class Collections$UnmodifiableSet;
270       class Collections$UnmodifiableSortedMap;
271       class Collections$UnmodifiableSortedSet;
272       class Comparator;
273       class ConcurrentModificationException;
274       class Date;
275       class Dictionary;
276       class EmptyStackException;
277       class Enumeration;
278       class EventListener;
279       class EventObject;
280       class GregorianCalendar;
281       class HashMap;
282       class HashMap$HashEntry;
283       class HashMap$HashIterator;
284       class HashSet;
285       class Hashtable;
286       class Hashtable$Enumerator;
287       class Hashtable$HashEntry;
288       class Hashtable$HashIterator;
289       class IdentityHashMap;
290       class IdentityHashMap$IdentityIterator;
291       class Iterator;
292       class LinkedHashMap;
293       class LinkedHashMap$LinkedHashEntry;
294       class LinkedList;
295       class LinkedList$Entry;
296       class LinkedList$LinkedListItr;
297       class List;
298       class ListIterator;
299       class ListResourceBundle;
300       class Locale;
301       class Map;
302       class Map$Entry;
303       class Map$Map;
304       class MissingResourceException;
305       class NoSuchElementException;
306       class Observable;
307       class Observer;
308       class Properties;
309       class PropertyPermission;
310       class PropertyResourceBundle;
311       class Random;
312       class RandomAccess;
313       class ResourceBundle;
314       class Set;
315       class SimpleTimeZone;
316       class SortedMap;
317       class SortedSet;
318       class Stack;
319       class StringTokenizer;
320       class SubList;
321       class TimeZone;
322       class Timer;
323       class Timer$Scheduler;
324       class Timer$TaskQueue;
325       class TimerTask;
326       class TooManyListenersException;
327       class TreeMap;
328       class TreeMap$Node;
329       class TreeMap$SubMap;
330       class TreeMap$TreeIterator;
331       class TreeMap$VerifyResult;
332       class TreeSet;
333       class Vector;
334       class WeakHashMap;
335       class WeakHashMap$Entry;
336       class WeakHashMap$WeakBucket;
337       class WeakHashMap$WeakEntrySet;
338       namespace jar
339       {
340         class Attributes;
341         class Attributes$Name;
342         class JarEntry;
343         class JarException;
344         class JarFile;
345         class JarFile$JarEnumeration;
346         class JarInputStream;
347         class JarOutputStream;
348         class Manifest;
349       };
350
351       namespace zip
352       {
353         class Adler32;
354         class CRC32;
355         class CheckedInputStream;
356         class CheckedOutputStream;
357         class Checksum;
358         class DataFormatException;
359         class Deflater;
360         class DeflaterOutputStream;
361         class GZIPInputStream;
362         class GZIPOutputStream;
363         class Inflater;
364         class InflaterInputStream;
365         class ZipConstants;
366         class ZipEntry;
367         class ZipEnumeration;
368         class ZipException;
369         class ZipFile;
370         class ZipInputStream;
371         class ZipOutputStream;
372       };
373     };
374   };
375 };
376   
377 typedef struct java::lang::Object* jobject;
378 typedef class java::lang::Class* jclass;
379 typedef class java::lang::Throwable* jthrowable;
380 typedef class java::lang::String* jstring;
381 struct _Jv_JNIEnv;
382
383 typedef struct _Jv_Field *jfieldID;
384 typedef struct _Jv_Method *jmethodID;
385
386 extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__));
387 extern "C" jobject _Jv_AllocObjectNoFinalizer (jclass, jint) __attribute__((__malloc__));
388 extern "C" jobject _Jv_AllocObjectNoInitNoFinalizer (jclass, jint) __attribute__((__malloc__));
389 #ifdef JV_HASH_SYNCHRONIZATION
390   extern "C" jobject _Jv_AllocPtrFreeObject (jclass, jint)
391                             __attribute__((__malloc__));
392 #else
393   // Collector still needs to scan sync_info
394   static inline jobject _Jv_AllocPtrFreeObject (jclass klass, jint sz)
395   {
396     return _Jv_AllocObject(klass, sz);
397   }
398 #endif
399 extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
400 extern "C" jstring _Jv_AllocString(jsize) __attribute__((__malloc__));
401 extern "C" jstring _Jv_NewString (const jchar*, jsize)
402   __attribute__((__malloc__));
403 extern jint _Jv_FormatInt (jchar* bufend, jint num);
404 extern "C" jchar* _Jv_GetStringChars (jstring str);
405 extern "C" void _Jv_MonitorEnter (jobject);
406 extern "C" void _Jv_MonitorExit (jobject);
407 extern "C" jstring _Jv_NewStringLatin1(const char*, jsize)
408   __attribute__((__malloc__));
409 extern "C" jsize _Jv_GetStringUTFLength (jstring);
410 extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
411
412 extern jint _Jv_CreateJavaVM (void* /*vm_args*/);
413
414 void
415 _Jv_ThreadRun (java::lang::Thread* thread);
416 jint
417 _Jv_AttachCurrentThread(java::lang::Thread* thread);
418 extern "C" java::lang::Thread*
419 _Jv_AttachCurrentThread(jstring name, java::lang::ThreadGroup* group);
420 extern "C" jint _Jv_DetachCurrentThread (void);
421
422 extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));
423 extern "C" void* _Jv_Malloc (jsize) __attribute__((__malloc__));
424 extern "C" void* _Jv_Realloc (void *, jsize);
425 extern "C" void _Jv_Free (void*);
426 extern void (*_Jv_RegisterClassHook) (jclass cl);
427 extern "C" void _Jv_RegisterClassHookDefault (jclass);
428
429 typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
430 typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
431
432 struct _Jv_Utf8Const
433 {
434   _Jv_ushort hash;
435   _Jv_ushort length;    /* In bytes, of data portion, without final '\0'. */
436   char data[1];         /* In Utf8 format, with final '\0'. */
437 };
438
439
440 #endif /* __JAVAPRIMS_H__ */