diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2001-09-02 13:42:19 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2001-09-02 13:42:19 +0000 |
commit | fe2e11a8fb4dcf166ffb7f91e6eb8dd0f4402f25 (patch) | |
tree | 8dff8da7bfc88f25c78afe5340d78daa8c89587c /otherlibs/labltk/support | |
parent | 7e053c39de8693928b83038c1727f5d90228c39d (diff) | |
download | ocaml-strict_labels.tar.gz |
remove doublonsstrict_labels
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/strict_labels@3687 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/labltk/support')
-rw-r--r-- | otherlibs/labltk/support/.depend | 20 | ||||
-rw-r--r-- | otherlibs/labltk/support/fileevent.ml | 9 | ||||
-rw-r--r-- | otherlibs/labltk/support/protocol.ml | 7 | ||||
-rw-r--r-- | otherlibs/labltk/support/support.ml | 4 | ||||
-rw-r--r-- | otherlibs/labltk/support/support.mli | 2 | ||||
-rw-r--r-- | otherlibs/labltk/support/textvariable.ml | 7 | ||||
-rw-r--r-- | otherlibs/labltk/support/timer.ml | 3 | ||||
-rw-r--r-- | otherlibs/labltk/support/widget.ml | 7 |
8 files changed, 35 insertions, 24 deletions
diff --git a/otherlibs/labltk/support/.depend b/otherlibs/labltk/support/.depend index 8c7b959bf6..c10b37a920 100644 --- a/otherlibs/labltk/support/.depend +++ b/otherlibs/labltk/support/.depend @@ -1,16 +1,16 @@ protocol.cmi: widget.cmi textvariable.cmi: protocol.cmi widget.cmi -fileevent.cmo: protocol.cmi fileevent.cmi -fileevent.cmx: protocol.cmx fileevent.cmi -protocol.cmo: widget.cmi protocol.cmi -protocol.cmx: widget.cmx protocol.cmi +fileevent.cmo: protocol.cmi support.cmi fileevent.cmi +fileevent.cmx: protocol.cmx support.cmx fileevent.cmi +protocol.cmo: support.cmi widget.cmi protocol.cmi +protocol.cmx: support.cmx widget.cmx protocol.cmi slave.cmo: widget.cmi slave.cmx: widget.cmx support.cmo: support.cmi support.cmx: support.cmi -textvariable.cmo: protocol.cmi widget.cmi textvariable.cmi -textvariable.cmx: protocol.cmx widget.cmx textvariable.cmi -timer.cmo: protocol.cmi timer.cmi -timer.cmx: protocol.cmx timer.cmi -widget.cmo: widget.cmi -widget.cmx: widget.cmi +textvariable.cmo: protocol.cmi support.cmi widget.cmi textvariable.cmi +textvariable.cmx: protocol.cmx support.cmx widget.cmx textvariable.cmi +timer.cmo: protocol.cmi support.cmi timer.cmi +timer.cmx: protocol.cmx support.cmx timer.cmi +widget.cmo: support.cmi widget.cmi +widget.cmx: support.cmx widget.cmi diff --git a/otherlibs/labltk/support/fileevent.ml b/otherlibs/labltk/support/fileevent.ml index f6d6e76aad..1e907c7684 100644 --- a/otherlibs/labltk/support/fileevent.ml +++ b/otherlibs/labltk/support/fileevent.ml @@ -16,6 +16,7 @@ (* $Id$ *) open Unix +open Support open Protocol external add_file_input : file_descr -> cbid -> unit @@ -33,8 +34,8 @@ let fd_table = Hashtbl.create 37 (* Avoid space leak in callback table *) let add_fileinput ~fd ~callback:f = let id = new_function_id () in - Hashtbl.add' callback_naming_table ~key:id ~data:(fun _ -> f()); - Hashtbl.add' fd_table ~key:(fd, 'r') ~data:id; + Hashtbl'.add callback_naming_table ~key:id ~data:(fun _ -> f()); + Hashtbl'.add fd_table ~key:(fd, 'r') ~data:id; if !Protocol.debug then begin Protocol.prerr_cbid id; prerr_endline " for fileinput" end; @@ -56,8 +57,8 @@ let remove_fileinput ~fd = let add_fileoutput ~fd ~callback:f = let id = new_function_id () in - Hashtbl.add' callback_naming_table ~key:id ~data:(fun _ -> f()); - Hashtbl.add' fd_table ~key:(fd, 'w') ~data:id; + Hashtbl'.add callback_naming_table ~key:id ~data:(fun _ -> f()); + Hashtbl'.add fd_table ~key:(fd, 'w') ~data:id; if !Protocol.debug then begin Protocol.prerr_cbid id; prerr_endline " for fileoutput" end; diff --git a/otherlibs/labltk/support/protocol.ml b/otherlibs/labltk/support/protocol.ml index 68e2eb993a..7ad8b317e6 100644 --- a/otherlibs/labltk/support/protocol.ml +++ b/otherlibs/labltk/support/protocol.ml @@ -16,6 +16,7 @@ (* $Id$ *) open StdLabels +open Support open Widget type callback_buffer = string list @@ -108,9 +109,9 @@ let string_of_cbid = string_of_int (* The callback should be cleared when w is destroyed *) let register_callback w ~callback:f = let id = new_function_id () in - Hashtbl.add' callback_naming_table ~key:id ~data:f; + Hashtbl'.add callback_naming_table ~key:id ~data:f; if (forget_type w) <> (forget_type Widget.dummy) then - Hashtbl.add' callback_memo_table ~key:(forget_type w) ~data:id; + Hashtbl'.add callback_memo_table ~key:(forget_type w) ~data:id; (string_of_cbid id) let clear_callback id = @@ -144,7 +145,7 @@ let install_cleanup () = List.iter ~f:(fun f -> f w) !destroy_hooks | _ -> raise (TkError "bad cleanup callback") in let fid = new_function_id () in - Hashtbl.add' callback_naming_table ~key:fid ~data:call_destroy_hooks; + Hashtbl'.add callback_naming_table ~key:fid ~data:call_destroy_hooks; (* setup general destroy callback *) tcl_command ("bind all <Destroy> {camlcb " ^ (string_of_cbid fid) ^" %W}") diff --git a/otherlibs/labltk/support/support.ml b/otherlibs/labltk/support/support.ml index ded07ee995..b6cd5e8c32 100644 --- a/otherlibs/labltk/support/support.ml +++ b/otherlibs/labltk/support/support.ml @@ -47,3 +47,7 @@ let maycons f x l = match x with Some x -> f x :: l | None -> l + +(* Get some labels on Hashtbl.add *) +module Hashtbl' = + struct let add tbl ~key ~data = Hashtbl.add tbl key data end diff --git a/otherlibs/labltk/support/support.mli b/otherlibs/labltk/support/support.mli index 78007e4eff..2eaf9b5e52 100644 --- a/otherlibs/labltk/support/support.mli +++ b/otherlibs/labltk/support/support.mli @@ -18,3 +18,5 @@ val split_str : pred:(char -> bool) -> string -> string list val may : ('a -> 'b) -> 'a option -> 'b option val maycons : ('a -> 'b) -> 'a option -> 'b list -> 'b list +module Hashtbl' : + sig val add : ('a, 'b) Hashtbl.t -> key:'a -> data:'b -> unit end diff --git a/otherlibs/labltk/support/textvariable.ml b/otherlibs/labltk/support/textvariable.ml index e9dd514772..df4c3b92dc 100644 --- a/otherlibs/labltk/support/textvariable.ml +++ b/otherlibs/labltk/support/textvariable.ml @@ -16,6 +16,7 @@ (* $Id$ *) open StdLabels +open Support open Protocol external internal_tracevar : string -> cbid -> unit @@ -37,7 +38,7 @@ let add_handle var cbid = r := cbid :: !r with Not_found -> - Hashtbl.add' handles var (ref [cbid]) + Hashtbl'.add handles var (ref [cbid]) let exceptq x = let rec ex acc = function @@ -75,7 +76,7 @@ let handle vname ~callback:f = clear_callback id; rem_handle vname id; f() in - Hashtbl.add' callback_naming_table ~key:id ~data:wrapped; + Hashtbl'.add callback_naming_table ~key:id ~data:wrapped; add_handle vname id; if !Protocol.debug then begin prerr_cbid id; prerr_string " for variable "; prerr_endline vname @@ -96,7 +97,7 @@ let add w v = with Not_found -> let r = ref StringSet.empty in - Hashtbl.add' memo ~key:w ~data:r; + Hashtbl'.add memo ~key:w ~data:r; r in r := StringSet.add v !r diff --git a/otherlibs/labltk/support/timer.ml b/otherlibs/labltk/support/timer.ml index 9bae936344..349bf6a2e3 100644 --- a/otherlibs/labltk/support/timer.ml +++ b/otherlibs/labltk/support/timer.ml @@ -16,6 +16,7 @@ (* $Id$ *) (* Timers *) +open Support open Protocol type tkTimer = int @@ -33,7 +34,7 @@ let add ~ms ~callback = let wrapped _ = clear_callback id; (* do it first in case f raises exception *) callback() in - Hashtbl.add' callback_naming_table ~key:id ~data:wrapped; + Hashtbl'.add callback_naming_table ~key:id ~data:wrapped; if !Protocol.debug then begin prerr_cbid id; prerr_endline " for timer" end; diff --git a/otherlibs/labltk/support/widget.ml b/otherlibs/labltk/support/widget.ml index 1c89bb5d90..6cc7c74743 100644 --- a/otherlibs/labltk/support/widget.ml +++ b/otherlibs/labltk/support/widget.ml @@ -16,6 +16,7 @@ (* $Id$ *) open StdLabels +open Support (* * Widgets @@ -68,7 +69,7 @@ let known_class = function let default_toplevel = let wname = "." in let w = Typed (wname, "toplevel") in - Hashtbl.add' table ~key:wname ~data:w; + Hashtbl'.add table ~key:wname ~data:w; w (* Dummy widget to which global callbacks are associated *) @@ -125,7 +126,7 @@ and widget_toplevel_table = [ "toplevel" ] let new_suffix clas n = try - (List.assoc clas naming_scheme) ^ (string_of_int n) + (List.assoc clas ~map:naming_scheme) ^ (string_of_int n) with Not_found -> "w" ^ (string_of_int n) @@ -147,7 +148,7 @@ let new_atom ~parent ?name:nom clas = else parentpath ^ "." ^ name in let w = Typed(path,clas) in - Hashtbl.add' table ~key:path ~data:w; + Hashtbl'.add table ~key:path ~data:w; w (* Just create a path. Only to check existence of widgets *) |