diff options
author | Franklin Wei <git@fwei.tk> | 2017-01-21 15:18:31 -0500 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-12-23 21:01:26 -0500 |
commit | a855d6202536ff28e5aae4f22a0f31d8f5b325d0 (patch) | |
tree | 8c75f224dd64ed360505afa8843d016b0d75000b /apps/plugins/sdl/src/video/Xext/extensions/extutil.h | |
parent | 01c6dcf6c7b9bb1ad2fa0450f99bacc5f3d3e04b (diff) | |
download | rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.tar.gz rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.zip |
Port of Duke Nukem 3D
This ports Fabien Sanglard's Chocolate Duke to run on a version of SDL
for Rockbox.
Change-Id: I8f2c4c78af19de10c1633ed7bb7a997b43256dd9
Diffstat (limited to 'apps/plugins/sdl/src/video/Xext/extensions/extutil.h')
-rw-r--r-- | apps/plugins/sdl/src/video/Xext/extensions/extutil.h | 226 |
1 files changed, 226 insertions, 0 deletions
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/extutil.h b/apps/plugins/sdl/src/video/Xext/extensions/extutil.h new file mode 100644 index 0000000000..f3a741ea22 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/extutil.h | |||
@@ -0,0 +1,226 @@ | |||
1 | /* | ||
2 | * $Xorg: extutil.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ | ||
3 | * | ||
4 | Copyright 1989, 1998 The Open Group | ||
5 | |||
6 | Permission to use, copy, modify, distribute, and sell this software and its | ||
7 | documentation for any purpose is hereby granted without fee, provided that | ||
8 | the above copyright notice appear in all copies and that both that | ||
9 | copyright notice and this permission notice appear in supporting | ||
10 | documentation. | ||
11 | |||
12 | The above copyright notice and this permission notice shall be included in | ||
13 | all copies or substantial portions of the Software. | ||
14 | |||
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||
19 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | Except as contained in this notice, the name of The Open Group shall not be | ||
23 | used in advertising or otherwise to promote the sale, use or other dealings | ||
24 | in this Software without prior written authorization from The Open Group. | ||
25 | * | ||
26 | * Author: Jim Fulton, MIT The Open Group | ||
27 | * | ||
28 | * Xlib Extension-Writing Utilities | ||
29 | * | ||
30 | * This package contains utilities for writing the client API for various | ||
31 | * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND | ||
32 | * ARE SUBJECT TO CHANGE! | ||
33 | */ | ||
34 | /* $XFree86: xc/include/extensions/extutil.h,v 1.9 2001/12/14 19:53:28 dawes Exp $ */ | ||
35 | |||
36 | #ifndef _EXTUTIL_H_ | ||
37 | #define _EXTUTIL_H_ | ||
38 | |||
39 | #include "SDL_stdinc.h" /* For portable string functions */ | ||
40 | |||
41 | #include "./Xext.h" | ||
42 | |||
43 | /* | ||
44 | * We need to keep a list of open displays since the Xlib display list isn't | ||
45 | * public. We also have to per-display info in a separate block since it isn't | ||
46 | * stored directly in the Display structure. | ||
47 | */ | ||
48 | typedef struct _XExtDisplayInfo { | ||
49 | struct _XExtDisplayInfo *next; /* keep a linked list */ | ||
50 | Display *display; /* which display this is */ | ||
51 | XExtCodes *codes; /* the extension protocol codes */ | ||
52 | XPointer data; /* extra data for extension to use */ | ||
53 | } XExtDisplayInfo; | ||
54 | |||
55 | typedef struct _XExtensionInfo { | ||
56 | XExtDisplayInfo *head; /* start of list */ | ||
57 | XExtDisplayInfo *cur; /* most recently used */ | ||
58 | int ndisplays; /* number of displays */ | ||
59 | } XExtensionInfo; | ||
60 | |||
61 | typedef struct _XExtensionHooks { | ||
62 | int (*create_gc)( | ||
63 | #if NeedNestedPrototypes | ||
64 | Display* /* display */, | ||
65 | GC /* gc */, | ||
66 | XExtCodes* /* codes */ | ||
67 | #endif | ||
68 | ); | ||
69 | int (*copy_gc)( | ||
70 | #if NeedNestedPrototypes | ||
71 | Display* /* display */, | ||
72 | GC /* gc */, | ||
73 | XExtCodes* /* codes */ | ||
74 | #endif | ||
75 | ); | ||
76 | int (*flush_gc)( | ||
77 | #if NeedNestedPrototypes | ||
78 | Display* /* display */, | ||
79 | GC /* gc */, | ||
80 | XExtCodes* /* codes */ | ||
81 | #endif | ||
82 | ); | ||
83 | int (*free_gc)( | ||
84 | #if NeedNestedPrototypes | ||
85 | Display* /* display */, | ||
86 | GC /* gc */, | ||
87 | XExtCodes* /* codes */ | ||
88 | #endif | ||
89 | ); | ||
90 | int (*create_font)( | ||
91 | #if NeedNestedPrototypes | ||
92 | Display* /* display */, | ||
93 | XFontStruct* /* fs */, | ||
94 | XExtCodes* /* codes */ | ||
95 | #endif | ||
96 | ); | ||
97 | int (*free_font)( | ||
98 | #if NeedNestedPrototypes | ||
99 | Display* /* display */, | ||
100 | XFontStruct* /* fs */, | ||
101 | XExtCodes* /* codes */ | ||
102 | #endif | ||
103 | ); | ||
104 | int (*close_display)( | ||
105 | #if NeedNestedPrototypes | ||
106 | Display* /* display */, | ||
107 | XExtCodes* /* codes */ | ||
108 | #endif | ||
109 | ); | ||
110 | Bool (*wire_to_event)( | ||
111 | #if NeedNestedPrototypes | ||
112 | Display* /* display */, | ||
113 | XEvent* /* re */, | ||
114 | xEvent* /* event */ | ||
115 | #endif | ||
116 | ); | ||
117 | Status (*event_to_wire)( | ||
118 | #if NeedNestedPrototypes | ||
119 | Display* /* display */, | ||
120 | XEvent* /* re */, | ||
121 | xEvent* /* event */ | ||
122 | #endif | ||
123 | ); | ||
124 | int (*error)( | ||
125 | #if NeedNestedPrototypes | ||
126 | Display* /* display */, | ||
127 | xError* /* err */, | ||
128 | XExtCodes* /* codes */, | ||
129 | int* /* ret_code */ | ||
130 | #endif | ||
131 | ); | ||
132 | char *(*error_string)( | ||
133 | #if NeedNestedPrototypes | ||
134 | Display* /* display */, | ||
135 | int /* code */, | ||
136 | XExtCodes* /* codes */, | ||
137 | char* /* buffer */, | ||
138 | int /* nbytes */ | ||
139 | #endif | ||
140 | ); | ||
141 | } XExtensionHooks; | ||
142 | |||
143 | extern XExtensionInfo *XextCreateExtension( | ||
144 | #if NeedFunctionPrototypes | ||
145 | void | ||
146 | #endif | ||
147 | ); | ||
148 | extern void XextDestroyExtension( | ||
149 | #if NeedFunctionPrototypes | ||
150 | XExtensionInfo* /* info */ | ||
151 | #endif | ||
152 | ); | ||
153 | extern XExtDisplayInfo *XextAddDisplay( | ||
154 | #if NeedFunctionPrototypes | ||
155 | XExtensionInfo* /* extinfo */, | ||
156 | Display* /* dpy */, | ||
157 | char* /* ext_name */, | ||
158 | XExtensionHooks* /* hooks */, | ||
159 | int /* nevents */, | ||
160 | XPointer /* data */ | ||
161 | #endif | ||
162 | ); | ||
163 | extern int XextRemoveDisplay( | ||
164 | #if NeedFunctionPrototypes | ||
165 | XExtensionInfo* /* extinfo */, | ||
166 | Display* /* dpy */ | ||
167 | #endif | ||
168 | ); | ||
169 | extern XExtDisplayInfo *XextFindDisplay( | ||
170 | #if NeedFunctionPrototypes | ||
171 | XExtensionInfo* /* extinfo */, | ||
172 | Display* /* dpy */ | ||
173 | #endif | ||
174 | ); | ||
175 | |||
176 | #define XextHasExtension(i) ((i) && ((i)->codes)) | ||
177 | #define XextCheckExtension(dpy,i,name,val) \ | ||
178 | if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } | ||
179 | #define XextSimpleCheckExtension(dpy,i,name) \ | ||
180 | if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } | ||
181 | |||
182 | |||
183 | /* | ||
184 | * helper macros to generate code that is common to all extensions; caller | ||
185 | * should prefix it with static if extension source is in one file; this | ||
186 | * could be a utility function, but have to stack 6 unused arguments for | ||
187 | * something that is called many, many times would be bad. | ||
188 | */ | ||
189 | #define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ | ||
190 | XExtDisplayInfo *proc (Display *dpy) \ | ||
191 | { \ | ||
192 | XExtDisplayInfo *dpyinfo; \ | ||
193 | if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ | ||
194 | if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ | ||
195 | dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ | ||
196 | return dpyinfo; \ | ||
197 | } | ||
198 | |||
199 | #define XEXT_FIND_DISPLAY_PROTO(proc) \ | ||
200 | XExtDisplayInfo *proc(Display *dpy) | ||
201 | |||
202 | #define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ | ||
203 | int proc (Display *dpy, XExtCodes *codes) \ | ||
204 | { \ | ||
205 | return XextRemoveDisplay (extinfo, dpy); \ | ||
206 | } | ||
207 | |||
208 | #define XEXT_CLOSE_DISPLAY_PROTO(proc) \ | ||
209 | int proc(Display *dpy, XExtCodes *codes) | ||
210 | |||
211 | #define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ | ||
212 | char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ | ||
213 | { \ | ||
214 | code -= codes->first_error; \ | ||
215 | if (code >= 0 && code < nerr) { \ | ||
216 | char tmp[256]; \ | ||
217 | SDL_snprintf (tmp, SDL_arraysize(tmp), "%s.%d", extname, code); \ | ||
218 | XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ | ||
219 | return buf; \ | ||
220 | } \ | ||
221 | return (char *)0; \ | ||
222 | } | ||
223 | |||
224 | #define XEXT_ERROR_STRING_PROTO(proc) \ | ||
225 | char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) | ||
226 | #endif | ||