MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Fail.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  fail.h Support for meaningful runtime deaths when necessary
3  Copyright (C) 2014 The Regents of the University of New Mexico. All rights reserved.
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
27 #ifndef FAIL_H
28 #define FAIL_H
29 
30 #include "FailPlatformSpecific.h" /* For FAIL and unwind_protect */
31 
32 extern "C" {
39  const char * MFMFailCodeReason(int failCode) ;
40 }
41 
42 #define XX(a) MFM_FAIL_CODE_REASON_##a,
43 enum MFMFailureCodes{
44  ZERO_UNUSED = 0,
45 #include "FailCodes.h"
46 #undef XX
47  MAX_FAILURE
48 };
49 
50 #define MFM_API_ASSERT(expr,code) do { if (!(expr)) FAIL(code); } while (0)
51 #define MFM_API_ASSERT_NONNULL(expr) MFM_API_ASSERT(expr,NULL_POINTER)
52 #define MFM_API_ASSERT_ZERO(expr) MFM_API_ASSERT((expr)==0,NON_ZERO)
53 
54 #endif /* FAIL_H */
55 
const char * MFMFailCodeReason(int failCode)
Definition: Fail.cpp:14