34 lines
602 B
C
34 lines
602 B
C
|
#ifndef BOOLE_H
|
||
|
#define BOOLE_H
|
||
|
|
||
|
/**
|
||
|
* \file boole.h
|
||
|
* \brief Simple boolean variables
|
||
|
* \author Thomas Stegemann
|
||
|
* \version $Id: boole.h,v 1.1 2007/01/02 21:30:40 rschaten Exp $
|
||
|
*
|
||
|
* License: See documentation.
|
||
|
*/
|
||
|
|
||
|
enum boolean_enum { False = 0, True = 1 };
|
||
|
|
||
|
typedef enum boolean_enum boolean;
|
||
|
|
||
|
static inline boolean boole(int test) {
|
||
|
if (test == 0) {
|
||
|
return False;
|
||
|
} else {
|
||
|
return True;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static inline const char *boolean_name(boolean value) {
|
||
|
if (value == False) {
|
||
|
return "false";
|
||
|
} else {
|
||
|
return "true";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif /* BOOLE_H */
|