1 | /*
|
---|
2 | * Copyright (c) 2003, 2007, 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 |
|
---|
53 | #if JPLISASSERT_ENABLEASSERTIONS
|
---|
54 | #define jplis_assert(x) JPLISAssertCondition((jboolean)(x), #x, __FILE__, __LINE__)
|
---|
55 | #define jplis_assert_msg(x, msg) JPLISAssertConditionWithMessage((jboolean)(x), #x, msg, __FILE__, __LINE__)
|
---|
56 | #else
|
---|
57 | #define jplis_assert(x)
|
---|
58 | #define jplis_assert_msg(x, msg)
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * Test the supplied condition.
|
---|
63 | * If false, print a constructed message including source site info to stderr.
|
---|
64 | * If true, do nothing.
|
---|
65 | */
|
---|
66 | extern void
|
---|
67 | JPLISAssertCondition( jboolean condition,
|
---|
68 | const char * assertionText,
|
---|
69 | const char * file,
|
---|
70 | int line);
|
---|
71 |
|
---|
72 | /*
|
---|
73 | * Test the supplied condition.
|
---|
74 | * If false, print a constructed message including source site info
|
---|
75 | * and the supplied message to stderr.
|
---|
76 | * If true, do nothing.
|
---|
77 | */
|
---|
78 | extern void
|
---|
79 | JPLISAssertConditionWithMessage( jboolean condition,
|
---|
80 | const char * assertionText,
|
---|
81 | const char * message,
|
---|
82 | const char * file,
|
---|
83 | int line);
|
---|
84 |
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 | #ifdef __cplusplus
|
---|
89 | } /* extern "C" */
|
---|
90 | #endif /* __cplusplus */
|
---|
91 |
|
---|
92 |
|
---|
93 | #endif
|
---|