From 7197c411833270db8466f36aef43f0c983261f19 Mon Sep 17 00:00:00 2001 From: ellson Date: Wed, 23 Feb 2005 18:58:13 +0000 Subject: [PATCH] various "64bit" fixes (mostly templates) excluding introduction of varargs Andreas Gruenbacher --- tclpkg/gdtclft/gdtclft.c | 51 ++++++++++++++++++++++++------ tclpkg/tcldot/tcldot.c | 2 +- tclpkg/tclpathplan/find_ints.c | 9 +++--- tclpkg/tkspline/tkspline.c | 2 +- windows/cmd/lefty/dot2l/dotparse.c | 2 +- 5 files changed, 49 insertions(+), 17 deletions(-) diff --git a/tclpkg/gdtclft/gdtclft.c b/tclpkg/gdtclft/gdtclft.c index 216e59a20..49ac2dea7 100644 --- a/tclpkg/gdtclft/gdtclft.c +++ b/tclpkg/gdtclft/gdtclft.c @@ -39,24 +39,55 @@ typedef struct { tblHeader_pt handleTbl; } GdData; -static int tclGdCreateCmd(), tclGdDestroyCmd(), tclGdWriteCmd(), -tclGdColorCmd(), tclGdInterlaceCmd(), tclGdSetCmd(), tclGdLineCmd(), -tclGdRectCmd(), tclGdArcCmd(), tclGdFillCmd(), tclGdSizeCmd(), -tclGdTextCmd(), tclGdCopyCmd(), tclGdGetCmd(), -tclGdBrushCmd(), tclGdStyleCmd(), tclGdTileCmd(), tclGdPolygonCmd(), -tclGdColorNewCmd(), tclGdColorExactCmd(), tclGdColorClosestCmd(), -tclGdColorResolveCmd(), tclGdColorFreeCmd(), tclGdColorTranspCmd(), -tclGdColorGetCmd(), tclGdWriteBufCmd(); +typedef int (CmdFunc)(Tcl_Interp *, GdData *, int, Tcl_Obj *CONST []); +typedef int (ColCmdFunc)(Tcl_Interp *, gdImagePtr, int, int[]); + +static CmdFunc tclGdCreateCmd; +static CmdFunc tclGdDestroyCmd; +static CmdFunc tclGdWriteCmd; +static CmdFunc tclGdColorCmd; +static CmdFunc tclGdInterlaceCmd; +static CmdFunc tclGdSetCmd; +static CmdFunc tclGdLineCmd; +static CmdFunc tclGdRectCmd; +static CmdFunc tclGdArcCmd; +static CmdFunc tclGdFillCmd; +static CmdFunc tclGdSizeCmd; +static CmdFunc tclGdTextCmd; +static CmdFunc tclGdCopyCmd; +static CmdFunc tclGdGetCmd; +static CmdFunc tclGdBrushCmd; +static CmdFunc tclGdStyleCmd; +static CmdFunc tclGdTileCmd; +static CmdFunc tclGdPolygonCmd; +static CmdFunc tclGdWriteBufCmd; + +static ColCmdFunc tclGdColorNewCmd; +static ColCmdFunc tclGdColorExactCmd; +static ColCmdFunc tclGdColorClosestCmd; +static ColCmdFunc tclGdColorResolveCmd; +static ColCmdFunc tclGdColorFreeCmd; +static ColCmdFunc tclGdColorTranspCmd; +static ColCmdFunc tclGdColorGetCmd; typedef struct { char *cmd; - int (*f) (); + CmdFunc *f; int minargs, maxargs; int subcmds; int ishandle; char *usage; } cmdOptions; +typedef struct { + char *cmd; + ColCmdFunc *f; + int minargs, maxargs; + int subcmds; + int ishandle; + char *usage; +} colCmdOptions; + typedef struct { char *buf; int buflen; @@ -183,7 +214,7 @@ static cmdOptions subcmdVec[] = { "gdhandle"}, }; -static cmdOptions colorCmdVec[] = { +static colCmdOptions colorCmdVec[] = { {"new", tclGdColorNewCmd, 5, 5, 1, 1, "gdhandle red green blue"}, {"exact", tclGdColorExactCmd, 5, 5, 1, 1, diff --git a/tclpkg/tcldot/tcldot.c b/tclpkg/tcldot/tcldot.c index 882279d97..7b086b588 100644 --- a/tclpkg/tcldot/tcldot.c +++ b/tclpkg/tcldot/tcldot.c @@ -66,7 +66,7 @@ extern int Output_lang; #endif #endif extern void *GDHandleTable; -extern int Gdtclft_Init(); +extern int Gdtclft_Init(Tcl_Interp *); static void *graphTblPtr, *nodeTblPtr, *edgeTblPtr; static tkgendata_t tkgendata; diff --git a/tclpkg/tclpathplan/find_ints.c b/tclpkg/tclpathplan/find_ints.c index 02be66622..caed5d490 100644 --- a/tclpkg/tclpathplan/find_ints.c +++ b/tclpkg/tclpathplan/find_ints.c @@ -20,6 +20,7 @@ void find_intersection(struct vertex *l, struct vertex *m, struct intersection ilist[], struct data *input); +static int gt(struct vertex **i, struct vertex **j); void find_ints(vertex_list, polygon_list, input, ilist) struct vertex vertex_list[]; @@ -27,7 +28,7 @@ struct polygon polygon_list[]; struct data *input; struct intersection ilist[]; { - int i, j, k, gt(); + int i, j, k; struct active_edge_list all; struct active_edge *new, *tempa; struct vertex *pt1, *pt2, *templ, **pvertex; @@ -44,7 +45,8 @@ struct intersection ilist[]; pvertex[i] = vertex_list + i; /* sort vertices by x coordinate */ - qsort(pvertex, input->nvertices, sizeof(struct vertex *), gt); + qsort(pvertex, input->nvertices, sizeof(struct vertex *), + (int (*)(const void *, const void *))gt); /* walk through the vertices in order of increasing x coordinate */ for (i = 0; i < input->nvertices; i++) { @@ -111,8 +113,7 @@ struct intersection ilist[]; } /* end i for loop */ } -int gt(i, j) -struct vertex **i, **j; +static int gt(struct vertex **i, struct vertex **j) { /* i > j if i.x > j.x or i.x = j.x and i.y > j.y */ double t; if ((t = (*i)->pos.x - (*j)->pos.x) != 0.) diff --git a/tclpkg/tkspline/tkspline.c b/tclpkg/tkspline/tkspline.c index e0949cb1e..1fc30ae1d 100644 --- a/tclpkg/tkspline/tkspline.c +++ b/tclpkg/tkspline/tkspline.c @@ -184,7 +184,7 @@ int numSteps; /* Not Used */ /* if the number of points is invalid, use the old function */ if ((numPoints < 4) || (numPoints % 3 != 1)) { -#if (TK_MAJOR_VERSION < 8) || ((TK_MAJOR_VERSION == 8) && (TK_MAJOR_VERSION < 3)) +#if (TK_MAJOR_VERSION < 8) || ((TK_MAJOR_VERSION == 8) && (TK_MINOR_VERSION < 3)) TkMakeBezierPostscript(interp, canvas, pointPtr, numPoints, numSteps); #else diff --git a/windows/cmd/lefty/dot2l/dotparse.c b/windows/cmd/lefty/dot2l/dotparse.c index 883675c60..dea835695 100644 --- a/windows/cmd/lefty/dot2l/dotparse.c +++ b/windows/cmd/lefty/dot2l/dotparse.c @@ -94,7 +94,7 @@ typedef void *Tobj; static char portstr[SMALLBUF]; -extern void yyerror(char *); +extern void yyerror(const char *fmt, ...); /* Enabling traces. */ -- 2.40.0