]>
Commit | Line | Data |
---|---|---|
0240e8b1 SC |
1 | /* |
2 | * Copyright (C) 1989-95 GROUPE BULL | |
3 | * | |
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
5 | * of this software and associated documentation files (the "Software"), to | |
6 | * deal in the Software without restriction, including without limitation the | |
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
8 | * sell copies of the Software, and to permit persons to whom the Software is | |
9 | * furnished to do so, subject to the following conditions: | |
10 | * | |
11 | * The above copyright notice and this permission notice shall be included in | |
12 | * all copies or substantial portions of the Software. | |
13 | * | |
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
17 | * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | |
18 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
19 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
20 | * | |
21 | * Except as contained in this notice, the name of GROUPE BULL shall not be | |
22 | * used in advertising or otherwise to promote the sale, use or other dealings | |
23 | * in this Software without prior written authorization from GROUPE BULL. | |
24 | */ | |
25 | ||
26 | /*****************************************************************************\ | |
27 | * simx.h: 0.1a * | |
28 | * * | |
29 | * This emulates some Xlib functionality for MSW. It's not a general solution, * | |
30 | * it is close related to XPM-lib. It is only intended to satisfy what is need * | |
31 | * there. Thus allowing to read XPM files under MS windows. * | |
32 | * * | |
33 | * Developed by HeDu 3/94 (hedu@cul-ipn.uni-kiel.de) * | |
34 | \*****************************************************************************/ | |
35 | ||
36 | ||
37 | #ifndef _SIMX_H | |
38 | #define _SIMX_H | |
39 | ||
40 | #if __STDC__ || defined(__cplusplus) || defined(c_plusplus) | |
41 | /* ANSI || C++ */ | |
42 | #define FUNC(f, t, p) extern t f p | |
43 | #define LFUNC(f, t, p) static t f p | |
44 | #else /* k&R */ | |
45 | #define FUNC(f, t, p) extern t f() | |
46 | #define LFUNC(f, t, p) static t f() | |
47 | #endif | |
48 | ||
49 | #ifdef FOR_MSW | |
50 | ||
51 | #include "windows.h" /* MS windows GDI types */ | |
52 | ||
53 | /* | |
54 | * minimal portability layer between ansi and KR C | |
55 | */ | |
56 | /* this comes from xpm.h, and is here again, to avoid complicated | |
57 | includes, since this is included from xpm.h */ | |
58 | /* these defines get undefed at the end of this file */ | |
59 | ||
60 | ||
61 | FUNC(boundCheckingMalloc, void *, (long s)); | |
62 | FUNC(boundCheckingCalloc, void *, (long num, long s)); | |
63 | FUNC(boundCheckingRealloc, void *, (void *p, long s)); | |
64 | ||
65 | /* define MSW types for X window types, | |
66 | I don't know much about MSW, but the following defines do the job */ | |
67 | ||
68 | typedef HDC Display; /* this should be similar */ | |
69 | typedef void *Screen; /* not used */ | |
70 | typedef void *Visual; /* not used yet, is for GRAY, COLOR, | |
71 | * MONO */ | |
72 | ||
73 | typedef void *Colormap; /* should be COLORPALETTE, not done | |
74 | * yet */ | |
75 | ||
76 | typedef COLORREF Pixel; | |
77 | ||
78 | #define PIXEL_ALREADY_TYPEDEFED /* to let xpm.h know about it */ | |
79 | ||
80 | typedef struct { | |
81 | Pixel pixel; | |
82 | BYTE red, green, blue; | |
83 | } XColor; | |
84 | ||
85 | typedef struct { | |
86 | HBITMAP bitmap; | |
87 | unsigned int width; | |
88 | unsigned int height; | |
89 | unsigned int depth; | |
90 | } XImage; | |
91 | ||
92 | #elif macintosh | |
2f1ae414 SC |
93 | #ifndef __MWERKS__ |
94 | #include <wx/wxprec.h> | |
95 | #endif | |
0240e8b1 SC |
96 | /* define Mac types for X window types */ |
97 | ||
98 | typedef GDevice* Display; /* this should be similar */ | |
99 | typedef void *Screen; /* not used */ | |
100 | typedef void *Visual; /* not used yet, is for GRAY, COLOR, | |
101 | * MONO */ | |
102 | ||
103 | typedef void *Colormap; /* should be COLORPALETTE, not done | |
104 | * yet */ | |
105 | ||
106 | typedef RGBColor Pixel; | |
107 | ||
108 | #define PIXEL_ALREADY_TYPEDEFED /* to let xpm.h know about it */ | |
109 | ||
110 | typedef struct { | |
111 | Pixel pixel; | |
112 | unsigned short red, green, blue; | |
113 | } XColor; | |
114 | ||
115 | typedef struct { | |
116 | GWorldPtr gworldptr ; | |
117 | unsigned int width; | |
118 | unsigned int height; | |
119 | unsigned int depth; | |
120 | } XImage; | |
121 | ||
122 | #endif | |
123 | ||
124 | #if defined(__cplusplus) || defined(c_plusplus) | |
125 | extern "C" { | |
126 | #endif | |
127 | /* some replacements for X... functions */ | |
128 | ||
129 | /* XDefaultXXX */ | |
130 | FUNC(XDefaultVisual, Visual *, (Display *display, Screen *screen)); | |
131 | FUNC(XDefaultScreen, Screen *, (Display *d)); | |
132 | FUNC(XDefaultColormap, Colormap *, (Display *display, Screen *screen)); | |
133 | FUNC(XDefaultDepth, int, (Display *d, Screen *s)); | |
134 | ||
135 | /* color related */ | |
136 | FUNC(XParseColor, int, (Display *, Colormap *, char *, XColor *)); | |
137 | FUNC(XAllocColor, int, (Display *, Colormap *, XColor *)); | |
138 | FUNC(XQueryColors, void, (Display *display, Colormap *colormap, | |
139 | XColor *xcolors, int ncolors)); | |
140 | FUNC(XFreeColors, int, (Display *d, Colormap cmap, | |
141 | unsigned long pixels[], | |
142 | int npixels, unsigned long planes)); | |
143 | /* XImage */ | |
144 | FUNC(XCreateImage, XImage *, (Display *, Visual *, int depth, int format, | |
145 | int x, int y, int width, int height, | |
146 | int pad, int foo)); | |
147 | ||
148 | /* free and destroy bitmap */ | |
149 | FUNC(XDestroyImage, void /* ? */ , (XImage *)); | |
150 | /* free only, bitmap remains */ | |
151 | FUNC(XImageFree, void, (XImage *)); | |
152 | #if defined(__cplusplus) || defined(c_plusplus) | |
153 | } /* end of extern "C" */ | |
154 | #endif /* cplusplus */ | |
155 | ||
156 | #define ZPixmap 1 /* not really used */ | |
157 | #define XYBitmap 1 /* not really used */ | |
158 | ||
159 | #ifndef True | |
160 | #define True 1 | |
161 | #define False 0 | |
162 | #endif | |
163 | #ifndef Bool | |
164 | #ifdef FOR_MSW | |
165 | typedef BOOL Bool; /* take MSW bool */ | |
166 | #elif macintosh | |
167 | typedef Boolean Bool; /* take MSW bool */ | |
168 | #endif | |
169 | #endif | |
170 | /* make these local here, simx.c gets the same from xpm.h */ | |
171 | #undef LFUNC | |
172 | #undef FUNC | |
173 | ||
174 | #endif /* _SIMX_H */ |