summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-03-04 23:25:09 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-03-04 23:25:09 (GMT)
commit9472fc9496ffa1b561e42b87aba86e26c96e993f (patch)
tree911406bda69a0e5544ae4bb757d2b323e1b6a78e
parent624b5ff0c09f22eee5e4fc6f7507b0fe5a4cdef2 (diff)
downloadtcl-9472fc9496ffa1b561e42b87aba86e26c96e993f.zip
tcl-9472fc9496ffa1b561e42b87aba86e26c96e993f.tar.gz
tcl-9472fc9496ffa1b561e42b87aba86e26c96e993f.tar.bz2
* generic/tclInt.h (TclParseInit): Factored the common code
* generic/tclParse.c (TclParseInit): for initializing a Tcl_Parse * generic/tclParseExpr.c: struct into one routine.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclInt.h5
-rw-r--r--generic/tclParse.c27
-rw-r--r--generic/tclParseExpr.c16
4 files changed, 21 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 6df04f8..abb88f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,8 +5,9 @@
2004-03-04 Don Porter <dgp@users.sourceforge.net>
- * generic/tclParse.c (InitParse): Factored the common code
- for initializing a Tcl_Parse struct into one routine.
+ * generic/tclInt.h (TclParseInit): Factored the common code
+ * generic/tclParse.c (TclParseInit): for initializing a Tcl_Parse
+ * generic/tclParseExpr.c: struct into one routine.
2004-03-04 Pat Thoyts <patthoyts@users.sourceforge.net>
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 27dbc89..1e66abc 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.144 2004/02/24 22:58:46 dkf Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.145 2004/03/04 23:25:10 dgp Exp $
*/
#ifndef _TCLINT
@@ -1733,6 +1733,9 @@ EXTERN int TclParseBackslash _ANSI_ARGS_((CONST char *src,
int numBytes, int *readPtr, char *dst));
EXTERN int TclParseHex _ANSI_ARGS_((CONST char *src, int numBytes,
Tcl_UniChar *resultPtr));
+EXTERN void TclParseInit _ANSI_ARGS_ ((Tcl_Interp *interp,
+ CONST char *string, int numBytes,
+ Tcl_Parse *parsePtr));
EXTERN int TclParseInteger _ANSI_ARGS_((CONST char *string,
int numBytes));
EXTERN int TclParseWhiteSpace _ANSI_ARGS_((CONST char *src,
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 7c21fe6..de95afe 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclParse.c,v 1.33 2004/03/04 22:39:30 dgp Exp $
+ * RCS: @(#) $Id: tclParse.c,v 1.34 2004/03/04 23:25:14 dgp Exp $
*/
#include "tclInt.h"
@@ -176,9 +176,6 @@ static CONST char charTypeTable[] = {
static int CommandComplete _ANSI_ARGS_((CONST char *script,
int numBytes));
-void InitParse _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *string, int numBytes,
- Tcl_Parse *parsePtr));
static int ParseComment _ANSI_ARGS_((CONST char *src, int numBytes,
Tcl_Parse *parsePtr));
static int ParseTokens _ANSI_ARGS_((CONST char *src, int numBytes,
@@ -187,7 +184,7 @@ static int ParseTokens _ANSI_ARGS_((CONST char *src, int numBytes,
/*
*----------------------------------------------------------------------
*
- * InitParse --
+ * TclParseInit --
*
* Initialize the fields of a Tcl_Parse struct.
*
@@ -201,7 +198,7 @@ static int ParseTokens _ANSI_ARGS_((CONST char *src, int numBytes,
*/
void
-InitParse(interp, string, numBytes, parsePtr)
+TclParseInit(interp, string, numBytes, parsePtr)
Tcl_Interp *interp; /* Interpreter to use for error reporting */
CONST char *string; /* String to be parsed. */
int numBytes; /* Total number of bytes in string. If < 0,
@@ -209,6 +206,10 @@ InitParse(interp, string, numBytes, parsePtr)
* the first null character. */
Tcl_Parse *parsePtr; /* Points to struct to initialize */
{
+ parsePtr->commentStart = NULL;
+ parsePtr->commentSize = 0;
+ parsePtr->commandStart = NULL;
+ parsePtr->commandSize = 0;
parsePtr->numWords = 0;
parsePtr->tokenPtr = parsePtr->staticTokens;
parsePtr->numTokens = 0;
@@ -286,11 +287,7 @@ Tcl_ParseCommand(interp, string, numBytes, nested, parsePtr)
if (numBytes < 0) {
numBytes = strlen(string);
}
- InitParse(interp, string, numBytes, parsePtr);
- parsePtr->commentStart = NULL;
- parsePtr->commentSize = 0;
- parsePtr->commandStart = NULL;
- parsePtr->commandSize = 0;
+ TclParseInit(interp, string, numBytes, parsePtr);
if (nested != 0) {
terminators = TYPE_COMMAND_END | TYPE_CLOSE_BRACK;
} else {
@@ -1185,7 +1182,7 @@ Tcl_ParseVarName(interp, string, numBytes, parsePtr, append)
}
if (!append) {
- InitParse(interp, string, numBytes, parsePtr);
+ TclParseInit(interp, string, numBytes, parsePtr);
}
/*
@@ -1476,7 +1473,7 @@ Tcl_ParseBraces(interp, string, numBytes, parsePtr, append, termPtr)
}
if (!append) {
- InitParse(interp, string, numBytes, parsePtr);
+ TclParseInit(interp, string, numBytes, parsePtr);
}
src = string;
@@ -1675,7 +1672,7 @@ Tcl_ParseQuotedString(interp, string, numBytes, parsePtr, append, termPtr)
}
if (!append) {
- InitParse(interp, string, numBytes, parsePtr);
+ TclParseInit(interp, string, numBytes, parsePtr);
}
if (TCL_OK != ParseTokens(string+1, numBytes-1, TYPE_QUOTE,
@@ -1733,7 +1730,7 @@ Tcl_SubstObj(interp, objPtr, flags)
Tcl_Obj *errMsg = NULL;
CONST char *p = Tcl_GetStringFromObj(objPtr, &length);
- InitParse(interp, p, length, &parse);
+ TclParseInit(interp, p, length, &parse);
/*
* First parse the string rep of objPtr, as if it were enclosed
diff --git a/generic/tclParseExpr.c b/generic/tclParseExpr.c
index 84094f4..3a0574e 100644
--- a/generic/tclParseExpr.c
+++ b/generic/tclParseExpr.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclParseExpr.c,v 1.19 2003/10/14 15:44:53 dgp Exp $
+ * RCS: @(#) $Id: tclParseExpr.c,v 1.20 2004/03/04 23:25:15 dgp Exp $
*/
#include "tclInt.h"
@@ -245,19 +245,7 @@ Tcl_ParseExpr(interp, string, numBytes, parsePtr)
}
#endif /* TCL_COMPILE_DEBUG */
- parsePtr->commentStart = NULL;
- parsePtr->commentSize = 0;
- parsePtr->commandStart = NULL;
- parsePtr->commandSize = 0;
- parsePtr->numWords = 0;
- parsePtr->tokenPtr = parsePtr->staticTokens;
- parsePtr->numTokens = 0;
- parsePtr->tokensAvailable = NUM_STATIC_TOKENS;
- parsePtr->string = string;
- parsePtr->end = (string + numBytes);
- parsePtr->interp = interp;
- parsePtr->term = string;
- parsePtr->incomplete = 0;
+ TclParseInit(interp, string, numBytes, parsePtr);
/*
* Initialize the ParseInfo structure that holds state while parsing