Mercurial > hg > wm
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Meerwald-dir/wm.h Fri Dec 20 13:08:59 2024 +0100 @@ -0,0 +1,64 @@ +#ifndef WM_H +#define WM_H + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <getopt.h> +#include <math.h> +#include <float.h> +#include <fcntl.h> + +#if defined(MINGW) +#define M_PI 3.1415926536 +#define rint floor +#define MAXPATHLEN 255 +void bzero(char *b, size_t length); +#elif defined(LINUX) +#include <values.h> +#include <sys/param.h> +#include <unistd.h> +#include <time.h> +#else +#error plattform not supported +#endif + +/* + * This macro is used to ensure correct rounding of integer values. + */ +#define ROUND(a) (((a) < 0) ? (int) ((a) - 0.5) : (int) ((a) + 0.5)) + +/* + * Macros to converts number of bytes to number of bits and vice verse + */ +#define NBITSTOBYTES(N) ((N & 7) ? (N >> 3) + 1 : N >> 3) +#define NBYTESTOBITS(N) (N << 3) + +#define GRAYRANGE(P) ((P > 255) ? 255 : (P < 0) ? 0 : P) +#define PIXELRANGE(P) ((P > 255) ? 255 : (P < 0) ? 0 : P) + +#ifndef sqr +#define sqr(X) ((X) * (X)) +#endif + +#ifndef MAX +#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) +#endif + +#ifndef MIN +#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) +#endif + +#ifdef NEED_STRCASECMP +#define strcasecmp stricmp +#endif + +#ifndef SIGN +#define SIGN(X) (((X) > 0) ? ((X) == 0 ? 0 : 1) : -1) +#endif + +void wm_init(); +void wm_init1(); +void wm_init2(); + +#endif