K&R sim/*.c: bulk function implementation conversion

K&R obsolete syntax removal for C23 compatibility series
This commit is contained in:
Darryl L. Miles 2025-01-31 19:41:36 +00:00 committed by R. Timothy Edwards
parent b3384f9104
commit 1fbba4408f
4 changed files with 145 additions and 137 deletions

View File

@ -83,9 +83,9 @@ static char bestName[256];
*/
int
SimConnectFunc(tile, cx)
Tile *tile; /* Tile found. */
TreeContext *cx; /* Describes context of search. The client
SimConnectFunc(
Tile *tile, /* Tile found. */
TreeContext *cx) /* Describes context of search. The client
* data is a pointer to the list head of
* the conSrArg2's describing the areas
* left to check.
@ -318,8 +318,8 @@ SimConnectFunc(tile, cx)
#define MAXPATHNAME 256
void
SimTreeCopyConnect(scx, mask, xMask, connect, area, destUse, Node_Name)
SearchContext *scx; /* Describes starting area. The
SimTreeCopyConnect(
SearchContext *scx, /* Describes starting area. The
* scx_use field gives the root of
* the hierarchy to search, and the
* scx_area field gives the starting
@ -327,26 +327,26 @@ SimTreeCopyConnect(scx, mask, xMask, connect, area, destUse, Node_Name)
* this area. The transform is from
* coords of scx_use to destUse.
*/
TileTypeBitMask *mask; /* Tile types to start from in area. */
int xMask; /* Information must be expanded in all
TileTypeBitMask *mask, /* Tile types to start from in area. */
int xMask, /* Information must be expanded in all
* of the windows indicated by this
* mask. Use 0 to consider all info
* regardless of expansion.
*/
TileTypeBitMask *connect; /* Points to table that defines what
TileTypeBitMask *connect, /* Points to table that defines what
* each tile type is considered to
* connect to. Use DBConnectTbl as
* a default.
*/
Rect *area; /* The resulting information is
Rect *area, /* The resulting information is
* clipped to this area. Pass
* TiPlaneRect to get everything.
*/
CellUse *destUse; /* Result use in which to place
CellUse *destUse, /* Result use in which to place
* anything connected to material of
* type mask in area of rootUse.
*/
char *Node_Name; /* Name of node returned.
char *Node_Name) /* Name of node returned.
* NOTE: Don't call this "NodeName",
* because that conflicts with reserved
* words in some compilers.
@ -438,8 +438,9 @@ SimTreeCopyConnect(scx, mask, xMask, connect, area, destUse, Node_Name)
*/
bool
efPreferredName(name1, name2)
char *name1, *name2;
efPreferredName(
char *name1,
char *name2)
{
int nslashes1, nslashes2;
char *np1, *np2;
@ -550,32 +551,31 @@ efPreferredName(name1, name2)
*/
int
SimSrConnect(def, startArea, mask, connect, bounds, func, clientData)
CellDef *def; /* Cell definition in which to carry out
SimSrConnect(
CellDef *def, /* Cell definition in which to carry out
* the connectivity search. Only paint
* in this definition is considered.
*/
Rect *startArea; /* Area to search for an initial tile. Only
Rect *startArea, /* Area to search for an initial tile. Only
* tiles OVERLAPPING the area are considered.
* This area should have positive x and y
* dimensions.
*/
TileTypeBitMask *mask; /* Only tiles of one of these types are used
TileTypeBitMask *mask, /* Only tiles of one of these types are used
* as initial tiles.
*/
TileTypeBitMask *connect; /* Pointer to a table indicating what tile
TileTypeBitMask *connect, /* Pointer to a table indicating what tile
* types connect to what other tile types.
* Each entry gives a mask of types that
* connect to tiles of a given type.
*/
Rect *bounds; /* Area, in coords of scx->scx_use->cu_def,
Rect *bounds, /* Area, in coords of scx->scx_use->cu_def,
* that limits the search: only tiles
* overalapping this area will be returned.
* Use TiPlaneRect to search everywhere.
*/
int (*func)(); /* Function to apply at each connected tile. */
ClientData clientData; /* Client data for above function. */
int (*func)(), /* Function to apply at each connected tile. */
ClientData clientData) /* Client data for above function. */
{
struct conSrArg csa;
int startPlane, result;
@ -661,26 +661,26 @@ SimSrConnect(def, startArea, mask, connect, bounds, func, clientData)
*/
int
SimTreeSrTiles(scx, mask, xMask, tpath, func, cdarg)
SearchContext *scx; /* Pointer to search context specifying
SimTreeSrTiles(
SearchContext *scx, /* Pointer to search context specifying
* a cell use to search, an area in the
* coordinates of the cell's def, and a
* transform back to "root" coordinates.
*/
TileTypeBitMask *mask; /* Only tiles with a type for which
TileTypeBitMask *mask, /* Only tiles with a type for which
* a bit in this mask is on are processed.
*/
int xMask; /* All subcells are visited recursively
int xMask, /* All subcells are visited recursively
* until we encounter uses whose flags,
* when anded with xMask, are not
* equal to xMask.
*/
TerminalPath *tpath; /* Pointer to a structure describing a
TerminalPath *tpath, /* Pointer to a structure describing a
* partially filled-in terminal pathname.
* Add new components as encountered.
*/
int (*func)(); /* Function to apply at each qualifying tile */
ClientData cdarg; /* Client data for above function */
int (*func)(), /* Function to apply at each qualifying tile */
ClientData cdarg) /* Client data for above function */
{
int SimCellTileSrFunc();
TreeFilter filter;
@ -703,29 +703,29 @@ SimTreeSrTiles(scx, mask, xMask, tpath, func, cdarg)
*/
int
SimTreeSrNMTiles(scx, dinfo, mask, xMask, tpath, func, cdarg)
SearchContext *scx; /* Pointer to search context specifying
SimTreeSrNMTiles(
SearchContext *scx, /* Pointer to search context specifying
* a cell use to search, an area in the
* coordinates of the cell's def, and a
* transform back to "root" coordinates.
*/
TileType dinfo; /* Type containing information about the
TileType dinfo, /* Type containing information about the
* triangular area to search.
*/
TileTypeBitMask *mask; /* Only tiles with a type for which
TileTypeBitMask *mask, /* Only tiles with a type for which
* a bit in this mask is on are processed.
*/
int xMask; /* All subcells are visited recursively
int xMask, /* All subcells are visited recursively
* until we encounter uses whose flags,
* when anded with xMask, are not
* equal to xMask.
*/
TerminalPath *tpath; /* Pointer to a structure describing a
TerminalPath *tpath, /* Pointer to a structure describing a
* partially filled-in terminal pathname.
* Add new components as encountered.
*/
int (*func)(); /* Function to apply at each qualifying tile */
ClientData cdarg; /* Client data for above function */
int (*func)(), /* Function to apply at each qualifying tile */
ClientData cdarg) /* Client data for above function */
{
int SimCellTileSrFunc();
TreeFilter filter;
@ -746,9 +746,9 @@ SimTreeSrNMTiles(scx, dinfo, mask, xMask, tpath, func, cdarg)
*/
int
SimCellTileSrFunc(scx, fp)
SearchContext *scx;
TreeFilter *fp;
SimCellTileSrFunc(
SearchContext *scx,
TreeFilter *fp)
{
TreeContext context;
TerminalPath *tp;
@ -860,15 +860,15 @@ cleanup:
*/
int
SimPutLabel(cellDef, rect, align, text, type)
CellDef *cellDef; /* Cell in which label is placed */
Rect *rect; /* Location of label; see above for description */
int align; /* Orientation/alignment of text. If this is < 0,
SimPutLabel(
CellDef *cellDef, /* Cell in which label is placed */
Rect *rect, /* Location of label, see above for description */
int align, /* Orientation/alignment of text. If this is < 0,
* an orientation will be picked to keep the text
* inside the cell boundary.
*/
char *text; /* Pointer to actual text of label */
TileType type; /* Type of tile to be labeled */
char *text, /* Pointer to actual text of label */
TileType type) /* Type of tile to be labeled */
{
Label *lab;
int len, x1, x2, y1, y2, tmp, labx, laby;
@ -963,9 +963,9 @@ SimPutLabel(cellDef, rect, align, text, type)
*/
void
SimRsimHandler(w, cmd)
MagWindow *w; /* Window containing cursor. */
TxCommand *cmd; /* Describes what happened. */
SimRsimHandler(
MagWindow *w, /* Window containing cursor. */
TxCommand *cmd) /* Describes what happened. */
{
static int buttonCorner = TOOL_ILG;

View File

@ -114,8 +114,8 @@ PlaneMask SimFetPlanes;
*/
void
SimAddDefList(newdef)
CellDef *newdef;
SimAddDefList(
CellDef *newdef)
{
DefListElt *d;
@ -163,7 +163,7 @@ SimAddDefList(newdef)
*/
void
SimInitDefList()
SimInitDefList(void)
{
DefListElt *p, *q;
@ -194,8 +194,8 @@ SimInitDefList()
*/
void
SimAddNodeList(newnode)
NodeRegion *newnode;
SimAddNodeList(
NodeRegion *newnode)
{
if( NodeRegList != (NodeRegion *) NULL )
newnode->nreg_next = NodeRegList;
@ -220,7 +220,7 @@ SimAddNodeList(newnode)
*/
void
SimFreeNodeRegs()
SimFreeNodeRegs(void)
{
NodeRegion *p, *q;
@ -239,7 +239,8 @@ SimFreeNodeRegs()
* to the region being searched.
*----------------------------------------------------------------
*/
int SimInitConnTables()
int
SimInitConnTables(void)
{
int i, t, sd, p;
ExtDevice *devptr;
@ -337,10 +338,11 @@ typedef struct /* return value from SimFindOneNode */
*
*----------------------------------------------------------------
*/
char *SimTxtorLabel( nterm, tm, trans )
int nterm;
Transform *tm;
SimTrans *trans;
char *
SimTxtorLabel(
int nterm,
Transform *tm,
SimTrans *trans)
{
static char name[30];
Rect r1, r2;
@ -356,18 +358,20 @@ char *SimTxtorLabel( nterm, tm, trans )
return( name );
}
int SimSDTransFunc( tile, ptile )
Tile *tile;
Tile **ptile;
int
SimSDTransFunc(
Tile *tile,
Tile **ptile)
{
*ptile = tile;
return( 1 );
}
int SimTransTerms( bp, trans )
Boundary *bp;
SimTrans *trans;
int
SimTransTerms(
Boundary *bp,
SimTrans *trans)
{
TransTerm *term;
Tile *tile = bp->b_outside;
@ -427,9 +431,10 @@ int SimTransTerms( bp, trans )
}
int SimTermNum( trans, reg )
SimTrans *trans;
NodeRegion *reg;
int
SimTermNum(
SimTrans *trans,
NodeRegion *reg)
{
int i, changed;
TransTerm *p1, *p2, tmp;
@ -470,10 +475,10 @@ int SimTermNum( trans, reg )
int
SimTransistorTile(tile, pNum, arg)
Tile *tile;
int pNum;
FindRegion *arg;
SimTransistorTile(
Tile *tile,
int pNum,
FindRegion *arg)
{
int i;
TileType t;
@ -494,10 +499,11 @@ SimTransistorTile(tile, pNum, arg)
}
int SimFindTxtor( tile, pNum, arg )
Tile *tile;
int pNum;
FindRegion *arg;
int
SimFindTxtor(
Tile *tile,
int pNum,
FindRegion *arg)
{
TileType type;
@ -549,9 +555,9 @@ int SimFindTxtor( tile, pNum, arg )
*/
NodeSpec *
SimFindOneNode( sx, tile )
SearchContext *sx;
Tile *tile;
SimFindOneNode(
SearchContext *sx,
Tile *tile)
{
CellDef *def = sx->scx_use->cu_def;
NodeRegion *reg;
@ -696,12 +702,12 @@ SimFindOneNode( sx, tile )
*/
char *
SimGetNodeName(sx, tp, path)
SearchContext *sx; /* current search context */
Tile *tp; /* tile in this cell which is part
SimGetNodeName(
SearchContext *sx, /* current search context */
Tile *tp, /* tile in this cell which is part
* of the node
*/
char *path; /* path name of hierarchy of search */
char *path) /* path name of hierarchy of search */
{
CellDef *def = sx->scx_use->cu_def;
NodeRegion *nodeList;
@ -820,7 +826,7 @@ SimGetNodeName(sx, tp, path)
*/
void
SimGetNodeCleanUp()
SimGetNodeCleanUp(void)
{
SimFreeNodeRegs();
SimInitDefList();

View File

@ -80,7 +80,7 @@ bool SimRsimRunning = FALSE;
bool SimHasCoords = FALSE;
/* Forward declaration */
void SimStopRsim();
void SimStopRsim(void);
/*
*-----------------------------------------------------------------------
@ -99,8 +99,8 @@ void SimStopRsim();
*/
char *
SimGetNodeCommand(cmd)
char *cmd;
SimGetNodeCommand(
char *cmd)
{
/* This table is used to define which Rsim commands are applied to
* each node in the selection. Depending on the command, you
@ -152,8 +152,8 @@ SimGetNodeCommand(cmd)
*/
bool
SimStartRsim(argv)
char *argv[]; /* list of rsim args for the fork */
SimStartRsim(
char *argv[]) /* list of rsim args for the fork */
{
int child;
@ -289,8 +289,8 @@ SimStartRsim(argv)
*/
void
SimConnectRsim(escRsim)
bool escRsim; /* TRUE if we should escape back to Magic */
SimConnectRsim(
bool escRsim) /* TRUE if we should escape back to Magic */
{
static char HELLO_MSG[] =
"Type \"q\" to quit simulator or \".\" to escape back to Magic.\n";
@ -383,8 +383,8 @@ SimConnectRsim(escRsim)
*/
bool
InitRsim(hello_msg)
char *hello_msg;
InitRsim(
char *hello_msg)
{
char buff[READBUF_SIZE];
char *last;
@ -463,7 +463,7 @@ InitRsim(hello_msg)
*/
void
SimStopRsim()
SimStopRsim(void)
{
int pid;
@ -515,7 +515,7 @@ SimStopRsim()
*/
void
RsimErrorMsg()
RsimErrorMsg(void)
{
static char msg[] = "The simulator must be running before this command "
"can be executed. To do\n"
@ -548,9 +548,9 @@ RsimErrorMsg()
*/
void
SimRsimIt(cmd, nodeName)
char *cmd;
char *nodeName;
SimRsimIt(
char *cmd,
char *nodeName)
{
static char cmdStr[512];
@ -619,12 +619,12 @@ SimRsimIt(cmd, nodeName)
*/
int
SimFillBuffer(buffHead, pLastChar, charCount)
char *buffHead; /* ptr to start of buffer */
char **pLastChar; /* used to return ptr to last char
SimFillBuffer(
char *buffHead, /* ptr to start of buffer */
char **pLastChar, /* used to return ptr to last char
* in the buffer.
*/
int *charCount; /* number of chars in the buffer */
int *charCount) /* number of chars in the buffer */
{
int charsRead = 0;
char *temp;
@ -723,10 +723,10 @@ try_again:
*/
void
SimShiftChars(buffStart, lineStart, lastChar)
char *buffStart; /* beginning of buffer */
char **lineStart; /* ptr to first valid char in buffer */
char **lastChar; /* ptr to last valid char in buffer */
SimShiftChars(
char *buffStart, /* beginning of buffer */
char **lineStart, /* ptr to first valid char in buffer */
char **lastChar) /* ptr to last valid char in buffer */
{
char *temp;
char *temp1;
@ -761,9 +761,9 @@ SimShiftChars(buffStart, lineStart, lastChar)
*/
char *
SimFindNewLine(buffStart, buffEnd)
char *buffStart; /* first char in buffer */
char *buffEnd; /* last char in buffer */
SimFindNewLine(
char *buffStart, /* first char in buffer */
char *buffEnd) /* last char in buffer */
{
char *sp;
@ -807,8 +807,8 @@ SimFindNewLine(buffStart, buffEnd)
*/
bool
SimGetReplyLine(replyLine)
char **replyLine;
SimGetReplyLine(
char **replyLine)
{
static char simReadBuff[READBUF_SIZE]; /* buffer in which to read the
* rsim reply before processing
@ -930,7 +930,7 @@ SimGetReplyLine(replyLine)
*/
void
SimInit()
SimInit(void)
{
static char *rsimdoc =
"You are currently using the \"rsim\" tool. The button actions are:\n\

View File

@ -125,17 +125,17 @@ bool SimRsimRunning = FALSE; /* Always false if there's no rsim module */
*/
char *
SimSelectNode(scx, type, xMask, buffer)
SearchContext *scx; /* Area to tree-search for material. The
SimSelectNode(
SearchContext *scx, /* Area to tree-search for material. The
* transform must map to EditRoot coordinates.
*/
TileType type; /* The type of material to be considered. */
int xMask; /* Indicates window (or windows) where cells
TileType type, /* The type of material to be considered. */
int xMask, /* Indicates window (or windows) where cells
* must be expanded for their contents to be
* considered. 0 means treat everything as
* expanded.
*/
char *buffer; /* buffer to hold node name */
char *buffer) /* buffer to hold node name */
{
TileTypeBitMask mask;
char *strptr;
@ -180,7 +180,7 @@ SimSelectNode(scx, type, xMask, buffer)
}
int
NullFunc()
NullFunc(void)
{
return(0);
}
@ -202,8 +202,8 @@ NullFunc()
*/
void
SimFreeNodeList(List)
TileListElt **List;
SimFreeNodeList(
TileListElt **List)
{
TileListElt *current;
TileListElt *temp;
@ -219,8 +219,9 @@ SimFreeNodeList(List)
}
TileListElt *
simFreeNodeEntry(list, entry)
TileListElt *list, *entry;
simFreeNodeEntry(
TileListElt *list,
TileListElt *entry)
{
TileListElt *prev, *curr;
@ -257,7 +258,8 @@ simFreeNodeEntry(list, entry)
*/
TileListElt *
SimSelectArea(Rect *rect)
SimSelectArea(
Rect *rect)
{
int plane;
int SimSelectFunc();
@ -317,9 +319,9 @@ SimSelectArea(Rect *rect)
*/
int
SimSelectFunc(tile, pHead)
Tile *tile; /* Tile in SelectDef. */
TileListElt **pHead; /* list of node names found */
SimSelectFunc(
Tile *tile, /* Tile in SelectDef. */
TileListElt **pHead) /* list of node names found */
{
TileTypeBitMask mask;
SearchContext scx;
@ -431,8 +433,8 @@ SimSelectFunc(tile, pHead)
*/
bool
SimSelection(cmd)
char *cmd; /* rsim command to apply to the selection */
SimSelection(
char *cmd) /* rsim command to apply to the selection */
{
static char Hstring[] = "RSIM=1";
static char Lstring[] = "RSIM=0";
@ -606,9 +608,9 @@ the selection.\n");
*/
void
SimAddLabels(SelectNodeList, rootuse)
TileListElt *SelectNodeList;
CellDef *rootuse; /* the root cell def for the window */
SimAddLabels(
TileListElt *SelectNodeList,
CellDef *rootuse) /* the root cell def for the window */
{
TileListElt *current;
@ -652,8 +654,8 @@ SimAddLabels(SelectNodeList, rootuse)
*/
void
SimRsimMouse(w)
MagWindow *w;
SimRsimMouse(
MagWindow *w)
{
CellUse *cu;
@ -720,7 +722,7 @@ SimRsimMouse(w)
*/
void
SimGetnode()
SimGetnode(void)
{
TileListElt *current;
@ -765,7 +767,7 @@ SimGetnode()
*/
void
SimGetsnode()
SimGetsnode(void)
{
TileListElt *current;
@ -813,7 +815,7 @@ SimGetsnode()
*/
void
SimEraseLabels()
SimEraseLabels(void)
{
SimDefListElt *p;