diff options
78 files changed, 250 insertions, 154 deletions
@@ -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 \ @@ -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 57c6d74d5..ddb86795c 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 6c4632ce0..e61d44631 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 0974e441c..addc547ea 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 ffd02ac39..78b3f73a5 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 460408ab6..37a182bdb 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 a847d921e..677dd80b3 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 c355f3ede..8bac70d29 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 24dc2517a..8cd4f91b8 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 897e5403d..8896f0f01 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 c41556bd4..df011b177 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 f091648b9..7b067f981 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 877e69aa7..d07db5525 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 c5872840e..4bb70e39d 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 0a25ddc60..4019b1c80 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 3eff0a6e3..0fcbee545 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 aaeff1941..cce4c1740 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 eebcf9170..60804878a 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 be7172749..ae95c284d 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 066a999b0..89f9c9ffd 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 0bfeb3914..c22cce623 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 da223c121..c561279ef 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 c4ba9d5ed..6bd4745ee 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 Binary files differindex f2bb57fe4..2ee53c3f0 100755 --- a/boot/ocamlc +++ b/boot/ocamlc diff --git a/boot/ocamllex b/boot/ocamllex Binary files differindex 480a0bed8..fca3f24bd 100755 --- a/boot/ocamllex +++ b/boot/ocamllex diff --git a/bytecomp/bytelibrarian.ml b/bytecomp/bytelibrarian.ml index 200e0dc14..b5a1e8941 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 ea78706bf..20b836d89 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 efebb828e..e883d15c5 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 cdf4be787..e2e530003 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 87a6735c9..98391b87f 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 b64b1fe3b..6dcec6afe 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 fd2501330..c65bf53ab 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 15395e210..a8427cdf4 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 62074d6ca..c35f63289 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 93dbc35a1..4e7738d0d 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 43fcd1b6d..33a519d47 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 89e79c829..e19775d7c 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 0d7971634..4850ad357 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 aaf48a259..f77591256 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 56ca2a888..f751e75cf 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 47c25a2b8..487fdacb5 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 471306deb..9f08a2177 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 2c3644ccb..6f84ffcad 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 0a35df99a..199a7133e 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 4e5229157..743256c16 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 dc9ec436c..c729ef896 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 53be3e3ee..a4aaa1a52 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 8e97f2fef..90770b82e 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 3f4f17be1..5f1f79a86 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 88a5fa30a..3b8838bde 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 cbdc6c7d4..cda668d7b 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 a0a52bfc0..1bdc67f13 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 5b37456a1..919e820f7 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 a89e49d28..5a66972dc 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 fe9f79021..77ef4f123 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 c8cf27cea..98a635cd2 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 b043ceec7..fa78ae35e 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 a28d1105b..5a84f334b 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 eec1ca99f..089ae8b7c 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 9df142a24..7b73ba6ab 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 3437f6897..d1e49742e 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 4551f6465..60d7b34b7 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 bf8e1550e..ce5caace0 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 7833eb025..cd4b193ff 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 a9529f093..38c3cba8c 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 abb4d7d4b..4af396936 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 98a434e3d..b7cf0f2ca 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 73914135c..f26d9de95 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 4796d2ea0..f9af1a8e1 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 00c66c250..33888a5e4 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 3a38e5dde..de99b37bc 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 3ffd6b05c..6cf224fc0 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 db7bf7fca..492c7ebf2 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 4520d94c2..f9ee2a86b 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 000000000..f9618653b --- /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 000000000..be724ea39 --- /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 b1c709bf9..81310d477 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; |