Commit Graph

2207 Commits (master)

Author SHA1 Message Date
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
Vladimir Keleshev f8c72d5b8e Format: replace inline list stacks with Stdlib.Stack
This reduces the volume of code in Format and adds clarity by using a
familiar Stack interface. However, this introduces a dependency from
Format to Stack.
2018-08-07 21:22:23 +02:00
Vladimir Keleshev cd958be9b6 Format: replace bespoke queue for Stdlib.Queue
This reduces the volume of code in Format and adds clarity by using a
familiar Queue interface. However, this introduces a dependency from
Format to Queue.

Note, `state.pp_queue` was unnecessarily mutable.
2018-08-07 21:16:59 +02:00
Vladimir Keleshev c1036e199d Format: introduce Size module
Use proper abstract module instead of "%identity" trick.
Add Size.unknown and Size.is_unknown to aid readability
instead of relying on a comment saying that negative
sizes mean unkown sizes.
2018-08-07 21:16:59 +02:00
Marcello Seri 129458bf0f stdlib: address @nojb review comments
Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
2018-08-07 20:29:07 +02:00
Marcello Seri 5c0b6f71bd stdlib: rename try_finally to protect
As a result of the poll in #1855.
The votes at the time of commiting are:

- 18 for `protect ~finally`
- 12 for `try_finally ~finally`
- 1  for `finally ~cleanup`
- 0  for `try_finally ~always`
- 0  for `try_finally ~cleanup`

Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
2018-08-07 20:26:05 +02:00
Marcello Seri ecb27c8dab stdlib: simplify try_finally docstring
Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
2018-08-07 20:24:53 +02:00
Marcello Seri cbb2ed7833 stdlib: simplify try_finally signature and implementation
Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
2018-08-07 20:24:53 +02:00
Marcello Seri 3f2acd87a3 stdlib: use a version of @bobot try_finally
`try_finally work ~always ~exceptionally` is designed to run code
in `work` that may fail with an exception, and has two kind of
cleanup routines:

- `always`, that must be run after **any** execution of the function
  (typically, freeing system resources), and

- `exceptionally`, that should be run **only** if `work` or `always`
  failed with an exception (typically, undoing user-visible state
  changes that would only make sense if the function completes
  correctly).

I had to locally re-define `rab_backtrace`, `get_raw_backtrace`,
`raise_with_backtrace` because I could not refer to `Printexc`.

Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
2018-08-07 20:24:53 +02:00
Marcello Seri 8a90c6ff77 stdlib: update try_finally to newer syntax
Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
2018-08-07 20:24:52 +02:00
Marcello Seri 6d4fd3ab5c stdlib: update docstring wording
Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
2018-08-07 20:24:52 +02:00
Marcello Seri af9174ff52 stdlib: introduce try_finally in Pervasives
Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
2018-08-07 20:24:52 +02:00
Drup 16bea57ef5 Fix and improve the documentation of dprintf. 2018-08-03 19:21:05 +02:00
Drup 82f5376044 Relax the type of make_iprintf and improve Format.ifprintf. 2018-08-02 23:17:47 +02:00
Drup 68490ebbbb Add dprintf, the delayed printf function. 2018-08-02 23:09:20 +02:00
Drup 12238e40ae Remove the state argument in CamlinternalFormat.make_printf.
This state argument was passed around, but never used, except
by the continuation.
2018-08-02 23:09:20 +02:00
Vladimir Keleshev ee1ec3eb4b Add Stack.{top_opt,pop_opt} and Queue.{peek_opt,take_opt} 2018-08-01 22:44:10 +02:00
Armaël Guéneau 21a327c8cf Lexing.flush_input: completely reset the current position 2018-07-25 11:52:23 +02:00
Valentin Gatien-Baron 36218f05ea Arg module sometimes misbehaved instead of rejecting invalid -keyword=arg inputs
When -a is defined as Unit, accepted -a=1.
When -a is defined as Tuple, accepted -a=1 b c as -a b=1 c=1.
When -a is defined as Rest, looped infinitely on -a=1.
2018-07-22 02:24:08 -04:00
whitequark 1ebc9f5a4c Remove the Sort module. (PR7812)
It has been deprecated since 2000, shown a deprecation warning
since 4.02, and Sort.merge is documented to have undefined behavior
when the lists being merged are not sorted in the first place.
2018-07-13 16:04:49 +02:00
thierry-martinez 220063adff Fix Array.of_seq (#1897)
Reported at https://caml.inria.fr/mantis/view.php?id=7820

Array.of_seq applies a circular permutation of one cell to the right
on the sequence.

With OCaml 4.07.0 and trunk, we have

- : int array = [|3; 1; 2|]

In stdlib/array.ml, line 337 (last line of of_rev_list), we have
      fill (len-1) tl
whereas it should be
      fill (len-2) tl
since hd, which should be assigned to the cell (len - 1), is skipped.
2018-07-11 19:08:03 +02:00
Pierre Weis a000769c8d Fix MPR#7235 (#1870) 2018-07-02 10:30:57 +02:00
Sébastien Hinderer d3e73595e5 Merge the asmrun and byterun directories into the runtime directory 2018-06-28 17:50:33 +02:00
Gabriel Scherer f3aca2376f
Merge pull request #1821 from gasche/makefiles-consistent-opt-targets
Makefiles: consistently offer `allopt` and `opt.opt` targets
2018-06-24 00:46:50 +02:00
Sébastien Hinderer 85fa27f7e9 Rename C compiler related build variables
This commit renames a few C compiler related build variables so that
they are reserved for the build system. They will then be re-introduced,
but this time as user varialbes whose value can be freely customized
when compiling the package, without risking to conflict with those
command-line flags that are required by the build system itself.

Here are the variables this commit renames:

- CFLAGS -> OC_CFLAGS
- CPPFLAGS -> OC_CPPFLAGS
- LDFLAGS -> OC_LDFLAGS

Note: before this commit the compilation of scheduler.c in
otherlibs/threads was relying on make's implicit rule to compile C files.

Since this commit stops using the standard variables for flags,
it is necessary to introduce an explicit rule to compile C files
and that makes use of the newly introduced variables.
2018-06-20 14:01:42 +02:00
David Allsopp b5d1929e87 Whitespace and overlong line fixes. 2018-06-14 15:15:34 +01:00
David Allsopp 061262ba70 Fix over-long lines with minor re-wordings 2018-06-13 09:37:49 +01:00
David Allsopp e9d7901a72 Refactor stdlib/Makefile for long-line
Semantically unchanged, just moved some expressions into separate
definitions.
2018-06-13 09:37:49 +01:00
David Allsopp 796b34b795 Missing quotes in stdlib Makefile 2018-06-09 10:01:58 +01:00
Gabriel Scherer a1bc562d8a makefiles: consistently offer *both* 'allopt' and 'opt.opt' targets
Some makefiles (lex, stdlib, otherlibs) would only offer allopt, while
others (ocamldoc, tools) only offered opt.opt. It is inconvenient to
have to remember which target name to use while going through various
repositories.
2018-06-07 09:54:13 +02:00
Nicolás Ojeda Bär fa7dc54819 Use String.escaped in Scanf.format_from_string 2018-06-06 14:08:35 +02:00
Alain Frisch 4f581b8401 Make updating lex_curr_p/lex_start_p optional (#1590)
Port optimization about not updating start_p/curr_p to non-ml mode of ocamllex
2018-05-31 17:12:44 +01:00
ygrek 3a978584d5 Add Changes entry and update Printf doc 2018-05-28 17:52:33 -07:00
ygrek 92748ee986 Printf: speedup %#d and allocate less 2018-05-28 17:52:33 -07:00
ygrek 97fca08b2d Printf: alternative int format %#d 1_234_567 2018-05-28 10:53:37 -07:00
Sébastien Hinderer a2586680a0 Remove the Makefile.nt files 2018-05-25 00:36:56 +02:00
Xavier Leroy ab1ca8e72a
Make sure a function registered with `at_exit` is executed only once (#1790)
Fixes: MPR#7253 (in large part), MPR#7796 (in full).

As shown in the PRs above there are several cases where do_at_exit
is called several times, causing functions registered with at_exit
to be called several times.  Also, an at_exit function that raises
could prevent other at_exit functions from being run.

This commit doesn't try to prevent multiple calls to do_at_exit,
but makes sure that each function registered with at_exit is run
at most once.  The idea is due to Nicolás Ojeda Bär.
2018-05-23 17:12:01 +02:00
Martin Desharnais 0b31b88849 Uniformise documentation of _opt functions in Pervasive (#1475)
* Uniformise documentation of `_opt` functions in Pervasives

The `option`-returning versions now document the behaviour of the
functions and are refered to by the raising versions using the following
pattern:

> Same as {!Pervasives.f_opt}, but raise [x] instead of returning [None].

* Document function `read_float` raising an exception
2018-05-18 15:28:40 +02:00
Gabriel Scherer 83b0ee1b62
Merge pull request #1779 from pmetzger/bigardocfix
Integrate Bigarray documentation
2018-05-14 10:31:38 +02:00
Mark Shinwell ea2d6a1e31
Add configure options to control installation of source artifacts (#1777) 2018-05-14 08:15:44 +01:00
Perry E. Metzger 1a412be026 Integrate Bigarray documentation
1. Add Bigarray lines to library/stdlib.etex
2. Move intro from libbigarray.etex to stdlib/bigarray.mli
3. Note that 0-dimensional arrays are supported.
4. Move C interface description to cmds/intf-c.etex
5. Change wording in libbigarray.etex to reflect legacy status.
6. Add a label to libunix.etex (needed for link from libbigarray.etex)
7. Put the changes in Changes (for 4.07).
2018-05-10 15:13:56 -04:00
Stephen Dolan 8095e5a10f Ensure Lazy has stable behaviour with afl-instrument.
When AFL instrumentation is enabled, the inlining of Lazy.force
is disabled, so that the GC optimisation of removing Forward_tag
blocks is no longer visible in the instrumentation output.
2018-05-02 15:46:59 +01:00
Stephen Dolan b06eb0cbb6 PR#7725: Never compile camlinternalOO with afl instrumentation 2018-05-02 15:46:59 +01:00
Frédéric Bour 7b6d2282d2 Use raise_notrace rather than raise in format.ml (#1731)
Calls to raise in Format can accidentally appear in backtraces,
especially when formatting an error message after catching an exception.

By using raise_notrace, the backtrace is no longer clobbered.
2018-04-20 12:54:20 +01:00
Nicolás Ojeda Bär 9f21424a28 make install: remove old bigarray library 2018-04-16 18:39:29 +02:00
Nicolás Ojeda Bär 7373f56ff2 make install: remove old files to account for new packed stdlib 2018-04-16 11:32:05 +02:00
Nicolás Ojeda Bär e0d5daa683 Fix Stream.junk on channel streams 2018-04-10 16:21:45 +02:00
Damien Doligez c11f19c2ff add @since annotations to stdlib/float.mli and stdlib/bigarray.mli 2018-04-10 14:16:26 +02:00
Damien Doligez 766b4cea65 small portability fix to "make depend" 2018-04-10 14:16:26 +02:00
Jérémie Dimino 32da45a80a Move bigarray to the stdlib (#1685) 2018-04-09 13:14:05 +01:00
Gabriel Scherer fa884f420b fix bug in GPR#1697 (List.init) caught after merge 2018-04-05 22:35:48 +02:00
Hugo Heuzard 952fe49bac depend 2018-04-05 18:08:30 +01:00
Hugo Heuzard f787536c1e Tune List.init threshold 2018-04-05 18:07:47 +01:00
zapashcanon 6ca69c2546
Fix a typo 2018-04-01 16:58:40 +01:00
Gabriel Scherer 6f52514c77
Merge pull request #1680 from gasche/install-install
makefiles: use 'install' instead of 'cp' in 'make install' targets
2018-03-29 19:39:18 +02:00
Christophe Troestler 9f0f710a8d Add Float.pi
Fixes https://caml.inria.fr/mantis/view.php?id=4170
2018-03-29 18:49:21 +02:00
Gabriel Scherer 3702f53692 factorize common makefile definitions in Makefile.common 2018-03-29 17:04:05 +02:00
Gabriel Scherer afcd29eb0c makefiles: turn the 'install' command into a variable
(Suggestion made by Sébastien Hinderer during review.)
2018-03-29 14:40:23 +02:00
Gabriel Scherer ecfd39f127 makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.

¹: a brtfs filesystem on an old-ish SSD

Why I care
----------

An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.

Partial diagnosis
-----------------

The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.

Change
------

The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).

Testing
-------

I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.

Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:

    for f in $(find $DESTDIR); do \
      echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
    done | sort

Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-29 14:40:22 +02:00
Simon Cruanes df80f34a92 Stdlib functional iterators (#1002)
* add `Seq` module, expose iterator conversions in most containers

* small typo

* typo

* change order of arguments for `{Map,Set}.add_seq`

* watch for max string length in `Bytes.of_seq`

* wip: make it build again

* Fix dependency

Sys needs to be linked before Bytes in stdlib.

* Update threads/stdlib.ml

* Update stdlib_no_prefixed/.depend

* fix inconsistencies with label modules

* update testsuite to work with seq

* update change file

* small change in `Hashtbl.to_seq`, capturing only the underlying array

* add some documentation to seq.mli

* revert to good ol' module type names for hashtables

* fix test

* change style of comments in seq.mli

* follow some demands in review of GPR #1002

* some fixes for #1002

* add Seq-related functions to Ephemeron

* add some comments on `Hashtbl.of_seq`

* add more tests for `Hashtbl.{to,of}_seq`

* fix bug in `Ephemeron.to_seq`

* Update Changes
2018-03-16 18:25:10 +01:00
Nicolás Ojeda Bär 4724e3914e
Merge pull request #1638 from nojb/float_module
Add Stdlib.Float module
2018-03-16 06:21:55 +01:00
Nicolás Ojeda Bär 5833954ecd Remove unwanted diff 2018-03-15 18:26:53 +01:00
Nicolás Ojeda Bär 2f6ffb138e Rename epsilon_float -> epsilon 2018-03-15 18:26:52 +01:00
Nicolás Ojeda Bär a36e1e70d4 Copyright 2018-03-15 18:26:52 +01:00
Nicolás Ojeda Bär 8bb6d26e50 Add Float.hash 2018-03-15 18:26:52 +01:00
Nicolás Ojeda Bär 242b6f20a1 make depend 2018-03-15 18:26:51 +01:00
Nicolás Ojeda Bär 8b396af99b Add Float.Array module 2018-03-15 18:26:51 +01:00
Nicolás Ojeda Bär 7f6d059f08 Add Float module 2018-03-15 18:26:51 +01:00
Hugo Heuzard e227fb007d fix primitives for marshal 2018-03-15 18:25:31 +01:00
alainfrisch 7ae2725a22 Fix install target after #1635. 2018-03-07 00:25:21 +01:00
Alain Frisch 43e195713c
Small fixes for stdlib/Makefile under Windows (#1635)
- Missing source file when compiling camlheaderi.
- Enable parallel build (using different filenames).
- Avoid rules with multiple targets.
2018-03-06 23:27:43 +01:00
Max Mouratov ae2af8920a stdlib: add a few references to Sys.int_size inside docstrings (#1572) 2018-03-01 18:54:24 +01:00
Nicolás Ojeda Bär 3492756047
Merge pull request #1637 from nojb/string_escape_optim
Optimize String.escaped
2018-02-28 16:24:09 +01:00
Milo Davis e6df2bb1cd Clarify Sys.executable_name behavior (#1395) 2018-02-28 15:11:56 +01:00
Nicolás Ojeda Bär 996b0ea43e Use more descriptive name for local function 2018-02-28 09:33:18 +01:00
Nicolás Ojeda Bär 35a75212dc Use local function 2018-02-28 09:28:47 +01:00
Nicolás Ojeda Bär 3cfb0bfe6f Avoid branch in String.escaped 2018-02-28 09:12:50 +01:00
Nicolás Ojeda Bär e92ed4e543 Fix 2018-02-27 18:47:32 +01:00
Nicolás Ojeda Bär 5c7b441a20 Simplify 2018-02-27 18:42:57 +01:00
Nicolás Ojeda Bär b2be21296c Use functional style 2018-02-27 14:53:05 +01:00
Nicolás Ojeda Bär d25eaa6f15 Optimize String.escaped 2018-02-27 09:49:03 +01:00
Jeremie Dimino e2847e56c9 Fix the dependencies for .p.cmx files in stdlib/ 2018-02-12 15:59:28 +00:00
Jeremie Dimino 84304a3282 Core review work
- Apply the __ heuristic more systematically
- Update tests
- Fix Windows builds
2018-02-12 08:29:17 +00:00
David Allsopp 5e35fd0418 Alter awk scripts to cope with CRLF checkout 2018-02-12 08:29:16 +00:00
David Allsopp 4d79045d95 Use gawk on Windows in the build system
awk is symbolic link in Cygwin, which means it can't be used in -pp for
a native Windows build. Just use gawk instead, as no other package
provides the awk command on Cygwin.
2018-02-12 08:29:16 +00:00
Jeremie Dimino 225d1c65b9 Prefix the compilation unit names of all modules in the stdlib
Except for the Camlinternal* modules and the new Stdlib module, all
modules in the stdlib now compile to Stdlib__<module>.

Pervasives is renamed to Stdlib and now contains a list of aliases
from the long names to the short ones, so that from inside and outside
the stdlib we can refer to the standard modules as just List or
Stdlib.List rather than Stdlib__list.

In order to avoid printing the long names in error messages and in the
toplevel, the following heuristic is added to Printtyp: given a path
Foo__bar, if Foo.Bar exists and is a direct or indirect alias to
Foo__bar, then prefer Foo.Bar.

A bootstrap step was required to replace Pervasives by Stdlib as the
module opened by default.
2018-02-12 08:29:16 +00:00
David Allsopp 617c461bb1 s/an Unicode/a Unicode/ 2018-01-19 13:55:50 +00:00
Marc Chevalier f7e1a313f5 stdlib/pervasives.mli: typo in documentation of __LINE_OF__ (#1548)
__LINE__ instead of __LINE_OF__ in __LINE_OF__ documentation.
Remove a trailing whitespace.
2017-12-28 15:29:51 +01:00
Damien Doligez 1252941d4e fix Makefile bug for lintapidiff and add missing @since in stdlib/format.mli
(cherry picked from commit 4b323be96a920b6e65d948f700d8568029fa13dd)
2017-11-10 17:20:44 +01:00
Gabriel Scherer 940ffca830 missing @since tags in stdlib/uchar.mli
(cherry picked from commit a5ec604c51557f6d24dbc4f7592c246b79cb3ef3)
2017-11-10 17:20:12 +01:00
Nicolas Ojeda Bar d622af3ba0 Format.out_indent: tweak doc 2017-10-20 18:04:13 +02:00
Jacques Garrigue 0cb45a611f add labels to BytesLabels.sub_string (#1353) 2017-10-16 08:55:30 +09:00
Florian Angeletti db03cedfdf Merge pull request #830 from Octachron/stdlib_doc_unnested_hierarchy
PR#7363: documentation, start heading levels at 1
2017-10-05 19:26:44 +02:00
alainfrisch 35e15f6029 Avoid non-tail recursion when loading files in Arg.read_arg. 2017-10-04 16:49:42 +02:00
octachron 9c8ac99009 fix few documentation headers 2017-10-04 13:05:05 +02:00
octachron e30e82a219 PR#7363: start documentation headers at {1 2017-10-04 13:05:05 +02:00
Nicolas Ojeda Bar e9ef3c80f7 headernt.c: use WriteConsole 2017-09-27 10:49:30 +01:00
Nicolas Ojeda Bar fb878a0af8 headernt.c: fix read_runtime_path 2017-09-27 10:49:30 +01:00
Jacques Garrigue 70b02405e0 Merge pull request #1365 from yallop/let-rec-patch-406
GPR#556, PR#7215, PR#7231, PR#6738: Add a new check that 'let rec' bindings are well formed.
2017-09-22 15:37:10 +09:00
Nicolás Ojeda Bär 9fe6d0e2c2 Unicode support for the Windows runtime (#1200)
* Add support code

* Explicitly reference ANSI Windows APIs

* Adapt Sys.is_directory

* Adapt ocamlrun

* Add Changes entry

* Add testsuite

* Adapt Unix.open_process{_in,_out,_full,}, Unix.create_process{_env,}

* Adapt headernt.c

* Adapt Pervasives.open_{in,out}, Filename.temp_file, etc.

* Adapt Sys.file_exists

* Adapt Sys.remove

* Adapt Sys.chdir

* Adapt Sys.getcwd

* Adapt Sys.getenv

* Adapt Sys.command

* Adapt Sys.readdir

* Adapt CPLUGINS

* Remove use of FormatMessageA, CreateFileA

* Adapt Unix.mkdir

* Adapt Unix.openfile

* Adapt Unix.readlink

* Adapt Unix.rename

* Adapt Unix.{LargeFile,}.{l,}stat

* Adapt Unix.system

* Adapt Unix.{open,read}dir

* Adapt Unix.link

* Adapt Unix.symlink

* Adapt Unix.getcwd

* Adapt Unix.rmdir

* Adapt Unix.utimes

* Adapt Unix.unlink

* Adapt Unix.chdir

* Adapt Unix.chmod

* Adapt Unix.{execv,execve,execvp,execvpe}

* Compile with -DUNICODE -D_UNICODE under Windows

* Add configure-time switch, Config.windows_unicode

* Adapt Unix.putenv

* Re-implement Unix.environment using GetEnvironmentStrings()

* Use Unicode-aware flexdll

* Adapt Unix.environment

* AppVeyor: bootstrap flexdll

* Adapt tests/embedded/cmmain.c

* Adapt tests/lib-dynlink-csharp/entry.c

* Remove exec tests

* Fixup

* Pass -municode to MinGW compiler

* Try to fix tests/embedded

* Adapt Sys.rename

* Correct Changes entry

* Makefile.several: use $(O) and $(NATIVECODE_ONLY)

* Display => skipped correctly for tests/win-unicode

* Add missing casts to execv* calls

It's not clear why these aren't necessary for with char, but they are
necessary with wchar_t on GCC (but not MSVC).

* Missing header in systhreads (Win32 only)

* Revert "Pass -municode to MinGW compiler"

This reverts commit a4ce7fb319c429068a5b9d1ab14a2cc3969c355f.

* Revert "Try to fix tests/embedded"

This reverts commit 5197d8922295b7b339b970ec3189374aa15de4b8.

* Revert "Remove exec tests"

This reverts commit 306ccef2e79eca5b38ecfa285b912c7bcf3e9f52.

* Don't pass $(LDFLAGS) when build ocamlc.opt

It's already included via CC anyway, and it causes Unicode problems for
Winodws (because the linker options need to be prefixed "-link" to go via
flexlink).

* Use wmain on Windows for ocamlrun

* Build Unicode applications on Windows

* Use wmain in headernt.c

* Minor correction to win-unicode Makefile

* Switch submodule to FlexDLL 0.36

* Build ocamlyacc as an ANSI application

* Revert "Fixup"

This reverts commit 500bd6b575ffd6c5b71c6953e55d740f0b090185.

* Fix casts for execvp/execve

* Remove tabs from test code

* Fix Changes entry

* shell32.lib is no longer necessary

* Free allocated string

* Changes: signal breaking change

* Disable exec_tests

* Protect with CAML_INTERNALS
2017-09-18 17:41:29 +02:00
Damien Doligez f086eda9c0 add -no-flat-float-array configure option 2017-09-15 18:24:36 +02:00