Makefile.am: New friends for java/lang/Thread.h.
[gcc.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 Character;
138 class Character$Subset;
139 class Character$UnicodeBlock;
140 class Class;
141 class ClassCastException;
142 class ClassCircularityError;
143 class ClassFormatError;
144 class ClassLoader;
145 class ClassNotFoundException;
146 class CloneNotSupportedException;
147 class Cloneable;
148 class Comparable;
149 class Compiler;
150 class ConcreteProcess;
151 class Double;
152 class Error;
153 class Exception;
154 class ExceptionInInitializerError;
155 class Float;
156 class IllegalAccessError;
157 class IllegalAccessException;
158 class IllegalArgumentException;
159 class IllegalMonitorStateException;
160 class IllegalStateException;
161 class IllegalThreadStateException;
162 class IncompatibleClassChangeError;
163 class IndexOutOfBoundsException;
164 class InstantiationError;
165 class InstantiationException;
166 class Integer;
167 class InternalError;
168 class InterruptedException;
169 class LinkageError;
170 class Long;
171 class Math;
172 class NegativeArraySizeException;
173 class NoClassDefFoundError;
174 class NoSuchFieldError;
175 class NoSuchFieldException;
176 class NoSuchMethodError;
177 class NoSuchMethodException;
178 class NullPointerException;
179 class Number;
180 class NumberFormatException;
181 class Object;
182 class OutOfMemoryError;
183 class Package;
184 class Process;
185 class Runnable;
186 class Runtime;
187 class RuntimeException;
188 class RuntimePermission;
189 class SecurityException;
190 class SecurityManager;
191 class Short;
192 class StackOverflowError;
193 class String;
194 class StringBuffer;
195 class StringIndexOutOfBoundsException;
196 class System;
197 class Thread;
198 class ThreadDeath;
199 class ThreadGroup;
200 class ThreadLocal;
201 class ThreadLocal$Value;
202 class Throwable;
203 class UnknownError;
204 class UnsatisfiedLinkError;
205 class UnsupportedOperationException;
206 class VMClassLoader;
207 class VerifyError;
208 class VirtualMachineError;
209 class Void;
210 namespace ref
211 {
212 class PhantomReference;
213 class Reference;
214 class ReferenceQueue;
215 class SoftReference;
216 class WeakReference;
217 };
218
219 namespace reflect
220 {
221 class AccessibleObject;
222 class Array;
223 class Constructor;
224 class Field;
225 class InvocationTargetException;
226 class Member;
227 class Method;
228 class Modifier;
229 class ReflectPermission;
230 };
231 };
232
233 namespace util
234 {
235 class AbstractCollection;
236 class AbstractList;
237 class AbstractList$AbstractListItr;
238 class AbstractMap;
239 class AbstractSequentialList;
240 class AbstractSet;
241 class ArrayList;
242 class Arrays;
243 class Arrays$ListImpl;
244 class BasicMapEntry;
245 class BitSet;
246 class Calendar;
247 class Collection;
248 class Collections;
249 class Collections$ReverseComparator;
250 class Collections$SynchronizedCollection;
251 class Collections$SynchronizedIterator;
252 class Collections$SynchronizedList;
253 class Collections$SynchronizedListIterator;
254 class Collections$SynchronizedMap;
255 class Collections$SynchronizedSet;
256 class Collections$SynchronizedSortedMap;
257 class Collections$SynchronizedSortedSet;
258 class Collections$UnmodifiableCollection;
259 class Collections$UnmodifiableIterator;
260 class Collections$UnmodifiableList;
261 class Collections$UnmodifiableListIterator;
262 class Collections$UnmodifiableMap;
263 class Collections$UnmodifiableSet;
264 class Collections$UnmodifiableSortedMap;
265 class Collections$UnmodifiableSortedSet;
266 class Comparator;
267 class ConcurrentModificationException;
268 class Date;
269 class Dictionary;
270 class EmptyStackException;
271 class Enumeration;
272 class EventListener;
273 class EventObject;
274 class GregorianCalendar;
275 class HashMap;
276 class HashMap$Entry;
277 class HashMap$HashIterator;
278 class HashSet;
279 class Hashtable;
280 class Hashtable$Entry;
281 class Hashtable$Enumerator;
282 class Hashtable$HashIterator;
283 class IdentityHashMap;
284 class IdentityHashMap$IdentityIterator;
285 class Iterator;
286 class LinkedList;
287 class LinkedList$Entry;
288 class LinkedList$LinkedListItr;
289 class List;
290 class ListIterator;
291 class ListResourceBundle;
292 class Locale;
293 class Map;
294 class Map$Entry;
295 class MissingResourceException;
296 class NoSuchElementException;
297 class Observable;
298 class Observer;
299 class Properties;
300 class PropertyPermission;
301 class PropertyResourceBundle;
302 class Random;
303 class ResourceBundle;
304 class Set;
305 class SimpleTimeZone;
306 class SortedMap;
307 class SortedSet;
308 class Stack;
309 class StringTokenizer;
310 class SubList;
311 class TimeZone;
312 class Timer;
313 class Timer$Scheduler;
314 class Timer$TaskQueue;
315 class TimerTask;
316 class TooManyListenersException;
317 class TreeMap;
318 class TreeMap$Node;
319 class TreeMap$SubMap;
320 class TreeMap$TreeIterator;
321 class TreeMap$VerifyResult;
322 class TreeSet;
323 class Vector;
324 class WeakHashMap;
325 class WeakHashMap$Entry;
326 class WeakHashMap$WeakBucket;
327 class WeakHashMap$WeakEntrySet;
328 namespace jar
329 {
330 class Attributes;
331 class Attributes$Name;
332 class JarEntry;
333 class JarException;
334 class JarFile;
335 class JarFile$JarEnumeration;
336 class JarInputStream;
337 class JarOutputStream;
338 class Manifest;
339 };
340
341 namespace zip
342 {
343 class Adler32;
344 class CRC32;
345 class CheckedInputStream;
346 class CheckedOutputStream;
347 class Checksum;
348 class DataFormatException;
349 class Deflater;
350 class DeflaterOutputStream;
351 class GZIPInputStream;
352 class GZIPOutputStream;
353 class Inflater;
354 class InflaterInputStream;
355 class ZipConstants;
356 class ZipEntry;
357 class ZipEnumeration;
358 class ZipException;
359 class ZipFile;
360 class ZipInputStream;
361 class ZipOutputStream;
362 };
363 };
364 };
365 };
366
367 typedef struct java::lang::Object* jobject;
368 typedef class java::lang::Class* jclass;
369 typedef class java::lang::Throwable* jthrowable;
370 typedef class java::lang::String* jstring;
371 struct _Jv_JNIEnv;
372
373 typedef struct _Jv_Field *jfieldID;
374 typedef struct _Jv_Method *jmethodID;
375
376 extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__));
377 #ifdef JV_HASH_SYNCHRONIZATION
378 extern "C" jobject _Jv_AllocPtrFreeObject (jclass, jint)
379 __attribute__((__malloc__));
380 #else
381 // Collector still needs to scan sync_info
382 static inline jobject _Jv_AllocPtrFreeObject (jclass klass, jint sz)
383 {
384 return _Jv_AllocObject(klass, sz);
385 }
386 #endif
387 extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
388 extern "C" jstring _Jv_AllocString(jsize) __attribute__((__malloc__));
389 extern "C" jstring _Jv_NewString (const jchar*, jsize)
390 __attribute__((__malloc__));
391 extern jint _Jv_FormatInt (jchar* bufend, jint num);
392 extern "C" jchar* _Jv_GetStringChars (jstring str);
393 extern "C" void _Jv_MonitorEnter (jobject);
394 extern "C" void _Jv_MonitorExit (jobject);
395 extern "C" jstring _Jv_NewStringLatin1(const char*, jsize)
396 __attribute__((__malloc__));
397 extern "C" jsize _Jv_GetStringUTFLength (jstring);
398 extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
399
400 extern jint _Jv_CreateJavaVM (void* /*vm_args*/);
401
402 void
403 _Jv_ThreadRun (java::lang::Thread* thread);
404 jint
405 _Jv_AttachCurrentThread(java::lang::Thread* thread);
406 extern "C" java::lang::Thread*
407 _Jv_AttachCurrentThread(jstring name, java::lang::ThreadGroup* group);
408 extern "C" jint _Jv_DetachCurrentThread (void);
409
410 extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));
411 extern "C" void* _Jv_Malloc (jsize) __attribute__((__malloc__));
412 extern "C" void* _Jv_Realloc (void *, jsize);
413 extern "C" void _Jv_Free (void*);
414
415 typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
416 typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
417
418 struct _Jv_Utf8Const
419 {
420 _Jv_ushort hash;
421 _Jv_ushort length; /* In bytes, of data portion, without final '\0'. */
422 char data[1]; /* In Utf8 format, with final '\0'. */
423 };
424
425
426 #endif /* __JAVAPRIMS_H__ */