summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvPs.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkCanvPs.c')
-rw-r--r--generic/tkCanvPs.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index b87068d..4c99b15 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -6,12 +6,12 @@
* procedures used for generating Postscript.
*
* Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1996 Sun Microsystems, Inc.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvPs.c,v 1.4 1998/09/22 18:57:16 stanton Exp $
+ * RCS: @(#) $Id: tkCanvPs.c,v 1.5 1999/04/16 01:51:11 stanton Exp $
*/
#include "tkInt.h"
@@ -115,6 +115,7 @@ static Tk_ConfigSpec configSpecs[] = {
* The prolog data. Generated by str2c from prolog.ps
* This was split in small chunks by str2c because
* some C compiler have limitations on the size of static strings.
+ * (str2c is a small tcl script in tcl's tool directory (source release))
*/
static CONST char * CONST prolog[]= {
/* Start of part 1 (2000 characters) */
@@ -123,7 +124,7 @@ static CONST char * CONST prolog[]= {
\n\
% This is a standard prolog for Postscript generated by Tk's canvas\n\
% widget.\n\
-% RCS: @(#) $Id: tkCanvPs.c,v 1.4 1998/09/22 18:57:16 stanton Exp $\n\
+% RCS: @(#) $Id: tkCanvPs.c,v 1.5 1999/04/16 01:51:11 stanton Exp $\n\
\n\
% The definitions below just define all of the variables used in\n\
% any of the procedures here. This is needed for obscure reasons\n\
@@ -710,20 +711,20 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
Tcl_AppendResult(canvasPtr->interp, "%!PS-Adobe-3.0 EPSF-3.0\n",
"%%Creator: Tk Canvas Widget\n", (char *) NULL);
-#if !(defined(__WIN32__) || defined(MAC_TCL))
+#ifdef HAVE_PW_GECOS
if (!Tcl_IsSafe(interp)) {
- struct passwd *pwPtr = getpwuid(getuid());
+ struct passwd *pwPtr = getpwuid(getuid()); /* INTL: Native. */
Tcl_AppendResult(canvasPtr->interp, "%%For: ",
(pwPtr != NULL) ? pwPtr->pw_gecos : "Unknown", "\n",
(char *) NULL);
endpwent();
}
-#endif /* __WIN32__ || MAC_TCL */
+#endif /* HAVE_PW_GECOS */
Tcl_AppendResult(canvasPtr->interp, "%%Title: Window ",
Tk_PathName(canvasPtr->tkwin), "\n", (char *) NULL);
time(&now);
Tcl_AppendResult(canvasPtr->interp, "%%CreationDate: ",
- ctime(&now), (char *) NULL);
+ ctime(&now), (char *) NULL); /* INTL: Native. */
if (!psInfo.rotate) {
sprintf(string, "%d %d %d %d",
(int) (psInfo.pageX + psInfo.scale*deltaX),
@@ -764,7 +765,7 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
}
if (psInfo.chan != NULL) {
- Tcl_Write(psInfo.chan, canvasPtr->interp->result, -1);
+ Tcl_Write(psInfo.chan, Tcl_GetStringResult(canvasPtr->interp), -1);
Tcl_ResetResult(canvasPtr->interp);
}
@@ -811,7 +812,7 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
Tcl_AppendResult(canvasPtr->interp, string,
" lineto closepath clip newpath\n", (char *) NULL);
if (psInfo.chan != NULL) {
- Tcl_Write(psInfo.chan, canvasPtr->interp->result, -1);
+ Tcl_Write(psInfo.chan, Tcl_GetStringResult(canvasPtr->interp), -1);
Tcl_ResetResult(canvasPtr->interp);
}
@@ -836,7 +837,7 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
result = (*itemPtr->typePtr->postscriptProc)(canvasPtr->interp,
(Tk_Canvas) canvasPtr, itemPtr, 0);
if (result != TCL_OK) {
- char msg[100];
+ char msg[64 + TCL_INTEGER_SPACE];
sprintf(msg, "\n (generating Postscript for item %d)",
itemPtr->id);
@@ -845,7 +846,7 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
}
Tcl_AppendResult(canvasPtr->interp, "grestore\n", (char *) NULL);
if (psInfo.chan != NULL) {
- Tcl_Write(psInfo.chan, canvasPtr->interp->result, -1);
+ Tcl_Write(psInfo.chan, Tcl_GetStringResult(canvasPtr->interp), -1);
Tcl_ResetResult(canvasPtr->interp);
}
}
@@ -860,7 +861,7 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
Tcl_AppendResult(canvasPtr->interp, "restore showpage\n\n",
"%%Trailer\nend\n%%EOF\n", (char *) NULL);
if (psInfo.chan != NULL) {
- Tcl_Write(psInfo.chan, canvasPtr->interp->result, -1);
+ Tcl_Write(psInfo.chan, Tcl_GetStringResult(canvasPtr->interp), -1);
Tcl_ResetResult(canvasPtr->interp);
}
@@ -916,9 +917,9 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
*
* Results:
* Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
+ * then an error message will be left in the interp's result.
* If no error occurs, then additional Postscript will be
- * appended to interp->result.
+ * appended to the interp's result.
*
* Side effects:
* None.
@@ -997,9 +998,9 @@ Tk_CanvasPsColor(interp, canvas, colorPtr)
*
* Results:
* Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
+ * then an error message will be left in the interp's result.
* If no error occurs, then additional Postscript will be
- * appended to the interp->result.
+ * appended to the interp's result.
*
* Side effects:
* The Postscript font name is entered into psInfoPtr->fontTable
@@ -1019,7 +1020,7 @@ Tk_CanvasPsFont(interp, canvas, tkfont)
TkCanvas *canvasPtr = (TkCanvas *) canvas;
TkPostscriptInfo *psInfoPtr = canvasPtr->psInfoPtr;
char *end;
- char pointString[20];
+ char pointString[TCL_INTEGER_SPACE];
Tcl_DString ds;
int i, points;
@@ -1091,9 +1092,9 @@ Tk_CanvasPsFont(interp, canvas, tkfont)
*
* Results:
* Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
+ * then an error message will be left in the interp's result.
* If no error occurs, then additional Postscript will be
- * appended to interp->result.
+ * appended to the interp's result.
*
* Side effects:
* None.
@@ -1190,9 +1191,9 @@ Tk_CanvasPsBitmap(interp, canvas, bitmap, startX, startY, width, height)
*
* Results:
* Returns a standard Tcl return value. If an error occurs
- * then an error message will be left in interp->result.
+ * then an error message will be left in the interp's result.
* If no error occurs, then additional Postscript will be
- * appended to interp->result.
+ * appended to the interp's result.
*
* Side effects:
* None.
@@ -1210,7 +1211,7 @@ Tk_CanvasPsStipple(interp, canvas, bitmap)
TkCanvas *canvasPtr = (TkCanvas *) canvas;
TkPostscriptInfo *psInfoPtr = canvasPtr->psInfoPtr;
int width, height;
- char string[100];
+ char string[TCL_INTEGER_SPACE * 2];
Window dummyRoot;
int dummyX, dummyY;
unsigned dummyBorderwidth, dummyDepth;
@@ -1278,7 +1279,7 @@ Tk_CanvasPsY(canvas, y)
* commands to create the path.
*
* Results:
- * Postscript commands get appended to what's in interp->result.
+ * Postscript commands get appended to what's in the interp's result.
*
* Side effects:
* None.
@@ -1327,7 +1328,7 @@ Tk_CanvasPsPath(interp, canvas, coordPtr, numPoints)
* TCL_OK is returned, then everything went well and the
* screen distance is stored at *doublePtr; otherwise
* TCL_ERROR is returned and an error message is left in
- * interp->result.
+ * the interp's result.
*
* Side effects:
* None.