* 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
I wanted to test a caml_tex issue by creating a smaller .etex file
than exten.etex, and got bitten by the fact that the Makefile hardcode
the knowledge that only exten.etex uses caml_example.
Many build errors in cross-reference-checker have gone unnoticed
because this program was only built to build the manual itself, which
is not part of the CI testing. (The test that it implements needs the
.aux files produces by LaTeX, which we don't really want to produce
during CI runs.)
This commit adds cross-reference-checker to the `tools` target of
manual/Makefile, which is in turn built by the `manual-pregen` target
of the main Makefile, which contains the sanity checks for the manual
that do not require building it, and is part of our CI.
Instead of the current print to stderr. This way it's treated the same
as other warnings: it has a position, colors, can be made an error,
disabled, goes in the expected formatter, is documented.
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.
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.
In the early days of pdflatex, the hyperref package didn't exist
and we used the \pdfchapter, \pdfchapterfold and \pdfsection
custom macros to build the PDF index.
Those macros are now useless, so remove all of their uses.
Before Hevea the plaintext version of the manual required a
specific toplevel file "plaintext.tex", some \ifplaintext
conditionals, and a "plaintext.sty" package.
All this is now useless, remove it.
Those formats are now obsolete compared with PDF.
- Merge pdfmanual.tex into manual.tex and remove pdfmanual.tex
- Simplify the Makefile: run with pdflatex only, not latex then pdflatex
- Remove mentions of DVI and Postscript versions on the HTML front page
By default, \usepackage[T1]{fontenc} causes CMR bitmap fonts to be put
in PDF and PS files. Fix this using the "ae" package
(virtual fonts for T1 encoded CMR-fonts).
Nearly identical changes to:
ocaml.m, ocamlc.m, ocamlopt.m, unified-options.etex
"-safe-string" has been the default since 4.06, so the assertion that
it would be the default someday, and that "-unsafe-string" is still
the default, was incorrect.
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).
The proposed behavior of `-config-var s` is as follows:
- if `s` is an existing configuration variable, print its value as
a string and exit with a success return value (0)
- if `s` is not an existing configuration variable, print nothing
and exit with a failure return value (non-0)
Note that we do not print a newline after the value of the
configuration variable. In particular, if the value is an empty
string, the output is undistinguishable from the output for
non-existing variables, the return value has to be considered instead.
The following alternative behaviors were considered:
- We could print a newline after the configuration value, which
would let users distinguish empty values from non-existing variables
by counting the lines of output, and would also be more pleasant for
users invoking the option from the command-line. However, the way
bash works on Windows means that $(ocamlc -config-var foo) would keep
a trailing \r in its output, and portable scripts would have to use
$(ocamlc -config-var foo | tr -d '\r') instead, which is a pain.
(This issue was pointed out by David Allsopp)
- We could print a message on the error output if the configuration
variable does not exist. This is clearer to a human user, but it is
annoying for scripts if they forget to silence the error output and
get their output mixed with our error messages. The main use of this
new feature is for scripting purposes.
Trying to build the manual (make -C manual/manual etex-files) when
your current opan switch is stale (for example, 4.05.0 when working on
the current 4.07.0+dev trunk) results in the following error:
make[1]: Entering directory '/home/gasche/Prog/ocaml/github-trunk/manual/manual/tutorials'
Fatal error: cannot load shared library dllunix
Reason: /home/gasche/.opam/4.05.0/lib/ocaml/stublibs/dllunix.so: undefined symbol: caml_strdup
Failure when generating coreexamples.tex
Fatal error: cannot load shared library dllunix
Reason: /home/gasche/.opam/4.05.0/lib/ocaml/stublibs/dllunix.so: undefined symbol: caml_strdup
Failure when generating lablexamples.tex
Fatal error: cannot load shared library dllunix
Reason: /home/gasche/.opam/4.05.0/lib/ocaml/stublibs/dllunix.so: undefined symbol: caml_strdup
Failure when generating objectexamples.tex
Fatal error: cannot load shared library dllunix
Reason: /home/gasche/.opam/4.05.0/lib/ocaml/stublibs/dllunix.so: undefined symbol: caml_strdup
Failure when generating moduleexamples.tex
Fatal error: cannot load shared library dllunix
Reason: /home/gasche/.opam/4.05.0/lib/ocaml/stublibs/dllunix.so: undefined symbol: caml_strdup
Failure when generating advexamples.tex
Fatal error: cannot load shared library dllunix
Reason: /home/gasche/.opam/4.05.0/lib/ocaml/stublibs/dllunix.so: undefined symbol: caml_strdup
Failure when generating polymorphism.tex
make[1]: Leaving directory '/home/gasche/Prog/ocaml/github-trunk/manual/manual/tutorials'
This PR fixes the issue by using Makefile.tools' SET_LD_PATH variable
to set a LD_PATH containing the required build directory's otherlibs/
libraries, instead of looking in an installed path.
(no change entry needed)
This commit adds a subsection to the record and variant section of the manual describing the behavior of the type-directed disambiguation of variant constructors and record fields.
The current documentation for caml_calloc_final, fixed by this commit,
contradicts the documentation for caml_calloc_custom:
Custom blocks must be allocated via the caml_alloc_custom function:
caml_alloc_custom(ops, size, used, max) returns a fresh custom block,
with room for size bytes of user data...
The caml_alloc_final function is defined as follows:
CAMLexport value caml_alloc_final (mlsize_t len, final_fun fun,
mlsize_t mem, mlsize_t max)
{
return caml_alloc_custom(caml_final_custom_operations(fun),
len * sizeof(value), mem, max);
}
And the caml_alloc_custom function begins as follows:
CAMLexport value caml_alloc_custom(struct custom_operations * ops,
uintnat size,
mlsize_t mem,
mlsize_t max)
{
mlsize_t wosize;
value result;
wosize = 1 + (size + sizeof(value) - 1) / sizeof(value);
...
It adds the extra word to store the custom_operations.
I believe this change reflects the original author's intent. The example is trying to demonstrate that the `[@bar]` attribute applies to the function definition, not to the extension itself.
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.
This commit adds a new chapter to the tutorial part of the manual, describing potential issues that can appear with polymorphic functions and types, and possible solutions or workarounds. The issues covered are, section-by-section:
* weakly polymorphic types
* polymorphic recursion
* higher-ranked polymorphic function
This commit makes the heading hierarchy of ocamldoc start at {0 rather
than {1. This level {0 should be reserved for global titles, freeing
the use of {1 for normal subtitles.
-(un)safe-string becomes -(no-)force-safe-string
-(un)safe-string-default becomes -default-unsafe-string
Config.safe_string (and Clflags.unsafe_string) keep their name for
backward-compatibility, as well as the C define CAML_SAFE_STRING
(which corresponds to -force-safe-string).
Currently, the equation is rendered as (1/1 + f)<sup>d</sup>.
I'm not certain if this will correctly render in HTML (apologies, but I don't have the capacity to check at the moment), but hopefully this PR will suffice.
Escaping strings when printing them in the toplevel has the disadvantage
of mangling unicode text:
```
\# "한글";;
- : string = "\237\149\156\234\184\128"
```
With this commit, strings are not escaped anymore, contrarily to bytes:
```
\# let cosmos = "κόσμος";;
cosmos : string = "κόσμος"
\# Bytes.of_string cosmos;;
- : bytes =
Bytes.of_string "\206\186\207\140\207\131\206\188\206\191\207\130"
```
This new behavior can be disabled dynamically by setting the environment
variable OCAMLTOP_UTF_8 to false
This change is not solely aesthetic: the mangling of unicode string may
contribute to the impression of some OCaml newcomers that Ocaml has no
support for unicode.
The syntax of string literals is changed to add the \u{X+} escape
sequence which replaces the escape by the UTF-8 encoding of the
Unicode scalar value denoted by the hexadecimal number H made of one
to six lower or uppercase hexadecimal digits.
Unfortunately due to OCaml lax policy about escape sequences this
change can break program that trigger warning 14 on compilation. More
precisely programs which have literals with "\u" as a substring will
now either fail or the string literal will be silently compiled to
another representation in case the literal has a subsequence that
respects the \u{X+} syntax.
* fall back to __secure_getenv when secure_getenv is not available
* use secure_getenv for instrumented runtimes
* documentation: warn against setting the setuid or setgid bits on custom bytecode executables
* fall back to __secure_getenv when secure_getenv is not available
* use secure_getenv for instrumented runtimes
* documentation: warn against setting the setuid or setgid bits on custom bytecode executables
The rule said:
$(INTF): $(MLIS)
$(OCAMLDOC) -latex [...] $(MLIS)
# renaming of files
mv -f Arith_status.tex Arithstatus.tex
mv -f Big_int.tex Bigint.tex
mv -f Ast_helper.tex Asthelper.tex
mv -f Ast_mapper.tex Astmapper.tex
If two targets executed at the same time depend on different files in
INTF, this rule would be executed several time in parallel, and in
particular the calls to `mv -f ...` would race with each other,
resulting in a build failure.
Now the $(OCAMLDOC) call is made unique by using a single target:
$(INTF): interfaces
interfaces: $(MLIS)
$(OCAMLDOC) -latex [...] $(MLIS)
[...]
Note that parallel build does not improve the build speed on my
machine; but it can still make people more productive by not breaking.
This commit makes it possible to omit the final ";;" in a caml_example
environment.
By default, this final ";;" is still mandatory. A new command line
option "-implicit-stop" makes it optional globally.
This global setting can be overrided locally by adding an optional
argument to the environment:
* [toplevel] makes the ";;" mandatory
* [verbatim] makes it optional
The tutorial part of the manual is configured to use the mandatory ";;"
mode globally for the sake of consistency whereas the language extension
section uses the new optional ";;" mode.
This commit replaces most of the use of <br> tags in ocamldoc html
backend by more meaningful tags, in order to improve the themability
of the generated html code.
Since 4.03, OCaml supports coloring its messages to standard output and standard
error, depending on the "-color" argument ({always,never,auto}). This commit
adds support for the environment variable "OCAML_COLOR" (which value can as well
be {always,never,auto}).
The command line argument "-color" takes precedence, "OCAML_COLOR" is only
taken into consideration if no "-color" is provided.
The motivation for this is that the user should have control over coloring
OCaml's output messages. OCamlbuild, a widely used build tool executes OCaml
not under a tty (and OCaml does not colorize errors and warnings), which lead
various packages use `color(always)` in their `_tags` files, which breaks with
other (non-interactive) programs (i.e. editor helpers).
Further discussion was done at https://github.com/ocaml/ocamlbuild/issues/87 and
https://github.com/ocaml/ocaml/pull/1098.
Since 4.03, OCaml supports coloring its messages to standard output and standard
error, depending on the "-color" argument ({always,never,auto}). This commit
adds support for the environment variable "OCAML_COLOR" (which value can as well
be {always,never,auto}).
The command line argument "-color" takes precedence, "OCAML_COLOR" is only
taken into consideration if no "-color" is provided.
The motivation for this is that the user should have control over coloring
OCaml's output messages. OCamlbuild, a widely used build tool executes OCaml
not under a tty (and OCaml does not colorize errors and warnings), which lead
various packages use `color(always)` in their `_tags` files, which breaks with
other (non-interactive) programs (i.e. editor helpers).
Further discussion was done at https://github.com/ocaml/ocamlbuild/issues/87 and
https://github.com/ocaml/ocaml/pull/1098.
With this commit, "ocamlc -c -linkall" or "ocamlopt -c -linkall" produce object files that have the "force link" flag set. Once put in library files (.cma/.cmxa), these object files will always be linked when the library is linked, even if no definition from the object file is referenced. However, other object files in the library can still be removed if none of their definitions are referenced.
In this respect, we get finer-grained control on which object files should always be linked, typically because they contain important initialization code.
* Added expand to toplevel.
The toplevel now also accepts -args and -args0. In order to avoid
problems with the overide_args hack now script file is allowed in
expand options.
* Fixed differences between .ml and .mli
* Added missing expand in opttopmain.
* Added some test for broken -args for toplevel.
The test checks whether the toplevel fails if the script file is passed
via args option.
* Corrected test case.
* Updated error case.
Instead of printing the error string, Arg.Bad is raised and a wrapper is
added around the parse_and_expand_dynamic_argv.
* Added begin ... end around try ... with.
* Added working example an strip error path.
* Use sed to remove path and fixed typo.
* Added documentation.
* Also fix typo in reference file.
* Added PR to the corresponding change entry.
* Reworked Changes entry.
* Added new tests and updated documentation.
A script file in a responsefile now only prints an error message instead
of the help.
* Removed duplicated entry.
* Simplified expand logic.
We only remember where the current last expanded option is.
* Use first non_expand position instead.
* Updated error message.
This commit creates a file unified-options.etex which regroups at
source level the description of the compilers and toplevel options.
Difference of options between native/bytecode compilers and toplevel
are handled via conditional tex macros.