diff options
author | dgp <dgp@users.sourceforge.net> | 2005-08-15 20:46:01 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-08-15 20:46:01 (GMT) |
commit | b5070492625db5c124f6d837c85433bd1d475a0d (patch) | |
tree | 91e539f3329456ced12a6db2db55f4a8aec7234e | |
parent | c4f3a7ba6542403af85f6424cb2d075057594ed0 (diff) | |
download | tcl-b5070492625db5c124f6d837c85433bd1d475a0d.zip tcl-b5070492625db5c124f6d837c85433bd1d475a0d.tar.gz tcl-b5070492625db5c124f6d837c85433bd1d475a0d.tar.bz2 |
* generic/tclInt.decls: Deleted TclLooksLikeInt() and all callers.
* generic/tclUtil.c:
* generic/tclCompCmds.c:
* generic/tclBasic.c: Rewrite of VerifyExprObjType().
* generic/tclIntDecls.h: make genstubs
* generic/tclStubInit.c:
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | generic/tclBasic.c | 21 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 16 | ||||
-rw-r--r-- | generic/tclInt.decls | 8 | ||||
-rw-r--r-- | generic/tclIntDecls.h | 18 | ||||
-rw-r--r-- | generic/tclStubInit.c | 6 | ||||
-rw-r--r-- | generic/tclUtil.c | 4 |
7 files changed, 57 insertions, 26 deletions
@@ -2,6 +2,16 @@ [kennykb_numerics_branch] Updates from HEAD. + + * generic/tclInt.decls: Deleted TclLooksLikeInt() and all callers. + * generic/tclUtil.c: + * generic/tclCompCmds.c: + + * generic/tclBasic.c: Rewrite of VerifyExprObjType(). + + * generic/tclIntDecls.h: make genstubs + * generic/tclStubInit.c: + * generic/tclExecute.c: Updated execution of comparison bytecodes to be bignum-aware, routing string compares through INST_STR_CMP. diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b22f351..105ed6b 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.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: tclBasic.c,v 1.136.2.14 2005/08/11 16:29:23 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.136.2.15 2005/08/15 20:46:02 dgp Exp $ */ #include "tclInt.h" @@ -5529,6 +5529,7 @@ VerifyExprObjType(interp, objPtr) * function. */ Tcl_Obj *objPtr; /* Points to the object to type check. */ { +#if 0 if (IS_NUMERIC_TYPE(objPtr->typePtr)) { return TCL_OK; } else { @@ -5556,6 +5557,24 @@ VerifyExprObjType(interp, objPtr) } return result; } +#else + double d; + + /* TODO: more efficient routine ? */ + if (TCL_OK == Tcl_GetDoubleFromObj(NULL, objPtr, &d)) { + return TCL_OK; + } + if (objPtr->typePtr == &tclDoubleType) { + /* NaN is acceptable value */ + return TCL_OK; + } + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "argument to math function didn't have numeric value", -1)); + TclCheckBadOctal(interp, Tcl_GetString(objPtr)); + } + return TCL_ERROR; +#endif } /* diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 324155c..e82f921 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -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: tclCompCmds.c,v 1.59.2.6 2005/08/02 18:15:17 dgp Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.59.2.7 2005/08/15 20:46:02 dgp Exp $ */ #include "tclInt.h" @@ -611,6 +611,7 @@ TclCompileDictCmd(interp, parsePtr, envPtr) word = incrTokenPtr[1].start; numBytes = incrTokenPtr[1].size; +#if 0 /* * Note there is a danger that modifying the string could have * undesirable side effects. In this case, TclLooksLikeInt has no @@ -620,6 +621,7 @@ TclCompileDictCmd(interp, parsePtr, envPtr) if (!TclLooksLikeInt(word, numBytes)) { return TCL_ERROR; } +#endif /* * Now try to really parse the number. @@ -1959,7 +1961,7 @@ TclCompileIncrCmd(interp, parsePtr, envPtr) if (incrTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { CONST char *word = incrTokenPtr[1].start; int numBytes = incrTokenPtr[1].size; - +#if 0 /* * Note there is a danger that modifying the string could have * undesirable side effects. In this case, TclLooksLikeInt has @@ -1967,6 +1969,7 @@ TclCompileIncrCmd(interp, parsePtr, envPtr) */ if (TclLooksLikeInt(word, numBytes)) { +#endif int code; Tcl_Obj *intObj = Tcl_NewStringObj(word, numBytes); Tcl_IncrRefCount(intObj); @@ -1976,7 +1979,9 @@ TclCompileIncrCmd(interp, parsePtr, envPtr) && (-127 <= immValue) && (immValue <= 127)) { haveImmValue = 1; } +#if 0 } +#endif if (!haveImmValue) { PushLiteral(envPtr, word, numBytes); } @@ -2280,8 +2285,11 @@ TclCompileLindexCmd(interp, parsePtr, envPtr) varTokenPtr = TokenAfter(parsePtr->tokenPtr); - if ((numWords == 3) && (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) && - TclLooksLikeInt(varTokenPtr[1].start, varTokenPtr[1].size)) { + if ((numWords == 3) && (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) +#if 0 + && TclLooksLikeInt(varTokenPtr[1].start, varTokenPtr[1].size) +#endif + ) { Tcl_Obj *tmpObj; int idx, result; diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 73efd0b..124fee2 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -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.decls,v 1.84.2.8 2005/08/15 18:13:59 dgp Exp $ +# RCS: @(#) $Id: tclInt.decls,v 1.84.2.9 2005/08/15 20:46:02 dgp Exp $ library tcl @@ -553,9 +553,9 @@ declare 138 generic { # char *sym2, Tcl_PackageInitProc **proc1Ptr, # Tcl_PackageInitProc **proc2Ptr, ClientData *clientDataPtr) #} -declare 140 generic { - int TclLooksLikeInt(CONST char *bytes, int length) -} +#declare 140 generic { +# int TclLooksLikeInt(CONST char *bytes, int length) +#} # This is used by TclX, but should otherwise be considered private declare 141 generic { CONST84_RETURN char *TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr) diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 551b7ac..66cbd48 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -12,9 +12,9 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * <<<<<<< tclIntDecls.h - * RCS: @(#) $Id: tclIntDecls.h,v 1.75.2.8 2005/08/15 18:13:59 dgp Exp $ + * RCS: @(#) $Id: tclIntDecls.h,v 1.75.2.9 2005/08/15 20:46:02 dgp Exp $ ======= - * RCS: @(#) $Id: tclIntDecls.h,v 1.75.2.8 2005/08/15 18:13:59 dgp Exp $ + * RCS: @(#) $Id: tclIntDecls.h,v 1.75.2.9 2005/08/15 20:46:02 dgp Exp $ >>>>>>> 1.83 */ @@ -688,12 +688,7 @@ EXTERN CONST84_RETURN char * TclGetEnv _ANSI_ARGS_((CONST char * name, Tcl_DString * valuePtr)); #endif /* Slot 139 is reserved */ -#ifndef TclLooksLikeInt_TCL_DECLARED -#define TclLooksLikeInt_TCL_DECLARED -/* 140 */ -EXTERN int TclLooksLikeInt _ANSI_ARGS_((CONST char * bytes, - int length)); -#endif +/* Slot 140 is reserved */ #ifndef TclpGetCwd_TCL_DECLARED #define TclpGetCwd_TCL_DECLARED /* 141 */ @@ -1267,7 +1262,7 @@ typedef struct TclIntStubs { void *reserved137; CONST84_RETURN char * (*tclGetEnv) _ANSI_ARGS_((CONST char * name, Tcl_DString * valuePtr)); /* 138 */ void *reserved139; - int (*tclLooksLikeInt) _ANSI_ARGS_((CONST char * bytes, int length)); /* 140 */ + void *reserved140; CONST84_RETURN char * (*tclpGetCwd) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); /* 141 */ int (*tclSetByteCodeFromAny) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CompileHookProc * hookProc, ClientData clientData)); /* 142 */ int (*tclAddLiteralObj) _ANSI_ARGS_((struct CompileEnv * envPtr, Tcl_Obj * objPtr, LiteralEntry ** litPtrPtr)); /* 143 */ @@ -1806,10 +1801,7 @@ extern TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclGetEnv) /* 138 */ #endif /* Slot 139 is reserved */ -#ifndef TclLooksLikeInt -#define TclLooksLikeInt \ - (tclIntStubsPtr->tclLooksLikeInt) /* 140 */ -#endif +/* Slot 140 is reserved */ #ifndef TclpGetCwd #define TclpGetCwd \ (tclIntStubsPtr->tclpGetCwd) /* 141 */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 9583d3f..c97c856 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -9,9 +9,9 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * <<<<<<< tclStubInit.c - * RCS: @(#) $Id: tclStubInit.c,v 1.109.2.11 2005/08/15 18:13:59 dgp Exp $ + * RCS: @(#) $Id: tclStubInit.c,v 1.109.2.12 2005/08/15 20:46:02 dgp Exp $ ======= - * RCS: @(#) $Id: tclStubInit.c,v 1.109.2.11 2005/08/15 18:13:59 dgp Exp $ + * RCS: @(#) $Id: tclStubInit.c,v 1.109.2.12 2005/08/15 20:46:02 dgp Exp $ >>>>>>> 1.121 */ @@ -228,7 +228,7 @@ TclIntStubs tclIntStubs = { NULL, /* 137 */ TclGetEnv, /* 138 */ NULL, /* 139 */ - TclLooksLikeInt, /* 140 */ + NULL, /* 140 */ TclpGetCwd, /* 141 */ TclSetByteCodeFromAny, /* 142 */ TclAddLiteralObj, /* 143 */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index ebd5a87..8b1a532 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.51.2.15 2005/08/02 18:16:11 dgp Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.51.2.16 2005/08/15 20:46:02 dgp Exp $ */ #include "tclInt.h" @@ -2170,6 +2170,7 @@ TclNeedSpace(start, end) } return 1; } +#if 0 /* *---------------------------------------------------------------------- @@ -2223,6 +2224,7 @@ TclLooksLikeInt(bytes, length) return (0 != TclParseInteger(p, length)); } +#endif /* *---------------------------------------------------------------------- |