From 3c1d5b89c33546028fce534546b8e356369ee231 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 9 Jul 1998 08:40:46 +0000 Subject: 1.1b9_30 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tcltklib/tcltklib.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'ext/tcltklib/tcltklib.c') diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index ada4c7a96e..df242997e8 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -26,6 +26,10 @@ fprintf(stderr, ARG1, ARG2); fprintf(stderr, "\n"); } #define DUMP2(ARG1, ARG2) */ +/* for callback break & continue */ +VALUE eTkCallbackBreak; +VALUE eTkCallbackContinue; + /* from tkAppInit.c */ /* @@ -136,8 +140,15 @@ ip_ruby(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) Tcl_ResetResult(interp); if (failed) { + VALUE eclass = CLASS_OF(failed); Tcl_AppendResult(interp, STR2CSTR(failed), (char*)NULL); - return TCL_ERROR; + if (eclass == eTkCallbackBreak) { + return TCL_BREAK; + } else if (eclass == eTkCallbackContinue) { + return TCL_CONTINUE; + } else { + return TCL_ERROR; + } } /* result must be string or nil */ @@ -338,6 +349,9 @@ void Init_tcltklib() VALUE lib = rb_define_module("TclTkLib"); VALUE ip = rb_define_class("TclTkIp", cObject); + eTkCallbackBreak = rb_define_class("TkCallbackBreak", eStandardError); + eTkCallbackContinue = rb_define_class("TkCallbackContinue",eStandardError); + rb_define_module_function(lib, "mainloop", lib_mainloop, 0); rb_define_singleton_method(ip, "new", ip_new, 0); -- cgit v1.2.3