From 0e7c2a3c941ea709e13087114f8467e4b19d0777 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Sat, 23 Aug 2008 01:48:24 +0000 Subject: * generic/tclBasic.c: Set special errocodes: COROUTINE_BUSY, COROUTINE_CANT_YIELD, COROUTINE_ILLEGAL_YIELD. --- ChangeLog | 3 ++- generic/tclBasic.c | 4 +++- generic/tclExecute.c | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29ac32c..82fefe2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2008-08-22 Miguel Sofer - * generic/tclBasic.c: Set a special COROUTINE_BUSY errorcode + * generic/tclBasic.c: Set special errocodes: COROUTINE_BUSY, + COROUTINE_CANT_YIELD, COROUTINE_ILLEGAL_YIELD. 2008-08-22 Don Porter diff --git a/generic/tclBasic.c b/generic/tclBasic.c index d8ab1d0..30631a5 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -16,7 +16,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.360 2008/08/23 01:42:54 msofer Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.361 2008/08/23 01:48:25 msofer Exp $ */ #include "tclInt.h" @@ -4302,9 +4302,11 @@ NRCallTEBC( case TCL_NR_YIELD_TYPE: if (iPtr->execEnvPtr->corPtr) { Tcl_SetResult(interp, "cannot yield: C stack busy", TCL_STATIC); + Tcl_SetErrorCode(interp, "COROUTINE_CANT_YIELD", NULL); } else { Tcl_SetResult(interp, "yield can only be called in a coroutine", TCL_STATIC); + Tcl_SetErrorCode(interp, "COROUTINE_ILLEGAL_YIELD", NULL); } return TCL_ERROR; default: diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 0311da2..453be92 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.407 2008/08/20 15:02:32 dkf Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.408 2008/08/23 01:48:26 msofer Exp $ */ #include "tclInt.h" @@ -1946,6 +1946,7 @@ TclExecuteByteCode( if (!corPtr) { Tcl_SetResult(interp, "yield can only be called in a coroutine", TCL_STATIC); + Tcl_SetErrorCode(interp, "COROUTINE_ILLEGAL_YIELD", NULL); result = TCL_ERROR; goto checkForCatch; } @@ -1955,6 +1956,7 @@ TclExecuteByteCode( if (corPtr->stackLevel != &initLevel) { Tcl_SetResult(interp, "cannot yield: C stack busy", TCL_STATIC); + Tcl_SetErrorCode(interp, "COROUTINE_CANT_YIELD", NULL); result = TCL_ERROR; goto checkForCatch; } -- cgit v0.12