irouter: convert K&R function definitions to ANSI C

Convert the old-style (K&R) function definitions in irouter/ 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 irInternal.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:15 +02:00
parent 996b292a80
commit ee6901c02c
No known key found for this signature in database
GPG Key ID: 588785BFDFB01ABD
5 changed files with 227 additions and 228 deletions

View File

@ -96,10 +96,10 @@ extern const SubCmdTableE irSubcommands[];
*/
void
irSetNoisyAutoInt(parm, valueS, file)
int *parm;
char *valueS;
FILE *file;
irSetNoisyAutoInt(
int *parm,
char *valueS,
FILE *file)
{
int which;
@ -208,10 +208,10 @@ irSetNoisyAutoInt(parm, valueS, file)
/* irLSetActive -- */
Tcl_Obj *
irLSetActive(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetActive(
RouteLayer *rL,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewBooleanObj(rL->rl_routeType.rt_active);
@ -221,10 +221,10 @@ irLSetActive(rL,s,file)
/* irLSetWidth -- */
Tcl_Obj *
irLSetWidth(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetWidth(
RouteLayer *rL,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rL->rl_routeType.rt_width);
@ -234,10 +234,10 @@ irLSetWidth(rL,s,file)
/* irLSetLength -- */
Tcl_Obj *
irLSetLength(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetLength(
RouteLayer *rL,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rL->rl_routeType.rt_length);
@ -247,10 +247,10 @@ irLSetLength(rL,s,file)
/* irLSetHCost -- */
Tcl_Obj *
irLSetHCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetHCost(
RouteLayer *rL,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rL->rl_hCost);
@ -260,10 +260,10 @@ irLSetHCost(rL,s,file)
/* irLSetVCost -- */
Tcl_Obj *
irLSetVCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetVCost(
RouteLayer *rL,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rL->rl_vCost);
@ -273,10 +273,10 @@ irLSetVCost(rL,s,file)
/* irLSetJogCost -- */
Tcl_Obj *
irLSetJogCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetJogCost(
RouteLayer *rL,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rL->rl_jogCost);
@ -286,10 +286,10 @@ irLSetJogCost(rL,s,file)
/* irLSetHintCost -- */
Tcl_Obj *
irLSetHintCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetHintCost(
RouteLayer *rL,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rL->rl_hintCost);
@ -299,10 +299,10 @@ irLSetHintCost(rL,s,file)
/* irLSetOverCost -- */
Tcl_Obj *
irLSetOverCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetOverCost(
RouteLayer *rL,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rL->rl_overCost);
@ -314,60 +314,60 @@ irLSetOverCost(rL,s,file)
/* irLSetActive -- */
void
irLSetActive(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetActive(
RouteLayer *rL,
char *s,
FILE *file)
{
SetNoisyBool(&(rL->rl_routeType.rt_active),s,file);
}
/* irLSetWidth -- */
void
irLSetWidth(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetWidth(
RouteLayer *rL,
char *s,
FILE *file)
{
SetNoisyInt(&(rL->rl_routeType.rt_width),s,file);
}
/* irLSetLength -- */
void
irLSetLength(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetLength(
RouteLayer *rL,
char *s,
FILE *file)
{
SetNoisyInt(&(rL->rl_routeType.rt_length),s,file);
}
/* irLSetHCost -- */
void
irLSetHCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetHCost(
RouteLayer *rL,
char *s,
FILE *file)
{
SetNoisyInt(&(rL->rl_hCost),s,file);
}
/* irLSetVCost -- */
void
irLSetVCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetVCost(
RouteLayer *rL,
char *s,
FILE *file)
{
SetNoisyInt(&(rL->rl_vCost),s,file);
}
/* irLSetJogCost -- */
void
irLSetJogCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetJogCost(
RouteLayer *rL,
char *s,
FILE *file)
{
SetNoisyInt(&(rL->rl_jogCost),s,file);
}
@ -375,20 +375,20 @@ irLSetJogCost(rL,s,file)
/* irLSetHintCost -- */
void
irLSetHintCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetHintCost(
RouteLayer *rL,
char *s,
FILE *file)
{
SetNoisyInt(&(rL->rl_hintCost),s,file);
}
/* irLSetOverCost -- */
void
irLSetOverCost(rL,s,file)
RouteLayer *rL;
char *s;
FILE *file;
irLSetOverCost(
RouteLayer *rL,
char *s,
FILE *file)
{
SetNoisyInt(&(rL->rl_overCost),s,file);
}
@ -418,10 +418,10 @@ irLSetOverCost(rL,s,file)
/* irCSetActive -- */
Tcl_Obj *
irCSetActive(rC,s, file)
RouteContact *rC;
char *s;
FILE *file;
irCSetActive(
RouteContact *rC,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewBooleanObj(rC->rc_routeType.rt_active);
@ -431,10 +431,10 @@ irCSetActive(rC,s, file)
/* irCSetWidth -- */
Tcl_Obj *
irCSetWidth(rC,s,file)
RouteContact *rC;
char *s;
FILE *file;
irCSetWidth(
RouteContact *rC,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rC->rc_routeType.rt_width);
@ -444,10 +444,10 @@ irCSetWidth(rC,s,file)
/* irCSetLength-- */
Tcl_Obj *
irCSetLength(rC,s,file)
RouteContact *rC;
char *s;
FILE *file;
irCSetLength(
RouteContact *rC,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rC->rc_routeType.rt_length);
@ -457,10 +457,10 @@ irCSetLength(rC,s,file)
/* irCSetCost -- */
Tcl_Obj *
irCSetCost(rC,s,file)
RouteContact *rC;
char *s;
FILE *file;
irCSetCost(
RouteContact *rC,
char *s,
FILE *file)
{
if (file == (FILE *)1)
return Tcl_NewIntObj(rC->rc_cost);
@ -472,40 +472,40 @@ irCSetCost(rC,s,file)
/* irCSetActive -- */
void
irCSetActive(rC,s, file)
RouteContact *rC;
char *s;
FILE *file;
irCSetActive(
RouteContact *rC,
char *s,
FILE *file)
{
SetNoisyBool(&(rC->rc_routeType.rt_active),s,file);
}
/* irCSetWidth -- */
void
irCSetWidth(rC,s,file)
RouteContact *rC;
char *s;
FILE *file;
irCSetWidth(
RouteContact *rC,
char *s,
FILE *file)
{
SetNoisyInt(&(rC->rc_routeType.rt_width),s,file);
}
/* irCSetLength -- */
void
irCSetLength(rC,s,file)
RouteContact *rC;
char *s;
FILE *file;
irCSetLength(
RouteContact *rC,
char *s,
FILE *file)
{
SetNoisyInt(&(rC->rc_routeType.rt_length),s,file);
}
/* irCSetCost -- */
void
irCSetCost(rC,s,file)
RouteContact *rC;
char *s;
FILE *file;
irCSetCost(
RouteContact *rC,
char *s,
FILE *file)
{
SetNoisyInt(&(rC->rc_cost),s,file);
}
@ -535,18 +535,18 @@ irCSetCost(rC,s,file)
/* irSrSetRate -- */
void
irSrSetRate(s,file)
char *s;
FILE *file;
irSrSetRate(
char *s,
FILE *file)
{
SetNoisyDI(&irMazeParms->mp_wRate,s,file);
}
/* irSrSetWidth -- */
void
irSrSetWidth(s,file)
char *s;
FILE *file;
irSrSetWidth(
char *s,
FILE *file)
{
SetNoisyDI(&(irMazeParms->mp_wWidth),s,file);
}
@ -572,54 +572,54 @@ irSrSetWidth(s,file)
/* irWzdSetBloomCost -- */
void
irWzdSetBloomCost(s,file)
char *s;
FILE *file;
irWzdSetBloomCost(
char *s,
FILE *file)
{
SetNoisyDI(&(irMazeParms->mp_bloomDeltaCost),s,file);
}
/* irWzdSetBloomLimit -- */
void
irWzdSetBloomLimit(s,file)
char *s;
FILE *file;
irWzdSetBloomLimit(
char *s,
FILE *file)
{
SetNoisyInt(&(irMazeParms->mp_bloomLimit),s,file);
}
/* irWzdSetBoundsIncrement -- */
void
irWzdSetBoundsIncrement(s,file)
char *s;
FILE *file;
irWzdSetBoundsIncrement(
char *s,
FILE *file)
{
irSetNoisyAutoInt(&(irMazeParms->mp_boundsIncrement),s,file);
}
/* irWzdSetEstimate -- */
void
irWzdSetEstimate(s,file)
char *s;
FILE *file;
irWzdSetEstimate(
char *s,
FILE *file)
{
SetNoisyBool(&(irMazeParms->mp_estimate),s,file);
}
/* irWzdSetExpandEndpoints-- */
void
irWzdSetExpandEndpoints(s, file)
char *s;
FILE *file;
irWzdSetExpandEndpoints(
char *s,
FILE *file)
{
SetNoisyBool(&(irMazeParms->mp_expandEndpoints),s,file);
}
/* irWzdSetPenalty -- */
void
irWzdSetPenalty(s, file)
char *s;
FILE *file;
irWzdSetPenalty(
char *s,
FILE *file)
{
if(s)
{
@ -655,18 +655,18 @@ irWzdSetPenalty(s, file)
/* irWzdSetPenetration-- */
void
irWzdSetPenetration(s, file)
char *s;
FILE *file;
irWzdSetPenetration(
char *s,
FILE *file)
{
irSetNoisyAutoInt(&(irMazeParms->mp_maxWalkLength),s,file);
}
/* irWzdSetWindow -- */
void
irWzdSetWindow(s, file)
char *s;
FILE *file;
irWzdSetWindow(
char *s,
FILE *file)
{
int which;
int i, type;
@ -800,9 +800,9 @@ static const struct
)
void
irContactsCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irContactsCmd(
MagWindow *w,
TxCommand *cmd)
{
TileType tileType;
RouteContact *rC;
@ -1069,9 +1069,9 @@ irContactsCmd(w, cmd)
/*ARGSUSED*/
void
irHelpCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irHelpCmd(
MagWindow *w,
TxCommand *cmd)
{
int n;
int which;
@ -1174,9 +1174,9 @@ static const struct
/*ARGSUSED*/
void
irLayersCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irLayersCmd(
MagWindow *w,
TxCommand *cmd)
{
TileType tileType;
RouteLayer *rL;
@ -1459,9 +1459,9 @@ static const char* const rOptions[] = {
};
void
irRouteCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irRouteCmd(
MagWindow *w,
TxCommand *cmd)
{
Point *startPtArg = NULL; /* pts to start point, if given on command */
Rect *destRectArg = NULL; /* pts to dest rect, if given on command */
@ -1753,9 +1753,9 @@ static const struct
};
void
irSearchCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irSearchCmd(
MagWindow *w,
TxCommand *cmd)
{
/* Process by case */
@ -1853,9 +1853,9 @@ irSearchCmd(w, cmd)
*/
void
irSpacingsCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irSpacingsCmd(
MagWindow *w,
TxCommand *cmd)
{
TileType tileType;
RouteType *rT;
@ -2132,9 +2132,9 @@ irSpacingsCmd(w, cmd)
*/
void
irVerbosityCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irVerbosityCmd(
MagWindow *w,
TxCommand *cmd)
{
if(cmd->tx_argc >3)
{
@ -2197,9 +2197,9 @@ irVerbosityCmd(w, cmd)
*/
void
irVersionCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irVersionCmd(
MagWindow *w,
TxCommand *cmd)
{
if(cmd->tx_argc == 2)
@ -2250,9 +2250,9 @@ static const struct
};
void
irWizardCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irWizardCmd(
MagWindow *w,
TxCommand *cmd)
{
/* Process by case */
@ -2353,9 +2353,9 @@ irWizardCmd(w, cmd)
*/
void
irSaveParametersCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irSaveParametersCmd(
MagWindow *w,
TxCommand *cmd)
{
FILE *saveFile;
RouteContact *rC;
@ -2570,9 +2570,9 @@ iroute spacings CLEAR\n\
}, *subCmdP;
void
IRCommand(w, cmd)
MagWindow *w;
TxCommand *cmd;
IRCommand(
MagWindow *w,
TxCommand *cmd)
{
int n;
int which;

View File

@ -48,7 +48,7 @@ extern RouteType *irFindRouteType();
extern RouteLayer *irFindRouteLayer();
extern RouteContact *irFindRouteContact();
extern char *irRepeatChar();
extern char *irRepeatChar(int n, char c);
/* ------------------------ Data Global to IRouter ------------------- */
extern MazeParameters *irMazeParms;

View File

@ -92,17 +92,16 @@ typedef struct labelSearchData
*/
int
irRoute(cmdWindow, startType, argStartPt, argStartLabel, argStartLayers,
destType, argDestRect, argDestLabel, argDestLayers)
MagWindow *cmdWindow; /* window route command issued to */
int startType; /* how start is specified */
Point *argStartPt; /* location to route from (in edit cell coords) */
char *argStartLabel; /* label to route from */
List *argStartLayers; /* OK route layers to start route on */
int destType; /* how dest is specified */
Rect *argDestRect; /* location to route to (in edit cell coords) */
char *argDestLabel; /* label to route to */
List *argDestLayers; /* OK route layers to end route on */
irRoute(
MagWindow *cmdWindow, /* window route command issued to */
int startType, /* how start is specified */
Point *argStartPt, /* location to route from (in edit cell coords) */
char *argStartLabel, /* label to route from */
List *argStartLayers, /* OK route layers to start route on */
int destType, /* how dest is specified */
Rect *argDestRect, /* location to route to (in edit cell coords) */
char *argDestLabel, /* label to route to */
List *argDestLayers) /* OK route layers to end route on */
{
CellUse *routeUse; /* Toplevel cell visible during routing */
int expansionMask; /* Subcell expansion modes to use during
@ -497,13 +496,13 @@ abort:
*/
Point
irGetStartPoint(startType, argStartPt, argStartLabel, startLayerPtr, routeUse)
int startType; /* how start is specified */
Point *argStartPt; /* location to route from
irGetStartPoint(
int startType, /* how start is specified */
Point *argStartPt, /* location to route from
* (in edit cell coords) */
char *argStartLabel; /* label to route from */
TileType *startLayerPtr; /* layer type (returned value) */
CellUse *routeUse; /* toplevel cell visible to router */
char *argStartLabel, /* label to route from */
TileType *startLayerPtr, /* layer type (returned value) */
CellUse *routeUse) /* toplevel cell visible to router */
{
Point startPt;
@ -626,13 +625,13 @@ abort:
*/
Rect
irGetDestRect(destType, argDestRect, argDestLabel, destLayerPtr, routeUse)
int destType; /* how dest is specified */
Rect *argDestRect; /* location to route to
irGetDestRect(
int destType, /* how dest is specified */
Rect *argDestRect, /* location to route to
* (in edit cell coords) */
char *argDestLabel; /* label to route to */
TileType *destLayerPtr; /* layer type (returned value) */
CellUse *routeUse; /* toplevel cell visible to router */
char *argDestLabel, /* label to route to */
TileType *destLayerPtr, /* layer type (returned value) */
CellUse *routeUse) /* toplevel cell visible to router */
{
Rect destRect;
@ -754,11 +753,11 @@ abort:
*/
int
irSelLabelsFunc(label, cellUse, transform, clientData)
Label *label;
CellUse *cellUse;
Transform *transform;
ClientData clientData;
irSelLabelsFunc(
Label *label,
CellUse *cellUse,
Transform *transform,
ClientData clientData)
{
LabelSearchData *lsd = (LabelSearchData *)clientData;
CellDef *cellDef = cellUse->cu_def;
@ -804,11 +803,11 @@ irSelLabelsFunc(label, cellUse, transform, clientData)
*/
int
irAllLabelsFunc(rect, name, label, clientData)
Rect *rect;
char *name;
Label *label;
ClientData clientData;
irAllLabelsFunc(
Rect *rect,
char *name,
Label *label,
ClientData clientData)
{
LabelSearchData *lsd = (LabelSearchData *)clientData;
@ -849,10 +848,10 @@ irAllLabelsFunc(rect, name, label, clientData)
*/
int
irSelectedTileFunc(rect, type, c)
Rect *rect;
TileType type;
ClientData c;
irSelectedTileFunc(
Rect *rect,
TileType type,
ClientData c)
{
RouteLayer *rL = (RouteLayer *) c;
MZAddDest(rect, rL->rl_routeType.rt_tileType);
@ -915,12 +914,12 @@ LayerInTouchingContact(
*/
List *
irChooseEndPtLayers(routeUse,expansionMask,endPt,argLayers,endPtName)
CellUse *routeUse;
int expansionMask; /* mask of expanded subcells */
Point *endPt;
List *argLayers;
char *endPtName;
irChooseEndPtLayers(
CellUse *routeUse,
int expansionMask, /* mask of expanded subcells */
Point *endPt,
List *argLayers,
char *endPtName)
{
List *activeLayers;
List *presentLayers;

View File

@ -77,9 +77,9 @@ extern const TestCmdTableE irTestCommands[];
*/
void
irDebugTstCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irDebugTstCmd(
MagWindow *w,
TxCommand *cmd)
{
int result;
bool value;
@ -130,9 +130,9 @@ irDebugTstCmd(w, cmd)
*/
void
irHelpTstCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irHelpTstCmd(
MagWindow *w,
TxCommand *cmd)
{
int n;
int which;
@ -206,9 +206,9 @@ irHelpTstCmd(w, cmd)
*/
void
irParmsTstCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
irParmsTstCmd(
MagWindow *w,
TxCommand *cmd)
{
MZPrintRLs(irRouteLayers);
@ -265,9 +265,9 @@ const TestCmdTableE irTestCommands[] = {
*/
void
IRTest(w, cmd)
MagWindow *w;
TxCommand *cmd;
IRTest(
MagWindow *w,
TxCommand *cmd)
{
int n;
int which;

View File

@ -50,8 +50,8 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
*/
RouteType *
irFindRouteType(type)
TileType type;
irFindRouteType(
TileType type)
{
RouteType *rT;
@ -80,8 +80,8 @@ irFindRouteType(type)
*/
RouteLayer *
irFindRouteLayer(type)
TileType type;
irFindRouteLayer(
TileType type)
{
RouteLayer *rL;
@ -110,8 +110,8 @@ irFindRouteLayer(type)
*/
RouteContact *
irFindRouteContact(type)
TileType type;
irFindRouteContact(
TileType type)
{
RouteContact *rC;
@ -149,9 +149,9 @@ irFindRouteContact(type)
char RepeatString[100];
char *
irRepeatChar(n,c)
int n;
char c;
irRepeatChar(
int n,
char c)
{
int i;
for(i=0; i<n; i++)