Back to index

im-sdk  12.3.91
syscfg.h
Go to the documentation of this file.
00001 #ifndef IM_SDK_SYSCFG_H_
00002 #define IM_SDK_SYSCFG_H_
00003 
00004 /***************************************
00005                  alloca
00006  ***************************************/
00007 
00008 /* system dependent alloca definitions */
00009 #ifdef HAVE_ALLOCA_H
00010 #include <alloca.h>
00011 #elif defined(__GNUC__)
00012 #define alloca __builtin_alloca
00013 #elif defined __DECC
00014 #include <alloca.h>
00015 #pragma intrinsic(alloca)
00016 #elif defined(_AIX)
00017 #pragma alloca
00018 #elif ! defined (alloca)
00019 void *alloca ();
00020 #endif
00021 
00022 /***************************************
00023              non-ANSI functions.
00024  ***************************************/
00025 
00026 /* check functions. */
00027 
00028 #ifndef HAVE_BCOPY
00029 #define bcopy(src, dest, size) memcpy((dest), (src), (size))
00030 #endif
00031 
00032 #ifndef HAVE_BZERO
00033 #define bzero(p, size) memset((p), 0, (size))
00034 #endif
00035 
00036 #ifndef HAVE_BCMP
00037 #define bcmp(p1, p2, size) memcmp((p1), (p2), (size))
00038 #endif
00039 
00040 #ifndef HAVE_INDEX
00041 #define index(s, c) strchr((s), (c))
00042 #endif
00043 
00044 #ifndef HAVE_RINDEX
00045 #define rindex(s, c) strrchr((s), (c))
00046 #endif
00047 
00048 /***************************************
00049                ASSERTION
00050  ***************************************/
00051 
00052 #ifndef ASSERT
00053 #ifdef DEBUG
00054 #define ASSERT(X)                         \
00055 do {                                      \
00056     if (!(X)) {                                  \
00057        fprintf(stderr, "ASSERT %s: %s (%d)\n",   \
00058               #X, __FILE__, __LINE__);    \
00059               abort();                    \
00060     }                                     \
00061 } while(0)
00062 #else
00063 #define ASSERT(X) ((void) 0)
00064 #endif
00065 #endif
00066 
00067 #define ERROR_INTERNAL(X)                        \
00068 do {                                             \
00069     fprintf(stderr, "Internal error %s: %s (%d)\n",     \
00070            #X, __FILE__, __LINE__);                     \
00071            abort();                              \
00072 } while(0)
00073 
00074 /***************************************
00075             INTEGER TYPES
00076  ***************************************/
00077 
00078 #define DEFINED_INTEGER_TYPES
00079 
00080 #if SIZEOF_UNSIGNED_INT == 1
00081 typedef unsigned int CARD8BIT;
00082 #elif SIZEOF_UNSIGNED_LONG == 1
00083 typedef unsigned long CARD8BIT;
00084 #elif SIZEOF_UNSIGNED_SHORT == 1
00085 typedef unsigned short CARD8BIT;
00086 #elif SIZEOF_UNSIGNED_CHAR == 1
00087 typedef unsigned char CARD8BIT;
00088 #else
00089 #error "Fail to find a 8-bit sized integer type."
00090 #endif
00091 
00092 #if SIZEOF_UNSIGNED_INT == 2
00093 typedef unsigned int CARD16BIT;
00094 #elif SIZEOF_UNSIGNED_LONG == 2
00095 typedef unsigned long CARD16BIT;
00096 #elif SIZEOF_UNSIGNED_SHORT == 2
00097 typedef unsigned short CARD16BIT;
00098 #elif SIZEOF_UNSIGNED_CHAR == 2
00099 typedef unsigned char CARD16BIT;
00100 #else
00101 #error "Fail to find a 16-bit sized integer type."
00102 #endif
00103 
00104 #if SIZEOF_UNSIGNED_INT == 4
00105 typedef unsigned int CARD32BIT;
00106 #elif SIZEOF_UNSIGNED_LONG == 4
00107 typedef unsigned long CARD32BIT;
00108 #elif SIZEOF_UNSIGNED_SHORT == 4
00109 typedef unsigned short CARD32BIT;
00110 #elif SIZEOF_UNSIGNED_CHAR == 4
00111 typedef unsigned char CARD32BIT;
00112 #else
00113 #error "Fail to find a 32-bit sized integer type."
00114 #endif
00115 
00116 /***************************************
00117             ENDS HERE
00118  ***************************************/
00119 
00120 #endif /* IM_SDK_SYSCFG_H_ */