version0.7.10

This commit is contained in:
Andreas Rumpf 2009-06-08 08:13:09 +02:00
commit 36818817bd
14 changed files with 1011 additions and 0 deletions

25
examples/tclex.nim Normal file
View file

@ -0,0 +1,25 @@
# Example to embed TCL in Nimrod
import tcl, os
const
myScript = """puts "Hello, World - In quotes" """
myScript2 = """
package require Tk
pack [entry .e -textvar e -width 50]
bind .e <Return> {
set e [regsub { *=.*} $e ""] ;# remove evaluation (Chris)
catch {expr [string map {/ *1./} $e]} res
append e " = $res"
}
"""
Tcl_FindExecutable(getApplicationFilename())
var interp = Tcl_CreateInterp()
if interp == nil: quit("cannot create TCL interpreter")
if Tcl_Init(interp) != TCL_OK:
quit("cannot init interpreter")
if Tcl_Eval(interp, myScript) != TCL_OK:
quit("cannot execute script.tcl")