sim: constify various APIs
This commit is contained in:
parent
1fbba4408f
commit
6ec826fb8b
|
|
@ -94,7 +94,8 @@ SimConnectFunc(
|
||||||
struct conSrArg2 *csa2;
|
struct conSrArg2 *csa2;
|
||||||
Rect tileArea, *srArea, newarea;
|
Rect tileArea, *srArea, newarea;
|
||||||
SearchContext *scx = cx->tc_scx;
|
SearchContext *scx = cx->tc_scx;
|
||||||
TileTypeBitMask notConnectMask, *connectMask;
|
TileTypeBitMask notConnectMask;
|
||||||
|
const TileTypeBitMask *connectMask;
|
||||||
TileType loctype, ctype;
|
TileType loctype, ctype;
|
||||||
TileType dinfo = 0;
|
TileType dinfo = 0;
|
||||||
int i, pNum;
|
int i, pNum;
|
||||||
|
|
@ -327,18 +328,18 @@ SimTreeCopyConnect(
|
||||||
* this area. The transform is from
|
* this area. The transform is from
|
||||||
* coords of scx_use to destUse.
|
* coords of scx_use to destUse.
|
||||||
*/
|
*/
|
||||||
TileTypeBitMask *mask, /* Tile types to start from in area. */
|
const TileTypeBitMask *mask, /* Tile types to start from in area. */
|
||||||
int xMask, /* Information must be expanded in all
|
int xMask, /* Information must be expanded in all
|
||||||
* of the windows indicated by this
|
* of the windows indicated by this
|
||||||
* mask. Use 0 to consider all info
|
* mask. Use 0 to consider all info
|
||||||
* regardless of expansion.
|
* regardless of expansion.
|
||||||
*/
|
*/
|
||||||
TileTypeBitMask *connect, /* Points to table that defines what
|
const TileTypeBitMask *connect, /* Points to table that defines what
|
||||||
* each tile type is considered to
|
* each tile type is considered to
|
||||||
* connect to. Use DBConnectTbl as
|
* connect to. Use DBConnectTbl as
|
||||||
* a default.
|
* a default.
|
||||||
*/
|
*/
|
||||||
Rect *area, /* The resulting information is
|
const Rect *area, /* The resulting information is
|
||||||
* clipped to this area. Pass
|
* clipped to this area. Pass
|
||||||
* TiPlaneRect to get everything.
|
* TiPlaneRect to get everything.
|
||||||
*/
|
*/
|
||||||
|
|
@ -354,7 +355,7 @@ SimTreeCopyConnect(
|
||||||
{
|
{
|
||||||
TerminalPath tpath;
|
TerminalPath tpath;
|
||||||
char pathName[MAXPATHNAME];
|
char pathName[MAXPATHNAME];
|
||||||
TileTypeBitMask *newmask;
|
const TileTypeBitMask *newmask;
|
||||||
struct conSrArg2 csa2;
|
struct conSrArg2 csa2;
|
||||||
TileType newtype;
|
TileType newtype;
|
||||||
|
|
||||||
|
|
@ -439,11 +440,11 @@ SimTreeCopyConnect(
|
||||||
|
|
||||||
bool
|
bool
|
||||||
efPreferredName(
|
efPreferredName(
|
||||||
char *name1,
|
const char *name1,
|
||||||
char *name2)
|
const char *name2)
|
||||||
{
|
{
|
||||||
int nslashes1, nslashes2;
|
int nslashes1, nslashes2;
|
||||||
char *np1, *np2;
|
const char *np1, *np2;
|
||||||
|
|
||||||
if( name1[0] == '@' && name1[1] == '=' )
|
if( name1[0] == '@' && name1[1] == '=' )
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
|
|
@ -556,20 +557,21 @@ SimSrConnect(
|
||||||
* the connectivity search. Only paint
|
* the connectivity search. Only paint
|
||||||
* in this definition is considered.
|
* in this definition is considered.
|
||||||
*/
|
*/
|
||||||
Rect *startArea, /* Area to search for an initial tile. Only
|
const Rect *startArea, /* Area to search for an initial tile. Only
|
||||||
* tiles OVERLAPPING the area are considered.
|
* tiles OVERLAPPING the area are considered.
|
||||||
* This area should have positive x and y
|
* This area should have positive x and y
|
||||||
* dimensions.
|
* dimensions.
|
||||||
*/
|
*/
|
||||||
TileTypeBitMask *mask, /* Only tiles of one of these types are used
|
const TileTypeBitMask *mask,/* Only tiles of one of these types are used
|
||||||
* as initial tiles.
|
* as initial tiles.
|
||||||
*/
|
*/
|
||||||
TileTypeBitMask *connect, /* Pointer to a table indicating what tile
|
const TileTypeBitMask *connect,
|
||||||
|
/* Pointer to a table indicating what tile
|
||||||
* types connect to what other tile types.
|
* types connect to what other tile types.
|
||||||
* Each entry gives a mask of types that
|
* Each entry gives a mask of types that
|
||||||
* connect to tiles of a given type.
|
* connect to tiles of a given type.
|
||||||
*/
|
*/
|
||||||
Rect *bounds, /* Area, in coords of scx->scx_use->cu_def,
|
const Rect *bounds, /* Area, in coords of scx->scx_use->cu_def,
|
||||||
* that limits the search: only tiles
|
* that limits the search: only tiles
|
||||||
* overalapping this area will be returned.
|
* overalapping this area will be returned.
|
||||||
* Use TiPlaneRect to search everywhere.
|
* Use TiPlaneRect to search everywhere.
|
||||||
|
|
@ -667,7 +669,7 @@ SimTreeSrTiles(
|
||||||
* coordinates of the cell's def, and a
|
* coordinates of the cell's def, and a
|
||||||
* transform back to "root" coordinates.
|
* transform back to "root" coordinates.
|
||||||
*/
|
*/
|
||||||
TileTypeBitMask *mask, /* Only tiles with a type for which
|
const TileTypeBitMask *mask,/* Only tiles with a type for which
|
||||||
* a bit in this mask is on are processed.
|
* a bit in this mask is on are processed.
|
||||||
*/
|
*/
|
||||||
int xMask, /* All subcells are visited recursively
|
int xMask, /* All subcells are visited recursively
|
||||||
|
|
@ -712,7 +714,7 @@ SimTreeSrNMTiles(
|
||||||
TileType dinfo, /* Type containing information about the
|
TileType dinfo, /* Type containing information about the
|
||||||
* triangular area to search.
|
* triangular area to search.
|
||||||
*/
|
*/
|
||||||
TileTypeBitMask *mask, /* Only tiles with a type for which
|
const TileTypeBitMask *mask,/* Only tiles with a type for which
|
||||||
* a bit in this mask is on are processed.
|
* a bit in this mask is on are processed.
|
||||||
*/
|
*/
|
||||||
int xMask, /* All subcells are visited recursively
|
int xMask, /* All subcells are visited recursively
|
||||||
|
|
@ -862,12 +864,12 @@ cleanup:
|
||||||
int
|
int
|
||||||
SimPutLabel(
|
SimPutLabel(
|
||||||
CellDef *cellDef, /* Cell in which label is placed */
|
CellDef *cellDef, /* Cell in which label is placed */
|
||||||
Rect *rect, /* Location of label, see above for description */
|
const Rect *rect, /* Location of label, see above for description */
|
||||||
int align, /* Orientation/alignment of text. If this is < 0,
|
int align, /* Orientation/alignment of text. If this is < 0,
|
||||||
* an orientation will be picked to keep the text
|
* an orientation will be picked to keep the text
|
||||||
* inside the cell boundary.
|
* inside the cell boundary.
|
||||||
*/
|
*/
|
||||||
char *text, /* Pointer to actual text of label */
|
const char *text, /* Pointer to actual text of label */
|
||||||
TileType type) /* Type of tile to be labeled */
|
TileType type) /* Type of tile to be labeled */
|
||||||
{
|
{
|
||||||
Label *lab;
|
Label *lab;
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,7 @@ typedef struct /* return value from SimFindOneNode */
|
||||||
char *
|
char *
|
||||||
SimTxtorLabel(
|
SimTxtorLabel(
|
||||||
int nterm,
|
int nterm,
|
||||||
Transform *tm,
|
const Transform *tm,
|
||||||
SimTrans *trans)
|
SimTrans *trans)
|
||||||
{
|
{
|
||||||
static char name[30];
|
static char name[30];
|
||||||
|
|
@ -707,7 +707,7 @@ SimGetNodeName(
|
||||||
Tile *tp, /* tile in this cell which is part
|
Tile *tp, /* tile in this cell which is part
|
||||||
* of the node
|
* of the node
|
||||||
*/
|
*/
|
||||||
char *path) /* path name of hierarchy of search */
|
const char *path) /* path name of hierarchy of search */
|
||||||
{
|
{
|
||||||
CellDef *def = sx->scx_use->cu_def;
|
CellDef *def = sx->scx_use->cu_def;
|
||||||
NodeRegion *nodeList;
|
NodeRegion *nodeList;
|
||||||
|
|
|
||||||
|
|
@ -98,9 +98,9 @@ void SimStopRsim(void);
|
||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
SimGetNodeCommand(
|
SimGetNodeCommand(
|
||||||
char *cmd)
|
const char *cmd)
|
||||||
{
|
{
|
||||||
/* This table is used to define which Rsim commands are applied to
|
/* This table is used to define which Rsim commands are applied to
|
||||||
* each node in the selection. Depending on the command, you
|
* each node in the selection. Depending on the command, you
|
||||||
|
|
@ -292,7 +292,7 @@ void
|
||||||
SimConnectRsim(
|
SimConnectRsim(
|
||||||
bool escRsim) /* TRUE if we should escape back to Magic */
|
bool escRsim) /* TRUE if we should escape back to Magic */
|
||||||
{
|
{
|
||||||
static char HELLO_MSG[] =
|
static const char HELLO_MSG[] =
|
||||||
"Type \"q\" to quit simulator or \".\" to escape back to Magic.\n";
|
"Type \"q\" to quit simulator or \".\" to escape back to Magic.\n";
|
||||||
|
|
||||||
char *replyLine; /* used to hold one line of the Rsim reply */
|
char *replyLine; /* used to hold one line of the Rsim reply */
|
||||||
|
|
@ -384,7 +384,7 @@ SimConnectRsim(
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InitRsim(
|
InitRsim(
|
||||||
char *hello_msg)
|
const char *hello_msg)
|
||||||
{
|
{
|
||||||
char buff[READBUF_SIZE];
|
char buff[READBUF_SIZE];
|
||||||
char *last;
|
char *last;
|
||||||
|
|
@ -517,7 +517,7 @@ SimStopRsim(void)
|
||||||
void
|
void
|
||||||
RsimErrorMsg(void)
|
RsimErrorMsg(void)
|
||||||
{
|
{
|
||||||
static char msg[] = "The simulator must be running before this command "
|
static const char msg[] = "The simulator must be running before this command "
|
||||||
"can be executed. To do\n"
|
"can be executed. To do\n"
|
||||||
"this enter the command \"rsim <options> <filename>\". "
|
"this enter the command \"rsim <options> <filename>\". "
|
||||||
"To escape back to\n"
|
"To escape back to\n"
|
||||||
|
|
@ -549,8 +549,8 @@ RsimErrorMsg(void)
|
||||||
|
|
||||||
void
|
void
|
||||||
SimRsimIt(
|
SimRsimIt(
|
||||||
char *cmd,
|
const char *cmd,
|
||||||
char *nodeName)
|
const char *nodeName)
|
||||||
{
|
{
|
||||||
|
|
||||||
static char cmdStr[512];
|
static char cmdStr[512];
|
||||||
|
|
@ -932,7 +932,7 @@ SimGetReplyLine(
|
||||||
void
|
void
|
||||||
SimInit(void)
|
SimInit(void)
|
||||||
{
|
{
|
||||||
static char *rsimdoc =
|
static const char *rsimdoc =
|
||||||
"You are currently using the \"rsim\" tool. The button actions are:\n\
|
"You are currently using the \"rsim\" tool. The button actions are:\n\
|
||||||
left - move the box so its lower-left corner is at cursor position\n\
|
left - move the box so its lower-left corner is at cursor position\n\
|
||||||
right - resize box by moving upper-right corner to cursor position\n\
|
right - resize box by moving upper-right corner to cursor position\n\
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ simFreeNodeEntry(
|
||||||
|
|
||||||
TileListElt *
|
TileListElt *
|
||||||
SimSelectArea(
|
SimSelectArea(
|
||||||
Rect *rect)
|
const Rect *rect)
|
||||||
{
|
{
|
||||||
int plane;
|
int plane;
|
||||||
int SimSelectFunc();
|
int SimSelectFunc();
|
||||||
|
|
@ -434,12 +434,12 @@ SimSelectFunc(
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SimSelection(
|
SimSelection(
|
||||||
char *cmd) /* rsim command to apply to the selection */
|
const char *cmd) /* rsim command to apply to the selection */
|
||||||
{
|
{
|
||||||
static char Hstring[] = "RSIM=1";
|
static const char Hstring[] = "RSIM=1";
|
||||||
static char Lstring[] = "RSIM=0";
|
static const char Lstring[] = "RSIM=0";
|
||||||
static char Xstring[] = "RSIM=X";
|
static const char Xstring[] = "RSIM=X";
|
||||||
static char QUESTstring[] = "?";
|
static const char QUESTstring[] = "?";
|
||||||
|
|
||||||
char timeString[256];
|
char timeString[256];
|
||||||
TileListElt *current, *node_list;
|
TileListElt *current, *node_list;
|
||||||
|
|
|
||||||
24
sim/sim.h
24
sim/sim.h
|
|
@ -5,13 +5,13 @@
|
||||||
#include "textio/txcommands.h" /* TxCommand */
|
#include "textio/txcommands.h" /* TxCommand */
|
||||||
#include "windows/windows.h" /* MagWindow */
|
#include "windows/windows.h" /* MagWindow */
|
||||||
|
|
||||||
extern char *SimGetNodeCommand(char *cmd);
|
extern const char *SimGetNodeCommand(const char *cmd);
|
||||||
extern char *SimGetNodeName(SearchContext *sx, Tile *tp, char *path);
|
extern char *SimGetNodeName(SearchContext *sx, Tile *tp, const char *path);
|
||||||
extern char *SimSelectNode(SearchContext *scx, TileType type, int xMask, char *buffer);
|
extern char *SimSelectNode(SearchContext *scx, TileType type, int xMask, char *buffer);
|
||||||
extern bool SimGetReplyLine(char **replyLine);
|
extern bool SimGetReplyLine(char **replyLine);
|
||||||
extern void SimRsimIt(char *cmd, char *nodeName);
|
extern void SimRsimIt(const char *cmd, const char *nodeName);
|
||||||
extern void SimEraseLabels(void);
|
extern void SimEraseLabels(void);
|
||||||
extern bool efPreferredName(char *name1, char *name2);
|
extern bool efPreferredName(const char *name1, const char *name2);
|
||||||
extern void SimRsimHandler(MagWindow *w, TxCommand *cmd);
|
extern void SimRsimHandler(MagWindow *w, TxCommand *cmd);
|
||||||
extern void SimInit(void);
|
extern void SimInit(void);
|
||||||
|
|
||||||
|
|
@ -34,18 +34,18 @@ extern HashTable SimAbortSeenTbl;
|
||||||
extern void SimGetnode(void);
|
extern void SimGetnode(void);
|
||||||
extern void SimGetsnode(void);
|
extern void SimGetsnode(void);
|
||||||
extern void SimGetNodeCleanUp(void);
|
extern void SimGetNodeCleanUp(void);
|
||||||
extern int SimPutLabel(CellDef *cellDef, Rect *rect, int align, char *text, TileType type);
|
extern int SimPutLabel(CellDef *cellDef, const Rect *rect, int align, const char *text, TileType type);
|
||||||
extern int SimSrConnect(CellDef *def, Rect *startArea, TileTypeBitMask *mask, TileTypeBitMask *connect,
|
extern int SimSrConnect(CellDef *def, const Rect *startArea, const TileTypeBitMask *mask, const TileTypeBitMask *connect,
|
||||||
Rect *bounds, int (*func)(), ClientData clientData);
|
const Rect *bounds, int (*func)(), ClientData clientData);
|
||||||
extern void SimTreeCopyConnect(SearchContext *scx, TileTypeBitMask *mask, int xMask, TileTypeBitMask *connect,
|
extern void SimTreeCopyConnect(SearchContext *scx, const TileTypeBitMask *mask, int xMask, const TileTypeBitMask *connect,
|
||||||
Rect *area, CellUse *destUse, char *Node_Name);
|
const Rect *area, CellUse *destUse, char *Node_Name);
|
||||||
extern int SimTreeSrNMTiles(SearchContext *scx, TileType dinfo, TileTypeBitMask *mask, int xMask, TerminalPath *tpath,
|
extern int SimTreeSrNMTiles(SearchContext *scx, TileType dinfo, const TileTypeBitMask *mask, int xMask, TerminalPath *tpath,
|
||||||
int (*func)(), ClientData cdarg);
|
int (*func)(), ClientData cdarg);
|
||||||
extern int SimTreeSrTiles(SearchContext *scx, TileTypeBitMask *mask, int xMask, TerminalPath *tpath,
|
extern int SimTreeSrTiles(SearchContext *scx, const TileTypeBitMask *mask, int xMask, TerminalPath *tpath,
|
||||||
int (*func)(), ClientData cdarg);
|
int (*func)(), ClientData cdarg);
|
||||||
extern bool SimStartRsim(char *argv[]);
|
extern bool SimStartRsim(char *argv[]);
|
||||||
extern void SimConnectRsim(bool escRsim);
|
extern void SimConnectRsim(bool escRsim);
|
||||||
extern bool SimSelection(char *cmd);
|
extern bool SimSelection(const char *cmd);
|
||||||
extern void SimRsimMouse(MagWindow *w);
|
extern void SimRsimMouse(MagWindow *w);
|
||||||
extern int SimFillBuffer(char *buffHead, char **pLastChar, int *charCount);
|
extern int SimFillBuffer(char *buffHead, char **pLastChar, int *charCount);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue