Artifact
befaf80706a16f52f2f4a552e2764601dcaa415d:
- File
test/th1-tcl1.txt
— part of check-in
[53b9445b2c]
at
2011-08-28 23:45:18
on branch tcl-integration
— Use macros to tidy up TH1 to Tcl argument marshalling. Use the Tcl interp result when Tcl_ExprObj does not return ok. Check for Tcl interp deletion. The TH1 'puts' command should flush when writing to stdout. Add 'repository' TH1 command. Use obj API to get Tcl cmdInfo. Add tests for Tcl integration.
(user:
mistachkin
size: 870)
[more...]
0000: 3c 74 68 31 3e 0a 20 20 23 0a 20 20 23 20 54 68 <th1>. #. # Th
0010: 69 73 20 69 73 20 61 20 22 54 48 31 20 66 72 61 is is a "TH1 fra
0020: 67 6d 65 6e 74 22 20 75 73 65 64 20 74 6f 20 74 gment" used to t
0030: 65 73 74 20 74 68 65 20 54 63 6c 20 69 6e 74 65 est the Tcl inte
0040: 67 72 61 74 69 6f 6e 20 66 65 61 74 75 72 65 73 gration features
0050: 20 6f 66 20 54 48 31 2e 0a 20 20 23 20 54 68 65 of TH1.. # The
0060: 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 corresponding t
0070: 65 73 74 20 66 69 6c 65 20 65 78 65 63 75 74 65 est file execute
0080: 73 20 74 68 69 73 20 66 69 6c 65 20 75 73 69 6e s this file usin
0090: 67 20 74 68 65 20 74 65 73 74 2d 74 68 2d 72 65 g the test-th-re
00a0: 6e 64 65 72 0a 20 20 23 20 46 6f 73 73 69 6c 20 nder. # Fossil
00b0: 63 6f 6d 6d 61 6e 64 2e 0a 20 20 23 0a 20 20 73 command.. #. s
00c0: 65 74 20 63 68 61 6e 6e 65 6c 20 73 74 64 6f 75 et channel stdou
00d0: 74 3b 20 74 63 6c 49 6e 76 6f 6b 65 20 73 65 74 t; tclInvoke set
00e0: 20 63 68 61 6e 6e 65 6c 20 24 63 68 61 6e 6e 65 channel $channe
00f0: 6c 0a 20 20 70 72 6f 63 20 64 6f 4f 75 74 20 7b l. proc doOut {
0100: 6d 73 67 7d 20 7b 70 75 74 73 20 24 6d 73 67 3b msg} {puts $msg;
0110: 20 70 75 74 73 20 5c 6e 7d 0a 20 20 64 6f 4f 75 puts \n}. doOu
0120: 74 20 5b 74 63 6c 45 76 61 6c 20 63 6c 6f 63 6b t [tclEval clock
0130: 20 73 65 63 6f 6e 64 73 5d 0a 20 20 64 6f 4f 75 seconds]. doOu
0140: 74 20 5b 74 63 6c 45 76 61 6c 20 7b 73 65 74 20 t [tclEval {set
0150: 78 20 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 x [clock seconds
0160: 5d 7d 5d 0a 20 20 74 63 6c 45 76 61 6c 20 7b 70 ]}]. tclEval {p
0170: 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 5b 63 uts $channel "[c
0180: 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d 22 7d 0a lock seconds]"}.
0190: 20 20 74 63 6c 49 6e 76 6f 6b 65 20 70 75 74 73 tclInvoke puts
01a0: 20 24 63 68 61 6e 6e 65 6c 20 22 76 69 61 20 54 $channel "via T
01b0: 63 6c 20 69 6e 76 6f 6b 65 22 0a 20 20 64 6f 4f cl invoke". doO
01c0: 75 74 20 5b 74 63 6c 45 78 70 72 20 32 2b 32 5d ut [tclExpr 2+2]
01d0: 0a 20 20 64 6f 4f 75 74 20 5b 74 63 6c 45 78 70 . doOut [tclExp
01e0: 72 20 32 20 2b 20 32 5d 0a 20 20 64 6f 4f 75 74 r 2 + 2]. doOut
01f0: 20 5b 74 63 6c 49 6e 76 6f 6b 65 20 73 65 74 20 [tclInvoke set
0200: 78 20 22 74 77 6f 20 77 6f 72 64 73 22 5d 0a 20 x "two words"].
0210: 20 64 6f 4f 75 74 20 5b 74 63 6c 49 6e 76 6f 6b doOut [tclInvok
0220: 65 20 65 76 61 6c 20 73 65 74 20 79 20 6f 6e 65 e eval set y one
0230: 5f 77 6f 72 64 5d 0a 20 20 64 6f 4f 75 74 20 5b _word]. doOut [
0240: 74 63 6c 49 6e 76 6f 6b 65 20 65 76 61 6c 20 7b tclInvoke eval {
0250: 73 65 74 20 7a 20 22 74 68 72 65 65 20 77 6f 72 set z "three wor
0260: 64 73 20 6e 6f 77 22 7d 5d 0a 20 20 64 6f 4f 75 ds now"}]. doOu
0270: 74 20 5b 73 65 74 20 78 20 5b 74 63 6c 45 76 61 t [set x [tclEva
0280: 6c 20 7b 73 65 74 20 78 20 5b 63 6c 6f 63 6b 20 l {set x [clock
0290: 73 65 63 6f 6e 64 73 5d 7d 5d 5d 0a 20 20 64 6f seconds]}]]. do
02a0: 4f 75 74 20 5b 74 63 6c 49 6e 76 6f 6b 65 20 74 Out [tclInvoke t
02b0: 68 31 45 76 61 6c 20 7b 73 65 74 20 79 20 22 74 h1Eval {set y "t
02c0: 77 6f 20 77 6f 72 64 73 22 7d 5d 0a 20 20 64 6f wo words"}]. do
02d0: 4f 75 74 20 5b 73 65 74 20 7a 20 5b 74 63 6c 49 Out [set z [tclI
02e0: 6e 76 6f 6b 65 20 74 68 31 45 78 70 72 20 7b 32 nvoke th1Expr {2
02f0: 2b 32 7d 5d 5d 0a 20 20 64 6f 4f 75 74 20 24 78 +2}]]. doOut $x
0300: 0a 20 20 64 6f 4f 75 74 20 24 79 0a 20 20 64 6f . doOut $y. do
0310: 4f 75 74 20 24 7a 0a 20 20 64 6f 4f 75 74 20 5b Out $z. doOut [
0320: 74 63 6c 45 76 61 6c 20 73 65 74 20 78 5d 0a 20 tclEval set x].
0330: 20 64 6f 4f 75 74 20 5b 74 63 6c 45 76 61 6c 20 doOut [tclEval
0340: 73 65 74 20 79 5d 0a 20 20 64 6f 4f 75 74 20 5b set y]. doOut [
0350: 74 63 6c 45 76 61 6c 20 73 65 74 20 7a 5d 0a 3c tclEval set z].<
0360: 2f 74 68 31 3e 0a /th1>.