summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2000-02-08 11:31:27 (GMT)
committerhobbs <hobbs@noemail.net>2000-02-08 11:31:27 (GMT)
commit6425b8563000a38896957048e230b624e7787221 (patch)
treeaaba98591be690b73fe87702aaa4023a89457083
parentbb9ddb68e864d2c686a08a1f9270dba0f1c25a4c (diff)
downloadtk-6425b8563000a38896957048e230b624e7787221.zip
tk-6425b8563000a38896957048e230b624e7787221.tar.gz
tk-6425b8563000a38896957048e230b624e7787221.tar.bz2
* generic/tkDecls.h:
* generic/tk.decls: * generic/tk.h: moved new public functions created in dash patch to the stubs interface [Bug: 4062] * generic/tk.h: * doc/CrtImgType.3: * doc/CrtPhImgFmt.3: * generic/tk.h: * generic/tkImgGIF.c: * generic/tkImgPhoto.c: * generic/tkStubImg.c (new file): * generic/tkTest.c: * unix/Makefile.in: * win/Makefile.in: * win/makefile.vc: improved support for moving from the old style image C API to the new obj'ified one with new Tk_InitImageArgs command and stub'ing of image code. See docs for how to make the transition. [Bug: 4060] FossilOrigin-Name: dbe34fe5efcb725442acc347dcb728ad8e30493c
-rw-r--r--ChangeLog20
-rw-r--r--doc/CrtImgType.334
-rw-r--r--doc/CrtPhImgFmt.333
-rw-r--r--generic/tk.decls71
-rw-r--r--generic/tk.h79
-rw-r--r--generic/tkDecls.h159
-rw-r--r--generic/tkImgGIF.c18
-rw-r--r--generic/tkImgPhoto.c51
-rw-r--r--generic/tkStubImg.c74
-rw-r--r--generic/tkStubInit.c22
-rw-r--r--generic/tkTest.c51
-rw-r--r--unix/Makefile.in7
-rw-r--r--win/Makefile.in5
-rw-r--r--win/makefile.vc3
14 files changed, 494 insertions, 133 deletions
diff --git a/ChangeLog b/ChangeLog
index 1490de8..069265e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
2000-02-08 Jeff Hobbs <hobbs@scriptics.com>
+ * generic/tkDecls.h:
+ * generic/tk.decls:
+ * generic/tk.h: moved new public functions created in dash patch
+ to the stubs interface [Bug: 4062]
+
+ * generic/tk.h:
+ * doc/CrtImgType.3:
+ * doc/CrtPhImgFmt.3:
+ * generic/tk.h:
+ * generic/tkImgGIF.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkStubImg.c (new file):
+ * generic/tkTest.c:
+ * unix/Makefile.in:
+ * win/Makefile.in:
+ * win/makefile.vc: improved support for moving from the old style
+ image C API to the new obj'ified one with new Tk_InitImageArgs
+ command and stub'ing of image code. See docs for how to make the
+ transition. [Bug: 4060]
+
* library/tk.tcl: wrapped check for tcl_platform(os) around info
exists because it won't in safe interpreters
diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3
index 918e0cc..ce97863 100644
--- a/doc/CrtImgType.3
+++ b/doc/CrtImgType.3
@@ -5,13 +5,13 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: CrtImgType.3,v 1.3 1999/10/29 03:57:40 hobbs Exp $
+'\" RCS: @(#) $Id: CrtImgType.3,v 1.4 2000/02/08 11:31:30 hobbs Exp $
'\"
.so man.macros
-.TH Tk_CreateImageType 3 8.0 Tk "Tk Library Procedures"
+.TH Tk_CreateImageType 3 8.3 Tk "Tk Library Procedures"
.BS
.SH NAME
-Tk_CreateImageType, Tk_GetImageMasterData \- define new kind of image
+Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind of image
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -21,6 +21,8 @@ ClientData
.sp
.VS
\fBTk_GetImageMasterData\fR(\fIinterp, name, typePtrPtr\fR)
+.sp
+\fBTk_InitImageArgs\fR(\fIinterp, argc, argvPtr\fR)
.SH ARGUMENTS
.AS Tk_ImageType *typePtrPtr
.AP Tk_ImageType *typePtr in
@@ -34,6 +36,10 @@ Name of existing image.
.AP Tk_ImageType **typePtrPtr out
Points to word in which to store a pointer to type information for
the given image, if it exists.
+.AP int argc
+Number of arguments
+.AP char ***argvPtr
+Pointer to argument list
.VE
.BE
@@ -100,6 +106,16 @@ type.
If there already existed an image type by this name then
the new image type replaces the old one.
+.SH PORTABILITY
+.PP
+In Tk 8.2 and earlier, the createProc below had a different
+signature. If you want to compile an image type using the
+old interface which should still run on all Tcl/Tk versions,
+compile it with the flag -DUSE_OLD_IMAGE. Further on, if
+you are using Stubs, you need to call the function
+Tk_InitImageArgs(interp, argc, &argv) first in your
+createProc. See below for a description of this function.
+
.SH CREATEPROC
\fItypePtr->createProc\fR provides the address of a procedure for
Tk to call whenever \fBimage create\fR is invoked to create
@@ -248,6 +264,18 @@ pointer to the image master data structure). If no such image exists
then NULL is returned and NULL is stored at \fI*typePtrPtr\fR.
.VE
+.SH TK_INITIMAGEARGS
+.VS
+.PP
+The function \fBTk_InitImageArgs\fR converts the arguments of the
+\fBcreateProc\fR from objects to strings when necessary. When
+not using stubs, not using the old interface, or running
+under an older (pre-8.3) Tk version, this function has no
+effect. This function makes porting older image handlers to
+the new interface a lot easier: After running this function,
+the arguments are guaranteed to be in string format, no
+matter how Tk deliverd them.
+
.SH "SEE ALSO"
Tk_ImageChanged, Tk_GetImage, Tk_FreeImage, Tk_RedrawImage, Tk_SizeOfImage
diff --git a/doc/CrtPhImgFmt.3 b/doc/CrtPhImgFmt.3
index 94b1404..fba525df 100644
--- a/doc/CrtPhImgFmt.3
+++ b/doc/CrtPhImgFmt.3
@@ -9,10 +9,10 @@
'\" Department of Computer Science,
'\" Australian National University.
'\"
-'\" RCS: @(#) $Id: CrtPhImgFmt.3,v 1.3 1999/10/29 03:57:40 hobbs Exp $
+'\" RCS: @(#) $Id: CrtPhImgFmt.3,v 1.4 2000/02/08 11:31:30 hobbs Exp $
'\"
.so man.macros
-.TH Tk_CreatePhotoImageFormat 3 4.0 Tk "Tk Library Procedures"
+.TH Tk_CreatePhotoImageFormat 3 8.3 Tk "Tk Library Procedures"
.BS
.SH NAME
Tk_CreatePhotoImageFormat \- define new file format for photo images
@@ -69,6 +69,14 @@ structure should be set to NULL. The handler must provide the
procedure, and the \fIstringMatchProc\fR procedure if it provides the
\fIstringReadProc\fR procedure.
+.SH PORTABILITY
+.PP
+In Tk 8.2 and earlier, a different interface was used. Tk 8.3 will
+still support the old format handlers if the format name is in upper
+case. If you still want to compile old format handlers with Tk8.3,
+use the flag -DUSE_OLD_IMAGE. This will restore all function prototypes
+to match the pre-8.3 situation.
+
.SH NAME
.PP
\fIformatPtr->name\fR provides a name for the image type.
@@ -76,7 +84,9 @@ Once \fBTk_CreatePhotoImageFormat\fR returns, this name may be used
in the \fB\-format\fR photo image configuration and subcommand option.
The manual page for the photo image (photo(n)) describes how image
file formats are chosen based on their names and the value given to
-the \fB\-format\fR option.
+the \fB\-format\fR option. For new format handlers, the name should
+be in lower case. Pre-8.3 format handlers are assumed to be in
+upper case.
.SH FILEMATCHPROC
\fIformatPtr->fileMatchProc\fR provides the address of a procedure for
@@ -86,7 +96,7 @@ suitable for reading data in a given file.
.CS
typedef int Tk_ImageFileMatchProc(
Tcl_Channel \fIchan\fR,
- char *\fIfileName\fR,
+ CONST char *\fIfileName\fR,
Tcl_Obj *\fIformat\fR,
int *\fIwidthPtr\fR,
int *\fIheightPtr\fR,
@@ -108,13 +118,13 @@ suitable for reading data from a given string.
\fIformatPtr->stringMatchProc\fR must match the following prototype:
.CS
typedef int Tk_ImageStringMatchProc(
- char *\fIstring\fR,
+ Tcl_Obj *\fIdata\fR,
Tcl_Obj *\fIformat\fR,
int *\fIwidthPtr\fR,
int *\fIheightPtr\fR,
Tcl_Interp *\fIinterp\fR);
.CE
-The \fIstring\fR argument points to the string containing the image
+The \fIdata\fR argument points to the object containing the image
data. The \fIformat\fR argument contains the value given for
the \fB\-format\fR option, or NULL if the option was not specified.
If the data in the string appears to be in the format supported by
@@ -131,7 +141,7 @@ Tk to call to read data from an image file into a photo image.
typedef int Tk_ImageFileReadProc(
Tcl_Interp *\fIinterp\fR,
Tcl_Channel \fIchan\fR,
- char *\fIfileName\fR,
+ CONST char *\fIfileName\fR,
Tcl_Obj *\fIformat\fR,
PhotoHandle \fIimageHandle\fR,
int \fIdestX\fR, int \fIdestY\fR,
@@ -159,7 +169,7 @@ Tk to call to read data from a string into a photo image.
.CS
typedef int Tk_ImageStringReadProc(
Tcl_Interp *\fIinterp\fR,
- char *\fIstring\fR,
+ Tcl_Obj *\fIdata\fR,
Tcl_Obj *\fIformat\fR,
PhotoHandle \fIimageHandle\fR,
int \fIdestX\fR, int \fIdestY\fR,
@@ -168,7 +178,7 @@ typedef int Tk_ImageStringReadProc(
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to read the image; it should be used for reporting errors.
-The \fIstring\fR argument points to the image data in string form.
+The \fIdata\fR argument points to the image data in object form.
The \fIformat\fR argument contains the
value given for the \fB\-format\fR option, or NULL if the option was
not specified. The image data in the string, or a subimage of it, is to
@@ -187,7 +197,7 @@ Tk to call to write data from a photo image to a file.
.CS
typedef int Tk_ImageFileWriteProc(
Tcl_Interp *\fIinterp\fR,
- char *\fIfileName\fR,
+ CONST char *\fIfileName\fR,
Tcl_Obj *\fIformat\fR,
Tk_PhotoImageBlock *\fIblockPtr\fR);
.CE
@@ -212,7 +222,6 @@ Tk to call to translate image data from a photo image into a string.
.CS
typedef int Tk_ImageStringWriteProc(
Tcl_Interp *\fIinterp\fR,
- Tcl_DString *\fIdataPtr\fR,
Tcl_Obj *\fIformat\fR,
Tk_PhotoImageBlock *\fIblockPtr\fR);
.CE
@@ -221,7 +230,7 @@ invoked to convert the image; it should be used for reporting errors.
The image data to be converted are in memory and are described by the
Tk_PhotoImageBlock structure pointed to by \fIblockPtr\fR; see the
manual page FindPhoto(3) for details. The data for the string
-should be appended to the dynamic string given by \fIdataPtr\fR.
+should be put in the interpreter \fIinterp\fR result.
The \fIformat\fR argument contains the
value given for the \fB\-format\fR option, or NULL if the option was
not specified. The format string can contain extra characters
diff --git a/generic/tk.decls b/generic/tk.decls
index db8314a..f152cbd 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: tk.decls,v 1.5 1999/12/14 06:52:24 hobbs Exp $
+# RCS: @(#) $Id: tk.decls,v 1.6 2000/02/08 11:31:32 hobbs Exp $
library tk
@@ -1052,6 +1052,75 @@ declare 217 generic {
# VOID *Tk_GetCanvasVisitor(Tcl_Interp *interp, CONST char *name)
#}
+declare 220 generic {
+ int Tk_GetDash(Tcl_Interp *interp, CONST char *value, Tk_Dash *dash)
+}
+declare 221 generic {
+ void Tk_CreateOutline(Tk_Outline *outline)
+}
+declare 222 generic {
+ void Tk_DeleteOutline(Display *display, Tk_Outline *outline)
+}
+declare 223 generic {
+ int Tk_ConfigOutlineGC(XGCValues *gcValues, Tk_Canvas canvas, \
+ Tk_Item *item, Tk_Outline *outline)
+}
+declare 224 generic {
+ int Tk_ChangeOutlineGC(Tk_Canvas canvas, Tk_Item *item, \
+ Tk_Outline *outline)
+}
+declare 225 generic {
+ int Tk_ResetOutlineGC(Tk_Canvas canvas, Tk_Item *item, \
+ Tk_Outline *outline)
+}
+declare 226 generic {
+ int Tk_CanvasPsOutline(Tk_Canvas canvas, Tk_Item *item, \
+ Tk_Outline *outline)
+}
+declare 227 generic {
+ void Tk_SetTSOrigin(Tk_Window tkwin, GC gc, int x, int y)
+}
+declare 228 generic {
+ int Tk_CanvasGetCoordFromObj(Tcl_Interp *interp, Tk_Canvas canvas, \
+ Tcl_Obj *obj, double *doublePtr)
+}
+declare 229 generic {
+ void Tk_CanvasSetOffset(Tk_Canvas canvas, GC gc, Tk_TSOffset *offset)
+}
+declare 230 generic {
+ void Tk_DitherPhoto(Tk_PhotoHandle handle, int x, int y, int width, \
+ int height)
+}
+declare 231 generic {
+ int Tk_PostscriptBitmap(Tcl_Interp *interp, Tk_Window tkwin, \
+ Tk_PostscriptInfo psInfo, Pixmap bitmap, int startX, \
+ int startY, int width, int height)
+}
+declare 232 generic {
+ int Tk_PostscriptColor(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, \
+ XColor *colorPtr)
+}
+declare 233 generic {
+ int Tk_PostscriptFont(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, \
+ Tk_Font font)
+}
+declare 234 generic {
+ int Tk_PostscriptImage(Tk_Image image, Tcl_Interp *interp, \
+ Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, \
+ int width, int height, int prepass)
+}
+declare 235 generic {
+ void Tk_PostscriptPath(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, \
+ double *coordPtr, int numPoints)
+}
+declare 236 generic {
+ int Tk_PostscriptStipple(Tcl_Interp *interp, Tk_Window tkwin, \
+ Tk_PostscriptInfo psInfo, Pixmap bitmap)
+}
+declare 237 generic {
+ double Tk_PostscriptY(double y, Tk_PostscriptInfo psInfo)
+}
+
# Define the platform specific public Tk interface. These functions are
# only available on the designated platform.
diff --git a/generic/tk.h b/generic/tk.h
index 5bc1320..7596e0b 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tk.h,v 1.37 2000/02/08 10:00:44 hobbs Exp $
+ * RCS: @(#) $Id: tk.h,v 1.38 2000/02/08 11:31:32 hobbs Exp $
*/
#ifndef _TK
@@ -1065,27 +1065,6 @@ typedef struct Tk_Outline {
Pixmap disabledStipple; /* Outline Stipple pattern if state is disabled. */
} Tk_Outline;
-/*
- * Some functions handy for Dashing and Outlines (in tkCanvUtil.c).
- */
-
-EXTERN int Tk_GetDash _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *value, Tk_Dash *dash));
-EXTERN void Tk_CreateOutline _ANSI_ARGS_((Tk_Outline *outline));
-EXTERN void Tk_DeleteOutline _ANSI_ARGS_((Display *display,
- Tk_Outline *outline));
-EXTERN int Tk_ConfigOutlineGC _ANSI_ARGS_((XGCValues *gcValues,
- Tk_Canvas canvas ,Tk_Item *item,
- Tk_Outline *outline));
-EXTERN int Tk_ChangeOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *item, Tk_Outline *outline));
-EXTERN int Tk_ResetOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *item, Tk_Outline *outline));
-EXTERN int Tk_CanvasPsOutline _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *item, Tk_Outline *outline));
-EXTERN void Tk_SetTSOrigin _ANSI_ARGS_((Tk_Window tkwin, GC gc, int x,
- int y));
-
/*
*--------------------------------------------------------------
@@ -1215,23 +1194,22 @@ typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
Tk_PhotoImageBlock *blockPtr));
#else
typedef int (Tk_ImageFileMatchProc) _ANSI_ARGS_((Tcl_Channel chan,
- char *fileName, Tcl_Obj *format, int *widthPtr,
+ CONST char *fileName, Tcl_Obj *format, int *widthPtr,
int *heightPtr, Tcl_Interp *interp));
typedef int (Tk_ImageStringMatchProc) _ANSI_ARGS_((Tcl_Obj *dataObj,
Tcl_Obj *format, int *widthPtr, int *heightPtr,
Tcl_Interp *interp));
typedef int (Tk_ImageFileReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Channel chan, char *fileName, Tcl_Obj *format,
+ Tcl_Channel chan, CONST char *fileName, Tcl_Obj *format,
Tk_PhotoHandle imageHandle, int destX, int destY,
int width, int height, int srcX, int srcY));
typedef int (Tk_ImageStringReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *dataObj, Tcl_Obj *format, Tk_PhotoHandle imageHandle,
int destX, int destY, int width, int height, int srcX, int srcY));
typedef int (Tk_ImageFileWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
- char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
+ CONST char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_DString *dataPtr, Tcl_Obj *format,
- Tk_PhotoImageBlock *blockPtr));
+ Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
#endif
/*
@@ -1273,7 +1251,7 @@ EXTERN void Tk_CreateOldImageType _ANSI_ARGS_((
EXTERN void Tk_CreateOldPhotoImageFormat _ANSI_ARGS_((
Tk_PhotoImageFormat *formatPtr));
-#ifdef USE_OLD_IMAGE
+#if !defined(USE_TK_STUBS) && defined(USE_OLD_IMAGE)
#define Tk_CreateImageType Tk_CreateOldImageType
#define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat
#endif
@@ -1337,6 +1315,14 @@ char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
#endif
+void Tk_InitImageArgs _ANSI_ARGS_((Tcl_Interp *interp, int argc, char ***argv));
+
+#if !defined(USE_TK_STUBS) || !defined(USE_OLD_IMAGE)
+
+#define Tk_InitImageArgs(interp, argc, argv) /**/
+
+#endif
+
/*
*--------------------------------------------------------------
@@ -1360,43 +1346,6 @@ typedef Tk_RestrictAction (Tk_RestrictProc) _ANSI_ARGS_((
typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData,
int offset, char *buffer, int maxBytes));
-/*
- *--------------------------------------------------------------
- *
- * Exported procedures introduced by dash-patch.
- *
- *--------------------------------------------------------------
- */
-
-EXTERN int Tk_CanvasGetCoordFromObj _ANSI_ARGS_((
- Tcl_Interp *interp, Tk_Canvas canvas, Tcl_Obj *obj,
- double *doublePtr));
-EXTERN void Tk_CanvasSetOffset _ANSI_ARGS_((
- Tk_Canvas canvas, GC gc, Tk_TSOffset *offset));
-EXTERN void Tk_CreatePhotoOption _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *name, Tcl_ObjCmdProc *proc));
-EXTERN void Tk_DitherPhoto _ANSI_ARGS_((Tk_PhotoHandle handle,
- int x, int y, int width, int height));
-EXTERN int Tk_PostscriptBitmap _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tk_PostscriptInfo psInfo,
- Pixmap bitmap, int startX, int startY,
- int width, int height));
-EXTERN int Tk_PostscriptColor _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_PostscriptInfo psInfo, XColor *colorPtr));
-EXTERN int Tk_PostscriptFont _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_PostscriptInfo psInfo, Tk_Font font));
-EXTERN int Tk_PostscriptImage _ANSI_ARGS_((Tk_Image image,
- Tcl_Interp *interp, Tk_Window tkwin,
- Tk_PostscriptInfo psinfo, int x, int y,
- int width, int height, int prepass));
-EXTERN void Tk_PostscriptPath _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_PostscriptInfo psInfo, double *coordPtr,
- int numPoints));
-EXTERN int Tk_PostscriptStipple _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tk_PostscriptInfo psInfo,
- Pixmap bitmap));
-EXTERN double Tk_PostscriptY _ANSI_ARGS_((double y,
- Tk_PostscriptInfo psInfo));
/*
*--------------------------------------------------------------
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index e9b7dc0..0a0820d 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkDecls.h,v 1.7 2000/01/12 11:45:02 hobbs Exp $
+ * RCS: @(#) $Id: tkDecls.h,v 1.8 2000/02/08 11:31:32 hobbs Exp $
*/
#ifndef _TKDECLS
@@ -752,6 +752,69 @@ EXTERN int Tk_CreateConsoleWindow _ANSI_ARGS_((
EXTERN void Tk_CreateSmoothMethod _ANSI_ARGS_((
Tcl_Interp * interp,
Tk_SmoothMethod * method));
+/* Slot 218 is reserved */
+/* Slot 219 is reserved */
+/* 220 */
+EXTERN int Tk_GetDash _ANSI_ARGS_((Tcl_Interp * interp,
+ CONST char * value, Tk_Dash * dash));
+/* 221 */
+EXTERN void Tk_CreateOutline _ANSI_ARGS_((Tk_Outline * outline));
+/* 222 */
+EXTERN void Tk_DeleteOutline _ANSI_ARGS_((Display * display,
+ Tk_Outline * outline));
+/* 223 */
+EXTERN int Tk_ConfigOutlineGC _ANSI_ARGS_((XGCValues * gcValues,
+ Tk_Canvas canvas, Tk_Item * item,
+ Tk_Outline * outline));
+/* 224 */
+EXTERN int Tk_ChangeOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
+ Tk_Item * item, Tk_Outline * outline));
+/* 225 */
+EXTERN int Tk_ResetOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
+ Tk_Item * item, Tk_Outline * outline));
+/* 226 */
+EXTERN int Tk_CanvasPsOutline _ANSI_ARGS_((Tk_Canvas canvas,
+ Tk_Item * item, Tk_Outline * outline));
+/* 227 */
+EXTERN void Tk_SetTSOrigin _ANSI_ARGS_((Tk_Window tkwin, GC gc,
+ int x, int y));
+/* 228 */
+EXTERN int Tk_CanvasGetCoordFromObj _ANSI_ARGS_((
+ Tcl_Interp * interp, Tk_Canvas canvas,
+ Tcl_Obj * obj, double * doublePtr));
+/* 229 */
+EXTERN void Tk_CanvasSetOffset _ANSI_ARGS_((Tk_Canvas canvas,
+ GC gc, Tk_TSOffset * offset));
+/* 230 */
+EXTERN void Tk_DitherPhoto _ANSI_ARGS_((Tk_PhotoHandle handle,
+ int x, int y, int width, int height));
+/* 231 */
+EXTERN int Tk_PostscriptBitmap _ANSI_ARGS_((Tcl_Interp * interp,
+ Tk_Window tkwin, Tk_PostscriptInfo psInfo,
+ Pixmap bitmap, int startX, int startY,
+ int width, int height));
+/* 232 */
+EXTERN int Tk_PostscriptColor _ANSI_ARGS_((Tcl_Interp * interp,
+ Tk_PostscriptInfo psInfo, XColor * colorPtr));
+/* 233 */
+EXTERN int Tk_PostscriptFont _ANSI_ARGS_((Tcl_Interp * interp,
+ Tk_PostscriptInfo psInfo, Tk_Font font));
+/* 234 */
+EXTERN int Tk_PostscriptImage _ANSI_ARGS_((Tk_Image image,
+ Tcl_Interp * interp, Tk_Window tkwin,
+ Tk_PostscriptInfo psinfo, int x, int y,
+ int width, int height, int prepass));
+/* 235 */
+EXTERN void Tk_PostscriptPath _ANSI_ARGS_((Tcl_Interp * interp,
+ Tk_PostscriptInfo psInfo, double * coordPtr,
+ int numPoints));
+/* 236 */
+EXTERN int Tk_PostscriptStipple _ANSI_ARGS_((
+ Tcl_Interp * interp, Tk_Window tkwin,
+ Tk_PostscriptInfo psInfo, Pixmap bitmap));
+/* 237 */
+EXTERN double Tk_PostscriptY _ANSI_ARGS_((double y,
+ Tk_PostscriptInfo psInfo));
typedef struct TkStubHooks {
struct TkPlatStubs *tkPlatStubs;
@@ -982,6 +1045,26 @@ typedef struct TkStubs {
void (*tk_InitConsoleChannels) _ANSI_ARGS_((Tcl_Interp * interp)); /* 215 */
int (*tk_CreateConsoleWindow) _ANSI_ARGS_((Tcl_Interp * interp)); /* 216 */
void (*tk_CreateSmoothMethod) _ANSI_ARGS_((Tcl_Interp * interp, Tk_SmoothMethod * method)); /* 217 */
+ void *reserved218;
+ void *reserved219;
+ int (*tk_GetDash) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * value, Tk_Dash * dash)); /* 220 */
+ void (*tk_CreateOutline) _ANSI_ARGS_((Tk_Outline * outline)); /* 221 */
+ void (*tk_DeleteOutline) _ANSI_ARGS_((Display * display, Tk_Outline * outline)); /* 222 */
+ int (*tk_ConfigOutlineGC) _ANSI_ARGS_((XGCValues * gcValues, Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 223 */
+ int (*tk_ChangeOutlineGC) _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 224 */
+ int (*tk_ResetOutlineGC) _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 225 */
+ int (*tk_CanvasPsOutline) _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 226 */
+ void (*tk_SetTSOrigin) _ANSI_ARGS_((Tk_Window tkwin, GC gc, int x, int y)); /* 227 */
+ int (*tk_CanvasGetCoordFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, Tcl_Obj * obj, double * doublePtr)); /* 228 */
+ void (*tk_CanvasSetOffset) _ANSI_ARGS_((Tk_Canvas canvas, GC gc, Tk_TSOffset * offset)); /* 229 */
+ void (*tk_DitherPhoto) _ANSI_ARGS_((Tk_PhotoHandle handle, int x, int y, int width, int height)); /* 230 */
+ int (*tk_PostscriptBitmap) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap, int startX, int startY, int width, int height)); /* 231 */
+ int (*tk_PostscriptColor) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, XColor * colorPtr)); /* 232 */
+ int (*tk_PostscriptFont) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, Tk_Font font)); /* 233 */
+ int (*tk_PostscriptImage) _ANSI_ARGS_((Tk_Image image, Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass)); /* 234 */
+ void (*tk_PostscriptPath) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, double * coordPtr, int numPoints)); /* 235 */
+ int (*tk_PostscriptStipple) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap)); /* 236 */
+ double (*tk_PostscriptY) _ANSI_ARGS_((double y, Tk_PostscriptInfo psInfo)); /* 237 */
} TkStubs;
#ifdef __cplusplus
@@ -1870,6 +1953,80 @@ extern TkStubs *tkStubsPtr;
#define Tk_CreateSmoothMethod \
(tkStubsPtr->tk_CreateSmoothMethod) /* 217 */
#endif
+/* Slot 218 is reserved */
+/* Slot 219 is reserved */
+#ifndef Tk_GetDash
+#define Tk_GetDash \
+ (tkStubsPtr->tk_GetDash) /* 220 */
+#endif
+#ifndef Tk_CreateOutline
+#define Tk_CreateOutline \
+ (tkStubsPtr->tk_CreateOutline) /* 221 */
+#endif
+#ifndef Tk_DeleteOutline
+#define Tk_DeleteOutline \
+ (tkStubsPtr->tk_DeleteOutline) /* 222 */
+#endif
+#ifndef Tk_ConfigOutlineGC
+#define Tk_ConfigOutlineGC \
+ (tkStubsPtr->tk_ConfigOutlineGC) /* 223 */
+#endif
+#ifndef Tk_ChangeOutlineGC
+#define Tk_ChangeOutlineGC \
+ (tkStubsPtr->tk_ChangeOutlineGC) /* 224 */
+#endif
+#ifndef Tk_ResetOutlineGC
+#define Tk_ResetOutlineGC \
+ (tkStubsPtr->tk_ResetOutlineGC) /* 225 */
+#endif
+#ifndef Tk_CanvasPsOutline
+#define Tk_CanvasPsOutline \
+ (tkStubsPtr->tk_CanvasPsOutline) /* 226 */
+#endif
+#ifndef Tk_SetTSOrigin
+#define Tk_SetTSOrigin \
+ (tkStubsPtr->tk_SetTSOrigin) /* 227 */
+#endif
+#ifndef Tk_CanvasGetCoordFromObj
+#define Tk_CanvasGetCoordFromObj \
+ (tkStubsPtr->tk_CanvasGetCoordFromObj) /* 228 */
+#endif
+#ifndef Tk_CanvasSetOffset
+#define Tk_CanvasSetOffset \
+ (tkStubsPtr->tk_CanvasSetOffset) /* 229 */
+#endif
+#ifndef Tk_DitherPhoto
+#define Tk_DitherPhoto \
+ (tkStubsPtr->tk_DitherPhoto) /* 230 */
+#endif
+#ifndef Tk_PostscriptBitmap
+#define Tk_PostscriptBitmap \
+ (tkStubsPtr->tk_PostscriptBitmap) /* 231 */
+#endif
+#ifndef Tk_PostscriptColor
+#define Tk_PostscriptColor \
+ (tkStubsPtr->tk_PostscriptColor) /* 232 */
+#endif
+#ifndef Tk_PostscriptFont
+#define Tk_PostscriptFont \
+ (tkStubsPtr->tk_PostscriptFont) /* 233 */
+#endif
+#ifndef Tk_PostscriptImage
+#define Tk_PostscriptImage \
+ (tkStubsPtr->tk_PostscriptImage) /* 234 */
+#endif
+#ifndef Tk_PostscriptPath
+#define Tk_PostscriptPath \
+ (tkStubsPtr->tk_PostscriptPath) /* 235 */
+#endif
+#ifndef Tk_PostscriptStipple
+#define Tk_PostscriptStipple \
+ (tkStubsPtr->tk_PostscriptStipple) /* 236 */
+#endif
+#ifndef Tk_PostscriptY
+#define Tk_PostscriptY \
+ (tkStubsPtr->tk_PostscriptY) /* 237 */
+#endif
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 87a90c7..e3a4085 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -29,7 +29,7 @@
* | provided "as is" without express or implied warranty. |
* +-------------------------------------------------------------------+
*
- * RCS: @(#) $Id: tkImgGIF.c,v 1.10 2000/01/27 16:58:42 ericm Exp $
+ * RCS: @(#) $Id: tkImgGIF.c,v 1.11 2000/02/08 11:31:33 hobbs Exp $
*/
/*
@@ -78,11 +78,11 @@ static Tcl_ThreadDataKey dataKey;
* The format record for the GIF file format:
*/
-static int FileMatchGIF _ANSI_ARGS_((Tcl_Channel chan, char *fileName,
+static int FileMatchGIF _ANSI_ARGS_((Tcl_Channel chan, CONST char *fileName,
Tcl_Obj *format, int *widthPtr, int *heightPtr,
Tcl_Interp *interp));
static int FileReadGIF _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Channel chan, char *fileName, Tcl_Obj *format,
+ Tcl_Channel chan, CONST char *fileName, Tcl_Obj *format,
Tk_PhotoHandle imageHandle, int destX, int destY,
int width, int height, int srcX, int srcY));
static int StringMatchGIF _ANSI_ARGS_(( Tcl_Obj *dataObj,
@@ -93,14 +93,14 @@ static int StringReadGIF _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *dataObj,
int destX, int destY, int width, int height,
int srcX, int srcY));
static int FileWriteGIF _ANSI_ARGS_((Tcl_Interp *interp,
- char *filename, Tcl_Obj *format,
+ CONST char *filename, Tcl_Obj *format,
Tk_PhotoImageBlock *blockPtr));
static int CommonWriteGIF _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Channel handle, Tcl_Obj *format,
Tk_PhotoImageBlock *blockPtr));
Tk_PhotoImageFormat tkImgFmtGIF = {
- "GIF", /* name */
+ "gif", /* name */
FileMatchGIF, /* fileMatchProc */
StringMatchGIF, /* stringMatchProc */
FileReadGIF, /* fileReadProc */
@@ -177,7 +177,7 @@ static void mInit _ANSI_ARGS_((unsigned char *string,
static int
FileMatchGIF(chan, fileName, format, widthPtr, heightPtr, interp)
Tcl_Channel chan; /* The image file, open for reading. */
- char *fileName; /* The name of the image file. */
+ CONST char *fileName; /* The name of the image file. */
Tcl_Obj *format; /* User-specified format object, or NULL. */
int *widthPtr, *heightPtr; /* The dimensions of the image are
* returned here if the file is a valid
@@ -212,7 +212,7 @@ FileReadGIF(interp, chan, fileName, format, imageHandle, destX, destY,
width, height, srcX, srcY)
Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
Tcl_Channel chan; /* The image file, open for reading. */
- char *fileName; /* The name of the image file. */
+ CONST char *fileName; /* The name of the image file. */
Tcl_Obj *format; /* User-specified format object, or NULL. */
Tk_PhotoHandle imageHandle; /* The photo image to write into. */
int destX, destY; /* Coordinates of top-left pixel in
@@ -1323,14 +1323,14 @@ static int no_bits _ANSI_ARGS_((int colors));
static int
FileWriteGIF (interp, filename, format, blockPtr)
Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- char *filename;
+ CONST char *filename;
Tcl_Obj *format;
Tk_PhotoImageBlock *blockPtr;
{
Tcl_Channel chan = NULL;
int result;
- chan = Tcl_OpenFileChannel(interp, filename, "w", 0644);
+ chan = Tcl_OpenFileChannel(interp, (char *) filename, "w", 0644);
if (!chan) {
return TCL_ERROR;
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 33fc954..9b2519a 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -15,7 +15,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.16 2000/01/31 18:38:26 ericm Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.17 2000/02/08 11:31:33 hobbs Exp $
*/
#include "tkInt.h"
@@ -371,7 +371,7 @@ static void ImgPhotoSetSize _ANSI_ARGS_((PhotoMaster *masterPtr,
static void ImgPhotoInstanceSetSize _ANSI_ARGS_((
PhotoInstance *instancePtr));
static int ImgStringWrite _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_DString *dataPtr, Tcl_Obj *formatString,
+ Tcl_Obj *formatString,
Tk_PhotoImageBlock *blockPtr));
static char * ImgGetPhoto _ANSI_ARGS_((PhotoMaster *masterPtr,
Tk_PhotoImageBlock *blockPtr,
@@ -462,8 +462,13 @@ Tk_CreatePhotoImageFormat(formatPtr)
*copyPtr = *formatPtr;
copyPtr->name = (char *) ckalloc((unsigned) (strlen(formatPtr->name) + 1));
strcpy(copyPtr->name, formatPtr->name);
- copyPtr->nextPtr = tsdPtr->formatList;
- tsdPtr->formatList = copyPtr;
+ if (isupper((unsigned char) *formatPtr->name)) {
+ copyPtr->nextPtr = tsdPtr->oldFormatList;
+ tsdPtr->oldFormatList = copyPtr;
+ } else {
+ copyPtr->nextPtr = tsdPtr->formatList;
+ tsdPtr->formatList = copyPtr;
+ }
}
/*
@@ -796,9 +801,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
break;
}
case PHOTO_DATA: {
- Tcl_DString buffer;
char *data;
- Tcl_Obj *formatObj;
/*
* photo data command - first parse and check any options given.
@@ -854,19 +857,6 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
}
if (stringWriteProc == NULL) {
- oldformat = 1;
- for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
- imageFormat = imageFormat->nextPtr) {
- if ((strncasecmp(Tcl_GetString(options.format),
- imageFormat->name, strlen(imageFormat->name)) == 0)) {
- if (imageFormat->stringWriteProc != NULL) {
- stringWriteProc = imageFormat->stringWriteProc;
- break;
- }
- }
- }
- }
- if (stringWriteProc == NULL) {
Tcl_AppendResult(interp, "image string format \"",
Tcl_GetString(options.format),
"\" is not supported", (char *) NULL);
@@ -882,25 +872,16 @@ ImgPhotoCmd(clientData, interp, objc, objv)
*/
data = ImgGetPhoto(masterPtr, &block, &options);
- Tcl_DStringInit(&buffer);
- formatObj = options.format;
- if (oldformat && formatObj) {
- formatObj = (Tcl_Obj *) Tcl_GetString(options.format);
- }
- result = stringWriteProc(interp, &buffer,
- formatObj, &block);
+ result = ((int (*) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *formatString,
+ Tk_PhotoImageBlock *blockPtr, VOID *dummy))) stringWriteProc)
+ (interp, options.format, &block, (VOID *) NULL);
if (options.background) {
Tk_FreeColor(options.background);
}
if (data) {
ckfree(data);
}
- if (result == TCL_OK) {
- Tcl_DStringResult(interp, &buffer);
- } else {
- Tcl_DStringFree(&buffer);
- }
return result;
break;
}
@@ -4908,9 +4889,8 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
*/
static int
-ImgStringWrite(interp, dataPtr, formatString, blockPtr)
+ImgStringWrite(interp, formatString, blockPtr)
Tcl_Interp *interp;
- Tcl_DString *dataPtr;
Tcl_Obj *formatString;
Tk_PhotoImageBlock *blockPtr;
{
@@ -4918,10 +4898,12 @@ ImgStringWrite(interp, dataPtr, formatString, blockPtr)
char *line, *linePtr;
unsigned char *pixelPtr;
int greenOffset, blueOffset;
+ Tcl_DString data;
greenOffset = blockPtr->offset[1] - blockPtr->offset[0];
blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
+ Tcl_DStringInit(&data);
if ((blockPtr->width > 0) && (blockPtr->height > 0)) {
line = (char *) ckalloc((unsigned int) ((8 * blockPtr->width) + 2));
for (row=0; row<blockPtr->height; row++) {
@@ -4934,10 +4916,11 @@ ImgStringWrite(interp, dataPtr, formatString, blockPtr)
pixelPtr += blockPtr->pixelSize;
linePtr += 8;
}
- Tcl_DStringAppendElement(dataPtr, line+1);
+ Tcl_DStringAppendElement(&data, line+1);
}
ckfree (line);
}
+ Tcl_DStringResult(interp, &data);
return TCL_OK;
}
diff --git a/generic/tkStubImg.c b/generic/tkStubImg.c
new file mode 100644
index 0000000..7e1e23f
--- /dev/null
+++ b/generic/tkStubImg.c
@@ -0,0 +1,74 @@
+/*
+ * tkStubImg.c --
+ *
+ * Stub object that will be statically linked into extensions that wish
+ * to access Tk.
+ *
+ * Copyright (c) 1999 Jan Nijtmans.
+ * Copyright (c) 1998-1999 by Scriptics Corporation.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * RCS: @(#) $Id: tkStubImg.c,v 1.1 2000/02/08 11:31:33 hobbs Exp $
+ */
+
+#include "tcl.h"
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_InitImageArgs --
+ *
+ * Performs the necessary conversion from Tcl_Obj's to strings
+ * in the createProc for Tcl_CreateImageType. If running under
+ * Tk 8.2 or earlier without the Img-patch, this function has
+ * no effect.
+ *
+ * Results:
+ * argvPtr will point to an argument list which is guaranteed to
+ * contain strings, no matter what Tk version is running.
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+#ifdef Tk_InitImageArgs
+#undef Tk_InitImageArgs
+#endif
+
+void
+Tk_InitImageArgs(interp, argc, argvPtr)
+ Tcl_Interp *interp;
+ int argc;
+ char ***argvPtr;
+{
+ static useNewImage = -1;
+ static char **argv = NULL;
+
+ if (argv) {
+ tclStubsPtr->tcl_Free((char *) argv);
+ argv = NULL;
+ }
+
+ if (useNewImage < 0) {
+ Tcl_CmdInfo cmdInfo;
+ if (!tclStubsPtr->tcl_GetCommandInfo(interp,"image", &cmdInfo)) {
+ tclStubsPtr->tcl_Panic("cannot find the \"image\" command");
+ }
+ if (cmdInfo.isNativeObjectProc == 1) {
+ useNewImage = 1; /* Tk uses the new image interface */
+ }
+ }
+ if (useNewImage && (argc > 0)) {
+ int i;
+ argv = (char **) tclStubsPtr->tcl_Alloc(argc * sizeof(char *));
+ for (i = 0; i < argc; i++) {
+ argv[i] = tclStubsPtr->tcl_GetString((Tcl_Obj *)(*argvPtr)[i]);
+ }
+ *argvPtr = (char **) argv;
+ }
+}
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 38f47e5..c1f2607 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkStubInit.c,v 1.15 2000/01/12 11:45:03 hobbs Exp $
+ * RCS: @(#) $Id: tkStubInit.c,v 1.16 2000/02/08 11:31:33 hobbs Exp $
*/
#include "tkInt.h"
@@ -919,6 +919,26 @@ TkStubs tkStubs = {
Tk_InitConsoleChannels, /* 215 */
Tk_CreateConsoleWindow, /* 216 */
Tk_CreateSmoothMethod, /* 217 */
+ NULL, /* 218 */
+ NULL, /* 219 */
+ Tk_GetDash, /* 220 */
+ Tk_CreateOutline, /* 221 */
+ Tk_DeleteOutline, /* 222 */
+ Tk_ConfigOutlineGC, /* 223 */
+ Tk_ChangeOutlineGC, /* 224 */
+ Tk_ResetOutlineGC, /* 225 */
+ Tk_CanvasPsOutline, /* 226 */
+ Tk_SetTSOrigin, /* 227 */
+ Tk_CanvasGetCoordFromObj, /* 228 */
+ Tk_CanvasSetOffset, /* 229 */
+ Tk_DitherPhoto, /* 230 */
+ Tk_PostscriptBitmap, /* 231 */
+ Tk_PostscriptColor, /* 232 */
+ Tk_PostscriptFont, /* 233 */
+ Tk_PostscriptImage, /* 234 */
+ Tk_PostscriptPath, /* 235 */
+ Tk_PostscriptStipple, /* 236 */
+ Tk_PostscriptY, /* 237 */
};
/* !END!: Do not edit above this line. */
diff --git a/generic/tkTest.c b/generic/tkTest.c
index d1c23bf..755bc1b 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -13,9 +13,13 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTest.c,v 1.9 1999/12/14 06:52:31 hobbs Exp $
+ * RCS: @(#) $Id: tkTest.c,v 1.10 2000/02/08 11:31:34 hobbs Exp $
*/
+#ifdef MAC_TCL
+#define USE_OLD_IMAGE
+#endif
+
#include "tkInt.h"
#include "tkPort.h"
#include "tkText.h"
@@ -61,10 +65,17 @@ typedef struct TImageInstance {
* The type record for test images:
*/
+#ifdef USE_OLD_IMAGE
+static int ImageCreate _ANSI_ARGS_((Tcl_Interp *interp,
+ char *name, int argc, char **argv,
+ Tk_ImageType *typePtr, Tk_ImageMaster master,
+ ClientData *clientDataPtr));
+#else
static int ImageCreate _ANSI_ARGS_((Tcl_Interp *interp,
char *name, int argc, Tcl_Obj *CONST objv[],
Tk_ImageType *typePtr, Tk_ImageMaster master,
ClientData *clientDataPtr));
+#endif
static ClientData ImageGet _ANSI_ARGS_((Tk_Window tkwin,
ClientData clientData));
static void ImageDisplay _ANSI_ARGS_((ClientData clientData,
@@ -78,7 +89,7 @@ static void ImageDelete _ANSI_ARGS_((ClientData clientData));
static Tk_ImageType imageType = {
"test", /* name */
- ImageCreate, /* createProc */
+ (Tk_ImageCreateProc *) ImageCreate, /* createProc */
ImageGet, /* getProc */
ImageDisplay, /* displayProc */
ImageFree, /* freeProc */
@@ -1557,6 +1568,41 @@ TestfontObjCmd(clientData, interp, objc, objv)
*/
/* ARGSUSED */
+#ifdef USE_OLD_IMAGE
+static int
+ImageCreate(interp, name, argc, argv, typePtr, master, clientDataPtr)
+ Tcl_Interp *interp; /* Interpreter for application containing
+ * image. */
+ char *name; /* Name to use for image. */
+ int argc; /* Number of arguments. */
+ char **argv; /* Argument strings for options (doesn't
+ * include image name or type). */
+ Tk_ImageType *typePtr; /* Pointer to our type record (not used). */
+ Tk_ImageMaster master; /* Token for image, to be used by us in
+ * later callbacks. */
+ ClientData *clientDataPtr; /* Store manager's token for image here;
+ * it will be returned in later callbacks. */
+{
+ TImageMaster *timPtr;
+ char *varName;
+ int i;
+
+ Tk_InitImageArgs(interp, argc, &argv);
+ varName = "log";
+ for (i = 0; i < argc; i += 2) {
+ if (strcmp(argv[i], "-variable") != 0) {
+ Tcl_AppendResult(interp, "bad option name \"",
+ argv[i], "\"", (char *) NULL);
+ return TCL_ERROR;
+ }
+ if ((i+1) == argc) {
+ Tcl_AppendResult(interp, "no value given for \"",
+ argv[i], "\" option", (char *) NULL);
+ return TCL_ERROR;
+ }
+ varName = argv[i+1];
+ }
+#else
static int
ImageCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
Tcl_Interp *interp; /* Interpreter for application containing
@@ -1589,6 +1635,7 @@ ImageCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
}
varName = Tcl_GetString(objv[i+1]);
}
+#endif
timPtr = (TImageMaster *) ckalloc(sizeof(TImageMaster));
timPtr->master = master;
timPtr->interp = interp;
diff --git a/unix/Makefile.in b/unix/Makefile.in
index c960e85..5681a75 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -5,7 +5,7 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
-# RCS: @(#) $Id: Makefile.in,v 1.38 2000/01/16 05:33:08 hobbs Exp $
+# RCS: @(#) $Id: Makefile.in,v 1.39 2000/02/08 11:31:36 hobbs Exp $
# Current Tk version; used in various names.
@@ -270,7 +270,7 @@ UNIXOBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \
tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
tkUnixSend.o tkUnixWm.o tkUnixXId.o tkStubInit.o tkStubLib.o
-STUB_LIB_OBJS = tkStubLib.o
+STUB_LIB_OBJS = tkStubLib.o tkStubImg.o
OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkClipboard.o tkCmds.o \
tkColor.o tkConfig.o tkConsole.o tkCursor.o tkError.o tkEvent.o \
@@ -808,6 +808,9 @@ tkStubInit.o: $(GENERIC_DIR)/tkStubInit.c
tkStubLib.o: $(GENERIC_DIR)/tkStubLib.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubLib.c
+tkStubImg.o: $(GENERIC_DIR)/tkStubImg.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubImg.c
+
tkUnix.o: $(UNIX_DIR)/tkUnix.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnix.c
diff --git a/win/Makefile.in b/win/Makefile.in
index f0f412b..ab801f1 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -4,7 +4,7 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
-# RCS: @(#) $Id: Makefile.in,v 1.17 2000/02/01 11:41:43 hobbs Exp $
+# RCS: @(#) $Id: Makefile.in,v 1.18 2000/02/08 11:31:49 hobbs Exp $
TCLVERSION = @TCL_VERSION@
VERSION = @TK_VERSION@
@@ -331,7 +331,8 @@ TK_OBJS = \
tkWindow.$(OBJEXT)
STUB_OBJS = \
- tkStubLib.$(OBJEXT)
+ tkStubLib.$(OBJEXT) \
+ tkStubImg.$(OBJEXT)
TCL_DOCS = "$(TCL_SRC_DIR_NATIVE)"/../doc/*.[13n]
TK_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n]
diff --git a/win/makefile.vc b/win/makefile.vc
index f4ac608..254631e 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -4,7 +4,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
-# RCS: @(#) $Id: makefile.vc,v 1.30 1999/12/09 14:46:41 hobbs Exp $
+# RCS: @(#) $Id: makefile.vc,v 1.31 2000/02/08 11:31:49 hobbs Exp $
# Does not depend on the presence of any environment variables in
# order to compile tcl; all needed information is derived from
@@ -216,6 +216,7 @@ TKOBJS = \
$(TMPDIR)\tkWindow.obj
TKSTUBOBJS = $(TMPDIR)\tkStubLib.obj \
+ $(TMPDIR)\tkStubImg.obj
cc32 = "$(TOOLS32)\bin\cl.exe"