javaprims.h (java::lang): Add java::lang::StrictMath.
[gcc.git] / libjava / gcj / javaprims.h
1 // javaprims.h - Main external header file for libgcj. -*- c++ -*-
2
3 /* Copyright (C) 1998, 1999, 2000, 2001, 2002 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 StrictMath;
197 class String;
198 class String$CaseInsensitiveComparator;
199 class StringBuffer;
200 class StringIndexOutOfBoundsException;
201 class System;
202 class Thread;
203 class ThreadDeath;
204 class ThreadGroup;
205 class ThreadLocal;
206 class ThreadLocal$Value;
207 class Throwable;
208 class UnknownError;
209 class UnsatisfiedLinkError;
210 class UnsupportedClassVersionError;
211 class UnsupportedOperationException;
212 class VMClassLoader;
213 class VMSecurityManager;
214 class VerifyError;
215 class VirtualMachineError;
216 class Void;
217 namespace ref
218 {
219 class PhantomReference;
220 class Reference;
221 class ReferenceQueue;
222 class SoftReference;
223 class WeakReference;
224 };
225
226 namespace reflect
227 {
228 class AccessibleObject;
229 class Array;
230 class Constructor;
231 class Field;
232 class InvocationTargetException;
233 class Member;
234 class Method;
235 class Modifier;
236 class ReflectPermission;
237 };
238 };
239
240 namespace util
241 {
242 class AbstractCollection;
243 class AbstractList;
244 class AbstractList$AbstractListItr;
245 class AbstractMap;
246 class AbstractSequentialList;
247 class AbstractSet;
248 class ArrayList;
249 class Arrays;
250 class Arrays$ListImpl;
251 class BasicMapEntry;
252 class BitSet;
253 class Calendar;
254 class Collection;
255 class Collections;
256 class Collections$ReverseComparator;
257 class Collections$SynchronizedCollection;
258 class Collections$SynchronizedIterator;
259 class Collections$SynchronizedList;
260 class Collections$SynchronizedListIterator;
261 class Collections$SynchronizedMap;
262 class Collections$SynchronizedSet;
263 class Collections$SynchronizedSortedMap;
264 class Collections$SynchronizedSortedSet;
265 class Collections$UnmodifiableCollection;
266 class Collections$UnmodifiableIterator;
267 class Collections$UnmodifiableList;
268 class Collections$UnmodifiableListIterator;
269 class Collections$UnmodifiableMap;
270 class Collections$UnmodifiableSet;
271 class Collections$UnmodifiableSortedMap;
272 class Collections$UnmodifiableSortedSet;
273 class Comparator;
274 class ConcurrentModificationException;
275 class Date;
276 class Dictionary;
277 class EmptyStackException;
278 class Enumeration;
279 class EventListener;
280 class EventObject;
281 class GregorianCalendar;
282 class HashMap;
283 class HashMap$HashEntry;
284 class HashMap$HashIterator;
285 class HashSet;
286 class Hashtable;
287 class Hashtable$Enumerator;
288 class Hashtable$HashEntry;
289 class Hashtable$HashIterator;
290 class IdentityHashMap;
291 class IdentityHashMap$IdentityIterator;
292 class Iterator;
293 class LinkedHashMap;
294 class LinkedHashMap$LinkedHashEntry;
295 class LinkedList;
296 class LinkedList$Entry;
297 class LinkedList$LinkedListItr;
298 class List;
299 class ListIterator;
300 class ListResourceBundle;
301 class Locale;
302 class Map;
303 class Map$Entry;
304 class Map$Map;
305 class MissingResourceException;
306 class NoSuchElementException;
307 class Observable;
308 class Observer;
309 class Properties;
310 class PropertyPermission;
311 class PropertyResourceBundle;
312 class Random;
313 class RandomAccess;
314 class ResourceBundle;
315 class Set;
316 class SimpleTimeZone;
317 class SortedMap;
318 class SortedSet;
319 class Stack;
320 class StringTokenizer;
321 class SubList;
322 class TimeZone;
323 class Timer;
324 class Timer$Scheduler;
325 class Timer$TaskQueue;
326 class TimerTask;
327 class TooManyListenersException;
328 class TreeMap;
329 class TreeMap$Node;
330 class TreeMap$SubMap;
331 class TreeMap$TreeIterator;
332 class TreeMap$VerifyResult;
333 class TreeSet;
334 class Vector;
335 class WeakHashMap;
336 class WeakHashMap$Entry;
337 class WeakHashMap$WeakBucket;
338 class WeakHashMap$WeakEntrySet;
339 namespace jar
340 {
341 class Attributes;
342 class Attributes$Name;
343 class JarEntry;
344 class JarException;
345 class JarFile;
346 class JarFile$JarEnumeration;
347 class JarInputStream;
348 class JarOutputStream;
349 class Manifest;
350 };
351
352 namespace zip
353 {
354 class Adler32;
355 class CRC32;
356 class CheckedInputStream;
357 class CheckedOutputStream;
358 class Checksum;
359 class DataFormatException;
360 class Deflater;
361 class DeflaterOutputStream;
362 class GZIPInputStream;
363 class GZIPOutputStream;
364 class Inflater;
365 class InflaterInputStream;
366 class ZipConstants;
367 class ZipEntry;
368 class ZipEnumeration;
369 class ZipException;
370 class ZipFile;
371 class ZipInputStream;
372 class ZipOutputStream;
373 };
374 };
375 };
376 };
377
378 typedef struct java::lang::Object* jobject;
379 typedef class java::lang::Class* jclass;
380 typedef class java::lang::Throwable* jthrowable;
381 typedef class java::lang::String* jstring;
382 struct _Jv_JNIEnv;
383
384 typedef struct _Jv_Field *jfieldID;
385 typedef struct _Jv_Method *jmethodID;
386
387 extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__));
388 extern "C" jobject _Jv_AllocObjectNoFinalizer (jclass, jint) __attribute__((__malloc__));
389 extern "C" jobject _Jv_AllocObjectNoInitNoFinalizer (jclass, jint) __attribute__((__malloc__));
390 #ifdef JV_HASH_SYNCHRONIZATION
391 extern "C" jobject _Jv_AllocPtrFreeObject (jclass, jint)
392 __attribute__((__malloc__));
393 #else
394 // Collector still needs to scan sync_info
395 static inline jobject _Jv_AllocPtrFreeObject (jclass klass, jint sz)
396 {
397 return _Jv_AllocObject(klass, sz);
398 }
399 #endif
400 extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
401 extern "C" jstring _Jv_AllocString(jsize) __attribute__((__malloc__));
402 extern "C" jstring _Jv_NewString (const jchar*, jsize)
403 __attribute__((__malloc__));
404 extern jint _Jv_FormatInt (jchar* bufend, jint num);
405 extern "C" jchar* _Jv_GetStringChars (jstring str);
406 extern "C" void _Jv_MonitorEnter (jobject);
407 extern "C" void _Jv_MonitorExit (jobject);
408 extern "C" jstring _Jv_NewStringLatin1(const char*, jsize)
409 __attribute__((__malloc__));
410 extern "C" jsize _Jv_GetStringUTFLength (jstring);
411 extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
412
413 extern jint _Jv_CreateJavaVM (void* /*vm_args*/);
414
415 void
416 _Jv_ThreadRun (java::lang::Thread* thread);
417 jint
418 _Jv_AttachCurrentThread(java::lang::Thread* thread);
419 extern "C" java::lang::Thread*
420 _Jv_AttachCurrentThread(jstring name, java::lang::ThreadGroup* group);
421 extern "C" jint _Jv_DetachCurrentThread (void);
422
423 extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));
424 extern "C" void* _Jv_Malloc (jsize) __attribute__((__malloc__));
425 extern "C" void* _Jv_Realloc (void *, jsize);
426 extern "C" void _Jv_Free (void*);
427 extern void (*_Jv_RegisterClassHook) (jclass cl);
428 extern "C" void _Jv_RegisterClassHookDefault (jclass);
429
430 typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
431 typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
432
433 struct _Jv_Utf8Const
434 {
435 _Jv_ushort hash;
436 _Jv_ushort length; /* In bytes, of data portion, without final '\0'. */
437 char data[1]; /* In Utf8 format, with final '\0'. */
438 };
439
440
441 #endif /* __JAVAPRIMS_H__ */