summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1999-11-08 17:06:33 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1999-11-08 17:06:33 +0000
commita048d42b10feaffe3e5ee8e891e15e8b59407e56 (patch)
tree54ee79580060b51bc44d39f513ce63d9b8f3c4c4
parentbad71c148081a820604b9901300a5b8e2b730a95 (diff)
downloadocaml-a048d42b10feaffe3e5ee8e891e15e8b59407e56.tar.gz
Ajout du module Formatmsg pour rediriger les messages du systeme vers stdout ou stderr suivant le contexte
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2486 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--.depend22
-rw-r--r--Makefile4
-rw-r--r--Makefile.Mac4
-rw-r--r--Makefile.nt4
-rw-r--r--asmcomp/alpha/arch.ml2
-rw-r--r--asmcomp/arm/arch.ml2
-rw-r--r--asmcomp/asmgen.ml2
-rw-r--r--asmcomp/asmlibrarian.ml2
-rw-r--r--asmcomp/asmlink.ml2
-rw-r--r--asmcomp/codegen.ml2
-rw-r--r--asmcomp/compilenv.ml2
-rw-r--r--asmcomp/hppa/arch.ml2
-rw-r--r--asmcomp/i386/arch.ml2
-rw-r--r--asmcomp/i386/proc.ml2
-rw-r--r--asmcomp/i386/proc_nt.ml2
-rw-r--r--asmcomp/liveness.ml2
-rw-r--r--asmcomp/m68k/arch.ml2
-rw-r--r--asmcomp/m68k/proc.ml2
-rw-r--r--asmcomp/mips/arch.ml2
-rw-r--r--asmcomp/power/arch.ml2
-rw-r--r--asmcomp/printcmm.ml2
-rw-r--r--asmcomp/printlinear.ml2
-rw-r--r--asmcomp/printmach.ml2
-rw-r--r--asmcomp/sparc/arch.ml2
-rwxr-xr-xboot/ocamlcbin580704 -> 599414 bytes
-rwxr-xr-xboot/ocamllexbin79554 -> 82386 bytes
-rw-r--r--bytecomp/bytelibrarian.ml2
-rw-r--r--bytecomp/bytelink.ml2
-rw-r--r--bytecomp/printinstr.ml2
-rw-r--r--bytecomp/printlambda.ml2
-rw-r--r--bytecomp/simplif.ml1
-rw-r--r--bytecomp/symtable.ml2
-rw-r--r--bytecomp/translclass.ml2
-rw-r--r--bytecomp/translcore.ml2
-rw-r--r--debugger/.depend90
-rw-r--r--debugger/Makefile2
-rw-r--r--debugger/command_line.ml2
-rw-r--r--debugger/envaux.ml2
-rw-r--r--debugger/eval.ml2
-rw-r--r--debugger/loadprinter.ml4
-rw-r--r--debugger/printval.ml2
-rw-r--r--debugger/show_information.ml2
-rw-r--r--driver/compile.ml2
-rw-r--r--driver/errors.ml2
-rw-r--r--driver/main.ml2
-rw-r--r--driver/optcompile.ml2
-rw-r--r--driver/opterrors.ml2
-rw-r--r--driver/optmain.ml2
-rw-r--r--otherlibs/dynlink/Makefile3
-rw-r--r--otherlibs/dynlink/Makefile.Mac3
-rw-r--r--otherlibs/dynlink/Makefile.nt3
-rw-r--r--parsing/lexer.mll2
-rw-r--r--parsing/location.ml2
-rw-r--r--parsing/syntaxerr.ml2
-rw-r--r--tools/.depend26
-rw-r--r--tools/Makefile4
-rw-r--r--tools/Makefile.Mac4
-rw-r--r--tools/Makefile.nt4
-rw-r--r--tools/ocamldep.ml11
-rw-r--r--tools/ocamlprof.ml4
-rw-r--r--toplevel/genprintval.ml2
-rw-r--r--toplevel/topdirs.ml2
-rw-r--r--toplevel/toploop.ml4
-rw-r--r--toplevel/trace.ml2
-rw-r--r--typing/env.ml2
-rw-r--r--typing/ident.ml2
-rw-r--r--typing/includeclass.ml2
-rw-r--r--typing/includemod.ml2
-rw-r--r--typing/primitive.ml2
-rw-r--r--typing/printtyp.ml2
-rw-r--r--typing/typeclass.ml2
-rw-r--r--typing/typecore.ml2
-rw-r--r--typing/typedecl.ml2
-rw-r--r--typing/typemod.ml8
-rw-r--r--typing/typetexp.ml2
-rw-r--r--utils/formatmsg.ml52
-rw-r--r--utils/formatmsg.mli37
-rw-r--r--utils/tbl.ml2
78 files changed, 250 insertions, 154 deletions
diff --git a/.depend b/.depend
index bc404bf564..c8ebb4c8a4 100644
--- a/.depend
+++ b/.depend
@@ -141,13 +141,13 @@ typing/mtype.cmo: typing/btype.cmi typing/ctype.cmi typing/env.cmi \
typing/mtype.cmx: typing/btype.cmx typing/ctype.cmx typing/env.cmx \
typing/ident.cmx typing/path.cmx typing/types.cmx typing/mtype.cmi
typing/parmatch.cmo: parsing/asttypes.cmi typing/ctype.cmi \
- typing/datarepr.cmi typing/env.cmi utils/formatmsg.cmi typing/ident.cmi \
- parsing/location.cmi utils/misc.cmi typing/path.cmi typing/typedtree.cmi \
- typing/types.cmi utils/warnings.cmi typing/parmatch.cmi
+ typing/datarepr.cmi typing/env.cmi typing/ident.cmi parsing/location.cmi \
+ utils/misc.cmi typing/path.cmi typing/typedtree.cmi typing/types.cmi \
+ utils/warnings.cmi typing/parmatch.cmi
typing/parmatch.cmx: parsing/asttypes.cmi typing/ctype.cmx \
- typing/datarepr.cmx typing/env.cmx utils/formatmsg.cmx typing/ident.cmx \
- parsing/location.cmx utils/misc.cmx typing/path.cmx typing/typedtree.cmx \
- typing/types.cmx utils/warnings.cmx typing/parmatch.cmi
+ typing/datarepr.cmx typing/env.cmx typing/ident.cmx parsing/location.cmx \
+ utils/misc.cmx typing/path.cmx typing/typedtree.cmx typing/types.cmx \
+ utils/warnings.cmx typing/parmatch.cmi
typing/path.cmo: typing/ident.cmi typing/path.cmi
typing/path.cmx: typing/ident.cmx typing/path.cmi
typing/predef.cmo: typing/btype.cmi typing/ident.cmi typing/path.cmi \
@@ -511,10 +511,12 @@ asmcomp/linearize.cmo: asmcomp/cmm.cmi asmcomp/mach.cmi asmcomp/proc.cmi \
asmcomp/reg.cmi asmcomp/linearize.cmi
asmcomp/linearize.cmx: asmcomp/cmm.cmx asmcomp/mach.cmx asmcomp/proc.cmx \
asmcomp/reg.cmx asmcomp/linearize.cmi
-asmcomp/liveness.cmo: asmcomp/mach.cmi utils/misc.cmi asmcomp/printmach.cmi \
- asmcomp/proc.cmi asmcomp/reg.cmi asmcomp/liveness.cmi
-asmcomp/liveness.cmx: asmcomp/mach.cmx utils/misc.cmx asmcomp/printmach.cmx \
- asmcomp/proc.cmx asmcomp/reg.cmx asmcomp/liveness.cmi
+asmcomp/liveness.cmo: utils/formatmsg.cmi asmcomp/mach.cmi utils/misc.cmi \
+ asmcomp/printmach.cmi asmcomp/proc.cmi asmcomp/reg.cmi \
+ asmcomp/liveness.cmi
+asmcomp/liveness.cmx: utils/formatmsg.cmx asmcomp/mach.cmx utils/misc.cmx \
+ asmcomp/printmach.cmx asmcomp/proc.cmx asmcomp/reg.cmx \
+ asmcomp/liveness.cmi
asmcomp/mach.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi utils/nativeint.cmi \
asmcomp/reg.cmi asmcomp/mach.cmi
asmcomp/mach.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx utils/nativeint.cmx \
diff --git a/Makefile b/Makefile
index c160f5f72f..3a51ba914d 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ MKDIR=mkdir -p
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver -I toplevel
-UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \
+UTILS=utils/misc.cmo utils/formatmsg.cmo utils/tbl.cmo utils/config.cmo \
utils/clflags.cmo utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo
OPTUTILS=$(UTILS) utils/nativeint.cmo
@@ -83,7 +83,7 @@ TOPOBJS=$(TOPLIB) $(TOPLEVELMAIN)
OPTOBJS=$(OPTUTILS) $(PARSING) $(TYPING) $(COMP) $(ASMCOMP) $(OPTDRIVER)
-EXPUNGEOBJS=utils/misc.cmo utils/tbl.cmo \
+EXPUNGEOBJS=utils/misc.cmo utils/formatmsg.cmo utils/tbl.cmo \
utils/config.cmo utils/clflags.cmo \
typing/ident.cmo typing/path.cmo typing/types.cmo typing/btype.cmo \
typing/predef.cmo bytecomp/runtimedef.cmo bytecomp/symtable.cmo \
diff --git a/Makefile.Mac b/Makefile.Mac
index 57c6d74d57..ddb86795cc 100644
--- a/Makefile.Mac
+++ b/Makefile.Mac
@@ -15,7 +15,7 @@ CAMLRUN = :byterun:ocamlrun
INCLUDES = -I :utils: -I :parsing: -I :typing: -I :bytecomp: ¶
-I :driver: -I :toplevel:
-UTILS = :utils:misc.cmo :utils:tbl.cmo :utils:config.cmo ¶
+UTILS = :utils:misc.cmo :utils:formatmsg.cmo :utils:tbl.cmo :utils:config.cmo ¶
:utils:clflags.cmo :utils:terminfo.cmo :utils:ccomp.cmo ¶
:utils:warnings.cmo
@@ -61,7 +61,7 @@ COMPOBJS = {UTILS} {PARSING} {TYPING} {COMP} {BYTECOMP} {DRIVER}
TOPLIB = {UTILS} {PARSING} {TYPING} {COMP} {BYTECOMP} {TOPLEVEL}
-EXPUNGEOBJS = :utils:misc.cmo :utils:tbl.cmo ¶
+EXPUNGEOBJS = :utils:misc.cmo :utils:formatmsg.cmo :utils:tbl.cmo ¶
:utils:config.cmo :utils:clflags.cmo ¶
:typing:ident.cmo :typing:path.cmo ¶
:typing:types.cmo :typing:btype.cmo :typing:predef.cmo ¶
diff --git a/Makefile.nt b/Makefile.nt
index 6c4632ce05..e61d446313 100644
--- a/Makefile.nt
+++ b/Makefile.nt
@@ -15,7 +15,7 @@ CAMLRUN=byterun\ocamlrun
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver -I toplevel
-UTILS=utils\misc.cmo utils\tbl.cmo utils\config.cmo \
+UTILS=utils\misc.cmo utils\formatmsg.cmo utils\tbl.cmo utils\config.cmo \
utils\clflags.cmo utils\terminfo.cmo utils\ccomp.cmo utils\warnings.cmo
OPTUTILS=$(UTILS) utils\nativeint.cmo
@@ -80,7 +80,7 @@ TOPOBJS=$(TOPLIB) $(TOPLEVELMAIN)
OPTOBJS=$(OPTUTILS) $(PARSING) $(TYPING) $(COMP) $(ASMCOMP) $(OPTDRIVER)
-EXPUNGEOBJS=utils\misc.cmo utils\tbl.cmo \
+EXPUNGEOBJS=utils\misc.cmo utils\formatmsg.cmo utils\tbl.cmo \
utils\config.cmo utils\clflags.cmo \
typing\ident.cmo typing\path.cmo typing\types.cmo typing\btype.cmo \
typing\predef.cmo bytecomp\runtimedef.cmo bytecomp\symtable.cmo \
diff --git a/asmcomp/alpha/arch.ml b/asmcomp/alpha/arch.ml
index 0974e441c0..addc547ea7 100644
--- a/asmcomp/alpha/arch.ml
+++ b/asmcomp/alpha/arch.ml
@@ -13,7 +13,7 @@
(* Specific operations for the Alpha processor *)
-open Format
+open Formatmsg
(* Addressing modes *)
diff --git a/asmcomp/arm/arch.ml b/asmcomp/arm/arch.ml
index ffd02ac399..78b3f73a5e 100644
--- a/asmcomp/arm/arch.ml
+++ b/asmcomp/arm/arch.ml
@@ -14,7 +14,7 @@
(* Specific operations for the ARM processor *)
open Misc
-open Format
+open Formatmsg
(* Addressing modes *)
diff --git a/asmcomp/asmgen.ml b/asmcomp/asmgen.ml
index 460408ab6d..37a182bdbe 100644
--- a/asmcomp/asmgen.ml
+++ b/asmcomp/asmgen.ml
@@ -13,7 +13,7 @@
(* From lambda to assembly code *)
-open Format
+open Formatmsg
open Config
open Clflags
open Misc
diff --git a/asmcomp/asmlibrarian.ml b/asmcomp/asmlibrarian.ml
index a847d921ea..677dd80b3b 100644
--- a/asmcomp/asmlibrarian.ml
+++ b/asmcomp/asmlibrarian.ml
@@ -55,7 +55,7 @@ let create_archive file_list lib_name =
remove_file archive_name;
raise x
-open Format
+open Formatmsg
let report_error = function
File_not_found name ->
diff --git a/asmcomp/asmlink.ml b/asmcomp/asmlink.ml
index c355f3eded..8bac70d290 100644
--- a/asmcomp/asmlink.ml
+++ b/asmcomp/asmlink.ml
@@ -273,7 +273,7 @@ let link objfiles =
(* Error report *)
-open Format
+open Formatmsg
let report_error = function
File_not_found name ->
diff --git a/asmcomp/codegen.ml b/asmcomp/codegen.ml
index 24dc2517a0..8cd4f91b86 100644
--- a/asmcomp/codegen.ml
+++ b/asmcomp/codegen.ml
@@ -13,7 +13,7 @@
(* From C-- to assembly code *)
-open Format
+open Formatmsg
open Cmm
let dump_cmm = ref false
diff --git a/asmcomp/compilenv.ml b/asmcomp/compilenv.ml
index 897e5403d7..8896f0f015 100644
--- a/asmcomp/compilenv.ml
+++ b/asmcomp/compilenv.ml
@@ -142,7 +142,7 @@ let save_unit_info filename =
(* Error report *)
-open Format
+open Formatmsg
let report_error = function
Not_a_unit_info filename ->
diff --git a/asmcomp/hppa/arch.ml b/asmcomp/hppa/arch.ml
index c41556bd4f..df011b177e 100644
--- a/asmcomp/hppa/arch.ml
+++ b/asmcomp/hppa/arch.ml
@@ -13,7 +13,7 @@
(* Specific operations for the HP PA-RISC processor *)
-open Format
+open Formatmsg
type specific_operation =
Ishift1add
diff --git a/asmcomp/i386/arch.ml b/asmcomp/i386/arch.ml
index f091648b99..7b067f9814 100644
--- a/asmcomp/i386/arch.ml
+++ b/asmcomp/i386/arch.ml
@@ -65,7 +65,7 @@ let num_args_addressing = function
(* Printing operations and addressing modes *)
-open Format
+open Formatmsg
let print_addressing printreg addr arg =
match addr with
diff --git a/asmcomp/i386/proc.ml b/asmcomp/i386/proc.ml
index 877e69aa7e..d07db55255 100644
--- a/asmcomp/i386/proc.ml
+++ b/asmcomp/i386/proc.ml
@@ -15,7 +15,7 @@
open Misc
open Arch
-open Format
+open Formatmsg
open Cmm
open Reg
open Mach
diff --git a/asmcomp/i386/proc_nt.ml b/asmcomp/i386/proc_nt.ml
index c5872840ef..4bb70e39dd 100644
--- a/asmcomp/i386/proc_nt.ml
+++ b/asmcomp/i386/proc_nt.ml
@@ -15,7 +15,7 @@
open Misc
open Arch
-open Format
+open Formatmsg
open Cmm
open Reg
open Mach
diff --git a/asmcomp/liveness.ml b/asmcomp/liveness.ml
index 0a25ddc607..4019b1c802 100644
--- a/asmcomp/liveness.ml
+++ b/asmcomp/liveness.ml
@@ -106,6 +106,6 @@ let fundecl f =
(* Sanity check: only function parameters can be live at entrypoint *)
let wrong_live = Reg.Set.diff initially_live (Reg.set_of_array f.fun_args) in
if not (Reg.Set.is_empty wrong_live) then begin
- Printmach.regset wrong_live; Format.print_newline();
+ Printmach.regset wrong_live; Formatmsg.print_newline();
Misc.fatal_error "Liveness.fundecl"
end
diff --git a/asmcomp/m68k/arch.ml b/asmcomp/m68k/arch.ml
index 3eff0a6e31..0fcbee5452 100644
--- a/asmcomp/m68k/arch.ml
+++ b/asmcomp/m68k/arch.ml
@@ -59,7 +59,7 @@ let num_args_addressing = function
(* Printing operations and addressing modes *)
-open Format
+open Formatmsg
let print_addressing printreg addr arg =
match addr with
diff --git a/asmcomp/m68k/proc.ml b/asmcomp/m68k/proc.ml
index aaeff19419..cce4c17406 100644
--- a/asmcomp/m68k/proc.ml
+++ b/asmcomp/m68k/proc.ml
@@ -15,7 +15,7 @@
open Misc
open Arch
-open Format
+open Formatmsg
open Cmm
open Reg
open Mach
diff --git a/asmcomp/mips/arch.ml b/asmcomp/mips/arch.ml
index eebcf91704..60804878a7 100644
--- a/asmcomp/mips/arch.ml
+++ b/asmcomp/mips/arch.ml
@@ -14,7 +14,7 @@
(* Specific operations for the Mips processor *)
open Misc
-open Format
+open Formatmsg
(* Addressing modes *)
diff --git a/asmcomp/power/arch.ml b/asmcomp/power/arch.ml
index be71727494..ae95c284d0 100644
--- a/asmcomp/power/arch.ml
+++ b/asmcomp/power/arch.ml
@@ -13,7 +13,7 @@
(* Specific operations for the PowerPC processor *)
-open Format
+open Formatmsg
type specific_operation =
Imultaddf (* multiply and add *)
diff --git a/asmcomp/printcmm.ml b/asmcomp/printcmm.ml
index 066a999b00..89f9c9ffd3 100644
--- a/asmcomp/printcmm.ml
+++ b/asmcomp/printcmm.ml
@@ -13,7 +13,7 @@
(* Pretty-printing of C-- code *)
-open Format
+open Formatmsg
open Cmm
let machtype_component = function
diff --git a/asmcomp/printlinear.ml b/asmcomp/printlinear.ml
index 0bfeb39140..c22cce6231 100644
--- a/asmcomp/printlinear.ml
+++ b/asmcomp/printlinear.ml
@@ -13,7 +13,7 @@
(* Pretty-printing of linearized machine code *)
-open Format
+open Formatmsg
open Mach
open Printmach
open Linearize
diff --git a/asmcomp/printmach.ml b/asmcomp/printmach.ml
index da223c121b..c561279ef7 100644
--- a/asmcomp/printmach.ml
+++ b/asmcomp/printmach.ml
@@ -13,7 +13,7 @@
(* Pretty-printing of pseudo machine code *)
-open Format
+open Formatmsg
open Cmm
open Reg
open Mach
diff --git a/asmcomp/sparc/arch.ml b/asmcomp/sparc/arch.ml
index c4ba9d5edc..6bd4745eea 100644
--- a/asmcomp/sparc/arch.ml
+++ b/asmcomp/sparc/arch.ml
@@ -13,7 +13,7 @@
(* Specific operations for the Sparc processor *)
-open Format
+open Formatmsg
type specific_operation = unit (* None worth mentioning *)
diff --git a/boot/ocamlc b/boot/ocamlc
index f2bb57fe4f..2ee53c3f08 100755
--- a/boot/ocamlc
+++ b/boot/ocamlc
Binary files differ
diff --git a/boot/ocamllex b/boot/ocamllex
index 480a0bed81..fca3f24bdf 100755
--- a/boot/ocamllex
+++ b/boot/ocamllex
Binary files differ
diff --git a/bytecomp/bytelibrarian.ml b/bytecomp/bytelibrarian.ml
index 200e0dc14b..b5a1e89418 100644
--- a/bytecomp/bytelibrarian.ml
+++ b/bytecomp/bytelibrarian.ml
@@ -82,7 +82,7 @@ let create_archive file_list lib_name =
remove_file lib_name;
raise x
-open Format
+open Formatmsg
let report_error = function
File_not_found name ->
diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
index ea78706bf1..20b836d89c 100644
--- a/bytecomp/bytelink.ml
+++ b/bytecomp/bytelink.ml
@@ -517,7 +517,7 @@ let link objfiles =
(* Error report *)
-open Format
+open Formatmsg
let report_error = function
File_not_found name ->
diff --git a/bytecomp/printinstr.ml b/bytecomp/printinstr.ml
index efebb828e5..e883d15c55 100644
--- a/bytecomp/printinstr.ml
+++ b/bytecomp/printinstr.ml
@@ -13,7 +13,7 @@
(* Pretty-print lists of instructions *)
-open Format
+open Formatmsg
open Lambda
open Instruct
diff --git a/bytecomp/printlambda.ml b/bytecomp/printlambda.ml
index cdf4be7876..e2e5300034 100644
--- a/bytecomp/printlambda.ml
+++ b/bytecomp/printlambda.ml
@@ -11,7 +11,7 @@
(* $Id$ *)
-open Format
+open Formatmsg
open Asttypes
open Primitive
open Types
diff --git a/bytecomp/simplif.ml b/bytecomp/simplif.ml
index 87a6735c9c..98391b87f4 100644
--- a/bytecomp/simplif.ml
+++ b/bytecomp/simplif.ml
@@ -82,7 +82,6 @@ let rec eliminate_ref id = function
(* Simplification of lets *)
-open Format
let simplify_lambda lam =
(* First pass: count the occurrences of all identifiers *)
let occ = Hashtbl.create 83 in
diff --git a/bytecomp/symtable.ml b/bytecomp/symtable.ml
index b64b1fe3b9..6dcec6afe9 100644
--- a/bytecomp/symtable.ml
+++ b/bytecomp/symtable.ml
@@ -292,7 +292,7 @@ let filter_global_map p gmap =
(* Error report *)
-open Format
+open Formatmsg
let report_error = function
Undefined_global s ->
diff --git a/bytecomp/translclass.ml b/bytecomp/translclass.ml
index fd25013307..c65bf53ab8 100644
--- a/bytecomp/translclass.ml
+++ b/bytecomp/translclass.ml
@@ -314,7 +314,7 @@ let class_stub =
(* Error report *)
-open Format
+open Formatmsg
let report_error = function
Illegal_class_expr ->
diff --git a/bytecomp/translcore.ml b/bytecomp/translcore.ml
index 15395e2106..a8427cdf49 100644
--- a/bytecomp/translcore.ml
+++ b/bytecomp/translcore.ml
@@ -602,7 +602,7 @@ let transl_exception id path decl =
(* Error report *)
-open Format
+open Formatmsg
let report_error = function
Illegal_letrec_pat ->
diff --git a/debugger/.depend b/debugger/.depend
index 62074d6ca2..c35f63289d 100644
--- a/debugger/.depend
+++ b/debugger/.depend
@@ -30,44 +30,44 @@ checkpoints.cmo: debugcom.cmi primitives.cmi checkpoints.cmi
checkpoints.cmx: debugcom.cmx primitives.cmx checkpoints.cmi
command_line.cmo: breakpoints.cmi checkpoints.cmi ../utils/config.cmi \
../typing/ctype.cmi debugcom.cmi debugger_config.cmi envaux.cmi eval.cmi \
- events.cmi frames.cmi history.cmi input_handling.cmi \
- ../bytecomp/instruct.cmi ../parsing/lexer.cmi loadprinter.cmi \
- ../utils/misc.cmi parameters.cmi parser.cmi parser_aux.cmi primitives.cmi \
- printval.cmi program_loading.cmi program_management.cmi \
- show_information.cmi show_source.cmi source.cmi symbols.cmi \
- time_travel.cmi ../typing/types.cmi ../otherlibs/unix/unix.cmi \
- unix_tools.cmi command_line.cmi
+ events.cmi ../utils/formatmsg.cmi frames.cmi history.cmi \
+ input_handling.cmi ../bytecomp/instruct.cmi ../parsing/lexer.cmi \
+ loadprinter.cmi ../utils/misc.cmi parameters.cmi parser.cmi \
+ parser_aux.cmi primitives.cmi printval.cmi program_loading.cmi \
+ program_management.cmi show_information.cmi show_source.cmi source.cmi \
+ symbols.cmi time_travel.cmi ../typing/types.cmi \
+ ../otherlibs/unix/unix.cmi unix_tools.cmi command_line.cmi
command_line.cmx: breakpoints.cmx checkpoints.cmx ../utils/config.cmx \
../typing/ctype.cmx debugcom.cmx debugger_config.cmx envaux.cmx eval.cmx \
- events.cmx frames.cmx history.cmx input_handling.cmx \
- ../bytecomp/instruct.cmx ../parsing/lexer.cmx loadprinter.cmx \
- ../utils/misc.cmx parameters.cmx parser.cmx parser_aux.cmi primitives.cmx \
- printval.cmx program_loading.cmx program_management.cmx \
- show_information.cmx show_source.cmx source.cmx symbols.cmx \
- time_travel.cmx ../typing/types.cmx ../otherlibs/unix/unix.cmx \
- unix_tools.cmx command_line.cmi
+ events.cmx ../utils/formatmsg.cmx frames.cmx history.cmx \
+ input_handling.cmx ../bytecomp/instruct.cmx ../parsing/lexer.cmx \
+ loadprinter.cmx ../utils/misc.cmx parameters.cmx parser.cmx \
+ parser_aux.cmi primitives.cmx printval.cmx program_loading.cmx \
+ program_management.cmx show_information.cmx show_source.cmx source.cmx \
+ symbols.cmx time_travel.cmx ../typing/types.cmx \
+ ../otherlibs/unix/unix.cmx unix_tools.cmx command_line.cmi
debugcom.cmo: input_handling.cmi ../utils/misc.cmi primitives.cmi \
debugcom.cmi
debugcom.cmx: input_handling.cmx ../utils/misc.cmx primitives.cmx \
debugcom.cmi
debugger_config.cmo: debugger_config.cmi
debugger_config.cmx: debugger_config.cmi
-envaux.cmo: ../typing/env.cmi ../bytecomp/instruct.cmi ../utils/misc.cmi \
- ../typing/mtype.cmi ../typing/path.cmi ../typing/printtyp.cmi \
- ../typing/types.cmi envaux.cmi
-envaux.cmx: ../typing/env.cmx ../bytecomp/instruct.cmx ../utils/misc.cmx \
- ../typing/mtype.cmx ../typing/path.cmx ../typing/printtyp.cmx \
- ../typing/types.cmx envaux.cmi
+envaux.cmo: ../typing/env.cmi ../utils/formatmsg.cmi ../bytecomp/instruct.cmi \
+ ../utils/misc.cmi ../typing/mtype.cmi ../typing/path.cmi \
+ ../typing/printtyp.cmi ../typing/types.cmi envaux.cmi
+envaux.cmx: ../typing/env.cmx ../utils/formatmsg.cmx ../bytecomp/instruct.cmx \
+ ../utils/misc.cmx ../typing/mtype.cmx ../typing/path.cmx \
+ ../typing/printtyp.cmx ../typing/types.cmx envaux.cmi
eval.cmo: ../typing/btype.cmi ../typing/ctype.cmi debugcom.cmi \
- debugger_config.cmi ../typing/env.cmi frames.cmi ../typing/ident.cmi \
- ../bytecomp/instruct.cmi ../parsing/longident.cmi ../utils/misc.cmi \
- parser_aux.cmi ../typing/path.cmi ../typing/predef.cmi \
+ debugger_config.cmi ../typing/env.cmi ../utils/formatmsg.cmi frames.cmi \
+ ../typing/ident.cmi ../bytecomp/instruct.cmi ../parsing/longident.cmi \
+ ../utils/misc.cmi parser_aux.cmi ../typing/path.cmi ../typing/predef.cmi \
../typing/printtyp.cmi printval.cmi ../bytecomp/symtable.cmi \
../typing/types.cmi eval.cmi
eval.cmx: ../typing/btype.cmx ../typing/ctype.cmx debugcom.cmx \
- debugger_config.cmx ../typing/env.cmx frames.cmx ../typing/ident.cmx \
- ../bytecomp/instruct.cmx ../parsing/longident.cmx ../utils/misc.cmx \
- parser_aux.cmi ../typing/path.cmx ../typing/predef.cmx \
+ debugger_config.cmx ../typing/env.cmx ../utils/formatmsg.cmx frames.cmx \
+ ../typing/ident.cmx ../bytecomp/instruct.cmx ../parsing/longident.cmx \
+ ../utils/misc.cmx parser_aux.cmi ../typing/path.cmx ../typing/predef.cmx \
../typing/printtyp.cmx printval.cmx ../bytecomp/symtable.cmx \
../typing/types.cmx eval.cmi
events.cmo: checkpoints.cmi ../bytecomp/instruct.cmi primitives.cmi \
@@ -91,15 +91,15 @@ input_handling.cmx: ../parsing/lexer.cmx primitives.cmx \
lexer.cmo: parser.cmi primitives.cmi
lexer.cmx: parser.cmx primitives.cmx
loadprinter.cmo: ../utils/config.cmi ../typing/ctype.cmi debugger_config.cmi \
- ../otherlibs/dynlink/dynlink.cmi ../typing/env.cmi ../typing/ident.cmi \
- ../parsing/longident.cmi ../utils/misc.cmi ../typing/path.cmi \
- ../typing/predef.cmi ../typing/printtyp.cmi printval.cmi \
- ../bytecomp/symtable.cmi ../typing/types.cmi loadprinter.cmi
+ ../otherlibs/dynlink/dynlink.cmi ../typing/env.cmi ../utils/formatmsg.cmi \
+ ../typing/ident.cmi ../parsing/longident.cmi ../utils/misc.cmi \
+ ../typing/path.cmi ../typing/predef.cmi ../typing/printtyp.cmi \
+ printval.cmi ../bytecomp/symtable.cmi ../typing/types.cmi loadprinter.cmi
loadprinter.cmx: ../utils/config.cmx ../typing/ctype.cmx debugger_config.cmx \
- ../otherlibs/dynlink/dynlink.cmx ../typing/env.cmx ../typing/ident.cmx \
- ../parsing/longident.cmx ../utils/misc.cmx ../typing/path.cmx \
- ../typing/predef.cmx ../typing/printtyp.cmx printval.cmx \
- ../bytecomp/symtable.cmx ../typing/types.cmx loadprinter.cmi
+ ../otherlibs/dynlink/dynlink.cmx ../typing/env.cmx ../utils/formatmsg.cmx \
+ ../typing/ident.cmx ../parsing/longident.cmx ../utils/misc.cmx \
+ ../typing/path.cmx ../typing/predef.cmx ../typing/printtyp.cmx \
+ printval.cmx ../bytecomp/symtable.cmx ../typing/types.cmx loadprinter.cmi
main.cmo: checkpoints.cmi command_line.cmi ../utils/config.cmi \
debugger_config.cmi exec.cmi frames.cmi input_handling.cmi \
../utils/misc.cmi parameters.cmi primitives.cmi program_management.cmi \
@@ -124,12 +124,12 @@ pattern_matching.cmx: ../typing/ctype.cmx debugcom.cmx debugger_config.cmx \
pattern_matching.cmi
primitives.cmo: ../otherlibs/unix/unix.cmi primitives.cmi
primitives.cmx: ../otherlibs/unix/unix.cmx primitives.cmi
-printval.cmo: debugcom.cmi ../toplevel/genprintval.cmi ../utils/misc.cmi \
- parser_aux.cmi ../typing/path.cmi ../typing/printtyp.cmi \
- ../typing/types.cmi printval.cmi
-printval.cmx: debugcom.cmx ../toplevel/genprintval.cmx ../utils/misc.cmx \
- parser_aux.cmi ../typing/path.cmx ../typing/printtyp.cmx \
- ../typing/types.cmx printval.cmi
+printval.cmo: debugcom.cmi ../utils/formatmsg.cmi ../toplevel/genprintval.cmi \
+ ../utils/misc.cmi parser_aux.cmi ../typing/path.cmi \
+ ../typing/printtyp.cmi ../typing/types.cmi printval.cmi
+printval.cmx: debugcom.cmx ../utils/formatmsg.cmx ../toplevel/genprintval.cmx \
+ ../utils/misc.cmx parser_aux.cmi ../typing/path.cmx \
+ ../typing/printtyp.cmx ../typing/types.cmx printval.cmi
program_loading.cmo: debugger_config.cmi input_handling.cmi ../utils/misc.cmi \
parameters.cmi primitives.cmi ../otherlibs/unix/unix.cmi unix_tools.cmi \
program_loading.cmi
@@ -147,11 +147,13 @@ program_management.cmx: breakpoints.cmx debugcom.cmx debugger_config.cmx \
time_travel.cmx ../otherlibs/unix/unix.cmx unix_tools.cmx \
program_management.cmi
show_information.cmo: breakpoints.cmi checkpoints.cmi debugcom.cmi events.cmi \
- frames.cmi ../bytecomp/instruct.cmi ../utils/misc.cmi primitives.cmi \
- printval.cmi show_source.cmi symbols.cmi show_information.cmi
+ ../utils/formatmsg.cmi frames.cmi ../bytecomp/instruct.cmi \
+ ../utils/misc.cmi primitives.cmi printval.cmi show_source.cmi symbols.cmi \
+ show_information.cmi
show_information.cmx: breakpoints.cmx checkpoints.cmx debugcom.cmx events.cmx \
- frames.cmx ../bytecomp/instruct.cmx ../utils/misc.cmx primitives.cmx \
- printval.cmx show_source.cmx symbols.cmx show_information.cmi
+ ../utils/formatmsg.cmx frames.cmx ../bytecomp/instruct.cmx \
+ ../utils/misc.cmx primitives.cmx printval.cmx show_source.cmx symbols.cmx \
+ show_information.cmi
show_source.cmo: debugger_config.cmi ../utils/misc.cmi parameters.cmi \
primitives.cmi source.cmi show_source.cmi
show_source.cmx: debugger_config.cmx ../utils/misc.cmx parameters.cmx \
diff --git a/debugger/Makefile b/debugger/Makefile
index 93dbc35a1a..4e7738d0da 100644
--- a/debugger/Makefile
+++ b/debugger/Makefile
@@ -15,7 +15,7 @@ INCLUDES=\
OTHEROBJS=\
../otherlibs/unix/unix.cma \
- ../utils/misc.cmo ../utils/config.cmo \
+ ../utils/misc.cmo ../utils/formatmsg.cmo ../utils/config.cmo \
../utils/tbl.cmo ../utils/clflags.cmo \
../parsing/longident.cmo \
../typing/ident.cmo ../typing/path.cmo ../typing/types.cmo \
diff --git a/debugger/command_line.ml b/debugger/command_line.ml
index 43fcd1b6d8..33a519d475 100644
--- a/debugger/command_line.ml
+++ b/debugger/command_line.ml
@@ -14,7 +14,7 @@
(************************ Reading and executing commands ***************)
-open Format
+open Formatmsg
open Misc
open Instruct
open Unix
diff --git a/debugger/envaux.ml b/debugger/envaux.ml
index 89e79c8290..e19775d7c3 100644
--- a/debugger/envaux.ml
+++ b/debugger/envaux.ml
@@ -75,7 +75,7 @@ let env_of_event =
(* Error report *)
-open Format
+open Formatmsg
let report_error error =
open_box 0;
diff --git a/debugger/eval.ml b/debugger/eval.ml
index 0d79716347..4850ad3572 100644
--- a/debugger/eval.ml
+++ b/debugger/eval.ml
@@ -159,7 +159,7 @@ and find_label lbl env ty path tydesc pos = function
(* Error report *)
-open Format
+open Formatmsg
let report_error error =
open_box 0;
diff --git a/debugger/loadprinter.ml b/debugger/loadprinter.ml
index aaf48a2594..f77591256e 100644
--- a/debugger/loadprinter.ml
+++ b/debugger/loadprinter.ml
@@ -55,7 +55,7 @@ let use_debugger_symtable fn arg =
(* Load a .cmo or .cma file *)
-open Format
+open Formatmsg
let rec loadfiles name =
try
@@ -127,7 +127,7 @@ let remove_printer lid =
(* Error report *)
-open Format
+open Formatmsg
let report_error error =
open_box 0;
diff --git a/debugger/printval.ml b/debugger/printval.ml
index 56ca2a8884..f751e75cf3 100644
--- a/debugger/printval.ml
+++ b/debugger/printval.ml
@@ -16,7 +16,7 @@
open Misc
open Obj
-open Format
+open Formatmsg
open Parser_aux
open Path
open Types
diff --git a/debugger/show_information.ml b/debugger/show_information.ml
index 47c25a2b81..487fdacb55 100644
--- a/debugger/show_information.ml
+++ b/debugger/show_information.ml
@@ -13,7 +13,7 @@
(* $Id$ *)
open Instruct
-open Format
+open Formatmsg
open Primitives
open Debugcom
open Checkpoints
diff --git a/driver/compile.ml b/driver/compile.ml
index 471306deb7..9f08a21778 100644
--- a/driver/compile.ml
+++ b/driver/compile.ml
@@ -15,7 +15,7 @@
open Misc
open Config
-open Format
+open Formatmsg
open Typedtree
(* Initialize the search path.
diff --git a/driver/errors.ml b/driver/errors.ml
index 2c3644ccbf..6f84ffcade 100644
--- a/driver/errors.ml
+++ b/driver/errors.ml
@@ -13,7 +13,7 @@
(* Error report *)
-open Format
+open Formatmsg
open Location
(* Report an error *)
diff --git a/driver/main.ml b/driver/main.ml
index 0a35df99ad..199a7133ed 100644
--- a/driver/main.ml
+++ b/driver/main.ml
@@ -88,7 +88,7 @@ module Options = Main_args.Make_options (struct
end)
let main () =
- Format.set_formatter_out_channel stderr;
+ Formatmsg.set_output Format.err_formatter;
try
Arg.parse Options.list process_file usage;
if !make_archive then begin
diff --git a/driver/optcompile.ml b/driver/optcompile.ml
index 4e52291570..743256c16e 100644
--- a/driver/optcompile.ml
+++ b/driver/optcompile.ml
@@ -15,7 +15,7 @@
open Misc
open Config
-open Format
+open Formatmsg
open Typedtree
(* Initialize the search path.
diff --git a/driver/opterrors.ml b/driver/opterrors.ml
index dc9ec436c9..c729ef8963 100644
--- a/driver/opterrors.ml
+++ b/driver/opterrors.ml
@@ -13,7 +13,7 @@
(* Error report *)
-open Format
+open Formatmsg
open Location
(* Report an error *)
diff --git a/driver/optmain.ml b/driver/optmain.ml
index 53be3e3ee2..a4aaa1a522 100644
--- a/driver/optmain.ml
+++ b/driver/optmain.ml
@@ -54,7 +54,7 @@ let usage = "Usage: ocamlopt <options> <files>\nOptions are:"
let main () =
native_code := true;
c_compiler := Config.native_c_compiler;
- Format.set_formatter_out_channel stderr;
+ Formatmsg.set_output Format.err_formatter;
try
Arg.parse [
"-a", Arg.Set make_archive, " Build a library";
diff --git a/otherlibs/dynlink/Makefile b/otherlibs/dynlink/Makefile
index 8e97f2feff..90770b82ee 100644
--- a/otherlibs/dynlink/Makefile
+++ b/otherlibs/dynlink/Makefile
@@ -7,7 +7,8 @@ INCLUDES=-I ../../utils -I ../../typing -I ../../bytecomp
COMPFLAGS=-I ../../stdlib $(INCLUDES)
OBJS=dynlink.cmo
-COMPILEROBJS=misc.cmo config.cmo tbl.cmo clflags.cmo ident.cmo path.cmo \
+COMPILEROBJS=misc.cmo config.cmo formatmsg.cmo tbl.cmo clflags.cmo \
+ ident.cmo path.cmo \
types.cmo btype.cmo predef.cmo runtimedef.cmo symtable.cmo \
opcodes.cmo meta.cmo
diff --git a/otherlibs/dynlink/Makefile.Mac b/otherlibs/dynlink/Makefile.Mac
index 3f4f17be1c..5f1f79a862 100644
--- a/otherlibs/dynlink/Makefile.Mac
+++ b/otherlibs/dynlink/Makefile.Mac
@@ -5,7 +5,8 @@ INCLUDES = -I :::utils: -I :::typing: -I :::bytecomp:
COMPFLAGS = -I :::stdlib: {INCLUDES}
OBJS = dynlink.cmo
-COMPILEROBJS = misc.cmo config.cmo tbl.cmo clflags.cmo ident.cmo path.cmo ¶
+COMPILEROBJS = misc.cmo config.cmo formatmsg.cmo tbl.cmo ¶
+ clflags.cmo ident.cmo path.cmo ¶
types.cmo btype.cmo predef.cmo runtimedef.cmo symtable.cmo opcodes.cmo
all Ä dynlink.cma extract_crc
diff --git a/otherlibs/dynlink/Makefile.nt b/otherlibs/dynlink/Makefile.nt
index 88a5fa30a1..3b8838bde5 100644
--- a/otherlibs/dynlink/Makefile.nt
+++ b/otherlibs/dynlink/Makefile.nt
@@ -7,7 +7,8 @@ INCLUDES=-I ..\..\utils -I ..\..\typing -I ..\..\bytecomp
COMPFLAGS=-I ..\..\stdlib $(INCLUDES)
OBJS=dynlink.cmo
-COMPILEROBJS=misc.cmo config.cmo tbl.cmo clflags.cmo ident.cmo path.cmo \
+COMPILEROBJS=misc.cmo config.cmo formatmsg.cmo tbl.cmo \
+ clflags.cmo ident.cmo path.cmo \
types.cmo btype.cmo predef.cmo runtimedef.cmo symtable.cmo opcodes.cmo
all: dynlink.cma extract_crc
diff --git a/parsing/lexer.mll b/parsing/lexer.mll
index cbdc6c7d48..cda668d7b3 100644
--- a/parsing/lexer.mll
+++ b/parsing/lexer.mll
@@ -148,7 +148,7 @@ and comment_start_pos = ref []
(* Error report *)
-open Format
+open Formatmsg
let report_error = function
Illegal_character ->
diff --git a/parsing/location.ml b/parsing/location.ml
index a0a52bfc0d..1bdc67f136 100644
--- a/parsing/location.ml
+++ b/parsing/location.ml
@@ -90,7 +90,7 @@ let rec highlight_locations loc1 loc2 =
(* Print the location in some way or another *)
-open Format
+open Formatmsg
let reset () =
num_loc_lines := 0
diff --git a/parsing/syntaxerr.ml b/parsing/syntaxerr.ml
index 5b37456a10..919e820f7a 100644
--- a/parsing/syntaxerr.ml
+++ b/parsing/syntaxerr.ml
@@ -13,7 +13,7 @@
(* Auxiliary type for reporting syntax errors *)
-open Format
+open Formatmsg
type error =
Unclosed of Location.t * string * Location.t * string
diff --git a/tools/.depend b/tools/.depend
index a89e49d286..5a66972dc9 100644
--- a/tools/.depend
+++ b/tools/.depend
@@ -12,18 +12,20 @@ objinfo.cmo: ../utils/config.cmi ../bytecomp/emitcode.cmi
objinfo.cmx: ../utils/config.cmx ../bytecomp/emitcode.cmx
ocamlcp.cmo: ../driver/main_args.cmi
ocamlcp.cmx: ../driver/main_args.cmx
-ocamldep.cmo: ../parsing/lexer.cmi ../parsing/location.cmi \
- ../parsing/longident.cmi ../utils/misc.cmi ../parsing/parse.cmi \
- ../parsing/parsetree.cmi ../parsing/syntaxerr.cmi
-ocamldep.cmx: ../parsing/lexer.cmx ../parsing/location.cmx \
- ../parsing/longident.cmx ../utils/misc.cmx ../parsing/parse.cmx \
- ../parsing/parsetree.cmi ../parsing/syntaxerr.cmx
-ocamlprof.cmo: ../utils/clflags.cmo ../utils/config.cmi ../parsing/lexer.cmi \
- ../parsing/location.cmi ../utils/misc.cmi ../parsing/parse.cmi \
- ../parsing/parsetree.cmi ../parsing/syntaxerr.cmi
-ocamlprof.cmx: ../utils/clflags.cmx ../utils/config.cmx ../parsing/lexer.cmx \
- ../parsing/location.cmx ../utils/misc.cmx ../parsing/parse.cmx \
- ../parsing/parsetree.cmi ../parsing/syntaxerr.cmx
+ocamldep.cmo: ../utils/formatmsg.cmi ../parsing/lexer.cmi \
+ ../parsing/location.cmi ../parsing/longident.cmi ../utils/misc.cmi \
+ ../parsing/parse.cmi ../parsing/parsetree.cmi ../parsing/syntaxerr.cmi
+ocamldep.cmx: ../utils/formatmsg.cmx ../parsing/lexer.cmx \
+ ../parsing/location.cmx ../parsing/longident.cmx ../utils/misc.cmx \
+ ../parsing/parse.cmx ../parsing/parsetree.cmi ../parsing/syntaxerr.cmx
+ocamlprof.cmo: ../utils/clflags.cmo ../utils/config.cmi \
+ ../utils/formatmsg.cmi ../parsing/lexer.cmi ../parsing/location.cmi \
+ ../utils/misc.cmi ../parsing/parse.cmi ../parsing/parsetree.cmi \
+ ../parsing/syntaxerr.cmi
+ocamlprof.cmx: ../utils/clflags.cmx ../utils/config.cmx \
+ ../utils/formatmsg.cmx ../parsing/lexer.cmx ../parsing/location.cmx \
+ ../utils/misc.cmx ../parsing/parse.cmx ../parsing/parsetree.cmi \
+ ../parsing/syntaxerr.cmx
primreq.cmo: ../utils/config.cmi ../bytecomp/emitcode.cmi
primreq.cmx: ../utils/config.cmx ../bytecomp/emitcode.cmx
profiling.cmo: profiling.cmi
diff --git a/tools/Makefile b/tools/Makefile
index fe9f790219..77ef4f1238 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -13,7 +13,7 @@ all: ocamldep ocamlprof ocamlcp ocamlmktop
# The dependency generator
CAMLDEP=ocamldep.cmo
-CAMLDEP_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
+CAMLDEP_IMPORTS=misc.cmo formatmsg.cmo config.cmo clflags.cmo terminfo.cmo \
linenum.cmo warnings.cmo location.cmo longident.cmo pstream.cmo \
syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
@@ -29,7 +29,7 @@ install::
# The profiler
CSLPROF=ocamlprof.cmo
-CSLPROF_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
+CSLPROF_IMPORTS=misc.cmo formatmsg.cmo config.cmo clflags.cmo terminfo.cmo \
linenum.cmo warnings.cmo location.cmo longident.cmo pstream.cmo \
syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
diff --git a/tools/Makefile.Mac b/tools/Makefile.Mac
index c8cf27ceac..98a635cd26 100644
--- a/tools/Makefile.Mac
+++ b/tools/Makefile.Mac
@@ -9,7 +9,7 @@ all Ä ocamldep
# The dependency generator
-CAMLDEP_IMPORTS = misc.cmo config.cmo clflags.cmo terminfo.cmo ¶
+CAMLDEP_IMPORTS = misc.cmo formatmsg.cmo config.cmo clflags.cmo terminfo.cmo ¶
linenum.cmo warnings.cmo location.cmo longident.cmo pstream.cmo ¶
syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
@@ -27,7 +27,7 @@ install ÄÄ
# The profiler (not available on the Mac for the moment)
#
#CSLPROF = ocamlprof.cmo
-#CSLPROF_IMPORTS = misc.cmo config.cmo clflags.cmo terminfo.cmo ¶
+#CSLPROF_IMPORTS = misc.cmo formatmsg.cmo config.cmo clflags.cmo terminfo.cmo ¶
# linenum.cmo warnings.cmo location.cmo longident.cmo pstream.cmo ¶
# syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
#
diff --git a/tools/Makefile.nt b/tools/Makefile.nt
index b043ceec71..fa78ae35ed 100644
--- a/tools/Makefile.nt
+++ b/tools/Makefile.nt
@@ -13,7 +13,7 @@ all: ocamldep ocamlprof ocamlcp.exe ocamlmktop.exe primreq
# The dependency generator
CAMLDEP=ocamldep.cmo
-CAMLDEP_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
+CAMLDEP_IMPORTS=misc.cmo formatmsg.cmo config.cmo clflags.cmo terminfo.cmo \
linenum.cmo warnings.cmo location.cmo longident.cmo pstream.cmo \
syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
@@ -31,7 +31,7 @@ beforedepend:: ocamldep.ml
# The profiler
CSLPROF=ocamlprof.cmo
-CSLPROF_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
+CSLPROF_IMPORTS=misc.cmo formatmsg.cmo config.cmo clflags.cmo terminfo.cmo \
linenum.cmo warnings.cmo location.cmo longident.cmo pstream.cmo \
syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml
index a28d1105bf..5a84f334b3 100644
--- a/tools/ocamldep.ml
+++ b/tools/ocamldep.ml
@@ -11,6 +11,7 @@
(* $Id$ *)
+open Formatmsg
open Location
open Longident
open Parsetree
@@ -328,8 +329,8 @@ let file_dependencies source_file =
with x ->
close_in ic; raise x
with x ->
- Format.set_formatter_out_channel stderr;
- Format.open_box 0;
+ set_output Format.err_formatter;
+ open_box 0;
begin match x with
Lexer.Error(err, start, stop) ->
Location.print {loc_start = start; loc_end = stop; loc_ghost = false};
@@ -337,11 +338,11 @@ let file_dependencies source_file =
| Syntaxerr.Error err ->
Syntaxerr.report_error err
| Sys_error msg ->
- Format.print_string "I/O error: "; Format.print_string msg
+ print_string "I/O error: "; print_string msg
| _ ->
- Format.close_box(); raise x
+ close_box(); raise x
end;
- Format.close_box(); Format.print_newline();
+ close_box(); print_newline();
error_occurred := true
end
diff --git a/tools/ocamlprof.ml b/tools/ocamlprof.ml
index eec1ca99f7..089ae8b7c7 100644
--- a/tools/ocamlprof.ml
+++ b/tools/ocamlprof.ml
@@ -424,7 +424,7 @@ let process_file filename =
(* Main function *)
-open Format
+open Formatmsg
let usage = "Usage: ocamlprof <options> <files>\noptions are:"
@@ -440,7 +440,7 @@ let main () =
] process_file usage;
exit 0
with x ->
- set_formatter_out_channel stderr;
+ set_output Format.err_formatter;
open_box 0;
begin match x with
Lexer.Error(err, start, stop) ->
diff --git a/toplevel/genprintval.ml b/toplevel/genprintval.ml
index 9df142a245..7b73ba6ab9 100644
--- a/toplevel/genprintval.ml
+++ b/toplevel/genprintval.ml
@@ -14,7 +14,7 @@
(* To print values *)
open Misc
-open Format
+open Formatmsg
open Longident
open Path
open Types
diff --git a/toplevel/topdirs.ml b/toplevel/topdirs.ml
index 3437f68977..d1e49742e0 100644
--- a/toplevel/topdirs.ml
+++ b/toplevel/topdirs.ml
@@ -13,7 +13,7 @@
(* Toplevel directives *)
-open Format
+open Formatmsg
open Misc
open Longident
open Path
diff --git a/toplevel/toploop.ml b/toplevel/toploop.ml
index 4551f64653..60d7b34b7a 100644
--- a/toplevel/toploop.ml
+++ b/toplevel/toploop.ml
@@ -14,7 +14,7 @@
(* The interactive toplevel loop *)
open Lexing
-open Format
+open Formatmsg
open Config
open Misc
open Parsetree
@@ -313,5 +313,5 @@ let loop() =
let run_script name =
Compile.init_path();
toplevel_env := Compile.initial_env();
- Format.set_formatter_out_channel stderr;
+ Formatmsg.set_output Format.err_formatter;
use_silently name
diff --git a/toplevel/trace.ml b/toplevel/trace.ml
index bf8e1550e1..ce5caace0d 100644
--- a/toplevel/trace.ml
+++ b/toplevel/trace.ml
@@ -13,7 +13,7 @@
(* The "trace" facility *)
-open Format
+open Formatmsg
open Misc
open Longident
open Types
diff --git a/typing/env.ml b/typing/env.ml
index 7833eb0253..cd4b193ffd 100644
--- a/typing/env.ml
+++ b/typing/env.ml
@@ -13,7 +13,7 @@
(* Environment handling *)
-open Format
+open Formatmsg
open Config
open Misc
open Asttypes
diff --git a/typing/ident.ml b/typing/ident.ml
index a9529f0936..38c3cba8c9 100644
--- a/typing/ident.ml
+++ b/typing/ident.ml
@@ -11,7 +11,7 @@
(* $Id$ *)
-open Format
+open Formatmsg
type t = { stamp: int; name: string; mutable global: bool }
diff --git a/typing/includeclass.ml b/typing/includeclass.ml
index abb4d7d4b5..4af396936c 100644
--- a/typing/includeclass.ml
+++ b/typing/includeclass.ml
@@ -32,7 +32,7 @@ let class_declarations env cty1 cty2 =
cty1.cty_params cty1.cty_type
cty2.cty_params cty2.cty_type
-open Format
+open Formatmsg
open Ctype
let include_err =
diff --git a/typing/includemod.ml b/typing/includemod.ml
index 98a434e3d8..b7cf0f2ca5 100644
--- a/typing/includemod.ml
+++ b/typing/includemod.ml
@@ -314,7 +314,7 @@ let type_declarations env id decl1 decl2 =
(* Error report *)
-open Format
+open Formatmsg
open Printtyp
let include_err = function
diff --git a/typing/primitive.ml b/typing/primitive.ml
index 73914135c0..f26d9de956 100644
--- a/typing/primitive.ml
+++ b/typing/primitive.ml
@@ -14,7 +14,7 @@
(* Description of primitive functions *)
open Misc
-open Format
+open Formatmsg
type description =
{ prim_name: string; (* Name of primitive or C function *)
diff --git a/typing/printtyp.ml b/typing/printtyp.ml
index 4796d2ea01..f9af1a8e11 100644
--- a/typing/printtyp.ml
+++ b/typing/printtyp.ml
@@ -15,7 +15,7 @@
open Misc
open Ctype
-open Format
+open Formatmsg
open Longident
open Path
open Asttypes
diff --git a/typing/typeclass.ml b/typing/typeclass.ml
index 00c66c250d..33888a5e41 100644
--- a/typing/typeclass.ml
+++ b/typing/typeclass.ml
@@ -952,7 +952,7 @@ let class_type_declarations env cls =
(* Error report *)
-open Format
+open Formatmsg
let report_error = function
| Repeated_parameter ->
diff --git a/typing/typecore.ml b/typing/typecore.ml
index 3a38e5dde1..de99b37bc4 100644
--- a/typing/typecore.ml
+++ b/typing/typecore.ml
@@ -902,7 +902,7 @@ let type_expression env sexp =
(* Error report *)
-open Format
+open Formatmsg
open Printtyp
let report_error = function
diff --git a/typing/typedecl.ml b/typing/typedecl.ml
index 3ffd6b05cc..6cf224fc01 100644
--- a/typing/typedecl.ml
+++ b/typing/typedecl.ml
@@ -319,7 +319,7 @@ let transl_with_constraint env sdecl =
(**** Error report ****)
-open Format
+open Formatmsg
let report_error = function
Repeated_parameter ->
diff --git a/typing/typemod.ml b/typing/typemod.ml
index db7bf7fcad..492c7ebf29 100644
--- a/typing/typemod.ml
+++ b/typing/typemod.ml
@@ -466,10 +466,8 @@ let _ =
let type_implementation sourcefile prefixname modulename initial_env ast =
let (str, sg, finalenv) = type_structure initial_env ast in
if !Clflags.print_types then begin
- let (f1, f2) = Format.get_formatter_output_functions() in
- Format.set_formatter_out_channel stdout;
- Printtyp.signature sg; Format.print_newline();
- Format.set_formatter_output_functions f1 f2
+ Formatmsg.with_output_to Format.std_formatter
+ (fun () -> Printtyp.signature sg; Format.print_newline())
end;
let coercion =
if Sys.file_exists (prefixname ^ !Config.interface_suffix) then begin
@@ -487,7 +485,7 @@ let type_implementation sourcefile prefixname modulename initial_env ast =
(* Error report *)
-open Format
+open Formatmsg
open Printtyp
let report_error = function
diff --git a/typing/typetexp.ml b/typing/typetexp.ml
index 4520d94c23..f9ee2a86b1 100644
--- a/typing/typetexp.ml
+++ b/typing/typetexp.ml
@@ -232,7 +232,7 @@ let transl_type_scheme env styp =
(* Error report *)
-open Format
+open Formatmsg
open Printtyp
let report_error = function
diff --git a/utils/formatmsg.ml b/utils/formatmsg.ml
new file mode 100644
index 0000000000..f9618653b2
--- /dev/null
+++ b/utils/formatmsg.ml
@@ -0,0 +1,52 @@
+(***********************************************************************)
+(* *)
+(* Objective Caml *)
+(* *)
+(* Xavier Leroy and Jerome Vouillon, projet Cristal, INRIA Rocquencourt*)
+(* *)
+(* Copyright 1996 Institut National de Recherche en Informatique et *)
+(* en Automatique. Distributed only by permission. *)
+(* *)
+(***********************************************************************)
+
+(* $Id$ *)
+
+(* Formatter used for printing the compiler messages *)
+
+open Format
+
+let fmt = ref std_formatter
+
+let open_hbox () = pp_open_hbox !fmt ()
+let open_vbox n = pp_open_vbox !fmt n
+let open_hvbox n = pp_open_hvbox !fmt n
+let open_hovbox n = pp_open_hovbox !fmt n
+let open_box n = pp_open_box !fmt n
+let close_box () = pp_close_box !fmt ()
+let print_string s = pp_print_string !fmt s
+let print_as n s = pp_print_as !fmt n s
+let print_int n = pp_print_int !fmt n
+let print_float f = pp_print_float !fmt f
+let print_char c = pp_print_char !fmt c
+let print_bool b = pp_print_bool !fmt b
+let print_break n1 n2 = pp_print_break !fmt n1 n2
+let print_cut () = pp_print_cut !fmt ()
+let print_space () = pp_print_space !fmt ()
+let force_newline () = pp_force_newline !fmt ()
+let print_flush () = pp_print_flush !fmt ()
+let print_newline () = pp_print_newline !fmt ()
+let printf f = fprintf !fmt f
+
+let set_output f = fmt := f
+
+let with_output_to f fn =
+ let oldf = !fmt in
+ fmt := f;
+ try
+ fn ();
+ fmt := oldf
+ with x ->
+ fmt := oldf;
+ raise x
+
+
diff --git a/utils/formatmsg.mli b/utils/formatmsg.mli
new file mode 100644
index 0000000000..be724ea39c
--- /dev/null
+++ b/utils/formatmsg.mli
@@ -0,0 +1,37 @@
+(***********************************************************************)
+(* *)
+(* Objective Caml *)
+(* *)
+(* Xavier Leroy and Jerome Vouillon, projet Cristal, INRIA Rocquencourt*)
+(* *)
+(* Copyright 1996 Institut National de Recherche en Informatique et *)
+(* en Automatique. Distributed only by permission. *)
+(* *)
+(***********************************************************************)
+
+(* $Id$ *)
+
+(* Formatter used for printing the compiler messages *)
+
+val open_hbox : unit -> unit
+val open_vbox : int -> unit
+val open_hvbox : int -> unit
+val open_hovbox : int -> unit
+val open_box : int -> unit
+val close_box : unit -> unit
+val print_string : string -> unit
+val print_as : int -> string -> unit
+val print_int : int -> unit
+val print_float : float -> unit
+val print_char : char -> unit
+val print_bool : bool -> unit
+val print_break : int -> int -> unit
+val print_cut : unit -> unit
+val print_space : unit -> unit
+val force_newline : unit -> unit
+val print_flush : unit -> unit
+val print_newline : unit -> unit
+val printf : ('a, Format.formatter, unit) format -> 'a;;
+
+val set_output : Format.formatter -> unit
+val with_output_to : Format.formatter -> (unit -> 'a) -> unit
diff --git a/utils/tbl.ml b/utils/tbl.ml
index b1c709bf91..81310d4775 100644
--- a/utils/tbl.ml
+++ b/utils/tbl.ml
@@ -94,7 +94,7 @@ let rec iter f = function
| Node(l, v, d, r, _) ->
iter f l; f v d; iter f r
-open Format
+open Formatmsg
let print print_key print_data tbl =
open_hvbox 2;