Commit Graph

2207 Commits (master)

Author SHA1 Message Date
Jeremy Yallop 73a37d45f8 Add Seq.unfold. 2020-01-15 15:38:46 +00:00
Armaël Guéneau 390d4e3ce5
Merge pull request #9227 from yallop/bool-identity
Make Bool.to_int primitive.
2020-01-15 13:27:29 +01:00
Gabriel Scherer bc574f542e [minor] Format: factorize check_geometry to avoid invariant duplication 2020-01-14 16:26:21 +01:00
Gabriel Scherer c41b282899 Format.pp_update_geometry: formatter -> (geometry -> geometry) -> unit
This lets users write code that is robust to the addition of new
geometry fields.

    Format.(pp_update_geometry ppf (fun geo -> {geo with ...}))

Today the only way to set the geometry is

    Format.pp_set_geometry ppf ~margin ~max_indent

we cannot add optional parameters after the [ppf] argument, and adding
new labeled parameters would break user code.

(Also: it's often convenient to work with the record directly, for
example to reset a previous geometry saved with [pp_get_geometry];
this is indirectly provided by [pp_update_geometry].)
2020-01-14 16:26:21 +01:00
Gabriel Scherer 87b027d9ec [minor] fix an indentation mistake in Format.pp_set_geometry 2020-01-14 16:23:18 +01:00
Jacques-Henri Jourdan e1a22e80fb Memprof API: cannot be start if already running, cannot be stopped if not already running. 2020-01-14 10:42:16 +01:00
Jeremy Yallop 38eb6d5f64
Add Array.for_all2 and Array.exists2 (#9235)
* Partially revert "Removed for_all2, exists2 and find again."

This partially reverts commit 83dcf62ebf.

(Restore for_all2 and exists2.)

* Partially revert "Fixed typos and changed exists2 and for_all2."

This partially reverts commit 7a082785be.

* Array.(for_all2,exists2): simplify documentation; add @since annotations

* Changes: remove trailing whitespace
2020-01-13 13:52:39 +00:00
Jacques-Henri Jourdan 0c8416478c Drop support for tags in memprof.
They are somewhat difficult to handle for native allocations, and it is not clear how useful they are. Moreover, they are easy to add back since [Gc.Memprof.allocation] is a private record.
2020-01-11 13:19:10 +01:00
Jeremy Yallop 37a6919ae2 Make Bool.to_int primitive. 2020-01-07 09:32:29 +00:00
hhugo 475df06021 stdlib: cleanup in Char.ml by using char range patterns (#9221)
stdlib/char.ml: [minor] use range patterns for {lowercase,uppercase} functions
2020-01-04 15:15:52 +01:00
Nicolás Ojeda Bär 55d286505c Merge pull request #9217 from kit-ty-kate/fix-doc-filename-null
Add missing since annotation for Filename.null

(cherry picked from commit bb62942ed5c3081d295e0b78a1c16cfb9061b613)
2019-12-30 05:22:21 +01:00
Jacques-Henri Jourdan 7dbbfce890 New ephemeron-free API for Memprof.
The user can register several callbacks, which are called for various
events during the block's lifetime. We need to maintain a data
structure for tracked blocks in the runtime. When using threads,
callbacks can be called concurrently in a reentrant way, so the
functions manipulating this data structure need to be reentrant.
2019-12-21 10:21:48 +01:00
Florian Angeletti 0921138b69 fix Stdlib.Lexing documentation 2019-12-12 14:42:21 +01:00
Gabriel Scherer 238e483eb8 better documentation for the best-fit allocation policy 2019-12-10 21:40:50 +01:00
Brian Wignall 2cd1db7ae9 Fix some spelling typos 2019-11-29 10:17:38 -05:00
Konstantin Romanov a9b0ca44d2 Add set_position and set_filename to Lexing. 2019-11-16 22:14:16 +00:00
Bernhard Schommer e5ebec7058 Fold map function for List (#8894)
The fold_map function is quite common combination of fold and map
which allow it to pass an accumulator through map.
2019-11-07 14:12:58 +01:00
zapashcanon c0e4096eaa add List.filteri to the stdlib (#9059) 2019-10-29 09:45:19 +01:00
Guillaume Munch-Maccagnoni 1220986b72 [minor] typo 2019-10-16 14:22:49 +02:00
Florian Angeletti 7c7f77cf98
Merge pull request #9024 from foocraft/fix_arraylabels_docs
Fixes to ArrayLabels documentation
2019-10-15 22:50:50 +02:00
Damien Doligez 01bdd5bbc4
best-fit allocator (#8809) 2019-10-15 13:52:16 +02:00
El-Hassan Wanas 8a614d79de Comment fixes
Co-Authored-By: David Allsopp <david.allsopp@metastack.com>
2019-10-15 14:14:31 +03:00
ElHassan Wanas e271e8fa4d Updated documentation for StringLabels, ArrayLabels, ListLabels and BytesLabels to show StdLabels usage 2019-10-15 12:44:44 +03:00
ElHassan Wanas fd8094e99a - Removal of all references to either Array or ArrayLabels from the
ArrayLabels documentation
- Only references remaining are for the warnings, and they refer to
  Array rather than ArrayLabels
2019-10-15 12:44:44 +03:00
El-Hassan Wanas b19f13768f Replaced old exception documentation in ArrayLabels with `@raise`
Deprecated warnings should point to `Array` alternatives rather than
those in `ArrayLabels`
Removed module references from function docs to avoid confusing between
StdLabels, Array and ArrayLabels

No change entry needed
2019-10-15 12:44:44 +03:00
El-Hassan Wanas f35ee6b458 Fixes to ArrayLabels documentation
- Removal of string arguments from exceptions in docs
- Changed references to ArrayLabels instead of Array whenever
  a labeled argument is present
- Fixes to code examples using the wrong argument(wrong name, or missing label)

No change entry needed
2019-10-15 12:44:44 +03:00
Gabriel Scherer cc1a05b055
Merge pull request #8651 from proux01/printf-h
Add printf '%#F' to output floats in hexadecimal OCaml constants
2019-10-14 11:43:01 +02:00
Jacques-Henri Jourdan 23e5bfa3bb Better stack backtraces for C calls in bytecode (#8641)
The previous mechanism worked for C calls that raise an exception, but not for C calls that call back into OCaml code which raises an exception.

This commit addresses the issue by saving the PC in the interpreter stack before a C call, so that the backtrace mechanism always sees it.

However, if an external is declared in the .ml file and exposed in the .mli file as a val, then ocamlc generates a wrapper that adds a spurious entry in the stack frame. In this PR, this change in behavior results in the re-declaration of Printexc.get_callstack as an external instead of a val, so that the spurious stack frame does not appear in call stacks obtained from Printexc.get_callstack.
2019-10-12 18:25:58 +02:00
David Allsopp fb6f58ea69
Merge pull request #8951 from shindere/make-default-target
Let make's default target build the compiler
2019-10-04 14:23:27 +01:00
Nicolás Ojeda Bär 46ca15365a
Merge pull request #8971 from nojb/filename_nul
Add Filename.null
2019-10-03 18:05:52 +02:00
Guillaume Munch-Maccagnoni b304042b29 Fix missing Caml_state (#8940)
* Fix free identifiers in spacetime

* Fix free identifiers in tools/gdb-macros

* [minor] Fix Caml_state fields in comments, and other comment updates

* Changes
2019-10-03 16:27:32 +02:00
Nicolás Ojeda Bär f1c4c6a1c1 Add Filename.null 2019-10-03 13:55:22 +02:00
Gabriel Scherer ba90da42ac List.concat_map : ('a -> 'b list) -> 'a list -> 'b list (#8760) 2019-10-01 15:53:14 +01:00
Nicolás Ojeda Bär 9c41f700c1
Merge pull request #9000 from nojb/option_join_micro
Tidy-up Option.join
2019-10-01 11:02:06 +02:00
Sébastien Hinderer 987b0814d7 Let make's default target build the compiler
This commit makes it possible to build the OCaml compiler according to
its configuration by simply runnning make. There is no need to specify
neither world nor world.opt explicitly, although the two targets
remain available.

This commit also introduces (and starts making use of) the
NATIVE_COMPILER build variable whosse value is true when the native
compiler is enabled and false otherwise.
2019-09-30 16:01:29 +02:00
Nicolás Ojeda Bär b5feac6b8c (Micro-)optimize Option.join 2019-09-30 14:29:08 +02:00
Nicolás Ojeda Bär 467395babb Update stdlib/HACKING.adoc 2019-09-30 13:56:48 +02:00
Nicolás Ojeda Bär dd30bd9786 Share list of modules in StdlibModules 2019-09-29 11:07:50 +02:00
Pierre Roux 1e3cd41fe7 Add printf `%#F` to output floats in hexadecimal OCaml constants 2019-09-26 15:55:32 +02:00
Jeremie Dimino 2d31ebfc8b Add support for [@@immediate64]
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2019-09-24 07:56:15 +01:00
Gabriel Scherer 5c7c619d4d List.find_map : ('a -> 'b option) -> 'a list -> 'b option (#8832) 2019-09-13 17:58:01 +02:00
Sébastien Hinderer 5ec649f0cb
Build system: share rules to compile C files (#8930)
This commit deduplicates some of the Makefile rules used to compile C files.

Rather than having one such rule per Makefile for each directory
containing C files, the relevant rules are moved to Makefile.common.in.
2019-09-11 09:16:15 +02:00
Thomas Blanc fe9f2ad6ec Fix typos in Bytes documentation 2019-09-06 16:16:41 +02:00
Jacques-Henri Jourdan 90073e96e5 Memprof tracking of interned data. 2019-08-27 19:14:56 +02:00
Gabriel Scherer 4c303cc88a Merge pull request #8826 from glondu/4.08-spelling-errors
Fix spelling errors reported by Lintian

(cherry picked from commit c808ce7068f3e31975594bcd5e6a41dceab3a80e)
2019-07-29 08:36:53 +02:00
Gabriel Scherer 1837dee56e
Merge pull request #8530 from gadmm/sort
List.sort: avoid duplicate work by chop
2019-07-26 06:48:08 +02:00
Guillaume Munch-Maccagnoni a1c05e3157 List.sort: avoid duplicate work by chop
David Allsopp: Remove unrelated reformatting
2019-07-25 22:31:39 +02:00
David Allsopp 94c5cbfb8d Refactor stdlib/hashtbl.ml
No code changes - move the definitions to ensure that the functorial
interface doesn't accidentally rely on polymorphic hash function.
2019-07-19 13:17:52 +01:00
Gabriel Scherer 364d07589b
Merge pull request #8526 from gretay-js/function-sections
Function sections
2019-07-16 13:39:55 +02:00
Alain Frisch 430c20bb78
A new runtime primitive for Array.fill (#8716) 2019-07-16 09:21:23 +02:00
Greta Yorsh 351edb49bb Add compile-time option -function-sections 2019-07-15 10:25:26 +01:00
Leo White 74e1a85b72 Update depends 2019-07-10 19:23:21 +01:00
David Allsopp 7c2284eda3 Rename references to Pervasives to Stdlib 2019-06-26 18:11:58 +01:00
Guillaume Munch-Maccagnoni 6a6f34e483 Fix typographic issues in the doc of new modules (#8744)
* Fix typographic issues in the doc of new modules

No change entry needed
2019-06-26 19:03:15 +02:00
Xavier Leroy a8daa89500 Add Filename.quote_command function (#1492)
MPR#7672: add a Filename.quote_command function

This function takes care of quoting the command and its arguments
so that they are correctly parsed by the system shell
(/bin/sh for Unix, cmd.exe for Win32).

Redirections for std input (< file) and std output (> file) and
std error (2> file) can also be specified as optional arguments.
A 2>&1 redirection is used if stdout and stderr are redirected to the
same file.

The result is a string that can be passed directly to Sys.command or
to the Unix functions that expect shell command lines.
2019-06-25 14:21:58 +02:00
Thibault Suzanne 7bba7b8e5c Fix Option.bind doc comment 2019-06-15 16:03:43 +02:00
Stephen Dolan 0cdb711f35
Merge pull request #8691 from jhjourdan/no_callback_c_alloc
Guarantee that allocation functions do no trigger callbacks when called from C
2019-06-11 09:50:34 +01:00
Damien Doligez 9a9223098c Fix the installation of the camlheader[di] files. They were installed under
the wrong names, which made -runtime-variant fail for bytecode.
2019-06-10 11:17:54 +01:00
Gabriel Scherer a9be9a4dba camlinternalFormat: fix the Formatting_gen case in fmt_of_string
Two bugs were present before the patch:

- Formatting_gen would always be printed as "@{",
  so for example "@[foo@]" would be reprinted as "@{foo@]"

- The Formatting_gen payload would be printed as a string literal,
  escaping '%', while it is a raw string representation of a format;
  so for example "@[<%d>" would be reprinted as "@[<%%d>"

  (This second bug was spotted by Florian Angeletti)
2019-06-06 12:50:22 +02:00
Gabriel Scherer bd6ef8413e Camlinternalformat: remove faulty check_open_box function
- Currently the check is a no-op, because the "emit a warning if the
  check fails" was never implemented. (It would actually require some
  work to pass a source location there to emit a warning, so it's not
  trivial.)

- The check is implemented by calling `open_box_of_string` and
  catching the `Failure _` exception if that function fails. This is
  just wrong: `Failure _` should be reserved to fatal program errors,
  and should not be caught for control-flow.

- The current implement is buggy (it fails all the time, but we don't
  notice because no warning is emitted):
  CamlinternalFormat.open_box_of_string expects a string of the form
  "v 3", but check_open_box would pass a string of the form "<v 3>"
  (or an empty string), which is the payload of the format value. So
  the check always fails.

- The idea of the check is wrong: "@[<x>foo@]" is an incorrect format
  string to pass to Format (the box indication does not make sense),
  but it is a perfectly fine format string to pass to Printf, where it
  just prints "@[<x>foo@]" on the output. So we cannot complain to the
  user at type-checking time, when we don't know how the format string
  will be used, whether the boxes will be interpreted as actual boxes
  or string literals.
2019-06-06 12:43:27 +02:00
Jacques-Henri Jourdan 0ca84f52cd Refactor the postponed blocks machinery in memprof.c
This makes sure that:
- Callbacks are never called when another is running
- The postponed queue is purged when setting memprof parameters

We now use a FIFO implemented as a circular buffer for remembering of
postponed blocks.
2019-06-05 14:25:33 +02:00
Stephen Dolan 16611aacc1
Merge branch 'trunk' into memprof_binomial 2019-05-27 11:32:07 +01:00
Gabriel Scherer e973cde5a4
Merge pull request #8685 from Fourchaux/trunk
Fixing misspellings
2019-05-24 06:58:30 +02:00
Jacques-Henri Jourdan b838e48c39 Memprof: Instead of a Poisson process, use a binomial distribution.
The workaround used for ignoring samples in the minor heap in native
mode now makes allocation very slow (or non-terminating) when the
sampling rate is not small enough. This will be fixed when sampling in
the minor heap in native mode will be implemented.
2019-05-21 17:10:16 +02:00
Damien Doligez 1d7740f624 additional fixes for #8634 2019-05-21 12:44:10 +02:00
JPR 6dc59549ce Fixing misspellings 2019-05-21 10:23:27 +02:00
Damien Doligez 1aeb9b2301 typos in comments 2019-05-20 16:49:40 +02:00
Jacques-Henri Jourdan cea1ff7534 Memprof sampling for blocks in the minor heap, allocated by C code.
Allocations ignored by this version
- Marshalling
- In the minor heap by natively-compiled OCaml code

Allocations potentially sampled
- In the major heap
- In the minor heap by C code and OCaml code in bytecode mode
2019-05-20 13:04:28 +02:00
Jacques-Henri Jourdan 052a950dea Statistical memory profiling of blocks allocated in the major heap. 2019-05-09 16:40:45 +02:00
Nicolás Ojeda Bär 89b1ab4aca
Merge pull request #8605 from alainfrisch/fix_hashtbl_to_seq_XXX_doc
Improve doc for Hashtbl.to_seq*
2019-05-09 11:00:05 +02:00
Stephen Dolan c24e5b5c8a Ensure that Gc.minor_words remains accurate after a GC (#8619)
If an allocation fails, the decrement of young_ptr should be undone
before the GC is entered. This happened correctly on bytecode but not
on native code.

This commit (squash of pull request #8619) fixes it for all the
platforms supported by ocamlopt.

amd64: add alternate entry points caml_call_gc{1,2,3} for code size
optimisation.

powerpc: introduce one GC call point per allocation size per function.
Each call point corrects the allocation pointer r31 before calling
caml_call_gc.

i386, arm, arm64, s390x: update the allocation pointer after the
conditional branch to the GC, not before.

arm64: simplify the code generator: Ialloc can assume that less than
0x1_0000 bytes are allocated, since the max allocation size for the
minor heap is less than that.

This is a partial cherry-pick of commit 8ceec on multicore.
2019-05-04 10:01:23 +02:00
David Allsopp 8838dc7527 Don't generate #! headers over 127 characters
A #! line should not exceed 128 characters (including the \0
terminator). This adds a test - both to the generation of the camlheader
files and also to the -use-runtime flag which falls back to #!/bin/sh
and uses exec to invoke the the interpreter.
2019-05-02 20:29:49 +02:00
Gabriel Scherer c107e00ce5 Fix the string.mli documentation of unsafe-string (#8653)
unsafe-string is no longer the default since 4.06.
2019-05-02 19:24:53 +02:00
Sébastien Hinderer cf8d6fd803 Fix build of standard library
There were a few buggy rules in stdlib/Makefile, fix them.
2019-04-20 14:28:57 +01:00
Gabriel Scherer f138e1be40 buffer: more detailed explanation of the [resize] reasoning 2019-04-16 17:29:26 +02:00
Gabriel Scherer 52a5c3fae8 refine the [resize] post-condition
See https://github.com/ocaml/ocaml/pull/8596#issuecomment-480812433
2019-04-16 10:05:54 +02:00
Gabriel Scherer 91daa22489 Buffer: actually enforce the invariant that (b.position <= b.length)
See https://github.com/ocaml/ocaml/pull/8596#issuecomment-480760172
and the rest of the conversation.
2019-04-16 10:05:54 +02:00
Gabriel Scherer b4cda227ae clarify the add_channel logic 2019-04-16 10:05:54 +02:00
Andrew Litteken d4ef2eecea Custom Exception Handlers at toplevel (#8594)
fixes #7156 

Two new functions exposed:

```ocaml
val to_string_default: exn -> string
(** [Printexc.to_string_default e] returns a string representation of the
    exception [e], ignoring all registered exception printers.
    @since 4.09
*)

val use_printers: exn -> string option
(** [Printexc.use_printers e] returns [None] if there are no registered
    printers and [Some s] with else as the resulting string otherwise.
    @since 4.09
*)
```
2019-04-14 15:38:27 +02:00
Sébastien Hinderer 49ce3b0611 Revert "Get rid of the stdlib/Compflags script (#8601)"
This reverts commit 0dec0ce9d6.
2019-04-11 15:52:41 +02:00
Sébastien Hinderer f7ba9367ec Revert "Fix typo in stdlib/Makefile"
This reverts commit b29e8979ec.
2019-04-11 15:52:03 +02:00
Nicolás Ojeda Bär 8897fe60cc make clean: do not remove emacs backups 2019-04-10 14:18:04 +02:00
alainfrisch e122acc1e7 Stronger spec for Hashtbl.to_seq w.r.t. multiple bindings on the same key 2019-04-10 13:20:46 +02:00
alainfrisch 8e695e3fbe Fix doc for Hashtbl.to_seq_keys, to_seq_values 2019-04-10 12:59:36 +02:00
Sébastien Hinderer b29e8979ec Fix typo in stdlib/Makefile 2019-04-10 12:09:19 +02:00
Sébastien Hinderer 0dec0ce9d6
Get rid of the stdlib/Compflags script (#8601)
This script was used to provide module-specific compiler flags.
Now that we use GNU make, these flags can be handled by make itslef.
2019-04-10 10:57:05 +02:00
David Allsopp 278e5abbc0 Merge the generation of stdlib/camlheader* (#2267)
Windows and Unix build instructions for the program versions of the
header stubs unified. For Cygwin, this also fixes the parallel build.
2019-04-10 00:52:48 +02:00
Damien Doligez 4e59ae10dd add assertion and comments suggested by @gasche 2019-04-08 14:16:26 +02:00
Damien Doligez ee1c8b4082 optimize more functions 2019-04-08 11:47:43 +02:00
Damien Doligez c7c44e13b0 add labels to Bytes.unsafe_blit_string 2019-04-08 11:41:29 +02:00
Damien Doligez 2085db3c3c #6148: optimize some buffer operations 2019-04-08 11:10:39 +02:00
Stephen Dolan 466d3bcc84 Deprecate Obj.truncate and bootstrap. 2019-04-01 14:17:39 +01:00
Stephen Dolan 18edce3b5f Remove use of Obj.truncate from toplevel.
When running a script with "ocaml foo.ml", the toplevel needs to
run foo.ml with a different Sys.argv than the initial value, since
foo.ml must not see the initial "ocaml" argument.

Previously, this was done with Obj.truncate to shorten the Sys.argv
array. This patch changes it by introducing a primitive %sys_argv.
Uses of this primitive expand to a call to a new C primitive, which
returns the argv array (and can be modified by the toplevel).
2019-04-01 14:14:00 +01:00
Stephen Dolan 501bd0bb36 Remove use of Obj.truncate from CamlinternalMod.
CamlinternalMod contains an optimisation for the initialisation
of recursive modules containing closures, where dummy closures
are updated in-place. This optimisation was buggy on bytecode,
since the bytecode interpreter relies on the lengths of blocks
containing closures (see #4008).

This commit disables the optimisation for bytecode (where it
had much less effect than on native code, and where performance
is of less concern anyway). The optimisation is still applied
on native-code, but without the use of Obj.truncate.

Also adds a test for #4008 (which introduced the truncate).
2019-04-01 14:10:12 +01:00
Stephen Dolan faab2a81ce Remove a use of Obj.truncate in weak.ml 2019-04-01 14:03:38 +01:00
David Allsopp 947486007e Fix Hashtbl.Make.of_seq creating randomized tables
Book-keeping error only - although it does potentially initialise the PRNG
unnecessarily.
2019-03-29 11:11:41 +01:00
David Allsopp fc8be501aa Fix Hashtbl.MakeSeeded.{add,replace,of}_seq
Hashtbl.MakeSeeded.{add,replace}_seq were not using the hash function
provided by the functor (Hashtbl.MakeSeeded.of_seq uses replace_seq and
so also has to be redefined locally).
2019-03-29 11:11:41 +01:00
Stephen Dolan f495bfb7cb
Merge pull request #8514 from stedolan/boot-ocamlc-opt
Use boot/ocamlc.opt for building, if available.
2019-03-22 12:22:14 +00:00
Stephen Dolan 46c427f519 Use boot/ocamlc.opt for building, if available. 2019-03-20 10:31:46 +00:00
Nicolás Ojeda Bär 74c94835b3 Add Unit to stdlib.ml{,i} 2019-03-19 12:29:20 +01:00
Mark Shinwell 2cc1ea26b9 Remove gprof support (#2314)
This commit removes support for gprof-based profiling (the -p option to ocamlopt).  It follows a discussion on the core developers' list, which indicated that removing gprof support was a reasonable thing to do. The rationale is that there are better easy-to-use profilers out there now, such as perf for Linux and Instruments on macOS; and the gprof support has always been patchy across targets. We save a whole build of the runtime and simplify some other parts of the codebase by removing it.
2019-03-16 19:56:53 +01:00
thierry-martinez 815c275529 Fix documentation for Result.bind: return [f v] and not [Ok (f v)] (#8503) 2019-03-15 00:37:20 +01:00
Pierre Roux ed74b5b237 Enforce precision in printf %F 2019-03-09 12:03:43 +01:00
Daniel Bünzli f7cf156e19 stdlib.mli: add a stable doc link to the list of modules. 2019-02-19 11:40:57 +00:00
Gabriel Scherer 5a29ea7c2b
Merge pull request #1725 from stedolan/deprecate-set-tag
Deprecate Obj.set_tag
2019-02-14 15:16:48 +01:00
Fourchaux 1946594bd7 Fixing typos in various files (#2246)
Note: Typos found with https://github.com/codespell-project/codespell

Here is the (semi-manual) command used to get (and correct) the typos:

$ codespell -i 3 -w --skip=".png,.gif,./ocaml/boot,./ocaml/.git,./ocaml/manual/styles,./ocaml/manual/manual/htmlman" -L minimise,instal,contructor,"o'caml",cristal,pres,clos,cmo,uint,iff,te,objext,nto,nd,mut,upto,larg,exten,leage,mthod,delte,tim,atleast,langage,hten,iwth,mke,contant,succint,methids,eles,valu,clas,modul,que,classe,missings,froms,defaut,correspondance,differents,configury,reachs,cas,approche,normale,dur,millon,amin,oje,transfert
2019-02-13 14:04:56 +01:00
Stephen Dolan c39f771a33 Deprecate Obj.set_tag.
- Adds Obj.with_tag as a partial replacement.
  - Adds caml_obj_make_forward for use of Camlinternal{Lazy,Mod}
2019-02-12 11:13:48 +00:00
Guillaume Munch-Maccagnoni f68692ebc2 Improve protect
- Treat as an error the case where ~finally raises an exception

- Move to Fun module

- Describe the purpose in the documentation

- Remove boilerplate

https://github.com/ocaml/ocaml/pull/2118
2019-02-03 12:27:27 +01:00
Richard Bonichon 1aa856270b [format] Make the code respect the documentation for set_max_indent
Nothing should happen when new maximum indentation is smaller than 2.
2019-01-16 10:04:30 +01:00
Sébastien Hinderer d258bb78ac Build system: use ocamlc -depend rather than ocamldep 2019-01-03 16:43:23 +01:00
Florian Angeletti e8d4324ee6
documentation: use Bigarray consistently (#2208) 2018-12-20 18:46:54 +01:00
Armaël Guéneau 3735b4ab20
Fix markup in the documentation for List.init (#2203) 2018-12-17 11:27:47 +01:00
Armaël Guéneau 8e9c4a1561 Fix docstring for Queue.of_seq 2018-12-16 18:37:09 +01:00
Florian Angeletti cbd0753ec6
manual: move lazy pattern to core (#2198) 2018-12-14 17:40:43 +01:00
Gabriel Scherer 49ff642ae5
Merge pull request #2189 from gasche/ocamldep-one-file-per-line
Ocamldep one file per line
2018-12-12 17:00:10 +01:00
Thomas Refis 742c65d30b List.filter_map (#2185) 2018-12-12 16:29:50 +01:00
Gabriel Scherer 295f71cb96 make alldepend (with new one-dep-per-file printing) 2018-12-12 09:38:49 +01:00
Gabriel Scherer 46ef054330 Makefiles: restructure CAMLDEP usage to easily add flags
This change should be a refactoring no-op.

Before, a DEPFLAGS variable existed in some makefiles to contain
include directories to be passed to ocamldep invocations, but no
support for easily adding command-line flags to ocamldep was available
(invocations would systematically use -slash, which was duplicated
across callsites).

With this PR, a new DEPINCLUDES variable contains the include
directories, and DEPFLAGS is repurposed to contain other command-line
flags for the tool -- currently "slash".
2018-12-12 09:30:55 +01:00
Florian Angeletti 0335966003 stdlib doc: avoid implicit order on bindings (#2194) 2018-12-11 00:22:22 +01:00
Jeremy Yallop 9797cadfd8 Map: use '_key' and 'key' rather than 'k' in the 'union' documentation 2018-12-10 13:17:13 +00:00
Jeremy Yallop 3812748a72 Map: fix documentation for 'union'
The function takes the key as argument, not just the values.
2018-12-10 13:01:44 +00:00
Vladimir Keleshev bc42e885bf Format.pp_print_custom_break, a more general break hint 2018-12-07 10:56:03 +01:00
Florian Angeletti ffb920ff86
MPR#7528: Format.pp_set_geometry (#1500)
* MPR#7528: Format.pp_set_geometry
* add geometry type and validation function
* add a safe variant to set_geometry
2018-12-04 17:03:05 +01:00
Thomas Refis b0de482c5e dune: fix stdlib build 2018-12-04 11:42:11 +00:00
Hugo Heuzard 3da5c94333 Fix type equality for result type 2018-12-03 18:14:11 +00:00
Thomas Refis f9b8935b2e
make alldepend (#2181) 2018-12-03 18:15:28 +01:00
Damien Doligez fc60f71b45
add Stdlib.Float.Array (#1936)
Add Stdlib.Float.Array module with a bunch of functions for the
floatarray type.
2018-12-03 14:08:56 +01:00
Pierre-Marie Pédrot 94175c9f60 Mark the Bytes.equal external as not-allocating C. 2018-11-21 13:09:42 +01:00
Pierre-Marie Pédrot 7a53fe1cf9 Mark the String.equal external as not-allocating C.
It is indeed a mere loop that does not allocate. This function was probably
forgotten because its code was hidden deep in the module.
2018-11-21 11:43:08 +01:00
Leo White fc1e6ad5a2 Update .depend 2018-11-21 03:39:34 -05:00
Gabriel Scherer f9e1c09f38
Merge pull request #2148 from stedolan/make-parallel-lazy
Fix a make -j bug, by ensuring Lazy depends on CamlinternalLazy.
2018-11-18 12:11:58 +01:00
Stephen Dolan 122c5218e0 Fix a make -j bug, by ensuring Lazy depends on CamlinternalLazy.
Without this patch, make -j often fails to build the stdlib with
a message along the lines of:

    no cmx file was found in path for module CamlinternalLazy

The issue is that stdlib files that use `lazy` actually depend on
camlinternalLazy.cmi because matching.ml expands lazy pattern
matches to code that refers to CamlinternalLazy. However, since
this dependency does not appear in the source code, there is no
way for ocamldep to discover it. This means that when building
the stdlib, there is no constraint ensuring that CamlinternalLazy
is built before stdlib modules using Lazy.

This causes issues with parallel make, but the issue can be
reproduced using a sequential make invocation:

    cd stdlib
    make clean
    make stdlib_stream.cmo

This patch adds a dependency on CamlinternalLazy into lazy.mli.
Its presence makes ocamldep see that all files that use Lazy also
depend on camlinternalLazy.cmi.
2018-11-14 17:33:51 +00:00
Damien Doligez bc3942bbb8
Merge pull request #676 from bobot/ephemeron_c_api2
Ephemeron C API
2018-11-14 11:50:22 +01:00
Damien Doligez 9e5e37c975
deprecate the mutability of Gc.control record fields (#2145)
deprecate the mutability of Gc.control record fields
2018-11-13 13:43:34 +01:00
Gabriel Scherer 8396c0b8bc make alldepend 2018-11-11 17:20:27 +01:00
Nicolás Ojeda Bär feead05553 Doc 2018-11-10 12:48:33 +01:00
Nicolas Ojeda Bar 30969895ac Add {Int32,Int64,Nativeint}.unsigned_{compare,div,rem} 2018-11-10 12:48:11 +01:00
Alain Frisch 1ec0ece0ab
Extend Bytes and Buffer with functions to read/write binary representations of numbers (#1864) 2018-11-09 13:40:33 +01:00
Daniel Bünzli acb0e91ac6 Stdlib doc: harmonize heading levels again. (#2142) 2018-11-08 17:33:55 +01:00
Thomas Refis bf78bacb14 stdlib/dune: add new modules 2018-11-08 16:11:27 +00:00
François Bobot 0ed143afa4 [Weak] Changes from reviews
from Frédéric Bour (@let-def)
   from Mark Shinwell (@mshinwell)

  particularly:
    - in *_copy, avoid an infinite loop by triggering a minor collection
      after 8 rounds. But since truncation and tag setting will be
      deprecated we could soon remove this code.
2018-11-08 16:16:32 +01:00
François Bobot 9e34215044 [Weak] Move checks from C to Ocaml
Simpler to write and to optimize
2018-11-08 16:16:09 +01:00
yallop ee1c2a4d7e Add paths for built-in types (#1876)
* Add an Extension_constructor submodule to Obj.

Deprecate top-level functions extension_constructor / extension_name /
extension_id.

* Add 'true' and 'false' to the definition of Bool.t

* Add aliases for the built-in 'list' and 'array' types.

* Add an alias for 'exn' to Printexc.

* Changes entry: built-in type aliases

* Add a Unit module.

* Add paths for built-in exceptions.
2018-11-08 16:08:17 +01:00
Alain Frisch a7a76fd4e8
Filename.chop_suffix_opt (#2125) 2018-11-08 08:50:39 +01:00
Daniel Bünzli a7afd89003 s/string_of_int/Int.to_string/g 2018-11-07 13:52:02 +01:00
Florian Angeletti 9f01a08a2b
Merge pull request #2117 from Octachron/stdlib_precedence_table_3
documentation: precedence table for the standard library.
2018-11-06 22:18:48 +01:00
François Bobot 83ff5cb963 [Changes] the C-layout of weak arrays changed 2018-11-06 16:15:54 +01:00
Florian Angeletti 088cf98b77 documentation: fix a warning in latex mode 2018-11-06 13:48:02 +01:00
Damien Doligez 17b64ac2b2
Add caml_alloc_custom_mem (#1738)
* add caml_alloc_custom_mem and corresponding GC parameters
* fix a bug in tests/misc/ephetest2.ml
2018-11-06 13:42:48 +01:00
Daniel Bünzli 89e48a38e9 Stdlib: add Fun module. (#2129)
* Stdlib: add Fun module.

* Stdlib: rename Bool.negate to Fun.negate.
2018-11-06 10:36:07 +01:00
Florian Angeletti cbd4f71a39 documentation: move operator table to a new page 2018-11-04 17:49:22 +01:00
Gabriel Scherer f8f04e771d clarify Set.diff documentation (#2119)
fixes [MPR#7868](https://caml.inria.fr/mantis/view.php?id=7868)
2018-10-26 15:30:16 +02:00
Florian Angeletti 5e056cf812 make precedence appendix an appendix 2018-10-26 12:59:47 +02:00
Florian Angeletti c19ba5cab3 review: typo + synchronisation comment 2018-10-26 11:26:07 +02:00
Laurent Thévenoux db99969bc8 Support FMA operation (#1354)
Adds a fused multiply-add operation to the Float module.

The following changes are made:
- configure: check math.h for the C99 fma() operation.
- fma declarations in float.ml[i] (stdlib/).
- C fma() call or emulation in runtime/floats.c.
- dedicated tests in testsuite/tests/fma.
2018-10-26 10:45:36 +02:00
Florian Angeletti bb1c5cd1ae doc: replace ordinal precedence with links 2018-10-25 18:29:32 +02:00
Florian Angeletti a2ab9d0ef2 stdlib documentation: precedence table 2018-10-25 18:29:32 +02:00
Nicolás Ojeda Bär fcb68de43b
Merge pull request #2010 from dbuenzli/bool-support
Improve stdlib support for `bool`
2018-10-23 14:54:26 +02:00
Christophe Troestler 00f9739dcb Extend Stdlib.Float with more functions (#1794) 2018-10-23 13:21:09 +02:00
Daniel Bünzli ff5a02c95a Remove Bool.of_string. 2018-10-23 11:35:08 +02:00
Daniel Bünzli fdba70136f Stdlib: add Bool module. 2018-10-23 11:35:08 +02:00
Nicolás Ojeda Bär 90d9b2287a
Merge pull request #2011 from dbuenzli/int-support
Improve stdlib support for `int`
2018-10-23 11:23:14 +02:00
Gabriel Scherer c48371c8bf
Merge pull request #1596 from Octachron/format_doc_max_indent
MPR#7720, format documentation: maximum indentation limit
2018-10-16 16:33:07 +02:00
Etienne Millon 530c99838e Fix link markup in Gc.finalise_last documentation 2018-10-11 16:11:20 +02:00
Thomas Refis d68e0e2077
Provide a way to build the bytecode compiler using Dune (#2093) 2018-10-10 16:16:00 +01:00
Daniel Bünzli 6a94394cb8 Remove Int.of_string. 2018-10-09 11:33:08 +02:00
Daniel Bünzli 5846aecee6 Stdlib: add Int module. 2018-10-09 10:20:39 +02:00
Nicolás Ojeda Bär 1f25d35237 Fix windows ANSI locale: use CP_ACP instead of CP_THREAD_ACP (#2062)
* Fix windows ANSI locale: use CP_ACP instead of CP_THREAD_ACP

* Update Changes
2018-10-03 14:19:07 +02:00
Foo Chuan Wei 7a89937764
Fix typo in Scanf docs
'String.unescaped' -> 'Scanf.unescaped'
2018-09-21 18:13:32 +08:00
Sébastien Hinderer 01b65ac0af Introduce and use ROOTDIR in more makefiles 2018-09-17 14:51:01 +02:00
Sébastien Hinderer ba6362a07d Move config/Makefile to Makefile.config
In order to prepare the transition to autoconf, this commit moves the
configuration Makefile out of the config directory which will disappear
and gives it the name it will have once intstalled, namely Makefile.config.
2018-09-17 14:23:35 +02:00
Gabriel Scherer 4317153910
Merge pull request #1995 from TheAspiringHacker/stdlib-contrib-docs
Add documentation for contributing to the stdlib
2018-09-06 08:31:44 +02:00
octachron 075bf9bed6 doc: remove unprefix trick 2018-09-03 13:59:32 +01:00
octachron adf4c4c37b documentation: detail Format's maximum indent 2018-09-03 13:44:07 +02:00
Drup bbadeee53d Introduce semantic tags as an extensible sum type. 2018-09-02 12:11:55 +02:00
Gabriel Scherer ac265e9ea3 (minor) remove unused CAMLYACC variables 2018-09-01 23:17:06 +02:00
Jeremie Dimino 7cf321a3cf Update the deprecation message for Stdlib.Pervasives
Make it point to stdlib-shims
2018-08-28 16:25:45 +01:00
Gabriel Scherer 6744597090
Merge pull request #2007 from Octachron/nme_integers
documentation: move 32/64/native literals out of the extension chapter
2018-08-27 14:57:11 +02:00
Jérémie Dimino 9124ab82d1
Deprecate Pervasives (#1605)
- inline Pervasives in Stdlib and re-add Pervasives as a deprecated
module that aliases all elements of Stdlib except the stdlib modules.

- remove special case for Stdlib.Pervasives in printtyp.ml
2018-08-27 12:42:14 +01:00
octachron e407ab3829 documentation: promote 32/64/native literals
* Move the description of these literals to refman/const.etex and
refman/lex.etex
* Mention their existence in library/builtins.etex
* Add examples to Int32, Int64 and NativeInt module documentation
2018-08-27 11:08:11 +02:00
David Allsopp 64074e33ec Typo in docs for Option module 2018-08-23 15:36:47 +01:00
TheAspiringHacker 00953cc221 Correct wrong instructions for otherlibs/threads/Makefile; state that partialclean may be used instead of clean 2018-08-20 21:12:53 -04:00
TheAspiringHacker 001dcf2dc6 Update link text of stdlib/HACKING.adoc to use paths relative to file 2018-08-19 16:01:02 -04:00
TheAspiringHacker ecbca3a493 Rewrite stdlib/README.md as stdlib/HACKING.adoc 2018-08-19 15:15:40 -04:00
TheAspiringHacker 0de45db6a5 Add documentation for contributing to the stdlib 2018-08-19 12:58:51 -04:00
Nicolás Ojeda Bär 5289ee6889 Set.disjoint: add @since annotation 2018-08-16 22:09:11 +05:30
Nicolás Ojeda Bär 8ec445eb1c Add Set.Make(_).disjoint 2018-08-10 16:23:15 +02:00
Gabriel Scherer 87855ffcae make alldepend 2018-08-09 22:10:54 +02:00
Nicolás Ojeda Bär 4a2b27afd0
Merge pull request #1855 from mseri/pervasive-finally
Add "finally" function to Pervasives
2018-08-08 17:31:01 +02:00
Nicolás Ojeda Bär 09b4aee5a4
Merge pull request #1940 from dbuenzli/option-support
Improve stdlib support for option values
2018-08-08 13:48:50 +02:00
Gabriel Scherer ed97c44bd2
Merge pull request #1948 from keleshev/refactor-format
Refactor Format module to use Queue and Stack
2018-08-08 12:58:45 +02:00
Daniel Bünzli f9c97d16c0 Add Format.pp_print_option. 2018-08-08 11:45:35 +02:00
Daniel Bünzli 1798999b65 Stdlib: add Option module. 2018-08-08 11:41:09 +02:00
Vladimir Keleshev cac5702555 Format: make `pp_skip_token` gracefully handle empty queue
Function `pp_skip_token` had a comment saying that the queue is never empty
when it is called.  However, I came up with a unit test that falsifies that
invariant, see `pp_skip_token.ml`. This prompted to change `pp_skip_token` to
gracefully handle the case when the queue is empty. Before, the invariant was
wrong, but the code still worked correctly because the exception would have
been caught in `advance_left` which used to use `Queue.Empty` exception for
control flow.
2018-08-08 11:12:20 +02:00
Daniel Bünzli 51802eddc7 Add Format.pp_print_result. 2018-08-08 10:34:07 +02:00
Daniel Bünzli b7affbb9ef Stdlib: add Result module. 2018-08-08 10:34:03 +02:00
Vladimir Keleshev c11c7d7cae Format: remove make_queue_element
Since it doesn't bring anything to the table. Use record constructor instead.
2018-08-07 21:29:43 +02:00
Vladimir Keleshev 1193d6591c Format: convert pp_format_elem into a record type
For better readability.
2018-08-07 21:29:38 +02:00
Vladimir Keleshev 903341bcf9 Format: convert pp_scan_elem into a record type
For better readability.
2018-08-07 21:29:23 +02:00
Vladimir Keleshev ff79fcc329 Format: rename pp_queue_elem.elem_size to size
The original name is tautological, plus the new name works better with
record field punning.
2018-08-07 21:23:46 +02:00