From 15b66c7db1b93e492699790d760e3e8325579b8c Mon Sep 17 00:00:00 2001 From: Bob Uhl Date: Thu, 27 Jul 2017 14:12:07 -0600 Subject: [PATCH] Implement Tcl_CommandComplete for Go --- interpreter.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/interpreter.go b/interpreter.go index b78503f..4e50fc8 100644 --- a/interpreter.go +++ b/interpreter.go @@ -31,6 +31,16 @@ const ( // Utils //------------------------------------------------------------------------------ +// IsComplete returns true if s is a complete TCL command. +func IsComplete(s string) bool { + cs := C.CString(s) + defer C.free(unsafe.Pointer(cs)) + if C.Tcl_CommandComplete(cs) != 0 { + return true + } + return false +} + // A handle that is used to manipulate a TCL interpreter. All handle methods // can be safely invoked from different threads. Each method invocation is // synchronous, it means that the method will be blocked until the action is