[cvs] bogofilter/src bftypes.h,NONE,1.1 system.h,1.25,1.26
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@pr...> - 2004-01-25 20:33:48
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11059 Modified Files: system.h Added Files: bftypes.h Log Message: Split system.h into bftypes.h and system.h --- NEW FILE: bftypes.h --- /* $Id: bftypes.h,v 1.1 2004/01/25 20:32:57 relson Exp $ */ /***************************************************************************** NAME: bftypes.h -- type definitions for bogofilter ******************************************************************************/ /* parts were taken from autoconf.info */ /* * this file shall define the bool and uint32_t types. * it shall include inttypes.h and stdbool.h if present */ #ifndef BFTYPES_H #define BFTYPES_H #include "config.h" #if HAVE_STDBOOL_H # include <stdbool.h> #else # if ! HAVE__BOOL # ifdef __cplusplus typedef bool _Bool; # else typedef unsigned char _Bool; # endif # endif # define bool _Bool # define false 0 # define true 1 # define __bool_true_false_are_defined 1 #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif /* obtain uint32_t */ #ifdef HAVE_INTTYPES_H #include <inttypes.h> #elif HAVE_STDINT_H #include <stdint.h> #endif #ifndef HAVE_UINT32_T #ifdef HAVE_U_INT32_T typedef u_int32_t uint32_t; #elif SIZEOF_LONG == 4 typedef unsigned long uint32_t; #elif SIZEOF_INT == 4 typedef unsigned int uint32_t; #elif SIZEOF_SHORT == 4 typedef unsigned short uint32_t; #else choke me because we do not know how to define uint32_t #endif #endif /* HAVE_UINT32_T */ #ifndef HAVE_U_INT32_T typedef uint32_t u_int32_t; #endif #ifndef HAVE_INT32_T #if SIZEOF_LONG == 4 typedef signed long int32_t; #elif SIZEOF_INT == 4 typedef signed int int32_t; #elif SIZEOF_SHORT == 4 typedef signed short int32_t; #else choke me because we do not know how to define int32_t #endif #endif /* HAVE_INT32_T */ #ifndef HAVE_UINT16_T #if SIZEOF_SHORT == 2 typedef unsigned short uint16_t; #else choke me because we do not know how to define uint16_t #endif #endif #ifndef HAVE_U_INT16_T typedef uint16_t u_int16_t; #endif #ifndef HAVE_INT16_T #if SIZEOF_SHORT == 2 typedef signed short int16_t; #else choke me because we do not know how to define int16_t #endif #endif #ifndef HAVE_U_INT8_T typedef unsigned char u_int8_t; #endif #ifndef HAVE_ULONG typedef unsigned long ulong; #endif #ifndef HAVE_UINT typedef unsigned int uint; #endif /* prevent db.h from redefining the types above */ #undef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ 1 /* splint crutch */ #ifdef __LCLINT__ typedef uint32_t u_int32_t; typedef uint16_t u_int16_t; typedef uint8_t u_int8_t; #define false 0 #define true 1 #endif typedef uint32_t YYYYMMDD; /* date as YYYYMMDD */ #if HAVE_SIZE_T #if SIZEOF_INT > SIZEOF_SIZE_T #error "int is wider than size_t. The current code is not designed to work on such systems and needs review." #endif #endif #endif /* BFTYPES_H */ Index: system.h =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/system.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- system.h 24 Jan 2004 18:12:55 -0000 1.25 +++ system.h 25 Jan 2004 20:32:56 -0000 1.26 @@ -9,35 +9,13 @@ /* parts were taken from autoconf.info */ -/* - * this file shall define the bool and uint32_t types. - * it shall include inttypes.h and stdbool.h if present - */ - #ifndef SYSTEM_H #define SYSTEM_H #include "config.h" -#if HAVE_STDBOOL_H -# include <stdbool.h> -#else -# if ! HAVE__BOOL -# ifdef __cplusplus -typedef bool _Bool; -# else -typedef unsigned char _Bool; -# endif -# endif -# define bool _Bool -# define false 0 -# define true 1 -# define __bool_true_false_are_defined 1 -#endif +#include "bftypes.h" -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif #if HAVE_SYS_STAT_H # include <sys/stat.h> #endif @@ -88,92 +66,6 @@ # endif #endif -/* obtain uint32_t */ -#ifdef HAVE_INTTYPES_H -#include <inttypes.h> -#elif HAVE_STDINT_H -#include <stdint.h> -#endif - -#ifndef HAVE_UINT32_T -#ifdef HAVE_U_INT32_T -typedef u_int32_t uint32_t; -#elif SIZEOF_LONG == 4 -typedef unsigned long uint32_t; -#elif SIZEOF_INT == 4 -typedef unsigned int uint32_t; -#elif SIZEOF_SHORT == 4 -typedef unsigned short uint32_t; -#else -choke me because we do not know how to define uint32_t -#endif -#endif /* HAVE_UINT32_T */ -#ifndef HAVE_U_INT32_T -typedef uint32_t u_int32_t; -#endif - -#ifndef HAVE_INT32_T -#if SIZEOF_LONG == 4 -typedef signed long int32_t; -#elif SIZEOF_INT == 4 -typedef signed int int32_t; -#elif SIZEOF_SHORT == 4 -typedef signed short int32_t; -#else -choke me because we do not know how to define int32_t -#endif -#endif /* HAVE_INT32_T */ - -#ifndef HAVE_UINT16_T -#if SIZEOF_SHORT == 2 -typedef unsigned short uint16_t; -#else -choke me because we do not know how to define uint16_t -#endif -#endif -#ifndef HAVE_U_INT16_T -typedef uint16_t u_int16_t; -#endif - -#ifndef HAVE_INT16_T -#if SIZEOF_SHORT == 2 -typedef signed short int16_t; -#else -choke me because we do not know how to define int16_t -#endif -#endif - -#ifndef HAVE_U_INT8_T -typedef unsigned char u_int8_t; -#endif - -#ifndef HAVE_ULONG -typedef unsigned long ulong; -#endif - -#ifndef HAVE_UINT -typedef unsigned int uint; -#endif - -/* prevent db.h from redefining the types above */ -#undef __BIT_TYPES_DEFINED__ -#define __BIT_TYPES_DEFINED__ 1 - -/* splint crutch */ -#ifdef __LCLINT__ -typedef uint32_t u_int32_t; -typedef uint16_t u_int16_t; -typedef uint8_t u_int8_t; -#define false 0 -#define true 1 -#endif - -#if HAVE_SIZE_T -#if SIZEOF_INT > SIZEOF_SIZE_T -#error "int is wider than size_t. The current code is not designed to work on such systems and needs review." -#endif -#endif - #if HAVE_FCNTL_H #include <fcntl.h> #endif |