summaryrefslogtreecommitdiff
path: root/otherlibs/labltk/compiler
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2001-09-02 13:42:19 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2001-09-02 13:42:19 +0000
commitfe2e11a8fb4dcf166ffb7f91e6eb8dd0f4402f25 (patch)
tree8dff8da7bfc88f25c78afe5340d78daa8c89587c /otherlibs/labltk/compiler
parent7e053c39de8693928b83038c1727f5d90228c39d (diff)
downloadocaml-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/compiler')
-rw-r--r--otherlibs/labltk/compiler/Makefile8
-rw-r--r--otherlibs/labltk/compiler/compile.ml6
-rw-r--r--otherlibs/labltk/compiler/intf.ml2
-rw-r--r--otherlibs/labltk/compiler/lexer.mll3
-rw-r--r--otherlibs/labltk/compiler/maincompile.ml9
-rw-r--r--otherlibs/labltk/compiler/tables.ml18
6 files changed, 24 insertions, 22 deletions
diff --git a/otherlibs/labltk/compiler/Makefile b/otherlibs/labltk/compiler/Makefile
index 6b215dcbfd..302ad25880 100644
--- a/otherlibs/labltk/compiler/Makefile
+++ b/otherlibs/labltk/compiler/Makefile
@@ -1,7 +1,7 @@
include ../support/Makefile.common
-OBJS=tsort.cmo tables.cmo printer.cmo lexer.cmo parser.cmo \
- compile.cmo intf.cmo maincompile.cmo
+OBJS= ../support/support.cmo tsort.cmo tables.cmo printer.cmo lexer.cmo \
+ parser.cmo compile.cmo intf.cmo maincompile.cmo
tkcompiler : $(OBJS)
$(LABLC) $(LINKFLAGS) -o tkcompiler $(OBJS)
@@ -25,10 +25,10 @@ install:
.SUFFIXES : .mli .ml .cmi .cmo .mlp
.mli.cmi:
- $(LABLCOMP) $(COMPFLAGS) $<
+ $(LABLCOMP) $(COMPFLAGS) -I ../support $<
.ml.cmo:
- $(LABLCOMP) $(COMPFLAGS) $<
+ $(LABLCOMP) $(COMPFLAGS) -I ../support $<
depend: parser.ml parser.mli lexer.ml
$(LABLDEP) *.mli *.ml > .depend
diff --git a/otherlibs/labltk/compiler/compile.ml b/otherlibs/labltk/compiler/compile.ml
index ca51bafcf9..66cfcf7a7d 100644
--- a/otherlibs/labltk/compiler/compile.ml
+++ b/otherlibs/labltk/compiler/compile.ml
@@ -52,7 +52,7 @@ let gettklabel fc =
else s
in begin
if List.mem s forbidden then
- try List.assoc s nicknames
+ try List.assoc s ~map:nicknames
with Not_found -> small fc.var_name
else s
end
@@ -97,7 +97,7 @@ let ppMLtype ?(any=false) ?(return=false) ?(def=false) ?(counter=ref 0) =
begin
try
let typdef = Hashtbl.find types_table sup in
- let fcl = List.assoc sub typdef.subtypes in
+ let fcl = List.assoc sub ~map:typdef.subtypes in
let tklabels = List.map ~f:gettklabel fcl in
let l = List.map fcl ~f:
begin fun fc ->
@@ -499,7 +499,7 @@ let code_of_template ~context_widget ?func:(funtemplate=false) template =
StringArg s -> "TkToken \"" ^ s ^ "\""
| TypeArg (_, List (Subtype (sup, sub) as ty)) ->
let typdef = Hashtbl.find types_table sup in
- let classdef = List.assoc sub typdef.subtypes in
+ let classdef = List.assoc sub ~map:typdef.subtypes in
let lbl = gettklabel (List.hd classdef) in
catch_opts := (sub ^ "_" ^ sup, lbl);
newvar := newvar2;
diff --git a/otherlibs/labltk/compiler/intf.ml b/otherlibs/labltk/compiler/intf.ml
index 489fa3930e..fdeac2edbb 100644
--- a/otherlibs/labltk/compiler/intf.ml
+++ b/otherlibs/labltk/compiler/intf.ml
@@ -27,7 +27,7 @@ let write_create_p ~w wname =
begin
try
let option = Hashtbl.find types_table "options" in
- let classdefs = List.assoc wname option.subtypes in
+ let classdefs = List.assoc wname ~map:option.subtypes in
let tklabels = List.map ~f:gettklabel classdefs in
let l = List.map classdefs ~f:
begin fun fc ->
diff --git a/otherlibs/labltk/compiler/lexer.mll b/otherlibs/labltk/compiler/lexer.mll
index 6daa17fc16..8de3956810 100644
--- a/otherlibs/labltk/compiler/lexer.mll
+++ b/otherlibs/labltk/compiler/lexer.mll
@@ -19,6 +19,7 @@
open StdLabels
open Lexing
open Parser
+open Support
exception Lexical_error of string
let current_line = ref 1
@@ -29,7 +30,7 @@ let current_line = ref 1
let keyword_table = (Hashtbl.create 149 : (string, token) Hashtbl.t)
let _ = List.iter
- ~f:(fun (str,tok) -> Hashtbl.add' keyword_table ~key:str ~data:tok)
+ ~f:(fun (str,tok) -> Hashtbl'.add keyword_table ~key:str ~data:tok)
[
"int", TYINT;
"float", TYFLOAT;
diff --git a/otherlibs/labltk/compiler/maincompile.ml b/otherlibs/labltk/compiler/maincompile.ml
index 146c5f08b5..65535df790 100644
--- a/otherlibs/labltk/compiler/maincompile.ml
+++ b/otherlibs/labltk/compiler/maincompile.ml
@@ -16,6 +16,7 @@
(* $Id$ *)
open StdLabels
+open Support
open Tables
open Printer
open Compile
@@ -118,7 +119,7 @@ let uniq_clauses = function
let c = constr.var_name in
if Hashtbl.mem t c
then (check_constr constr (Hashtbl.find t c))
- else Hashtbl.add' t ~key:c ~data:constr);
+ else Hashtbl'.add t ~key:c ~data:constr);
elements t;;
let option_hack oc =
@@ -268,11 +269,11 @@ let main () =
(fun filename -> input_name := filename)
"Usage: tkcompiler <source file>" ;
try
- verbose_string "Parsing... ";
+ verbose_endline "Parsing...";
parse_file !input_name;
- verbose_string "Compiling... ";
+ verbose_endline "Compiling...";
compile ();
- verbose_string "Finished";
+ verbose_endline "Finished";
exit 0
with
| Lexer.Lexical_error s ->
diff --git a/otherlibs/labltk/compiler/tables.ml b/otherlibs/labltk/compiler/tables.ml
index fa8aa502ca..85029b7726 100644
--- a/otherlibs/labltk/compiler/tables.ml
+++ b/otherlibs/labltk/compiler/tables.ml
@@ -16,6 +16,7 @@
(* $Id$ *)
open StdLabels
+open Support
(* Internal compiler errors *)
@@ -155,7 +156,7 @@ let new_type typname arity =
subtypes = [];
requires_widget_context = false;
variant = false} in
- Hashtbl.add' types_table ~key:typname ~data:typdef;
+ Hashtbl'.add types_table ~key:typname ~data:typdef;
typdef
@@ -180,7 +181,7 @@ let declared_type_parser_arity s =
(Hashtbl.find types_table s).parser_arity
with
Not_found ->
- try List.assoc s !types_external
+ try List.assoc s ~map:!types_external
with
Not_found ->
prerr_string "Type "; prerr_string s;
@@ -387,13 +388,13 @@ let enter_widget name components =
| External, _ -> ()
end;
let commands =
- try List.assoc Command sorted_components
+ try List.assoc Command ~map:sorted_components
with Not_found -> []
and externals =
- try List.assoc External sorted_components
+ try List.assoc External ~map:sorted_components
with Not_found -> []
in
- Hashtbl.add' module_table ~key:name
+ Hashtbl'.add module_table ~key:name
~data:{module_type = Widget; commands = commands; externals = externals}
(******************** Functions ********************)
@@ -414,12 +415,11 @@ let enter_module name components =
| External, _ -> ()
end;
let commands =
- try List.assoc Command sorted_components
+ try List.assoc Command ~map:sorted_components
with Not_found -> []
and externals =
- try List.assoc External sorted_components
+ try List.assoc External ~map:sorted_components
with Not_found -> []
in
- Hashtbl.add' module_table ~key:name
+ Hashtbl'.add module_table ~key:name
~data:{module_type = Family; commands = commands; externals = externals}
-