]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/xpm/XpmI.h
2 * Copyright (C) 1989-95 GROUPE BULL
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
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.
26 /*****************************************************************************\
30 * Internal Include file *
32 * ** Everything defined here is subject to changes any time. ** *
34 * Developed by Arnaud Le Hors *
35 \*****************************************************************************/
38 * The code related to FOR_MSW has been added by
39 * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
55 * lets try to solve include files
60 /* stdio.h doesn't declare popen on a Sequent DYNIX OS */
65 #if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32) || defined(macintosh) || defined(__APPLE__)
73 #define rindex strrchr
76 #else /* defined(SYSV) || defined(SVR4) || defined(VMS) */
82 #if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32) || defined(macintosh) || defined(__APPLE__)
84 #define bcopy(source, dest, count) memcpy(dest, source, count)
87 #define bzero(b, len) memset(b, 0, len)
91 /* the following is defined in X11R6 but not in previous versions */
103 /* The following should help people wanting to use their own memory allocation
104 * functions. To avoid the overhead of a function call when the standard
105 * functions are used these are all macros, even the XpmFree function which
106 * needs to be a real function for the outside world though.
107 * So if change these be sure to change the XpmFree function in misc.c
110 #define XpmFree(ptr) free(ptr)
113 #define XpmMalloc(size) malloc((size))
114 #define XpmRealloc(ptr, size) realloc((ptr), (size))
115 #define XpmCalloc(nelem, elsize) calloc((nelem), (elsize))
117 /* checks for mallocs bigger than 64K */
118 #define XpmMalloc(size) boundCheckingMalloc((long)(size))/* in simx.[ch] */
119 #define XpmRealloc(ptr, size) boundCheckingRealloc((ptr),(long)(size))
120 #define XpmCalloc(nelem, elsize) \
121 boundCheckingCalloc((long)(nelem),(long) (elsize))
124 #define XPMMAXCMTLEN BUFSIZ
134 char Comment
[XPMMAXCMTLEN
];
135 char *Bcmt
, *Ecmt
, Bos
, Eos
;
136 int format
; /* 1 if XPM1, 0 otherwise */
153 char *type
; /* key word */
154 char *Bcmt
; /* string beginning comments */
155 char *Ecmt
; /* string ending comments */
156 char Bos
; /* character beginning strings */
157 char Eos
; /* character ending strings */
158 char *Strs
; /* strings separator */
159 char *Dec
; /* data declaration string */
160 char *Boa
; /* string beginning assignment */
161 char *Eoa
; /* string ending assignment */
164 extern xpmDataType xpmDataTypes
[];
167 * rgb values and ascii names (from rgb text file) rgb values,
168 * range of 0 -> 65535 color mnemonic of rgb value
175 /* Maximum number of rgb mnemonics allowed in rgb text file. */
176 #define MAX_RGBNAMES 1024
178 extern char *xpmColorKeys
[];
180 #define TRANSPARENT_COLOR "None" /* this must be a string! */
182 /* number of xpmColorKeys */
185 /* XPM internal routines */
187 FUNC(xpmParseData
, int, (xpmData
*data
, XpmImage
*image
, XpmInfo
*info
));
188 FUNC(xpmParseDataAndCreate
, int, (Display
*display
, xpmData
*data
,
189 XImage
**image_return
,
190 XImage
**shapeimage_return
,
191 XpmImage
*image
, XpmInfo
*info
,
192 XpmAttributes
*attributes
));
194 FUNC(xpmFreeColorTable
, void, (XpmColor
*colorTable
, int ncolors
));
196 FUNC(xpmInitAttributes
, void, (XpmAttributes
*attributes
));
198 FUNC(xpmInitXpmImage
, void, (XpmImage
*image
));
200 FUNC(xpmInitXpmInfo
, void, (XpmInfo
*info
));
202 FUNC(xpmSetInfoMask
, void, (XpmInfo
*info
, XpmAttributes
*attributes
));
203 FUNC(xpmSetInfo
, void, (XpmInfo
*info
, XpmAttributes
*attributes
));
204 FUNC(xpmSetAttributes
, void, (XpmAttributes
*attributes
, XpmImage
*image
,
207 /* structures and functions related to hastable code */
209 typedef struct _xpmHashAtom
{
218 xpmHashAtom
*atomTable
;
221 FUNC(xpmHashTableInit
, int, (xpmHashTable
*table
));
222 FUNC(xpmHashTableFree
, void, (xpmHashTable
*table
));
223 FUNC(xpmHashSlot
, xpmHashAtom
*, (xpmHashTable
*table
, char *s
));
224 FUNC(xpmHashIntern
, int, (xpmHashTable
*table
, char *tag
, void *data
));
226 #define HashAtomData(i) ((void *)i)
227 #define HashColorIndex(slot) ((unsigned int)((*slot)->data))
228 #define USE_HASHTABLE (cpp > 2 && ncolors > 4)
232 FUNC(xpmNextString
, int, (xpmData
*mdata
));
233 FUNC(xpmNextUI
, int, (xpmData
*mdata
, unsigned int *ui_return
));
234 FUNC(xpmGetString
, int, (xpmData
*mdata
, char **sptr
, unsigned int *l
));
236 #define xpmGetC(mdata) \
237 ((!mdata->type || mdata->type == XPMBUFFER) ? \
238 (*mdata->cptr++) : (getc(mdata->stream.file)))
240 FUNC(xpmNextWord
, unsigned int,
241 (xpmData
*mdata
, char *buf
, unsigned int buflen
));
242 FUNC(xpmGetCmt
, int, (xpmData
*mdata
, char **cmt
));
243 FUNC(xpmParseHeader
, int, (xpmData
*mdata
));
244 FUNC(xpmParseValues
, int, (xpmData
*data
, unsigned int *width
,
245 unsigned int *height
, unsigned int *ncolors
,
246 unsigned int *cpp
, unsigned int *x_hotspot
,
247 unsigned int *y_hotspot
, unsigned int *hotspot
,
248 unsigned int *extensions
));
250 FUNC(xpmParseColors
, int, (xpmData
*data
, unsigned int ncolors
,
251 unsigned int cpp
, XpmColor
**colorTablePtr
,
252 xpmHashTable
*hashtable
));
254 FUNC(xpmParseExtensions
, int, (xpmData
*data
, XpmExtension
**extensions
,
255 unsigned int *nextensions
));
259 FUNC(xpmReadRgbNames
, int, (char *rgb_fname
, xpmRgbName
*rgbn
));
260 FUNC(xpmGetRgbName
, char *, (xpmRgbName
*rgbn
, int rgbn_max
,
261 int red
, int green
, int blue
));
262 FUNC(xpmFreeRgbNames
, void, (xpmRgbName
*rgbn
, int rgbn_max
));
264 FUNC(xpmGetRGBfromName
,int, (char *name
, int *r
, int *g
, int *b
));
273 FUNC(xpmstrdup
, char *, (char *s1
));
276 #define xpmstrdup strdup
279 #ifdef NEED_STRCASECMP
280 FUNC(xpmstrcasecmp
, int, (char *s1
, char *s2
));
283 #define xpmstrcasecmp strcasecmp
286 FUNC(xpmatoui
, unsigned int,
287 (char *p
, unsigned int l
, unsigned int *ui_return
));