<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/ocaml.git/stdlib/scanf.ml, branch cc-optim</title>
<subtitle>github.com: ocaml/ocaml
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/'/>
<entry>
<title>PR#6316: Scanf.scanf failure on %u formats when reading big integers.</title>
<updated>2015-07-24T09:36:03+00:00</updated>
<author>
<name>Xavier Leroy</name>
<email>xavier.leroy@inria.fr</email>
</author>
<published>2015-07-24T09:36:03+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=a1bafbbb6723ae937e2553af43df5a04e281c8d8'/>
<id>a1bafbbb6723ae937e2553af43df5a04e281c8d8</id>
<content type='text'>
The approach implemented is the second one suggested by Benoît Vaugon in the PR:
- The int_of_string functions accept a "0u" prefix meaning "decimal unsigned".
- The '%u' format of the scanf functions adds this "0u" prefix before conversion.
This is consistent with the current handling of unsigned hexa, octal, and binary numbers.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16241 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The approach implemented is the second one suggested by Benoît Vaugon in the PR:
- The int_of_string functions accept a "0u" prefix meaning "decimal unsigned".
- The '%u' format of the scanf functions adds this "0u" prefix before conversion.
This is consistent with the current handling of unsigned hexa, octal, and binary numbers.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16241 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</pre>
</div>
</content>
</entry>
<entry>
<title>PR#6452, GPR#140: add internal support for custom printing formats</title>
<updated>2015-03-08T09:36:10+00:00</updated>
<author>
<name>Gabriel Scherer</name>
<email>gabriel.scherer@gmail.com</email>
</author>
<published>2015-03-08T09:36:10+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=3ad7f526a23b98971275dac6a7939fb174adbd57'/>
<id>3ad7f526a23b98971275dac6a7939fb174adbd57</id>
<content type='text'>
(Jérémie Dimino)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15884 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(Jérémie Dimino)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15884 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</pre>
</div>
</content>
</entry>
<entry>
<title>PR#6791: "%s@[", "%s@{" regression in Scanf</title>
<updated>2015-03-07T10:55:13+00:00</updated>
<author>
<name>Gabriel Scherer</name>
<email>gabriel.scherer@gmail.com</email>
</author>
<published>2015-03-07T10:55:13+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=efa9d3bd9eab489503cf98ea379c5f4e8950f5da'/>
<id>efa9d3bd9eab489503cf98ea379c5f4e8950f5da</id>
<content type='text'>
(Benoît Vaugon)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15881 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(Benoît Vaugon)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15881 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</pre>
</div>
</content>
</entry>
<entry>
<title>merge branch 4.02 from release 4.02.0 to release 4.02.1</title>
<updated>2014-10-15T13:34:58+00:00</updated>
<author>
<name>Damien Doligez</name>
<email>damien.doligez-inria.fr</email>
</author>
<published>2014-10-15T13:34:58+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=031cffd1554cde5e9d78b78e4959708a2d8c9201'/>
<id>031cffd1554cde5e9d78b78e4959708a2d8c9201</id>
<content type='text'>
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15558 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15558 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</pre>
</div>
</content>
</entry>
<entry>
<title>merge changes from branch 4.02 from branching (rev 14852) to 4.02.0+rc1 (rev 15121)</title>
<updated>2014-08-22T13:45:02+00:00</updated>
<author>
<name>Damien Doligez</name>
<email>damien.doligez-inria.fr</email>
</author>
<published>2014-08-22T13:45:02+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=cbfe627f925ab2bab93bae7a7bc9f6ee6afb8637'/>
<id>cbfe627f925ab2bab93bae7a7bc9f6ee6afb8637</id>
<content type='text'>
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</pre>
</div>
</content>
</entry>
<entry>
<title>PR#6418: support "@[&lt;hov %d&gt;" in the new format implementation (Benoît Vaugon)</title>
<updated>2014-06-14T21:08:50+00:00</updated>
<author>
<name>Gabriel Scherer</name>
<email>gabriel.scherer@gmail.com</email>
</author>
<published>2014-06-14T21:08:50+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=49d3f7b9f89826ed1b2d33a144277b390bbc3f2e'/>
<id>49d3f7b9f89826ed1b2d33a144277b390bbc3f2e</id>
<content type='text'>
The bootstrap procedure, as for commit trunk@14973 (see there for
detailed build instructions), requires to first commit a temporary
patch:

&gt; diff -Naur old/typing/typecore.ml new/typing/typecore.ml
&gt; --- old/typing/typecore.ml        2014-06-11 18:16:24.851647309 +0200
&gt; +++ new/typing/typecore.ml        2014-06-11 18:15:50.075646418 +0200
&gt; @@ -2758,16 +2758,9 @@
&gt;        let mk_int n = mk_cst (Const_int n)
&gt;        and mk_string str = mk_cst (Const_string (str, None))
&gt;        and mk_char chr = mk_cst (Const_char chr) in
&gt; -      let mk_block_type bty = match bty with
&gt; -        | Pp_hbox   -&gt; mk_constr "Pp_hbox"   []
&gt; -        | Pp_vbox   -&gt; mk_constr "Pp_vbox"   []
&gt; -        | Pp_hvbox  -&gt; mk_constr "Pp_hvbox"  []
&gt; -        | Pp_hovbox -&gt; mk_constr "Pp_hovbox" []
&gt; -        | Pp_box    -&gt; mk_constr "Pp_box"    []
&gt; -        | Pp_fits   -&gt; mk_constr "Pp_fits"   [] in
&gt;        let rec mk_formatting_lit fmting = match fmting with
&gt; -        | Open_box (org, bty, idt) -&gt;
&gt; -          mk_constr "Open_box" [ mk_string org; mk_block_type bty; mk_int idt ]
&gt; +        | Open_box _ -&gt;
&gt; +          assert false
&gt;          | Close_box -&gt;
&gt;            mk_constr "Close_box" []
&gt;          | Close_tag -&gt;
&gt; @@ -2950,6 +2943,19 @@
&gt;            mk_constr "Alpha" [ mk_fmt rest ]
&gt;          | Theta rest -&gt;
&gt;            mk_constr "Theta" [ mk_fmt rest ]
&gt; +        | Formatting_lit (Open_box (org, _bty, _idt), rest) -&gt;
&gt; +          mk_constr "Formatting_gen" [
&gt; +            mk_constr "Open_box" [
&gt; +              mk_constr "Format" [
&gt; +                mk_constr "String_literal" [
&gt; +                  mk_string "&lt;&gt;";
&gt; +                  mk_constr "End_of_format" [];
&gt; +                ];
&gt; +                mk_string "@[&lt;&gt;";
&gt; +              ]
&gt; +            ];
&gt; +            mk_fmt rest;
&gt; +          ]
&gt;          | Formatting_lit (fmting, rest) -&gt;
&gt;            mk_constr "Formatting_lit" [ mk_formatting_lit fmting; mk_fmt rest ]
&gt;          | Formatting_gen (fmting, rest) -&gt;

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14984 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The bootstrap procedure, as for commit trunk@14973 (see there for
detailed build instructions), requires to first commit a temporary
patch:

&gt; diff -Naur old/typing/typecore.ml new/typing/typecore.ml
&gt; --- old/typing/typecore.ml        2014-06-11 18:16:24.851647309 +0200
&gt; +++ new/typing/typecore.ml        2014-06-11 18:15:50.075646418 +0200
&gt; @@ -2758,16 +2758,9 @@
&gt;        let mk_int n = mk_cst (Const_int n)
&gt;        and mk_string str = mk_cst (Const_string (str, None))
&gt;        and mk_char chr = mk_cst (Const_char chr) in
&gt; -      let mk_block_type bty = match bty with
&gt; -        | Pp_hbox   -&gt; mk_constr "Pp_hbox"   []
&gt; -        | Pp_vbox   -&gt; mk_constr "Pp_vbox"   []
&gt; -        | Pp_hvbox  -&gt; mk_constr "Pp_hvbox"  []
&gt; -        | Pp_hovbox -&gt; mk_constr "Pp_hovbox" []
&gt; -        | Pp_box    -&gt; mk_constr "Pp_box"    []
&gt; -        | Pp_fits   -&gt; mk_constr "Pp_fits"   [] in
&gt;        let rec mk_formatting_lit fmting = match fmting with
&gt; -        | Open_box (org, bty, idt) -&gt;
&gt; -          mk_constr "Open_box" [ mk_string org; mk_block_type bty; mk_int idt ]
&gt; +        | Open_box _ -&gt;
&gt; +          assert false
&gt;          | Close_box -&gt;
&gt;            mk_constr "Close_box" []
&gt;          | Close_tag -&gt;
&gt; @@ -2950,6 +2943,19 @@
&gt;            mk_constr "Alpha" [ mk_fmt rest ]
&gt;          | Theta rest -&gt;
&gt;            mk_constr "Theta" [ mk_fmt rest ]
&gt; +        | Formatting_lit (Open_box (org, _bty, _idt), rest) -&gt;
&gt; +          mk_constr "Formatting_gen" [
&gt; +            mk_constr "Open_box" [
&gt; +              mk_constr "Format" [
&gt; +                mk_constr "String_literal" [
&gt; +                  mk_string "&lt;&gt;";
&gt; +                  mk_constr "End_of_format" [];
&gt; +                ];
&gt; +                mk_string "@[&lt;&gt;";
&gt; +              ]
&gt; +            ];
&gt; +            mk_fmt rest;
&gt; +          ]
&gt;          | Formatting_lit (fmting, rest) -&gt;
&gt;            mk_constr "Formatting_lit" [ mk_formatting_lit fmting; mk_fmt rest ]
&gt;          | Formatting_gen (fmting, rest) -&gt;

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14984 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</pre>
</div>
</content>
</entry>
<entry>
<title>PR#6418: fix format regression on "@{&lt;..%d..%s..&gt;" (Benoît Vaugon)</title>
<updated>2014-06-09T13:53:47+00:00</updated>
<author>
<name>Gabriel Scherer</name>
<email>gabriel.scherer@gmail.com</email>
</author>
<published>2014-06-09T13:53:47+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=7cb9d0d84ea13ae0f984b45f6b9ddae5ca4a5198'/>
<id>7cb9d0d84ea13ae0f984b45f6b9ddae5ca4a5198</id>
<content type='text'>
To be able to compile this patch, you should temporarily apply the
following patch to bootstrap the format type change:

&gt; diff -Naur old/typing/typecore.ml new/typing/typecore.ml
&gt; --- old/typing/typecore.ml	2014-06-06 03:37:03.240926150 +0200
&gt; +++ new/typing/typecore.ml	2014-06-06 03:37:24.696926699 +0200
&gt; @@ -2956,7 +2956,7 @@
&gt;          | Theta rest -&gt;
&gt;            mk_constr "Theta" [ mk_fmt rest ]
&gt;          | Formatting (fmting, rest) -&gt;
&gt; -          mk_constr "Formatting" [ mk_formatting fmting; mk_fmt rest ]
&gt; +          mk_constr "Formatting_lit" [ mk_formatting fmting; mk_fmt rest ]
&gt;          | Reader rest -&gt;
&gt;            mk_constr "Reader" [ mk_fmt rest ]
&gt;          | Scan_char_set (width_opt, char_set, rest) -&gt;

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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To be able to compile this patch, you should temporarily apply the
following patch to bootstrap the format type change:

&gt; diff -Naur old/typing/typecore.ml new/typing/typecore.ml
&gt; --- old/typing/typecore.ml	2014-06-06 03:37:03.240926150 +0200
&gt; +++ new/typing/typecore.ml	2014-06-06 03:37:24.696926699 +0200
&gt; @@ -2956,7 +2956,7 @@
&gt;          | Theta rest -&gt;
&gt;            mk_constr "Theta" [ mk_fmt rest ]
&gt;          | Formatting (fmting, rest) -&gt;
&gt; -          mk_constr "Formatting" [ mk_formatting fmting; mk_fmt rest ]
&gt; +          mk_constr "Formatting_lit" [ mk_formatting fmting; mk_fmt rest ]
&gt;          | Reader rest -&gt;
&gt;            mk_constr "Reader" [ mk_fmt rest ]
&gt;          | Scan_char_set (width_opt, char_set, rest) -&gt;

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
</pre>
</div>
</content>
</entry>
<entry>
<title>format+gadts: make format types "relational" to fix %(...%) typing</title>
<updated>2014-05-21T13:23:13+00:00</updated>
<author>
<name>Gabriel Scherer</name>
<email>gabriel.scherer@gmail.com</email>
</author>
<published>2014-05-21T13:23:13+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=e0b000527be1c6e2a93a7b859499378db85b915c'/>
<id>e0b000527be1c6e2a93a7b859499378db85b915c</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>Use a nominal datatype for CamlinternalFormat.format6</title>
<updated>2014-05-14T15:07:13+00:00</updated>
<author>
<name>Gabriel Scherer</name>
<email>gabriel.scherer@gmail.com</email>
</author>
<published>2014-05-14T15:07:13+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=3ffa399b3714c7ce084d05415a0faa0a6c976aa3'/>
<id>3ffa399b3714c7ce084d05415a0faa0a6c976aa3</id>
<content type='text'>
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:

&gt; Error: This expression has type
&gt;          ('a, 'b, 'c, 'd, 'd, 'a) format6 =
&gt;            ('a, 'b, 'c, 'd, 'd, 'a) CamlinternalFormatBasics.format6
&gt;        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:

&gt; Error: This expression has type ('a, 'b, 'c, 'd, 'd, 'a) format6
&gt;        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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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:

&gt; Error: This expression has type
&gt;          ('a, 'b, 'c, 'd, 'd, 'a) format6 =
&gt;            ('a, 'b, 'c, 'd, 'd, 'a) CamlinternalFormatBasics.format6
&gt;        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:

&gt; Error: This expression has type ('a, 'b, 'c, 'd, 'd, 'a) format6
&gt;        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
</pre>
</div>
</content>
</entry>
<entry>
<title>Add support for ignored scan_get_counter formats (%_[nlNL])</title>
<updated>2014-05-12T15:37:56+00:00</updated>
<author>
<name>Gabriel Scherer</name>
<email>gabriel.scherer@gmail.com</email>
</author>
<published>2014-05-12T15:37:56+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ocaml.git/commit/?id=bf6e3185c055221df51dfec26cd9131194a7c5b8'/>
<id>bf6e3185c055221df51dfec26cd9131194a7c5b8</id>
<content type='text'>
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14820 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14820 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
</pre>
</div>
</content>
</entry>
</feed>
