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

View File

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

View File

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