138451Smsmith/*
238451Smsmith	Copyright 1999, Be Incorporated.   All Rights Reserved.
338451Smsmith	This file may be used under the terms of the Be Sample Code License.
438451Smsmith*/
538451Smsmith
638451Smsmith#ifndef ERROR_H
738451Smsmith#define ERROR_H
838451Smsmith
938451Smsmith#include <stdio.h>
1038451Smsmith
1138451Smsmithextern void fatalerror(const char *);
1238451Smsmith
1338451Smsmith#define DEBUGGING 1
1438451Smsmith
1538451Smsmith#ifdef DEBUGGING
1638451Smsmith
1738451Smsmith#define assert(a) if (!(a)) { \
1838451Smsmith  printf("%s:%d: Failed assertion `"#a"'\n",__FILE__,__LINE__); \
1938451Smsmith  fatalerror("Failed assertion!"); };
2038451Smsmith
2138451Smsmith#define checkpoint printf("%s:%d: Checkpoint...\n",__FILE__,__LINE__);\
2238451Smsmith                   fflush(stdout);
2338451Smsmith
2438451Smsmith#else //DEBUGGING
2538451Smsmith
2640520Sdfr#define assert(a)
2738451Smsmith#define checkpoint
2838451Smsmith
2938451Smsmith#endif //DEBUGGING
3038451Smsmith
3138451Smsmith#endif // ERROR_H
3238451Smsmith