diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2014-01-13 08:06:43 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2014-01-13 08:06:43 (GMT) |
commit | aa2c40934df3fdefbb39338f7eef44e79c3c551e (patch) | |
tree | b9160847863784dfe55e508ea2eab9da956df310 /generic/tclExecute.c | |
parent | c3c6e803684022dcc788ddbfc4a59a6d0dfde102 (diff) | |
download | tcl-aa2c40934df3fdefbb39338f7eef44e79c3c551e.zip tcl-aa2c40934df3fdefbb39338f7eef44e79c3c551e.tar.gz tcl-aa2c40934df3fdefbb39338f7eef44e79c3c551e.tar.bz2 |
extend [string is] to booleans
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 2707ec1..989b7b6 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -6461,6 +6461,17 @@ TEBCresume( * ----------------------------------------------------------------- */ + case INST_TRY_CVT_TO_BOOLEAN: + valuePtr = OBJ_AT_TOS; + if (valuePtr->typePtr == &tclBooleanType) { + objResultPtr = TCONST(1); + } else { + int result = (TclSetBooleanFromAny(NULL, valuePtr) == TCL_OK); + objResultPtr = TCONST(result); + } + TRACE_WITH_OBJ(("\"%.30s\" => ", O2S(valuePtr)), objResultPtr); + NEXT_INST_F(1, 0, 1); + case INST_BREAK: /* DECACHE_STACK_INFO(); |