Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.instrument/share/native/libinstrument/JPLISAssert.h
41149 views
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
#if JPLISASSERT_ENABLEASSERTIONS
53
#define jplis_assert(x) JPLISAssertCondition((jboolean)(x), #x, __FILE__, __LINE__)
54
#define jplis_assert_msg(x, msg) JPLISAssertConditionWithMessage((jboolean)(x), #x, msg, __FILE__, __LINE__)
55
#else
56
#define jplis_assert(x)
57
#define jplis_assert_msg(x, msg)
58
#endif
59
60
/*
61
* Test the supplied condition.
62
* If false, print a constructed message including source site info to stderr.
63
* If true, do nothing.
64
*/
65
extern void
66
JPLISAssertCondition( jboolean condition,
67
const char * assertionText,
68
const char * file,
69
int line);
70
71
/*
72
* Test the supplied condition.
73
* If false, print a constructed message including source site info
74
* and the supplied message to stderr.
75
* If true, do nothing.
76
*/
77
extern void
78
JPLISAssertConditionWithMessage( jboolean condition,
79
const char * assertionText,
80
const char * message,
81
const char * file,
82
int line);
83
84
85
86
87
#ifdef __cplusplus
88
} /* extern "C" */
89
#endif /* __cplusplus */
90
91
92
#endif
93
94