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

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.