Juggle Home - Bits'n'Pieces - Feature Hitlist - Problem Reports - Mailing lists - The J Repository - References +-------------------+ | 9!:12'' | |5 | +-------------------+

Calling TCL from J

The following session log is from a Sparc running Solaris 2.5.1.
J 4.02  Copyright (c) 1990-1998, Iverson Software Inc.  All rights reserved.

   ]r=. 'libtcl8.0.so _Tcl_CreateInterp *' 15!:0 ''
+-------+
|1930216|
+-------+
   interp=.{.r

   ]r=. 'libtcl8.0.so _Tcl_Eval i * *c' 15!:0 interp;'expr 17 + 4'
+-+---------+-----------+
|0|+-------+|expr 17 + 4|
| ||1930216||           |
| |+-------+|           |
+-+---------+-----------+
   NB. The leading 0 above is a TCL_OK code.
   NB. A look at your tcl.h reveals what is necessary to
   NB. access interp->result.  It translates to:
   ]resultaddr =. (memr=.15!:1) (>interp), 0, 1, 4
1930496
   memr resultaddr, 0, _1
21
   NB. This '21' is the result from "expr 17 + 4".

   NB. When you are done with everything:
   ]r=.  'libtcl8.0.so _Tcl_DeleteInterp n *'  15!:0  <interp
+-+---------+
|0|+-------+|
| ||1930216||
| |+-------+|
+-+---------+
   15!:5 ''
   2!:55 ] 0

+-------------------+ | 9!:12'' | |5 | +-------------------+ Juggle Home - Bits'n'Pieces - Feature Hitlist - Problem Reports - Mailing lists - The J Repository - References