source: branches/blt4/src/objects/RpInt.h @ 2060

Last change on this file since 2060 was 1270, checked in by dkearney, 15 years ago

rappture object updates, stuff i'm playing around with. the code is not functional but it compiles, and i dont want to loose this state as i continue to play. the configure scripts and makefiles should still be working properly.

File size: 6.7 KB
Line 
1
2/*
3 * bltInt.h --
4 *
5 * Copyright 1993-1998 Lucent Technologies, Inc.
6 *
7 * Permission to use, copy, modify, and distribute this software and
8 * its documentation for any purpose and without fee is hereby
9 * granted, provided that the above copyright notice appear in all
10 * copies and that both that the copyright notice and warranty
11 * disclaimer appear in supporting documentation, and that the names
12 * of Lucent Technologies any of their entities not be used in
13 * advertising or publicity pertaining to distribution of the software
14 * without specific, written prior permission.
15 *
16 * Lucent Technologies disclaims all warranties with regard to this
17 * software, including all implied warranties of merchantability and
18 * fitness.  In no event shall Lucent Technologies be liable for any
19 * special, indirect or consequential damages or any damages
20 * whatsoever resulting from loss of use, data or profits, whether in
21 * an action of contract, negligence or other tortuous action, arising
22 * out of or in connection with the use or performance of this
23 * software.
24 */
25
26#ifndef _RP_INT_H
27#define _RP_INT_H
28
29// #define USE_NON_CONST
30
31#include <stdio.h>
32#include <assert.h>
33
34#include <stdlib.h>
35#include <string.h>
36#include <errno.h>
37#include <ctype.h>
38#include <memory.h>
39#include <unistd.h>
40#include <limits.h>
41
42// keep this commented until i fix the autoheader setup to
43// automatically #define these
44//
45// #include "bltConfig.h"
46//#ifdef HAVE_STDLIB_H
47//#include <stdlib.h>
48//#endif /* HAVE_STDLIB_H */
49//
50//#ifdef HAVE_STRING_H
51//#include <string.h>
52//#endif /* HAVE_STRING_H */
53//
54//#ifdef HAVE_ERRNO_H
55//#include <errno.h>
56//#endif /* HAVE_ERRNO_H */
57//
58//#ifdef HAVE_CTYPE_H
59//#include <ctype.h>
60//#endif /* HAVE_CTYPE_H */
61//
62//#ifdef HAVE_MEMORY_H
63//#include <memory.h>
64//#endif /* HAVE_MEMORY_H */
65//
66//#ifdef HAVE_UNISTD_H
67//#include <unistd.h>
68//#endif /* HAVE_UNISTD_H */
69//
70//#ifdef HAVE_LIMITS_H
71//#include <limits.h>
72//#endif
73
74#define RP_OK       0
75#define RP_ERROR    1
76#define RP_RETURN   2
77#define RP_BREAK    3
78#define RP_CONTINUE 4
79
80#ifndef _CLIENTDATA
81#   ifndef NO_VOID
82    typedef void *ClientData;
83#   else
84    typedef int *ClientData;
85#   endif
86#   define _CLIENTDATA
87
88#ifndef NO_CONST
89#   define CONST const
90#else
91#   define CONST
92#endif
93
94/*
95#ifndef _ANSI_ARGS_
96#   define _ANSI_ARGS_(x)       ()
97#endif
98*/
99
100#ifndef _ANSI_ARGS_
101#if defined(__STDC__) || defined(__cplusplus)
102#   define _ANSI_ARGS_(x)       x
103#else
104#   define _ANSI_ARGS_(x)       ()
105#endif
106#endif
107
108
109#endif
110#undef INLINE
111#ifdef __GNUC__
112#define INLINE inline
113#else
114#define INLINE
115#endif
116// #undef EXPORT
117// #define EXPORT
118
119#ifndef EXPORT
120#define EXPORT
121#endif
122
123#undef EXTERN
124
125#ifdef __cplusplus
126#   define EXTERN extern "C" EXPORT
127#else
128#   define EXTERN extern EXPORT
129#endif
130
131
132#undef VARARGS
133#ifdef __cplusplus
134#define ANYARGS (...)
135#define VARARGS(first)  (first, ...)
136#define VARARGS2(first, second)  (first, second, ...)
137#else
138#define ANYARGS ()
139#define VARARGS(first) ()
140#define VARARGS2(first, second) ()
141#endif /* __cplusplus */
142
143#undef MIN
144#define MIN(a,b)    (((a)<(b))?(a):(b))
145
146#undef MAX
147#define MAX(a,b)    (((a)>(b))?(a):(b))
148
149#undef MIN3
150#define MIN3(a,b,c) (((a)<(b))?(((a)<(c))?(a):(c)):(((b)<(c))?(b):(c)))
151
152#undef MAX3
153#define MAX3(a,b,c) (((a)>(b))?(((a)>(c))?(a):(c)):(((b)>(c))?(b):(c)))
154
155#define TRUE    1
156#define FALSE   0
157
158/*
159 * The macro below is used to modify a "char" value (e.g. by casting
160 * it to an unsigned character) so that it can be used safely with
161 * macros such as isspace.
162 */
163#define UCHAR(c) ((unsigned char) (c))
164
165#undef panic
166#define panic(mesg) Rp_Panic("%s:%d %s", __FILE__, __LINE__, (mesg))
167
168/*
169 * Since the Tcl/Tk distribution doesn't perform any asserts, dynamic
170 * loading can fail to find the __assert function.  As a workaround,
171 * we'll include our own.
172 */
173#undef  assert
174#ifdef  NDEBUG
175    #define assert(EX) ((void)0)
176#else
177    extern void Rp_Assert _ANSI_ARGS_((char *expr, char *file, int line));
178    #ifdef __STDC__
179        #define assert(EX) (void)((EX) || (Rp_Assert(#EX, __FILE__, __LINE__), 0))
180    #else
181        #define assert(EX) (void)((EX) || (Rp_Assert("EX", __FILE__, __LINE__), 0))
182    #endif /* __STDC__ */
183
184#endif /* NDEBUG */
185
186/*
187 * ----------------------------------------------------------------------
188 *
189 *  Assume we need to declare free if there's no stdlib.h or malloc.h
190 *
191 * ----------------------------------------------------------------------
192 */
193#if !defined(HAVE_STDLIB_H) && !defined(HAVE_MALLOC_H)
194extern void free _ANSI_ARGS_((void *));
195#endif
196
197extern int Rp_DictionaryCompare _ANSI_ARGS_((char *s1, char *s2));
198
199extern void Rp_Panic _ANSI_ARGS_((const char *format, ...));
200
201
202/* ---------------------------------------------------------------- */
203
204typedef int (QSortCompareProc) _ANSI_ARGS_((const void *, const void *));
205
206/*
207 * -------------------------------------------------------------------
208 *
209 * Point2D --
210 *
211 *      2-D coordinate.
212 *
213 * -------------------------------------------------------------------
214 */
215typedef struct {
216    double x, y;
217} Point2D;
218
219/*
220 * -------------------------------------------------------------------
221 *
222 * Point3D --
223 *
224 *      3-D coordinate.
225 *
226 * -------------------------------------------------------------------
227 */
228typedef struct {
229    double x, y, z;
230} Point3D;
231
232/*
233 * -------------------------------------------------------------------
234 *
235 * Segment2D --
236 *
237 *      2-D line segment.
238 *
239 * -------------------------------------------------------------------
240 */
241typedef struct {
242    Point2D p, q;               /* The two end points of the segment. */
243} Segment2D;
244
245/*
246 * -------------------------------------------------------------------
247 *
248 * Dim2D --
249 *
250 *      2-D dimension.
251 *
252 * -------------------------------------------------------------------
253 */
254typedef struct {
255    short int width, height;
256} Dim2D;
257
258/*
259 *----------------------------------------------------------------------
260 *
261 * Region2D --
262 *
263 *      2-D region.  Used to copy parts of images.
264 *
265 *----------------------------------------------------------------------
266 */
267typedef struct {
268    int left, right, top, bottom;
269} Region2D;
270
271#define RegionWidth(r)      ((r)->right - (r)->left + 1)
272#define RegionHeight(r)     ((r)->bottom - (r)->top + 1)
273
274typedef struct {
275    double left, right, top, bottom;
276} Extents2D;
277
278typedef struct {
279    double left, right, top, bottom, front, back;
280} Extents3D;
281
282#define PointInRegion(e,x,y) \
283    (((x) <= (e)->right) && ((x) >= (e)->left) && \
284     ((y) <= (e)->bottom) && ((y) >= (e)->top))
285
286#define PointInRectangle(r,x0,y0) \
287    (((x0) <= (int)((r)->x + (r)->width - 1)) && ((x0) >= (int)(r)->x) && \
288     ((y0) <= (int)((r)->y + (r)->height - 1)) && ((y0) >= (int)(r)->y))
289
290
291#define Rp_Malloc malloc
292#define Rp_Calloc calloc
293#define Rp_Realloc realloc
294#define Rp_Free free
295#define Rp_Strdup strdup
296
297#endif /*_RP_INT_H*/
Note: See TracBrowser for help on using the repository browser.