|
|
1.1 root 1: /***********************************************************
2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
4:
5: All Rights Reserved
6:
7: Permission to use, copy, modify, and distribute this software and its
8: documentation for any purpose and without fee is hereby granted,
9: provided that the above copyright notice appear in all copies and that
10: both that copyright notice and this permission notice appear in
11: supporting documentation, and that the names of Digital or MIT not be
12: used in advertising or publicity pertaining to distribution of the
13: software without specific, written prior permission.
14:
15: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
16: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
17: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
18: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
20: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
21: SOFTWARE.
22:
23: ******************************************************************/
24: /* $Header: misc.h,v 1.43 87/09/11 07:49:51 toddb Exp $ */
25: #ifndef MISC_H
26: #define MISC_H 1
27: /*
28: * X internal definitions
29: *
30: */
31:
32:
33: extern unsigned long globalSerialNumber;
34:
35: #ifndef NULL
36: #define NULL 0
37: #endif
38:
39: #define MAXSCREENS 3
40: #define MAXCLIENTS 128
41: #define MAXFORMATS 8
42: #define MAXVISUALS_PER_SCREEN 50
43:
44: typedef unsigned char *pointer;
45: typedef int Bool;
46: typedef long PIXEL;
47: typedef int ATOM;
48:
49:
50: #ifndef TRUE
51: #define TRUE 1
52: #define FALSE 0
53: #endif
54: #include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */
55:
56: #define NullBox ((BoxPtr)0)
57: #define MILLI_PER_MIN (1000 * 60)
58: #define MILLI_PER_SECOND (1000)
59: #define DEFAULT_SCREEN_SAVER_TIME (10 * MILLI_PER_MIN);
60:
61: /* this next is used with None and ParentRelative to tell
62: PaintWin() what to use to paint the background. Also used
63: in the macro IS_VALID_PIXMAP */
64:
65: #define USE_BACKGROUND_PIXEL 3
66: #define USE_BORDER_PIXEL 3
67:
68:
69: /* byte swap a long literal */
70: #define lswapl(x) ((((x) & 0xff) << 24) |\
71: (((x) & 0xff00) << 8) |\
72: (((x) & 0xff000) >> 8) |\
73: (((x) >> 24) & 0xff))
74:
75: /* byte swap a short literal */
76: #define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
77:
78: #define min(a, b) (((a) < (b)) ? (a) : (b))
79: #define max(a, b) (((a) > (b)) ? (a) : (b))
80: #define abs(a) ((a) > 0 ? (a) : -(a))
81: #define fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */
82: #define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
83:
84: #define MAXSHORT 32767
85: #define MINSHORT -MAXSHORT
86:
87:
88: /* byte swap a long */
89: #define swapl(x, n) n = ((char *) (x))[0];\
90: ((char *) (x))[0] = ((char *) (x))[3];\
91: ((char *) (x))[3] = n;\
92: n = ((char *) (x))[1];\
93: ((char *) (x))[1] = ((char *) (x))[2];\
94: ((char *) (x))[2] = n;
95:
96: /* byte swap a short */
97: #define swaps(x, n) n = ((char *) (x))[0];\
98: ((char *) (x))[0] = ((char *) (x))[1];\
99: ((char *) (x))[1] = n
100:
101:
102:
103: typedef struct _DDXPoint *DDXPointPtr;
104: typedef struct _Box *BoxPtr;
105: typedef struct _Rectangle *RectanglePtr;
106:
107: #endif /* MISC_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.