Aamer Akhter schrieb:
Critcl allows us to easily create tcl callable C procs. Is there something similar avaliable for xotcl?
Is there any C api documentation?
There is as well a simpler way, defining e.g. a cinstproc similar to the cproc:
=============================================================== lappend auto_path . package require critcl
Class instproc cinstproc {name arglist returntype body} { critcl::cproc $name $arglist $returntype $body catch {$name} ;# there must be a better way forcing the compile! rename $name ::xotcl::classes[self]::$name } ===============================================================
now one can define a Class and a cinstproc and use it.
=============================================================== Class C C cinstproc triple {int i} int { return i * 3; /* this is C code */ }
C c1 puts "three times 123 is [c1 triple 123]" ===============================================================
this might be already sufficient for you. Two things should be done more beautiful:
a) the compilation in criticl seems to be forced through unknown. my approach with the catch is rather crude. but i am sure, there must be an option.
b) It would be nice to generate the command in the right namespace. i found as well no nice approach to do this.
Aamer, if you have some experience here, feedback would be welcome,
-gustaf
-- Aamer Akhter / aakhter@gmail.com
Xotcl mailing list Xotcl@alice.wu-wien.ac.at http://alice.wu-wien.ac.at/mailman/listinfo/xotcl