netmenu: convert K&R function definitions to ANSI C

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

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:16 +02:00
parent 7c4194e259
commit c74eaf4ee8
No known key found for this signature in database
GPG Key ID: 588785BFDFB01ABD
3 changed files with 125 additions and 122 deletions

View File

@ -66,11 +66,11 @@ char *NMCurNetName = NULL;
*/ */
void void
NMButtonNetList(window, cmd, nmButton, point) NMButtonNetList(
MagWindow *window; /* Where button was clicked (not used). */ MagWindow *window, /* Where button was clicked (not used). */
NetButton *nmButton; /* Data structure for button (not used). */ TxCommand *cmd, /* Used to figure out which button it was. */
TxCommand *cmd; /* Used to figure out which button it was. */ NetButton *nmButton, /* Data structure for button (not used). */
Point *point; /* Not used. */ Point *point) /* Not used. */
{ {
#define MAXLENGTH 200 #define MAXLENGTH 200
char newName[MAXLENGTH]; char newName[MAXLENGTH];
@ -182,9 +182,9 @@ nmButtonSetup()
*/ */
void void
NMButtonRight(w, cmd) NMButtonRight(
MagWindow *w; /* Window in which button was pushed. */ MagWindow *w, /* Window in which button was pushed. */
TxCommand *cmd; /* Detailed information about command. */ TxCommand *cmd) /* Detailed information about command. */
{ {
char *name; char *name;
extern int nmButHighlightFunc(), nmButUnHighlightFunc(); extern int nmButHighlightFunc(), nmButUnHighlightFunc();
@ -251,9 +251,9 @@ NMButtonRight(w, cmd)
*/ */
int int
nmButCheckFunc(name1, name2) nmButCheckFunc(
char *name1; /* Name of terminal in net. */ char *name1, /* Name of terminal in net. */
char *name2; /* Name of other terminal. */ char *name2) /* Name of other terminal. */
{ {
if (strcmp(name1, name2) == 0) return 1; if (strcmp(name1, name2) == 0) return 1;
return 0; return 0;
@ -265,9 +265,9 @@ nmButCheckFunc(name1, name2)
*/ */
int int
nmFindNetNameFunc(name1, pname2) nmFindNetNameFunc(
char *name1; /* Name of terminal in net. */ char *name1, /* Name of terminal in net. */
char **pname2; /* Pointer to name to be replaced with char **pname2) /* Pointer to name to be replaced with
* different name, if there is a different * different name, if there is a different
* name in the net. * name in the net.
*/ */
@ -279,11 +279,11 @@ nmFindNetNameFunc(name1, pname2)
/* ARGSUSED */ /* ARGSUSED */
int int
nmButHighlightFunc(area, name, label, pExists) nmButHighlightFunc(
Rect *area; /* Area of the label. */ Rect *area, /* Area of the label. */
char *name; /* Name of label. */ char *name, /* Name of label. */
Label *label; /* Pointer to label */ Label *label, /* Pointer to label */
bool *pExists; /* We just set this to TRUE. */ bool *pExists) /* We just set this to TRUE. */
{ {
Rect rootArea; Rect rootArea;
Point point; Point point;
@ -297,8 +297,8 @@ nmButHighlightFunc(area, name, label, pExists)
} }
int int
nmButUnHighlightFunc(area) nmButUnHighlightFunc(
Rect *area; /* Area of the label. */ Rect *area) /* Area of the label. */
{ {
Rect rootArea; Rect rootArea;
Point point; Point point;
@ -311,9 +311,9 @@ nmButUnHighlightFunc(area)
} }
int int
nmNewRefFunc(name, oldRef) nmNewRefFunc(
char *name; /* Name of a terminal in the net. */ char *name, /* Name of a terminal in the net. */
char *oldRef; /* Name we don't want to use as net reference char *oldRef) /* Name we don't want to use as net reference
* anymore. * anymore.
*/ */
{ {
@ -344,8 +344,8 @@ nmNewRefFunc(name, oldRef)
*/ */
void void
NMSelectNet(name) NMSelectNet(
char *name; /* Gives name of terminal in net to be char *name) /* Gives name of terminal in net to be
* be selected. * be selected.
*/ */
{ {
@ -371,8 +371,8 @@ NMSelectNet(name)
/* For each terminal in the net, highlight each instance of the terminal. */ /* For each terminal in the net, highlight each instance of the terminal. */
int int
nmSelNetFunc(name) nmSelNetFunc(
char *name; char *name)
{ {
bool exists; bool exists;
@ -402,9 +402,9 @@ nmSelNetFunc(name)
*/ */
void void
NMButtonLeft(w, cmd) NMButtonLeft(
MagWindow *w; /* Window in which button was pushed. */ MagWindow *w, /* Window in which button was pushed. */
TxCommand *cmd; /* Detailed information about the command. */ TxCommand *cmd) /* Detailed information about the command. */
{ {
char *name; char *name;
@ -441,9 +441,9 @@ NMButtonLeft(w, cmd)
*/ */
void void
NMButtonMiddle(w, cmd) NMButtonMiddle(
MagWindow *w; /* Window in which button was pushed. */ MagWindow *w, /* Window in which button was pushed. */
TxCommand *cmd; /* Detailed information about command. */ TxCommand *cmd) /* Detailed information about command. */
{ {
char *name; char *name;
@ -489,9 +489,9 @@ NMButtonMiddle(w, cmd)
*/ */
void void
NMButtonProc(w, cmd) NMButtonProc(
MagWindow *w; /* Window in which button was pushed. */ MagWindow *w, /* Window in which button was pushed. */
TxCommand *cmd; /* Detailed information about exactly what happened. */ TxCommand *cmd) /* Detailed information about exactly what happened. */
{ {
if (cmd->tx_buttonAction != TX_BUTTON_DOWN) return; if (cmd->tx_buttonAction != TX_BUTTON_DOWN) return;
switch (cmd->tx_button) switch (cmd->tx_button)

View File

@ -79,9 +79,9 @@ static Plane *nmscPlane; /* Shared between procs below. */
extern int nmscRedrawFunc(); /* Forward declaration. */ extern int nmscRedrawFunc(); /* Forward declaration. */
int int
NMRedrawCell(window, plane) NMRedrawCell(
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,
* in root cell coordinates, the areas where * in root cell coordinates, the areas where
* highlight information must be redrawn. * highlight information must be redrawn.
*/ */
@ -122,10 +122,10 @@ NMRedrawCell(window, plane)
} }
int int
nmscRedrawFunc(tile, dinfo, window) nmscRedrawFunc(
Tile *tile; /* Tile to be redisplayed on highlight layer.*/ Tile *tile, /* Tile to be redisplayed 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, screenArea; Rect area, screenArea;
extern int nmscAlways1(); /* Forward reference. */ extern int nmscAlways1(); /* Forward reference. */
@ -142,7 +142,10 @@ nmscRedrawFunc(tile, dinfo, window)
} }
int int
nmscAlways1(Tile *tile, TileType dinfo, ClientData clientdata) nmscAlways1(
Tile *tile,
TileType dinfo,
ClientData clientdata)
{ {
return 1; return 1;
} }
@ -200,11 +203,11 @@ NMUnsetCell()
*/ */
void void
NMShowCell(use, rootDef) NMShowCell(
CellUse *use; /* Cell whose contents are to be drawn CellUse *use, /* Cell whose contents are to be drawn
* on the highlight plane. * on the highlight plane.
*/ */
CellDef *rootDef; /* Highlights will appear in all windows CellDef *rootDef) /* Highlights will appear in all windows
* with this root definition. * with this root definition.
*/ */
{ {
@ -325,8 +328,8 @@ NMShowUnderBox()
*/ */
int int
NMShowRoutedNet(netName) NMShowRoutedNet(
char * netName; char * netName)
{ {
int nmShowRoutedNetFunc(); int nmShowRoutedNetFunc();
@ -375,9 +378,9 @@ NMShowRoutedNet(netName)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
int int
nmShowRoutedNetFunc(name, clientData) nmShowRoutedNetFunc(
char *name; char *name,
ClientData clientData; ClientData clientData)
{ {
int nmSRNFunc(); int nmSRNFunc();
@ -404,11 +407,11 @@ nmShowRoutedNetFunc(name, clientData)
/*ARGSUSED*/ /*ARGSUSED*/
int int
nmSRNFunc(rect, name, label, cdarg) nmSRNFunc(
Rect *rect; Rect *rect,
char *name; /* Unused */ char *name, /* Unused */
Label *label; Label *label,
ClientData cdarg; ClientData cdarg)
{ {
SearchContext scx; SearchContext scx;

View File

@ -123,10 +123,10 @@ static int nmVCount= 0;
*/ */
int int
nmwRipTileFunc(tile, plane, listHead) nmwRipTileFunc(
Tile *tile; /* Tile that is to be deleted. */ Tile *tile, /* Tile that is to be deleted. */
int plane; /* Plane index of the tile */ int plane, /* Plane index of the tile */
struct nmwarea **listHead; /* Pointer to list head pointer. */ struct nmwarea **listHead) /* Pointer to list head pointer. */
{ {
struct nmwarea *new; struct nmwarea *new;
@ -219,13 +219,13 @@ NMRipup()
/* ARGSUSED */ /* ARGSUSED */
int int
nmRipLocFunc(rect, name, label, area) nmRipLocFunc(
Rect *rect; /* Area of the terminal, edit cell coords. */ Rect *rect, /* Area of the terminal, edit cell coords. */
char *name; /* Name of the terminal (ignored). */ char *name, /* Name of the terminal (ignored). */
Label *label; /* Pointer to the label, used to find out Label *label, /* Pointer to the label, used to find out
* what layer the label's attached to. * what layer the label's attached to.
*/ */
Rect *area; /* We GeoInclude into this all the areas of Rect *area) /* We GeoInclude into this all the areas of
* all the tiles we delete. * all the tiles we delete.
*/ */
{ {
@ -278,10 +278,10 @@ nmRipLocFunc(rect, name, label, area)
/* ARGSUSED */ /* ARGSUSED */
int int
nmRipNameFunc(name, firstInNet, area) nmRipNameFunc(
char *name; /* Name of terminal. */ char *name, /* Name of terminal. */
bool firstInNet; /* Ignored by this procedure. */ bool firstInNet, /* Ignored by this procedure. */
Rect *area; /* Passed through as ClientData to Rect *area) /* Passed through as ClientData to
* nmRipLocFunc. * nmRipLocFunc.
*/ */
{ {
@ -346,8 +346,8 @@ NMRipupList()
*/ */
int int
nmwNetCellFunc(scx) nmwNetCellFunc(
SearchContext *scx; /* Describes search. */ SearchContext *scx) /* Describes search. */
{ {
TxError("Cell id %s touches net but has no terminals.\n", TxError("Cell id %s touches net but has no terminals.\n",
scx->scx_use->cu_id); scx->scx_use->cu_id);
@ -373,9 +373,9 @@ nmwNetCellFunc(scx)
*/ */
int int
nmwCheckFunc(name, otherName) nmwCheckFunc(
char *name; /* Terminal in net. */ char *name, /* Terminal in net. */
char *otherName; /* Terminal we want to know if it's in net. */ char *otherName) /* Terminal we want to know if it's in net. */
{ {
if (strcmp(name, otherName) == 0) return 1; if (strcmp(name, otherName) == 0) return 1;
return 0; return 0;
@ -405,11 +405,11 @@ nmwCheckFunc(name, otherName)
/* ARGSUSED */ /* ARGSUSED */
int int
nmwNetTermFunc(scx, label, tpath, netPtr) nmwNetTermFunc(
SearchContext *scx; /* Describes state of search (ignored). */ SearchContext *scx, /* Describes state of search (ignored). */
Label *label; /* Label (ignored). */ Label *label, /* Label (ignored). */
TerminalPath *tpath; /* Gives hierarchical label name. */ TerminalPath *tpath, /* Gives hierarchical label name. */
char **netPtr; /* Pointer to a terminal in current net. */ char **netPtr) /* Pointer to a terminal in current net. */
{ {
char *p, *p2; char *p, *p2;
@ -478,10 +478,10 @@ nmwNetTermFunc(scx, label, tpath, netPtr)
*/ */
int int
nmwNetTileFunc(tile, plane, netPtr) nmwNetTileFunc(
Tile *tile; /* Tile that is connected to net. */ Tile *tile, /* Tile that is connected to net. */
int plane; /* Plane index of the tile */ int plane, /* Plane index of the tile */
char **netPtr; /* Pointer to pointer to net name. */ char **netPtr) /* Pointer to pointer to net name. */
{ {
SearchContext scx; SearchContext scx;
char label[TERMLENGTH]; char label[TERMLENGTH];
@ -587,11 +587,11 @@ NMExtract()
*/ */
int int
nmwVerifyLabelFunc2(scx, label, tpath, cd) nmwVerifyLabelFunc2(
SearchContext *scx; /* Describes state of search. */ SearchContext *scx, /* Describes state of search. */
Label *label; /* Label. */ Label *label, /* Label. */
TerminalPath *tpath; /* Gives hierarchical label name. */ TerminalPath *tpath, /* Gives hierarchical label name. */
ClientData cd; /* Used in nmwVerifyTileFunc */ ClientData cd) /* Used in nmwVerifyTileFunc */
{ {
char *p, *p2; char *p, *p2;
char *name; char *name;
@ -765,11 +765,11 @@ nmwVerifyTileFunc(
*/ */
int int
nmwVerifyLabelFunc(rect, name, label, cd) nmwVerifyLabelFunc(
Rect *rect; /* Area of the label, in EditUse coords. */ Rect *rect, /* Area of the label, in EditUse coords. */
char *name; /* Hierarchical name of label. */ char *name, /* Hierarchical name of label. */
Label *label; /* Actual label structure. */ Label *label, /* Actual label structure. */
ClientData cd; /* Client data for nmwVerifyTileFunc (function pointer) */ ClientData cd) /* Client data for nmwVerifyTileFunc (function pointer) */
{ {
TileTypeBitMask *mask; TileTypeBitMask *mask;
int i; int i;
@ -826,10 +826,10 @@ nmwVerifyLabelFunc(rect, name, label, cd)
/* ARGSUSED */ /* ARGSUSED */
int int
nmwVErrorLabelFunc(rect, name, label) nmwVErrorLabelFunc(
Rect *rect; /* Area of label in edit cell coords. */ Rect *rect, /* Area of label in edit cell coords. */
char *name; /* Hierarchical name of label. */ char *name, /* Hierarchical name of label. */
Label *label; /* Pointer to the label itself (not used). */ Label *label) /* Pointer to the label itself (not used). */
{ {
char msg[200]; char msg[200];
Rect biggerArea; Rect biggerArea;
@ -868,9 +868,9 @@ nmwVErrorLabelFunc(rect, name, label)
/* ARGSUSED */ /* ARGSUSED */
int int
nmwVerifyTermFunc(name, report) nmwVerifyTermFunc(
char *name; /* Name of terminal. */ char *name, /* Name of terminal. */
bool report; /* TRUE => print error messages */ bool report) /* TRUE => print error messages */
{ {
int i, found; int i, found;
@ -923,9 +923,9 @@ nmwVerifyTermFunc(name, report)
*/ */
int int
nmwVerifyNetFunc(name, first) nmwVerifyNetFunc(
char *name; /* Name of terminal. */ char *name, /* Name of terminal. */
bool first; /* TRUE means this is first terminal bool first) /* TRUE means this is first terminal
* of a new net. * of a new net.
*/ */
{ {
@ -1081,7 +1081,7 @@ NMVerify()
int int
NMCull() NMCull()
{ {
int nmwCullNetFunc(); int nmwCullNetFunc(char *name, bool first);
/* This implementation is the complement of the verify command. Instead /* This implementation is the complement of the verify command. Instead
* of finding bad nets and reporting them, find good nets and remove them. * of finding bad nets and reporting them, find good nets and remove them.
@ -1118,9 +1118,9 @@ NMCull()
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
int int
nmwCullNetFunc(name, first) nmwCullNetFunc(
char *name; /* Name of a terminal in a net */ char *name, /* Name of a terminal in a net */
bool first; /* TRUE => first terminal of a net */ bool first) /* TRUE => first terminal of a net */
{ {
int i; int i;
@ -1222,10 +1222,10 @@ NMMeasureNet()
/* ARGSUSED */ /* ARGSUSED */
int int
nmMeasureFunc(r, type, clientData) nmMeasureFunc(
Rect *r; Rect *r,
TileType type; TileType type,
ClientData clientData; ClientData clientData)
{ {
if(type == RtrMetalType) if(type == RtrMetalType)
nmMArea=nmMArea+(r->r_xtop-r->r_xbot)*(r->r_ytop-r->r_ybot); nmMArea=nmMArea+(r->r_xtop-r->r_xbot)*(r->r_ytop-r->r_ybot);
@ -1257,10 +1257,10 @@ nmMeasureFunc(r, type, clientData)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
void void
NMMeasureAll(fp) NMMeasureAll(
FILE * fp; FILE * fp)
{ {
int nmAllFunc(); int nmAllFunc(char *name, bool firstInNet, FILE * fp);
nmMArea = nmPArea = nmVCount= 0; nmMArea = nmPArea = nmVCount= 0;
(void) NMEnumNets(nmAllFunc, (ClientData) fp); (void) NMEnumNets(nmAllFunc, (ClientData) fp);
@ -1271,10 +1271,10 @@ NMMeasureAll(fp)
/* ARGSUSED */ /* ARGSUSED */
int int
nmAllFunc(name, firstInNet, fp) nmAllFunc(
char *name; char *name,
bool firstInNet; bool firstInNet,
FILE * fp; FILE * fp)
{ {
void nmwMeasureTileFunc(); void nmwMeasureTileFunc();
int saveM, saveP, saveV; int saveM, saveP, saveV;
@ -1329,8 +1329,8 @@ nmAllFunc(name, firstInNet, fp)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
void void
nmwMeasureTileFunc(tile) nmwMeasureTileFunc(
Tile * tile; Tile * tile)
{ {
int i; int i;
Rect r; Rect r;