graphics: convert K&R function definitions to ANSI C

Convert the old-style (K&R) function definitions in graphics/ to ANSI C
prototypes, formatted in the project's convention: the return type on its
own line and each parameter on its own line, indented four spaces, with
the original parameter comments retained.

Adds a forward typedef for TileType in graphics.h so the GrClipTriangle
prototype can name it without creating a circular include with the
database layer.

Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Andreas Wendleder 2026-06-10 03:48:52 +02:00
parent da2438e5cf
commit 4f8c244876
No known key found for this signature in database
GPG Key ID: 588785BFDFB01ABD
27 changed files with 851 additions and 744 deletions

View File

@ -84,16 +84,16 @@ bool W3Ddelete();
/* ------------------------Low-Level Routines--------------------------------- */ /* ------------------------Low-Level Routines--------------------------------- */
void void
w3dLock(w) w3dLock(
MagWindow *w; MagWindow *w)
{ {
grSimpleLock(w, TRUE); grSimpleLock(w, TRUE);
w3dSetProjection(w); w3dSetProjection(w);
} }
void void
w3dUnlock(w) w3dUnlock(
MagWindow *w; MagWindow *w)
{ {
glFlush(); glFlush();
glFinish(); glFinish();
@ -111,11 +111,11 @@ w3dUnlock(w)
/* -------------------Low-Level Drawing Routines------------------------------ */ /* -------------------Low-Level Drawing Routines------------------------------ */
void void
w3dFillEdge(bbox, r, ztop, zbot) w3dFillEdge(
Rect *bbox; /* tile bounding box */ Rect *bbox, /* tile bounding box */
Rect *r; Rect *r,
float ztop; float ztop,
float zbot; float zbot)
{ {
float ztmp; float ztmp;
float xbot = (float)r->r_xbot; float xbot = (float)r->r_xbot;
@ -142,11 +142,11 @@ w3dFillEdge(bbox, r, ztop, zbot)
} }
void void
w3dFillPolygon(p, np, zval, istop) w3dFillPolygon(
Point *p; Point *p,
int np; int np,
float zval; float zval,
bool istop; bool istop)
{ {
int i; int i;
@ -162,10 +162,10 @@ w3dFillPolygon(p, np, zval, istop)
} }
void void
w3dFillTile(r, zval, istop) w3dFillTile(
Rect *r; Rect *r,
float zval; float zval,
bool istop; bool istop)
{ {
float xbot, ybot, xtop, ytop; float xbot, ybot, xtop, ytop;
@ -192,8 +192,12 @@ w3dFillTile(r, zval, istop)
} }
void void
w3dFillXSide(xstart, xend, yval, ztop, zbot) w3dFillXSide(
float xstart, xend, yval, ztop, zbot; float xstart,
float xend,
float yval,
float ztop,
float zbot)
{ {
glBegin(GL_POLYGON); glBegin(GL_POLYGON);
glVertex3f(xstart, yval, zbot); glVertex3f(xstart, yval, zbot);
@ -204,8 +208,12 @@ w3dFillXSide(xstart, xend, yval, ztop, zbot)
} }
void void
w3dFillYSide(xval, ystart, yend, ztop, zbot) w3dFillYSide(
float xval, ystart, yend, ztop, zbot; float xval,
float ystart,
float yend,
float ztop,
float zbot)
{ {
glBegin(GL_POLYGON); glBegin(GL_POLYGON);
glVertex3f(xval, ystart, zbot); glVertex3f(xval, ystart, zbot);
@ -219,8 +227,13 @@ w3dFillYSide(xval, ystart, yend, ztop, zbot)
/* counterclockwise direction with respect to the tile interior. */ /* counterclockwise direction with respect to the tile interior. */
void void
w3dFillDiagonal(x1, y1, x2, y2, ztop, zbot) w3dFillDiagonal(
float x1, y1, x2, y2, ztop, zbot; float x1,
float y1,
float x2,
float y2,
float ztop,
float zbot)
{ {
glBegin(GL_POLYGON); glBegin(GL_POLYGON);
glVertex3f(x1, y1, zbot); glVertex3f(x1, y1, zbot);
@ -231,13 +244,13 @@ w3dFillDiagonal(x1, y1, x2, y2, ztop, zbot)
} }
void void
w3dFillOps(trans, tile, dinfo, cliprect, ztop, zbot) w3dFillOps(
Transform *trans; Transform *trans,
Tile *tile; Tile *tile,
TileType dinfo; TileType dinfo,
Rect *cliprect; Rect *cliprect,
float ztop; float ztop,
float zbot; float zbot)
{ {
LinkedRect *tilesegs, *segptr; LinkedRect *tilesegs, *segptr;
Rect r, r2; Rect r, r2;
@ -381,11 +394,11 @@ w3dFillOps(trans, tile, dinfo, cliprect, ztop, zbot)
} }
void void
w3dRenderVolume(tile, dinfo, trans, cliprect) w3dRenderVolume(
Tile *tile; Tile *tile,
TileType dinfo; TileType dinfo,
Transform *trans; Transform *trans,
Rect *cliprect; Rect *cliprect)
{ {
float zbot, ztop; float zbot, ztop;
float ftop = 0.0, fthk = 0.0; float ftop = 0.0, fthk = 0.0;
@ -413,11 +426,11 @@ w3dRenderVolume(tile, dinfo, trans, cliprect)
} }
void void
w3dRenderCIF(tile, dinfo, layer, trans) w3dRenderCIF(
Tile *tile; Tile *tile,
TileType dinfo; TileType dinfo,
CIFLayer *layer; CIFLayer *layer,
Transform *trans; Transform *trans)
{ {
float zbot, ztop; float zbot, ztop;
float ftop, fthk; float ftop, fthk;
@ -468,8 +481,8 @@ w3dClear()
/* -------------------High-Level Drawing Routines------------------------------ */ /* -------------------High-Level Drawing Routines------------------------------ */
void void
w3dSetProjection(w) w3dSetProjection(
MagWindow *w; MagWindow *w)
{ {
W3DclientRec *crec; W3DclientRec *crec;
Window wind; Window wind;
@ -546,10 +559,10 @@ w3dSetProjection(w)
/* Magic layer tile painting function */ /* Magic layer tile painting function */
int int
w3dPaintFunc(tile, dinfo, cxp) w3dPaintFunc(
Tile *tile; /* Tile to be displayed */ Tile *tile, /* Tile to be displayed */
TileType dinfo; /* Split tile information */ TileType dinfo, /* Split tile information */
TreeContext *cxp; /* From DBTreeSrTiles */ TreeContext *cxp) /* From DBTreeSrTiles */
{ {
SearchContext *scx = cxp->tc_scx; SearchContext *scx = cxp->tc_scx;
@ -593,10 +606,10 @@ w3dPaintFunc(tile, dinfo, cxp)
/* CIF layer tile painting function */ /* CIF layer tile painting function */
int int
w3dCIFPaintFunc(tile, dinfo, arg) w3dCIFPaintFunc(
Tile *tile; /* Tile to be displayed */ Tile *tile, /* Tile to be displayed */
TileType dinfo; /* Split tile information */ TileType dinfo, /* Split tile information */
ClientData *arg; /* is NULL */ ClientData *arg) /* is NULL */
{ {
CIFLayer *layer = (CIFLayer *)arg; CIFLayer *layer = (CIFLayer *)arg;
@ -648,9 +661,9 @@ w3dCIFPaintFunc(tile, dinfo, arg)
*/ */
void void
w3dHelp(w, cmd) w3dHelp(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
const char * const *msg; const char * const *msg;
W3DclientRec *crec = (W3DclientRec *) w->w_clientData; W3DclientRec *crec = (W3DclientRec *) w->w_clientData;
@ -679,9 +692,9 @@ w3dHelp(w, cmd)
*/ */
void void
w3dCutBox(w, cmd) w3dCutBox(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
bool hide = FALSE; bool hide = FALSE;
int lidx = 1, num_layers; int lidx = 1, num_layers;
@ -768,9 +781,9 @@ w3dCutBox(w, cmd)
*/ */
void void
w3dSeeLayers(w, cmd) w3dSeeLayers(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
bool hide = FALSE; bool hide = FALSE;
int lidx = 1, num_layers; int lidx = 1, num_layers;
@ -821,9 +834,9 @@ w3dSeeLayers(w, cmd)
*/ */
void void
w3dClose(w, cmd) w3dClose(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
W3DclientRec *crec = (W3DclientRec *) w->w_clientData; W3DclientRec *crec = (W3DclientRec *) w->w_clientData;
@ -844,9 +857,9 @@ w3dClose(w, cmd)
*/ */
void void
w3dRescale(crec, scalefactor) w3dRescale(
W3DclientRec *crec; W3DclientRec *crec,
float scalefactor; float scalefactor)
{ {
crec->scale_xy /= scalefactor; crec->scale_xy /= scalefactor;
crec->prescale_z /= scalefactor; crec->prescale_z /= scalefactor;
@ -867,9 +880,9 @@ w3dRescale(crec, scalefactor)
*/ */
void void
w3dToggleCIF(w, cmd) w3dToggleCIF(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
W3DclientRec *crec = (W3DclientRec *) w->w_clientData; W3DclientRec *crec = (W3DclientRec *) w->w_clientData;
@ -906,9 +919,9 @@ w3dToggleCIF(w, cmd)
*/ */
void void
w3dLevel(w, cmd) w3dLevel(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
W3DclientRec *crec = (W3DclientRec *) w->w_clientData; W3DclientRec *crec = (W3DclientRec *) w->w_clientData;
@ -946,8 +959,8 @@ w3dLevel(w, cmd)
*/ */
void void
w3drefreshFunc(mw) w3drefreshFunc(
MagWindow *mw; MagWindow *mw)
{ {
W3DclientRec *crec = (W3DclientRec *) mw->w_clientData; W3DclientRec *crec = (W3DclientRec *) mw->w_clientData;
Rect screenRect; Rect screenRect;
@ -972,9 +985,9 @@ w3drefreshFunc(mw)
*/ */
void void
w3dDefaults(w, cmd) w3dDefaults(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
W3DclientRec *crec = (W3DclientRec *) w->w_clientData; W3DclientRec *crec = (W3DclientRec *) w->w_clientData;
@ -998,9 +1011,9 @@ w3dDefaults(w, cmd)
*/ */
void void
w3dRefresh(w, cmd) w3dRefresh(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
W3DclientRec *crec = (W3DclientRec *) w->w_clientData; W3DclientRec *crec = (W3DclientRec *) w->w_clientData;
@ -1022,9 +1035,9 @@ w3dRefresh(w, cmd)
*/ */
void void
w3dView(w, cmd) w3dView(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
bool relative = FALSE; bool relative = FALSE;
int argc = cmd->tx_argc; int argc = cmd->tx_argc;
@ -1094,9 +1107,9 @@ w3dView(w, cmd)
*/ */
void void
w3dScroll(w, cmd) w3dScroll(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
bool relative = FALSE; bool relative = FALSE;
int argc = cmd->tx_argc; int argc = cmd->tx_argc;
@ -1167,9 +1180,9 @@ w3dScroll(w, cmd)
*/ */
void void
w3dZoom(w, cmd) w3dZoom(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
bool relative = FALSE; bool relative = FALSE;
int argc = cmd->tx_argc; int argc = cmd->tx_argc;
@ -1244,9 +1257,9 @@ w3dZoom(w, cmd)
*/ */
void void
w3dRenderValues(w, cmd) w3dRenderValues(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
int lidx; int lidx;
CIFLayer *layer; CIFLayer *layer;
@ -1329,9 +1342,9 @@ badusage:
*/ */
void void
Set3DDefaults(mw, crec) Set3DDefaults(
MagWindow *mw; MagWindow *mw,
W3DclientRec *crec; W3DclientRec *crec)
{ {
int height, width; int height, width;
int centerx, centery; int centerx, centery;
@ -1399,9 +1412,9 @@ Set3DDefaults(mw, crec)
*/ */
bool bool
W3DloadWindow(window, name) W3DloadWindow(
MagWindow *window; MagWindow *window,
char *name; char *name)
{ {
CellDef *newEditDef; CellDef *newEditDef;
CellUse *newEditUse; CellUse *newEditUse;
@ -1444,10 +1457,10 @@ W3DloadWindow(window, name)
*/ */
bool bool
W3Dcreate(window, argc, argv) W3Dcreate(
MagWindow *window; MagWindow *window,
int argc; int argc,
char *argv[]; char *argv[])
{ {
W3DclientRec *crec; W3DclientRec *crec;
Tk_Window tkwind, tktop; Tk_Window tkwind, tktop;
@ -1614,8 +1627,8 @@ W3Dcreate(window, argc, argv)
*/ */
bool bool
W3Ddelete(window) W3Ddelete(
MagWindow *window; MagWindow *window)
{ {
W3DclientRec *cr; W3DclientRec *cr;
Tk_Window xw; Tk_Window xw;
@ -1647,10 +1660,10 @@ W3Ddelete(window)
*/ */
void void
W3Dredisplay(w, rootArea, clipArea) W3Dredisplay(
MagWindow *w; /* The window containing the area. */ MagWindow *w, /* The window containing the area. */
Rect *rootArea; /* Ignore this---area defined by window with box */ Rect *rootArea, /* Ignore this---area defined by window with box */
Rect *clipArea; /* Ignore this, too */ Rect *clipArea) /* Ignore this, too */
{ {
W3DclientRec *crec; W3DclientRec *crec;
CellDef *cellDef; CellDef *cellDef;
@ -1724,10 +1737,10 @@ W3Dredisplay(w, rootArea, clipArea)
*/ */
void void
W3DCIFredisplay(w, rootArea, clipArea) W3DCIFredisplay(
MagWindow *w; /* The window containing the area. */ MagWindow *w, /* The window containing the area. */
Rect *rootArea; /* Ignore this---area defined by window with box */ Rect *rootArea, /* Ignore this---area defined by window with box */
Rect *clipArea; /* Ignore this, too */ Rect *clipArea) /* Ignore this, too */
{ {
W3DclientRec *crec; W3DclientRec *crec;
SearchContext scx; SearchContext scx;
@ -1801,9 +1814,9 @@ W3DCIFredisplay(w, rootArea, clipArea)
*/ */
void void
W3Dcommand(w, cmd) W3Dcommand(
MagWindow *w; MagWindow *w,
TxCommand *cmd; TxCommand *cmd)
{ {
int cmdNum; int cmdNum;

View File

@ -70,9 +70,9 @@ sigRetVal MapWindow();
#define TIMEOUT 10 /* timeout period (minutes) */ #define TIMEOUT 10 /* timeout period (minutes) */
int int
main (argc, argv) main(
int argc; int argc,
char **argv; char **argv)
{ {
XEvent xevent; XEvent xevent;
@ -126,8 +126,8 @@ main (argc, argv)
*/ */
void void
ParseEvent (event) ParseEvent(
XEvent *event; XEvent *event)
{ {
if (event->type == KeyPress) if (event->type == KeyPress)
{ {
@ -269,7 +269,8 @@ SetTimeOut()
*/ */
sigRetVal sigRetVal
TimeOut(int signo) TimeOut(
int signo)
{ {
int tmpid; int tmpid;
@ -293,7 +294,8 @@ TimeOut(int signo)
*/ */
sigRetVal sigRetVal
MapWindow(int signo) MapWindow(
int signo)
{ {
Window window; Window window;
@ -315,7 +317,9 @@ MapWindow(int signo)
*/ */
void void
sigSetAction(int signo, sigRetVal (*handler)(int)) sigSetAction(
int signo,
sigRetVal (*handler)(int))
{ {
#if defined(SYSV) || defined(CYGWIN) #if defined(SYSV) || defined(CYGWIN)
struct sigaction sa; struct sigaction sa;

View File

@ -102,11 +102,11 @@ GrResetCMap()
*/ */
bool bool
GrReadCMap(techStyle, dispType, monType, path, libPath) GrReadCMap(
char *techStyle; /* The type of dstyle file requested by char *techStyle, /* The type of dstyle file requested by
* the current technology. * the current technology.
*/ */
char *dispType; /* A class of color map files for one or char *dispType, /* A class of color map files for one or
* more display types. Usually this * more display types. Usually this
* is defaulted to NULL, in which case the * is defaulted to NULL, in which case the
* type required by the current driver is * type required by the current driver is
@ -115,11 +115,11 @@ char *dispType; /* A class of color map files for one or
* needed at all (it's a black-and-white * needed at all (it's a black-and-white
* display), so nothing is loaded. * display), so nothing is loaded.
*/ */
char *monType; /* The class of monitors being used. Usually char *monType, /* The class of monitors being used. Usually
* given as "std". * given as "std".
*/ */
char *path; /* a search path */ char *path, /* a search path */
char *libPath; /* a library search path */ char *libPath) /* a library search path */
{ {
int max, red, green, blue, newmax, argc, i; int max, red, green, blue, newmax, argc, i;
@ -244,21 +244,21 @@ cleanup:
*/ */
bool bool
GrSaveCMap(techStyle, dispType, monType, path, libPath) GrSaveCMap(
char *techStyle; /* The type of dstyle file requested by char *techStyle, /* The type of dstyle file requested by
* the current technology. * the current technology.
*/ */
char *dispType; /* A class of color map files for one or char *dispType, /* A class of color map files for one or
* more display types. Usually this * more display types. Usually this
* is defaulted to NULL, in which case the * is defaulted to NULL, in which case the
* type required by the current driver is * type required by the current driver is
* used. * used.
*/ */
char *monType; /* The class of monitors being used. Usually char *monType, /* The class of monitors being used. Usually
* given as "std". * given as "std".
*/ */
char *path; /* a search path */ char *path, /* a search path */
char *libPath; /* a library search path */ char *libPath) /* a library search path */
{ {
FILE *f; FILE *f;
@ -319,8 +319,8 @@ char *libPath; /* a library search path */
*/ */
int int
GrNameToColor(colorname) GrNameToColor(
char *colorname; char *colorname)
{ {
int i; int i;
colorEntry *ce; colorEntry *ce;
@ -351,9 +351,11 @@ GrNameToColor(colorname)
*/ */
bool bool
GrGetColor(color, red, green, blue) GrGetColor(
int color; /* Color to be read. */ int color, /* Color to be read. */
int *red, *green, *blue; /* Pointers to values of color elements. */ int *red,
int *green,
int *blue)
{ {
colorEntry *ce; colorEntry *ce;
@ -381,9 +383,11 @@ GrGetColor(color, red, green, blue)
*/ */
bool bool
GrPutColor(color, red, green, blue) GrPutColor(
int color; /* Color to be changed. */ int color, /* Color to be changed. */
int red, green, blue; /* New intensities for color. */ int red,
int green,
int blue)
{ {
colorEntry *ce; colorEntry *ce;
@ -425,15 +429,16 @@ GrPutColor(color, red, green, blue)
*/ */
void void
GrPutManyColors(color, red, green, blue, opaqueBit) GrPutManyColors(
int color; /* A specification of colors to be modified. */ int color, /* A specification of colors to be modified. */
int red, green, blue; /* New intensity values. */ int red,
int opaqueBit; /* The opaque/transparent bit. It is assumed int green,
int blue,
int opaqueBit) /* The opaque/transparent bit. It is assumed
* that the opaque layer colors or * that the opaque layer colors or
* transparent layer bits lie to the right * transparent layer bits lie to the right
* of the opaque/transparent bit. * of the opaque/transparent bit.
*/ */
{ {
int i; int i;
int mask = color; int mask = color;

View File

@ -39,7 +39,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
/* Forward declaration: */ /* Forward declaration: */
extern bool GrDisjoint(); extern bool GrDisjoint();
extern void GrClipTriangle(); extern void GrClipTriangle(Rect *r, Rect *c, bool clipped, TileType dinfo, Point *points, int *np);
/* The following rectangle defines the size of the cross drawn for /* The following rectangle defines the size of the cross drawn for
* zero-size rectangles. This must be all on one line to keep * zero-size rectangles. This must be all on one line to keep
@ -83,8 +83,8 @@ int grCurOutline, grCurFill, grCurColor;
bool grDriverInformed = TRUE; bool grDriverInformed = TRUE;
void void
GrSetStuff(style) GrSetStuff(
int style; int style)
{ {
grCurDStyle = style; grCurDStyle = style;
grCurWMask = GrStyleTable[style].mask; grCurWMask = GrStyleTable[style].mask;
@ -136,11 +136,11 @@ grInformDriver()
*/ */
void void
grClipAgainst(startllr, clip) grClipAgainst(
LinkedRect **startllr; /* A pointer to the pointer that heads LinkedRect **startllr, /* A pointer to the pointer that heads
* the list . * the list .
*/ */
Rect *clip; /* The rectangle to clip against */ Rect *clip) /* The rectangle to clip against */
{ {
extern bool grClipAddFunc(); /* forward declaration */ extern bool grClipAddFunc(); /* forward declaration */
LinkedRect **llr, *lr; LinkedRect **llr, *lr;
@ -185,8 +185,8 @@ bool grClipAddFunc(box, cd)
void void
grObsBox(r) grObsBox(
Rect *r; Rect *r)
{ {
LinkedRect *ob; LinkedRect *ob;
LinkedRect *ar; LinkedRect *ar;
@ -231,18 +231,17 @@ grObsBox(r)
*/ */
bool bool
grClipPoints(line, box, p1, p1OK, p2, p2OK) grClipPoints(
Rect *line; /* Actually a line from line->r_ll to Rect *line, /* Actually a line from line->r_ll to
* line->r_ur. It is assumed that r_ll is to * line->r_ur. It is assumed that r_ll is to
* the left of r_ur, but we don't assume that * the left of r_ur, but we don't assume that
* r_ll is below r_ur. * r_ll is below r_ur.
*/ */
Rect *box; /* A box to check intersections with */ Rect *box, /* A box to check intersections with */
Point *p1, *p2; /* To be filled in with 0, 1, or 2 points Point *p1,
* that are on the border of the box as well as bool *p1OK,
* on the line. Point *p2,
*/ bool *p2OK)
bool *p1OK, *p2OK; /* Says if the point was filled in */
{ {
int tmp, delx, dely; int tmp, delx, dely;
bool delyneg; bool delyneg;
@ -376,8 +375,11 @@ grClipPoints(line, box, p1, p1OK, p2, p2OK)
*/ */
void void
GrClipLine(x1, y1, x2, y2) GrClipLine(
int x1, y1, x2, y2; int x1,
int y1,
int x2,
int y2)
{ {
LinkedRect **ar; LinkedRect **ar;
LinkedRect *ob; LinkedRect *ob;
@ -527,9 +529,12 @@ deleteit: {
*/ */
void void
grAddSegment(llx, lly, urx, ury, segments) grAddSegment(
int llx, lly, urx, ury; int llx,
LinkedRect **segments; int lly,
int urx,
int ury,
LinkedRect **segments)
{ {
LinkedRect *curseg; LinkedRect *curseg;
@ -571,10 +576,10 @@ grAddSegment(llx, lly, urx, ury, segments)
*/ */
bool bool
GrBoxOutline(tile, dinfo, tilesegs) GrBoxOutline(
Tile *tile; Tile *tile,
TileType dinfo; TileType dinfo,
LinkedRect **tilesegs; LinkedRect **tilesegs)
{ {
Rect rect; Rect rect;
TileType ttype; TileType ttype;
@ -774,7 +779,11 @@ GrBoxOutline(tile, dinfo, tilesegs)
*--------------------------------------------------------- *---------------------------------------------------------
*/ */
void void
GrBox(MagWindow *mw, Transform *trans, Tile *tile, TileType dinfo) GrBox(
MagWindow *mw,
Transform *trans,
Tile *tile,
TileType dinfo)
{ {
Rect r, r2, clipr; Rect r, r2, clipr;
bool needClip, needObscure, simpleBox; bool needClip, needObscure, simpleBox;
@ -984,11 +993,11 @@ GrBox(MagWindow *mw, Transform *trans, Tile *tile, TileType dinfo)
*/ */
void void
GrDrawFastBox(prect, scale) GrDrawFastBox(
Rect *prect; /* The rectangle to be drawn, given in Rect *prect, /* The rectangle to be drawn, given in
* screen coordinates. * screen coordinates.
*/ */
int scale; /* If < 0, we reduce the cross size for int scale) /* If < 0, we reduce the cross size for
* points according to the (negative) scale, * points according to the (negative) scale,
* so point labels don't dominate a top-level * so point labels don't dominate a top-level
* layout. * layout.
@ -1156,13 +1165,13 @@ GrDrawFastBox(prect, scale)
#define yround(d) (int)(((((d % width) << 1) >= width) ? 1 : 0) + (d / width)) #define yround(d) (int)(((((d % width) << 1) >= width) ? 1 : 0) + (d / width))
void void
GrClipTriangle(r, c, clipped, dinfo, points, np) GrClipTriangle(
Rect *r; /* Bounding box of triangle, in screen coords */ Rect *r, /* Bounding box of triangle, in screen coords */
Rect *c; /* Clipping rectangle */ Rect *c, /* Clipping rectangle */
bool clipped; /* Boolean, if bounding box is clipped */ bool clipped, /* Boolean, if bounding box is clipped */
TileType dinfo; /* Split side and direction information */ TileType dinfo, /* Split side and direction information */
Point *points; /* Point array (up to 5 points) to fill */ Point *points, /* Point array (up to 5 points) to fill */
int *np; /* Number of points in the clipped polygon */ int *np) /* Number of points in the clipped polygon */
{ {
if (!(dinfo & TT_SIDE)) if (!(dinfo & TT_SIDE))
{ {
@ -1419,9 +1428,9 @@ GrClipTriangle(r, c, clipped, dinfo, points, np)
*/ */
void void
GrDrawTriangleEdge(r, dinfo) GrDrawTriangleEdge(
Rect *r; /* Bounding box of triangle, in screen coords */ Rect *r, /* Bounding box of triangle, in screen coords */
TileType dinfo; TileType dinfo)
{ {
Point tpoints[5]; Point tpoints[5];
int tnum, i, j; int tnum, i, j;
@ -1460,11 +1469,11 @@ GrDrawTriangleEdge(r, dinfo)
*/ */
void void
GrDiagonal(prect, dinfo) GrDiagonal(
Rect *prect; /* The rectangle to be drawn, given in Rect *prect, /* The rectangle to be drawn, given in
* screen coordinates. * screen coordinates.
*/ */
TileType dinfo; /* split and direction information */ TileType dinfo) /* split and direction information */
{ {
Rect *r; Rect *r;
bool needClip, needObscure; bool needClip, needObscure;
@ -1541,9 +1550,9 @@ GrDiagonal(prect, dinfo)
*/ */
void void
GrFillPolygon(polyp, np) GrFillPolygon(
Point *polyp; /* Array of points defining polygon */ Point *polyp, /* Array of points defining polygon */
int np; /* number of points in array polyp */ int np) /* number of points in array polyp */
{ {
if (grFillPolygonPtr != NULL) if (grFillPolygonPtr != NULL)
{ {
@ -1567,11 +1576,11 @@ GrFillPolygon(polyp, np)
*/ */
void void
GrClipBox(prect, style) GrClipBox(
Rect *prect; /* The rectangle to be drawn, given in Rect *prect, /* The rectangle to be drawn, given in
* screen coordinates. * screen coordinates.
*/ */
int style; /* The style to be used in drawing it. */ int style) /* The style to be used in drawing it. */
{ {
GrSetStuff(style); GrSetStuff(style);
GrFastBox(prect); GrFastBox(prect);
@ -1603,11 +1612,11 @@ GrClipBox(prect, style)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
bool bool
GrDisjoint(area, clipBox, func, cdarg) GrDisjoint(
Rect * area; Rect * area,
Rect * clipBox; Rect * clipBox,
bool (*func) (); bool (*func) (),
ClientData cdarg; ClientData cdarg)
{ {
Rect ok, rArea; Rect ok, rArea;
bool result; bool result;

View File

@ -102,10 +102,10 @@ GR_STYLE_LINE *GrStyleTable;
bool bool
GrDrawGlyphNum(num, xoff, yoff) GrDrawGlyphNum(
int num; int num,
int xoff; int xoff,
int yoff; int yoff)
{ {
Point p; Point p;
@ -133,8 +133,8 @@ GrDrawGlyphNum(num, xoff, yoff)
*/ */
int int
GrGetStyleFromName(stylename) GrGetStyleFromName(
char *stylename; char *stylename)
{ {
int style; int style;
int maxstyles = TECHBEGINSTYLES + (DBWNumStyles * 2); int maxstyles = TECHBEGINSTYLES + (DBWNumStyles * 2);
@ -196,9 +196,9 @@ GrResetStyles()
*/ */
bool bool
styleBuildDisplayStyle(line, version) styleBuildDisplayStyle(
char *line; char *line,
int version; int version)
{ {
bool res; bool res;
int argsread; int argsread;
@ -284,9 +284,9 @@ styleBuildDisplayStyle(line, version)
*/ */
bool bool
styleBuildStipplesStyle(line, version) styleBuildStipplesStyle(
char *line; char *line,
int version; int version)
{ {
bool res; bool res;
int ord; int ord;
@ -360,9 +360,9 @@ styleBuildStipplesStyle(line, version)
*/ */
bool bool
GrLoadCursors(path, libPath) GrLoadCursors(
char *path; char *path,
char *libPath; char *libPath)
{ {
if (grCursorGlyphs != (GrGlyphs *) NULL) if (grCursorGlyphs != (GrGlyphs *) NULL)
{ {
@ -402,8 +402,8 @@ char *libPath;
*/ */
int int
GrLoadStyles(techType, path, libPath) GrLoadStyles(
char *techType; /* Type of styles wanted by the technology char *techType, /* Type of styles wanted by the technology
* file (usually "std"). We tack two things * file (usually "std"). We tack two things
* onto this name: the type of styles * onto this name: the type of styles
* wanted by the display, and a version * wanted by the display, and a version
@ -411,8 +411,8 @@ char *techType; /* Type of styles wanted by the technology
* to look up the actual display styles * to look up the actual display styles
* file. * file.
*/ */
char *path; char *path,
char *libPath; char *libPath)
{ {
FILE *inp; FILE *inp;
int res = 0; int res = 0;

View File

@ -54,8 +54,8 @@ extern void (*grFreeCursorPtr)();
*/ */
void void
GrFreeGlyphs(g) GrFreeGlyphs(
GrGlyphs *g; GrGlyphs *g)
{ {
int i; int i;
ASSERT(g != NULL, "GrFreeGlyphs"); ASSERT(g != NULL, "GrFreeGlyphs");
@ -94,10 +94,11 @@ GrFreeGlyphs(g)
*/ */
bool bool
GrReadGlyphs(filename, path, libPath, gl) GrReadGlyphs(
char *filename; char *filename,
char *path, *libPath; /* paths to search in for the file */ char *path,
GrGlyphs **gl; /* To be filled in with a malloc'ed structure char *libPath,
GrGlyphs **gl) /* To be filled in with a malloc'ed structure
* This structure must be freed by the caller * This structure must be freed by the caller
* if it is not to live forever. * if it is not to live forever.
*/ */

View File

@ -63,8 +63,8 @@ LinkedRect * grCurObscure; /* A list of obscuring areas */
*/ */
static char * static char *
grWindName(w) grWindName(
MagWindow *w; MagWindow *w)
{ {
if (w == NULL) return "<NULL>"; if (w == NULL) return "<NULL>";
if (w == GR_LOCK_SCREEN) return "<FULL-SCREEN>"; if (w == GR_LOCK_SCREEN) return "<FULL-SCREEN>";
@ -92,11 +92,11 @@ grWindName(w)
*/ */
void void
grSimpleLock(w, inside) grSimpleLock(
MagWindow *w; /* The window to lock, or GR_LOCK_SCREEN if the MagWindow *w, /* The window to lock, or GR_LOCK_SCREEN if the
* whole screen. * whole screen.
*/ */
bool inside; /* If TRUE, clip to inside of window, otherwise clip bool inside) /* If TRUE, clip to inside of window, otherwise clip
* to outside of window. * to outside of window.
*/ */
{ {
@ -128,8 +128,8 @@ grSimpleLock(w, inside)
void void
grSimpleUnlock(w) grSimpleUnlock(
MagWindow *w; MagWindow *w)
{ {
ASSERT(w != NULL, "grSimpleUnlock"); ASSERT(w != NULL, "grSimpleUnlock");
if (grTraceLocks) TxError("--- Unlock %s\n", grWindName(w)); if (grTraceLocks) TxError("--- Unlock %s\n", grWindName(w));
@ -160,8 +160,8 @@ grSimpleUnlock(w)
*/ */
void void
GrClipTo(r) GrClipTo(
Rect *r; Rect *r)
{ {
if (grLockedWindow == NULL) return; if (grLockedWindow == NULL) return;
if (grLockScreen) if (grLockScreen)

View File

@ -243,13 +243,12 @@ void (*GrResumePtr)() = grNullProc;
*/ */
bool bool
GrSetDisplay(type, outName, mouseName) GrSetDisplay(
char *type; /* Name of the display type. */ char *type, /* Name of the display type. */
char *outName; /* Filename used for communciation with char *outName, /* Filename used for communciation with
* display. */ * display. */
char *mouseName; /* Filename used for communciation char *mouseName) /* Filename used for communciation
* with tablet. */ * with tablet. */
{ {
char **ptr; char **ptr;
char *cp; char *cp;
@ -326,8 +325,9 @@ char *mouseName; /* Filename used for communciation
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
bool bool
GrIsDisplay(disp1, disp2) GrIsDisplay(
char *disp1, *disp2; char *disp1,
char *disp2)
{ {
char **ptr1, **ptr2; char **ptr1, **ptr2;
int i, j; int i, j;
@ -379,11 +379,11 @@ GrIsDisplay(disp1, disp2)
*/ */
void void
GrGuessDisplayType(graphics, mouse, display, monitor) GrGuessDisplayType(
char **graphics; /* default device for sending out graphics */ char **graphics, /* default device for sending out graphics */
char **mouse; /* default device for reading mouse (tablet) */ char **mouse, /* default device for reading mouse (tablet) */
char **display; /* default type of device (OGL, etc...) */ char **display, /* default type of device (OGL, etc...) */
char **monitor; /* default type of monitor (pale, std) */ char **monitor) /* default type of monitor (pale, std) */
{ {
bool onSun; /* Are we on a Sun? */ bool onSun; /* Are we on a Sun? */
bool haveX; /* are we running under X? */ bool haveX; /* are we running under X? */
@ -443,11 +443,11 @@ GrGuessDisplayType(graphics, mouse, display, monitor)
*/ */
char * char *
grFgets(str, n, stream, name) grFgets(
char *str; char *str,
int n; int n,
FILE *stream; FILE *stream,
char *name; /* The user name of the stream, for the error msg */ char *name) /* The user name of the stream, for the error msg */
{ {
fd_set fn; fd_set fn;
char *newstr; char *newstr;

View File

@ -71,28 +71,42 @@ nullDoNothing()
/* 1-argument stub (int or pointer) */ /* 1-argument stub (int or pointer) */
static void static void
nullDoNothingI(int a) nullDoNothingI(
int a)
{ {
(void) a; (void) a;
} }
/* 2-argument stub */ /* 2-argument stub */
static void static void
nullDoNothingII(int a, int b) nullDoNothingII(
int a,
int b)
{ {
(void) a; (void) b; (void) a; (void) b;
} }
/* 4-argument stub */ /* 4-argument stub */
static void static void
nullDoNothingIIII(int a, int b, int c, int d) nullDoNothingIIII(
int a,
int b,
int c,
int d)
{ {
(void) a; (void) b; (void) c; (void) d; (void) a; (void) b; (void) c; (void) d;
} }
/* 7-argument stub (for grFontTextPtr) */ /* 7-argument stub (for grFontTextPtr) */
static void static void
nullDoNothingIIIIIII(int a, int b, int c, int d, int e, int f, int g) nullDoNothingIIIIIII(
int a,
int b,
int c,
int d,
int e,
int f,
int g)
{ {
(void) a; (void) b; (void) c; (void) d; (void) e; (void) f; (void) g; (void) a; (void) b; (void) c; (void) d; (void) e; (void) f; (void) g;
} }
@ -100,14 +114,17 @@ nullDoNothingIIIIIII(int a, int b, int c, int d, int e, int f, int g)
/* bool-returning stubs — return FALSE so callers treat backing store / window /* bool-returning stubs — return FALSE so callers treat backing store / window
* creation as unavailable, which is correct for the headless null driver. */ * creation as unavailable, which is correct for the headless null driver. */
static bool static bool
nullReturnFalseI(int a) nullReturnFalseI(
int a)
{ {
(void) a; (void) a;
return FALSE; return FALSE;
} }
static bool static bool
nullReturnFalseII(int a, int b) nullReturnFalseII(
int a,
int b)
{ {
(void) a; (void) b; (void) a; (void) b;
return FALSE; return FALSE;
@ -115,7 +132,10 @@ nullReturnFalseII(int a, int b)
/* 3-argument bool-returning stub (for grDrawGridPtr) */ /* 3-argument bool-returning stub (for grDrawGridPtr) */
static bool static bool
nullReturnFalseIII(int a, int b, int c) nullReturnFalseIII(
int a,
int b,
int c)
{ {
(void) a; (void) b; (void) c; (void) a; (void) b; (void) c;
return FALSE; return FALSE;
@ -123,7 +143,8 @@ nullReturnFalseIII(int a, int b, int c)
/* 1-argument int-returning stub (for GrWindowIdPtr) */ /* 1-argument int-returning stub (for GrWindowIdPtr) */
static int static int
nullReturnZeroI(int a) nullReturnZeroI(
int a)
{ {
(void) a; (void) a;
return 0; return 0;
@ -214,10 +235,10 @@ NullInit()
*/ */
int int
NullTextSize(text, size, r) NullTextSize(
char *text; char *text,
int size; int size,
Rect *r; Rect *r)
{ {
ASSERT(r != NULL, "nullTextSize"); ASSERT(r != NULL, "nullTextSize");
r->r_xbot = 0; r->r_xbot = 0;
@ -307,10 +328,10 @@ NullBitBlt()
*/ */
bool bool
nullSetDisplay(dispType, outFileName, mouseFileName) nullSetDisplay(
char *dispType; char *dispType,
char *outFileName; char *outFileName,
char *mouseFileName; char *mouseFileName)
{ {
TxPrintf("Using NULL graphics device.\n"); TxPrintf("Using NULL graphics device.\n");

View File

@ -80,9 +80,9 @@ extern void grOGLWStdin(int fd, ClientData cdata); /* cb_textio_input_t (unused)
*/ */
void void
groglSetWMandC (mask, c) groglSetWMandC(
int mask; /* New value for write mask */ int mask, /* New value for write mask */
int c; /* New value for current color */ int c) /* New value for current color */
{ {
static int oldMask = -1; static int oldMask = -1;
static int oldColor = -1; static int oldColor = -1;
@ -135,8 +135,8 @@ groglSetWMandC (mask, c)
*/ */
void void
groglSetLineStyle (style) groglSetLineStyle(
int style; /* New stipple pattern for lines. */ int style) /* New stipple pattern for lines. */
{ {
static int oldStyle = -1; static int oldStyle = -1;
GLushort glstyle; GLushort glstyle;
@ -172,9 +172,9 @@ groglSetLineStyle (style)
*/ */
void void
groglSetSPattern (sttable, numstipples) groglSetSPattern(
int **sttable; /* The table of patterns */ int **sttable, /* The table of patterns */
int numstipples; /* Number of stipples */ int numstipples) /* Number of stipples */
{ {
int i, j, k, n; int i, j, k, n;
GLubyte *pdata; GLubyte *pdata;
@ -209,8 +209,8 @@ groglSetSPattern (sttable, numstipples)
*/ */
void void
groglSetStipple (stipple) groglSetStipple(
int stipple; /* The stipple number to be used. */ int stipple) /* The stipple number to be used. */
{ {
static int oldStip = -1; static int oldStip = -1;
if (stipple == oldStip) return; if (stipple == oldStip) return;
@ -358,7 +358,8 @@ GrOGLFlush()
/* /*
int int
glTransYs(int wy) glTransYs(
int wy)
{ {
int my; int my;
GLint vparms[4]; GLint vparms[4];
@ -376,8 +377,11 @@ glTransYs(int wy)
*---------------------------------------------------------------------- *----------------------------------------------------------------------
*/ */
void void
oglSetProjection(llx, lly, width, height) oglSetProjection(
int llx, lly, width, height; int llx,
int lly,
int width,
int height)
{ {
glXMakeCurrent(grXdpy, (GLXDrawable)oglCurrent.window, grXcontext); glXMakeCurrent(grXdpy, (GLXDrawable)oglCurrent.window, grXcontext);
@ -612,10 +616,10 @@ pipehandler(
*/ */
bool bool
oglSetDisplay (dispType, outFileName, mouseFileName) oglSetDisplay(
char *dispType; /* arguments not used by X */ char *dispType, /* arguments not used by X */
char *outFileName; char *outFileName,
char *mouseFileName; char *mouseFileName)
{ {
int fildes[2], fildes2[2]; int fildes[2], fildes2[2];
char *planecount; char *planecount;
@ -801,9 +805,9 @@ grOGLWStdin(
*/ */
bool bool
GrOGLCreate(w, name) GrOGLCreate(
MagWindow *w; MagWindow *w,
char *name; char *name)
{ {
Window wind; Window wind;
HashEntry *entry; HashEntry *entry;
@ -912,8 +916,8 @@ GrOGLCreate(w, name)
*/ */
void void
GrOGLDelete(w) GrOGLDelete(
MagWindow *w; MagWindow *w)
{ {
int xw; int xw;
HashEntry *entry; HashEntry *entry;
@ -941,8 +945,8 @@ GrOGLDelete(w)
*/ */
void void
GrOGLConfigure(w) GrOGLConfigure(
MagWindow *w; MagWindow *w)
{ {
XMoveResizeWindow(grXdpy,(Window) w->w_grdata, XMoveResizeWindow(grXdpy,(Window) w->w_grdata,
w->w_frameArea.r_xbot, glTransYs(w->w_frameArea.r_ytop), w->w_frameArea.r_xbot, glTransYs(w->w_frameArea.r_ytop),
@ -967,8 +971,8 @@ GrOGLConfigure(w)
*/ */
void void
GrOGLRaise(w) GrOGLRaise(
MagWindow *w; MagWindow *w)
{ {
XRaiseWindow(grXdpy, (Window) w->w_grdata ); XRaiseWindow(grXdpy, (Window) w->w_grdata );
} }
@ -990,8 +994,8 @@ GrOGLRaise(w)
*/ */
void void
GrOGLLower(w) GrOGLLower(
MagWindow *w; MagWindow *w)
{ {
XLowerWindow(grXdpy, (Window) w->w_grdata ); XLowerWindow(grXdpy, (Window) w->w_grdata );
} }
@ -1013,9 +1017,9 @@ GrOGLLower(w)
*/ */
void void
GrOGLLock(w, flag) GrOGLLock(
MagWindow *w; MagWindow *w,
bool flag; bool flag)
{ {
grSimpleLock(w, flag); grSimpleLock(w, flag);
if ( w != GR_LOCK_SCREEN ) if ( w != GR_LOCK_SCREEN )
@ -1045,8 +1049,8 @@ GrOGLLock(w, flag)
*/ */
void void
GrOGLUnlock(w) GrOGLUnlock(
MagWindow *w; MagWindow *w)
{ {
GrOGLFlush(); GrOGLFlush();
grSimpleUnlock(w); grSimpleUnlock(w);
@ -1066,9 +1070,9 @@ GrOGLUnlock(w)
*/ */
void void
GrOGLIconUpdate(w,text) GrOGLIconUpdate(
MagWindow *w; MagWindow *w,
char *text; char *text)
{ {
Window wind = (Window) w->w_grdata; Window wind = (Window) w->w_grdata;
XClassHint class; XClassHint class;

View File

@ -71,9 +71,9 @@ int groglNbRects=0;
*/ */
void void
groglDrawLines(lines, nb) groglDrawLines(
Rect lines[]; Rect lines[],
int nb; int nb)
{ {
int i; int i;
@ -109,9 +109,11 @@ groglDrawLines(lines, nb)
*/ */
void void
groglDrawLine (x1, y1, x2, y2) groglDrawLine(
int x1, y1; /* Screen coordinates of first point. */ int x1,
int x2, y2; /* Screen coordinates of second point. */ int y1,
int x2,
int y2)
{ {
if (groglNbLines == OGL_BATCH_SIZE) GR_X_FLUSH_LINES(); if (groglNbLines == OGL_BATCH_SIZE) GR_X_FLUSH_LINES();
groglLines[groglNbLines].r_ll.p_x = x1; groglLines[groglNbLines].r_ll.p_x = x1;
@ -134,9 +136,9 @@ groglDrawLine (x1, y1, x2, y2)
*/ */
void void
groglFillRects(rects, nb) groglFillRects(
OGLRect rects[]; OGLRect rects[],
int nb; int nb)
{ {
int i; int i;
@ -168,8 +170,8 @@ groglFillRects(rects, nb)
*/ */
void void
groglFillRect(r) groglFillRect(
Rect *r; /* Address of a rectangle in screen Rect *r) /* Address of a rectangle in screen
* coordinates. * coordinates.
*/ */
{ {
@ -203,9 +205,9 @@ groglFillRect(r)
*/ */
void void
groglFillPolygon(tp, np) groglFillPolygon(
Point *tp; Point *tp,
int np; int np)
{ {
int i; int i;

View File

@ -66,15 +66,15 @@ GLuint grXBases[4];
*/ */
bool bool
groglDrawGrid (prect, outline, clip) groglDrawGrid(
Rect *prect; /* A rectangle that forms the template Rect *prect, /* A rectangle that forms the template
* for the grid. Note: in order to maintain * for the grid. Note: in order to maintain
* precision for the grid, the rectangle * precision for the grid, the rectangle
* coordinates are specified in units of * coordinates are specified in units of
* screen coordinates multiplied by SUBPIXEL. * screen coordinates multiplied by SUBPIXEL.
*/ */
int outline; /* the outline style */ int outline, /* the outline style */
Rect *clip; /* a clipping rectangle */ Rect *clip) /* a clipping rectangle */
{ {
int xsize, ysize; int xsize, ysize;
int x, y; int x, y;
@ -222,8 +222,8 @@ groglLoadFont()
*/ */
void void
groglSetCharSize (size) groglSetCharSize(
int size; /* Width of characters */ int size) /* Width of characters */
{ {
oglCurrent.fontSize = size; oglCurrent.fontSize = size;
@ -267,10 +267,10 @@ groglSetCharSize (size)
*/ */
int int
GrOGLTextSize(text, size, r) GrOGLTextSize(
char *text; char *text,
int size; int size,
Rect *r; Rect *r)
{ {
XCharStruct overall; XCharStruct overall;
XFontStruct *font; XFontStruct *font;
@ -324,9 +324,10 @@ GrOGLTextSize(text, size, r)
*/ */
int int
GrOGLReadPixel (w, x, y) GrOGLReadPixel(
MagWindow *w; MagWindow *w,
int x,y; /* the location of a pixel in screen coords */ int x,
int y)
{ {
return 0; return 0;
} }
@ -347,9 +348,9 @@ GrOGLReadPixel (w, x, y)
*/ */
void void
GrOGLBitBlt(r, p) GrOGLBitBlt(
Rect *r; Rect *r,
Point *p; Point *p)
{ {
glCopyPixels(r->r_xbot, r->r_ybot, r->r_xtop - r->r_xbot + 1, glCopyPixels(r->r_xbot, r->r_ybot, r->r_xtop - r->r_xbot + 1,
r->r_ytop - r->r_ybot + 1, GL_COLOR); r->r_ytop - r->r_ybot + 1, GL_COLOR);
@ -390,10 +391,10 @@ myCombine(GLdouble coords[3], GLdouble *vertex_data[4],
*/ */
void void
groglDrawCharacter(clist, tc, pixsize) groglDrawCharacter(
FontChar *clist; FontChar *clist,
unsigned char tc; unsigned char tc,
int pixsize; int pixsize)
{ {
Point *tp; Point *tp;
int np, nptotal; int np, nptotal;
@ -468,14 +469,14 @@ groglDrawCharacter(clist, tc, pixsize)
*/ */
void void
groglFontText(text, font, size, rotate, pos, clip, obscure) groglFontText(
char *text; /* The text to be drawn */ char *text, /* The text to be drawn */
int font; /* Font to use from fontList */ int font, /* Font to use from fontList */
int size; /* Pixel size of the font */ int size, /* Pixel size of the font */
int rotate; /* Text rotation */ int rotate, /* Text rotation */
Point *pos; /* Text base position */ Point *pos, /* Text base position */
Rect *clip; /* Clipping area */ Rect *clip, /* Clipping area */
LinkedRect *obscure; /* List of obscuring areas */ LinkedRect *obscure) /* List of obscuring areas */
{ {
char *tptr; char *tptr;
Point *coffset; /* vector to next character */ Point *coffset; /* vector to next character */
@ -535,7 +536,8 @@ static GC grXcopyGC = (GC)NULL;
*/ */
void void
groglFreeBackingStore(MagWindow *window) groglFreeBackingStore(
MagWindow *window)
{ {
Pixmap pmap = (Pixmap)window->w_backingStore; Pixmap pmap = (Pixmap)window->w_backingStore;
if (pmap == (Pixmap)NULL) return; if (pmap == (Pixmap)NULL) return;
@ -561,7 +563,8 @@ groglFreeBackingStore(MagWindow *window)
*/ */
void void
groglCreateBackingStore(MagWindow *w) groglCreateBackingStore(
MagWindow *w)
{ {
Pixmap pmap; Pixmap pmap;
Window wind = (Window)w->w_grdata; Window wind = (Window)w->w_grdata;
@ -609,7 +612,9 @@ groglCreateBackingStore(MagWindow *w)
*/ */
bool bool
groglGetBackingStore(MagWindow *w, Rect *area) groglGetBackingStore(
MagWindow *w,
Rect *area)
{ {
Pixmap pmap; Pixmap pmap;
Window wind = (Window)w->w_grdata; Window wind = (Window)w->w_grdata;
@ -658,7 +663,9 @@ groglGetBackingStore(MagWindow *w, Rect *area)
*/ */
bool bool
groglScrollBackingStore(MagWindow *w, Point *shift) groglScrollBackingStore(
MagWindow *w,
Point *shift)
{ {
Pixmap pmap; Pixmap pmap;
unsigned int width, height; unsigned int width, height;
@ -717,7 +724,9 @@ groglScrollBackingStore(MagWindow *w, Point *shift)
*/ */
void void
groglPutBackingStore(MagWindow *w, Rect *area) groglPutBackingStore(
MagWindow *w,
Rect *area)
{ {
Pixmap pmap = (Pixmap)w->w_backingStore; Pixmap pmap = (Pixmap)w->w_backingStore;
Window wind = (Window)w->w_grdata; Window wind = (Window)w->w_grdata;
@ -771,14 +780,13 @@ groglPutBackingStore(MagWindow *w, Rect *area)
*/ */
void void
groglPutText (text, pos, clip, obscure) groglPutText(
char *text; /* The text to be drawn. */ char *text, /* The text to be drawn. */
Point *pos; /* A point located at the leftmost point of Point *pos, /* A point located at the leftmost point of
* the baseline for this string. * the baseline for this string.
*/ */
Rect *clip; /* A rectangle to clip against */ Rect *clip, /* A rectangle to clip against */
LinkedRect *obscure; /* A list of obscuring rectangles */ LinkedRect *obscure) /* A list of obscuring rectangles */
{ {
Rect location; Rect location;
Rect overlap; Rect overlap;
@ -832,10 +840,9 @@ groglPutText (text, pos, clip, obscure)
*/ */
void void
grOGLGeoSub(r, area) grOGLGeoSub(
Rect *r; /* Rectangle to be subtracted from. */ Rect *r, /* Rectangle to be subtracted from. */
Rect *area; /* Area to be subtracted. */ Rect *area) /* Area to be subtracted. */
{ {
if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop; if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop;
else else

View File

@ -54,9 +54,9 @@ extern Cursor grCursors[MAX_CURSORS]; /* grX11su5.c */
*/ */
void void
GrOGLDrawGlyph (gl, p) GrOGLDrawGlyph(
GrGlyph *gl; /* A single glyph */ GrGlyph *gl, /* A single glyph */
Point *p; /* screen pos of lower left corner */ Point *p) /* screen pos of lower left corner */
{ {
Rect bBox; Rect bBox;
bool anyObscure; bool anyObscure;
@ -182,8 +182,8 @@ GrOGLDrawGlyph (gl, p)
*/ */
void void
groglDefineCursor(glyphs) groglDefineCursor(
GrGlyphs *glyphs; GrGlyphs *glyphs)
{ {
int glyphnum; int glyphnum;
Rect oldClip; Rect oldClip;
@ -298,8 +298,8 @@ groglDefineCursor(glyphs)
*/ */
void void
GrOGLSetCursor(cursorNum) GrOGLSetCursor(
int cursorNum; /* The cursor number as defined in the display int cursorNum) /* The cursor number as defined in the display
* styles file. * styles file.
*/ */
{ {

View File

@ -64,7 +64,7 @@ TOGL_CURRENT toglCurrent= {(Tk_Font)0, 0, 0, 0, 0,
*/ */
extern void GrTOGLClose(), GrTOGLFlush(); extern void GrTOGLClose(), GrTOGLFlush();
extern void GrTOGLDelete(), GrTOGLConfigure(), GrTOGLRaise(), GrTOGLLower(); extern void GrTOGLDelete(), GrTOGLConfigure(), GrTOGLRaise(), GrTOGLLower();
extern void GrTOGLLock(), GrTOGLUnlock(), GrTOGLIconUpdate(); extern void GrTOGLLock(MagWindow *w, bool flag), GrTOGLUnlock(), GrTOGLIconUpdate();
extern bool GrTOGLInit(); extern bool GrTOGLInit();
extern bool GrTOGLEventPending(), GrTOGLCreate(), grtoglGetCursorPos(); extern bool GrTOGLEventPending(), GrTOGLCreate(), grtoglGetCursorPos();
extern int GrTOGLWindowId(); extern int GrTOGLWindowId();
@ -87,9 +87,9 @@ extern void toglSetProjection();
*/ */
void void
grtoglSetWMandC (mask, c) grtoglSetWMandC(
int mask; /* New value for write mask */ int mask, /* New value for write mask */
int c; /* New value for current color */ int c) /* New value for current color */
{ {
static int oldColor = -1; static int oldColor = -1;
static int oldMask = -1; static int oldMask = -1;
@ -150,8 +150,8 @@ grtoglSetWMandC (mask, c)
*/ */
void void
grtoglSetLineStyle (style) grtoglSetLineStyle(
int style; /* New stipple pattern for lines. */ int style) /* New stipple pattern for lines. */
{ {
static int oldStyle = -1; static int oldStyle = -1;
GLushort glstyle; GLushort glstyle;
@ -188,9 +188,9 @@ grtoglSetLineStyle (style)
*/ */
void void
grtoglSetSPattern (sttable, numstipples) grtoglSetSPattern(
int **sttable; /* The table of patterns */ int **sttable, /* The table of patterns */
int numstipples; /* Number of stipples */ int numstipples) /* Number of stipples */
{ {
int i, j, k, n; int i, j, k, n;
GLubyte *pdata; GLubyte *pdata;
@ -225,8 +225,8 @@ grtoglSetSPattern (sttable, numstipples)
*/ */
void void
grtoglSetStipple (stipple) grtoglSetStipple(
int stipple; /* The stipple number to be used. */ int stipple) /* The stipple number to be used. */
{ {
static int oldStip = -1; static int oldStip = -1;
if (stipple == oldStip) return; if (stipple == oldStip) return;
@ -402,8 +402,11 @@ static GLXPbuffer pbuffer = None;
*/ */
void void
toglSetProjection(llx, lly, width, height) toglSetProjection(
int llx, lly, width, height; int llx,
int lly,
int width,
int height)
{ {
if (toglCurrent.mw->w_flags & WIND_OFFSCREEN) if (toglCurrent.mw->w_flags & WIND_OFFSCREEN)
{ {
@ -485,9 +488,9 @@ toglSetProjection(llx, lly, width, height)
*/ */
void void
TOGLEventProc(clientData, xevent) TOGLEventProc(
ClientData clientData; ClientData clientData,
XEvent *xevent; XEvent *xevent)
{ {
TxInputEvent *event; TxInputEvent *event;
HashEntry *entry; HashEntry *entry;
@ -979,10 +982,10 @@ toglOnScreen()
*/ */
bool bool
oglSetDisplay (dispType, outFileName, mouseFileName) oglSetDisplay(
char *dispType; char *dispType,
char *outFileName; char *outFileName,
char *mouseFileName; char *mouseFileName)
{ {
char *planecount; char *planecount;
char *fullname; char *fullname;
@ -1000,8 +1003,8 @@ oglSetDisplay (dispType, outFileName, mouseFileName)
GrPixelCorrect = 0; GrPixelCorrect = 0;
GrLockPtr = GrTOGLLock; GrLockPtr = (void (*)())GrTOGLLock;
GrUnlockPtr = GrTOGLUnlock; GrUnlockPtr = (void (*)())GrTOGLUnlock;
GrInitPtr = GrTOGLInit; GrInitPtr = GrTOGLInit;
GrClosePtr = GrTOGLClose; GrClosePtr = GrTOGLClose;
GrSetCMapPtr = GrTOGLSetCMap; GrSetCMapPtr = GrTOGLSetCMap;
@ -1095,9 +1098,9 @@ extern void MakeWindowCommand();
*/ */
bool bool
GrTOGLCreate(w, name) GrTOGLCreate(
MagWindow *w; MagWindow *w,
char *name; char *name)
{ {
Tk_Window tkwind, tktop; Tk_Window tkwind, tktop;
Window wind; Window wind;
@ -1244,8 +1247,8 @@ GrTOGLCreate(w, name)
*/ */
void void
GrTOGLDelete(w) GrTOGLDelete(
MagWindow *w; MagWindow *w)
{ {
Tk_Window xw; Tk_Window xw;
HashEntry *entry; HashEntry *entry;
@ -1274,8 +1277,8 @@ GrTOGLDelete(w)
*/ */
void void
GrTOGLConfigure(w) GrTOGLConfigure(
MagWindow *w; MagWindow *w)
{ {
if (w->w_flags & WIND_OFFSCREEN) return; if (w->w_flags & WIND_OFFSCREEN) return;
@ -1302,8 +1305,8 @@ GrTOGLConfigure(w)
*/ */
void void
GrTOGLRaise(w) GrTOGLRaise(
MagWindow *w; MagWindow *w)
{ {
Tk_Window tkwind; Tk_Window tkwind;
@ -1330,8 +1333,8 @@ GrTOGLRaise(w)
*/ */
void void
GrTOGLLower(w) GrTOGLLower(
MagWindow *w; MagWindow *w)
{ {
Tk_Window tkwind; Tk_Window tkwind;
@ -1365,9 +1368,9 @@ extern void TCairoOffScreen();
#endif #endif
void void
GrTOGLLock(w, flag) GrTOGLLock(
MagWindow *w; MagWindow *w,
bool flag; bool flag)
{ {
Window wind; Window wind;
@ -1421,8 +1424,8 @@ GrTOGLLock(w, flag)
*/ */
void void
GrTOGLUnlock(w) GrTOGLUnlock(
MagWindow *w; MagWindow *w)
{ {
#ifdef CAIRO_OFFSCREEN_RENDER #ifdef CAIRO_OFFSCREEN_RENDER
@ -1537,9 +1540,9 @@ GrTOGLEventPending()
*/ */
void void
GrTOGLIconUpdate(w,text) /* See Blt code */ GrTOGLIconUpdate(
MagWindow *w; MagWindow *w,
char *text; char *text)
{ {
Tk_Window tkwind; Tk_Window tkwind;
Window wind; Window wind;
@ -1592,8 +1595,8 @@ GrTOGLIconUpdate(w,text) /* See Blt code */
*/ */
int int
GrTOGLWindowId(tkname) GrTOGLWindowId(
char *tkname; char *tkname)
{ {
Tk_Window tkwind; Tk_Window tkwind;
MagWindow *mw; MagWindow *mw;

View File

@ -66,9 +66,9 @@ int grtoglNbDiagonal = 0;
*/ */
void void
grtoglDrawLines(lines, nb) grtoglDrawLines(
Rect lines[]; Rect lines[],
int nb; int nb)
{ {
#ifdef OGL_SERVER_SIDE_ONLY #ifdef OGL_SERVER_SIDE_ONLY
@ -103,9 +103,11 @@ grtoglDrawLines(lines, nb)
*/ */
void void
grtoglDrawLine (x1, y1, x2, y2) grtoglDrawLine(
int x1, y1; /* Screen coordinates of first point. */ int x1,
int x2, y2; /* Screen coordinates of second point. */ int y1,
int x2,
int y2)
{ {
/* Treat straight and diagonal lines separately. Some */ /* Treat straight and diagonal lines separately. Some */
/* implementations of OpenGL make straight lines twice as thick */ /* implementations of OpenGL make straight lines twice as thick */
@ -143,9 +145,9 @@ grtoglDrawLine (x1, y1, x2, y2)
*/ */
void void
grtoglFillRects(rects, nb) grtoglFillRects(
TOGLRect rects[]; TOGLRect rects[],
int nb; int nb)
{ {
#ifdef OGL_SERVER_SIDE_ONLY #ifdef OGL_SERVER_SIDE_ONLY
@ -178,8 +180,8 @@ grtoglFillRects(rects, nb)
*/ */
void void
grtoglFillRect(r) grtoglFillRect(
Rect *r; /* Address of a rectangle in screen Rect *r) /* Address of a rectangle in screen
* coordinates. * coordinates.
*/ */
{ {
@ -213,9 +215,9 @@ grtoglFillRect(r)
*/ */
void void
grtoglFillPolygon(tp, np) grtoglFillPolygon(
Point *tp; Point *tp,
int np; int np)
{ {
int i; int i;

View File

@ -61,15 +61,15 @@ typedef struct {
*/ */
bool bool
grtoglDrawGrid (prect, outline, clip) grtoglDrawGrid(
Rect *prect; /* A rectangle that forms the template Rect *prect, /* A rectangle that forms the template
* for the grid. Note: in order to maintain * for the grid. Note: in order to maintain
* precision for the grid, the rectangle * precision for the grid, the rectangle
* coordinates are specified in units of * coordinates are specified in units of
* screen coordinates multiplied by SUBPIXEL. * screen coordinates multiplied by SUBPIXEL.
*/ */
int outline; /* the outline style */ int outline, /* the outline style */
Rect *clip; /* a clipping rectangle */ Rect *clip) /* a clipping rectangle */
{ {
int xsize, ysize; int xsize, ysize;
int x, y; int x, y;
@ -160,8 +160,8 @@ grtoglLoadFont()
*/ */
void void
grtoglSetCharSize (size) grtoglSetCharSize(
int size; /* Width of characters, in pixels (6 or 8). */ int size) /* Width of characters, in pixels (6 or 8). */
{ {
toglCurrent.fontSize = size; toglCurrent.fontSize = size;
switch (size) switch (size)
@ -204,10 +204,10 @@ grtoglSetCharSize (size)
*/ */
int int
GrTOGLTextSize(text, size, r) GrTOGLTextSize(
char *text; char *text,
int size; int size,
Rect *r; Rect *r)
{ {
Tk_FontMetrics overall; Tk_FontMetrics overall;
Tk_Font font; Tk_Font font;
@ -252,7 +252,8 @@ GrTOGLTextSize(text, size, r)
/* backing store contains valid data or not. */ /* backing store contains valid data or not. */
void void
grtoglFreeBackingStore(MagWindow *w) grtoglFreeBackingStore(
MagWindow *w)
{ {
RenderFrame *rf; RenderFrame *rf;
@ -265,7 +266,8 @@ grtoglFreeBackingStore(MagWindow *w)
} }
void void
grtoglCreateBackingStore(MagWindow *w) grtoglCreateBackingStore(
MagWindow *w)
{ {
RenderFrame *rf; RenderFrame *rf;
@ -298,7 +300,9 @@ grtoglCreateBackingStore(MagWindow *w)
} }
bool bool
grtoglGetBackingStore(MagWindow *w, Rect *area) grtoglGetBackingStore(
MagWindow *w,
Rect *area)
{ {
RenderFrame *rf; RenderFrame *rf;
unsigned int width, height; unsigned int width, height;
@ -336,7 +340,9 @@ grtoglGetBackingStore(MagWindow *w, Rect *area)
bool bool
grtoglScrollBackingStore(MagWindow *w, Point *shift) grtoglScrollBackingStore(
MagWindow *w,
Point *shift)
{ {
RenderFrame *rf; RenderFrame *rf;
GLuint FramebufferName, RenderbufferName; GLuint FramebufferName, RenderbufferName;
@ -396,7 +402,9 @@ grtoglScrollBackingStore(MagWindow *w, Point *shift)
} }
void void
grtoglPutBackingStore(MagWindow *w, Rect *area) grtoglPutBackingStore(
MagWindow *w,
Rect *area)
{ {
RenderFrame *rf; RenderFrame *rf;
GLuint FramebufferName, RenderbufferName; GLuint FramebufferName, RenderbufferName;
@ -452,9 +460,10 @@ grtoglPutBackingStore(MagWindow *w, Rect *area)
*/ */
int int
GrTOGLReadPixel (w, x, y) GrTOGLReadPixel(
MagWindow *w; MagWindow *w,
int x,y; /* the location of a pixel in screen coords */ int x,
int y)
{ {
return 0; /* OpenGL has no such function, so return 0 */ return 0; /* OpenGL has no such function, so return 0 */
} }
@ -475,9 +484,9 @@ GrTOGLReadPixel (w, x, y)
*/ */
void void
GrTOGLBitBlt(r, p) GrTOGLBitBlt(
Rect *r; Rect *r,
Point *p; Point *p)
{ {
glCopyPixels(r->r_xbot, r->r_ybot, r->r_xtop - r->r_xbot + 1, glCopyPixels(r->r_xbot, r->r_ybot, r->r_xtop - r->r_xbot + 1,
r->r_ytop - r->r_ybot + 1, GL_COLOR); r->r_ytop - r->r_ybot + 1, GL_COLOR);
@ -518,10 +527,10 @@ myCombine(GLdouble coords[3], GLdouble *vertex_data[4],
*/ */
void void
grtoglDrawCharacter(clist, tc, pixsize) grtoglDrawCharacter(
FontChar *clist; FontChar *clist,
unsigned char tc; unsigned char tc,
int pixsize; int pixsize)
{ {
Point *tp; Point *tp;
int np, nptotal; int np, nptotal;
@ -596,14 +605,14 @@ grtoglDrawCharacter(clist, tc, pixsize)
*/ */
void void
grtoglFontText(text, font, size, rotate, pos, clip, obscure) grtoglFontText(
char *text; /* The text to be drawn */ char *text, /* The text to be drawn */
int font; /* Font to use from fontList */ int font, /* Font to use from fontList */
int size; /* Pixel size of the font */ int size, /* Pixel size of the font */
int rotate; /* Text rotation */ int rotate, /* Text rotation */
Point *pos; /* Text base position */ Point *pos, /* Text base position */
Rect *clip; /* Clipping area */ Rect *clip, /* Clipping area */
LinkedRect *obscure; /* List of obscuring areas */ LinkedRect *obscure) /* List of obscuring areas */
{ {
char *tptr; char *tptr;
Point *coffset; /* vector to next character */ Point *coffset; /* vector to next character */
@ -666,14 +675,13 @@ grtoglFontText(text, font, size, rotate, pos, clip, obscure)
*/ */
void void
grtoglPutText (text, pos, clip, obscure) grtoglPutText(
char *text; /* The text to be drawn. */ char *text, /* The text to be drawn. */
Point *pos; /* A point located at the leftmost point of Point *pos, /* A point located at the leftmost point of
* the baseline for this string. * the baseline for this string.
*/ */
Rect *clip; /* A rectangle to clip against */ Rect *clip, /* A rectangle to clip against */
LinkedRect *obscure; /* A list of obscuring rectangles */ LinkedRect *obscure) /* A list of obscuring rectangles */
{ {
Rect location; Rect location;
Rect overlap; Rect overlap;
@ -726,10 +734,9 @@ grtoglPutText (text, pos, clip, obscure)
*/ */
void void
grTOGLGeoSub(r, area) grTOGLGeoSub(
Rect *r; /* Rectangle to be subtracted from. */ Rect *r, /* Rectangle to be subtracted from. */
Rect *area; /* Area to be subtracted. */ Rect *area) /* Area to be subtracted. */
{ {
if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop; if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop;
else else

View File

@ -47,14 +47,14 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
*/ */
bool bool
GrFontText(str, style, p, font, size, rotate, clip) GrFontText(
char *str; /* The text to be drawn. */ char *str, /* The text to be drawn. */
int style; /* Display style to use for the text */ int style, /* Display style to use for the text */
Point *p; /* Point of origin */ Point *p, /* Point of origin */
int font; /* Font to use */ int font, /* Font to use */
int size; /* Scale */ int size, /* Scale */
int rotate; /* Rotation (in degrees) */ int rotate, /* Rotation (in degrees) */
Rect *clip; /* Clipping area */ Rect *clip) /* Clipping area */
{ {
Rect nClip; Rect nClip;
Point pstart; Point pstart;
@ -106,29 +106,28 @@ GrFontText(str, style, p, font, size, rotate, clip)
*/ */
bool bool
GrPutText(str, style, p, pos, size, adjust, clip, actual) GrPutText(
char *str; /* The text to be drawn. */ char *str, /* The text to be drawn. */
int style; /* The style for drawing text; if -1 then int style, /* The style for drawing text; if -1 then
* the caller has already set the style * the caller has already set the style
* and we don't have to. * and we don't have to.
*/ */
Point *p, /* The point to align with */
Point *p; /* The point to align with */ int pos, /* The alignment desired (GR_NORTH,
int pos; /* The alignment desired (GR_NORTH,
* GR_NORTHEAST, etc.) * GR_NORTHEAST, etc.)
*/ */
int size; /* The desired size of the text int size, /* The desired size of the text
* (such as GR_TEXT_MEDIUM). * (such as GR_TEXT_MEDIUM).
*/ */
bool adjust; /* TRUE means adjust the text (either by bool adjust, /* TRUE means adjust the text (either by
* sliding it around or using a smaller font) * sliding it around or using a smaller font)
* if that is necessary to make it fit into * if that is necessary to make it fit into
* the clipping rectangle. FALSE means * the clipping rectangle. FALSE means
* display the text exactly as instructed, * display the text exactly as instructed,
* clipping it if it doesn't fit. * clipping it if it doesn't fit.
*/ */
Rect *clip; /* A clipping rectangle for the text */ Rect *clip, /* A clipping rectangle for the text */
Rect *actual; /* To be filled in with the location of the Rect *actual) /* To be filled in with the location of the
* text. * text.
*/ */
{ {
@ -315,13 +314,13 @@ GrPutText(str, style, p, pos, size, adjust, clip, actual)
*/ */
void void
GrLabelSize(text, pos, size, area) GrLabelSize(
char *text; /* Text of the label. */ char *text, /* Text of the label. */
int pos; /* Position of the label relative int pos, /* Position of the label relative
* to its positioning point. * to its positioning point.
*/ */
int size; /* Text size. */ int size, /* Text size. */
Rect *area; /* To be filled in with label size. */ Rect *area) /* To be filled in with label size. */
{ {
int xoffset, yoffset; /* Offsets due to label position. */ int xoffset, yoffset; /* Offsets due to label position. */

View File

@ -100,7 +100,7 @@ extern bool GrTkInstalledCMap;
*/ */
extern void GrTkClose(), GrTkFlush(); extern void GrTkClose(), GrTkFlush();
extern void GrTkDelete(),GrTkConfigure(),GrTkRaise(),GrTkLower(); extern void GrTkDelete(),GrTkConfigure(),GrTkRaise(),GrTkLower();
extern void GrTkLock(),GrTkUnlock(),GrTkIconUpdate(); extern void GrTkLock(MagWindow *w, bool flag),GrTkUnlock(),GrTkIconUpdate();
extern bool GrTkInit(); extern bool GrTkInit();
extern bool GrTkEventPending(), GrTkCreate(), grtkGetCursorPos(); extern bool GrTkEventPending(), GrTkCreate(), grtkGetCursorPos();
extern int GrTkWindowId(); extern int GrTkWindowId();
@ -121,9 +121,9 @@ extern char *GrTkWindowName();
*/ */
void void
grtkSetWMandC (mask, c) grtkSetWMandC(
long mask; /* New value for write mask */ long mask, /* New value for write mask */
int c; /* New value for current color */ int c) /* New value for current color */
{ {
static int oldC = -1; static int oldC = -1;
static int oldM = -1; static int oldM = -1;
@ -163,8 +163,8 @@ grtkSetWMandC (mask, c)
*/ */
void void
grtkSetLineStyle (style) grtkSetLineStyle(
int style; /* New stipple pattern for lines. */ int style) /* New stipple pattern for lines. */
{ {
static int oldStyle = -1; static int oldStyle = -1;
LineStyle *linestyle; LineStyle *linestyle;
@ -258,9 +258,9 @@ grtkSetLineStyle (style)
*/ */
void void
grtkSetSPattern (sttable, numstipples) grtkSetSPattern(
int **sttable; /* The table of patterns */ int **sttable, /* The table of patterns */
int numstipples; /* Number of stipples */ int numstipples) /* Number of stipples */
{ {
Tk_Window tkwind; Tk_Window tkwind;
Window xwid; Window xwid;
@ -311,8 +311,8 @@ grtkSetSPattern (sttable, numstipples)
*/ */
void void
grtkSetStipple (stipple) grtkSetStipple(
int stipple; /* The stipple number to be used. */ int stipple) /* The stipple number to be used. */
{ {
static int oldStip = -1; static int oldStip = -1;
if (stipple == oldStip) return; if (stipple == oldStip) return;
@ -345,8 +345,8 @@ grtkSetStipple (stipple)
#define visual_table_len 7 #define visual_table_len 7
bool bool
GrTkInit(dispType) GrTkInit(
char *dispType; char *dispType)
{ {
int i,j; int i,j;
XVisualInfo grvisual_info, *grvisual_get, grtemplate; XVisualInfo grvisual_info, *grvisual_get, grtemplate;
@ -728,9 +728,9 @@ GrTkFlush ()
*/ */
void void
MagicEventProc(clientData, xevent) MagicEventProc(
ClientData clientData; ClientData clientData,
XEvent *xevent; XEvent *xevent)
{ {
HashEntry *entry; HashEntry *entry;
Tk_Window wind = (Tk_Window)clientData; Tk_Window wind = (Tk_Window)clientData;
@ -1217,10 +1217,10 @@ keys_and_buttons:
*/ */
bool bool
x11SetDisplay (dispType, outFileName, mouseFileName) x11SetDisplay(
char *dispType; char *dispType,
char *outFileName; char *outFileName,
char *mouseFileName; char *mouseFileName)
{ {
char *planecount; char *planecount;
char *fullname; char *fullname;
@ -1235,8 +1235,8 @@ x11SetDisplay (dispType, outFileName, mouseFileName)
/* Set up the procedure values in the indirection table. */ /* Set up the procedure values in the indirection table. */
GrLockPtr = GrTkLock; GrLockPtr = (void (*)())GrTkLock;
GrUnlockPtr = GrTkUnlock; GrUnlockPtr = (void (*)())GrTkUnlock;
GrInitPtr = GrTkInit; GrInitPtr = GrTkInit;
GrClosePtr = GrTkClose; GrClosePtr = GrTkClose;
GrSetCMapPtr = GrTkSetCMap; GrSetCMapPtr = GrTkSetCMap;
@ -1321,9 +1321,9 @@ extern void MakeWindowCommand();
*/ */
bool bool
GrTkCreate(w, name) GrTkCreate(
MagWindow *w; MagWindow *w,
char *name; char *name)
{ {
Tk_Window tkwind, tktop; Tk_Window tkwind, tktop;
Window wind; Window wind;
@ -1545,8 +1545,8 @@ GrTkCreate(w, name)
*/ */
void void
GrTkDelete(w) GrTkDelete(
MagWindow *w; MagWindow *w)
{ {
Tk_Window xw; Tk_Window xw;
HashEntry *entry; HashEntry *entry;
@ -1576,8 +1576,8 @@ GrTkDelete(w)
*/ */
void void
GrTkConfigure(w) GrTkConfigure(
MagWindow *w; MagWindow *w)
{ {
if (w->w_flags & WIND_OFFSCREEN) return; if (w->w_flags & WIND_OFFSCREEN) return;
@ -1604,8 +1604,8 @@ GrTkConfigure(w)
*/ */
void void
GrTkRaise(w) GrTkRaise(
MagWindow *w; MagWindow *w)
{ {
Tk_Window tkwind; Tk_Window tkwind;
@ -1632,8 +1632,8 @@ GrTkRaise(w)
*/ */
void void
GrTkLower(w) GrTkLower(
MagWindow *w; MagWindow *w)
{ {
Tk_Window tkwind; Tk_Window tkwind;
@ -1660,9 +1660,9 @@ GrTkLower(w)
*/ */
void void
GrTkLock(w, flag) GrTkLock(
MagWindow *w; MagWindow *w,
bool flag; bool flag)
{ {
grSimpleLock(w, flag); grSimpleLock(w, flag);
@ -1699,8 +1699,8 @@ GrTkLock(w, flag)
*/ */
void void
GrTkUnlock(w) GrTkUnlock(
MagWindow *w; MagWindow *w)
{ {
GR_TK_FLUSH_BATCH(); GR_TK_FLUSH_BATCH();
grSimpleUnlock(w); grSimpleUnlock(w);
@ -1753,9 +1753,9 @@ GrTkEventPending()
*/ */
void void
GrTkIconUpdate(w, text) /* See Blt code */ GrTkIconUpdate(
MagWindow *w; MagWindow *w,
char *text; char *text)
{ {
Tk_Window tkwind; Tk_Window tkwind;
Window wind; Window wind;
@ -1806,8 +1806,8 @@ GrTkIconUpdate(w, text) /* See Blt code */
*/ */
int int
GrTkWindowId(tkname) GrTkWindowId(
char *tkname; char *tkname)
{ {
Tk_Window tkwind; Tk_Window tkwind;
MagWindow *mw; MagWindow *mw;

View File

@ -192,9 +192,9 @@ int grtkNbRects=0;
*/ */
void void
grtkDrawLines(lines, nb) grtkDrawLines(
XSegment lines[]; XSegment lines[],
int nb; int nb)
{ {
XDrawSegments(grXdpy, grCurrent.windowid, grGCDraw, XDrawSegments(grXdpy, grCurrent.windowid, grGCDraw,
lines, nb); lines, nb);
@ -213,9 +213,11 @@ grtkDrawLines(lines, nb)
*/ */
void void
grtkDrawLine (x1, y1, x2, y2) grtkDrawLine(
int x1, y1; /* Screen coordinates of first point. */ int x1,
int x2, y2; /* Screen coordinates of second point. */ int y1,
int x2,
int y2)
{ {
if (grtkNbLines == TK_BATCH_SIZE) GR_TK_FLUSH_LINES(); if (grtkNbLines == TK_BATCH_SIZE) GR_TK_FLUSH_LINES();
grtkLines[grtkNbLines].x1 = x1; grtkLines[grtkNbLines].x1 = x1;
@ -239,9 +241,9 @@ grtkDrawLine (x1, y1, x2, y2)
*/ */
void void
grtkFillRects(rects, nb) grtkFillRects(
XRectangle rects[]; XRectangle rects[],
int nb; int nb)
{ {
XFillRectangles(grXdpy, grCurrent.windowid, grGCFill, rects, nb); XFillRectangles(grXdpy, grCurrent.windowid, grGCFill, rects, nb);
} }
@ -259,8 +261,8 @@ grtkFillRects(rects, nb)
*/ */
void void
grtkFillRect(r) grtkFillRect(
Rect *r; /* Address of a rectangle in screen Rect *r) /* Address of a rectangle in screen
* coordinates. * coordinates.
*/ */
{ {
@ -289,9 +291,9 @@ grtkFillRect(r)
*/ */
void void
grtkFillPolygon(tp, np) grtkFillPolygon(
Point *tp; Point *tp,
int np; int np)
{ {
XPoint xp[5]; XPoint xp[5];
int i; int i;

View File

@ -52,15 +52,15 @@
#define GR_NUM_GRIDS 64 #define GR_NUM_GRIDS 64
bool bool
grtkDrawGrid (prect, outline, clip) grtkDrawGrid(
Rect *prect; /* A rectangle that forms the template Rect *prect, /* A rectangle that forms the template
* for the grid. Note: in order to maintain * for the grid. Note: in order to maintain
* precision for the grid, the rectangle * precision for the grid, the rectangle
* coordinates are specified in units of * coordinates are specified in units of
* screen coordinates multiplied by SUBPIXEL. * screen coordinates multiplied by SUBPIXEL.
*/ */
int outline; /* the outline style */ int outline, /* the outline style */
Rect *clip; /* a clipping rectangle */ Rect *clip) /* a clipping rectangle */
{ {
int xsize, ysize; int xsize, ysize;
int x, y; int x, y;
@ -133,8 +133,8 @@ grtkDrawGrid (prect, outline, clip)
*/ */
void void
grtkSetCharSize (size) grtkSetCharSize(
int size; /* Width of characters, in pixels (6 or 8). */ int size) /* Width of characters, in pixels (6 or 8). */
{ {
grCurrent.fontSize = size; grCurrent.fontSize = size;
switch (size) switch (size)
@ -177,10 +177,10 @@ grtkSetCharSize (size)
*/ */
int int
GrTkTextSize(text, size, r) GrTkTextSize(
char *text; char *text,
int size; int size,
Rect *r; Rect *r)
{ {
Tk_FontMetrics overall; Tk_FontMetrics overall;
Tk_Font font; Tk_Font font;
@ -233,9 +233,10 @@ GrTkTextSize(text, size, r)
*/ */
int int
GrTkReadPixel (w, x, y) GrTkReadPixel(
MagWindow *w; MagWindow *w,
int x,y; /* the location of a pixel in screen coords */ int x,
int y)
{ {
XImage *image; XImage *image;
unsigned long value; unsigned long value;
@ -265,9 +266,9 @@ GrTkReadPixel (w, x, y)
*/ */
void void
GrTkBitBlt(r, p) GrTkBitBlt(
Rect *r; Rect *r,
Point *p; Point *p)
{ {
Window wind = grCurrent.windowid; Window wind = grCurrent.windowid;
@ -295,9 +296,9 @@ GrTkBitBlt(r, p)
*/ */
void void
grtkRectConvert(mr, xr) grtkRectConvert(
Rect *mr; /* source rectangle pointer */ Rect *mr, /* source rectangle pointer */
XRectangle *xr; /* destination rectangle pointer */ XRectangle *xr) /* destination rectangle pointer */
{ {
xr->x = mr->r_xbot; xr->x = mr->r_xbot;
xr->y = grMagicToX(mr->r_ytop); xr->y = grMagicToX(mr->r_ytop);
@ -316,14 +317,14 @@ grtkRectConvert(mr, xr)
*/ */
void void
grtkFontText(text, font, size, rotate, pos, clip, obscure) grtkFontText(
char *text; char *text,
int font; int font,
int size; /* pixel size of the text */ int size, /* pixel size of the text */
int rotate; /* text rotation */ int rotate, /* text rotation */
Point *pos; /* text base position */ Point *pos, /* text base position */
Rect *clip; Rect *clip,
LinkedRect *obscure; LinkedRect *obscure)
{ {
char *tptr; char *tptr;
FontChar *ccur, *clist; FontChar *ccur, *clist;
@ -477,14 +478,13 @@ grtkFontText(text, font, size, rotate, pos, clip, obscure)
*/ */
void void
grtkPutText (text, pos, clip, obscure) grtkPutText(
char *text; /* The text to be drawn. */ char *text, /* The text to be drawn. */
Point *pos; /* A point located at the leftmost point of Point *pos, /* A point located at the leftmost point of
* the baseline for this string. * the baseline for this string.
*/ */
Rect *clip; /* A rectangle to clip against */ Rect *clip, /* A rectangle to clip against */
LinkedRect *obscure; /* A list of obscuring rectangles */ LinkedRect *obscure) /* A list of obscuring rectangles */
{ {
Rect location; Rect location;
Rect overlap; Rect overlap;
@ -547,10 +547,9 @@ grtkPutText (text, pos, clip, obscure)
*/ */
void void
grtkGeoSub(r, area) grtkGeoSub(
Rect *r; /* Rectangle to be subtracted from. */ Rect *r, /* Rectangle to be subtracted from. */
Rect *area; /* Area to be subtracted. */ Rect *area) /* Area to be subtracted. */
{ {
if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop; if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop;
else else

View File

@ -140,8 +140,8 @@ grTkFreeFonts()
*/ */
void void
grTkFreeCursors(glyphs) grTkFreeCursors(
GrGlyphs *glyphs; GrGlyphs *glyphs)
{ {
int i; int i;
for (i = 0; i < glyphs->gr_num; i++) for (i = 0; i < glyphs->gr_num; i++)
@ -169,8 +169,8 @@ typedef struct {
} CursorCache; } CursorCache;
void void
grTkDefineCursor(glyphs) grTkDefineCursor(
GrGlyphs *glyphs; GrGlyphs *glyphs)
{ {
char *fgname, *bgname; char *fgname, *bgname;
int glyphnum; int glyphnum;
@ -308,8 +308,8 @@ grTkDefineCursor(glyphs)
*/ */
char * char *
GrTkWindowName(mw) GrTkWindowName(
MagWindow *mw; MagWindow *mw)
{ {
Tk_Window tkwind; Tk_Window tkwind;
char *tkname; char *tkname;
@ -332,7 +332,8 @@ GrTkWindowName(mw)
*/ */
void void
grtkFreeBackingStore(MagWindow *window) grtkFreeBackingStore(
MagWindow *window)
{ {
Pixmap pmap = (Pixmap)window->w_backingStore; Pixmap pmap = (Pixmap)window->w_backingStore;
if (pmap == (Pixmap)NULL) return; if (pmap == (Pixmap)NULL) return;
@ -357,7 +358,8 @@ grtkFreeBackingStore(MagWindow *window)
*/ */
void void
grtkCreateBackingStore(MagWindow *w) grtkCreateBackingStore(
MagWindow *w)
{ {
Pixmap pmap; Pixmap pmap;
Tk_Window tkwind = (Tk_Window)w->w_grdata; Tk_Window tkwind = (Tk_Window)w->w_grdata;
@ -399,7 +401,9 @@ grtkCreateBackingStore(MagWindow *w)
*/ */
bool bool
grtkGetBackingStore(MagWindow *w, Rect *area) grtkGetBackingStore(
MagWindow *w,
Rect *area)
{ {
Pixmap pmap; Pixmap pmap;
Tk_Window tkwind = (Tk_Window)w->w_grdata; Tk_Window tkwind = (Tk_Window)w->w_grdata;
@ -466,7 +470,9 @@ grtkGetBackingStore(MagWindow *w, Rect *area)
*/ */
bool bool
grtkScrollBackingStore(MagWindow *w, Point *shift) grtkScrollBackingStore(
MagWindow *w,
Point *shift)
{ {
Pixmap pmap; Pixmap pmap;
Tk_Window tkwind = (Tk_Window)w->w_grdata; Tk_Window tkwind = (Tk_Window)w->w_grdata;
@ -531,7 +537,9 @@ grtkScrollBackingStore(MagWindow *w, Point *shift)
*/ */
void void
grtkPutBackingStore(MagWindow *w, Rect *area) grtkPutBackingStore(
MagWindow *w,
Rect *area)
{ {
Pixmap pmap = (Pixmap)w->w_backingStore; Pixmap pmap = (Pixmap)w->w_backingStore;
Tk_Window tkwind = (Tk_Window)w->w_grdata; Tk_Window tkwind = (Tk_Window)w->w_grdata;
@ -615,8 +623,8 @@ grtkPutBackingStore(MagWindow *w, Rect *area)
*/ */
char * char *
GrTkGetColorByName(name) GrTkGetColorByName(
char *name; char *name)
{ {
Tk_Window tkwind = Tk_MainWindow(magicinterp); Tk_Window tkwind = Tk_MainWindow(magicinterp);
int style, red, green, blue; int style, red, green, blue;
@ -896,12 +904,12 @@ ImgLayerCreate(interp, name, argc, argv, typePtr, master, clientDataPtr)
*/ */
static int static int
ImgLayerConfigureMaster(masterPtr, objc, objv, flags) ImgLayerConfigureMaster(
LayerMaster *masterPtr; /* Pointer to data structure describing LayerMaster *masterPtr, /* Pointer to data structure describing
* overall pixmap image to (reconfigure). */ * overall pixmap image to (reconfigure). */
int objc; /* Number of entries in objv. */ int objc, /* Number of entries in objv. */
Tcl_Obj *const objv[]; /* Pairs of configuration options for image. */ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */
int flags; /* Flags to pass to Tk_ConfigureWidget, int flags) /* Flags to pass to Tk_ConfigureWidget,
* such as TK_CONFIG_ARGV_ONLY. */ * such as TK_CONFIG_ARGV_ONLY. */
{ {
LayerInstance *instancePtr; LayerInstance *instancePtr;
@ -963,8 +971,8 @@ ImgLayerConfigureMaster(masterPtr, objc, objv, flags)
*/ */
void void
grDrawOffScreenBox(rect) grDrawOffScreenBox(
Rect *rect; Rect *rect)
{ {
(*grDrawLinePtr)(rect->r_xbot, rect->r_ytop - 1, rect->r_xtop - 1, (*grDrawLinePtr)(rect->r_xbot, rect->r_ytop - 1, rect->r_xtop - 1,
rect->r_ytop - 1); rect->r_ytop - 1);
@ -1003,8 +1011,8 @@ grDrawOffScreenBox(rect)
#define LAYER_LAYOUT 3 #define LAYER_LAYOUT 3
static void static void
ImgLayerConfigureInstance(instancePtr) ImgLayerConfigureInstance(
LayerInstance *instancePtr; /* Instance to reconfigure. */ LayerInstance *instancePtr) /* Instance to reconfigure. */
{ {
LayerMaster *masterPtr = instancePtr->masterPtr; LayerMaster *masterPtr = instancePtr->masterPtr;
XGCValues gcValues; XGCValues gcValues;
@ -1241,11 +1249,11 @@ error:
*/ */
static int static int
ImgLayerCmd(clientData, interp, objc, objv) ImgLayerCmd(
ClientData clientData; /* Information about the image master. */ ClientData clientData, /* Information about the image master. */
Tcl_Interp *interp; /* Current interpreter. */ Tcl_Interp *interp, /* Current interpreter. */
int objc; /* Number of arguments. */ int objc, /* Number of arguments. */
Tcl_Obj *const objv[]; /* Argument objects. */ Tcl_Obj *const objv[]) /* Argument objects. */
{ {
static char *layerOptions[] = {"cget", "configure", (char *) NULL}; static char *layerOptions[] = {"cget", "configure", (char *) NULL};
LayerMaster *masterPtr = (LayerMaster *) clientData; LayerMaster *masterPtr = (LayerMaster *) clientData;
@ -1310,10 +1318,10 @@ ImgLayerCmd(clientData, interp, objc, objv)
*/ */
static ClientData static ClientData
ImgLayerGet(tkwin, masterData) ImgLayerGet(
Tk_Window tkwin; /* Window in which the instance will be Tk_Window tkwin, /* Window in which the instance will be
* used. */ * used. */
ClientData masterData; /* Pointer to our master structure for the ClientData masterData) /* Pointer to our master structure for the
* image. */ * image. */
{ {
LayerMaster *masterPtr = (LayerMaster *) masterData; LayerMaster *masterPtr = (LayerMaster *) masterData;
@ -1376,17 +1384,17 @@ ImgLayerGet(tkwin, masterData)
*/ */
static void static void
ImgLayerDisplay(clientData, display, drawable, imageX, imageY, width, ImgLayerDisplay(
height, drawableX, drawableY) ClientData clientData, /* Pointer to LayerInstance structure for
ClientData clientData; /* Pointer to LayerInstance structure for
* for instance to be displayed. */ * for instance to be displayed. */
Display *display; /* Display on which to draw image. */ Display *display, /* Display on which to draw image. */
Drawable drawable; /* Pixmap or window in which to draw image. */ Drawable drawable, /* Pixmap or window in which to draw image. */
int imageX, imageY; /* Upper-left corner of region within image int imageX,
* to draw. */ int imageY,
int width, height; /* Dimensions of region within image to draw. */ int width,
int drawableX, drawableY; /* Coordinates within drawable that int height,
* correspond to imageX and imageY. */ int drawableX,
int drawableY)
{ {
LayerInstance *instancePtr = (LayerInstance *) clientData; LayerInstance *instancePtr = (LayerInstance *) clientData;
@ -1420,10 +1428,10 @@ ImgLayerDisplay(clientData, display, drawable, imageX, imageY, width,
*/ */
static void static void
ImgLayerFree(clientData, display) ImgLayerFree(
ClientData clientData; /* Pointer to LayerInstance structure for ClientData clientData, /* Pointer to LayerInstance structure for
* for instance to be displayed. */ * for instance to be displayed. */
Display *display; /* Display containing window that used image. */ Display *display) /* Display containing window that used image. */
{ {
LayerInstance *instancePtr = (LayerInstance *) clientData; LayerInstance *instancePtr = (LayerInstance *) clientData;
LayerInstance *prevPtr; LayerInstance *prevPtr;
@ -1479,8 +1487,8 @@ ImgLayerFree(clientData, display)
*/ */
static void static void
ImgLayerDelete(masterData) ImgLayerDelete(
ClientData masterData; /* Pointer to BitmapMaster structure for ClientData masterData) /* Pointer to BitmapMaster structure for
* image. Must not have any more instances. */ * image. Must not have any more instances. */
{ {
LayerMaster *masterPtr = (LayerMaster *) masterData; LayerMaster *masterPtr = (LayerMaster *) masterData;
@ -1515,8 +1523,8 @@ ImgLayerDelete(masterData)
*/ */
static void static void
ImgLayerCmdDeletedProc(clientData) ImgLayerCmdDeletedProc(
ClientData clientData; /* Pointer to BitmapMaster structure for ClientData clientData) /* Pointer to BitmapMaster structure for
* image. */ * image. */
{ {
LayerMaster *masterPtr = (LayerMaster *) clientData; LayerMaster *masterPtr = (LayerMaster *) clientData;
@ -1542,7 +1550,8 @@ ImgLayerCmdDeletedProc(clientData)
*/ */
void void
RegisterTkCommands(Tcl_Interp *interp) RegisterTkCommands(
Tcl_Interp *interp)
{ {
Tcl_CreateCommand(interp, "magic::magiccolor", Tcl_CreateCommand(interp, "magic::magiccolor",
(Tcl_CmdProc *)_magic_magiccolor, (ClientData)NULL, (Tcl_CmdProc *)_magic_magiccolor, (ClientData)NULL,

View File

@ -134,9 +134,9 @@ extern bool grx11GetCursorPos();
*/ */
void void
grx11SetWMandC (mask, c) grx11SetWMandC(
int mask; /* New value for write mask */ int mask, /* New value for write mask */
int c; /* New value for current color */ int c) /* New value for current color */
{ {
static int oldC = -1; static int oldC = -1;
static int oldM = -1; static int oldM = -1;
@ -176,8 +176,8 @@ grx11SetWMandC (mask, c)
*/ */
void void
grx11SetLineStyle (style) grx11SetLineStyle(
int style; /* New stipple pattern for lines. */ int style) /* New stipple pattern for lines. */
{ {
static int oldStyle = -1; static int oldStyle = -1;
LineStyle *linestyle; LineStyle *linestyle;
@ -271,9 +271,9 @@ grx11SetLineStyle (style)
*/ */
void void
grx11SetSPattern (sttable, numstipples) grx11SetSPattern(
int **sttable; /* Table of patterns */ int **sttable, /* Table of patterns */
int numstipples; /* Number of stipples */ int numstipples) /* Number of stipples */
{ {
Pixmap p; Pixmap p;
int i, x, y, pat; int i, x, y, pat;
@ -311,8 +311,8 @@ grx11SetSPattern (sttable, numstipples)
*/ */
void void
grx11SetStipple (stipple) grx11SetStipple(
int stipple; /* The stipple number to be used. */ int stipple) /* The stipple number to be used. */
{ {
static int oldStip = -1; static int oldStip = -1;
if (stipple == oldStip) return; if (stipple == oldStip) return;
@ -343,8 +343,8 @@ grx11SetStipple (stipple)
*/ */
bool bool
GrX11Init(dispType) GrX11Init(
char *dispType; char *dispType)
{ {
int i,j; int i,j;
XVisualInfo grvisual_info, *grvisual_get, grtemplate; XVisualInfo grvisual_info, *grvisual_get, grtemplate;
@ -965,10 +965,10 @@ grX11Stdin(
*/ */
bool bool
x11SetDisplay (dispType, outFileName, mouseFileName) x11SetDisplay(
char *dispType; /* arguments not used by X */ char *dispType, /* arguments not used by X */
char *outFileName; char *outFileName,
char *mouseFileName; char *mouseFileName)
{ {
int fildes[2],fildes2[2]; int fildes[2],fildes2[2];
char *fullname; char *fullname;
@ -1147,9 +1147,9 @@ grXWStdin(
*/ */
bool bool
GrX11Create(w, name) GrX11Create(
MagWindow *w; MagWindow *w,
char *name; char *name)
{ {
Window wind; Window wind;
static int firstWindow = 1; static int firstWindow = 1;
@ -1279,8 +1279,8 @@ GrX11Create(w, name)
*/ */
void void
GrX11Delete(w) GrX11Delete(
MagWindow *w; MagWindow *w)
{ {
Window xw; Window xw;
HashEntry *entry; HashEntry *entry;
@ -1308,8 +1308,8 @@ GrX11Delete(w)
*/ */
void void
GrX11Configure(w) GrX11Configure(
MagWindow *w; MagWindow *w)
{ {
XMoveResizeWindow(grXdpy,(Window) w->w_grdata, XMoveResizeWindow(grXdpy,(Window) w->w_grdata,
w->w_frameArea.r_xbot, grMagicToXs(w->w_frameArea.r_ytop), w->w_frameArea.r_xbot, grMagicToXs(w->w_frameArea.r_ytop),
@ -1334,8 +1334,8 @@ GrX11Configure(w)
*/ */
void void
GrX11Raise(w) GrX11Raise(
MagWindow *w; MagWindow *w)
{ {
XRaiseWindow(grXdpy, (Window) w->w_grdata ); XRaiseWindow(grXdpy, (Window) w->w_grdata );
} }
@ -1357,8 +1357,8 @@ GrX11Raise(w)
*/ */
void void
GrX11Lower(w) GrX11Lower(
MagWindow *w; MagWindow *w)
{ {
XLowerWindow(grXdpy, (Window) w->w_grdata ); XLowerWindow(grXdpy, (Window) w->w_grdata );
} }
@ -1381,9 +1381,9 @@ GrX11Lower(w)
*/ */
void void
GrX11Lock(w, flag) GrX11Lock(
MagWindow *w; MagWindow *w,
bool flag; bool flag)
{ {
grSimpleLock(w, flag); grSimpleLock(w, flag);
if ( w != GR_LOCK_SCREEN ) if ( w != GR_LOCK_SCREEN )
@ -1411,8 +1411,8 @@ GrX11Lock(w, flag)
*/ */
void void
GrX11Unlock(w) GrX11Unlock(
MagWindow *w; MagWindow *w)
{ {
GR_X_FLUSH_BATCH(); GR_X_FLUSH_BATCH();
grSimpleUnlock(w); grSimpleUnlock(w);
@ -1432,10 +1432,9 @@ GrX11Unlock(w)
*/ */
void void
GrX11IconUpdate(w,text) GrX11IconUpdate(
MagWindow *w; MagWindow *w,
char *text; char *text)
{ {
Window wind = (Window)(w->w_grdata); Window wind = (Window)(w->w_grdata);
XClassHint class; XClassHint class;

View File

@ -225,9 +225,9 @@ int grx11NbRects=0;
*/ */
void void
grx11DrawLines(lines, nb) grx11DrawLines(
XSegment lines[]; XSegment lines[],
int nb; int nb)
{ {
XDrawSegments(grXdpy, grCurrent.window, grGCDraw, XDrawSegments(grXdpy, grCurrent.window, grGCDraw,
lines, nb); lines, nb);
@ -245,9 +245,11 @@ grx11DrawLines(lines, nb)
*/ */
void void
grx11DrawLine (x1, y1, x2, y2) grx11DrawLine(
int x1, y1; /* Screen coordinates of first point. */ int x1,
int x2, y2; /* Screen coordinates of second point. */ int y1,
int x2,
int y2)
{ {
if (grx11NbLines == X11_BATCH_SIZE) GR_X_FLUSH_LINES(); if (grx11NbLines == X11_BATCH_SIZE) GR_X_FLUSH_LINES();
grx11Lines[grx11NbLines].x1 = x1; grx11Lines[grx11NbLines].x1 = x1;
@ -270,9 +272,9 @@ grx11DrawLine (x1, y1, x2, y2)
*/ */
void void
grx11FillRects(rects, nb) grx11FillRects(
XRectangle rects[]; XRectangle rects[],
int nb; int nb)
{ {
XFillRectangles(grXdpy, grCurrent.window, grGCFill, rects, nb); XFillRectangles(grXdpy, grCurrent.window, grGCFill, rects, nb);
} }
@ -290,8 +292,8 @@ grx11FillRects(rects, nb)
*/ */
void void
grx11FillRect(r) grx11FillRect(
Rect *r; /* Address of a rectangle in screen Rect *r) /* Address of a rectangle in screen
* coordinates. * coordinates.
*/ */
{ {
@ -315,9 +317,9 @@ grx11FillRect(r)
*/ */
void void
grx11FillPolygon(tp, np) grx11FillPolygon(
Point *tp; Point *tp,
int np; int np)
{ {
XPoint xp[5]; XPoint xp[5];
int i; int i;

View File

@ -68,15 +68,15 @@ static XFontStruct *grXFonts[4];
#define GR_NUM_GRIDS 64 #define GR_NUM_GRIDS 64
bool bool
grx11DrawGrid (prect, outline, clip) grx11DrawGrid(
Rect *prect; /* A rectangle that forms the template Rect *prect, /* A rectangle that forms the template
* for the grid. Note: in order to maintain * for the grid. Note: in order to maintain
* precision for the grid, the rectangle * precision for the grid, the rectangle
* coordinates are specified in units of * coordinates are specified in units of
* screen coordinates multiplied by SUBPIXEL. * screen coordinates multiplied by SUBPIXEL.
*/ */
int outline; /* the outline style */ int outline, /* the outline style */
Rect *clip; /* a clipping rectangle */ Rect *clip) /* a clipping rectangle */
{ {
int xsize, ysize; int xsize, ysize;
int x, y; int x, y;
@ -194,8 +194,8 @@ grx11LoadFont()
*/ */
void void
grx11SetCharSize (size) grx11SetCharSize(
int size; /* Width of characters, in pixels (6 or 8). */ int size) /* Width of characters, in pixels (6 or 8). */
{ {
grCurrent.fontSize = size; grCurrent.fontSize = size;
switch (size) switch (size)
@ -238,10 +238,10 @@ grx11SetCharSize (size)
*/ */
int int
GrX11TextSize(text, size, r) GrX11TextSize(
char *text; char *text,
int size; int size,
Rect *r; Rect *r)
{ {
XCharStruct overall; XCharStruct overall;
XFontStruct *font; XFontStruct *font;
@ -292,9 +292,10 @@ GrX11TextSize(text, size, r)
*/ */
int int
GrX11ReadPixel (w, x, y) GrX11ReadPixel(
MagWindow *w; MagWindow *w,
int x,y; /* the location of a pixel in screen coords */ int x,
int y)
{ {
XImage *image; XImage *image;
unsigned long value; unsigned long value;
@ -326,9 +327,9 @@ GrX11ReadPixel (w, x, y)
*/ */
void void
GrX11BitBlt(r, p) GrX11BitBlt(
Rect *r; Rect *r,
Point *p; Point *p)
{ {
Drawable wind = (Drawable)grCurrent.window; Drawable wind = (Drawable)grCurrent.window;
@ -354,7 +355,8 @@ static GC grXcopyGC = (GC)NULL;
*/ */
void void
grx11FreeBackingStore(MagWindow *window) grx11FreeBackingStore(
MagWindow *window)
{ {
Pixmap pmap = (Pixmap)window->w_backingStore; Pixmap pmap = (Pixmap)window->w_backingStore;
if (pmap == (Pixmap)NULL) return; if (pmap == (Pixmap)NULL) return;
@ -380,7 +382,8 @@ grx11FreeBackingStore(MagWindow *window)
*/ */
void void
grx11CreateBackingStore(MagWindow *w) grx11CreateBackingStore(
MagWindow *w)
{ {
Pixmap pmap; Pixmap pmap;
Window wind = (Window)w->w_grdata; Window wind = (Window)w->w_grdata;
@ -433,7 +436,9 @@ grx11CreateBackingStore(MagWindow *w)
*/ */
bool bool
grx11GetBackingStore(MagWindow *w, Rect *area) grx11GetBackingStore(
MagWindow *w,
Rect *area)
{ {
Pixmap pmap; Pixmap pmap;
Window wind = (Window)w->w_grdata; Window wind = (Window)w->w_grdata;
@ -482,7 +487,9 @@ grx11GetBackingStore(MagWindow *w, Rect *area)
*/ */
bool bool
grx11ScrollBackingStore(MagWindow *w, Point *shift) grx11ScrollBackingStore(
MagWindow *w,
Point *shift)
{ {
Pixmap pmap; Pixmap pmap;
unsigned int width, height; unsigned int width, height;
@ -541,7 +548,9 @@ grx11ScrollBackingStore(MagWindow *w, Point *shift)
*/ */
void void
grx11PutBackingStore(MagWindow *w, Rect *area) grx11PutBackingStore(
MagWindow *w,
Rect *area)
{ {
Pixmap pmap = (Pixmap)w->w_backingStore; Pixmap pmap = (Pixmap)w->w_backingStore;
Window wind = (Window)w->w_grdata; Window wind = (Window)w->w_grdata;
@ -592,9 +601,9 @@ grx11PutBackingStore(MagWindow *w, Rect *area)
*/ */
void void
grx11RectConvert(mr, xr) grx11RectConvert(
Rect *mr; Rect *mr,
XRectangle *xr; XRectangle *xr)
{ {
xr->x = mr->r_xbot; xr->x = mr->r_xbot;
xr->y = grMagicToX(mr->r_ytop); xr->y = grMagicToX(mr->r_ytop);
@ -613,14 +622,14 @@ grx11RectConvert(mr, xr)
*/ */
void void
grx11FontText(text, font, size, rotate, pos, clip, obscure) grx11FontText(
char *text; char *text,
int font; int font,
int size; /* pixel size of the text */ int size, /* pixel size of the text */
int rotate; /* text rotation */ int rotate, /* text rotation */
Point *pos; /* text base position */ Point *pos, /* text base position */
Rect *clip; Rect *clip,
LinkedRect *obscure; LinkedRect *obscure)
{ {
char *tptr; char *tptr;
FontChar *ccur, *clist; FontChar *ccur, *clist;
@ -774,14 +783,13 @@ grx11FontText(text, font, size, rotate, pos, clip, obscure)
*/ */
void void
grx11PutText (text, pos, clip, obscure) grx11PutText(
char *text; /* The text to be drawn. */ char *text, /* The text to be drawn. */
Point *pos; /* A point located at the leftmost point of Point *pos, /* A point located at the leftmost point of
* the baseline for this string. * the baseline for this string.
*/ */
Rect *clip; /* A rectangle to clip against */ Rect *clip, /* A rectangle to clip against */
LinkedRect *obscure; /* A list of obscuring rectangles */ LinkedRect *obscure) /* A list of obscuring rectangles */
{ {
Rect location; Rect location;
Rect overlap; Rect overlap;
@ -842,9 +850,9 @@ grx11PutText (text, pos, clip, obscure)
*/ */
void void
grX11suGeoSub(r, area) grX11suGeoSub(
Rect *r; /* Rectangle to be subtracted from. */ Rect *r, /* Rectangle to be subtracted from. */
Rect *area; /* Area to be subtracted. */ Rect *area) /* Area to be subtracted. */
{ {
if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop; if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop;
else else

View File

@ -53,9 +53,9 @@ Cursor grCursors[MAX_CURSORS];
*/ */
void void
GrX11DrawGlyph (gl, p) GrX11DrawGlyph(
GrGlyph *gl; /* A single glyph */ GrGlyph *gl, /* A single glyph */
Point *p; /* screen pos of lower left corner */ Point *p) /* screen pos of lower left corner */
{ {
Rect bBox; Rect bBox;
bool anyObscure; bool anyObscure;
@ -168,8 +168,8 @@ GrX11DrawGlyph (gl, p)
*/ */
void void
grx11DefineCursor(glyphs) grx11DefineCursor(
GrGlyphs *glyphs; GrGlyphs *glyphs)
{ {
int glyphnum; int glyphnum;
Rect oldClip; Rect oldClip;
@ -301,8 +301,8 @@ grx11DefineCursor(glyphs)
*/ */
void void
GrX11SetCursor(cursorNum) GrX11SetCursor(
int cursorNum; /* The cursor number as defined in the display int cursorNum) /* The cursor number as defined in the display
* styles file. * styles file.
*/ */
{ {

View File

@ -63,9 +63,9 @@ pthread_t xloop_thread = 0;
*/ */
void void
ParseEvent (event, parentID) ParseEvent(
XEvent *event; XEvent *event,
int parentID; int parentID)
{ {
if (event->type == KeyPress) if (event->type == KeyPress)
{ {
@ -161,8 +161,8 @@ ParseEvent (event, parentID)
*/ */
void void
xloop_begin(window) xloop_begin(
Window window; Window window)
{ {
XEvent xevent; XEvent xevent;
int parentID; int parentID;
@ -201,8 +201,8 @@ xloop_begin(window)
*/ */
int int
xloop_create(window) xloop_create(
Window window; Window window)
{ {
int status = 0; int status = 0;

View File

@ -25,6 +25,15 @@
#include "utils/magic.h" #include "utils/magic.h"
#include "utils/geometry.h" #include "utils/geometry.h"
/* Forward declaration to avoid circular include with windows/windows.h */
struct WIND_S1;
typedef struct WIND_S1 MagWindow;
/* TileType is defined in database/database.h, which sits above graphics in
* the include hierarchy; repeat the (identical) typedef here so prototypes
* can name it without creating a circular dependency. */
typedef int TileType;
/* data structures */ /* data structures */
typedef struct { typedef struct {
int idx, mask, color, outline, fill, stipple; int idx, mask, color, outline, fill, stipple;
@ -54,13 +63,13 @@ extern void (*GrLockPtr)();
extern void (*GrUnlockPtr)(); extern void (*GrUnlockPtr)();
extern bool GrHaveLock(); extern bool GrHaveLock();
extern void GrClipTo(); extern void GrClipTo();
extern void GrClipBox(); extern void GrClipBox(Rect *prect, int style);
extern void GrClipLine(); extern void GrClipLine();
extern bool GrPutText(); extern bool GrPutText(char *str, int style, Point *p, int pos, int size, bool adjust, Rect *clip, Rect *actual);
extern void GrFillPolygon(); extern void GrFillPolygon();
extern void (*GrDrawGlyphPtr)(); extern void (*GrDrawGlyphPtr)();
extern void (*GrBitBltPtr)(); extern void (*GrBitBltPtr)();
extern int (*GrReadPixelPtr)(); extern int (*GrReadPixelPtr)(MagWindow *w, int x, int y);
extern void (*GrFlushPtr)(); extern void (*GrFlushPtr)();
/* Tablet routines */ /* Tablet routines */
@ -83,8 +92,10 @@ extern bool GrDrawGlyphNum();
#define GrFastBox(x) GrDrawFastBox(x, 0) #define GrFastBox(x) GrDrawFastBox(x, 0)
/* external color map routines */ /* external color map routines */
extern bool GrReadCMap(), GrSaveCMap(); extern bool GrReadCMap(char *techStyle, char *dispType, char *monType, char *path, char *libPath);
extern bool GrGetColor(), GrPutColor(); extern bool GrSaveCMap(char *techStyle, char *dispType, char *monType, char *path, char *libPath);
extern bool GrGetColor(int color, int *red, int *green, int *blue);
extern bool GrPutColor(int color, int red, int green, int blue);
extern int GrNameToColor(); extern int GrNameToColor();
extern void GrPutManyColors(); extern void GrPutManyColors();
extern void (*GrSetCMapPtr)(); extern void (*GrSetCMapPtr)();
@ -139,7 +150,7 @@ extern void (*GrResumePtr)();
#define GrResume (*GrResumePtr) #define GrResume (*GrResumePtr)
/* C99 compat */ /* C99 compat */
extern void GrClipTriangle(); extern void GrClipTriangle(Rect *r, Rect *c, bool clipped, TileType dinfo, Point *points, int *np);
extern void GrBox(); extern void GrBox();
extern bool GrFontText(); extern bool GrFontText();
extern void GrDiagonal(); extern void GrDiagonal();