summaryrefslogtreecommitdiffstats
path: root/stdlib
AgeCommit message (Collapse)Author
2015-01-24PR#6691: install .cmt[i] files for stdlib and compiler-libsGabriel Scherer
(patch by David Sheets) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15794 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-27minor header fixGabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15758 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-27PR#5887: move the byterun/*.h headers to byterun/caml/*.h to avoid header ↵Gabriel Scherer
name clashes (Jérôme Vouillon and Adrien Nader and Peter Zotov) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15757 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-24PR#6727: Printf.sprintf "%F" misbehaviorDamien Doligez
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15746 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21add @since tags to the new *_ascii functionsGabriel Scherer
From: Gabriel Scherer <gabriel.scherer@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15732 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21PR6694: Deprecate Latin-1 string manipulation functions.Gabriel Scherer
Also, add documentation for the US-ASCII variants. From: Peter Zotov <whitequark@whitequark.org> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15729 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21PR6695: Make Filename use only US-ASCII functions.Gabriel Scherer
The only place that includes changes is the code for checking the suffix. It is highly unlikely that the change has any impact at all. From: Peter Zotov <whitequark@whitequark.org> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15728 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21PR6695: Add ASCII counterparts to case-mapping functions.Gabriel Scherer
This updates Char, String, Bytes in the stdlib. For now, they are hidden from documentation and are only for internal compiler use. From: Peter Zotov <whitequark@whitequark.org> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15726 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21PR#6494: Add equal function in modules Big_int, Bytes, Char, Digest, Int32, ↵Gabriel Scherer
Int64, Nativeint, Num and String (Romain Calascibetta) From: Romain Calascibetta <romain.calascibetta@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15725 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21minor filename.mli doc clarificationGabriel Scherer
From: Gabriel Scherer <gabriel.scherer@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15723 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21Add optional perms argument to Filename.open_temp_file.Gabriel Scherer
From: Daniel Bünzli <daniel.buenzli@erratique.ch> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15722 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-19Add @since tags on stdlib functions new in 4.02Gabriel Scherer
make_float was added in 4.02 Buffer.(to_bytes, add_bytes, add_subbytes) were added in 4.02. BytesLabels was added in 4.02. Digest.(bytes, subbytes) were added in 4.02. Marshal.(to_bytes, from_bytes) were added in 4.02. various Pervasives functions were added in 4.02: print_bytes prerr_bytes output_bytes output_substring really_input_string Printexc.(backtrace_slots, raw_backtrace_slot) were added in 4.02. Scanf.(ksscanf, kfscanf) were added in 4.02. Stream.of_bytes was added in 4.02. From: Jeremy Yallop <yallop@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15687 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-19Change 'List' to 'ListLabels' in the ListLabels documentation.Gabriel Scherer
From: Jeremy Yallop <yallop@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15686 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-19Change 'Array' to 'ArrayLabels' in the ArrayLabels documentation.Gabriel Scherer
From: Jeremy Yallop <yallop@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15685 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-19Add sort_uniq to ListLabels.Gabriel Scherer
From: Jeremy Yallop <yallop@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15684 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-19Add make_float to ArrayLabels.Gabriel Scherer
From: Jeremy Yallop <yallop@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15683 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-13Simplify the use of custom .() and .[]Gabriel Scherer
This commit modifies the parser to use the newly defined .() and .[] operators. It also moves the definition of the standard .() and .[] operator for String/Bytes and Array to the pervasives module. Before this commit, expressions of the form array.(index) and string.(index) where desugared to Array.get[_unsafe] array index and Strinf.get[_unsafe] string index. The unsafe or unsafe version were chosen depending on the presence of the "-unsafe" compiler option. Such expression are now desugared to ( .() ) array index and ( .[] ) string index respectively. The same desugar operation is applied to array.(index) <- value which becomes ( .()<- ) array index value. In order to keep the standard semantic for the string and array index operations, these new index operators are defined in the pervasives module using new compiler primitives, e.g. let .() = "%array_opt_get". These new primitives are then mapped to safe or unsafe version depending on the the "-unsafe" compiler option. Consequently, these modifications should have no impact on existing code. With these modifications, defining custom .() and .[] operators should be easier, at the cost of losing access to the standard index operator for either array or string. From: octachron <octa@polychoron.fr> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15661 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-11-17Update documentation of Sys.int_sizeGabriel Scherer
From: hhugo <hugo.heuzard@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15591 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-11-17Sys: Use constant for some runtime limitations. After bootstrapGabriel Scherer
From: Hugo Heuzard <hugo.heuzard@gmail.com> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15590 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-11-16missing @since on List.sort_uniqGabriel Scherer
From: Simon Cruanes <simon.cruanes.2007@m4x.org> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15579 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-20PR#6619: update documentation of Printexc.set_uncaught_exception_handlerJérémie Dimino
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15560 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-15merge branch 4.02 from release 4.02.0 to release 4.02.1Damien Doligez
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15558 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-24#6577: fix performance of %C format.Alain Frisch
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15321 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-24#6577: fix performance of %S format.Alain Frisch
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15320 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-24#6577: fix performance of %L, %l, %n formats.Alain Frisch
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15319 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-11minor update of comment in gc.mliMark Shinwell
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15212 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-03PR#6540: update documentation of default values in gc.mliJérémie Dimino
(Patch by Daniel Richman) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15185 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-29merge changes of version/4.02 from r15121 to r15155Damien Doligez
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15168 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-27PR#6517: use ISO C99 types {,u}int{32,64}_t in preference to our homegrownXavier Leroy
types {,u}int{32,64}. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15131 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-22merge changes from branch 4.02 from branching (rev 14852) to 4.02.0+rc1 (rev ↵Damien Doligez
15121) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-16minor typo spotted by Jeremy YallopGabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15093 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-16I forgot about {Bytes,String}Labels.mapi; thanks Alain!Gabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15091 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-08More accurate wording about when Invalid_argument is raised for list functions.Gabriel Scherer
(Patch by Jeremy Yallop) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15074 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-08remove redundant bound checking in Buffer.blit (patch by Philippe Wang)Gabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15073 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-06remove the Obj.magic from the string.ml implementationGabriel Scherer
It is important not to assume that String.t and Bytes.t will always share the same representation. Using Obj.magic to convert between functions would give a very bad example to users considering a migration, which are very quick to imitate any moral turpitude found in the standard library. An unfortunate consequence of the change is the duplication of String.concat code; other designs would be possible to share more implementation details between Bytes and String (eg. defined factorized operations on both in a shared internal module), but if we consider that String representation may evolve in the future this coincidence of implementation is really a temporary coindence rather than an definitive duplication. I checked that all the small functions introduced are marked as inlinable. In the case of coercions like this, we could even have the compiler recognize eta-expansions of the identity function and turn them into simple rebindings. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15060 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-06implement {Bytes,String}.mapiGabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15058 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-07-28Use labeled arguments. (Cherry-picked from commit 15031 on 4.02).Alain Frisch
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15032 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-07-28#6500: add String.init, Bytes.init, Labels couterparts, Stream.of_byte. ↵Alain Frisch
(Cherry-picked from 15029 on 4.02.) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15030 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-06-14PR#6418: support "@[<hov %d>" in the new format implementation (Benoît Vaugon)Gabriel Scherer
The bootstrap procedure, as for commit trunk@14973 (see there for detailed build instructions), requires to first commit a temporary patch: > diff -Naur old/typing/typecore.ml new/typing/typecore.ml > --- old/typing/typecore.ml 2014-06-11 18:16:24.851647309 +0200 > +++ new/typing/typecore.ml 2014-06-11 18:15:50.075646418 +0200 > @@ -2758,16 +2758,9 @@ > let mk_int n = mk_cst (Const_int n) > and mk_string str = mk_cst (Const_string (str, None)) > and mk_char chr = mk_cst (Const_char chr) in > - let mk_block_type bty = match bty with > - | Pp_hbox -> mk_constr "Pp_hbox" [] > - | Pp_vbox -> mk_constr "Pp_vbox" [] > - | Pp_hvbox -> mk_constr "Pp_hvbox" [] > - | Pp_hovbox -> mk_constr "Pp_hovbox" [] > - | Pp_box -> mk_constr "Pp_box" [] > - | Pp_fits -> mk_constr "Pp_fits" [] in > let rec mk_formatting_lit fmting = match fmting with > - | Open_box (org, bty, idt) -> > - mk_constr "Open_box" [ mk_string org; mk_block_type bty; mk_int idt ] > + | Open_box _ -> > + assert false > | Close_box -> > mk_constr "Close_box" [] > | Close_tag -> > @@ -2950,6 +2943,19 @@ > mk_constr "Alpha" [ mk_fmt rest ] > | Theta rest -> > mk_constr "Theta" [ mk_fmt rest ] > + | Formatting_lit (Open_box (org, _bty, _idt), rest) -> > + mk_constr "Formatting_gen" [ > + mk_constr "Open_box" [ > + mk_constr "Format" [ > + mk_constr "String_literal" [ > + mk_string "<>"; > + mk_constr "End_of_format" []; > + ]; > + mk_string "@[<>"; > + ] > + ]; > + mk_fmt rest; > + ] > | Formatting_lit (fmting, rest) -> > mk_constr "Formatting_lit" [ mk_formatting_lit fmting; mk_fmt rest ] > | Formatting_gen (fmting, rest) -> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14984 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-06-09PR#6418: fix format regression on "@{<..%d..%s..>" (Benoît Vaugon)Gabriel Scherer
To be able to compile this patch, you should temporarily apply the following patch to bootstrap the format type change: > diff -Naur old/typing/typecore.ml new/typing/typecore.ml > --- old/typing/typecore.ml 2014-06-06 03:37:03.240926150 +0200 > +++ new/typing/typecore.ml 2014-06-06 03:37:24.696926699 +0200 > @@ -2956,7 +2956,7 @@ > | Theta rest -> > mk_constr "Theta" [ mk_fmt rest ] > | Formatting (fmting, rest) -> > - mk_constr "Formatting" [ mk_formatting fmting; mk_fmt rest ] > + mk_constr "Formatting_lit" [ mk_formatting fmting; mk_fmt rest ] > | Reader rest -> > mk_constr "Reader" [ mk_fmt rest ] > | Scan_char_set (width_opt, char_set, rest) -> Bootstrap process: make core apply the patch above make core make promote-cross make partialclean revert the patch above, apply the commit make partialclean make core make coreboot git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14973 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-06-09Fix PR#6417: sprintf broken when local module named Pervasives is in scopeGabriel Scherer
(Backport from Jacques' commit 4.02@14921) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14972 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-06-04fix PR#6431 (patch by Benoît Vaugon)Gabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14954 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-21format+gadts: make format types "relational" to fix %(...%) typingGabriel Scherer
See the long comment in pervasives.ml for an explanation of the change. The short summary is that we need to prove more elaborate properties between the format types involved in the typing of %(...%), and that proving things by writing GADT functions in OCaml reveals that Coq's Ltac is a miracle of usability. Proofs on OCaml GADTs are runtime functions that do have a runtime semantics: it is legitimate to hope that those proof computations are as simple as possible, but the current implementation was optimized for feasability, not simplicity. François Bobot has some interesting suggestions to simplify the reasoning part (with more equality reasoning where I used transitivity and symmetry of the relation profusely), which may make the code simpler in the future (and possibly more efficient: the hope is that only %(...%) users will pay a proof-related cost). git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14897 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-16update .dependGabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14886 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-15fix PR#6415: format had forgotten about 'b' boxesGabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14874 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-14replay trunk@13911: better behavior of printf on nan/infinity floatsGabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14871 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-14Use a nominal datatype for CamlinternalFormat.format6Gabriel Scherer
This should make the type-checking of formats simpler and more robust: instead of trying to find a pair as previously, we can now use the path of the format6 type directly. A nice side-effect of the change is that the internal definition of formats (as a pair) is not printed in error messages anymore. Because format6 is in fact defined in the CamlinternalFormatBasics submodule of Pervasives, and has an alias at the toplevel of Pervasives, error messages still expand the definition: > Error: This expression has type > ('a, 'b, 'c, 'd, 'd, 'a) format6 = > ('a, 'b, 'c, 'd, 'd, 'a) CamlinternalFormatBasics.format6 > but an expression was expected of type ... Passing the option `-short-paths` does avoid this expansion and returns exactly the same error message as 4.01: > Error: This expression has type ('a, 'b, 'c, 'd, 'd, 'a) format6 > but an expression was expected of type ... (To get this error message without -short-paths, one would need to define format6 directly in Pervasives; but this type is mutually recursive with several GADT types that we don't want to add in the Pervasives namespace unqualified. This is why I'll keep the alias for now.) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14868 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-12fix a regression in Format formatting printing routinesGabriel Scherer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14842 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-12formats: enable the legacy mode by defaultGabriel Scherer
Given that there still remains a small incompatibility (typing of %(..%)), I decided to keep the legacy mode enabled for now. This means that any failure related to format can be traced to this incompatiblity (or unknown regressions), which will simplify the monitoring and handling of changes considerably. As soon as the %(..%) typing is generalized, we can turn the legacy mode off (or maybe simply add warnings for ignored formats). git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14841 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-12For %{..%}, restore Pierre's semanticsGabriel Scherer
(printf {%foo%} bar) will print the string representation of the format type of both `foo` and `bar`, instead of printing `bar` (for this purpose one can just use %s). `bar` content is ignored, but the typer should check that its type is compatible with the one of `foo`. This semantics allows to use (printf %{..%}) for testing/debugging the use of %(...%): put in the brackets what you believe to be the format type you want to use, and as argument the format you wish to pass, and you'll get type-checking confidence and the "canonical" representation of the format string which you can use in the %(...%) -- note that using the canonical format type is not mandatory. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14840 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02