home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume44 / toy_os / part02 / myenv.h < prev    next >
C/C++ Source or Header  |  1994-09-05  |  1KB  |  53 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. //************************************************************************
  3. //
  4. //            A standard environment
  5. //              I am accustomed to
  6.  
  7. //#pragma once
  8. #ifndef _myenv_h
  9.  
  10. #define _myenv_h
  11. #pragma interface
  12.  
  13.                 /* Strings of symbols            */
  14.                 /* They may be used as a delimiting lines*/
  15. extern const char _Minuses [];
  16. extern const char _Asteriscs [];
  17. extern const char _Equals [];
  18.  
  19.                 /* Print an error message at stderr and    */
  20.                 /* abort                */
  21. volatile void _error(
  22.     const char * message,        /* Message to be printed    */
  23.     ...                             /* Additional args to printf    */
  24.        );
  25.  
  26.                 /* Print a message at stderr         */
  27. void message(
  28.     const char * text,        /* Message to be printed    */
  29.     ...                             /* Additional args to printf    */
  30.        );
  31.  
  32.  
  33. //------------------------------------------------------------------------
  34. //            Verify the assertion
  35.  
  36. #if 0
  37.                       /* Print a message and abort*/
  38. extern volatile void _error( const char * message,... ); 
  39. #endif
  40.  
  41. #define assert(ex) \
  42.         (void)((ex) ? 1 : \
  43.               (_error("Failed assertion " #ex " at line %d of `%s'.\n", \
  44.                __LINE__, __FILE__), 0))
  45. #define assertval(ex) assert(ex)
  46.  
  47. #define assure(expr,message)                \
  48.     if    (expr) ;                \
  49.     else _error("%s\n at line %d of '%s'.",message,__LINE__, __FILE__);
  50.  
  51.  
  52. #endif
  53.