1 /* 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 /* 27 * Copyright 2003 Wily Technology, Inc. 28 */ 29 30 /* 31 * Super-cheesy assertions that aren't efficient when they are turned on, but 32 * are free when turned off (all pre-processor stuff) 33 */ 34 35 36 #ifndef _JPLISASSERT_H_ 37 #define _JPLISASSERT_H_ 38 39 #include <jni.h> 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 #define JPLISASSERT_ENABLEASSERTIONS (1) 46 47 48 #ifndef JPLISASSERT_ENABLEASSERTIONS 49 #define JPLISASSERT_ENABLEASSERTIONS (0) 50 #endif 51 52 /* Use THIS_FILE when it is available. */ 53 #ifndef THIS_FILE 54 #define THIS_FILE __FILE__ 55 #endif 56 57 #if JPLISASSERT_ENABLEASSERTIONS 58 #define jplis_assert(x) JPLISAssertCondition((jboolean)(x), #x, THIS_FILE, __LINE__) 59 #define jplis_assert_msg(x, msg) JPLISAssertConditionWithMessage((jboolean)(x), #x, msg, THIS_FILE, __LINE__) 60 #else 61 #define jplis_assert(x) 62 #define jplis_assert_msg(x, msg) 63 #endif 64 65 /* 66 * Test the supplied condition. 67 * If false, print a constructed message including source site info to stderr. 68 * If true, do nothing. 69 */ 70 extern void 71 JPLISAssertCondition( jboolean condition, 72 const char * assertionText, 73 const char * file, 74 int line); 75 76 /* 77 * Test the supplied condition. 78 * If false, print a constructed message including source site info 79 * and the supplied message to stderr. 80 * If true, do nothing. 81 */ 82 extern void 83 JPLISAssertConditionWithMessage( jboolean condition, 84 const char * assertionText, 85 const char * message, 86 const char * file, 87 int line); 88 89 90 91 92 #ifdef __cplusplus 93 } /* extern "C" */ 94 #endif /* __cplusplus */ 95 96 97 #endif