TxParseString() refactor to 1-arg public form
Only the txCommands.c file needs the 3-arg form locally
This commit is contained in:
parent
9aef87c355
commit
705b4da105
|
|
@ -780,7 +780,7 @@ keys_and_buttons:
|
||||||
freeMagic(vis);
|
freeMagic(vis);
|
||||||
}
|
}
|
||||||
/* Print Carriage Return & Put back Tcl/Tk prompt */
|
/* Print Carriage Return & Put back Tcl/Tk prompt */
|
||||||
TxParseString("", NULL, NULL);
|
TxParseString("");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -816,7 +816,7 @@ keys_and_buttons:
|
||||||
TxSetPoint(KeyPressedEvent->x,
|
TxSetPoint(KeyPressedEvent->x,
|
||||||
grXtransY(mw, KeyPressedEvent->y),
|
grXtransY(mw, KeyPressedEvent->y),
|
||||||
mw->w_wid);
|
mw->w_wid);
|
||||||
TxParseString(macroDef, NULL, NULL);
|
TxParseString(macroDef);
|
||||||
}
|
}
|
||||||
freeMagic(macroDef);
|
freeMagic(macroDef);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -784,7 +784,7 @@ keys_and_buttons:
|
||||||
freeMagic(vis);
|
freeMagic(vis);
|
||||||
}
|
}
|
||||||
/* Print Carriage Return & Put back Tcl/Tk prompt */
|
/* Print Carriage Return & Put back Tcl/Tk prompt */
|
||||||
TxParseString("", NULL, NULL);
|
TxParseString("");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -820,7 +820,7 @@ keys_and_buttons:
|
||||||
TxSetPoint(KeyPressedEvent->x,
|
TxSetPoint(KeyPressedEvent->x,
|
||||||
grXtransY(mw, KeyPressedEvent->y),
|
grXtransY(mw, KeyPressedEvent->y),
|
||||||
mw->w_wid);
|
mw->w_wid);
|
||||||
TxParseString(macroDef, NULL, NULL);
|
TxParseString(macroDef);
|
||||||
}
|
}
|
||||||
freeMagic(macroDef);
|
freeMagic(macroDef);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1041,7 +1041,7 @@ keys_and_buttons:
|
||||||
freeMagic(vis);
|
freeMagic(vis);
|
||||||
}
|
}
|
||||||
/* Print Carriage Return & Put back Tcl/Tk prompt */
|
/* Print Carriage Return & Put back Tcl/Tk prompt */
|
||||||
TxParseString("", NULL, NULL);
|
TxParseString("");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1076,7 +1076,7 @@ keys_and_buttons:
|
||||||
TxSetPoint(KeyPressedEvent->x,
|
TxSetPoint(KeyPressedEvent->x,
|
||||||
grXToMagic(KeyPressedEvent->y),
|
grXToMagic(KeyPressedEvent->y),
|
||||||
grCurrent.mw->w_wid);
|
grCurrent.mw->w_wid);
|
||||||
TxParseString(macroDef, NULL, NULL);
|
TxParseString(macroDef);
|
||||||
}
|
}
|
||||||
freeMagic(macroDef);
|
freeMagic(macroDef);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1003,10 +1003,8 @@ TxDispatch(f)
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
TxParseString(str, q, event)
|
TxParseString(str)
|
||||||
const char *str;
|
const char *str;
|
||||||
void *q; /* unused */
|
|
||||||
void *event; /* always NULL (ignored) */
|
|
||||||
{
|
{
|
||||||
const char *reply;
|
const char *reply;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@ TxGetInputEvent(
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* TxParseString --
|
* TxParseString_internal --
|
||||||
*
|
*
|
||||||
* Parse a string into commands, and add them to the rear of a queue.
|
* Parse a string into commands, and add them to the rear of a queue.
|
||||||
* The commands in the queue should eventually be freed by the caller
|
* The commands in the queue should eventually be freed by the caller
|
||||||
|
|
@ -1010,11 +1010,13 @@ TxGetInputEvent(
|
||||||
* Side Effects:
|
* Side Effects:
|
||||||
* None.
|
* None.
|
||||||
*
|
*
|
||||||
|
* Module internal API. See TxParseString() for public version.
|
||||||
|
*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
static void
|
||||||
TxParseString(
|
TxParseString_internal(
|
||||||
const char *str, /* The string to be parsed. */
|
const char *str, /* The string to be parsed. */
|
||||||
DQueue *q, /* Add to the tail of this queue. */
|
DQueue *q, /* Add to the tail of this queue. */
|
||||||
TxInputEvent *event) /* An event to supply the point, window ID,
|
TxInputEvent *event) /* An event to supply the point, window ID,
|
||||||
|
|
@ -1053,6 +1055,53 @@ TxParseString(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* TxParseString --
|
||||||
|
*
|
||||||
|
* Parse a string into commands, and add them to the rear of a queue.
|
||||||
|
* The commands in the queue should eventually be freed by the caller
|
||||||
|
* via TxFreeCommand().
|
||||||
|
*
|
||||||
|
* Results:
|
||||||
|
* None.
|
||||||
|
*
|
||||||
|
* Side Effects:
|
||||||
|
* None.
|
||||||
|
*
|
||||||
|
* Public API. See also TxParseString_internal().
|
||||||
|
*
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
TxParseString(
|
||||||
|
const char *str) /* The string to be parsed. */
|
||||||
|
{
|
||||||
|
TxParseString_internal(str, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* tclmagic.c defines TxParseString() so we need a shim to other way
|
||||||
|
*
|
||||||
|
* FIXME it feels like there is some design error here, only this
|
||||||
|
* file cares about DQueue/TxInputEvent arguments but they are
|
||||||
|
* passed but not used by tclmagic.c TxParseString()
|
||||||
|
*
|
||||||
|
* It must be that !MAGIC_WRAPPER needs the DQueue/TxInputEvent for
|
||||||
|
* the other builds, such as WASM.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
TxParseString_internal(
|
||||||
|
const char *str, /* The string to be parsed. */
|
||||||
|
DQueue *q,
|
||||||
|
TxInputEvent *event)
|
||||||
|
{
|
||||||
|
TxParseString(str);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* !MAGIC_WRAPPER */
|
#endif /* !MAGIC_WRAPPER */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1149,7 +1198,7 @@ txGetInteractiveCommand(
|
||||||
(void) TxGetLinePrompt(inputLine, TX_MAX_CMDLEN, TX_CMD_PROMPT);
|
(void) TxGetLinePrompt(inputLine, TX_MAX_CMDLEN, TX_CMD_PROMPT);
|
||||||
if (inputLine[0] != '\0') MacroDefine(DBWclientID, (int)'.',
|
if (inputLine[0] != '\0') MacroDefine(DBWclientID, (int)'.',
|
||||||
inputLine, NULL, FALSE);
|
inputLine, NULL, FALSE);
|
||||||
TxParseString(inputLine, queue, (TxInputEvent* ) NULL);
|
TxParseString_internal(inputLine, queue, (TxInputEvent* ) NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1182,11 +1231,11 @@ txGetInteractiveCommand(
|
||||||
TX_MAX_CMDLEN, TX_CMD_PROMPT, macroDef);
|
TX_MAX_CMDLEN, TX_CMD_PROMPT, macroDef);
|
||||||
if (inputLine[0] != '\0') MacroDefine(DBWclientID, (int)'.',
|
if (inputLine[0] != '\0') MacroDefine(DBWclientID, (int)'.',
|
||||||
inputLine, NULL, FALSE);
|
inputLine, NULL, FALSE);
|
||||||
TxParseString(inputLine, queue, (TxInputEvent *) NULL);
|
TxParseString_internal(inputLine, queue, (TxInputEvent *) NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TxParseString(macroDef, queue, (TxInputEvent *) NULL);
|
TxParseString_internal(macroDef, queue, (TxInputEvent *) NULL);
|
||||||
}
|
}
|
||||||
freeMagic(macroDef);
|
freeMagic(macroDef);
|
||||||
}
|
}
|
||||||
|
|
@ -1291,7 +1340,7 @@ txGetFileCommand(
|
||||||
if ((inputLine[0] == ':') || (inputLine[1] == ';')) linep++;
|
if ((inputLine[0] == ':') || (inputLine[1] == ';')) linep++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TxParseString(linep, queue, (TxInputEvent *) NULL);
|
TxParseString_internal(linep, queue, (TxInputEvent *) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ extern void TxReleaseButton(int but);
|
||||||
extern void TxPrintCommand(TxCommand *cmd);
|
extern void TxPrintCommand(TxCommand *cmd);
|
||||||
extern TxCommand *TxNewCommand(void);
|
extern TxCommand *TxNewCommand(void);
|
||||||
extern void TxFreeCommand(TxCommand *command);
|
extern void TxFreeCommand(TxCommand *command);
|
||||||
extern void TxParseString(const char *str, void *q, void *event);
|
extern void TxParseString(const char *str);
|
||||||
extern void TxDispatch(FILE *f);
|
extern void TxDispatch(FILE *f);
|
||||||
extern void TxRebuildCommand(TxCommand *cmd);
|
extern void TxRebuildCommand(TxCommand *cmd);
|
||||||
extern int TxCommandNumber; /* Serial number of current command. */
|
extern int TxCommandNumber; /* Serial number of current command. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue