select: convert K&R function definitions to ANSI C

Convert the old-style (K&R) function definitions in select/ 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.

Updates select.h with prototypes for the affected declarations.

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:49:04 +02:00
parent 61a0a0541c
commit 1ac06cafc6
No known key found for this signature in database
GPG Key ID: 588785BFDFB01ABD
4 changed files with 155 additions and 152 deletions

View File

@ -83,9 +83,9 @@ static Plane *selRedisplayPlane;
*/ */
void void
SelRedisplay(window, plane) SelRedisplay(
MagWindow *window; /* Window in which to redisplay. */ MagWindow *window, /* Window in which to redisplay. */
Plane *plane; /* Non-space tiles on this plane indicate Plane *plane) /* Non-space tiles on this plane indicate
* which areas must have their highlights * which areas must have their highlights
* redrawn. * redrawn.
*/ */
@ -195,7 +195,10 @@ SelRedisplay(window, plane)
*/ */
int int
selAlways1(Tile *tile, TileType dinfo, ClientData clientdata) selAlways1(
Tile *tile,
TileType dinfo,
ClientData clientdata)
{ {
return 1; return 1;
} }
@ -206,10 +209,10 @@ selAlways1(Tile *tile, TileType dinfo, ClientData clientdata)
*/ */
int int
selRedisplayFunc(tile, dinfo, window) selRedisplayFunc(
Tile *tile; /* Tile to be drawn on highlight layer. */ Tile *tile, /* Tile to be drawn on highlight layer. */
TileType dinfo; /* Split tile information */ TileType dinfo, /* Split tile information */
MagWindow *window; /* Window in which to redisplay. */ MagWindow *window) /* Window in which to redisplay. */
{ {
Rect area, edge, screenEdge, tmpr; Rect area, edge, screenEdge, tmpr;
Tile *neighbor; Tile *neighbor;
@ -307,9 +310,9 @@ searchleft:
*/ */
int int
selRedisplayCellFunc(scx, window) selRedisplayCellFunc(
SearchContext *scx; /* Describes cell found. */ SearchContext *scx, /* Describes cell found. */
MagWindow *window; /* Window in which to redisplay. */ MagWindow *window) /* Window in which to redisplay. */
{ {
Rect tmp, screen, bbox; Rect tmp, screen, bbox;
Point p; Point p;
@ -392,11 +395,11 @@ selRedisplayCellFunc(scx, window)
*/ */
void void
SelSetDisplay(selectUse, displayRoot) SelSetDisplay(
CellUse *selectUse; /* Cell whose contents are to be CellUse *selectUse, /* Cell whose contents are to be
* highlighted. * highlighted.
*/ */
CellDef *displayRoot; /* Cell definition on top of whose contents CellDef *displayRoot) /* Cell definition on top of whose contents
* the highlights are to be displayed. Must * the highlights are to be displayed. Must
* be the root cell of a window. May be NULL * be the root cell of a window. May be NULL
* to turn off selection displaying. * to turn off selection displaying.
@ -423,11 +426,11 @@ typedef struct {
} FeedLayerData; } FeedLayerData;
void void
SelCopyToFeedback(celldef, seluse, style, text) SelCopyToFeedback(
CellDef *celldef; /* Cell def to hold feedback */ CellDef *celldef, /* Cell def to hold feedback */
CellUse *seluse; /* Cell use holding selection */ CellUse *seluse, /* Cell use holding selection */
int style; /* Style to use for feedback */ int style, /* Style to use for feedback */
char *text; /* Text to attach to feedback */ char *text) /* Text to attach to feedback */
{ {
int selFeedbackFunc(); /* Forward reference */ int selFeedbackFunc(); /* Forward reference */
int i; int i;
@ -459,10 +462,10 @@ SelCopyToFeedback(celldef, seluse, style, text)
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
int int
selFeedbackFunc(tile, dinfo, fld) selFeedbackFunc(
Tile *tile; Tile *tile,
TileType dinfo; TileType dinfo,
FeedLayerData *fld; FeedLayerData *fld)
{ {
Rect area; Rect area;

View File

@ -96,13 +96,13 @@ static StretchArea *selStretchList; /* List of areas to paint. */
*/ */
void void
SelectDelete(msg, do_clear) SelectDelete(
char *msg; /* Some information to print in error messages. char *msg, /* Some information to print in error messages.
* For example, if called as part of a move procedure, * For example, if called as part of a move procedure,
* supply "moved". This will appear in messages of * supply "moved". This will appear in messages of
* the form "only edit cell information was moved". * the form "only edit cell information was moved".
*/ */
bool do_clear; /* If TRUE, clear the select def before returning. */ bool do_clear) /* If TRUE, clear the select def before returning. */
{ {
bool nonEdit; bool nonEdit;
Rect editArea; Rect editArea;
@ -169,13 +169,13 @@ SelectDelete(msg, do_clear)
*/ */
void void
SelectDeleteUses(msg, do_clear) SelectDeleteUses(
char *msg; /* Some information to print in error messages. char *msg, /* Some information to print in error messages.
* For example, if called as part of a move procedure, * For example, if called as part of a move procedure,
* supply "moved". This will appear in messages of * supply "moved". This will appear in messages of
* the form "only edit cell information was moved". * the form "only edit cell information was moved".
*/ */
bool do_clear; /* If TRUE, clear the select def before returning. */ bool do_clear) /* If TRUE, clear the select def before returning. */
{ {
bool nonEdit; bool nonEdit;
Rect editArea; Rect editArea;
@ -207,9 +207,9 @@ SelectDeleteUses(msg, do_clear)
/* Search function to delete paint. */ /* Search function to delete paint. */
int int
selDelPaintFunc(rect, type) selDelPaintFunc(
Rect *rect; /* Area of paint, in root coords. */ Rect *rect, /* Area of paint, in root coords. */
TileType type; /* Type of paint to delete. */ TileType type) /* Type of paint to delete. */
{ {
Rect editRect; Rect editRect;
TileTypeBitMask tmask; TileTypeBitMask tmask;
@ -238,9 +238,9 @@ selDelPaintFunc(rect, type)
/* ARGSUSED */ /* ARGSUSED */
int int
selDelCellFunc(selUse, use) selDelCellFunc(
CellUse *selUse; /* Not used. */ CellUse *selUse, /* Not used. */
CellUse *use; /* What to delete. */ CellUse *use) /* What to delete. */
{ {
if (use->cu_flags & CU_LOCKED) return 0; if (use->cu_flags & CU_LOCKED) return 0;
@ -256,8 +256,8 @@ selDelCellFunc(selUse, use)
* the selection can differ from the edit cell in this regard. */ * the selection can differ from the edit cell in this regard. */
int int
selDelLabelFunc(label) selDelLabelFunc(
Label *label; /* Label to delete. */ Label *label) /* Label to delete. */
{ {
DBEraseLabelsByContent(EditCellUse->cu_def, &label->lab_rect, -1, DBEraseLabelsByContent(EditCellUse->cu_def, &label->lab_rect, -1,
label->lab_text); label->lab_text);
@ -283,8 +283,8 @@ selDelLabelFunc(label)
*/ */
void void
SelectCopy(transform) SelectCopy(
Transform *transform; /* How to displace the copy relative Transform *transform) /* How to displace the copy relative
* to the original. This displacement * to the original. This displacement
* is given in root coordinates. * is given in root coordinates.
*/ */
@ -410,10 +410,10 @@ typedef struct _shortsearchdata {
*/ */
int int
selShortTileProc(tile, dinfo, ssd) selShortTileProc(
Tile *tile; Tile *tile,
TileType dinfo; /* (unused) */ TileType dinfo, /* (unused) */
ShortSearchData *ssd; ShortSearchData *ssd)
{ {
const int curr = (int)TiGetClientINT(tile); const int curr = (int)TiGetClientINT(tile);
if (curr < ssd->cost) if (curr < ssd->cost)
@ -448,11 +448,11 @@ selShortTileProc(tile, dinfo, ssd)
*/ */
int int
selShortFindReverse(rlist, tile, pnum, fdir) selShortFindReverse(
ExtRectList **rlist; ExtRectList **rlist,
Tile *tile; Tile *tile,
int pnum; int pnum,
int fdir; int fdir)
{ {
Tile *tp, *mintp; Tile *tp, *mintp;
ExtRectList *newrrec; ExtRectList *newrrec;
@ -711,11 +711,11 @@ ShortData *NewSD(cost, tile, type, pnum)
*/ */
int int
selShortProcessTile(tile, cost, fdir, mask) selShortProcessTile(
Tile *tile; Tile *tile,
int cost; int cost,
int fdir; int fdir,
TileTypeBitMask *mask; TileTypeBitMask *mask)
{ {
TileType ttype; TileType ttype;
@ -789,11 +789,11 @@ selShortProcessTile(tile, cost, fdir, mask)
*/ */
void void
selShortFindForward(srctile, srctype, srcpnum, desttile) selShortFindForward(
Tile *srctile; Tile *srctile,
TileType srctype; TileType srctype,
int srcpnum; int srcpnum,
Tile *desttile; Tile *desttile)
{ {
TileType type; TileType type;
TileTypeBitMask *lmask; TileTypeBitMask *lmask;
@ -938,7 +938,9 @@ donesrch:
*/ */
ExtRectList * ExtRectList *
SelectShort(char *lab1, char *lab2) SelectShort(
char *lab1,
char *lab2)
{ {
Label *selLabel, *srclab = NULL, *destlab = NULL; Label *selLabel, *srclab = NULL, *destlab = NULL;
Tile *srctile, *desttile; Tile *srctile, *desttile;
@ -1052,8 +1054,8 @@ SelectShort(char *lab1, char *lab2)
*/ */
void void
selTransTo2(transform) selTransTo2(
Transform *transform; /* How to transform stuff before copying Transform *transform) /* How to transform stuff before copying
* it to Select2Def. * it to Select2Def.
*/ */
{ {
@ -1076,10 +1078,10 @@ selTransTo2(transform)
/* Search function to copy paint. Always return 1 to keep the search alive. */ /* Search function to copy paint. Always return 1 to keep the search alive. */
int int
selTransPaintFunc(rect, type, transform) selTransPaintFunc(
Rect *rect; /* Area of paint. */ Rect *rect, /* Area of paint. */
TileType type; /* Type of paint. */ TileType type, /* Type of paint. */
Transform *transform; /* How to change coords before painting. */ Transform *transform) /* How to change coords before painting. */
{ {
Rect newarea; Rect newarea;
TileType loctype; TileType loctype;
@ -1105,12 +1107,12 @@ selTransPaintFunc(rect, type, transform)
/* ARGSUSED */ /* ARGSUSED */
int int
selTransCellFunc(selUse, realUse, realTrans, transform) selTransCellFunc(
CellUse *selUse; /* Use from selection. */ CellUse *selUse, /* Use from selection. */
CellUse *realUse; /* Corresponding use from layout (used to CellUse *realUse, /* Corresponding use from layout (used to
* get id). */ * get id). */
Transform *realTrans; /* Transform for realUse (ignored). */ Transform *realTrans, /* Transform for realUse (ignored). */
Transform *transform; /* How to change coords of selUse before Transform *transform) /* How to change coords of selUse before
* copying. * copying.
*/ */
{ {
@ -1142,13 +1144,13 @@ selTransCellFunc(selUse, realUse, realTrans, transform)
/* ARGSUSED */ /* ARGSUSED */
int int
selTransLabelFunc(label, cellUse, defTransform, transform) selTransLabelFunc(
Label *label; /* Label to copy. This points to label Label *label, /* Label to copy. This points to label
* in cellDef. * in cellDef.
*/ */
CellUse *cellUse; /* (unused) */ CellUse *cellUse, /* (unused) */
Transform *defTransform; /* Transform from cellDef to root. */ Transform *defTransform, /* Transform from cellDef to root. */
Transform *transform; /* How to modify coords before copying to Transform *transform) /* How to modify coords before copying to
* Select2Def. * Select2Def.
*/ */
{ {
@ -1192,8 +1194,8 @@ selTransLabelFunc(label, cellUse, defTransform, transform)
*/ */
void void
SelectTransform(transform) SelectTransform(
Transform *transform; /* How to displace the selection. Transform *transform) /* How to displace the selection.
* The transform is in root (user- * The transform is in root (user-
* visible) coordinates. * visible) coordinates.
*/ */
@ -1246,15 +1248,15 @@ typedef struct selExpData {
*/ */
void void
SelectExpand(mask, expandType, rootBox) SelectExpand(
int mask; /* Bits of this word indicate which int mask, /* Bits of this word indicate which
* windows the selected cells will be * windows the selected cells will be
* expanded in. * expanded in.
*/ */
int expandType; /* Operation to perform: Expand, int expandType, /* Operation to perform: Expand,
* unexpand, or expand toggle. * unexpand, or expand toggle.
*/ */
Rect *rootBox; /* Area of root box, if selecting by Rect *rootBox) /* Area of root box, if selecting by
* cursor box area. * cursor box area.
*/ */
{ {
@ -1285,11 +1287,11 @@ SelectExpand(mask, expandType, rootBox)
/* ARGSUSED */ /* ARGSUSED */
int int
selExpandFunc(selUse, use, transform, sed) selExpandFunc(
CellUse *selUse; /* Use from selection. */ CellUse *selUse, /* Use from selection. */
CellUse *use; /* Use to expand (in actual layout). */ CellUse *use, /* Use to expand (in actual layout). */
Transform *transform; /* Not used. */ Transform *transform, /* Not used. */
SelExpData *sed; /* Information for expansion */ SelExpData *sed) /* Information for expansion */
{ {
int expandType = sed->sed_type; int expandType = sed->sed_type;
int mask = sed->sed_mask; int mask = sed->sed_mask;
@ -1420,8 +1422,8 @@ selExpandFunc(selUse, use, transform, sed)
*/ */
void void
SelectArray(arrayInfo) SelectArray(
ArrayInfo *arrayInfo; /* Describes desired shape of array, all in ArrayInfo *arrayInfo) /* Describes desired shape of array, all in
* root coordinates. * root coordinates.
*/ */
{ {
@ -1457,10 +1459,10 @@ SelectArray(arrayInfo)
*/ */
int int
selArrayPFunc(rect, type, arrayInfo) selArrayPFunc(
Rect *rect; /* Rectangle to be arrayed. */ Rect *rect, /* Rectangle to be arrayed. */
TileType type; /* Type of tile. */ TileType type, /* Type of tile. */
ArrayInfo *arrayInfo; /* How to array. */ ArrayInfo *arrayInfo) /* How to array. */
{ {
int y, nx, ny; int y, nx, ny;
Rect current; Rect current;
@ -1493,11 +1495,11 @@ selArrayPFunc(rect, type, arrayInfo)
/* ARGSUSED */ /* ARGSUSED */
int int
selArrayCFunc(selUse, use, transform, arrayInfo) selArrayCFunc(
CellUse *selUse; /* Use from selection (not used). */ CellUse *selUse, /* Use from selection (not used). */
CellUse *use; /* Use to be copied and arrayed. */ CellUse *use, /* Use to be copied and arrayed. */
Transform *transform; /* Transform from use->cu_def to root. */ Transform *transform, /* Transform from use->cu_def to root. */
ArrayInfo *arrayInfo; /* Array characteristics desired. */ ArrayInfo *arrayInfo) /* Array characteristics desired. */
{ {
CellUse *newUse; CellUse *newUse;
Transform tinv, newTrans; Transform tinv, newTrans;
@ -1551,11 +1553,11 @@ selArrayCFunc(selUse, use, transform, arrayInfo)
/* ARGSUSED */ /* ARGSUSED */
int int
selArrayLFunc(label, use, transform, arrayInfo) selArrayLFunc(
Label *label; /* Label to be copied and replicated. */ Label *label, /* Label to be copied and replicated. */
CellUse *use; /* (unused) */ CellUse *use, /* (unused) */
Transform *transform; /* Transform from coords of def to root. */ Transform *transform, /* Transform from coords of def to root. */
ArrayInfo *arrayInfo; /* How to replicate. */ ArrayInfo *arrayInfo) /* How to replicate. */
{ {
int y, nx, ny, rootJust, rootRotate; int y, nx, ny, rootJust, rootRotate;
Point rootOffset; Point rootOffset;
@ -1631,9 +1633,9 @@ selArrayLFunc(label, use, transform, arrayInfo)
*/ */
void void
SelectStretch(x, y) SelectStretch(
int x; /* Amount to move in the x-direction. */ int x, /* Amount to move in the x-direction. */
int y; /* Amount to move in the y-direction. Must int y) /* Amount to move in the y-direction. Must
* be zero if x is non-zero. * be zero if x is non-zero.
*/ */
{ {
@ -1746,10 +1748,10 @@ SelectStretch(x, y)
*/ */
int int
selStretchEraseFunc(tile, dinfo, plane) selStretchEraseFunc(
Tile *tile; /* Tile being moved in a stretch operation. */ Tile *tile, /* Tile being moved in a stretch operation. */
TileType dinfo; /* Split tile information */ TileType dinfo, /* Split tile information */
int *plane; /* Plane of tiles being searched */ int *plane) /* Plane of tiles being searched */
{ {
Rect area, editArea; Rect area, editArea;
int planeNum; int planeNum;
@ -1881,10 +1883,10 @@ selStretchEraseFunc(tile, dinfo, plane)
} }
int int
selStretchEraseFunc2(tile, dinfo, pa) selStretchEraseFunc2(
Tile *tile; Tile *tile,
TileType dinfo; /* (unused) */ TileType dinfo, /* (unused) */
planeAndArea *pa; planeAndArea *pa)
{ {
TileType type = TT_SPACE; TileType type = TT_SPACE;
@ -1924,10 +1926,10 @@ selStretchEraseFunc2(tile, dinfo, pa)
*/ */
int int
selStretchFillFunc(tile, dinfo, plane) selStretchFillFunc(
Tile *tile; /* Tile in the old selection. */ Tile *tile, /* Tile in the old selection. */
TileType dinfo; /* Split tile information (unused) */ TileType dinfo, /* Split tile information (unused) */
int *plane; /* Plane of tile being searched */ int *plane) /* Plane of tile being searched */
{ {
Rect area; Rect area;
extern int selStretchFillFunc2(); extern int selStretchFillFunc2();
@ -1993,12 +1995,12 @@ selStretchFillFunc(tile, dinfo, plane)
*/ */
int int
selStretchFillFunc2(tile, dinfo, area) selStretchFillFunc2(
Tile *tile; /* Space tile that borders selected Tile *tile, /* Space tile that borders selected
* paint. * paint.
*/ */
TileType dinfo; /* Split tile information (unused) */ TileType dinfo, /* Split tile information (unused) */
Rect *area; /* A one-unit wide strip along the Rect *area) /* A one-unit wide strip along the
* border (i.e. the area in which * border (i.e. the area in which
* we're interested in space). * we're interested in space).
*/ */
@ -2042,12 +2044,12 @@ selStretchFillFunc2(tile, dinfo, area)
*/ */
int int
selStretchFillFunc3(tile, dinfo, area) selStretchFillFunc3(
Tile *tile; /* Tile of edit material that's about to Tile *tile, /* Tile of edit material that's about to
* be left behind selection. * be left behind selection.
*/ */
TileType dinfo; /* Split tile information (unused) */ TileType dinfo, /* Split tile information (unused) */
Rect *area; /* The border area we're interested in, Rect *area) /* The border area we're interested in,
* in root coords. * in root coords.
*/ */
{ {
@ -2180,8 +2182,8 @@ selStretchFillFunc3(tile, dinfo, area)
*/ */
void void
SelectDump(scx) SelectDump(
SearchContext *scx; /* Describes the cell from which SearchContext *scx) /* Describes the cell from which
* material is to be copied, the * material is to be copied, the
* area to copy, and the transform * area to copy, and the transform
* to root coordinates in the edit * to root coordinates in the edit

View File

@ -44,10 +44,10 @@
*/ */
int int
selUnselFunc(tile, dinfo, arg) selUnselFunc(
Tile *tile; Tile *tile,
TileType dinfo; /* unused, but should be handled */ TileType dinfo, /* unused, but should be handled */
ClientData *arg; ClientData *arg)
{ {
TileType type; TileType type;
Rect rect; Rect rect;
@ -83,10 +83,9 @@ static CellUse *(selRemoveUses[MAXUNSELUSES]);
static int selNRemove; static int selNRemove;
int int
selRemoveCellFunc(scx, cdarg) selRemoveCellFunc(
SearchContext *scx; SearchContext *scx,
Rect *cdarg; Rect *cdarg)
{ {
ASSERT((selNRemove < MAXUNSELUSES) && (selNRemove >= 0), ASSERT((selNRemove < MAXUNSELUSES) && (selNRemove >= 0),
"selRemoveCellFunc(selNRemove)"); "selRemoveCellFunc(selNRemove)");
@ -118,10 +117,10 @@ selRemoveCellFunc(scx, cdarg)
*/ */
void void
SelRemoveArea(area, mask, globmatch) SelRemoveArea(
Rect *area; Rect *area,
TileTypeBitMask *mask; TileTypeBitMask *mask,
char *globmatch; char *globmatch)
{ {
SearchContext scx; SearchContext scx;
Rect bbox, areaReturn; Rect bbox, areaReturn;
@ -211,10 +210,10 @@ SelRemoveArea(area, mask, globmatch)
*/ */
int int
selRemoveLabelPaintFunc(tile, dinfo, label) selRemoveLabelPaintFunc(
Tile *tile; Tile *tile,
TileType dinfo; /* (unused) */ TileType dinfo, /* (unused) */
Label *label; Label *label)
{ {
(void) DBPutFontLabel(Select2Def, &label->lab_rect, label->lab_font, (void) DBPutFontLabel(Select2Def, &label->lab_rect, label->lab_font,
label->lab_size, label->lab_rotate, &label->lab_offset, label->lab_size, label->lab_rotate, &label->lab_offset,
@ -319,9 +318,9 @@ typedef struct
*/ */
int int
SelRemoveCellSearchFunc(scx, cdarg) SelRemoveCellSearchFunc(
SearchContext *scx; SearchContext *scx,
SelRemoveCellArgs *cdarg; SelRemoveCellArgs *cdarg)
{ {
Transform *et, *st; Transform *et, *st;
@ -374,10 +373,9 @@ SelRemoveCellSearchFunc(scx, cdarg)
*/ */
int int
SelectRemoveCellUse(use, trans) SelectRemoveCellUse(
CellUse *use; CellUse *use,
Transform *trans; Transform *trans)
{ {
SearchContext scx; SearchContext scx;
SelRemoveCellArgs args; SelRemoveCellArgs args;

View File

@ -50,8 +50,8 @@ extern int SelEnumLabelsMirror();
/* Procedures to operate on the selection. */ /* Procedures to operate on the selection. */
extern void SelectDelete(); extern void SelectDelete(char *msg, bool do_clear);
extern void SelectDeleteUses(); extern void SelectDeleteUses(char *msg, bool do_clear);
extern void SelectCopy(); extern void SelectCopy();
extern void SelectTransform(); extern void SelectTransform();
extern void SelectExpand(); extern void SelectExpand();