K&R commands/*.c: bulk forward reference function prototype conversion

K&R obsolete syntax removal for C23 compatibility series
This commit is contained in:
Darryl L. Miles 2024-10-04 12:05:38 +01:00 committed by Tim Edwards
parent afd1b0b2df
commit 56139b48eb
8 changed files with 51 additions and 46 deletions

View File

@ -156,7 +156,7 @@ CmdArray(
Tcl_Obj *tobj; Tcl_Obj *tobj;
#endif #endif
extern int selGetArrayFunc(); extern int selGetArrayFunc(CellUse *selUse, CellUse *use, Transform *trans, LinkedArray **arg);
locargc = cmd->tx_argc; locargc = cmd->tx_argc;
argstart = 1; argstart = 1;

View File

@ -67,8 +67,8 @@ struct cmdCornerArea
}; };
/* Forward declarations */ /* Forward declarations */
int cmdDumpFunc(); int cmdDumpFunc(Rect *rect, char *name, Label *label, Point *point);
bool cmdDumpParseArgs(); bool cmdDumpParseArgs(char *cmdName, MagWindow *w, TxCommand *cmd, CellUse *dummy, SearchContext *scx);
#ifdef CALMA_MODULE #ifdef CALMA_MODULE
/* /*
@ -1323,7 +1323,7 @@ CmdCellname(
/* Unload the cell definition and re-read with search paths */ /* Unload the cell definition and re-read with search paths */
if (locargc == 3) if (locargc == 3)
{ {
void cmdFlushCell(); void cmdFlushCell(CellDef *def, int force_deref);
if (cellname == NULL) if (cellname == NULL)
cellDef = EditRootDef; cellDef = EditRootDef;
@ -2387,8 +2387,8 @@ CmdContact(
CCStruct ccs; CCStruct ccs;
Rect area; Rect area;
LinkedRect *lr = NULL; LinkedRect *lr = NULL;
int cmdContactFunc(); /* Forward declaration */ int cmdContactFunc(Tile *tile, CCStruct *ccs); /* Forward declaration */
int cmdContactEraseFunc(); /* Forward declaration */ int cmdContactEraseFunc(Tile *tile, LinkedRect **lr); /* Forward declaration */
windCheckOnlyWindow(&w, DBWclientID); windCheckOnlyWindow(&w, DBWclientID);
if ((w == (MagWindow *) NULL) || (w->w_client != DBWclientID)) if ((w == (MagWindow *) NULL) || (w->w_client != DBWclientID))
@ -2522,7 +2522,7 @@ cmdContactFunc(
{ {
TileType stype; TileType stype;
TileTypeBitMask smask; TileTypeBitMask smask;
int cmdContactFunc2(); /* Forward declaration */ int cmdContactFunc2(Tile *tile, CCStruct *ccs); /* Forward declaration */
TiToRect(tile, &ccs->area); TiToRect(tile, &ccs->area);
GeoClip(&ccs->area, &ccs->clip); GeoClip(&ccs->area, &ccs->clip);
@ -2815,11 +2815,11 @@ CmdCorner(
TileTypeBitMask maskBits; TileTypeBitMask maskBits;
Rect editBox; Rect editBox;
SearchContext scx; SearchContext scx;
extern int cmdCornerFunc(); extern int cmdCornerFunc(Tile *tile, TreeContext *cxp);
bool hasErr = FALSE; bool hasErr = FALSE;
int locargc = cmd->tx_argc; int locargc = cmd->tx_argc;
extern int cmdBevelFunc(); extern int cmdBevelFunc(Tile *tile, TreeContext *cxp);
bool dobevel = FALSE; bool dobevel = FALSE;
NMCornerPath cmdPathList; NMCornerPath cmdPathList;
@ -3833,8 +3833,8 @@ CmdDown(
{ {
CellUse *use = NULL; CellUse *use = NULL;
Rect area, pointArea; Rect area, pointArea;
int cmdEditRedisplayFunc(); /* External declaration. */ int cmdEditRedisplayFunc(MagWindow *w, Rect *area); /* External declaration. */
int cmdDownEnumFunc(); /* Forward declaration. */ int cmdDownEnumFunc(CellUse *selUse, CellUse *use, Transform *transform, Rect *area); /* Forward declaration. */
if ((w != NULL) && (cmd->tx_argc == 2)) if ((w != NULL) && (cmd->tx_argc == 2))
{ {

View File

@ -86,8 +86,8 @@ CmdEdit(
Rect area, pointArea; Rect area, pointArea;
CellUse *usave, *use = NULL; CellUse *usave, *use = NULL;
CellDef *csave; CellDef *csave;
int cmdEditRedisplayFunc(); /* Forward declaration. */ int cmdEditRedisplayFunc(MagWindow *w, Rect *area); /* Forward declaration. */
int cmdEditEnumFunc(); /* Forward declaration. */ int cmdEditEnumFunc(CellUse *selUse, CellUse *use, Transform *transform, Rect *area); /* Forward declaration. */
bool noCurrentUse = FALSE; bool noCurrentUse = FALSE;
if ((w != NULL) && (cmd->tx_argc == 2)) if ((w != NULL) && (cmd->tx_argc == 2))
@ -633,7 +633,7 @@ CmdErase(
{ {
Rect editRect, areaReturn; Rect editRect, areaReturn;
TileTypeBitMask mask, errorLayersForErasure, activeLayersForErasure; TileTypeBitMask mask, errorLayersForErasure, activeLayersForErasure;
extern int cmdEraseCellsFunc(); extern int cmdEraseCellsFunc(SearchContext *scx, ClientData cdarg);
windCheckOnlyWindow(&w, DBWclientID); windCheckOnlyWindow(&w, DBWclientID);
if (w == (MagWindow *) NULL) return; if (w == (MagWindow *) NULL) return;
@ -805,7 +805,7 @@ CmdExpand(
Rect rootRect; Rect rootRect;
CellUse *rootBoxUse; CellUse *rootBoxUse;
CellDef *rootBoxDef; CellDef *rootBoxDef;
int cmdExpandFunc(); /* Forward reference. */ int cmdExpandFunc(CellUse *use, int windowMask); /* Forward reference. */
if (cmd->tx_argc > 2 || (cmd->tx_argc == 2 if (cmd->tx_argc > 2 || (cmd->tx_argc == 2
&& (strncmp(cmd->tx_argv[1], "toggle", strlen(cmd->tx_argv[1])) != 0))) && (strncmp(cmd->tx_argv[1], "toggle", strlen(cmd->tx_argv[1])) != 0)))

View File

@ -512,7 +512,7 @@ CmdFill(
TileTypeBitMask maskBits; TileTypeBitMask maskBits;
Rect editBox; Rect editBox;
SearchContext scx; SearchContext scx;
extern int cmdFillFunc(); extern int cmdFillFunc(Tile *tile, TreeContext *cxp);
if (cmd->tx_argc < 2 || cmd->tx_argc > 3) if (cmd->tx_argc < 2 || cmd->tx_argc > 3)
{ {
@ -802,7 +802,7 @@ CmdFindLabel(
int found, occur, plainargs; int found, occur, plainargs;
bool doglob = FALSE; /* csh-style glob matching (see utils/match.c) */ bool doglob = FALSE; /* csh-style glob matching (see utils/match.c) */
LabSearchRec lsr; LabSearchRec lsr;
int dbListLabels(); /* forward declaration */ int dbListLabels(SearchContext *scx, Label *label, TerminalPath *tpath, ClientData cdarg); /* forward declaration */
plainargs = cmd->tx_argc; plainargs = cmd->tx_argc;
if ((plainargs > 2) && !strncmp(cmd->tx_argv[1], "-glob", 5)) if ((plainargs > 2) && !strncmp(cmd->tx_argv[1], "-glob", 5))
@ -1512,7 +1512,7 @@ CmdIdentify(
MagWindow *w, MagWindow *w,
TxCommand *cmd) TxCommand *cmd)
{ {
extern int cmdIdFunc(); /* Forward reference. */ extern int cmdIdFunc(CellUse *selUse, CellUse *use, Transform *transform, char *newId); /* Forward reference. */
if (cmd->tx_argc != 2) if (cmd->tx_argc != 2)
{ {
@ -1702,7 +1702,7 @@ checklocal:
if (locvalid == TRUE) if (locvalid == TRUE)
{ {
int findTile(); int findTile(Tile *tile, TileType *rtype);
CellDef *targetdef = use->cu_def; CellDef *targetdef = use->cu_def;
Plane *plane = targetdef->cd_planes[pnum]; Plane *plane = targetdef->cd_planes[pnum];
@ -1865,7 +1865,7 @@ FlatCopyAllLabels(
int xMask, int xMask,
CellUse *targetUse) CellUse *targetUse)
{ {
int flatCopyAllLabels(); int flatCopyAllLabels(SearchContext *scx, Label *lab, TerminalPath *tpath, CellUse *targetUse);
char pathstring[FLATTERMSIZE]; char pathstring[FLATTERMSIZE];
TerminalPath tpath; TerminalPath tpath;

View File

@ -51,7 +51,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
/* Forward declarations */ /* Forward declarations */
void CmdPaintEraseButton(); void CmdPaintEraseButton(MagWindow *w, Point *refPoint, bool isPaint, bool isScreen);
/* See the SetLabel command */ /* See the SetLabel command */
@ -403,7 +403,7 @@ CmdLoad(
bool failNotFound = FALSE; bool failNotFound = FALSE;
unsigned char saveVerbose; unsigned char saveVerbose;
unsigned char flags; unsigned char flags;
int keepGoing(); /* forward declaration */ int keepGoing(CellUse *use, ClientData clientdata); /* forward declaration */
extern unsigned char DBVerbose; /* from DBio.c */ extern unsigned char DBVerbose; /* from DBio.c */
saveVerbose = DBVerbose; saveVerbose = DBVerbose;
@ -1448,7 +1448,7 @@ complabel(
/* Natural sort order routine from DBcellname.c /* Natural sort order routine from DBcellname.c
* replaces strcasecmp(). * replaces strcasecmp().
*/ */
int strcmpbynum(); int strcmpbynum(const char *s1, const char *s2);
Label *l1 = *((Label **)one); Label *l1 = *((Label **)one);
Label *l2 = *((Label **)two); Label *l2 = *((Label **)two);
@ -2076,7 +2076,7 @@ CmdPort(
{ {
int numlabels, n, p; int numlabels, n, p;
Label **slablist, *tlab, *lastlab; Label **slablist, *tlab, *lastlab;
extern int complabel(); extern int complabel(const void *one, const void *two);
/* Create a sortable list of labels */ /* Create a sortable list of labels */
numlabels = 0; numlabels = 0;

View File

@ -52,9 +52,9 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
/* Forward declarations */ /* Forward declarations */
extern char *cmdCheckNewName(); extern char *cmdCheckNewName(CellDef *def, char *newName, bool tryRename, bool noninteractive);
extern int cmdSaveWindSet(); extern int cmdSaveWindSet(MagWindow *window, CellDef *def);
extern void CmdSetWindCaption(); extern void CmdSetWindCaption(CellUse *newEditUse, CellDef *rootDef);
TileTypeBitMask CmdYMLabel; TileTypeBitMask CmdYMLabel;
TileTypeBitMask CmdYMCell; TileTypeBitMask CmdYMCell;
@ -908,7 +908,7 @@ CmdSetWindCaption(
* edit cell was selected. * edit cell was selected.
*/ */
{ {
int cmdWindSet(); int cmdWindSet(MagWindow *window);
newEditDef = (newEditUse) ? newEditUse->cu_def : NULL; newEditDef = (newEditUse) ? newEditUse->cu_def : NULL;
newRootDef = rootDef; newRootDef = rootDef;
@ -1075,7 +1075,7 @@ bool
CmdWarnWrite(void) CmdWarnWrite(void)
{ {
int count, code; int count, code;
int cmdWarnWriteFunc(); int cmdWarnWriteFunc(CellDef *cellDef, int *pcount);
static char *yesno[] = { "no", "yes", 0 }; static char *yesno[] = { "no", "yes", 0 };
char *prompt; char *prompt;
@ -1125,7 +1125,7 @@ cmdExpandOneLevel(
int bitmask, int bitmask,
bool expand) bool expand)
{ {
extern int cmdExpand1func(); extern int cmdExpand1func(CellUse *cu, ClientData bitmask);
/* first, expand this cell use */ /* first, expand this cell use */
DBExpand(cu, bitmask, expand); DBExpand(cu, bitmask, expand);
@ -1174,7 +1174,7 @@ CmdGetSelectedCell(
*/ */
{ {
CellUse *result = NULL; CellUse *result = NULL;
int cmdGetSelFunc(); /* Forward declaration. */ int cmdGetSelFunc(CellUse *selUse, CellUse *realUse, Transform *transform, CellUse **pResult); /* Forward declaration. */
cmdSelTrans = pTrans; cmdSelTrans = pTrans;
(void) SelEnumCells(FALSE, (bool *) NULL, (SearchContext *) NULL, (void) SelEnumCells(FALSE, (bool *) NULL, (SearchContext *) NULL,

View File

@ -701,7 +701,7 @@ CmdUnexpand(
{ {
int windowMask, boxMask; int windowMask, boxMask;
Rect rootRect; Rect rootRect;
int cmdUnexpandFunc(); /* Forward reference. */ int cmdUnexpandFunc(CellUse *use, int windowMask); /* Forward reference. */
if (cmd->tx_argc != 1) if (cmd->tx_argc != 1)
{ {
@ -943,11 +943,14 @@ CmdWhat(
#ifdef MAGIC_WRAPPER #ifdef MAGIC_WRAPPER
Tcl_Obj *lobj, *paintobj, *paintcellobj, *celllistobj, *labelobj, *cellobj; Tcl_Obj *lobj, *paintobj, *paintcellobj, *celllistobj, *labelobj, *cellobj;
extern int cmdWhatCellListFunc(); extern int cmdWhatCellListFunc(CellUse *selUse, CellUse *realUse, Transform *transform, Tcl_Obj *newobj);
#endif #endif
extern int cmdWhatPaintFunc(), cmdWhatLabelFunc(), cmdWhatCellFunc(); extern int cmdWhatPaintFunc(Rect *rect, TileType type, TileTypeBitMask *mask);
extern int cmdWhatLabelPreFunc(), orderLabelFunc(); extern int cmdWhatLabelFunc(LabelStore *entry, bool *foundAny);
extern int cmdWhatCellFunc(CellUse *selUse, CellUse *realUse, Transform *transform, bool *foundAny);
extern int cmdWhatLabelPreFunc(Label *label, CellUse *cellUse, Transform *transform, bool *foundAny);
extern int orderLabelFunc(LabelStore *one, LabelStore *two);
locargc = cmd->tx_argc; locargc = cmd->tx_argc;
@ -1345,7 +1348,7 @@ cmdWhatCellFunc(
*/ */
{ {
/* Forward reference */ /* Forward reference */
char *dbGetUseName(); char *dbGetUseName(CellUse *celluse);
if (!*foundAny) if (!*foundAny)
{ {
@ -1370,7 +1373,7 @@ cmdWhatCellListFunc(
{ {
Tcl_Obj *tuple; Tcl_Obj *tuple;
/* Forward reference */ /* Forward reference */
char *dbGetUseName(); char *dbGetUseName(CellUse *celluse);
tuple = Tcl_NewListObj(0, NULL); tuple = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(magicinterp, tuple, Tcl_ListObjAppendElement(magicinterp, tuple,
@ -1859,7 +1862,7 @@ CmdWriteall(
MagWindow *w, MagWindow *w,
TxCommand *cmd) TxCommand *cmd)
{ {
int cmdWriteallFunc(); int cmdWriteallFunc(CellDef *def, TxCommand *cmd);
int option = -1; int option = -1;
static char *writeallOpts[] = { "force", "modified", 0 }; static char *writeallOpts[] = { "force", "modified", 0 };
int argc; int argc;

View File

@ -52,7 +52,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
/* Forward declarations */ /* Forward declarations */
extern void cmdPsearchStats(); extern void cmdPsearchStats(char *str, struct tms *tl, struct tms *td, int count);
void cmdStatsHier(CellDef *, int, CellDef *); void cmdStatsHier(CellDef *, int, CellDef *);
@ -436,7 +436,7 @@ CmdTilestats(
bool allDefs = FALSE; bool allDefs = FALSE;
char **av = cmd->tx_argv + 1; char **av = cmd->tx_argv + 1;
int ac = cmd->tx_argc - 1; int ac = cmd->tx_argc - 1;
int cmdStatsFunc(); int cmdStatsFunc(CellDef *def, FILE *outf);
if (ac > 2) if (ac > 2)
{ {
@ -515,7 +515,8 @@ cmdStatsFunc(
CellDef *def, CellDef *def,
FILE *outf) FILE *outf)
{ {
int cmdStatsCount(), cmdStatsOutput(); int cmdStatsCount(CellDef *def, struct countClient *cc);
int cmdStatsOutput(CellDef *def, struct countClient *cc);
struct countClient cc; struct countClient cc;
int total; int total;
TileType t; TileType t;
@ -568,7 +569,7 @@ cmdStatsCount(
CellDef *def, CellDef *def,
struct countClient *cc) struct countClient *cc)
{ {
int cmdStatsCountTile(); int cmdStatsCountTile(Tile *tile, struct cellInfo *ci);
int pNum; int pNum;
struct cellInfo *ci; struct cellInfo *ci;
TileType t; TileType t;
@ -755,7 +756,7 @@ CmdPsearch(
MagWindow *w, MagWindow *w,
TxCommand *cmd) TxCommand *cmd)
{ {
char *RunStats(); char *RunStats(int flags, struct tms *lastt, struct tms *deltat);
static struct tms tlast, tdelta; static struct tms tlast, tdelta;
Point p; Point p;
Plane *plane; Plane *plane;
@ -823,7 +824,7 @@ cmdPsearchStats(
struct tms *td, struct tms *td,
int count) int count)
{ {
char *RunStats(); char *RunStats(int flags, struct tms *lastt, struct tms *deltat);
char *rstatp; char *rstatp;
int us, ups; int us, ups;
@ -867,8 +868,9 @@ CmdTsearch(
MagWindow *w, MagWindow *w,
TxCommand *cmd) TxCommand *cmd)
{ {
int cmdTsrFunc(); int cmdTsrFunc(Tile *tp);
char *RunStats(), *rstatp; char *RunStats(int flags, struct tms *lastt, struct tms *deltat);
char *rstatp;
static TileTypeBitMask mask; static TileTypeBitMask mask;
static struct tms tlast, tdelta; static struct tms tlast, tdelta;
Rect rtool, rsearch; Rect rtool, rsearch;