Mercurial > hg > wm
comparison Meerwald-dir/wm.h @ 24:9f20bce6184e v0.7
move directories, support netpbm 11
| author | Peter Meerwald-Stadler <pmeerw@pmeerw.net> |
|---|---|
| date | Fri, 20 Dec 2024 13:08:59 +0100 |
| parents | Meerwald/wm.h@f83ef905a63d |
| children |
comparison
equal
deleted
inserted
replaced
| 23:71dd4b96221b | 24:9f20bce6184e |
|---|---|
| 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 #include <unistd.h> | |
| 21 #include <time.h> | |
| 22 #else | |
| 23 #error plattform not supported | |
| 24 #endif | |
| 25 | |
| 26 /* | |
| 27 * This macro is used to ensure correct rounding of integer values. | |
| 28 */ | |
| 29 #define ROUND(a) (((a) < 0) ? (int) ((a) - 0.5) : (int) ((a) + 0.5)) | |
| 30 | |
| 31 /* | |
| 32 * Macros to converts number of bytes to number of bits and vice verse | |
| 33 */ | |
| 34 #define NBITSTOBYTES(N) ((N & 7) ? (N >> 3) + 1 : N >> 3) | |
| 35 #define NBYTESTOBITS(N) (N << 3) | |
| 36 | |
| 37 #define GRAYRANGE(P) ((P > 255) ? 255 : (P < 0) ? 0 : P) | |
| 38 #define PIXELRANGE(P) ((P > 255) ? 255 : (P < 0) ? 0 : P) | |
| 39 | |
| 40 #ifndef sqr | |
| 41 #define sqr(X) ((X) * (X)) | |
| 42 #endif | |
| 43 | |
| 44 #ifndef MAX | |
| 45 #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) | |
| 46 #endif | |
| 47 | |
| 48 #ifndef MIN | |
| 49 #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) | |
| 50 #endif | |
| 51 | |
| 52 #ifdef NEED_STRCASECMP | |
| 53 #define strcasecmp stricmp | |
| 54 #endif | |
| 55 | |
| 56 #ifndef SIGN | |
| 57 #define SIGN(X) (((X) > 0) ? ((X) == 0 ? 0 : 1) : -1) | |
| 58 #endif | |
| 59 | |
| 60 void wm_init(); | |
| 61 void wm_init1(); | |
| 62 void wm_init2(); | |
| 63 | |
| 64 #endif |
