1 /* src/vm/exceptions.h - exception related functions prototypes
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Christian Thalinger
29 Changes: Edwin Steiner
31 $Id: exceptions.h 3861 2005-12-03 13:31:29Z twisti $
39 /* forward typedefs ***********************************************************/
41 typedef struct exceptionentry exceptionentry;
46 #include "vm/global.h"
47 #include "native/include/java_lang_String.h"
48 #include "native/include/java_lang_Throwable.h"
49 #include "vm/builtin.h"
50 #include "vm/references.h"
51 #include "vm/method.h"
54 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
55 #define exceptionptr builtin_get_exceptionptrptr()
57 #define exceptionptr &_no_threads_exceptionptr
60 #if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
61 extern java_objectheader *_no_threads_exceptionptr;
65 /* exceptionentry **************************************************************
67 Datastructure which represents an exception entry in the exception
68 table residing in the data segment.
70 *******************************************************************************/
72 struct exceptionentry {
73 classref_or_classinfo catchtype;
80 /* function prototypes ********************************************************/
82 /* load and link exceptions used in the system */
83 bool exceptions_init(void);
86 /* exception throwing functions */
88 void throw_exception(void);
89 void throw_exception_exit(void);
91 void throw_main_exception(void);
92 void throw_main_exception_exit(void);
94 void throw_cacao_exception_exit(const char *exception,
95 const char *message, ...);
97 void exceptions_throw_outofmemory_exit(void);
100 /* initialize new exceptions */
102 java_objectheader *new_exception(const char *classname);
104 java_objectheader *new_exception_message(const char *classname,
105 const char *message);
107 java_objectheader *new_exception_throwable(const char *classname,
108 java_lang_Throwable *cause);
110 java_objectheader *new_exception_utfmessage(const char *classname,
113 java_objectheader *new_exception_javastring(const char *classname,
114 java_lang_String *message);
116 java_objectheader *new_exception_int(const char *classname, s4 i);
119 /* functions to generate compiler exceptions */
121 java_objectheader *new_classformaterror(classinfo *c, const char *message, ...);
122 java_objectheader *new_classnotfoundexception(utf *name);
123 java_objectheader *new_noclassdeffounderror(utf *name);
124 java_objectheader *exceptions_new_linkageerror(const char *message,classinfo *c);
125 java_objectheader *exceptions_new_nosuchmethoderror(classinfo *c,
126 utf *name, utf *desc);
127 java_objectheader *new_internalerror(const char *message, ...);
128 java_objectheader *new_verifyerror(methodinfo *m, const char *message, ...);
129 java_objectheader *new_unsupportedclassversionerror(classinfo *c,
130 const char *message, ...);
132 java_objectheader *new_arithmeticexception(void);
133 java_objectheader *new_arrayindexoutofboundsexception(s4 index);
134 java_objectheader *new_arraystoreexception(void);
135 java_objectheader *new_classcastexception(void);
136 java_objectheader *new_illegalargumentexception(void);
137 java_objectheader *new_illegalmonitorstateexception(void);
138 java_objectheader *new_negativearraysizeexception(void);
139 java_objectheader *new_nullpointerexception(void);
141 void classnotfoundexception_to_noclassdeffounderror(void);
143 void exceptions_print_exception(java_objectheader *xptr);
145 #endif /* _EXCEPTIONS_H */
149 * These are local overrides for various environment variables in Emacs.
150 * Please do not remove this and leave it at the end of the file, where
151 * Emacs will automagically detect them.
152 * ---------------------------------------------------------------------
155 * indent-tabs-mode: t