Mercurial > hg > wm
comparison Meerwald/wm.h @ 0:be303a3f5ea8
import
| author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
|---|---|
| date | Sun, 12 Aug 2007 13:14:34 +0200 |
| parents | |
| children | acb6967ee76d |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:be303a3f5ea8 |
|---|---|
| 1 #ifndef WM_H | |
| 2 #define WM_H | |
| 3 | |
| 4 #include <stdlib.h> | |
| 5 #include <stdio.h> | |
| 6 #include <string.h> | |
| 7 #include <getopt.h> | |
| 8 #include <math.h> | |
| 9 #include <float.h> | |
| 10 #include <fcntl.h> | |
| 11 | |
| 12 #if defined(MINGW) | |
| 13 #define M_PI 3.1415926536 | |
| 14 #define rint floor | |
| 15 #define MAXPATHLEN 255 | |
| 16 void bzero(char *b, size_t length); | |
| 17 #elif defined(LINUX) | |
| 18 #include <values.h> | |
| 19 #include <sys/param.h> | |
| 20 #else | |
| 21 #error platform not supported | |
| 22 #endif | |
| 23 | |
| 24 /* | |
| 25 * This macro is used to ensure correct rounding of integer values. | |
| 26 */ | |
| 27 #define ROUND(a) (((a) < 0) ? (int) ((a) - 0.5) : (int) ((a) + 0.5)) | |
| 28 | |
| 29 /* | |
| 30 * Macros to converts number of bytes to number of bits and vice verse | |
| 31 */ | |
| 32 #define NBITSTOBYTES(N) ((N & 7) ? (N >> 3) + 1 : N >> 3) | |
| 33 #define NBYTESTOBITS(N) (N << 3) | |
| 34 | |
| 35 #define GRAYRANGE(P) ((P > 255) ? 255 : (P < 0) ? 0 : P) | |
| 36 #define PIXELRANGE(P) ((P > 255) ? 255 : (P < 0) ? 0 : P) | |
| 37 | |
| 38 #ifndef sqr | |
| 39 #define sqr(X) ((X) * (X)) | |
| 40 #endif | |
| 41 | |
| 42 #ifndef MAX | |
| 43 #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) | |
| 44 #endif | |
| 45 | |
| 46 #ifndef MIN | |
| 47 #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) | |
| 48 #endif | |
| 49 | |
| 50 #ifdef NEED_STRCASECMP | |
| 51 #define strcasecmp stricmp | |
| 52 #endif | |
| 53 | |
| 54 #ifndef SIGN | |
| 55 #define SIGN(X) (((X) > 0) ? ((X) == 0 ? 0 : 1) : -1) | |
| 56 #endif | |
| 57 | |
| 58 void wm_init(); | |
| 59 void wm_init1(); | |
| 60 void wm_init2(); | |
| 61 | |
| 62 #endif |
