1 (***********************************************************************)
3 (* MLTk, Tcl/Tk interface of Objective Caml *)
5 (* Francois Rouaix, Francois Pessaux, Jun Furuse and Pierre Weis *)
6 (* projet Cristal, INRIA Rocquencourt *)
7 (* Jacques Garrigue, Kyoto University RIMS *)
9 (* Copyright 2002 Institut National de Recherche en Informatique et *)
10 (* en Automatique and Kyoto University. All rights reserved. *)
11 (* This file is distributed under the terms of the GNU Library *)
12 (* General Public License, with the special exception on linking *)
13 (* described in file LICENSE found in the Objective Caml source tree. *)
15 (***********************************************************************)
16 (* Some notion of RPC *)
20 (* A RPC is just a callback with a particular name, plus a Tcl procedure *)
22 let id = new_function_id() in
23 Hashtbl.add callback_naming_table id f;
25 Textvariable.set (Textvariable.coerce ("camltkrpc("^name^")"))
27 tkCommand [| TkToken "proc"; TkToken name; TkToken "args";
28 TkToken ("camlcb "^(string_of_cbid id)^" $args") |]
31 let invoke interp f args =
36 TkTokenList (List.map (fun s -> TkToken s) args)
39 let async_invoke interp f args =
45 TkTokenList (List.map (fun s -> TkToken s) args)