-INCLUDE 'stcl.sno'
This page describes a facility for invoking Tcl and Tk from SNOBOL4 programs, inspired by Arjen Markus' "ftcl" FORTRAN/Tcl interface
-INCLUDE 'stcl.sno'
INTERP = STCL_CREATEINTERP()
TCL_VERSION = STCL_GETVAR(INTERP, "tcl_version")
OUTPUT = IDENT(TCL_VERSION) "Could not get tcl_version" :S(END)
OUTPUT = "Tcl Version: " TCL_VERSION
# check Tcl version
NUM = SPAN('0123456789')
VPAT = NUM '.' NUM
TCL_VERSION VPAT . VER :S(CHECKV)
OUTPUT = "could not parse tcl_version" :(END)
CHECKV LT(VER, 8.4) :S(CHECKTK)
# Tcl 8.4 and later can dynamicly load Tk!
STCL_EVAL(INTERP, "package require Tk") :F(END)
# Check for Tk
CHECKTK TK_VERSION = STCL_GETVAR(INTERP, "tk_version") :F(NO_TK)
DIFFER(TK_VERSION) :S(HAVETK)
NO_TK OUTPUT = "Could not find tk_version" :(END)
HAVETK OUTPUT = "Tk version: " TK_VERSION
LOOP OUTPUT = STCL_EVAL(INTERP,
+ 'tk_messageBox -message "Alert!"'
+ ' -type ok -icon info')
VAL = STCL_EVAL(INTERP,
+ 'tk_messageBox -message "Really quit?"'
+ ' -type yesno -icon question')
OUTPUT = VAL
DIFFER(VAL, "yes") :S(LOOP)
END