cd dynclasses && make
you get runtime/parrot/dynext/tclgroup.so (or something like it.) (If you don't, there's a bug, and please report it
to the perl6 internals list. )
Now, at the top level parrot directory, you can create foo.imc containing:
.sub main
loadlib $P0, "tclgroup" # Load combined tcl lib
$I0 = find_type "TclInt" # Find ID for a TclInt *
$P0 = new $I0 # Instantiate
$P0 = "asdf" # Assign
print $P0
print "\n"
$S0 = typeof $P0 # Get the type description.
print $S0
print "\n"
end
.end
This snippet prints out
asdf
TclString
Note that the type of the PMC has
shimmered (morphed, if you prefer) to the appropriate data type. I need to do
more work to nail down the appropriate reactions for each kind of shimmer for
Tcl.
Next steps:
puts '[string range [list 1 2 3] 0 2]'
Actually generates
'1 2'
which will have been shimmered from a TclList (returned by [list]) to a TclString
[*] - these steps are, of course, unnecessary with built in types. They're
necessary here because when parrot started, we didn't know anything about Tcl.
We have to load the pmcs, and then, because the pmc types were created at
runtime, we have to use a runtime check to get our class ID. (As opposed to
the builtin type String, which you can, thanks to runtime/parrot/include/pmctypes.pasm, just create with $P0 = new String)
ParTcl: Dynamic Tcl PMCs 0 Comments More | Login | Reply /