annotate Meerwald/wm.h @ 15:ad1d224896c5

fix scanf() warning
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Mon, 30 Jun 2008 20:59:01 +0200
parents f83ef905a63d
children
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>
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 3
diff changeset
20 #include <unistd.h>
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 3
diff changeset
21 #include <time.h>
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
22 #else
3
acb6967ee76d update to 0.5
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
23 #error plattform not supported
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
24 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
25
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
26 /*
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
27 * This macro is used to ensure correct rounding of integer values.
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
28 */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
29 #define ROUND(a) (((a) < 0) ? (int) ((a) - 0.5) : (int) ((a) + 0.5))
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
30
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
31 /*
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
32 * Macros to converts number of bytes to number of bits and vice verse
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
33 */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
34 #define NBITSTOBYTES(N) ((N & 7) ? (N >> 3) + 1 : N >> 3)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
35 #define NBYTESTOBITS(N) (N << 3)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
36
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
37 #define GRAYRANGE(P) ((P > 255) ? 255 : (P < 0) ? 0 : P)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
38 #define PIXELRANGE(P) ((P > 255) ? 255 : (P < 0) ? 0 : P)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
39
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
40 #ifndef sqr
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
41 #define sqr(X) ((X) * (X))
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
42 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
43
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
44 #ifndef MAX
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
45 #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
46 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
47
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
48 #ifndef MIN
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
49 #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
50 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
51
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
52 #ifdef NEED_STRCASECMP
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
53 #define strcasecmp stricmp
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
54 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
55
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
56 #ifndef SIGN
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
57 #define SIGN(X) (((X) > 0) ? ((X) == 0 ? 0 : 1) : -1)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
58 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
59
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
60 void wm_init();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
61 void wm_init1();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
62 void wm_init2();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
63
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
64 #endif

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