summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changes140
-rw-r--r--INSTALL3
-rw-r--r--Makefile10
-rw-r--r--README.win3268
-rw-r--r--VERSION2
-rw-r--r--asmcomp/emitaux.ml72
-rw-r--r--asmcomp/power/arch.ml2
-rw-r--r--asmrun/.depend99
-rw-r--r--boot/.ignore2
-rw-r--r--byterun/.depend63
-rw-r--r--byterun/.ignore2
-rw-r--r--byterun/Makefile2
-rw-r--r--byterun/compact.c12
-rw-r--r--byterun/freelist.c4
-rw-r--r--byterun/gc_ctrl.c20
-rw-r--r--byterun/io.c2
-rw-r--r--camlp4/boot/.ignore1
-rw-r--r--config/auto-aux/cfi.S9
-rwxr-xr-xconfigure7
-rw-r--r--debugger/.ignore1
-rw-r--r--driver/pparse.ml2
-rw-r--r--lex/.depend68
-rw-r--r--man/Makefile1
-rw-r--r--man/ocamlcp.m72
-rw-r--r--man/ocamlopt.m2
-rw-r--r--ocamldoc/.depend287
-rw-r--r--ocamldoc/Makefile17
-rw-r--r--ocamldoc/odoc_analyse.ml2
-rw-r--r--ocamldoc/odoc_args.ml92
-rw-r--r--ocamldoc/odoc_args.mli24
-rw-r--r--ocamldoc/odoc_ast.ml316
-rw-r--r--ocamldoc/odoc_class.ml2
-rw-r--r--ocamldoc/odoc_comments.ml2
-rw-r--r--ocamldoc/odoc_cross.ml31
-rw-r--r--ocamldoc/odoc_gen.ml15
-rw-r--r--ocamldoc/odoc_gen.mli11
-rw-r--r--ocamldoc/odoc_html.ml143
-rw-r--r--ocamldoc/odoc_info.ml8
-rw-r--r--ocamldoc/odoc_info.mli12
-rw-r--r--ocamldoc/odoc_latex.ml41
-rw-r--r--ocamldoc/odoc_man.ml8
-rw-r--r--ocamldoc/odoc_merge.mli2
-rw-r--r--ocamldoc/odoc_messages.ml13
-rw-r--r--ocamldoc/odoc_misc.ml2
-rw-r--r--ocamldoc/odoc_name.ml6
-rw-r--r--ocamldoc/odoc_name.mli3
-rw-r--r--ocamldoc/odoc_scan.ml17
-rw-r--r--ocamldoc/odoc_search.ml71
-rw-r--r--ocamldoc/odoc_search.mli20
-rw-r--r--ocamldoc/odoc_sig.ml95
-rw-r--r--ocamldoc/odoc_sig.mli2
-rw-r--r--ocamldoc/odoc_test.ml13
-rw-r--r--ocamldoc/odoc_text.ml2
-rw-r--r--ocamldoc/odoc_text_lexer.mll39
-rw-r--r--ocamldoc/odoc_text_parser.mly4
-rw-r--r--ocamldoc/odoc_types.ml6
-rw-r--r--ocamldoc/odoc_types.mli6
-rw-r--r--otherlibs/bigarray/.depend8
-rw-r--r--otherlibs/bigarray/bigarray.mli6
-rw-r--r--otherlibs/bigarray/mmap_unix.c4
-rw-r--r--otherlibs/labltk/support/cltkFile.c4
-rw-r--r--otherlibs/num/.depend46
-rw-r--r--otherlibs/str/.depend6
-rw-r--r--otherlibs/systhreads/.depend30
-rw-r--r--otherlibs/threads/.depend45
-rw-r--r--otherlibs/threads/event.mli4
-rw-r--r--otherlibs/win32unix/accept.c15
-rw-r--r--otherlibs/win32unix/socket.c15
-rw-r--r--stdlib/scanf.mli2
-rw-r--r--tools/Makefile.shared21
-rwxr-xr-xtools/make-package-macosx8
-rwxr-xr-xtools/make-version-header.sh43
-rw-r--r--tools/ocamlcp.ml3
-rw-r--r--tools/ocamldep.ml45
-rw-r--r--tools/ocamloptp.ml158
-rwxr-xr-xtools/setignore1
-rw-r--r--utils/warnings.ml4
-rw-r--r--yacc/.ignore1
78 files changed, 1679 insertions, 768 deletions
diff --git a/Changes b/Changes
index 1ee74857e..45b6f77f7 100644
--- a/Changes
+++ b/Changes
@@ -39,6 +39,11 @@ Compilers:
* Warning 28 is now enabled by default.
- New option -absname to use absolute paths in error messages
- Optimize away compile-time beta-redexes, e.g. (fun x y -> e) a b.
+- Added option -bin-annot to dump the AST with type annotations.
+- Added lots of new warnings about unused variables, opens, fields,
+ constructors, etc.
+* New meaning for warning 7: it is now triggered when a method is overridden
+ with the "method" keyword. Use "method!" to avoid the warning.
Native-code compiler:
- Optimized handling of partially-applied functions (PR#5287)
@@ -50,10 +55,23 @@ Native-code compiler:
savings of 28%.
. Added support for position-independent code, natdynlink, profiling and
exception backtraces.
-- In -g mode, generation of CFI information and a few filename/line
- number debugging annotations, enabling in particular precise stack
- backtraces with the gdb debugger. Currently supported for x86 32-bits
- and 64-bits only. (PR#5487)
+- Generation of CFI information, and filename/line number debugging (with -g)
+ annotations, enabling in particular precise stack backtraces with
+ the gdb debugger. Currently supported for x86 32-bits and 64-bits only.
+ (PR#5487)
+- New tool: ocamloptp, the equivalent of ocamlcp for the native-code compiler.
+
+OCamldoc:
+- PR#5645: ocamldoc doesn't handle module/type substitution in signatures
+- PR#5544: improve HTML output (less formatting in html code)
+- PR#5522: allow refering to record fields and variant constructors
+- fix PR#5419 (error message in french)
+- fix PR#5535 (no cross ref to class after dump+load)
+* Use first class modules for custom generators, to be able to
+ load various plugins incrementally adding features to the current
+ generator
+* PR#5507: Use Location.t structures for locations.
+- fix: do not keep code when not told to keep code.
Standard library:
- Added float functions "hypot" and "copysign" (PR#3806, PR#4752, PR#5246)
@@ -70,13 +88,14 @@ Standard library:
to turn randomization on by default (PR#5572, CVE-2012-0839)
. Added new functorial interface "MakeSeeded" to support randomization
with user-provided seeded hash functions.
+ . Install new header <caml/hash.h> for C code.
- Filename: on-demand (lazy) initialization of the PRNG used by "temp_file".
- Marshal: marshalling of function values (flag Marshal.Closures) now
also works for functions that come from dynamically-loaded modules (PR#5215)
- Random:
. More random initialization (Random.self_init()), using /dev/urandom
when available (e.g. Linux, FreeBSD, MacOS X, Solaris)
- . Faster implementation of Random.float
+ * Faster implementation of Random.float (changes the generated sequences)
- Format strings for formatted input/output revised to correct PR#5380
. Consistently treat %@ as a plain @ character
. Consistently treat %% as a plain % character
@@ -85,10 +104,29 @@ Standard library:
- Set and Map: more efficient implementation of "filter" and "partition"
- String: new function "map" (PR#3888)
+Installation procedure:
+- Compiler internals are now installed in `ocamlc -where`/compiler-libs.
+ The files available there include the .cmi interfaces for all compiler
+ modules, plus the following libraries:
+ ocamlcommon.cma/.cmxa modules common to ocamlc, ocamlopt, ocaml
+ ocamlbytecomp.cma/.cmxa modules for ocamlc and ocaml
+ ocamloptcomp.cma/.cmxa modules specific to ocamlopt
+ ocamltoplevel.cma modules specific to ocaml
+ (PR#1804, PR#4653, frequently-asked feature).
+* Some .cmi for toplevel internals that used to be installed in
+ `ocamlc -where` are now to be found in `ocamlc -where`/compiler-libs.
+ Add "-I +compiler-libs" where needed.
+* toplevellib.cma is no longer installed because subsumed by
+ ocamlcommon.cma ocamlbytecomp.cma ocamltoplevel.cma
+- Added a configuration option (-with-debug-runtime) to compile and install
+ a debug version of the runtime system, and a compiler option
+ (-runtime-variant) to select the debug runtime.
+
Bug Fixes:
- PR#1643: functions of the Lazy module whose named started with 'lazy_' have
been deprecated, and new ones without the prefix added
- PR#3571: in Bigarrays, call msync() before unmapping to commit changes
+- PR#4292: various documentation problems
- PR#4511, PR#4838: local modules remove polymorphism
* PR#4549: Filename.dirname is not handling multiple / on Unix
- PR#4688: (Windows) special floating-point values aren't converted to strings
@@ -108,20 +146,30 @@ Bug Fixes:
otherwise. This reduces (but does not eliminate) the risk of
segmentation faults due to stack overflow in C code
- PR#5073: wrong location for 'Unbound record field label' error
+- PR#5084: sub-sub-module building fails for native code compilation
+- PR#5120: fix the output function of Camlp4.Debug.formatter
- PR#5131: compilation of custom runtime with g++ generates lots of warnings
- PR#5137: caml-types-explore does not work
+- PR#5159: better documentation of type Lexing.position
+- PR#5171: Map.join does more comparisons than needed
+- PR#5176: emacs mode: stack overflow in regexp matcher
+- PR#5179: port OCaml to mingw-w64
- PR#5211: updated Genlex documentation to state that camlp4 is mandatory for
'parser' keyword and associated notation
+- PR#5214: ocamlfind plugin invokes 'cut' utility
- PR#5218: use $(MAKE) instead of "make" in Makefiles
- PR#5224: confusing error message in non-regular type definition
+- PR#5231: camlp4: fix parsing of <:str_item< type t = $x$ >>
- PR#5233: finaliser on weak array gives dangling pointers (crash)
- PR#5238, PR#5277: Sys_error when getting error location
- PR#5261, PR#5497: Ocaml source-code examples are not "copy-paste-able"
* PR#5279: executable name is not initialized properly in caml_startup_code
+- PR#5290: added hash functions for channels, nats, mutexes, conditions
- PR#5291: undetected loop in class initialization
- PR#5295: OS threads: problem with caml_c_thread_unregister()
- PR#5301: camlp4r and exception equal to another one with parameters
- PR#5305: prevent ocamlbuild from complaining about links to _build/
+- PR#5306: comparing to Thread.self() raises exception at runtime
- PR#5309: Queue.add is not thread/signal safe
- PR#5310: Ratio.create_ratio/create_normalized_ratio have misleading names
- PR#5311: better message for warning 23
@@ -131,6 +179,7 @@ Bug Fixes:
- PR#5214: ocamlfind plugin invokes 'cut' utility
- PR#5316: objinfo now shows ccopts/ccobjs/force_link when applicable
- PR#5318: segfault on stack overflow when reading marshaled data
+- PR#5319: %r11 clobbered by Lswitch in Windows AMD64 native-code compilation
- PR#5322: type abbreviations expanding to a universal type variable
- PR#5325: (Windows) blocked Unix.recv in one thread blocks Unix.send in
another thread
@@ -138,22 +187,40 @@ Bug Fixes:
- PR#5330: thread tag with '.top' and '.inferred.mli' targets
- PR#5331: ocamlmktop is not always a shell script
- PR#5335: Unix.environment segfaults after a call to clearenv
+- PR#5338: sanitize.sh has windows style end-of-lines (mingw)
- PR#5343: ocaml -rectypes is unsound wrt module subtyping
- PR#5344: some predefined exceptions need special printing
+- PR#5349: Hashtbl.replace uses new key instead of reusing old key
- PR#5356: ocamlbuild handling of 'predicates' for ocamlfind
- PR#5364: wrong compilation of "((val m : SIG1) : SIG2)"
- PR#5370: ocamldep omits filename in syntax error message
+- PR#5374: camlp4 creates wrong location for type definitions
- PR#5380: strange sscanf input segfault
-- PR#5394: Documentation for -dtypes is missing in manpage
+- PR#5382: EOPNOTSUPP and ENOTSUPP different on exotic platforms
+- PR#5383: build failure in Win32/MSVC
+- PR#5387: camlp4: str_item and other syntactic elements with Nils are
+ not very usable
+- PR#5389: compaction sometimes leaves a very large heap
+- PR#5393: fails to build from source on GNU/kFreeBSD because of -R link option
+- PR#5394: documentation for -dtypes is missing in manpage
+- PR#5397: Filename.temp_dir_name should be mutable
+- PR#5410: fix printing of class application with Camlp4
- PR#5416: (Windows) Unix.(set|clear)_close_on_exec now preserves blocking mode
+- PR#5435: ocamlbuild does not find .opt executables on Windows
- PR#5436: update object ids on unmarshaling
+- PR#5442: camlp4: quotation issue with strings
- PR#5453: configure doesn't find X11 under Ubuntu/MultiarchSpec
- PR#5461: Double linking of bytecode modules
- PR#5463: Bigarray.*.map_file fail if empty array is requested
+- PR#5465: increase stack size of ocamlopt.opt for windows
- PR#5469: private record type generated by functor loses abbreviation
- PR#5475: Wrapper script for interpreted LablTk wrongly handles command line
parameters
- PR#5476: bug in native code compilation of let rec on float arrays
+- PR#5477: use pkg-config to configure graphics on linux
+- PR#5481: update camlp4 magic numbers
+- PR#5482: remove bashism in test suite scripts
+- PR#5495: camlp4o dies on infix definition (or)
- PR#5498: Unification with an empty object only checks the absence of
the first method
- PR#5503: error when ocamlbuild is passed an absolute path as build directory
@@ -163,59 +230,108 @@ Bug Fixes:
- PR#5511: in Bigarray.reshape, unwarranted limitation on new array dimensions.
- PR#5513: Int64.div causes floating point exception (ocamlopt, x86)
- PR#5516: in Bigarray C stubs, use C99 flexible array types if possible
+- PR#5518: segfault with lazy empty array
- PR#5531: Allow ocamlbuild to add ocamldoc flags through -docflag
and -docflags switches
-- PR#5543: in Bigarray.map_file, try to avoid using lseek() when growing file
- PR#5538: combining -i and -annot in ocamlc
+- PR#5543: in Bigarray.map_file, try to avoid using lseek() when growing file
+- PR#5648: (probably fixed) test failures in tests/lib-threads
+- PR#5551: repeated calls to find_in_path degrade performance
+- PR#5552: Mac OS X: unrecognized gcc option "-no-cpp-precomp"
+- PR#5555: add Hashtbl.reset to resize the bucket table to its initial size
- PR#5560: incompatible type for tuple pattern with -principal
+- PR#5575: Random states are not marshallable across architectures
+- PR#5579: camlp4: when a plugin is loaded in the toplevel,
+ Token.Filter.define_filter has no effect before the first syntax error
+- PR#5585: typo: "explicitely"
+- PR#5587: documentation: "allows to" is not correct English
+- PR#5593: remove C file when -output-obj fails
+- PR#5597: register names for instrtrace primitives in embedded bytecode
+- PR#5598: add backslash-space support in strings in ocamllex
- PR#5603: wrong .file debug info generated by ocamlopt -g
+- PR#5604: fix permissions of files created by ocamlbuild itself
- PR#5610: new unmarshaler (from PR#5318) fails to freshen object identifiers
+- PR#5614: add missing -linkall flag when compiling ocamldoc.opt
+- PR#5616: move ocamlbuild documentation to the reference manual
+- PR#5619: Uncaught CType.Unify exception in the compiler
- PR#5620: invalid printing of type manifest (camlp4 revised syntax)
- PR#5637: invalid printing of anonymous type parameters (camlp4 revised syntax)
- PR#5643: issues with .cfi and .loc directives generated by ocamlopt -g
- PR#5644: Stream.count broken when used with Sapp or Slazy nodes
- PR#5647: Cannot use install_printer in debugger
- PR#5651: printer for abstract data type (camlp4 revised syntax)
+- PR#5654: self pattern variable location tweak
- PR#5655: ocamlbuild doesn't pass cflags when building C stubs
+- PR#5657: wrong error location for abbreviated record fields
+- PR#5659: ocamlmklib -L option breaks with MSVC
- PR#5661: fixes for the test suite
+- PR#5668: Camlp4 produces invalid syntax for "let _ = ..."
- PR#5671: initialization of compare_ext field in caml_final_custom_operations()
- PR#5677: do not use "value" as identifier (genprintval.ml)
+- PR#5687: dynlink broken when used from "output-obj" main program (bytecode)
- problem with printing of string literals in camlp4 (reported on caml-list)
- emacs mode: colorization of comments and strings now works correctly
+- problem with forall and method (reported on caml-list on 2011-07-26)
+- crash when using OCAMLRUNPARAM=a=X with invalid X (reported in private)
Feature wishes:
- PR#352: new option "-stdin" to make ocaml read stdin as a script
-- PR#4444: new String.trim function, removing leading and trailing whitespace
+- PR#1164: better error message when mixing -a and .cmxa
+- PR#1284: documentation: remove restriction on mixed streams
+- PR#1496: allow configuring LIBDIR, BINDIR, and MANDIR relative to $(PREFIX)
+- PR#1835: add Digest.from_hex
+- PR#1898: toplevel: add option to suppress continuation prompts
+- PR#4278: configure: option to disable "graph" library
+- PR#4444: new String.trim function, removing leading and trailing whistespace
+- PR#4549: make Filename.dirname/basename POSIX compliant
+- PR#4830: add option -v to expunge.ml
- PR#4898: new Sys.big_endian boolean for machine endianness
+- PR#4963, PR#5467: no extern "C" into ocaml C-stub headers
- PR#5199: tests are run only for bytecode if either native support is missing,
or a non-empty value is set to "BYTECODE_ONLY" Makefile variable
+- PR#5215: marshalling of dynlinked closure
- PR#5236: new '%revapply' primitive with the semantics 'revapply x f = f x',
and '%apply' with semantics 'apply f x = f x'.
- PR#5255: natdynlink detection on powerpc, hurd, sparc
+- PR#5295: OS threads: problem with caml_c_thread_unregister()
- PR#5297: compiler now checks existence of builtin primitives
- PR#5329: (Windows) more efficient Unix.select if all fd's are sockets
+- PR#5357: warning for useless open statements
- PR#5358: first class modules don't allow "with type" declarations for types
in sub-modules
+- PR#5385: configure: emit a warning when MACOSX_DEPLOYMENT_TARGET is set
+- PR#5396: ocamldep: add options -sort, -all, and -one-line
- PR#5397: Filename.temp_dir_name should be mutable
+- PR#5403: give better error message when emacs is not found in PATH
- PR#5411: new directive for the toplevel: #load_rec
- PR#5420: Unix.openfile share mode (Windows)
-- PR#5437: warning for useless open statements
+- PR#5421: Unix: do not leak fds in various open_proc* functions
+- PR#5434: implement Unix.times in win32unix (partially)
- PR#5438: new warnings for unused declarations
+- PR#5439: upgrade config.guess and config.sub
+- PR#5445 and others: better printing of types with user-provided names
- PR#5454: Digest.compare is missing and md5 doc update
-- PR#5467: no extern "C" into ocaml C-stub headers
+- PR#5455: .emacs instructions, add lines to recognize ocaml scripts
+- PR#5456: pa_macro: replace __LOCATION__ after macro expansion; add LOCATION_OF
+- PR#5461: bytecode: emit warning when linking two modules with the same name
- PR#5478: ocamlopt assumes ar command exists
- PR#5479: Num.num_of_string may raise an exception, not reflected in the
documentation.
-- PR#5555: Add function Hashtbl.reset to resize the bucket table to
+- PR#5501: increase IO_BUFFER_SIZE to 64KiB
+- PR#5532: improve error message when bytecode file is wrong
+- PR#5555: add function Hashtbl.reset to resize the bucket table to
its initial size.
+- PR#5586: increase UNIX_BUFFER_SIZE to 64KiB
- PR#5597: register names for instrtrace primitives in embedded bytecode
- PR#5599: Add warn() tag in ocamlbuild to control -w compiler switch
- PR#5628: add #remove_directory and Topdirs.remove_directory to remove
a directory from the load path
- PR#5636: in system threads library, issue with linking of pthread_atfork
+- PR#5666: C includes don't provide a revision number
- ocamldebug: ability to inspect values that contain code pointers
- ocamldebug: new 'environment' directive to set environment variables
- for debugee
+ for debuggee
+- configure: add -no-camlp4 option
Shedding weight:
* Removed the obsolete native-code generators for Alpha, HPPA, IA64 and MIPS.
diff --git a/INSTALL b/INSTALL
index 0e7091926..98dfd31dc 100644
--- a/INSTALL
+++ b/INSTALL
@@ -169,6 +169,9 @@ Examples:
For Sun Solaris with the "acc" compiler:
./configure -cc "acc -fast" -libs "-lucb"
+ For Sun Solaris on Sparc 64bit, to compile natively (32bit only)
+ ./configure -cc "gcc -m32" -as "as -32" -aspp "gcc -m32 -c"
+
For AIX 4.3 with the IBM compiler xlc:
./configure -cc "xlc_r -D_AIX43 -Wl,-bexpall,-brtl -qmaxmem=8192"
diff --git a/Makefile b/Makefile
index 37aa1dca3..eeb3b47e6 100644
--- a/Makefile
+++ b/Makefile
@@ -128,6 +128,7 @@ world:
world.opt:
$(MAKE) coldstart
$(MAKE) opt.opt
+ $(MAKE) ocamltoolsopt
# Hard bootstrap how-to:
# (only necessary in some cases, for example if you remove some primitive)
@@ -246,6 +247,7 @@ opt:
$(MAKE) ocamlopt
$(MAKE) libraryopt
$(MAKE) otherlibrariesopt
+ $(MAKE) ocamltoolsopt
$(MAKE) ocamlbuildlib.native
# Native-code versions of the tools
@@ -307,6 +309,7 @@ installopt:
for i in $(OTHERLIBRARIES); \
do (cd otherlibs/$$i; $(MAKE) installopt) || exit $$?; done
if test -f ocamlopt.opt ; then $(MAKE) installoptopt; fi
+ cd tools; $(MAKE) installopt
installoptopt:
cp ocamlc.opt $(BINDIR)/ocamlc.opt$(EXE)
@@ -657,6 +660,9 @@ clean::
ocamltools: ocamlc ocamlyacc ocamllex asmcomp/cmx_format.cmi
cd tools; $(MAKE) all
+ocamltoolsopt: ocamlopt
+ cd tools; $(MAKE) opt
+
ocamltoolsopt.opt: ocamlc.opt ocamlyacc ocamllex asmcomp/cmx_format.cmi
cd tools; $(MAKE) opt.opt
@@ -798,8 +804,8 @@ distclean:
.PHONY: coreboot defaultentry depend distclean install installopt
.PHONY: library library-cross libraryopt ocamlbuild-mixed-boot
.PHONY: ocamlbuild.byte ocamlbuild.native ocamldebugger ocamldoc
-.PHONY: ocamldoc.opt ocamllex ocamllex.opt ocamltools ocamltools.opt
-.PHONY: ocamlyacc opt-core opt opt.opt otherlibraries
+.PHONY: ocamldoc.opt ocamllex ocamllex.opt ocamltools ocamltoolsopt
+.PHONY: ocamltoolsopt.opt ocamlyacc opt-core opt opt.opt otherlibraries
.PHONY: otherlibrariesopt package-macosx promote promote-cross
.PHONY: restore runtime runtimeopt makeruntimeopt world world.opt
diff --git a/README.win32 b/README.win32
index 6f21ecb53..ddd010a08 100644
--- a/README.win32
+++ b/README.win32
@@ -91,8 +91,7 @@ THIRD-PARTY SOFTWARE:
Can be downloaded from http://alain.frisch.fr/flexdll.html
[3] TCL/TK version 8.5. Windows binaries are available as part of the
- ActiveTCL distribution at http://www.activestate.com/products/ActiveTcl/
-
+ ActiveTCL distribution at http://www.activestate.com/activetcl/downloads
RECOMPILATION FROM THE SOURCES:
@@ -186,7 +185,7 @@ contributed his changes to the OCaml project.
REQUIREMENTS:
-This port runs under MS Windows Vista, XP, and 2000.
+This port runs under MS Windows Seven, Vista, XP, and 2000.
The base bytecode system (ocamlc, ocaml, ocamllex, ocamlyacc, ...)
runs without any additional tools.
@@ -202,10 +201,14 @@ the Setup tool from Cygwin):
mingw64-i686-binutils
mingw64-i686-gcc
+ mingw64-i686-gcc-core
mingw64-i686-runtime
-NOTE:
+NOTES:
+
+ - Do not use the Cygwin version of flexdll for this port.
+
- There is another 32-bit gcc compiler, from the MinGW.org
project, packaged in Cygwin under the name mingw-gcc.
It is not currently supported by flexdll and OCaml.
@@ -223,7 +226,7 @@ NOTE:
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/
+ http://www.activestate.com/activetcl/downloads
Note that you will need to install the 32-bit version of ActiveTCL,
even if you are on a 64-bit version of Windows.
@@ -246,23 +249,26 @@ environment variable. E.g. if Tcl/Tk was installed in C:\tcl, add
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:
+- Windows NT, 2000, XP, Vista, or Seven.
+- Cygwin: http://cygwin.com/
+ Install at least the following packages (and their dependencies, as
+ computed by Cygwin's setup.exe):
mingw64-i686-binutils
mingw64-i686-gcc
+ mingw64-i686-gcc-core
mingw64-i686-runtime
diffutils
make
ncurses
-- TCL/TK version 8.5 (see above).
-- The flexdll tool (see above).
+- Tcl/Tk version 8.5 (see above).
+- The flexdll tool (see above). Do not forget to add the flexdll directory
+ to your PATH
The standalone mingw toolchain from the MinGW-w64 project
(http://mingw-w64.sourceforge.net/) is not supported. Please use the
version packaged in Cygwin instead.
-Start a Cygwin shell and unpack the source distribution
+Start a new Cygwin shell and unpack the source distribution
(ocaml-X.YY.Z.tar.gz) with "tar xzf". Change to the top-level
directory of the OCaml distribution. Then, do
@@ -273,7 +279,7 @@ directory of the OCaml distribution. Then, do
Then, edit config/Makefile as needed, following the comments in this file.
Normally, the only variables that need to be changed are
PREFIX where to install everything
- TK_ROOT where TCL/TK was installed
+ TK_ROOT where Tcl/Tk was installed
Finally, use "make -f Makefile.nt" to build the system, e.g.
@@ -317,16 +323,42 @@ the OCaml packages). Alternatively, recompile from the source distribution.
RECOMPILATION FROM THE SOURCES:
-Just follow the instructions for Unix machines given in the file INSTALL.
+Before starting, make sure that the gcc version installed by cygwin
+is not 4.5.3 (it has a bug that affects OCaml). If needed, use cygwin's
+setup.exe to downgrade to 4.3.4.
+
+You will need to recompile (and install) flexdll from source with
+Cygwin's C compiler because the official binary version of flexdll
+doesn't handle Cygwin's symbolic links and sometimes fails to
+launch the C compiler.
+
+In order to recompile flexdll, you first need to configure, compile,
+and install OCaml without flexdll support (configure with options
+-no-shared-libs -no-tk -no-camlp4), then modify the flexdll Makefile
+to change line 51 from:
+ LINKFLAGS = -ccopt "-link version_res.o"
+to:
+ LINKFLAGS = -cclib version_res.o
+
+Then "make CHAINS=cygwin" and add the flexdll directory to your PATH.
+Make sure to add it before "/usr/bin" or you will get cygwin's flexlink.
+
+Then, in OCaml's source directory, type:
+ make clean
+ make distclean
+and follow the instructions for Unix machines given in the file INSTALL.
NOTES:
-The libraries available in this port are "num", "str", "threads",
-"unix" and "labltk". "graph" is not available.
-The replay debugger is fully supported.
-When upgrading from 3.12.0 to 3.12.1, you will need to remove
-/usr/local/bin/ocamlmktop.exe before typing "make install".
+- There is a problem with cygwin's port of gcc version 4.5.3. You should
+ use cygwin's setup program to downgrade to 4.3.4 before compiling OCaml.
+- The replay debugger is fully supported.
+- When upgrading from 3.12.0 to 3.12.1, you will need to remove
+ /usr/local/bin/ocamlmktop.exe before typing "make install".
+- In order to use the "graph" and "labltk" libraries, you will need
+ to use Cygwin's setup.exe to install the xinit, libX11-devel, tcl,
+ and tcl-tk packages before compiling OCaml.
------------------------------------------------------------------------------
diff --git a/VERSION b/VERSION
index c02c194aa..792680f2e 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
-4.01.0+dev3_2012-05-30
+4.01.0+dev4_2012-07-26
# The version string is the first line of this file.
# It must be in the format described in stdlib/sys.mli
diff --git a/asmcomp/emitaux.ml b/asmcomp/emitaux.ml
index 6e3b4ee95..14c232d3f 100644
--- a/asmcomp/emitaux.ml
+++ b/asmcomp/emitaux.ml
@@ -111,42 +111,6 @@ let emit_float32_directive directive f =
let x = Int32.bits_of_float (float_of_string f) in
emit_printf "\t%s\t0x%lx\n" directive x
-(* Emit debug information *)
-
-(* This assoc list is expected to be very short *)
-let file_pos_nums =
- (ref [] : (string * int) list ref)
-
-(* Number of files *)
-let file_pos_num_cnt = ref 1
-
-(* Reset debug state at beginning of asm file *)
-let reset_debug_info () =
- file_pos_nums := [];
- file_pos_num_cnt := 1
-
-(* We only diplay .file if the file has not been seen before. We
- display .loc for every instruction. *)
-let emit_debug_info dbg =
- if !Clflags.debug && not (Debuginfo.is_none dbg) then (
- let line = dbg.Debuginfo.dinfo_line in
- assert (line <> 0); (* clang errors out on zero line numbers *)
- let file_name = dbg.Debuginfo.dinfo_file in
- let file_num =
- try List.assoc file_name !file_pos_nums
- with Not_found ->
- let file_num = !file_pos_num_cnt in
- incr file_pos_num_cnt;
- emit_string " .file ";
- emit_int file_num; emit_char ' ';
- emit_string_literal file_name; emit_char '\n';
- file_pos_nums := (file_name,file_num) :: !file_pos_nums;
- file_num in
- emit_string " .loc ";
- emit_int file_num; emit_char ' ';
- emit_int line; emit_char '\n'
- )
-
(* Record live pointers at call points *)
type frame_descr =
@@ -240,3 +204,39 @@ let cfi_adjust_cfa_offset n =
emit_string " .cfi_adjust_cfa_offset "; emit_int n; emit_string "\n";
end
+(* Emit debug information *)
+
+(* This assoc list is expected to be very short *)
+let file_pos_nums =
+ (ref [] : (string * int) list ref)
+
+(* Number of files *)
+let file_pos_num_cnt = ref 1
+
+(* Reset debug state at beginning of asm file *)
+let reset_debug_info () =
+ file_pos_nums := [];
+ file_pos_num_cnt := 1
+
+(* We only diplay .file if the file has not been seen before. We
+ display .loc for every instruction. *)
+let emit_debug_info dbg =
+ if is_cfi_enabled () &&
+ !Clflags.debug && not (Debuginfo.is_none dbg) then begin
+ let line = dbg.Debuginfo.dinfo_line in
+ assert (line <> 0); (* clang errors out on zero line numbers *)
+ let file_name = dbg.Debuginfo.dinfo_file in
+ let file_num =
+ try List.assoc file_name !file_pos_nums
+ with Not_found ->
+ let file_num = !file_pos_num_cnt in
+ incr file_pos_num_cnt;
+ emit_string " .file ";
+ emit_int file_num; emit_char ' ';
+ emit_string_literal file_name; emit_char '\n';
+ file_pos_nums := (file_name,file_num) :: !file_pos_nums;
+ file_num in
+ emit_string " .loc ";
+ emit_int file_num; emit_char ' ';
+ emit_int line; emit_char '\n'
+ end
diff --git a/asmcomp/power/arch.ml b/asmcomp/power/arch.ml
index c0557244b..c1323234a 100644
--- a/asmcomp/power/arch.ml
+++ b/asmcomp/power/arch.ml
@@ -48,7 +48,7 @@ let size_float = 8
(* Behavior of division *)
-let division_crashes_on_overflow = false
+let division_crashes_on_overflow = true
(* Operations on addressing modes *)
diff --git a/asmrun/.depend b/asmrun/.depend
index aa0e69e1a..1bbfddcde 100644
--- a/asmrun/.depend
+++ b/asmrun/.depend
@@ -37,9 +37,10 @@ custom.o: custom.c ../byterun/alloc.h ../byterun/misc.h \
../byterun/mlvalues.h ../byterun/custom.h ../byterun/fail.h \
../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \
../byterun/freelist.h ../byterun/minor_gc.h ../byterun/mlvalues.h
-debugger.o: debugger.c ../byterun/config.h ../byterun/../config/m.h \
- ../byterun/../config/s.h ../byterun/debugger.h ../byterun/misc.h \
- ../byterun/config.h ../byterun/mlvalues.h ../byterun/misc.h
+debugger.o: debugger.c ../byterun/alloc.h ../byterun/misc.h \
+ ../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
+ ../byterun/mlvalues.h ../byterun/config.h ../byterun/debugger.h \
+ ../byterun/misc.h
dynlink.o: dynlink.c ../byterun/config.h ../byterun/../config/m.h \
../byterun/../config/s.h ../byterun/alloc.h ../byterun/misc.h \
../byterun/config.h ../byterun/mlvalues.h ../byterun/dynlink.h \
@@ -51,9 +52,9 @@ extern.o: extern.c ../byterun/alloc.h ../byterun/misc.h \
../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
../byterun/mlvalues.h ../byterun/custom.h ../byterun/fail.h \
../byterun/gc.h ../byterun/intext.h ../byterun/io.h ../byterun/io.h \
- ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \
- ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/misc.h \
- ../byterun/mlvalues.h ../byterun/reverse.h
+ ../byterun/md5.h ../byterun/memory.h ../byterun/gc.h \
+ ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \
+ ../byterun/misc.h ../byterun/mlvalues.h ../byterun/reverse.h
fail.o: fail.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
../byterun/fail.h ../byterun/io.h ../byterun/gc.h ../byterun/memory.h \
@@ -96,14 +97,14 @@ hash.o: hash.c ../byterun/mlvalues.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/misc.h \
../byterun/custom.h ../byterun/mlvalues.h ../byterun/memory.h \
../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \
- ../byterun/minor_gc.h
+ ../byterun/minor_gc.h ../byterun/hash.h ../byterun/int64_native.h
intern.o: intern.c ../byterun/alloc.h ../byterun/misc.h \
../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
- ../byterun/mlvalues.h ../byterun/custom.h ../byterun/fail.h \
- ../byterun/gc.h ../byterun/intext.h ../byterun/io.h ../byterun/io.h \
- ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \
- ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/mlvalues.h \
- ../byterun/misc.h ../byterun/reverse.h ../byterun/md5.h
+ ../byterun/mlvalues.h ../byterun/callback.h ../byterun/custom.h \
+ ../byterun/fail.h ../byterun/gc.h ../byterun/intext.h ../byterun/io.h \
+ ../byterun/io.h ../byterun/md5.h ../byterun/memory.h ../byterun/gc.h \
+ ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \
+ ../byterun/mlvalues.h ../byterun/misc.h ../byterun/reverse.h
ints.o: ints.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
../byterun/custom.h ../byterun/fail.h ../byterun/intext.h \
@@ -174,7 +175,8 @@ natdynlink.o: natdynlink.c ../byterun/misc.h ../byterun/config.h \
../byterun/misc.h ../byterun/memory.h ../byterun/gc.h \
../byterun/mlvalues.h ../byterun/major_gc.h ../byterun/freelist.h \
../byterun/minor_gc.h stack.h ../byterun/callback.h ../byterun/alloc.h \
- natdynlink.h ../byterun/osdeps.h ../byterun/fail.h
+ ../byterun/intext.h ../byterun/io.h natdynlink.h ../byterun/osdeps.h \
+ ../byterun/fail.h
obj.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
../byterun/fail.h ../byterun/gc.h ../byterun/interp.h \
@@ -216,8 +218,9 @@ signals_asm.o: signals_asm.c ../byterun/fail.h ../byterun/misc.h \
startup.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \
../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
../byterun/misc.h ../byterun/backtrace.h ../byterun/custom.h \
- ../byterun/fail.h ../byterun/freelist.h ../byterun/gc.h \
- ../byterun/gc_ctrl.h ../byterun/memory.h ../byterun/gc.h \
+ ../byterun/debugger.h ../byterun/fail.h ../byterun/freelist.h \
+ ../byterun/gc.h ../byterun/gc_ctrl.h ../byterun/intext.h \
+ ../byterun/io.h ../byterun/memory.h ../byterun/gc.h \
../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \
../byterun/misc.h ../byterun/mlvalues.h ../byterun/osdeps.h \
../byterun/printexc.h stack.h ../byterun/sys.h natdynlink.h
@@ -284,9 +287,10 @@ custom.d.o: custom.c ../byterun/alloc.h ../byterun/misc.h \
../byterun/mlvalues.h ../byterun/custom.h ../byterun/fail.h \
../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \
../byterun/freelist.h ../byterun/minor_gc.h ../byterun/mlvalues.h
-debugger.d.o: debugger.c ../byterun/config.h ../byterun/../config/m.h \
- ../byterun/../config/s.h ../byterun/debugger.h ../byterun/misc.h \
- ../byterun/config.h ../byterun/mlvalues.h ../byterun/misc.h
+debugger.d.o: debugger.c ../byterun/alloc.h ../byterun/misc.h \
+ ../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
+ ../byterun/mlvalues.h ../byterun/config.h ../byterun/debugger.h \
+ ../byterun/misc.h
dynlink.d.o: dynlink.c ../byterun/config.h ../byterun/../config/m.h \
../byterun/../config/s.h ../byterun/alloc.h ../byterun/misc.h \
../byterun/config.h ../byterun/mlvalues.h ../byterun/dynlink.h \
@@ -298,9 +302,9 @@ extern.d.o: extern.c ../byterun/alloc.h ../byterun/misc.h \
../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
../byterun/mlvalues.h ../byterun/custom.h ../byterun/fail.h \
../byterun/gc.h ../byterun/intext.h ../byterun/io.h ../byterun/io.h \
- ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \
- ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/misc.h \
- ../byterun/mlvalues.h ../byterun/reverse.h
+ ../byterun/md5.h ../byterun/memory.h ../byterun/gc.h \
+ ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \
+ ../byterun/misc.h ../byterun/mlvalues.h ../byterun/reverse.h
fail.d.o: fail.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
../byterun/fail.h ../byterun/io.h ../byterun/gc.h ../byterun/memory.h \
@@ -343,14 +347,14 @@ hash.d.o: hash.c ../byterun/mlvalues.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/misc.h \
../byterun/custom.h ../byterun/mlvalues.h ../byterun/memory.h \
../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \
- ../byterun/minor_gc.h
+ ../byterun/minor_gc.h ../byterun/hash.h ../byterun/int64_native.h
intern.d.o: intern.c ../byterun/alloc.h ../byterun/misc.h \
../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
- ../byterun/mlvalues.h ../byterun/custom.h ../byterun/fail.h \
- ../byterun/gc.h ../byterun/intext.h ../byterun/io.h ../byterun/io.h \
- ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \
- ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/mlvalues.h \
- ../byterun/misc.h ../byterun/reverse.h ../byterun/md5.h
+ ../byterun/mlvalues.h ../byterun/callback.h ../byterun/custom.h \
+ ../byterun/fail.h ../byterun/gc.h ../byterun/intext.h ../byterun/io.h \
+ ../byterun/io.h ../byterun/md5.h ../byterun/memory.h ../byterun/gc.h \
+ ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \
+ ../byterun/mlvalues.h ../byterun/misc.h ../byterun/reverse.h
ints.d.o: ints.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
../byterun/custom.h ../byterun/fail.h ../byterun/intext.h \
@@ -421,7 +425,8 @@ natdynlink.d.o: natdynlink.c ../byterun/misc.h ../byterun/config.h \
../byterun/misc.h ../byterun/memory.h ../byterun/gc.h \
../byterun/mlvalues.h ../byterun/major_gc.h ../byterun/freelist.h \
../byterun/minor_gc.h stack.h ../byterun/callback.h ../byterun/alloc.h \
- natdynlink.h ../byterun/osdeps.h ../byterun/fail.h
+ ../byterun/intext.h ../byterun/io.h natdynlink.h ../byterun/osdeps.h \
+ ../byterun/fail.h
obj.d.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
../byterun/fail.h ../byterun/gc.h ../byterun/interp.h \
@@ -463,8 +468,9 @@ signals_asm.d.o: signals_asm.c ../byterun/fail.h ../byterun/misc.h \
startup.d.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \
../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
../byterun/misc.h ../byterun/backtrace.h ../byterun/custom.h \
- ../byterun/fail.h ../byterun/freelist.h ../byterun/gc.h \
- ../byterun/gc_ctrl.h ../byterun/memory.h ../byterun/gc.h \
+ ../byterun/debugger.h ../byterun/fail.h ../byterun/freelist.h \
+ ../byterun/gc.h ../byterun/gc_ctrl.h ../byterun/intext.h \
+ ../byterun/io.h ../byterun/memory.h ../byterun/gc.h \
../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \
../byterun/misc.h ../byterun/mlvalues.h ../byterun/osdeps.h \
../byterun/printexc.h stack.h ../byterun/sys.h natdynlink.h
@@ -531,9 +537,10 @@ custom.p.o: custom.c ../byterun/alloc.h ../byterun/misc.h \
../byterun/mlvalues.h ../byterun/custom.h ../byterun/fail.h \
../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \
../byterun/freelist.h ../byterun/minor_gc.h ../byterun/mlvalues.h
-debugger.p.o: debugger.c ../byterun/config.h ../byterun/../config/m.h \
- ../byterun/../config/s.h ../byterun/debugger.h ../byterun/misc.h \
- ../byterun/config.h ../byterun/mlvalues.h ../byterun/misc.h
+debugger.p.o: debugger.c ../byterun/alloc.h ../byterun/misc.h \
+ ../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
+ ../byterun/mlvalues.h ../byterun/config.h ../byterun/debugger.h \
+ ../byterun/misc.h
dynlink.p.o: dynlink.c ../byterun/config.h ../byterun/../config/m.h \
../byterun/../config/s.h ../byterun/alloc.h ../byterun/misc.h \
../byterun/config.h ../byterun/mlvalues.h ../byterun/dynlink.h \
@@ -545,9 +552,9 @@ extern.p.o: extern.c ../byterun/alloc.h ../byterun/misc.h \
../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
../byterun/mlvalues.h ../byterun/custom.h ../byterun/fail.h \
../byterun/gc.h ../byterun/intext.h ../byterun/io.h ../byterun/io.h \
- ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \
- ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/misc.h \
- ../byterun/mlvalues.h ../byterun/reverse.h
+ ../byterun/md5.h ../byterun/memory.h ../byterun/gc.h \
+ ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \
+ ../byterun/misc.h ../byterun/mlvalues.h ../byterun/reverse.h
fail.p.o: fail.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
../byterun/fail.h ../byterun/io.h ../byterun/gc.h ../byterun/memory.h \
@@ -590,14 +597,14 @@ hash.p.o: hash.c ../byterun/mlvalues.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/misc.h \
../byterun/custom.h ../byterun/mlvalues.h ../byterun/memory.h \
../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \
- ../byterun/minor_gc.h
+ ../byterun/minor_gc.h ../byterun/hash.h ../byterun/int64_native.h
intern.p.o: intern.c ../byterun/alloc.h ../byterun/misc.h \
../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
- ../byterun/mlvalues.h ../byterun/custom.h ../byterun/fail.h \
- ../byterun/gc.h ../byterun/intext.h ../byterun/io.h ../byterun/io.h \
- ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \
- ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/mlvalues.h \
- ../byterun/misc.h ../byterun/reverse.h ../byterun/md5.h
+ ../byterun/mlvalues.h ../byterun/callback.h ../byterun/custom.h \
+ ../byterun/fail.h ../byterun/gc.h ../byterun/intext.h ../byterun/io.h \
+ ../byterun/io.h ../byterun/md5.h ../byterun/memory.h ../byterun/gc.h \
+ ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \
+ ../byterun/mlvalues.h ../byterun/misc.h ../byterun/reverse.h
ints.p.o: ints.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
../byterun/custom.h ../byterun/fail.h ../byterun/intext.h \
@@ -668,7 +675,8 @@ natdynlink.p.o: natdynlink.c ../byterun/misc.h ../byterun/config.h \
../byterun/misc.h ../byterun/memory.h ../byterun/gc.h \
../byterun/mlvalues.h ../byterun/major_gc.h ../byterun/freelist.h \
../byterun/minor_gc.h stack.h ../byterun/callback.h ../byterun/alloc.h \
- natdynlink.h ../byterun/osdeps.h ../byterun/fail.h
+ ../byterun/intext.h ../byterun/io.h natdynlink.h ../byterun/osdeps.h \
+ ../byterun/fail.h
obj.p.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
../byterun/fail.h ../byterun/gc.h ../byterun/interp.h \
@@ -710,8 +718,9 @@ signals_asm.p.o: signals_asm.c ../byterun/fail.h ../byterun/misc.h \
startup.p.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \
../byterun/config.h ../byterun/../config/m.h ../byterun/../config/s.h \
../byterun/misc.h ../byterun/backtrace.h ../byterun/custom.h \
- ../byterun/fail.h ../byterun/freelist.h ../byterun/gc.h \
- ../byterun/gc_ctrl.h ../byterun/memory.h ../byterun/gc.h \
+ ../byterun/debugger.h ../byterun/fail.h ../byterun/freelist.h \
+ ../byterun/gc.h ../byterun/gc_ctrl.h ../byterun/intext.h \
+ ../byterun/io.h ../byterun/memory.h ../byterun/gc.h \
../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \
../byterun/misc.h ../byterun/mlvalues.h ../byterun/osdeps.h \
../byterun/printexc.h stack.h ../byterun/sys.h natdynlink.h
diff --git a/boot/.ignore b/boot/.ignore
index a0a2356c9..8165156d9 100644
--- a/boot/.ignore
+++ b/boot/.ignore
@@ -1,6 +1,8 @@
Saved
ocamlrun
+ocamlrun.exe
ocamlyacc
+ocamlyacc.exe
camlheader
myocamlbuild
myocamlbuild.native
diff --git a/byterun/.depend b/byterun/.depend
index b92cc6de2..68adc27b3 100644
--- a/byterun/.depend
+++ b/byterun/.depend
@@ -6,7 +6,7 @@ array.o: array.c alloc.h compatibility.h misc.h config.h ../config/m.h \
minor_gc.h
backtrace.o: backtrace.c config.h ../config/m.h ../config/s.h \
compatibility.h mlvalues.h misc.h alloc.h io.h instruct.h intext.h \
- fix_code.h exec.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
+ exec.h fix_code.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
startup.h stacks.h sys.h backtrace.h
callback.o: callback.c callback.h compatibility.h mlvalues.h config.h \
../config/m.h ../config/s.h misc.h fail.h memory.h gc.h major_gc.h \
@@ -20,15 +20,15 @@ compare.o: compare.c custom.h compatibility.h mlvalues.h config.h \
custom.o: custom.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h custom.h fail.h memory.h gc.h major_gc.h \
freelist.h minor_gc.h
-debugger.o: debugger.c config.h ../config/m.h ../config/s.h \
- compatibility.h debugger.h misc.h mlvalues.h fail.h fix_code.h \
+debugger.o: debugger.c alloc.h compatibility.h misc.h config.h \
+ ../config/m.h ../config/s.h mlvalues.h debugger.h fail.h fix_code.h \
instruct.h intext.h io.h stacks.h memory.h gc.h major_gc.h freelist.h \
minor_gc.h sys.h
dynlink.o: dynlink.c config.h ../config/m.h ../config/s.h compatibility.h \
alloc.h misc.h mlvalues.h dynlink.h fail.h memory.h gc.h major_gc.h \
freelist.h minor_gc.h osdeps.h prims.h
extern.o: extern.c alloc.h compatibility.h misc.h config.h ../config/m.h \
- ../config/s.h mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h \
+ ../config/s.h mlvalues.h custom.h fail.h gc.h intext.h io.h md5.h \
memory.h major_gc.h freelist.h minor_gc.h reverse.h
fail.o: fail.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h fail.h io.h gc.h memory.h major_gc.h \
@@ -38,7 +38,8 @@ finalise.o: finalise.c callback.h compatibility.h mlvalues.h config.h \
major_gc.h freelist.h minor_gc.h signals.h
fix_code.o: fix_code.c config.h ../config/m.h ../config/s.h \
compatibility.h debugger.h misc.h mlvalues.h fix_code.h instruct.h \
- md5.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h reverse.h
+ intext.h io.h md5.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
+ reverse.h
floats.o: floats.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h \
minor_gc.h reverse.h stacks.h
@@ -54,18 +55,18 @@ globroots.o: globroots.c memory.h compatibility.h config.h ../config/m.h \
roots.h globroots.h
hash.o: hash.c mlvalues.h compatibility.h config.h ../config/m.h \
../config/s.h misc.h custom.h memory.h gc.h major_gc.h freelist.h \
- minor_gc.h
+ minor_gc.h hash.h int64_native.h
instrtrace.o: instrtrace.c
intern.o: intern.c alloc.h compatibility.h misc.h config.h ../config/m.h \
- ../config/s.h mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h \
- memory.h major_gc.h freelist.h minor_gc.h reverse.h
+ ../config/s.h mlvalues.h callback.h custom.h fail.h gc.h intext.h io.h \
+ md5.h memory.h major_gc.h freelist.h minor_gc.h reverse.h
interp.o: interp.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h backtrace.h callback.h debugger.h fail.h \
fix_code.h instrtrace.h instruct.h interp.h major_gc.h freelist.h \
memory.h gc.h minor_gc.h prims.h signals.h stacks.h jumptbl.h
ints.o: ints.c alloc.h compatibility.h misc.h config.h ../config/m.h \
- ../config/s.h mlvalues.h custom.h fail.h intext.h io.h fix_code.h \
- memory.h gc.h major_gc.h freelist.h minor_gc.h int64_native.h
+ ../config/s.h mlvalues.h custom.h fail.h intext.h io.h memory.h gc.h \
+ major_gc.h freelist.h minor_gc.h int64_native.h
io.o: io.c config.h ../config/m.h ../config/s.h compatibility.h alloc.h \
misc.h mlvalues.h custom.h fail.h io.h memory.h gc.h major_gc.h \
freelist.h minor_gc.h signals.h sys.h
@@ -142,7 +143,7 @@ array.d.o: array.c alloc.h compatibility.h misc.h config.h ../config/m.h \
minor_gc.h
backtrace.d.o: backtrace.c config.h ../config/m.h ../config/s.h \
compatibility.h mlvalues.h misc.h alloc.h io.h instruct.h intext.h \
- fix_code.h exec.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
+ exec.h fix_code.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
startup.h stacks.h sys.h backtrace.h
callback.d.o: callback.c callback.h compatibility.h mlvalues.h config.h \
../config/m.h ../config/s.h misc.h fail.h memory.h gc.h major_gc.h \
@@ -156,15 +157,15 @@ compare.d.o: compare.c custom.h compatibility.h mlvalues.h config.h \
custom.d.o: custom.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h custom.h fail.h memory.h gc.h major_gc.h \
freelist.h minor_gc.h
-debugger.d.o: debugger.c config.h ../config/m.h ../config/s.h \
- compatibility.h debugger.h misc.h mlvalues.h fail.h fix_code.h \
+debugger.d.o: debugger.c alloc.h compatibility.h misc.h config.h \
+ ../config/m.h ../config/s.h mlvalues.h debugger.h fail.h fix_code.h \
instruct.h intext.h io.h stacks.h memory.h gc.h major_gc.h freelist.h \
minor_gc.h sys.h
dynlink.d.o: dynlink.c config.h ../config/m.h ../config/s.h compatibility.h \
alloc.h misc.h mlvalues.h dynlink.h fail.h memory.h gc.h major_gc.h \
freelist.h minor_gc.h osdeps.h prims.h
extern.d.o: extern.c alloc.h compatibility.h misc.h config.h ../config/m.h \
- ../config/s.h mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h \
+ ../config/s.h mlvalues.h custom.h fail.h gc.h intext.h io.h md5.h \
memory.h major_gc.h freelist.h minor_gc.h reverse.h
fail.d.o: fail.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h fail.h io.h gc.h memory.h major_gc.h \
@@ -174,7 +175,8 @@ finalise.d.o: finalise.c callback.h compatibility.h mlvalues.h config.h \
major_gc.h freelist.h minor_gc.h signals.h
fix_code.d.o: fix_code.c config.h ../config/m.h ../config/s.h \
compatibility.h debugger.h misc.h mlvalues.h fix_code.h instruct.h \
- md5.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h reverse.h
+ intext.h io.h md5.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
+ reverse.h
floats.d.o: floats.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h \
minor_gc.h reverse.h stacks.h
@@ -190,20 +192,20 @@ globroots.d.o: globroots.c memory.h compatibility.h config.h ../config/m.h \
roots.h globroots.h
hash.d.o: hash.c mlvalues.h compatibility.h config.h ../config/m.h \
../config/s.h misc.h custom.h memory.h gc.h major_gc.h freelist.h \
- minor_gc.h
+ minor_gc.h hash.h int64_native.h
instrtrace.d.o: instrtrace.c instruct.h misc.h compatibility.h config.h \
../config/m.h ../config/s.h mlvalues.h opnames.h prims.h stacks.h \
memory.h gc.h major_gc.h freelist.h minor_gc.h
intern.d.o: intern.c alloc.h compatibility.h misc.h config.h ../config/m.h \
- ../config/s.h mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h \
- memory.h major_gc.h freelist.h minor_gc.h reverse.h
+ ../config/s.h mlvalues.h callback.h custom.h fail.h gc.h intext.h io.h \
+ md5.h memory.h major_gc.h freelist.h minor_gc.h reverse.h
interp.d.o: interp.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h backtrace.h callback.h debugger.h fail.h \
fix_code.h instrtrace.h instruct.h interp.h major_gc.h freelist.h \
memory.h gc.h minor_gc.h prims.h signals.h stacks.h
ints.d.o: ints.c alloc.h compatibility.h misc.h config.h ../config/m.h \
- ../config/s.h mlvalues.h custom.h fail.h intext.h io.h fix_code.h \
- memory.h gc.h major_gc.h freelist.h minor_gc.h int64_native.h
+ ../config/s.h mlvalues.h custom.h fail.h intext.h io.h memory.h gc.h \
+ major_gc.h freelist.h minor_gc.h int64_native.h
io.d.o: io.c config.h ../config/m.h ../config/s.h compatibility.h alloc.h \
misc.h mlvalues.h custom.h fail.h io.h memory.h gc.h major_gc.h \
freelist.h minor_gc.h signals.h sys.h
@@ -280,7 +282,7 @@ array.pic.o: array.c alloc.h compatibility.h misc.h config.h ../config/m.h \
minor_gc.h
backtrace.pic.o: backtrace.c config.h ../config/m.h ../config/s.h \
compatibility.h mlvalues.h misc.h alloc.h io.h instruct.h intext.h \
- fix_code.h exec.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
+ exec.h fix_code.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
startup.h stacks.h sys.h backtrace.h
callback.pic.o: callback.c callback.h compatibility.h mlvalues.h config.h \
../config/m.h ../config/s.h misc.h fail.h memory.h gc.h major_gc.h \
@@ -294,15 +296,15 @@ compare.pic.o: compare.c custom.h compatibility.h mlvalues.h config.h \
custom.pic.o: custom.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h custom.h fail.h memory.h gc.h major_gc.h \
freelist.h minor_gc.h
-debugger.pic.o: debugger.c config.h ../config/m.h ../config/s.h \
- compatibility.h debugger.h misc.h mlvalues.h fail.h fix_code.h \
+debugger.pic.o: debugger.c alloc.h compatibility.h misc.h config.h \
+ ../config/m.h ../config/s.h mlvalues.h debugger.h fail.h fix_code.h \
instruct.h intext.h io.h stacks.h memory.h gc.h major_gc.h freelist.h \
minor_gc.h sys.h
dynlink.pic.o: dynlink.c config.h ../config/m.h ../config/s.h compatibility.h \
alloc.h misc.h mlvalues.h dynlink.h fail.h memory.h gc.h major_gc.h \
freelist.h minor_gc.h osdeps.h prims.h
extern.pic.o: extern.c alloc.h compatibility.h misc.h config.h ../config/m.h \
- ../config/s.h mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h \
+ ../config/s.h mlvalues.h custom.h fail.h gc.h intext.h io.h md5.h \
memory.h major_gc.h freelist.h minor_gc.h reverse.h
fail.pic.o: fail.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h fail.h io.h gc.h memory.h major_gc.h \
@@ -312,7 +314,8 @@ finalise.pic.o: finalise.c callback.h compatibility.h mlvalues.h config.h \
major_gc.h freelist.h minor_gc.h signals.h
fix_code.pic.o: fix_code.c config.h ../config/m.h ../config/s.h \
compatibility.h debugger.h misc.h mlvalues.h fix_code.h instruct.h \
- md5.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h reverse.h
+ intext.h io.h md5.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
+ reverse.h
floats.pic.o: floats.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h \
minor_gc.h reverse.h stacks.h
@@ -328,18 +331,18 @@ globroots.pic.o: globroots.c memory.h compatibility.h config.h ../config/m.h \
roots.h globroots.h
hash.pic.o: hash.c mlvalues.h compatibility.h config.h ../config/m.h \
../config/s.h misc.h custom.h memory.h gc.h major_gc.h freelist.h \
- minor_gc.h
+ minor_gc.h hash.h int64_native.h
instrtrace.pic.o: instrtrace.c
intern.pic.o: intern.c alloc.h compatibility.h misc.h config.h ../config/m.h \
- ../config/s.h mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h \
- memory.h major_gc.h freelist.h minor_gc.h reverse.h
+ ../config/s.h mlvalues.h callback.h custom.h fail.h gc.h intext.h io.h \
+ md5.h memory.h major_gc.h freelist.h minor_gc.h reverse.h
interp.pic.o: interp.c alloc.h compatibility.h misc.h config.h ../config/m.h \
../config/s.h mlvalues.h backtrace.h callback.h debugger.h fail.h \
fix_code.h instrtrace.h instruct.h interp.h major_gc.h freelist.h \
memory.h gc.h minor_gc.h prims.h signals.h stacks.h jumptbl.h
ints.pic.o: ints.c alloc.h compatibility.h misc.h config.h ../config/m.h \
- ../config/s.h mlvalues.h custom.h fail.h intext.h io.h fix_code.h \
- memory.h gc.h major_gc.h freelist.h minor_gc.h int64_native.h
+ ../config/s.h mlvalues.h custom.h fail.h intext.h io.h memory.h gc.h \
+ major_gc.h freelist.h minor_gc.h int64_native.h
io.pic.o: io.c config.h ../config/m.h ../config/s.h compatibility.h alloc.h \
misc.h mlvalues.h custom.h fail.h io.h memory.h gc.h major_gc.h \
freelist.h minor_gc.h signals.h sys.h
diff --git a/byterun/.ignore b/byterun/.ignore
index 59302e054..7b178a46d 100644
--- a/byterun/.ignore
+++ b/byterun/.ignore
@@ -4,7 +4,9 @@ prims.c
opnames.h
version.h
ocamlrun
+ocamlrun.exe
ocamlrund
+ocamlrund.exe
ld.conf
interp.a.lst
*.[sd]obj
diff --git a/byterun/Makefile b/byterun/Makefile
index 316f69e5c..e35121252 100644
--- a/byterun/Makefile
+++ b/byterun/Makefile
@@ -32,7 +32,7 @@ ocamlrun$(EXE): libcamlrun.a prims.o
prims.o libcamlrun.a $(BYTECCLIBS)
ocamlrund$(EXE): libcamlrund.a prims.o
- $(MKEXE) -g $(BYTECCLINKOPTS) -o ocamlrund$(EXE) \
+ $(MKEXE) $(MKEXEDEBUGFLAG) $(BYTECCLINKOPTS) -o ocamlrund$(EXE) \
prims.o libcamlrund.a $(BYTECCLIBS)
libcamlrun.a: $(OBJS)
diff --git a/byterun/compact.c b/byterun/compact.c
index 17d574bb7..6c2164c31 100644
--- a/byterun/compact.c
+++ b/byterun/compact.c
@@ -397,7 +397,7 @@ uintnat caml_percent_max; /* used in gc_ctrl.c and memory.c */
void caml_compact_heap (void)
{
- uintnat target_size;
+ uintnat target_size, live;
do_compaction ();
/* Compaction may fail to shrink the heap to a reasonable size
@@ -416,13 +416,15 @@ void caml_compact_heap (void)
/* We compute:
freewords = caml_fl_cur_size (exact)
heapsize = caml_heap_size (exact)
- usedwords = heap_size - freewords
- target_size = usedwords * (1 + caml_percent_free / 100)
+ live = heap_size - freewords
+ target_size = live * (1 + caml_percent_free / 100)
+ = live / 100 * (100 + caml_percent_free)
+ We add 1 to live/100 to make sure it isn't 0.
We recompact if target_size < heap_size / 2
*/
- target_size = (caml_stat_heap_size - Bsize_wsize (caml_fl_cur_size))
- * (100 + caml_percent_free) / 100;
+ live = caml_stat_heap_size - Bsize_wsize (caml_fl_cur_size);
+ target_size = (live / 100 + 1) * (100 + caml_percent_free);
target_size = caml_round_heap_chunk_size (target_size);
if (target_size < caml_stat_heap_size / 2){
char *chunk;
diff --git a/byterun/freelist.c b/byterun/freelist.c
index f3bb4a8ee..6b50d3f9e 100644
--- a/byterun/freelist.c
+++ b/byterun/freelist.c
@@ -532,14 +532,14 @@ void caml_set_allocation_policy (uintnat p)
switch (p){
case Policy_next_fit:
fl_prev = Fl_head;
+ policy = p;
break;
case Policy_first_fit:
flp_size = 0;
beyond = NULL;
+ policy = p;
break;
default:
- Assert (0);
break;
}
- policy = p;
}
diff --git a/byterun/gc_ctrl.c b/byterun/gc_ctrl.c
index b5c436679..2ae3165d9 100644
--- a/byterun/gc_ctrl.c
+++ b/byterun/gc_ctrl.c
@@ -356,21 +356,12 @@ static intnat norm_minsize (intnat s)
return s;
}
-static intnat norm_policy (intnat p)
-{
- if (p >= 0 && p <= 1){
- return p;
- }else{
- return 1;
- }
-}
-
CAMLprim value caml_gc_set(value v)
{
uintnat newpf, newpm;
asize_t newheapincr;
asize_t newminsize;
- uintnat newpolicy;
+ uintnat oldpolicy;
caml_verb_gc = Long_val (Field (v, 3));
@@ -396,10 +387,11 @@ CAMLprim value caml_gc_set(value v)
caml_gc_message (0x20, "New heap increment size: %luk bytes\n",
caml_major_heap_increment/1024);
}
- newpolicy = norm_policy (Long_val (Field (v, 6)));
- if (newpolicy != caml_allocation_policy){
- caml_gc_message (0x20, "New allocation policy: %d\n", newpolicy);
- caml_set_allocation_policy (newpolicy);
+ oldpolicy = caml_allocation_policy;
+ caml_set_allocation_policy (Long_val (Field (v, 6)));
+ if (oldpolicy != caml_allocation_policy){
+ caml_gc_message (0x20, "New allocation policy: %d\n",
+ caml_allocation_policy);
}
/* Minor heap size comes last because it will trigger a minor collection
diff --git a/byterun/io.c b/byterun/io.c
index 51fad082f..ae9e39706 100644
--- a/byterun/io.c
+++ b/byterun/io.c
@@ -284,7 +284,7 @@ CAMLexport int caml_do_read(int fd, char *p, unsigned int n)
retcode = read(fd, p, 16384);
}
#endif
- caml_leave_blocking_section();
+ caml_leave_blocking_section();
} while (retcode == -1 && errno == EINTR);
if (retcode == -1) caml_sys_io_error(NO_ARG);
return retcode;
diff --git a/camlp4/boot/.ignore b/camlp4/boot/.ignore
index 03db14871..9a5f19e1e 100644
--- a/camlp4/boot/.ignore
+++ b/camlp4/boot/.ignore
@@ -2,3 +2,4 @@ camlp4
camlp4o
camlp4r
SAVED
+*.old
diff --git a/config/auto-aux/cfi.S b/config/auto-aux/cfi.S
index e055423a9..acd052df0 100644
--- a/config/auto-aux/cfi.S
+++ b/config/auto-aux/cfi.S
@@ -1,3 +1,6 @@
-.cfi_startproc
-.cfi_adjust_cfa_offset 8
-.cfi_endproc
+camlPervasives__loop_1128:
+ .file 1 "pervasives.ml"
+ .loc 1 193
+ .cfi_startproc
+ .cfi_adjust_cfa_offset 8
+ .cfi_endproc
diff --git a/configure b/configure
index 732e23367..b823db117 100755
--- a/configure
+++ b/configure
@@ -256,6 +256,7 @@ esac
bytecc="$cc"
mkexe="\$(BYTECC)"
+mkexedebugflag="-g"
bytecccompopts=""
bytecclinkopts=""
dllccompopts=""
@@ -328,6 +329,7 @@ case "$bytecc,$host" in
else
iflexdir="-I\"$flexdir\""
mkexe="$flexlink -exe"
+ mkexedebugflag="-link -g"
fi
fi
exe=".exe"
@@ -1632,6 +1634,7 @@ echo "TOOLCHAIN=cc" >> Makefile
echo "NATDYNLINK=$natdynlink" >> Makefile
echo "CMXS=$cmxs" >> Makefile
echo "MKEXE=$mkexe" >> Makefile
+echo "MKEXEDEBUGFLAG=$mkexedebugflag" >> Makefile
echo "MKDLL=$mksharedlib" >> Makefile
echo "MKMAINDLL=$mkmaindll" >> Makefile
echo "RUNTIMED=${debugruntime}" >>Makefile
@@ -1721,8 +1724,8 @@ fi
if test $has_tk = true; then
echo "Configuration for the \"labltk\" library:"
echo " use tcl/tk version ....... $tcl_version"
-echo " options for compiling .... $tk_defs $x11_includes"
-echo " options for linking ...... $tk_libs $x11_link"
+echo " options for compiling .... $tk_defs $tk_x11_include"
+echo " options for linking ...... $tk_libs $tk_x11_libs"
else
echo "The \"labltk\" library: not supported"
fi
diff --git a/debugger/.ignore b/debugger/.ignore
index 45440f86d..45eec7cce 100644
--- a/debugger/.ignore
+++ b/debugger/.ignore
@@ -2,5 +2,6 @@ lexer.ml
parser.ml
parser.mli
ocamldebug
+ocamldebug.exe
dynlink.ml
dynlink.mli
diff --git a/driver/pparse.ml b/driver/pparse.ml
index 1d8c57c7c..d125f5e41 100644
--- a/driver/pparse.ml
+++ b/driver/pparse.ml
@@ -22,7 +22,7 @@ let preprocess sourcefile =
match !Clflags.preprocessor with
None -> sourcefile
| Some pp ->
- let tmpfile = Filename.temp_file "camlpp" "" in
+ let tmpfile = Filename.temp_file "ocamlpp" "" in
let comm = Printf.sprintf "%s %s > %s"
pp (Filename.quote sourcefile) tmpfile
in
diff --git a/lex/.depend b/lex/.depend
index b51dbd3bd..b0df0b874 100644
--- a/lex/.depend
+++ b/lex/.depend
@@ -1,34 +1,34 @@
-common.cmi: syntax.cmi lexgen.cmi
-compact.cmi: lexgen.cmi
-cset.cmi:
-lexer.cmi: parser.cmi
-lexgen.cmi: syntax.cmi
-output.cmi: syntax.cmi lexgen.cmi compact.cmi common.cmi
-outputbis.cmi: syntax.cmi lexgen.cmi common.cmi
-parser.cmi: syntax.cmi
-syntax.cmi: cset.cmi
-table.cmi:
-common.cmo: syntax.cmi lexgen.cmi common.cmi
-common.cmx: syntax.cmx lexgen.cmx common.cmi
-compact.cmo: table.cmi lexgen.cmi compact.cmi
-compact.cmx: table.cmx lexgen.cmx compact.cmi
-cset.cmo: cset.cmi
-cset.cmx: cset.cmi
-lexer.cmo: syntax.cmi parser.cmi lexer.cmi
-lexer.cmx: syntax.cmx parser.cmx lexer.cmi
-lexgen.cmo: table.cmi syntax.cmi cset.cmi lexgen.cmi
-lexgen.cmx: table.cmx syntax.cmx cset.cmx lexgen.cmi
-main.cmo: syntax.cmi parser.cmi outputbis.cmi output.cmi lexgen.cmi lexer.cmi \
- cset.cmi compact.cmi common.cmi
-main.cmx: syntax.cmx parser.cmx outputbis.cmx output.cmx lexgen.cmx lexer.cmx \
- cset.cmx compact.cmx common.cmx
-output.cmo: syntax.cmi lexgen.cmi compact.cmi common.cmi output.cmi
-output.cmx: syntax.cmx lexgen.cmx compact.cmx common.cmx output.cmi
-outputbis.cmo: syntax.cmi lexgen.cmi common.cmi outputbis.cmi
-outputbis.cmx: syntax.cmx lexgen.cmx common.cmx outputbis.cmi
-parser.cmo: syntax.cmi cset.cmi parser.cmi
-parser.cmx: syntax.cmx cset.cmx parser.cmi
-syntax.cmo: cset.cmi syntax.cmi
-syntax.cmx: cset.cmx syntax.cmi
-table.cmo: table.cmi
-table.cmx: table.cmi
+common.cmi : syntax.cmi lexgen.cmi
+compact.cmi : lexgen.cmi
+cset.cmi :
+lexer.cmi : parser.cmi
+lexgen.cmi : syntax.cmi
+output.cmi : syntax.cmi lexgen.cmi compact.cmi common.cmi
+outputbis.cmi : syntax.cmi lexgen.cmi common.cmi
+parser.cmi : syntax.cmi
+syntax.cmi : cset.cmi
+table.cmi :
+common.cmo : syntax.cmi lexgen.cmi common.cmi
+common.cmx : syntax.cmx lexgen.cmx common.cmi
+compact.cmo : table.cmi lexgen.cmi compact.cmi
+compact.cmx : table.cmx lexgen.cmx compact.cmi
+cset.cmo : cset.cmi
+cset.cmx : cset.cmi
+lexer.cmo : syntax.cmi parser.cmi lexer.cmi
+lexer.cmx : syntax.cmx parser.cmx lexer.cmi
+lexgen.cmo : table.cmi syntax.cmi cset.cmi lexgen.cmi
+lexgen.cmx : table.cmx syntax.cmx cset.cmx lexgen.cmi
+main.cmo : syntax.cmi parser.cmi outputbis.cmi output.cmi lexgen.cmi \
+ lexer.cmi cset.cmi compact.cmi common.cmi
+main.cmx : syntax.cmx parser.cmx outputbis.cmx output.cmx lexgen.cmx \
+ lexer.cmx cset.cmx compact.cmx common.cmx
+output.cmo : syntax.cmi lexgen.cmi compact.cmi common.cmi output.cmi
+output.cmx : syntax.cmx lexgen.cmx compact.cmx common.cmx output.cmi
+outputbis.cmo : syntax.cmi lexgen.cmi common.cmi outputbis.cmi
+outputbis.cmx : syntax.cmx lexgen.cmx common.cmx outputbis.cmi
+parser.cmo : syntax.cmi cset.cmi parser.cmi
+parser.cmx : syntax.cmx cset.cmx parser.cmi
+syntax.cmo : cset.cmi syntax.cmi
+syntax.cmx : cset.cmx syntax.cmi
+table.cmo : table.cmi
+table.cmx : table.cmi
diff --git a/man/Makefile b/man/Makefile
index e6c1e193b..4c0cb8191 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -20,3 +20,4 @@ install:
for i in *.m; do cp $$i $(DIR)/`basename $$i .m`.$(MANEXT); done
echo '.so man$(MANEXT)/ocamlc.$(MANEXT)' > $(DIR)/ocamlc.opt.$(MANEXT)
echo '.so man$(MANEXT)/ocamlopt.$(MANEXT)' > $(DIR)/ocamlopt.opt.$(MANEXT)
+ echo '.so man$(MANEXT)/ocamlcp.$(MANEXT)' > $(DIR)/ocamloptp.$(MANEXT)
diff --git a/man/ocamlcp.m b/man/ocamlcp.m
index 0c9979f10..25dcf2836 100644
--- a/man/ocamlcp.m
+++ b/man/ocamlcp.m
@@ -12,10 +12,10 @@
.\"
.\" $Id$
.\"
-.TH OCAMLCP 1
+.TH "OCAMLCP" 1
.SH NAME
-ocamlcp \- The OCaml profiling compiler
+ocamlcp, ocamloptp \- The OCaml profiling compilers
.SH SYNOPSIS
.B ocamlcp
@@ -23,36 +23,62 @@ ocamlcp \- The OCaml profiling compiler
.I ocamlc options
]
[
-.BI \-p \ flags
+.BI \-P \ flags
+]
+.I filename ...
+
+.B ocamloptp
+[
+.I ocamlopt options
+]
+[
+.BI \-P \ flags
]
.I filename ...
.SH DESCRIPTION
The
.B ocamlcp
-command is a front-end to
+and
+.B ocamloptp
+commands are front-ends to
.BR ocamlc (1)
-that instruments the source code, adding code to record how many times
-functions are called, branches of conditionals are taken, ...
+and
+.BR ocamlopt (1)
+that instrument the source code, adding code to record how many times
+functions are called, branches of conditionals are taken, etc.
Execution of instrumented code produces an execution profile in the
file ocamlprof.dump, which can be read using
.BR ocamlprof (1).
.B ocamlcp
accepts the same arguments and options as
-.BR ocamlc (1).
+.BR ocamlc (1)
+and
+.B ocamloptp
+accepts the same arguments and options as
+.BR ocamlopt (1).
+There is only one exception: in both cases, the
+.B \-pp
+option is not supported. If you need to preprocess your source files,
+you will have to do it separately before calling
+.B ocamlcp
+or
+.BR ocamloptp .
.SH OPTIONS
In addition to the
.BR ocamlc (1)
+or
+.BR ocamlopt (1)
options,
.B ocamlcp
-accepts the following option controlling the amount of profiling
-information:
-.TP
-.BI \-p \ letters
-The
+and
+.B ocamloptp
+accept one option to control the kind of profiling information, the
+.BI \-P \ letters
+option. The
.I letters
indicate which parts of the program should be profiled:
.TP
@@ -69,7 +95,7 @@ count points are set in both
branches
.TP
.B l
-\BR while , \ for
+.BR while , \ for
loops: a count point is set at the beginning of the loop body
.TP
.B m
@@ -84,27 +110,31 @@ branch of an exception catcher
.PP
For instance, compiling with
-.B ocamlcp\ \-pfilm
+.B ocamlcp \-P film
profiles function calls,
.BR if \ ... \ then \ ... \ else \ ...,
loops, and pattern matching.
Calling
.BR ocamlcp (1)
+or
+.BR ocamloptp (1)
without the
-.B \-p
+.B \-P
option defaults to
-.B \-p\ fm
+.BR \-P\ fm ,
meaning that only function calls and pattern matching are profiled.
-Note: due to the implementation of streams and stream patterns as
-syntactic sugar, it is hard to predict what parts of stream expressions
-and patterns will be profiled by a given flag. To profile a program with
-streams, we recommend using
-.BR ocamlcp\ \-p\ a .
+Note: for compatibility with previous versions,
+.BR ocamlcp (1)
+also accepts the option
+.B \-p
+with the same argument and meaning as
+.BR \-P .
.SH SEE ALSO
.BR ocamlc (1),
+.BR ocamlopt (1),
.BR ocamlprof (1).
.br
.IR "The OCaml user's manual" ,
diff --git a/man/ocamlopt.m b/man/ocamlopt.m
index d3bb2dab8..513e8dbf6 100644
--- a/man/ocamlopt.m
+++ b/man/ocamlopt.m
@@ -151,7 +151,7 @@ If
options are passed on the command
line, these options are stored in the resulting .cmxa library. Then,
linking with this library automatically adds back the
-\BR \-cclib \ and \ \-ccopt
+.BR \-cclib \ and \ \-ccopt
options as if they had been provided on the
command line, unless the
.B \-noautolink
diff --git a/ocamldoc/.depend b/ocamldoc/.depend
index 6467d445b..f8e0d3570 100644
--- a/ocamldoc/.depend
+++ b/ocamldoc/.depend
@@ -1,12 +1,12 @@
-odoc.cmo: ../typing/typedtree.cmi odoc_messages.cmo odoc_info.cmi \
+odoc.cmo : ../typing/typedtree.cmi odoc_messages.cmo odoc_info.cmi \
odoc_global.cmi odoc_gen.cmi odoc_config.cmi odoc_args.cmi \
odoc_analyse.cmi ../utils/misc.cmi ../utils/config.cmi \
../utils/clflags.cmi
-odoc.cmx: ../typing/typedtree.cmx odoc_messages.cmx odoc_info.cmx \
+odoc.cmx : ../typing/typedtree.cmx odoc_messages.cmx odoc_info.cmx \
odoc_global.cmx odoc_gen.cmx odoc_config.cmx odoc_args.cmx \
odoc_analyse.cmx ../utils/misc.cmx ../utils/config.cmx \
../utils/clflags.cmx
-odoc_analyse.cmo: ../utils/warnings.cmi ../typing/typetexp.cmi \
+odoc_analyse.cmo : ../utils/warnings.cmi ../typing/typetexp.cmi \
../typing/types.cmi ../typing/typemod.cmi ../typing/typedtree.cmi \
../typing/typedecl.cmi ../typing/typecore.cmi ../typing/typeclass.cmi \
../bytecomp/translcore.cmi ../bytecomp/translclass.cmi \
@@ -16,9 +16,9 @@ odoc_analyse.cmo: ../utils/warnings.cmi ../typing/typetexp.cmi \
odoc_cross.cmi odoc_comments.cmi odoc_class.cmo odoc_ast.cmi \
../utils/misc.cmi ../parsing/location.cmi ../parsing/lexer.cmi \
../typing/includemod.cmi ../typing/env.cmi ../typing/ctype.cmi \
- ../utils/config.cmi ../utils/clflags.cmi ../utils/ccomp.cmi \
- odoc_analyse.cmi
-odoc_analyse.cmx: ../utils/warnings.cmx ../typing/typetexp.cmx \
+ ../utils/config.cmi ../typing/cmi_format.cmi ../utils/clflags.cmi \
+ ../utils/ccomp.cmi odoc_analyse.cmi
+odoc_analyse.cmx : ../utils/warnings.cmx ../typing/typetexp.cmx \
../typing/types.cmx ../typing/typemod.cmx ../typing/typedtree.cmx \
../typing/typedecl.cmx ../typing/typecore.cmx ../typing/typeclass.cmx \
../bytecomp/translcore.cmx ../bytecomp/translclass.cmx \
@@ -28,226 +28,229 @@ odoc_analyse.cmx: ../utils/warnings.cmx ../typing/typetexp.cmx \
odoc_cross.cmx odoc_comments.cmx odoc_class.cmx odoc_ast.cmx \
../utils/misc.cmx ../parsing/location.cmx ../parsing/lexer.cmx \
../typing/includemod.cmx ../typing/env.cmx ../typing/ctype.cmx \
- ../utils/config.cmx ../utils/clflags.cmx ../utils/ccomp.cmx \
- odoc_analyse.cmi
-odoc_args.cmo: odoc_types.cmi odoc_texi.cmo odoc_messages.cmo odoc_man.cmo \
+ ../utils/config.cmx ../typing/cmi_format.cmx ../utils/clflags.cmx \
+ ../utils/ccomp.cmx odoc_analyse.cmi
+odoc_args.cmo : odoc_types.cmi odoc_texi.cmo odoc_messages.cmo odoc_man.cmo \
odoc_latex.cmo odoc_html.cmo odoc_global.cmi odoc_gen.cmi odoc_dot.cmo \
odoc_config.cmi ../utils/misc.cmi ../utils/config.cmi odoc_args.cmi
-odoc_args.cmx: odoc_types.cmx odoc_texi.cmx odoc_messages.cmx odoc_man.cmx \
+odoc_args.cmx : odoc_types.cmx odoc_texi.cmx odoc_messages.cmx odoc_man.cmx \
odoc_latex.cmx odoc_html.cmx odoc_global.cmx odoc_gen.cmx odoc_dot.cmx \
odoc_config.cmx ../utils/misc.cmx ../utils/config.cmx odoc_args.cmi
-odoc_ast.cmo: ../typing/types.cmi ../typing/typedtree.cmi \
+odoc_ast.cmo : ../typing/types.cmi ../typing/typedtree.cmi \
../typing/predef.cmi ../typing/path.cmi ../parsing/parsetree.cmi \
odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_sig.cmi \
odoc_parameter.cmo odoc_name.cmi odoc_module.cmo odoc_messages.cmo \
odoc_global.cmi odoc_exception.cmo odoc_env.cmi odoc_class.cmo \
../utils/misc.cmi ../parsing/location.cmi ../typing/ident.cmi \
../parsing/asttypes.cmi odoc_ast.cmi
-odoc_ast.cmx: ../typing/types.cmx ../typing/typedtree.cmx \
+odoc_ast.cmx : ../typing/types.cmx ../typing/typedtree.cmx \
../typing/predef.cmx ../typing/path.cmx ../parsing/parsetree.cmi \
odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_sig.cmx \
odoc_parameter.cmx odoc_name.cmx odoc_module.cmx odoc_messages.cmx \
odoc_global.cmx odoc_exception.cmx odoc_env.cmx odoc_class.cmx \
../utils/misc.cmx ../parsing/location.cmx ../typing/ident.cmx \
../parsing/asttypes.cmi odoc_ast.cmi
-odoc_class.cmo: ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
+odoc_class.cmo : ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
odoc_parameter.cmo odoc_name.cmi
-odoc_class.cmx: ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
+odoc_class.cmx : ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
odoc_parameter.cmx odoc_name.cmx
-odoc_comments.cmo: odoc_types.cmi odoc_text.cmi odoc_see_lexer.cmo \
+odoc_comments.cmo : odoc_types.cmi odoc_text.cmi odoc_see_lexer.cmo \
odoc_parser.cmi odoc_misc.cmi odoc_messages.cmo odoc_merge.cmi \
odoc_lexer.cmo odoc_global.cmi odoc_cross.cmi odoc_comments_global.cmi \
odoc_comments.cmi
-odoc_comments.cmx: odoc_types.cmx odoc_text.cmx odoc_see_lexer.cmx \
+odoc_comments.cmx : odoc_types.cmx odoc_text.cmx odoc_see_lexer.cmx \
odoc_parser.cmx odoc_misc.cmx odoc_messages.cmx odoc_merge.cmx \
odoc_lexer.cmx odoc_global.cmx odoc_cross.cmx odoc_comments_global.cmx \
odoc_comments.cmi
-odoc_comments_global.cmo: odoc_comments_global.cmi
-odoc_comments_global.cmx: odoc_comments_global.cmi
-odoc_config.cmo: ../utils/config.cmi odoc_config.cmi
-odoc_config.cmx: ../utils/config.cmx odoc_config.cmi
-odoc_control.cmo:
-odoc_control.cmx:
-odoc_cross.cmo: odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_search.cmi \
+odoc_comments_global.cmo : odoc_comments_global.cmi
+odoc_comments_global.cmx : odoc_comments_global.cmi
+odoc_config.cmo : ../utils/config.cmi odoc_config.cmi
+odoc_config.cmx : ../utils/config.cmx odoc_config.cmi
+odoc_control.cmo :
+odoc_control.cmx :
+odoc_cross.cmo : odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_search.cmi \
odoc_scan.cmo odoc_parameter.cmo odoc_name.cmi odoc_module.cmo \
odoc_misc.cmi odoc_messages.cmo odoc_global.cmi odoc_exception.cmo \
odoc_class.cmo odoc_cross.cmi
-odoc_cross.cmx: odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_search.cmx \
+odoc_cross.cmx : odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_search.cmx \
odoc_scan.cmx odoc_parameter.cmx odoc_name.cmx odoc_module.cmx \
odoc_misc.cmx odoc_messages.cmx odoc_global.cmx odoc_exception.cmx \
odoc_class.cmx odoc_cross.cmi
-odoc_dag2html.cmo: odoc_info.cmi odoc_dag2html.cmi
-odoc_dag2html.cmx: odoc_info.cmx odoc_dag2html.cmi
-odoc_dep.cmo: ../parsing/parsetree.cmi odoc_type.cmo odoc_print.cmi \
+odoc_dag2html.cmo : odoc_info.cmi odoc_dag2html.cmi
+odoc_dag2html.cmx : odoc_info.cmx odoc_dag2html.cmi
+odoc_dep.cmo : ../parsing/parsetree.cmi odoc_type.cmo odoc_print.cmi \
odoc_module.cmo ../tools/depend.cmi
-odoc_dep.cmx: ../parsing/parsetree.cmi odoc_type.cmx odoc_print.cmx \
+odoc_dep.cmx : ../parsing/parsetree.cmi odoc_type.cmx odoc_print.cmx \
odoc_module.cmx ../tools/depend.cmx
-odoc_dot.cmo: odoc_messages.cmo odoc_info.cmi
-odoc_dot.cmx: odoc_messages.cmx odoc_info.cmx
-odoc_env.cmo: ../typing/types.cmi ../typing/printtyp.cmi ../typing/predef.cmi \
- ../typing/path.cmi odoc_name.cmi ../typing/btype.cmi odoc_env.cmi
-odoc_env.cmx: ../typing/types.cmx ../typing/printtyp.cmx ../typing/predef.cmx \
- ../typing/path.cmx odoc_name.cmx ../typing/btype.cmx odoc_env.cmi
-odoc_exception.cmo: ../typing/types.cmi odoc_types.cmi odoc_name.cmi
-odoc_exception.cmx: ../typing/types.cmx odoc_types.cmx odoc_name.cmx
-odoc_gen.cmo: odoc_texi.cmo odoc_module.cmo odoc_man.cmo odoc_latex.cmo \
+odoc_dot.cmo : odoc_messages.cmo odoc_info.cmi
+odoc_dot.cmx : odoc_messages.cmx odoc_info.cmx
+odoc_env.cmo : ../typing/types.cmi ../typing/printtyp.cmi \
+ ../typing/predef.cmi ../typing/path.cmi odoc_name.cmi ../typing/btype.cmi \
+ odoc_env.cmi
+odoc_env.cmx : ../typing/types.cmx ../typing/printtyp.cmx \
+ ../typing/predef.cmx ../typing/path.cmx odoc_name.cmx ../typing/btype.cmx \
+ odoc_env.cmi
+odoc_exception.cmo : ../typing/types.cmi odoc_types.cmi odoc_name.cmi
+odoc_exception.cmx : ../typing/types.cmx odoc_types.cmx odoc_name.cmx
+odoc_gen.cmo : odoc_texi.cmo odoc_module.cmo odoc_man.cmo odoc_latex.cmo \
odoc_html.cmo odoc_dot.cmo odoc_gen.cmi
-odoc_gen.cmx: odoc_texi.cmx odoc_module.cmx odoc_man.cmx odoc_latex.cmx \
+odoc_gen.cmx : odoc_texi.cmx odoc_module.cmx odoc_man.cmx odoc_latex.cmx \
odoc_html.cmx odoc_dot.cmx odoc_gen.cmi
-odoc_global.cmo: odoc_types.cmi odoc_messages.cmo odoc_config.cmi \
+odoc_global.cmo : odoc_types.cmi odoc_messages.cmo odoc_config.cmi \
../utils/clflags.cmi odoc_global.cmi
-odoc_global.cmx: odoc_types.cmx odoc_messages.cmx odoc_config.cmx \
+odoc_global.cmx : odoc_types.cmx odoc_messages.cmx odoc_config.cmx \
../utils/clflags.cmx odoc_global.cmi
-odoc_html.cmo: odoc_text.cmi odoc_ocamlhtml.cmo odoc_messages.cmo \
+odoc_html.cmo : odoc_text.cmi odoc_ocamlhtml.cmo odoc_messages.cmo \
odoc_info.cmi odoc_global.cmi odoc_dag2html.cmi ../parsing/asttypes.cmi
-odoc_html.cmx: odoc_text.cmx odoc_ocamlhtml.cmx odoc_messages.cmx \
+odoc_html.cmx : odoc_text.cmx odoc_ocamlhtml.cmx odoc_messages.cmx \
odoc_info.cmx odoc_global.cmx odoc_dag2html.cmx ../parsing/asttypes.cmi
-odoc_info.cmo: ../typing/printtyp.cmi odoc_value.cmo odoc_types.cmi \
+odoc_info.cmo : ../typing/printtyp.cmi odoc_value.cmo odoc_types.cmi \
odoc_type.cmo odoc_text.cmi odoc_str.cmi odoc_search.cmi odoc_scan.cmo \
odoc_print.cmi odoc_parameter.cmo odoc_name.cmi odoc_module.cmo \
odoc_misc.cmi odoc_global.cmi odoc_exception.cmo odoc_dep.cmo \
odoc_config.cmi odoc_comments.cmi odoc_class.cmo odoc_analyse.cmi \
- odoc_info.cmi
-odoc_info.cmx: ../typing/printtyp.cmx odoc_value.cmx odoc_types.cmx \
+ ../parsing/location.cmi odoc_info.cmi
+odoc_info.cmx : ../typing/printtyp.cmx odoc_value.cmx odoc_types.cmx \
odoc_type.cmx odoc_text.cmx odoc_str.cmx odoc_search.cmx odoc_scan.cmx \
odoc_print.cmx odoc_parameter.cmx odoc_name.cmx odoc_module.cmx \
odoc_misc.cmx odoc_global.cmx odoc_exception.cmx odoc_dep.cmx \
odoc_config.cmx odoc_comments.cmx odoc_class.cmx odoc_analyse.cmx \
- odoc_info.cmi
-odoc_inherit.cmo:
-odoc_inherit.cmx:
-odoc_latex.cmo: odoc_to_text.cmo odoc_messages.cmo odoc_latex_style.cmo \
+ ../parsing/location.cmx odoc_info.cmi
+odoc_inherit.cmo :
+odoc_inherit.cmx :
+odoc_latex.cmo : odoc_to_text.cmo odoc_messages.cmo odoc_latex_style.cmo \
odoc_info.cmi ../parsing/asttypes.cmi
-odoc_latex.cmx: odoc_to_text.cmx odoc_messages.cmx odoc_latex_style.cmx \
+odoc_latex.cmx : odoc_to_text.cmx odoc_messages.cmx odoc_latex_style.cmx \
odoc_info.cmx ../parsing/asttypes.cmi
-odoc_latex_style.cmo:
-odoc_latex_style.cmx:
-odoc_lexer.cmo: odoc_parser.cmi odoc_messages.cmo odoc_global.cmi \
+odoc_latex_style.cmo :
+odoc_latex_style.cmx :
+odoc_lexer.cmo : odoc_parser.cmi odoc_messages.cmo odoc_global.cmi \
odoc_comments_global.cmi
-odoc_lexer.cmx: odoc_parser.cmx odoc_messages.cmx odoc_global.cmx \
+odoc_lexer.cmx : odoc_parser.cmx odoc_messages.cmx odoc_global.cmx \
odoc_comments_global.cmx
-odoc_man.cmo: odoc_str.cmi odoc_print.cmi odoc_misc.cmi odoc_messages.cmo \
+odoc_man.cmo : odoc_str.cmi odoc_print.cmi odoc_misc.cmi odoc_messages.cmo \
odoc_info.cmi ../parsing/asttypes.cmi
-odoc_man.cmx: odoc_str.cmx odoc_print.cmx odoc_misc.cmx odoc_messages.cmx \
+odoc_man.cmx : odoc_str.cmx odoc_print.cmx odoc_misc.cmx odoc_messages.cmx \
odoc_info.cmx ../parsing/asttypes.cmi
-odoc_merge.cmo: odoc_value.cmo odoc_types.cmi odoc_type.cmo \
+odoc_merge.cmo : odoc_value.cmo odoc_types.cmi odoc_type.cmo \
odoc_parameter.cmo odoc_name.cmi odoc_module.cmo odoc_messages.cmo \
odoc_global.cmi odoc_exception.cmo odoc_class.cmo odoc_merge.cmi
-odoc_merge.cmx: odoc_value.cmx odoc_types.cmx odoc_type.cmx \
+odoc_merge.cmx : odoc_value.cmx odoc_types.cmx odoc_type.cmx \
odoc_parameter.cmx odoc_name.cmx odoc_module.cmx odoc_messages.cmx \
odoc_global.cmx odoc_exception.cmx odoc_class.cmx odoc_merge.cmi
-odoc_messages.cmo: ../utils/config.cmi
-odoc_messages.cmx: ../utils/config.cmx
-odoc_misc.cmo: ../typing/types.cmi ../typing/predef.cmi ../typing/path.cmi \
+odoc_messages.cmo : ../utils/config.cmi
+odoc_messages.cmx : ../utils/config.cmx
+odoc_misc.cmo : ../typing/types.cmi ../typing/predef.cmi ../typing/path.cmi \
odoc_types.cmi odoc_messages.cmo ../parsing/longident.cmi \
../typing/ctype.cmi ../typing/btype.cmi odoc_misc.cmi
-odoc_misc.cmx: ../typing/types.cmx ../typing/predef.cmx ../typing/path.cmx \
+odoc_misc.cmx : ../typing/types.cmx ../typing/predef.cmx ../typing/path.cmx \
odoc_types.cmx odoc_messages.cmx ../parsing/longident.cmx \
../typing/ctype.cmx ../typing/btype.cmx odoc_misc.cmi
-odoc_module.cmo: ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
+odoc_module.cmo : ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
odoc_type.cmo odoc_name.cmi odoc_exception.cmo odoc_class.cmo
-odoc_module.cmx: ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
+odoc_module.cmx : ../typing/types.cmx odoc_value.cmx odoc_types.cmx \
odoc_type.cmx odoc_name.cmx odoc_exception.cmx odoc_class.cmx
-odoc_name.cmo: ../typing/path.cmi odoc_misc.cmi ../typing/ident.cmi \
+odoc_name.cmo : ../typing/path.cmi odoc_misc.cmi ../typing/ident.cmi \
odoc_name.cmi
-odoc_name.cmx: ../typing/path.cmx odoc_misc.cmx ../typing/ident.cmx \
+odoc_name.cmx : ../typing/path.cmx odoc_misc.cmx ../typing/ident.cmx \
odoc_name.cmi
-odoc_ocamlhtml.cmo:
-odoc_ocamlhtml.cmx:
-odoc_parameter.cmo: ../typing/types.cmi odoc_types.cmi
-odoc_parameter.cmx: ../typing/types.cmx odoc_types.cmx
-odoc_parser.cmo: odoc_types.cmi odoc_comments_global.cmi odoc_parser.cmi
-odoc_parser.cmx: odoc_types.cmx odoc_comments_global.cmx odoc_parser.cmi
-odoc_print.cmo: ../typing/types.cmi ../typing/printtyp.cmi odoc_print.cmi
-odoc_print.cmx: ../typing/types.cmx ../typing/printtyp.cmx odoc_print.cmi
-odoc_scan.cmo: odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_module.cmo \
+odoc_ocamlhtml.cmo :
+odoc_ocamlhtml.cmx :
+odoc_parameter.cmo : ../typing/types.cmi odoc_types.cmi
+odoc_parameter.cmx : ../typing/types.cmx odoc_types.cmx
+odoc_parser.cmo : odoc_types.cmi odoc_comments_global.cmi odoc_parser.cmi
+odoc_parser.cmx : odoc_types.cmx odoc_comments_global.cmx odoc_parser.cmi
+odoc_print.cmo : ../typing/types.cmi ../typing/printtyp.cmi odoc_print.cmi
+odoc_print.cmx : ../typing/types.cmx ../typing/printtyp.cmx odoc_print.cmi
+odoc_scan.cmo : odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_module.cmo \
odoc_exception.cmo odoc_class.cmo
-odoc_scan.cmx: odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_module.cmx \
+odoc_scan.cmx : odoc_value.cmx odoc_types.cmx odoc_type.cmx odoc_module.cmx \
odoc_exception.cmx odoc_class.cmx
-odoc_search.cmo: odoc_value.cmo odoc_types.cmi odoc_type.cmo \
+odoc_search.cmo : odoc_value.cmo odoc_types.cmi odoc_type.cmo \
odoc_parameter.cmo odoc_name.cmi odoc_module.cmo odoc_exception.cmo \
odoc_class.cmo odoc_search.cmi
-odoc_search.cmx: odoc_value.cmx odoc_types.cmx odoc_type.cmx \
+odoc_search.cmx : odoc_value.cmx odoc_types.cmx odoc_type.cmx \
odoc_parameter.cmx odoc_name.cmx odoc_module.cmx odoc_exception.cmx \
odoc_class.cmx odoc_search.cmi
-odoc_see_lexer.cmo: odoc_parser.cmi
-odoc_see_lexer.cmx: odoc_parser.cmx
-odoc_sig.cmo: ../typing/types.cmi ../typing/typedtree.cmi ../typing/path.cmi \
- ../parsing/parsetree.cmi odoc_value.cmo odoc_types.cmi odoc_type.cmo \
- odoc_parameter.cmo odoc_name.cmi odoc_module.cmo odoc_misc.cmi \
- odoc_messages.cmo odoc_merge.cmi odoc_global.cmi odoc_exception.cmo \
- odoc_env.cmi odoc_class.cmo ../utils/misc.cmi ../parsing/location.cmi \
- ../typing/btype.cmi ../parsing/asttypes.cmi odoc_sig.cmi
-odoc_sig.cmx: ../typing/types.cmx ../typing/typedtree.cmx ../typing/path.cmx \
- ../parsing/parsetree.cmi odoc_value.cmx odoc_types.cmx odoc_type.cmx \
- odoc_parameter.cmx odoc_name.cmx odoc_module.cmx odoc_misc.cmx \
- odoc_messages.cmx odoc_merge.cmx odoc_global.cmx odoc_exception.cmx \
- odoc_env.cmx odoc_class.cmx ../utils/misc.cmx ../parsing/location.cmx \
- ../typing/btype.cmx ../parsing/asttypes.cmi odoc_sig.cmi
-odoc_str.cmo: ../typing/types.cmi ../typing/printtyp.cmi odoc_value.cmo \
+odoc_see_lexer.cmo : odoc_parser.cmi
+odoc_see_lexer.cmx : odoc_parser.cmx
+odoc_sig.cmo : ../typing/types.cmi ../typing/typedtree.cmi \
+ ../typing/path.cmi ../parsing/parsetree.cmi odoc_value.cmo odoc_types.cmi \
+ odoc_type.cmo odoc_parameter.cmo odoc_name.cmi odoc_module.cmo \
+ odoc_misc.cmi odoc_messages.cmo odoc_merge.cmi odoc_global.cmi \
+ odoc_exception.cmo odoc_env.cmi odoc_class.cmo ../utils/misc.cmi \
+ ../parsing/location.cmi ../typing/ident.cmi ../typing/btype.cmi \
+ ../parsing/asttypes.cmi odoc_sig.cmi
+odoc_sig.cmx : ../typing/types.cmx ../typing/typedtree.cmx \
+ ../typing/path.cmx ../parsing/parsetree.cmi odoc_value.cmx odoc_types.cmx \
+ odoc_type.cmx odoc_parameter.cmx odoc_name.cmx odoc_module.cmx \
+ odoc_misc.cmx odoc_messages.cmx odoc_merge.cmx odoc_global.cmx \
+ odoc_exception.cmx odoc_env.cmx odoc_class.cmx ../utils/misc.cmx \
+ ../parsing/location.cmx ../typing/ident.cmx ../typing/btype.cmx \
+ ../parsing/asttypes.cmi odoc_sig.cmi
+odoc_str.cmo : ../typing/types.cmi ../typing/printtyp.cmi odoc_value.cmo \
odoc_type.cmo odoc_print.cmi odoc_name.cmi odoc_misc.cmi \
odoc_messages.cmo odoc_exception.cmo odoc_class.cmo \
../parsing/asttypes.cmi odoc_str.cmi
-odoc_str.cmx: ../typing/types.cmx ../typing/printtyp.cmx odoc_value.cmx \
+odoc_str.cmx : ../typing/types.cmx ../typing/printtyp.cmx odoc_value.cmx \
odoc_type.cmx odoc_print.cmx odoc_name.cmx odoc_misc.cmx \
odoc_messages.cmx odoc_exception.cmx odoc_class.cmx \
../parsing/asttypes.cmi odoc_str.cmi
-odoc_test.cmo: odoc_info.cmi odoc_gen.cmi odoc_args.cmi
-odoc_test.cmx: odoc_info.cmx odoc_gen.cmx odoc_args.cmx
-odoc_texi.cmo: odoc_to_text.cmo odoc_messages.cmo odoc_info.cmi \
- ../parsing/asttypes.cmi
-odoc_texi.cmx: odoc_to_text.cmx odoc_messages.cmx odoc_info.cmx \
- ../parsing/asttypes.cmi
-odoc_text.cmo: odoc_types.cmi odoc_text_parser.cmi odoc_text_lexer.cmo \
+odoc_test.cmo : odoc_info.cmi odoc_gen.cmi odoc_args.cmi
+odoc_test.cmx : odoc_info.cmx odoc_gen.cmx odoc_args.cmx
+odoc_texi.cmo : ../typing/types.cmi odoc_to_text.cmo odoc_messages.cmo \
+ odoc_info.cmi ../parsing/asttypes.cmi
+odoc_texi.cmx : ../typing/types.cmx odoc_to_text.cmx odoc_messages.cmx \
+ odoc_info.cmx ../parsing/asttypes.cmi
+odoc_text.cmo : odoc_types.cmi odoc_text_parser.cmi odoc_text_lexer.cmo \
odoc_text.cmi
-odoc_text.cmx: odoc_types.cmx odoc_text_parser.cmx odoc_text_lexer.cmx \
+odoc_text.cmx : odoc_types.cmx odoc_text_parser.cmx odoc_text_lexer.cmx \
odoc_text.cmi
-odoc_text_lexer.cmo: odoc_text_parser.cmi odoc_misc.cmi
-odoc_text_lexer.cmx: odoc_text_parser.cmx odoc_misc.cmx
-odoc_text_parser.cmo: odoc_types.cmi odoc_misc.cmi odoc_text_parser.cmi
-odoc_text_parser.cmx: odoc_types.cmx odoc_misc.cmx odoc_text_parser.cmi
-odoc_to_text.cmo: odoc_module.cmo odoc_messages.cmo odoc_info.cmi
-odoc_to_text.cmx: odoc_module.cmx odoc_messages.cmx odoc_info.cmx
-odoc_type.cmo: ../typing/types.cmi odoc_types.cmi odoc_name.cmi \
+odoc_text_lexer.cmo : odoc_text_parser.cmi odoc_misc.cmi
+odoc_text_lexer.cmx : odoc_text_parser.cmx odoc_misc.cmx
+odoc_text_parser.cmo : odoc_types.cmi odoc_misc.cmi odoc_text_parser.cmi
+odoc_text_parser.cmx : odoc_types.cmx odoc_misc.cmx odoc_text_parser.cmi
+odoc_to_text.cmo : odoc_module.cmo odoc_messages.cmo odoc_info.cmi
+odoc_to_text.cmx : odoc_module.cmx odoc_messages.cmx odoc_info.cmx
+odoc_type.cmo : ../typing/types.cmi odoc_types.cmi odoc_name.cmi \
../parsing/asttypes.cmi
-odoc_type.cmx: ../typing/types.cmx odoc_types.cmx odoc_name.cmx \
+odoc_type.cmx : ../typing/types.cmx odoc_types.cmx odoc_name.cmx \
../parsing/asttypes.cmi
-odoc_types.cmo: odoc_messages.cmo odoc_types.cmi
-odoc_types.cmx: odoc_messages.cmx odoc_types.cmi
-odoc_value.cmo: ../typing/types.cmi ../typing/printtyp.cmi odoc_types.cmi \
+odoc_types.cmo : odoc_messages.cmo ../parsing/location.cmi odoc_types.cmi
+odoc_types.cmx : odoc_messages.cmx ../parsing/location.cmx odoc_types.cmi
+odoc_value.cmo : ../typing/types.cmi ../typing/printtyp.cmi odoc_types.cmi \
odoc_parameter.cmo odoc_name.cmi
-odoc_value.cmx: ../typing/types.cmx ../typing/printtyp.cmx odoc_types.cmx \
+odoc_value.cmx : ../typing/types.cmx ../typing/printtyp.cmx odoc_types.cmx \
odoc_parameter.cmx odoc_name.cmx
-t.cmo:
-t.cmx:
-odoc_analyse.cmi: odoc_module.cmo odoc_global.cmi
-odoc_args.cmi: odoc_gen.cmi
-odoc_ast.cmi: ../typing/types.cmi ../typing/typedtree.cmi ../typing/path.cmi \
- ../parsing/parsetree.cmi odoc_sig.cmi odoc_name.cmi odoc_module.cmo
-odoc_comments.cmi: odoc_types.cmi odoc_module.cmo
-odoc_comments_global.cmi:
-odoc_config.cmi:
-odoc_cross.cmi: odoc_types.cmi odoc_module.cmo
-odoc_dag2html.cmi: odoc_info.cmi
-odoc_env.cmi: ../typing/types.cmi odoc_name.cmi
-odoc_gen.cmi: odoc_texi.cmo odoc_module.cmo odoc_man.cmo odoc_latex.cmo \
+odoc_analyse.cmi : odoc_module.cmo odoc_global.cmi
+odoc_args.cmi : odoc_gen.cmi
+odoc_ast.cmi : ../typing/types.cmi ../typing/typedtree.cmi \
+ ../typing/path.cmi ../parsing/parsetree.cmi odoc_sig.cmi odoc_name.cmi \
+ odoc_module.cmo
+odoc_comments.cmi : odoc_types.cmi odoc_module.cmo
+odoc_comments_global.cmi :
+odoc_config.cmi :
+odoc_cross.cmi : odoc_types.cmi odoc_module.cmo
+odoc_dag2html.cmi : odoc_info.cmi
+odoc_env.cmi : ../typing/types.cmi odoc_name.cmi
+odoc_gen.cmi : odoc_texi.cmo odoc_module.cmo odoc_man.cmo odoc_latex.cmo \
odoc_html.cmo odoc_dot.cmo
-odoc_global.cmi: odoc_types.cmi
-odoc_info.cmi: ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
+odoc_global.cmi : odoc_types.cmi
+odoc_info.cmi : ../typing/types.cmi odoc_value.cmo odoc_types.cmi \
odoc_type.cmo odoc_search.cmi odoc_parameter.cmo odoc_module.cmo \
- odoc_global.cmi odoc_exception.cmo odoc_class.cmo
-odoc_merge.cmi: odoc_types.cmi odoc_module.cmo
-odoc_misc.cmi: ../typing/types.cmi odoc_types.cmi ../parsing/longident.cmi
-odoc_name.cmi: ../typing/path.cmi ../parsing/longident.cmi \
+ odoc_global.cmi odoc_exception.cmo odoc_class.cmo ../parsing/location.cmi
+odoc_merge.cmi : odoc_types.cmi odoc_module.cmo
+odoc_misc.cmi : ../typing/types.cmi odoc_types.cmi ../parsing/longident.cmi
+odoc_name.cmi : ../typing/path.cmi ../parsing/longident.cmi \
../typing/ident.cmi
-odoc_parser.cmi: odoc_types.cmi
-odoc_print.cmi: ../typing/types.cmi
-odoc_search.cmi: odoc_value.cmo odoc_types.cmi odoc_type.cmo odoc_module.cmo \
- odoc_exception.cmo odoc_class.cmo
-odoc_sig.cmi: ../typing/types.cmi ../parsing/parsetree.cmi odoc_types.cmi \
+odoc_parser.cmi : odoc_types.cmi
+odoc_print.cmi : ../typing/types.cmi
+odoc_search.cmi : odoc_value.cmo odoc_types.cmi odoc_type.cmo \
+ odoc_module.cmo odoc_exception.cmo odoc_class.cmo
+odoc_sig.cmi : ../typing/types.cmi ../parsing/parsetree.cmi odoc_types.cmi \
odoc_type.cmo odoc_name.cmi odoc_module.cmo odoc_env.cmi odoc_class.cmo
-odoc_str.cmi: ../typing/types.cmi odoc_value.cmo odoc_type.cmo \
+odoc_str.cmi : ../typing/types.cmi odoc_value.cmo odoc_type.cmo \
odoc_exception.cmo odoc_class.cmo
-odoc_text.cmi: odoc_types.cmi
-odoc_text_parser.cmi: odoc_types.cmi
-odoc_types.cmi:
+odoc_text.cmi : odoc_types.cmi
+odoc_text_parser.cmi : odoc_types.cmi
+odoc_types.cmi : ../parsing/location.cmi
diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile
index 245f6f873..c7e85f2ac 100644
--- a/ocamldoc/Makefile
+++ b/ocamldoc/Makefile
@@ -50,7 +50,9 @@ ODOC_TEST=odoc_test.cmo
GENERATORS_CMOS= \
generators/odoc_todo.cmo \
generators/odoc_literate.cmo
-GENERATORS_CMXS=$(GENERATORS_CMOS:.cmo=.cmxs)
+GENERATORS_CMXS_TMP1=$(GENERATORS_CMOS:.cmo=.cmxs)
+GENERATORS_CMXS_TMP2=$(NATDYNLINK:false=)
+GENERATORS_CMXS=$(GENERATORS_CMXS_TMP2:true=$(GENERATORS_CMXS_TMP1))
# Compilation
@@ -214,12 +216,12 @@ debug:
$(OCAMLDOC): $(EXECMOFILES)
$(OCAMLC) -o $@ -linkall unix.cma str.cma dynlink.cma $(LINKFLAGS) $(OCAMLCMOFILES) $(EXECMOFILES)
$(OCAMLDOC_OPT): $(EXECMXFILES)
- $(OCAMLOPT) -o $@ unix.cmxa str.cmxa dynlink.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES)
+ $(OCAMLOPT) -o $@ -linkall unix.cmxa str.cmxa dynlink.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES)
$(OCAMLDOC_LIBCMA): $(LIBCMOFILES)
- $(OCAMLC) -a -o $@ $(LINKFLAGS) $(OCAMLCMOFILES) $(LIBCMOFILES)
+ $(OCAMLC) -a -o $@ $(LINKFLAGS) $(OCAMLSRCDIR)/tools/depend.cmo $(LIBCMOFILES)
$(OCAMLDOC_LIBCMXA): $(LIBCMXFILES)
- $(OCAMLOPT) -a -o $@ $(LINKFLAGS) $(OCAMLCMXFILES) $(LIBCMXFILES)
+ $(OCAMLOPT) -a -o $@ $(LINKFLAGS) $(OCAMLSRCDIR)/tools/depend.cmx $(LIBCMXFILES)
manpages: stdlib_man/Pervasives.3o
@@ -309,6 +311,13 @@ test_stdlib: dummy
../otherlibs/unix/unix.mli \
../otherlibs/str/str.mli
+test_stdlib_code: dummy
+ $(MKDIR) $@
+ $(OCAMLDOC_RUN) -html -colorize-code -sort -d $@ $(INCLUDES) -dump $@/stdlib.odoc -keep-code \
+ `ls ../stdlib/*.ml | grep -v Labels` \
+ ../otherlibs/unix/unix.ml \
+ ../otherlibs/str/str.ml
+
test_framed: dummy
$(MKDIR) $@
$(OCAMLDOC_RUN) -g odoc_fhtml.cmo -sort -colorize-code -d $@ $(INCLUDES) odoc*.ml odoc*.mli
diff --git a/ocamldoc/odoc_analyse.ml b/ocamldoc/odoc_analyse.ml
index b1f47c31a..cc0cf57b2 100644
--- a/ocamldoc/odoc_analyse.ml
+++ b/ocamldoc/odoc_analyse.ml
@@ -251,7 +251,7 @@ let process_file ppf sourcefile =
[Odoc_module.Element_module_comment txt] ;
Odoc_module.m_loc =
{ Odoc_types.loc_impl = None ;
- Odoc_types.loc_inter = Some (file, 0) } ;
+ Odoc_types.loc_inter = Some (Location.in_file file) } ;
Odoc_module.m_top_deps = [] ;
Odoc_module.m_code = None ;
Odoc_module.m_code_intf = None ;
diff --git a/ocamldoc/odoc_args.ml b/ocamldoc/odoc_args.ml
index fa3cc3033..24cf08b50 100644
--- a/ocamldoc/odoc_args.ml
+++ b/ocamldoc/odoc_args.ml
@@ -17,6 +17,96 @@ module M = Odoc_messages
let current_generator = ref (None : Odoc_gen.generator option)
+let get_html_generator () =
+ match !current_generator with
+ None -> (module Odoc_html.Generator : Odoc_html.Html_generator)
+ | Some (Odoc_gen.Html m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "html")
+;;
+
+let get_latex_generator () =
+ match !current_generator with
+ None -> (module Odoc_latex.Generator : Odoc_latex.Latex_generator)
+ | Some (Odoc_gen.Latex m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "latex")
+;;
+
+let get_texi_generator () =
+ match !current_generator with
+ None -> (module Odoc_texi.Generator : Odoc_texi.Texi_generator)
+ | Some (Odoc_gen.Texi m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "texi")
+;;
+
+let get_man_generator () =
+ match !current_generator with
+ None -> (module Odoc_man.Generator : Odoc_man.Man_generator)
+ | Some (Odoc_gen.Man m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "man")
+;;
+
+let get_dot_generator () =
+ match !current_generator with
+ None -> (module Odoc_dot.Generator : Odoc_dot.Dot_generator)
+ | Some (Odoc_gen.Dot m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "dot")
+;;
+
+let get_base_generator () =
+ match !current_generator with
+ None -> (module Odoc_gen.Base_generator : Odoc_gen.Base)
+ | Some (Odoc_gen.Base m) -> m
+ | Some _ -> failwith (M.current_generator_is_not "base")
+;;
+
+let extend_html_generator f =
+ let current = get_html_generator () in
+ let module Current = (val current : Odoc_html.Html_generator) in
+ let module F = (val f : Odoc_gen.Html_functor) in
+ let module M = F(Current) in
+ current_generator := Some (Odoc_gen.Html (module M : Odoc_html.Html_generator))
+;;
+
+let extend_latex_generator f =
+ let current = get_latex_generator () in
+ let module Current = (val current : Odoc_latex.Latex_generator) in
+ let module F = (val f : Odoc_gen.Latex_functor) in
+ let module M = F(Current) in
+ current_generator := Some(Odoc_gen.Latex (module M : Odoc_latex.Latex_generator))
+;;
+
+let extend_texi_generator f =
+ let current = get_texi_generator () in
+ let module Current = (val current : Odoc_texi.Texi_generator) in
+ let module F = (val f : Odoc_gen.Texi_functor) in
+ let module M = F(Current) in
+ current_generator := Some(Odoc_gen.Texi (module M : Odoc_texi.Texi_generator))
+;;
+
+let extend_man_generator f =
+ let current = get_man_generator () in
+ let module Current = (val current : Odoc_man.Man_generator) in
+ let module F = (val f : Odoc_gen.Man_functor) in
+ let module M = F(Current) in
+ current_generator := Some(Odoc_gen.Man (module M : Odoc_man.Man_generator))
+;;
+
+let extend_dot_generator f =
+ let current = get_dot_generator () in
+ let module Current = (val current : Odoc_dot.Dot_generator) in
+ let module F = (val f : Odoc_gen.Dot_functor) in
+ let module M = F(Current) in
+ current_generator := Some (Odoc_gen.Dot (module M : Odoc_dot.Dot_generator))
+;;
+
+let extend_base_generator f =
+ let current = get_base_generator () in
+ let module Current = (val current : Odoc_gen.Base) in
+ let module F = (val f : Odoc_gen.Base_functor) in
+ let module M = F(Current) in
+ current_generator := Some (Odoc_gen.Base (module M : Odoc_gen.Base))
+;;
+
(** Analysis of a string defining options. Return the list of
options according to the list giving associations between
[(character, _)] and a list of options. *)
@@ -226,7 +316,7 @@ let help_action () =
let msg =
Arg.usage_string
(!options @ !help_options)
- (M.usage ^ M.options_are) in
+ (M.usage ^ M.options_are) in
print_string msg
let () =
help_options := [
diff --git a/ocamldoc/odoc_args.mli b/ocamldoc/odoc_args.mli
index 2f190ef75..1d55de747 100644
--- a/ocamldoc/odoc_args.mli
+++ b/ocamldoc/odoc_args.mli
@@ -19,6 +19,30 @@ val current_generator : Odoc_gen.generator option ref
(** To set the documentation generator. *)
val set_generator : Odoc_gen.generator -> unit
+(** Extend current HTML generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_html_generator : (module Odoc_gen.Html_functor) -> unit
+
+(** Extend current LaTeX generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_latex_generator : (module Odoc_gen.Latex_functor) -> unit
+
+(** Extend current Texi generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_texi_generator : (module Odoc_gen.Texi_functor) -> unit
+
+(** Extend current man generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_man_generator : (module Odoc_gen.Man_functor) -> unit
+
+(** Extend current dot generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_dot_generator : (module Odoc_gen.Dot_functor) -> unit
+
+(** Extend current base generator.
+ @raise Failure if another kind of generator is already set.*)
+val extend_base_generator : (module Odoc_gen.Base_functor) -> unit
+
(** Add an option specification. *)
val add_option : string * Arg.spec * string -> unit
diff --git a/ocamldoc/odoc_ast.ml b/ocamldoc/odoc_ast.ml
index 26f813cad..74fbb50f1 100644
--- a/ocamldoc/odoc_ast.ml
+++ b/ocamldoc/odoc_ast.ml
@@ -358,6 +358,13 @@ module Analyser =
let name_pre = Name.from_ident ident in
let name = Name.parens_if_infix name_pre in
let complete_name = Name.concat current_module_name name in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
(* create the value *)
let new_value = {
val_name = complete_name ;
@@ -365,8 +372,8 @@ module Analyser =
val_type = Odoc_env.subst_type env pat.Typedtree.pat_type ;
val_recursive = rec_flag = Asttypes.Recursive ;
val_parameters = tt_analyse_function_parameters env comment_opt pat_exp_list2 ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
}
in
[ new_value ]
@@ -376,14 +383,21 @@ module Analyser =
let name_pre = Name.from_ident ident in
let name = Name.parens_if_infix name_pre in
let complete_name = Name.concat current_module_name name in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
let new_value = {
val_name = complete_name ;
val_info = comment_opt ;
val_type = Odoc_env.subst_type env pat.Typedtree.pat_type ;
val_recursive = rec_flag = Asttypes.Recursive ;
val_parameters = [] ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
}
in
[ new_value ]
@@ -438,7 +452,7 @@ module Analyser =
| l ->
match l with
[] ->
- (* cas impossible, on l'a filtré avant *)
+ (* cas impossible, on l'a filtré avant *)
assert false
| (pattern_param, exp) :: second_ele :: q ->
(* implicit pattern matching -> anonymous parameter *)
@@ -553,27 +567,34 @@ module Analyser =
try
if virt then
Typedtree_search.search_virtual_attribute_type table
- (Name.simple current_class_name) label
+ (Name.simple current_class_name) label
else
Typedtree_search.search_attribute_type tt_cls label
with Not_found ->
raise (Failure (Odoc_messages.attribute_not_found_in_typedtree complete_name))
- in
- let att =
- {
- att_value = { val_name = complete_name ;
- val_info = info_opt ;
- val_type = Odoc_env.subst_type env type_exp ;
- val_recursive = false ;
- val_parameters = [] ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
- } ;
- att_mutable = mutable_flag = Asttypes.Mutable ;
- att_virtual = virt ;
- }
- in
- iter acc_inher (acc_fields @ ele_comments @ [ Class_attribute att ]) loc.Location.loc_end.Lexing.pos_cnum q
+ in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
+ let att =
+ {
+ att_value = { val_name = complete_name ;
+ val_info = info_opt ;
+ val_type = Odoc_env.subst_type env type_exp ;
+ val_recursive = false ;
+ val_parameters = [] ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ } ;
+ att_mutable = mutable_flag = Asttypes.Mutable ;
+ att_virtual = virt ;
+ }
+ in
+ iter acc_inher (acc_fields @ ele_comments @ [ Class_attribute att ]) loc.Location.loc_end.Lexing.pos_cnum q
| (Parsetree.Pcf_virt ({ txt = label }, private_flag, _)) ->
let complete_name = Name.concat current_class_name label in
@@ -584,64 +605,79 @@ module Analyser =
in
let real_type =
match met_type.Types.desc with
- Tarrow (_, _, t, _) ->
- t
- | _ ->
+ Tarrow (_, _, t, _) ->
+ t
+ | _ ->
(* ?!? : not an arrow type ! return the original type *)
- met_type
- in
- let met =
- {
- met_value = { val_name = complete_name ;
- val_info = info_opt ;
- val_type = Odoc_env.subst_type env real_type ;
- val_recursive = false ;
- val_parameters = [] ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
- } ;
- met_private = private_flag = Asttypes.Private ;
- met_virtual = true ;
- }
- in
- (* update the parameter description *)
- Odoc_value.update_value_parameters_text met.met_value;
+ met_type
+ in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
+ let met =
+ {
+ met_value = {
+ val_name = complete_name ;
+ val_info = info_opt ;
+ val_type = Odoc_env.subst_type env real_type ;
+ val_recursive = false ;
+ val_parameters = [] ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ } ;
+ met_private = private_flag = Asttypes.Private ;
+ met_virtual = true ;
+ }
+ in
+ (* update the parameter description *)
+ Odoc_value.update_value_parameters_text met.met_value;
- iter acc_inher (acc_fields @ ele_comments @ [ Class_method met ]) loc.Location.loc_end.Lexing.pos_cnum q
+ iter acc_inher (acc_fields @ ele_comments @ [ Class_method met ]) loc.Location.loc_end.Lexing.pos_cnum q
| (Parsetree.Pcf_meth ({ txt = label }, private_flag, _, _)) ->
let complete_name = Name.concat current_class_name label in
let (info_opt, ele_comments) = get_comments_in_class last_pos loc.Location.loc_start.Lexing.pos_cnum in
let exp =
try Typedtree_search.search_method_expression tt_cls label
- with Not_found -> raise (Failure (Odoc_messages.method_not_found_in_typedtree complete_name))
- in
- let real_type =
- match exp.exp_type.desc with
- Tarrow (_, _, t,_) ->
- t
- | _ ->
+ with Not_found -> raise (Failure (Odoc_messages.method_not_found_in_typedtree complete_name))
+ in
+ let real_type =
+ match exp.exp_type.desc with
+ Tarrow (_, _, t,_) ->
+ t
+ | _ ->
(* ?!? : not an arrow type ! return the original type *)
- exp.Typedtree.exp_type
- in
- let met =
- {
- met_value = { val_name = complete_name ;
- val_info = info_opt ;
- val_type = Odoc_env.subst_type env real_type ;
- val_recursive = false ;
- val_parameters = tt_analyse_method_expression env complete_name info_opt exp ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
- } ;
- met_private = private_flag = Asttypes.Private ;
- met_virtual = false ;
+ exp.Typedtree.exp_type
+ in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
+ let met =
+ {
+ met_value = { val_name = complete_name ;
+ val_info = info_opt ;
+ val_type = Odoc_env.subst_type env real_type ;
+ val_recursive = false ;
+ val_parameters = tt_analyse_method_expression env complete_name info_opt exp ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ } ;
+ met_private = private_flag = Asttypes.Private ;
+ met_virtual = false ;
}
- in
- (* update the parameter description *)
- Odoc_value.update_value_parameters_text met.met_value;
+ in
+ (* update the parameter description *)
+ Odoc_value.update_value_parameters_text met.met_value;
- iter acc_inher (acc_fields @ ele_comments @ [ Class_method met ]) loc.Location.loc_end.Lexing.pos_cnum q
+ iter acc_inher (acc_fields @ ele_comments @ [ Class_method met ]) loc.Location.loc_end.Lexing.pos_cnum q
| Parsetree.Pcf_constr (_, _) ->
(* don't give a $*%@ ! *)
@@ -664,7 +700,7 @@ module Analyser =
(* A VOIR : dommage qu'on n'ait pas un Tclass_ident :-( même quand on a class tutu = toto *)
Name.from_longident lid.txt
in
- (* On n'a pas ici les paramètres de type sous forme de Types.type_expr,
+ (* On n'a pas ici les paramètres de type sous forme de Types.type_expr,
par contre on peut les trouver dans le class_type *)
let params =
match tt_class_exp.Typedtree.cl_type with
@@ -749,7 +785,7 @@ module Analyser =
match tt_class_expr2.Typedtree.cl_desc with
Typedtree.Tcl_ident (p,_,_) -> Name.from_path p (* A VOIR : obtenir le nom complet *)
| _ ->
- (* A VOIR : dommage qu'on n'ait pas un Tclass_ident :-( même quand on a class tutu = toto *)
+ (* A VOIR : dommage qu'on n'ait pas un Tclass_ident :-( même quand on a class tutu = toto *)
match p_class_expr2.Parsetree.pcl_desc with
Parsetree.Pcl_constr (lid, _) ->
(* we try to get the name from the environment. *)
@@ -814,7 +850,8 @@ module Analyser =
let analyse_class env current_module_name comment_opt p_class_decl tt_type_params tt_class_exp table =
let name = p_class_decl.Parsetree.pci_name in
let complete_name = Name.concat current_module_name name.txt in
- let pos_start = p_class_decl.Parsetree.pci_expr.Parsetree.pcl_loc.Location.loc_start.Lexing.pos_cnum in
+ let loc = p_class_decl.Parsetree.pci_expr.Parsetree.pcl_loc in
+ let pos_start = loc.Location.loc_start.Lexing.pos_cnum in
let type_parameters = tt_type_params in
let virt = p_class_decl.Parsetree.pci_virt = Asttypes.Virtual in
let cltype = Odoc_env.subst_class_type env tt_class_exp.Typedtree.cl_type in
@@ -836,7 +873,7 @@ module Analyser =
cl_type_parameters = type_parameters ;
cl_kind = kind ;
cl_parameters = parameters ;
- cl_loc = { loc_impl = Some (!file_name, pos_start) ; loc_inter = None } ;
+ cl_loc = { loc_impl = Some loc ; loc_inter = None } ;
}
in
cl
@@ -1089,23 +1126,30 @@ module Analyser =
(0, new_env, l_ele)
| Parsetree.Pstr_primitive ({ txt = name_pre }, val_desc) ->
- (* of string * value_description *)
- print_DEBUG ("Parsetree.Pstr_primitive ("^name_pre^", ["^(String.concat ", " val_desc.Parsetree.pval_prim)^"]");
- let typ = Typedtree_search.search_primitive table name_pre in
- let name = Name.parens_if_infix name_pre in
- let complete_name = Name.concat current_module_name name in
- let new_value = {
- val_name = complete_name ;
- val_info = comment_opt ;
- val_type = Odoc_env.subst_type env typ ;
- val_recursive = false ;
- val_parameters = [] ;
- val_code = Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum loc.Location.loc_end.Lexing.pos_cnum) ;
- val_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
- }
- in
- let new_env = Odoc_env.add_value env new_value.val_name in
- (0, new_env, [Element_value new_value])
+ (* of string * value_description *)
+ print_DEBUG ("Parsetree.Pstr_primitive ("^name_pre^", ["^(String.concat ", " val_desc.Parsetree.pval_prim)^"]");
+ let typ = Typedtree_search.search_primitive table name_pre in
+ let name = Name.parens_if_infix name_pre in
+ let complete_name = Name.concat current_module_name name in
+ let code =
+ if !Odoc_global.keep_code then
+ Some (get_string_of_file loc.Location.loc_start.Lexing.pos_cnum
+ loc.Location.loc_end.Lexing.pos_cnum)
+ else
+ None
+ in
+ let new_value = {
+ val_name = complete_name ;
+ val_info = comment_opt ;
+ val_type = Odoc_env.subst_type env typ ;
+ val_recursive = false ;
+ val_parameters = [] ;
+ val_code = code ;
+ val_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ }
+ in
+ let new_env = Odoc_env.add_value env new_value.val_name in
+ (0, new_env, [Element_value new_value])
| Parsetree.Pstr_type name_typedecl_list ->
(* of (string * type_declaration) list *)
@@ -1124,14 +1168,15 @@ module Analyser =
[] -> (maybe_more_acc, [])
| ({ txt = name }, type_decl) :: q ->
let complete_name = Name.concat current_module_name name in
- let loc_start = type_decl.Parsetree.ptype_loc.Location.loc_start.Lexing.pos_cnum in
- let loc_end = type_decl.Parsetree.ptype_loc.Location.loc_end.Lexing.pos_cnum in
+ let loc = type_decl.Parsetree.ptype_loc in
+ let loc_start = loc.Location.loc_start.Lexing.pos_cnum in
+ let loc_end = loc.Location.loc_end.Lexing.pos_cnum in
let pos_limit2 =
match q with
- [] -> pos_limit
- | (_, td) :: _ -> td.Parsetree.ptype_loc.Location.loc_start.Lexing.pos_cnum
- in
- let (maybe_more, name_comment_list) =
+ [] -> pos_limit
+ | (_, td) :: _ -> td.Parsetree.ptype_loc.Location.loc_start.Lexing.pos_cnum
+ in
+ let (maybe_more, name_comment_list) =
Sig.name_comment_from_type_kind
loc_end
pos_limit2
@@ -1151,47 +1196,47 @@ module Analyser =
let kind = Sig.get_type_kind
new_env name_comment_list
tt_type_decl.Types.type_kind
- in
- let new_end = loc_end + maybe_more in
- let t =
- {
- ty_name = complete_name ;
- ty_info = com_opt ;
- ty_parameters =
+ in
+ let new_end = loc_end + maybe_more in
+ let t =
+ {
+ ty_name = complete_name ;
+ ty_info = com_opt ;
+ ty_parameters =
List.map2
- (fun p (co,cn,_) ->
- (Odoc_env.subst_type new_env p,
- co, cn)
- )
+ (fun p (co,cn,_) ->
+ (Odoc_env.subst_type new_env p,
+ co, cn)
+ )
tt_type_decl.Types.type_params
tt_type_decl.Types.type_variance ;
- ty_kind = kind ;
- ty_private = tt_type_decl.Types.type_private;
- ty_manifest =
- (match tt_type_decl.Types.type_manifest with
- None -> None
- | Some t -> Some (Odoc_env.subst_type new_env t));
- ty_loc = { loc_impl = Some (!file_name, loc_start) ; loc_inter = None } ;
- ty_code =
+ ty_kind = kind ;
+ ty_private = tt_type_decl.Types.type_private;
+ ty_manifest =
+ (match tt_type_decl.Types.type_manifest with
+ None -> None
+ | Some t -> Some (Odoc_env.subst_type new_env t));
+ ty_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ ty_code =
(
if !Odoc_global.keep_code then
Some (get_string_of_file loc_start new_end)
else
None
) ;
- }
- in
- let (maybe_more2, info_after_opt) =
- My_ir.just_after_special
+ }
+ in
+ let (maybe_more2, info_after_opt) =
+ My_ir.just_after_special
!file_name
(get_string_of_file new_end pos_limit2)
- in
- t.ty_info <- Sig.merge_infos t.ty_info info_after_opt ;
- let (maybe_more3, eles) = f (maybe_more + maybe_more2) (new_end + maybe_more2) q in
- (maybe_more3, ele_comments @ ((Element_type t) :: eles))
- in
- let (maybe_more, eles) = f ~first: true 0 loc.Location.loc_start.Lexing.pos_cnum name_typedecl_list in
- (maybe_more, new_env, eles)
+ in
+ t.ty_info <- Sig.merge_infos t.ty_info info_after_opt ;
+ let (maybe_more3, eles) = f (maybe_more + maybe_more2) (new_end + maybe_more2) q in
+ (maybe_more3, ele_comments @ ((Element_type t) :: eles))
+ in
+ let (maybe_more, eles) = f ~first: true 0 loc.Location.loc_start.Lexing.pos_cnum name_typedecl_list in
+ (maybe_more, new_env, eles)
| Parsetree.Pstr_exception (name, excep_decl) ->
(* a new exception is defined *)
@@ -1213,7 +1258,7 @@ module Analyser =
Odoc_env.subst_type new_env ctyp.ctyp_type)
tt_excep_decl.exn_params ;
ex_alias = None ;
- ex_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ ex_loc = { loc_impl = Some loc ; loc_inter = None } ;
ex_code =
(
if !Odoc_global.keep_code then
@@ -1242,7 +1287,7 @@ module Analyser =
ex_args = [] ;
ex_alias = Some { ea_name = (Odoc_env.full_exception_name env (Name.from_path tt_path)) ;
ea_ex = None ; } ;
- ex_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ ex_loc = { loc_impl = Some loc ; loc_inter = None } ;
ex_code = None ;
}
in
@@ -1369,7 +1414,7 @@ module Analyser =
mt_is_interface = false ;
mt_file = !file_name ;
mt_kind = Some kind ;
- mt_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ; loc_inter = None } ;
+ mt_loc = { loc_impl = Some loc ; loc_inter = None } ;
}
in
let new_env = Odoc_env.add_module_type env mt.mt_name in
@@ -1485,7 +1530,7 @@ module Analyser =
clt_type_parameters = List.map (Odoc_env.subst_type new_env) type_params ;
clt_virtual = virt ;
clt_kind = kind ;
- clt_loc = { loc_impl = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) ;
+ clt_loc = { loc_impl = Some loc ;
loc_inter = None } ;
}
in
@@ -1504,13 +1549,14 @@ module Analyser =
im_info = comment_opt ;
}
in
- (0, env, [ Element_included_module im ]) (* A VOIR : étendre l'environnement ? avec quoi ? *)
+ (0, env, [ Element_included_module im ]) (* A VOIR : étendre l'environnement ? avec quoi ? *)
(** Analysis of a [Parsetree.module_expr] and a name to return a [t_module].*)
and analyse_module env current_module_name module_name comment_opt p_module_expr tt_module_expr =
let complete_name = Name.concat current_module_name module_name in
- let pos_start = p_module_expr.Parsetree.pmod_loc.Location.loc_start.Lexing.pos_cnum in
- let pos_end = p_module_expr.Parsetree.pmod_loc.Location.loc_end.Lexing.pos_cnum in
+ let loc = p_module_expr.Parsetree.pmod_loc in
+ let pos_start = loc.Location.loc_start.Lexing.pos_cnum in
+ let pos_end = loc.Location.loc_end.Lexing.pos_cnum in
let modtype =
(* A VOIR : Odoc_env.subst_module_type env ? *)
tt_module_expr.Typedtree.mod_type
@@ -1532,7 +1578,7 @@ module Analyser =
m_is_interface = false ;
m_file = !file_name ;
m_kind = Module_struct [] ;
- m_loc = { loc_impl = Some (!file_name, pos_start) ; loc_inter = None } ;
+ m_loc = { loc_impl = Some loc ; loc_inter = None } ;
m_top_deps = [] ;
m_code = None ; (* code is set by the caller, after the module is created *)
m_code_intf = m_code_intf ;
@@ -1732,7 +1778,7 @@ module Analyser =
m_is_interface = false ;
m_file = !file_name ;
m_kind = kind ;
- m_loc = { loc_impl = Some (!file_name, 0) ; loc_inter = None } ;
+ m_loc = { loc_impl = Some (Location.in_file !file_name) ; loc_inter = None } ;
m_top_deps = [] ;
m_code = (if !Odoc_global.keep_code then Some !file else None) ;
m_code_intf = None ;
diff --git a/ocamldoc/odoc_class.ml b/ocamldoc/odoc_class.ml
index 676d0ebc3..28abf6703 100644
--- a/ocamldoc/odoc_class.ml
+++ b/ocamldoc/odoc_class.ml
@@ -115,7 +115,7 @@ let rec class_elements ?(trans=true) cl =
| Class_constraint (c_kind, ct_kind) ->
iter_kind c_kind
(* A VOIR : utiliser le c_kind ou le ct_kind ?
- Pour l'instant, comme le ct_kind n'est pas analysé,
+ Pour l'instant, comme le ct_kind n'est pas analysé,
on cherche dans le c_kind
class_type_elements ~trans: trans
{ clt_name = "" ; clt_info = None ;
diff --git a/ocamldoc/odoc_comments.ml b/ocamldoc/odoc_comments.ml
index ea5427e07..af524eefa 100644
--- a/ocamldoc/odoc_comments.ml
+++ b/ocamldoc/odoc_comments.ml
@@ -38,7 +38,7 @@ module Info_retriever =
| Odoc_text.Text_syntax (l, c, s) ->
raise (Failure (Odoc_messages.text_parse_error l c s))
| _ ->
- raise (Failure ("Erreur inconnue lors du parse de see : "^s))
+ raise (Failure ("Unknown error while parsing @see tag: "^s))
let retrieve_info fun_lex file (s : string) =
try
diff --git a/ocamldoc/odoc_cross.ml b/ocamldoc/odoc_cross.ml
index 39965f83b..cd79790d2 100644
--- a/ocamldoc/odoc_cross.ml
+++ b/ocamldoc/odoc_cross.ml
@@ -58,7 +58,9 @@ module P_alias =
let p_class c _ = (false, false)
let p_class_type ct _ = (false, false)
let p_value v _ = false
- let p_type t _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type t _ = (false, false)
let p_exception e _ = e.ex_alias <> None
let p_attribute a _ = false
let p_method m _ = false
@@ -178,7 +180,7 @@ let kind_name_exists kind =
match kind with
RK_module -> (fun e -> match e with Odoc_search.Res_module _ -> true | _ -> false)
| RK_module_type -> (fun e -> match e with Odoc_search.Res_module_type _ -> true | _ -> false)
- | RK_class -> (fun e -> match e with Odoc_search.Res_class_type _ -> true | _ -> false)
+ | RK_class -> (fun e -> match e with Odoc_search.Res_class _ -> true | _ -> false)
| RK_class_type -> (fun e -> match e with Odoc_search.Res_class_type _ -> true | _ -> false)
| RK_value -> (fun e -> match e with Odoc_search.Res_value _ -> true | _ -> false)
| RK_type -> (fun e -> match e with Odoc_search.Res_type _ -> true | _ -> false)
@@ -186,6 +188,8 @@ let kind_name_exists kind =
| RK_attribute -> (fun e -> match e with Odoc_search.Res_attribute _ -> true | _ -> false)
| RK_method -> (fun e -> match e with Odoc_search.Res_method _ -> true | _ -> false)
| RK_section _ -> assert false
+ | RK_recfield -> (fun e -> match e with Odoc_search.Res_recfield _ -> true | _ -> false)
+ | RK_const -> (fun e -> match e with Odoc_search.Res_const _ -> true | _ -> false)
in
fun name ->
try List.exists pred (get_known_elements name)
@@ -200,6 +204,8 @@ let type_exists = kind_name_exists RK_type
let exception_exists = kind_name_exists RK_exception
let attribute_exists = kind_name_exists RK_attribute
let method_exists = kind_name_exists RK_method
+let recfield_exists = kind_name_exists RK_recfield
+let const_exists = kind_name_exists RK_const
let lookup_module name =
match List.find
@@ -246,8 +252,17 @@ class scan =
inherit Odoc_scan.scanner
method! scan_value v =
add_known_element v.val_name (Odoc_search.Res_value v)
- method! scan_type t =
- add_known_element t.ty_name (Odoc_search.Res_type t)
+ method! scan_type_recfield t f =
+ add_known_element
+ (Printf.sprintf "%s.%s" t.ty_name f.rf_name)
+ (Odoc_search.Res_recfield (t, f))
+ method! scan_type_const t f =
+ add_known_element
+ (Printf.sprintf "%s.%s" t.ty_name f.vc_name)
+ (Odoc_search.Res_const (t, f))
+ method! scan_type_pre t =
+ add_known_element t.ty_name (Odoc_search.Res_type t);
+ true
method! scan_exception e =
add_known_element e.ex_name (Odoc_search.Res_exception e)
method! scan_attribute a =
@@ -620,6 +635,8 @@ let not_found_of_kind kind name =
| RK_attribute -> Odoc_messages.cross_attribute_not_found
| RK_method -> Odoc_messages.cross_method_not_found
| RK_section _ -> Odoc_messages.cross_section_not_found
+ | RK_recfield -> Odoc_messages.cross_recfield_not_found
+ | RK_const -> Odoc_messages.cross_const_not_found
) name
let rec assoc_comments_text_elements parent_name module_list t_ele =
@@ -675,6 +692,10 @@ let rec assoc_comments_text_elements parent_name module_list t_ele =
| Odoc_search.Res_attribute a -> (a.att_value.val_name, RK_attribute)
| Odoc_search.Res_method m -> (m.met_value.val_name, RK_method)
| Odoc_search.Res_section (_ ,t)-> assert false
+ | Odoc_search.Res_recfield (t, f) ->
+ (Printf.sprintf "%s.%s" t.ty_name f.rf_name, RK_recfield)
+ | Odoc_search.Res_const (t, f) ->
+ (Printf.sprintf "%s.%s" t.ty_name f.vc_name, RK_const)
in
add_verified (name, Some kind) ;
(name, Some kind)
@@ -731,6 +752,8 @@ let rec assoc_comments_text_elements parent_name module_list t_ele =
| RK_attribute -> attribute_exists
| RK_method -> method_exists
| RK_section _ -> assert false
+ | RK_recfield -> recfield_exists
+ | RK_const -> const_exists
in
if f name then
(
diff --git a/ocamldoc/odoc_gen.ml b/ocamldoc/odoc_gen.ml
index b77b186d4..b1909e786 100644
--- a/ocamldoc/odoc_gen.ml
+++ b/ocamldoc/odoc_gen.ml
@@ -18,13 +18,24 @@ module type Base = sig
class generator : doc_generator
end;;
+module Base_generator : Base = struct
+ class generator : doc_generator = object method generate l = () end
+ end;;
+
+module type Base_functor = functor (G: Base) -> Base
+module type Html_functor = functor (G: Odoc_html.Html_generator) -> Odoc_html.Html_generator
+module type Latex_functor = functor (G: Odoc_latex.Latex_generator) -> Odoc_latex.Latex_generator
+module type Texi_functor = functor (G: Odoc_texi.Texi_generator) -> Odoc_texi.Texi_generator
+module type Man_functor = functor (G: Odoc_man.Man_generator) -> Odoc_man.Man_generator
+module type Dot_functor = functor (G: Odoc_dot.Dot_generator) -> Odoc_dot.Dot_generator
+
type generator =
| Html of (module Odoc_html.Html_generator)
| Latex of (module Odoc_latex.Latex_generator)
| Texi of (module Odoc_texi.Texi_generator)
| Man of (module Odoc_man.Man_generator)
| Dot of (module Odoc_dot.Dot_generator)
- | Other of (module Base)
+ | Base of (module Base)
;;
let get_minimal_generator = function
@@ -43,7 +54,7 @@ let get_minimal_generator = function
| Dot m ->
let module M = (val m : Odoc_dot.Dot_generator) in
(new M.dot :> doc_generator)
-| Other m ->
+| Base m ->
let module M = (val m : Base) in
new M.generator
;;
diff --git a/ocamldoc/odoc_gen.mli b/ocamldoc/odoc_gen.mli
index 4649c9504..37768c008 100644
--- a/ocamldoc/odoc_gen.mli
+++ b/ocamldoc/odoc_gen.mli
@@ -20,6 +20,15 @@ module type Base = sig
class generator : doc_generator
end;;
+module Base_generator : Base
+
+module type Base_functor = functor (P: Base) -> Base
+module type Html_functor = functor (G: Odoc_html.Html_generator) -> Odoc_html.Html_generator
+module type Latex_functor = functor (G: Odoc_latex.Latex_generator) -> Odoc_latex.Latex_generator
+module type Texi_functor = functor (G: Odoc_texi.Texi_generator) -> Odoc_texi.Texi_generator
+module type Man_functor = functor (G: Odoc_man.Man_generator) -> Odoc_man.Man_generator
+module type Dot_functor = functor (G: Odoc_dot.Dot_generator) -> Odoc_dot.Dot_generator
+
(** Various ways to create a generator. *)
type generator =
| Html of (module Odoc_html.Html_generator)
@@ -27,7 +36,7 @@ type generator =
| Texi of (module Odoc_texi.Texi_generator)
| Man of (module Odoc_man.Man_generator)
| Dot of (module Odoc_dot.Dot_generator)
- | Other of (module Base)
+ | Base of (module Base)
;;
val get_minimal_generator : generator -> doc_generator
diff --git a/ocamldoc/odoc_html.ml b/ocamldoc/odoc_html.ml
index 369114d74..e3ce5344a 100644
--- a/ocamldoc/odoc_html.ml
+++ b/ocamldoc/odoc_html.ml
@@ -37,6 +37,9 @@ module Naming =
(** The prefix for types marks. *)
let mark_type = "TYPE"
+ (** The prefix for types elements (record fields or constructors). *)
+ let mark_type_elt = "TYPEELT"
+
(** The prefix for functions marks. *)
let mark_function = "FUN"
@@ -89,9 +92,25 @@ module Naming =
(** Return the link target for the given type. *)
let type_target t = target mark_type (Name.simple t.ty_name)
+ (** Return the link target for the given variant constructor. *)
+ let const_target t f =
+ let name = Printf.sprintf "%s.%s" (Name.simple t.ty_name) f.vc_name in
+ target mark_type_elt name
+
+ (** Return the link target for the given record field. *)
+ let recfield_target t f = target mark_type_elt
+ (Printf.sprintf "%s.%s" (Name.simple t.ty_name) f.rf_name)
+
(** Return the complete link target for the given type. *)
let complete_type_target t = complete_target mark_type t.ty_name
+ let complete_recfield_target name =
+ let typ = Name.father name in
+ let field = Name.simple name in
+ Printf.sprintf "%s.%s" (complete_target mark_type_elt typ) field
+
+ let complete_const_target = complete_recfield_target
+
(** Return the link target for the given exception. *)
let exception_target e = target mark_exception (Name.simple e.ex_name)
@@ -316,14 +335,10 @@ class virtual text =
in
fun b s ->
if !colorize_code then
- (
- bs b "<pre></pre>";
- self#html_of_code b (remove_useless_newlines s);
- bs b "<pre></pre>"
- )
+ self#html_of_code b (remove_useless_newlines s)
else
(
- bs b "<pre><code class=\"";
+ bs b "<pre class=\"codepre\"><code class=\"";
bs b Odoc_ocamlhtml.code_class;
bs b "\">" ;
bs b (self#escape (remove_useless_newlines s));
@@ -331,7 +346,7 @@ class virtual text =
)
method html_of_Verbatim b s =
- bs b "<pre>";
+ bs b "<pre class=\"verbatim\">";
bs b (self#escape s);
bs b "</pre>"
@@ -440,6 +455,8 @@ class virtual text =
| Odoc_info.RK_method -> (Naming.complete_target Naming.mark_method name, h name)
| Odoc_info.RK_section t -> (Naming.complete_label_target name,
Odoc_info.Italic [Raw (Odoc_info.string_of_text t)])
+ | Odoc_info.RK_recfield -> (Naming.complete_recfield_target name, h name)
+ | Odoc_info.RK_const -> (Naming.complete_const_target name, h name)
in
let text =
match text_opt with
@@ -466,7 +483,7 @@ class virtual text =
bs b "<br>\n<table class=\"indextable\">\n";
List.iter
(fun name ->
- bs b "<tr><td>";
+ bs b "<tr><td class=\"module\">";
(
try
let m =
@@ -490,8 +507,9 @@ class virtual text =
let index_if_not_empty l url m =
match l with
[] -> ()
- | _ -> bp b "<a href=\"%s\">%s</a><br>\n" url m
+ | _ -> bp b "<li><a href=\"%s\">%s</a></li>\n" url m
in
+ bp b "<ul class=\"indexlist\">\n";
index_if_not_empty self#list_types self#index_types Odoc_messages.index_of_types;
index_if_not_empty self#list_exceptions self#index_exceptions Odoc_messages.index_of_exceptions;
index_if_not_empty self#list_values self#index_values Odoc_messages.index_of_values;
@@ -500,7 +518,8 @@ class virtual text =
index_if_not_empty self#list_classes self#index_classes Odoc_messages.index_of_classes;
index_if_not_empty self#list_class_types self#index_class_types Odoc_messages.index_of_class_types;
index_if_not_empty self#list_modules self#index_modules Odoc_messages.index_of_modules;
- index_if_not_empty self#list_module_types self#index_module_types Odoc_messages.index_of_module_types
+ index_if_not_empty self#list_module_types self#index_module_types Odoc_messages.index_of_module_types;
+ bp b "</ul>\n"
method virtual list_types : Odoc_info.Type.t_type list
method virtual index_types : string
@@ -690,7 +709,7 @@ class virtual info =
let module M = Odoc_info in
let dep = info.M.i_deprecated <> None in
bs b "<div class=\"info\">\n";
- if dep then bs b "<font color=\"#CCCCCC\">";
+ if dep then bs b "<span class=\"deprecated\">";
(
match info.M.i_desc with
None -> ()
@@ -701,7 +720,7 @@ class virtual info =
(Odoc_info.first_sentence_of_text d));
bs b "\n"
);
- if dep then bs b "</font>";
+ if dep then bs b "</span>";
bs b "</div>\n"
end
@@ -748,11 +767,7 @@ class html =
(** The default style options. *)
val mutable default_style_options =
- ["a:visited {color : #416DFF; text-decoration : none; }" ;
- "a:link {color : #416DFF; text-decoration : none;}" ;
- "a:hover {color : Red; text-decoration : none; background-color: #5FFF88}" ;
- "a:active {color : Red; text-decoration : underline; }" ;
- ".keyword { font-weight : bold ; color : Red }" ;
+ [ ".keyword { font-weight : bold ; color : Red }" ;
".keywordsign { color : #C04600 }" ;
".superscript { font-size : 4 }" ;
".subscript { font-size : 4 }" ;
@@ -761,9 +776,18 @@ class html =
".type { color : #5C6585 }" ;
".string { color : Maroon }" ;
".warning { color : Red ; font-weight : bold }" ;
- ".info { margin-left : 3em; margin-right : 3em }" ;
+ ".info { margin-left : 3em; margin-right: 3em }" ;
".param_info { margin-top: 4px; margin-left : 3em; margin-right : 3em }" ;
".code { color : #465F91 ; }" ;
+ ".typetable { border-style : hidden }" ;
+ ".paramstable { border-style : hidden ; padding: 5pt 5pt}" ;
+ "tr { background-color : White }" ;
+ "td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;}" ;
+ "div.sig_block {margin-left: 2em}" ;
+ "*:target { background: yellow; }" ;
+
+ "body {font: 13px sans-serif; color: black; text-align: left; padding: 5px; margin: 0}";
+
"h1 { font-size : 20pt ; text-align: center; }" ;
"h2 { font-size : 20pt ; border: 1px solid #000000; "^
@@ -788,7 +812,7 @@ class html =
"h6 { font-size : 20pt ; border: 1px solid #000000; "^
"margin-top: 5px; margin-bottom: 2px;"^
- "text-align: center; background-color: #C0FFFF ; "^
+ "text-align: center; background-color: #90BDFF ; "^
"padding: 2px; }" ;
"div.h7 { font-size : 20pt ; border: 1px solid #000000; "^
@@ -806,17 +830,22 @@ class html =
"text-align: center; background-color: #FFFFFF ; "^
"padding: 2px; }" ;
- ".typetable { border-style : hidden }" ;
- ".indextable { border-style : hidden }" ;
- ".paramstable { border-style : hidden ; padding: 5pt 5pt}" ;
- "body { background-color : White }" ;
- "tr { background-color : White }" ;
- "td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;}" ;
- "pre { margin-bottom: 4px }" ;
+ "a {color: #416DFF; text-decoration: none}";
+ "a:hover {background-color: #ddd; text-decoration: underline}";
+ "pre { margin-bottom: 4px; font-family: monospace; }" ;
+ "pre.verbatim, pre.codepre { }";
- "div.sig_block {margin-left: 2em}" ;
+ ".indextable {border: 1px #ddd solid; border-collapse: collapse}";
+ ".indextable td, .indextable th {border: 1px #ddd solid; min-width: 80px}";
+ ".indextable td.module {background-color: #eee ; padding-left: 2px; padding-right: 2px}";
+ ".indextable td.module a {color: 4E6272; text-decoration: none; display: block; width: 100%}";
+ ".indextable td.module a:hover {text-decoration: underline; background-color: transparent}";
+ ".deprecated {color: #888; font-style: italic}" ;
+
+ ".indextable tr td div.info { margin-left: 2px; margin-right: 2px }" ;
- "*:target { background: yellow; } " ;
+ "ul.indexlist { margin-left: 0; padding-left: 0;}";
+ "ul.indexlist li { list-style-type: none ; margin-left: 0; padding-left: 0; }";
]
(** The style file for all pages. *)
@@ -1052,21 +1081,24 @@ class html =
match pre with
None -> ()
| Some name ->
- bp b "<a href=\"%s\">%s</a>\n"
+ bp b "<a class=\"pre\" href=\"%s\" title=\"%s\">%s</a>\n"
(fst (Naming.html_files name))
+ name
Odoc_messages.previous
);
bs b "&nbsp;";
let father = Name.father name in
let href = if father = "" then self#index else fst (Naming.html_files father) in
- bp b "<a href=\"%s\">%s</a>\n" href Odoc_messages.up;
+ let father_name = if father = "" then "Index" else father in
+ bp b "<a class=\"up\" href=\"%s\" title=\"%s\">%s</a>\n" href father_name Odoc_messages.up;
bs b "&nbsp;";
(
match post with
None -> ()
| Some name ->
- bp b "<a href=\"%s\">%s</a>\n"
+ bp b "<a class=\"post\" href=\"%s\" title=\"%s\">%s</a>\n"
(fst (Naming.html_files name))
+ name
Odoc_messages.next
);
bs b "</div>\n"
@@ -1244,7 +1276,7 @@ class html =
self#html_of_module_kind b father k2;
self#html_of_text b [Code ")"]
| Module_with (k, s) ->
- (* TODO: à modifier quand Module_with sera plus détaillé *)
+ (* TODO: modify when Module_with will be more detailed *)
self#html_of_module_type_kind b father ?modu k;
bs b "<code class=\"type\"> ";
bs b (self#create_fully_qualified_module_idents_links father s);
@@ -1427,7 +1459,7 @@ class html =
(match t.ty_manifest, t.ty_kind with
None, Type_abstract -> "<pre>"
| None, Type_variant _
- | None, Type_record _ -> "<br><code>"
+ | None, Type_record _ -> "<pre><code>"
| Some _, Type_abstract -> "<pre>"
| Some _, Type_variant _
| Some _, Type_record _ -> "<pre>"
@@ -1456,7 +1488,7 @@ class html =
bs b
(
match t.ty_manifest with
- None -> "</code>"
+ None -> "</code></pre>"
| Some _ -> "</pre>"
);
bs b "<table class=\"typetable\">\n";
@@ -1466,7 +1498,9 @@ class html =
bs b (self#keyword "|");
bs b "</code></td>\n<td align=\"left\" valign=\"top\" >\n";
bs b "<code>";
- bs b (self#constructor constr.vc_name);
+ bp b "<span id=\"%s\">%s</span>"
+ (Naming.const_target t constr)
+ (self#constructor constr.vc_name);
(
match constr.vc_args, constr.vc_ret with
[], None -> ()
@@ -1480,7 +1514,7 @@ class html =
bs b (" " ^ (self#keyword ":") ^ " ");
self#html_of_type_expr_list ~par: false b father " * " l;
bs b (" " ^ (self#keyword "->") ^ " ");
- self#html_of_type_expr b father r;
+ self#html_of_type_expr b father r;
);
bs b "</code></td>\n";
(
@@ -1511,7 +1545,7 @@ class html =
bs b
(
match t.ty_manifest with
- None -> "</code>"
+ None -> "</code></pre>"
| Some _ -> "</pre>"
);
bs b "<table class=\"typetable\">\n" ;
@@ -1521,7 +1555,9 @@ class html =
bs b "</td>\n<td align=\"left\" valign=\"top\" >\n";
bs b "<code>";
if r.rf_mutable then bs b (self#keyword "mutable&nbsp;") ;
- bs b (r.rf_name ^ "&nbsp;: ") ;
+ bp b "<span id=\"%s\">%s</span>&nbsp;:"
+ (Naming.recfield_target t r)
+ r.rf_name;
self#html_of_type_expr b father r.rf_type;
bs b ";</code></td>\n";
(
@@ -1834,7 +1870,7 @@ class html =
self#html_of_text b [Code "end"]
| Class_apply capp ->
- (* TODO: afficher le type final à partir du typedtree *)
+ (* TODO: display final type from typedtree *)
self#html_of_text b [Raw "class application not handled yet"]
| Class_constr cco ->
@@ -2085,9 +2121,11 @@ class html =
let b = new_buf () in
bs b "<html>\n";
self#print_header b (self#inner_title title);
- bs b "<body>\n<center><h1>";
+ bs b "<body>\n";
+ self#print_navbar b None None "";
+ bs b "<h1>";
bs b title;
- bs b "</h1></center>\n" ;
+ bs b "</h1>\n" ;
let sorted_elements = List.sort
(fun e1 e2 -> compare (Name.simple (name e1)) (Name.simple (name e2)))
@@ -2120,7 +2158,7 @@ class html =
in
bs b "<table>\n";
List.iter f_group groups ;
- bs b "</table><br>\n" ;
+ bs b "</table>\n" ;
bs b "</body>\n</html>";
Buffer.output_buffer chanout b;
close_out chanout
@@ -2159,11 +2197,11 @@ class html =
(self#inner_title cl.cl_name);
bs b "<body>\n";
self#print_navbar b pre_name post_name cl.cl_name;
- bs b "<center><h1>";
+ bs b "<h1>";
bs b (Odoc_messages.clas^" ");
if cl.cl_virtual then bs b "virtual " ;
bp b "<a href=\"%s\">%s</a>" type_file cl.cl_name;
- bs b "</h1></center>\n<br>\n";
+ bs b "</h1>\n";
self#html_of_class b ~with_link: false cl;
(* parameters *)
self#html_of_described_parameter_list b
@@ -2207,11 +2245,11 @@ class html =
bs b "<body>\n";
self#print_navbar b pre_name post_name clt.clt_name;
- bs b "<center><h1>";
+ bs b "<h1>";
bs b (Odoc_messages.class_type^" ");
if clt.clt_virtual then bs b "virtual ";
bp b "<a href=\"%s\">%s</a>" type_file clt.clt_name;
- bs b "</h1></center>\n<br>\n";
+ bs b "</h1>\n";
self#html_of_class_type b ~with_link: false clt;
(* class inheritance *)
@@ -2252,14 +2290,14 @@ class html =
(self#inner_title mt.mt_name);
bs b "<body>\n";
self#print_navbar b pre_name post_name mt.mt_name;
- bp b "<center><h1>";
+ bp b "<h1>";
bs b (Odoc_messages.module_type^" ");
(
match mt.mt_type with
Some _ -> bp b "<a href=\"%s\">%s</a>" type_file mt.mt_name
| None-> bs b mt.mt_name
);
- bs b "</h1></center>\n<br>\n" ;
+ bs b "</h1>\n" ;
self#html_of_modtype b ~with_link: false mt;
(* parameters for functors *)
@@ -2320,7 +2358,7 @@ class html =
(self#inner_title modu.m_name);
bs b "<body>\n" ;
self#print_navbar b pre_name post_name modu.m_name ;
- bs b "<center><h1>";
+ bs b "<h1>";
if modu.m_text_only then
bs b modu.m_name
else
@@ -2339,7 +2377,7 @@ class html =
| Some _ -> bp b " (<a href=\"%s\">.ml</a>)" code_file
)
);
- bs b "</h1></center>\n<br>\n";
+ bs b "</h1>\n";
if not modu.m_text_only then self#html_of_module b ~with_link: false modu;
@@ -2397,9 +2435,10 @@ class html =
bs b "<html>\n";
self#print_header b self#title;
bs b "<body>\n";
- bs b "<center><h1>";
+
+ bs b "<h1>";
bs b title;
- bs b "</h1></center>\n" ;
+ bs b "</h1>\n" ;
let info = Odoc_info.apply_opt
(Odoc_info.info_of_comment_file module_list)
!Odoc_info.Global.intro_file
diff --git a/ocamldoc/odoc_info.ml b/ocamldoc/odoc_info.ml
index 047fa2b5b..769aade9c 100644
--- a/ocamldoc/odoc_info.ml
+++ b/ocamldoc/odoc_info.ml
@@ -24,6 +24,8 @@ type ref_kind = Odoc_types.ref_kind =
| RK_attribute
| RK_method
| RK_section of text
+ | RK_recfield
+ | RK_const
and text_element = Odoc_types.text_element =
| Raw of string
@@ -81,8 +83,8 @@ type info = Odoc_types.info = {
}
type location = Odoc_types.location = {
- loc_impl : (string * int) option ;
- loc_inter : (string * int) option ;
+ loc_impl : Location.t option ;
+ loc_inter : Location.t option ;
}
let dummy_loc = { loc_impl = None ; loc_inter = None }
@@ -293,6 +295,8 @@ module Search =
| Res_attribute of Value.t_attribute
| Res_method of Value.t_method
| Res_section of string * text
+ | Res_recfield of Type.t_type * Type.record_field
+ | Res_const of Type.t_type * Type.variant_constructor
type search_result = result_element list
diff --git a/ocamldoc/odoc_info.mli b/ocamldoc/odoc_info.mli
index 0ab1fa815..0d755c7f4 100644
--- a/ocamldoc/odoc_info.mli
+++ b/ocamldoc/odoc_info.mli
@@ -25,6 +25,8 @@ type ref_kind = Odoc_types.ref_kind =
| RK_attribute
| RK_method
| RK_section of text
+ | RK_recfield
+ | RK_const
and text_element = Odoc_types.text_element =
| Raw of string (** Raw text. *)
@@ -98,8 +100,8 @@ type info = Odoc_types.info = {
(** Location of elements in implementation and interface files. *)
type location = Odoc_types.location = {
- loc_impl : (string * int) option ; (** implementation file name and position *)
- loc_inter : (string * int) option ; (** interface file name and position *)
+ loc_impl : Location.t option ; (** implementation location *)
+ loc_inter : Location.t option ; (** interface location *)
}
(** A dummy location. *)
@@ -792,6 +794,8 @@ module Search :
| Res_attribute of Value.t_attribute
| Res_method of Value.t_method
| Res_section of string * text
+ | Res_recfield of Type.t_type * Type.record_field
+ | Res_const of Type.t_type * Type.variant_constructor
(** The type representing a research result.*)
type search_result = result_element list
@@ -836,6 +840,10 @@ module Scan :
(** Scan of 'leaf elements'. *)
method scan_value : Value.t_value -> unit
+
+ method scan_type_pre : Type.t_type -> bool
+ method scan_type_const : Type.t_type -> Type.variant_constructor -> unit
+ method scan_type_recfield : Type.t_type -> Type.record_field -> unit
method scan_type : Type.t_type -> unit
method scan_exception : Exception.t_exception -> unit
method scan_attribute : Value.t_attribute -> unit
diff --git a/ocamldoc/odoc_latex.ml b/ocamldoc/odoc_latex.ml
index df404fc32..f2bff2172 100644
--- a/ocamldoc/odoc_latex.ml
+++ b/ocamldoc/odoc_latex.ml
@@ -37,6 +37,7 @@ let latex_titles = ref [
let latex_value_prefix = ref Odoc_messages.default_latex_value_prefix
let latex_type_prefix = ref Odoc_messages.default_latex_type_prefix
+let latex_type_elt_prefix = ref Odoc_messages.default_latex_type_elt_prefix
let latex_exception_prefix = ref Odoc_messages.default_latex_exception_prefix
let latex_module_prefix = ref Odoc_messages.default_latex_module_prefix
let latex_module_type_prefix = ref Odoc_messages.default_latex_module_type_prefix
@@ -96,19 +97,19 @@ class text =
"}", "\\\\}";
"\\$", "\\\\$";
"\\^", "{\\\\textasciicircum}";
- "à", "\\\\`a";
- "â", "\\\\^a";
- "é", "\\\\'e";
- "è", "\\\\`e";
- "ê", "\\\\^e";
- "ë", "\\\\\"e";
- "ç", "\\\\c{c}";
- "ô", "\\\\^o";
- "ö", "\\\\\"o";
- "î", "\\\\^i";
- "ï", "\\\\\"i";
- "ù", "\\\\`u";
- "û", "\\\\^u";
+ "à", "\\\\`a";
+ "â", "\\\\^a";
+ "é", "\\\\'e";
+ "è", "\\\\`e";
+ "ê", "\\\\^e";
+ "ë", "\\\\\"e";
+ "ç", "\\\\c{c}";
+ "ô", "\\\\^o";
+ "ö", "\\\\\"o";
+ "î", "\\\\^i";
+ "ï", "\\\\\"i";
+ "ù", "\\\\`u";
+ "û", "\\\\^u";
"%", "\\\\%";
"_", "\\\\_";
"~", "\\\\~{}";
@@ -240,6 +241,12 @@ class text =
(** Make a correct label from a type name. *)
method type_label ?no_ name = !latex_type_prefix^(self#label ?no_ name)
+ (** Make a correct label from a record field. *)
+ method recfield_label ?no_ name = !latex_type_elt_prefix^(self#label ?no_ name)
+
+ (** Make a correct label from a variant constructor. *)
+ method const_label ?no_ name = !latex_type_elt_prefix^(self#label ?no_ name)
+
(** Return latex code for the label of a given label. *)
method make_label label = "\\label{"^label^"}"
@@ -409,6 +416,8 @@ class text =
| Odoc_info.RK_attribute -> self#attribute_label
| Odoc_info.RK_method -> self#method_label
| Odoc_info.RK_section _ -> assert false
+ | Odoc_info.RK_recfield -> self#recfield_label
+ | Odoc_info.RK_const -> self#const_label
in
let text =
match text_opt with
@@ -566,7 +575,7 @@ class latex =
":"
(self#normal_type_list ~par: false mod_name " * " l)
"->"
- (self#normal_type mod_name r)
+ (self#normal_type mod_name r)
);
flush2 ()
in
@@ -694,7 +703,7 @@ class latex =
self#latex_of_module_kind fmt father k2;
self#latex_of_text fmt [Code ")"]
| Module_with (k, s) ->
- (* TODO: à modifier quand Module_with sera plus détaillé *)
+ (* TODO: à modifier quand Module_with sera plus détaillé *)
self#latex_of_module_type_kind fmt father k;
self#latex_of_text fmt
[ Code " ";
@@ -723,7 +732,7 @@ class latex =
self#latex_of_text fmt [Latex "\\end{ocamldocobjectend}\n"]
| Class_apply capp ->
- (* TODO: afficher le type final à partir du typedtree *)
+ (* TODO: afficher le type final à partir du typedtree *)
self#latex_of_text fmt [Raw "class application not handled yet"]
| Class_constr cco ->
diff --git a/ocamldoc/odoc_man.ml b/ocamldoc/odoc_man.ml
index 037dee02d..dae2ff986 100644
--- a/ocamldoc/odoc_man.ml
+++ b/ocamldoc/odoc_man.ml
@@ -478,10 +478,10 @@ class man =
bs b "(* ";
self#man_of_text b t;
bs b " *)\n "
- | [], None, Some r ->
+ | [], None, Some r ->
bs b "\n.B : ";
self#man_of_type_expr b father r;
- bs b " "
+ bs b " "
| [], (Some t), Some r ->
bs b "\n.B : ";
self#man_of_type_expr b father r;
@@ -999,6 +999,8 @@ class man =
| Res_attribute a -> Name.simple a.att_value.val_name
| Res_method m -> Name.simple m.met_value.val_name
| Res_section _ -> assert false
+ | Res_recfield (_,f) -> f.rf_name
+ | Res_const (_,f) -> f.vc_name
in
let all_items_pre = Odoc_info.Search.search_by_name module_list (Str.regexp ".*") in
let all_items = List.filter
@@ -1040,6 +1042,8 @@ class man =
| Res_attribute a -> a.att_value.val_name
| Res_method m -> m.met_value.val_name
| Res_section (s,_) -> s
+ | Res_recfield (_,f) -> f.rf_name
+ | Res_const (_,f) -> f.vc_name
)
in
let date = Unix.time () in
diff --git a/ocamldoc/odoc_merge.mli b/ocamldoc/odoc_merge.mli
index 4f580ee89..3133c5e93 100644
--- a/ocamldoc/odoc_merge.mli
+++ b/ocamldoc/odoc_merge.mli
@@ -13,7 +13,7 @@
(** Merge of information from [.ml] and [.mli] for a module.*)
-(** Merging \@before tags. *)
+(** Merging \@before tags. *)
val merge_before_tags :
(string * Odoc_types.text) list -> (string * Odoc_types.text) list
diff --git a/ocamldoc/odoc_messages.ml b/ocamldoc/odoc_messages.ml
index 3e9578744..242515758 100644
--- a/ocamldoc/odoc_messages.ml
+++ b/ocamldoc/odoc_messages.ml
@@ -128,6 +128,11 @@ let latex_type_prefix =
"<string>\n\t\tUse <string> as prefix for the LaTeX labels of types.\n"^
"\t\t(default is \""^default_latex_type_prefix^"\")"
+let default_latex_type_elt_prefix = "typeelt:"
+let latex_type_elt_prefix =
+ "<string>\n\t\tUse <string> as prefix for the LaTeX labels of type elements.\n"^
+ "\t\t(default is \""^default_latex_type_elt_prefix^"\")"
+
let default_latex_exception_prefix = "exception:"
let latex_exception_prefix =
"<string>\n\t\tUse <string> as prefix for the LaTeX labels of exceptions.\n"^
@@ -245,7 +250,7 @@ let tag_not_handled tag = "Tag @"^tag^" not handled by this generator"
let bad_tree = "Incorrect tree structure."
let not_a_valid_tag s = s^" is not a valid tag."
let fun_without_param f = "Function "^f^" has no parameter.";;
-let method_without_param f = "Méthode "^f^" has no parameter.";;
+let method_without_param f = "Method "^f^" has no parameter.";;
let anonymous_parameters f = "Function "^f^" has anonymous parameters."
let function_colon f = "Function "^f^": "
let implicit_match_in_parameter = "Parameters contain implicit pattern matching."
@@ -295,11 +300,17 @@ let cross_attribute_not_found n = "Attribute "^n^" not found"
let cross_section_not_found n = "Section "^n^" not found"
let cross_value_not_found n = "Value "^n^" not found"
let cross_type_not_found n = "Type "^n^" not found"
+let cross_recfield_not_found n = Printf.sprintf "Record field %s not found" n
+let cross_const_not_found n = Printf.sprintf "Constructor %s not found" n
let object_end = "object ... end"
let struct_end = "struct ... end"
let sig_end = "sig ... end"
+let current_generator_is_not kind =
+ Printf.sprintf "Current generator is not a %s generator" kind
+;;
+
(** Messages for verbose mode. *)
let analysing f = "Analysing file "^f^"..."
diff --git a/ocamldoc/odoc_misc.ml b/ocamldoc/odoc_misc.ml
index c48c1f6a5..c74b287d6 100644
--- a/ocamldoc/odoc_misc.ml
+++ b/ocamldoc/odoc_misc.ml
@@ -334,7 +334,7 @@ let rec get_before_dot s =
let len = String.length s in
let n = String.index s '.' in
if n + 1 >= len then
- (* le point est le dernier caractère *)
+ (* le point est le dernier caractère *)
(true, s, "")
else
match s.[n+1] with
diff --git a/ocamldoc/odoc_name.ml b/ocamldoc/odoc_name.ml
index b82cf8745..7d059df40 100644
--- a/ocamldoc/odoc_name.ml
+++ b/ocamldoc/odoc_name.ml
@@ -215,3 +215,9 @@ let to_path n =
| Some p -> p
let from_longident = Odoc_misc.string_of_longident
+
+module Set = Set.Make (struct
+ type z = t
+ type t = z
+ let compare = String.compare
+end)
diff --git a/ocamldoc/odoc_name.mli b/ocamldoc/odoc_name.mli
index e3b43a786..9bff7c22f 100644
--- a/ocamldoc/odoc_name.mli
+++ b/ocamldoc/odoc_name.mli
@@ -67,3 +67,6 @@ val to_path : t -> Path.t
(** Get a name from a [Longident.t].*)
val from_longident : Longident.t -> t
+
+(** Set of Name.t *)
+module Set : Set.S with type elt = t
diff --git a/ocamldoc/odoc_scan.ml b/ocamldoc/odoc_scan.ml
index 29e1ca272..18a8f117c 100644
--- a/ocamldoc/odoc_scan.ml
+++ b/ocamldoc/odoc_scan.ml
@@ -28,7 +28,18 @@ class scanner =
(** Scan of 'leaf elements'. *)
method scan_value (v : Odoc_value.t_value) = ()
- method scan_type (t : Odoc_type.t_type) = ()
+
+ method scan_type_pre (t : Odoc_type.t_type) = true
+
+ method scan_type_recfield t (f : Odoc_type.record_field) = ()
+ method scan_type_const t (f : Odoc_type.variant_constructor) = ()
+ method scan_type (t : Odoc_type.t_type) =
+ if self#scan_type_pre t then
+ match t.Odoc_type.ty_kind with
+ Odoc_type.Type_abstract -> ()
+ | Odoc_type.Type_variant l -> List.iter (self#scan_type_const t) l
+ | Odoc_type.Type_record l -> List.iter (self#scan_type_recfield t) l
+
method scan_exception (e : Odoc_exception.t_exception) = ()
method scan_attribute (a : Odoc_value.t_attribute) = ()
method scan_method (m : Odoc_value.t_method) = ()
@@ -45,7 +56,7 @@ class scanner =
method scan_class_pre (c : Odoc_class.t_class) = true
(** This method scan the elements of the given class.
- A VOIR : scan des classes héritées.*)
+ A VOIR : scan des classes héritées.*)
method scan_class_elements c =
List.iter
(fun ele ->
@@ -71,7 +82,7 @@ class scanner =
method scan_class_type_pre (ct : Odoc_class.t_class_type) = true
(** This method scan the elements of the given class type.
- A VOIR : scan des classes héritées.*)
+ A VOIR : scan des classes héritées.*)
method scan_class_type_elements ct =
List.iter
(fun ele ->
diff --git a/ocamldoc/odoc_search.ml b/ocamldoc/odoc_search.ml
index 65d602d3b..91b1d13c8 100644
--- a/ocamldoc/odoc_search.ml
+++ b/ocamldoc/odoc_search.ml
@@ -32,6 +32,8 @@ type result_element =
| Res_attribute of t_attribute
| Res_method of t_method
| Res_section of string * Odoc_types.text
+ | Res_recfield of t_type * record_field
+ | Res_const of t_type * variant_constructor
type result = result_element list
@@ -43,7 +45,9 @@ module type Predicates =
val p_class : t_class -> t -> bool * bool
val p_class_type : t_class_type -> t -> bool * bool
val p_value : t_value -> t -> bool
- val p_type : t_type -> t -> bool
+ val p_recfield : t_type -> record_field -> t -> bool
+ val p_const : t_type -> variant_constructor -> t -> bool
+ val p_type : t_type -> t -> (bool * bool)
val p_exception : t_exception -> t -> bool
val p_attribute : t_attribute -> t -> bool
val p_method : t_method -> t -> bool
@@ -92,7 +96,26 @@ module Search =
let search_value va v = if P.p_value va v then [Res_value va] else []
- let search_type t v = if P.p_type t v then [Res_type t] else []
+ let search_recfield t f v =
+ if P.p_recfield t f v then [Res_recfield (t,f)] else []
+
+ let search_const t f v =
+ if P.p_const t f v then [Res_const (t,f)] else []
+
+ let search_type t v =
+ let (go_deeper, ok) = P.p_type t v in
+ let l =
+ match go_deeper with
+ false -> []
+ | true ->
+ match t.ty_kind with
+ Type_abstract -> []
+ | Type_record l ->
+ List.flatten (List.map (fun rf -> search_recfield t rf v) l)
+ | Type_variant l ->
+ List.flatten (List.map (fun rf -> search_const t rf v) l)
+ in
+ if ok then (Res_type t) :: l else l
let search_exception e v = if P.p_exception e v then [Res_exception e] else []
@@ -305,7 +328,13 @@ module P_name =
let p_class c r = (true, c.cl_name =~ r)
let p_class_type ct r = (true, ct.clt_name =~ r)
let p_value v r = v.val_name =~ r
- let p_type t r = t.ty_name =~ r
+ let p_recfield t f r =
+ let name = Printf.sprintf "%s.%s" t.ty_name f.rf_name in
+ name =~ r
+ let p_const t f r =
+ let name = Printf.sprintf "%s.%s" t.ty_name f.vc_name in
+ name =~ r
+ let p_type t r = (true, t.ty_name =~ r)
let p_exception e r = e.ex_name =~ r
let p_attribute a r = a.att_value.val_name =~ r
let p_method m r = m.met_value.val_name =~ r
@@ -322,7 +351,9 @@ module P_values =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = true
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -347,7 +378,9 @@ module P_exceptions =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = true
let p_attribute _ _ = false
let p_method _ _ = false
@@ -372,7 +405,9 @@ module P_types =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = true
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, true)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -397,7 +432,9 @@ module P_attributes =
let p_class _ _ = (true, false)
let p_class_type _ _ = (true, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = true
let p_method _ _ = false
@@ -422,7 +459,9 @@ module P_methods =
let p_class _ _ = (true, false)
let p_class_type _ _ = (true, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = true
@@ -447,7 +486,9 @@ module P_classes =
let p_class _ _ = (false, true)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -472,7 +513,9 @@ module P_class_types =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, true)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -497,7 +540,9 @@ module P_modules =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
@@ -522,7 +567,9 @@ module P_module_types =
let p_class _ _ = (false, false)
let p_class_type _ _ = (false, false)
let p_value _ _ = false
- let p_type _ _ = false
+ let p_recfield _ _ _ = false
+ let p_const _ _ _ = false
+ let p_type _ _ = (false, false)
let p_exception _ _ = false
let p_attribute _ _ = false
let p_method _ _ = false
diff --git a/ocamldoc/odoc_search.mli b/ocamldoc/odoc_search.mli
index d7ace5831..2f882d524 100644
--- a/ocamldoc/odoc_search.mli
+++ b/ocamldoc/odoc_search.mli
@@ -25,6 +25,8 @@ type result_element =
| Res_attribute of Odoc_value.t_attribute
| Res_method of Odoc_value.t_method
| Res_section of string * Odoc_types.text
+ | Res_recfield of Odoc_type.t_type * Odoc_type.record_field
+ | Res_const of Odoc_type.t_type * Odoc_type.variant_constructor
(** The type representing a research result.*)
type result = result_element list
@@ -42,7 +44,9 @@ module type Predicates =
val p_class : Odoc_class.t_class -> t -> bool * bool
val p_class_type : Odoc_class.t_class_type -> t -> bool * bool
val p_value : Odoc_value.t_value -> t -> bool
- val p_type : Odoc_type.t_type -> t -> bool
+ val p_recfield : Odoc_type.t_type -> Odoc_type.record_field -> t -> bool
+ val p_const : Odoc_type.t_type -> Odoc_type.variant_constructor -> t -> bool
+ val p_type : Odoc_type.t_type -> t -> (bool * bool)
val p_exception : Odoc_exception.t_exception -> t -> bool
val p_attribute : Odoc_value.t_attribute -> t -> bool
val p_method : Odoc_value.t_method -> t -> bool
@@ -59,6 +63,14 @@ module Search :
(** search in a value *)
val search_value : Odoc_value.t_value -> P.t -> result_element list
+ (** search in a record field *)
+ val search_recfield :
+ Odoc_type.t_type -> Odoc_type.record_field -> P.t -> result_element list
+
+ (** search in a variant constructor *)
+ val search_const :
+ Odoc_type.t_type -> Odoc_type.variant_constructor -> P.t -> result_element list
+
(** search in a type *)
val search_type : Odoc_type.t_type -> P.t -> result_element list
@@ -102,7 +114,9 @@ module P_name :
val p_class : Odoc_class.t_class -> Str.regexp -> bool * bool
val p_class_type : Odoc_class.t_class_type -> Str.regexp -> bool * bool
val p_value : Odoc_value.t_value -> Str.regexp -> bool
- val p_type : Odoc_type.t_type -> Str.regexp -> bool
+ val p_recfield : Odoc_type.t_type -> Odoc_type.record_field -> Str.regexp -> bool
+ val p_const : Odoc_type.t_type -> Odoc_type.variant_constructor -> Str.regexp -> bool
+ val p_type : Odoc_type.t_type -> Str.regexp -> (bool * bool)
val p_exception : Odoc_exception.t_exception -> Str.regexp -> bool
val p_attribute : Odoc_value.t_attribute -> Str.regexp -> bool
val p_method : Odoc_value.t_method -> Str.regexp -> bool
@@ -113,6 +127,8 @@ module Search_by_name :
sig
val search_section : Odoc_types.text -> string -> P_name.t -> result_element list
val search_value : Odoc_value.t_value -> P_name.t -> result_element list
+ val search_recfield : Odoc_type.t_type -> Odoc_type.record_field -> P_name.t -> result_element list
+ val search_const : Odoc_type.t_type -> Odoc_type.variant_constructor -> P_name.t -> result_element list
val search_type : Odoc_type.t_type -> P_name.t -> result_element list
val search_exception :
Odoc_exception.t_exception -> P_name.t -> result_element list
diff --git a/ocamldoc/odoc_sig.ml b/ocamldoc/odoc_sig.ml
index 74de957ed..ea42ddb7b 100644
--- a/ocamldoc/odoc_sig.ml
+++ b/ocamldoc/odoc_sig.ml
@@ -257,6 +257,38 @@ module Analyser =
in
Odoc_type.Type_record (List.map f l)
+ let erased_names_of_constraints constraints acc =
+ List.fold_right (fun (longident, constraint_) acc ->
+ match constraint_ with
+ | Parsetree.Pwith_type _ | Parsetree.Pwith_module _ -> acc
+ | Parsetree.Pwith_typesubst _ | Parsetree.Pwith_modsubst _ ->
+ Name.Set.add (Name.from_longident longident.txt) acc)
+ constraints acc
+
+ let filter_out_erased_items_from_signature erased signature =
+ if Name.Set.is_empty erased then signature
+ else List.fold_right (fun sig_item acc ->
+ let take_item psig_desc = { sig_item with Parsetree.psig_desc } :: acc in
+ match sig_item.Parsetree.psig_desc with
+ | Parsetree.Psig_value (_, _)
+ | Parsetree.Psig_exception (_, _)
+ | Parsetree.Psig_open _
+ | Parsetree.Psig_include _
+ | Parsetree.Psig_class _
+ | Parsetree.Psig_class_type _ as tp -> take_item tp
+ | Parsetree.Psig_type types ->
+ (match List.filter (fun (name, _) -> not (Name.Set.mem name.txt erased)) types with
+ | [] -> acc
+ | types -> take_item (Parsetree.Psig_type types))
+ | Parsetree.Psig_module (name, _)
+ | Parsetree.Psig_modtype (name, _) as m ->
+ if Name.Set.mem name.txt erased then acc else take_item m
+ | Parsetree.Psig_recmodule mods ->
+ (match List.filter (fun (name, _) -> not (Name.Set.mem name.txt erased)) mods with
+ | [] -> acc
+ | mods -> take_item (Parsetree.Psig_recmodule mods)))
+ signature []
+
(** Analysis of the elements of a class, from the information in the parsetree and in the class
signature. @return the couple (inherited_class list, elements).*)
let analyse_class_elements env current_class_name last_pos pos_limit
@@ -292,7 +324,7 @@ module Analyser =
val_recursive = false ;
val_parameters = Odoc_value.dummy_parameter_list subst_typ ;
val_code = None ;
- val_loc = { loc_impl = None ; loc_inter = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum) };
+ val_loc = { loc_impl = None ; loc_inter = Some loc };
} ;
met_private = private_flag = Asttypes.Private ;
met_virtual = false ;
@@ -352,7 +384,7 @@ module Analyser =
val_recursive = false ;
val_parameters = [] ;
val_code = None ;
- val_loc = { loc_impl = None ; loc_inter = Some (!file_name, loc.Location.loc_start.Lexing.pos_cnum)} ;
+ val_loc = { loc_impl = None ; loc_inter = Some loc} ;
} ;
att_mutable = mutable_flag = Asttypes.Mutable ;
att_virtual = virtual_flag = Asttypes.Virtual ;
@@ -466,6 +498,7 @@ module Analyser =
signat
table
current_module_name
+ ele.Parsetree.psig_loc
ele.Parsetree.psig_loc.Location.loc_start.Lexing.pos_cnum
ele.Parsetree.psig_loc.Location.loc_end.Lexing.pos_cnum
(match q with
@@ -488,7 +521,7 @@ module Analyser =
(** Analyse the given signature_item_desc to create the corresponding module element
(with the given attached comment).*)
and analyse_signature_item_desc env signat table current_module_name
- pos_start_ele pos_end_ele pos_limit comment_opt sig_item_desc =
+ sig_item_loc pos_start_ele pos_end_ele pos_limit comment_opt sig_item_desc =
match sig_item_desc with
Parsetree.Psig_value (name_pre, value_desc) ->
let type_expr =
@@ -506,7 +539,7 @@ module Analyser =
val_recursive = false ;
val_parameters = Odoc_value.dummy_parameter_list subst_typ ;
val_code = None ;
- val_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele)}
+ val_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
}
in
let (maybe_more, info_after_opt) =
@@ -533,7 +566,7 @@ module Analyser =
ex_info = comment_opt ;
ex_args = List.map (Odoc_env.subst_type env) types_excep_decl.exn_args ;
ex_alias = None ;
- ex_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ ex_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
ex_code =
(
if !Odoc_global.keep_code then
@@ -618,10 +651,7 @@ module Analyser =
(match sig_type_decl.Types.type_manifest with
None -> None
| Some t -> Some (Odoc_env.subst_type new_env t));
- ty_loc =
- { loc_impl = None ;
- loc_inter = Some (!file_name,loc_start) ;
- };
+ ty_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
ty_code =
(
if !Odoc_global.keep_code then
@@ -683,7 +713,7 @@ module Analyser =
m_is_interface = true ;
m_file = !file_name ;
m_kind = module_kind ;
- m_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ m_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
m_top_deps = [] ;
m_code = None ;
m_code_intf = code_intf ;
@@ -734,8 +764,9 @@ module Analyser =
(acc_maybe_more, [])
| (name, modtype) :: q ->
let complete_name = Name.concat current_module_name name.txt in
- let loc_start = modtype.Parsetree.pmty_loc.Location.loc_start.Lexing.pos_cnum in
- let loc_end = modtype.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
+ let loc = modtype.Parsetree.pmty_loc in
+ let loc_start = loc.Location.loc_start.Lexing.pos_cnum in
+ let loc_end = loc.Location.loc_end.Lexing.pos_cnum in
let (assoc_com, ele_comments) =
if first then
(comment_opt, [])
@@ -747,7 +778,7 @@ module Analyser =
let pos_limit2 =
match q with
[] -> pos_limit
- | (_, mty) :: _ -> mty.Parsetree.pmty_loc.Location.loc_start.Lexing.pos_cnum
+ | (_, mty) :: _ -> loc.Location.loc_start.Lexing.pos_cnum
in
(* get the information for the module in the signature *)
let sig_module_type =
@@ -759,7 +790,6 @@ module Analyser =
let module_kind = analyse_module_kind new_env complete_name modtype sig_module_type in
let code_intf =
if !Odoc_global.keep_code then
- let loc = modtype.Parsetree.pmty_loc in
let st = loc.Location.loc_start.Lexing.pos_cnum in
let en = loc.Location.loc_end.Lexing.pos_cnum in
Some (get_string_of_file st en)
@@ -774,7 +804,7 @@ module Analyser =
m_is_interface = true ;
m_file = !file_name ;
m_kind = module_kind ;
- m_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ m_loc = { loc_impl = None ; loc_inter = Some loc } ;
m_top_deps = [] ;
m_code = None ;
m_code_intf = code_intf ;
@@ -822,7 +852,7 @@ module Analyser =
mt_is_interface = true ;
mt_file = !file_name ;
mt_kind = module_type_kind ;
- mt_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ mt_loc = { loc_impl = None ; loc_inter = Some sig_item_loc } ;
}
in
let (maybe_more, info_after_opt) =
@@ -863,7 +893,7 @@ module Analyser =
im_info = comment_opt;
}
in
- (0, env, [ Element_included_module im ]) (* A VOIR : étendre l'environnement ? avec quoi ? *)
+ (0, env, [ Element_included_module im ]) (* A VOIR : etendre l'environnement ? avec quoi ? *)
| Parsetree.Psig_class class_description_list ->
(* we start by extending the environment *)
@@ -920,7 +950,7 @@ module Analyser =
cl_virtual = class_desc.Parsetree.pci_virt = Asttypes.Virtual ;
cl_kind = class_kind ;
cl_parameters = parameters ;
- cl_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ cl_loc = { loc_impl = None ; loc_inter = Some class_desc.Parsetree.pci_loc } ;
}
in
let (maybe_more, info_after_opt) =
@@ -994,7 +1024,7 @@ module Analyser =
clt_type_parameters = sig_cltype_decl.clty_params ;
clt_virtual = ct_decl.Parsetree.pci_virt = Asttypes.Virtual ;
clt_kind = kind ;
- clt_loc = { loc_impl = None ; loc_inter = Some (!file_name, pos_start_ele) } ;
+ clt_loc = { loc_impl = None ; loc_inter = Some ct_decl.Parsetree.pci_loc } ;
}
in
let (maybe_more, info_after_opt) =
@@ -1015,7 +1045,8 @@ module Analyser =
(maybe_more, new_env, eles)
(** Return a module_type_kind from a Parsetree.module_type and a Types.module_type *)
- and analyse_module_type_kind env current_module_name module_type sig_module_type =
+ and analyse_module_type_kind
+ ?(erased = Name.Set.empty) env current_module_name module_type sig_module_type =
match module_type.Parsetree.pmty_desc with
Parsetree.Pmty_ident longident ->
let name =
@@ -1029,6 +1060,7 @@ module Analyser =
| Parsetree.Pmty_signature ast ->
(
+ let ast = filter_out_erased_items_from_signature erased ast in
(* we must have a signature in the module type *)
match sig_module_type with
Types.Mty_signature signat ->
@@ -1059,7 +1091,7 @@ module Analyser =
mp_kind = mp_kind ;
}
in
- let k = analyse_module_type_kind env
+ let k = analyse_module_type_kind ~erased env
current_module_name
module_type2
body_module_type
@@ -1071,13 +1103,15 @@ module Analyser =
raise (Failure "Parsetree.Pmty_functor _ but not Types.Mty_functor _")
)
- | Parsetree.Pmty_with (module_type2, _) ->
+ | Parsetree.Pmty_with (module_type2, constraints) ->
(* of module_type * (Longident.t * with_constraint) list *)
(
let loc_start = module_type2.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
let loc_end = module_type.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
let s = get_string_of_file loc_start loc_end in
- let k = analyse_module_type_kind env current_module_name module_type2 sig_module_type in
+ let erased = erased_names_of_constraints constraints erased in
+ let k = analyse_module_type_kind ~erased env current_module_name module_type2 sig_module_type in
+
Module_type_with (k, s)
)
@@ -1088,7 +1122,8 @@ module Analyser =
Module_type_typeof s
(** analyse of a Parsetree.module_type and a Types.module_type.*)
- and analyse_module_kind env current_module_name module_type sig_module_type =
+ and analyse_module_kind
+ ?(erased = Name.Set.empty) env current_module_name module_type sig_module_type =
match module_type.Parsetree.pmty_desc with
Parsetree.Pmty_ident longident ->
let k = analyse_module_type_kind env current_module_name module_type sig_module_type in
@@ -1096,6 +1131,7 @@ module Analyser =
| Parsetree.Pmty_signature signature ->
(
+ let signature = filter_out_erased_items_from_signature erased signature in
match sig_module_type with
Types.Mty_signature signat ->
Module_struct
@@ -1130,7 +1166,7 @@ module Analyser =
mp_kind = mp_kind ;
}
in
- let k = analyse_module_kind env
+ let k = analyse_module_kind ~erased env
current_module_name
module_type2
body_module_type
@@ -1141,13 +1177,14 @@ module Analyser =
(* if we're here something's wrong *)
raise (Failure "Parsetree.Pmty_functor _ but not Types.Mty_functor _")
)
- | Parsetree.Pmty_with (module_type2, _) ->
+ | Parsetree.Pmty_with (module_type2, constraints) ->
(*of module_type * (Longident.t * with_constraint) list*)
(
let loc_start = module_type2.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
let loc_end = module_type.Parsetree.pmty_loc.Location.loc_end.Lexing.pos_cnum in
let s = get_string_of_file loc_start loc_end in
- let k = analyse_module_type_kind env current_module_name module_type2 sig_module_type in
+ let erased = erased_names_of_constraints constraints erased in
+ let k = analyse_module_type_kind ~erased env current_module_name module_type2 sig_module_type in
Module_with (k, s)
)
| Parsetree.Pmty_typeof module_expr ->
@@ -1202,7 +1239,7 @@ module Analyser =
)
else
(
- raise (Failure "Parsetree.Pcty_fun (parse_label, _, pclass_type), labels différents")
+ raise (Failure "Parsetree.Pcty_fun (parse_label, _, pclass_type), labels differents")
)
| _ ->
@@ -1304,7 +1341,7 @@ module Analyser =
m_is_interface = true ;
m_file = !file_name ;
m_kind = Module_struct elements ;
- m_loc = { loc_impl = None ; loc_inter = Some (!file_name, 0) } ;
+ m_loc = { loc_impl = None ; loc_inter = Some (Location.in_file !file_name) } ;
m_top_deps = [] ;
m_code = None ;
m_code_intf = code_intf ;
diff --git a/ocamldoc/odoc_sig.mli b/ocamldoc/odoc_sig.mli
index 5717dc1f9..766994d71 100644
--- a/ocamldoc/odoc_sig.mli
+++ b/ocamldoc/odoc_sig.mli
@@ -156,7 +156,7 @@ module Analyser :
(** Return a module_type_kind from a Parsetree.module_type and a Types.module_type *)
val analyse_module_type_kind :
- Odoc_env.env -> Odoc_name.t ->
+ ?erased:Odoc_name.Set.t -> Odoc_env.env -> Odoc_name.t ->
Parsetree.module_type -> Types.module_type ->
Odoc_module.module_type_kind
diff --git a/ocamldoc/odoc_test.ml b/ocamldoc/odoc_test.ml
index 7b455f45b..a903b1c15 100644
--- a/ocamldoc/odoc_test.ml
+++ b/ocamldoc/odoc_test.ml
@@ -22,12 +22,13 @@ type test_kind =
let p = Format.fprintf
-module Generator =
+module Generator (G : Odoc_gen.Base) =
struct
-class string_gen =
+ class string_gen =
object(self)
inherit Odoc_info.Scan.scanner
+
val mutable test_kinds = []
val mutable fmt = Format.str_formatter
@@ -111,8 +112,12 @@ class string_gen =
class generator =
let g = new string_gen in
object
- method generate = g#generate
+ inherit G.generator as base
+
+ method generate l =
+ base#generate l;
+ g#generate l
end
end;;
-let _ = Odoc_args.set_generator (Odoc_gen.Other (module Generator : Odoc_gen.Base))
+let _ = Odoc_args.extend_base_generator (module Generator : Odoc_gen.Base_functor);;
diff --git a/ocamldoc/odoc_text.ml b/ocamldoc/odoc_text.ml
index b50a2dbd1..e80b680ed 100644
--- a/ocamldoc/odoc_text.ml
+++ b/ocamldoc/odoc_text.ml
@@ -133,6 +133,8 @@ module Texter =
| RK_attribute -> "attribute"
| RK_method -> "method"
| RK_section _ -> "section"
+ | RK_recfield -> "recfield"
+ | RK_const -> "const"
in
s^":"
)
diff --git a/ocamldoc/odoc_text_lexer.mll b/ocamldoc/odoc_text_lexer.mll
index 37d863181..a4888c1a8 100644
--- a/ocamldoc/odoc_text_lexer.mll
+++ b/ocamldoc/odoc_text_lexer.mll
@@ -22,10 +22,10 @@ let char_number = ref 0
let string_buffer = Buffer.create 32
-(** Fonction de remise à zéro de la chaine de caractères tampon *)
+(** Fonction de remise à zéro de la chaine de caractères tampon *)
let reset_string_buffer () = Buffer.reset string_buffer
-(** Fonction d'ajout d'un caractère dans la chaine de caractères tampon *)
+(** Fonction d'ajout d'un caractère dans la chaine de caractères tampon *)
let ajout_char_string = Buffer.add_char string_buffer
(** Add a string to the buffer. *)
@@ -161,6 +161,8 @@ let begin_clt_ref = "{!classtype:"blank_nl | "{!classtype:"
let begin_att_ref = "{!attribute:"blank_nl | "{!attribute:"
let begin_met_ref = "{!method:"blank_nl | "{!method:"
let begin_sec_ref = "{!section:"blank_nl | "{!section:"
+let begin_recf_ref = "{!recfield:"blank_nl | "{!recfield:"
+let begin_const_ref = "{!const:"blank_nl | "{!const:"
let begin_mod_list_ref = "{!modules:"blank_nl | "{!modules:"
let index_list = "{!indexlist}"
let begin_custom = "{"['a'-'z''A'-'Z']['a'-'z''A'-'Z''0'-'9']*
@@ -664,7 +666,38 @@ rule main = parse
Char (Lexing.lexeme lexbuf)
)
}
-
+| begin_recf_ref
+ {
+ incr_cpts lexbuf ;
+ if !verb_mode or !target_mode or !code_pre_mode or !open_brackets >= 1 then
+ Char (Lexing.lexeme lexbuf)
+ else
+ if not !ele_ref_mode then
+ (
+ ele_ref_mode := true;
+ RECF_REF
+ )
+ else
+ (
+ Char (Lexing.lexeme lexbuf)
+ )
+ }
+| begin_const_ref
+ {
+ incr_cpts lexbuf ;
+ if !verb_mode or !target_mode or !code_pre_mode or !open_brackets >= 1 then
+ Char (Lexing.lexeme lexbuf)
+ else
+ if not !ele_ref_mode then
+ (
+ ele_ref_mode := true;
+ CONST_REF
+ )
+ else
+ (
+ Char (Lexing.lexeme lexbuf)
+ )
+ }
| begin_mod_list_ref
{
incr_cpts lexbuf ;
diff --git a/ocamldoc/odoc_text_parser.mly b/ocamldoc/odoc_text_parser.mly
index 55909141b..6efc32f54 100644
--- a/ocamldoc/odoc_text_parser.mly
+++ b/ocamldoc/odoc_text_parser.mly
@@ -62,6 +62,8 @@ let print_DEBUG s = print_string s; print_newline ()
%token ATT_REF
%token MET_REF
%token SEC_REF
+%token RECF_REF
+%token CONST_REF
%token MOD_LIST_REF
%token INDEX_LIST
@@ -121,6 +123,8 @@ ele_ref_kind:
| ATT_REF { Some RK_attribute }
| MET_REF { Some RK_method }
| SEC_REF { Some (RK_section [])}
+| RECF_REF { Some RK_recfield }
+| CONST_REF { Some RK_const }
;
text_element:
diff --git a/ocamldoc/odoc_types.ml b/ocamldoc/odoc_types.ml
index 53a1ca5f9..d1ae70ef2 100644
--- a/ocamldoc/odoc_types.ml
+++ b/ocamldoc/odoc_types.ml
@@ -22,6 +22,8 @@ type ref_kind =
| RK_attribute
| RK_method
| RK_section of text
+ | RK_recfield
+ | RK_const
and text_element =
| Raw of string
@@ -91,8 +93,8 @@ let dummy_info = {
}
type location = {
- loc_impl : (string * int) option ;
- loc_inter : (string * int) option ;
+ loc_impl : Location.t option ;
+ loc_inter : Location.t option ;
}
let dummy_loc = { loc_impl = None ; loc_inter = None }
diff --git a/ocamldoc/odoc_types.mli b/ocamldoc/odoc_types.mli
index d4affb503..f6eca5d96 100644
--- a/ocamldoc/odoc_types.mli
+++ b/ocamldoc/odoc_types.mli
@@ -25,6 +25,8 @@ type ref_kind =
| RK_attribute
| RK_method
| RK_section of text
+ | RK_recfield
+ | RK_const
and text_element =
| Raw of string (** Raw text. *)
@@ -94,8 +96,8 @@ val dummy_info : info
(** Location of elements in implementation and interface files. *)
type location = {
- loc_impl : (string * int) option ; (** implementation file name and position *)
- loc_inter : (string * int) option ; (** interface file name and position *)
+ loc_impl : Location.t option ; (** implementation location *)
+ loc_inter : Location.t option ; (** interface location *)
}
(** A dummy location. *)
diff --git a/otherlibs/bigarray/.depend b/otherlibs/bigarray/.depend
index c70f81a52..889328a33 100644
--- a/otherlibs/bigarray/.depend
+++ b/otherlibs/bigarray/.depend
@@ -3,7 +3,7 @@ bigarray_stubs.o: bigarray_stubs.c ../../byterun/alloc.h \
../../byterun/../config/s.h ../../byterun/mlvalues.h bigarray.h \
../../byterun/config.h ../../byterun/mlvalues.h ../../byterun/custom.h \
../../byterun/fail.h ../../byterun/intext.h ../../byterun/io.h \
- ../../byterun/fix_code.h ../../byterun/memory.h ../../byterun/gc.h \
+ ../../byterun/hash.h ../../byterun/memory.h ../../byterun/gc.h \
../../byterun/major_gc.h ../../byterun/freelist.h \
../../byterun/minor_gc.h
mmap_unix.o: mmap_unix.c bigarray.h ../../byterun/config.h \
@@ -16,6 +16,6 @@ mmap_win32.o: mmap_win32.c bigarray.h ../../byterun/config.h \
../../byterun/mlvalues.h ../../byterun/config.h ../../byterun/misc.h \
../../byterun/alloc.h ../../byterun/mlvalues.h ../../byterun/custom.h \
../../byterun/fail.h ../../byterun/sys.h ../unix/unixsupport.h
-bigarray.cmi:
-bigarray.cmo: bigarray.cmi
-bigarray.cmx: bigarray.cmi
+bigarray.cmi :
+bigarray.cmo : bigarray.cmi
+bigarray.cmx : bigarray.cmi
diff --git a/otherlibs/bigarray/bigarray.mli b/otherlibs/bigarray/bigarray.mli
index 8b260bf79..fb252cb42 100644
--- a/otherlibs/bigarray/bigarray.mli
+++ b/otherlibs/bigarray/bigarray.mli
@@ -27,9 +27,9 @@
Big arrays support all the OCaml ad-hoc polymorphic operations:
- comparisons ([=], [<>], [<=], etc, as well as {!Pervasives.compare});
- hashing (module [Hash]);
- - and structured input-output ({!Pervasives.output_value}
- and {!Pervasives.input_value}, as well as the functions from the
- {!Marshal} module).
+ - and structured input-output (the functions from the
+ {!Marshal} module, as well as {!Pervasives.output_value}
+ and {!Pervasives.input_value}).
*)
(** {6 Element kinds} *)
diff --git a/otherlibs/bigarray/mmap_unix.c b/otherlibs/bigarray/mmap_unix.c
index 30294cc4b..44276f9bd 100644
--- a/otherlibs/bigarray/mmap_unix.c
+++ b/otherlibs/bigarray/mmap_unix.c
@@ -13,6 +13,10 @@
/* $Id$ */
+/* Needed (under Linux at least) to get pwrite's prototype in unistd.h.
+ Must be defined before the first system .h is included. */
+#define _XOPEN_SOURCE 500
+
#include <stddef.h>
#include <string.h>
#include "bigarray.h"
diff --git a/otherlibs/labltk/support/cltkFile.c b/otherlibs/labltk/support/cltkFile.c
index b4ebca614..c01f39545 100644
--- a/otherlibs/labltk/support/cltkFile.c
+++ b/otherlibs/labltk/support/cltkFile.c
@@ -16,10 +16,6 @@
/* $Id$ */
-#ifdef __CYGWIN__
-#define _WIN32
-#endif
-
#ifdef _WIN32
#include <wtypes.h>
#include <winbase.h>
diff --git a/otherlibs/num/.depend b/otherlibs/num/.depend
index 1e783ec0f..2013ac35b 100644
--- a/otherlibs/num/.depend
+++ b/otherlibs/num/.depend
@@ -1,11 +1,9 @@
bng.o: bng.c bng.h ../../byterun/config.h ../../byterun/../config/m.h \
../../byterun/../config/s.h ../../byterun/compatibility.h bng_amd64.c \
bng_digit.c
-bng_alpha.o: bng_alpha.c
bng_amd64.o: bng_amd64.c
bng_digit.o: bng_digit.c
bng_ia32.o: bng_ia32.c
-bng_mips.o: bng_mips.c
bng_ppc.o: bng_ppc.c
bng_sparc.o: bng_sparc.c
nat_stubs.o: nat_stubs.c ../../byterun/alloc.h \
@@ -13,28 +11,28 @@ nat_stubs.o: nat_stubs.c ../../byterun/alloc.h \
../../byterun/config.h ../../byterun/../config/m.h \
../../byterun/../config/s.h ../../byterun/mlvalues.h \
../../byterun/config.h ../../byterun/custom.h ../../byterun/intext.h \
- ../../byterun/io.h ../../byterun/fix_code.h ../../byterun/fail.h \
+ ../../byterun/io.h ../../byterun/fail.h ../../byterun/hash.h \
../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
../../byterun/freelist.h ../../byterun/minor_gc.h \
../../byterun/mlvalues.h bng.h nat.h
-arith_flags.cmi:
-arith_status.cmi:
-big_int.cmi: nat.cmi
-int_misc.cmi:
-nat.cmi:
-num.cmi: ratio.cmi nat.cmi big_int.cmi
-ratio.cmi: nat.cmi big_int.cmi
-arith_flags.cmo: arith_flags.cmi
-arith_flags.cmx: arith_flags.cmi
-arith_status.cmo: arith_flags.cmi arith_status.cmi
-arith_status.cmx: arith_flags.cmx arith_status.cmi
-big_int.cmo: nat.cmi int_misc.cmi big_int.cmi
-big_int.cmx: nat.cmx int_misc.cmx big_int.cmi
-int_misc.cmo: int_misc.cmi
-int_misc.cmx: int_misc.cmi
-nat.cmo: int_misc.cmi nat.cmi
-nat.cmx: int_misc.cmx nat.cmi
-num.cmo: ratio.cmi nat.cmi int_misc.cmi big_int.cmi arith_flags.cmi num.cmi
-num.cmx: ratio.cmx nat.cmx int_misc.cmx big_int.cmx arith_flags.cmx num.cmi
-ratio.cmo: nat.cmi int_misc.cmi big_int.cmi arith_flags.cmi ratio.cmi
-ratio.cmx: nat.cmx int_misc.cmx big_int.cmx arith_flags.cmx ratio.cmi
+arith_flags.cmi :
+arith_status.cmi :
+big_int.cmi : nat.cmi
+int_misc.cmi :
+nat.cmi :
+num.cmi : ratio.cmi nat.cmi big_int.cmi
+ratio.cmi : nat.cmi big_int.cmi
+arith_flags.cmo : arith_flags.cmi
+arith_flags.cmx : arith_flags.cmi
+arith_status.cmo : arith_flags.cmi arith_status.cmi
+arith_status.cmx : arith_flags.cmx arith_status.cmi
+big_int.cmo : nat.cmi int_misc.cmi big_int.cmi
+big_int.cmx : nat.cmx int_misc.cmx big_int.cmi
+int_misc.cmo : int_misc.cmi
+int_misc.cmx : int_misc.cmi
+nat.cmo : int_misc.cmi nat.cmi
+nat.cmx : int_misc.cmx nat.cmi
+num.cmo : ratio.cmi nat.cmi int_misc.cmi big_int.cmi arith_flags.cmi num.cmi
+num.cmx : ratio.cmx nat.cmx int_misc.cmx big_int.cmx arith_flags.cmx num.cmi
+ratio.cmo : nat.cmi int_misc.cmi big_int.cmi arith_flags.cmi ratio.cmi
+ratio.cmx : nat.cmx int_misc.cmx big_int.cmx arith_flags.cmx ratio.cmi
diff --git a/otherlibs/str/.depend b/otherlibs/str/.depend
index df6eb9af0..5be8377c2 100644
--- a/otherlibs/str/.depend
+++ b/otherlibs/str/.depend
@@ -4,6 +4,6 @@ strstubs.o: strstubs.c ../../byterun/mlvalues.h \
../../byterun/misc.h ../../byterun/alloc.h ../../byterun/mlvalues.h \
../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
../../byterun/freelist.h ../../byterun/minor_gc.h ../../byterun/fail.h
-str.cmi:
-str.cmo: str.cmi
-str.cmx: str.cmi
+str.cmi :
+str.cmo : str.cmi
+str.cmx : str.cmi
diff --git a/otherlibs/systhreads/.depend b/otherlibs/systhreads/.depend
index 9c6889b70..85add2e59 100644
--- a/otherlibs/systhreads/.depend
+++ b/otherlibs/systhreads/.depend
@@ -9,18 +9,18 @@ st_stubs.o: st_stubs.c ../../byterun/alloc.h \
../../byterun/mlvalues.h ../../byterun/printexc.h ../../byterun/roots.h \
../../byterun/memory.h ../../byterun/signals.h ../../byterun/stacks.h \
../../byterun/sys.h threads.h st_posix.h
-condition.cmi: mutex.cmi
-event.cmi:
-mutex.cmi:
-thread.cmi:
-threadUnix.cmi:
-condition.cmo: mutex.cmi condition.cmi
-condition.cmx: mutex.cmx condition.cmi
-event.cmo: mutex.cmi condition.cmi event.cmi
-event.cmx: mutex.cmx condition.cmx event.cmi
-mutex.cmo: mutex.cmi
-mutex.cmx: mutex.cmi
-thread.cmo: thread.cmi
-thread.cmx: thread.cmi
-threadUnix.cmo: thread.cmi threadUnix.cmi
-threadUnix.cmx: thread.cmx threadUnix.cmi
+condition.cmi : mutex.cmi
+event.cmi :
+mutex.cmi :
+thread.cmi :
+threadUnix.cmi :
+condition.cmo : mutex.cmi condition.cmi
+condition.cmx : mutex.cmx condition.cmi
+event.cmo : mutex.cmi condition.cmi event.cmi
+event.cmx : mutex.cmx condition.cmx event.cmi
+mutex.cmo : mutex.cmi
+mutex.cmx : mutex.cmi
+thread.cmo : thread.cmi
+thread.cmx : thread.cmi
+threadUnix.cmo : thread.cmi threadUnix.cmi
+threadUnix.cmx : thread.cmx threadUnix.cmi
diff --git a/otherlibs/threads/.depend b/otherlibs/threads/.depend
index 7ce4479a4..bc03050be 100644
--- a/otherlibs/threads/.depend
+++ b/otherlibs/threads/.depend
@@ -9,24 +9,27 @@ scheduler.o: scheduler.c ../../byterun/alloc.h \
../../byterun/mlvalues.h ../../byterun/printexc.h ../../byterun/roots.h \
../../byterun/memory.h ../../byterun/signals.h ../../byterun/stacks.h \
../../byterun/sys.h
-condition.cmi: mutex.cmi
-event.cmi:
-mutex.cmi:
-thread.cmi: unix.cmo
-threadUnix.cmi: unix.cmo
-condition.cmo: thread.cmi mutex.cmi condition.cmi
-condition.cmx: thread.cmx mutex.cmx condition.cmi
-event.cmo: mutex.cmi condition.cmi event.cmi
-event.cmx: mutex.cmx condition.cmx event.cmi
-marshal.cmo: pervasives.cmo
-marshal.cmx: pervasives.cmx
-mutex.cmo: thread.cmi mutex.cmi
-mutex.cmx: thread.cmx mutex.cmi
-pervasives.cmo: unix.cmo
-pervasives.cmx: unix.cmx
-thread.cmo: unix.cmo thread.cmi
-thread.cmx: unix.cmx thread.cmi
-threadUnix.cmo: unix.cmo thread.cmi threadUnix.cmi
-threadUnix.cmx: unix.cmx thread.cmx threadUnix.cmi
-unix.cmo:
-unix.cmx:
+condition.cmi : mutex.cmi
+event.cmi :
+marshal.cmi :
+mutex.cmi :
+pervasives.cmi :
+thread.cmi : unix.cmi
+threadUnix.cmi : unix.cmi
+unix.cmi :
+condition.cmo : thread.cmi mutex.cmi condition.cmi
+condition.cmx : thread.cmx mutex.cmx condition.cmi
+event.cmo : mutex.cmi condition.cmi event.cmi
+event.cmx : mutex.cmx condition.cmx event.cmi
+marshal.cmo : pervasives.cmi marshal.cmi
+marshal.cmx : pervasives.cmx marshal.cmi
+mutex.cmo : thread.cmi mutex.cmi
+mutex.cmx : thread.cmx mutex.cmi
+pervasives.cmo : unix.cmi pervasives.cmi
+pervasives.cmx : unix.cmx pervasives.cmi
+thread.cmo : unix.cmi thread.cmi
+thread.cmx : unix.cmx thread.cmi
+threadUnix.cmo : unix.cmi thread.cmi threadUnix.cmi
+threadUnix.cmx : unix.cmx thread.cmx threadUnix.cmi
+unix.cmo : unix.cmi
+unix.cmx : unix.cmi
diff --git a/otherlibs/threads/event.mli b/otherlibs/threads/event.mli
index 11842e5ad..eb37f0124 100644
--- a/otherlibs/threads/event.mli
+++ b/otherlibs/threads/event.mli
@@ -59,8 +59,8 @@ val wrap_abort : 'a event -> (unit -> unit) -> 'a event
val guard : (unit -> 'a event) -> 'a event
(** [guard fn] returns the event that, when synchronized, computes
- [fn()] and behaves as the resulting event. This allows to
- compute events with side-effects at the time of the synchronization
+ [fn()] and behaves as the resulting event. This allows events with
+ side-effects to be computed at the time of the synchronization
operation. *)
val sync : 'a event -> 'a
diff --git a/otherlibs/win32unix/accept.c b/otherlibs/win32unix/accept.c
index 68c7bac7a..48d028790 100644
--- a/otherlibs/win32unix/accept.c
+++ b/otherlibs/win32unix/accept.c
@@ -26,15 +26,30 @@ CAMLprim value unix_accept(sock)
SOCKET sconn = Socket_val(sock);
SOCKET snew;
value fd = Val_unit, adr = Val_unit, res;
+ int oldvalue, oldvaluelen, newvalue, retcode;
union sock_addr_union addr;
socklen_param_type addr_len;
DWORD err = 0;
+ oldvaluelen = sizeof(oldvalue);
+ retcode = getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
+ (char *) &oldvalue, &oldvaluelen);
+ if (retcode == 0) {
+ /* Set sockets to synchronous mode */
+ newvalue = SO_SYNCHRONOUS_NONALERT;
+ setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
+ (char *) &newvalue, sizeof(newvalue));
+ }
addr_len = sizeof(sock_addr);
enter_blocking_section();
snew = accept(sconn, &addr.s_gen, &addr_len);
if (snew == INVALID_SOCKET) err = WSAGetLastError ();
leave_blocking_section();
+ if (retcode == 0) {
+ /* Restore initial mode */
+ setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
+ (char *) &oldvalue, oldvaluelen);
+ }
if (snew == INVALID_SOCKET) {
win32_maperr(err);
uerror("accept", Nothing);
diff --git a/otherlibs/win32unix/socket.c b/otherlibs/win32unix/socket.c
index 4aabe5e45..908ffb729 100644
--- a/otherlibs/win32unix/socket.c
+++ b/otherlibs/win32unix/socket.c
@@ -33,6 +33,7 @@ CAMLprim value unix_socket(domain, type, proto)
value domain, type, proto;
{
SOCKET s;
+ int oldvalue, oldvaluelen, newvalue, retcode;
#ifndef HAS_IPV6
/* IPv6 requires WinSock2, we must raise an error on PF_INET6 */
@@ -42,9 +43,23 @@ CAMLprim value unix_socket(domain, type, proto)
}
#endif
+ oldvaluelen = sizeof(oldvalue);
+ retcode = getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
+ (char *) &oldvalue, &oldvaluelen);
+ if (retcode == 0) {
+ /* Set sockets to synchronous mode */
+ newvalue = SO_SYNCHRONOUS_NONALERT;
+ setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
+ (char *) &newvalue, sizeof(newvalue));
+ }
s = socket(socket_domain_table[Int_val(domain)],
socket_type_table[Int_val(type)],
Int_val(proto));
+ if (retcode == 0) {
+ /* Restore initial mode */
+ setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
+ (char *) &oldvalue, oldvaluelen);
+ }
if (s == INVALID_SOCKET) {
win32_maperr(WSAGetLastError());
uerror("socket", Nothing);
diff --git a/stdlib/scanf.mli b/stdlib/scanf.mli
index bb68d40fc..879851436 100644
--- a/stdlib/scanf.mli
+++ b/stdlib/scanf.mli
@@ -144,7 +144,7 @@ val open_in_bin : file_name -> in_channel;;
*)
val close_in : in_channel -> unit;;
-(** Closes the [Pervasives.input_channel] associated with the given
+(** Closes the [Pervasives.in_channel] associated with the given
[Scanning.in_channel] formatted input channel.
@since 3.12.0
*)
diff --git a/tools/Makefile.shared b/tools/Makefile.shared
index 4729fef31..39004d41e 100644
--- a/tools/Makefile.shared
+++ b/tools/Makefile.shared
@@ -23,7 +23,8 @@ INCLUDES=-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp \
COMPFLAGS= -warn-error A $(INCLUDES)
LINKFLAGS=$(INCLUDES)
-all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib dumpobj objinfo
+all: ocamldep ocamlprof ocamlcp ocamloptp ocamlmktop ocamlmklib dumpobj \
+ objinfo read_cmt
# scrapelabels addlabels
@@ -71,13 +72,23 @@ ocamlprof: $(CSLPROF) profiling.cmo
ocamlcp: ocamlcp.cmo
$(CAMLC) $(LINKFLAGS) -o ocamlcp warnings.cmo main_args.cmo ocamlcp.cmo
+ocamloptp: ocamloptp.cmo
+ $(CAMLC) $(LINKFLAGS) -o ocamloptp warnings.cmo main_args.cmo \
+ ocamloptp.cmo
+
+opt:: profiling.cmx
+
install::
cp ocamlprof $(BINDIR)/ocamlprof$(EXE)
cp ocamlcp $(BINDIR)/ocamlcp$(EXE)
+ cp ocamloptp $(BINDIR)/ocamloptp$(EXE)
cp profiling.cmi profiling.cmo $(LIBDIR)
+installopt::
+ cp profiling.cmx profiling.o $(LIBDIR)
+
clean::
- rm -f ocamlprof ocamlcp
+ rm -f ocamlprof ocamlcp ocamloptp
# To help building mixed-mode libraries (OCaml + C)
@@ -224,12 +235,8 @@ READ_CMT= \
read_cmt: $(READ_CMT)
$(CAMLC) $(LINKFLAGS) -o read_cmt $(READ_CMT)
-# read_cmt is precious: sometimes we are stuck in the middle of a
-# bootstrap and we need to remake the dependencies
-clean::
- if test -f read_cmt; then mv -f read_cmt read_cmt.bak; else :; fi
-
clean::
+ rm -f read_cmt
beforedepend::
diff --git a/tools/make-package-macosx b/tools/make-package-macosx
index 222df8221..1b8c205a7 100755
--- a/tools/make-package-macosx
+++ b/tools/make-package-macosx
@@ -86,15 +86,17 @@ mkdir -p resources
# stop here -> |
cat >resources/ReadMe.txt <<EOF
This package installs OCaml version ${VERSION}.
-You need Mac OS X 10.5.x (Leopard), with the
-XCode tools installed (v3.1.1 or later), and
-optionally X11.
+You need Mac OS X 10.7.x (Lion), with the
+XCode tools installed (v3.2.6 or later).
Files will be installed in the following directories:
/usr/local/bin - command-line executables
/usr/local/lib/ocaml - library and support files
/usr/local/man - manual pages
+
+Note that this package installs only command-line
+tools and does not include any GUI application.
EOF
chmod -R g-w root
diff --git a/tools/make-version-header.sh b/tools/make-version-header.sh
new file mode 100755
index 000000000..22320ec16
--- /dev/null
+++ b/tools/make-version-header.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#########################################################################
+# #
+# OCaml #
+# #
+# Damien Doligez, projet Gallium, INRIA Rocquencourt #
+# #
+# Copyright 2003 Institut National de Recherche en Informatique et #
+# en Automatique. All rights reserved. As an exception to the #
+# licensing rules of OCaml, this file is freely redistributable, #
+# modified or not, without constraints. #
+# #
+#########################################################################
+
+# For maximal compatibility with older versions, we Use "ocamlc -v"
+# instead of "ocamlc -vnum" or the VERSION file in .../lib/ocaml/.
+
+# This script extracts the components from an OCaml version number
+# and provides them as C defines:
+# OCAML_VERSION_MAJOR: the major version number
+# OCAML_VERSION_MAJOR: the minor version number
+# OCAML_VERSION_PATCHLEVEL: the patchlevel number if present, or 0 if absent
+# OCAML_VERSION_ADDITIONAL: this is defined only if the additional-info
+# field is present, and is a string that contains that field.
+# Note that additional-info is always absent in officially-released
+# versions of OCaml.
+
+version="`ocamlc -v | sed -n -e 's/.*version //p'`"
+
+major="`echo "$version" | sed -n -e '1s/^\([0-9]*\)\..*/\1/p'`"
+minor="`echo "$version" | sed -n -e '1s/^[0-9]*\.\([0-9]*\).*/\1/p'`"
+patchlevel="`echo "$version" | sed -n -e '1s/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p'`"
+suffix="`echo "$version" | sed -n -e '1s/^[^+]*+\(.*\)/\1/p'`"
+
+echo "#define OCAML_VERSION_MAJOR $major"
+echo "#define OCAML_VERSION_MINOR $minor"
+case $patchlevel in "") patchlevel=0;; esac
+echo "#define OCAML_VERSION_PATCHLEVEL $patchlevel"
+case "$suffix" in
+ "") echo "#undef OCAML_VERSION_ADDITIONAL";;
+ *) echo "#define OCAML_VERSION_ADDITIONAL \"$suffix\"";;
+esac
diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
index 885117e10..953dd250a 100644
--- a/tools/ocamlcp.ml
+++ b/tools/ocamlcp.ml
@@ -104,7 +104,7 @@ let add_profarg s =
;;
let optlist =
- ("-p", Arg.String add_profarg,
+ ("-P", Arg.String add_profarg,
"[afilmt] Profile constructs specified by argument (default fm):\n\
\032 a Everything\n\
\032 f Function calls and method calls\n\
@@ -112,6 +112,7 @@ let optlist =
\032 l while and for loops\n\
\032 m match ... with\n\
\032 t try ... with")
+ :: ("-p", Arg.String add_profarg, "[afilmt] Same as option -P")
:: Options.list
in
Arg.parse optlist process_file usage;
diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml
index eee0ae5b7..eaf58f5b2 100644
--- a/tools/ocamldep.ml
+++ b/tools/ocamldep.ml
@@ -200,7 +200,8 @@ let report_err source_file exn =
| Sys_error msg ->
Format.fprintf Format.err_formatter "@[I/O error:@ %s@]@." msg
| Pparse.Error ->
- Format.fprintf Format.err_formatter "@[Preprocessing error on file %s@]@."
+ Format.fprintf Format.err_formatter
+ "@[Preprocessing error on file %s@]@."
source_file
| x -> raise x
@@ -226,8 +227,7 @@ let ml_file_dependencies source_file =
print_raw_dependencies source_file extracted_deps
end else begin
let basename = Filename.chop_extension source_file in
- let byte_targets =
- if !native_only then [] else [ basename ^ ".cmo" ] in
+ let byte_targets = [ basename ^ ".cmo" ] in
let native_targets =
if !all_dependencies
then [ basename ^ ".cmx"; basename ^ ".o" ]
@@ -235,13 +235,16 @@ let ml_file_dependencies source_file =
let init_deps = if !all_dependencies then [source_file] else [] in
let cmi_name = basename ^ ".cmi" in
let init_deps, extra_targets =
- if List.exists (fun ext -> Sys.file_exists (basename ^ ext)) !mli_synonyms
+ if List.exists (fun ext -> Sys.file_exists (basename ^ ext))
+ !mli_synonyms
then (cmi_name :: init_deps, cmi_name :: init_deps), []
- else (init_deps, init_deps), ( if !all_dependencies then [cmi_name] else [] ) in
+ else (init_deps, init_deps),
+ (if !all_dependencies then [cmi_name] else [])
+ in
let (byt_deps, native_deps) =
Depend.StringSet.fold (find_dependency ML)
extracted_deps init_deps in
- if not !native_only then print_dependencies (byte_targets @ extra_targets) byt_deps;
+ print_dependencies (byte_targets @ extra_targets) byt_deps;
print_dependencies (native_targets @ extra_targets) native_deps;
end
@@ -370,36 +373,36 @@ let _ =
Clflags.classic := false;
add_to_load_path Filename.current_dir_name;
Arg.parse [
+ "-all", Arg.Set all_dependencies,
+ " Generate dependencies on all files";
"-I", Arg.String add_to_load_path,
"<dir> Add <dir> to the list of include directories";
"-impl", Arg.String (file_dependencies_as ML),
- "<f> Process <f> as a .ml file";
+ "<f> Process <f> as a .ml file";
"-intf", Arg.String (file_dependencies_as MLI),
- "<f> Process <f> as a .mli file";
+ "<f> Process <f> as a .mli file";
"-ml-synonym", Arg.String(add_to_synonym_list ml_synonyms),
- "<e> Consider <e> as a synonym of the .ml extension";
+ "<e> Consider <e> as a synonym of the .ml extension";
"-mli-synonym", Arg.String(add_to_synonym_list mli_synonyms),
- "<e> Consider <e> as a synonym of the .mli extension";
- "-sort", Arg.Set sort_files,
- " Sort files according to their dependencies";
+ "<e> Consider <e> as a synonym of the .mli extension";
"-modules", Arg.Set raw_dependencies,
- " Print module dependencies in raw form (not suitable for make)";
+ " Print module dependencies in raw form (not suitable for make)";
"-native", Arg.Set native_only,
- " Generate dependencies for a pure native-code project (no .cmo files)";
- "-all", Arg.Set all_dependencies,
- " Generate dependencies on all files (not accommodating for make shortcomings)";
+ " Generate dependencies for native-code only (no .cmo files)";
"-one-line", Arg.Set one_line,
- " Output one line per file, regardless of the length";
+ " Output one line per file, regardless of the length";
"-pp", Arg.String(fun s -> Clflags.preprocessor := Some s),
- "<cmd> Pipe sources through preprocessor <cmd>";
+ "<cmd> Pipe sources through preprocessor <cmd>";
"-ppx", Arg.String(fun s -> Clflags.ppx := s :: !Clflags.ppx),
"<cmd> Pipe abstract syntax trees through preprocessor <cmd>";
"-slash", Arg.Set force_slash,
- " (Windows) Use forward slash / instead of backslash \\ in file paths";
+ " (Windows) Use forward slash / instead of backslash \\ in file paths";
+ "-sort", Arg.Set sort_files,
+ " Sort files according to their dependencies";
"-version", Arg.Unit print_version,
- " Print version and exit";
+ " Print version and exit";
"-vnum", Arg.Unit print_version_num,
- " Print version number and exit";
+ " Print version number and exit";
] file_dependencies usage;
if !sort_files then sort_files_by_dependencies !files;
exit (if !error_occurred then 2 else 0)
diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml
new file mode 100644
index 000000000..0d87ef2d9
--- /dev/null
+++ b/tools/ocamloptp.ml
@@ -0,0 +1,158 @@
+(***********************************************************************)
+(* *)
+(* OCaml *)
+(* *)
+(* Damien Doligez, projet Gallium, INRIA Rocquencourt *)
+(* *)
+(* Copyright 2012 Institut National de Recherche en Informatique et *)
+(* en Automatique. All rights reserved. This file is distributed *)
+(* under the terms of the Q Public License version 1.0. *)
+(* *)
+(***********************************************************************)
+
+(* $Id: ocamlcp.ml 11890 2011-12-20 10:35:43Z frisch $ *)
+
+open Printf
+
+let compargs = ref ([] : string list)
+let profargs = ref ([] : string list)
+let toremove = ref ([] : string list)
+
+let option opt () = compargs := opt :: !compargs
+let option_with_arg opt arg =
+ compargs := (Filename.quote arg) :: opt :: !compargs
+;;
+let option_with_int opt arg =
+ compargs := (string_of_int arg) :: opt :: !compargs
+;;
+
+let make_archive = ref false;;
+let with_impl = ref false;;
+let with_intf = ref false;;
+let with_mli = ref false;;
+let with_ml = ref false;;
+
+let process_file filename =
+ if Filename.check_suffix filename ".ml" then with_ml := true;
+ if Filename.check_suffix filename ".mli" then with_mli := true;
+ compargs := (Filename.quote filename) :: !compargs
+;;
+
+let usage = "Usage: ocamloptp <options> <files>\noptions are:"
+
+let incompatible o =
+ fprintf stderr "ocamloptp: profiling is incompatible with the %s option\n" o;
+ exit 2
+
+module Options = Main_args.Make_optcomp_options (struct
+ let _a () = make_archive := true; option "-a" ()
+ let _absname = option "-absname"
+ let _annot = option "-annot"
+ let _binannot = option "-bin-annot"
+ let _c = option "-c"
+ let _cc s = option_with_arg "-cc" s
+ let _cclib s = option_with_arg "-cclib" s
+ let _ccopt s = option_with_arg "-ccopt" s
+ let _compact = option "-compact"
+ let _config = option "-config"
+ let _for_pack s = option_with_arg "-for-pack" s
+ let _g = option "-g"
+ let _i = option "-i"
+ let _I s = option_with_arg "-I" s
+ let _impl s = with_impl := true; option_with_arg "-impl" s
+ let _inline n = option_with_int "-inline" n
+ let _intf s = with_intf := true; option_with_arg "-intf" s
+ let _intf_suffix s = option_with_arg "-intf-suffix" s
+ let _labels = option "-labels"
+ let _linkall = option "-linkall"
+ let _no_app_funct = option "-no-app-funct"
+ let _noassert = option "-noassert"
+ let _noautolink = option "-noautolink"
+ let _nodynlink = option "-nodynlink"
+ let _nolabels = option "-nolabels"
+ let _nostdlib = option "-nostdlib"
+ let _o s = option_with_arg "-o" s
+ let _output_obj = option "-output-obj"
+ let _p = option "-p"
+ let _pack = option "-pack"
+ let _pp s = incompatible "-pp"
+ let _ppx s = incompatible "-ppx"
+ let _principal = option "-principal"
+ let _rectypes = option "-rectypes"
+ let _runtime_variant s = option_with_arg "-runtime-variant" s
+ let _S = option "-S"
+ let _strict_sequence = option "-strict-sequence"
+ let _shared = option "-shared"
+ let _thread = option "-thread"
+ let _unsafe = option "-unsafe"
+ let _v = option "-v"
+ let _version = option "-version"
+ let _vnum = option "-vnum"
+ let _verbose = option "-verbose"
+ let _w = option_with_arg "-w"
+ let _warn_error = option_with_arg "-warn-error"
+ let _warn_help = option "-warn-help"
+ let _where = option "-where"
+
+ let _nopervasives = option "-nopervasives"
+ let _dparsetree = option "-dparsetree"
+ let _drawlambda = option "-drawlambda"
+ let _dlambda = option "-dlambda"
+ let _dclambda = option "-dclambda"
+ let _dcmm = option "-dcmm"
+ let _dsel = option "-dsel"
+ let _dcombine = option "-dcombine"
+ let _dlive = option "-dlive"
+ let _dspill = option "-dspill"
+ let _dsplit = option "-dsplit"
+ let _dinterf = option "-dinterf"
+ let _dprefer = option "-dprefer"
+ let _dalloc = option "-dalloc"
+ let _dreload = option "-dreload"
+ let _dscheduling = option "-dscheduling"
+ let _dlinear = option "-dlinear"
+ let _dstartup = option "-dstartup"
+
+ let anonymous = process_file
+end);;
+
+let add_profarg s =
+ profargs := (Filename.quote s) :: "-m" :: !profargs
+;;
+
+let optlist =
+ ("-P", Arg.String add_profarg,
+ "[afilmt] Profile constructs specified by argument (default fm):\n\
+ \032 a Everything\n\
+ \032 f Function calls and method calls\n\
+ \032 i if ... then ... else\n\
+ \032 l while and for loops\n\
+ \032 m match ... with\n\
+ \032 t try ... with")
+ :: Options.list
+in
+Arg.parse optlist process_file usage;
+if !with_impl && !with_intf then begin
+ fprintf stderr "ocamloptp cannot deal with both \"-impl\" and \"-intf\"\n";
+ fprintf stderr "please compile interfaces and implementations separately\n";
+ exit 2;
+end else if !with_impl && !with_mli then begin
+ fprintf stderr "ocamloptp cannot deal with both \"-impl\" and .mli files\n";
+ fprintf stderr "please compile interfaces and implementations separately\n";
+ exit 2;
+end else if !with_intf && !with_ml then begin
+ fprintf stderr "ocamloptp cannot deal with both \"-intf\" and .ml files\n";
+ fprintf stderr "please compile interfaces and implementations separately\n";
+ exit 2;
+end;
+if !with_impl then profargs := "-impl" :: !profargs;
+if !with_intf then profargs := "-intf" :: !profargs;
+let status =
+ Sys.command
+ (Printf.sprintf "ocamlopt -pp \"ocamlprof -instrument %s\" %s %s"
+ (String.concat " " (List.rev !profargs))
+ (if !make_archive then "" else "profiling.cmx")
+ (String.concat " " (List.rev !compargs)))
+in
+exit status
+;;
diff --git a/tools/setignore b/tools/setignore
index 708ed26cc..2c2e06704 100755
--- a/tools/setignore
+++ b/tools/setignore
@@ -27,6 +27,7 @@
*.byte
*.native
program
+program.exe
.depend
.depend.nt
diff --git a/utils/warnings.ml b/utils/warnings.ml
index e44874031..02621ea67 100644
--- a/utils/warnings.ml
+++ b/utils/warnings.ml
@@ -348,14 +348,14 @@ let descriptions =
5, "Partially applied function: expression whose result has function\n\
\ type and is ignored.";
6, "Label omitted in function application.";
- 7, "Some methods are overridden in the class where they are defined.";
+ 7, "Method overridden.";
8, "Partial match: missing cases in pattern-matching.";
9, "Missing fields in a record pattern.";
10, "Expression on the left-hand side of a sequence that doesn't have type\n\
\ \"unit\" (and that is not a function, see warning number 5).";
11, "Redundant case in a pattern matching (unused match case).";
12, "Redundant sub-pattern in a pattern-matching.";
- 13, "Override of an instance variable.";
+ 13, "Instance variable overridden.";
14, "Illegal backslash escape in a string constant.";
15, "Private method made public implicitly.";
16, "Unerasable optional argument.";
diff --git a/yacc/.ignore b/yacc/.ignore
index bf37bf6c4..833c2dea6 100644
--- a/yacc/.ignore
+++ b/yacc/.ignore
@@ -1,3 +1,4 @@
ocamlyacc
+ocamlyacc.exe
version.h
.gdb_history