diff --git a/Changes b/Changes index 29b496587..4188a0ee8 100644 --- a/Changes +++ b/Changes @@ -190,7 +190,7 @@ Compilers: are tail calls. - All compiler error messages now include a file name and location, for better interaction with Emacs' compilation mode. -- Optimized compilation of "lazy e" when the argument "e" is +- Optimized compilation of "lazy e" when the argument "e" is already evaluated. - Optimized compilation of equality tests with a variant constant constructor. - The -dllib options recorded in libraries are no longer ignored when @@ -243,7 +243,7 @@ Other libraries: - Dynlink: on some platforms, the Dynlink library is now available in native code. The boolean Dynlink.is_native allows the program to know whether it has been compiled in bytecode or in native code. -- Bigarrays: added "unsafe_get" and "unsafe_set" +- Bigarrays: added "unsafe_get" and "unsafe_set" (non-bound-checking versions of "get" and "set"). - Bigarrays: removed limitation "array dimension < 2^31". - Labltk: added support for TK 8.5. @@ -274,7 +274,7 @@ Bug fixes: out-of-heap pointers. - PR#3915: updated most man pages. - PR#4261: type-checking of recursive modules -- PR#4308: better stack backtraces for "spontaneous" exceptions such as +- PR#4308: better stack backtraces for "spontaneous" exceptions such as Stack_overflow, Out_of_memory, etc. - PR#4338: Str.global_substitute, Str.global_replace and the Str.*split* functions are now tail-recursive. diff --git a/INSTALL b/INSTALL index ad24f4afe..81855257e 100644 --- a/INSTALL +++ b/INSTALL @@ -78,7 +78,7 @@ The "configure" script accepts the following options: LablTk. "-tkdefs" helps to find the headers, and "-tklibs" the C libraries. "-tklibs" may contain either only -L/path and -Wl,... flags, in which case the library names are determined - automatically, or the actual libraries, which are used as given. + automatically, or the actual libraries, which are used as given. Example: for a Japanese tcl/tk whose headers are in specific directories and libraries in /usr/local/lib, you can use ./configure -tklibs "-L/usr/local/lib -ltk8.0jp -ltcl8.0jp" diff --git a/Makefile b/Makefile index c7cea0d6d..344d14554 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ SHELL=/bin/sh MKDIR=mkdir -p INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver \ - -I toplevel + -I toplevel UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \ utils/clflags.cmo utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \ @@ -192,9 +192,9 @@ coldstart: cd stdlib; $(MAKE) COMPILER=../boot/ocamlc all cd stdlib; cp $(LIBFILES) ../boot if test -f boot/libcamlrun.a; then :; else \ - ln -s ../byterun/libcamlrun.a boot/libcamlrun.a; fi + ln -s ../byterun/libcamlrun.a boot/libcamlrun.a; fi if test -d stdlib/caml; then :; else \ - ln -s ../byterun stdlib/caml; fi + ln -s ../byterun stdlib/caml; fi # Build the core system: the minimum needed to make depend and bootstrap core: coldstart ocamlc ocamllex ocamlyacc ocamltools library @@ -240,7 +240,7 @@ compare: @if cmp boot/ocamlc ocamlc && cmp boot/ocamllex lex/ocamllex \ && cmp boot/ocamldep tools/ocamldep; \ then echo "Fixpoint reached, bootstrap succeeded."; \ - else echo "Fixpoint not reached, try one more bootstrapping cycle."; \ + else echo "Fixpoint not reached, try one more bootstrapping cycle."; \ fi # Remove old bootstrap compilers @@ -262,9 +262,9 @@ opt: # Native-code versions of the tools opt.opt: checkstack runtime core ocaml opt-core ocamlc.opt otherlibraries \ - ocamlbuild.byte camlp4out $(DEBUGGER) ocamldoc ocamlopt.opt \ - otherlibrariesopt \ - ocamllex.opt ocamltoolsopt.opt ocamlbuild.native camlp4opt ocamldoc.opt + ocamlbuild.byte camlp4out $(DEBUGGER) ocamldoc ocamlopt.opt \ + otherlibrariesopt \ + ocamllex.opt ocamltoolsopt.opt ocamlbuild.native camlp4opt ocamldoc.opt # Installation install: @@ -274,8 +274,8 @@ install: if test -d $(MANDIR)/man$(MANEXT); then : ; \ else $(MKDIR) $(MANDIR)/man$(MANEXT); fi cd $(LIBDIR); rm -f dllbigarray.so dlllabltk.so dllnums.so \ - dllthreads.so dllunix.so dllgraphics.so dllmldbm.so dllstr.so \ - dlltkanim.so + dllthreads.so dllunix.so dllgraphics.so dllmldbm.so dllstr.so \ + dlltkanim.so cd byterun; $(MAKE) install cp ocamlc $(BINDIR)/ocamlc$(EXE) cp ocaml $(BINDIR)/ocaml$(EXE) @@ -291,8 +291,8 @@ install: cd tools; $(MAKE) install -cd man; $(MAKE) install for i in $(OTHERLIBRARIES); do \ - (cd otherlibs/$$i; $(MAKE) install) || exit $$?; \ - done + (cd otherlibs/$$i; $(MAKE) install) || exit $$?; \ + done cd ocamldoc; $(MAKE) install if test -f ocamlopt; then $(MAKE) installopt; else :; fi if test -f debugger/ocamldebug; then (cd debugger; $(MAKE) install); \ @@ -355,7 +355,7 @@ partialclean:: # The native toplevel -ocamlnat: ocamlopt otherlibs/dynlink/dynlink.cmxa $(NATTOPOBJS:.cmo=.cmx) +ocamlnat: ocamlopt otherlibs/dynlink/dynlink.cmxa $(NATTOPOBJS:.cmo=.cmx) $(CAMLOPT) $(LINKFLAGS) otherlibs/dynlink/dynlink.cmxa -o ocamlnat \ $(NATTOPOBJS:.cmo=.cmx) -linkall @@ -369,28 +369,28 @@ otherlibs/dynlink/dynlink.cmxa: otherlibs/dynlink/natdynlink.ml utils/config.ml: utils/config.mlp config/Makefile @rm -f utils/config.ml sed -e 's|%%LIBDIR%%|$(LIBDIR)|' \ - -e 's|%%BYTERUN%%|$(BINDIR)/ocamlrun|' \ - -e 's|%%CCOMPTYPE%%|cc|' \ - -e 's|%%BYTECC%%|$(BYTECC) $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS)|' \ - -e 's|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|' \ - -e 's|%%PACKLD%%|$(PACKLD)|' \ - -e 's|%%BYTECCLIBS%%|$(BYTECCLIBS)|' \ - -e 's|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|' \ - -e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \ - -e 's|%%CC_PROFILE%%|$(CC_PROFILE)|' \ - -e 's|%%ARCH%%|$(ARCH)|' \ - -e 's|%%MODEL%%|$(MODEL)|' \ - -e 's|%%SYSTEM%%|$(SYSTEM)|' \ - -e 's|%%EXT_OBJ%%|.o|' \ - -e 's|%%EXT_ASM%%|.s|' \ - -e 's|%%EXT_LIB%%|.a|' \ - -e 's|%%EXT_DLL%%|.so|' \ - -e 's|%%SYSTHREAD_SUPPORT%%|$(SYSTHREAD_SUPPORT)|' \ - -e 's|%%ASM%%|$(ASM)|' \ - -e 's|%%MKDLL%%|$(MKDLL)|' \ - -e 's|%%MKEXE%%|$(MKEXE)|' \ - -e 's|%%MKMAINDLL%%|$(MKMAINDLL)|' \ - utils/config.mlp > utils/config.ml + -e 's|%%BYTERUN%%|$(BINDIR)/ocamlrun|' \ + -e 's|%%CCOMPTYPE%%|cc|' \ + -e 's|%%BYTECC%%|$(BYTECC) $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS)|' \ + -e 's|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|' \ + -e 's|%%PACKLD%%|$(PACKLD)|' \ + -e 's|%%BYTECCLIBS%%|$(BYTECCLIBS)|' \ + -e 's|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|' \ + -e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \ + -e 's|%%CC_PROFILE%%|$(CC_PROFILE)|' \ + -e 's|%%ARCH%%|$(ARCH)|' \ + -e 's|%%MODEL%%|$(MODEL)|' \ + -e 's|%%SYSTEM%%|$(SYSTEM)|' \ + -e 's|%%EXT_OBJ%%|.o|' \ + -e 's|%%EXT_ASM%%|.s|' \ + -e 's|%%EXT_LIB%%|.a|' \ + -e 's|%%EXT_DLL%%|.so|' \ + -e 's|%%SYSTHREAD_SUPPORT%%|$(SYSTHREAD_SUPPORT)|' \ + -e 's|%%ASM%%|$(ASM)|' \ + -e 's|%%MKDLL%%|$(MKDLL)|' \ + -e 's|%%MKEXE%%|$(MKEXE)|' \ + -e 's|%%MKMAINDLL%%|$(MKMAINDLL)|' \ + utils/config.mlp > utils/config.ml @chmod -w utils/config.ml partialclean:: @@ -433,8 +433,8 @@ beforedepend:: parsing/linenum.ml ocamlc.opt: $(COMPOBJS:.cmo=.cmx) cd asmrun; $(MAKE) meta.o dynlink.o $(CAMLOPT) $(LINKFLAGS) -ccopt "$(BYTECCLINKOPTS)" -o ocamlc.opt \ - $(COMPOBJS:.cmo=.cmx) \ - asmrun/meta.o asmrun/dynlink.o -cclib "$(BYTECCLIBS)" + $(COMPOBJS:.cmo=.cmx) \ + asmrun/meta.o asmrun/dynlink.o -cclib "$(BYTECCLIBS)" @sed -e 's|@compiler@|$$topdir/ocamlc.opt|' \ driver/ocamlcomp.sh.in > ocamlcomp.sh @chmod +x ocamlcomp.sh @@ -459,7 +459,7 @@ $(OPTOBJS:.cmo=.cmx): ocamlopt bytecomp/opcodes.ml: byterun/instruct.h sed -n -e '/^enum/p' -e 's/,//g' -e '/^ /p' byterun/instruct.h | \ - awk -f tools/make-opcodes > bytecomp/opcodes.ml + awk -f tools/make-opcodes > bytecomp/opcodes.ml partialclean:: rm -f bytecomp/opcodes.ml @@ -475,9 +475,9 @@ bytecomp/runtimedef.ml: byterun/primitives byterun/fail.h (echo 'let builtin_exceptions = [|'; \ sed -n -e 's|.*/\* \("[A-Za-z_]*"\) \*/$$| \1;|p' byterun/fail.h | \ sed -e '$$s/;$$//'; \ - echo '|]'; \ - echo 'let builtin_primitives = [|'; \ - sed -e 's/.*/ "&";/' -e '$$s/;$$//' byterun/primitives; \ + echo '|]'; \ + echo 'let builtin_primitives = [|'; \ + sed -e 's/.*/ "&";/' -e '$$s/;$$//' byterun/primitives; \ echo '|]') > bytecomp/runtimedef.ml partialclean:: @@ -531,7 +531,7 @@ beforedepend:: asmcomp/scheduling.ml asmcomp/emit.ml: asmcomp/$(ARCH)/emit.mlp tools/cvt_emit $(CAMLRUN) tools/cvt_emit < asmcomp/$(ARCH)/emit.mlp > asmcomp/emit.ml \ - || { rm -f asmcomp/emit.ml; exit 2; } + || { rm -f asmcomp/emit.ml; exit 2; } partialclean:: rm -f asmcomp/emit.ml @@ -555,7 +555,7 @@ partialclean:: runtime: cd byterun; $(MAKE) all if test -f stdlib/libcamlrun.a; then :; else \ - ln -s ../byterun/libcamlrun.a stdlib/libcamlrun.a; fi + ln -s ../byterun/libcamlrun.a stdlib/libcamlrun.a; fi clean:: cd byterun; $(MAKE) clean @@ -649,18 +649,18 @@ alldepend:: otherlibraries: ocamltools for i in $(OTHERLIBRARIES); do \ - (cd otherlibs/$$i; $(MAKE) RUNTIME=$(RUNTIME) all) || exit $$?; \ - done + (cd otherlibs/$$i; $(MAKE) RUNTIME=$(RUNTIME) all) || exit $$?; \ + done otherlibrariesopt: for i in $(OTHERLIBRARIES); do \ - (cd otherlibs/$$i; $(MAKE) allopt) || exit $$?; \ - done + (cd otherlibs/$$i; $(MAKE) allopt) || exit $$?; \ + done partialclean:: for i in $(OTHERLIBRARIES); do \ - (cd otherlibs/$$i; $(MAKE) partialclean); \ - done + (cd otherlibs/$$i; $(MAKE) partialclean); \ + done clean:: for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) clean); done diff --git a/Makefile.nt b/Makefile.nt index fe4199b77..62de9eeaa 100644 --- a/Makefile.nt +++ b/Makefile.nt @@ -29,7 +29,7 @@ DEPFLAGS=$(INCLUDES) CAMLRUN=byterun/ocamlrun INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver \ - -I toplevel + -I toplevel UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \ utils/clflags.cmo utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \ @@ -295,7 +295,7 @@ partialclean:: # The native toplevel -ocamlnat: ocamlopt otherlibs/dynlink/dynlink.cmxa $(NATTOPOBJS:.cmo=.cmx) +ocamlnat: ocamlopt otherlibs/dynlink/dynlink.cmxa $(NATTOPOBJS:.cmo=.cmx) $(CAMLOPT) $(LINKFLAGS) otherlibs/dynlink/dynlink.cmxa -o ocamlnat $(NATTOPOBJS:.cmo=.cmx) -linkall toplevel/opttoploop.cmx: otherlibs/dynlink/dynlink.cmxa @@ -309,31 +309,31 @@ otherlibs/dynlink/dynlink.cmxa: otherlibs/dynlink/natdynlink.ml utils/config.ml: utils/config.mlp config/Makefile @rm -f utils/config.ml sed -e "s|%%LIBDIR%%|$(LIBDIR)|" \ - -e "s|%%BYTERUN%%|ocamlrun|" \ - -e 's|%%CCOMPTYPE%%|$(CCOMPTYPE)|' \ - -e "s|%%BYTECC%%|$(BYTECC) $(BYTECCCOMPOPTS)|" \ - -e "s|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|" \ - -e "s|%%PARTIALLD%%|$(PARTIALLD)|" \ - -e "s|%%PACKLD%%|$(PACKLD)|" \ - -e "s|%%BYTECCLIBS%%|$(BYTECCLIBS)|" \ - -e "s|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|" \ - -e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \ - -e 's|%%BINUTILS_NM%%|$(BINUTILS_NM)|' \ - -e 's|%%BINUTILS_OBJCOPY%%|$(BINUTILS_OBJCOPY)|' \ - -e "s|%%ARCH%%|$(ARCH)|" \ - -e "s|%%MODEL%%|$(MODEL)|" \ - -e "s|%%SYSTEM%%|$(SYSTEM)|" \ - -e "s|%%EXT_OBJ%%|.$(O)|" \ - -e "s|%%EXT_ASM%%|.$(S)|" \ - -e "s|%%EXT_LIB%%|.$(A)|" \ - -e "s|%%EXT_DLL%%|.dll|" \ - -e "s|%%SYSTHREAD_SUPPORT%%|true|" \ - -e 's|%%ASM%%|$(ASM)|' \ - -e 's|%%MKDLL%%|$(MKDLL)|' \ - -e 's|%%MKEXE%%|$(MKEXE)|' \ - -e 's|%%MKMAINDLL%%|$(MKMAINDLL)|' \ - -e 's|%%CC_PROFILE%%||' \ - utils/config.mlp > utils/config.ml + -e "s|%%BYTERUN%%|ocamlrun|" \ + -e 's|%%CCOMPTYPE%%|$(CCOMPTYPE)|' \ + -e "s|%%BYTECC%%|$(BYTECC) $(BYTECCCOMPOPTS)|" \ + -e "s|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|" \ + -e "s|%%PARTIALLD%%|$(PARTIALLD)|" \ + -e "s|%%PACKLD%%|$(PACKLD)|" \ + -e "s|%%BYTECCLIBS%%|$(BYTECCLIBS)|" \ + -e "s|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|" \ + -e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \ + -e 's|%%BINUTILS_NM%%|$(BINUTILS_NM)|' \ + -e 's|%%BINUTILS_OBJCOPY%%|$(BINUTILS_OBJCOPY)|' \ + -e "s|%%ARCH%%|$(ARCH)|" \ + -e "s|%%MODEL%%|$(MODEL)|" \ + -e "s|%%SYSTEM%%|$(SYSTEM)|" \ + -e "s|%%EXT_OBJ%%|.$(O)|" \ + -e "s|%%EXT_ASM%%|.$(S)|" \ + -e "s|%%EXT_LIB%%|.$(A)|" \ + -e "s|%%EXT_DLL%%|.dll|" \ + -e "s|%%SYSTHREAD_SUPPORT%%|true|" \ + -e 's|%%ASM%%|$(ASM)|' \ + -e 's|%%MKDLL%%|$(MKDLL)|' \ + -e 's|%%MKEXE%%|$(MKEXE)|' \ + -e 's|%%MKMAINDLL%%|$(MKMAINDLL)|' \ + -e 's|%%CC_PROFILE%%||' \ + utils/config.mlp > utils/config.ml @chmod -w utils/config.ml partialclean:: @@ -394,7 +394,7 @@ $(OPTOBJS:.cmo=.cmx): ocamlopt bytecomp/opcodes.ml: byterun/instruct.h sed -n -e "/^enum/p" -e "s|,||g" -e "/^ /p" byterun/instruct.h | \ - gawk -f tools/make-opcodes > bytecomp/opcodes.ml + gawk -f tools/make-opcodes > bytecomp/opcodes.ml partialclean:: rm -f bytecomp/opcodes.ml @@ -410,9 +410,9 @@ bytecomp/runtimedef.ml: byterun/primitives byterun/fail.h (echo 'let builtin_exceptions = [|'; \ sed -n -e 's|.*/\* \("[A-Za-z_]*"\) \*/$$| \1;|p' byterun/fail.h | \ sed -e '$$s/;$$//'; \ - echo '|]'; \ - echo 'let builtin_primitives = [|'; \ - sed -e 's/.*/ "&";/' -e '$$s/;$$//' byterun/primitives; \ + echo '|]'; \ + echo 'let builtin_primitives = [|'; \ + sed -e 's/.*/ "&";/' -e '$$s/;$$//' byterun/primitives; \ echo '|]') > bytecomp/runtimedef.ml partialclean:: @@ -561,9 +561,9 @@ alldepend:: # OCamldoc -ocamldoc.byte: +ocamldoc.byte: cd ocamldoc ; $(MAKEREC) all -ocamldoc.opt: +ocamldoc.opt: cd ocamldoc ; $(MAKEREC) opt.opt partialclean:: cd ocamldoc ; $(MAKEREC) clean diff --git a/README b/README index e82420df2..c0670ea67 100644 --- a/README +++ b/README @@ -84,7 +84,7 @@ All files marked "Copyright INRIA" in this distribution are copyright INSTALLATION: -See the file INSTALL for installation instructions on Unix, Linux and +See the file INSTALL for installation instructions on Unix, Linux and MacOS X machines. For MS Windows, see README.win32. DOCUMENTATION: diff --git a/README.win32 b/README.win32 index bb6b31d90..9479e1137 100644 --- a/README.win32 +++ b/README.win32 @@ -6,7 +6,7 @@ There are no less than four ports of Objective Caml for MS Windows available: - a native Win32 port, built with the Cygwin/MinGW development tools; - a port consisting of the Unix sources compiled under the Cygwin Unix-like environment for Windows; - - a native Win64 port (64-bit Windows), built with the Microsoft + - a native Win64 port (64-bit Windows), built with the Microsoft development tools. Here is a summary of the main differences between these ports: @@ -95,7 +95,7 @@ THIRD-PARTY SOFTWARE: 2005 can download MASM version 8 from http://www.microsoft.com/downloads/details.aspx?FamilyID=7A1C9DA0-0510-44A2-B042-7EF370530C64&displaylang=en To obtain MASM version 6.11, see - http://users.easystreet.com/jkirwan/new/pctools.html. + http://users.easystreet.com/jkirwan/new/pctools.html. [4] TCL/TK version 8.5. Windows binaries are available as part of the ActiveTCL distribution at http://www.activestate.com/products/ActiveTcl/ @@ -152,7 +152,7 @@ performance of bytecode programs is about 2/3 of that obtained under Unix/GCC or Cygwin or Mingw on similar hardware. * Libraries available in this port: "num", "str", "threads", "graphics", -"labltk", and large parts of "unix". +"labltk", and large parts of "unix". * The replay debugger is partially supported (no reverse execution). @@ -178,7 +178,7 @@ The base bytecode system (ocamlc, ocaml, ocamllex, ocamlyacc, ...) runs without any additional tools. The native-code compiler (ocamlopt), as well as static linking of -Caml bytecode with C code (ocamlc -custom), require +Caml bytecode with C code (ocamlc -custom), require the Cygwin development tools, available at http://www.cygwin.com/ and the flexdll tool, available at @@ -191,7 +191,7 @@ Do *not* install the Mingw/MSYS development tools from www.mingw.org: these are not compatible with this Caml port (@responsefile not recognized on the command line). -The LablTk GUI requires Tcl/Tk 8.5. Windows binaries are available +The LablTk GUI requires Tcl/Tk 8.5. Windows binaries are available as part of the ActiveTCL distribution at http://www.activestate.com/products/ActiveTcl/ @@ -216,7 +216,7 @@ RECOMPILATION FROM THE SOURCES: You will need the following software components to perform the recompilation: - Windows NT, 2000, XP, or Vista. - Cygwin: http://sourceware.cygnus.com/cygwin/ - Install at least the following packages: binutils, diffutils, + Install at least the following packages: binutils, diffutils, gcc-core, gcc-mingw-core, make, mingw-runtime, ncurses, w32-api. - TCL/TK version 8.5 (see above). - The flexdll tool (see above). @@ -238,7 +238,7 @@ Normally, the only variables that need to be changed are PREFIX where to install everything TK_ROOT where TCL/TK was installed -Finally, use "make -f Makefile.nt" to build the system, e.g. +Finally, use "make -f Makefile.nt" to build the system, e.g. make -f Makefile.nt world make -f Makefile.nt bootstrap @@ -250,7 +250,7 @@ Finally, use "make -f Makefile.nt" to build the system, e.g. NOTES: * Libraries available in this port: "num", "str", "threads", "graphics", - "labltk", and large parts of "unix". + "labltk", and large parts of "unix". * The replay debugger is partially supported (no reverse execution). @@ -357,7 +357,7 @@ compiler for AMD64 instead of the Platform SDK compiler, replace the line by EXTRALIBS= -Finally, use "make -f Makefile.nt" to build the system, e.g. +Finally, use "make -f Makefile.nt" to build the system, e.g. make -f Makefile.nt world make -f Makefile.nt bootstrap @@ -369,7 +369,7 @@ Finally, use "make -f Makefile.nt" to build the system, e.g. NOTES: * Libraries available in this port: "num", "str", "threads", "graphics", - and large parts of "unix". + and large parts of "unix". * The replay debugger is partially supported (no reverse execution). diff --git a/Upgrading b/Upgrading index 10fdd47ca..808413ed2 100644 --- a/Upgrading +++ b/Upgrading @@ -97,7 +97,7 @@ A8: The new default mode is more flexible than the original commuting interface must also be present in the implementation. The addlabels tool can help you to do that. Suppose that you have mymod.ml and mymod.mli, where mymod.mli adds some labels. Then - doing + doing $CAMLLIB/addlabels mymod.ml will insert labels from the interface inside the implementation. It also takes care of inserting them in recursive calls, as @@ -106,4 +106,4 @@ A8: The new default mode is more flexible than the original commuting If you used labels from standard libraries, you will also have problems with them. You can proceed as described in A6. Since you used classic mode, you do not need to bother about changed - argument order. \ No newline at end of file + argument order. diff --git a/asmcomp/alpha/emit.mlp b/asmcomp/alpha/emit.mlp index 3c04b7a47..6857da04e 100644 --- a/asmcomp/alpha/emit.mlp +++ b/asmcomp/alpha/emit.mlp @@ -129,7 +129,7 @@ let emit_label lbl = emit_string "$"; emit_int lbl let emit_Llabel fallthrough lbl = - if (not fallthrough) then begin + if (not fallthrough) then begin emit_string " .align 4\n" end ; emit_label lbl @@ -195,7 +195,7 @@ let int_reg_number = [| 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 16; 17; 18; 19; 20; 21; 22 |] - + let float_reg_number = [| 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 29; 30 @@ -358,7 +358,7 @@ let emit_instr fallthrough i = Lend -> () | Lop(Imove | Ispill | Ireload) -> let src = i.arg.(0) and dst = i.res.(0) in - if src.loc <> dst.loc then begin + if src.loc <> dst.loc then begin match (src.loc, dst.loc) with (Reg rs, Reg rd) -> if src.typ = Float then @@ -381,7 +381,7 @@ let emit_instr fallthrough i = | Lop(Iconst_int n) -> if n = 0n then ` clr {emit_reg i.res.(0)}\n` - else if digital_asm || + else if digital_asm || (n >= Nativeint.of_int (-0x80000000) && n <= Nativeint.of_int 0x7FFFFFFF) then ` ldiq {emit_reg i.res.(0)}, {emit_nativeint n}\n` diff --git a/asmcomp/alpha/proc.ml b/asmcomp/alpha/proc.ml index 6bcf44f59..f31b852fb 100644 --- a/asmcomp/alpha/proc.ml +++ b/asmcomp/alpha/proc.ml @@ -49,7 +49,7 @@ let int_reg_name = [| (* 8-12 *) "$8"; "$9"; "$10"; "$11"; "$12"; (* 13-19 *) "$16"; "$17"; "$18"; "$19"; "$20"; "$21"; "$22" |] - + let float_reg_name = [| (* 100-107 *) "$f0"; "$f1"; "$f2"; "$f3"; "$f4"; "$f5"; "$f6"; "$f7"; (* 108-115 *) "$f8"; "$f9"; "$f10"; "$f11"; "$f12"; "$f13"; "$f14"; "$f15"; @@ -210,7 +210,7 @@ let assemble_file infile outfile = if digital_asm && !Clflags.gprofile then Config.as ^ " -pg" else Config.as in - Ccomp.command (as_cmd ^ " -o " ^ + Ccomp.command (as_cmd ^ " -o " ^ Filename.quote outfile ^ " " ^ Filename.quote infile) open Clflags;; diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp index 950748d6e..b1f886da9 100644 --- a/asmcomp/amd64/emit.mlp +++ b/asmcomp/amd64/emit.mlp @@ -60,7 +60,7 @@ let slot_offset loc cl = (* Symbols *) let emit_symbol s = - if macosx then emit_string "_"; + if macosx then emit_string "_"; Emitaux.emit_symbol '$' s let emit_call s = @@ -791,4 +791,3 @@ let end_assembly() = if Config.system = "linux" then (* Mark stack as non-executable, PR#4564 *) ` .section .note.GNU-stack,\"\",%progbits\n` - diff --git a/asmcomp/amd64/emit_nt.mlp b/asmcomp/amd64/emit_nt.mlp index 71b71157b..23c5b34ec 100644 --- a/asmcomp/amd64/emit_nt.mlp +++ b/asmcomp/amd64/emit_nt.mlp @@ -39,10 +39,10 @@ let frame_required () = let frame_size () = (* includes return address *) if frame_required() then begin - let sz = + let sz = (!stack_offset + 8 * (num_stack_slots.(0) + num_stack_slots.(1)) + 8) in Misc.align sz 16 - end else + end else !stack_offset + 8 let slot_offset loc cl = @@ -63,7 +63,7 @@ let emit_int32 n = emit_printf "0%lxh" n let emit_symbol s = Emitaux.emit_symbol '$' s -(* Record symbols used and defined - at the end generate extern for those +(* Record symbols used and defined - at the end generate extern for those used but not defined *) let symbols_defined = ref StringSet.empty @@ -84,11 +84,11 @@ let emit_label lbl = let emit_align n = ` ALIGN {emit_int n}\n` - + let emit_Llabel fallthrough lbl = if not fallthrough && !fastcode_flag then emit_align 4; emit_label lbl - + (* Output a pseudo-register *) let emit_reg = function @@ -106,13 +106,13 @@ let emit_reg = function (* Output a reference to the lower 8, 16 or 32 bits of a register *) let reg_low_8_name = - [| "al"; "bl"; "dil"; "sil"; "dl"; "cl"; "r8b"; "r9b"; + [| "al"; "bl"; "dil"; "sil"; "dl"; "cl"; "r8b"; "r9b"; "r10b"; "r11b"; "bpl"; "r12b"; "r13b" |] let reg_low_16_name = - [| "ax"; "bx"; "di"; "si"; "dx"; "cx"; "r8w"; "r9w"; + [| "ax"; "bx"; "di"; "si"; "dx"; "cx"; "r8w"; "r9w"; "r10w"; "r11w"; "bp"; "r12w"; "r13w" |] let reg_low_32_name = - [| "eax"; "ebx"; "edi"; "esi"; "edx"; "ecx"; "r8d"; "r9d"; + [| "eax"; "ebx"; "edi"; "esi"; "edx"; "ecx"; "r8d"; "r9d"; "r10d"; "r11d"; "ebp"; "r12d"; "r13d" |] let emit_subreg tbl pref r = @@ -253,7 +253,7 @@ let name_for_cond_branch = function | Iunsigned Ceq -> "e" | Iunsigned Cne -> "ne" | Iunsigned Cle -> "be" | Iunsigned Cgt -> "a" | Iunsigned Clt -> "b" | Iunsigned Cge -> "ae" - + (* Output an = 0 or <> 0 test. *) let output_test_zero arg = @@ -544,7 +544,7 @@ let emit_instr fallthrough i = ` cmp {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`; let b = name_for_cond_branch cmp in ` j{emit_string b} {emit_label lbl}\n` - | Iinttest_imm((Isigned Ceq | Isigned Cne | + | Iinttest_imm((Isigned Ceq | Isigned Cne | Iunsigned Ceq | Iunsigned Cne) as cmp, 0) -> output_test_zero i.arg.(0); let b = name_for_cond_branch cmp in diff --git a/asmcomp/amd64/proc.ml b/asmcomp/amd64/proc.ml index c0807b88d..4ba0d5c3e 100644 --- a/asmcomp/amd64/proc.ml +++ b/asmcomp/amd64/proc.ml @@ -31,24 +31,24 @@ open Mach rcx 5 r8 6 r9 7 - r10 8 - r11 9 + r10 8 + r11 9 rbp 10 - r12 11 - r13 12 + r12 11 + r13 12 r14 trap pointer r15 allocation pointer - + xmm0 - xmm15 100 - 115 xmm0 - xmm9: Caml function arguments xmm0 - xmm7: C function arguments xmm0: Caml and C function results *) let int_reg_name = - [| "%rax"; "%rbx"; "%rdi"; "%rsi"; "%rdx"; "%rcx"; "%r8"; "%r9"; + [| "%rax"; "%rbx"; "%rdi"; "%rsi"; "%rdx"; "%rcx"; "%r8"; "%r9"; "%r10"; "%r11"; "%rbp"; "%r12"; "%r13" |] let float_reg_name = - [| "%xmm0"; "%xmm1"; "%xmm2"; "%xmm3"; "%xmm4"; "%xmm5"; "%xmm6"; "%xmm7"; + [| "%xmm0"; "%xmm1"; "%xmm2"; "%xmm3"; "%xmm4"; "%xmm5"; "%xmm6"; "%xmm7"; "%xmm8"; "%xmm9"; "%xmm10"; "%xmm11"; "%xmm12"; "%xmm13"; "%xmm14"; "%xmm15" |] diff --git a/asmcomp/amd64/proc_nt.ml b/asmcomp/amd64/proc_nt.ml index 05ce517dd..5c90e4f52 100644 --- a/asmcomp/amd64/proc_nt.ml +++ b/asmcomp/amd64/proc_nt.ml @@ -31,25 +31,25 @@ open Mach rcx 5 r8 6 r9 7 - r10 8 - r11 9 + r10 8 + r11 9 rbp 10 - r12 11 - r13 12 + r12 11 + r13 12 r14 trap pointer r15 allocation pointer - + xmm0 - xmm15 100 - 115 xmm0 - xmm9: Caml function arguments xmm0 - xmm3: C function arguments xmm0: Caml and C function results xmm6-xmm15 are preserved by C *) let int_reg_name = - [| "rax"; "rbx"; "rdi"; "rsi"; "rdx"; "rcx"; "r8"; "r9"; + [| "rax"; "rbx"; "rdi"; "rsi"; "rdx"; "rcx"; "r8"; "r9"; "r10"; "r11"; "rbp"; "r12"; "r13" |] let float_reg_name = - [| "xmm0"; "xmm1"; "xmm2"; "xmm3"; "xmm4"; "xmm5"; "xmm6"; "xmm7"; + [| "xmm0"; "xmm1"; "xmm2"; "xmm3"; "xmm4"; "xmm5"; "xmm6"; "xmm7"; "xmm8"; "xmm9"; "xmm10"; "xmm11"; "xmm12"; "xmm13"; "xmm14"; "xmm15" |] let num_register_classes = 2 @@ -229,5 +229,5 @@ let contains_calls = ref false let assemble_file infile outfile = Ccomp.command (Config.asm ^ - Filename.quote outfile ^ " " ^ + Filename.quote outfile ^ " " ^ Filename.quote infile ^ "> NUL") diff --git a/asmcomp/arm/emit.mlp b/asmcomp/arm/emit.mlp index a2a6b4dad..307d097dc 100644 --- a/asmcomp/arm/emit.mlp +++ b/asmcomp/arm/emit.mlp @@ -274,7 +274,7 @@ let emit_instr i = ` mov {emit_reg i.res.(0)}, #{emit_nativeint low_bits} @ {emit_string s}\n`; ` mov {emit_reg i.res.(1)}, #{emit_nativeint high_bits}\n`; 2 - end else begin + end else begin let lbl = label_constant float_constants s 2 in ` ldr {emit_reg i.res.(0)}, {emit_label lbl} @ {emit_string s}\n`; ` ldr {emit_reg i.res.(1)}, {emit_label lbl} + 4\n`; diff --git a/asmcomp/arm/selection.ml b/asmcomp/arm/selection.ml index 3fdbd640a..ded233eda 100644 --- a/asmcomp/arm/selection.ml +++ b/asmcomp/arm/selection.ml @@ -166,7 +166,7 @@ method select_operation op args = method select_condition = function | Cop(Ccmpf cmp, args) -> (Iinttest_imm(Isigned cmp, 0), - Cop(Cextcall(float_comparison_function cmp, + Cop(Cextcall(float_comparison_function cmp, typ_int, false, Debuginfo.none), args)) | expr -> @@ -198,4 +198,3 @@ method insert_op_debug op dbg rs rd = end let fundecl f = (new selector)#emit_fundecl f - diff --git a/asmcomp/asmgen.ml b/asmcomp/asmgen.ml index 36edea8cf..9cdf61f40 100644 --- a/asmcomp/asmgen.ml +++ b/asmcomp/asmgen.ml @@ -90,7 +90,7 @@ let compile_genfuns ppf f = List.iter (function | (Cfunction {fun_name = name}) as ph when f name -> - compile_phrase ppf ph + compile_phrase ppf ph | _ -> ()) (Cmmgen.generic_functions true [Compilenv.current_unit_infos ()]) diff --git a/asmcomp/asmlibrarian.ml b/asmcomp/asmlibrarian.ml index 62815809e..d54d89297 100644 --- a/asmcomp/asmlibrarian.ml +++ b/asmcomp/asmlibrarian.ml @@ -71,4 +71,3 @@ let report_error ppf = function fprintf ppf "Cannot find file %s" name | Archiver_error name -> fprintf ppf "Error while creating the library %s" name - diff --git a/asmcomp/asmpackager.ml b/asmcomp/asmpackager.ml index 6be94a1b6..cb757efc2 100644 --- a/asmcomp/asmpackager.ml +++ b/asmcomp/asmpackager.ml @@ -83,10 +83,10 @@ let make_package_object ppf members targetobj targetname coercion = let objtemp = if !Clflags.keep_asm_file then chop_extension_if_any targetobj ^ ".pack" ^ Config.ext_obj - else + else (* Put the full name of the module in the temporary file name - to avoid collisions with MSVC's link /lib in case of successive - packs *) + to avoid collisions with MSVC's link /lib in case of successive + packs *) Filename.temp_file (Compilenv.make_symbol (Some "")) Config.ext_obj in let components = List.map diff --git a/asmcomp/closure.mli b/asmcomp/closure.mli index cf98dffbc..f16379068 100644 --- a/asmcomp/closure.mli +++ b/asmcomp/closure.mli @@ -15,4 +15,3 @@ (* Introduction of closures, uncurrying, recognition of direct calls *) val intro: int -> Lambda.lambda -> Clambda.ulambda - diff --git a/asmcomp/cmm.ml b/asmcomp/cmm.ml index 8d817a857..68625e24c 100644 --- a/asmcomp/cmm.ml +++ b/asmcomp/cmm.ml @@ -129,4 +129,3 @@ type data_item = type phrase = Cfunction of fundecl | Cdata of data_item list - diff --git a/asmcomp/cmm.mli b/asmcomp/cmm.mli index 5cabc0066..1b0907165 100644 --- a/asmcomp/cmm.mli +++ b/asmcomp/cmm.mli @@ -115,4 +115,3 @@ type data_item = type phrase = Cfunction of fundecl | Cdata of data_item list - diff --git a/asmcomp/cmmgen.ml b/asmcomp/cmmgen.ml index 00742dcf9..635c3f751 100644 --- a/asmcomp/cmmgen.ml +++ b/asmcomp/cmmgen.ml @@ -1950,9 +1950,9 @@ let generic_functions shared units = let (apply,send,curry) = List.fold_left (fun (apply,send,curry) ui -> - List.fold_right IntSet.add ui.Compilenv.ui_apply_fun apply, - List.fold_right IntSet.add ui.Compilenv.ui_send_fun send, - List.fold_right IntSet.add ui.Compilenv.ui_curry_fun curry) + List.fold_right IntSet.add ui.Compilenv.ui_apply_fun apply, + List.fold_right IntSet.add ui.Compilenv.ui_send_fun send, + List.fold_right IntSet.add ui.Compilenv.ui_curry_fun curry) (IntSet.empty,IntSet.empty,IntSet.empty) units in let apply = if shared then apply else IntSet.union apply default_apply in @@ -2071,7 +2071,7 @@ let plugin_header units = crc = crc; imports_cmi = ui.Compilenv.ui_imports_cmi; imports_cmx = ui.Compilenv.ui_imports_cmx; - defines = ui.Compilenv.ui_defines + defines = ui.Compilenv.ui_defines } in global_data "caml_plugin_header" { magic = dyn_magic_number; units = List.map mk units } diff --git a/asmcomp/cmmgen.mli b/asmcomp/cmmgen.mli index 50771c81b..bd3d9acff 100644 --- a/asmcomp/cmmgen.mli +++ b/asmcomp/cmmgen.mli @@ -23,7 +23,7 @@ val generic_functions: bool -> Compilenv.unit_infos list -> Cmm.phrase list val entry_point: string list -> Cmm.phrase val global_table: string list -> Cmm.phrase val reference_symbols: string list -> Cmm.phrase -val globals_map: (string * Digest.t * Digest.t * string list) list -> +val globals_map: (string * Digest.t * Digest.t * string list) list -> Cmm.phrase val frame_table: string list -> Cmm.phrase val data_segment_table: string list -> Cmm.phrase diff --git a/asmcomp/codegen.ml b/asmcomp/codegen.ml index fe841e70e..280f13940 100644 --- a/asmcomp/codegen.ml +++ b/asmcomp/codegen.ml @@ -39,7 +39,7 @@ let rec regalloc fd = let (newfd, redo_regalloc) = Reload.fundecl fd in if !dump_reload then Printmach.phase "After insertion of reloading code" newfd; - if redo_regalloc + if redo_regalloc then begin Reg.reinit(); Liveness.fundecl newfd; regalloc newfd end else newfd @@ -95,7 +95,3 @@ let file filename = close_in ic; Parsecmmaux.report_error msg | x -> close_in ic; raise x - - - - diff --git a/asmcomp/coloring.ml b/asmcomp/coloring.ml index 0fe105e8c..37c03a05b 100644 --- a/asmcomp/coloring.ml +++ b/asmcomp/coloring.ml @@ -50,7 +50,7 @@ let find_degree reg = let cl = Proc.register_class reg in let avail_regs = Proc.num_available_registers.(cl) in if avail_regs = 0 then - (* Don't bother computing the degree if there are no regs + (* Don't bother computing the degree if there are no regs in this class *) unconstrained := Reg.Set.add reg !unconstrained else begin @@ -131,7 +131,7 @@ let iter_preferred f reg = List.iter (fun (r, w) -> walk r w) reg.prefer; reg.visited <- false -(* Where to start the search for a suitable register. +(* Where to start the search for a suitable register. Used to introduce some "randomness" in the choice between registers with equal scores. This offers more opportunities for scheduling. *) diff --git a/asmcomp/compilenv.ml b/asmcomp/compilenv.ml index e0f999c20..2bf4b6ec8 100644 --- a/asmcomp/compilenv.ml +++ b/asmcomp/compilenv.ml @@ -179,7 +179,7 @@ let record_global_approx_toplevel id = let global_approx id = if Ident.is_predef_exn id then Value_unknown else try Hashtbl.find toplevel_approx (Ident.name id) - with Not_found -> + with Not_found -> match get_global_info id with | None -> Value_unknown | Some ui -> ui.ui_approx @@ -240,4 +240,3 @@ let report_error ppf = function fprintf ppf "Corrupted compilation unit description@ %s" filename | Illegal_renaming(modname, filename) -> fprintf ppf "%s@ contains the description for unit@ %s" filename modname - diff --git a/asmcomp/compilenv.mli b/asmcomp/compilenv.mli index 762123b01..74120f4cd 100644 --- a/asmcomp/compilenv.mli +++ b/asmcomp/compilenv.mli @@ -106,5 +106,3 @@ type error = exception Error of error val report_error: Format.formatter -> error -> unit - - diff --git a/asmcomp/debuginfo.ml b/asmcomp/debuginfo.ml index 84390442b..a7124e171 100644 --- a/asmcomp/debuginfo.ml +++ b/asmcomp/debuginfo.ml @@ -33,7 +33,7 @@ let none = { let to_string d = if d == none - then "" + then "" else Printf.sprintf "{%s:%d,%d-%d}" d.dinfo_file d.dinfo_line d.dinfo_char_start d.dinfo_char_end diff --git a/asmcomp/debuginfo.mli b/asmcomp/debuginfo.mli index 151cd0abb..c3c9c406e 100644 --- a/asmcomp/debuginfo.mli +++ b/asmcomp/debuginfo.mli @@ -28,4 +28,3 @@ val from_location: kind -> Location.t -> t val from_call: Lambda.lambda_event -> t val from_raise: Lambda.lambda_event -> t - diff --git a/asmcomp/emitaux.ml b/asmcomp/emitaux.ml index 35338eed9..d4db78ad7 100644 --- a/asmcomp/emitaux.ml +++ b/asmcomp/emitaux.ml @@ -138,7 +138,7 @@ let emit_frames a = let filenames = Hashtbl.create 7 in let lbl_filenames = ref 200000 in let label_filename name = - try + try Hashtbl.find filenames name with Not_found -> let lbl = !lbl_filenames in @@ -165,7 +165,7 @@ let emit_frames a = Int64.add (Int64.shift_left (Int64.of_int char_end) 26) (Int64.of_int kind))) in a.efa_label_rel - (label_filename d.dinfo_file) + (label_filename d.dinfo_file) (Int64.to_int32 info); a.efa_32 (Int64.to_int32 (Int64.shift_right info 32)) end in @@ -189,4 +189,3 @@ let is_generic_function name = List.exists (fun p -> isprefix p name) ["caml_apply"; "caml_curry"; "caml_send"; "caml_tuplify"] - diff --git a/asmcomp/hppa/arch.ml b/asmcomp/hppa/arch.ml index da022ca40..eb2e1938d 100644 --- a/asmcomp/hppa/arch.ml +++ b/asmcomp/hppa/arch.ml @@ -71,4 +71,3 @@ let print_specific_operation printreg op ppf arg = | Ishift1add -> fprintf ppf "%a << 1 + %a" printreg arg.(0) printreg arg.(1) | Ishift2add -> fprintf ppf "%a << 2 + %a" printreg arg.(0) printreg arg.(1) | Ishift3add -> fprintf ppf "%a << 3 + %a" printreg arg.(0) printreg arg.(1) - diff --git a/asmcomp/hppa/emit.mlp b/asmcomp/hppa/emit.mlp index 2c81b7892..b697a335a 100644 --- a/asmcomp/hppa/emit.mlp +++ b/asmcomp/hppa/emit.mlp @@ -137,7 +137,7 @@ let emit_imports () = let is_offset n = (n < 8192) && (n >= -8192) (* 14 bits *) -let is_offset_native n = +let is_offset_native n = n < Nativeint.of_int 8192 && n >= Nativeint.of_int (-8192) let emit_load instr addr arg dst = diff --git a/asmcomp/hppa/proc.ml b/asmcomp/hppa/proc.ml index 296baa17b..c0b40adbe 100644 --- a/asmcomp/hppa/proc.ml +++ b/asmcomp/hppa/proc.ml @@ -40,18 +40,18 @@ open Mach %fr31 temporary *) let int_reg_name = [| - (* 0-4 *) "%r6"; "%r7"; "%r8"; "%r9"; "%r10"; + (* 0-4 *) "%r6"; "%r7"; "%r8"; "%r9"; "%r10"; (* 5-10 *) "%r11"; "%r12"; "%r13"; "%r14"; "%r15"; "%r16"; - (* 11-16 *) "%r17"; "%r18"; "%r19"; "%r20"; "%r21"; "%r22"; + (* 11-16 *) "%r17"; "%r18"; "%r19"; "%r20"; "%r21"; "%r22"; (* 17-20 *) "%r23"; "%r24"; "%r25"; "%r26"; (* 21-22 *) "%r28"; "%r29" |] - + let float_reg_name = [| (* 100-105 *) "%fr4"; "%fr5"; "%fr6"; "%fr7"; "%fr8"; "%fr9"; (* 106-111 *) "%fr10"; "%fr11"; "%fr12"; "%fr13"; "%fr14"; "%fr15"; (* 112-117 *) "%fr16"; "%fr17"; "%fr18"; "%fr19"; "%fr20"; "%fr21"; - (* 118-123 *) "%fr22"; "%fr23"; "%fr24"; "%fr25"; "%fr26"; "%fr27"; + (* 118-123 *) "%fr22"; "%fr23"; "%fr24"; "%fr25"; "%fr26"; "%fr27"; (* 124-127 *) "%fr28"; "%fr29"; "%fr30"; "%fr31" |] @@ -141,7 +141,7 @@ let loc_results res = let (loc, ofs) = calling_conventions 20 13 100 107 not_supported res in loc (* Calling C functions: - when all arguments are integers, use %r26 - %r23, + when all arguments are integers, use %r26 - %r23, then -52(%r30), -56(%r30), etc. When some arguments are floats, we handle a couple of cases by hand and fail otherwise. *) @@ -218,7 +218,7 @@ let contains_calls = ref false let assemble_file infile outfile = Ccomp.command (Config.asm ^ " -o " ^ - Filename.quote outfile ^ " " ^ Filename.quote infile) + Filename.quote outfile ^ " " ^ Filename.quote infile) open Clflags;; open Config;; diff --git a/asmcomp/hppa/selection.ml b/asmcomp/hppa/selection.ml index 6a0e9fe40..a13b52711 100644 --- a/asmcomp/hppa/selection.ml +++ b/asmcomp/hppa/selection.ml @@ -69,7 +69,7 @@ method select_operation op args = Cand, Cor, Cxor : never *) | (Cmuli, ([arg1; Cconst_int n] as args)) -> let l = Misc.log2 n in - if n = 1 lsl l + if n = 1 lsl l then (Iintop_imm(Ilsl, l), [arg1]) else (Iintop Imul, args) | (Cmuli, ([Cconst_int n; arg1] as args)) -> diff --git a/asmcomp/i386/arch.ml b/asmcomp/i386/arch.ml index 81f94c8fb..04d673d91 100644 --- a/asmcomp/i386/arch.ml +++ b/asmcomp/i386/arch.ml @@ -144,11 +144,10 @@ let print_specific_operation printreg op ppf arg = if i > 0 then fprintf ppf ", "; printreg ppf arg.(i) done - + (* Stack alignment constraints *) let stack_alignment = match Config.system with | "macosx" -> 16 | _ -> 4 - diff --git a/asmcomp/i386/emit_nt.mlp b/asmcomp/i386/emit_nt.mlp index a0c94e181..da1606e44 100644 --- a/asmcomp/i386/emit_nt.mlp +++ b/asmcomp/i386/emit_nt.mlp @@ -49,7 +49,7 @@ let slot_offset loc cl = | Outgoing n -> assert (n >= 0); n -(* Record symbols used and defined - at the end generate extern for those +(* Record symbols used and defined - at the end generate extern for those used but not defined *) let symbols_defined = ref StringSet.empty @@ -74,7 +74,7 @@ let emit_label lbl = (* Output an align directive. *) let emit_align n = ` ALIGN {emit_int n}\n` - + (* Output a pseudo-register *) let emit_reg = function @@ -257,7 +257,7 @@ let name_for_cond_branch = function | Iunsigned Ceq -> "e" | Iunsigned Cne -> "ne" | Iunsigned Cle -> "be" | Iunsigned Cgt -> "a" | Iunsigned Clt -> "b" | Iunsigned Cge -> "ae" - + (* Output an = 0 or <> 0 test. *) let output_test_zero arg = @@ -687,7 +687,7 @@ let emit_instr i = ` cmp {emit_reg i.arg.(0)},{emit_reg i.arg.(1)}\n`; let b = name_for_cond_branch cmp in ` j{emit_string b} {emit_label lbl}\n` - | Iinttest_imm((Isigned Ceq | Isigned Cne | + | Iinttest_imm((Isigned Ceq | Isigned Cne | Iunsigned Ceq | Iunsigned Cne) as cmp, 0) -> output_test_zero i.arg.(0); let b = name_for_cond_branch cmp in diff --git a/asmcomp/i386/proc_nt.ml b/asmcomp/i386/proc_nt.ml index 03b5a2f6b..5e617ff1a 100644 --- a/asmcomp/i386/proc_nt.ml +++ b/asmcomp/i386/proc_nt.ml @@ -183,4 +183,4 @@ let contains_calls = ref false let assemble_file infile outfile = Ccomp.command (Config.asm ^ Filename.quote outfile ^ " " ^ Filename.quote infile ^ - (if !Clflags.verbose then "" else ">NUL")) + (if !Clflags.verbose then "" else ">NUL")) diff --git a/asmcomp/i386/selection.ml b/asmcomp/i386/selection.ml index 2f0dd90ee..d9600f16d 100644 --- a/asmcomp/i386/selection.ml +++ b/asmcomp/i386/selection.ml @@ -72,7 +72,7 @@ let rec select_addr exp = end | arg -> (Alinear arg, 0) - + (* C functions to be turned into Ifloatspecial instructions if -ffast-math *) let inline_float_ops = @@ -310,7 +310,7 @@ method emit_extcall_args env args = let sz2 = Misc.align sz1 stack_alignment in let rec emit_pushes = function | [] -> - if sz2 > sz1 then + if sz2 > sz1 then self#insert (Iop (Istackoffset (sz2 - sz1))) [||] [||] | e :: el -> emit_pushes el; @@ -324,4 +324,3 @@ method emit_extcall_args env args = end let fundecl f = (new selector)#emit_fundecl f - diff --git a/asmcomp/ia64/emit.mlp b/asmcomp/ia64/emit.mlp index fb84e9e08..3d8eeb974 100644 --- a/asmcomp/ia64/emit.mlp +++ b/asmcomp/ia64/emit.mlp @@ -347,7 +347,7 @@ let insimm opc arg imm res = for i = 0 to Array.length arg - 1 do Hashtbl.add code_uses arg.(i) node done; - (* Insert in appropriate queue *) + (* Insert in appropriate queue *) if node.instr.kind = KB then add_branch node else if node.ancestors = 0 then add_ready node @@ -359,7 +359,7 @@ let insert opc arg res = let rec longest_path node = if node.length < 0 then begin - node.length <- + node.length <- List.fold_left (fun len (son, delay) -> max len (longest_path son + delay)) 0 node.sons @@ -447,10 +447,10 @@ let can_issue instr = | KF -> if !num_F < 2 then (incr num_F; true) else false | KI -> - if !num_I < 2 && !num_A + !num_I + !num_M < 4 + if !num_I < 2 && !num_A + !num_I + !num_M < 4 then (incr num_I; true) else false | KM -> - if !num_M < 2 && !num_A + !num_I + !num_M < 4 + if !num_M < 2 && !num_A + !num_I + !num_M < 4 then (incr num_M; true) else false | _ (* KB | KB_exc *) -> if !num_B < 3 then (incr num_B; true) else false @@ -481,7 +481,7 @@ let emit_node date node = end) node.sons -(* Emit all ready nodes that we can emit given the architectural +(* Emit all ready nodes that we can emit given the architectural constraints. *) let rec emit_ready_nodes filter date = @@ -561,7 +561,7 @@ let end_basic_block () = (* Compute critical paths and rebuild ready queue sorted by decreasing criticality *) let r = !ready_queue in - ready_queue := []; + ready_queue := []; let max_length = List.fold_left (fun len node -> max len (longest_path node)) 0 r in List.iter add_ready r; @@ -760,7 +760,7 @@ let is_immediate_adds n = n >= -0x2000 && n < 0x2000 let ones_pos n = let rec ones p accu = - if p >= 63 + if p >= 63 then accu else ones (p+1) (if n land (1 lsl p) = 0 then accu else p :: accu) in ones 0 [] @@ -795,7 +795,7 @@ let emit_instr i = Lend -> () | Lop(Imove | Ispill | Ireload) -> let src = i.arg.(0) and dst = i.res.(0) in - if src.loc <> dst.loc then begin + if src.loc <> dst.loc then begin match (src.loc, dst.loc) with (Reg _, Reg _) -> insert "mov" (regs i.arg) (regs i.res) @@ -1198,7 +1198,7 @@ let emit_instr i = | Lpushtrap -> end_basic_block(); stack_offset := !stack_offset + 16; - (* Store trap pointer at sp, handler addr at sp+8, + (* Store trap pointer at sp, handler addr at sp+8, and decrement sp by 16. Remember, the bottom 16 bytes of the stack must be left free. *) ` add r3 = 8, sp\n`; diff --git a/asmcomp/ia64/proc.ml b/asmcomp/ia64/proc.ml index a82536586..15311aa02 100644 --- a/asmcomp/ia64/proc.ml +++ b/asmcomp/ia64/proc.ml @@ -71,10 +71,10 @@ let int_reg_name = [| "r88"; "r89"; "r90"; "r91"; (* 80-81 *) "r14"; "r15" |] - + let float_reg_name = [| (* 0-13 *) "f2"; "f3"; "f4"; "f5"; "f6"; "f7"; - "f8"; "f9"; "f10"; "f11"; "f12"; "f13"; "f14"; "f15"; + "f8"; "f9"; "f10"; "f11"; "f12"; "f13"; "f14"; "f15"; (* 14-29 *) "f16"; "f17"; "f18"; "f19"; "f20"; "f21"; "f22"; "f23"; "f24"; "f25"; "f26"; "f27"; "f28"; "f29"; "f30"; "f31"; (* 30-61 *) "f32"; "f33"; "f34"; "f35"; "f36"; "f37"; "f38"; "f39"; diff --git a/asmcomp/ia64/scheduling.ml b/asmcomp/ia64/scheduling.ml index ad6480152..9bed03a6c 100644 --- a/asmcomp/ia64/scheduling.ml +++ b/asmcomp/ia64/scheduling.ml @@ -14,7 +14,7 @@ open Schedgen (* to create a dependency *) -(* We don't schedule here on the linearized code, but instead schedule the +(* We don't schedule here on the linearized code, but instead schedule the assembly code generated in Emit. *) let fundecl f = f diff --git a/asmcomp/ia64/selection.ml b/asmcomp/ia64/selection.ml index 949ef884e..86d269172 100644 --- a/asmcomp/ia64/selection.ml +++ b/asmcomp/ia64/selection.ml @@ -106,7 +106,7 @@ method select_operation op args = Turn general division and modulus into calls to C library functions *) | (Cdivi, [arg; Cconst_int n]) when n = 1 lsl (Misc.log2 n) -> (Iintop_imm(Idiv, n), [arg]) - | (Cdivi, _) -> + | (Cdivi, _) -> (Iextcall("__divdi3", false), args) | (Cmodi, [arg; Cconst_int n]) when n = 1 lsl (Misc.log2 n) && n <> 1 -> (Iintop_imm(Imod, n), [arg]) diff --git a/asmcomp/interf.ml b/asmcomp/interf.ml index b6c0dc451..30f17b725 100644 --- a/asmcomp/interf.ml +++ b/asmcomp/interf.ml @@ -98,7 +98,7 @@ let build_graph fundecl = | Iexit _ -> () | Itrywith(body, handler) -> - add_interf_set Proc.destroyed_at_raise handler.live; + add_interf_set Proc.destroyed_at_raise handler.live; interf body; interf handler; interf i.next | Iraise -> () in diff --git a/asmcomp/linearize.ml b/asmcomp/linearize.ml index 47e4dc68a..5833595ae 100644 --- a/asmcomp/linearize.ml +++ b/asmcomp/linearize.ml @@ -49,7 +49,7 @@ and instruction_desc = let has_fallthrough = function | Lreturn | Lbranch _ | Lswitch _ | Lraise | Lop Itailcall_ind | Lop (Itailcall_imm _) -> false - | _ -> true + | _ -> true type fundecl = { fun_name: string; @@ -84,13 +84,13 @@ let rec end_instr = (* Cons an instruction (live, debug empty) *) let instr_cons d a r n = - { desc = d; next = n; arg = a; res = r; + { desc = d; next = n; arg = a; res = r; dbg = Debuginfo.none; live = Reg.Set.empty } (* Cons a simple instruction (arg, res, live empty) *) let cons_instr d n = - { desc = d; next = n; arg = [||]; res = [||]; + { desc = d; next = n; arg = [||]; res = [||]; dbg = Debuginfo.none; live = Reg.Set.empty } (* Build an instruction with arg, res, dbg, live taken from @@ -98,7 +98,7 @@ let cons_instr d n = let copy_instr d i n = { desc = d; next = n; - arg = i.Mach.arg; res = i.Mach.res; + arg = i.Mach.arg; res = i.Mach.res; dbg = i.Mach.dbg; live = i.Mach.live } (* @@ -187,7 +187,7 @@ let rec linear i n = copy_instr (Lcondbranch(test, lbl)) i (linear ifnot n1) | _, Iend, Lbranch lbl -> copy_instr (Lcondbranch(invert_test test, lbl)) i (linear ifso n1) - | Iexit nfail1, Iexit nfail2, _ + | Iexit nfail1, Iexit nfail2, _ when is_next_catch nfail1 -> let lbl2 = find_exit_label nfail2 in copy_instr diff --git a/asmcomp/linearize.mli b/asmcomp/linearize.mli index 59985acad..aaf03184c 100644 --- a/asmcomp/linearize.mli +++ b/asmcomp/linearize.mli @@ -42,7 +42,7 @@ and instruction_desc = val has_fallthrough : instruction_desc -> bool val end_instr: instruction -val instr_cons: +val instr_cons: instruction_desc -> Reg.t array -> Reg.t array -> instruction -> instruction val invert_test: Mach.test -> Mach.test @@ -52,4 +52,3 @@ type fundecl = fun_fast: bool } val fundecl: Mach.fundecl -> fundecl - diff --git a/asmcomp/mach.ml b/asmcomp/mach.ml index 13c831fc1..027550ab1 100644 --- a/asmcomp/mach.ml +++ b/asmcomp/mach.ml @@ -82,23 +82,23 @@ type fundecl = fun_fast: bool } let rec dummy_instr = - { desc = Iend; + { desc = Iend; next = dummy_instr; - arg = [||]; + arg = [||]; res = [||]; dbg = Debuginfo.none; live = Reg.Set.empty } let end_instr () = - { desc = Iend; + { desc = Iend; next = dummy_instr; - arg = [||]; + arg = [||]; res = [||]; dbg = Debuginfo.none; live = Reg.Set.empty } let instr_cons d a r n = - { desc = d; next = n; arg = a; res = r; + { desc = d; next = n; arg = a; res = r; dbg = Debuginfo.none; live = Reg.Set.empty } let instr_cons_debug d a r dbg n = @@ -128,5 +128,4 @@ let rec instr_iter f i = instr_iter f body; instr_iter f handler; instr_iter f i.next | Iraise -> () | _ -> - instr_iter f i.next - + instr_iter f i.next diff --git a/asmcomp/mach.mli b/asmcomp/mach.mli index f1b5eae8b..438d15d2f 100644 --- a/asmcomp/mach.mli +++ b/asmcomp/mach.mli @@ -71,7 +71,7 @@ and instruction_desc = | Iswitch of int array * instruction array | Iloop of instruction | Icatch of int * instruction * instruction - | Iexit of int + | Iexit of int | Itrywith of instruction * instruction | Iraise @@ -83,11 +83,10 @@ type fundecl = val dummy_instr: instruction val end_instr: unit -> instruction -val instr_cons: +val instr_cons: instruction_desc -> Reg.t array -> Reg.t array -> instruction -> instruction -val instr_cons_debug: +val instr_cons_debug: instruction_desc -> Reg.t array -> Reg.t array -> Debuginfo.t -> instruction -> instruction val instr_iter: (instruction -> unit) -> instruction -> unit - diff --git a/asmcomp/mips/emit.mlp b/asmcomp/mips/emit.mlp index 6908ccfd4..06915fd34 100644 --- a/asmcomp/mips/emit.mlp +++ b/asmcomp/mips/emit.mlp @@ -94,7 +94,7 @@ let emit_addressing addr r n = let int_reg_number = [| 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21 |] - + let float_reg_number = [| 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30 |] diff --git a/asmcomp/mips/proc.ml b/asmcomp/mips/proc.ml index 6ac37a4c0..53971890e 100644 --- a/asmcomp/mips/proc.ml +++ b/asmcomp/mips/proc.ml @@ -50,7 +50,7 @@ let int_reg_name = [| (* 6-13 *) "$8"; "$9"; "$10"; "$11"; "$12"; "$13"; "$14"; "$15"; (* 14-19 *) "$16"; "$17"; "$18"; "$19"; "$20"; "$21" |] - + let float_reg_name = [| "$f0"; "$f1"; "$f2"; "$f3"; "$f4"; "$f5"; "$f6"; "$f7"; "$f8"; "$f9"; @@ -143,7 +143,7 @@ let loc_results res = or float regs $f12...$f19. Each argument "consumes" both one slot in the int register file and one slot in the float register file. Extra arguments are passed on stack, in a 64-bits slot, right-justified - (i.e. at +4 from natural address). *) + (i.e. at +4 from natural address). *) let loc_external_arguments arg = let loc = Array.create (Array.length arg) Reg.dummy in diff --git a/asmcomp/power/arch.ml b/asmcomp/power/arch.ml index 729601650..8828de7c0 100644 --- a/asmcomp/power/arch.ml +++ b/asmcomp/power/arch.ml @@ -84,4 +84,3 @@ let print_specific_operation printreg op ppf arg = printreg arg.(0) printreg arg.(1) printreg arg.(2) | Ialloc_far n -> fprintf ppf "alloc_far %d" n - diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp index ec3abbde4..b6496f987 100644 --- a/asmcomp/power/emit.mlp +++ b/asmcomp/power/emit.mlp @@ -116,7 +116,7 @@ let emit_reg r = Reg r -> emit_string (register_name r) | _ -> fatal_error "Emit.emit_reg" -let use_full_regnames = +let use_full_regnames = Config.system = "rhapsody" let emit_gpr r = @@ -607,13 +607,13 @@ let rec emit_instr i dslot = | Lop(Iintop_imm(Idiv, n)) -> (* n is guaranteed to be a power of 2 *) let l = Misc.log2 n in ` {emit_string sragi} {emit_reg i.res.(0)}, {emit_reg i.arg.(0)}, {emit_int l}\n`; - ` addze {emit_reg i.res.(0)}, {emit_reg i.res.(0)}\n` + ` addze {emit_reg i.res.(0)}, {emit_reg i.res.(0)}\n` | Lop(Iintop_imm(Imod, n)) -> (* n is guaranteed to be a power of 2 *) let l = Misc.log2 n in ` {emit_string sragi} {emit_gpr 0}, {emit_reg i.arg.(0)}, {emit_int l}\n`; ` addze {emit_gpr 0}, {emit_gpr 0}\n`; ` {emit_string slgi} {emit_gpr 0}, {emit_gpr 0}, {emit_int l}\n`; - ` subfc {emit_reg i.res.(0)}, {emit_gpr 0}, {emit_reg i.arg.(0)}\n` + ` subfc {emit_reg i.res.(0)}, {emit_gpr 0}, {emit_reg i.arg.(0)}\n` | Lop(Iintop_imm(Icomp cmp, n)) -> begin match cmp with Isigned c -> diff --git a/asmcomp/power/proc.ml b/asmcomp/power/proc.ml index 5d09342a8..ab8e5a5d5 100644 --- a/asmcomp/power/proc.ml +++ b/asmcomp/power/proc.ml @@ -45,14 +45,14 @@ let word_addressed = false let int_reg_name = if Config.system = "rhapsody" then - [| "r3"; "r4"; "r5"; "r6"; "r7"; "r8"; "r9"; "r10"; + [| "r3"; "r4"; "r5"; "r6"; "r7"; "r8"; "r9"; "r10"; "r14"; "r15"; "r16"; "r17"; "r18"; "r19"; "r20"; "r21"; "r22"; "r23"; "r24"; "r25"; "r26"; "r27"; "r28" |] else - [| "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; + [| "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "14"; "15"; "16"; "17"; "18"; "19"; "20"; "21"; "22"; "23"; "24"; "25"; "26"; "27"; "28" |] - + let float_reg_name = if Config.system = "rhapsody" then [| "f1"; "f2"; "f3"; "f4"; "f5"; "f6"; "f7"; "f8"; diff --git a/asmcomp/power/scheduling.ml b/asmcomp/power/scheduling.ml index ef3a77b34..aac37c879 100644 --- a/asmcomp/power/scheduling.ml +++ b/asmcomp/power/scheduling.ml @@ -63,4 +63,3 @@ method reload_retaddr_issue_cycles = 3 end let fundecl f = (new scheduler)#schedule_fundecl f - diff --git a/asmcomp/power/selection.ml b/asmcomp/power/selection.ml index f3880b0da..2818c4fd5 100644 --- a/asmcomp/power/selection.ml +++ b/asmcomp/power/selection.ml @@ -69,7 +69,7 @@ method select_operation op args = a power of 2, which do not correspond to an instruction. *) (Cdivi, [arg; Cconst_int n]) when n = 1 lsl (Misc.log2 n) -> (Iintop_imm(Idiv, n), [arg]) - | (Cdivi, _) -> + | (Cdivi, _) -> (Iintop Idiv, args) | (Cmodi, [arg; Cconst_int n]) when n = 1 lsl (Misc.log2 n) -> (Iintop_imm(Imod, n), [arg]) diff --git a/asmcomp/printcmm.ml b/asmcomp/printcmm.ml index 0d592ac03..364d9ea88 100644 --- a/asmcomp/printcmm.ml +++ b/asmcomp/printcmm.ml @@ -108,7 +108,7 @@ let rec expr ppf = function | Clet(id, def, body) -> fprintf ppf "@[<2>(let@ @[<2>%a@ %a@]@ %a)@]" - Ident.print id expr def sequence body + Ident.print id expr def sequence body | Cassign(id, exp) -> fprintf ppf "@[<2>(assign @[<2>%a@ %a@])@]" Ident.print id expr exp | Ctuple el -> @@ -142,7 +142,7 @@ let rec expr ppf = function for i = 0 to Array.length cases - 1 do fprintf ppf "@ @[<2>%t@ %a@]" (print_case i) sequence cases.(i) done in - fprintf ppf "@[@[<2>(switch@ %a@ @]%t)@]" expr e1 print_cases + fprintf ppf "@[@[<2>(switch@ %a@ @]%t)@]" expr e1 print_cases | Cloop e -> fprintf ppf "@[<2>(loop@ %a)@]" sequence e | Ccatch(i, ids, e1, e2) -> @@ -172,7 +172,7 @@ let fundecl ppf f = let print_cases ppf cases = let first = ref true in List.iter - (fun (id, ty) -> + (fun (id, ty) -> if !first then first := false else fprintf ppf "@ "; fprintf ppf "%a: %a" Ident.print id machtype ty) cases in diff --git a/asmcomp/printmach.ml b/asmcomp/printmach.ml index bd1006a93..d7d538df3 100644 --- a/asmcomp/printmach.ml +++ b/asmcomp/printmach.ml @@ -27,7 +27,7 @@ let reg ppf r = fprintf ppf "/%i" r.stamp; begin match r.loc with | Unknown -> () - | Reg r -> + | Reg r -> fprintf ppf "[%s]" (Proc.register_name r) | Stack(Local s) -> fprintf ppf "[s%i]" s diff --git a/asmcomp/reg.ml b/asmcomp/reg.ml index 42670c472..f9bef4967 100644 --- a/asmcomp/reg.ml +++ b/asmcomp/reg.ml @@ -82,7 +82,7 @@ let first_virtual_reg_stamp = ref (-1) let reset() = (* When reset() is called for the first time, the current stamp reflects all hard pseudo-registers that have been allocated by Proc, so - remember it and use it as the base stamp for allocating + remember it and use it as the base stamp for allocating soft pseudo-registers *) if !first_virtual_reg_stamp = -1 then first_virtual_reg_stamp := !currstamp; currstamp := !first_virtual_reg_stamp; diff --git a/asmcomp/reload.mli b/asmcomp/reload.mli index a562b4fbc..fc72446e7 100644 --- a/asmcomp/reload.mli +++ b/asmcomp/reload.mli @@ -15,4 +15,3 @@ (* Insert load/stores for pseudoregs that got assigned to stack locations. *) val fundecl: Mach.fundecl -> Mach.fundecl * bool - diff --git a/asmcomp/reloadgen.ml b/asmcomp/reloadgen.ml index c8e9f4919..898c65c98 100644 --- a/asmcomp/reloadgen.ml +++ b/asmcomp/reloadgen.ml @@ -109,13 +109,13 @@ method private reload i = (self#reload i.next))} | Iifthenelse(tst, ifso, ifnot) -> let newarg = self#reload_test tst i.arg in - insert_moves i.arg newarg + insert_moves i.arg newarg (instr_cons (Iifthenelse(tst, self#reload ifso, self#reload ifnot)) newarg [||] (self#reload i.next)) | Iswitch(index, cases) -> let newarg = self#makeregs i.arg in - insert_moves i.arg newarg + insert_moves i.arg newarg (instr_cons (Iswitch(index, Array.map (self#reload) cases)) newarg [||] (self#reload i.next)) | Iloop body -> diff --git a/asmcomp/schedgen.ml b/asmcomp/schedgen.ml index fae061b19..388d0d4c8 100644 --- a/asmcomp/schedgen.ml +++ b/asmcomp/schedgen.ml @@ -91,7 +91,7 @@ let rec longest_path critical_outputs node = then node.delay else 0 | sons -> - node.length <- + node.length <- List.fold_left (fun len (son, delay) -> max len (longest_path critical_outputs son + delay)) @@ -287,7 +287,7 @@ method private ready_instruction date queue = then instr else best in extract new_best rem in extract dummy_node queue - + (* Schedule a basic block, adding its instructions in front of the given instruction sequence *) diff --git a/asmcomp/selectgen.ml b/asmcomp/selectgen.ml index 079ae5401..0b75c64bd 100644 --- a/asmcomp/selectgen.ml +++ b/asmcomp/selectgen.ml @@ -259,8 +259,8 @@ method select_operation op args = | (Cnegf, _) -> (Inegf, args) | (Cabsf, _) -> (Iabsf, args) | (Caddf, _) -> (Iaddf, args) - | (Csubf, _) -> (Isubf, args) - | (Cmulf, _) -> (Imulf, args) + | (Csubf, _) -> (Isubf, args) + | (Cmulf, _) -> (Imulf, args) | (Cdivf, _) -> (Idivf, args) | (Cfloatofint, _) -> (Ifloatofint, args) | (Cintoffloat, _) -> (Iintoffloat, args) @@ -381,7 +381,7 @@ method insert_move_results loc res stacksize = self#insert_moves loc res (* Add an Iop opcode. Can be overriden by processor description - to insert moves before and after the operation, i.e. for two-address + to insert moves before and after the operation, i.e. for two-address instructions, or instructions using dedicated registers. *) method insert_op_debug op dbg rs rd = @@ -506,7 +506,7 @@ method emit_expr env exp = let r1 = self#emit_tuple env new_args in let rd = self#regs_for ty in Some (self#insert_op_debug op dbg r1 rd) - end + end | Csequence(e1, e2) -> begin match self#emit_expr env e1 with None -> None @@ -545,7 +545,7 @@ method emit_expr env exp = (fun id -> let r = self#regs_for typ_addr in name_regs id r; r) ids in - catch_regs := (nfail, Array.concat rs) :: !catch_regs ; + catch_regs := (nfail, Array.concat rs) :: !catch_regs ; let (r1, s1) = self#emit_sequence env e1 in catch_regs := List.tl !catch_regs ; let new_env = @@ -768,7 +768,7 @@ method emit_tail env exp = name_regs id r ; r) ids in - catch_regs := (nfail, Array.concat rs) :: !catch_regs ; + catch_regs := (nfail, Array.concat rs) :: !catch_regs ; let s1 = self#emit_tail_sequence env e1 in catch_regs := List.tl !catch_regs ; let new_env = diff --git a/asmcomp/selectgen.mli b/asmcomp/selectgen.mli index 6d7bd2948..fa2cddcf0 100644 --- a/asmcomp/selectgen.mli +++ b/asmcomp/selectgen.mli @@ -62,7 +62,7 @@ class virtual selector_generic : object (* The following method is the entry point and should not be overriden *) method emit_fundecl : Cmm.fundecl -> Mach.fundecl - + (* The following methods should not be overriden. They cannot be declared "private" in the current implementation because they are not always applied to "self", but ideally they should be private. *) diff --git a/asmcomp/sparc/proc.ml b/asmcomp/sparc/proc.ml index 91f1c8e73..2fd147bfc 100644 --- a/asmcomp/sparc/proc.ml +++ b/asmcomp/sparc/proc.ml @@ -50,7 +50,7 @@ let int_reg_name = [| (* 12-16 *) "%l0"; "%l1"; "%l2"; "%l3"; "%l4"; (* 17-18 *) "%g3"; "%g4" |] - + let float_reg_name = [| (* 100-105 *) "%f0"; "%f2"; "%f4"; "%f6"; "%f8"; "%f10"; (* 106-109 *) "%f12"; "%f14"; "%f16"; "%f18"; diff --git a/asmcomp/sparc/scheduling.ml b/asmcomp/sparc/scheduling.ml index fc6623901..efe9a1f4c 100644 --- a/asmcomp/sparc/scheduling.ml +++ b/asmcomp/sparc/scheduling.ml @@ -62,4 +62,3 @@ method oper_issue_cycles = function end let fundecl f = (new scheduler)#schedule_fundecl f - diff --git a/asmcomp/spill.ml b/asmcomp/spill.ml index 255795c71..968987d48 100644 --- a/asmcomp/spill.ml +++ b/asmcomp/spill.ml @@ -12,7 +12,7 @@ (* $Id$ *) -(* Insertion of moves to suggest possible spilling / reloading points +(* Insertion of moves to suggest possible spilling / reloading points before register allocation. *) open Reg @@ -130,7 +130,7 @@ let find_reload_at_exit k = List.assoc k !reload_at_exit with | Not_found -> Misc.fatal_error "Spill.find_reload_at_exit" - + let reload_at_break = ref Reg.Set.empty let rec reload i before = @@ -400,4 +400,3 @@ let fundecl f = fun_args = f.fun_args; fun_body = new_body; fun_fast = f.fun_fast } - diff --git a/asmcomp/spill.mli b/asmcomp/spill.mli index 966d471fd..16a8c01ad 100644 --- a/asmcomp/spill.mli +++ b/asmcomp/spill.mli @@ -12,7 +12,7 @@ (* $Id$ *) -(* Insertion of moves to suggest possible spilling / reloading points +(* Insertion of moves to suggest possible spilling / reloading points before register allocation. *) val fundecl: Mach.fundecl -> Mach.fundecl diff --git a/asmcomp/split.ml b/asmcomp/split.ml index 1fcbb0749..9e6130d21 100644 --- a/asmcomp/split.ml +++ b/asmcomp/split.ml @@ -189,7 +189,7 @@ let rec rename i sub = | Iraise -> (instr_cons_debug Iraise (subst_regs i.arg sub) [||] i.dbg i.next, None) - + (* Second pass: replace registers by their final representatives *) let set_repres i = diff --git a/asmrun/alpha.S b/asmrun/alpha.S index dd2e77273..c5251b73a 100644 --- a/asmrun/alpha.S +++ b/asmrun/alpha.S @@ -80,7 +80,7 @@ caml_allocN: .set at ret ($26) .end caml_allocN - + .globl caml_call_gc .ent caml_call_gc .align 3 diff --git a/asmrun/amd64.S b/asmrun/amd64.S index e1bec27a9..3268a3182 100644 --- a/asmrun/amd64.S +++ b/asmrun/amd64.S @@ -52,7 +52,7 @@ FUNCTION(G(caml_call_gc)) movq %rax, G(caml_last_return_address)(%rip) leaq 8(%rsp), %rax movq %rax, G(caml_bottom_of_stack)(%rip) -.L105: +.L105: /* Save caml_young_ptr, caml_exception_pointer */ movq %r15, G(caml_young_ptr)(%rip) movq %r14, G(caml_exception_pointer)(%rip) diff --git a/asmrun/amd64nt.asm b/asmrun/amd64nt.asm index a21e08606..894331418 100644 --- a/asmrun/amd64nt.asm +++ b/asmrun/amd64nt.asm @@ -1,13 +1,13 @@ ;********************************************************************* -; -; Objective Caml ; -; Xavier Leroy, projet Gallium, INRIA Rocquencourt +; Objective Caml ; -; Copyright 2006 Institut National de Recherche en Informatique et -; en Automatique. All rights reserved. This file is distributed -; under the terms of the GNU Library General Public License, with -; the special exception on linking described in file ../LICENSE. +; Xavier Leroy, projet Gallium, INRIA Rocquencourt +; +; Copyright 2006 Institut National de Recherche en Informatique et +; en Automatique. All rights reserved. This file is distributed +; under the terms of the GNU Library General Public License, with +; the special exception on linking described in file ../LICENSE. ; ;********************************************************************* @@ -46,11 +46,11 @@ caml_call_gc: mov caml_last_return_address, rax lea rax, [rsp+8] mov caml_bottom_of_stack, rax -L105: +L105: ; Save caml_young_ptr, caml_exception_pointer mov caml_young_ptr, r15 mov caml_exception_pointer, r14 - ; Build array of registers, save it into caml_gc_regs + ; Build array of registers, save it into caml_gc_regs push r13 push r12 push rbp @@ -65,7 +65,7 @@ L105: push rbx push rax mov caml_gc_regs, rsp - ; Save floating-point registers + ; Save floating-point registers sub rsp, 16*8 movlpd QWORD PTR [rsp + 0*8], xmm0 movlpd QWORD PTR [rsp + 1*8], xmm1 @@ -83,9 +83,9 @@ L105: movlpd QWORD PTR [rsp + 13*8], xmm13 movlpd QWORD PTR [rsp + 14*8], xmm14 movlpd QWORD PTR [rsp + 15*8], xmm15 - ; Call the garbage collector + ; Call the garbage collector call caml_garbage_collection - ; Restore all regs used by the code generator + ; Restore all regs used by the code generator movlpd xmm0, QWORD PTR [rsp + 0*8] movlpd xmm1, QWORD PTR [rsp + 1*8] movlpd xmm2, QWORD PTR [rsp + 2*8] @@ -116,10 +116,10 @@ L105: pop rbp pop r12 pop r13 - ; Restore caml_young_ptr, caml_exception_pointer + ; Restore caml_young_ptr, caml_exception_pointer mov r15, caml_young_ptr mov r14, caml_exception_pointer - ; Return to caller + ; Return to caller ret PUBLIC caml_alloc1 @@ -181,41 +181,41 @@ caml_allocN: jb L103 ret L103: - push rax ; save desired size + push rax ; save desired size mov rax, [rsp + 8] mov caml_last_return_address, rax lea rax, [rsp + 16] mov caml_bottom_of_stack, rax call L105 - pop rax ; recover desired size + pop rax ; recover desired size jmp caml_allocN -; Call a C function from Caml +; Call a C function from Caml PUBLIC caml_c_call ALIGN 16 caml_c_call: - ; Record lowest stack address and return address + ; Record lowest stack address and return address pop r12 mov caml_last_return_address, r12 mov caml_bottom_of_stack, rsp - ; Make the exception handler and alloc ptr available to the C code + ; Make the exception handler and alloc ptr available to the C code mov caml_young_ptr, r15 mov caml_exception_pointer, r14 - ; Call the function (address in rax) + ; Call the function (address in rax) call rax - ; Reload alloc ptr + ; Reload alloc ptr mov r15, caml_young_ptr - ; Return to caller + ; Return to caller push r12 ret -; Start the Caml program +; Start the Caml program PUBLIC caml_start_program ALIGN 16 caml_start_program: - ; Save callee-save registers + ; Save callee-save registers push rbx push rbp push rsi @@ -235,39 +235,39 @@ caml_start_program: movapd OWORD PTR [rsp + 7*16], xmm13 movapd OWORD PTR [rsp + 8*16], xmm14 movapd OWORD PTR [rsp + 9*16], xmm15 - ; Initial entry point is caml_program + ; Initial entry point is caml_program lea r12, caml_program - ; Common code for caml_start_program and caml_callback* + ; Common code for caml_start_program and caml_callback* L106: - ; Build a callback link - sub rsp, 8 ; stack 16-aligned + ; Build a callback link + sub rsp, 8 ; stack 16-aligned push caml_gc_regs push caml_last_return_address push caml_bottom_of_stack - ; Setup alloc ptr and exception ptr + ; Setup alloc ptr and exception ptr mov r15, caml_young_ptr mov r14, caml_exception_pointer - ; Build an exception handler + ; Build an exception handler lea r13, L108 push r13 push r14 mov r14, rsp - ; Call the Caml code + ; Call the Caml code call r12 L107: - ; Pop the exception handler + ; Pop the exception handler pop r14 - pop r12 ; dummy register + pop r12 ; dummy register L109: - ; Update alloc ptr and exception ptr + ; Update alloc ptr and exception ptr mov caml_young_ptr, r15 mov caml_exception_pointer, r14 - ; Pop the callback restoring, link the global variables + ; Pop the callback restoring, link the global variables pop caml_bottom_of_stack pop caml_last_return_address pop caml_gc_regs add rsp, 8 - ; Restore callee-save registers. + ; Restore callee-save registers. movapd xmm6, OWORD PTR [rsp + 0*16] movapd xmm7, OWORD PTR [rsp + 1*16] movapd xmm8, OWORD PTR [rsp + 2*16] @@ -291,7 +291,7 @@ L109: ret L108: ; Exception handler - ; Mark the bucket as an exception result and return it + ; Mark the bucket as an exception result and return it or rax, 2 jmp L109 @@ -318,7 +318,7 @@ L110: pop r14 ; Recover previous exception handler ret ; Branch to handler -; Raise an exception from C +; Raise an exception from C PUBLIC caml_raise_exception ALIGN 16 @@ -327,8 +327,8 @@ caml_raise_exception: jne L111 mov rax, rcx ; First argument is exn bucket mov rsp, caml_exception_pointer - pop r14 ; Recover previous exception handler - mov r15, caml_young_ptr ; Reload alloc ptr + pop r14 ; Recover previous exception handler + mov r15, caml_young_ptr ; Reload alloc ptr ret L111: mov r12, rcx ; Save exception bucket in r12 @@ -340,16 +340,16 @@ L111: call caml_stash_backtrace mov rax, r12 ; Recover exception bucket mov rsp, caml_exception_pointer - pop r14 ; Recover previous exception handler - mov r15, caml_young_ptr ; Reload alloc ptr + pop r14 ; Recover previous exception handler + mov r15, caml_young_ptr ; Reload alloc ptr ret -; Callback from C to Caml +; Callback from C to Caml PUBLIC caml_callback_exn ALIGN 16 caml_callback_exn: - ; Save callee-save registers + ; Save callee-save registers push rbx push rbp push rsi @@ -369,16 +369,16 @@ caml_callback_exn: movapd OWORD PTR [rsp + 7*16], xmm13 movapd OWORD PTR [rsp + 8*16], xmm14 movapd OWORD PTR [rsp + 9*16], xmm15 - ; Initial loading of arguments - mov rbx, rcx ; closure - mov rax, rdx ; argument - mov r12, [rbx] ; code pointer + ; Initial loading of arguments + mov rbx, rcx ; closure + mov rax, rdx ; argument + mov r12, [rbx] ; code pointer jmp L106 PUBLIC caml_callback2_exn ALIGN 16 caml_callback2_exn: - ; Save callee-save registers + ; Save callee-save registers push rbx push rbp push rsi @@ -398,17 +398,17 @@ caml_callback2_exn: movapd OWORD PTR [rsp + 7*16], xmm13 movapd OWORD PTR [rsp + 8*16], xmm14 movapd OWORD PTR [rsp + 9*16], xmm15 - ; Initial loading of arguments + ; Initial loading of arguments mov rdi, rcx ; closure - mov rax, rdx ; first argument - mov rbx, r8 ; second argument - lea r12, caml_apply2 ; code pointer + mov rax, rdx ; first argument + mov rbx, r8 ; second argument + lea r12, caml_apply2 ; code pointer jmp L106 PUBLIC caml_callback3_exn ALIGN 16 caml_callback3_exn: - ; Save callee-save registers + ; Save callee-save registers push rbx push rbp push rsi @@ -428,12 +428,12 @@ caml_callback3_exn: movapd OWORD PTR [rsp + 7*16], xmm13 movapd OWORD PTR [rsp + 8*16], xmm14 movapd OWORD PTR [rsp + 9*16], xmm15 - ; Initial loading of arguments + ; Initial loading of arguments mov rsi, rcx ; closure - mov rax, rdx ; first argument - mov rbx, r8 ; second argument - mov rdi, r9 ; third argument - lea r12, caml_apply3 ; code pointer + mov rax, rdx ; first argument + mov rbx, r8 ; second argument + mov rdi, r9 ; third argument + lea r12, caml_apply3 ; code pointer jmp L106 PUBLIC caml_ml_array_bound_error @@ -445,10 +445,10 @@ caml_ml_array_bound_error: .DATA PUBLIC caml_system__frametable caml_system__frametable LABEL QWORD - QWORD 1 ; one descriptor - QWORD L107 ; return address into callback - WORD -1 ; negative frame size => use callback link - WORD 0 ; no roots here + QWORD 1 ; one descriptor + QWORD L107 ; return address into callback + WORD -1 ; negative frame size => use callback link + WORD 0 ; no roots here ALIGN 8 PUBLIC caml_negf_mask diff --git a/asmrun/backtrace.c b/asmrun/backtrace.c index 1b39bfb94..0825cade5 100644 --- a/asmrun/backtrace.c +++ b/asmrun/backtrace.c @@ -131,7 +131,7 @@ static void extract_location_info(frame_descr * d, uint32 info1, info2; /* If no debugging information available, print nothing. - When everything is compiled with -g, this corresponds to + When everything is compiled with -g, this corresponds to compiler-inserted re-raise operations. */ if ((d->frame_size & 1) == 0) { li->loc_valid = 0; @@ -147,7 +147,7 @@ static void extract_location_info(frame_descr * d, info2 = ((uint32 *)infoptr)[1]; /* Format of the two info words: llllllllllllllllllll aaaaaaaa bbbbbbbbbb nnnnnnnnnnnnnnnnnnnnnnnn kk - 44 36 26 2 0 + 44 36 26 2 0 (32+12) (32+4) k ( 2 bits): 0 if it's a call, 1 if it's a raise n (24 bits): offset (in 4-byte words) of file name relative to infoptr @@ -222,4 +222,3 @@ CAMLprim value caml_get_exception_backtrace(value unit) res = caml_alloc_small(1, 0); Field(res, 0) = arr; /* Some */ CAMLreturn(res); } - diff --git a/asmrun/hppa.S b/asmrun/hppa.S index b795f52b0..abdd4554b 100644 --- a/asmrun/hppa.S +++ b/asmrun/hppa.S @@ -366,7 +366,7 @@ L102: ldo LOW(G(caml_young_limit))(%r1), %r4 ; Call the Caml code ble 0(4, %r22) - copy %r31, %r2 + copy %r31, %r2 L104: ; Pop the trap frame ldw -8(%r30), %r31 diff --git a/asmrun/i386nt.asm b/asmrun/i386nt.asm index 7d51a7ec1..711449cfb 100644 --- a/asmrun/i386nt.asm +++ b/asmrun/i386nt.asm @@ -1,13 +1,13 @@ ;********************************************************************* -; -; Objective Caml ; -; Xavier Leroy, projet Cristal, INRIA Rocquencourt +; Objective Caml ; -; Copyright 1996 Institut National de Recherche en Informatique et -; en Automatique. All rights reserved. This file is distributed -; under the terms of the GNU Library General Public License, with -; the special exception on linking described in file ../LICENSE. +; Xavier Leroy, projet Cristal, INRIA Rocquencourt +; +; Copyright 1996 Institut National de Recherche en Informatique et +; en Automatique. All rights reserved. This file is distributed +; under the terms of the GNU Library General Public License, with +; the special exception on linking described in file ../LICENSE. ; ;********************************************************************* @@ -32,7 +32,7 @@ EXTERN _caml_backtrace_active: DWORD EXTERN _caml_stash_backtrace: PROC -; Allocation +; Allocation .CODE PUBLIC _caml_alloc1 @@ -42,12 +42,12 @@ PUBLIC _caml_call_gc _caml_call_gc: - ; Record lowest stack address and return address + ; Record lowest stack address and return address mov eax, [esp] mov _caml_last_return_address, eax lea eax, [esp+4] mov _caml_bottom_of_stack, eax - ; Save all regs used by the code generator + ; Save all regs used by the code generator L105: push ebp push edi push esi @@ -56,9 +56,9 @@ L105: push ebp push ebx push eax mov _caml_gc_regs, esp - ; Call the garbage collector + ; Call the garbage collector call _caml_garbage_collection - ; Restore all regs used by the code generator + ; Restore all regs used by the code generator pop eax pop ebx pop ecx @@ -66,8 +66,8 @@ L105: push ebp pop esi pop edi pop ebp - ; Return to caller - ret + ; Return to caller + ret ALIGN 4 _caml_alloc1: @@ -76,7 +76,7 @@ _caml_alloc1: mov _caml_young_ptr, eax cmp eax, _caml_young_limit jb L100 - ret + ret L100: mov eax, [esp] mov _caml_last_return_address, eax lea eax, [esp+4] @@ -91,7 +91,7 @@ _caml_alloc2: mov _caml_young_ptr, eax cmp eax, _caml_young_limit jb L101 - ret + ret L101: mov eax, [esp] mov _caml_last_return_address, eax lea eax, [esp+4] @@ -106,7 +106,7 @@ _caml_alloc3: mov _caml_young_ptr, eax cmp eax, _caml_young_limit jb L102 - ret + ret L102: mov eax, [esp] mov _caml_last_return_address, eax lea eax, [esp+4] @@ -134,25 +134,25 @@ L103: sub eax, _caml_young_ptr ; eax = - size pop eax ; recover desired size jmp _caml_allocN -; Call a C function from Caml +; Call a C function from Caml PUBLIC _caml_c_call ALIGN 4 _caml_c_call: - ; Record lowest stack address and return address + ; Record lowest stack address and return address mov edx, [esp] mov _caml_last_return_address, edx lea edx, [esp+4] mov _caml_bottom_of_stack, edx - ; Call the function (address in %eax) + ; Call the function (address in %eax) jmp eax -; Start the Caml program +; Start the Caml program PUBLIC _caml_start_program ALIGN 4 _caml_start_program: - ; Save callee-save registers + ; Save callee-save registers push ebx push esi push edi @@ -163,20 +163,20 @@ _caml_start_program: ; Code shared between caml_start_program and callback* L106: - ; Build a callback link + ; Build a callback link push _caml_gc_regs push _caml_last_return_address push _caml_bottom_of_stack - ; Build an exception handler + ; Build an exception handler push L108 push _caml_exception_pointer mov _caml_exception_pointer, esp - ; Call the Caml code + ; Call the Caml code call esi L107: - ; Pop the exception handler + ; Pop the exception handler pop _caml_exception_pointer - pop esi ; dummy register + pop esi ; dummy register L109: ; Pop the callback link, restoring the global variables ; used by caml_c_call @@ -188,8 +188,8 @@ L109: pop edi pop esi pop ebx - ; Return to caller. - ret + ; Return to caller. + ret L108: ; Exception handler ; Mark the bucket as an exception result and return it @@ -205,7 +205,7 @@ _caml_raise_exn: jne L110 mov esp, _caml_exception_pointer pop _caml_exception_pointer - ret + ret L110: mov esi, eax ; Save exception bucket in esi mov edi, _caml_exception_pointer ; SP of handler @@ -221,7 +221,7 @@ L110: pop _caml_exception_pointer ret -; Raise an exception from C +; Raise an exception from C PUBLIC _caml_raise_exception ALIGN 4 @@ -231,7 +231,7 @@ _caml_raise_exception: mov eax, [esp+4] mov esp, _caml_exception_pointer pop _caml_exception_pointer - ret + ret L111: mov esi, [esp+4] ; Save exception bucket in esi push _caml_exception_pointer ; arg 4: SP of handler @@ -244,51 +244,51 @@ L111: pop _caml_exception_pointer ret -; Callback from C to Caml +; Callback from C to Caml PUBLIC _caml_callback_exn ALIGN 4 _caml_callback_exn: - ; Save callee-save registers + ; Save callee-save registers push ebx push esi push edi push ebp - ; Initial loading of arguments - mov ebx, [esp+20] ; closure - mov eax, [esp+24] ; argument + ; Initial loading of arguments + mov ebx, [esp+20] ; closure + mov eax, [esp+24] ; argument mov esi, [ebx] ; code pointer jmp L106 PUBLIC _caml_callback2_exn ALIGN 4 _caml_callback2_exn: - ; Save callee-save registers + ; Save callee-save registers push ebx push esi push edi push ebp - ; Initial loading of arguments - mov ecx, [esp+20] ; closure - mov eax, [esp+24] ; first argument - mov ebx, [esp+28] ; second argument - mov esi, offset _caml_apply2 ; code pointer + ; Initial loading of arguments + mov ecx, [esp+20] ; closure + mov eax, [esp+24] ; first argument + mov ebx, [esp+28] ; second argument + mov esi, offset _caml_apply2 ; code pointer jmp L106 PUBLIC _caml_callback3_exn ALIGN 4 _caml_callback3_exn: - ; Save callee-save registers + ; Save callee-save registers push ebx push esi push edi push ebp - ; Initial loading of arguments - mov edx, [esp+20] ; closure - mov eax, [esp+24] ; first argument - mov ebx, [esp+28] ; second argument - mov ecx, [esp+32] ; third argument - mov esi, offset _caml_apply3 ; code pointer + ; Initial loading of arguments + mov edx, [esp+20] ; closure + mov eax, [esp+24] ; first argument + mov ebx, [esp+28] ; second argument + mov ecx, [esp+32] ; third argument + mov esi, offset _caml_apply3 ; code pointer jmp L106 PUBLIC _caml_ml_array_bound_error @@ -310,14 +310,13 @@ _caml_ml_array_bound_error: .DATA PUBLIC _caml_system__frametable _caml_system__frametable LABEL DWORD - DWORD 1 ; one descriptor - DWORD L107 ; return address into callback - WORD -1 ; negative frame size => use callback link - WORD 0 ; no roots here + DWORD 1 ; one descriptor + DWORD L107 ; return address into callback + WORD -1 ; negative frame size => use callback link + WORD 0 ; no roots here PUBLIC _caml_extra_params _caml_extra_params LABEL DWORD BYTE 64 DUP (?) END - diff --git a/asmrun/ia64.S b/asmrun/ia64.S index 025e064a5..d4296fa4a 100644 --- a/asmrun/ia64.S +++ b/asmrun/ia64.S @@ -239,7 +239,7 @@ caml_start_program: mov b6 = r2 /* Code shared with caml_callback* */ -.L103: +.L103: /* Allocate 64 "out" registers (for the Caml code) and no locals */ alloc r3 = ar.pfs, 0, 0, 64, 0 add sp = -(56 * 8), sp ;; @@ -503,7 +503,7 @@ caml_callback3_exn: .align 16 caml_ml_array_bound_error: ADDRGLOBAL(r2, @fptr(caml_array_bound_error#)) - br.sptk caml_c_call /* never returns */ + br.sptk caml_c_call /* never returns */ .rodata diff --git a/asmrun/power-elf.S b/asmrun/power-elf.S index e9f0baef0..968e3aeb8 100644 --- a/asmrun/power-elf.S +++ b/asmrun/power-elf.S @@ -204,7 +204,7 @@ caml_c_call: Storeglobal(12, caml_last_return_address, 11) /* Return to caller */ blr - + /* Raise an exception from C */ .globl caml_raise_exception @@ -298,7 +298,7 @@ caml_start_program: stw 11, 4(1) mr 29, 1 /* Reload allocation pointers */ - Loadglobal(31, caml_young_ptr, 11) + Loadglobal(31, caml_young_ptr, 11) Loadglobal(30, caml_young_limit, 11) /* Say we are back into Caml code */ li 0, 0 @@ -316,9 +316,9 @@ caml_start_program: lwz 9, 0(1) lwz 10, 4(1) lwz 11, 8(1) - Storeglobal(9, caml_bottom_of_stack, 12) - Storeglobal(10, caml_last_return_address, 12) - Storeglobal(11, caml_gc_regs, 12) + Storeglobal(9, caml_bottom_of_stack, 12) + Storeglobal(10, caml_last_return_address, 12) + Storeglobal(11, caml_gc_regs, 12) addi 1, 1, 16 /* Update allocation pointer */ Storeglobal(31, caml_young_ptr, 11) @@ -396,7 +396,7 @@ caml_callback2_exn: mr 5, 0 Addrglobal(12, caml_apply2) b .L102 - + .globl caml_callback3_exn .type caml_callback3_exn, @function caml_callback3_exn: @@ -418,4 +418,3 @@ caml_system__frametable: .long .L105 + 4 /* return address into callback */ .short -1 /* negative size count => use callback link */ .short 0 /* no roots here */ - diff --git a/boot/ocamlc b/boot/ocamlc index a4a8b667e..2d86493c1 100755 Binary files a/boot/ocamlc and b/boot/ocamlc differ diff --git a/boot/ocamldep b/boot/ocamldep index cbf203cfd..925338520 100755 Binary files a/boot/ocamldep and b/boot/ocamldep differ diff --git a/build/buildbot b/build/buildbot index f337e3f6d..82cc26b16 100755 --- a/build/buildbot +++ b/build/buildbot @@ -26,7 +26,7 @@ bad() { } finish_if_bad() { - if [ -f buildbot.failed ]; then + if [ -f buildbot.failed ]; then finish exit 2 fi diff --git a/build/mkconfig.sh b/build/mkconfig.sh index 1cd66f37e..0eb693030 100755 --- a/build/mkconfig.sh +++ b/build/mkconfig.sh @@ -8,5 +8,3 @@ sed -e 's/^\(.*\$([0-9]).*\)$/# \1/' \ -e 's/^FLEX.*$//g' \ -e 's/^\([^#=]*\)=\([^"]*\)$/if [ "x$\1" = "x" ]; then \1="\2"; fi/' \ config/Makefile > config/config.sh - - diff --git a/build/myocamlbuild.sh b/build/myocamlbuild.sh index dc129a849..4333542f9 100755 --- a/build/myocamlbuild.sh +++ b/build/myocamlbuild.sh @@ -7,9 +7,9 @@ if [ ! -x _build/ocamlbuild/ocamlbuildlight.byte ]; then (cd ocamlbuild && make) fi mkdir -p _build/ocamlbuild - for i in "light.cmo" "light.byte" "lightlib.cma" "_plugin.cmi" "_pack.cmi" + for i in "light.cmo" "light.byte" "lightlib.cma" "_plugin.cmi" "_pack.cmi" do - cp ocamlbuild/_build/ocamlbuild$i _build/ocamlbuild + cp ocamlbuild/_build/ocamlbuild$i _build/ocamlbuild done fi rm -f ocamlbuild/myocamlbuild_config.ml ocamlbuild/myocamlbuild_config.mli diff --git a/bytecomp/bytelibrarian.ml b/bytecomp/bytelibrarian.ml index a5d45877f..ba08fc019 100644 --- a/bytecomp/bytelibrarian.ml +++ b/bytecomp/bytelibrarian.ml @@ -37,7 +37,7 @@ let copy_compunit ic oc compunit = end (* Add C objects and options and "custom" info from a library descriptor *) - + let lib_sharedobjs = ref [] let lib_ccobjs = ref [] let lib_ccopts = ref [] @@ -119,4 +119,3 @@ let report_error ppf = function fprintf ppf "Cannot find file %s" name | Not_an_object_file name -> fprintf ppf "The file %s is not a bytecode object file" name - diff --git a/bytecomp/cmo_format.mli b/bytecomp/cmo_format.mli index 34df9ffae..c87e6df4e 100644 --- a/bytecomp/cmo_format.mli +++ b/bytecomp/cmo_format.mli @@ -58,4 +58,3 @@ type library = ... object code for last library member library descriptor *) - diff --git a/bytecomp/dll.ml b/bytecomp/dll.ml index f5ba48d4f..bcf66b429 100644 --- a/bytecomp/dll.ml +++ b/bytecomp/dll.ml @@ -172,4 +172,3 @@ let init_toplevel dllpath = opened_dlls := Array.to_list (get_current_dlls()); names_of_opened_dlls := []; linking_in_core := true - diff --git a/bytecomp/dll.mli b/bytecomp/dll.mli index 4f57571de..fea455f7c 100644 --- a/bytecomp/dll.mli +++ b/bytecomp/dll.mli @@ -58,4 +58,3 @@ val init_compile: bool -> unit contents of ld.conf file). Take note of the DLLs that were opened when starting the running program. *) val init_toplevel: string -> unit - diff --git a/bytecomp/emitcode.ml b/bytecomp/emitcode.ml index db10dea64..2cec99dc8 100644 --- a/bytecomp/emitcode.ml +++ b/bytecomp/emitcode.ml @@ -69,7 +69,7 @@ let out_const c = out_int (const_as_int c) with | AsInt -> Misc.fatal_error "Emitcode.const_as_int" - + (* Handling of local labels and backpatching *) diff --git a/bytecomp/lambda.ml b/bytecomp/lambda.ml index 1422401d6..ff94a6d9c 100644 --- a/bytecomp/lambda.ml +++ b/bytecomp/lambda.ml @@ -423,5 +423,3 @@ and negate_comparison = function | Ceq -> Cneq| Cneq -> Ceq | Clt -> Cge | Cle -> Cgt | Cgt -> Cle | Cge -> Clt - - diff --git a/bytecomp/lambda.mli b/bytecomp/lambda.mli index 46a2cf012..0fe0df2d6 100644 --- a/bytecomp/lambda.mli +++ b/bytecomp/lambda.mli @@ -205,4 +205,3 @@ val staticfail : lambda (* Anticipated static failure *) (* Check anticipated failure, substitute its final value *) val is_guarded: lambda -> bool val patch_guarded : lambda -> lambda -> lambda - diff --git a/bytecomp/matching.ml b/bytecomp/matching.ml index b20022d7b..21006cc69 100644 --- a/bytecomp/matching.ml +++ b/bytecomp/matching.ml @@ -59,7 +59,7 @@ let pretty_ctx ctx = let le_ctx c1 c2 = le_pats c1.left c2.left && le_pats c1.right c2.right - + let lshift {left=left ; right=right} = match right with | x::xs -> {left=x::left ; right=xs} | _ -> assert false @@ -77,7 +77,7 @@ let rec small_enough n = function let ctx_lshift ctx = if small_enough 31 ctx then List.map lshift ctx - else (* Context pruning *) begin + else (* Context pruning *) begin get_mins le_ctx (List.map lforget ctx) end @@ -94,7 +94,7 @@ let rec nchars n ps = let chars, cdrs = nchars (n-1) rem in p::chars,cdrs | _ -> assert false - + let rshift_num n {left=left ; right=right} = let shifted,left = nchars n left in {left=left ; right = shifted@right} @@ -298,7 +298,7 @@ let rec jumps_extract i = function let rec jumps_remove i = function | [] -> [] | (j,_)::rem when i=j -> rem - | x::rem -> x::jumps_remove i rem + | x::rem -> x::jumps_remove i rem let jumps_empty = [] and jumps_is_empty = function @@ -363,7 +363,7 @@ type pm_or_compiled = or_matrix : matrix ; } type pm_half_compiled = - | PmOr of pm_or_compiled + | PmOr of pm_or_compiled | PmVar of pm_var_compiled | Pm of pattern_matching @@ -507,7 +507,7 @@ exception Var of pattern let simplify_or p = let rec simpl_rec p = match p with | {pat_desc = Tpat_any|Tpat_var _} -> raise (Var p) - | {pat_desc = Tpat_alias (q,id)} -> + | {pat_desc = Tpat_alias (q,id)} -> begin try {p with pat_desc = Tpat_alias (simpl_rec q,id)} with @@ -515,15 +515,15 @@ let simplify_or p = end | {pat_desc = Tpat_or (p1,p2,o)} -> let q1 = simpl_rec p1 in - begin try + begin try let q2 = simpl_rec p2 in {p with pat_desc = Tpat_or (q1, q2, o)} - with + with | Var q2 -> raise (Var {p with pat_desc = Tpat_or (q1, q2, o)}) end | {pat_desc = Tpat_record lbls} -> let all_lbls = all_record_args lbls in - {p with pat_desc=Tpat_record all_lbls} + {p with pat_desc=Tpat_record all_lbls} | _ -> p in try simpl_rec p @@ -577,7 +577,7 @@ let rec what_is_cases cases = match cases with | (({pat_desc=(Tpat_var _|Tpat_or (_,_,_)|Tpat_alias (_,_))}::_),_)::_ -> assert false (* applies to simplified matchings only *) | (p::_,_)::_ -> p -| [] -> omega +| [] -> omega | _ -> assert false @@ -633,7 +633,7 @@ let mk_alpha_env arg aliases ids = match arg with | Some v -> v | _ -> raise Cannot_flatten - else + else Ident.create (Ident.name id)) ids @@ -646,10 +646,10 @@ let rec explode_or_pat arg patl mk_action rem vars aliases = function | {pat_desc = Tpat_alias (p,id)} -> explode_or_pat arg patl mk_action rem vars (id::aliases) p | {pat_desc = Tpat_var x} -> - let env = mk_alpha_env arg (x::aliases) vars in + let env = mk_alpha_env arg (x::aliases) vars in (omega::patl,mk_action (List.map snd env))::rem | p -> - let env = mk_alpha_env arg aliases vars in + let env = mk_alpha_env arg aliases vars in (alpha_pat env p::patl,mk_action (List.map snd env))::rem let pm_free_variables {cases=cases} = @@ -758,7 +758,7 @@ let insert_or_append p ps act ors no = else (* fail to insert or append *) ors,(p::ps,act)::no else if condb act_q ps qs then (* check condition (b) for append *) - attempt (cl::seen) rem + attempt (cl::seen) rem else ors,(p::ps,act)::no else (* p # q, go on with append/insert *) @@ -781,7 +781,7 @@ let rec rebuild_default nexts def = match nexts with | (e, pmh)::rem -> (add_omega_column (rebuild_matrix pmh), e):: rebuild_default rem def - + let rebuild_nexts arg nexts k = List.fold_right (fun (e, pm) k -> (e, PmVar {inside=pm ; var_arg=arg})::k) @@ -840,7 +840,7 @@ let rec split_or argo cls args def = | rem -> let {me=next ; matrix=matrix ; top_default=def},nexts = do_split [] [] [] rem in - let idef = next_raise_count () in + let idef = next_raise_count () in precompile_or argo yes yesor args (cons_default matrix idef def) @@ -869,10 +869,10 @@ and split_constr cls args def k = begin match yes with | [] -> (* Could not success in raising up a constr matching up *) - split_noex [cl] [] rem + split_noex [cl] [] rem | _ -> let {me=next ; matrix=matrix ; top_default=def}, nexts = - split_noex [cl] [] rem in + split_noex [cl] [] rem in let idef = next_raise_count () in let def = cons_default matrix idef def in {me = Pm {cases=yes ; args=args ; default=def} ; @@ -936,7 +936,7 @@ and precompile_var args cls def k = match args with and var_def = make_default (fun _ rem -> rem) def in let {me=first ; matrix=matrix}, nexts = split_or (Some v) var_cls (arg::rargs) var_def in - + (* Compute top information *) match nexts with | [] -> (* If you need *) @@ -962,7 +962,7 @@ and precompile_or argo cls ors args def k = match ors with | _ -> let rec do_cases = function | ({pat_desc=Tpat_or _} as orp::patl, action)::rem -> - let others,rem = get_equiv orp rem in + let others,rem = get_equiv orp rem in let orpm = {cases = (patl, action):: @@ -1033,7 +1033,7 @@ let add make_matching_fun division key patl_action args = cell.pm.cases <- [patl_action] ; (key, cell) :: division - + let divide make get_key get_args ctx pm = let rec divide_rec = function @@ -1068,7 +1068,7 @@ let divide_line make_ctx make get_args pat ctx pm = They may raise NoMatch or OrPat and perform the full matching (selection + arguments). - + - get_args and get_key are for the compiled matrices, note that selection and geting arguments are separed. @@ -1103,7 +1103,7 @@ let make_constant_matching p def ctx = function let def = make_default (matcher_const (get_key_constant "make" p)) def - and ctx = + and ctx = filter_ctx p ctx in {pm = {cases = []; args = argl ; default = def} ; ctx = ctx ; @@ -1222,7 +1222,7 @@ let rec matcher_variant_const lab p rem = match p.pat_desc with | Tpat_any -> rem | _ -> raise NoMatch - + let make_variant_matching_constant p lab def ctx = function [] -> fatal_error "Matching.make_variant_matching_constant" | ((arg, mut) :: argl) -> @@ -1269,7 +1269,7 @@ let divide_variant row ctx {cases = cl; args = al; default=def} = match pato with None -> add (make_variant_matching_constant p lab def ctx) variants - (Cstr_constant tag) (patl, action) al + (Cstr_constant tag) (patl, action) al | Some pat -> add (make_variant_matching_nonconst p lab def ctx) variants (Cstr_block tag) (pat :: patl, action) al @@ -1378,7 +1378,7 @@ let inline_lazy_force_switch arg loc = Lprim(Pisint, [varg]), varg, (Lswitch (varg, - { sw_numconsts = 0; sw_consts = []; + { sw_numconsts = 0; sw_consts = []; sw_numblocks = (max Obj.lazy_tag Obj.forward_tag) + 1; sw_blocks = [ (Obj.forward_tag, Lprim(Pfield 0, [varg])); @@ -1423,7 +1423,7 @@ let matcher_tuple arity p rem = match p.pat_desc with | Tpat_or (_,_,_) -> raise OrPat | Tpat_var _ -> get_args_tuple arity omega rem | _ -> get_args_tuple arity p rem - + let make_tuple_matching arity def = function [] -> fatal_error "Matching.make_tuple_matching" | (arg, mut) :: argl -> @@ -1525,7 +1525,7 @@ let divide_array kind ctx pm = divide (make_array_matching kind) get_key_array get_args_array ctx pm - + (* To combine sub-matchings together *) let float_compare s1 s2 = @@ -1641,16 +1641,16 @@ let make_switch_switcher arg cases acts = let l = ref [] in for i = Array.length cases-1 downto 0 do l := (i,acts.(cases.(i))) :: !l - done ; + done ; Lswitch(arg, {sw_numconsts = Array.length cases ; sw_consts = !l ; sw_numblocks = 0 ; sw_blocks = [] ; sw_failaction = None}) - + let full sw = List.length sw.sw_consts = sw.sw_numconsts && List.length sw.sw_blocks = sw.sw_numblocks - + let make_switch (arg,sw) = match sw.sw_failaction with | None -> let t = Hashtbl.create 17 in @@ -1685,7 +1685,7 @@ sw_failaction = Some (Lstaticraise (default,[]))}) else Lswitch (arg,sw) | _ -> Lswitch (arg,sw) - + module SArg = struct type primitive = Lambda.primitive @@ -1730,7 +1730,7 @@ let get_edges low high l = match l with | [] -> low, high | (x,_)::_ -> x, last high l - + let as_interval_canfail fail low high l = let store = mk_store equal_action in let rec nofail_rec cur_low cur_high cur_act = function @@ -1897,12 +1897,12 @@ let mk_res get_key env last_choice idef cant_fail ctx = let klist = List.fold_right (fun pat klist -> (get_key pat,act)::klist) - pats klist + pats klist and ctx = if cant_fail then ctx else ctx_lub pat ctx in klist,jumps_add i ctx jumps) env ([],jumps_fail) in fail, klist, jumps - + (* Following two ``failaction'' function compute n, the trap handler @@ -1923,8 +1923,8 @@ let mk_failaction_neg partial ctx def = match partial with | Total -> None, [], jumps_empty - - + + (* Conforme a l'article et plus simple qu'avant *) and mk_failaction_pos partial seen ctx defs = let rec scan_def env to_test defs = match to_test,defs with @@ -1955,8 +1955,8 @@ and mk_failaction_pos partial seen ctx defs = (complete_pats_constrs seen)) defs - -let combine_constant arg cst partial ctx def + +let combine_constant arg cst partial ctx def (const_lambda_list, total, pats) = let fail, to_add, local_jumps = mk_failaction_neg partial ctx def in @@ -2016,12 +2016,12 @@ let split_cases tag_lambda_list = let const, nonconst = split_rec tag_lambda_list in sort_int_lambda_list const, sort_int_lambda_list nonconst - + let combine_constructor arg ex_pat cstr partial ctx def (tag_lambda_list, total1, pats) = if cstr.cstr_consts < 0 then begin - (* Special cases for exceptions *) + (* Special cases for exceptions *) let fail, to_add, local_jumps = mk_failaction_neg partial ctx def in let tag_lambda_list = to_add@tag_lambda_list in @@ -2159,7 +2159,7 @@ let combine_variant row arg partial ctx def (tag_lambda_list, total1, pats) = in lambda1, jumps_union local_jumps total1 - + let combine_array arg kind partial ctx def (len_lambda_list, total1, pats) = let fail, to_add, local_jumps = mk_failaction_neg partial ctx def in @@ -2208,12 +2208,12 @@ let rec event_branch repr lam = comp_match_handlers (for compililing splitted matches) may reraise Unused - + *) -exception Unused +exception Unused -let compile_list compile_fun division = +let compile_list compile_fun division = let rec c_rec totals = function | [] -> [], jumps_unions totals, [] @@ -2222,7 +2222,7 @@ let compile_list compile_fun division = | [] -> c_rec totals rem | _ -> try - let (lambda1, total1) = compile_fun cell.ctx cell.pm in + let (lambda1, total1) = compile_fun cell.ctx cell.pm in let c_rem, total, new_pats = c_rec (jumps_map ctx_combine total1::totals) rem in @@ -2298,7 +2298,7 @@ let rec lower_bind v arg lam = match lam with and pnot = approx_present v ifnot in begin match pcond, pso, pnot with | false, false, false -> lam - | false, true, false -> + | false, true, false -> Lifthenelse (cond, lower_bind v arg ifso, ifnot) | false, false, true -> Lifthenelse (cond, ifso, lower_bind v arg ifnot) @@ -2315,19 +2315,19 @@ let rec lower_bind v arg lam = match lam with bind Alias v arg lam else Llet (Alias, vv, lv, lower_bind v arg l) -| _ -> +| _ -> bind Alias v arg lam let bind_check str v arg lam = match str,arg with | _, Lvar _ ->bind str v arg lam -| Alias,_ -> lower_bind v arg lam +| Alias,_ -> lower_bind v arg lam | _,_ -> bind str v arg lam let rec comp_exit ctx m = match m.default with | (_,i)::_ -> Lstaticraise (i,[]), jumps_singleton i ctx | _ -> fatal_error "Matching.comp_exit" - + let rec comp_match_handlers comp_fun partial ctx arg first_match next_matchs = match next_matchs with | [] -> comp_fun partial ctx arg first_match @@ -2336,7 +2336,7 @@ let rec comp_match_handlers comp_fun partial ctx arg first_match next_matchs = m | [] -> body, total_body (* Hum, -1 meant never taken | (-1,pm)::rem -> c_rec body total_body rem *) - | (i,pm)::rem -> + | (i,pm)::rem -> let ctx_i,total_rem = jumps_extract i total_body in begin match ctx_i with | [] -> c_rec body total_body rem @@ -2424,7 +2424,7 @@ and do_compile_matching_pr repr partial ctx arg x = pretty_ctx ctx ; let (_, jumps) as r = do_compile_matching repr partial ctx arg x in prerr_endline "JUMPS" ; - pretty_jumps jumps ; + pretty_jumps jumps ; r *) and do_compile_matching repr partial ctx arg pmh = match pmh with @@ -2432,7 +2432,7 @@ and do_compile_matching repr partial ctx arg pmh = match pmh with let pat = what_is_cases pm.cases in begin match pat.pat_desc with | Tpat_any -> - compile_no_test + compile_no_test divide_var ctx_rshift repr partial ctx pm | Tpat_tuple patl -> compile_no_test @@ -2453,7 +2453,7 @@ and do_compile_matching repr partial ctx arg pmh = match pmh with (compile_match repr partial) partial divide_constructor (combine_constructor arg pat cstr partial) ctx pm - | Tpat_array _ -> + | Tpat_array _ -> let kind = Typeopt.array_pattern_kind pat in compile_test (compile_match repr partial) partial (divide_array kind) (combine_array arg kind partial) @@ -2499,7 +2499,7 @@ let check_partial pat_act_list partial = (fun (_,lam) -> is_guarded lam) pat_act_list then begin - Partial + Partial end else partial @@ -2590,7 +2590,7 @@ let for_tupled_function loc paraml pats_act_list partial = let flatten_pattern size p = match p.pat_desc with | Tpat_tuple args -> args -| Tpat_any -> omegas size +| Tpat_any -> omegas size | _ -> raise Cannot_flatten let rec flatten_pat_line size p k = match p.pat_desc with @@ -2666,7 +2666,7 @@ let do_for_multiple_match loc paraml pat_act_list partial = { cases = List.map (fun (pat, act) -> ([pat], act)) pat_act_list; args = [Lprim(Pmakeblock(0, Immutable), paraml), Strict] ; default = [] } in - + try try (* Once for checking that compilation is possible *) @@ -2683,7 +2683,7 @@ let do_for_multiple_match loc paraml pat_act_list partial = nexts in let lam, total = - comp_match_handlers + comp_match_handlers (compile_flattened repr) partial (start_ctx size) () flat_next flat_nexts in List.fold_right2 (bind Strict) idl paraml @@ -2728,4 +2728,3 @@ let for_multiple_match loc paraml pat_act_list partial = let paraml = List.map (fun (v,_) -> Lvar v) v_paraml in List.fold_right bind_opt v_paraml (do_for_multiple_match loc paraml pat_act_list partial) - diff --git a/bytecomp/meta.ml b/bytecomp/meta.ml index c03523fbc..a4beaf422 100644 --- a/bytecomp/meta.ml +++ b/bytecomp/meta.ml @@ -17,10 +17,11 @@ external realloc_global_data : int -> unit = "caml_realloc_global" external static_alloc : int -> string = "caml_static_alloc" external static_free : string -> unit = "caml_static_free" external static_resize : string -> int -> string = "caml_static_resize" -external static_release_bytecode : string -> int -> unit = "caml_static_release_bytecode" +external static_release_bytecode : string -> int -> unit + = "caml_static_release_bytecode" type closure = unit -> Obj.t external reify_bytecode : string -> int -> closure = "caml_reify_bytecode" external invoke_traced_function : Obj.t -> Obj.t -> Obj.t -> Obj.t = "caml_invoke_traced_function" external get_section_table : unit -> (string * Obj.t) list - = "caml_get_section_table" + = "caml_get_section_table" diff --git a/bytecomp/meta.mli b/bytecomp/meta.mli index 3de027f19..774c5f137 100644 --- a/bytecomp/meta.mli +++ b/bytecomp/meta.mli @@ -18,11 +18,12 @@ external global_data : unit -> Obj.t array = "caml_get_global_data" external realloc_global_data : int -> unit = "caml_realloc_global" external static_alloc : int -> string = "caml_static_alloc" external static_free : string -> unit = "caml_static_free" -external static_release_bytecode : string -> int -> unit = "caml_static_release_bytecode" +external static_release_bytecode : string -> int -> unit + = "caml_static_release_bytecode" external static_resize : string -> int -> string = "caml_static_resize" type closure = unit -> Obj.t external reify_bytecode : string -> int -> closure = "caml_reify_bytecode" external invoke_traced_function : Obj.t -> Obj.t -> Obj.t -> Obj.t = "caml_invoke_traced_function" external get_section_table : unit -> (string * Obj.t) list - = "caml_get_section_table" + = "caml_get_section_table" diff --git a/bytecomp/simplif.ml b/bytecomp/simplif.ml index eaa408935..6081d5bd4 100644 --- a/bytecomp/simplif.ml +++ b/bytecomp/simplif.ml @@ -26,7 +26,7 @@ let rec eliminate_ref id = function Lvar v as lam -> if Ident.same v id then raise Real_reference else lam | Lconst cst as lam -> lam - | Lapply(e1, el, loc) -> + | Lapply(e1, el, loc) -> Lapply(eliminate_ref id e1, List.map (eliminate_ref id) el, loc) | Lfunction(kind, params, body) as lam -> if IdentSet.mem id (free_variables lam) @@ -85,7 +85,7 @@ let rec eliminate_ref id = function (* Simplification of exits *) -let simplify_exits lam = +let simplify_exits lam = (* Count occurrences of (exit n ...) statements *) let exits = Hashtbl.create 17 in @@ -101,7 +101,7 @@ let simplify_exits lam = incr (Hashtbl.find exits i) with | Not_found -> Hashtbl.add exits i (ref 1) in - + let rec count = function | (Lvar _| Lconst _) -> () | Lapply(l1, ll, _) -> count l1; List.iter count ll @@ -267,7 +267,7 @@ let simplify_lets lam = !(Hashtbl.find occ v) with Not_found -> 0 - and incr_var v = + and incr_var v = try incr(Hashtbl.find occ v) with Not_found -> @@ -388,7 +388,7 @@ let simplify_lets lam = {sw with sw_consts = new_consts ; sw_blocks = new_blocks; sw_failaction = new_fail}) | Lstaticraise (i,ls) -> - Lstaticraise (i, List.map simplif ls) + Lstaticraise (i, List.map simplif ls) | Lstaticcatch(l1, (i,args), l2) -> Lstaticcatch (simplif l1, (i,args), simplif l2) | Ltrywith(l1, v, l2) -> Ltrywith(simplif l1, v, simplif l2) diff --git a/bytecomp/switch.ml b/bytecomp/switch.ml index ff58af72e..4fa7b62ba 100644 --- a/bytecomp/switch.ml +++ b/bytecomp/switch.ml @@ -20,7 +20,7 @@ let mk_store same = let r_acts = ref [] in let store act = let rec store_rec i = function - | [] -> i,[act] + | [] -> i,[act] | act0::rem -> if same act0 act then raise (Found i) else @@ -256,7 +256,7 @@ let coupe_inter i j cases = Array.sub cases i (j-i+1), case_append (Array.sub cases 0 i) (Array.sub cases (j+1) (lcases-(j+1))) -type kind = Kvalue of int | Kinter of int | Kempty +type kind = Kvalue of int | Kinter of int | Kempty let pkind chan = function | Kvalue i ->Printf.fprintf chan "V%d" i @@ -281,7 +281,7 @@ let make_key cases = incr count ; r | (act0,index) :: rem -> - if act0 = act then + if act0 = act then index else got_it act rem in @@ -291,7 +291,7 @@ let make_key cases = Kvalue (got_it act !seen) else Kinter (got_it act !seen) in - + let rec make_rec i pl = if i < 0 then [] @@ -303,8 +303,8 @@ let make_key cases = Kempty::make_one l h act::make_rec (i-1) l in let l,h,act = cases.(Array.length cases-1) in - make_one l h act::make_rec (Array.length cases-2) l - + make_one l h act::make_rec (Array.length cases-2) l + let same_act t = let len = Array.length t in @@ -330,7 +330,7 @@ let make_key cases = This condition is checked by zyva *) - + let inter_limit = 1 lsl 16 let ok_inter = ref false @@ -356,7 +356,7 @@ let rec opt_count top cases = divide top cases in Hashtbl.add t key r ; r - + and divide top cases = let lcases = Array.length cases in let m = lcases/2 in @@ -372,12 +372,12 @@ and divide top cases = else add_test cm cml ; Sep m,(cm, ci) - + and heuristic top cases = let lcases = Array.length cases in - + let sep,csep = divide false cases - + and inter,cinter = if !ok_inter then begin let _,_,act0 = cases.(0) @@ -398,18 +398,18 @@ and heuristic top cases = end else Inter (-1,-1),(too_much, too_much) end else - Inter (-1,-1),(too_much, too_much) in + Inter (-1,-1),(too_much, too_much) in if less2tests csep cinter then sep,csep else inter,cinter - - + + and enum top cases = let lcases = Array.length cases in let lim, with_sep = let best = ref (-1) and best_cost = ref (too_much,too_much) in - + for i = 1 to lcases-(1) do let _,left,right = coupe cases i in let ci = {n=1 ; ni=0} @@ -422,7 +422,7 @@ and enum top cases = add_test cm cmr else add_test cm cml ; - + if less2tests (cm,ci) !best_cost then begin @@ -488,45 +488,45 @@ and enum top cases = r := Sep lim ; rc := with_sep end ; !r, !rc - + let make_if_test konst test arg i ifso ifnot = Arg.make_if (Arg.make_prim test [arg ; konst i]) ifso ifnot - + let make_if_lt konst arg i ifso ifnot = match i with | 1 -> make_if_test konst Arg.leint arg 0 ifso ifnot | _ -> make_if_test konst Arg.ltint arg i ifso ifnot - + and make_if_le konst arg i ifso ifnot = match i with | -1 -> make_if_test konst Arg.ltint arg 0 ifso ifnot | _ -> make_if_test konst Arg.leint arg i ifso ifnot - + and make_if_gt konst arg i ifso ifnot = match i with | -1 -> make_if_test konst Arg.geint arg 0 ifso ifnot | _ -> make_if_test konst Arg.gtint arg i ifso ifnot - + and make_if_ge konst arg i ifso ifnot = match i with | 1 -> make_if_test konst Arg.gtint arg 0 ifso ifnot | _ -> make_if_test konst Arg.geint arg i ifso ifnot - + and make_if_eq konst arg i ifso ifnot = make_if_test konst Arg.eqint arg i ifso ifnot - + and make_if_ne konst arg i ifso ifnot = make_if_test konst Arg.neint arg i ifso ifnot - + let do_make_if_out h arg ifso ifno = Arg.make_if (Arg.make_isout h arg) ifso ifno - + let make_if_out konst ctx l d mk_ifso mk_ifno = match l with | 0 -> do_make_if_out @@ -538,10 +538,10 @@ and enum top cases = let ctx = {off= (-l+ctx.off) ; arg=arg} in do_make_if_out (konst d) arg (mk_ifso ctx) (mk_ifno ctx)) - + let do_make_if_in h arg ifso ifno = Arg.make_if (Arg.make_isin h arg) ifso ifno - + let make_if_in konst ctx l d mk_ifso mk_ifno = match l with | 0 -> do_make_if_in @@ -553,15 +553,15 @@ and enum top cases = let ctx = {off= (-l+ctx.off) ; arg=arg} in do_make_if_in (konst d) arg (mk_ifso ctx) (mk_ifno ctx)) - - + + let rec c_test konst ctx ({cases=cases ; actions=actions} as s) = let lcases = Array.length cases in assert(lcases > 0) ; if lcases = 1 then actions.(get_act cases 0) ctx else begin - + let w,c = opt_count false cases in (* Printf.fprintf stderr @@ -624,7 +624,7 @@ and enum top cases = make_if_ge konst ctx.arg (lim+ctx.off) (c_test konst ctx right) (c_test konst ctx left) - + end @@ -687,7 +687,7 @@ let comp_clusters ({cases=cases ; actions=actions} as s) = get_min (j-1) + 1 < min_clusters.(i) then begin k.(i) <- j ; - min_clusters.(i) <- get_min (j-1) + 1 + min_clusters.(i) <- get_min (j-1) + 1 end done ; done ; @@ -766,15 +766,15 @@ let make_clusters ({cases=cases ; actions=actions} as s) n_clusters k = r.(ir) <- (l,h,add_index (make_switch s i j)) end ; if i > 0 then zyva (i-1) (ir-1) in - + zyva (len-1) (n_clusters-1) ; let acts = Array.create !index (fun _ -> assert false) in Hashtbl.iter (fun _ (i,act) -> acts.(i) <- act) t ; {cases = r ; actions = acts} ;; - -let zyva (low,high) konst arg cases actions = + +let zyva (low,high) konst arg cases actions = let old_ok = !ok_inter in ok_inter := (abs low <= inter_limit && abs high <= inter_limit) ; if !ok_inter <> old_ok then Hashtbl.clear t ; @@ -793,7 +793,7 @@ let zyva (low,high) konst arg cases actions = and test_sequence konst arg cases actions = - let old_ok = !ok_inter in + let old_ok = !ok_inter in ok_inter := false ; if !ok_inter <> old_ok then Hashtbl.clear t ; let s = diff --git a/bytecomp/switch.mli b/bytecomp/switch.mli index 73799daa0..33014c0f7 100644 --- a/bytecomp/switch.mli +++ b/bytecomp/switch.mli @@ -67,7 +67,7 @@ module Make : functor (Arg : S) -> sig val zyva : - (int * int) -> + (int * int) -> (int -> Arg.act) -> Arg.act -> (int * int * int) array -> diff --git a/bytecomp/symtable.ml b/bytecomp/symtable.ml index bad39a213..136144efa 100644 --- a/bytecomp/symtable.ml +++ b/bytecomp/symtable.ml @@ -133,8 +133,8 @@ let output_primitive_table outchan = let init () = (* Enter the predefined exceptions *) - Array.iter - (fun name -> + Array.iter + (fun name -> let id = try List.assoc name Predef.builtin_values with Not_found -> fatal_error "Symtable.init" in @@ -180,7 +180,7 @@ let patch_int buff pos n = String.unsafe_set buff (pos + 2) (Char.unsafe_chr (n asr 16)); String.unsafe_set buff (pos + 3) (Char.unsafe_chr (n asr 24)) -let patch_object buff patchlist = +let patch_object buff patchlist = List.iter (function (Reloc_literal sc, pos) -> @@ -249,7 +249,7 @@ let update_global_table () = (* Recover data for toplevel initialization. Data can come either from executable file (normal case) or from linked-in data (-output-obj). *) -type section_reader = { +type section_reader = { read_string: string -> string; read_struct: string -> Obj.t; close_reader: unit -> unit @@ -262,7 +262,7 @@ let read_sections () = (fun name -> (Obj.magic(List.assoc name sections) : string)); read_struct = (fun name -> List.assoc name sections); - close_reader = + close_reader = (fun () -> ()) } with Not_found -> let ic = open_in_bin Sys.executable_name in diff --git a/bytecomp/translmod.ml b/bytecomp/translmod.ml index 58ce08ae5..bd6107f03 100644 --- a/bytecomp/translmod.ml +++ b/bytecomp/translmod.ml @@ -84,7 +84,7 @@ let primitive_declarations = ref ([] : Primitive.description list) let record_primitive = function | {val_kind=Val_prim p} -> primitive_declarations := p :: !primitive_declarations | _ -> () - + (* Keep track of the root path (from the root of the namespace to the currently compiled module expression). Useful for naming exceptions. *) diff --git a/bytecomp/translmod.mli b/bytecomp/translmod.mli index bec880b2f..9e47ca5e6 100644 --- a/bytecomp/translmod.mli +++ b/bytecomp/translmod.mli @@ -23,7 +23,7 @@ val transl_store_phrases: string -> structure -> int * lambda val transl_store_implementation: string -> structure * module_coercion -> int * lambda val transl_toplevel_definition: structure -> lambda -val transl_package: +val transl_package: Ident.t option list -> Ident.t -> module_coercion -> lambda val transl_store_package: Ident.t option list -> Ident.t -> module_coercion -> int * lambda diff --git a/bytecomp/translobj.ml b/bytecomp/translobj.ml index e97fbfc13..a0df551d8 100644 --- a/bytecomp/translobj.ml +++ b/bytecomp/translobj.ml @@ -112,8 +112,8 @@ let transl_store_label_init glob size f arg = (size+1, Lsequence( Lprim(Psetfield(size, false), - [Lprim(Pgetglobal glob, []); - Lprim (Pccall prim_makearray, [int !method_count; int 0])]), + [Lprim(Pgetglobal glob, []); + Lprim (Pccall prim_makearray, [int !method_count; int 0])]), expr)) in (size, transl_label_init expr) @@ -157,4 +157,3 @@ let oo_wrap env req f x = wrapping := false; top_env := Env.empty; raise exn - diff --git a/bytecomp/typeopt.ml b/bytecomp/typeopt.ml index ebcfb20a9..f8e43f0df 100644 --- a/bytecomp/typeopt.ml +++ b/bytecomp/typeopt.ml @@ -58,7 +58,7 @@ let array_element_kind env ty = else if Path.same p Predef.path_float then Pfloatarray else if Path.same p Predef.path_string - || Path.same p Predef.path_array + || Path.same p Predef.path_array || Path.same p Predef.path_nativeint || Path.same p Predef.path_int32 || Path.same p Predef.path_int64 then diff --git a/byterun/Makefile.nt b/byterun/Makefile.nt index 23fcde933..a633787de 100644 --- a/byterun/Makefile.nt +++ b/byterun/Makefile.nt @@ -22,7 +22,7 @@ OBJS=$(COMMONOBJS:.o=.$(O)) win32.$(O) main.$(O) DOBJS=$(OBJS:.$(O)=.$(DBGO)) instrtrace.$(DBGO) ocamlrun$(EXE): libcamlrun.$(A) prims.$(O) - $(MKEXE) -o ocamlrun$(EXE) prims.$(O) $(call SYSLIB,ws2_32) $(EXTRALIBS) libcamlrun.$(A) + $(MKEXE) -o ocamlrun$(EXE) prims.$(O) $(call SYSLIB,ws2_32) $(EXTRALIBS) libcamlrun.$(A) ocamlrund$(EXE): libcamlrund.$(A) prims.$(O) main.$(O) $(MKEXE) -o ocamlrun$(EXE) $(BYTECCDBGCOMPOPTS) prims.$(O) $(call SYSLIB,ws2_32) $(EXTRALIBS) libcamlrund.$(A) diff --git a/byterun/array.c b/byterun/array.c index e282f0600..fc6065952 100644 --- a/byterun/array.c +++ b/byterun/array.c @@ -34,7 +34,7 @@ CAMLprim value caml_array_get_float(value array, value index) double d; value res; - if (idx < 0 || idx >= Wosize_val(array) / Double_wosize) + if (idx < 0 || idx >= Wosize_val(array) / Double_wosize) caml_array_bound_error(); d = Double_field(array, idx); #define Setup_for_gc diff --git a/byterun/backtrace.c b/byterun/backtrace.c index 1afce8ae2..2b29c31dc 100644 --- a/byterun/backtrace.c +++ b/byterun/backtrace.c @@ -308,4 +308,3 @@ CAMLprim value caml_get_exception_backtrace(value unit) } CAMLreturn(res); } - diff --git a/byterun/custom.h b/byterun/custom.h index 3855742f4..a706857ae 100644 --- a/byterun/custom.h +++ b/byterun/custom.h @@ -27,7 +27,7 @@ struct custom_operations { void (*finalize)(value v); int (*compare)(value v1, value v2); intnat (*hash)(value v); - void (*serialize)(value v, + void (*serialize)(value v, /*out*/ uintnat * wsize_32 /*size in bytes*/, /*out*/ uintnat * wsize_64 /*size in bytes*/); uintnat (*deserialize)(void * dst); diff --git a/byterun/debugger.c b/byterun/debugger.c index 38b1923e6..3639c43bb 100644 --- a/byterun/debugger.c +++ b/byterun/debugger.c @@ -72,7 +72,7 @@ static union { /* Socket address for the debugger */ struct sockaddr s_gen; #ifndef _WIN32 struct sockaddr_un s_unix; -#endif +#endif struct sockaddr_in s_inet; } sock_addr; static int sock_addr_len; /* Length of sock_addr */ @@ -98,7 +98,7 @@ static void open_connection(void) setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &newvalue, sizeof(newvalue)); } -#endif +#endif dbg_socket = socket(sock_domain, SOCK_STREAM, 0); #ifdef _WIN32 if (retcode == 0) { @@ -106,7 +106,7 @@ static void open_connection(void) setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &oldvalue, oldvaluelen); } -#endif +#endif if (dbg_socket == -1 || connect(dbg_socket, &sock_addr.s_gen, sock_addr_len) == -1){ caml_fatal_error_arg2 ("cannot connect to debugger at %s", dbg_addr, @@ -181,7 +181,7 @@ void caml_debugger_init(void) + strlen(address); #else caml_fatal_error("Unix sockets not supported"); -#endif +#endif } else { /* Internet domain */ sock_domain = PF_INET; @@ -318,7 +318,7 @@ void caml_debugger(enum event_kind event) #else caml_fatal_error("error: REQ_CHECKPOINT command"); exit(-1); -#endif +#endif break; case REQ_GO: caml_event_count = caml_getword(dbg_in); @@ -332,7 +332,7 @@ void caml_debugger(enum event_kind event) #else caml_fatal_error("Fatal error: REQ_WAIT command"); exit(-1); -#endif +#endif break; case REQ_INITIAL_FRAME: frame = caml_extern_sp + 1; diff --git a/byterun/debugger.h b/byterun/debugger.h index 59e23ec0e..ce479d271 100644 --- a/byterun/debugger.h +++ b/byterun/debugger.h @@ -46,7 +46,7 @@ enum debugger_request { REQ_RESET_INSTR = 'i', /* uint32 pos */ /* Clear an event or breapoint at position pos, restores initial instr. */ REQ_CHECKPOINT = 'c', /* no args */ - /* Checkpoint the runtime system by forking a child process. + /* Checkpoint the runtime system by forking a child process. Reply is pid of child process or -1 if checkpoint failed. */ REQ_GO = 'g', /* uint32 n */ /* Run the program for n events. diff --git a/byterun/dynlink.c b/byterun/dynlink.c index e08bdc0b2..7df594dbe 100644 --- a/byterun/dynlink.c +++ b/byterun/dynlink.c @@ -94,7 +94,7 @@ static char * parse_ld_conf(void) ldconfname); config = caml_stat_alloc(st.st_size + 1); nread = read(ldconf, config, st.st_size); - if (nread == -1) + if (nread == -1) caml_fatal_error_arg ("Fatal error: error while reading loader config file %s\n", ldconfname); diff --git a/byterun/fix_code.c b/byterun/fix_code.c index b626f2cb0..b252efd58 100644 --- a/byterun/fix_code.c +++ b/byterun/fix_code.c @@ -92,7 +92,7 @@ void caml_thread_code (code_t code, asize_t len) code_t p; int l [STOP + 1]; int i; - + for (i = 0; i <= STOP; i++) { l [i] = 0; } diff --git a/byterun/floats.c b/byterun/floats.c index 21ba411a7..d1d178a32 100644 --- a/byterun/floats.c +++ b/byterun/floats.c @@ -429,7 +429,7 @@ CAMLprim value caml_classify_float(value vd) return Val_int(FP_normal); } #else - union { + union { double d; #if defined(ARCH_BIG_ENDIAN) || (defined(__arm__) && !defined(__ARM_EABI__)) struct { uint32 h; uint32 l; } i; diff --git a/byterun/globroots.c b/byterun/globroots.c index e4fec3328..acac1e217 100644 --- a/byterun/globroots.c +++ b/byterun/globroots.c @@ -133,7 +133,7 @@ static void caml_delete_global_root(struct global_root_list * rootlist, /* Reclaim list element */ caml_stat_free(e); /* Down-correct list level */ - while (rootlist->level > 0 && + while (rootlist->level > 0 && rootlist->forward[rootlist->level] == NULL) rootlist->level--; } @@ -223,11 +223,11 @@ CAMLexport void caml_modify_generational_global_root(value *r, value newval) { value oldval = *r; - /* It is OK to have a root in roots_young that suddenly points to + /* It is OK to have a root in roots_young that suddenly points to the old generation -- the next minor GC will take care of that. What needs corrective action is a root in roots_old that suddenly points to the young generation. */ - if (Is_block(newval) && Is_young(newval) && + if (Is_block(newval) && Is_young(newval) && Is_block(oldval) && Is_in_heap(oldval)) { caml_delete_global_root(&caml_global_roots_old, r); caml_insert_global_root(&caml_global_roots_young, r); diff --git a/byterun/hash.c b/byterun/hash.c index a1d7864db..c981768d0 100644 --- a/byterun/hash.c +++ b/byterun/hash.c @@ -61,7 +61,7 @@ static void hash_aux(value obj) /* Pointers into the heap are well-structured blocks. So are atoms. We can inspect the block contents. */ - Assert (Is_block (obj)); + Assert (Is_block (obj)); if (Is_in_value_area(obj)) { tag = Tag_val(obj); switch (tag) { @@ -146,7 +146,7 @@ CAMLexport value caml_hash_variant(char const * tag) { value accu; /* Same hashing algorithm as in ../typing/btype.ml, function hash_variant */ - for (accu = Val_int(0); *tag != 0; tag++) + for (accu = Val_int(0); *tag != 0; tag++) accu = Val_int(223 * Int_val(accu) + *((unsigned char *) tag)); #ifdef ARCH_SIXTYFOUR accu = accu & Val_long(0x7FFFFFFFL); diff --git a/byterun/instrtrace.c b/byterun/instrtrace.c index 3734d8241..3afdc9541 100644 --- a/byterun/instrtrace.c +++ b/byterun/instrtrace.c @@ -59,7 +59,7 @@ void caml_disasm_instr(pc) /* Instructions with two operands */ case APPTERM: case CLOSURE: case CLOSUREREC: case PUSHGETGLOBALFIELD: case GETGLOBALFIELD: case MAKEBLOCK: - case BEQ: case BNEQ: case BLTINT: case BLEINT: case BGTINT: case BGEINT: + case BEQ: case BNEQ: case BLTINT: case BLEINT: case BGTINT: case BGEINT: case BULTINT: case BUGEINT: printf(" %d, %d\n", pc[0], pc[1]); break; /* Instructions with a C primitive as operand */ @@ -182,13 +182,13 @@ caml_trace_value_file (value v, code_t prog, int proglen, FILE * f) if (!v) return; if (prog && v % sizeof (int) == 0 - && (code_t) v >= prog - && (code_t) v < (code_t) ((char *) prog + proglen)) + && (code_t) v >= prog + && (code_t) v < (code_t) ((char *) prog + proglen)) fprintf (f, "=code@%d", (code_t) v - prog); else if (Is_long (v)) fprintf (f, "=long%" ARCH_INTNAT_PRINTF_FORMAT "d", Long_val (v)); - else if ((void*)v >= (void*)caml_stack_low - && (void*)v < (void*)caml_stack_high) + else if ((void*)v >= (void*)caml_stack_low + && (void*)v < (void*)caml_stack_high) fprintf (f, "=stack_%d", (intnat*)caml_stack_high - (intnat*)v); else if (Is_block (v)) { int s = Wosize_val (v); @@ -202,10 +202,10 @@ caml_trace_value_file (value v, code_t prog, int proglen, FILE * f) l = caml_string_length (v); fprintf (f, "=string[s%dL%d]'", s, l); for (i = 0; i < ((l>0x1f)?0x1f:l) ; i++) { - if (isprint (Byte (v, i))) - putc (Byte (v, i), f); - else - putc ('?', f); + if (isprint (Byte (v, i))) + putc (Byte (v, i), f); + else + putc ('?', f); }; fprintf (f, "'"); goto displayfields; @@ -215,7 +215,7 @@ caml_trace_value_file (value v, code_t prog, int proglen, FILE * f) case Double_array_tag: fprintf (f, "=floatarray[s%d]", s); for (i = 0; i < ((s>0xf)?0xf:s); i++) - fprintf (f, " %g", Double_field (v, i)); + fprintf (f, " %g", Double_field (v, i)); goto displayfields; case Abstract_tag: fprintf (f, "=abstract[s%d]", s); @@ -227,25 +227,25 @@ caml_trace_value_file (value v, code_t prog, int proglen, FILE * f) fprintf (f, "=block", tg, s); displayfields: if (s > 0) - fputs ("=(", f); + fputs ("=(", f); for (i = 0; i < s; i++) { - if (i > 20) { - fputs ("....", f); - break; - }; - if (i > 0) - putc (' ', f); - fprintf (f, "%#lx", Field (v, i)); + if (i > 20) { + fputs ("....", f); + break; + }; + if (i > 0) + putc (' ', f); + fprintf (f, "%#lx", Field (v, i)); }; if (s > 0) - putc (')', f); + putc (')', f); }; } } void caml_trace_accu_sp_file (value accu, value * sp, code_t prog, int proglen, - FILE * f) + FILE * f) { int i; value *p; diff --git a/byterun/instruct.h b/byterun/instruct.h index a2eb5b7b5..c45d4ea28 100644 --- a/byterun/instruct.h +++ b/byterun/instruct.h @@ -27,7 +27,7 @@ enum instructions { ENVACC1, ENVACC2, ENVACC3, ENVACC4, ENVACC, PUSHENVACC1, PUSHENVACC2, PUSHENVACC3, PUSHENVACC4, PUSHENVACC, PUSH_RETADDR, APPLY, APPLY1, APPLY2, APPLY3, - APPTERM, APPTERM1, APPTERM2, APPTERM3, + APPTERM, APPTERM1, APPTERM2, APPTERM3, RETURN, RESTART, GRAB, CLOSURE, CLOSUREREC, OFFSETCLOSUREM2, OFFSETCLOSURE0, OFFSETCLOSURE2, OFFSETCLOSURE, @@ -48,7 +48,7 @@ enum instructions { NEGINT, ADDINT, SUBINT, MULINT, DIVINT, MODINT, ANDINT, ORINT, XORINT, LSLINT, LSRINT, ASRINT, EQ, NEQ, LTINT, LEINT, GTINT, GEINT, - OFFSETINT, OFFSETREF, ISINT, + OFFSETINT, OFFSETREF, ISINT, GETMETHOD, BEQ, BNEQ, BLTINT, BLEINT, BGTINT, BGEINT, ULTINT, UGEINT, diff --git a/byterun/int64_format.h b/byterun/int64_format.h index 2096a030d..b9ae91040 100644 --- a/byterun/int64_format.h +++ b/byterun/int64_format.h @@ -49,7 +49,7 @@ static void I64_format(char * buffer, char * fmt, int64 x) filler = '0'; break; case '#': alternate = 1; break; - case '1': case '2': case '3': case '4': case '5': + case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': width = atoi(p); while (*p >= '0' && *p <= '9') p++; diff --git a/byterun/intern.c b/byterun/intern.c index b7acfd4a0..f44211462 100644 --- a/byterun/intern.c +++ b/byterun/intern.c @@ -104,7 +104,7 @@ static void intern_cleanup(void) if (intern_obj_table != NULL) caml_stat_free(intern_obj_table); if (intern_extra_block != NULL) { /* free newly allocated heap chunk */ - caml_free_for_heap(intern_extra_block); + caml_free_for_heap(intern_extra_block); } else if (intern_block != 0) { /* restore original header for heap block, otherwise GC is confused */ Hd_val(intern_block) = intern_header; @@ -186,7 +186,7 @@ static void intern_rec(value *dest) read_shared: Assert (ofs > 0); Assert (ofs <= obj_counter); - Assert (intern_obj_table != NULL); + Assert (intern_obj_table != NULL); v = intern_obj_table[obj_counter - ofs]; break; case CODE_SHARED16: @@ -237,7 +237,7 @@ static void intern_rec(value *dest) Permute_64(v, ARCH_FLOAT_ENDIANNESS, v, 0x01234567) else Permute_64(v, ARCH_FLOAT_ENDIANNESS, v, 0x76543210); -#endif +#endif break; case CODE_DOUBLE_ARRAY8_LITTLE: case CODE_DOUBLE_ARRAY8_BIG: @@ -508,7 +508,7 @@ CAMLexport value caml_input_value_from_malloc(char * data, intnat ofs) intern_src = intern_input + ofs; intern_input_malloced = 1; magic = read32u(); - if (magic != Intext_magic_number) + if (magic != Intext_magic_number) caml_failwith("input_value_from_malloc: bad object"); block_len = read32u(); obj = input_val_from_block(); @@ -527,7 +527,7 @@ CAMLexport value caml_input_value_from_block(char * data, intnat len) intern_src = intern_input; intern_input_malloced = 0; magic = read32u(); - if (magic != Intext_magic_number) + if (magic != Intext_magic_number) caml_failwith("input_value_from_block: bad object"); block_len = read32u(); if (5*4 + block_len > len) diff --git a/byterun/interp.c b/byterun/interp.c index 254441e6e..7bcdf7acb 100644 --- a/byterun/interp.c +++ b/byterun/interp.c @@ -1024,14 +1024,14 @@ value caml_interprete(code_t prog, asize_t prog_size) Instruct(ISINT): accu = Val_long(accu & 1); Next; - + /* Object-oriented operations */ #define Lookup(obj, lab) Field (Field (obj, 0), Int_val(lab)) /* please don't forget to keep below code in sync with the - functions caml_cache_public_method and - caml_cache_public_method2 in obj.c */ + functions caml_cache_public_method and + caml_cache_public_method2 in obj.c */ Instruct(GETMETHOD): accu = Lookup(sp[0], accu); @@ -1137,7 +1137,7 @@ void caml_prepare_bytecode(code_t prog, asize_t prog_size) { Assert(prog); Assert(prog_size>0); /* actually, the threading of the bytecode might be done here */ -} +} void caml_release_bytecode(code_t prog, asize_t prog_size) { /* other implementations of the interpreter (such as an hypothetical diff --git a/byterun/ints.c b/byterun/ints.c index 7b8a13675..9fdaa1802 100644 --- a/byterun/ints.c +++ b/byterun/ints.c @@ -180,7 +180,7 @@ CAMLprim value caml_format_int(value fmt, value arg) value res; buffer = parse_format(fmt, ARCH_INTNAT_PRINTF_FORMAT, - format_string, default_format_buffer, &conv); + format_string, default_format_buffer, &conv); switch (conv) { case 'u': case 'x': case 'X': case 'o': sprintf(buffer, format_string, Unsigned_long_val(arg)); @@ -492,7 +492,7 @@ CAMLprim value caml_int64_of_float(value v) { return caml_copy_int64(I64_of_double(Double_val(v))); } CAMLprim value caml_int64_to_float(value v) -{ +{ int64 i = Int64_val(v); return caml_copy_double(I64_to_double(i)); } diff --git a/byterun/lexing.c b/byterun/lexing.c index d2776116e..6e74795c2 100644 --- a/byterun/lexing.c +++ b/byterun/lexing.c @@ -219,7 +219,7 @@ CAMLprim value caml_new_lex_engine(struct lexing_table *tbl, value start_state, pc_off = Short(tbl->lex_trans_code, base_code + c) ; else pc_off = Short(tbl->lex_default_code, pstate) ; - if (pc_off > 0) + if (pc_off > 0) run_mem(Bp_val(tbl->lex_code) + pc_off, lexbuf->lex_mem, lexbuf->lex_curr_pos) ; /* Erase the EOF condition only if the EOF pseudo-character was consumed by the automaton (i.e. there was no backtrack above) @@ -228,4 +228,3 @@ CAMLprim value caml_new_lex_engine(struct lexing_table *tbl, value start_state, } } } - diff --git a/byterun/md5.c b/byterun/md5.c index 9d2481fe9..d0b6e5e46 100644 --- a/byterun/md5.c +++ b/byterun/md5.c @@ -308,4 +308,3 @@ CAMLexport void caml_MD5Transform(uint32 *buf, uint32 *in) buf[2] += c; buf[3] += d; } - diff --git a/byterun/md5.h b/byterun/md5.h index ff8c23ee0..b92b02ad1 100644 --- a/byterun/md5.h +++ b/byterun/md5.h @@ -32,7 +32,7 @@ struct MD5Context { }; CAMLextern void caml_MD5Init (struct MD5Context *context); -CAMLextern void caml_MD5Update (struct MD5Context *context, unsigned char *buf, +CAMLextern void caml_MD5Update (struct MD5Context *context, unsigned char *buf, uintnat len); CAMLextern void caml_MD5Final (unsigned char *digest, struct MD5Context *ctx); CAMLextern void caml_MD5Transform (uint32 *buf, uint32 *in); diff --git a/byterun/meta.c b/byterun/meta.c index 91143612a..1ed4fbddd 100644 --- a/byterun/meta.c +++ b/byterun/meta.c @@ -82,7 +82,7 @@ CAMLprim value caml_realloc_global(value size) } return Val_unit; } - + CAMLprim value caml_get_current_environment(value unit) { return *caml_extern_sp; @@ -148,7 +148,7 @@ value caml_realloc_global(value size) caml_invalid_argument("Meta.realloc_global"); return Val_unit; /* not reached */ } - + value caml_invoke_traced_function(value codeptr, value env, value arg) { caml_invalid_argument("Meta.invoke_traced_function"); diff --git a/byterun/osdeps.h b/byterun/osdeps.h index 3646fb4f7..248b3f6aa 100644 --- a/byterun/osdeps.h +++ b/byterun/osdeps.h @@ -69,4 +69,3 @@ extern int caml_executable_name(char * name, int name_len); #endif #endif /* CAML_OSDEPS_H */ - diff --git a/byterun/parsing.c b/byterun/parsing.c index 23228bf7b..bcb9e5faa 100644 --- a/byterun/parsing.c +++ b/byterun/parsing.c @@ -83,7 +83,7 @@ int caml_parser_trace = 0; /* Output codes */ /* Mirrors parser_output in ../stdlib/parsing.ml */ -#define READ_TOKEN Val_int(0) +#define READ_TOKEN Val_int(0) #define RAISE_PARSE_ERROR Val_int(1) #define GROW_STACKS_1 Val_int(2) #define GROW_STACKS_2 Val_int(3) @@ -133,8 +133,8 @@ static void print_token(struct parser_tables *tables, int state, value tok) else fprintf(stderr, "_"); fprintf(stderr, ")\n"); - } -} + } +} /* The pushdown automata */ @@ -171,7 +171,7 @@ CAMLprim value caml_parse_engine(struct parser_tables *tables, caml_modify(&env->lval, Val_long(0)); } if (caml_parser_trace) print_token(tables, state, arg); - + testshift: n1 = Short(tables->sindex, state); n2 = n1 + Int_val(env->curr_char); @@ -199,7 +199,7 @@ CAMLprim value caml_parse_engine(struct parser_tables *tables, n2 = n1 + ERRCODE; if (n1 != 0 && n2 >= 0 && n2 <= Int_val(tables->tablesize) && Short(tables->check, n2) == ERRCODE) { - if (caml_parser_trace) + if (caml_parser_trace) fprintf(stderr, "Recovering in state %d\n", state1); goto shift_recover; } else { @@ -222,7 +222,7 @@ CAMLprim value caml_parse_engine(struct parser_tables *tables, env->curr_char = Val_int(-1); goto loop; } - + shift: env->curr_char = Val_int(-1); if (errflag > 0) errflag--; @@ -289,7 +289,7 @@ CAMLprim value caml_parse_engine(struct parser_tables *tables, Assert(0); return RAISE_PARSE_ERROR; /* Keeps gcc -Wall happy */ } - + } /* Control printing of debugging info */ diff --git a/byterun/printexc.c b/byterun/printexc.c index c2f0af046..f72157ff0 100644 --- a/byterun/printexc.c +++ b/byterun/printexc.c @@ -44,7 +44,7 @@ static void add_string(struct stringbuf *buf, char *s) if (len > 0) memmove(buf->ptr, s, len); buf->ptr += len; } - + CAMLexport char * caml_format_exception(value exn) { mlsize_t start, i; diff --git a/byterun/roots.c b/byterun/roots.c index ff726bd31..74fbb41ed 100644 --- a/byterun/roots.c +++ b/byterun/roots.c @@ -101,4 +101,3 @@ CAMLexport void caml_do_local_roots (scanning_action f, value *stack_low, } } } - diff --git a/byterun/signals.c b/byterun/signals.c index 31604eba2..90fe89196 100644 --- a/byterun/signals.c +++ b/byterun/signals.c @@ -267,7 +267,7 @@ CAMLprim value caml_install_signal_handler(value signal_number, value action) int sig, act, oldact; sig = caml_convert_signal_number(Int_val(signal_number)); - if (sig < 0 || sig >= NSIG) + if (sig < 0 || sig >= NSIG) caml_invalid_argument("Sys.signal: unavailable signal"); switch(action) { case Val_int(0): /* Signal_default */ diff --git a/byterun/startup.c b/byterun/startup.c index 419d49be6..f954e3ee5 100644 --- a/byterun/startup.c +++ b/byterun/startup.c @@ -176,7 +176,7 @@ int32 caml_seek_optional_section(int fd, struct exec_trailer *trail, char *name) int32 caml_seek_section(int fd, struct exec_trailer *trail, char *name) { int32 len = caml_seek_optional_section(fd, trail, name); - if (len == -1) + if (len == -1) caml_fatal_error_arg("Fatal_error: section `%s' is missing\n", name); return len; } diff --git a/byterun/str.c b/byterun/str.c index 380e2eb5a..760b154e3 100644 --- a/byterun/str.c +++ b/byterun/str.c @@ -91,7 +91,7 @@ CAMLprim value caml_string_compare(value s1, value s2) if (s1 == s2) return Val_int(0); len1 = caml_string_length(s1); - len2 = caml_string_length(s2); + len2 = caml_string_length(s2); res = memcmp(String_val(s1), String_val(s2), len1 <= len2 ? len1 : len2); if (res < 0) return Val_int(-1); if (res > 0) return Val_int(1); @@ -104,22 +104,22 @@ CAMLprim value caml_string_lessthan(value s1, value s2) { return caml_string_compare(s1, s2) < Val_int(0) ? Val_true : Val_false; } - + CAMLprim value caml_string_lessequal(value s1, value s2) { return caml_string_compare(s1, s2) <= Val_int(0) ? Val_true : Val_false; } - + CAMLprim value caml_string_greaterthan(value s1, value s2) { return caml_string_compare(s1, s2) > Val_int(0) ? Val_true : Val_false; } - + CAMLprim value caml_string_greaterequal(value s1, value s2) { return caml_string_compare(s1, s2) >= Val_int(0) ? Val_true : Val_false; } - + CAMLprim value caml_blit_string(value s1, value ofs1, value s2, value ofs2, value n) { @@ -153,4 +153,3 @@ CAMLprim value caml_bitvect_test(value bv, value n) int pos = Int_val(n); return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7))); } - diff --git a/byterun/win32.c b/byterun/win32.c index fa499f959..866977b12 100644 --- a/byterun/win32.c +++ b/byterun/win32.c @@ -84,7 +84,7 @@ char * caml_search_in_path(struct ext_table * path, char * name) strcpy(fullname, name); return fullname; } - + CAMLexport char * caml_search_exe_in_path(char * name) { char * fullname, * filepart; @@ -95,14 +95,14 @@ CAMLexport char * caml_search_exe_in_path(char * name) while (1) { fullname = stat_alloc(pathlen); retcode = SearchPath(NULL, /* use system search path */ - name, - ".exe", /* add .exe extension if needed */ - pathlen, - fullname, - &filepart); + name, + ".exe", /* add .exe extension if needed */ + pathlen, + fullname, + &filepart); if (retcode == 0) { caml_gc_message(0x100, "%s not found in search path\n", - (uintnat) name); + (uintnat) name); strcpy(fullname, name); break; } @@ -406,7 +406,7 @@ void caml_signal_thread(void * lpParam) #if defined(NATIVE_CODE) && !defined(_WIN64) -/* Handling of system stack overflow. +/* Handling of system stack overflow. * Based on code provided by Olivier Andrieu. * An EXCEPTION_STACK_OVERFLOW is signaled when the guard page at the @@ -470,11 +470,11 @@ static void caml_reset_stack (void *faulting_address) /* restore the PAGE_GUARD protection on this page */ switch (osi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: - VirtualProtect (mbi.BaseAddress, page_size, + VirtualProtect (mbi.BaseAddress, page_size, mbi.Protect | PAGE_GUARD, &oldprot); break; case VER_PLATFORM_WIN32_WINDOWS: - VirtualProtect (mbi.BaseAddress, page_size, + VirtualProtect (mbi.BaseAddress, page_size, PAGE_NOACCESS, &oldprot); break; } diff --git a/camlp4/CHANGES b/camlp4/CHANGES index 571894b9c..ef48fc425 100644 --- a/camlp4/CHANGES +++ b/camlp4/CHANGES @@ -160,8 +160,8 @@ Camlp4 Version 3.05 (Jacques Garrigue's idea): old syntax new syntax [| ... |] [ = ... ] - [| < ... |] [ < ... ] - [| > ... |] [ > ... ] + [| < ... |] [ < ... ] + [| > ... |] [ > ... ] This applies also in predefined quotations of syntax tree for types <:ctyp< ... >> - [05 Jun 02] Added option -ss in pr_o.cmo: print with double semicolons; @@ -600,7 +600,7 @@ Grammar interface is now: Grammar.tokens g "" -Missing features added +Missing features added * Added "lazy" statement (pa_r.cmo, pa_o.cmo, pr_r.cmo, pr_o.cmo) * Added print "assert" statement (pr_o.cmo, pr_r.cmo) * Added parsing of infix operators like in Ocaml (e.g. |||) in pa_o.cmo @@ -690,7 +690,7 @@ Errors and missings in normal and righteous syntaxes. Grammars, EXTEND, DELETE_RULE -* Added functorial version for grammars (started in version 1.07.1, +* Added functorial version for grammars (started in version 1.07.1, completed in this version). * Added statements GEXTEND and GDELETE_RULE in pa_extend.cmo for functorial version. diff --git a/camlp4/Camlp4/Camlp4Ast.partial.ml b/camlp4/Camlp4/Camlp4Ast.partial.ml index ba941d7a8..19b5053b8 100644 --- a/camlp4/Camlp4/Camlp4Ast.partial.ml +++ b/camlp4/Camlp4/Camlp4Ast.partial.ml @@ -160,7 +160,7 @@ (* sig sg end *) | MtSig of loc and sig_item (* mt with wc *) - | MtWit of loc and module_type and with_constr + | MtWit of loc and module_type and with_constr | MtAnt of loc and string (* $s$ *) ] and sig_item = [ SgNil of loc diff --git a/camlp4/Camlp4/Debug.ml b/camlp4/Camlp4/Debug.ml index b94d8f4da..cbd309227 100644 --- a/camlp4/Camlp4/Debug.ml +++ b/camlp4/Camlp4/Debug.ml @@ -45,7 +45,7 @@ value mode = StringSet.add (String.sub str i (String.length str - i)) acc ] in let sections = loop StringSet.empty 0 in if StringSet.mem "*" sections then fun _ -> True - else fun x -> StringSet.mem x sections + else fun x -> StringSet.mem x sections with [ Not_found -> fun _ -> False ]; value formatter = diff --git a/camlp4/Camlp4/PreCast.ml b/camlp4/Camlp4/PreCast.ml index 527c0c484..8e3da3483 100644 --- a/camlp4/Camlp4/PreCast.ml +++ b/camlp4/Camlp4/PreCast.ml @@ -65,4 +65,3 @@ module Printers = struct module DumpCamlp4Ast = Printers.DumpCamlp4Ast.Make Syntax; module Null = Printers.Null.Make Syntax; end; - diff --git a/camlp4/Camlp4/Printers/Null.ml b/camlp4/Camlp4/Printers/Null.ml index d593f9efc..a9a2c486b 100644 --- a/camlp4/Camlp4/Printers/Null.ml +++ b/camlp4/Camlp4/Printers/Null.ml @@ -24,7 +24,7 @@ end; module Make (Syntax : Sig.Syntax) = struct include Syntax; - + value print_interf ?input_file:(_) ?output_file:(_) _ = (); value print_implem ?input_file:(_) ?output_file:(_) _ = (); end; diff --git a/camlp4/Camlp4/Register.ml b/camlp4/Camlp4/Register.ml index 6044b0d97..4b6819368 100644 --- a/camlp4/Camlp4/Register.ml +++ b/camlp4/Camlp4/Register.ml @@ -139,7 +139,7 @@ module CurrentParser = struct value parse_interf ?directive_handler loc strm = sig_item_parser.val ?directive_handler loc strm; value parse_implem ?directive_handler loc strm = - str_item_parser.val ?directive_handler loc strm; + str_item_parser.val ?directive_handler loc strm; end; module CurrentPrinter = struct @@ -147,7 +147,7 @@ module CurrentPrinter = struct value print_interf ?input_file ?output_file ast = sig_item_printer.val ?input_file ?output_file ast; value print_implem ?input_file ?output_file ast = - str_item_printer.val ?input_file ?output_file ast; + str_item_printer.val ?input_file ?output_file ast; end; value enable_ocaml_printer () = @@ -167,4 +167,3 @@ value enable_dump_camlp4_ast_printer () = value enable_null_printer () = let module M = Printer PP.Null.Id PP.Null.Make in (); - diff --git a/camlp4/Camlp4/Register.mli b/camlp4/Camlp4/Register.mli index df1180ffd..513114397 100644 --- a/camlp4/Camlp4/Register.mli +++ b/camlp4/Camlp4/Register.mli @@ -91,4 +91,3 @@ value enable_ocamlr_printer : unit -> unit; value enable_null_printer : unit -> unit; value enable_dump_ocaml_ast_printer : unit -> unit; value enable_dump_camlp4_ast_printer : unit -> unit; - diff --git a/camlp4/Camlp4/Sig.ml b/camlp4/Camlp4/Sig.ml index 3e7106e73..f2df616b8 100644 --- a/camlp4/Camlp4/Sig.ml +++ b/camlp4/Camlp4/Sig.ml @@ -247,7 +247,7 @@ module type Ast = sig (** This class is the base class for map traversal on the Ast. To make a custom traversal class one just extend it like that: - + This example swap pairs expression contents: open Camlp4.PreCast; [class swap = object @@ -744,7 +744,7 @@ module type Token = sig type t; value to_string : t -> string; - + value print : Format.formatter -> t -> unit; value match_keyword : string -> t -> bool; @@ -774,7 +774,7 @@ module type Token = sig function to produce token keywords instead. *) value filter : t -> token_filter; - (** Called by the grammar system when a keyword is used. + (** Called by the grammar system when a keyword is used. The boolean argument is True when it's the first time that keyword is used. If you do not care about this information just return [()]. *) value keyword_added : t -> string -> bool -> unit; @@ -955,10 +955,10 @@ module Grammar = struct (** The abstract type of grammar entries. The type parameter is the type of the semantic actions that are associated with this entry. *) type t 'a; - + (** Make a new entry from the given name. *) value mk : gram -> string -> t 'a; - + (** Make a new entry from a name and an hand made token parser. *) value of_parser : gram -> string -> (Stream.t (Token.t * Loc.t) -> 'a) -> t 'a; @@ -1367,4 +1367,3 @@ module type SyntaxExtension = functor (Syn : Syntax) and module Token = Syn.Token and module Gram = Syn.Gram and module Quotation = Syn.Quotation); - diff --git a/camlp4/Camlp4/Struct/CommentFilter.ml b/camlp4/Camlp4/Struct/CommentFilter.ml index 5867df408..9dac53fbf 100644 --- a/camlp4/Camlp4/Struct/CommentFilter.ml +++ b/camlp4/Camlp4/Struct/CommentFilter.ml @@ -35,7 +35,7 @@ module Make (Token : Sig.Camlp4Token) = struct do { Queue.add (x, loc) q; debug comments "add: %S at %a@\n" x Loc.dump loc in self xs } - | [: ` x; xs :] -> + | [: ` x; xs :] -> (* debug comments "Found %a at %a@." Token.print x Loc.dump loc in *) [: ` x; self xs :] | [: :] -> [: :] ] diff --git a/camlp4/Camlp4/Struct/FreeVars.ml b/camlp4/Camlp4/Struct/FreeVars.ml index 66a9a8b0e..7ce12e24d 100644 --- a/camlp4/Camlp4/Struct/FreeVars.ml +++ b/camlp4/Camlp4/Struct/FreeVars.ml @@ -125,4 +125,3 @@ module Make (Ast : Sig.Camlp4Ast) = struct value free_vars env_init e = let fold = new fold_free_vars S.add ~env_init S.empty in (fold#expr e)#free; end; - diff --git a/camlp4/Camlp4/Struct/Grammar/Context.ml b/camlp4/Camlp4/Struct/Grammar/Context.ml index 75d731c66..b92c2915b 100644 --- a/camlp4/Camlp4/Struct/Grammar/Context.ml +++ b/camlp4/Camlp4/Struct/Grammar/Context.ml @@ -38,7 +38,7 @@ module Make (Token : Sig.Token) : S with module Token = Token = struct type t = { strm : mutable Stream.t (Token.t * Loc.t); loc : mutable Loc.t }; - value loc_bp c = + value loc_bp c = match Stream.peek c.strm with [ None -> Loc.ghost | Some (_, loc) -> loc ]; diff --git a/camlp4/Camlp4/Struct/Grammar/Parser.mli b/camlp4/Camlp4/Struct/Grammar/Parser.mli index 695982a3d..e5a3faaaf 100644 --- a/camlp4/Camlp4/Struct/Grammar/Parser.mli +++ b/camlp4/Camlp4/Struct/Grammar/Parser.mli @@ -65,4 +65,3 @@ module Make (Structure : Structure.S) : sig value continue_parser_of_entry : internal_entry -> int -> Loc.t -> Action.t -> Context.t -> Stream.t (Token.t * Loc.t) -> Action.t; end; - diff --git a/camlp4/Camlp4/Struct/Lexer.mll b/camlp4/Camlp4/Struct/Lexer.mll index f024fa437..40a082233 100644 --- a/camlp4/Camlp4/Struct/Lexer.mll +++ b/camlp4/Camlp4/Struct/Lexer.mll @@ -396,7 +396,7 @@ module Make (Token : Sig.Camlp4Token) SYMBOL(beginning ^ tok) } and maybe_quotation_at c = parse - | (ident as loc) '<' + | (ident as loc) '<' { mk_quotation quotation c "" loc (1 + String.length loc) } | symbolchar* as tok { SYMBOL("<@" ^ tok) } @@ -434,7 +434,7 @@ module Make (Token : Sig.Camlp4Token) | _ { store_parse (antiquot name) c } { - + let lexing_store s buff max = let rec self n s = if n >= max then n diff --git a/camlp4/Camlp4/Struct/Loc.ml b/camlp4/Camlp4/Struct/Loc.ml index 48974d829..ac42d4b1c 100644 --- a/camlp4/Camlp4/Struct/Loc.ml +++ b/camlp4/Camlp4/Struct/Loc.ml @@ -25,32 +25,32 @@ open Format; handling: type pos = ... the same ... - + 1/ - + type loc = { file_name : string; start : pos; stop : pos }; - + type t = [ Nowhere | Ghost of loc (* the closest non ghost loc *) | Concrete of loc ]; - + 2/ - + type loc = { file_name : string; start : pos; stop : pos }; - + type t = option loc; - + 3/ - + type t = { file_name : option string; start : pos; @@ -195,7 +195,7 @@ value merge a b = debug loc "trivial merge@\n" in a else - let r = + let r = match (a.ghost, b.ghost) with [ (False, False) -> (* FIXME if a.file_name <> b.file_name then diff --git a/camlp4/Camlp4Filters/Camlp4FoldGenerator.ml b/camlp4/Camlp4Filters/Camlp4FoldGenerator.ml index f5efd2c6a..c0af8e53a 100644 --- a/camlp4/Camlp4Filters/Camlp4FoldGenerator.ml +++ b/camlp4/Camlp4Filters/Camlp4FoldGenerator.ml @@ -56,22 +56,22 @@ module Make (AstFilters : Camlp4.Sig.AstFilters) = struct value exsk s k = <:expr< $lid:xsk s k$>>; value rec apply_expr accu = - fun - [ [] -> accu + fun + [ [] -> accu | [x :: xs] -> let _loc = Ast.loc_of_expr x in apply_expr <:expr< $accu$ $x$ >> xs ]; value rec apply_patt accu = - fun - [ [] -> accu + fun + [ [] -> accu | [x :: xs] -> let _loc = Ast.loc_of_patt x in apply_patt <:patt< $accu$ $x$ >> xs ]; value rec apply_ctyp accu = - fun - [ [] -> accu + fun + [ [] -> accu | [x :: xs] -> let _loc = Ast.loc_of_ctyp x in apply_ctyp <:ctyp< $accu$ $x$ >> xs ]; @@ -430,7 +430,7 @@ module Make (AstFilters : Camlp4.Sig.AstFilters) = struct let priv = if priv then Ast.BTrue else Ast.BFalse in <:class_str_item< method $private:priv$ $lid:id1$ : $ty$ = $funs$; $acc$ >> - and ctyp_name_of_name_params name params = + and ctyp_name_of_name_params name params = apply_ctyp <:ctyp< $id:name$ >> params and method_type_of_type_decl (_, name, params, ctyp, _) = diff --git a/camlp4/Camlp4Filters/Camlp4MetaGenerator.ml b/camlp4/Camlp4Filters/Camlp4MetaGenerator.ml index ea99c99ed..6eb849995 100644 --- a/camlp4/Camlp4Filters/Camlp4MetaGenerator.ml +++ b/camlp4/Camlp4Filters/Camlp4MetaGenerator.ml @@ -151,7 +151,7 @@ value filter st = value meta_float _loc s = $m.flo$ _loc s; value meta_char _loc s = $m.chr$ _loc s; value meta_bool _loc = - fun + fun [ False -> $m_uid m "False"$ | True -> $m_uid m "True"$ ]; value rec meta_list mf_a _loc = diff --git a/camlp4/Camlp4Parsers/Camlp4DebugParser.ml b/camlp4/Camlp4Parsers/Camlp4DebugParser.ml index a815a96a2..7e7228188 100644 --- a/camlp4/Camlp4Parsers/Camlp4DebugParser.ml +++ b/camlp4/Camlp4Parsers/Camlp4DebugParser.ml @@ -40,7 +40,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct StringSet.add (String.sub str i (String.length str - i)) acc ] in let sections = loop StringSet.empty 0 in if StringSet.mem "*" sections then fun _ -> True - else fun x -> StringSet.mem x sections + else fun x -> StringSet.mem x sections with [ Not_found -> fun _ -> False ]; value rec apply accu = diff --git a/camlp4/Camlp4Parsers/Camlp4GrammarParser.ml b/camlp4/Camlp4Parsers/Camlp4GrammarParser.ml index 50cbdb2bf..2aa433453 100644 --- a/camlp4/Camlp4Parsers/Camlp4GrammarParser.ml +++ b/camlp4/Camlp4Parsers/Camlp4GrammarParser.ml @@ -531,7 +531,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct [ <:expr< $lid:i$ >> -> i | _ -> failwith "internal error in the Grammar extension" ] in <:binding< $lid:i$ = - (grammar_entry_create $str:i$ : $uid:gm$.Entry.t '$x$) >> in + (grammar_entry_create $str:i$ : $uid:gm$.Entry.t '$x$) >> in let expr_of_name {expr = e; tvar = x; loc = _loc} = <:expr< ($e$ : $uid:gm$.Entry.t '$x$) >> in let e = @@ -710,7 +710,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct ; rule_list: [ [ "["; "]" -> [] - | "["; rules = LIST1 rule SEP "|"; "]" -> + | "["; rules = LIST1 rule SEP "|"; "]" -> retype_rule_list_without_patterns _loc rules ] ] ; rule: diff --git a/camlp4/Camlp4Parsers/Camlp4ListComprehension.ml b/camlp4/Camlp4Parsers/Camlp4ListComprehension.ml index 05cfab472..23db86855 100644 --- a/camlp4/Camlp4Parsers/Camlp4ListComprehension.ml +++ b/camlp4/Camlp4Parsers/Camlp4ListComprehension.ml @@ -45,21 +45,21 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct [ Some (KEYWORD "<-") -> n | Some (KEYWORD ("[" | "[<")) -> skip_patt (ignore_upto "]" (n + 1) + 1) - | Some (KEYWORD "(") -> + | Some (KEYWORD "(") -> skip_patt (ignore_upto ")" (n + 1) + 1) - | Some (KEYWORD "{") -> + | Some (KEYWORD "{") -> skip_patt (ignore_upto "}" (n + 1) + 1) | Some (KEYWORD ("as" | "::" | "," | "_")) | Some (LIDENT _ | UIDENT _) -> skip_patt (n + 1) | Some _ | None -> raise Stream.Failure ] and ignore_upto end_kwd n = match stream_peek_nth n strm with - [ Some (KEYWORD prm) when prm = end_kwd -> n + [ Some (KEYWORD prm) when prm = end_kwd -> n | Some (KEYWORD ("[" | "[<")) -> ignore_upto end_kwd (ignore_upto "]" (n + 1) + 1) | Some (KEYWORD "(") -> ignore_upto end_kwd (ignore_upto ")" (n + 1) + 1) - | Some (KEYWORD "{") -> + | Some (KEYWORD "{") -> ignore_upto end_kwd (ignore_upto "}" (n + 1) + 1) | Some _ -> ignore_upto end_kwd (n + 1) | None -> raise Stream.Failure ] @@ -69,7 +69,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct value map _loc p e l = match (p, e) with [ (<:patt< $lid:x$ >>, <:expr< $lid:y$ >>) when x = y -> l - | _ -> + | _ -> if Ast.is_irrefut_patt p then <:expr< List.map (fun $p$ -> $e$) $l$ >> else @@ -92,8 +92,8 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct [ [`gen (p, l)] -> map _loc p e l | [`gen (p, l); `cond b :: items] -> compr _loc e [`gen (p, filter _loc p b l) :: items] - | [`gen (p, l) :: ([ `gen (_, _) :: _ ] as is )] -> - concat _loc (map _loc p (compr _loc e is) l) + | [`gen (p, l) :: ([ `gen (_, _) :: _ ] as is )] -> + concat _loc (map _loc p (compr _loc e is) l) | _ -> raise Stream.Failure ]; DELETE_RULE Gram expr: "["; sem_expr_for_list; "]" END; @@ -122,8 +122,8 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct | e = expr LEVEL "top" -> <:expr< [$e$] >> ] ] ; - item: - [ [ test_patt_lessminus; + item: + [ [ test_patt_lessminus; p = patt; "<-" ; e = expr LEVEL "top" -> `gen (p, e) | e = expr LEVEL "top" -> `cond e ] ] ; diff --git a/camlp4/Camlp4Parsers/Camlp4MacroParser.ml b/camlp4/Camlp4Parsers/Camlp4MacroParser.ml index ea3591527..57f660daf 100644 --- a/camlp4/Camlp4Parsers/Camlp4MacroParser.ml +++ b/camlp4/Camlp4Parsers/Camlp4MacroParser.ml @@ -316,9 +316,9 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct [ [ "DEFINE"; i = uident; def = opt_macro_value -> SdDef i def | "UNDEF"; i = uident -> SdUnd i | "IFDEF"; uident_eval_ifdef; "THEN"; st1 = smlist_then; st2 = else_macro_def -> - make_SdITE_result st1 st2 + make_SdITE_result st1 st2 | "IFNDEF"; uident_eval_ifndef; "THEN"; st1 = smlist_then; st2 = else_macro_def -> - make_SdITE_result st1 st2 + make_SdITE_result st1 st2 | "INCLUDE"; fname = STRING -> SdLazy (lazy (parse_include_file str_items fname)) ] ] ; @@ -352,23 +352,23 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct ; smlist_then: [ [ sml = LIST1 [ d = macro_def; semi -> - execute_macro_if_active_branch _loc <:str_item<>> (fun a b -> <:str_item< $a$; $b$ >>) Then d - | si = str_item; semi -> SdStr si ] -> sml ] ] + execute_macro_if_active_branch _loc <:str_item<>> (fun a b -> <:str_item< $a$; $b$ >>) Then d + | si = str_item; semi -> SdStr si ] -> sml ] ] ; smlist_else: [ [ sml = LIST1 [ d = macro_def; semi -> - execute_macro_if_active_branch _loc <:str_item<>> (fun a b -> <:str_item< $a$; $b$ >>) Else d - | si = str_item; semi -> SdStr si ] -> sml ] ] + execute_macro_if_active_branch _loc <:str_item<>> (fun a b -> <:str_item< $a$; $b$ >>) Else d + | si = str_item; semi -> SdStr si ] -> sml ] ] ; sglist_then: [ [ sgl = LIST1 [ d = macro_def_sig; semi -> - execute_macro_if_active_branch _loc <:sig_item<>> (fun a b -> <:sig_item< $a$; $b$ >>) Then d - | si = sig_item; semi -> SdStr si ] -> sgl ] ] + execute_macro_if_active_branch _loc <:sig_item<>> (fun a b -> <:sig_item< $a$; $b$ >>) Then d + | si = sig_item; semi -> SdStr si ] -> sgl ] ] ; sglist_else: [ [ sgl = LIST1 [ d = macro_def_sig; semi -> - execute_macro_if_active_branch _loc <:sig_item<>> (fun a b -> <:sig_item< $a$; $b$ >>) Else d - | si = sig_item; semi -> SdStr si ] -> sgl ] ] + execute_macro_if_active_branch _loc <:sig_item<>> (fun a b -> <:sig_item< $a$; $b$ >>) Else d + | si = sig_item; semi -> SdStr si ] -> sgl ] ] ; endif: [ [ "END" -> () diff --git a/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml b/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml index 8a1b53c08..fa550bacf 100644 --- a/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml +++ b/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml @@ -449,7 +449,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct [ [ i = lident_colon; t = ctyp LEVEL "star"; "->"; ct = SELF -> <:class_type< [ ~ $i$ : $t$ ] -> $ct$ >> | "?"; i = a_LIDENT; ":"; t = ctyp LEVEL "star"; "->"; ct = SELF -> - <:class_type< [ ? $i$ : $t$ ] -> $ct$ >> + <:class_type< [ ? $i$ : $t$ ] -> $ct$ >> | i = OPTLABEL (* FIXME inline a_OPTLABEL *); t = ctyp LEVEL "star"; "->"; ct = SELF -> <:class_type< [ ? $i$ : $t$ ] -> $ct$ >> | test_ctyp_minusgreater; t = ctyp LEVEL "star"; "->"; ct = SELF -> diff --git a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml index 59cd7b70e..9dab8bd74 100644 --- a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml +++ b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml @@ -328,7 +328,7 @@ Very old (no more supported) syntax:\n\ <:expr< $lid:x$ >>) ; - let list_ok = ["<"; ">"; "<="; ">="; "="; "<>"; "=="; "!="; "$"] in + let list_ok = ["<"; ">"; "<="; ">="; "="; "<>"; "=="; "!="; "$"] in let list_first_char_ok = ['='; '<'; '>'; '|'; '&'; '$'; '!'] in let excl = ["<-"; "||"; "&&"] in Gram.Entry.setup_parser infixop0 @@ -776,7 +776,7 @@ Very old (no more supported) syntax:\n\ [ p = labeled_ipatt; e = SELF -> <:expr< fun $p$ -> $e$ >> | "="; e = expr -> <:expr< $e$ >> - | ":"; t = ctyp; "="; e = expr -> <:expr< ($e$ : $t$) >> + | ":"; t = ctyp; "="; e = expr -> <:expr< ($e$ : $t$) >> | ":>"; t = ctyp; "="; e = expr -> <:expr< ($e$ :> $t$) >> ] ] ; match_case: diff --git a/camlp4/Camlp4Top/Top.ml b/camlp4/Camlp4Top/Top.ml index 4bb92bdc4..dcd3aa460 100644 --- a/camlp4/Camlp4Top/Top.ml +++ b/camlp4/Camlp4Top/Top.ml @@ -88,7 +88,7 @@ value wrap parse_fun = | x -> let x = match x with - [ Loc.Exc_located loc x -> do { + [ Loc.Exc_located loc x -> do { Toploop.print_location Format.err_formatter (Loc.to_ocaml_location loc); x } @@ -103,10 +103,10 @@ value wrap parse_fun = value toplevel_phrase token_stream = match Gram.parse_tokens_after_filter Syntax.top_phrase token_stream with [ Some str_item -> - let str_item = - AstFilters.fold_topphrase_filters (fun t filter -> filter t) str_item - in - Ast2pt.phrase str_item + let str_item = + AstFilters.fold_topphrase_filters (fun t filter -> filter t) str_item + in + Ast2pt.phrase str_item | None -> raise End_of_file ]; diff --git a/camlp4/Camlp4_config.ml b/camlp4/Camlp4_config.ml index 8eb191512..745930b79 100644 --- a/camlp4/Camlp4_config.ml +++ b/camlp4/Camlp4_config.ml @@ -21,7 +21,7 @@ let ocaml_standard_library = Camlp4_import.Config.standard_library;; let camlp4_standard_library = try Sys.getenv "CAMLP4LIB" - with Not_found -> + with Not_found -> Filename.concat ocaml_standard_library "camlp4";; let version = Sys.ocaml_version;; diff --git a/camlp4/Makefile.ml b/camlp4/Makefile.ml index 681f35bd2..eefedf147 100644 --- a/camlp4/Makefile.ml +++ b/camlp4/Makefile.ml @@ -275,8 +275,8 @@ let file ppf f = loop () in try loop () with End_of_file -> () let ext_split f = split '.' f - - + + let print_packed_sources ppf ?(skip = fun _ -> false) package_dir = let _ = fold_units_sources [package_dir] (fun name sources k (skip, inside) -> @@ -356,4 +356,3 @@ let just_doc () = let doc () = pack (); just_doc () - diff --git a/camlp4/examples/expression_closure.ml b/camlp4/examples/expression_closure.ml index 58f15448f..cfc47454d 100644 --- a/camlp4/examples/expression_closure.ml +++ b/camlp4/examples/expression_closure.ml @@ -21,4 +21,3 @@ value f e = value print_expr = (new PP.printer ())#expr; printf "%a@." print_expr (f <>); - diff --git a/camlp4/examples/fancy_lambda_quot_test.ml b/camlp4/examples/fancy_lambda_quot_test.ml index 32009828f..5ff348c9d 100644 --- a/camlp4/examples/fancy_lambda_quot_test.ml +++ b/camlp4/examples/fancy_lambda_quot_test.ml @@ -3,7 +3,7 @@ let _loc = Camlp4.PreCast.Loc.ghost;; let rec propagate = function | << $f$ $x$ $y$ >> -> begin match propagate f, propagate x, propagate y with - | f, << $int:i$ >>, << $int:j$ >> -> + | f, << $int:i$ >>, << $int:j$ >> -> begin match f with | << plus >> -> << $int:i + j$ >> | << minus >> -> << $int:i - j$ >> diff --git a/camlp4/examples/global_handler.ml b/camlp4/examples/global_handler.ml index 758e4f968..e2da52873 100644 --- a/camlp4/examples/global_handler.ml +++ b/camlp4/examples/global_handler.ml @@ -17,4 +17,3 @@ AstFilters.register_str_item_filter begin fun st -> <:str_item@ghost< try let module Main = struct $st$ end in () with e -> $global_handler_ref.val$ e >> end; - diff --git a/camlp4/examples/lambda_test.ml b/camlp4/examples/lambda_test.ml index 408461a52..e2603259a 100644 --- a/camlp4/examples/lambda_test.ml +++ b/camlp4/examples/lambda_test.ml @@ -10,4 +10,3 @@ let rec_nat = let plus = << fun n -> fun m -> $rec_nat$ n (fun n -> fun p -> $succ$ p) m >> let times = << fun n -> fun m -> $rec_nat$ n (fun n -> fun p -> $plus$ m p) $zero$ >> let fact = << fun n -> $rec_nat$ n (fun n -> fun p -> $times$ ($succ$ n) p) $one$ >> - diff --git a/camlp4/man/Makefile b/camlp4/man/Makefile index bf33c7a05..381bdcc53 100644 --- a/camlp4/man/Makefile +++ b/camlp4/man/Makefile @@ -12,9 +12,9 @@ install-local: $(MKDIR) $(MANDIR)/man1 ; \ cp $(TARGET) $(MANDIR)/man1/. ; \ for i in $(ALIASES); do \ - rm -f $(MANDIR)/man1/$$i; \ - echo '.so man1/$(TARGET)' > $(MANDIR)/man1/$$i; \ - done; \ + rm -f $(MANDIR)/man1/$$i; \ + echo '.so man1/$(TARGET)' > $(MANDIR)/man1/$$i; \ + done; \ fi camlp4.1: camlp4.1.tpl diff --git a/camlp4/man/camlp4.help.tpl b/camlp4/man/camlp4.help.tpl deleted file mode 100644 index 8b1378917..000000000 --- a/camlp4/man/camlp4.help.tpl +++ /dev/null @@ -1 +0,0 @@ - diff --git a/config/.cvsignore b/config/.cvsignore index df99fdc71..9fc1c014f 100644 --- a/config/.cvsignore +++ b/config/.cvsignore @@ -2,4 +2,3 @@ m.h s.h Makefile config.sh - diff --git a/config/Makefile-templ b/config/Makefile-templ index 9889767bb..dd65452a9 100644 --- a/config/Makefile-templ +++ b/config/Makefile-templ @@ -31,7 +31,7 @@ MANDIR=/usr/local/man MANEXT=1 ### Do #! scripts work on your system? -### Beware: on some systems (e.g. SunOS 4), this will work only if +### Beware: on some systems (e.g. SunOS 4), this will work only if ### the string "#!$(BINDIR)/ocamlrun" is less than 32 characters long. ### In doubt, set SHARPBANGSCRIPTS to false. SHARPBANGSCRIPTS=true @@ -224,7 +224,7 @@ PARTIALLD=ld -r $(NATIVECCLINKOPTS) # unix Unix system calls # str Regular expressions and high-level string processing # num Arbitrary-precision rational arithmetic -# threads Lightweight concurrent processes +# threads Lightweight concurrent processes # systhreads Same as threads, requires POSIX threads # graph Portable drawing primitives for X11 # dynlink Dynamic linking of bytecode diff --git a/config/Makefile.mingw b/config/Makefile.mingw index e5a743e00..d1e40bb1d 100644 --- a/config/Makefile.mingw +++ b/config/Makefile.mingw @@ -153,5 +153,5 @@ TK_LINK=$(TK_ROOT)/bin/tk85.dll $(TK_ROOT)/bin/tcl85.dll -lws2_32 ############# Aliases for common commands -MAKEREC=$(MAKE) -f Makefile.nt +MAKEREC=$(MAKE) -f Makefile.nt MAKECMD=$(MAKE) diff --git a/config/Makefile.msvc b/config/Makefile.msvc index 67e4ad716..4bbf54451 100644 --- a/config/Makefile.msvc +++ b/config/Makefile.msvc @@ -159,5 +159,5 @@ TK_LINK=tk85.lib tcl85.lib ws2_32.lib ############# Aliases for common commands -MAKEREC=$(MAKE) -f Makefile.nt +MAKEREC=$(MAKE) -f Makefile.nt MAKECMD=$(MAKE) diff --git a/config/Makefile.msvc64 b/config/Makefile.msvc64 index a9f2309b6..5088fc172 100644 --- a/config/Makefile.msvc64 +++ b/config/Makefile.msvc64 @@ -154,5 +154,5 @@ TK_LINK= ############# Aliases for common commands -MAKEREC=$(MAKE) -f Makefile.nt +MAKEREC=$(MAKE) -f Makefile.nt MAKECMD=$(MAKE) diff --git a/config/auto-aux/dblalign.c b/config/auto-aux/dblalign.c index 9b44a774e..c2520381c 100644 --- a/config/auto-aux/dblalign.c +++ b/config/auto-aux/dblalign.c @@ -52,4 +52,3 @@ int main(void) #endif exit(res); } - diff --git a/config/auto-aux/divmod.c b/config/auto-aux/divmod.c index 24d3786ce..8f69dabf3 100644 --- a/config/auto-aux/divmod.c +++ b/config/auto-aux/divmod.c @@ -15,7 +15,7 @@ /* Test semantics of division and modulus for negative arguments */ -long div4[] = +long div4[] = { -4,-3,-3,-3,-3,-2,-2,-2,-2,-1,-1,-1,-1,0,0,0, 0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4 }; diff --git a/config/auto-aux/int64align.c b/config/auto-aux/int64align.c index 5c77b39c5..6bdd25567 100644 --- a/config/auto-aux/int64align.c +++ b/config/auto-aux/int64align.c @@ -53,4 +53,3 @@ int main(void) #endif exit(res); } - diff --git a/config/auto-aux/stackov.c b/config/auto-aux/stackov.c index 7f06e9711..39e4e832b 100644 --- a/config/auto-aux/stackov.c +++ b/config/auto-aux/stackov.c @@ -55,7 +55,7 @@ int main(int argc, char ** argv) #else act.sa_sigaction = segv_handler; act.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_NODEFER; -#endif +#endif sigemptyset(&act.sa_mask); system_stack_top = (char *) &act; if (sigaltstack(&stk, NULL) != 0) { perror("sigaltstack"); return 2; } diff --git a/config/m-nt.h b/config/m-nt.h index d14376815..7a9282811 100644 --- a/config/m-nt.h +++ b/config/m-nt.h @@ -43,4 +43,3 @@ #define ARCH_INT64_PRINTF_FORMAT "I64" #undef NONSTANDARD_DIV_MOD - diff --git a/config/s-templ.h b/config/s-templ.h index 479047841..a65b178a8 100644 --- a/config/s-templ.h +++ b/config/s-templ.h @@ -193,7 +193,7 @@ #define HAS_LOCALE -/* Define HAS_LOCALE if you have the include file and the +/* Define HAS_LOCALE if you have the include file and the setlocale() function. */ #define HAS_MMAP @@ -204,13 +204,13 @@ #define HAS_GETHOSTBYNAME_R 6 /* Define HAS_GETHOSTBYNAME_R if gethostbyname_r() is available. - The value of this symbol is the number of arguments of + The value of this symbol is the number of arguments of gethostbyname_r(): either 5 or 6 depending on prototype. (5 is the Solaris version, 6 is the Linux version). */ #define HAS_GETHOSTBYADDR_R 8 /* Define HAS_GETHOSTBYADDR_R if gethostbyname_r() is available. - The value of this symbol is the number of arguments of + The value of this symbol is the number of arguments of gethostbyaddr_r(): either 7 or 8 depending on prototype. (7 is the Solaris version, 8 is the Linux version). */ diff --git a/debugger/Makefile.nt b/debugger/Makefile.nt index 3630d32e0..70263e94d 100644 --- a/debugger/Makefile.nt +++ b/debugger/Makefile.nt @@ -14,4 +14,3 @@ UNIXDIR=../otherlibs/win32unix include Makefile.shared - diff --git a/debugger/Makefile.shared b/debugger/Makefile.shared index 1e16f32ef..4372cf74c 100644 --- a/debugger/Makefile.shared +++ b/debugger/Makefile.shared @@ -44,7 +44,7 @@ OTHEROBJS=\ OBJS=\ - dynlink.cmo \ + dynlink.cmo \ int64ops.cmo \ primitives.cmo \ unix_tools.cmo \ diff --git a/debugger/breakpoints.ml b/debugger/breakpoints.ml index 9d85aff04..1da4b74e2 100644 --- a/debugger/breakpoints.ml +++ b/debugger/breakpoints.ml @@ -123,7 +123,7 @@ let change_version version pos = (function () -> current_version := version; positions := pos) - + (* Execute given function with no breakpoint in current checkpoint. *) (* --- `goto' runs faster this way (does not stop on each breakpoint). *) let execute_without_breakpoints f = diff --git a/debugger/command_line.ml b/debugger/command_line.ml index 2bdd8afaa..5fdf3da47 100644 --- a/debugger/command_line.ml +++ b/debugger/command_line.ml @@ -77,10 +77,10 @@ let error text = raise Toplevel let check_not_windows feature = - match Sys.os_type with + match Sys.os_type with | "Win32" -> error ("'"^feature^"' feature not supported on Windows") - | _ -> + | _ -> () let eol = @@ -227,7 +227,7 @@ let instr_shell ppf lexbuf = let cmd = String.concat " " cmdarg in (* perhaps we should use $SHELL -c ? *) let err = Sys.command cmd in - if (err != 0) then + if (err != 0) then eprintf "Shell command %S failed with exit code %d\n%!" cmd err let instr_pwd ppf lexbuf = @@ -363,8 +363,8 @@ let print_info_list ppf = let instr_complete ppf lexbuf = let ppf = Format.err_formatter in - let rec print_list l = - try + let rec print_list l = + try eol lexbuf; List.iter (function i -> fprintf ppf "%s@." i) l with _ -> @@ -395,7 +395,7 @@ let instr_complete ppf lexbuf = | [i] -> if i.info_name = ident then [] else [i.info_name] | l -> List.map (fun i -> i.info_name) l end - | None -> + | None -> List.map (fun i -> i.info_name) !info_list end else ["info"] diff --git a/debugger/debugcom.ml b/debugger/debugcom.ml index 307f4258d..5bfbb2bfa 100644 --- a/debugger/debugcom.ml +++ b/debugger/debugcom.ml @@ -183,7 +183,7 @@ exception Marshalling_error module Remote_value = struct type t = Remote of string | Local of Obj.t - + let obj = function | Local obj -> Obj.obj obj | Remote v -> diff --git a/debugger/debugcom.mli b/debugger/debugcom.mli index 447e45d9e..6c7a53446 100644 --- a/debugger/debugcom.mli +++ b/debugger/debugcom.mli @@ -83,7 +83,7 @@ exception Marshalling_error module Remote_value : sig type t - + val obj : t -> 'a val is_block : t -> bool val tag : t -> int diff --git a/debugger/debugger_config.ml b/debugger/debugger_config.ml index ee707abb2..54d6b2d58 100644 --- a/debugger/debugger_config.ml +++ b/debugger/debugger_config.ml @@ -23,7 +23,7 @@ exception Toplevel (*ISO 6429 color sequences 00 to restore default color -01 for brighter colors +01 for brighter colors 04 for underlined text 05 for flashing text 30 for black foreground diff --git a/debugger/debugger_config.mli b/debugger/debugger_config.mli index d3185f083..18faf9c62 100644 --- a/debugger/debugger_config.mli +++ b/debugger/debugger_config.mli @@ -33,4 +33,3 @@ val checkpoint_big_step : int64 ref val checkpoint_small_step : int64 ref val checkpoint_max_count : int ref val make_checkpoints : bool ref - diff --git a/debugger/dynlink.ml b/debugger/dynlink.ml index 7d3e347f5..a8b6efa76 100644 --- a/debugger/dynlink.ml +++ b/debugger/dynlink.ml @@ -212,7 +212,7 @@ let loadfile file_name = let toc_pos = input_binary_int ic in (* Go to table of contents *) seek_in ic toc_pos; let lib = (input_value ic : library) in - begin try + begin try Dll.open_dlls Dll.For_execution (List.map Dll.extract_dll_name lib.lib_dllibs) with Failure reason -> diff --git a/debugger/dynlink.mli b/debugger/dynlink.mli index caee29171..7cca68c5a 100644 --- a/debugger/dynlink.mli +++ b/debugger/dynlink.mli @@ -23,9 +23,9 @@ val is_native: bool val loadfile : string -> unit (** In bytecode: load the given bytecode object file ([.cmo] file) or - bytecode library file ([.cma] file), and link it with the running + bytecode library file ([.cma] file), and link it with the running program. In native code: load the given OCaml plugin file (usually - [.cmxs]), and link it with the running + [.cmxs]), and link it with the running program. All toplevel expressions in the loaded compilation units are evaluated. No facilities are provided to diff --git a/debugger/envaux.ml b/debugger/envaux.ml index 7f74ecbf7..8d462e2f8 100644 --- a/debugger/envaux.ml +++ b/debugger/envaux.ml @@ -60,7 +60,7 @@ let rec env_from_summary sum subst = let env = env_from_summary s subst in let path' = Subst.module_path subst path in let mty = - try + try Env.find_module path' env with Not_found -> raise (Error (Module_not_found path')) diff --git a/debugger/eval.ml b/debugger/eval.ml index abec4291a..7ee1339f0 100644 --- a/debugger/eval.ml +++ b/debugger/eval.ml @@ -197,7 +197,7 @@ let report_error ppf = function "@[Cannot extract item number %i from a value of type@ %a@]@." pos Printtyp.type_expr ty | Wrong_label(ty, lbl) -> - fprintf ppf + fprintf ppf "@[The record type@ %a@ has no label named %s@]@." Printtyp.type_expr ty lbl | Not_a_record ty -> diff --git a/debugger/events.mli b/debugger/events.mli index df928de00..7166f2c9d 100644 --- a/debugger/events.mli +++ b/debugger/events.mli @@ -27,4 +27,3 @@ val current_event : debug_event option ref val get_current_event : unit -> debug_event val current_event_is_before : unit -> bool - diff --git a/debugger/frames.ml b/debugger/frames.ml index 2dcff988d..c533782fc 100644 --- a/debugger/frames.ml +++ b/debugger/frames.ml @@ -75,7 +75,7 @@ let select_frame frame_number = | _ -> set_initial_frame(); selected_event := Some(move_up frame_number curr_event); - current_frame := frame_number + current_frame := frame_number with Not_found -> set_frame initial_sp; raise Not_found diff --git a/debugger/loadprinter.ml b/debugger/loadprinter.ml index 07d7b78ae..ac5aa0187 100644 --- a/debugger/loadprinter.ml +++ b/debugger/loadprinter.ml @@ -120,10 +120,10 @@ let find_printer_type lid = with Ctype.Unify _ -> (match_printer_type desc "printer_type_old", true) in (ty_arg, path, is_old_style) - with + with | Not_found -> raise(Error(Unbound_identifier lid)) | Ctype.Unify _ -> raise(Error(Wrong_type lid)) - + let install_printer ppf lid = let (ty_arg, path, is_old_style) = find_printer_type lid in let v = @@ -167,5 +167,3 @@ let report_error ppf = function | No_active_printer lid -> fprintf ppf "@[%a is not currently active as a printing function.@]@." Printtyp.longident lid - - diff --git a/debugger/main.ml b/debugger/main.ml index 8d430c0ac..f836bf9f0 100644 --- a/debugger/main.ml +++ b/debugger/main.ml @@ -179,9 +179,9 @@ let speclist = [ let main () = try - socket_name := + socket_name := (match Sys.os_type with - "Win32" -> + "Win32" -> (Unix.string_of_inet_addr Unix.inet_addr_loopback)^ ":"^ (string_of_int (10000 + ((Unix.getpid ()) mod 10000))) diff --git a/debugger/parser.mly b/debugger/parser.mly index db365a69e..6fc8392a8 100644 --- a/debugger/parser.mly +++ b/debugger/parser.mly @@ -187,7 +187,7 @@ opt_longident : | { None }; opt_longident_eol : - opt_longident end_of_line { $1 }; + opt_longident end_of_line { $1 }; identifier : LIDENT { $1 } diff --git a/debugger/parser_aux.mli b/debugger/parser_aux.mli index 434c14dbc..a68e08d5c 100644 --- a/debugger/parser_aux.mli +++ b/debugger/parser_aux.mli @@ -31,4 +31,3 @@ type break_arg = | BA_pos1 of Longident.t option * int * int option (* break @ [MODULE] LINE [POS] *) | BA_pos2 of Longident.t option * int (* break @ [MODULE] # OFFSET *) - diff --git a/debugger/pattern_matching.ml b/debugger/pattern_matching.ml index a04dcae5b..97af9326b 100644 --- a/debugger/pattern_matching.ml +++ b/debugger/pattern_matching.ml @@ -150,7 +150,7 @@ and match_concrete_type pattern obj cstr ty ty_list = | Variant_type constr_list -> let tag = value_tag obj in (try - let constr = + let constr = if same_type_constr cstr constr_type_exn then find_exception tag else diff --git a/debugger/printval.ml b/debugger/printval.ml index 0e37bad6b..5f36e1a7c 100644 --- a/debugger/printval.ml +++ b/debugger/printval.ml @@ -106,4 +106,3 @@ let print_named_value max_depth exp env obj ppf ty = print_value_name exp Printtyp.type_expr ty (print_value max_depth env obj) ty - diff --git a/debugger/printval.mli b/debugger/printval.mli index d100a4333..bb6318880 100644 --- a/debugger/printval.mli +++ b/debugger/printval.mli @@ -28,6 +28,6 @@ val reset_named_values : unit -> unit val find_named_value : int -> Debugcom.Remote_value.t * Types.type_expr val install_printer : - Path.t -> Types.type_expr -> formatter -> + Path.t -> Types.type_expr -> formatter -> (formatter -> Obj.t -> unit) -> unit val remove_printer : Path.t -> unit diff --git a/debugger/question.ml b/debugger/question.ml index 8b2d4598b..2eeec3ab0 100644 --- a/debugger/question.ml +++ b/debugger/question.ml @@ -33,4 +33,3 @@ let yes_or_no message = raise x else false - diff --git a/emacs/.cvsignore b/emacs/.cvsignore index e7e261fca..ea6381f91 100644 --- a/emacs/.cvsignore +++ b/emacs/.cvsignore @@ -1,2 +1 @@ ocamltags - diff --git a/emacs/Makefile b/emacs/Makefile index 4f3aa3784..9519b396a 100644 --- a/emacs/Makefile +++ b/emacs/Makefile @@ -30,28 +30,28 @@ SCRIPTDIR = $(BINDIR) # Command for byte-compiling the files COMPILECMD=(progn \ - (setq load-path (cons "." load-path)) \ - (byte-compile-file "caml-xemacs.el") \ + (setq load-path (cons "." load-path)) \ + (byte-compile-file "caml-xemacs.el") \ (byte-compile-file "caml-emacs.el") \ - (byte-compile-file "caml.el") \ - (byte-compile-file "inf-caml.el") \ - (byte-compile-file "caml-help.el") \ - (byte-compile-file "caml-types.el") \ - (byte-compile-file "camldebug.el")) + (byte-compile-file "caml.el") \ + (byte-compile-file "inf-caml.el") \ + (byte-compile-file "caml-help.el") \ + (byte-compile-file "caml-types.el") \ + (byte-compile-file "camldebug.el")) install: @if test "$(EMACSDIR)" = ""; then \ - set xxx `($(EMACS) --batch --eval "(mapcar 'print load-path)") \ - 2>/dev/null | \ - sed -n -e '/\/site-lisp/s/"//gp'`; \ - if test "$$2" = ""; then \ - echo "Cannot determine Emacs site-lisp directory"; \ - exit 2; \ - fi; \ - $(MAKE) EMACSDIR="$$2" simple-install; \ - else \ - $(MAKE) simple-install; \ - fi + set xxx `($(EMACS) --batch --eval "(mapcar 'print load-path)") \ + 2>/dev/null | \ + sed -n -e '/\/site-lisp/s/"//gp'`; \ + if test "$$2" = ""; then \ + echo "Cannot determine Emacs site-lisp directory"; \ + exit 2; \ + fi; \ + $(MAKE) EMACSDIR="$$2" simple-install; \ + else \ + $(MAKE) simple-install; \ + fi # install the .el files, but do not compile them. install-el: diff --git a/emacs/caml-compat.el b/emacs/caml-compat.el index 3a48449b2..8ba7a99c7 100644 --- a/emacs/caml-compat.el +++ b/emacs/caml-compat.el @@ -39,4 +39,3 @@ only if necessary. It leaves point at end of indentation." (defalias 'buffer-substring-no-properties 'buffer-substring))) (provide 'caml-compat) - diff --git a/emacs/caml-font-old.el b/emacs/caml-font-old.el index fe5721376..8faa542f0 100644 --- a/emacs/caml-font-old.el +++ b/emacs/caml-font-old.el @@ -114,7 +114,7 @@ ((fboundp 'global-font-lock-mode) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults - '(caml-font-lock-keywords nil nil ((?' . "w") (?_ . "w"))))) + '(caml-font-lock-keywords nil nil ((?' . "w") (?_ . "w"))))) (t (setq font-lock-keywords caml-font-lock-keywords))) (make-local-variable 'font-lock-keywords-only) diff --git a/emacs/caml-font.el b/emacs/caml-font.el index e796abdcb..f287ffa04 100644 --- a/emacs/caml-font.el +++ b/emacs/caml-font.el @@ -1,6 +1,6 @@ ;; caml-font: font-lock support for OCaml files ;; -;; rewrite and clean-up. +;; rewrite and clean-up. ;; Changes: ;; - fontify strings and comments using syntactic font lock ;; - define a `font-lock-syntactic-face-function' to fontify ocamldoc comments @@ -31,7 +31,7 @@ (unless (facep 'font-lock-preprocessor-face) (defvar font-lock-preprocessor-face - (copy-face 'font-lock-builtin-face + (copy-face 'font-lock-builtin-face 'font-lock-preprocessor-face))) (defconst caml-font-lock-keywords @@ -92,7 +92,7 @@ (defun caml-font-set-font-lock () (setq font-lock-defaults '(caml-font-lock-keywords - nil nil nil nil + nil nil nil nil (font-lock-syntactic-face-function . caml-font-syntactic-face))) (font-lock-mode 1)) (add-hook 'caml-mode-hook 'caml-font-set-font-lock) @@ -106,7 +106,7 @@ (defun inferior-caml-set-font-lock () (setq font-lock-defaults '(inferior-caml-font-lock-keywords - nil nil nil nil + nil nil nil nil (font-lock-syntactic-face-function . caml-font-syntactic-face))) (font-lock-mode 1)) (add-hook 'inferior-caml-mode-hooks 'inferior-caml-set-font-lock) diff --git a/emacs/caml-help.el b/emacs/caml-help.el index 92735acac..e6517185a 100644 --- a/emacs/caml-help.el +++ b/emacs/caml-help.el @@ -27,27 +27,27 @@ ;; - dump some databaes: Info, Lib, ... ;; - accept a search path for local libraries instead of current dir ;; (then distinguish between different modules lying in different -;; directories) +;; directories) ;; - improve the construction for info files. ;; -;; Abstract over +;; Abstract over ;; - the viewing method and the database, so that the documentation for -;; and identifier could be search in +;; and identifier could be search in ;; * info / html / man / mli's sources ;; * viewed in emacs or using an external previewer. ;; ;; Take all identifiers (labels, Constructors, exceptions, etc.) -;; +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (eval-and-compile - (if (and (boundp 'running-xemacs) running-xemacs) + (if (and (boundp 'running-xemacs) running-xemacs) (require 'caml-xemacs) (require 'caml-emacs))) ;; Loading or building databases. -;; +;; ;; variables to be customized @@ -73,7 +73,7 @@ "ocamlc -where"))))) ocaml-lib-path) - + ;; General purpose auxiliary functions @@ -92,17 +92,17 @@ (if (stringp path) (if (file-directory-p path) path nil) (mapconcat '(lambda (d) (if (file-directory-p d) d)) - path " "))) + path " "))) (command (and path-string (concat "find " path-string " '(' " filter " ')' " (if depth (concat " -maxdepth " (int-to-string depth))) - (if split nil " -printf '%\p '") + (if split nil " -printf '%\p '") ))) (files (and command (shell-command-to-string command)))) - (if (and split (stringp files)) (split-string files "\n") files) + (if (and split (stringp files)) (split-string files "\n") files) )) ;; Specialized auxiliary functions @@ -111,7 +111,7 @@ ;; Global table of modules contents of modules loaded lazily. (defvar ocaml-module-alist 'lazy - "A-list of modules with how and where to find help information. + "A-list of modules with how and where to find help information. 'delay means non computed yet") (defun ocaml-add-mli-modules (modules tag &optional path) @@ -209,7 +209,7 @@ alist) )) -;; Local list of visible modules. +;; Local list of visible modules. (defvar ocaml-visible-modules 'lazy "A-list of open modules, local to every file.") @@ -249,8 +249,8 @@ When call interactively, make completion over known modules." (message "%S" (mapcar 'car (ocaml-visible-modules)))) (defun ocaml-close-module (arg) - "*Close module of name ARG when ARG is a string. -When call interactively, make completion over visible modules. + "*Close module of name ARG when ARG is a string. +When call interactively, make completion over visible modules. Otherwise if ARG is true, close all modules and reset to default. " (interactive "P") (if (= (prefix-numeric-value arg) 4) @@ -268,27 +268,27 @@ Otherwise if ARG is true, close all modules and reset to default. " ocaml-visible-modules)) )) (message "%S" (mapcar 'car (ocaml-visible-modules)))) - + ;; Look for identifiers around point (defun ocaml-qualified-identifier (&optional show) - "Search for a qualified identifier (Path. entry) around point. + "Search for a qualified identifier (Path. entry) around point. Entry may be nil. -Currently, the path may only be nil or a single Module. -For paths is of the form Module.Path', it returns Module -and always nil for entry. +Currently, the path may only be nil or a single Module. +For paths is of the form Module.Path', it returns Module +and always nil for entry. -If defined Module and Entry are represented by a region in the buffer, -and are nil otherwise. +If defined Module and Entry are represented by a region in the buffer, +and are nil otherwise. -For debugging purposes, it returns the string Module.entry if called -with an optional non-nil argument. +For debugging purposes, it returns the string Module.entry if called +with an optional non-nil argument. " (save-excursion (let ((module) (entry)) - (if (looking-at "[ \n]") (skip-chars-backward " ")) + (if (looking-at "[ \n]") (skip-chars-backward " ")) (if (re-search-backward "\\([^A-Za-z0-9_.']\\|\\`\\)\\([A-Za-z0-9_']*[.]\\)*[A-Za-z0-9_']*\\=" (- (point) 100) t) @@ -314,7 +314,7 @@ with an optional non-nil argument. (let ((list (or (and module - (list + (list (or (assoc module (ocaml-module-alist)) (error "Unknown module %s" module)))) (ocaml-visible-modules)))) @@ -333,19 +333,19 @@ with an optional non-nil argument. ))) (defun caml-complete (arg) - "Does completion for OCaml identifiers qualified. + "Does completion for OCaml identifiers qualified. -It attemps to recognize an qualified identifier Module . entry +It attemps to recognize an qualified identifier Module . entry around point using function \\[ocaml-qualified-identifier]. If Module is defined, it does completion for identifier in Module. -If Module is undefined, it does completion in visible modules. -Then, if completion fails, it does completion among all modules +If Module is undefined, it does completion in visible modules. +Then, if completion fails, it does completion among all modules where identifier is defined." (interactive "p") (let* ((module-entry (ocaml-qualified-identifier)) (entry) - (module) + (module) (beg) (end) (pattern)) (if (car module-entry) (progn @@ -364,7 +364,7 @@ where identifier is defined." (progn (setq entry (cdr module-entry)) t)) (error "Unknown module %s" module)))) (if (consp (cdr module-entry)) - (progn + (progn (setq beg (cadr module-entry)) (setq end (cddr module-entry))) (if (and module @@ -408,7 +408,7 @@ where identifier is defined." (delete-region (caar module-entry) end) (delete-region beg end)) (insert module "." pattern)))) - + ((not (string-equal pattern completion)) (delete-region beg end) (goto-char beg) @@ -426,10 +426,10 @@ where identifier is defined." (defvar ocaml-info-prefix "ocaml-lib" "Prefix of ocaml info files describing library modules. -Suffix .info will be added to info files. +Suffix .info will be added to info files. Additional suffix .gz may be added if info files are compressed. ") -;; +;; (defun ocaml-hevea-info-add-entries (entries dir name) (let* @@ -470,9 +470,9 @@ Additional suffix .gz may be added if info files are compressed. entries)) (defun ocaml-hevea-info () - "The default way to create an info data base from the value -of \\[Info-default-directory-list] and the base name \\[ocaml-info-name] -of files to look for. + "The default way to create an info data base from the value +of \\[Info-default-directory-list] and the base name \\[ocaml-info-name] +of files to look for. This uses info files produced by HeVeA. " @@ -512,8 +512,8 @@ This uses info files produced by HeVeA. entries)) (defun ocaml-ocamldoc-info () - "The default way to create an info data base from the value -of \\[Info-default-directory-list] and the base name \\[ocaml-info-name] + "The default way to create an info data base from the value +of \\[Info-default-directory-list] and the base name \\[ocaml-info-name] of files to look for. This uses info files produced by ocamldoc." @@ -531,18 +531,18 @@ This uses info files produced by ocamldoc." ;; Continuing (defvar ocaml-info-alist 'ocaml-ocamldoc-info - "A-list binding module names to info entries: + "A-list binding module names to info entries: nil means do not use info. A function to build the list lazily (at the first call). The result of the function call will be assign permanently to this variable for future uses. We provide two default functions \\[ocaml-info-default-function] -(info produced by HeVeA is the default) and \\[ocaml-info-default-function] -(info produced by ocamldoc). +(info produced by HeVeA is the default) and \\[ocaml-info-default-function] +(info produced by ocamldoc). Otherwise, this value should be an alist binding module names to info -entries of the form to \"(entry)section\" be taken by the \\[info] +entries of the form to \"(entry)section\" be taken by the \\[info] command. An entry may be an info module or a complete file name." ) @@ -571,7 +571,7 @@ command. An entry may be an info module or a complete file name." (defun ocaml-buffer-substring (region) (and region (buffer-substring-no-properties (car region) (cdr region)))) -;; Help function. +;; Help function. (defun ocaml-goto-help (&optional module entry same-window) @@ -588,7 +588,7 @@ current buffer using \\[ocaml-qualified-identifier]." (or (assoc module (ocaml-module-alist)) (and (file-exists-p (concat (ocaml-uncapitalize module) ".mli")) - (ocaml-get-or-make-module module)))) + (ocaml-get-or-make-module module)))) (location (cdr (cadr module-info)))) (cond (location @@ -630,27 +630,28 @@ current buffer using \\[ocaml-qualified-identifier]." )) (defun caml-help (arg) - "Find documentation for OCaml qualified identifiers. + "Find documentation for OCaml qualified identifiers. It attemps to recognize an qualified identifier of the form ``Module . entry'' around point using function `ocaml-qualified-identifier'. If Module is undetermined it is temptatively guessed from the identifier name -and according to visible modules. If this is still unsucessful, the user is -then prompted for a Module name. +and according to visible modules. If this is still unsucessful, the user is +then prompted for a Module name. The documentation for Module is first seach in the info manual if available, -then in the ``module.mli'' source file. The entry is then searched in the documentation. +then in the ``module.mli'' source file. The entry is then searched in the +documentation. -Visible modules are computed only once, at the first call. +Visible modules are computed only once, at the first call. Modules can be made visible explicitly with `ocaml-open-module' and -hidden with `ocaml-close-module'. +hidden with `ocaml-close-module'. Prefix arg 0 forces recompilation of visible modules (and their content) -from the file content. +from the file content. Prefix arg 4 prompts for Module and identifier instead of guessing values -from the possition of point in the current buffer. +from the possition of point in the current buffer. " (interactive "p") (let ((module) (entry) (module-entry)) @@ -709,7 +710,7 @@ from the possition of point in the current buffer. (defvar ocaml-links nil "Local links in the current of last info node or interface file. -The car of the list is a key that indentifies the module to prevent +The car of the list is a key that indentifies the module to prevent recompilation when next help command is relative to the same module. The cdr is a list of elments, each of which is an string and a pair of buffer positions." @@ -717,7 +718,7 @@ buffer positions." (make-variable-buffer-local 'ocaml-links) (defun ocaml-info-links (section) - (cdr + (cdr (if (and ocaml-links section (equal (car ocaml-links) section)) ocaml-links (save-excursion @@ -793,19 +794,19 @@ buffer positions." (put-text-property (match-beginning 1) (match-end 1) 'face 'ocaml-link-face))) ) - ;; need to restore flag if buffer was unmodified. + ;; need to restore flag if buffer was unmodified. (unless modified-p (set-buffer-modified-p nil)) )) )))) - + ;; bindings ---now in caml.el ; (and ; (boundp 'caml-mode-map) ; (keymapp caml-mode-map) -; (progn +; (progn ; (define-key caml-mode-map [?\C-c?i] 'ocaml-add-path) ; (define-key caml-mode-map [?\C-c?]] 'ocaml-close-module) ; (define-key caml-mode-map [?\C-c?[] 'ocaml-open-module) @@ -822,7 +823,7 @@ buffer positions." ; (define-key map [open] '("Open module for help" . ocaml-open-module)) ; (define-key map [help] '("Help for identifier" . caml-help)) ; (define-key map [complete] '("Complete identifier" . caml-complete)) -; ) +; ) ; )))) diff --git a/emacs/inf-caml.el b/emacs/inf-caml.el index a213ee4f5..f2291f90f 100644 --- a/emacs/inf-caml.el +++ b/emacs/inf-caml.el @@ -80,7 +80,7 @@ be sent from another buffer in Caml mode. (defconst inferior-caml-buffer-name (concat "*" inferior-caml-buffer-subname "*")) -;; for compatibility with xemacs +;; for compatibility with xemacs (defun caml-sit-for (second &optional mili redisplay) (if (and (boundp 'running-xemacs) running-xemacs) @@ -170,7 +170,7 @@ Input and output via buffer `*inferior-caml*'." ) ) -;; patched by Didier to move cursor after evaluation +;; patched by Didier to move cursor after evaluation (defun inferior-caml-eval-region (start end) "Send the current region to the inferior Caml process." @@ -231,15 +231,15 @@ output can be retreived later, asynchronously.") (defun inferior-caml-eval-phrase (arg &optional min max) "Send the phrase containing the point to the CAML process. -With prefix-arg send as many phrases as its numeric value, +With prefix-arg send as many phrases as its numeric value, If an error occurs during evalutaion, stop at this phrase and -repport the error. +repport the error. Return nil if noerror and position of error if any. If arg's numeric value is zero or negative, evaluate the current phrase -or as many as prefix arg, ignoring evaluation errors. -This allows to jump other erroneous phrases. +or as many as prefix arg, ignoring evaluation errors. +This allows to jump other erroneous phrases. Optional arguments min max defines a region within which the phrase should lies." @@ -327,12 +327,12 @@ should lies." (progn (move-overlay caml-error-overlay beg end (current-buffer)) (beep) (if wait (read-event) (caml-sit-for 60))) - (delete-overlay caml-error-overlay))))) + (delete-overlay caml-error-overlay))))) ;; wait some amount for ouput, that is, until inferior-caml-output is set ;; to true. Hence, interleaves sitting for shorts delays and checking the -;; flag. Give up after some time. Typing into the source buffer will cancel -;; waiting, i.e. may report 'No result yet' +;; flag. Give up after some time. Typing into the source buffer will cancel +;; waiting, i.e. may report 'No result yet' (defun caml-wait-output (&optional before after) (let ((c 1)) @@ -351,11 +351,11 @@ should lies." caml-previous-output (- pos 2)))) ;; additional bindings - + ;(let ((map (lookup-key caml-mode-map [menu-bar caml]))) ; (define-key map [indent-buffer] '("Indent buffer" . caml-indent-buffer)) ; (define-key map [eval-buffer] '("Eval buffer" . caml-eval-buffer)) -;) +;) ;(define-key caml-mode-map "\C-c\C-b" 'caml-eval-buffer) diff --git a/lex/compact.ml b/lex/compact.ml index 9475ab6e5..abbf5a503 100644 --- a/lex/compact.ml +++ b/lex/compact.ml @@ -169,7 +169,7 @@ type lex_tables = tbl_backtrk_code : int array; (* nothing / code when Remember *) (* moves to execute before transitions (compacted) *) tbl_default_code : int array; - tbl_trans_code : int array; + tbl_trans_code : int array; tbl_check_code : int array; (* byte code itself *) tbl_code: int array;} @@ -200,7 +200,7 @@ let compact_tables state_v = base_code.(i) <- b_moves; default_code.(i) <- d_moves ; done; let code = Table.trim code in - let tables = + let tables = if Array.length code > 1 then { tbl_base = base; tbl_backtrk = backtrk; @@ -229,6 +229,3 @@ let compact_tables state_v = reset_compact trans ; reset_compact moves ; tables - - - diff --git a/lex/compact.mli b/lex/compact.mli index e52dc7d2c..18363c3d4 100644 --- a/lex/compact.mli +++ b/lex/compact.mli @@ -24,7 +24,7 @@ type lex_tables = tbl_backtrk_code : int array; (* nothing / code when Remember *) (* moves to execute before transitions (compacted) *) tbl_default_code : int array; - tbl_trans_code : int array; + tbl_trans_code : int array; tbl_check_code : int array; (* byte code itself *) tbl_code: int array;} diff --git a/lex/cset.ml b/lex/cset.ml index ec68ee1c8..c4594540e 100644 --- a/lex/cset.ml +++ b/lex/cset.ml @@ -95,5 +95,3 @@ let env_to_array env = match env with c) rem ; res - - diff --git a/lex/cset.mli b/lex/cset.mli index fc2c9930c..3160cc908 100644 --- a/lex/cset.mli +++ b/lex/cset.mli @@ -15,7 +15,7 @@ (* Set of characters encoded as list of intervals *) -type t +type t exception Bad val empty : t @@ -32,6 +32,3 @@ val inter : t -> t -> t val diff : t -> t -> t val complement : t -> t val env_to_array : (t * 'a) list -> 'a array - - - diff --git a/lex/lexgen.ml b/lex/lexgen.ml index 1a12f0d49..775e78b05 100644 --- a/lex/lexgen.ml +++ b/lex/lexgen.ml @@ -37,7 +37,7 @@ type regexp = | Star of regexp type tag_base = Start | End | Mem of int -type tag_addr = Sum of (tag_base * int) +type tag_addr = Sum of (tag_base * int) type ident_info = | Ident_string of bool * tag_addr * tag_addr | Ident_char of bool * tag_addr @@ -298,7 +298,7 @@ let rec encode_regexp char_vars act = function (* Optimisation, Static optimization : Replace tags by offsets relative to the beginning - or end of matched string. + or end of matched string. Dynamic optimization: Replace some non-optional, non-double tags by offsets w.r.t a previous similar tag. @@ -448,7 +448,7 @@ let opt_regexp all_vars char_vars optional_vars double_vars r = let a = get_tag_addr (n.id,n.start) in r,Some a end - + | Empty -> r,pos | Chars (_,is_eof) -> r,(if is_eof then pos else add_pos pos 1) | Seq (r1,r2) -> @@ -465,10 +465,10 @@ let opt_regexp all_vars char_vars optional_vars double_vars r = | Action _ -> assert false in let r,_ = alloc_exp None r in - let m = + let m = IdSet.fold (fun ((name,_) as x) r -> - + let v = if IdSet.mem x char_vars then Ident_char @@ -482,8 +482,8 @@ let opt_regexp all_vars char_vars optional_vars double_vars r = all_vars [] in m,r, !loc_count - - + + let encode_casedef casedef = let r = List.fold_left @@ -520,7 +520,7 @@ let encode_lexdef def = (chr, entry_list) (* To generate directly a NFA from a regular expression. - Confer Aho-Sethi-Ullman, dragon book, chap. 3 + Confer Aho-Sethi-Ullman, dragon book, chap. 3 Extension to tagged automata. Confer Ville Larikari @@ -533,7 +533,7 @@ let encode_lexdef def = *) type t_transition = - OnChars of int + OnChars of int | ToAction of int type transition = t_transition * Tags.t @@ -608,7 +608,7 @@ let followpos size entry_list = fill (TransSet.union (firstpos r) s) r in List.iter (fun (entry,_,_) -> fill TransSet.empty entry.lex_regexp) entry_list ; v - + (************************) (* The algorithm itself *) (************************) @@ -654,7 +654,7 @@ let dstate {final=(act,(_,m)) ; others=o} = (fun () -> prerr_endline "") o - + let dfa_state_empty = {final=(no_action, (max_int,TagMap.empty)) ; others=MemMap.empty} @@ -663,7 +663,7 @@ and dfa_state_is_empty {final=(act,_) ; others=o} = act = no_action && o = MemMap.empty - + (* A key is an abstraction on a dfa state, two states with the same key can be made the same by copying some memory cells into others *) @@ -688,14 +688,14 @@ type dfa_key = {kstate : StateSet.t ; kmem : MemKey.t} (* Map a state to its key *) let env_to_class m = - let env1 = + let env1 = MemMap.fold (fun _ (tag,s) r -> try let ss = TagMap.find tag r in let r = TagMap.remove tag r in TagMap.add tag (StateSetSet.add s ss) r - with + with | Not_found -> TagMap.add tag (StateSetSet.add s StateSetSet.empty) r) m TagMap.empty in @@ -739,23 +739,23 @@ let key_compare k1 k2 = match StateSet.compare k1.kstate k2.kstate with | r -> r (* Association dfa_state -> state_num *) - + module StateMap = Map.Make(struct type t = dfa_key let compare = key_compare end) let state_map = ref (StateMap.empty : int StateMap.t) -let todo = Stack.create() +let todo = Stack.create() let next_state_num = ref 0 let next_mem_cell = ref 0 let temp_pending = ref false -let tag_cells = Hashtbl.create 17 +let tag_cells = Hashtbl.create 17 let state_table = Table.create dfa_state_empty (* Initial reset of state *) let reset_state () = Stack.clear todo; - next_state_num := 0 ; + next_state_num := 0 ; let _ = Table.trim state_table in () @@ -878,14 +878,14 @@ let get_map t st = match t with m let dest = function | Copy (d,_) | Set d -> d -and orig = function | Copy (_,o) -> o | Set _ -> -1 +and orig = function | Copy (_,o) -> o | Set _ -> -1 let pmv oc mv = fprintf oc "%d <- %d" (dest mv) (orig mv) let pmvs oc mvs = List.iter (fun mv -> fprintf oc "%a " pmv mv) mvs ; output_char oc '\n' ; flush oc - + (* Topological sort << a la louche >> *) let sort_mvs mvs = let rec do_rec r mvs = match mvs with @@ -917,7 +917,7 @@ let sort_mvs mvs = end | _ -> do_rec (here@r) rem in do_rec [] mvs - + let move_to mem_key src tgt = let mvs = MemKey.fold @@ -943,7 +943,7 @@ let move_to mem_key src tgt = sort_mvs mvs -let get_state st = +let get_state st = let key = get_key st in try let num = StateMap.find key !state_map in @@ -992,7 +992,7 @@ let add_tags_to_map gen tags m = let apply_transition gen r pri m = function | ToAction n,tags -> let on,(opri,_) = r.final in - if n < on || (on=n && pri < opri) then + if n < on || (on=n && pri < opri) then let m = add_tags_to_map gen tags m in {r with final=n,(pri,m)} else r @@ -1000,7 +1000,7 @@ let apply_transition gen r pri m = function try let (opri,_) = MemMap.find n r.others in if pri < opri then - let m = add_tags_to_map gen tags m in + let m = add_tags_to_map gen tags m in {r with others=MemMap.add n (pri,m) (MemMap.remove n r.others)} else r @@ -1018,7 +1018,7 @@ let apply_transitions gen r pri m ts = ts r -(* For a given nfa_state pos, refine char partition *) +(* For a given nfa_state pos, refine char partition *) let rec split_env gen follow pos m s = function | [] -> (* Can occur ! because of non-matching regexp ([^'\000'-'\255']) *) [] @@ -1033,20 +1033,20 @@ let rec split_env gen follow pos m s = function rem else split_env gen follow pos m rest rem - and new_st = apply_transitions gen st1 pos m follow in + and new_st = apply_transitions gen st1 pos m follow in let stay = Cset.diff s1 here in if Cset.is_empty stay then (here, new_st)::rem else (stay, st1)::(here, new_st)::rem - + (* For all nfa_state pos in a dfa state st *) let comp_shift gen chars follow st = MemMap.fold (fun pos (_,m) env -> split_env gen follow.(pos) pos m chars.(pos) env) st [Cset.all_chars_eof,dfa_state_empty] - + let reachs chars follow st = let gen = create_new_addr_gen () in @@ -1058,7 +1058,7 @@ let reachs chars follow st = (fun (s,dfa_state) -> s,goto_state dfa_state) env in (* finally build the char indexed array -> new state num *) let shift = Cset.env_to_array env in - shift + shift let get_tag_mem n env t = @@ -1082,8 +1082,8 @@ let do_tag_actions n env m = used,r) env.(n) (used,r) in r - - + + let translate_state shortest_match tags chars follow st = let (n,(_,m)) = st.final in if MemMap.empty = st.others then @@ -1106,7 +1106,7 @@ let dtags chan tags = Tags.iter (fun t -> fprintf chan " %a" dtag t) tags - + let dtransset s = TransSet.iter (fun trans -> match trans with @@ -1169,7 +1169,7 @@ let make_dfa lexdef = map_on_all_states (translate_state shortest tags chars follow) !r_states ; { auto_name = le.lex_name; - auto_args = args ; + auto_args = args ; auto_mem_size = (if !temp_pending then !next_mem_cell+1 else !next_mem_cell) ; auto_initial_state = init_num ; diff --git a/lex/lexgen.mli b/lex/lexgen.mli index 5c9c1bc75..5136f8f28 100644 --- a/lex/lexgen.mli +++ b/lex/lexgen.mli @@ -14,7 +14,7 @@ (* raised when there are too many bindings (>= 254 memory cells) *) -exception Memory_overflow +exception Memory_overflow (* Representation of automata *) @@ -39,7 +39,7 @@ type ident = string * Syntax.location (* Representation of entry points *) type tag_base = Start | End | Mem of int -type tag_addr = Sum of (tag_base * int) +type tag_addr = Sum of (tag_base * int) type ident_info = | Ident_string of bool * tag_addr * tag_addr | Ident_char of bool * tag_addr @@ -58,4 +58,3 @@ type ('args,'action) automata_entry = val make_dfa : ('args, 'action) Syntax.entry list -> ('args, 'action) automata_entry list * automata array - diff --git a/lex/main.ml b/lex/main.ml index 280537ca1..5540c9728 100644 --- a/lex/main.ml +++ b/lex/main.ml @@ -36,7 +36,7 @@ let specs = "-q", Arg.Set Common.quiet_mode, " Do not display informational messages"; "-v", Arg.Unit print_version_string, " Print version and exit"; "-version", Arg.Unit print_version_string, " Print version and exit"; - ] + ] let _ = Arg.parse @@ -44,11 +44,11 @@ let _ = (fun name -> source_name := Some name) usage - + let main () = let source_name = match !source_name with - | None -> Arg.usage specs usage ; exit 2 + | None -> Arg.usage specs usage ; exit 2 | Some name -> name in let dest_name = match !output_name with | Some name -> name @@ -105,7 +105,7 @@ let main () = | Lexgen.Memory_overflow -> Printf.fprintf stderr "File \"%s\":\n Position memory overflow, too many bindings\n" - source_name + source_name | Output.Table_overflow -> Printf.fprintf stderr "File \"%s\":\ntransition table overflow, automaton is too big\n" @@ -116,4 +116,3 @@ let main () = exit 3 let _ = (* Printexc.catch *) main (); exit 0 - diff --git a/lex/table.mli b/lex/table.mli index e5d55f965..b88d7d345 100644 --- a/lex/table.mli +++ b/lex/table.mli @@ -13,7 +13,7 @@ (* Table used for code emission, ie extensible arrays *) type 'a t -val create : 'a -> 'a t +val create : 'a -> 'a t val emit : 'a t -> 'a -> unit @@ -29,5 +29,3 @@ val get : 'a t -> int -> 'a val size : 'a t -> int - - diff --git a/man/ocaml.help b/man/ocaml.help deleted file mode 100644 index 466896dcc..000000000 --- a/man/ocaml.help +++ /dev/null @@ -1,138 +0,0 @@ -- -OCaml # Objective Caml toplevel -Usage: ocaml -options are: - -I Add to the list of include directories - -unsafe No bound checking on array and string access - -drawlambda (undocumented) - -dlambda (undocumented) - -dinstr (undocumented) - -rectypes (undocumented) - -- -OCamlc # Objective Caml compiler -Usage: ocamlc -Options are: - -a Build a library - -c Compile only (do not link) - -cc Use as the C compiler and linker - -cclib Pass option to the C linker - -ccopt Pass option to the C compiler and linker - -g Save debugging information - -i Print the types - -I Add to the list of include directories - -impl Compile as a .ml file - -intf Compile as a .mli file - -intf-suffix Suffix for interface file (default: .mli) - -intf_suffix (deprecated) same as -intf-suffix - -linkall Link all modules, even unused ones - -make-runtime Build a runtime system with given C objects and libraries - -make_runtime (deprecated) same as -make-runtime - -noassert Do not compile assertion checks - -o Set output file name to - -output-obj Output a C object file instead of an executable - -pp Pipe sources through preprocessor - -thread Use thread-safe standard library - -unsafe No bounds checking on array and string access - -use-runtime Generate bytecode for the given runtime system - -use_runtime (deprecated) same as -use-runtime - -v Print compiler version number - -verbose Print calls to external commands - -w Enable or disable warnings according to : - A/a enable/disable all warnings - C/c enable/disable suspicious comment - F/f enable/disable partially applied function - M/m enable/disable overriden method - P/p enable/disable partial match - S/s enable/disable non-unit statement - U/u enable/disable unused match case - V/v enable/disable hidden instance variable - X/x enable/disable all other warnings - default setting is A (all warnings enabled) - -nopervasives (undocumented) - -dparsetree (undocumented) - -drawlambda (undocumented) - -dlambda (undocumented) - -dinstr (undocumented) - -use-prims (undocumented) - -rectypes (undocumented) - - Treat as a file name (even if it starts with `-') - -- -OCamlc-custom # Objective Caml compiler for custom runtime mode -Usage: ocamlc-custom -Options are: - -a Build a library - -c Compile only (do not link) - -cc Use as the C compiler and linker - -cclib Pass option to the C linker - -ccopt Pass option to the C compiler and linker - -g Save debugging information - -i Print the types - -I Add to the list of include directories - -impl Compile as a .ml file - -intf Compile as a .mli file - -intf-suffix Suffix for interface file (default: .mli) - -intf_suffix (deprecated) same as -intf-suffix - -linkall Link all modules, even unused ones - -make-runtime Build a runtime system with given C objects and libraries - -make_runtime (deprecated) same as -make-runtime - -noassert Do not compile assertion checks - -o Set output file name to - -output-obj Output a C object file instead of an executable - -pp Pipe sources through preprocessor - -thread Use thread-safe standard library - -unsafe No bounds checking on array and string access - -use-runtime Generate bytecode for the given runtime system - -use_runtime (deprecated) same as -use-runtime - -v Print compiler version number - -verbose Print calls to external commands - -w Enable or disable warnings according to : - A/a enable/disable all warnings - C/c enable/disable suspicious comment - F/f enable/disable partially applied function - M/m enable/disable overriden method - P/p enable/disable partial match - S/s enable/disable non-unit statement - U/u enable/disable unused match case - V/v enable/disable hidden instance variable - X/x enable/disable all other warnings - default setting is A (all warnings enabled) - -nopervasives (undocumented) - -dparsetree (undocumented) - -drawlambda (undocumented) - -dlambda (undocumented) - -dinstr (undocumented) - -use-prims (undocumented) - -rectypes (undocumented) - - Treat as a file name (even if it starts with `-') - -- -OCamlDep # Objective Caml dependency generator -Usage: ocamldep [-I ] - -I Add to the list of include directories - -- -OCamlLex # Objective Caml lexer generator -OCamlLex name.mll - -- -OCamlRun # Objective Caml bytecode interpreter -OCamlRun [-v] file [argumentsÉ] - -v # print GC messages - -Environment variable: -Set -e OCamlRunParam "