STANDARD.H 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. Copyright (C) 1994-1995 Apogee Software, Ltd.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. /**********************************************************************
  16. module: STANDARD.H
  17. author: James R. Dose
  18. date: May 25, 1994
  19. Header containing standard definitions.
  20. (c) Copyright 1994 James R. Dose. All Rights Reserved.
  21. **********************************************************************/
  22. #ifndef __STANDARD_H
  23. #define __STANDARD_H
  24. typedef int boolean;
  25. typedef int errorcode;
  26. #ifndef TRUE
  27. #define TRUE ( 1 == 1 )
  28. #define FALSE ( !TRUE )
  29. #endif
  30. enum STANDARD_ERRORS
  31. {
  32. Warning = -2,
  33. FatalError = -1,
  34. Success = 0
  35. };
  36. #define BITSET( data, bit ) \
  37. ( ( ( data ) & ( bit ) ) == ( bit ) )
  38. #define ARRAY_LENGTH( array ) \
  39. ( sizeof( array ) / sizeof( ( array )[ 0 ] ) )
  40. #define WITHIN_BOUNDS( array, index ) \
  41. ( ( 0 <= ( index ) ) && ( ( index ) < ARRAY_LENGTH( array ) ) )
  42. #define FOREVER for( ; ; )
  43. #ifdef NDEBUG
  44. #define DEBUGGING 0
  45. #else
  46. #define DEBUGGING 1
  47. #endif
  48. #define DEBUG_CODE \
  49. if ( DEBUGGING == 0 ) \
  50. { \
  51. } \
  52. else
  53. #endif