[tcljava-user] Advice Porting Tcl C API Tcl_CreateObjCommand to TclJava tcl.lang.Interp#createComma
Brought to you by:
mdejong
From: Brian B. (US) <Bri...@da...> - 2016-04-29 16:13:03
|
We're porting a TCL-based C app to Java using TclJava (technically, jtcl). We have a lot of TCL commands written in C which utilize the ClientData passed to Tcl_CreateObjCommand https://www.tcl.tk/man/tcl/TclLib/CrtObjCmd.htm. TclJava lacks command ClientData support. So I'm trying to come up with an alternative that works with TclJava tcl.lang.Interp#createCommand http://tcljava.sourceforge.net/docs/TclJavaLib/createCmd.htm. A couple of Intra-Process-Communication approaches I've considering: 1. Use AssocData http://tcljava.sourceforge.net/docs/TclJavaLib/AssocData.htm. 2. Use a Java class static member (guarded for thread-safety) e.g. Package org.myorg.myprod; public class GlobalData { public static Map<String,Object> clientData = new HashMap<>(); } We have hundreds of TCL scripts which already use these commands, so altering the scripts to pass the "ClientData" as command arguments isn't really an option. Has anyone already successfully solved this problem? Are there examples of how to do this already? Any advice? Sincerely, Brian Brooks Sr Software Engineer Duluth, GA 30096 This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains information that is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. |