error.hpp

Go to the documentation of this file.
00001 /* Copyright 1994 - 1996 LongView Technologies L.L.C. $Revision: 1.8 $ */
00002 /* Copyright (c) 2006, Sun Microsystems, Inc.
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 
00006 following conditions are met:
00007 
00008     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 
00010           disclaimer in the documentation and/or other materials provided with the distribution.
00011     * Neither the name of Sun Microsystems nor the names of its contributors may be used to endorse or promote products derived 
00012           from this software without specific prior written permission.
00013 
00014 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 
00015 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
00016 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00017 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00018 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
00019 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00020 
00021 
00022 */
00023 
00024 #define DEBUG_EXCEPTION _asm { int 3 }
00025 
00026 
00027 #ifdef PRODUCT
00028 #define FILE_INFO "<no file info>"
00029 #define LINE_INFO 0
00030 #else
00031 #define FILE_INFO __FILE__
00032 #define LINE_INFO __LINE__
00033 #endif
00034 
00035 
00036 #ifdef ASSERT
00037 #define assert(b,msg)                                            \
00038   if (!(b)) {                                                    \
00039     report_assertion_failure(XSTR(b),FILE_INFO, LINE_INFO, msg); \
00040     DEBUG_EXCEPTION;                                             \
00041   }
00042 #else
00043 #define assert(b,msg)
00044 #endif
00045 
00046 
00047 #define fatal(m)                             { report_fatal(FILE_INFO, LINE_INFO, m                                    ); DEBUG_EXCEPTION; }
00048 #define fatal1(m,x1)                         { report_fatal(FILE_INFO, LINE_INFO, m, x1                                ); DEBUG_EXCEPTION; }
00049 #define fatal2(m,x1,x2)                      { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2                            ); DEBUG_EXCEPTION; }
00050 #define fatal3(m,x1,x2,x3)                   { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3                        ); DEBUG_EXCEPTION; }
00051 #define fatal4(m,x1,x2,x3,x4)                { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4                    ); DEBUG_EXCEPTION; }
00052 #define fatal5(m,x1,x2,x3,x4,x5)             { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5                ); DEBUG_EXCEPTION; }
00053 #define fatal6(m,x1,x2,x3,x4,x5,x6)          { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5, x6            ); DEBUG_EXCEPTION; }
00054 #define fatal7(m,x1,x2,x3,x4,x5,x6,x7)       { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5, x6, x7        ); DEBUG_EXCEPTION; }
00055 #define fatal8(m,x1,x2,x3,x4,x5,x6,x7,x8)    { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5, x6, x7, x8    ); DEBUG_EXCEPTION; }
00056 #define fatal9(m,x1,x2,x3,x4,x5,x6,x7,x8,x9) { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5, x6, x7, x8, x9); DEBUG_EXCEPTION; }
00057 
00058 
00059 #define guarantee(b,msg)         { if (!(b)) fatal(msg); }
00060 #define ShouldNotCallThis()      { report_should_not_call        (FILE_INFO, LINE_INFO); DEBUG_EXCEPTION; }
00061 #define ShouldNotReachHere()     { report_should_not_reach_here  (FILE_INFO, LINE_INFO); DEBUG_EXCEPTION; }
00062 #define SubclassResponsibility() { report_subclass_responsibility(FILE_INFO, LINE_INFO); DEBUG_EXCEPTION; }
00063 #define Unimplemented()          { report_unimplemented          (FILE_INFO, LINE_INFO); DEBUG_EXCEPTION; }
00064 
00065 
00066 void report_assertion_failure(char* code_str, char* file_name, int line_no, char* message);
00067 void report_fatal(char* file_name, int line_no, char* format, ...);
00068 void report_should_not_call(char* file_name, int line_no);
00069 void report_should_not_reach_here(char* file_name, int line_no);
00070 void report_subclass_responsibility(char* file_name, int line_no);
00071 void report_unimplemented(char* file_name, int line_no);
00072 void report_vm_state();
00073 
00074 
00075 extern "C" {
00076   void breakpoint();            // called at every warning
00077   void error_breakpoint();      // called at every error or fatal
00078 }

Generated on Mon Oct 9 13:37:09 2006 for Strongtalk VM by  doxygen 1.4.7