lasp/beamforming/c/ascee_assert.h

43 lines
1.2 KiB
C
Raw Normal View History

2018-01-29 15:14:50 +00:00
// ascee_assert.h
//
// Author: J.A. de Jong - ASCEE
//
// Description:
// Basic tools for debugging using assert statements including text.
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef ASCEE_ASSERT_H
#define ASCEE_ASSERT_H
#define OUTOFBOUNDSMATR "Out of bounds access on matrix row"
#define OUTOFBOUNDSMATC "Out of bounds access on matrix column"
#define OUTOFBOUNDSVEC "Out of bounds access on vector"
#define SIZEINEQUAL "Array sizes not equal"
#define ALLOCFAILED "Memory allocation failure in: "
#define NULLPTRDEREF "Null pointer dereference in: "
#ifdef ASCEE_DEBUG
#include "types.h"
void DBG_AssertFailedExtImplementation(const char* file,
const us line,
const char* string);
#define dbgassert(assertion, assert_string) \
if (!(assertion)) \
{ \
DBG_AssertFailedExtImplementation(__FILE__, __LINE__, assert_string ); \
}
#else // ASCEE_DEBUG not defined
#define dbgassert(assertion, assert_string)
#define assertvalidptr(ptr) dbgassert(ptr,NULLPTRDEREF)
2018-01-29 15:14:50 +00:00
#endif // ASCEE_DEBUG
#endif // ASCEE_ASSERT_H
//////////////////////////////////////////////////////////////////////