Debian Codegraph @

generic/bltInt.h

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
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 _BLT_INT_H
27 #define _BLT_INT_H
28
29 #ifdef WIN32
30 #define STRICT
31 #define WIN32_LEAN_AND_MEAN
32 #include <windows.h>
33 #undef STRICT
34 #undef WIN32_LEAN_AND_MEAN
35 #include <windowsx.h>
36 #endif /* WIN32 */
37
38 #define USE_NON_CONST
39 #include <tcl.h>
40 #define USE_COMPOSITELESS_PHOTO_PUT_BLOCK
41 #include <tk.h>
42
43 #define _VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
44 #define TCL_VERSION_NUMBER _VERSION(TCL_MAJOR_VERSION, TCL_MINOR_VERSION, TCL_RELEASE_SERIAL)
45 #define TK_VERSION_NUMBER _VERSION(TK_MAJOR_VERSION, TK_MINOR_VERSION, TK_RELEASE_SERIAL)
46
47 #include "bltTkInt.h"
48
49 #include <stdio.h>
50 #include <assert.h>
51
52 #if defined(WIN32) && defined(__MINGW32__)
53 #include "bltWinConfig.h"
54 #elif defined(WIN32) && !defined(__GNUC__)
55 #include "bltWinConfig.h"
56 #else
57 #include "bltConfig.h"
58 #endif
59
60 #ifdef WIN32
61 #ifndef EXPORT
62 #if defined(_MSC_VER) || defined(__BORLANDC__)
63 #define EXPORT __declspec(dllexport)
64 #else
65 #define EXPORT
66 #endif /* _MSC_VER || __BORLANDC__ */
67 #endif /* EXPORT */
68
69 /* Misc. definitions */
70 #define NO_CUTBUFFER 1
71 /* #define NO_TILESCROLLBAR 1 */
72 #define NO_DND 1
73
74 #ifndef __GNUC__
75 #ifdef O_NONBLOCK
76 #define O_NONBLOCK 1
77 #endif
78 #endif /* __GNUC__ */
79 #endif /* WIN32 */
80
81 #include "blt.h"
82 #include "bltNsUtil.h"
83
84 #ifdef HAVE_STDLIB_H
85 #include <stdlib.h>
86 #endif /* HAVE_STDLIB_H */
87
88 #ifdef HAVE_STRING_H
89 #include <string.h>
90 #endif /* HAVE_STRING_H */
91
92 #ifdef HAVE_ERRNO_H
93 #include <errno.h>
94 #endif /* HAVE_ERRNO_H */
95
96 #ifdef HAVE_CTYPE_H
97 #include <ctype.h>
98 #endif /* HAVE_CTYPE_H */
99
100 #ifdef HAVE_MEMORY_H
101 #include <memory.h>
102 #endif /* HAVE_MEMORY_H */
103
104 #ifdef HAVE_UNISTD_H
105 #include <unistd.h>
106 #endif /* HAVE_UNISTD_H */
107
108 #ifdef HAVE_LIMITS_H
109 #include <limits.h>
110 #endif
111
112 #include "bltMath.h"
113
114 #undef INLINE
115 #ifdef __GNUC__
116 #define INLINE inline
117 #else
118 #define INLINE
119 #endif
120 #undef EXPORT
121 #define EXPORT
122
123 #undef VARARGS
•124 #if 1
125 #define ANYARGS (...)
126 #define VARARGS(first) (first, ...)
127 #define VARARGS2(first, second) (first, second, ...)
128 #else
129 #define ANYARGS ()
130 #define VARARGS(first) ()
131 #define VARARGS2(first, second) ()
132 #endif /* __cplusplus */
133
•134 /* Sometimes BLT uses variable named bool which fails with GCC 15 */
135 #define bool boolv
136
137 #undef MIN
138 #define MIN(a,b) (((a)<(b))?(a):(b))
139
140 #undef MAX
141 #define MAX(a,b) (((a)>(b))?(a):(b))
142
143 #undef MIN3
144 #define MIN3(a,b,c) (((a)<(b))?(((a)<(c))?(a):(c)):(((b)<(c))?(b):(c)))
145
146 #undef MAX3
147 #define MAX3(a,b,c) (((a)>(b))?(((a)>(c))?(a):(c)):(((b)>(c))?(b):(c)))
148
149 #define TRUE 1
150 #define FALSE 0
151
152 /*
153 * The macro below is used to modify a "char" value (e.g. by casting
154 * it to an unsigned character) so that it can be used safely with
155 * macros such as isspace.
156 */
157 #define UCHAR(c) ((unsigned char) (c))
158
159 #undef panic
160 #define panic(mesg) Blt_Panic("%s:%d %s", __FILE__, __LINE__, (mesg))
161
162 /*
163 * Since the Tcl/Tk distribution doesn't perform any asserts, dynamic
164 * loading can fail to find the __assert function. As a workaround,
165 * we'll include our own.
166 */
167 #undef assert
168 #ifdef NDEBUG
169 #define assert(EX) ((void)0)
170 #else
171 extern void Blt_Assert _ANSI_ARGS_((char *expr, char *file, int line));
172 #ifdef __STDC__
173 #define assert(EX) (void)((EX) || (Blt_Assert(#EX, __FILE__, __LINE__), 0))
174 #else
175 #define assert(EX) (void)((EX) || (Blt_Assert("EX", __FILE__, __LINE__), 0))
176 #endif /* __STDC__ */
177
178 #endif /* NDEBUG */
179
180 #if (TCL_MAJOR_VERSION >= 8)
181 extern Tcl_Obj *bltEmptyStringObjPtr;
182 #endif /* TCL_MAJOR_VERSION >= 8 */
183
184 /*
185 * ----------------------------------------------------------------------
186 *
187 * Blt_CmdSpec --
188 *
189 * ----------------------------------------------------------------------
190 */
191 typedef struct {
192 char *name; /* Name of command */
193 Tcl_CmdProc *cmdProc;
194 Tcl_CmdDeleteProc *cmdDeleteProc;
195 ClientData clientData;
196 } Blt_CmdSpec;
197
198 #if (TCL_MAJOR_VERSION >= 8)
199 /*
200 * ----------------------------------------------------------------------
201 *
202 * Blt_CmdSpec --
203 *
204 * ----------------------------------------------------------------------
205 */
206 typedef struct {
207 char *name; /* Name of command */
208 Tcl_ObjCmdProc *cmdProc;
209 Tcl_CmdDeleteProc *cmdDeleteProc;
210 ClientData clientData;
211 } Blt_ObjCmdSpec;
212
213 #endif /* TCL_MAJOR_VERSION >= 8 */
214
215 /*
216 * ----------------------------------------------------------------------
217 *
218 * Blt_Op --
219 *
220 * Generic function prototype of CmdOptions.
221 *
222 * ----------------------------------------------------------------------
223 */
224 typedef int (*Blt_Op) _ANSI_ARGS_(ANYARGS);
225
226 /*
227 * ----------------------------------------------------------------------
228 *
229 * Blt_OpSpec --
230 *
231 * Structure to specify a set of operations for a Tcl command.
232 * This is passed to the Blt_GetOp procedure to look
233 * for a function pointer associated with the operation name.
234 *
235 * ----------------------------------------------------------------------
236 */
237 typedef struct {
238 char *name; /* Name of operation */
239 int minChars; /* Minimum # characters to disambiguate */
240 Blt_Op proc;
241 int minArgs; /* Minimum # args required */
242 int maxArgs; /* Maximum # args required */
243 char *usage; /* Usage message */
244
245 } Blt_OpSpec;
246
247 typedef enum {
248 BLT_OP_ARG0, /* Op is the first argument. */
249 BLT_OP_ARG1, /* Op is the second argument. */
250 BLT_OP_ARG2, /* Op is the third argument. */
251 BLT_OP_ARG3, /* Op is the fourth argument. */
252 BLT_OP_ARG4 /* Op is the fifth argument. */
253
254 } Blt_OpIndex;
255
256 #define BLT_OP_LINEAR_SEARCH 1
257 #define BLT_OP_BINARY_SEARCH 0
258
259 extern Blt_Op Blt_GetOp _ANSI_ARGS_((Tcl_Interp *interp, int nSpecs,
260 Blt_OpSpec *specArr, int operPos, int argc, char **argv, int flags));
261
262 #if (TCL_VERSION_NUMBER >= _VERSION(8,0,0))
263 extern Blt_Op Blt_GetOpFromObj _ANSI_ARGS_((Tcl_Interp *interp,
264 int nSpecs, Blt_OpSpec *specArr, int operPos, int objc,
265 Tcl_Obj *CONST *objv, int flags));
266 #endif
267
268 /*
269 * ----------------------------------------------------------------------
270 *
271 * Assume we need to declare free if there's no stdlib.h or malloc.h
272 *
273 * ----------------------------------------------------------------------
274 */
275 #if !defined(HAVE_STDLIB_H) && !defined(HAVE_MALLOC_H)
276 extern void free _ANSI_ARGS_((void *));
277 #endif
278
279 #define free(x) abc123(x)
280
281 extern int Blt_DictionaryCompare _ANSI_ARGS_((char *s1, char *s2));
282
283 EXTERN void Blt_Panic _ANSI_ARGS_(TCL_VARARGS(char *, args));
284
285
286 extern void Blt_Draw3DRectangle _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable,
287 Tk_3DBorder border, int x, int y, int width, int height,
288 int borderWidth, int relief));
289 extern void Blt_Fill3DRectangle _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable,
290 Tk_3DBorder border, int x, int y, int width, int height,
291 int borderWidth, int relief));
292
293 #ifdef notdef
294 #define Blt_Fill3DRectangle Tk_Fill3DRectangle
295 #define Blt_Draw3DRectangle Tk_Draw3DRectangle
296 #endif
297
298 /* ---------------------------------------------------------------- */
299
300
301 #define PIXELS_NONNEGATIVE 0
302 #define PIXELS_POSITIVE 1
303 #define PIXELS_ANY 2
304
305 #define COUNT_NONNEGATIVE 0
306 #define COUNT_POSITIVE 1
307 #define COUNT_ANY 2
308
309 #define BLT_SCROLL_MODE_CANVAS (1<<0)
310 #define BLT_SCROLL_MODE_LISTBOX (1<<1)
311 #define BLT_SCROLL_MODE_HIERBOX (1<<2)
312
313 #define RGB_ANTIQUEWHITE1 "#ffefdb"
314 #define RGB_BISQUE1 "#ffe4c4"
315 #define RGB_BISQUE2 "#eed5b7"
316 #define RGB_BISQUE3 "#cdb79e"
317 #define RGB_BLACK "#000000"
318 #define RGB_BLUE "#0000ff"
319 #define RGB_GREEN "#00ff00"
320 #define RGB_GREY "#b0b0b0"
321 #define RGB_GREY15 "#262626"
322 #define RGB_GREY50 "#7f7f7f"
323 #define RGB_GREY64 "#a3a3a3"
324 #define RGB_GREY70 "#b3b3b3"
325 #define RGB_GREY75 "#bfbfbf"
326 #define RGB_GREY77 "#c3c3c3"
327 #define RGB_GREY82 "#d1d1d1"
328 #define RGB_GREY85 "#d9d9d9"
329 #define RGB_GREY90 "#e5e5e5"
330 #define RGB_GREY95 "#f2f2f2"
331 #define RGB_LIGHTBLUE0 "#e4f7ff"
332 #define RGB_LIGHTBLUE1 "#bfefff"
333 #define RGB_LIGHTBLUE2 "#b2dfee"
334 #define RGB_LIGHTSKYBLUE1 "#b0e2ff"
335 #define RGB_MAROON "#b03060"
336 #define RGB_NAVYBLUE "#000080"
337 #define RGB_PINK "#ffc0cb"
338 #define RGB_BISQUE1 "#ffe4c4"
339 #define RGB_RED "#ff0000"
340 #define RGB_WHITE "#ffffff"
341 #define RGB_YELLOW "#ffff00"
342
343 #ifdef OLD_TK_COLORS
344 #define STD_NORMAL_BACKGROUND RGB_BISQUE1
345 #define STD_ACTIVE_BACKGROUND RGB_BISQUE2
346 #define STD_SELECT_BACKGROUND RGB_LIGHTBLUE1
347 #define STD_DISABLE_FOREGROUND RGB_GREY64
348 #else
349 #define STD_NORMAL_BACKGROUND RGB_GREY85
350 #define STD_ACTIVE_BACKGROUND RGB_GREY64
351 #define STD_SELECT_BACKGROUND RGB_LIGHTBLUE1
352 #define STD_DISABLE_FOREGROUND RGB_GREY64
353 #endif /* OLD_TK_COLORS */
354
355 #define STD_ACTIVE_BG_MONO RGB_BLACK
356 #define STD_ACTIVE_FOREGROUND RGB_BLACK
357 #define STD_ACTIVE_FG_MONO RGB_WHITE
358 #define STD_BORDERWIDTH "2"
359 #ifdef OLD_TK_FONTS
360 #define STD_FONT "*-Helvetica-Medium-R-Normal-*-12-120-*"
361 #define STD_FONT_HUGE "*-Helvetica-Medium-R-Normal-*-18-180-*"
362 #define STD_FONT_LARGE "*-Helvetica-Medium-R-Normal-*-14-140-*"
363 #define STD_FONT_SMALL "*-Helvetica-Medium-R-Normal-*-10-100-*"
364 #else
365 #define STD_FONT "Helvetica -12"
366 #define STD_FONT_HUGE "*Helvetica -18"
367 #define STD_FONT_LARGE "Helvetica -14"
368 #define STD_FONT_SMALL "Helvetica -10"
369 #endif
370 #define STD_INDICATOR_COLOR RGB_MAROON
371 #define STD_NORMAL_BG_MONO RGB_WHITE
372 #define STD_NORMAL_FOREGROUND RGB_BLACK
373 #define STD_NORMAL_FG_MONO RGB_BLACK
374 #define STD_SELECT_BG_MONO RGB_BLACK
375 #define STD_SELECT_BORDERWIDTH "2"
376 #define STD_SELECT_FOREGROUND RGB_BLACK
377 #define STD_SELECT_FG_MONO RGB_WHITE
378 #define STD_SHADOW_COLOR RGB_GREY64
379 #define STD_SHADOW_MONO RGB_BLACK
380
381 #define LineWidth(w) (((w) > 1) ? (w) : 0)
382
383 #ifdef TCL_UTF_MAX
384 #define HAVE_UTF 1
385 extern FILE *Blt_OpenUtfFile _ANSI_ARGS_((char *fileName, char *mode));
386 #define fopen(f,m) Blt_OpenUtfFile((f),(m));
387 #else
388 #define HAVE_UTF 0
389 #endif /* TCL_UTF_MAX */
390
391 typedef char *DestroyData;
392
393
394 #ifndef TK_RELIEF_SOLID
395 #define TK_RELIEF_SOLID TK_RELIEF_FLAT
396 #endif
397
398 /*
399 * Tcl/Tk Backward compatibility section.
400 */
401 #if (TCL_MAJOR_VERSION > 7)
402
403 #define NO_FLAGS 0
404 #define Blt_FindPhoto(interp, name) Tk_FindPhoto(interp, name)
405
406 #else
407
408 #define Tcl_GetStringResult(interp) ((interp)->result)
409 #define Blt_FindPhoto(interp, name) Tk_FindPhoto(name)
410
411 #define Tcl_DeleteCommandFromToken(interp, token) \
412 Tcl_DeleteCommand(interp, Tcl_GetCommandName(interp, token))
413
414 /*
415 *--------------------------------------------------------------
416 *
417 * The definitions below provide foreward compatibility for
418 * functions and types related to event handling that used to
419 * be in Tk but have moved to Tcl.
420 *
421 *--------------------------------------------------------------
422 */
423
424 #define Tcl_IdleProc Tk_IdleProc
425 #define Tcl_FileProc Tk_FileProc
426 #define Tcl_TimerProc Tk_TimerProc
427 #define Tcl_TimerToken Tk_TimerToken
428
429 #define Tcl_BackgroundError Tk_BackgroundError
430 #define Tcl_CancelIdleCall Tk_CancelIdleCall
431
432 #define Tcl_CreateTimerHandler Tk_CreateTimerHandler
433 #define Tcl_DeleteTimerHandler Tk_DeleteTimerHandler
434 #define Tcl_DoOneEvent Tk_DoOneEvent
435 #define Tcl_DoWhenIdle Tk_DoWhenIdle
436 #define Tcl_Sleep Tk_Sleep
437
438 /* Additional stuff that has moved to Tcl: */
439
440 #define Tcl_AfterCmd Tk_AfterCmd
441 #define Tcl_EventuallyFree Tk_EventuallyFree
442 #define Tcl_FreeProc Tk_FreeProc
443 #define Tcl_Preserve Tk_Preserve
444 #define Tcl_Release Tk_Release
445
446 #endif /* TCL_MAJOR_VERSION > 7 */
447
448 typedef int (QSortCompareProc) _ANSI_ARGS_((const void *, const void *));
449
450
451 /*
452 * ----------------------------------------------------------------------
453 *
454 * Blt_Pad --
455 *
456 * Specifies vertical and horizontal padding.
457 *
458 * Padding can be specified on a per side basis. The fields
459 * side1 and side2 refer to the opposite sides, either
460 * horizontally or vertically.
461 *
462 * side1 side2
463 * ----- -----
464 * x | left right
465 * y | top bottom
466 *
467 * ----------------------------------------------------------------------
468 */
469 typedef struct {
470 short int side1, side2;
471 } Blt_Pad;
472
473 #define padLeft padX.side1
474 #define padRight padX.side2
475 #define padTop padY.side1
476 #define padBottom padY.side2
477 #define PADDING(x) ((x).side1 + (x).side2)
478
479 /*
480 * ----------------------------------------------------------------------
481 *
482 * The following enumerated values are used as bit flags.
483 * FILL_NONE Neither coordinate plane is specified
484 * FILL_X Horizontal plane.
485 * FILL_Y Vertical plane.
486 * FILL_BOTH Both vertical and horizontal planes.
487 *
488 * ----------------------------------------------------------------------
489 */
490 #define FILL_NONE 0
491 #define FILL_X 1
492 #define FILL_Y 2
493 #define FILL_BOTH 3
494
495 #ifndef TK_BGTILE_TOP
496 #define TK_BGTILE_TOP 0x2000000
497 #endif
498
499 #ifndef Tk_IsBgTileTop
500 #define Tk_IsBgTileTop(tkwin) \
501 (((Tk_FakeWin *) (tkwin))->flags & TK_BGTILE_TOP)
502 #endif
503
504
505 /*
506 * ----------------------------------------------------------------------
507 *
508 * Blt_Dashes --
509 *
510 * List of dash values (maximum 11 based upon PostScript limit).
511 *
512 * ----------------------------------------------------------------------
513 */
514 typedef struct {
515 unsigned char values[12];
516 int offset;
517 } Blt_Dashes;
518
519 #define LineIsDashed(d) ((d).values[0] != 0)
520
521 extern void Blt_SetDashes _ANSI_ARGS_((Display *display, GC gc,
522 Blt_Dashes *dashesPtr));
523 extern Blt_Dashes *Blt_GetDashes _ANSI_ARGS_((GC gc));
524
525 /*
526 * -------------------------------------------------------------------
527 *
528 * Point2D --
529 *
530 * 2-D coordinate.
531 *
532 * -------------------------------------------------------------------
533 */
534 typedef struct {
535 double x, y;
536 } Point2D;
537
538 /*
539 * -------------------------------------------------------------------
540 *
541 * Point3D --
542 *
543 * 3-D coordinate.
544 *
545 * -------------------------------------------------------------------
546 */
547 typedef struct {
548 double x, y, z;
549 } Point3D;
550
551 /*
552 * -------------------------------------------------------------------
553 *
554 * Segment2D --
555 *
556 * 2-D line segment.
557 *
558 * -------------------------------------------------------------------
559 */
560 typedef struct {
561 Point2D p, q; /* The two end points of the segment. */
562 } Segment2D;
563
564 /*
565 * -------------------------------------------------------------------
566 *
567 * Dim2D --
568 *
569 * 2-D dimension.
570 *
571 * -------------------------------------------------------------------
572 */
573 typedef struct {
574 short int width, height;
575 } Dim2D;
576
577 /*
578 *----------------------------------------------------------------------
579 *
580 * Region2D --
581 *
582 * 2-D region. Used to copy parts of images.
583 *
584 *----------------------------------------------------------------------
585 */
586 typedef struct {
587 int left, right, top, bottom;
588 } Region2D;
589
590 #define RegionWidth(r) ((r)->right - (r)->left + 1)
591 #define RegionHeight(r) ((r)->bottom - (r)->top + 1)
592
593 typedef struct {
594 double left, right, top, bottom;
595 } Extents2D;
596
597 typedef struct {
598 double left, right, top, bottom, front, back;
599 } Extents3D;
600
601 #define PointInRegion(e,x,y) \
602 (((x) <= (e)->right) && ((x) >= (e)->left) && \
603 ((y) <= (e)->bottom) && ((y) >= (e)->top))
604
605 #define PointInRectangle(r,x0,y0) \
606 (((x0) <= (int)((r)->x + (r)->width - 1)) && ((x0) >= (int)(r)->x) && \
607 ((y0) <= (int)((r)->y + (r)->height - 1)) && ((y0) >= (int)(r)->y))
608
609
610 /* -------------------------------------------------------------------
611 *
612 * ColorPair --
613 *
614 * Holds a pair of foreground, background colors.
615 *
616 * -------------------------------------------------------------------
617 */
618 typedef struct {
619 XColor *fgColor, *bgColor;
620 } ColorPair;
621
622 #define COLOR_NONE (XColor *)0
623 #define COLOR_DEFAULT (XColor *)1
624 #define COLOR_ALLOW_DEFAULTS 1
625
626 extern int Blt_GetColorPair _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin,
627 char *fgColor, char *bgColor, ColorPair *pairPtr, int colorFlag));
628 extern void Blt_FreeColorPair _ANSI_ARGS_((ColorPair *pairPtr));
629
630 #define STATE_NORMAL 0
631 #define STATE_ACTIVE (1<<0)
632 #define STATE_DISABLED (1<<1)
633 #define STATE_EMPHASIS (1<<2)
634
635
636 #define ARROW_NONE (-1)
637 #define ARROW_LEFT (0)
638 #define ARROW_UP (1)
639 #define ARROW_RIGHT (2)
640 #define ARROW_DOWN (3)
641 #define ARROW_OFFSET 4
642 #define STD_ARROW_HEIGHT 3
643 #define STD_ARROW_WIDTH ((2 * (ARROW_OFFSET - 1)) + 1)
644
645 #include "bltText.h"
646
647 /*
648 * ----------------------------------------------------------------------
649 *
650 * X11/Xosdefs.h requires XNOSTDHDRS be set for some systems.
651 * This is a guess. If I can't find STDC headers or unistd.h,
652 * assume that this is non-POSIX and non-STDC environment.
653 * (needed for Encore Umax 3.4 ?)
654 *
655 * ----------------------------------------------------------------------
656 */
657 #if !defined(STDC_HEADERS) && !defined(HAVE_UNISTD_H)
658 #define XNOSTDHDRS 1
659 #endif
660
661 extern char *Blt_Itoa _ANSI_ARGS_((int value));
662 extern char *Blt_Utoa _ANSI_ARGS_((unsigned int value));
663 extern char *Blt_Dtoa _ANSI_ARGS_((Tcl_Interp *interp, double value));
664 extern Tcl_Command Blt_InitCmd _ANSI_ARGS_((Tcl_Interp *interp,
665 char *namespace, Blt_CmdSpec *specPtr));
666
667 #if (TCL_VERSION_NUMBER >= _VERSION(8,0,0))
668 extern Tcl_Command Blt_InitObjCmd _ANSI_ARGS_((Tcl_Interp *interp,
669 char *namespace, Blt_ObjCmdSpec *specPtr));
670 #if (TCL_VERSION_NUMBER < _VERSION(8,1,0))
671 extern char *Tcl_GetString _ANSI_ARGS_((Tcl_Obj *objPtr));
672 extern int Tcl_EvalObjv _ANSI_ARGS_((Tcl_Interp *interp, int objc,
673 Tcl_Obj **objv, int flags));
674 extern int Tcl_WriteObj _ANSI_ARGS_((Tcl_Channel channel, Tcl_Obj *objPtr));
675 extern char *Tcl_SetVar2Ex _ANSI_ARGS_((Tcl_Interp *interp, char *part1,
676 char *part2, Tcl_Obj *objPtr, int flags));
677 extern Tcl_Obj *Tcl_GetVar2Ex _ANSI_ARGS_((Tcl_Interp *interp, char *part1,
678 char *part2, int flags));
679 #endif /* TCL_VERSION_NUMBER < 8.2.0 */
680 #endif /* TCL_VERSION_NUMBER >= 8.0.0 */
681
682
683 extern int Blt_InitCmds _ANSI_ARGS_((Tcl_Interp *interp, char *namespace,
684 Blt_CmdSpec *specPtr, int nCmds));
685
686 extern int Blt_NaturalSpline _ANSI_ARGS_((Point2D *origPts, int nOrigPts,
687 Point2D *intpPts, int nIntpPts));
688
689 extern int Blt_QuadraticSpline _ANSI_ARGS_((Point2D *origPts, int nOrigPts,
690 Point2D *intpPts, int nIntpPts));
691
692 extern int Blt_SimplifyLine _ANSI_ARGS_((Point2D *origPts, int low, int high,
693 double tolerance, int indices[]));
694
695 extern int Blt_NaturalParametricSpline _ANSI_ARGS_((Point2D *origPts,
696 int nOrigPts, Extents2D *extsPtr, int isClosed, Point2D *intpPts,
697 int nIntpPts));
698
699 extern int Blt_CatromParametricSpline _ANSI_ARGS_((Point2D *origPts,
700 int nOrigPts, Point2D *intpPts, int nIntpPts));
701
702 extern int Blt_StringToFlag _ANSI_ARGS_((ClientData clientData,
703 Tcl_Interp *interp, Tk_Window tkwin, char *string, char *widgRec,
704 int flags));
705 extern char *Blt_FlagToString _ANSI_ARGS_((ClientData clientData,
706 Tk_Window tkwin, char *string, int offset, Tcl_FreeProc **freeProc));
707
708 extern void Blt_InitHexTable _ANSI_ARGS_((char *table));
709
710 extern GC Blt_GetPrivateGC _ANSI_ARGS_((Tk_Window tkwin, unsigned long gcMask,
711 XGCValues *valuePtr));
712
713 extern GC Blt_GetPrivateGCFromDrawable _ANSI_ARGS_((Display *display,
714 Drawable drawable, unsigned long gcMask, XGCValues *valuePtr));
715
716 extern void Blt_FreePrivateGC _ANSI_ARGS_((Display *display, GC gc));
717
718 extern Tk_Window Blt_FindChild _ANSI_ARGS_((Tk_Window parent, char *name));
719
720 extern Tk_Window Blt_FirstChild _ANSI_ARGS_((Tk_Window parent));
721
722 extern Tk_Window Blt_NextChild _ANSI_ARGS_((Tk_Window tkwin));
723
724 extern void Blt_RelinkWindow _ANSI_ARGS_((Tk_Window tkwin, Tk_Window newParent,
725 int x, int y));
726
727 extern Tk_Window Blt_Toplevel _ANSI_ARGS_((Tk_Window tkwin));
728
729 extern int Blt_GetPixels _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin,
730 char *string, int check, int *valuePtr));
731 extern int Blt_GetPosition _ANSI_ARGS_((Tcl_Interp *interp, char *string,
732 int *indexPtr));
733 extern int Blt_GetPositionSize _ANSI_ARGS_((Tcl_Interp *interp, char *string,
734 int size, int *indexPtr));
735 extern int Blt_GetCount _ANSI_ARGS_((Tcl_Interp *interp, char *string,
736 int check, int *valuePtr));
737
738 extern char *Blt_NameOfFill _ANSI_ARGS_((int fill));
739
740 extern int Blt_GetXY _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin,
741 char *string, int *x, int *y));
742
743 extern Point2D Blt_GetProjection _ANSI_ARGS_((int x, int y, Point2D *p,
744 Point2D *q));
745
746 extern void Blt_DrawArrow _ANSI_ARGS_((Display *display, Drawable drawable,
747 GC gc, int x, int y, int arrowHeight, int orientation));
748
749 extern Tk_OptionParseProc Blt_StringToEnum;
750 extern Tk_OptionPrintProc Blt_EnumToString;
751
752 extern int Blt_ConfigModified _ANSI_ARGS_(TCL_VARARGS(Tk_ConfigSpec *, specs));
753
754 extern void Blt_DStringAppendElements _ANSI_ARGS_(TCL_VARARGS(Tcl_DString *, args));
755
756 extern void Blt_MakeTransparentWindowExist _ANSI_ARGS_((Tk_Window tkwin,
757 Window parent, int isBusy));
758
759 extern Window Blt_GetParent _ANSI_ARGS_((Display *display, Window tkwin));
760
761 extern void Blt_GetBoundingBox _ANSI_ARGS_((int width, int height,
762 double theta, double *widthPtr, double *heightPtr, Point2D *points));
763
764 extern void Blt_InitEpsCanvasItem _ANSI_ARGS_((Tcl_Interp *interp));
765
766 extern void Blt_TranslateAnchor _ANSI_ARGS_((int x, int y, int width,
767 int height, Tk_Anchor anchor, int *transXPtr, int *transYPtr));
768
769 extern Point2D Blt_TranslatePoint _ANSI_ARGS_((Point2D *pointPtr, int width,
770 int height, Tk_Anchor anchor));
771
772 extern int Blt_ConfigureWidgetComponent _ANSI_ARGS_((Tcl_Interp *interp,
773 Tk_Window tkwin, char *name, char *class, Tk_ConfigSpec *specs,
774 int argc, char **argv, char *widgRec, int flags));
775
776 extern void Blt_HSV _ANSI_ARGS_((XColor *colorPtr, double *huePtr,
777 double *valPtr, double *satPtr));
778
779 extern void Blt_RGB _ANSI_ARGS_((double hue, double sat, double val,
780 XColor *colorPtr));
781
782 extern int Blt_ParseFlag _ANSI_ARGS_((ClientData, Tcl_Interp *, Tk_Window,
783 char *, char *, int));
784 extern char *Blt_FlagPrint _ANSI_ARGS_((ClientData, Tk_Window, char *, int,
785 Tcl_FreeProc **));
786
787 extern int Blt_MaxRequestSize _ANSI_ARGS_((Display *display,
788 unsigned int elemSize));
789
790 extern Window Blt_GetRealWindowId _ANSI_ARGS_((Tk_Window tkwin));
791 extern int Blt_RootX _ANSI_ARGS_((Tk_Window tkwin));
792 extern int Blt_RootY _ANSI_ARGS_((Tk_Window tkwin));
793 extern void Blt_RootCoordinates _ANSI_ARGS_((Tk_Window tkwin, int x, int y,
794 int *rootXPtr, int *rootYPtr));
795 extern void Blt_MapToplevel _ANSI_ARGS_((Tk_Window tkwin));
796 extern void Blt_UnmapToplevel _ANSI_ARGS_((Tk_Window tkwin));
797 extern void Blt_RaiseToplevel _ANSI_ARGS_((Tk_Window tkwin));
798 extern void Blt_LowerToplevel _ANSI_ARGS_((Tk_Window tkwin));
799 extern void Blt_ResizeToplevel _ANSI_ARGS_((Tk_Window tkwin,
800 int width, int height));
801 extern void Blt_MoveToplevel _ANSI_ARGS_((Tk_Window tkwin, int x, int y));
802 extern void Blt_MoveResizeToplevel _ANSI_ARGS_((Tk_Window tkwin,
803 int x, int y, int width, int height));
804 extern ClientData Blt_GetWindowInstanceData _ANSI_ARGS_((Tk_Window tkwin));
805
806 extern void Blt_SetWindowInstanceData _ANSI_ARGS_((Tk_Window tkwin,
807 ClientData instanceData));
808
809 extern void Blt_DeleteWindowInstanceData _ANSI_ARGS_((Tk_Window tkwin));
810
811 extern int Blt_AdjustViewport _ANSI_ARGS_((int offset, int worldSize,
812 int windowSize, int scrollUnits, int scrollMode));
813
814 extern int Blt_GetScrollInfo _ANSI_ARGS_((Tcl_Interp *interp, int argc,
815 char **argv, int *offsetPtr, int worldSize, int windowSize,
816 int scrollUnits, int scrollMode));
817
818 extern int Blt_WinResizeAlways _ANSI_ARGS_((Tk_Window tkwin));
819
820 #if (TK_MAJOR_VERSION >= 8)
821 extern int Blt_GetScrollInfoFromObj _ANSI_ARGS_((Tcl_Interp *interp, int objc,
822 Tcl_Obj *CONST *objv, int *offsetPtr, int worldSize, int windowSize,
823 int scrollUnits, int scrollMode));
824 #endif
825
826 extern void Blt_UpdateScrollbar _ANSI_ARGS_((Tcl_Interp *interp,
827 char *scrollCmd, double firstFract, double lastFract));
828
829 extern int Blt_ReparentWindow _ANSI_ARGS_((Display *display, Window window,
830 Window newParent, int x, int y));
831
832 #if defined(HAVE_JPEGLIB_H) || defined(HAVE_IJL_H)
833 #define HAVE_JPEG 1
834 extern int Blt_JPEGToPhoto _ANSI_ARGS_((Tcl_Interp *interp, char *fileName,
835 Tk_PhotoHandle photo));
836 #endif /* HAVE_JPEGLIB_H || HAVE_IJL_H */
837
838 #define Blt_SetBooleanResult(i, b) \
839 Tcl_SetResult((i), (b) ? "1" : "0", TCL_STATIC)
840
841 /*
842 * Define this if you want to be able to tile to the main window "."
843 * This will cause a conflict with Tk if you try to compile and link
844 * statically.
845 */
846 #undef TILE_MAINWINDOW
847
848 #ifdef WIN32
849 #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION == 0)
850 #else
851 #define NO_DDE 1
852 #endif
853 #else
854 #define NO_DDE 1
855 #define NO_PRINTER 1
856 #endif /* WIN32 */
857
858 #if (TCL_MAJOR_VERSION == 7)
859 #define NO_TREE 1
860 #define NO_ARRAY 1
861 #define NO_TREEVIEW 1
862 #endif
863
864 /* #define NO_TED */
865
866 #ifndef NO_BEEP
867 extern Tcl_AppInitProc Blt_BeepInit;
868 #endif
869 #ifndef NO_BGEXEC
870 extern Tcl_AppInitProc Blt_BgexecInit;
871 #endif
872 #ifndef NO_BITMAP
873 extern Tcl_AppInitProc Blt_BitmapInit;
874 #endif
875 #ifndef NO_BUSY
876 extern Tcl_AppInitProc Blt_BusyInit;
877 #endif
878 #ifndef NO_CONTAINER
879 extern Tcl_AppInitProc Blt_ContainerInit;
880 #endif
881 #ifndef NO_CRC32
882 extern Tcl_AppInitProc Blt_Crc32Init;
883 #endif
884 #ifndef NO_CUTBUFFER
885 extern Tcl_AppInitProc Blt_CutbufferInit;
886 #endif
887 #ifndef NO_DEBUG
888 extern Tcl_AppInitProc Blt_DebugInit;
889 #endif
890 #ifndef NO_DRAGDROP
891 extern Tcl_AppInitProc Blt_DragDropInit;
892 #endif
893 #ifndef NO_DND
894 extern Tcl_AppInitProc Blt_DndInit;
895 #endif
896 #ifndef NO_GRAPH
897 extern Tcl_AppInitProc Blt_GraphInit;
898 #endif
899 #ifndef NO_HIERBOX
900 extern Tcl_AppInitProc Blt_HierboxInit;
901 #endif
902 #ifndef NO_HIERTABLE
903 extern Tcl_AppInitProc Blt_HiertableInit;
904 #endif
905 #ifndef NO_HTEXT
906 extern Tcl_AppInitProc Blt_HtextInit;
907 #endif
908 #ifdef WIN32
909 #ifndef NO_PRINTER
910 extern Tcl_AppInitProc Blt_PrinterInit;
911 #endif
912 #endif
913 #ifndef NO_TABLE
914 extern Tcl_AppInitProc Blt_TableInit;
915 #endif
916 #ifndef NO_VECTOR
917 extern Tcl_AppInitProc Blt_VectorInit;
918 #endif
919 #ifndef NO_WINOP
920 extern Tcl_AppInitProc Blt_WinopInit;
921 #endif
922 #ifndef NO_WATCH
923 extern Tcl_AppInitProc Blt_WatchInit;
924 #endif
925 #ifndef NO_SPLINE
926 extern Tcl_AppInitProc Blt_SplineInit;
927 #endif
928 #ifndef NO_TABSET
929 extern Tcl_AppInitProc Blt_TabsetInit;
930 #endif
931 #ifndef NO_TABNOTEBOOK
932 extern Tcl_AppInitProc Blt_TabnotebookInit;
933 #endif
934 #ifndef NO_TREE
935 extern Tcl_AppInitProc Blt_TreeInit;
936 #endif
937 #ifndef NO_TREEVIEW
938 extern Tcl_AppInitProc Blt_TreeViewInit;
939 #endif
940 #ifndef NO_TILEFRAME
941 extern Tcl_AppInitProc Blt_FrameInit;
942 #endif
943 #ifndef NO_TILEBUTTON
944 extern Tcl_AppInitProc Blt_ButtonInit;
945 #endif
946 #ifndef NO_TILESCROLLBAR
947 extern Tcl_AppInitProc Blt_ScrollbarInit;
948 #endif
949
950 #if (BLT_MAJOR_VERSION == 3)
951 #ifndef NO_MOUNTAIN
952 extern Tcl_AppInitProc Blt_MountainInit;
953 #endif
954 #endif
955 #ifndef NO_TED
956 extern Tcl_AppInitProc Blt_TedInit;
957 #endif
958
959 #ifndef NO_DDE
960 extern Tcl_AppInitProc Blt_DdeInit;
961 #endif
962
963 typedef void *(Blt_MallocProc) _ANSI_ARGS_((size_t size));
964 typedef void *(Blt_CallocProc) _ANSI_ARGS_((int nElem, size_t size));
965 typedef void *(Blt_ReallocProc) _ANSI_ARGS_((void *ptr, size_t size));
966 typedef void (Blt_FreeProc) _ANSI_ARGS_((void *ptr));
967
968 EXTERN Blt_MallocProc *Blt_MallocProcPtr;
969 EXTERN Blt_FreeProc *Blt_FreeProcPtr;
970 EXTERN Blt_ReallocProc *Blt_ReallocProcPtr;
971
972 #define Blt_Malloc(size) (*Blt_MallocProcPtr)(size)
973 #define Blt_Free (*Blt_FreeProcPtr)
974 #define Blt_Realloc(ptr, size) (*Blt_ReallocProcPtr)(ptr, size)
975
976 EXTERN char *Blt_Strdup _ANSI_ARGS_((CONST char *ptr));
977 EXTERN void *Blt_Calloc _ANSI_ARGS_((unsigned int nElem, size_t size));
978
979 EXTERN Tk_CustomOption bltTileOption;
980 EXTERN Tk_ObjCustomOption bltCustomTileOption;
981
982 #ifdef WIN32
983 #include "bltWin.h"
984 #endif
985
986 #ifndef WIN32
987 #define PurifyPrintf printf
988 #endif /* WIN32 */
989 #endif /*_BLT_INT_H*/