Codebase list labltk / c27e185
Update upstream source from tag 'upstream/8.06.13' Update to upstream version '8.06.13' with Debian dir ee0dc84535d568dd95cd0233aeebd835ee7a94c6 Stéphane Glondu 1 year, 3 months ago
18 changed file(s) with 67 addition(s) and 49 deletion(s). Raw diff Collapse all Expand all
0 2022-11-01:
1 -----------
2 * Release labltk-8.06.13 for OCaml 5.0
3
4 2022-10-13:
5 -----------
6 * Fix compatibility with OCaml 5.0
7
8 2022-10-06:
9 -----------
10 * Update OCamlBrowser for OCaml 5.0
11
12 2022-03-30:
13 -----------
14 * Release labltk-8.06.12 for OCaml 4.14
15 * Update OCamlBrowser
16
017 2021-09-17:
118 -----------
219 * Release labltk-8.06.11 for ocaml 4.13
22
33 PREREQUISITES
44
5 * OCaml (>= 4.08) should be installed (4.13 for ocamlbrowser)
5 * OCaml (>= 4.08) should be installed (5.0 for ocamlbrowser)
66
77 * Tcl/Tk (>= 8.03) should be installed
88
1313 # #
1414 #########################################################################
1515
16 LABLTKLIB=-I ../labltk -I ../lib -I ../support -I +compiler-libs
17 INCLUDES=$(LABLTKLIB)
16 LABLTKLIB=-I ../labltk -I ../lib -I ../support -I +compiler-libs -I +str -I +unix
17 INCLUDES=$(LABLTKLIB) -I +unix -I +str
1818
1919 OBJ = list2.cmo useunix.cmo setpath.cmo lexical.cmo \
2020 fileselect.cmo searchid.cmo searchpos.cmo \
8282 "<command> Pipe sources through preprocessor <command>";
8383 "-rectypes", Arg.Set Clflags.recursive_types,
8484 " Allow arbitrary recursive types";
85 "-safe-string", Arg.Clear Clflags.unsafe_string,
86 " Make strings immutable";
8785 "-short-paths", Arg.Clear Clflags.real_paths, " Shorten paths in types";
8886 "-version", Arg.Unit print_version,
8987 " Print version and exit";
9593 Arg.parse spec
9694 (fun name -> raise(Arg.Bad("don't know what to do with " ^ name)))
9795 errmsg;
98 Load_path.init
96 Load_path.init ~auto_include:Load_path.no_auto_include
9997 (Sys.getcwd ()
10098 :: List.rev_map ~f:(Misc.expand_directory Config.standard_library) !path
10199 @ [Config.standard_library]);
9494 if p = 0 then 1 else n * arr (p-1) ~card:(n-1)
9595
9696 let rec all_args ty =
97 let ty = repr ty in
98 match ty.desc with
97 match get_desc ty with
9998 Tarrow(l, ty1, ty2, _) -> let (tl,ty) = all_args ty2 in ((l,ty1)::tl, ty)
10099 | _ -> ([], ty)
101100
102101 let rec equal ~prefix t1 t2 =
103 match (repr t1).desc, (repr t2).desc with
102 match get_desc t1, get_desc t2 with
104103 Tvar _, Tvar _ -> true
105104 | Tvariant row1, Tvariant row2 ->
106 let row1 = row_repr row1 and row2 = row_repr row2 in
107 let fields1 = filter_row_fields false row1.row_fields
108 and fields2 = filter_row_fields false row1.row_fields
105 let fields1 = filter_row_fields false (row_fields row1)
106 and fields2 = filter_row_fields false (row_fields row1)
109107 in
110108 let r1, r2, pairs = merge_row_fields fields1 fields2 in
111 row1.row_closed = row2.row_closed && r1 = [] && r2 = [] &&
109 row_closed row1 = row_closed row2 && r1 = [] && r2 = [] &&
112110 List.for_all pairs ~f:
113111 begin fun (_,f1,f2) ->
114112 match row_field_repr f1, row_field_repr f2 with
115113 Rpresent None, Rpresent None -> true
116114 | Rpresent(Some t1), Rpresent (Some t2) -> equal t1 t2 ~prefix
117 | Reither(c1, tl1, _, _), Reither(c2, tl2, _, _) ->
115 | Reither(c1, tl1, _), Reither(c2, tl2, _) ->
118116 c1 = c2 && List.length tl1 = List.length tl2 &&
119117 List.for_all2 tl1 tl2 ~f:(equal ~prefix)
120118 | _ -> false
142140 let get_options = List.filter ~f:Btype.is_optional
143141
144142 let rec included ~prefix t1 t2 =
145 match (repr t1).desc, (repr t2).desc with
143 match get_desc t1, get_desc t2 with
146144 Tvar _, _ -> true
147145 | Tvariant row1, Tvariant row2 ->
148 let row1 = row_repr row1 and row2 = row_repr row2 in
149 let fields1 = filter_row_fields false row1.row_fields
150 and fields2 = filter_row_fields false row2.row_fields
146 let fields1 = filter_row_fields false (row_fields row1)
147 and fields2 = filter_row_fields false (row_fields row2)
151148 in
152149 let r1, r2, pairs = merge_row_fields fields1 fields2 in
153150 r1 = [] &&
156153 match row_field_repr f1, row_field_repr f2 with
157154 Rpresent None, Rpresent None -> true
158155 | Rpresent(Some t1), Rpresent (Some t2) -> included t1 t2 ~prefix
159 | Reither(c1, tl1, _, _), Reither(c2, tl2, _, _) ->
156 | Reither(c1, tl1, _), Reither(c2, tl2, _) ->
160157 c1 = c2 && List.length tl1 = List.length tl2 &&
161158 List.for_all2 tl1 tl2 ~f:(included ~prefix)
162159 | _ -> false
206203 let get_fields ~prefix ~sign self =
207204 (*let env = open_signature Fresh (mkpath prefix) sign !start_env in*)
208205 let env = add_signature sign !start_env in
209 match (expand_head env self).desc with
206 match get_desc (expand_head env self) with
210207 Tobject (ty_obj, _) ->
211208 let l,_ = flatten_fields ty_obj in l
212209 | _ -> []
269266 end
270267
271268 let search_all_types t ~mode =
272 let tl = match mode, t.desc with
269 let tl = match mode, get_desc t with
273270 `Exact, _ -> [t]
274271 | `Included, Tarrow _ -> [t]
275272 | `Included, _ ->
276 [t; newty(Tarrow(Nolabel,t,newvar(),Cok));
277 newty(Tarrow(Nolabel,newvar(),t,Cok))]
273 [t; newty(Tarrow(Nolabel,t,newvar(),commu_ok));
274 newty(Tarrow(Nolabel,newvar(),t,commu_ok))]
278275 in List2.flat_map !module_list ~f:
279276 begin fun modname ->
280277 let mlid = Lident modname in
194194
195195 let search_pos_extension ext ~pos ~env =
196196 begin match ext.pext_kind with
197 Pext_decl (l, _) -> search_pos_arguments l ~pos ~env
197 Pext_decl (_, l, _) -> search_pos_arguments l ~pos ~env
198198 | Pext_rebind _ -> ()
199199 end
200200
501501 and view_type_decl path ~env =
502502 let td = find_type path env in
503503 try match td.type_manifest with None -> raise Not_found
504 | Some ty -> match (Ctype.repr ty).desc with
504 | Some ty -> match get_desc ty with
505505 Tobject _ ->
506506 let clt = find_cltype path env in
507507 view_signature_item ~path ~env
508508 [Sig_class_type(ident_of_path path ~default:"ct", clt, Trec_first,
509509 Exported);
510510 dummy_item; dummy_item]
511 | Tvariant ({row_name = Some _} as row) ->
512 let td = {td with type_manifest = Some(
513 Btype.newgenty (Tvariant {row with row_name = None}))} in
511 | Tvariant row when row_name row <> None ->
512 let Row {fields; more; closed; fixed} = row_repr row in
513 let row = create_row ~fields ~more ~closed ~fixed ~name:None in
514 let td =
515 {td with type_manifest = Some(Btype.newgenty (Tvariant row))} in
514516 view_signature_item ~path ~env
515517 [Sig_type(ident_of_path path ~default:"t", td, Trec_first,
516518 Exported)]
696698 Format.set_formatter_output_functions buf#out ignore;
697699 Format.set_margin 60;
698700 Format.open_hbox ();
699 Printtyp.reset ();
700 Printtyp.mark_loops ty;
701 Printtyp.prepare_for_printing [ty];
701702 Printtyp.wrap_printing_env ~error:false env
702703 (fun () -> Printtyp.type_expr Format.std_formatter ty);
703704 Format.close_box (); Format.print_flush ();
711712 in
712713 (* Menu.add_separator menu; *)
713714 List.iter l ~f:
714 begin fun label -> match (Ctype.repr ty).desc with
715 begin fun label -> match get_desc ty with
715716 Tconstr (path,_,_) ->
716717 Menu.add_command menu ~label ~font
717718 ~command:(fun () -> view_type_decl path ~env)
718 | Tvariant {row_name = Some (path, _)} ->
719 | Tvariant row when row_name row <> None ->
720 let path, _ = Stdlib.Option.get (row_name row) in
719721 Menu.add_command menu ~label ~font
720722 ~command:(fun () -> view_type_decl path ~env)
721723 | _ ->
863865 search_pos_expr a ~pos; search_pos_expr b ~pos
864866 | Texp_for (_, _, a, b, _, c) ->
865867 List.iter [a;b;c] ~f:(search_pos_expr ~pos)
866 | Texp_send (exp, _, _) -> search_pos_expr exp ~pos
868 | Texp_send (exp, _) -> search_pos_expr exp ~pos
867869 | Texp_new (path, _, _) ->
868870 add_found_str (`Exp(`New path, exp.exp_type))
869871 ~env:exp.exp_env ~loc:exp.exp_loc
3030 end
3131
3232 let set_load_path l =
33 Load_path.init l;
33 Load_path.init l ~auto_include:Load_path.no_auto_include;
3434 exec_update_hooks ();
3535 Env.reset_cache ()
3636
4444 let obj = Obj.repr h in
4545 if Obj.is_int obj || Obj.tag obj <> Obj.custom_tag then
4646 invalid_arg "Shell.dump_handle";
47 Nativeint.format "%x" (Obj.obj obj)
47 Printf.sprintf "%nx" (Obj.obj obj)
4848
4949 (* The shell class. Now encapsulated *)
5050
115115 List.iter psl ~f:
116116 begin function
117117 Ptop_def pstr ->
118 let str, sign, _names, env' = Typemod.type_structure !env pstr in
118 let str, sign, _names, _, env' = Typemod.type_structure !env pstr in
119119 txt.structure <- txt.structure @ str.str_items;
120120 txt.signature <- txt.signature @ sign;
121121 env := env'
6464 [Sig_value (Ident.create_local name, vd, Exported)]
6565 | Ptype -> view_type_id id ~env
6666 | Plabel -> let ld = find_label_by_name id env in
67 begin match ld.lbl_res.desc with
67 begin match get_desc ld.lbl_res with
6868 Tconstr (path, _, _) -> view_type_decl path ~env
6969 | _ -> ()
7070 end
7171 | Pconstructor ->
7272 let cd = find_constructor_by_name id env in
73 begin match cd.cstr_tag, cd.cstr_res.desc with
73 begin match cd.cstr_tag, get_desc cd.cstr_res with
7474 Cstr_extension _, Tconstr (cpath, args, _) ->
7575 view_signature ~title:(string_of_longident id) ~env ?path
7676 [Sig_typext (Ident.create_local name,
1515
1616 include ../support/Makefile.common
1717
18 COMPFLAGS= -I ../support -no-alias-deps
18 COMPFLAGS= -I ../support -no-alias-deps -I +unix
1919
2020 all: camltkobjs
2121
1616 include ../support/Makefile.common
1717
1818 # We are using the non-installed library !
19 BYT_COMPFLAGS=-I ../lib -I ../camltk -I ../support -w s -dllpath ../support
20 BIN_COMPFLAGS=-I ../lib -I ../camltk -I ../support -w s
19 BYT_COMPFLAGS=-I ../lib -I ../camltk -I ../support -w s -dllpath ../support \
20 -I +unix
21 BIN_COMPFLAGS=-I ../lib -I ../camltk -I ../support -w s -I +unix
2122
2223 WITH_BYT_CAMLTK=labltk.cma camltk.cmo
2324 WITH_BIN_CAMLTK=labltk.cmxa camltk.cmx
3434 $(CAMLC) $(COMPFLAGS) -o calc $(LIBNAME).cma calc.cmo
3535
3636 clock: clock.cmo
37 $(CAMLC) $(COMPFLAGS) -o clock $(LIBNAME).cma unix.cma clock.cmo
37 $(CAMLC) $(COMPFLAGS) -o clock $(LIBNAME).cma \
38 -I +unix unix.cma clock.cmo
3839
3940 clock.opt: clock.cmx
4041 $(CAMLOPT) $(COMPFLAGS) -o clock.opt \
41 $(LIBNAME).cmxa unix.cmxa clock.cmx
42 $(LIBNAME).cmxa -I +unix unix.cmxa clock.cmx
4243
4344 tetris: tetris.cmo
4445 $(CAMLC) $(COMPFLAGS) -o tetris $(LIBNAME).cma tetris.cmo
1515
1616 include ../support/Makefile.common
1717
18 COMPFLAGS=-I ../labltk -I ../support
18 COMPFLAGS=-I ../labltk -I ../support -I +str -I +unix
1919
2020 OBJS= fileselect.cmo balloon.cmo shell.cmo jpf_font.cmo
2121
1515
1616 include ../support/Makefile.common
1717
18 COMPFLAGS= -I ../support -no-alias-deps
18 COMPFLAGS= -I ../support -no-alias-deps -I +unix
1919
2020 all: labltkobjs
2121
6666 $(LIBNAME)top$(EXE) : $(LIBNAME).cma ../support/lib$(LIBNAME).$(A)
6767 $(CAMLC) -verbose -linkall -o $(LIBNAME)top$(EXE) -I ../support \
6868 $(TOPLEVELLIBS) \
69 -I +compiler-libs unix.cma \
69 -I +compiler-libs -I +unix -I +str unix.cma str.cma \
7070 -I ../labltk -I ../camltk $(LIBNAME).cma \
71 str.cma \
7271 $(TOPLEVELSTART)
7372
7473 $(LIBNAME): Makefile
113112 cd $(INSTALLDIR); $(RANLIB) $(LIBNAME).$(A)
114113 chmod 644 $(INSTALLDIR)/$(LIBNAME).cmxa
115114 chmod 644 $(INSTALLDIR)/$(LIBNAME).$(A)
116 endif
115 endif
2929
3030 CCFLAGS=-I$(LIBDIR)/caml $(TK_DEFS) $(SHAREDCCCOMPOPTS)
3131
32 COMPFLAGS=
32 COMPFLAGS=-I +unix
3333 THFLAGS=-I +threads -I vmthreads
3434 TKLDOPTS=$(TK_LINK:%=-ldopt "%")
3535
3434 CAMLOPTLIBR=$(CAMLOPT) -a
3535 MKLIB=$(BINDIR)/ocamlmklib
3636 CAMLRUNGEN=$(BINDIR)/ocamlrun
37 ifeq (x$(RANLIB),x)
38 RANLIB=":"
39 endif