#ifndef ASSERT_H
# define ASSERT_H

# ifndef STDCXX_HXX
#  include <stdcxx.hxx>
# endif
# ifndef IOSTREAMH
#  include <iostream.h>
# endif
# ifndef NDEBUG
#  ifndef __STRING_H
#   include <String.h>
#  endif

class assert_c;
typedef C assert_c Cassert_c;
typedef C String CString;

class assert_c	{
	CString filename, functname;
	int linenum;
	C static char *MARK;
	C static char *EXIT;
	assert_c();
	void dcheck(C char *) C;
	assert_c *next, *back;
	static assert_c *top, *bot;
	public:
	static BOOL desperate;
	assert_c(C char *f, int line, C char *funct="");
	~assert_c()	{top=top->back;top->next=top;dcheck(EXIT);}
	void mark(int line)	{linenum = line;dcheck(MARK);}
	static int trace();
	};
IMPORT assert_c assert_foo;


# endif
#endif

/*ident	"@(#)ctrans:incl-master/proto-headers/assert.h	1.6" */

/* This header file intentionally has no wrapper, since the user
*  may want to re-include it to turn off/on assertions for only
*  a portion of the source file.
*/

#ifndef __OSFCN_H
#include <osfcn.h>
#endif

#ifndef __LIBC_H
#include <libc.h>
#endif

#ifndef __IOSTREAM_H
#include <iostream.h>
#endif

#ifdef assert
#undef assert
#endif
#ifdef _assert
#undef _assert
#endif

#ifdef NDEBUG
#define assert(e) ((void)0)
# define ENTER_FCN(x)	/**/
# define MARK_LINE		/**/
#else
# define ENTER_FCN(x)	assert_c assert_foo(__FILE__, __LINE__, (x));
# define MARK_LINE		assert_foo.mark(__LINE__);
#if defined(__STDC__) && __STDC__
#define assert(EX) (void)((EX) || ((cerr << "Assertion failed: " # EX ", file " __FILE__  ", line " << __LINE__ << endl), assert_c::trace(), abort(), 0))
#else
#define assert(EX) (void)((EX) || ((cerr << "Assertion failed: EX, file " << __FILE__ << ", line " << __LINE__ << endl), assert_c::trace(), abort(), 0))
#endif
#endif

#define _assert(e) assert(e)
