* exceptions_new_nosuchmethoderror: Added.
[cacao.git] / src / vm / exceptions.h
1 /* src/vm/exceptions.h - exception related functions prototypes
2
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
7
8    This file is part of CACAO.
9
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.
14
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.
19
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
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Christian Thalinger
28
29    Changes: Edwin Steiner
30
31    $Id: exceptions.h 3639 2005-11-08 17:21:37Z twisti $
32
33 */
34
35
36 #ifndef _EXCEPTIONS_H
37 #define _EXCEPTIONS_H
38
39 #include "config.h"
40 #include "vm/types.h"
41
42 #include "vm/global.h"
43 #include "native/include/java_lang_String.h"
44 #include "native/include/java_lang_Throwable.h"
45 #include "vm/builtin.h"
46 #include "vm/references.h"
47 #include "vm/method.h"
48
49
50 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
51 #define exceptionptr    builtin_get_exceptionptrptr()
52 #else
53 #define exceptionptr    &_no_threads_exceptionptr
54 #endif
55
56 #if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
57 extern java_objectheader *_no_threads_exceptionptr;
58 #endif
59
60
61 /* global variables ***********************************************************/
62
63
64 /* function prototypes ********************************************************/
65
66 /* load and link exceptions used in the system */
67
68 bool exceptions_init(void);
69
70
71 /* exception throwing functions */
72
73 void throw_exception(void);
74 void throw_exception_exit(void);
75
76 void throw_main_exception(void);
77 void throw_main_exception_exit(void);
78
79 void throw_cacao_exception_exit(const char *exception,
80                                                                 const char *message, ...);
81
82 void exceptions_throw_outofmemory_exit(void);
83
84
85 /* initialize new exceptions */
86
87 java_objectheader *new_exception(const char *classname);
88
89 java_objectheader *new_exception_message(const char *classname,
90                                                                                  const char *message);
91
92 java_objectheader *new_exception_throwable(const char *classname,
93                                                                                    java_lang_Throwable *cause);
94
95 java_objectheader *new_exception_utfmessage(const char *classname,
96                                                                                         utf *message);
97
98 java_objectheader *new_exception_javastring(const char *classname,
99                                                                                         java_lang_String *message);
100
101 java_objectheader *new_exception_int(const char *classname, s4 i);
102
103
104 /* functions to generate compiler exceptions */
105
106 java_objectheader *new_classformaterror(classinfo *c, const char *message, ...);
107 java_objectheader *new_classnotfoundexception(utf *name);
108 java_objectheader *new_noclassdeffounderror(utf *name);
109 java_objectheader *exceptions_new_nosuchmethoderror(classinfo *c,
110                                                                                                         utf *name, utf *desc);
111 java_objectheader *new_internalerror(const char *message, ...);
112 java_objectheader *new_verifyerror(methodinfo *m, const char *message, ...);
113 java_objectheader *new_unsupportedclassversionerror(classinfo *c,
114                                                                                                         const char *message, ...);
115
116 java_objectheader *new_arithmeticexception(void);
117 java_objectheader *new_arrayindexoutofboundsexception(s4 index);
118 java_objectheader *new_arraystoreexception(void);
119 java_objectheader *new_classcastexception(void);
120 java_objectheader *new_illegalargumentexception(void);
121 java_objectheader *new_illegalmonitorstateexception(void);
122 java_objectheader *new_negativearraysizeexception(void);
123 java_objectheader *new_nullpointerexception(void);
124
125 void classnotfoundexception_to_noclassdeffounderror(void);
126
127 #endif /* _EXCEPTIONS_H */
128
129
130 /*
131  * These are local overrides for various environment variables in Emacs.
132  * Please do not remove this and leave it at the end of the file, where
133  * Emacs will automagically detect them.
134  * ---------------------------------------------------------------------
135  * Local variables:
136  * mode: c
137  * indent-tabs-mode: t
138  * c-basic-offset: 4
139  * tab-width: 4
140  * End:
141  */