diff --git a/_odoc-theme/fonts/DejaVuSansMono-Bold.woff2 b/_odoc-theme/fonts/DejaVuSansMono-Bold.woff2 new file mode 100644 index 00000000..f2b469a6 Binary files /dev/null and b/_odoc-theme/fonts/DejaVuSansMono-Bold.woff2 differ diff --git a/_odoc-theme/fonts/DejaVuSansMono-BoldOblique.woff2 b/_odoc-theme/fonts/DejaVuSansMono-BoldOblique.woff2 new file mode 100644 index 00000000..c28f9107 Binary files /dev/null and b/_odoc-theme/fonts/DejaVuSansMono-BoldOblique.woff2 differ diff --git a/_odoc-theme/fonts/DejaVuSansMono-Oblique.woff2 b/_odoc-theme/fonts/DejaVuSansMono-Oblique.woff2 new file mode 100644 index 00000000..2631692e Binary files /dev/null and b/_odoc-theme/fonts/DejaVuSansMono-Oblique.woff2 differ diff --git a/_odoc-theme/fonts/DejaVuSansMono.woff2 b/_odoc-theme/fonts/DejaVuSansMono.woff2 new file mode 100644 index 00000000..cf200e12 Binary files /dev/null and b/_odoc-theme/fonts/DejaVuSansMono.woff2 differ diff --git a/_odoc-theme/fonts/PTC55F.woff2 b/_odoc-theme/fonts/PTC55F.woff2 new file mode 100644 index 00000000..aa67b386 Binary files /dev/null and b/_odoc-theme/fonts/PTC55F.woff2 differ diff --git a/_odoc-theme/fonts/PTC75F.woff2 b/_odoc-theme/fonts/PTC75F.woff2 new file mode 100644 index 00000000..fa5a500e Binary files /dev/null and b/_odoc-theme/fonts/PTC75F.woff2 differ diff --git a/_odoc-theme/fonts/PTS55F.woff2 b/_odoc-theme/fonts/PTS55F.woff2 new file mode 100644 index 00000000..0aef8b14 Binary files /dev/null and b/_odoc-theme/fonts/PTS55F.woff2 differ diff --git a/_odoc-theme/fonts/PTS56F.woff2 b/_odoc-theme/fonts/PTS56F.woff2 new file mode 100644 index 00000000..2fd9d9af Binary files /dev/null and b/_odoc-theme/fonts/PTS56F.woff2 differ diff --git a/_odoc-theme/fonts/PTS75F.woff2 b/_odoc-theme/fonts/PTS75F.woff2 new file mode 100644 index 00000000..a0fa7de3 Binary files /dev/null and b/_odoc-theme/fonts/PTS75F.woff2 differ diff --git a/_odoc-theme/fonts/PTS76F.woff2 b/_odoc-theme/fonts/PTS76F.woff2 new file mode 100644 index 00000000..8cae8e79 Binary files /dev/null and b/_odoc-theme/fonts/PTS76F.woff2 differ diff --git a/_odoc-theme/fonts/fonts.css b/_odoc-theme/fonts/fonts.css new file mode 100644 index 00000000..9bffe8e8 --- /dev/null +++ b/_odoc-theme/fonts/fonts.css @@ -0,0 +1,59 @@ +@charset "UTF-8"; + +/* PT Sans */ + +@font-face +{ font-family: 'PT-Sans'; + src: url('PTS55F.woff2') format('woff2'); + font-weight: 400; font-style: normal; } + +@font-face +{ font-family: 'PT-Sans'; + src: url('PTS75F.woff2') format('woff2'); + font-weight: 700; font-style: normal; } + +@font-face +{ font-family: 'PT-Sans'; + src: url('PTS56F.woff2') format('woff2'); + font-weight: 400; font-style: italic; } + +@font-face +{ font-family: 'PT-Sans'; + src: url('PTS76F.woff2') format('woff2'); + font-weight: 700; font-style: italic; } + +/* PT Sans caption */ + +@font-face +{ font-family: 'PT-Sans-Caption'; + src: url('PTC55F.woff2') format('woff2'); + font-weight: 400; font-style: normal; } + +@font-face +{ font-family: 'PT-Sans-Caption'; + src: url('PTC75F.woff2') format('woff2'); + font-weight: 700; font-style: normal; } + +/* DejaVu 400 */ + +@font-face +{ font-family: 'DejaVu-SansMono'; + src: url('DejaVuSansMono.woff2') format('woff2'); + font-weight: 400; font-style: normal; } + +@font-face +{ font-family: 'DejaVu-SansMono'; + src: url('DejaVuSansMono-Oblique.woff2') format('woff2'); + font-weight: 400; font-style: oblique; } + +/* DejaVu 700 */ + +@font-face +{ font-family: 'DejaVu-SansMono'; + src: url('DejaVuSansMono-Bold.woff2') format('woff2'); + font-weight: 700; font-style: normal; } + +@font-face +{ font-family: 'DejaVu-SansMono'; + src: url('DejaVuSansMono-BoldOblique.woff2') format('woff2'); + font-weight: 700; font-style: oblique; } diff --git a/_odoc-theme/manual.css b/_odoc-theme/manual.css new file mode 100644 index 00000000..92a1b438 --- /dev/null +++ b/_odoc-theme/manual.css @@ -0,0 +1,376 @@ +@charset "UTF-8"; +@import url("fonts/fonts.css"); +@import url("theme.css"); + +/* Copyright (c) 2019 The odig programmers. All rights reserved. + Distributed under the ISC license, see terms at the end of the file. + odig v0.0.9 */ + +:root { --font-headings: "PT-Sans-Caption"; + --font-body: "PT-Sans"; + --font-mono: "DejaVu-SansMono"; + + --size-font: 0.96875rem; + --size-font-micro: calc(0.675 * var(--size-font)); + --size-font-tiny-ratio: 0.75; + --size-font-tiny: calc(var(--size-font-tiny-ratio) * var(--size-font)); + --size-font-small: calc(0.875 * var(--size-font)); + --size-font-large: calc(1.25 * var(--size-font)); + --size-font-big: calc(1.5 * var(--size-font)); + --size-font-huge: calc(1.75 * var(--size-font)); + --size-font-mono-ratio: 0.87097; + --size-line-ratio: 1.5; + --size-line: calc(var(--size-line-ratio) * var(--size-font)); + --size-half-line: calc(0.5 * var(--size-line)); } + +/* Reset a few things. */ + +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre, +a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,select, +small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li, +fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td, +article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup, +menu,nav,output,ruby,section,summary,time,mark,audio,video,button,input +{ margin: 0; padding: 0; border: 0; /* outline: 0; */ + font-size: inherit; font: inherit; font-weight: inherit; + line-height: inherit; vertical-align: baseline; + text-align: inherit; color: inherit; background: transparent; } + +table { border-collapse: collapse; border-spacing: 0; } +*, *:before, *:After { box-sizing: border-box; } + +/* Note the stylesheet has quite hackish CSS selectors as the markup's + classification is sometimes a bit lacking. */ + +/* Geometry. + See also media adjustements at the end of the stylesheet. */ + +body { background-color: var(--color-bg); + color: var(--color-fg); + font-size: var(--size-font); + font-family: var(--font-body), sans-serif; + font-weight: 400; + line-height: var(--size-line); + text-align: left; + position: relative; + max-width: 120ch; + margin: 0 auto; + padding: calc(1.5 * var(--size-line)); + padding-top: calc(0.5 * var(--size-line)); } + +body > * { max-width: 80ch; width: 75% } +body > ul:first-of-type:not(.itemize):not(.ftoc2) /* toc */ +{ position: absolute; + top: 0px; right: 0px; + width: 20%; + margin-left: var(--size-line); + margin-top: calc(2 * var(--size-line)); + margin-right: var(--size-line); + border-top: solid thin var(--color-rule); } + +/* Rules + We remove the top one, keep the last one and add one over h1 and h2 */ + +body > hr:last-of-type { + margin-top: var(--size-line); + border-style: none; + width: 100%; + max-width: 100%; + text-align: right; + border-top: solid thin var(--color-rule); } + +body > hr:first-of-type { display: none } /* order with last-of-type imporant */ +h1, h2 { border-top: solid thin var(--color-rule) } + +/* Hacks */ + +body > a > img /* Navigation arrows, a bit problematic for dark themes */ +{ display: inline-block; margin:0; + background-color: var(--color-code-block-bg); /* bof */ } + +body > p br, h1 br { display: none; } /* brs should die */ + +/* Basic markup */ + +h1, h2, h3, h4, h5, h6 +{ font-family: var(--font-headings), sans-serif; + font-weight: 400; + text-transform: uppercase; + margin-top: var(--size-line); } + +h1, h2 { line-height: calc(1.5 * var(--size-line)); + padding-top: calc(0.75 * var(--size-line)); } + +hr + h1, hr + h2 { margin-top: calc(0.25 * var(--size-line)) } + +h1 { font-size: var(--size-font-huge); } +h2 { font-size: var(--size-font-big); } +h3 { font-size: var(--size-font-large); } + +div, nav, p, ol, ul, dl, pre, table, blockquote +{ margin-top: var(--size-half-line); } + +ul, ol { list-style-position: outside } +ul { list-style-type: square } +ul > li { margin-left: 2.25ch; } +ol > li { margin-left: 2ch; } + +em { font-style: italic } +b, strong { font-weight: 700 } +small { font-size: var(--size-font-small); } + +sup { vertical-align: super; } +sub { vertical-align: sub; } +sup, sub { font-size : calc(1em * var(--size-font-tiny-ratio)); + line-height: 0; margin-left: 0.2ex; } + +img { display: block; + margin-top: var(--size-half-line); margin-bottom: var(--size-half-line); } + +blockquote { margin-left: var(--size-half-line); } + +/* Links and anchors. Note anchors need to be refined a bit further down + in certain cases. */ + +a { text-decoration:none; color: var(--color-link); } +a:hover { box-shadow:0 1px 0 0 var(--color-link); } +a.anchor:before { content: "#" } +a.anchor:hover { box-shadow: none; text-decoration: underline; } +*:hover > a.anchor { visibility: visible } +a.anchor +{ visibility: hidden; position: absolute; + font-weight: normal; + font-style: normal; + margin-left: -2.5ch; + padding-right: 1ch; padding-left: 1ch; /* To remain selectable */ + color: var(--color-link); + text-align: right; + } + +*:target /* Linked highlight */ +{ background-color: var(--color-bg-highlight); + box-shadow: 0 0 0 3px var(--color-bg-highlight) } + +/* Code and code highlighting */ + +.c003, .c004, .c005, .c006, .c015, +code, pre +{ font-family: var(--font-mono), monospace; + font-weight: 400; + font-size: calc(1em * var(--size-font-mono-ratio)); + color: var(--color-code-fg); } + +.c004, .c002 { color: var(--color-code-type-id); } +.c005 { font-style: oblique } +.c006 { font-weight: 700 } +.c015 { text-align: left } + +pre .c003, pre .c004, pre .c005, pre .c006, +pre code { font-size: inherit } /* don't apply transform twice... */ +a code { color: inherit } +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { text-transform: none; } + +pre { background: var(--color-code-block-bg); + padding-left: 0.8ch; padding-right: 0.8ch; + margin-left: -0.8ch; margin-right: -0.8ch; + padding-top: 1ch; padding-bottom: 1ch; + white-space: pre-wrap; + word-wrap: break-word; } + +/* Table of contents, like in odoc.css except we don't have a class */ + +body > ul:first-of-type:not(.itemize):not(.ftoc2) +{ font-size: var(--size-font-small); } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) a +{ color : var(--color-fg); } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) a:hover +{ color : var(--color-link); } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) +{ font-family: var(--font-headings); text-transform: uppercase; + list-style-type: none; padding-top: var(--size-line) } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) li +{ margin-left: 0; padding-left: 3.25ch; text-indent: -3.25ch; } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) ul +{ font-family: var(--font-body); + text-transform: none; + margin-top:0; } + +/* toplevel examples */ + +div.caml-example.toplevel div.caml-input::before { content: "#" } +div.caml-input, div.caml-output { margin-top: 0; } + +.caml-input {} +.caml-output { color: var(--color-code-string) /* why not */ } + +/* Other HeVeA classes */ + +.c000 { border-spacing: 2ch; border-collapse: separate; margin: 0 auto; } +.c001 { border-spacing: 1ch; border-collapse: separate } +.c008 { font-size: var(--size-font-small) } +.c009 { font-style:italic } +.c010 { font-style:italic; color:var(--color-link) } +.c011 { font-style:italic; font-weight:700 } +.c012 { font-style:italic } +.c013 { font-style:italic } +.c018 { text-align: right } +.c019 { text-align: left} +.dcenter { margin: 0 auto; } +.description { margin-left: var(--size-line) } +.dd-description br { display: none } +dd + dt { margin-top: var(--size-half-line) } + +dt .c003 { font-style:normal; font-weight:700 } /* options */ + +.indexenv { list-style-type: none } +.indexenv li { margin-left: 0 } + +/* Page specific */ + +/* Cover page */ + +div.maintitle > span > span +{ text-transform: uppercase; + font-family: var(--font-headings); + line-height: var(--size-line-ratio); + font-size: calc(2.25 * var(--size-font)) !important; + margin-left: -0.25ch; /* compensate nbsp */ } + +div.maintitle > span > span > br { display: none } +div.maintitle > span > span > span +{ display: block; + text-transform: none; + font-style: italic; + font-family: var(--font-body); + font-size: var(--size-font-big) !important; } + +div.maintitle > span > span > span > span /* ugh */ +{ font-style: normal; + line-height: var(--size-line); + font-size: var(--size-font) !important; } + +div.maintitle > span > span > span > span > span /* ugh bis */ +{ font-size: var(--size-font-small) !important; + font-style: italic; + margin-left: -1.25ch; } + +div.maintitle + blockquote hr { display : none } +div.maintitle + blockquote +{ margin: 0; +/* margin-top: calc(-1 * var(--size-line)); chrome but not FF, bah... */ + font-size: var(--size-font-small); + border-bottom: solid thin var(--color-rule); + padding-bottom: var(--size-half-line); } + +div.maintitle ~ blockquote:last-of-type { display: none } /* remove branding */ + +div.maintitle ~ ul:first-of-type:not(.itemize):not(.ftoc2) /* undo side toc */ +{ position: static; + padding: 0; + margin: 0; margin-top: var(--size-line); + width: 100%; } + +div.maintitle ~ br { display: none } +div.maintitle ~ ul:first-of-type:not(.itemize):not(.ftoc2) > li { margin: 0; } +div.maintitle ~ ul:first-of-type:not(.itemize):not(.ftoc2) a +{ color: var(--color-link) } + +div.maintitle ~ table { margin-top: 0 } +div.maintitle ~ ul:first-of-type:not(.itemize):not(.ftoc2) +{ list-style-type: none; + font-family: inherit; text-transform: inherit; + font-size: inherit; + margin-top: var(--size-half-line); + border: none; } + +div.maintitle ~ ul { list-style-type: none } +div.maintitle ~ ul li { margin-left: 0 } + +/* Contents page */ + +h1#sec1 + ul:first-of-type /* undo side toc */ +{ position: static; + list-style-type: none; + margin: 0; margin-top: var(--size-half-line); + width: 100%; border: none; padding: 0; + font-size: var(--size-font-big); } + +h1#sec1 + ul:first-of-type li +{ margin-left: 0; padding-left: 0; text-indent: 0 } + +h1#sec1 ~ ul ul +{ list-style-type: none; font-size: var(--size-font-large); font-style: italic;} + +h1#sec1 ~ ul ul ul +{ font-size: var(--size-font); font-style: normal; + margin-top: var(--size-half-line); } + +h1#sec1 ~ ul ul ul ul { margin-left: 2.5ch; margin-top: 0;} +h1#sec1 ~ ul > li { margin-top: var(--size-line); } +h1#sec1 ~ ul > li > ul > li { margin-top: var(--size-half-line); } + +/* Media adjustments */ + +@media only screen and (min-width:160ch) /* and (min-height: 60rem) */ +{ +:root { --size-font: 1.125rem; } /* consider using vmin units */ +} + +@media only screen and (max-width:80ch) +{ + body { padding: var(--size-line); } + body > * { width: 100%; } + body > ul:first-of-type:not(.itemize):not(.ftoc2) + { position: static; + margin: 0; margin-top: var(--size-line); + width: 100%; } + pre { font-size: var(--size-font-tiny); } +} + +@media print +{ + * { -webkit-print-color-adjust: exact; } + .content nav:first-child { visibility: hidden } + body > * { width: 100%; } + body > ul:first-of-type:not(.itemize):not(.ftoc2) + { position: static; width: 100%; + margin: 0; margin-top: var(--size-line); } + + /* odig.light with slight adjustements */ + :root + { --color-bg: white; + --color-bg-highlight: #CAD7EF; + --color-fg: black; + --color-rule: #DADBDB; + + --color-code-block-bg: #E8E8E8; + --color-code-fg: #16191D; + --color-code-comment: #747679; + --color-code-keyword: #874aa9; + --color-code-type-id: #a9874a; + --color-code-string: #4aa987; + + --color-link: #557dcc; + --color-broken-link: #f71414; } +} + +/* +Copyright (c) 2019 The odig programmers + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ diff --git a/_odoc-theme/odoc.css b/_odoc-theme/odoc.css new file mode 100644 index 00000000..1dbc9da2 --- /dev/null +++ b/_odoc-theme/odoc.css @@ -0,0 +1,334 @@ +@charset "UTF-8"; +@import url("fonts/fonts.css"); +@import url("theme.css"); + +/* Copyright (c) 2019 The odig programmers. All rights reserved. + Distributed under the ISC license, see terms at the end of the file. */ + +/* Reset a few things. */ + +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre, +a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,select, +small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li, +fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td, +article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup, +menu,nav,output,ruby,section,summary,time,mark,audio,video,button,input +{ margin: 0; padding: 0; border: 0; /* outline: 0; */ + font-size: inherit; font: inherit; font-weight: inherit; + line-height: inherit; vertical-align: baseline; + text-align: inherit; color: inherit; background: transparent; } + +table { border-collapse: collapse; border-spacing: 0; } +*, *:before, *:after { box-sizing: border-box; } + +/* Basic geometry */ + +:root { --font-headings: "PT-Sans-Caption"; + --font-body: "PT-Sans"; + --font-mono: "DejaVu-SansMono"; + --size-font: 0.96875rem; + --size-font-micro: calc(0.675 * var(--size-font)); + --size-font-tiny-ratio: 0.75; + --size-font-tiny: calc(var(--size-font-tiny-ratio) * var(--size-font)); + --size-font-small: calc(0.875 * var(--size-font)); + --size-font-large: calc(1.25 * var(--size-font)); + --size-font-big: calc(1.5 * var(--size-font)); + --size-font-huge: calc(1.75 * var(--size-font)); + --size-font-mono-ratio: 0.87097; + --size-font-mono-ratio: 0.865; + --size-line-ratio: 1.5; + --size-line: calc(var(--size-line-ratio) * var(--size-font)); + --size-half-line: calc(0.5 * var(--size-line)); + --size-fourth-line: calc(0.25 * var(--size-line)); } + +.odoc { background-color: var(--color-bg); + color: var(--color-fg); + font-size: var(--size-font); + font-family: var(--font-body), sans-serif; + font-weight: 400; + line-height: var(--size-line); + text-align: left; + display: grid; + margin: 0 auto; + max-width: 130ch; + grid-template-columns: minmax(50ch,76ch) minmax(23ch,1fr); + grid-column-gap: calc(2 * var(--size-line)); + grid-template-areas: "nav nav" + "header toc" + "content toc"; + padding: calc(1.5 * var(--size-line)); + padding-top: calc(0.5 * var(--size-line)); } + +.odoc-nav { grid-area: nav; } +.odoc-preamble { grid-area: header; } +.odoc-content { grid-area: content; margin: 0 } +.odoc-toc +{ grid-area: toc; + margin-top: var(--size-line); + border-top: solid thin var(--color-rule); } + +/* Media adjustments */ + +@media only screen and (min-width:160ch) /* and (min-height: 60rem) */ +{ + :root { --size-font: 1.125rem; } /* consider using vmin units */ +} + +@media only screen and (max-width:80ch) /* Basically mobile */ +{ + .odoc + { padding: var(--size-line); + grid-template-columns: auto; + grid-template-rows: none; + grid-template-areas: "nav" + "header" + "toc" + "content"; } + .odoc-toc { margin: 0; margin-top: var(--size-line); } + pre { font-size: var(--size-font-tiny); } +} + +@media print +{ + * { -webkit-print-color-adjust: exact; } + .odoc-nav { visibility: hidden } + .odoc-toc { margin: 0; margin-top: var(--size-line); } + + /* odig.light with slight adjustements */ + :root + { --color-bg: white; + --color-bg-highlight: #CAD7EF; + --color-fg: black; + --color-rule: #DADBDB; + + --color-code-block-bg: #E8E8E8; + --color-code-fg: #16191D; + --color-code-comment: #747679; + --color-code-keyword: #874aa9; + --color-code-type-id: #a9874a; + --color-code-string: #4aa987; + + --color-link: #557dcc; + --color-broken-link: #f71414; } +} + +/* Block level markup */ + +header > * + *, div > * + *, details > * + * +{ margin-top: var(--size-half-line); } + +ul + * , ol + * { margin-top: 0; } +ul, ol { margin-top: var(--size-fourth-line); + margin-bottom: var(--size-fourth-line); + list-style-position: outside; } + +li *:first-child, li ol, li ul { margin-top: 0; } + +ul { list-style-type: square; } +ul > li { margin-left: 2.25ch; } +ol > li { margin-left: 2ch; } +ol li::marker +{ font-family: var(--font-headings), sans-serif; + font-size: var(--size-font-small); } + +img +{ display: block; + margin-top: var(--size-half-line); + margin-bottom: var(--size-half-line); } + +/* Headings and horizontal rulers */ + +h1, h2, .odoc-content > *:first-child +{ border-top: solid thin var(--color-rule); + padding-top: calc(0.75 * var(--size-line)); + margin-top: var(--size-line); } + +h1, h2, h3, h4, h5, h6 +{ font-family: var(--font-headings), sans-serif; + font-weight: 400; + text-transform: uppercase; + margin-top: var(--size-line); } + +h1, h2 { line-height: calc(1.5 * var(--size-line)); } +h1 { font-size: var(--size-font-huge); } +h2 { font-size: var(--size-font-big); } +h3 { font-size: var(--size-font-large); } + +/* Phrasing content */ + +em { font-style: italic } +b, strong { font-weight: 700 } +small { font-size: var(--size-font-small); } + +sup { vertical-align: super; } +sub { vertical-align: sub; } +sup, sub +{ font-size : calc(1em * var(--size-font-tiny-ratio)); + line-height: 0; margin-left: 0.2ex; } + +/* Code and code highlighting */ + +code, pre +{ font-family: var(--font-mono), monospace; + font-weight: 400; + font-size: calc(1em * var(--size-font-mono-ratio)); + color: var(--color-code-fg); + overflow-wrap: anywhere; } + +code span span { white-space: nowrap } /* Do not break these units */ + +pre code { font-size: inherit } /* don't apply transform twice... */ +a code { color: inherit } +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { text-transform: none; } + +pre +{ background: var(--color-code-block-bg); + padding-left: 0.8ch; padding-right: 0.8ch; + margin-left: -0.8ch; margin-right: -0.8ch; + padding-top: 1ch; padding-bottom: 1ch; + white-space: pre-wrap; + overflow-wrap: break-word; } + +.arrow { white-space: nowrap } +.keyword , .hljs-keyword { color : var(--color-code-keyword); } +.hljs-type { color : var(--color-code-type-id); } +.hljs-string { color : var(--color-code-string); } +.hljs-comment { color : var(--color-code-comment); font-style: italic; } + +/* Links and anchors. Note anchors need to be refined a bit further down + in certain cases. */ + +a { text-decoration:none; color: var(--color-link); } +a:hover { box-shadow:0 1px 0 0 var(--color-link); } +a.anchor:before { content: "#" } +a.anchor:hover { box-shadow: none; text-decoration: underline; } +*:hover > a.anchor { visibility: visible } +a.anchor +{ visibility: hidden; position: absolute; + font-weight: normal; + font-style: normal; + margin-left: -2.5ch; + padding-right: 1ch; padding-left: 1ch; /* To remain selectable */ + color: var(--color-link); + text-align: right; } + +*:target /* Linked highlight */ +{ background-color: var(--color-bg-highlight); + box-shadow: 0 0 0 3px var(--color-bg-highlight) } + +.xref-unresolved { box-shadow:0 1px 0 0 var(--color-broken-link)} + +/* Table of contents */ + +.odoc-toc { font-size: var(--size-font-small); } +.odoc-toc a { color : var(--color-fg); } +.odoc-toc a:hover { color : var(--color-link) } +.odoc-toc ul +{ font-family: var(--font-headings); text-transform: uppercase; + margin-top: var(--size-line); + list-style-type: none; } + +.odoc-toc ul ul +{ font-family: var(--font-body); text-transform: none; margin-top:0; } + +.odoc-toc ul ul ul { margin-left:1.5ch } +.odoc-toc li { margin-left: 0; padding-left: 1ch; text-indent: -1ch; } +.odoc-toc > ul > li { margin-top: calc(0.25 * var(--size-half-line)) } +.odoc-toc > ul > li > ul > li:last-child +{ margin-bottom: var(--size-half-line) } + +.odoc-toc ul ul li { margin-left: 0; padding-left: 0; } + +/* Module structure items */ + +.odoc-spec { padding-bottom: var(--size-fourth-line); } +.spec { margin-top: 0; } +.spec-doc { margin-top:0; padding-left: 1ch; } +.spec-doc > *:first-child { margin-top: 0 } + +/* Indent on wrap */ +.spec, .spec td:first-child { padding-left: 4ch; text-indent: -4ch } +.spec td.field { padding-left: 6ch } + +.spec .def-doc .comment-delim + * { margin-top: 0 } +.spec .def-doc .comment-delim /* make them invisible yet copy-pastable */ +{ position: absolute; width: 1px; height: 1px; overflow: hidden; } + +/* But we don't do it for types for now because of variants and + records. This makes :target highlight be off. And poses + other problems (e.g. need to indent back the last ] or }. + A better markup strategy should be found here. */ +.spec.type { padding-left: 0; text-indent: 0 } +.spec.type > a.anchor +{ padding-left: 1ch; padding-right: 1ch; /* values from a.anchor */ } +.spec li > a.anchor, .spec > a.anchor +{ padding-right: 0.5ch; padding-left: 2ch; } + +.spec ol { margin:0; list-style-type: none; } +.spec li { margin-left: 0; padding-left: 4ch; text-indent: -4ch } +.spec li.record.field { margin-left: 2ch } + +.spec .def-doc { display: inline-block } +.spec .def-doc { padding-left: /* 4 + 3 */ 7ch; } +.spec .def-doc p { margin-left: -4ch; text-indent: 0 } + +.odoc-include summary { cursor: pointer } + +/* Package, module and @tag lists + + Allowing indent on wrap with the anchor makes all this quite convoluted. + Is there a better way ? */ + +.packages, .modules, .at-tags { list-style-type: none; margin-left: -2ch; } +.packages li, .modules li, .at-tags li { padding-left: 2ch; text-indent: -2ch; } +.modules li a.anchor, .packages li a.anchor +{ padding-right: 0.5ch; padding-left: 2ch; } + +.synopsis { padding-left: 1ch; } +.version { font-size: var(--size-font-micro); } +.at-tag { text-transform : capitalize } + +/* Package page */ + +h1 .version, h1 nav { font-size: var(--size-font); line-height:0 } +h1 nav +{ display: inline-block; + font-family: var(--font-body); + text-transform: capitalize; } + +.package.info td:first-child { padding-right: 2ch; min-width: 13ch} +.package.info ul { list-style-type: none; display: inline; margin:0; padding:0} +.package.info li { display: inline-block; margin:0; margin-right:1ex; } +#info-authors li, #info-maintainers li { display: block; } + +/* Package index page */ + +.by-name nav a +{ font-family: var(--font-headings); + font-size: var(--size-font-large); + text-transform: uppercase; + margin-right: 1ch; + display: inline-block; } + +.by-tag ol { list-style-type: none; } +.by-tag ol.tags li { margin-left: 1ch; display: inline-block } +.by-tag td:first-child +{ font-family: var(--font-headings); + font-size: var(--size-font-large); + text-transform: uppercase; } + +/* +Copyright (c) 2019 The odig programmers + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ diff --git a/_odoc-theme/theme.css b/_odoc-theme/theme.css new file mode 100644 index 00000000..a7a8e6b8 --- /dev/null +++ b/_odoc-theme/theme.css @@ -0,0 +1,34 @@ +:root +{ --color-bg: #F6F6F6; + --color-bg-highlight: #CAD7EF; + --color-fg: #1F2227; + --color-rule: #DADBDB; + + --color-code-block-bg: #E8E8E8; + --color-code-fg: #16191D; + --color-code-comment: #747679; + --color-code-keyword: #874aa9; + --color-code-type-id: #a9874a; + --color-code-string: #4aa987; + + --color-link: #557dcc; + --color-broken-link: #f71414; } + +@media (prefers-color-scheme: dark) +{ +:root +{ --color-bg: #181B20; + --color-bg-highlight: #303644; + --color-fg: #8C8D90; + --color-rule: #2F3236; + + --color-code-block-bg: #24272A; + --color-code-fg: #A3A4A6; + --color-code-comment: #747679; + --color-code-keyword: #7F668D; + --color-code-type-id: #8D7F66; + --color-code-string: #668d7f; + + --color-link: #7788AA; + --color-broken-link: #900505; } +} diff --git a/fonts/KaTeX_AMS-Regular.woff2 b/fonts/KaTeX_AMS-Regular.woff2 new file mode 100644 index 00000000..0acaaff0 Binary files /dev/null and b/fonts/KaTeX_AMS-Regular.woff2 differ diff --git a/fonts/KaTeX_Caligraphic-Bold.woff2 b/fonts/KaTeX_Caligraphic-Bold.woff2 new file mode 100644 index 00000000..f390922e Binary files /dev/null and b/fonts/KaTeX_Caligraphic-Bold.woff2 differ diff --git a/fonts/KaTeX_Caligraphic-Regular.woff2 b/fonts/KaTeX_Caligraphic-Regular.woff2 new file mode 100644 index 00000000..75344a1f Binary files /dev/null and b/fonts/KaTeX_Caligraphic-Regular.woff2 differ diff --git a/fonts/KaTeX_Fraktur-Bold.woff2 b/fonts/KaTeX_Fraktur-Bold.woff2 new file mode 100644 index 00000000..395f28be Binary files /dev/null and b/fonts/KaTeX_Fraktur-Bold.woff2 differ diff --git a/fonts/KaTeX_Fraktur-Regular.woff2 b/fonts/KaTeX_Fraktur-Regular.woff2 new file mode 100644 index 00000000..735f6948 Binary files /dev/null and b/fonts/KaTeX_Fraktur-Regular.woff2 differ diff --git a/fonts/KaTeX_Main-Bold.woff2 b/fonts/KaTeX_Main-Bold.woff2 new file mode 100644 index 00000000..ab2ad21d Binary files /dev/null and b/fonts/KaTeX_Main-Bold.woff2 differ diff --git a/fonts/KaTeX_Main-BoldItalic.woff2 b/fonts/KaTeX_Main-BoldItalic.woff2 new file mode 100644 index 00000000..5931794d Binary files /dev/null and b/fonts/KaTeX_Main-BoldItalic.woff2 differ diff --git a/fonts/KaTeX_Main-Italic.woff2 b/fonts/KaTeX_Main-Italic.woff2 new file mode 100644 index 00000000..b50920e1 Binary files /dev/null and b/fonts/KaTeX_Main-Italic.woff2 differ diff --git a/fonts/KaTeX_Main-Regular.woff2 b/fonts/KaTeX_Main-Regular.woff2 new file mode 100644 index 00000000..eb24a7ba Binary files /dev/null and b/fonts/KaTeX_Main-Regular.woff2 differ diff --git a/fonts/KaTeX_Math-BoldItalic.woff2 b/fonts/KaTeX_Math-BoldItalic.woff2 new file mode 100644 index 00000000..29657023 Binary files /dev/null and b/fonts/KaTeX_Math-BoldItalic.woff2 differ diff --git a/fonts/KaTeX_Math-Italic.woff2 b/fonts/KaTeX_Math-Italic.woff2 new file mode 100644 index 00000000..215c143f Binary files /dev/null and b/fonts/KaTeX_Math-Italic.woff2 differ diff --git a/fonts/KaTeX_SansSerif-Bold.woff2 b/fonts/KaTeX_SansSerif-Bold.woff2 new file mode 100644 index 00000000..cfaa3bda Binary files /dev/null and b/fonts/KaTeX_SansSerif-Bold.woff2 differ diff --git a/fonts/KaTeX_SansSerif-Italic.woff2 b/fonts/KaTeX_SansSerif-Italic.woff2 new file mode 100644 index 00000000..349c06dc Binary files /dev/null and b/fonts/KaTeX_SansSerif-Italic.woff2 differ diff --git a/fonts/KaTeX_SansSerif-Regular.woff2 b/fonts/KaTeX_SansSerif-Regular.woff2 new file mode 100644 index 00000000..a90eea85 Binary files /dev/null and b/fonts/KaTeX_SansSerif-Regular.woff2 differ diff --git a/fonts/KaTeX_Script-Regular.woff2 b/fonts/KaTeX_Script-Regular.woff2 new file mode 100644 index 00000000..b3048fc1 Binary files /dev/null and b/fonts/KaTeX_Script-Regular.woff2 differ diff --git a/fonts/KaTeX_Size1-Regular.woff2 b/fonts/KaTeX_Size1-Regular.woff2 new file mode 100644 index 00000000..c5a8462f Binary files /dev/null and b/fonts/KaTeX_Size1-Regular.woff2 differ diff --git a/fonts/KaTeX_Size2-Regular.woff2 b/fonts/KaTeX_Size2-Regular.woff2 new file mode 100644 index 00000000..e1bccfe2 Binary files /dev/null and b/fonts/KaTeX_Size2-Regular.woff2 differ diff --git a/fonts/KaTeX_Size3-Regular.woff2 b/fonts/KaTeX_Size3-Regular.woff2 new file mode 100644 index 00000000..249a2866 Binary files /dev/null and b/fonts/KaTeX_Size3-Regular.woff2 differ diff --git a/fonts/KaTeX_Size4-Regular.woff2 b/fonts/KaTeX_Size4-Regular.woff2 new file mode 100644 index 00000000..680c1308 Binary files /dev/null and b/fonts/KaTeX_Size4-Regular.woff2 differ diff --git a/fonts/KaTeX_Typewriter-Regular.woff2 b/fonts/KaTeX_Typewriter-Regular.woff2 new file mode 100644 index 00000000..771f1af7 Binary files /dev/null and b/fonts/KaTeX_Typewriter-Regular.woff2 differ diff --git a/fonts/fira-mono-v14-latin-500.woff2 b/fonts/fira-mono-v14-latin-500.woff2 new file mode 100644 index 00000000..9d07a635 Binary files /dev/null and b/fonts/fira-mono-v14-latin-500.woff2 differ diff --git a/fonts/fira-mono-v14-latin-regular.woff2 b/fonts/fira-mono-v14-latin-regular.woff2 new file mode 100644 index 00000000..edc71a86 Binary files /dev/null and b/fonts/fira-mono-v14-latin-regular.woff2 differ diff --git a/fonts/fira-sans-v17-latin-500.woff2 b/fonts/fira-sans-v17-latin-500.woff2 new file mode 100644 index 00000000..24bb8f45 Binary files /dev/null and b/fonts/fira-sans-v17-latin-500.woff2 differ diff --git a/fonts/fira-sans-v17-latin-500italic.woff2 b/fonts/fira-sans-v17-latin-500italic.woff2 new file mode 100644 index 00000000..1a8b72dc Binary files /dev/null and b/fonts/fira-sans-v17-latin-500italic.woff2 differ diff --git a/fonts/fira-sans-v17-latin-700.woff2 b/fonts/fira-sans-v17-latin-700.woff2 new file mode 100644 index 00000000..40b8a1cf Binary files /dev/null and b/fonts/fira-sans-v17-latin-700.woff2 differ diff --git a/fonts/fira-sans-v17-latin-700italic.woff2 b/fonts/fira-sans-v17-latin-700italic.woff2 new file mode 100644 index 00000000..bdf8f5f9 Binary files /dev/null and b/fonts/fira-sans-v17-latin-700italic.woff2 differ diff --git a/fonts/fira-sans-v17-latin-italic.woff2 b/fonts/fira-sans-v17-latin-italic.woff2 new file mode 100644 index 00000000..b9619dd5 Binary files /dev/null and b/fonts/fira-sans-v17-latin-italic.woff2 differ diff --git a/fonts/fira-sans-v17-latin-regular.woff2 b/fonts/fira-sans-v17-latin-regular.woff2 new file mode 100644 index 00000000..d31eba84 Binary files /dev/null and b/fonts/fira-sans-v17-latin-regular.woff2 differ diff --git a/fonts/noticia-text-v15-latin-700.woff2 b/fonts/noticia-text-v15-latin-700.woff2 new file mode 100644 index 00000000..536fbe1d Binary files /dev/null and b/fonts/noticia-text-v15-latin-700.woff2 differ diff --git a/fonts/noticia-text-v15-latin-italic.woff2 b/fonts/noticia-text-v15-latin-italic.woff2 new file mode 100644 index 00000000..9b83b071 Binary files /dev/null and b/fonts/noticia-text-v15-latin-italic.woff2 differ diff --git a/fonts/noticia-text-v15-latin-regular.woff2 b/fonts/noticia-text-v15-latin-regular.woff2 new file mode 100644 index 00000000..efff29f9 Binary files /dev/null and b/fonts/noticia-text-v15-latin-regular.woff2 differ diff --git a/highlight.pack.js b/highlight.pack.js new file mode 100644 index 00000000..7d1bcd04 --- /dev/null +++ b/highlight.pack.js @@ -0,0 +1,634 @@ +/*! + Highlight.js v11.7.0 (git: 82688fad18) + (c) 2006-2022 undefined and other contributors + License: BSD-3-Clause + */ +var hljs=function(){"use strict";var e={exports:{}};function t(e){ +return e instanceof Map?e.clear=e.delete=e.set=()=>{ +throw Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=()=>{ +throw Error("set is read-only") +}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((n=>{var i=e[n] +;"object"!=typeof i||Object.isFrozen(i)||t(i)})),e} +e.exports=t,e.exports.default=t;class n{constructor(e){ +void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1} +ignoreMatch(){this.isMatchIgnored=!0}}function i(e){ +return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'") +}function r(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t] +;return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n} +const s=e=>!!e.scope||e.sublanguage&&e.language;class o{constructor(e,t){ +this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){ +this.buffer+=i(e)}openNode(e){if(!s(e))return;let t="" +;t=e.sublanguage?"language-"+e.language:((e,{prefix:t})=>{if(e.includes(".")){ +const n=e.split(".") +;return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ") +}return`${t}${e}`})(e.scope,{prefix:this.classPrefix}),this.span(t)} +closeNode(e){s(e)&&(this.buffer+="")}value(){return this.buffer}span(e){ +this.buffer+=``}}const a=(e={})=>{const t={children:[]} +;return Object.assign(t,e),t};class c{constructor(){ +this.rootNode=a(),this.stack=[this.rootNode]}get top(){ +return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){ +this.top.children.push(e)}openNode(e){const t=a({scope:e}) +;this.add(t),this.stack.push(t)}closeNode(){ +if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ +for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)} +walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){ +return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t), +t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){ +"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{ +c._collapse(e)})))}}class l extends c{constructor(e){super(),this.options=e} +addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())} +addText(e){""!==e&&this.add(e)}addSublanguage(e,t){const n=e.root +;n.sublanguage=!0,n.language=t,this.add(n)}toHTML(){ +return new o(this,this.options).value()}finalize(){return!0}}function g(e){ +return e?"string"==typeof e?e:e.source:null}function d(e){return p("(?=",e,")")} +function u(e){return p("(?:",e,")*")}function h(e){return p("(?:",e,")?")} +function p(...e){return e.map((e=>g(e))).join("")}function f(...e){const t=(e=>{ +const t=e[e.length-1] +;return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{} +})(e);return"("+(t.capture?"":"?:")+e.map((e=>g(e))).join("|")+")"} +function b(e){return RegExp(e.toString()+"|").exec("").length-1} +const m=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./ +;function E(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n +;let i=g(e),r="";for(;i.length>0;){const e=m.exec(i);if(!e){r+=i;break} +r+=i.substring(0,e.index), +i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?r+="\\"+(Number(e[1])+t):(r+=e[0], +"("===e[0]&&n++)}return r})).map((e=>`(${e})`)).join(t)} +const x="[a-zA-Z]\\w*",w="[a-zA-Z_]\\w*",y="\\b\\d+(\\.\\d+)?",_="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",O="\\b(0b[01]+)",v={ +begin:"\\\\[\\s\\S]",relevance:0},N={scope:"string",begin:"'",end:"'", +illegal:"\\n",contains:[v]},k={scope:"string",begin:'"',end:'"',illegal:"\\n", +contains:[v]},M=(e,t,n={})=>{const i=r({scope:"comment",begin:e,end:t, +contains:[]},n);i.contains.push({scope:"doctag", +begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", +end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0}) +;const s=f("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/) +;return i.contains.push({begin:p(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i +},S=M("//","$"),R=M("/\\*","\\*/"),j=M("#","$");var A=Object.freeze({ +__proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:x,UNDERSCORE_IDENT_RE:w, +NUMBER_RE:y,C_NUMBER_RE:_,BINARY_NUMBER_RE:O, +RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", +SHEBANG:(e={})=>{const t=/^#![ ]*\// +;return e.binary&&(e.begin=p(t,/.*\b/,e.binary,/\b.*/)),r({scope:"meta",begin:t, +end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)}, +BACKSLASH_ESCAPE:v,APOS_STRING_MODE:N,QUOTE_STRING_MODE:k,PHRASAL_WORDS_MODE:{ +begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ +},COMMENT:M,C_LINE_COMMENT_MODE:S,C_BLOCK_COMMENT_MODE:R,HASH_COMMENT_MODE:j, +NUMBER_MODE:{scope:"number",begin:y,relevance:0},C_NUMBER_MODE:{scope:"number", +begin:_,relevance:0},BINARY_NUMBER_MODE:{scope:"number",begin:O,relevance:0}, +REGEXP_MODE:{begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//, +end:/\/[gimuy]*/,illegal:/\n/,contains:[v,{begin:/\[/,end:/\]/,relevance:0, +contains:[v]}]}]},TITLE_MODE:{scope:"title",begin:x,relevance:0}, +UNDERSCORE_TITLE_MODE:{scope:"title",begin:w,relevance:0},METHOD_GUARD:{ +begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},END_SAME_AS_BEGIN:e=>Object.assign(e,{ +"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{ +t.data._beginMatch!==e[1]&&t.ignoreMatch()}})});function I(e,t){ +"."===e.input[e.index-1]&&t.ignoreMatch()}function T(e,t){ +void 0!==e.className&&(e.scope=e.className,delete e.className)}function L(e,t){ +t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)", +e.__beforeBegin=I,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords, +void 0===e.relevance&&(e.relevance=0))}function B(e,t){ +Array.isArray(e.illegal)&&(e.illegal=f(...e.illegal))}function D(e,t){ +if(e.match){ +if(e.begin||e.end)throw Error("begin & end are not supported with match") +;e.begin=e.match,delete e.match}}function H(e,t){ +void 0===e.relevance&&(e.relevance=1)}const P=(e,t)=>{if(!e.beforeMatch)return +;if(e.starts)throw Error("beforeMatch cannot be used with starts") +;const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t] +})),e.keywords=n.keywords,e.begin=p(n.beforeMatch,d(n.begin)),e.starts={ +relevance:0,contains:[Object.assign(n,{endsParent:!0})] +},e.relevance=0,delete n.beforeMatch +},C=["of","and","for","in","not","or","if","then","parent","list","value"] +;function $(e,t,n="keyword"){const i=Object.create(null) +;return"string"==typeof e?r(n,e.split(" ")):Array.isArray(e)?r(n,e):Object.keys(e).forEach((n=>{ +Object.assign(i,$(e[n],t,n))})),i;function r(e,n){ +t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((t=>{const n=t.split("|") +;i[n[0]]=[e,U(n[0],n[1])]}))}}function U(e,t){ +return t?Number(t):(e=>C.includes(e.toLowerCase()))(e)?0:1}const z={},K=e=>{ +console.error(e)},W=(e,...t)=>{console.log("WARN: "+e,...t)},X=(e,t)=>{ +z[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),z[`${e}/${t}`]=!0) +},G=Error();function Z(e,t,{key:n}){let i=0;const r=e[n],s={},o={} +;for(let e=1;e<=t.length;e++)o[e+i]=r[e],s[e+i]=!0,i+=b(t[e-1]) +;e[n]=o,e[n]._emit=s,e[n]._multi=!0}function F(e){(e=>{ +e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope, +delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={ +_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope +}),(e=>{if(Array.isArray(e.begin)){ +if(e.skip||e.excludeBegin||e.returnBegin)throw K("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), +G +;if("object"!=typeof e.beginScope||null===e.beginScope)throw K("beginScope must be object"), +G;Z(e,e.begin,{key:"beginScope"}),e.begin=E(e.begin,{joinWith:""})}})(e),(e=>{ +if(Array.isArray(e.end)){ +if(e.skip||e.excludeEnd||e.returnEnd)throw K("skip, excludeEnd, returnEnd not compatible with endScope: {}"), +G +;if("object"!=typeof e.endScope||null===e.endScope)throw K("endScope must be object"), +G;Z(e,e.end,{key:"endScope"}),e.end=E(e.end,{joinWith:""})}})(e)}function V(e){ +function t(t,n){ +return RegExp(g(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":"")) +}class n{constructor(){ +this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} +addRule(e,t){ +t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]), +this.matchAt+=b(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null) +;const e=this.regexes.map((e=>e[1]));this.matcherRe=t(E(e,{joinWith:"|" +}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex +;const t=this.matcherRe.exec(e);if(!t)return null +;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),i=this.matchIndexes[n] +;return t.splice(0,n),Object.assign(t,i)}}class i{constructor(){ +this.rules=[],this.multiRegexes=[], +this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ +if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n +;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))), +t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){ +return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){ +this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){ +const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex +;let n=t.exec(e) +;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{ +const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)} +return n&&(this.regexIndex+=n.position+1, +this.regexIndex===this.count&&this.considerAll()),n}} +if(e.compilerExtensions||(e.compilerExtensions=[]), +e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") +;return e.classNameAliases=r(e.classNameAliases||{}),function n(s,o){const a=s +;if(s.isCompiled)return a +;[T,D,F,P].forEach((e=>e(s,o))),e.compilerExtensions.forEach((e=>e(s,o))), +s.__beforeBegin=null,[L,B,H].forEach((e=>e(s,o))),s.isCompiled=!0;let c=null +;return"object"==typeof s.keywords&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords), +c=s.keywords.$pattern, +delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=$(s.keywords,e.case_insensitive)), +a.keywordPatternRe=t(c,!0), +o&&(s.begin||(s.begin=/\B|\b/),a.beginRe=t(a.begin),s.end||s.endsWithParent||(s.end=/\B|\b/), +s.end&&(a.endRe=t(a.end)), +a.terminatorEnd=g(a.end)||"",s.endsWithParent&&o.terminatorEnd&&(a.terminatorEnd+=(s.end?"|":"")+o.terminatorEnd)), +s.illegal&&(a.illegalRe=t(s.illegal)), +s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>r(e,{ +variants:null},t)))),e.cachedVariants?e.cachedVariants:q(e)?r(e,{ +starts:e.starts?r(e.starts):null +}):Object.isFrozen(e)?r(e):e))("self"===e?s:e)))),s.contains.forEach((e=>{n(e,a) +})),s.starts&&n(s.starts,o),a.matcher=(e=>{const t=new i +;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin" +}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end" +}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(a),a}(e)}function q(e){ +return!!e&&(e.endsWithParent||q(e.starts))}class J extends Error{ +constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}} +const Y=i,Q=r,ee=Symbol("nomatch");var te=(t=>{ +const i=Object.create(null),r=Object.create(null),s=[];let o=!0 +;const a="Could not find the language '{}', did you forget to load/include a language module?",c={ +disableAutodetect:!0,name:"Plain text",contains:[]};let g={ +ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i, +languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-", +cssSelector:"pre code",languages:null,__emitter:l};function b(e){ +return g.noHighlightRe.test(e)}function m(e,t,n){let i="",r="" +;"object"==typeof t?(i=e, +n=t.ignoreIllegals,r=t.language):(X("10.7.0","highlight(lang, code, ...args) has been deprecated."), +X("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"), +r=e,i=t),void 0===n&&(n=!0);const s={code:i,language:r};k("before:highlight",s) +;const o=s.result?s.result:E(s.language,s.code,n) +;return o.code=s.code,k("after:highlight",o),o}function E(e,t,r,s){ +const c=Object.create(null);function l(){if(!N.keywords)return void M.addText(S) +;let e=0;N.keywordPatternRe.lastIndex=0;let t=N.keywordPatternRe.exec(S),n="" +;for(;t;){n+=S.substring(e,t.index) +;const r=y.case_insensitive?t[0].toLowerCase():t[0],s=(i=r,N.keywords[i]);if(s){ +const[e,i]=s +;if(M.addText(n),n="",c[r]=(c[r]||0)+1,c[r]<=7&&(R+=i),e.startsWith("_"))n+=t[0];else{ +const n=y.classNameAliases[e]||e;M.addKeyword(t[0],n)}}else n+=t[0] +;e=N.keywordPatternRe.lastIndex,t=N.keywordPatternRe.exec(S)}var i +;n+=S.substring(e),M.addText(n)}function d(){null!=N.subLanguage?(()=>{ +if(""===S)return;let e=null;if("string"==typeof N.subLanguage){ +if(!i[N.subLanguage])return void M.addText(S) +;e=E(N.subLanguage,S,!0,k[N.subLanguage]),k[N.subLanguage]=e._top +}else e=x(S,N.subLanguage.length?N.subLanguage:null) +;N.relevance>0&&(R+=e.relevance),M.addSublanguage(e._emitter,e.language) +})():l(),S=""}function u(e,t){let n=1;const i=t.length-1;for(;n<=i;){ +if(!e._emit[n]){n++;continue}const i=y.classNameAliases[e[n]]||e[n],r=t[n] +;i?M.addKeyword(r,i):(S=r,l(),S=""),n++}}function h(e,t){ +return e.scope&&"string"==typeof e.scope&&M.openNode(y.classNameAliases[e.scope]||e.scope), +e.beginScope&&(e.beginScope._wrap?(M.addKeyword(S,y.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap), +S=""):e.beginScope._multi&&(u(e.beginScope,t),S="")),N=Object.create(e,{parent:{ +value:N}}),N}function p(e,t,i){let r=((e,t)=>{const n=e&&e.exec(t) +;return n&&0===n.index})(e.endRe,i);if(r){if(e["on:end"]){const i=new n(e) +;e["on:end"](t,i),i.isMatchIgnored&&(r=!1)}if(r){ +for(;e.endsParent&&e.parent;)e=e.parent;return e}} +if(e.endsWithParent)return p(e.parent,t,i)}function f(e){ +return 0===N.matcher.regexIndex?(S+=e[0],1):(I=!0,0)}function b(e){ +const n=e[0],i=t.substring(e.index),r=p(N,e,i);if(!r)return ee;const s=N +;N.endScope&&N.endScope._wrap?(d(), +M.addKeyword(n,N.endScope._wrap)):N.endScope&&N.endScope._multi?(d(), +u(N.endScope,e)):s.skip?S+=n:(s.returnEnd||s.excludeEnd||(S+=n), +d(),s.excludeEnd&&(S=n));do{ +N.scope&&M.closeNode(),N.skip||N.subLanguage||(R+=N.relevance),N=N.parent +}while(N!==r.parent);return r.starts&&h(r.starts,e),s.returnEnd?0:n.length} +let m={};function w(i,s){const a=s&&s[0];if(S+=i,null==a)return d(),0 +;if("begin"===m.type&&"end"===s.type&&m.index===s.index&&""===a){ +if(S+=t.slice(s.index,s.index+1),!o){const t=Error(`0 width match regex (${e})`) +;throw t.languageName=e,t.badRule=m.rule,t}return 1} +if(m=s,"begin"===s.type)return(e=>{ +const t=e[0],i=e.rule,r=new n(i),s=[i.__beforeBegin,i["on:begin"]] +;for(const n of s)if(n&&(n(e,r),r.isMatchIgnored))return f(t) +;return i.skip?S+=t:(i.excludeBegin&&(S+=t), +d(),i.returnBegin||i.excludeBegin||(S=t)),h(i,e),i.returnBegin?0:t.length})(s) +;if("illegal"===s.type&&!r){ +const e=Error('Illegal lexeme "'+a+'" for mode "'+(N.scope||"")+'"') +;throw e.mode=N,e}if("end"===s.type){const e=b(s);if(e!==ee)return e} +if("illegal"===s.type&&""===a)return 1 +;if(A>1e5&&A>3*s.index)throw Error("potential infinite loop, way more iterations than matches") +;return S+=a,a.length}const y=O(e) +;if(!y)throw K(a.replace("{}",e)),Error('Unknown language: "'+e+'"') +;const _=V(y);let v="",N=s||_;const k={},M=new g.__emitter(g);(()=>{const e=[] +;for(let t=N;t!==y;t=t.parent)t.scope&&e.unshift(t.scope) +;e.forEach((e=>M.openNode(e)))})();let S="",R=0,j=0,A=0,I=!1;try{ +for(N.matcher.considerAll();;){ +A++,I?I=!1:N.matcher.considerAll(),N.matcher.lastIndex=j +;const e=N.matcher.exec(t);if(!e)break;const n=w(t.substring(j,e.index),e) +;j=e.index+n} +return w(t.substring(j)),M.closeAllNodes(),M.finalize(),v=M.toHTML(),{ +language:e,value:v,relevance:R,illegal:!1,_emitter:M,_top:N}}catch(n){ +if(n.message&&n.message.includes("Illegal"))return{language:e,value:Y(t), +illegal:!0,relevance:0,_illegalBy:{message:n.message,index:j, +context:t.slice(j-100,j+100),mode:n.mode,resultSoFar:v},_emitter:M};if(o)return{ +language:e,value:Y(t),illegal:!1,relevance:0,errorRaised:n,_emitter:M,_top:N} +;throw n}}function x(e,t){t=t||g.languages||Object.keys(i);const n=(e=>{ +const t={value:Y(e),illegal:!1,relevance:0,_top:c,_emitter:new g.__emitter(g)} +;return t._emitter.addText(e),t})(e),r=t.filter(O).filter(N).map((t=>E(t,e,!1))) +;r.unshift(n);const s=r.sort(((e,t)=>{ +if(e.relevance!==t.relevance)return t.relevance-e.relevance +;if(e.language&&t.language){if(O(e.language).supersetOf===t.language)return 1 +;if(O(t.language).supersetOf===e.language)return-1}return 0})),[o,a]=s,l=o +;return l.secondBest=a,l}function w(e){let t=null;const n=(e=>{ +let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"" +;const n=g.languageDetectRe.exec(t);if(n){const t=O(n[1]) +;return t||(W(a.replace("{}",n[1])), +W("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"} +return t.split(/\s+/).find((e=>b(e)||O(e)))})(e);if(b(n))return +;if(k("before:highlightElement",{el:e,language:n +}),e.children.length>0&&(g.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), +console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), +console.warn("The element with unescaped HTML:"), +console.warn(e)),g.throwUnescapedHTML))throw new J("One of your code blocks includes unescaped HTML.",e.innerHTML) +;t=e;const i=t.textContent,s=n?m(i,{language:n,ignoreIllegals:!0}):x(i) +;e.innerHTML=s.value,((e,t,n)=>{const i=t&&r[t]||n +;e.classList.add("hljs"),e.classList.add("language-"+i) +})(e,n,s.language),e.result={language:s.language,re:s.relevance, +relevance:s.relevance},s.secondBest&&(e.secondBest={ +language:s.secondBest.language,relevance:s.secondBest.relevance +}),k("after:highlightElement",{el:e,result:s,text:i})}let y=!1;function _(){ +"loading"!==document.readyState?document.querySelectorAll(g.cssSelector).forEach(w):y=!0 +}function O(e){return e=(e||"").toLowerCase(),i[e]||i[r[e]]} +function v(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{ +r[e.toLowerCase()]=t}))}function N(e){const t=O(e) +;return t&&!t.disableAutodetect}function k(e,t){const n=e;s.forEach((e=>{ +e[n]&&e[n](t)}))} +"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{ +y&&_()}),!1),Object.assign(t,{highlight:m,highlightAuto:x,highlightAll:_, +highlightElement:w, +highlightBlock:e=>(X("10.7.0","highlightBlock will be removed entirely in v12.0"), +X("10.7.0","Please use highlightElement now."),w(e)),configure:e=>{g=Q(g,e)}, +initHighlighting:()=>{ +_(),X("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")}, +initHighlightingOnLoad:()=>{ +_(),X("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.") +},registerLanguage:(e,n)=>{let r=null;try{r=n(t)}catch(t){ +if(K("Language definition for '{}' could not be registered.".replace("{}",e)), +!o)throw t;K(t),r=c} +r.name||(r.name=e),i[e]=r,r.rawDefinition=n.bind(null,t),r.aliases&&v(r.aliases,{ +languageName:e})},unregisterLanguage:e=>{delete i[e] +;for(const t of Object.keys(r))r[t]===e&&delete r[t]}, +listLanguages:()=>Object.keys(i),getLanguage:O,registerAliases:v, +autoDetection:N,inherit:Q,addPlugin:e=>{(e=>{ +e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{ +e["before:highlightBlock"](Object.assign({block:t.el},t)) +}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{ +e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),s.push(e)} +}),t.debugMode=()=>{o=!1},t.safeMode=()=>{o=!0 +},t.versionString="11.7.0",t.regex={concat:p,lookahead:d,either:f,optional:h, +anyNumberOfTimes:u};for(const t in A)"object"==typeof A[t]&&e.exports(A[t]) +;return Object.assign(t,A),t})({});return te}() +;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);/*! `reasonml` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{ +const n="~?[a-z$_][0-9a-zA-Z$_]*",a="`?[A-Z$_][0-9a-zA-Z$_]*",s="("+["||","++","**","+.","*","/","*.","/.","..."].map((e=>e.split("").map((e=>"\\"+e)).join(""))).join("|")+"|\\|>|&&|==|===)",i="\\s+"+s+"\\s+",r={ +keyword:"and as asr assert begin class constraint do done downto else end exception external for fun function functor if in include inherit initializer land lazy let lor lsl lsr lxor match method mod module mutable new nonrec object of open or private rec sig struct then to try type val virtual when while with", +built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ", +literal:"true false" +},l="\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",t={ +className:"number",relevance:0,variants:[{begin:l},{begin:"\\(-"+l+"\\)"}]},c={ +className:"operator",relevance:0,begin:s},o=[{className:"identifier", +relevance:0,begin:n},c,t],g=[e.QUOTE_STRING_MODE,c,{className:"module", +begin:"\\b"+a,returnBegin:!0,relevance:0,end:".",contains:[{ +className:"identifier",begin:a,relevance:0}]}],b=[{className:"module", +begin:"\\b"+a,returnBegin:!0,end:".",relevance:0,contains:[{ +className:"identifier",begin:a,relevance:0}]}],m={className:"function", +relevance:0,keywords:r,variants:[{begin:"\\s(\\(\\.?.*?\\)|"+n+")\\s*=>", +end:"\\s*=>",returnBegin:!0,relevance:0,contains:[{className:"params", +variants:[{begin:n},{ +begin:"~?[a-z$_][0-9a-zA-Z$_]*(\\s*:\\s*[a-z$_][0-9a-z$_]*(\\(\\s*('?[a-z$_][0-9a-z$_]*\\s*(,'?[a-z$_][0-9a-z$_]*\\s*)*)?\\))?){0,2}" +},{begin:/\(\s*\)/}]}]},{begin:"\\s\\(\\.?[^;\\|]*\\)\\s*=>",end:"\\s=>", +returnBegin:!0,relevance:0,contains:[{className:"params",relevance:0,variants:[{ +begin:n,end:"(,|\\n|\\))",relevance:0,contains:[c,{className:"typing",begin:":", +end:"(,|\\n)",returnBegin:!0,relevance:0,contains:b}]}]}]},{ +begin:"\\(\\.\\s"+n+"\\)\\s*=>"}]};g.push(m);const d={className:"constructor", +begin:a+"\\(",end:"\\)",illegal:"\\n",keywords:r, +contains:[e.QUOTE_STRING_MODE,c,{className:"params",begin:"\\b"+n}]},u={ +className:"pattern-match",begin:"\\|",returnBegin:!0,keywords:r,end:"=>", +relevance:0,contains:[d,c,{relevance:0,className:"constructor",begin:a}]},v={ +className:"module-access",keywords:r,returnBegin:!0,variants:[{ +begin:"\\b("+a+"\\.)+"+n},{begin:"\\b("+a+"\\.)+\\(",end:"\\)",returnBegin:!0, +contains:[m,{begin:"\\(",end:"\\)",relevance:0,skip:!0}].concat(g)},{ +begin:"\\b("+a+"\\.)+\\{",end:/\}/}],contains:g};return b.push(v),{ +name:"ReasonML",aliases:["re"],keywords:r,illegal:"(:-|:=|\\$\\{|\\+=)", +contains:[e.COMMENT("/\\*","\\*/",{illegal:"^(#,\\/\\/)"}),{ +className:"character",begin:"'(\\\\[^']+|[^'])'",illegal:"\\n",relevance:0 +},e.QUOTE_STRING_MODE,{className:"literal",begin:"\\(\\)",relevance:0},{ +className:"literal",begin:"\\[\\|",end:"\\|\\]",relevance:0,contains:o},{ +className:"literal",begin:"\\[",end:"\\]",relevance:0,contains:o},d,{ +className:"operator",begin:i,illegal:"--\x3e",relevance:0 +},t,e.C_LINE_COMMENT_MODE,u,m,{className:"module-def", +begin:"\\bmodule\\s+"+n+"\\s+"+a+"\\s+=\\s+\\{",end:/\}/,returnBegin:!0, +keywords:r,relevance:0,contains:[{className:"module",relevance:0,begin:a},{ +begin:/\{/,end:/\}/,relevance:0,skip:!0}].concat(g)},v]}}})() +;hljs.registerLanguage("reasonml",e)})();/*! `javascript` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict" +;const e="[A-Za-z$_][0-9A-Za-z$_]*",n=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],a=["true","false","null","undefined","NaN","Infinity"],t=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],s=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],r=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],c=["arguments","this","super","console","window","document","localStorage","module","global"],i=[].concat(r,t,s) +;return o=>{const l=o.regex,b=e,d={begin:/<[A-Za-z0-9\\._:-]+/, +end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{ +const a=e[0].length+e.index,t=e.input[a] +;if("<"===t||","===t)return void n.ignoreMatch();let s +;">"===t&&(((e,{after:n})=>{const a="",M={ +match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,l.lookahead(C)], +keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]} +;return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:g,exports:{ +PARAMS_CONTAINS:p,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/, +contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),{ +label:"use_strict",className:"meta",relevance:10, +begin:/^\s*['"]use (strict|asm)['"]/ +},o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,y,N,_,h,{match:/\$\d+/},E,R,{ +className:"attr",begin:b+l.lookahead(":"),relevance:0},M,{ +begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", +keywords:"return throw case",relevance:0,contains:[h,o.REGEXP_MODE,{ +className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{ +className:"params",variants:[{begin:o.UNDERSCORE_IDENT_RE,relevance:0},{ +className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0, +excludeEnd:!0,keywords:g,contains:p}]}]},{begin:/,/,relevance:0},{match:/\s+/, +relevance:0},{variants:[{begin:"<>",end:""},{ +match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:d.begin, +"on:begin":d.isTrulyOpeningTag,end:d.end}],subLanguage:"xml",contains:[{ +begin:d.begin,end:d.end,skip:!0,contains:["self"]}]}]},O,{ +beginKeywords:"while if switch catch for"},{ +begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", +returnBegin:!0,label:"func.def",contains:[S,o.inherit(o.TITLE_MODE,{begin:b, +className:"title.function"})]},{match:/\.\.\./,relevance:0},x,{match:"\\$"+b, +relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"}, +contains:[S]},k,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, +className:"variable.constant"},w,T,{match:/\$[(.]/}]}}})() +;hljs.registerLanguage("javascript",e)})();/*! `sql` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{ +const r=e.regex,t=e.COMMENT("--","$"),n=["true","false","unknown"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],i=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],s=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],o=i,c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter((e=>!i.includes(e))),l={ +begin:r.concat(/\b/,r.either(...o),/\s*\(/),relevance:0,keywords:{built_in:o}} +;return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{ +$pattern:/\b[\w\.]+/,keyword:((e,{exceptions:r,when:t}={})=>{const n=t +;return r=r||[],e.map((e=>e.match(/\|\d+$/)||r.includes(e)?e:n(e)?e+"|0":e)) +})(c,{when:e=>e.length<3}),literal:n,type:a, +built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"] +},contains:[{begin:r.either(...s),relevance:0,keywords:{$pattern:/[\w\.]+/, +keyword:c.concat(s),literal:n,type:a}},{className:"type", +begin:r.either("double precision","large object","with timezone","without timezone") +},l,{className:"variable",begin:/@[a-z0-9]+/},{className:"string",variants:[{ +begin:/'/,end:/'/,contains:[{begin:/''/}]}]},{begin:/"/,end:/"/,contains:[{ +begin:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,t,{className:"operator", +begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}}})() +;hljs.registerLanguage("sql",e)})();/*! `bash` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{const s=e.regex,t={},n={begin:/\$\{/, +end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{ +className:"variable",variants:[{ +begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});const a={ +className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i={ +begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/, +end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/, +contains:[e.BACKSLASH_ESCAPE,t,a]};a.contains.push(c);const o={begin:/\$?\(\(/, +end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t] +},r=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10 +}),l={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0, +contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{ +name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/, +keyword:["if","then","else","elif","fi","for","while","in","do","done","case","esac","function"], +literal:["true","false"], +built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"] +},contains:[r,e.SHEBANG(),l,o,e.HASH_COMMENT_MODE,i,{match:/(\/[a-z._-]+)+/},c,{ +className:"",begin:/\\"/},{className:"string",begin:/'/,end:/'/},t]}}})() +;hljs.registerLanguage("bash",e)})();/*! `shell` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var s=(()=>{"use strict";return s=>({name:"Shell Session", +aliases:["console","shellsession"],contains:[{className:"meta.prompt", +begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/, +subLanguage:"bash"}}]})})();hljs.registerLanguage("shell",s)})();/*! `plaintext` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var t=(()=>{"use strict";return t=>({name:"Plain text", +aliases:["text","txt"],disableAutodetect:!0})})() +;hljs.registerLanguage("plaintext",t)})();/*! `graphql` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{const a=e.regex;return{name:"GraphQL", +aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{ +keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"], +literal:["true","false","null"]}, +contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{ +scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation", +begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/, +end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{ +scope:"symbol",begin:a.concat(/[_A-Za-z][_0-9A-Za-z]*/,a.lookahead(/\s*:/)), +relevance:0}],illegal:[/[;<']/,/BEGIN/]}}})();hljs.registerLanguage("graphql",e) +})();/*! `ocaml` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>({name:"OCaml",aliases:["ml"], +keywords:{$pattern:"[a-z_]\\w*!?", +keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value", +built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref", +literal:"true false"},illegal:/\/\/|>>/,contains:[{className:"literal", +begin:"\\[(\\|\\|)?\\]|\\(\\)",relevance:0},e.COMMENT("\\(\\*","\\*\\)",{ +contains:["self"]}),{className:"symbol",begin:"'[A-Za-z_](?!')[\\w']*"},{ +className:"type",begin:"`[A-Z][\\w']*"},{className:"type", +begin:"\\b[A-Z][\\w']*",relevance:0},{begin:"[a-z_]\\w*'[\\w']*",relevance:0 +},e.inherit(e.APOS_STRING_MODE,{className:"string",relevance:0 +}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"number", +begin:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)", +relevance:0},{begin:/->/}]})})();hljs.registerLanguage("ocaml",e)})();/*! `json` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{const a=["true","false","null"],n={ +scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",keywords:{ +literal:a},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/, +relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0 +},e.QUOTE_STRING_MODE,n,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE], +illegal:"\\S"}}})();hljs.registerLanguage("json",e)})();/*! `python` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{ +const n=e.regex,a=/[\p{XID_Start}_]\p{XID_Continue}*/u,i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],s={ +$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i, +built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"], +literal:["__debug__","Ellipsis","False","None","NotImplemented","True"], +type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"] +},t={className:"meta",begin:/^(>>>|\.\.\.) /},r={className:"subst",begin:/\{/, +end:/\}/,keywords:s,illegal:/#/},l={begin:/\{\{/,relevance:0},b={ +className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{ +begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/, +contains:[e.BACKSLASH_ESCAPE,t],relevance:10},{ +begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/, +contains:[e.BACKSLASH_ESCAPE,t],relevance:10},{ +begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/, +contains:[e.BACKSLASH_ESCAPE,t,l,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/, +end:/"""/,contains:[e.BACKSLASH_ESCAPE,t,l,r]},{begin:/([uU]|[rR])'/,end:/'/, +relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{ +begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/, +end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/, +contains:[e.BACKSLASH_ESCAPE,l,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/, +contains:[e.BACKSLASH_ESCAPE,l,r]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] +},o="[0-9](_?[0-9])*",c=`(\\b(${o}))?\\.(${o})|\\b(${o})\\.`,d="\\b|"+i.join("|"),g={ +className:"number",relevance:0,variants:[{ +begin:`(\\b(${o})|(${c}))[eE][+-]?(${o})[jJ]?(?=${d})`},{begin:`(${c})[jJ]?`},{ +begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{ +begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})` +},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${o})[jJ](?=${d})` +}]},p={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:s, +contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={ +className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/, +end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s, +contains:["self",t,g,b,e.HASH_COMMENT_MODE]}]};return r.contains=[b,g,t],{ +name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:s, +illegal:/(<\/|->|\?)|=>/,contains:[t,g,{begin:/\bself\b/},{beginKeywords:"if", +relevance:0},b,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,a],scope:{ +1:"keyword",3:"title.function"},contains:[m]},{variants:[{ +match:[/\bclass/,/\s+/,a,/\s*/,/\(\s*/,a,/\s*\)/]},{match:[/\bclass/,/\s+/,a]}], +scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{ +className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,m,b]}]}}})() +;hljs.registerLanguage("python",e)})();/*! `xml` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{ +const a=e.regex,n=a.concat(/[\p{L}_]/u,a.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s={ +className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},t={begin:/\s/, +contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}] +},i=e.inherit(t,{begin:/\(/,end:/\)/}),c=e.inherit(e.APOS_STRING_MODE,{ +className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),r={ +endsWithParent:!0,illegal:/`]+/}]}]}]};return{ +name:"HTML, XML", +aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"], +case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[t,l,c,i,{begin:/\[/,end:/\]/,contains:[{ +className:"meta",begin://,contains:[t,i,l,c]}]}] +},e.COMMENT(//,{relevance:10}),{begin://, +relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/, +relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag", +begin:/)/,end:/>/,keywords:{name:"style"},contains:[r],starts:{ +end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag", +begin:/)/,end:/>/,keywords:{name:"script"},contains:[r],starts:{ +end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{ +className:"tag",begin:/<>|<\/>/},{className:"tag", +begin:a.concat(//,/>/,/\s/)))), +end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:r}]},{ +className:"tag",begin:a.concat(/<\//,a.lookahead(a.concat(n,/>/))),contains:[{ +className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}} +})();hljs.registerLanguage("xml",e)})();/*! `markdown` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{const n={begin:/<\/?[A-Za-z_]/, +end:">",subLanguage:"xml",relevance:0},a={variants:[{begin:/\[.+?\]\[.*?\]/, +relevance:0},{ +begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/, +relevance:2},{ +begin:e.regex.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/), +relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{ +begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/ +},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0, +returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)", +excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[", +end:"\\]",excludeBegin:!0,excludeEnd:!0}]},i={className:"strong",contains:[], +variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}] +},s={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{ +begin:/_(?![_\s])/,end:/_/,relevance:0}]},c=e.inherit(i,{contains:[] +}),t=e.inherit(s,{contains:[]});i.contains.push(t),s.contains.push(c) +;let g=[n,a];return[i,s,c,t].forEach((e=>{e.contains=e.contains.concat(g) +})),g=g.concat(i,s),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{ +className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:g},{ +begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n", +contains:g}]}]},n,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)", +end:"\\s+",excludeEnd:!0},i,s,{className:"quote",begin:"^>\\s+",contains:g, +end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{ +begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{ +begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))", +contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{ +begin:"^[-\\*]{3,}",end:"$"},a,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{ +className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{ +className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}}})() +;hljs.registerLanguage("markdown",e)})();/*! `c` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{const n=e.regex,t=e.COMMENT("//","$",{ +contains:[{begin:/\\\n/}] +}),s="[a-zA-Z_]\\w*::",a="(decltype\\(auto\\)|"+n.optional(s)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",r={ +className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{ +match:/\batomic_[a-z]{3,6}\b/}]},i={className:"string",variants:[{ +begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{ +begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", +end:"'",illegal:"."},e.END_SAME_AS_BEGIN({ +begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={ +className:"number",variants:[{begin:"\\b(0b[01']+)"},{ +begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" +},{ +begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" +}],relevance:0},o={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ +keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" +},contains:[{begin:/\\\n/,relevance:0},e.inherit(i,{className:"string"}),{ +className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},c={ +className:"title",begin:n.optional(s)+e.IDENT_RE,relevance:0 +},d=n.optional(s)+e.IDENT_RE+"\\s*\\(",u={ +keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"], +type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"], +literal:"true false NULL", +built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr" +},g=[o,r,t,e.C_BLOCK_COMMENT_MODE,l,i],m={variants:[{begin:/=/,end:/;/},{ +begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}], +keywords:u,contains:g.concat([{begin:/\(/,end:/\)/,keywords:u, +contains:g.concat(["self"]),relevance:0}]),relevance:0},p={ +begin:"("+a+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, +keywords:u,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)", +keywords:u,relevance:0},{begin:d,returnBegin:!0,contains:[e.inherit(c,{ +className:"title.function"})],relevance:0},{relevance:0,match:/,/},{ +className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0, +contains:[t,e.C_BLOCK_COMMENT_MODE,i,l,r,{begin:/\(/,end:/\)/,keywords:u, +relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,i,l,r]}] +},r,t,e.C_BLOCK_COMMENT_MODE,o]};return{name:"C",aliases:["h"],keywords:u, +disableAutodetect:!0,illegal:"=]/,contains:[{ +beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:o, +strings:i,keywords:u}}}})();hljs.registerLanguage("c",e)})(); diff --git a/index.html b/index.html new file mode 100644 index 00000000..b027a7a3 --- /dev/null +++ b/index.html @@ -0,0 +1,2 @@ + +_opam

OCaml package documentation

Browse by name, by tag, the standard library and the OCaml manual (online, latest version).

Generated for /home/runner/work/tiny_httpd/tiny_httpd/_opam/lib

Packages by name

Packages by tag

\ No newline at end of file diff --git a/katex.min.css b/katex.min.css new file mode 100644 index 00000000..5f1f8576 --- /dev/null +++ b/katex.min.css @@ -0,0 +1 @@ +@font-face{font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(fonts/KaTeX_AMS-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Main-Bold.woff2) format("woff2")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(fonts/KaTeX_Main-Italic.woff2) format("woff2")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Main-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(fonts/KaTeX_Math-Italic.woff2) format("woff2")}@font-face{font-family:"KaTeX_SansSerif";font-style:normal;font-weight:700;src:url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2")}@font-face{font-family:"KaTeX_SansSerif";font-style:italic;font-weight:400;src:url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2")}@font-face{font-family:"KaTeX_SansSerif";font-style:normal;font-weight:400;src:url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Script-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size1-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size2-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size3-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size4-Regular.woff2) format("woff2")}@font-face{font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2")}.katex{text-rendering:auto;font:normal 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.15.2"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.83333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.85714286em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857143em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96285714em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55428571em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.66666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.77777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.88888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.58333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.66666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.41666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.48611111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.55555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44027778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.28935185em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.34722222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.40509259em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.46296296em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.52083333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023148em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981481em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108004em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.28929605em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.33751205em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.38572806em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.43394407em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216008em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57859209em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69431051em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.83317261em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961427em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.20096463em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.24115756em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.28135048em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.32154341em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.36173633em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.40192926em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.48231511em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.57877814em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.69453376em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.83360129em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo} diff --git a/katex.min.js b/katex.min.js new file mode 100644 index 00000000..e4d78f24 --- /dev/null +++ b/katex.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.katex=t():e.katex=t()}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return Zn}});var r=function e(t,r){this.position=void 0;var n,a="KaTeX parse error: "+t,i=r&&r.loc;if(i&&i.start<=i.end){var o=i.lexer.input;n=i.start;var s=i.end;n===o.length?a+=" at end of input: ":a+=" at position "+(n+1)+": ";var l=o.slice(n,s).replace(/[^]/g,"$&\u0332");a+=(n>15?"\u2026"+o.slice(n-15,n):o.slice(0,n))+l+(s+15":">","<":"<",'"':""","'":"'"},o=/[&><"']/g;var s=function e(t){return"ordgroup"===t.type||"color"===t.type?1===t.body.length?e(t.body[0]):t:"font"===t.type?e(t.body):t},l={contains:function(e,t){return-1!==e.indexOf(t)},deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(o,(function(e){return i[e]}))},hyphenate:function(e){return e.replace(a,"-$1").toLowerCase()},getBaseElem:s,isCharacterBox:function(e){var t=s(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){var t=/^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(e);return null!=t?t[1]:"_relative"}},h={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:function(e){return"#"+e}},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:function(e,t){return t.push(e),t}},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:function(e){return Math.max(0,e)},cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:function(e){return Math.max(0,e)},cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:function(e){return Math.max(0,e)},cli:"-e, --max-expand ",cliProcessor:function(e){return"Infinity"===e?1/0:parseInt(e)}},globalGroup:{type:"boolean",cli:!1}};function m(e){if(e.default)return e.default;var t=e.type,r=Array.isArray(t)?t[0]:t;if("string"!=typeof r)return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}var c=function(){function e(e){for(var t in this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},h)if(h.hasOwnProperty(t)){var r=h[t];this[t]=void 0!==e[t]?r.processor?r.processor(e[t]):e[t]:m(r)}}var t=e.prototype;return t.reportNonstrict=function(e,t,r){var a=this.strict;if("function"==typeof a&&(a=a(e,t,r)),a&&"ignore"!==a){if(!0===a||"error"===a)throw new n("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",r);"warn"===a?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+a+"': "+t+" ["+e+"]")}},t.useStrictBehavior=function(e,t,r){var n=this.strict;if("function"==typeof n)try{n=n(e,t,r)}catch(e){n="error"}return!(!n||"ignore"===n)&&(!0===n||"error"===n||("warn"===n?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+n+"': "+t+" ["+e+"]"),!1)))},t.isTrusted=function(e){e.url&&!e.protocol&&(e.protocol=l.protocolFromUrl(e.url));var t="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(t)},e}(),u=function(){function e(e,t,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=r}var t=e.prototype;return t.sup=function(){return p[d[this.id]]},t.sub=function(){return p[f[this.id]]},t.fracNum=function(){return p[g[this.id]]},t.fracDen=function(){return p[v[this.id]]},t.cramp=function(){return p[b[this.id]]},t.text=function(){return p[y[this.id]]},t.isTight=function(){return this.size>=2},e}(),p=[new u(0,0,!1),new u(1,0,!0),new u(2,1,!1),new u(3,1,!0),new u(4,2,!1),new u(5,2,!0),new u(6,3,!1),new u(7,3,!0)],d=[4,5,4,5,6,7,6,7],f=[5,5,5,5,7,7,7,7],g=[2,3,4,5,6,7,6,7],v=[3,3,5,5,7,7,7,7],b=[1,1,3,3,5,5,7,7],y=[0,1,2,3,2,3,2,3],x={DISPLAY:p[0],TEXT:p[2],SCRIPT:p[4],SCRIPTSCRIPT:p[6]},w=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var k=[];function S(e){for(var t=0;t=k[t]&&e<=k[t+1])return!0;return!1}w.forEach((function(e){return e.blocks.forEach((function(e){return k.push.apply(k,e)}))}));var M=80,z={doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"},A=function(){function e(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}var t=e.prototype;return t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){for(var e=document.createDocumentFragment(),t=0;t=5?0:e>=3?1:2]){var r=N[t]={cssEmPerMu:B.quad[t]/18};for(var n in B)B.hasOwnProperty(n)&&(r[n]=B[n][t])}return N[t]}(this.size)),this._fontMetrics},t.getColor=function(){return this.phantom?"transparent":this.color},e}();H.BASESIZE=6;var E=H,L={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},D={ex:!0,em:!0,mu:!0},P=function(e){return"string"!=typeof e&&(e=e.unit),e in L||e in D||"ex"===e},F=function(e,t){var r;if(e.unit in L)r=L[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if("mu"===e.unit)r=t.fontMetrics().cssEmPerMu;else{var a;if(a=t.style.isTight()?t.havingStyle(t.style.text()):t,"ex"===e.unit)r=a.fontMetrics().xHeight;else{if("em"!==e.unit)throw new n("Invalid unit: '"+e.unit+"'");r=a.fontMetrics().quad}a!==t&&(r*=a.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*r,t.maxSize)},V=function(e){return+e.toFixed(4)+"em"},G=function(e){return e.filter((function(e){return e})).join(" ")},U=function(e,t,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},t){t.style.isTight()&&this.classes.push("mtight");var n=t.getColor();n&&(this.style.color=n)}},Y=function(e){var t=document.createElement(e);for(var r in t.className=G(this.classes),this.style)this.style.hasOwnProperty(r)&&(t.style[r]=this.style[r]);for(var n in this.attributes)this.attributes.hasOwnProperty(n)&&t.setAttribute(n,this.attributes[n]);for(var a=0;a"},W=function(){function e(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,U.call(this,e,r,n),this.children=t||[]}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){return Y.call(this,"span")},t.toMarkup=function(){return X.call(this,"span")},e}(),_=function(){function e(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,U.call(this,t,n),this.children=r||[],this.setAttribute("href",e)}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){return Y.call(this,"a")},t.toMarkup=function(){return X.call(this,"a")},e}(),j=function(){function e(e,t,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=r}var t=e.prototype;return t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){var e=document.createElement("img");for(var t in e.src=this.src,e.alt=this.alt,e.className="mord",this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e},t.toMarkup=function(){var e=""+this.alt+"=a[0]&&e<=a[1])return r.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[\xee\xef\xed\xec]/.test(this.text)&&(this.text=$[this.text])}var t=e.prototype;return t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){var e=document.createTextNode(this.text),t=null;for(var r in this.italic>0&&((t=document.createElement("span")).style.marginRight=V(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=G(this.classes)),this.style)this.style.hasOwnProperty(r)&&((t=t||document.createElement("span")).style[r]=this.style[r]);return t?(t.appendChild(e),t):e},t.toMarkup=function(){var e=!1,t="0&&(r+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(n)&&(r+=l.hyphenate(n)+":"+this.style[n]+";");r&&(e=!0,t+=' style="'+l.escape(r)+'"');var a=l.escape(this.text);return e?(t+=">",t+=a,t+="
"):a},e}(),K=function(){function e(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}var t=e.prototype;return t.toNode=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);for(var r=0;r":""},e}(),Q=function(){function e(e){this.attributes=void 0,this.attributes=e||{}}var t=e.prototype;return t.toNode=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e},t.toMarkup=function(){var e="","\\gt",!0),ie(oe,le,be,"\u2208","\\in",!0),ie(oe,le,be,"\ue020","\\@not"),ie(oe,le,be,"\u2282","\\subset",!0),ie(oe,le,be,"\u2283","\\supset",!0),ie(oe,le,be,"\u2286","\\subseteq",!0),ie(oe,le,be,"\u2287","\\supseteq",!0),ie(oe,he,be,"\u2288","\\nsubseteq",!0),ie(oe,he,be,"\u2289","\\nsupseteq",!0),ie(oe,le,be,"\u22a8","\\models"),ie(oe,le,be,"\u2190","\\leftarrow",!0),ie(oe,le,be,"\u2264","\\le"),ie(oe,le,be,"\u2264","\\leq",!0),ie(oe,le,be,"<","\\lt",!0),ie(oe,le,be,"\u2192","\\rightarrow",!0),ie(oe,le,be,"\u2192","\\to"),ie(oe,he,be,"\u2271","\\ngeq",!0),ie(oe,he,be,"\u2270","\\nleq",!0),ie(oe,le,ye,"\xa0","\\ "),ie(oe,le,ye,"\xa0","\\space"),ie(oe,le,ye,"\xa0","\\nobreakspace"),ie(se,le,ye,"\xa0","\\ "),ie(se,le,ye,"\xa0"," "),ie(se,le,ye,"\xa0","\\space"),ie(se,le,ye,"\xa0","\\nobreakspace"),ie(oe,le,ye,null,"\\nobreak"),ie(oe,le,ye,null,"\\allowbreak"),ie(oe,le,ve,",",","),ie(oe,le,ve,";",";"),ie(oe,he,ce,"\u22bc","\\barwedge",!0),ie(oe,he,ce,"\u22bb","\\veebar",!0),ie(oe,le,ce,"\u2299","\\odot",!0),ie(oe,le,ce,"\u2295","\\oplus",!0),ie(oe,le,ce,"\u2297","\\otimes",!0),ie(oe,le,xe,"\u2202","\\partial",!0),ie(oe,le,ce,"\u2298","\\oslash",!0),ie(oe,he,ce,"\u229a","\\circledcirc",!0),ie(oe,he,ce,"\u22a1","\\boxdot",!0),ie(oe,le,ce,"\u25b3","\\bigtriangleup"),ie(oe,le,ce,"\u25bd","\\bigtriangledown"),ie(oe,le,ce,"\u2020","\\dagger"),ie(oe,le,ce,"\u22c4","\\diamond"),ie(oe,le,ce,"\u22c6","\\star"),ie(oe,le,ce,"\u25c3","\\triangleleft"),ie(oe,le,ce,"\u25b9","\\triangleright"),ie(oe,le,ge,"{","\\{"),ie(se,le,xe,"{","\\{"),ie(se,le,xe,"{","\\textbraceleft"),ie(oe,le,ue,"}","\\}"),ie(se,le,xe,"}","\\}"),ie(se,le,xe,"}","\\textbraceright"),ie(oe,le,ge,"{","\\lbrace"),ie(oe,le,ue,"}","\\rbrace"),ie(oe,le,ge,"[","\\lbrack",!0),ie(se,le,xe,"[","\\lbrack",!0),ie(oe,le,ue,"]","\\rbrack",!0),ie(se,le,xe,"]","\\rbrack",!0),ie(oe,le,ge,"(","\\lparen",!0),ie(oe,le,ue,")","\\rparen",!0),ie(se,le,xe,"<","\\textless",!0),ie(se,le,xe,">","\\textgreater",!0),ie(oe,le,ge,"\u230a","\\lfloor",!0),ie(oe,le,ue,"\u230b","\\rfloor",!0),ie(oe,le,ge,"\u2308","\\lceil",!0),ie(oe,le,ue,"\u2309","\\rceil",!0),ie(oe,le,xe,"\\","\\backslash"),ie(oe,le,xe,"\u2223","|"),ie(oe,le,xe,"\u2223","\\vert"),ie(se,le,xe,"|","\\textbar",!0),ie(oe,le,xe,"\u2225","\\|"),ie(oe,le,xe,"\u2225","\\Vert"),ie(se,le,xe,"\u2225","\\textbardbl"),ie(se,le,xe,"~","\\textasciitilde"),ie(se,le,xe,"\\","\\textbackslash"),ie(se,le,xe,"^","\\textasciicircum"),ie(oe,le,be,"\u2191","\\uparrow",!0),ie(oe,le,be,"\u21d1","\\Uparrow",!0),ie(oe,le,be,"\u2193","\\downarrow",!0),ie(oe,le,be,"\u21d3","\\Downarrow",!0),ie(oe,le,be,"\u2195","\\updownarrow",!0),ie(oe,le,be,"\u21d5","\\Updownarrow",!0),ie(oe,le,fe,"\u2210","\\coprod"),ie(oe,le,fe,"\u22c1","\\bigvee"),ie(oe,le,fe,"\u22c0","\\bigwedge"),ie(oe,le,fe,"\u2a04","\\biguplus"),ie(oe,le,fe,"\u22c2","\\bigcap"),ie(oe,le,fe,"\u22c3","\\bigcup"),ie(oe,le,fe,"\u222b","\\int"),ie(oe,le,fe,"\u222b","\\intop"),ie(oe,le,fe,"\u222c","\\iint"),ie(oe,le,fe,"\u222d","\\iiint"),ie(oe,le,fe,"\u220f","\\prod"),ie(oe,le,fe,"\u2211","\\sum"),ie(oe,le,fe,"\u2a02","\\bigotimes"),ie(oe,le,fe,"\u2a01","\\bigoplus"),ie(oe,le,fe,"\u2a00","\\bigodot"),ie(oe,le,fe,"\u222e","\\oint"),ie(oe,le,fe,"\u222f","\\oiint"),ie(oe,le,fe,"\u2230","\\oiiint"),ie(oe,le,fe,"\u2a06","\\bigsqcup"),ie(oe,le,fe,"\u222b","\\smallint"),ie(se,le,pe,"\u2026","\\textellipsis"),ie(oe,le,pe,"\u2026","\\mathellipsis"),ie(se,le,pe,"\u2026","\\ldots",!0),ie(oe,le,pe,"\u2026","\\ldots",!0),ie(oe,le,pe,"\u22ef","\\@cdots",!0),ie(oe,le,pe,"\u22f1","\\ddots",!0),ie(oe,le,xe,"\u22ee","\\varvdots"),ie(oe,le,me,"\u02ca","\\acute"),ie(oe,le,me,"\u02cb","\\grave"),ie(oe,le,me,"\xa8","\\ddot"),ie(oe,le,me,"~","\\tilde"),ie(oe,le,me,"\u02c9","\\bar"),ie(oe,le,me,"\u02d8","\\breve"),ie(oe,le,me,"\u02c7","\\check"),ie(oe,le,me,"^","\\hat"),ie(oe,le,me,"\u20d7","\\vec"),ie(oe,le,me,"\u02d9","\\dot"),ie(oe,le,me,"\u02da","\\mathring"),ie(oe,le,de,"\ue131","\\@imath"),ie(oe,le,de,"\ue237","\\@jmath"),ie(oe,le,xe,"\u0131","\u0131"),ie(oe,le,xe,"\u0237","\u0237"),ie(se,le,xe,"\u0131","\\i",!0),ie(se,le,xe,"\u0237","\\j",!0),ie(se,le,xe,"\xdf","\\ss",!0),ie(se,le,xe,"\xe6","\\ae",!0),ie(se,le,xe,"\u0153","\\oe",!0),ie(se,le,xe,"\xf8","\\o",!0),ie(se,le,xe,"\xc6","\\AE",!0),ie(se,le,xe,"\u0152","\\OE",!0),ie(se,le,xe,"\xd8","\\O",!0),ie(se,le,me,"\u02ca","\\'"),ie(se,le,me,"\u02cb","\\`"),ie(se,le,me,"\u02c6","\\^"),ie(se,le,me,"\u02dc","\\~"),ie(se,le,me,"\u02c9","\\="),ie(se,le,me,"\u02d8","\\u"),ie(se,le,me,"\u02d9","\\."),ie(se,le,me,"\xb8","\\c"),ie(se,le,me,"\u02da","\\r"),ie(se,le,me,"\u02c7","\\v"),ie(se,le,me,"\xa8",'\\"'),ie(se,le,me,"\u02dd","\\H"),ie(se,le,me,"\u25ef","\\textcircled");var we={"--":!0,"---":!0,"``":!0,"''":!0};ie(se,le,xe,"\u2013","--",!0),ie(se,le,xe,"\u2013","\\textendash"),ie(se,le,xe,"\u2014","---",!0),ie(se,le,xe,"\u2014","\\textemdash"),ie(se,le,xe,"\u2018","`",!0),ie(se,le,xe,"\u2018","\\textquoteleft"),ie(se,le,xe,"\u2019","'",!0),ie(se,le,xe,"\u2019","\\textquoteright"),ie(se,le,xe,"\u201c","``",!0),ie(se,le,xe,"\u201c","\\textquotedblleft"),ie(se,le,xe,"\u201d","''",!0),ie(se,le,xe,"\u201d","\\textquotedblright"),ie(oe,le,xe,"\xb0","\\degree",!0),ie(se,le,xe,"\xb0","\\degree"),ie(se,le,xe,"\xb0","\\textdegree",!0),ie(oe,le,xe,"\xa3","\\pounds"),ie(oe,le,xe,"\xa3","\\mathsterling",!0),ie(se,le,xe,"\xa3","\\pounds"),ie(se,le,xe,"\xa3","\\textsterling",!0),ie(oe,he,xe,"\u2720","\\maltese"),ie(se,he,xe,"\u2720","\\maltese");for(var ke='0123456789/@."',Se=0;Set&&(t=i.height),i.depth>r&&(r=i.depth),i.maxFontSize>n&&(n=i.maxFontSize)}e.height=t,e.depth=r,e.maxFontSize=n},Xe=function(e,t,r,n){var a=new W(e,t,r,n);return Ye(a),a},We=function(e,t,r,n){return new W(e,t,r,n)},_e=function(e){var t=new A(e);return Ye(t),t},je=function(e,t,r){var n="";switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}return n+"-"+("textbf"===t&&"textit"===r?"BoldItalic":"textbf"===t?"Bold":"textit"===t?"Italic":"Regular")},$e={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Ze={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Ke={fontMap:$e,makeSymbol:Ge,mathsym:function(e,t,r,n){return void 0===n&&(n=[]),"boldsymbol"===r.font&&Ve(e,"Main-Bold",t).metrics?Ge(e,"Main-Bold",t,r,n.concat(["mathbf"])):"\\"===e||"main"===ae[t][e].font?Ge(e,"Main-Regular",t,r,n):Ge(e,"AMS-Regular",t,r,n.concat(["amsrm"]))},makeSpan:Xe,makeSvgSpan:We,makeLineSpan:function(e,t,r){var n=Xe([e],[],t);return n.height=Math.max(r||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),n.style.borderBottomWidth=V(n.height),n.maxFontSize=1,n},makeAnchor:function(e,t,r,n){var a=new _(e,t,r,n);return Ye(a),a},makeFragment:_e,wrapFragment:function(e,t){return e instanceof A?Xe([],[e],t):e},makeVList:function(e,t){for(var r=function(e){if("individualShift"===e.positionType){for(var t=e.children,r=[t[0]],n=-t[0].shift-t[0].elem.depth,a=n,i=1;i0&&(o.push(kt(s,t)),s=[]),o.push(a[l]));s.length>0&&o.push(kt(s,t)),r?((i=kt(ft(r,t,!0))).classes=["tag"],o.push(i)):n&&o.push(n);var m=mt(["katex-html"],o);if(m.setAttribute("aria-hidden","true"),i){var c=i.children[0];c.style.height=V(m.height+m.depth),m.depth&&(c.style.verticalAlign=V(-m.depth))}return m}function Mt(e){return new A(e)}var zt=function(){function e(e,t,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=r||[]}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.getAttribute=function(e){return this.attributes[e]},t.toNode=function(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=G(this.classes));for(var r=0;r0&&(e+=' class ="'+l.escape(G(this.classes))+'"'),e+=">";for(var r=0;r"},t.toText=function(){return this.children.map((function(e){return e.toText()})).join("")},e}(),At=function(){function e(e){this.text=void 0,this.text=e}var t=e.prototype;return t.toNode=function(){return document.createTextNode(this.text)},t.toMarkup=function(){return l.escape(this.toText())},t.toText=function(){return this.text},e}(),Tt={MathNode:zt,TextNode:At,SpaceNode:function(){function e(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?"\u200a":e>=.1666&&e<=.1667?"\u2009":e>=.2222&&e<=.2223?"\u2005":e>=.2777&&e<=.2778?"\u2005\u200a":e>=-.05556&&e<=-.05555?"\u200a\u2063":e>=-.1667&&e<=-.1666?"\u2009\u2063":e>=-.2223&&e<=-.2222?"\u205f\u2063":e>=-.2778&&e<=-.2777?"\u2005\u2063":null}var t=e.prototype;return t.toNode=function(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",V(this.width)),e},t.toMarkup=function(){return this.character?""+this.character+"":''},t.toText=function(){return this.character?this.character:" "},e}(),newDocumentFragment:Mt},Bt=function(e,t,r){return!ae[t][e]||!ae[t][e].replace||55349===e.charCodeAt(0)||we.hasOwnProperty(e)&&r&&(r.fontFamily&&"tt"===r.fontFamily.substr(4,2)||r.font&&"tt"===r.font.substr(4,2))||(e=ae[t][e].replace),new Tt.TextNode(e)},Ct=function(e){return 1===e.length?e[0]:new Tt.MathNode("mrow",e)},qt=function(e,t){if("texttt"===t.fontFamily)return"monospace";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";var r=t.font;if(!r||"mathnormal"===r)return null;var n=e.mode;if("mathit"===r)return"italic";if("boldsymbol"===r)return"textord"===e.type?"bold":"bold-italic";if("mathbf"===r)return"bold";if("mathbb"===r)return"double-struck";if("mathfrak"===r)return"fraktur";if("mathscr"===r||"mathcal"===r)return"script";if("mathsf"===r)return"sans-serif";if("mathtt"===r)return"monospace";var a=e.text;return l.contains(["\\imath","\\jmath"],a)?null:(ae[n][a]&&ae[n][a].replace&&(a=ae[n][a].replace),q(a,Ke.fontMap[r].fontName,n)?Ke.fontMap[r].variant:null)},Nt=function(e,t,r){if(1===e.length){var n=Rt(e[0],t);return r&&n instanceof zt&&"mo"===n.type&&(n.setAttribute("lspace","0em"),n.setAttribute("rspace","0em")),[n]}for(var a,i=[],o=0;o0&&(p.text=p.text.slice(0,1)+"\u0338"+p.text.slice(1),i.pop())}}}i.push(s),a=s}return i},It=function(e,t,r){return Ct(Nt(e,t,r))},Rt=function(e,t){if(!e)return new Tt.MathNode("mrow");if(it[e.type])return it[e.type](e,t);throw new n("Got group of unknown type: '"+e.type+"'")};function Ot(e,t,r,n,a){var i,o=Nt(e,r);i=1===o.length&&o[0]instanceof zt&&l.contains(["mrow","mtable"],o[0].type)?o[0]:new Tt.MathNode("mrow",o);var s=new Tt.MathNode("annotation",[new Tt.TextNode(t)]);s.setAttribute("encoding","application/x-tex");var h=new Tt.MathNode("semantics",[i,s]),m=new Tt.MathNode("math",[h]);m.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&m.setAttribute("display","block");var c=a?"katex":"katex-mathml";return Ke.makeSpan([c],[m])}var Ht=function(e){return new E({style:e.displayMode?x.DISPLAY:x.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Et=function(e,t){if(t.displayMode){var r=["katex-display"];t.leqno&&r.push("leqno"),t.fleqn&&r.push("fleqn"),e=Ke.makeSpan(r,[e])}return e},Lt=function(e,t,r){var n,a=Ht(r);if("mathml"===r.output)return Ot(e,t,a,r.displayMode,!0);if("html"===r.output){var i=St(e,a);n=Ke.makeSpan(["katex"],[i])}else{var o=Ot(e,t,a,r.displayMode,!1),s=St(e,a);n=Ke.makeSpan(["katex"],[o,s])}return Et(n,r)},Dt={widehat:"^",widecheck:"\u02c7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23df",overbrace:"\u23de",overgroup:"\u23e0",undergroup:"\u23e1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21d2",xRightarrow:"\u21d2",overleftharpoon:"\u21bc",xleftharpoonup:"\u21bc",overrightharpoon:"\u21c0",xrightharpoonup:"\u21c0",xLeftarrow:"\u21d0",xLeftrightarrow:"\u21d4",xhookleftarrow:"\u21a9",xhookrightarrow:"\u21aa",xmapsto:"\u21a6",xrightharpoondown:"\u21c1",xleftharpoondown:"\u21bd",xrightleftharpoons:"\u21cc",xleftrightharpoons:"\u21cb",xtwoheadleftarrow:"\u219e",xtwoheadrightarrow:"\u21a0",xlongequal:"=",xtofrom:"\u21c4",xrightleftarrows:"\u21c4",xrightequilibrium:"\u21cc",xleftequilibrium:"\u21cb","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="},Pt={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Ft=function(e,t,r,n,a){var i,o=e.height+e.depth+r+n;if(/fbox|color|angl/.test(t)){if(i=Ke.makeSpan(["stretchy",t],[],a),"fbox"===t){var s=a.color&&a.getColor();s&&(i.style.borderColor=s)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new Q({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new Q({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new K(l,{width:"100%",height:V(o)});i=Ke.makeSvgSpan([],[h],a)}return i.height=o,i.style.height=V(o),i},Vt=function(e){var t=new Tt.MathNode("mo",[new Tt.TextNode(Dt[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},Gt=function(e,t){var r=function(){var r=4e5,n=e.label.substr(1);if(l.contains(["widehat","widecheck","widetilde","utilde"],n)){var a,i,o,s="ordgroup"===(d=e.base).type?d.body.length:1;if(s>5)"widehat"===n||"widecheck"===n?(a=420,r=2364,o=.42,i=n+"4"):(a=312,r=2340,o=.34,i="tilde4");else{var h=[1,1,2,2,3,3][s];"widehat"===n||"widecheck"===n?(r=[0,1062,2364,2364,2364][h],a=[0,239,300,360,420][h],o=[0,.24,.3,.3,.36,.42][h],i=n+h):(r=[0,600,1033,2339,2340][h],a=[0,260,286,306,312][h],o=[0,.26,.286,.3,.306,.34][h],i="tilde"+h)}var m=new J(i),c=new K([m],{width:"100%",height:V(o),viewBox:"0 0 "+r+" "+a,preserveAspectRatio:"none"});return{span:Ke.makeSvgSpan([],[c],t),minWidth:0,height:o}}var u,p,d,f=[],g=Pt[n],v=g[0],b=g[1],y=g[2],x=y/1e3,w=v.length;if(1===w)u=["hide-tail"],p=[g[3]];else if(2===w)u=["halfarrow-left","halfarrow-right"],p=["xMinYMin","xMaxYMin"];else{if(3!==w)throw new Error("Correct katexImagesData or update code here to support\n "+w+" children.");u=["brace-left","brace-center","brace-right"],p=["xMinYMin","xMidYMin","xMaxYMin"]}for(var k=0;k0&&(n.style.minWidth=V(a)),n};function Ut(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function Yt(e){var t=Xt(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Xt(e){return e&&("atom"===e.type||re.hasOwnProperty(e.type))?e:null}var Wt=function(e,t){var r,n,a;e&&"supsub"===e.type?(r=(n=Ut(e.base,"accent")).base,e.base=r,a=function(e){if(e instanceof W)return e;throw new Error("Expected span but got "+String(e)+".")}(wt(e,t)),e.base=n):r=(n=Ut(e,"accent")).base;var i=wt(r,t.havingCrampedStyle()),o=0;if(n.isShifty&&l.isCharacterBox(r)){var s=l.getBaseElem(r);o=ee(wt(s,t.havingCrampedStyle())).skew}var h,m="\\c"===n.label,c=m?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight);if(n.isStretchy)h=Gt(n,t),h=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+V(2*o)+")",marginLeft:V(2*o)}:void 0}]},t);else{var u,p;"\\vec"===n.label?(u=Ke.staticSvg("vec",t),p=Ke.svgData.vec[1]):((u=ee(u=Ke.makeOrd({mode:n.mode,text:n.label},t,"textord"))).italic=0,p=u.width,m&&(c+=u.depth)),h=Ke.makeSpan(["accent-body"],[u]);var d="\\textcircled"===n.label;d&&(h.classes.push("accent-full"),c=i.height);var f=o;d||(f-=p/2),h.style.left=V(f),"\\textcircled"===n.label&&(h.style.top=".2em"),h=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-c},{type:"elem",elem:h}]},t)}var g=Ke.makeSpan(["mord","accent"],[h],t);return a?(a.children[0]=g,a.height=Math.max(g.height,a.height),a.classes[0]="mord",a):g},_t=function(e,t){var r=e.isStretchy?Vt(e.label):new Tt.MathNode("mo",[Bt(e.label,e.mode)]),n=new Tt.MathNode("mover",[Rt(e.base,t),r]);return n.setAttribute("accent","true"),n},jt=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((function(e){return"\\"+e})).join("|"));ot({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:function(e,t){var r=lt(t[0]),n=!jt.test(e.funcName),a=!n||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:a,base:r}},htmlBuilder:Wt,mathmlBuilder:_t}),ot({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:function(e,t){var r=t[0],n=e.parser.mode;return"math"===n&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:Wt,mathmlBuilder:_t}),ot({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:a}},htmlBuilder:function(e,t){var r=wt(e.base,t),n=Gt(e,t),a="\\utilde"===e.label?.12:0,i=Ke.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:a},{type:"elem",elem:r}]},t);return Ke.makeSpan(["mord","accentunder"],[i],t)},mathmlBuilder:function(e,t){var r=Vt(e.label),n=new Tt.MathNode("munder",[Rt(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});var $t=function(e){var t=new Tt.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};ot({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler:function(e,t,r){var n=e.parser,a=e.funcName;return{type:"xArrow",mode:n.mode,label:a,body:t[0],below:r[0]}},htmlBuilder:function(e,t){var r,n=t.style,a=t.havingStyle(n.sup()),i=Ke.wrapFragment(wt(e.body,a,t),t),o="\\x"===e.label.slice(0,2)?"x":"cd";i.classes.push(o+"-arrow-pad"),e.below&&(a=t.havingStyle(n.sub()),(r=Ke.wrapFragment(wt(e.below,a,t),t)).classes.push(o+"-arrow-pad"));var s,l=Gt(e,t),h=-t.fontMetrics().axisHeight+.5*l.height,m=-t.fontMetrics().axisHeight-.5*l.height-.111;if((i.depth>.25||"\\xleftequilibrium"===e.label)&&(m-=i.depth),r){var c=-t.fontMetrics().axisHeight+r.height+.5*l.height+.111;s=Ke.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:m},{type:"elem",elem:l,shift:h},{type:"elem",elem:r,shift:c}]},t)}else s=Ke.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:m},{type:"elem",elem:l,shift:h}]},t);return s.children[0].children[0].children[1].classes.push("svg-align"),Ke.makeSpan(["mrel","x-arrow"],[s],t)},mathmlBuilder:function(e,t){var r,n=Vt(e.label);if(n.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var a=$t(Rt(e.body,t));if(e.below){var i=$t(Rt(e.below,t));r=new Tt.MathNode("munderover",[n,i,a])}else r=new Tt.MathNode("mover",[n,a])}else if(e.below){var o=$t(Rt(e.below,t));r=new Tt.MathNode("munder",[n,o])}else r=$t(),r=new Tt.MathNode("mover",[n,r]);return r}});var Zt={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Kt=function(e){return"textord"===e.type&&"@"===e.text};function Jt(e,t,r){var n=Zt[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var a={type:"atom",text:n,mode:"math",family:"rel"},i={type:"ordgroup",mode:"math",body:[r.callFunction("\\\\cdleft",[t[0]],[]),r.callFunction("\\Big",[a],[]),r.callFunction("\\\\cdright",[t[1]],[])]};return r.callFunction("\\\\cdparent",[i],[]);case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return r.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}}}ot({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder:function(e,t){var r=t.havingStyle(t.style.sup()),n=Ke.wrapFragment(wt(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=V(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder:function(e,t){var r=new Tt.MathNode("mrow",[Rt(e.label,t)]);return(r=new Tt.MathNode("mpadded",[r])).setAttribute("width","0"),"left"===e.side&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),(r=new Tt.MathNode("mstyle",[r])).setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}}),ot({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:function(e,t){return{type:"cdlabelparent",mode:e.parser.mode,fragment:t[0]}},htmlBuilder:function(e,t){var r=Ke.wrapFragment(wt(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder:function(e,t){return new Tt.MathNode("mrow",[Rt(e.fragment,t)])}}),ot({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){for(var r=e.parser,a=Ut(t[0],"ordgroup").body,i="",o=0;o=1114111)throw new n("\\@char with invalid code point "+i);return l<=65535?s=String.fromCharCode(l):(l-=65536,s=String.fromCharCode(55296+(l>>10),56320+(1023&l))),{type:"textord",mode:r.mode,text:s}}});var Qt=function(e,t){var r=ft(e.body,t.withColor(e.color),!1);return Ke.makeFragment(r)},er=function(e,t){var r=Nt(e.body,t.withColor(e.color)),n=new Tt.MathNode("mstyle",r);return n.setAttribute("mathcolor",e.color),n};ot({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler:function(e,t){var r=e.parser,n=Ut(t[0],"color-token").color,a=t[1];return{type:"color",mode:r.mode,color:n,body:ht(a)}},htmlBuilder:Qt,mathmlBuilder:er}),ot({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler:function(e,t){var r=e.parser,n=e.breakOnTokenText,a=Ut(t[0],"color-token").color;r.gullet.macros.set("\\current@color",a);var i=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:a,body:i}},htmlBuilder:Qt,mathmlBuilder:er}),ot({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:1,argTypes:["size"],allowedInText:!0},handler:function(e,t,r){var n=e.parser,a=r[0],i=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:i,size:a&&Ut(a,"size").value}},htmlBuilder:function(e,t){var r=Ke.makeSpan(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=V(F(e.size,t)))),r},mathmlBuilder:function(e,t){var r=new Tt.MathNode("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",V(F(e.size,t)))),r}});var tr={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},rr=function(e){var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new n("Expected a control sequence",e);return t},nr=function(e,t,r,n){var a=e.gullet.macros.get(r.text);null==a&&(r.noexpand=!0,a={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,a,n)};ot({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler:function(e){var t=e.parser,r=e.funcName;t.consumeSpaces();var a=t.fetch();if(tr[a.text])return"\\global"!==r&&"\\\\globallong"!==r||(a.text=tr[a.text]),Ut(t.parseFunction(),"internal");throw new n("Invalid token after macro prefix",a)}}),ot({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler:function(e){var t=e.parser,r=e.funcName,a=t.gullet.popToken(),i=a.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new n("Expected a control sequence",a);for(var o,s=0,l=[[]];"{"!==t.gullet.future().text;)if("#"===(a=t.gullet.popToken()).text){if("{"===t.gullet.future().text){o=t.gullet.future(),l[s].push("{");break}if(a=t.gullet.popToken(),!/^[1-9]$/.test(a.text))throw new n('Invalid argument number "'+a.text+'"');if(parseInt(a.text)!==s+1)throw new n('Argument number "'+a.text+'" out of order');s++,l.push([])}else{if("EOF"===a.text)throw new n("Expected a macro definition");l[s].push(a.text)}var h=t.gullet.consumeArg().tokens;return o&&h.unshift(o),"\\edef"!==r&&"\\xdef"!==r||(h=t.gullet.expandTokens(h)).reverse(),t.gullet.macros.set(i,{tokens:h,numArgs:s,delimiters:l},r===tr[r]),{type:"internal",mode:t.mode}}}),ot({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler:function(e){var t=e.parser,r=e.funcName,n=rr(t.gullet.popToken());t.gullet.consumeSpaces();var a=function(e){var t=e.gullet.popToken();return"="===t.text&&" "===(t=e.gullet.popToken()).text&&(t=e.gullet.popToken()),t}(t);return nr(t,n,a,"\\\\globallet"===r),{type:"internal",mode:t.mode}}}),ot({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler:function(e){var t=e.parser,r=e.funcName,n=rr(t.gullet.popToken()),a=t.gullet.popToken(),i=t.gullet.popToken();return nr(t,n,i,"\\\\globalfuture"===r),t.gullet.pushToken(i),t.gullet.pushToken(a),{type:"internal",mode:t.mode}}});var ar=function(e,t,r){var n=q(ae.math[e]&&ae.math[e].replace||e,t,r);if(!n)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return n},ir=function(e,t,r,n){var a=r.havingBaseStyle(t),i=Ke.makeSpan(n.concat(a.sizingClasses(r)),[e],r),o=a.sizeMultiplier/r.sizeMultiplier;return i.height*=o,i.depth*=o,i.maxFontSize=a.sizeMultiplier,i},or=function(e,t,r){var n=t.havingBaseStyle(r),a=(1-t.sizeMultiplier/n.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=V(a),e.height-=a,e.depth+=a},sr=function(e,t,r,n,a,i){var o=function(e,t,r,n){return Ke.makeSymbol(e,"Size"+t+"-Regular",r,n)}(e,t,a,n),s=ir(Ke.makeSpan(["delimsizing","size"+t],[o],n),x.TEXT,n,i);return r&&or(s,n,x.TEXT),s},lr=function(e,t,r){var n;return n="Size1-Regular"===t?"delim-size1":"delim-size4",{type:"elem",elem:Ke.makeSpan(["delimsizinginner",n],[Ke.makeSpan([],[Ke.makeSymbol(e,t,r)])])}},hr=function(e,t,r){var n=T["Size4-Regular"][e.charCodeAt(0)]?T["Size4-Regular"][e.charCodeAt(0)][4]:T["Size1-Regular"][e.charCodeAt(0)][4],a=new J("inner",function(e,t){switch(e){case"\u239c":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"\u2223":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"\u2225":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145zM367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z";case"\u239f":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"\u23a2":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"\u23a5":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"\u23aa":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"\u23d0":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"\u2016":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257zM478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z";default:return""}}(e,Math.round(1e3*t))),i=new K([a],{width:V(n),height:V(t),style:"width:"+V(n),viewBox:"0 0 "+1e3*n+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),o=Ke.makeSvgSpan([],[i],r);return o.height=t,o.style.height=V(t),o.style.width=V(n),{type:"elem",elem:o}},mr={type:"kern",size:-.008},cr=["|","\\lvert","\\rvert","\\vert"],ur=["\\|","\\lVert","\\rVert","\\Vert"],pr=function(e,t,r,n,a,i){var o,s,h,m;o=h=m=e,s=null;var c="Size1-Regular";"\\uparrow"===e?h=m="\u23d0":"\\Uparrow"===e?h=m="\u2016":"\\downarrow"===e?o=h="\u23d0":"\\Downarrow"===e?o=h="\u2016":"\\updownarrow"===e?(o="\\uparrow",h="\u23d0",m="\\downarrow"):"\\Updownarrow"===e?(o="\\Uparrow",h="\u2016",m="\\Downarrow"):l.contains(cr,e)?h="\u2223":l.contains(ur,e)?h="\u2225":"["===e||"\\lbrack"===e?(o="\u23a1",h="\u23a2",m="\u23a3",c="Size4-Regular"):"]"===e||"\\rbrack"===e?(o="\u23a4",h="\u23a5",m="\u23a6",c="Size4-Regular"):"\\lfloor"===e||"\u230a"===e?(h=o="\u23a2",m="\u23a3",c="Size4-Regular"):"\\lceil"===e||"\u2308"===e?(o="\u23a1",h=m="\u23a2",c="Size4-Regular"):"\\rfloor"===e||"\u230b"===e?(h=o="\u23a5",m="\u23a6",c="Size4-Regular"):"\\rceil"===e||"\u2309"===e?(o="\u23a4",h=m="\u23a5",c="Size4-Regular"):"("===e||"\\lparen"===e?(o="\u239b",h="\u239c",m="\u239d",c="Size4-Regular"):")"===e||"\\rparen"===e?(o="\u239e",h="\u239f",m="\u23a0",c="Size4-Regular"):"\\{"===e||"\\lbrace"===e?(o="\u23a7",s="\u23a8",m="\u23a9",h="\u23aa",c="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(o="\u23ab",s="\u23ac",m="\u23ad",h="\u23aa",c="Size4-Regular"):"\\lgroup"===e||"\u27ee"===e?(o="\u23a7",m="\u23a9",h="\u23aa",c="Size4-Regular"):"\\rgroup"===e||"\u27ef"===e?(o="\u23ab",m="\u23ad",h="\u23aa",c="Size4-Regular"):"\\lmoustache"===e||"\u23b0"===e?(o="\u23a7",m="\u23ad",h="\u23aa",c="Size4-Regular"):"\\rmoustache"!==e&&"\u23b1"!==e||(o="\u23ab",m="\u23a9",h="\u23aa",c="Size4-Regular");var u=ar(o,c,a),p=u.height+u.depth,d=ar(h,c,a),f=d.height+d.depth,g=ar(m,c,a),v=g.height+g.depth,b=0,y=1;if(null!==s){var w=ar(s,c,a);b=w.height+w.depth,y=2}var k=p+v+b,S=k+Math.max(0,Math.ceil((t-k)/(y*f)))*y*f,M=n.fontMetrics().axisHeight;r&&(M*=n.sizeMultiplier);var z=S/2-M,A=[];if(A.push(lr(m,c,a)),A.push(mr),null===s){var T=S-p-v+.016;A.push(hr(h,T,n))}else{var B=(S-p-v-b)/2+.016;A.push(hr(h,B,n)),A.push(mr),A.push(lr(s,c,a)),A.push(mr),A.push(hr(h,B,n))}A.push(mr),A.push(lr(o,c,a));var C=n.havingBaseStyle(x.TEXT),q=Ke.makeVList({positionType:"bottom",positionData:z,children:A},C);return ir(Ke.makeSpan(["delimsizing","mult"],[q],C),x.TEXT,n,i)},dr=.08,fr=function(e,t,r,n,a){var i=function(e,t,r){t*=1e3;var n="";switch(e){case"sqrtMain":n=function(e,t){return"M95,"+(622+e+t)+"\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl"+e/2.075+" -"+e+"\nc5.3,-9.3,12,-14,20,-14\nH400000v"+(40+e)+"H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM"+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,M);break;case"sqrtSize1":n=function(e,t){return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+e/2.084+" -"+e+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+e)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,M);break;case"sqrtSize2":n=function(e,t){return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,M);break;case"sqrtSize3":n=function(e,t){return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,M);break;case"sqrtSize4":n=function(e,t){return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,M);break;case"sqrtTall":n=function(e,t,r){return"M702 "+(e+t)+"H400000"+(40+e)+"\nH742v"+(r-54-t-e)+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+t+"H400000v"+(40+e)+"H742z"}(t,M,r)}return n}(e,n,r),o=new J(e,i),s=new K([o],{width:"400em",height:V(t),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return Ke.makeSvgSpan(["hide-tail"],[s],a)},gr=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230a","\u230b","\\lceil","\\rceil","\u2308","\u2309","\\surd"],vr=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27ee","\u27ef","\\lmoustache","\\rmoustache","\u23b0","\u23b1"],br=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],yr=[0,1.2,1.8,2.4,3],xr=[{type:"small",style:x.SCRIPTSCRIPT},{type:"small",style:x.SCRIPT},{type:"small",style:x.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],wr=[{type:"small",style:x.SCRIPTSCRIPT},{type:"small",style:x.SCRIPT},{type:"small",style:x.TEXT},{type:"stack"}],kr=[{type:"small",style:x.SCRIPTSCRIPT},{type:"small",style:x.SCRIPT},{type:"small",style:x.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Sr=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},Mr=function(e,t,r,n){for(var a=Math.min(2,3-n.style.size);at)return r[a]}return r[r.length-1]},zr=function(e,t,r,n,a,i){var o;"<"===e||"\\lt"===e||"\u27e8"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"\u27e9"!==e||(e="\\rangle"),o=l.contains(br,e)?xr:l.contains(gr,e)?kr:wr;var s=Mr(e,t,o,n);return"small"===s.type?function(e,t,r,n,a,i){var o=Ke.makeSymbol(e,"Main-Regular",a,n),s=ir(o,t,n,i);return r&&or(s,n,t),s}(e,s.style,r,n,a,i):"large"===s.type?sr(e,s.size,r,n,a,i):pr(e,t,r,n,a,i)},Ar={sqrtImage:function(e,t){var r,n,a=t.havingBaseSizing(),i=Mr("\\surd",e*a.sizeMultiplier,kr,a),o=a.sizeMultiplier,s=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),l=0,h=0,m=0;return"small"===i.type?(e<1?o=1:e<1.4&&(o=.7),h=(1+s)/o,(r=fr("sqrtMain",l=(1+s+dr)/o,m=1e3+1e3*s+80,s,t)).style.minWidth="0.853em",n=.833/o):"large"===i.type?(m=1080*yr[i.size],h=(yr[i.size]+s)/o,l=(yr[i.size]+s+dr)/o,(r=fr("sqrtSize"+i.size,l,m,s,t)).style.minWidth="1.02em",n=1/o):(l=e+s+dr,h=e+s,m=Math.floor(1e3*e+s)+80,(r=fr("sqrtTall",l,m,s,t)).style.minWidth="0.742em",n=1.056),r.height=h,r.style.height=V(l),{span:r,advanceWidth:n,ruleWidth:(t.fontMetrics().sqrtRuleThickness+s)*o}},sizedDelim:function(e,t,r,a,i){if("<"===e||"\\lt"===e||"\u27e8"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"\u27e9"!==e||(e="\\rangle"),l.contains(gr,e)||l.contains(br,e))return sr(e,t,!1,r,a,i);if(l.contains(vr,e))return pr(e,yr[t],!1,r,a,i);throw new n("Illegal delimiter: '"+e+"'")},sizeToMaxHeight:yr,customSizedDelim:zr,leftRightDelim:function(e,t,r,n,a,i){var o=n.fontMetrics().axisHeight*n.sizeMultiplier,s=5/n.fontMetrics().ptPerEm,l=Math.max(t-o,r+o),h=Math.max(l/500*901,2*l-s);return zr(e,h,!0,n,a,i)}},Tr={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Br=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230a","\u230b","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27e8","\\rangle","\u27e9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27ee","\u27ef","\\lmoustache","\\rmoustache","\u23b0","\u23b1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Cr(e,t){var r=Xt(e);if(r&&l.contains(Br,r.text))return r;throw new n(r?"Invalid delimiter '"+r.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function qr(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ot({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:function(e,t){var r=Cr(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:Tr[e.funcName].size,mclass:Tr[e.funcName].mclass,delim:r.text}},htmlBuilder:function(e,t){return"."===e.delim?Ke.makeSpan([e.mclass]):Ar.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass])},mathmlBuilder:function(e){var t=[];"."!==e.delim&&t.push(Bt(e.delim,e.mode));var r=new Tt.MathNode("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=V(Ar.sizeToMaxHeight[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}}),ot({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:function(e,t){var r=e.parser.gullet.macros.get("\\current@color");if(r&&"string"!=typeof r)throw new n("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Cr(t[0],e).text,color:r}}}),ot({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:function(e,t){var r=Cr(t[0],e),n=e.parser;++n.leftrightDepth;var a=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var i=Ut(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:a,left:r.text,right:i.delim,rightColor:i.color}},htmlBuilder:function(e,t){qr(e);for(var r,n,a=ft(e.body,t,!0,["mopen","mclose"]),i=0,o=0,s=!1,l=0;l-1?"mpadded":"menclose",[Rt(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),"\\fcolorbox"===e.label){var a=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+a+"em solid "+String(e.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};ot({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler:function(e,t,r){var n=e.parser,a=e.funcName,i=Ut(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:n.mode,label:a,backgroundColor:i,body:o}},htmlBuilder:Nr,mathmlBuilder:Ir}),ot({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler:function(e,t,r){var n=e.parser,a=e.funcName,i=Ut(t[0],"color-token").color,o=Ut(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:n.mode,label:a,backgroundColor:o,borderColor:i,body:s}},htmlBuilder:Nr,mathmlBuilder:Ir}),ot({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:function(e,t){return{type:"enclose",mode:e.parser.mode,label:"\\fbox",body:t[0]}}}),ot({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"enclose",mode:r.mode,label:n,body:a}},htmlBuilder:Nr,mathmlBuilder:Ir}),ot({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler:function(e,t){return{type:"enclose",mode:e.parser.mode,label:"\\angl",body:t[0]}}});var Rr={};function Or(e){for(var t=e.type,r=e.names,n=e.props,a=e.handler,i=e.htmlBuilder,o=e.mathmlBuilder,s={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:a},l=0;l1||!c)&&g.pop(),b.length0&&(y+=.25),m.push({pos:y,isDashed:e[t]})}for(w(o[0]),r=0;r0&&(M<(B+=b)&&(M=B),B=0),e.addJot&&(M+=f),z.height=S,z.depth=M,y+=S,z.pos=y,y+=M+B,h[r]=z,w(o[r+1])}var C,q,N=y/2+t.fontMetrics().axisHeight,I=e.cols||[],R=[],O=[];if(e.tags&&e.tags.some((function(e){return e})))for(r=0;r=s)){var W=void 0;(a>0||e.hskipBeforeAndAfter)&&0!==(W=l.deflt(P.pregap,p))&&((C=Ke.makeSpan(["arraycolsep"],[])).style.width=V(W),R.push(C));var _=[];for(r=0;r0){for(var K=Ke.makeLineSpan("hline",t,c),J=Ke.makeLineSpan("hdashline",t,c),Q=[{type:"elem",elem:h,shift:0}];m.length>0;){var ee=m.pop(),te=ee.pos-N;ee.isDashed?Q.push({type:"elem",elem:J,shift:te}):Q.push({type:"elem",elem:K,shift:te})}h=Ke.makeVList({positionType:"individualShift",children:Q},t)}if(0===O.length)return Ke.makeSpan(["mord"],[h],t);var re=Ke.makeVList({positionType:"individualShift",children:O},t);return re=Ke.makeSpan(["tag"],[re],t),Ke.makeFragment([h,re])},Xr={c:"center ",l:"left ",r:"right "},Wr=function(e,t){for(var r=[],n=new Tt.MathNode("mtd",[],["mtr-glue"]),a=new Tt.MathNode("mtd",[],["mml-eqn-num"]),i=0;i0){var p=e.cols,d="",f=!1,g=0,v=p.length;"separator"===p[0].type&&(c+="top ",g=1),"separator"===p[p.length-1].type&&(c+="bottom ",v-=1);for(var b=g;b0?"left ":"",c+=S[S.length-1].length>0?"right ":"";for(var M=1;M-1?"alignat":"align",o="split"===e.envName,s=Gr(e.parser,{cols:a,addJot:!0,autoTag:o?void 0:Vr(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:o?2:void 0,leqno:e.parser.settings.leqno},"display"),l=0,h={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){for(var m="",c=0;c0&&u&&(f=1),a[p]={type:"align",align:d,pregap:f,postgap:0}}return s.colSeparationType=u?"align":"alignat",s};Or({type:"array",names:["array","darray"],props:{numArgs:1},handler:function(e,t){var r=(Xt(t[0])?[t[0]]:Ut(t[0],"ordgroup").body).map((function(e){var t=Yt(e).text;if(-1!=="lcr".indexOf(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"};throw new n("Unknown column alignment: "+t,e)})),a={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return Gr(e.parser,a,Ur(e.envName))},htmlBuilder:Yr,mathmlBuilder:Wr}),Or({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler:function(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",a={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if("*"===e.envName.charAt(e.envName.length-1)){var i=e.parser;if(i.consumeSpaces(),"["===i.fetch().text){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,-1==="lcr".indexOf(r))throw new n("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),a.cols=[{type:"align",align:r}]}}var o=Gr(e.parser,a,Ur(e.envName)),s=Math.max.apply(Math,[0].concat(o.body.map((function(e){return e.length}))));return o.cols=new Array(s).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[o],left:t[0],right:t[1],rightColor:void 0}:o},htmlBuilder:Yr,mathmlBuilder:Wr}),Or({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:function(e){var t=Gr(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:Yr,mathmlBuilder:Wr}),Or({type:"array",names:["subarray"],props:{numArgs:1},handler:function(e,t){var r=(Xt(t[0])?[t[0]]:Ut(t[0],"ordgroup").body).map((function(e){var t=Yt(e).text;if(-1!=="lc".indexOf(t))return{type:"align",align:t};throw new n("Unknown column alignment: "+t,e)}));if(r.length>1)throw new n("{subarray} can contain only one column");var a={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5};if((a=Gr(e.parser,a,"script")).body.length>0&&a.body[0].length>1)throw new n("{subarray} can contain only one column");return a},htmlBuilder:Yr,mathmlBuilder:Wr}),Or({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler:function(e){var t=Gr(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},Ur(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Yr,mathmlBuilder:Wr}),Or({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:_r,htmlBuilder:Yr,mathmlBuilder:Wr}),Or({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler:function(e){l.contains(["gather","gather*"],e.envName)&&Fr(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Vr(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Gr(e.parser,t,"display")},htmlBuilder:Yr,mathmlBuilder:Wr}),Or({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:_r,htmlBuilder:Yr,mathmlBuilder:Wr}),Or({type:"array",names:["equation","equation*"],props:{numArgs:0},handler:function(e){Fr(e);var t={autoTag:Vr(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Gr(e.parser,t,"display")},htmlBuilder:Yr,mathmlBuilder:Wr}),Or({type:"array",names:["CD"],props:{numArgs:0},handler:function(e){return Fr(e),function(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if("&"!==r&&"\\\\"!==r){if("\\end"===r){0===t[t.length-1].length&&t.pop();break}throw new n("Expected \\\\ or \\cr or \\end",e.nextToken)}e.consume()}for(var a,i,o=[],s=[o],l=0;l-1);else{if(!("<>AV".indexOf(u)>-1))throw new n('Expected one of "<>AV=|." after @',h[c]);for(var d=0;d<2;d++){for(var f=!0,g=c+1;g=x.SCRIPT.id?r.text():x.DISPLAY:"text"===e&&r.size===x.DISPLAY.size?r=x.TEXT:"script"===e?r=x.SCRIPT:"scriptscript"===e&&(r=x.SCRIPTSCRIPT),r},nn=function(e,t){var r,n=rn(e.size,t.style),a=n.fracNum(),i=n.fracDen();r=t.havingStyle(a);var o=wt(e.numer,r,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;o.height=o.height0?3*c:7*c,d=t.fontMetrics().denom1):(m>0?(u=t.fontMetrics().num2,p=c):(u=t.fontMetrics().num3,p=3*c),d=t.fontMetrics().denom2),h){var w=t.fontMetrics().axisHeight;u-o.depth-(w+.5*m)0&&(t="."===(t=e)?null:t),t};ot({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler:function(e,t){var r,n=e.parser,a=t[4],i=t[5],o=lt(t[0]),s="atom"===o.type&&"open"===o.family?sn(o.text):null,l=lt(t[1]),h="atom"===l.type&&"close"===l.family?sn(l.text):null,m=Ut(t[2],"size"),c=null;r=!!m.isBlank||(c=m.value).number>0;var u="auto",p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var d=Ut(p.body[0],"textord");u=on[Number(d.text)]}}else p=Ut(p,"textord"),u=on[Number(p.text)];return{type:"genfrac",mode:n.mode,numer:a,denom:i,continued:!1,hasBarLine:r,barSize:c,leftDelim:s,rightDelim:h,size:u}},htmlBuilder:nn,mathmlBuilder:an}),ot({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:function(e,t){var r=e.parser,n=(e.funcName,e.token);return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:Ut(t[0],"size").value,token:n}}}),ot({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:function(e,t){var r=e.parser,n=(e.funcName,t[0]),a=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(Ut(t[1],"infix").size),i=t[2],o=a.number>0;return{type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:o,barSize:a,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:nn,mathmlBuilder:an});var ln=function(e,t){var r,n,a=t.style;"supsub"===e.type?(r=e.sup?wt(e.sup,t.havingStyle(a.sup()),t):wt(e.sub,t.havingStyle(a.sub()),t),n=Ut(e.base,"horizBrace")):n=Ut(e,"horizBrace");var i,o=wt(n.base,t.havingBaseStyle(x.DISPLAY)),s=Gt(n,t);if(n.isOver?(i=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},t)).children[0].children[0].children[1].classes.push("svg-align"):(i=Ke.makeVList({positionType:"bottom",positionData:o.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},t)).children[0].children[0].children[0].classes.push("svg-align"),r){var l=Ke.makeSpan(["mord",n.isOver?"mover":"munder"],[i],t);i=n.isOver?Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]},t):Ke.makeVList({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]},t)}return Ke.makeSpan(["mord",n.isOver?"mover":"munder"],[i],t)};ot({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName;return{type:"horizBrace",mode:r.mode,label:n,isOver:/^\\over/.test(n),base:t[0]}},htmlBuilder:ln,mathmlBuilder:function(e,t){var r=Vt(e.label);return new Tt.MathNode(e.isOver?"mover":"munder",[Rt(e.base,t),r])}}),ot({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:function(e,t){var r=e.parser,n=t[1],a=Ut(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:a})?{type:"href",mode:r.mode,href:a,body:ht(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:function(e,t){var r=ft(e.body,t,!1);return Ke.makeAnchor(e.href,[],r,t)},mathmlBuilder:function(e,t){var r=It(e.body,t);return r instanceof zt||(r=new zt("mrow",[r])),r.setAttribute("href",e.href),r}}),ot({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:function(e,t){var r=e.parser,n=Ut(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var a=[],i=0;i0&&(n=F(e.totalheight,t)-r);var a=0;e.width.number>0&&(a=F(e.width,t));var i={height:V(r+n)};a>0&&(i.width=V(a)),n>0&&(i.verticalAlign=V(-n));var o=new j(e.src,e.alt,i);return o.height=r,o.depth=n,o},mathmlBuilder:function(e,t){var r=new Tt.MathNode("mglyph",[]);r.setAttribute("alt",e.alt);var n=F(e.height,t),a=0;if(e.totalheight.number>0&&(a=F(e.totalheight,t)-n,r.setAttribute("valign",V(-a))),r.setAttribute("height",V(n+a)),e.width.number>0){var i=F(e.width,t);r.setAttribute("width",V(i))}return r.setAttribute("src",e.src),r}}),ot({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=Ut(t[0],"size");if(r.settings.strict){var i="m"===n[1],o="mu"===a.value.unit;i?(o||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, not "+a.value.unit+" units"),"math"!==r.mode&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):o&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:a.value}},htmlBuilder:function(e,t){return Ke.makeGlue(e.dimension,t)},mathmlBuilder:function(e,t){var r=F(e.dimension,t);return new Tt.SpaceNode(r)}}),ot({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:a}},htmlBuilder:function(e,t){var r;"clap"===e.alignment?(r=Ke.makeSpan([],[wt(e.body,t)]),r=Ke.makeSpan(["inner"],[r],t)):r=Ke.makeSpan(["inner"],[wt(e.body,t)]);var n=Ke.makeSpan(["fix"],[]),a=Ke.makeSpan([e.alignment],[r,n],t),i=Ke.makeSpan(["strut"]);return i.style.height=V(a.height+a.depth),a.depth&&(i.style.verticalAlign=V(-a.depth)),a.children.unshift(i),a=Ke.makeSpan(["thinbox"],[a],t),Ke.makeSpan(["mord","vbox"],[a],t)},mathmlBuilder:function(e,t){var r=new Tt.MathNode("mpadded",[Rt(e.body,t)]);if("rlap"!==e.alignment){var n="llap"===e.alignment?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}}),ot({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(e,t){var r=e.funcName,n=e.parser,a=n.mode;n.switchMode("math");var i="\\("===r?"\\)":"$",o=n.parseExpression(!1,i);return n.expect(i),n.switchMode(a),{type:"styling",mode:n.mode,style:"text",body:o}}}),ot({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(e,t){throw new n("Mismatched "+e.funcName)}});var mn=function(e,t){switch(t.style.size){case x.DISPLAY.size:return e.display;case x.TEXT.size:return e.text;case x.SCRIPT.size:return e.script;case x.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};ot({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:function(e,t){return{type:"mathchoice",mode:e.parser.mode,display:ht(t[0]),text:ht(t[1]),script:ht(t[2]),scriptscript:ht(t[3])}},htmlBuilder:function(e,t){var r=mn(e,t),n=ft(r,t,!1);return Ke.makeFragment(n)},mathmlBuilder:function(e,t){var r=mn(e,t);return It(r,t)}});var cn=function(e,t,r,n,a,i,o){e=Ke.makeSpan([],[e]);var s,h,m,c=r&&l.isCharacterBox(r);if(t){var u=wt(t,n.havingStyle(a.sup()),n);h={elem:u,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-u.depth)}}if(r){var p=wt(r,n.havingStyle(a.sub()),n);s={elem:p,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-p.height)}}if(h&&s){var d=n.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+e.depth+o;m=Ke.makeVList({positionType:"bottom",positionData:d,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:V(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:V(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(s){var f=e.height-o;m=Ke.makeVList({positionType:"top",positionData:f,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:V(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e}]},n)}else{if(!h)return e;var g=e.depth+o;m=Ke.makeVList({positionType:"bottom",positionData:g,children:[{type:"elem",elem:e},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:V(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}var v=[m];if(s&&0!==i&&!c){var b=Ke.makeSpan(["mspace"],[],n);b.style.marginRight=V(i),v.unshift(b)}return Ke.makeSpan(["mop","op-limits"],v,n)},un=["\\smallint"],pn=function(e,t){var r,n,a,i=!1;"supsub"===e.type?(r=e.sup,n=e.sub,a=Ut(e.base,"op"),i=!0):a=Ut(e,"op");var o,s=t.style,h=!1;if(s.size===x.DISPLAY.size&&a.symbol&&!l.contains(un,a.name)&&(h=!0),a.symbol){var m=h?"Size2-Regular":"Size1-Regular",c="";if("\\oiint"!==a.name&&"\\oiiint"!==a.name||(c=a.name.substr(1),a.name="oiint"===c?"\\iint":"\\iiint"),o=Ke.makeSymbol(a.name,m,"math",t,["mop","op-symbol",h?"large-op":"small-op"]),c.length>0){var u=o.italic,p=Ke.staticSvg(c+"Size"+(h?"2":"1"),t);o=Ke.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:p,shift:h?.08:0}]},t),a.name="\\"+c,o.classes.unshift("mop"),o.italic=u}}else if(a.body){var d=ft(a.body,t,!0);1===d.length&&d[0]instanceof Z?(o=d[0]).classes[0]="mop":o=Ke.makeSpan(["mop"],d,t)}else{for(var f=[],g=1;g0){for(var s=a.body.map((function(e){var t=e.text;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e})),l=ft(s,t.withFont("mathrm"),!0),h=0;h=0?s.setAttribute("height",V(a)):(s.setAttribute("height",V(a)),s.setAttribute("depth",V(-a))),s.setAttribute("voffset",V(a)),s}});var yn=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];ot({type:"sizing",names:yn,props:{numArgs:0,allowedInText:!0},handler:function(e,t){var r=e.breakOnTokenText,n=e.funcName,a=e.parser,i=a.parseExpression(!1,r);return{type:"sizing",mode:a.mode,size:yn.indexOf(n)+1,body:i}},htmlBuilder:function(e,t){var r=t.havingSize(e.size);return bn(e.body,r,t)},mathmlBuilder:function(e,t){var r=t.havingSize(e.size),n=Nt(e.body,r),a=new Tt.MathNode("mstyle",n);return a.setAttribute("mathsize",V(r.sizeMultiplier)),a}}),ot({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:function(e,t,r){var n=e.parser,a=!1,i=!1,o=r[0]&&Ut(r[0],"ordgroup");if(o)for(var s="",l=0;lr.height+r.depth+i&&(i=(i+c-r.height-r.depth)/2);var u=l.height-r.height-i-h;r.style.paddingLeft=V(m);var p=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+u)},{type:"elem",elem:l},{type:"kern",size:h}]},t);if(e.index){var d=t.havingStyle(x.SCRIPTSCRIPT),f=wt(e.index,d,t),g=.6*(p.height-p.depth),v=Ke.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:f}]},t),b=Ke.makeSpan(["root"],[v]);return Ke.makeSpan(["mord","sqrt"],[b,p],t)}return Ke.makeSpan(["mord","sqrt"],[p],t)},mathmlBuilder:function(e,t){var r=e.body,n=e.index;return n?new Tt.MathNode("mroot",[Rt(r,t),Rt(n,t)]):new Tt.MathNode("msqrt",[Rt(r,t)])}});var xn={display:x.DISPLAY,text:x.TEXT,script:x.SCRIPT,scriptscript:x.SCRIPTSCRIPT};ot({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler:function(e,t){var r=e.breakOnTokenText,n=e.funcName,a=e.parser,i=a.parseExpression(!0,r),o=n.slice(1,n.length-5);return{type:"styling",mode:a.mode,style:o,body:i}},htmlBuilder:function(e,t){var r=xn[e.style],n=t.havingStyle(r).withFont("");return bn(e.body,n,t)},mathmlBuilder:function(e,t){var r=xn[e.style],n=t.havingStyle(r),a=Nt(e.body,n),i=new Tt.MathNode("mstyle",a),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var wn=function(e,t){var r=e.base;return r?"op"===r.type?r.limits&&(t.style.size===x.DISPLAY.size||r.alwaysHandleSupSub)?pn:null:"operatorname"===r.type?r.alwaysHandleSupSub&&(t.style.size===x.DISPLAY.size||r.limits)?vn:null:"accent"===r.type?l.isCharacterBox(r.base)?Wt:null:"horizBrace"===r.type&&!e.sub===r.isOver?ln:null:null};st({type:"supsub",htmlBuilder:function(e,t){var r=wn(e,t);if(r)return r(e,t);var n,a,i,o=e.base,s=e.sup,h=e.sub,m=wt(o,t),c=t.fontMetrics(),u=0,p=0,d=o&&l.isCharacterBox(o);if(s){var f=t.havingStyle(t.style.sup());n=wt(s,f,t),d||(u=m.height-f.fontMetrics().supDrop*f.sizeMultiplier/t.sizeMultiplier)}if(h){var g=t.havingStyle(t.style.sub());a=wt(h,g,t),d||(p=m.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}i=t.style===x.DISPLAY?c.sup1:t.style.cramped?c.sup3:c.sup2;var v,b=t.sizeMultiplier,y=V(.5/c.ptPerEm/b),w=null;if(a){var k=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(m instanceof Z||k)&&(w=V(-m.italic))}if(n&&a){u=Math.max(u,i,n.depth+.25*c.xHeight),p=Math.max(p,c.sub2);var S=4*c.defaultRuleThickness;if(u-n.depth-(a.height-p)0&&(u+=M,p-=M)}var z=[{type:"elem",elem:a,shift:p,marginRight:y,marginLeft:w},{type:"elem",elem:n,shift:-u,marginRight:y}];v=Ke.makeVList({positionType:"individualShift",children:z},t)}else if(a){p=Math.max(p,c.sub1,a.height-.8*c.xHeight);var A=[{type:"elem",elem:a,marginLeft:w,marginRight:y}];v=Ke.makeVList({positionType:"shift",positionData:p,children:A},t)}else{if(!n)throw new Error("supsub must have either sup or sub.");u=Math.max(u,i,n.depth+.25*c.xHeight),v=Ke.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:n,marginRight:y}]},t)}var T=yt(m,"right")||"mord";return Ke.makeSpan([T],[m,Ke.makeSpan(["msupsub"],[v])],t)},mathmlBuilder:function(e,t){var r,n=!1;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(n=!0,r=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var a,i=[Rt(e.base,t)];if(e.sub&&i.push(Rt(e.sub,t)),e.sup&&i.push(Rt(e.sup,t)),n)a=r?"mover":"munder";else if(e.sub)if(e.sup){var o=e.base;a=o&&"op"===o.type&&o.limits&&t.style===x.DISPLAY||o&&"operatorname"===o.type&&o.alwaysHandleSupSub&&(t.style===x.DISPLAY||o.limits)?"munderover":"msubsup"}else{var s=e.base;a=s&&"op"===s.type&&s.limits&&(t.style===x.DISPLAY||s.alwaysHandleSupSub)||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||t.style===x.DISPLAY)?"munder":"msub"}else{var l=e.base;a=l&&"op"===l.type&&l.limits&&(t.style===x.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===x.DISPLAY)?"mover":"msup"}return new Tt.MathNode(a,i)}}),st({type:"atom",htmlBuilder:function(e,t){return Ke.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder:function(e,t){var r=new Tt.MathNode("mo",[Bt(e.text,e.mode)]);if("bin"===e.family){var n=qt(e,t);"bold-italic"===n&&r.setAttribute("mathvariant",n)}else"punct"===e.family?r.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||r.setAttribute("stretchy","false");return r}});var kn={mi:"italic",mn:"normal",mtext:"normal"};st({type:"mathord",htmlBuilder:function(e,t){return Ke.makeOrd(e,t,"mathord")},mathmlBuilder:function(e,t){var r=new Tt.MathNode("mi",[Bt(e.text,e.mode,t)]),n=qt(e,t)||"italic";return n!==kn[r.type]&&r.setAttribute("mathvariant",n),r}}),st({type:"textord",htmlBuilder:function(e,t){return Ke.makeOrd(e,t,"textord")},mathmlBuilder:function(e,t){var r,n=Bt(e.text,e.mode,t),a=qt(e,t)||"normal";return r="text"===e.mode?new Tt.MathNode("mtext",[n]):/[0-9]/.test(e.text)?new Tt.MathNode("mn",[n]):"\\prime"===e.text?new Tt.MathNode("mo",[n]):new Tt.MathNode("mi",[n]),a!==kn[r.type]&&r.setAttribute("mathvariant",a),r}});var Sn={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Mn={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};st({type:"spacing",htmlBuilder:function(e,t){if(Mn.hasOwnProperty(e.text)){var r=Mn[e.text].className||"";if("text"===e.mode){var a=Ke.makeOrd(e,t,"textord");return a.classes.push(r),a}return Ke.makeSpan(["mspace",r],[Ke.mathsym(e.text,e.mode,t)],t)}if(Sn.hasOwnProperty(e.text))return Ke.makeSpan(["mspace",Sn[e.text]],[],t);throw new n('Unknown type of space "'+e.text+'"')},mathmlBuilder:function(e,t){if(!Mn.hasOwnProperty(e.text)){if(Sn.hasOwnProperty(e.text))return new Tt.MathNode("mspace");throw new n('Unknown type of space "'+e.text+'"')}return new Tt.MathNode("mtext",[new Tt.TextNode("\xa0")])}});var zn=function(){var e=new Tt.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};st({type:"tag",mathmlBuilder:function(e,t){var r=new Tt.MathNode("mtable",[new Tt.MathNode("mtr",[zn(),new Tt.MathNode("mtd",[It(e.body,t)]),zn(),new Tt.MathNode("mtd",[It(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var An={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Tn={"\\textbf":"textbf","\\textmd":"textmd"},Bn={"\\textit":"textit","\\textup":"textup"},Cn=function(e,t){var r=e.font;return r?An[r]?t.withTextFontFamily(An[r]):Tn[r]?t.withTextFontWeight(Tn[r]):t.withTextFontShape(Bn[r]):t};ot({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"text",mode:r.mode,body:ht(a),font:n}},htmlBuilder:function(e,t){var r=Cn(e,t),n=ft(e.body,r,!0);return Ke.makeSpan(["mord","text"],n,r)},mathmlBuilder:function(e,t){var r=Cn(e,t);return It(e.body,r)}}),ot({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){return{type:"underline",mode:e.parser.mode,body:t[0]}},htmlBuilder:function(e,t){var r=wt(e.body,t),n=Ke.makeLineSpan("underline-line",t),a=t.fontMetrics().defaultRuleThickness,i=Ke.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:a},{type:"elem",elem:n},{type:"kern",size:3*a},{type:"elem",elem:r}]},t);return Ke.makeSpan(["mord","underline"],[i],t)},mathmlBuilder:function(e,t){var r=new Tt.MathNode("mo",[new Tt.TextNode("\u203e")]);r.setAttribute("stretchy","true");var n=new Tt.MathNode("munder",[Rt(e.body,t),r]);return n.setAttribute("accentunder","true"),n}}),ot({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:function(e,t){return{type:"vcenter",mode:e.parser.mode,body:t[0]}},htmlBuilder:function(e,t){var r=wt(e.body,t),n=t.fontMetrics().axisHeight,a=.5*(r.height-n-(r.depth+n));return Ke.makeVList({positionType:"shift",positionData:a,children:[{type:"elem",elem:r}]},t)},mathmlBuilder:function(e,t){return new Tt.MathNode("mpadded",[Rt(e.body,t)],["vcenter"])}}),ot({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler:function(e,t,r){throw new n("\\verb ended by end of line instead of matching delimiter")},htmlBuilder:function(e,t){for(var r=qn(e),n=[],a=t.havingStyle(t.style.text()),i=0;i0;)this.endGroup()},t.has=function(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)},t.get=function(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]},t.set=function(e,t,r){if(void 0===r&&(r=!1),r){for(var n=0;n0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(e)&&(a[e]=this.current[e])}null==t?delete this.current[e]:this.current[e]=t},e}(),Hn=Hr;Er("\\noexpand",(function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}})),Er("\\expandafter",(function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}})),Er("\\@firstoftwo",(function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}})),Er("\\@secondoftwo",(function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}})),Er("\\@ifnextchar",(function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return 1===t[0].length&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}})),Er("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),Er("\\TextOrMath",(function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}}));var En={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Er("\\char",(function(e){var t,r=e.popToken(),a="";if("'"===r.text)t=8,r=e.popToken();else if('"'===r.text)t=16,r=e.popToken();else if("`"===r.text)if("\\"===(r=e.popToken()).text[0])a=r.text.charCodeAt(1);else{if("EOF"===r.text)throw new n("\\char` missing argument");a=r.text.charCodeAt(0)}else t=10;if(t){if(null==(a=En[r.text])||a>=t)throw new n("Invalid base-"+t+" digit "+r.text);for(var i;null!=(i=En[e.future().text])&&i":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Er("\\dots",(function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in Dn?t=Dn[r]:("\\not"===r.substr(0,4)||r in ae.math&&l.contains(["bin","rel"],ae.math[r].group))&&(t="\\dotsb"),t}));var Pn={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Er("\\dotso",(function(e){return e.future().text in Pn?"\\ldots\\,":"\\ldots"})),Er("\\dotsc",(function(e){var t=e.future().text;return t in Pn&&","!==t?"\\ldots\\,":"\\ldots"})),Er("\\cdots",(function(e){return e.future().text in Pn?"\\@cdots\\,":"\\@cdots"})),Er("\\dotsb","\\cdots"),Er("\\dotsm","\\cdots"),Er("\\dotsi","\\!\\cdots"),Er("\\dotsx","\\ldots\\,"),Er("\\DOTSI","\\relax"),Er("\\DOTSB","\\relax"),Er("\\DOTSX","\\relax"),Er("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),Er("\\,","\\tmspace+{3mu}{.1667em}"),Er("\\thinspace","\\,"),Er("\\>","\\mskip{4mu}"),Er("\\:","\\tmspace+{4mu}{.2222em}"),Er("\\medspace","\\:"),Er("\\;","\\tmspace+{5mu}{.2777em}"),Er("\\thickspace","\\;"),Er("\\!","\\tmspace-{3mu}{.1667em}"),Er("\\negthinspace","\\!"),Er("\\negmedspace","\\tmspace-{4mu}{.2222em}"),Er("\\negthickspace","\\tmspace-{5mu}{.277em}"),Er("\\enspace","\\kern.5em "),Er("\\enskip","\\hskip.5em\\relax"),Er("\\quad","\\hskip1em\\relax"),Er("\\qquad","\\hskip2em\\relax"),Er("\\tag","\\@ifstar\\tag@literal\\tag@paren"),Er("\\tag@paren","\\tag@literal{({#1})}"),Er("\\tag@literal",(function(e){if(e.macros.get("\\df@tag"))throw new n("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"})),Er("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),Er("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),Er("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),Er("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),Er("\\pmb","\\html@mathml{\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}{\\mathbf{#1}}"),Er("\\newline","\\\\\\relax"),Er("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Fn=V(T["Main-Regular"]["T".charCodeAt(0)][1]-.7*T["Main-Regular"]["A".charCodeAt(0)][1]);Er("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+Fn+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),Er("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+Fn+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),Er("\\hspace","\\@ifstar\\@hspacer\\@hspace"),Er("\\@hspace","\\hskip #1\\relax"),Er("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),Er("\\ordinarycolon",":"),Er("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),Er("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),Er("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),Er("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),Er("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),Er("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),Er("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),Er("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),Er("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),Er("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),Er("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),Er("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),Er("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),Er("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),Er("\u2237","\\dblcolon"),Er("\u2239","\\eqcolon"),Er("\u2254","\\coloneqq"),Er("\u2255","\\eqqcolon"),Er("\u2a74","\\Coloneqq"),Er("\\ratio","\\vcentcolon"),Er("\\coloncolon","\\dblcolon"),Er("\\colonequals","\\coloneqq"),Er("\\coloncolonequals","\\Coloneqq"),Er("\\equalscolon","\\eqqcolon"),Er("\\equalscoloncolon","\\Eqqcolon"),Er("\\colonminus","\\coloneq"),Er("\\coloncolonminus","\\Coloneq"),Er("\\minuscolon","\\eqcolon"),Er("\\minuscoloncolon","\\Eqcolon"),Er("\\coloncolonapprox","\\Colonapprox"),Er("\\coloncolonsim","\\Colonsim"),Er("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Er("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Er("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Er("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Er("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220c}}"),Er("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),Er("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),Er("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),Er("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),Er("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),Er("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),Er("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),Er("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),Er("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}"),Er("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}"),Er("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}"),Er("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}"),Er("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}"),Er("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}"),Er("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}"),Er("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}"),Er("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}"),Er("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}"),Er("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228a}"),Er("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2acb}"),Er("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228b}"),Er("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2acc}"),Er("\\imath","\\html@mathml{\\@imath}{\u0131}"),Er("\\jmath","\\html@mathml{\\@jmath}{\u0237}"),Er("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27e6}}"),Er("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27e7}}"),Er("\u27e6","\\llbracket"),Er("\u27e7","\\rrbracket"),Er("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}"),Er("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}"),Er("\u2983","\\lBrace"),Er("\u2984","\\rBrace"),Er("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29b5}}"),Er("\u29b5","\\minuso"),Er("\\darr","\\downarrow"),Er("\\dArr","\\Downarrow"),Er("\\Darr","\\Downarrow"),Er("\\lang","\\langle"),Er("\\rang","\\rangle"),Er("\\uarr","\\uparrow"),Er("\\uArr","\\Uparrow"),Er("\\Uarr","\\Uparrow"),Er("\\N","\\mathbb{N}"),Er("\\R","\\mathbb{R}"),Er("\\Z","\\mathbb{Z}"),Er("\\alef","\\aleph"),Er("\\alefsym","\\aleph"),Er("\\Alpha","\\mathrm{A}"),Er("\\Beta","\\mathrm{B}"),Er("\\bull","\\bullet"),Er("\\Chi","\\mathrm{X}"),Er("\\clubs","\\clubsuit"),Er("\\cnums","\\mathbb{C}"),Er("\\Complex","\\mathbb{C}"),Er("\\Dagger","\\ddagger"),Er("\\diamonds","\\diamondsuit"),Er("\\empty","\\emptyset"),Er("\\Epsilon","\\mathrm{E}"),Er("\\Eta","\\mathrm{H}"),Er("\\exist","\\exists"),Er("\\harr","\\leftrightarrow"),Er("\\hArr","\\Leftrightarrow"),Er("\\Harr","\\Leftrightarrow"),Er("\\hearts","\\heartsuit"),Er("\\image","\\Im"),Er("\\infin","\\infty"),Er("\\Iota","\\mathrm{I}"),Er("\\isin","\\in"),Er("\\Kappa","\\mathrm{K}"),Er("\\larr","\\leftarrow"),Er("\\lArr","\\Leftarrow"),Er("\\Larr","\\Leftarrow"),Er("\\lrarr","\\leftrightarrow"),Er("\\lrArr","\\Leftrightarrow"),Er("\\Lrarr","\\Leftrightarrow"),Er("\\Mu","\\mathrm{M}"),Er("\\natnums","\\mathbb{N}"),Er("\\Nu","\\mathrm{N}"),Er("\\Omicron","\\mathrm{O}"),Er("\\plusmn","\\pm"),Er("\\rarr","\\rightarrow"),Er("\\rArr","\\Rightarrow"),Er("\\Rarr","\\Rightarrow"),Er("\\real","\\Re"),Er("\\reals","\\mathbb{R}"),Er("\\Reals","\\mathbb{R}"),Er("\\Rho","\\mathrm{P}"),Er("\\sdot","\\cdot"),Er("\\sect","\\S"),Er("\\spades","\\spadesuit"),Er("\\sub","\\subset"),Er("\\sube","\\subseteq"),Er("\\supe","\\supseteq"),Er("\\Tau","\\mathrm{T}"),Er("\\thetasym","\\vartheta"),Er("\\weierp","\\wp"),Er("\\Zeta","\\mathrm{Z}"),Er("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),Er("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),Er("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),Er("\\bra","\\mathinner{\\langle{#1}|}"),Er("\\ket","\\mathinner{|{#1}\\rangle}"),Er("\\braket","\\mathinner{\\langle{#1}\\rangle}"),Er("\\Bra","\\left\\langle#1\\right|"),Er("\\Ket","\\left|#1\\right\\rangle"),Er("\\angln","{\\angl n}"),Er("\\blue","\\textcolor{##6495ed}{#1}"),Er("\\orange","\\textcolor{##ffa500}{#1}"),Er("\\pink","\\textcolor{##ff00af}{#1}"),Er("\\red","\\textcolor{##df0030}{#1}"),Er("\\green","\\textcolor{##28ae7b}{#1}"),Er("\\gray","\\textcolor{gray}{#1}"),Er("\\purple","\\textcolor{##9d38bd}{#1}"),Er("\\blueA","\\textcolor{##ccfaff}{#1}"),Er("\\blueB","\\textcolor{##80f6ff}{#1}"),Er("\\blueC","\\textcolor{##63d9ea}{#1}"),Er("\\blueD","\\textcolor{##11accd}{#1}"),Er("\\blueE","\\textcolor{##0c7f99}{#1}"),Er("\\tealA","\\textcolor{##94fff5}{#1}"),Er("\\tealB","\\textcolor{##26edd5}{#1}"),Er("\\tealC","\\textcolor{##01d1c1}{#1}"),Er("\\tealD","\\textcolor{##01a995}{#1}"),Er("\\tealE","\\textcolor{##208170}{#1}"),Er("\\greenA","\\textcolor{##b6ffb0}{#1}"),Er("\\greenB","\\textcolor{##8af281}{#1}"),Er("\\greenC","\\textcolor{##74cf70}{#1}"),Er("\\greenD","\\textcolor{##1fab54}{#1}"),Er("\\greenE","\\textcolor{##0d923f}{#1}"),Er("\\goldA","\\textcolor{##ffd0a9}{#1}"),Er("\\goldB","\\textcolor{##ffbb71}{#1}"),Er("\\goldC","\\textcolor{##ff9c39}{#1}"),Er("\\goldD","\\textcolor{##e07d10}{#1}"),Er("\\goldE","\\textcolor{##a75a05}{#1}"),Er("\\redA","\\textcolor{##fca9a9}{#1}"),Er("\\redB","\\textcolor{##ff8482}{#1}"),Er("\\redC","\\textcolor{##f9685d}{#1}"),Er("\\redD","\\textcolor{##e84d39}{#1}"),Er("\\redE","\\textcolor{##bc2612}{#1}"),Er("\\maroonA","\\textcolor{##ffbde0}{#1}"),Er("\\maroonB","\\textcolor{##ff92c6}{#1}"),Er("\\maroonC","\\textcolor{##ed5fa6}{#1}"),Er("\\maroonD","\\textcolor{##ca337c}{#1}"),Er("\\maroonE","\\textcolor{##9e034e}{#1}"),Er("\\purpleA","\\textcolor{##ddd7ff}{#1}"),Er("\\purpleB","\\textcolor{##c6b9fc}{#1}"),Er("\\purpleC","\\textcolor{##aa87ff}{#1}"),Er("\\purpleD","\\textcolor{##7854ab}{#1}"),Er("\\purpleE","\\textcolor{##543b78}{#1}"),Er("\\mintA","\\textcolor{##f5f9e8}{#1}"),Er("\\mintB","\\textcolor{##edf2df}{#1}"),Er("\\mintC","\\textcolor{##e0e5cc}{#1}"),Er("\\grayA","\\textcolor{##f6f7f7}{#1}"),Er("\\grayB","\\textcolor{##f0f1f2}{#1}"),Er("\\grayC","\\textcolor{##e3e5e6}{#1}"),Er("\\grayD","\\textcolor{##d6d8da}{#1}"),Er("\\grayE","\\textcolor{##babec2}{#1}"),Er("\\grayF","\\textcolor{##888d93}{#1}"),Er("\\grayG","\\textcolor{##626569}{#1}"),Er("\\grayH","\\textcolor{##3b3e40}{#1}"),Er("\\grayI","\\textcolor{##21242c}{#1}"),Er("\\kaBlue","\\textcolor{##314453}{#1}"),Er("\\kaGreen","\\textcolor{##71B307}{#1}");var Vn={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},Gn=function(){function e(e,t,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new On(Hn,t.macros),this.mode=r,this.stack=[]}var t=e.prototype;return t.feed=function(e){this.lexer=new Rn(e,this.settings)},t.switchMode=function(e){this.mode=e},t.beginGroup=function(){this.macros.beginGroup()},t.endGroup=function(){this.macros.endGroup()},t.endGroups=function(){this.macros.endGroups()},t.future=function(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]},t.popToken=function(){return this.future(),this.stack.pop()},t.pushToken=function(e){this.stack.push(e)},t.pushTokens=function(e){var t;(t=this.stack).push.apply(t,e)},t.scanArgument=function(e){var t,r,n;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken();var a=this.consumeArg(["]"]);n=a.tokens,r=a.end}else{var i=this.consumeArg();n=i.tokens,t=i.start,r=i.end}return this.pushToken(new Dr("EOF",r.loc)),this.pushTokens(n),t.range(r,"")},t.consumeSpaces=function(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}},t.consumeArg=function(e){var t=[],r=e&&e.length>0;r||this.consumeSpaces();var a,i=this.future(),o=0,s=0;do{if(a=this.popToken(),t.push(a),"{"===a.text)++o;else if("}"===a.text){if(-1===--o)throw new n("Extra }",a)}else if("EOF"===a.text)throw new n("Unexpected end of input in a macro argument, expected '"+(e&&r?e[s]:"}")+"'",a);if(e&&r)if((0===o||1===o&&"{"===e[s])&&a.text===e[s]){if(++s===e.length){t.splice(-s,s);break}}else s=0}while(0!==o||r);return"{"===i.text&&"}"===t[t.length-1].text&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:a}},t.consumeArgs=function(e,t){if(t){if(t.length!==e+1)throw new n("The length of delimiters doesn't match the number of args!");for(var r=t[0],a=0;athis.settings.maxExpand)throw new n("Too many expansions: infinite loop or need to increase maxExpand setting");var i=a.tokens,o=this.consumeArgs(a.numArgs,a.delimiters);if(a.numArgs)for(var s=(i=i.slice()).length-1;s>=0;--s){var l=i[s];if("#"===l.text){if(0===s)throw new n("Incomplete placeholder at end of macro body",l);if("#"===(l=i[--s]).text)i.splice(s+1,1);else{if(!/^[1-9]$/.test(l.text))throw new n("Not a valid argument number",l);var h;(h=i).splice.apply(h,[s,2].concat(o[+l.text-1]))}}}return this.pushTokens(i),i},t.expandAfterFuture=function(){return this.expandOnce(),this.future()},t.expandNextToken=function(){for(;;){var e=this.expandOnce();if(e instanceof Dr)return e.treatAsRelax&&(e.text="\\relax"),this.stack.pop()}throw new Error},t.expandMacro=function(e){return this.macros.has(e)?this.expandTokens([new Dr(e)]):void 0},t.expandTokens=function(e){var t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;){var n=this.expandOnce(!0);n instanceof Dr&&(n.treatAsRelax&&(n.noexpand=!1,n.treatAsRelax=!1),t.push(this.stack.pop()))}return t},t.expandMacroAsText=function(e){var t=this.expandMacro(e);return t?t.map((function(e){return e.text})).join(""):t},t._getExpansion=function(e){var t=this.macros.get(e);if(null==t)return t;if(1===e.length){var r=this.lexer.catcodes[e];if(null!=r&&13!==r)return}var n="function"==typeof t?t(this):t;if("string"==typeof n){var a=0;if(-1!==n.indexOf("#"))for(var i=n.replace(/##/g,"");-1!==i.indexOf("#"+(a+1));)++a;for(var o=new Rn(n,this.settings),s=[],l=o.lex();"EOF"!==l.text;)s.push(l),l=o.lex();return s.reverse(),{tokens:s,numArgs:a}}return n},t.isDefined=function(e){return this.macros.has(e)||Nn.hasOwnProperty(e)||ae.math.hasOwnProperty(e)||ae.text.hasOwnProperty(e)||Vn.hasOwnProperty(e)},t.isExpandable=function(e){var t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:Nn.hasOwnProperty(e)&&!Nn[e].primitive},e}(),Un={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030c":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030a":{text:"\\r",math:"\\mathring"},"\u030b":{text:"\\H"},"\u0327":{text:"\\c"}},Yn={"\xe1":"a\u0301","\xe0":"a\u0300","\xe4":"a\u0308","\u01df":"a\u0308\u0304","\xe3":"a\u0303","\u0101":"a\u0304","\u0103":"a\u0306","\u1eaf":"a\u0306\u0301","\u1eb1":"a\u0306\u0300","\u1eb5":"a\u0306\u0303","\u01ce":"a\u030c","\xe2":"a\u0302","\u1ea5":"a\u0302\u0301","\u1ea7":"a\u0302\u0300","\u1eab":"a\u0302\u0303","\u0227":"a\u0307","\u01e1":"a\u0307\u0304","\xe5":"a\u030a","\u01fb":"a\u030a\u0301","\u1e03":"b\u0307","\u0107":"c\u0301","\u1e09":"c\u0327\u0301","\u010d":"c\u030c","\u0109":"c\u0302","\u010b":"c\u0307","\xe7":"c\u0327","\u010f":"d\u030c","\u1e0b":"d\u0307","\u1e11":"d\u0327","\xe9":"e\u0301","\xe8":"e\u0300","\xeb":"e\u0308","\u1ebd":"e\u0303","\u0113":"e\u0304","\u1e17":"e\u0304\u0301","\u1e15":"e\u0304\u0300","\u0115":"e\u0306","\u1e1d":"e\u0327\u0306","\u011b":"e\u030c","\xea":"e\u0302","\u1ebf":"e\u0302\u0301","\u1ec1":"e\u0302\u0300","\u1ec5":"e\u0302\u0303","\u0117":"e\u0307","\u0229":"e\u0327","\u1e1f":"f\u0307","\u01f5":"g\u0301","\u1e21":"g\u0304","\u011f":"g\u0306","\u01e7":"g\u030c","\u011d":"g\u0302","\u0121":"g\u0307","\u0123":"g\u0327","\u1e27":"h\u0308","\u021f":"h\u030c","\u0125":"h\u0302","\u1e23":"h\u0307","\u1e29":"h\u0327","\xed":"i\u0301","\xec":"i\u0300","\xef":"i\u0308","\u1e2f":"i\u0308\u0301","\u0129":"i\u0303","\u012b":"i\u0304","\u012d":"i\u0306","\u01d0":"i\u030c","\xee":"i\u0302","\u01f0":"j\u030c","\u0135":"j\u0302","\u1e31":"k\u0301","\u01e9":"k\u030c","\u0137":"k\u0327","\u013a":"l\u0301","\u013e":"l\u030c","\u013c":"l\u0327","\u1e3f":"m\u0301","\u1e41":"m\u0307","\u0144":"n\u0301","\u01f9":"n\u0300","\xf1":"n\u0303","\u0148":"n\u030c","\u1e45":"n\u0307","\u0146":"n\u0327","\xf3":"o\u0301","\xf2":"o\u0300","\xf6":"o\u0308","\u022b":"o\u0308\u0304","\xf5":"o\u0303","\u1e4d":"o\u0303\u0301","\u1e4f":"o\u0303\u0308","\u022d":"o\u0303\u0304","\u014d":"o\u0304","\u1e53":"o\u0304\u0301","\u1e51":"o\u0304\u0300","\u014f":"o\u0306","\u01d2":"o\u030c","\xf4":"o\u0302","\u1ed1":"o\u0302\u0301","\u1ed3":"o\u0302\u0300","\u1ed7":"o\u0302\u0303","\u022f":"o\u0307","\u0231":"o\u0307\u0304","\u0151":"o\u030b","\u1e55":"p\u0301","\u1e57":"p\u0307","\u0155":"r\u0301","\u0159":"r\u030c","\u1e59":"r\u0307","\u0157":"r\u0327","\u015b":"s\u0301","\u1e65":"s\u0301\u0307","\u0161":"s\u030c","\u1e67":"s\u030c\u0307","\u015d":"s\u0302","\u1e61":"s\u0307","\u015f":"s\u0327","\u1e97":"t\u0308","\u0165":"t\u030c","\u1e6b":"t\u0307","\u0163":"t\u0327","\xfa":"u\u0301","\xf9":"u\u0300","\xfc":"u\u0308","\u01d8":"u\u0308\u0301","\u01dc":"u\u0308\u0300","\u01d6":"u\u0308\u0304","\u01da":"u\u0308\u030c","\u0169":"u\u0303","\u1e79":"u\u0303\u0301","\u016b":"u\u0304","\u1e7b":"u\u0304\u0308","\u016d":"u\u0306","\u01d4":"u\u030c","\xfb":"u\u0302","\u016f":"u\u030a","\u0171":"u\u030b","\u1e7d":"v\u0303","\u1e83":"w\u0301","\u1e81":"w\u0300","\u1e85":"w\u0308","\u0175":"w\u0302","\u1e87":"w\u0307","\u1e98":"w\u030a","\u1e8d":"x\u0308","\u1e8b":"x\u0307","\xfd":"y\u0301","\u1ef3":"y\u0300","\xff":"y\u0308","\u1ef9":"y\u0303","\u0233":"y\u0304","\u0177":"y\u0302","\u1e8f":"y\u0307","\u1e99":"y\u030a","\u017a":"z\u0301","\u017e":"z\u030c","\u1e91":"z\u0302","\u017c":"z\u0307","\xc1":"A\u0301","\xc0":"A\u0300","\xc4":"A\u0308","\u01de":"A\u0308\u0304","\xc3":"A\u0303","\u0100":"A\u0304","\u0102":"A\u0306","\u1eae":"A\u0306\u0301","\u1eb0":"A\u0306\u0300","\u1eb4":"A\u0306\u0303","\u01cd":"A\u030c","\xc2":"A\u0302","\u1ea4":"A\u0302\u0301","\u1ea6":"A\u0302\u0300","\u1eaa":"A\u0302\u0303","\u0226":"A\u0307","\u01e0":"A\u0307\u0304","\xc5":"A\u030a","\u01fa":"A\u030a\u0301","\u1e02":"B\u0307","\u0106":"C\u0301","\u1e08":"C\u0327\u0301","\u010c":"C\u030c","\u0108":"C\u0302","\u010a":"C\u0307","\xc7":"C\u0327","\u010e":"D\u030c","\u1e0a":"D\u0307","\u1e10":"D\u0327","\xc9":"E\u0301","\xc8":"E\u0300","\xcb":"E\u0308","\u1ebc":"E\u0303","\u0112":"E\u0304","\u1e16":"E\u0304\u0301","\u1e14":"E\u0304\u0300","\u0114":"E\u0306","\u1e1c":"E\u0327\u0306","\u011a":"E\u030c","\xca":"E\u0302","\u1ebe":"E\u0302\u0301","\u1ec0":"E\u0302\u0300","\u1ec4":"E\u0302\u0303","\u0116":"E\u0307","\u0228":"E\u0327","\u1e1e":"F\u0307","\u01f4":"G\u0301","\u1e20":"G\u0304","\u011e":"G\u0306","\u01e6":"G\u030c","\u011c":"G\u0302","\u0120":"G\u0307","\u0122":"G\u0327","\u1e26":"H\u0308","\u021e":"H\u030c","\u0124":"H\u0302","\u1e22":"H\u0307","\u1e28":"H\u0327","\xcd":"I\u0301","\xcc":"I\u0300","\xcf":"I\u0308","\u1e2e":"I\u0308\u0301","\u0128":"I\u0303","\u012a":"I\u0304","\u012c":"I\u0306","\u01cf":"I\u030c","\xce":"I\u0302","\u0130":"I\u0307","\u0134":"J\u0302","\u1e30":"K\u0301","\u01e8":"K\u030c","\u0136":"K\u0327","\u0139":"L\u0301","\u013d":"L\u030c","\u013b":"L\u0327","\u1e3e":"M\u0301","\u1e40":"M\u0307","\u0143":"N\u0301","\u01f8":"N\u0300","\xd1":"N\u0303","\u0147":"N\u030c","\u1e44":"N\u0307","\u0145":"N\u0327","\xd3":"O\u0301","\xd2":"O\u0300","\xd6":"O\u0308","\u022a":"O\u0308\u0304","\xd5":"O\u0303","\u1e4c":"O\u0303\u0301","\u1e4e":"O\u0303\u0308","\u022c":"O\u0303\u0304","\u014c":"O\u0304","\u1e52":"O\u0304\u0301","\u1e50":"O\u0304\u0300","\u014e":"O\u0306","\u01d1":"O\u030c","\xd4":"O\u0302","\u1ed0":"O\u0302\u0301","\u1ed2":"O\u0302\u0300","\u1ed6":"O\u0302\u0303","\u022e":"O\u0307","\u0230":"O\u0307\u0304","\u0150":"O\u030b","\u1e54":"P\u0301","\u1e56":"P\u0307","\u0154":"R\u0301","\u0158":"R\u030c","\u1e58":"R\u0307","\u0156":"R\u0327","\u015a":"S\u0301","\u1e64":"S\u0301\u0307","\u0160":"S\u030c","\u1e66":"S\u030c\u0307","\u015c":"S\u0302","\u1e60":"S\u0307","\u015e":"S\u0327","\u0164":"T\u030c","\u1e6a":"T\u0307","\u0162":"T\u0327","\xda":"U\u0301","\xd9":"U\u0300","\xdc":"U\u0308","\u01d7":"U\u0308\u0301","\u01db":"U\u0308\u0300","\u01d5":"U\u0308\u0304","\u01d9":"U\u0308\u030c","\u0168":"U\u0303","\u1e78":"U\u0303\u0301","\u016a":"U\u0304","\u1e7a":"U\u0304\u0308","\u016c":"U\u0306","\u01d3":"U\u030c","\xdb":"U\u0302","\u016e":"U\u030a","\u0170":"U\u030b","\u1e7c":"V\u0303","\u1e82":"W\u0301","\u1e80":"W\u0300","\u1e84":"W\u0308","\u0174":"W\u0302","\u1e86":"W\u0307","\u1e8c":"X\u0308","\u1e8a":"X\u0307","\xdd":"Y\u0301","\u1ef2":"Y\u0300","\u0178":"Y\u0308","\u1ef8":"Y\u0303","\u0232":"Y\u0304","\u0176":"Y\u0302","\u1e8e":"Y\u0307","\u0179":"Z\u0301","\u017d":"Z\u030c","\u1e90":"Z\u0302","\u017b":"Z\u0307","\u03ac":"\u03b1\u0301","\u1f70":"\u03b1\u0300","\u1fb1":"\u03b1\u0304","\u1fb0":"\u03b1\u0306","\u03ad":"\u03b5\u0301","\u1f72":"\u03b5\u0300","\u03ae":"\u03b7\u0301","\u1f74":"\u03b7\u0300","\u03af":"\u03b9\u0301","\u1f76":"\u03b9\u0300","\u03ca":"\u03b9\u0308","\u0390":"\u03b9\u0308\u0301","\u1fd2":"\u03b9\u0308\u0300","\u1fd1":"\u03b9\u0304","\u1fd0":"\u03b9\u0306","\u03cc":"\u03bf\u0301","\u1f78":"\u03bf\u0300","\u03cd":"\u03c5\u0301","\u1f7a":"\u03c5\u0300","\u03cb":"\u03c5\u0308","\u03b0":"\u03c5\u0308\u0301","\u1fe2":"\u03c5\u0308\u0300","\u1fe1":"\u03c5\u0304","\u1fe0":"\u03c5\u0306","\u03ce":"\u03c9\u0301","\u1f7c":"\u03c9\u0300","\u038e":"\u03a5\u0301","\u1fea":"\u03a5\u0300","\u03ab":"\u03a5\u0308","\u1fe9":"\u03a5\u0304","\u1fe8":"\u03a5\u0306","\u038f":"\u03a9\u0301","\u1ffa":"\u03a9\u0300"},Xn=function(){function e(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Gn(e,t,this.mode),this.settings=t,this.leftrightDepth=0}var t=e.prototype;return t.expect=function(e,t){if(void 0===t&&(t=!0),this.fetch().text!==e)throw new n("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()},t.consume=function(){this.nextToken=null},t.fetch=function(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken},t.switchMode=function(e){this.mode=e,this.gullet.switchMode(e)},t.parse=function(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}},t.subparse=function(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Dr("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r},t.parseExpression=function(t,r){for(var n=[];;){"math"===this.mode&&this.consumeSpaces();var a=this.fetch();if(-1!==e.endOfExpression.indexOf(a.text))break;if(r&&a.text===r)break;if(t&&Nn[a.text]&&Nn[a.text].infix)break;var i=this.parseAtom(r);if(!i)break;"internal"!==i.type&&n.push(i)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)},t.handleInfixNodes=function(e){for(var t,r=-1,a=0;a=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var s,l=ae[this.mode][t].group,h=Lr.range(e);if(te.hasOwnProperty(l)){var m=l;s={type:"atom",mode:this.mode,family:m,loc:h,text:t}}else s={type:l,mode:this.mode,loc:h,text:t};i=s}else{if(!(t.charCodeAt(0)>=128))return null;this.settings.strict&&(S(t.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",e)),i={type:"textord",mode:"text",loc:Lr.range(e),text:t}}if(this.consume(),o)for(var c=0;c +Afl_instrument (ocaml.Afl_instrument)

Module Afl_instrument

Instrumentation for afl-fuzz.

val instrument_function : Cmm.expression -> Debuginfo.t -> Cmm.expression
val instrument_initialiser : + Cmm.expression -> + (unit -> Debuginfo.t) -> + Cmm.expression
diff --git a/ocaml/Alias_analysis/index.html b/ocaml/Alias_analysis/index.html new file mode 100644 index 00000000..4d7960ec --- /dev/null +++ b/ocaml/Alias_analysis/index.html @@ -0,0 +1,10 @@ + +Alias_analysis (ocaml.Alias_analysis)

Module Alias_analysis

type allocation_point =
  1. | Symbol of Symbol.t
  2. | Variable of Variable.t
type allocated_const =
  1. | Normal of Allocated_const.t
  2. | Array of Lambda.array_kind * Asttypes.mutable_flag * Variable.t list
  3. | Duplicate_array of Lambda.array_kind * Asttypes.mutable_flag * Variable.t
type constant_defining_value =
  1. | Allocated_const of allocated_const
  2. | Block of Tag.t * Variable.t list
  3. | Set_of_closures of Flambda.set_of_closures
  4. | Project_closure of Flambda.project_closure
  5. | Move_within_set_of_closures of Flambda.move_within_set_of_closures
  6. | Project_var of Flambda.project_var
  7. | Field of Variable.t * int
  8. | Symbol_field of Symbol.t * int
  9. | Const of Flambda.const
  10. | Symbol of Symbol.t
  11. | Variable of Variable.t
type initialize_symbol_field = Variable.t option

Simple alias analysis working over information about which symbols have been assigned to variables; and which constants have been assigned to symbols. The return value gives the assignment of the defining values of constants to variables. Also see comments for Lift_constants, whose input feeds this pass.

Variables found to be ill-typed accesses to other constants, for example arising from dead code, will be pointed at the_dead_constant.

val print_constant_defining_value : + Stdlib.Format.formatter -> + constant_defining_value -> + unit
diff --git a/ocaml/Allocated_const/index.html b/ocaml/Allocated_const/index.html new file mode 100644 index 00000000..a8aed038 --- /dev/null +++ b/ocaml/Allocated_const/index.html @@ -0,0 +1,2 @@ + +Allocated_const (ocaml.Allocated_const)

Module Allocated_const

Constants that are always allocated (possibly statically). Blocks are not included here since they are always encoded using Prim (Pmakeblock, ...).

type t =
  1. | Float of float
  2. | Int32 of int32
  3. | Int64 of int64
  4. | Nativeint of nativeint
  5. | Float_array of float list
  6. | Immutable_float_array of float list
  7. | String of string
  8. | Immutable_string of string
val compare_floats : float -> float -> int
val compare : t -> t -> int
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Annot/index.html b/ocaml/Annot/index.html new file mode 100644 index 00000000..59bac179 --- /dev/null +++ b/ocaml/Annot/index.html @@ -0,0 +1,2 @@ + +Annot (ocaml.Annot)

Module Annot

type call =
  1. | Tail
  2. | Stack
  3. | Inline
type ident =
  1. | Iref_internal of Location.t
  2. | Iref_external
  3. | Idef of Location.t
diff --git a/ocaml/Arch/index.html b/ocaml/Arch/index.html new file mode 100644 index 00000000..27551587 --- /dev/null +++ b/ocaml/Arch/index.html @@ -0,0 +1,14 @@ + +Arch (ocaml.Arch)

Module Arch

val command_line_options : (string * Stdlib.Arg.spec * string) list
type addressing_mode =
  1. | Ibased of string * int
  2. | Iindexed of int
  3. | Iindexed2 of int
  4. | Iscaled of int * int
  5. | Iindexed2scaled of int * int
type specific_operation =
  1. | Ilea of addressing_mode
  2. | Istore_int of nativeint * addressing_mode * bool
  3. | Ioffset_loc of int * addressing_mode
  4. | Ifloatarithmem of float_operation * addressing_mode
  5. | Ibswap of int
  6. | Isqrtf
  7. | Ifloatsqrtf of addressing_mode
  8. | Isextend32
  9. | Izextend32
and float_operation =
  1. | Ifloatadd
  2. | Ifloatsub
  3. | Ifloatmul
  4. | Ifloatdiv
val big_endian : bool
val size_addr : int
val size_int : int
val size_float : int
val allow_unaligned_access : bool
val division_crashes_on_overflow : bool
val identity_addressing : addressing_mode
val offset_addressing : addressing_mode -> int -> addressing_mode
val num_args_addressing : addressing_mode -> int
val print_addressing : + (Stdlib.Format.formatter -> 'a -> unit) -> + addressing_mode -> + Stdlib.Format.formatter -> + 'a array -> + unit
val print_specific_operation : + (Stdlib.Format.formatter -> 'a -> unit) -> + specific_operation -> + Stdlib.Format.formatter -> + 'a array -> + unit
val win64 : bool
val operation_is_pure : specific_operation -> bool
val operation_can_raise : specific_operation -> bool
val float_cond_and_need_swap : + Lambda.float_comparison -> + X86_ast.float_condition * bool
diff --git a/ocaml/Arg_helper/Make/argument-1-S/Key/Map/index.html b/ocaml/Arg_helper/Make/argument-1-S/Key/Map/index.html new file mode 100644 index 00000000..7ec0c6da --- /dev/null +++ b/ocaml/Arg_helper/Make/argument-1-S/Key/Map/index.html @@ -0,0 +1,8 @@ + +Map (ocaml.Arg_helper.Make.S.Key.Map)

Module Key.Map

Maps

type key = t

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Arg_helper/Make/argument-1-S/Key/index.html b/ocaml/Arg_helper/Make/argument-1-S/Key/index.html new file mode 100644 index 00000000..5ebe3867 --- /dev/null +++ b/ocaml/Arg_helper/Make/argument-1-S/Key/index.html @@ -0,0 +1,2 @@ + +Key (ocaml.Arg_helper.Make.S.Key)

Module S.Key

type t
val of_string : string -> t

The textual representation of a key must not contain '=' or ','.

module Map : Map.S with type key = t
diff --git a/ocaml/Arg_helper/Make/argument-1-S/Value/index.html b/ocaml/Arg_helper/Make/argument-1-S/Value/index.html new file mode 100644 index 00000000..5748a7df --- /dev/null +++ b/ocaml/Arg_helper/Make/argument-1-S/Value/index.html @@ -0,0 +1,2 @@ + +Value (ocaml.Arg_helper.Make.S.Value)

Module S.Value

type t
val of_string : string -> t

The textual representation of a value must not contain ','.

diff --git a/ocaml/Arg_helper/Make/argument-1-S/index.html b/ocaml/Arg_helper/Make/argument-1-S/index.html new file mode 100644 index 00000000..3b2e3dc1 --- /dev/null +++ b/ocaml/Arg_helper/Make/argument-1-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Arg_helper.Make.S)

Parameter Make.S

module Key : sig ... end
module Value : sig ... end
diff --git a/ocaml/Arg_helper/Make/index.html b/ocaml/Arg_helper/Make/index.html new file mode 100644 index 00000000..5d608895 --- /dev/null +++ b/ocaml/Arg_helper/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Arg_helper.Make)

Module Arg_helper.Make

Parameters

module S : sig ... end

Signature

type parsed
val default : S.Value.t -> parsed
val set_base_default : S.Value.t -> parsed -> parsed
val add_base_override : S.Key.t -> S.Value.t -> parsed -> parsed
val reset_base_overrides : parsed -> parsed
val set_user_default : S.Value.t -> parsed -> parsed
val add_user_override : S.Key.t -> S.Value.t -> parsed -> parsed
val parse : string -> string -> parsed ref -> unit
type parse_result =
  1. | Ok
  2. | Parse_failed of exn
val parse_no_error : string -> parsed ref -> parse_result
val get : key:S.Key.t -> parsed -> S.Value.t
diff --git a/ocaml/Arg_helper/index.html b/ocaml/Arg_helper/index.html new file mode 100644 index 00000000..064c35b5 --- /dev/null +++ b/ocaml/Arg_helper/index.html @@ -0,0 +1,2 @@ + +Arg_helper (ocaml.Arg_helper)

Module Arg_helper

Decipher command line arguments of the form <value> | <key>=<value>,...

(as used for example for the specification of inlining parameters varying by simplification round).

Warning: this module is unstable and part of compiler-libs.

module Make (S : sig ... end) : sig ... end
diff --git a/ocaml/Asmgen/index.html b/ocaml/Asmgen/index.html new file mode 100644 index 00000000..1a665760 --- /dev/null +++ b/ocaml/Asmgen/index.html @@ -0,0 +1,20 @@ + +Asmgen (ocaml.Asmgen)

Module Asmgen

From Lambda to assembly code

type middle_end = + backend:(module Backend_intf.S) -> + prefixname:string -> + ppf_dump:Stdlib.Format.formatter -> + Lambda.program -> + Clambda.with_constants

The type of converters from Lambda to Clambda.

val compile_implementation : + ?toplevel:(string -> bool) -> + backend:(module Backend_intf.S) -> + prefixname:string -> + middle_end:middle_end -> + ppf_dump:Stdlib.Format.formatter -> + Lambda.program -> + unit

Compile an implementation from Lambda using the given middle end.

val compile_implementation_linear : string -> progname:string -> unit
val compile_phrase : ppf_dump:Stdlib.Format.formatter -> Cmm.phrase -> unit
type error =
  1. | Assembler_error of string
  2. | Mismatched_for_pack of string option
  3. | Asm_generation of string * Emitaux.error
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
val compile_unit : + output_prefix:string -> + asm_filename:string -> + keep_asm:bool -> + obj_filename:string -> + (unit -> unit) -> + unit
diff --git a/ocaml/Asmlibrarian/index.html b/ocaml/Asmlibrarian/index.html new file mode 100644 index 00000000..1d72cc5e --- /dev/null +++ b/ocaml/Asmlibrarian/index.html @@ -0,0 +1,2 @@ + +Asmlibrarian (ocaml.Asmlibrarian)

Module Asmlibrarian

val create_archive : string list -> string -> unit
type error =
  1. | File_not_found of string
  2. | Archiver_error of string
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Asmlink/index.html b/ocaml/Asmlink/index.html new file mode 100644 index 00000000..68e91267 --- /dev/null +++ b/ocaml/Asmlink/index.html @@ -0,0 +1,10 @@ + +Asmlink (ocaml.Asmlink)

Module Asmlink

val call_linker_shared : string list -> string -> unit
val reset : unit -> unit
val check_consistency : + Misc.filepath -> + Cmx_format.unit_infos -> + Stdlib.Digest.t -> + unit
val extract_crc_interfaces : unit -> Misc.crcs
val extract_crc_implementations : unit -> Misc.crcs
type error =
  1. | File_not_found of Misc.filepath
  2. | Not_an_object_file of Misc.filepath
  3. | Missing_implementations of (Misc.modname * string list) list
  4. | Inconsistent_interface of Misc.modname * Misc.filepath * Misc.filepath
  5. | Inconsistent_implementation of Misc.modname * Misc.filepath * Misc.filepath
  6. | Assembler_error of Misc.filepath
  7. | Linking_error of int
  8. | Multiple_definition of Misc.modname * Misc.filepath * Misc.filepath
  9. | Missing_cmx of Misc.filepath * Misc.modname
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Asmpackager/index.html b/ocaml/Asmpackager/index.html new file mode 100644 index 00000000..e96b1df0 --- /dev/null +++ b/ocaml/Asmpackager/index.html @@ -0,0 +1,8 @@ + +Asmpackager (ocaml.Asmpackager)

Module Asmpackager

val package_files : + ppf_dump:Stdlib.Format.formatter -> + Env.t -> + string list -> + string -> + backend:(module Backend_intf.S) -> + unit
type error =
  1. | Illegal_renaming of string * string * string
  2. | Forward_reference of string * string
  3. | Wrong_for_pack of string * string
  4. | Linking_error
  5. | Assembler_error of string
  6. | File_not_found of string
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Ast_helper/Attr/index.html b/ocaml/Ast_helper/Attr/index.html new file mode 100644 index 00000000..735885f6 --- /dev/null +++ b/ocaml/Ast_helper/Attr/index.html @@ -0,0 +1,2 @@ + +Attr (ocaml.Ast_helper.Attr)

Module Ast_helper.Attr

Attributes

diff --git a/ocaml/Ast_helper/Cf/index.html b/ocaml/Ast_helper/Cf/index.html new file mode 100644 index 00000000..15f75a84 --- /dev/null +++ b/ocaml/Ast_helper/Cf/index.html @@ -0,0 +1,44 @@ + +Cf (ocaml.Ast_helper.Cf)

Module Ast_helper.Cf

Class fields

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + Parsetree.class_field_desc -> + Parsetree.class_field
val inherit_ : + ?loc:loc -> + ?attrs:attrs -> + Asttypes.override_flag -> + Parsetree.class_expr -> + str option -> + Parsetree.class_field
val val_ : + ?loc:loc -> + ?attrs:attrs -> + str -> + Asttypes.mutable_flag -> + Parsetree.class_field_kind -> + Parsetree.class_field
val method_ : + ?loc:loc -> + ?attrs:attrs -> + str -> + Asttypes.private_flag -> + Parsetree.class_field_kind -> + Parsetree.class_field
val constraint_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.core_type -> + Parsetree.core_type -> + Parsetree.class_field
val initializer_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.class_field
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.class_field
val attribute : ?loc:loc -> Parsetree.attribute -> Parsetree.class_field
diff --git a/ocaml/Ast_helper/Ci/index.html b/ocaml/Ast_helper/Ci/index.html new file mode 100644 index 00000000..f2751932 --- /dev/null +++ b/ocaml/Ast_helper/Ci/index.html @@ -0,0 +1,12 @@ + +Ci (ocaml.Ast_helper.Ci)

Module Ast_helper.Ci

Classes

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?text:Docstrings.text -> + ?virt:Asttypes.virtual_flag -> + ?params: + (Parsetree.core_type * (Asttypes.variance * Asttypes.injectivity)) list -> + str -> + 'a -> + 'a Parsetree.class_infos
diff --git a/ocaml/Ast_helper/Cl/index.html b/ocaml/Ast_helper/Cl/index.html new file mode 100644 index 00000000..ce43182a --- /dev/null +++ b/ocaml/Ast_helper/Cl/index.html @@ -0,0 +1,47 @@ + +Cl (ocaml.Ast_helper.Cl)

Module Ast_helper.Cl

Class expressions

val mk : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.class_expr_desc -> + Parsetree.class_expr
val constr : + ?loc:loc -> + ?attrs:attrs -> + lid -> + Parsetree.core_type list -> + Parsetree.class_expr
val structure : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.class_structure -> + Parsetree.class_expr
val apply : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.class_expr -> + (Asttypes.arg_label * Parsetree.expression) list -> + Parsetree.class_expr
val let_ : + ?loc:loc -> + ?attrs:attrs -> + Asttypes.rec_flag -> + Parsetree.value_binding list -> + Parsetree.class_expr -> + Parsetree.class_expr
val constraint_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.class_expr -> + Parsetree.class_type -> + Parsetree.class_expr
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.class_expr
val open_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.open_description -> + Parsetree.class_expr -> + Parsetree.class_expr
diff --git a/ocaml/Ast_helper/Const/index.html b/ocaml/Ast_helper/Const/index.html new file mode 100644 index 00000000..bf2c70db --- /dev/null +++ b/ocaml/Ast_helper/Const/index.html @@ -0,0 +1,6 @@ + +Const (ocaml.Ast_helper.Const)

Module Ast_helper.Const

val char : char -> Parsetree.constant
val string : + ?quotation_delimiter:string -> + ?loc:Location.t -> + string -> + Parsetree.constant
val integer : ?suffix:char -> string -> Parsetree.constant
val int : ?suffix:char -> int -> Parsetree.constant
val int32 : ?suffix:char -> int32 -> Parsetree.constant
val int64 : ?suffix:char -> int64 -> Parsetree.constant
val nativeint : ?suffix:char -> nativeint -> Parsetree.constant
val float : ?suffix:char -> string -> Parsetree.constant
diff --git a/ocaml/Ast_helper/Csig/index.html b/ocaml/Ast_helper/Csig/index.html new file mode 100644 index 00000000..6496e114 --- /dev/null +++ b/ocaml/Ast_helper/Csig/index.html @@ -0,0 +1,5 @@ + +Csig (ocaml.Ast_helper.Csig)

Module Ast_helper.Csig

Class signatures

diff --git a/ocaml/Ast_helper/Cstr/index.html b/ocaml/Ast_helper/Cstr/index.html new file mode 100644 index 00000000..2d7b4433 --- /dev/null +++ b/ocaml/Ast_helper/Cstr/index.html @@ -0,0 +1,5 @@ + +Cstr (ocaml.Ast_helper.Cstr)

Module Ast_helper.Cstr

Class structures

diff --git a/ocaml/Ast_helper/Ctf/index.html b/ocaml/Ast_helper/Ctf/index.html new file mode 100644 index 00000000..d4949b89 --- /dev/null +++ b/ocaml/Ast_helper/Ctf/index.html @@ -0,0 +1,37 @@ + +Ctf (ocaml.Ast_helper.Ctf)

Module Ast_helper.Ctf

Class type fields

diff --git a/ocaml/Ast_helper/Cty/index.html b/ocaml/Ast_helper/Cty/index.html new file mode 100644 index 00000000..007c982c --- /dev/null +++ b/ocaml/Ast_helper/Cty/index.html @@ -0,0 +1,30 @@ + +Cty (ocaml.Ast_helper.Cty)

Module Ast_helper.Cty

Class type expressions

val mk : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.class_type_desc -> + Parsetree.class_type
val constr : + ?loc:loc -> + ?attrs:attrs -> + lid -> + Parsetree.core_type list -> + Parsetree.class_type
val signature : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.class_signature -> + Parsetree.class_type
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.class_type
val open_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.open_description -> + Parsetree.class_type -> + Parsetree.class_type
diff --git a/ocaml/Ast_helper/Exp/index.html b/ocaml/Ast_helper/Exp/index.html new file mode 100644 index 00000000..5cc7f3a8 --- /dev/null +++ b/ocaml/Ast_helper/Exp/index.html @@ -0,0 +1,186 @@ + +Exp (ocaml.Ast_helper.Exp)

Module Ast_helper.Exp

Expressions

val mk : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression_desc -> + Parsetree.expression
val ident : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.expression
val constant : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.constant -> + Parsetree.expression
val let_ : + ?loc:loc -> + ?attrs:attrs -> + Asttypes.rec_flag -> + Parsetree.value_binding list -> + Parsetree.expression -> + Parsetree.expression
val function_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.case list -> + Parsetree.expression
val apply : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + (Asttypes.arg_label * Parsetree.expression) list -> + Parsetree.expression
val match_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.case list -> + Parsetree.expression
val try_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.case list -> + Parsetree.expression
val tuple : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression list -> + Parsetree.expression
val construct : + ?loc:loc -> + ?attrs:attrs -> + lid -> + Parsetree.expression option -> + Parsetree.expression
val variant : + ?loc:loc -> + ?attrs:attrs -> + Asttypes.label -> + Parsetree.expression option -> + Parsetree.expression
val record : + ?loc:loc -> + ?attrs:attrs -> + (lid * Parsetree.expression) list -> + Parsetree.expression option -> + Parsetree.expression
val field : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + lid -> + Parsetree.expression
val setfield : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + lid -> + Parsetree.expression -> + Parsetree.expression
val array : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression list -> + Parsetree.expression
val ifthenelse : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.expression -> + Parsetree.expression option -> + Parsetree.expression
val sequence : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.expression -> + Parsetree.expression
val while_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.expression -> + Parsetree.expression
val coerce : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.core_type option -> + Parsetree.core_type -> + Parsetree.expression
val constraint_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.core_type -> + Parsetree.expression
val send : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + str -> + Parsetree.expression
val new_ : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.expression
val setinstvar : + ?loc:loc -> + ?attrs:attrs -> + str -> + Parsetree.expression -> + Parsetree.expression
val override : + ?loc:loc -> + ?attrs:attrs -> + (str * Parsetree.expression) list -> + Parsetree.expression
val letmodule : + ?loc:loc -> + ?attrs:attrs -> + str_opt -> + Parsetree.module_expr -> + Parsetree.expression -> + Parsetree.expression
val letexception : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension_constructor -> + Parsetree.expression -> + Parsetree.expression
val assert_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.expression
val lazy_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.expression
val poly : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.core_type option -> + Parsetree.expression
val object_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.class_structure -> + Parsetree.expression
val newtype : + ?loc:loc -> + ?attrs:attrs -> + str -> + Parsetree.expression -> + Parsetree.expression
val pack : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.module_expr -> + Parsetree.expression
val open_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.open_declaration -> + Parsetree.expression -> + Parsetree.expression
val letop : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.binding_op -> + Parsetree.binding_op list -> + Parsetree.expression -> + Parsetree.expression
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.expression
val unreachable : ?loc:loc -> ?attrs:attrs -> unit -> Parsetree.expression
val binding_op : + str -> + Parsetree.pattern -> + Parsetree.expression -> + loc -> + Parsetree.binding_op
diff --git a/ocaml/Ast_helper/Incl/index.html b/ocaml/Ast_helper/Incl/index.html new file mode 100644 index 00000000..0c09c1b7 --- /dev/null +++ b/ocaml/Ast_helper/Incl/index.html @@ -0,0 +1,7 @@ + +Incl (ocaml.Ast_helper.Incl)

Module Ast_helper.Incl

Includes

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + 'a -> + 'a Parsetree.include_infos
diff --git a/ocaml/Ast_helper/Mb/index.html b/ocaml/Ast_helper/Mb/index.html new file mode 100644 index 00000000..b636a544 --- /dev/null +++ b/ocaml/Ast_helper/Mb/index.html @@ -0,0 +1,9 @@ + +Mb (ocaml.Ast_helper.Mb)

Module Ast_helper.Mb

Module bindings

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?text:Docstrings.text -> + str_opt -> + Parsetree.module_expr -> + Parsetree.module_binding
diff --git a/ocaml/Ast_helper/Md/index.html b/ocaml/Ast_helper/Md/index.html new file mode 100644 index 00000000..36c101d8 --- /dev/null +++ b/ocaml/Ast_helper/Md/index.html @@ -0,0 +1,9 @@ + +Md (ocaml.Ast_helper.Md)

Module Ast_helper.Md

Module declarations

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?text:Docstrings.text -> + str_opt -> + Parsetree.module_type -> + Parsetree.module_declaration
diff --git a/ocaml/Ast_helper/Mod/index.html b/ocaml/Ast_helper/Mod/index.html new file mode 100644 index 00000000..7885a799 --- /dev/null +++ b/ocaml/Ast_helper/Mod/index.html @@ -0,0 +1,40 @@ + +Mod (ocaml.Ast_helper.Mod)

Module Ast_helper.Mod

Module expressions

val mk : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.module_expr_desc -> + Parsetree.module_expr
val ident : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.module_expr
val structure : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.structure -> + Parsetree.module_expr
val functor_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.functor_parameter -> + Parsetree.module_expr -> + Parsetree.module_expr
val apply : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.module_expr -> + Parsetree.module_expr -> + Parsetree.module_expr
val apply_unit : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.module_expr -> + Parsetree.module_expr
val constraint_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.module_expr -> + Parsetree.module_type -> + Parsetree.module_expr
val unpack : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.expression -> + Parsetree.module_expr
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.module_expr
diff --git a/ocaml/Ast_helper/Ms/index.html b/ocaml/Ast_helper/Ms/index.html new file mode 100644 index 00000000..33ec510d --- /dev/null +++ b/ocaml/Ast_helper/Ms/index.html @@ -0,0 +1,9 @@ + +Ms (ocaml.Ast_helper.Ms)

Module Ast_helper.Ms

Module substitutions

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?text:Docstrings.text -> + str -> + lid -> + Parsetree.module_substitution
diff --git a/ocaml/Ast_helper/Mtd/index.html b/ocaml/Ast_helper/Mtd/index.html new file mode 100644 index 00000000..cf53dd31 --- /dev/null +++ b/ocaml/Ast_helper/Mtd/index.html @@ -0,0 +1,9 @@ + +Mtd (ocaml.Ast_helper.Mtd)

Module Ast_helper.Mtd

Module type declarations

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?text:Docstrings.text -> + ?typ:Parsetree.module_type -> + str -> + Parsetree.module_type_declaration
diff --git a/ocaml/Ast_helper/Mty/index.html b/ocaml/Ast_helper/Mty/index.html new file mode 100644 index 00000000..b6f676dc --- /dev/null +++ b/ocaml/Ast_helper/Mty/index.html @@ -0,0 +1,31 @@ + +Mty (ocaml.Ast_helper.Mty)

Module Ast_helper.Mty

Module type expressions

val mk : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.module_type_desc -> + Parsetree.module_type
val ident : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.module_type
val alias : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.module_type
val signature : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.signature -> + Parsetree.module_type
val functor_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.functor_parameter -> + Parsetree.module_type -> + Parsetree.module_type
val with_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.module_type -> + Parsetree.with_constraint list -> + Parsetree.module_type
val typeof_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.module_expr -> + Parsetree.module_type
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.module_type
diff --git a/ocaml/Ast_helper/Of/index.html b/ocaml/Ast_helper/Of/index.html new file mode 100644 index 00000000..bfefe631 --- /dev/null +++ b/ocaml/Ast_helper/Of/index.html @@ -0,0 +1,11 @@ + +Of (ocaml.Ast_helper.Of)

Module Ast_helper.Of

Object fields

val mk : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.object_field_desc -> + Parsetree.object_field
val tag : + ?loc:loc -> + ?attrs:attrs -> + Asttypes.label with_loc -> + Parsetree.core_type -> + Parsetree.object_field
diff --git a/ocaml/Ast_helper/Opn/index.html b/ocaml/Ast_helper/Opn/index.html new file mode 100644 index 00000000..53e43f58 --- /dev/null +++ b/ocaml/Ast_helper/Opn/index.html @@ -0,0 +1,8 @@ + +Opn (ocaml.Ast_helper.Opn)

Module Ast_helper.Opn

Opens

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?override:Asttypes.override_flag -> + 'a -> + 'a Parsetree.open_infos
diff --git a/ocaml/Ast_helper/Pat/index.html b/ocaml/Ast_helper/Pat/index.html new file mode 100644 index 00000000..725d3804 --- /dev/null +++ b/ocaml/Ast_helper/Pat/index.html @@ -0,0 +1,66 @@ + +Pat (ocaml.Ast_helper.Pat)

Module Ast_helper.Pat

Patterns

val mk : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.pattern_desc -> + Parsetree.pattern
val any : ?loc:loc -> ?attrs:attrs -> unit -> Parsetree.pattern
val var : ?loc:loc -> ?attrs:attrs -> str -> Parsetree.pattern
val alias : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.pattern -> + str -> + Parsetree.pattern
val constant : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.constant -> + Parsetree.pattern
val interval : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.constant -> + Parsetree.constant -> + Parsetree.pattern
val tuple : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.pattern list -> + Parsetree.pattern
val construct : + ?loc:loc -> + ?attrs:attrs -> + lid -> + (str list * Parsetree.pattern) option -> + Parsetree.pattern
val variant : + ?loc:loc -> + ?attrs:attrs -> + Asttypes.label -> + Parsetree.pattern option -> + Parsetree.pattern
val record : + ?loc:loc -> + ?attrs:attrs -> + (lid * Parsetree.pattern) list -> + Asttypes.closed_flag -> + Parsetree.pattern
val array : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.pattern list -> + Parsetree.pattern
val or_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.pattern -> + Parsetree.pattern -> + Parsetree.pattern
val constraint_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.pattern -> + Parsetree.core_type -> + Parsetree.pattern
val type_ : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.pattern
val lazy_ : ?loc:loc -> ?attrs:attrs -> Parsetree.pattern -> Parsetree.pattern
val unpack : ?loc:loc -> ?attrs:attrs -> str_opt -> Parsetree.pattern
val open_ : + ?loc:loc -> + ?attrs:attrs -> + lid -> + Parsetree.pattern -> + Parsetree.pattern
val exception_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.pattern -> + Parsetree.pattern
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.pattern
diff --git a/ocaml/Ast_helper/Rf/index.html b/ocaml/Ast_helper/Rf/index.html new file mode 100644 index 00000000..7afab149 --- /dev/null +++ b/ocaml/Ast_helper/Rf/index.html @@ -0,0 +1,12 @@ + +Rf (ocaml.Ast_helper.Rf)

Module Ast_helper.Rf

Row fields

val mk : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.row_field_desc -> + Parsetree.row_field
val tag : + ?loc:loc -> + ?attrs:attrs -> + Asttypes.label with_loc -> + bool -> + Parsetree.core_type list -> + Parsetree.row_field
val inherit_ : ?loc:loc -> Parsetree.core_type -> Parsetree.row_field
diff --git a/ocaml/Ast_helper/Sig/index.html b/ocaml/Ast_helper/Sig/index.html new file mode 100644 index 00000000..4aa9d653 --- /dev/null +++ b/ocaml/Ast_helper/Sig/index.html @@ -0,0 +1,43 @@ + +Sig (ocaml.Ast_helper.Sig)

Module Ast_helper.Sig

Signature items

val type_subst : + ?loc:loc -> + Parsetree.type_declaration list -> + Parsetree.signature_item
val type_extension : + ?loc:loc -> + Parsetree.type_extension -> + Parsetree.signature_item
val exception_ : + ?loc:loc -> + Parsetree.type_exception -> + Parsetree.signature_item
val rec_module : + ?loc:loc -> + Parsetree.module_declaration list -> + Parsetree.signature_item
val class_ : + ?loc:loc -> + Parsetree.class_description list -> + Parsetree.signature_item
val class_type : + ?loc:loc -> + Parsetree.class_type_declaration list -> + Parsetree.signature_item
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.signature_item
diff --git a/ocaml/Ast_helper/Str/index.html b/ocaml/Ast_helper/Str/index.html new file mode 100644 index 00000000..a6b30b94 --- /dev/null +++ b/ocaml/Ast_helper/Str/index.html @@ -0,0 +1,42 @@ + +Str (ocaml.Ast_helper.Str)

Module Ast_helper.Str

Structure items

val type_extension : + ?loc:loc -> + Parsetree.type_extension -> + Parsetree.structure_item
val exception_ : + ?loc:loc -> + Parsetree.type_exception -> + Parsetree.structure_item
val rec_module : + ?loc:loc -> + Parsetree.module_binding list -> + Parsetree.structure_item
val class_ : + ?loc:loc -> + Parsetree.class_declaration list -> + Parsetree.structure_item
val class_type : + ?loc:loc -> + Parsetree.class_type_declaration list -> + Parsetree.structure_item
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.structure_item
diff --git a/ocaml/Ast_helper/Te/index.html b/ocaml/Ast_helper/Te/index.html new file mode 100644 index 00000000..a57e4207 --- /dev/null +++ b/ocaml/Ast_helper/Te/index.html @@ -0,0 +1,39 @@ + +Te (ocaml.Ast_helper.Te)

Module Ast_helper.Te

Type extensions

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?params: + (Parsetree.core_type * (Asttypes.variance * Asttypes.injectivity)) list -> + ?priv:Asttypes.private_flag -> + lid -> + Parsetree.extension_constructor list -> + Parsetree.type_extension
val mk_exception : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + Parsetree.extension_constructor -> + Parsetree.type_exception
val constructor : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?info:Docstrings.info -> + str -> + Parsetree.extension_constructor_kind -> + Parsetree.extension_constructor
val decl : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?info:Docstrings.info -> + ?vars:str list -> + ?args:Parsetree.constructor_arguments -> + ?res:Parsetree.core_type -> + str -> + Parsetree.extension_constructor
val rebind : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?info:Docstrings.info -> + str -> + lid -> + Parsetree.extension_constructor
diff --git a/ocaml/Ast_helper/Typ/index.html b/ocaml/Ast_helper/Typ/index.html new file mode 100644 index 00000000..6ec77258 --- /dev/null +++ b/ocaml/Ast_helper/Typ/index.html @@ -0,0 +1,59 @@ + +Typ (ocaml.Ast_helper.Typ)

Module Ast_helper.Typ

Type expressions

val mk : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.core_type_desc -> + Parsetree.core_type
val any : ?loc:loc -> ?attrs:attrs -> unit -> Parsetree.core_type
val var : ?loc:loc -> ?attrs:attrs -> string -> Parsetree.core_type
val arrow : + ?loc:loc -> + ?attrs:attrs -> + Asttypes.arg_label -> + Parsetree.core_type -> + Parsetree.core_type -> + Parsetree.core_type
val tuple : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.core_type list -> + Parsetree.core_type
val constr : + ?loc:loc -> + ?attrs:attrs -> + lid -> + Parsetree.core_type list -> + Parsetree.core_type
val object_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.object_field list -> + Asttypes.closed_flag -> + Parsetree.core_type
val class_ : + ?loc:loc -> + ?attrs:attrs -> + lid -> + Parsetree.core_type list -> + Parsetree.core_type
val alias : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.core_type -> + string -> + Parsetree.core_type
val variant : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.row_field list -> + Asttypes.closed_flag -> + Asttypes.label list option -> + Parsetree.core_type
val poly : + ?loc:loc -> + ?attrs:attrs -> + str list -> + Parsetree.core_type -> + Parsetree.core_type
val package : + ?loc:loc -> + ?attrs:attrs -> + lid -> + (lid * Parsetree.core_type) list -> + Parsetree.core_type
val extension : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.extension -> + Parsetree.core_type
val varify_constructors : + str list -> + Parsetree.core_type -> + Parsetree.core_type

varify_constructors newtypes te is type expression te, of which any of nullary type constructor tc is replaced by type variable of the same name, if tc's name appears in newtypes. Raise Syntaxerr.Variable_in_scope if any type variable inside te appears in newtypes.

  • since 4.05
diff --git a/ocaml/Ast_helper/Type/index.html b/ocaml/Ast_helper/Type/index.html new file mode 100644 index 00000000..f7245487 --- /dev/null +++ b/ocaml/Ast_helper/Type/index.html @@ -0,0 +1,29 @@ + +Type (ocaml.Ast_helper.Type)

Module Ast_helper.Type

Type declarations

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?text:Docstrings.text -> + ?params: + (Parsetree.core_type * (Asttypes.variance * Asttypes.injectivity)) list -> + ?cstrs:(Parsetree.core_type * Parsetree.core_type * loc) list -> + ?kind:Parsetree.type_kind -> + ?priv:Asttypes.private_flag -> + ?manifest:Parsetree.core_type -> + str -> + Parsetree.type_declaration
val constructor : + ?loc:loc -> + ?attrs:attrs -> + ?info:Docstrings.info -> + ?vars:str list -> + ?args:Parsetree.constructor_arguments -> + ?res:Parsetree.core_type -> + str -> + Parsetree.constructor_declaration
val field : + ?loc:loc -> + ?attrs:attrs -> + ?info:Docstrings.info -> + ?mut:Asttypes.mutable_flag -> + str -> + Parsetree.core_type -> + Parsetree.label_declaration
diff --git a/ocaml/Ast_helper/Val/index.html b/ocaml/Ast_helper/Val/index.html new file mode 100644 index 00000000..29c22afa --- /dev/null +++ b/ocaml/Ast_helper/Val/index.html @@ -0,0 +1,9 @@ + +Val (ocaml.Ast_helper.Val)

Module Ast_helper.Val

Value declarations

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?prim:string list -> + str -> + Parsetree.core_type -> + Parsetree.value_description
diff --git a/ocaml/Ast_helper/Vb/index.html b/ocaml/Ast_helper/Vb/index.html new file mode 100644 index 00000000..1d2c42ad --- /dev/null +++ b/ocaml/Ast_helper/Vb/index.html @@ -0,0 +1,10 @@ + +Vb (ocaml.Ast_helper.Vb)

Module Ast_helper.Vb

Value bindings

val mk : + ?loc:loc -> + ?attrs:attrs -> + ?docs:Docstrings.docs -> + ?text:Docstrings.text -> + ?value_constraint:Parsetree.value_constraint -> + Parsetree.pattern -> + Parsetree.expression -> + Parsetree.value_binding
diff --git a/ocaml/Ast_helper/index.html b/ocaml/Ast_helper/index.html new file mode 100644 index 00000000..388d4d74 --- /dev/null +++ b/ocaml/Ast_helper/index.html @@ -0,0 +1,2 @@ + +Ast_helper (ocaml.Ast_helper)

Module Ast_helper

Helpers to produce Parsetree fragments

Warning This module is unstable and part of compiler-libs.

type 'a with_loc = 'a Location.loc
type loc = Location.t
type str = string with_loc
type str_opt = string option with_loc
type attrs = Parsetree.attribute list

Default locations

val default_loc : loc ref

Default value for all optional location arguments.

val with_default_loc : loc -> (unit -> 'a) -> 'a

Set the default_loc within the scope of the execution of the provided function.

Constants

module Const : sig ... end
module Attr : sig ... end

Core language

module Typ : sig ... end

Type expressions

module Pat : sig ... end

Patterns

module Exp : sig ... end

Expressions

module Val : sig ... end

Value declarations

module Type : sig ... end

Type declarations

module Te : sig ... end

Type extensions

Module language

module Mty : sig ... end

Module type expressions

module Mod : sig ... end

Module expressions

module Sig : sig ... end

Signature items

module Str : sig ... end

Structure items

module Md : sig ... end

Module declarations

module Ms : sig ... end

Module substitutions

module Mtd : sig ... end

Module type declarations

module Mb : sig ... end

Module bindings

module Opn : sig ... end

Opens

module Incl : sig ... end

Includes

module Vb : sig ... end

Value bindings

Class language

module Cty : sig ... end

Class type expressions

module Ctf : sig ... end

Class type fields

module Cl : sig ... end

Class expressions

module Cf : sig ... end

Class fields

module Ci : sig ... end

Classes

module Csig : sig ... end

Class signatures

module Cstr : sig ... end

Class structures

module Rf : sig ... end

Row fields

module Of : sig ... end

Object fields

diff --git a/ocaml/Ast_invariants/index.html b/ocaml/Ast_invariants/index.html new file mode 100644 index 00000000..5a57e2b0 --- /dev/null +++ b/ocaml/Ast_invariants/index.html @@ -0,0 +1,2 @@ + +Ast_invariants (ocaml.Ast_invariants)

Module Ast_invariants

Check AST invariants

Warning: this module is unstable and part of compiler-libs.

val structure : Parsetree.structure -> unit
val signature : Parsetree.signature -> unit
diff --git a/ocaml/Ast_iterator/index.html b/ocaml/Ast_iterator/index.html new file mode 100644 index 00000000..7cbf38d8 --- /dev/null +++ b/ocaml/Ast_iterator/index.html @@ -0,0 +1,6 @@ + +Ast_iterator (ocaml.Ast_iterator)

Module Ast_iterator

Ast_iterator.iterator enables AST inspection using open recursion. A typical mapper would be based on Ast_iterator.default_iterator, a trivial iterator, and will fall back on it for handling the syntax it does not modify.

Warning: this module is unstable and part of compiler-libs.

A generic Parsetree iterator

type iterator = {
  1. attribute : iterator -> Parsetree.attribute -> unit;
  2. attributes : iterator -> Parsetree.attribute list -> unit;
  3. binding_op : iterator -> Parsetree.binding_op -> unit;
  4. case : iterator -> Parsetree.case -> unit;
  5. cases : iterator -> Parsetree.case list -> unit;
  6. class_declaration : iterator -> Parsetree.class_declaration -> unit;
  7. class_description : iterator -> Parsetree.class_description -> unit;
  8. class_expr : iterator -> Parsetree.class_expr -> unit;
  9. class_field : iterator -> Parsetree.class_field -> unit;
  10. class_signature : iterator -> Parsetree.class_signature -> unit;
  11. class_structure : iterator -> Parsetree.class_structure -> unit;
  12. class_type : iterator -> Parsetree.class_type -> unit;
  13. class_type_declaration : iterator -> Parsetree.class_type_declaration -> unit;
  14. class_type_field : iterator -> Parsetree.class_type_field -> unit;
  15. constructor_declaration : iterator -> + Parsetree.constructor_declaration -> + unit;
  16. expr : iterator -> Parsetree.expression -> unit;
  17. extension : iterator -> Parsetree.extension -> unit;
  18. extension_constructor : iterator -> Parsetree.extension_constructor -> unit;
  19. include_declaration : iterator -> Parsetree.include_declaration -> unit;
  20. include_description : iterator -> Parsetree.include_description -> unit;
  21. label_declaration : iterator -> Parsetree.label_declaration -> unit;
  22. location : iterator -> Location.t -> unit;
  23. module_binding : iterator -> Parsetree.module_binding -> unit;
  24. module_declaration : iterator -> Parsetree.module_declaration -> unit;
  25. module_substitution : iterator -> Parsetree.module_substitution -> unit;
  26. module_expr : iterator -> Parsetree.module_expr -> unit;
  27. module_type : iterator -> Parsetree.module_type -> unit;
  28. module_type_declaration : iterator -> + Parsetree.module_type_declaration -> + unit;
  29. open_declaration : iterator -> Parsetree.open_declaration -> unit;
  30. open_description : iterator -> Parsetree.open_description -> unit;
  31. pat : iterator -> Parsetree.pattern -> unit;
  32. payload : iterator -> Parsetree.payload -> unit;
  33. signature : iterator -> Parsetree.signature -> unit;
  34. signature_item : iterator -> Parsetree.signature_item -> unit;
  35. structure : iterator -> Parsetree.structure -> unit;
  36. structure_item : iterator -> Parsetree.structure_item -> unit;
  37. typ : iterator -> Parsetree.core_type -> unit;
  38. row_field : iterator -> Parsetree.row_field -> unit;
  39. object_field : iterator -> Parsetree.object_field -> unit;
  40. type_declaration : iterator -> Parsetree.type_declaration -> unit;
  41. type_extension : iterator -> Parsetree.type_extension -> unit;
  42. type_exception : iterator -> Parsetree.type_exception -> unit;
  43. type_kind : iterator -> Parsetree.type_kind -> unit;
  44. value_binding : iterator -> Parsetree.value_binding -> unit;
  45. value_description : iterator -> Parsetree.value_description -> unit;
  46. with_constraint : iterator -> Parsetree.with_constraint -> unit;
}

A iterator record implements one "method" per syntactic category, using an open recursion style: each method takes as its first argument the iterator to be applied to children in the syntax tree.

val default_iterator : iterator

A default iterator, which implements a "do not do anything" mapping.

diff --git a/ocaml/Ast_mapper/index.html b/ocaml/Ast_mapper/index.html new file mode 100644 index 00000000..70f9dd61 --- /dev/null +++ b/ocaml/Ast_mapper/index.html @@ -0,0 +1,75 @@ + +Ast_mapper (ocaml.Ast_mapper)

Module Ast_mapper

The interface of a -ppx rewriter

A -ppx rewriter is a program that accepts a serialized abstract syntax tree and outputs another, possibly modified, abstract syntax tree. This module encapsulates the interface between the compiler and the -ppx rewriters, handling such details as the serialization format, forwarding of command-line flags, and storing state.

mapper enables AST rewriting using open recursion. A typical mapper would be based on default_mapper, a deep identity mapper, and will fall back on it for handling the syntax it does not modify. For example:

open Asttypes
+open Parsetree
+open Ast_mapper
+
+let test_mapper argv =
+  { default_mapper with
+    expr = fun mapper expr ->
+      match expr with
+      | { pexp_desc = Pexp_extension ({ txt = "test" }, PStr [])} ->
+        Ast_helper.Exp.constant (Const_int 42)
+      | other -> default_mapper.expr mapper other; }
+
+let () =
+  register "ppx_test" test_mapper

This -ppx rewriter, which replaces [%test] in expressions with the constant 42, can be compiled using ocamlc -o ppx_test -I +compiler-libs ocamlcommon.cma ppx_test.ml.

Warning: this module is unstable and part of compiler-libs.

A generic Parsetree mapper

type mapper = {
  1. attribute : mapper -> Parsetree.attribute -> Parsetree.attribute;
  2. attributes : mapper -> Parsetree.attribute list -> Parsetree.attribute list;
  3. binding_op : mapper -> Parsetree.binding_op -> Parsetree.binding_op;
  4. case : mapper -> Parsetree.case -> Parsetree.case;
  5. cases : mapper -> Parsetree.case list -> Parsetree.case list;
  6. class_declaration : mapper -> + Parsetree.class_declaration -> + Parsetree.class_declaration;
  7. class_description : mapper -> + Parsetree.class_description -> + Parsetree.class_description;
  8. class_expr : mapper -> Parsetree.class_expr -> Parsetree.class_expr;
  9. class_field : mapper -> Parsetree.class_field -> Parsetree.class_field;
  10. class_signature : mapper -> + Parsetree.class_signature -> + Parsetree.class_signature;
  11. class_structure : mapper -> + Parsetree.class_structure -> + Parsetree.class_structure;
  12. class_type : mapper -> Parsetree.class_type -> Parsetree.class_type;
  13. class_type_declaration : mapper -> + Parsetree.class_type_declaration -> + Parsetree.class_type_declaration;
  14. class_type_field : mapper -> + Parsetree.class_type_field -> + Parsetree.class_type_field;
  15. constant : mapper -> Parsetree.constant -> Parsetree.constant;
  16. constructor_declaration : mapper -> + Parsetree.constructor_declaration -> + Parsetree.constructor_declaration;
  17. expr : mapper -> Parsetree.expression -> Parsetree.expression;
  18. extension : mapper -> Parsetree.extension -> Parsetree.extension;
  19. extension_constructor : mapper -> + Parsetree.extension_constructor -> + Parsetree.extension_constructor;
  20. include_declaration : mapper -> + Parsetree.include_declaration -> + Parsetree.include_declaration;
  21. include_description : mapper -> + Parsetree.include_description -> + Parsetree.include_description;
  22. label_declaration : mapper -> + Parsetree.label_declaration -> + Parsetree.label_declaration;
  23. location : mapper -> Location.t -> Location.t;
  24. module_binding : mapper -> + Parsetree.module_binding -> + Parsetree.module_binding;
  25. module_declaration : mapper -> + Parsetree.module_declaration -> + Parsetree.module_declaration;
  26. module_substitution : mapper -> + Parsetree.module_substitution -> + Parsetree.module_substitution;
  27. module_expr : mapper -> Parsetree.module_expr -> Parsetree.module_expr;
  28. module_type : mapper -> Parsetree.module_type -> Parsetree.module_type;
  29. module_type_declaration : mapper -> + Parsetree.module_type_declaration -> + Parsetree.module_type_declaration;
  30. open_declaration : mapper -> + Parsetree.open_declaration -> + Parsetree.open_declaration;
  31. open_description : mapper -> + Parsetree.open_description -> + Parsetree.open_description;
  32. pat : mapper -> Parsetree.pattern -> Parsetree.pattern;
  33. payload : mapper -> Parsetree.payload -> Parsetree.payload;
  34. signature : mapper -> Parsetree.signature -> Parsetree.signature;
  35. signature_item : mapper -> + Parsetree.signature_item -> + Parsetree.signature_item;
  36. structure : mapper -> Parsetree.structure -> Parsetree.structure;
  37. structure_item : mapper -> + Parsetree.structure_item -> + Parsetree.structure_item;
  38. typ : mapper -> Parsetree.core_type -> Parsetree.core_type;
  39. type_declaration : mapper -> + Parsetree.type_declaration -> + Parsetree.type_declaration;
  40. type_extension : mapper -> + Parsetree.type_extension -> + Parsetree.type_extension;
  41. type_exception : mapper -> + Parsetree.type_exception -> + Parsetree.type_exception;
  42. type_kind : mapper -> Parsetree.type_kind -> Parsetree.type_kind;
  43. value_binding : mapper -> Parsetree.value_binding -> Parsetree.value_binding;
  44. value_description : mapper -> + Parsetree.value_description -> + Parsetree.value_description;
  45. with_constraint : mapper -> + Parsetree.with_constraint -> + Parsetree.with_constraint;
}

A mapper record implements one "method" per syntactic category, using an open recursion style: each method takes as its first argument the mapper to be applied to children in the syntax tree.

val default_mapper : mapper

A default mapper, which implements a "deep identity" mapping.

Apply mappers to compilation units

val tool_name : unit -> string

Can be used within a ppx preprocessor to know which tool is calling it "ocamlc", "ocamlopt", "ocamldoc", "ocamldep", "ocaml", ... Some global variables that reflect command-line options are automatically synchronized between the calling tool and the ppx preprocessor: Clflags.include_dirs, Load_path, Clflags.open_modules, Clflags.for_package, Clflags.debug.

val apply : source:string -> target:string -> mapper -> unit

Apply a mapper (parametrized by the unit name) to a dumped parsetree found in the source file and put the result in the target file. The structure or signature field of the mapper is applied to the implementation or interface.

val run_main : (string list -> mapper) -> unit

Entry point to call to implement a standalone -ppx rewriter from a mapper, parametrized by the command line arguments. The current unit name can be obtained from Location.input_name. This function implements proper error reporting for uncaught exceptions.

Registration API

val register_function : (string -> (string list -> mapper) -> unit) ref
val register : string -> (string list -> mapper) -> unit

Apply the register_function. The default behavior is to run the mapper immediately, taking arguments from the process command line. This is to support a scenario where a mapper is linked as a stand-alone executable.

It is possible to overwrite the register_function to define "-ppx drivers", which combine several mappers in a single process. Typically, a driver starts by defining register_function to a custom implementation, then lets ppx rewriters (linked statically or dynamically) register themselves, and then run all or some of them. It is also possible to have -ppx drivers apply rewriters to only specific parts of an AST.

The first argument to register is a symbolic name to be used by the ppx driver.

Convenience functions to write mappers

val map_opt : ('a -> 'b) -> 'a option -> 'b option
val extension_of_error : Location.error -> Parsetree.extension

Encode an error into an 'ocaml.error' extension node which can be inserted in a generated Parsetree. The compiler will be responsible for reporting the error.

val attribute_of_warning : Location.t -> string -> Parsetree.attribute

Encode a warning message into an 'ocaml.ppwarning' attribute which can be inserted in a generated Parsetree. The compiler will be responsible for reporting the warning.

Helper functions to call external mappers

val add_ppx_context_str : + tool_name:string -> + Parsetree.structure -> + Parsetree.structure

Extract information from the current environment and encode it into an attribute which is prepended to the list of structure items in order to pass the information to an external processor.

val add_ppx_context_sig : + tool_name:string -> + Parsetree.signature -> + Parsetree.signature

Same as add_ppx_context_str, but for signatures.

val drop_ppx_context_str : + restore:bool -> + Parsetree.structure -> + Parsetree.structure

Drop the ocaml.ppx.context attribute from a structure. If restore is true, also restore the associated data in the current process.

val drop_ppx_context_sig : + restore:bool -> + Parsetree.signature -> + Parsetree.signature

Same as drop_ppx_context_str, but for signatures.

Cookies

Cookies are used to pass information from a ppx processor to a further invocation of itself, when called from the OCaml toplevel (or other tools that support cookies).

diff --git a/ocaml/Asttypes/index.html b/ocaml/Asttypes/index.html new file mode 100644 index 00000000..869d10d6 --- /dev/null +++ b/ocaml/Asttypes/index.html @@ -0,0 +1,2 @@ + +Asttypes (ocaml.Asttypes)

Module Asttypes

Auxiliary AST types used by parsetree and typedtree.

Warning: this module is unstable and part of compiler-libs.

type constant =
  1. | Const_int of int
  2. | Const_char of char
  3. | Const_string of string * Location.t * string option
  4. | Const_float of string
  5. | Const_int32 of int32
  6. | Const_int64 of int64
  7. | Const_nativeint of nativeint
type rec_flag =
  1. | Nonrecursive
  2. | Recursive
type direction_flag =
  1. | Upto
  2. | Downto
type private_flag =
  1. | Private
  2. | Public
type mutable_flag =
  1. | Immutable
  2. | Mutable
type virtual_flag =
  1. | Virtual
  2. | Concrete
type override_flag =
  1. | Override
  2. | Fresh
type closed_flag =
  1. | Closed
  2. | Open
type label = string
type arg_label =
  1. | Nolabel
  2. | Labelled of string
    (*

    label:T -> ...

    *)
  3. | Optional of string
    (*

    ?label:T -> ...

    *)
type 'a loc = 'a Location.loc = {
  1. txt : 'a;
  2. loc : Location.t;
}
type variance =
  1. | Covariant
  2. | Contravariant
  3. | NoVariance
type injectivity =
  1. | Injective
  2. | NoInjectivity
diff --git a/ocaml/Attr_helper/index.html b/ocaml/Attr_helper/index.html new file mode 100644 index 00000000..7e12a1e4 --- /dev/null +++ b/ocaml/Attr_helper/index.html @@ -0,0 +1,5 @@ + +Attr_helper (ocaml.Attr_helper)

Module Attr_helper

Helpers for attributes

Warning: this module is unstable and part of compiler-libs.

type error =
  1. | Multiple_attributes of string
  2. | No_payload_expected of string
val get_no_payload_attribute : + string list -> + Parsetree.attributes -> + string Asttypes.loc option

The string list argument of the following functions is a list of alternative names for the attribute we are looking for. For instance:

["foo"; "ocaml.foo"]
val has_no_payload_attribute : string list -> Parsetree.attributes -> bool
exception Error of Location.t * error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Augment_specialised_args/Definition/index.html b/ocaml/Augment_specialised_args/Definition/index.html new file mode 100644 index 00000000..70b70af8 --- /dev/null +++ b/ocaml/Augment_specialised_args/Definition/index.html @@ -0,0 +1,2 @@ + +Definition (ocaml.Augment_specialised_args.Definition)

Module Augment_specialised_args.Definition

type t =
  1. | Existing_inner_free_var of Variable.t
  2. | Projection_from_existing_specialised_arg of Projection.t
diff --git a/ocaml/Augment_specialised_args/Make/argument-1-_/index.html b/ocaml/Augment_specialised_args/Make/argument-1-_/index.html new file mode 100644 index 00000000..e3442da6 --- /dev/null +++ b/ocaml/Augment_specialised_args/Make/argument-1-_/index.html @@ -0,0 +1,5 @@ + +_ (ocaml.Augment_specialised_args.Make._)

Parameter Make._

val pass_name : string
val what_to_specialise : + env:Inline_and_simplify_aux.Env.t -> + set_of_closures:Flambda.set_of_closures -> + What_to_specialise.t
diff --git a/ocaml/Augment_specialised_args/Make/index.html b/ocaml/Augment_specialised_args/Make/index.html new file mode 100644 index 00000000..cbc30b26 --- /dev/null +++ b/ocaml/Augment_specialised_args/Make/index.html @@ -0,0 +1,11 @@ + +Make (ocaml.Augment_specialised_args.Make)

Module Augment_specialised_args.Make

Parameters

module _ : S

Signature

val rewrite_set_of_closures : + env:Inline_and_simplify_aux.Env.t -> + duplicate_function: + (env:Inline_and_simplify_aux.Env.t -> + set_of_closures:Flambda.set_of_closures -> + fun_var:Variable.t -> + new_fun_var:Variable.t -> + Flambda.function_declaration * Flambda.specialised_to Variable.Map.t) -> + set_of_closures:Flambda.set_of_closures -> + (Flambda.expr * Inlining_cost.Benefit.t) option

duplicate_function should be Inline_and_simplify.duplicate_function.

diff --git a/ocaml/Augment_specialised_args/What_to_specialise/index.html b/ocaml/Augment_specialised_args/What_to_specialise/index.html new file mode 100644 index 00000000..0870cf7e --- /dev/null +++ b/ocaml/Augment_specialised_args/What_to_specialise/index.html @@ -0,0 +1,7 @@ + +What_to_specialise (ocaml.Augment_specialised_args.What_to_specialise)

Module Augment_specialised_args.What_to_specialise

type t
val create : set_of_closures:Flambda.set_of_closures -> t
val new_specialised_arg : + t -> + fun_var:Variable.t -> + group:Variable.t -> + definition:Definition.t -> + t
val make_direct_call_surrogate_for : t -> fun_var:Variable.t -> t
diff --git a/ocaml/Augment_specialised_args/index.html b/ocaml/Augment_specialised_args/index.html new file mode 100644 index 00000000..8c76f85f --- /dev/null +++ b/ocaml/Augment_specialised_args/index.html @@ -0,0 +1,2 @@ + +Augment_specialised_args (ocaml.Augment_specialised_args)

Module Augment_specialised_args

Helper module for adding specialised arguments to sets of closures.

module Definition : sig ... end
module What_to_specialise : sig ... end
module type S = sig ... end
module Make (_ : S) : sig ... end
diff --git a/ocaml/Augment_specialised_args/module-type-S/index.html b/ocaml/Augment_specialised_args/module-type-S/index.html new file mode 100644 index 00000000..51a0c9bd --- /dev/null +++ b/ocaml/Augment_specialised_args/module-type-S/index.html @@ -0,0 +1,5 @@ + +S (ocaml.Augment_specialised_args.S)

Module type Augment_specialised_args.S

val pass_name : string
val what_to_specialise : + env:Inline_and_simplify_aux.Env.t -> + set_of_closures:Flambda.set_of_closures -> + What_to_specialise.t
diff --git a/ocaml/Backend_intf/index.html b/ocaml/Backend_intf/index.html new file mode 100644 index 00000000..eb5a7337 --- /dev/null +++ b/ocaml/Backend_intf/index.html @@ -0,0 +1,2 @@ + +Backend_intf (ocaml.Backend_intf)

Module Backend_intf

Knowledge that the middle end needs about the backend.

module type S = sig ... end
diff --git a/ocaml/Backend_intf/module-type-S/index.html b/ocaml/Backend_intf/module-type-S/index.html new file mode 100644 index 00000000..69c7156f --- /dev/null +++ b/ocaml/Backend_intf/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Backend_intf.S)

Module type Backend_intf.S

val symbol_for_global' : Ident.t -> Symbol.t

Compute the symbol for the given identifier.

val really_import_approx : Simple_value_approx.t -> Simple_value_approx.t

If the given approximation is that of a symbol (Value_symbol) or an external (Value_extern), attempt to find a more informative approximation from a previously-written compilation artifact. In the native code backend, for example, this might consult a .cmx file.

val import_symbol : Symbol.t -> Simple_value_approx.t
val closure_symbol : Closure_id.t -> Symbol.t
val size_int : int

The natural size of an integer on the target architecture (cf. Arch.size_int in the native code backend).

val big_endian : bool

true iff the target architecture is big endian.

val max_sensible_number_of_arguments : int

The maximum number of arguments that is reasonable for a function to have. This should be fewer than the threshold that causes non-self tail call optimization to be inhibited (in particular, if it would entail passing arguments on the stack; see Selectgen).

diff --git a/ocaml/Backend_var/Provenance/index.html b/ocaml/Backend_var/Provenance/index.html new file mode 100644 index 00000000..4a3fabf3 --- /dev/null +++ b/ocaml/Backend_var/Provenance/index.html @@ -0,0 +1,6 @@ + +Provenance (ocaml.Backend_var.Provenance)

Module Backend_var.Provenance

type t
val create : + module_path:Path.t -> + location:Debuginfo.t -> + original_ident:Ident.t -> + t
val module_path : t -> Path.t
val location : t -> Debuginfo.t
val original_ident : t -> Ident.t
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Backend_var/With_provenance/index.html b/ocaml/Backend_var/With_provenance/index.html new file mode 100644 index 00000000..c80b3b4b --- /dev/null +++ b/ocaml/Backend_var/With_provenance/index.html @@ -0,0 +1,2 @@ + +With_provenance (ocaml.Backend_var.With_provenance)

Module Backend_var.With_provenance

type t

Values of type t should be used for variables in binding position.

val print : Stdlib.Format.formatter -> t -> unit
val create : ?provenance:Provenance.t -> backend_var -> t
val var : t -> backend_var
val provenance : t -> Provenance.t option
val name : t -> string
val rename : t -> t
diff --git a/ocaml/Backend_var/index.html b/ocaml/Backend_var/index.html new file mode 100644 index 00000000..92cc0c87 --- /dev/null +++ b/ocaml/Backend_var/index.html @@ -0,0 +1,2 @@ + +Backend_var (ocaml.Backend_var)

Module Backend_var

Variables used in the backend, optionally equipped with "provenance" information, used for the emission of debugging information.

include module type of struct include Ident end
type t = Ident.t
include Identifiable.S with type t := t
module T = Ident.T
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set = Ident.Set
module Map = Ident.Map
module Tbl = Ident.Tbl
val print_with_scope : Stdlib.Format.formatter -> t -> unit

Same as print except that it will also add a "n" suffix if the scope of the argument is n.

val create_scoped : scope:int -> string -> t
val create_local : string -> t
val create_persistent : string -> t
val create_predef : string -> t
val rename : t -> t

Creates an identifier with the same name as the input, a fresh stamp, and no scope.

  • raises [Fatal_error]

    if called on a persistent / predef ident.

val name : t -> string
val unique_name : t -> string
val unique_toplevel_name : t -> string
val persistent : t -> bool
val same : t -> t -> bool

Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

val compare : t -> t -> int
val global : t -> bool
val is_predef : t -> bool
val scope : t -> int
val lowest_scope : int
val highest_scope : int
val reinit : unit -> unit
type 'a tbl = 'a Ident.tbl

'a tbl represents association tables from identifiers to values of type 'a.

'a tbl plays the role of map, but bindings can be looked up from either the full Ident using find_same, or just its user-visible name using find_name. In general the two lookups may not return the same result, as an identifier may have been shadowed in the environment by a distinct identifier with the same name.

find_all returns the bindings for all idents of a given name, most recently introduced first.

In other words, 'a tbl corresponds to (Ident.t * 'a) list Map.Make(String) and the implementation is very close to that representation.

Note in particular that searching among idents of the same name takes linear time, and that add simply extends the list without checking for duplicates. So it is not a good idea to implement union by repeated add calls, which may result in many duplicated identifiers and poor find_same performance. It is even possible to build overly large same-name lists such that non-recursive functions like find_all or fold_all blow the stack.

You should probably use Map.Make(Ident) instead, unless you really need to query bindings by user-visible name, not just by unique identifiers.

val empty : 'a tbl
val add : t -> 'a -> 'a tbl -> 'a tbl
val find_same : t -> 'a tbl -> 'a
val find_name : string -> 'a tbl -> t * 'a
val find_all : string -> 'a tbl -> (t * 'a) list
val find_all_seq : string -> 'a tbl -> (t * 'a) Stdlib.Seq.t
val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
val iter : (t -> 'a -> unit) -> 'a tbl -> unit
val remove : t -> 'a tbl -> 'a tbl
val make_key_generator : unit -> t -> t
type backend_var = t
module Provenance : sig ... end
module With_provenance : sig ... end
diff --git a/ocaml/Binutils/index.html b/ocaml/Binutils/index.html new file mode 100644 index 00000000..dea5a24f --- /dev/null +++ b/ocaml/Binutils/index.html @@ -0,0 +1,2 @@ + +Binutils (ocaml.Binutils)

Module Binutils

type error =
  1. | Truncated_file
  2. | Unrecognized of string
  3. | Unsupported of string * int64
  4. | Out_of_range of string
val error_to_string : error -> string
type t
val read : string -> (t, error) Stdlib.Result.t
val defines_symbol : t -> string -> bool
val symbol_offset : t -> string -> int64 option
diff --git a/ocaml/Branch_relaxation/Make/argument-1-T/Cond_branch/index.html b/ocaml/Branch_relaxation/Make/argument-1-T/Cond_branch/index.html new file mode 100644 index 00000000..8489f677 --- /dev/null +++ b/ocaml/Branch_relaxation/Make/argument-1-T/Cond_branch/index.html @@ -0,0 +1,2 @@ + +Cond_branch (ocaml.Branch_relaxation.Make.T.Cond_branch)

Module T.Cond_branch

type t
val all : t list
val max_displacement : t -> distance
val classify_instr : Linear.instruction_desc -> t option
diff --git a/ocaml/Branch_relaxation/Make/argument-1-T/index.html b/ocaml/Branch_relaxation/Make/argument-1-T/index.html new file mode 100644 index 00000000..4b99705d --- /dev/null +++ b/ocaml/Branch_relaxation/Make/argument-1-T/index.html @@ -0,0 +1,5 @@ + +T (ocaml.Branch_relaxation.Make.T)

Parameter Make.T

type distance = int
module Cond_branch : sig ... end
val offset_pc_at_branch : distance
val relax_allocation : + num_bytes:int -> + dbginfo:Debuginfo.alloc_dbginfo -> + Linear.instruction_desc
val relax_poll : return_label:Cmm.label option -> Linear.instruction_desc
val relax_intop_checkbound : unit -> Linear.instruction_desc
val relax_intop_imm_checkbound : bound:int -> Linear.instruction_desc
diff --git a/ocaml/Branch_relaxation/Make/index.html b/ocaml/Branch_relaxation/Make/index.html new file mode 100644 index 00000000..eda4c5c2 --- /dev/null +++ b/ocaml/Branch_relaxation/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Branch_relaxation.Make)

Module Branch_relaxation.Make

Parameters

Signature

val relax : Linear.fundecl -> max_out_of_line_code_offset:T.distance -> unit
diff --git a/ocaml/Branch_relaxation/index.html b/ocaml/Branch_relaxation/index.html new file mode 100644 index 00000000..3ae8f261 --- /dev/null +++ b/ocaml/Branch_relaxation/index.html @@ -0,0 +1,2 @@ + +Branch_relaxation (ocaml.Branch_relaxation)

Module Branch_relaxation

module Make (T : Branch_relaxation_intf.S) : sig ... end
diff --git a/ocaml/Branch_relaxation_intf/index.html b/ocaml/Branch_relaxation_intf/index.html new file mode 100644 index 00000000..265e9d8d --- /dev/null +++ b/ocaml/Branch_relaxation_intf/index.html @@ -0,0 +1,2 @@ + +Branch_relaxation_intf (ocaml.Branch_relaxation_intf)

Module Branch_relaxation_intf

module type S = sig ... end
diff --git a/ocaml/Branch_relaxation_intf/module-type-S/Cond_branch/index.html b/ocaml/Branch_relaxation_intf/module-type-S/Cond_branch/index.html new file mode 100644 index 00000000..9efa4b6b --- /dev/null +++ b/ocaml/Branch_relaxation_intf/module-type-S/Cond_branch/index.html @@ -0,0 +1,2 @@ + +Cond_branch (ocaml.Branch_relaxation_intf.S.Cond_branch)

Module S.Cond_branch

type t
val all : t list
val max_displacement : t -> distance
val classify_instr : Linear.instruction_desc -> t option
diff --git a/ocaml/Branch_relaxation_intf/module-type-S/index.html b/ocaml/Branch_relaxation_intf/module-type-S/index.html new file mode 100644 index 00000000..45916d95 --- /dev/null +++ b/ocaml/Branch_relaxation_intf/module-type-S/index.html @@ -0,0 +1,5 @@ + +S (ocaml.Branch_relaxation_intf.S)

Module type Branch_relaxation_intf.S

type distance = int
module Cond_branch : sig ... end
val offset_pc_at_branch : distance
val relax_allocation : + num_bytes:int -> + dbginfo:Debuginfo.alloc_dbginfo -> + Linear.instruction_desc
val relax_poll : return_label:Cmm.label option -> Linear.instruction_desc
val relax_intop_checkbound : unit -> Linear.instruction_desc
val relax_intop_imm_checkbound : bound:int -> Linear.instruction_desc
diff --git a/ocaml/Btype/For_copy/index.html b/ocaml/Btype/For_copy/index.html new file mode 100644 index 00000000..f2217b1e --- /dev/null +++ b/ocaml/Btype/For_copy/index.html @@ -0,0 +1,2 @@ + +For_copy (ocaml.Btype.For_copy)

Module Btype.For_copy

type copy_scope
val redirect_desc : copy_scope -> Types.type_expr -> Types.type_desc -> unit
val with_scope : (copy_scope -> 'a) -> 'a
diff --git a/ocaml/Btype/TransientTypeMap/index.html b/ocaml/Btype/TransientTypeMap/index.html new file mode 100644 index 00000000..8b4717fc --- /dev/null +++ b/ocaml/Btype/TransientTypeMap/index.html @@ -0,0 +1,8 @@ + +TransientTypeMap (ocaml.Btype.TransientTypeMap)

Module Btype.TransientTypeMap

Maps

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Btype/TypeHash/index.html b/ocaml/Btype/TypeHash/index.html new file mode 100644 index 00000000..5d87669d --- /dev/null +++ b/ocaml/Btype/TypeHash/index.html @@ -0,0 +1,2 @@ + +TypeHash (ocaml.Btype.TypeHash)

Module Btype.TypeHash

include Hashtbl.S with type key = Types.transient_expr
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val add : 'a t -> Types.type_expr -> 'a -> unit
val remove : 'a t -> Types.type_expr -> unit
val find : 'a t -> Types.type_expr -> 'a
val iter : (Types.type_expr -> 'a -> unit) -> 'a t -> unit
diff --git a/ocaml/Btype/TypeMap/index.html b/ocaml/Btype/TypeMap/index.html new file mode 100644 index 00000000..b6111188 --- /dev/null +++ b/ocaml/Btype/TypeMap/index.html @@ -0,0 +1,10 @@ + +TypeMap (ocaml.Btype.TypeMap)

Module Btype.TypeMap

include Map.S + with type key = Types.transient_expr + and type 'a t = 'a TransientTypeMap.t

Maps

The type of the map keys.

type 'a t = 'a TransientTypeMap.t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val add : Types.type_expr -> 'a -> 'a t -> 'a t
val find : Types.type_expr -> 'a t -> 'a
val singleton : Types.type_expr -> 'a -> 'a t
val fold : (Types.type_expr -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
diff --git a/ocaml/Btype/TypePairs/index.html b/ocaml/Btype/TypePairs/index.html new file mode 100644 index 00000000..41c4e25d --- /dev/null +++ b/ocaml/Btype/TypePairs/index.html @@ -0,0 +1,2 @@ + +TypePairs (ocaml.Btype.TypePairs)

Module Btype.TypePairs

type t
val create : int -> t
val clear : t -> unit
val add : t -> (Types.type_expr * Types.type_expr) -> unit
val mem : t -> (Types.type_expr * Types.type_expr) -> bool
val iter : ((Types.type_expr * Types.type_expr) -> unit) -> t -> unit
diff --git a/ocaml/Btype/TypeSet/index.html b/ocaml/Btype/TypeSet/index.html new file mode 100644 index 00000000..13103596 --- /dev/null +++ b/ocaml/Btype/TypeSet/index.html @@ -0,0 +1,3 @@ + +TypeSet (ocaml.Btype.TypeSet)

Module Btype.TypeSet

include Set.S with type elt = Types.transient_expr

Sets

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val add : Types.type_expr -> t -> t
val mem : Types.type_expr -> t -> bool
val singleton : Types.type_expr -> t
val exists : (Types.type_expr -> bool) -> t -> bool
val elements : t -> Types.type_expr list
diff --git a/ocaml/Btype/index.html b/ocaml/Btype/index.html new file mode 100644 index 00000000..8104684d --- /dev/null +++ b/ocaml/Btype/index.html @@ -0,0 +1,52 @@ + +Btype (ocaml.Btype)

Module Btype

module TypeSet : sig ... end
module TypeMap : sig ... end
module TypeHash : sig ... end
module TypePairs : sig ... end
val generic_level : int
val newgenvar : ?name:string -> unit -> Types.type_expr
val newgenstub : scope:int -> Types.type_expr
val is_Tvar : Types.type_expr -> bool
val is_Tunivar : Types.type_expr -> bool
val is_Tconstr : Types.type_expr -> bool
val dummy_method : Asttypes.label
val is_fixed : Types.row_desc -> bool
val has_fixed_explanation : Types.row_desc -> bool
val fixed_explanation : Types.row_desc -> Types.fixed_explanation option
val merge_fixed_explanation : + Types.fixed_explanation option -> + Types.fixed_explanation option -> + Types.fixed_explanation option
val static_row : Types.row_desc -> bool
val hash_variant : Asttypes.label -> int
val row_of_type : Types.type_expr -> Types.type_expr
val has_constr_row : Types.type_expr -> bool
val is_row_name : string -> bool
val is_constr_row : allow_ident:bool -> Types.type_expr -> bool
val set_static_row_name : Types.type_declaration -> Path.t -> unit
val iter_type_expr : (Types.type_expr -> unit) -> Types.type_expr -> unit
val fold_type_expr : + ('a -> Types.type_expr -> 'a) -> + 'a -> + Types.type_expr -> + 'a
val iter_row : (Types.type_expr -> unit) -> Types.row_desc -> unit
val fold_row : ('a -> Types.type_expr -> 'a) -> 'a -> Types.row_desc -> 'a
val iter_abbrev : (Types.type_expr -> unit) -> Types.abbrev_memo -> unit
val iter_type_expr_kind : + (Types.type_expr -> unit) -> + Types.type_decl_kind -> + unit
val iter_type_expr_cstr_args : + (Types.type_expr -> unit) -> + Types.constructor_arguments -> + unit
type type_iterators = {
  1. it_signature : type_iterators -> Types.signature -> unit;
  2. it_signature_item : type_iterators -> Types.signature_item -> unit;
  3. it_value_description : type_iterators -> Types.value_description -> unit;
  4. it_type_declaration : type_iterators -> Types.type_declaration -> unit;
  5. it_extension_constructor : type_iterators -> + Types.extension_constructor -> + unit;
  6. it_module_declaration : type_iterators -> Types.module_declaration -> unit;
  7. it_modtype_declaration : type_iterators -> Types.modtype_declaration -> unit;
  8. it_class_declaration : type_iterators -> Types.class_declaration -> unit;
  9. it_class_type_declaration : type_iterators -> + Types.class_type_declaration -> + unit;
  10. it_functor_param : type_iterators -> Types.functor_parameter -> unit;
  11. it_module_type : type_iterators -> Types.module_type -> unit;
  12. it_class_type : type_iterators -> Types.class_type -> unit;
  13. it_type_kind : type_iterators -> Types.type_decl_kind -> unit;
  14. it_do_type_expr : type_iterators -> Types.type_expr -> unit;
  15. it_type_expr : type_iterators -> Types.type_expr -> unit;
  16. it_path : Path.t -> unit;
}
val type_iterators : type_iterators
val unmark_iterators : type_iterators
val copy_type_desc : + ?keep_names:bool -> + (Types.type_expr -> Types.type_expr) -> + Types.type_desc -> + Types.type_desc
val copy_row : + (Types.type_expr -> Types.type_expr) -> + bool -> + Types.row_desc -> + bool -> + Types.type_expr -> + Types.row_desc
module For_copy : sig ... end
val lowest_level : int
val not_marked_node : Types.type_expr -> bool
val logged_mark_node : Types.type_expr -> unit
val try_logged_mark_node : Types.type_expr -> bool
val flip_mark_node : Types.type_expr -> unit
val try_mark_node : Types.type_expr -> bool
val mark_type : Types.type_expr -> unit
val mark_type_params : Types.type_expr -> unit
val unmark_type : Types.type_expr -> unit
val unmark_type_decl : Types.type_declaration -> unit
val unmark_extension_constructor : Types.extension_constructor -> unit
val unmark_class_type : Types.class_type -> unit
val unmark_class_signature : Types.class_signature -> unit
val find_expans : + Asttypes.private_flag -> + Path.t -> + Types.abbrev_memo -> + Types.type_expr option
val cleanup_abbrev : unit -> unit
val memorize_abbrev : + Types.abbrev_memo ref -> + Asttypes.private_flag -> + Path.t -> + Types.type_expr -> + Types.type_expr -> + unit
val forget_abbrev : Types.abbrev_memo ref -> Path.t -> unit
val snapshot : unit -> Types.snapshot
val backtrack : Types.snapshot -> unit
val is_optional : Asttypes.arg_label -> bool
val prefixed_label_name : Asttypes.arg_label -> Asttypes.label
val extract_label : + Asttypes.label -> + (Asttypes.arg_label * 'a) list -> + (Asttypes.arg_label * 'a * bool * (Asttypes.arg_label * 'a) list) option
val signature_of_class_type : Types.class_type -> Types.class_signature
val scrape_class_type : Types.class_type -> Types.class_type
val class_type_arity : Types.class_type -> int
val abbreviate_class_type : + Path.t -> + Types.type_expr list -> + Types.class_type -> + Types.class_type
val self_type_row : Types.class_type -> Types.type_expr
val methods : Types.class_signature -> string list
val virtual_methods : Types.class_signature -> string list
val concrete_methods : Types.class_signature -> Types.MethSet.t
val public_methods : Types.class_signature -> string list
val instance_vars : Types.class_signature -> string list
val virtual_instance_vars : Types.class_signature -> string list
val concrete_instance_vars : Types.class_signature -> Types.VarSet.t
val instance_variable_type : + Asttypes.label -> + Types.class_signature -> + Types.type_expr
val print_raw : (Stdlib.Format.formatter -> Types.type_expr -> unit) ref
val cstr_type_path : Types.constructor_description -> Path.t
diff --git a/ocaml/Build_export_info/index.html b/ocaml/Build_export_info/index.html new file mode 100644 index 00000000..10e42989 --- /dev/null +++ b/ocaml/Build_export_info/index.html @@ -0,0 +1,5 @@ + +Build_export_info (ocaml.Build_export_info)

Module Build_export_info

Construct export information, for emission into .cmx files, from an Flambda program.

val build_transient : + backend:(module Backend_intf.S) -> + Flambda.program -> + Export_info.transient
diff --git a/ocaml/Build_path_prefix_map/index.html b/ocaml/Build_path_prefix_map/index.html new file mode 100644 index 00000000..7d45b33d --- /dev/null +++ b/ocaml/Build_path_prefix_map/index.html @@ -0,0 +1,2 @@ + +Build_path_prefix_map (ocaml.Build_path_prefix_map)

Module Build_path_prefix_map

Rewrite paths for reproducible builds

Warning: this module is unstable and part of compiler-libs.

See the BUILD_PATH_PREFIX_MAP spec

type path = string
type path_prefix = string
type error_message = string
val encode_prefix : path_prefix -> string
val decode_prefix : string -> (path_prefix, error_message) result
type pair = {
  1. target : path_prefix;
  2. source : path_prefix;
}
val encode_pair : pair -> string
val decode_pair : string -> (pair, error_message) result
type map = pair option list
val encode_map : map -> string
val decode_map : string -> (map, error_message) result
val rewrite_first : map -> path -> path option

rewrite_first map path tries to find a source in map that is a prefix of the input path. If it succeeds, it replaces this prefix with the corresponding target. If it fails, it just returns None.

val rewrite_all : map -> path -> path list

rewrite_all map path finds all sources in map that are a prefix of the input path. For each matching source, in priority order, it replaces this prefix with the corresponding target and adds the result to the returned list. If there are no matches, it just returns [].

val rewrite : map -> path -> path

rewrite path uses rewrite_first to try to find a mapping for path. If found, it returns that, otherwise it just returns path.

diff --git a/ocaml/Builtin_attributes/index.html b/ocaml/Builtin_attributes/index.html new file mode 100644 index 00000000..416d9452 --- /dev/null +++ b/ocaml/Builtin_attributes/index.html @@ -0,0 +1,24 @@ + +Builtin_attributes (ocaml.Builtin_attributes)

Module Builtin_attributes

Support for some of the builtin attributes

  • ocaml.deprecated
  • ocaml.alert
  • ocaml.error
  • ocaml.ppwarning
  • ocaml.warning
  • ocaml.warnerror
  • ocaml.explicit_arity (for camlp4/camlp5)
  • ocaml.warn_on_literal_pattern
  • ocaml.deprecated_mutable
  • ocaml.immediate
  • ocaml.immediate64
  • ocaml.boxed / ocaml.unboxed

Warning: this module is unstable and part of compiler-libs.

val check_alerts : Location.t -> Parsetree.attributes -> string -> unit
val check_alerts_inclusion : + def:Location.t -> + use:Location.t -> + Location.t -> + Parsetree.attributes -> + Parsetree.attributes -> + string -> + unit
val alerts_of_attrs : Parsetree.attributes -> Misc.alerts
val alerts_of_sig : Parsetree.signature -> Misc.alerts
val alerts_of_str : Parsetree.structure -> Misc.alerts
val check_deprecated_mutable : + Location.t -> + Parsetree.attributes -> + string -> + unit
val check_deprecated_mutable_inclusion : + def:Location.t -> + use:Location.t -> + Location.t -> + Parsetree.attributes -> + Parsetree.attributes -> + string -> + unit
val check_no_alert : Parsetree.attributes -> unit
val error_of_extension : Parsetree.extension -> Location.error
val warning_attribute : ?ppwarning:bool -> Parsetree.attribute -> unit

Apply warning settings from the specified attribute. "ocaml.warning"/"ocaml.warnerror" (and variants without the prefix) are processed and other attributes are ignored.

Also implement ocaml.ppwarning (unless ~ppwarning:false is passed).

val warning_scope : + ?ppwarning:bool -> + Parsetree.attributes -> + (unit -> 'a) -> + 'a

Execute a function in a new scope for warning settings. This means that the effect of any call to warning_attribute during the execution of this function will be discarded after execution.

The function also takes a list of attributes which are processed with warning_attribute in the fresh scope before the function is executed.

val warn_on_literal_pattern : Parsetree.attributes -> bool
val explicit_arity : Parsetree.attributes -> bool
val immediate : Parsetree.attributes -> bool
val immediate64 : Parsetree.attributes -> bool
val has_unboxed : Parsetree.attributes -> bool
val has_boxed : Parsetree.attributes -> bool
diff --git a/ocaml/Bytegen/index.html b/ocaml/Bytegen/index.html new file mode 100644 index 00000000..2b5906dc --- /dev/null +++ b/ocaml/Bytegen/index.html @@ -0,0 +1,10 @@ + +Bytegen (ocaml.Bytegen)

Module Bytegen

val compile_implementation : + string -> + Lambda.lambda -> + Instruct.instruction list
val compile_phrase : + Lambda.lambda -> + Instruct.instruction list * Instruct.instruction list
diff --git a/ocaml/Bytelibrarian/index.html b/ocaml/Bytelibrarian/index.html new file mode 100644 index 00000000..3ac6d99a --- /dev/null +++ b/ocaml/Bytelibrarian/index.html @@ -0,0 +1,2 @@ + +Bytelibrarian (ocaml.Bytelibrarian)

Module Bytelibrarian

val create_archive : string list -> string -> unit
type error =
  1. | File_not_found of string
  2. | Not_an_object_file of string
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
val reset : unit -> unit
diff --git a/ocaml/Bytelink/Dep/index.html b/ocaml/Bytelink/Dep/index.html new file mode 100644 index 00000000..f42dfbb8 --- /dev/null +++ b/ocaml/Bytelink/Dep/index.html @@ -0,0 +1,2 @@ + +Dep (ocaml.Bytelink.Dep)

Module Bytelink.Dep

The type of the set elements.

val compare : t -> t -> int

A total ordering function over the set elements. This is a two-argument function f such that f e1 e2 is zero if the elements e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Bytelink/DepSet/index.html b/ocaml/Bytelink/DepSet/index.html new file mode 100644 index 00000000..f63e5dac --- /dev/null +++ b/ocaml/Bytelink/DepSet/index.html @@ -0,0 +1,3 @@ + +DepSet (ocaml.Bytelink.DepSet)

Module Bytelink.DepSet

Sets

type elt = Dep.t

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Bytelink/index.html b/ocaml/Bytelink/index.html new file mode 100644 index 00000000..f786997d --- /dev/null +++ b/ocaml/Bytelink/index.html @@ -0,0 +1,2 @@ + +Bytelink (ocaml.Bytelink)

Module Bytelink

module DepSet : Set.S with type elt = Dep.t
val reset : unit -> unit
val check_consistency : Misc.filepath -> Cmo_format.compilation_unit -> unit
val extract_crc_interfaces : unit -> Misc.crcs
type error =
  1. | File_not_found of Misc.filepath
  2. | Not_an_object_file of Misc.filepath
  3. | Wrong_object_name of Misc.filepath
  4. | Symbol_error of Misc.filepath * Symtable.error
  5. | Inconsistent_import of Misc.modname * Misc.filepath * Misc.filepath
  6. | Custom_runtime
  7. | File_exists of Misc.filepath
  8. | Cannot_open_dll of Misc.filepath
  9. | Required_module_unavailable of Misc.modname * Misc.modname
  10. | Camlheader of string * Misc.filepath
  11. | Multiple_definition of Misc.modname * Misc.filepath * Misc.filepath
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Bytepackager/index.html b/ocaml/Bytepackager/index.html new file mode 100644 index 00000000..3ce1a413 --- /dev/null +++ b/ocaml/Bytepackager/index.html @@ -0,0 +1,7 @@ + +Bytepackager (ocaml.Bytepackager)

Module Bytepackager

val package_files : + ppf_dump:Stdlib.Format.formatter -> + Env.t -> + string list -> + string -> + unit
type error =
  1. | Forward_reference of string * Ident.t
  2. | Multiple_definition of string * Ident.t
  3. | Not_an_object_file of string
  4. | Illegal_renaming of string * string * string
  5. | File_not_found of string
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Bytesections/Name/index.html b/ocaml/Bytesections/Name/index.html new file mode 100644 index 00000000..d8fea71d --- /dev/null +++ b/ocaml/Bytesections/Name/index.html @@ -0,0 +1,2 @@ + +Name (ocaml.Bytesections.Name)

Module Bytesections.Name

type raw_name = private string
type t =
  1. | CODE
    (*

    bytecode

    *)
  2. | CRCS
    (*

    crcs for modules

    *)
  3. | DATA
    (*

    global data (constant)

    *)
  4. | DBUG
    (*

    debug info

    *)
  5. | DLLS
    (*

    dll names

    *)
  6. | DLPT
    (*

    dll paths

    *)
  7. | PRIM
    (*

    primitives names

    *)
  8. | RNTM
    (*

    The path to the bytecode interpreter (use_runtime mode)

    *)
  9. | SYMB
    (*

    global identifiers

    *)
  10. | Other of raw_name
val of_string : string -> t
  • raises Invalid_argument

    if the input is not of size 4

val to_string : t -> string
diff --git a/ocaml/Bytesections/index.html b/ocaml/Bytesections/index.html new file mode 100644 index 00000000..30bf4f83 --- /dev/null +++ b/ocaml/Bytesections/index.html @@ -0,0 +1,2 @@ + +Bytesections (ocaml.Bytesections)

Module Bytesections

module Name : sig ... end

Recording sections written to a bytecode executable file

type toc_writer
val init_record : out_channel -> toc_writer

Start recording sections from the current position in out_channel

val record : toc_writer -> Name.t -> unit

Record the current position in the out_channel as the end of the section with the given name.

val write_toc_and_trailer : toc_writer -> unit

Write the table of contents and the standard trailer for bytecode executable files

Reading sections from a bytecode executable file

type section_entry = {
  1. name : Name.t;
    (*

    name of the section.

    *)
  2. pos : int;
    (*

    byte offset at which the section starts.

    *)
  3. len : int;
    (*

    length of the section.

    *)
}
type section_table
exception Bad_magic_number
val read_toc : in_channel -> section_table

Read the table of sections from a bytecode executable. Raise Bad_magic_number if magic number doesn't match

val seek_section : section_table -> in_channel -> Name.t -> int

Position the input channel at the beginning of the section named "name", and return the length of that section. Raise Not_found if no such section exists.

val read_section_string : section_table -> in_channel -> Name.t -> string

Return the contents of a section, as a string.

val read_section_struct : section_table -> in_channel -> Name.t -> 'a

Return the contents of a section, as marshalled data.

val all : section_table -> section_entry list

Returns all section_entry from a section_table in increasing position order.

val pos_first_section : section_table -> int

Return the position of the beginning of the first section

diff --git a/ocaml/CSE/index.html b/ocaml/CSE/index.html new file mode 100644 index 00000000..8dbe29c7 --- /dev/null +++ b/ocaml/CSE/index.html @@ -0,0 +1,2 @@ + +CSE (ocaml.CSE)

Module CSE

Common interface to all architecture-specific CSE modules

val fundecl : Mach.fundecl -> Mach.fundecl
diff --git a/ocaml/CSEgen/class-cse_generic/index.html b/ocaml/CSEgen/class-cse_generic/index.html new file mode 100644 index 00000000..5d7d3fcc --- /dev/null +++ b/ocaml/CSEgen/class-cse_generic/index.html @@ -0,0 +1,2 @@ + +cse_generic (ocaml.CSEgen.cse_generic)

Class CSEgen.cse_generic

method class_of_operation : Mach.operation -> op_class
method is_cheap_operation : Mach.operation -> bool
method fundecl : Mach.fundecl -> Mach.fundecl
diff --git a/ocaml/CSEgen/index.html b/ocaml/CSEgen/index.html new file mode 100644 index 00000000..1c7d3a69 --- /dev/null +++ b/ocaml/CSEgen/index.html @@ -0,0 +1,2 @@ + +CSEgen (ocaml.CSEgen)

Module CSEgen

type op_class =
  1. | Op_pure
  2. | Op_checkbound
  3. | Op_load of Asttypes.mutable_flag
  4. | Op_store of bool
  5. | Op_other
class cse_generic : object ... end
diff --git a/ocaml/CamlinternalFormat/index.html b/ocaml/CamlinternalFormat/index.html new file mode 100644 index 00000000..c2519922 --- /dev/null +++ b/ocaml/CamlinternalFormat/index.html @@ -0,0 +1,53 @@ + +CamlinternalFormat (ocaml.CamlinternalFormat)

Module CamlinternalFormat

val is_in_char_set : CamlinternalFormatBasics.char_set -> char -> bool
type mutable_char_set = bytes
val create_char_set : unit -> mutable_char_set
val add_in_char_set : mutable_char_set -> char -> unit
type ('a, 'b, 'c, 'd, 'e, 'f) param_format_ebb =
  1. | Param_format_EBB : ('x -> 'a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmt -> + ('a, 'b, 'c, 'd, 'e, 'f) + param_format_ebb
val param_format_of_ignored_format : + ('a, 'b, 'c, 'd, 'y, 'x) CamlinternalFormatBasics.ignored -> + ('x, 'b, 'c, 'y, 'e, 'f) CamlinternalFormatBasics.fmt -> + ('a, 'b, 'c, 'd, 'e, 'f) param_format_ebb
type ('b, 'c) acc_formatting_gen =
  1. | Acc_open_tag of ('b, 'c) acc
  2. | Acc_open_box of ('b, 'c) acc
and ('b, 'c) acc =
  1. | Acc_formatting_lit of ('b, 'c) acc * CamlinternalFormatBasics.formatting_lit
  2. | Acc_formatting_gen of ('b, 'c) acc * ('b, 'c) acc_formatting_gen
  3. | Acc_string_literal of ('b, 'c) acc * string
  4. | Acc_char_literal of ('b, 'c) acc * char
  5. | Acc_data_string of ('b, 'c) acc * string
  6. | Acc_data_char of ('b, 'c) acc * char
  7. | Acc_delay of ('b, 'c) acc * 'b -> 'c
  8. | Acc_flush of ('b, 'c) acc
  9. | Acc_invalid_arg of ('b, 'c) acc * string
  10. | End_of_acc
type ('a, 'b) heter_list =
  1. | Cons : 'c * ('a, 'b) heter_list -> ('c -> 'a, 'b) heter_list
  2. | Nil : ('b, 'b) heter_list
type ('b, 'c, 'e, 'f) fmt_ebb =
  1. | Fmt_EBB : ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmt -> ('b, + 'c, + 'e, + 'f) + fmt_ebb
val make_printf : + (('b, 'c) acc -> 'd) -> + ('b, 'c) acc -> + ('a, 'b, 'c, 'c, 'c, 'd) CamlinternalFormatBasics.fmt -> + 'a
val make_iprintf : + ('s -> 'f) -> + 's -> + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmt -> + 'a
val output_acc : out_channel -> (out_channel, unit) acc -> unit
val bufput_acc : Stdlib.Buffer.t -> (Stdlib.Buffer.t, unit) acc -> unit
val strput_acc : Stdlib.Buffer.t -> (unit, string) acc -> unit
val type_format : + ('x, 'b, 'c, 't, 'u, 'v) CamlinternalFormatBasics.fmt -> + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmtty -> + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmt
val fmt_ebb_of_string : + ?legacy_behavior:bool -> + string -> + ('b, 'c, 'e, 'f) fmt_ebb
val format_of_string_fmtty : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmtty -> + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6
val format_of_string_format : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6 -> + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6
val char_of_iconv : CamlinternalFormatBasics.int_conv -> char
val string_of_formatting_lit : + CamlinternalFormatBasics.formatting_lit -> + string
val string_of_fmtty : + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmtty -> + string
val string_of_fmt : + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmt -> + string
val open_box_of_string : string -> int * CamlinternalFormatBasics.block_type
val symm : + ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + CamlinternalFormatBasics.fmtty_rel -> + ('a2, 'b2, 'c2, 'd2, 'e2, 'f2, 'a1, 'b1, 'c1, 'd1, 'e1, 'f1) + CamlinternalFormatBasics.fmtty_rel
val trans : + ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + CamlinternalFormatBasics.fmtty_rel -> + ('a2, 'b2, 'c2, 'd2, 'e2, 'f2, 'a3, 'b3, 'c3, 'd3, 'e3, 'f3) + CamlinternalFormatBasics.fmtty_rel -> + ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a3, 'b3, 'c3, 'd3, 'e3, 'f3) + CamlinternalFormatBasics.fmtty_rel
val recast : + ('a1, 'b1, 'c1, 'd1, 'e1, 'f1) CamlinternalFormatBasics.fmt -> + ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + CamlinternalFormatBasics.fmtty_rel -> + ('a2, 'b2, 'c2, 'd2, 'e2, 'f2) CamlinternalFormatBasics.fmt
diff --git a/ocaml/CamlinternalFormatBasics/index.html b/ocaml/CamlinternalFormatBasics/index.html new file mode 100644 index 00000000..0ed3e01d --- /dev/null +++ b/ocaml/CamlinternalFormatBasics/index.html @@ -0,0 +1,308 @@ + +CamlinternalFormatBasics (ocaml.CamlinternalFormatBasics)

Module CamlinternalFormatBasics

type padty =
  1. | Left
  2. | Right
  3. | Zeros
type int_conv =
  1. | Int_d
  2. | Int_pd
  3. | Int_sd
  4. | Int_i
  5. | Int_pi
  6. | Int_si
  7. | Int_x
  8. | Int_Cx
  9. | Int_X
  10. | Int_CX
  11. | Int_o
  12. | Int_Co
  13. | Int_u
  14. | Int_Cd
  15. | Int_Ci
  16. | Int_Cu
type float_flag_conv =
  1. | Float_flag_
  2. | Float_flag_p
  3. | Float_flag_s
type float_kind_conv =
  1. | Float_f
  2. | Float_e
  3. | Float_E
  4. | Float_g
  5. | Float_G
  6. | Float_F
  7. | Float_h
  8. | Float_H
  9. | Float_CF
type float_conv = float_flag_conv * float_kind_conv
type char_set = string
type counter =
  1. | Line_counter
  2. | Char_counter
  3. | Token_counter
type ('a, 'b) padding =
  1. | No_padding : ('a, 'a) padding
  2. | Lit_padding : padty * int -> ('a, 'a) padding
  3. | Arg_padding : padty -> (int -> 'a, 'a) padding
type pad_option = int option
type ('a, 'b) precision =
  1. | No_precision : ('a, 'a) precision
  2. | Lit_precision : int -> ('a, 'a) precision
  3. | Arg_precision : (int -> 'a, 'a) precision
type prec_option = int option
type ('a, 'b, 'c) custom_arity =
  1. | Custom_zero : ('a, string, 'a) custom_arity
  2. | Custom_succ : ('a, 'b, 'c) custom_arity -> ('a, 'x -> 'b, 'x -> 'c) + custom_arity
type block_type =
  1. | Pp_hbox
  2. | Pp_vbox
  3. | Pp_hvbox
  4. | Pp_hovbox
  5. | Pp_box
  6. | Pp_fits
type formatting_lit =
  1. | Close_box
  2. | Close_tag
  3. | Break of string * int * int
  4. | FFlush
  5. | Force_newline
  6. | Flush_newline
  7. | Magic_size of string * int
  8. | Escaped_at
  9. | Escaped_percent
  10. | Scan_indic of char
type ('a, 'b, 'c, 'd, 'e, 'f) formatting_gen =
  1. | Open_tag : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) + formatting_gen
  2. | Open_box : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) + formatting_gen
and ('a, 'b, 'c, 'd, 'e, 'f) fmtty = + ('a, 'b, 'c, 'd, 'e, 'f, 'a, 'b, 'c, 'd, 'e, 'f) fmtty_rel
and ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmtty_rel =
  1. | Char_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> (char -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + char -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  2. | String_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> (string -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + string -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  3. | Int_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmtty_rel -> + (int -> 'a1, 'b1, 'c1, 'd1, 'e1, 'f1, int -> 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel
  4. | Int32_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> (int32 -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + int32 -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  5. | Nativeint_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> (nativeint -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + nativeint -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  6. | Int64_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> (int64 -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + int64 -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  7. | Float_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> (float -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + float -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  8. | Bool_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> (bool -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + bool -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  9. | Format_arg_ty : ('g, 'h, 'i, 'j, 'k, 'l) fmtty + * ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmtty_rel -> + (('g, 'h, 'i, 'j, 'k, 'l) format6 -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + ('g, 'h, 'i, 'j, 'k, 'l) format6 -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  10. | Format_subst_ty : ('g, 'h, 'i, 'j, 'k, 'l, 'g1, 'b1, 'c1, 'j1, 'd1, 'a1) + fmtty_rel + * ('g, 'h, 'i, 'j, 'k, 'l, 'g2, 'b2, 'c2, 'j2, 'd2, 'a2) fmtty_rel + * ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmtty_rel -> + (('g, 'h, 'i, 'j, 'k, 'l) format6 -> + 'g1, + 'b1, + 'c1, + 'j1, + 'e1, + 'f1, + ('g, 'h, 'i, 'j, 'k, 'l) format6 -> + 'g2, + 'b2, + 'c2, + 'j2, + 'e2, + 'f2) + fmtty_rel
  11. | Alpha_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> (('b1 -> 'x -> 'c1) -> + 'x -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + ('b2 -> 'x -> 'c2) -> + 'x -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  12. | Theta_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> (('b1 -> 'c1) -> + 'a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + ('b2 -> 'c2) -> + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel
  13. | Any_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmtty_rel -> + ('x -> 'a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'x -> 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel
  14. | Reader_ty : ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) + fmtty_rel -> ('x -> + 'a1, + 'b1, + 'c1, + ('b1 -> 'x) -> + 'd1, + 'e1, + 'f1, + 'x -> + 'a2, + 'b2, + 'c2, + ('b2 -> 'x) -> + 'd2, + 'e2, + 'f2) + fmtty_rel
  15. | Ignored_reader_ty : ('a1, + 'b1, + 'c1, + 'd1, + 'e1, + 'f1, + 'a2, + 'b2, + 'c2, + 'd2, + 'e2, + 'f2) + fmtty_rel -> ('a1, + 'b1, + 'c1, + ('b1 -> 'x) -> + 'd1, + 'e1, + 'f1, + 'a2, + 'b2, + 'c2, + ('b2 -> 'x) -> + 'd2, + 'e2, + 'f2) + fmtty_rel
  16. | End_of_fmtty : ('f1, 'b1, 'c1, 'd1, 'd1, 'f1, 'f2, 'b2, 'c2, 'd2, 'd2, 'f2) + fmtty_rel
and ('a, 'b, 'c, 'd, 'e, 'f) fmt =
  1. | Char : ('a, 'b, 'c, 'd, 'e, 'f) fmt -> (char -> 'a, 'b, 'c, 'd, 'e, 'f) fmt
  2. | Caml_char : ('a, 'b, 'c, 'd, 'e, 'f) fmt -> (char -> 'a, 'b, 'c, 'd, 'e, 'f) + fmt
  3. | String : ('x, string -> 'a) padding + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('x, 'b, 'c, 'd, 'e, 'f) fmt
  4. | Caml_string : ('x, string -> 'a) padding + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('x, 'b, 'c, 'd, 'e, 'f) fmt
  5. | Int : int_conv + * ('x, 'y) padding + * ('y, int -> 'a) precision + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('x, 'b, 'c, 'd, 'e, 'f) fmt
  6. | Int32 : int_conv + * ('x, 'y) padding + * ('y, int32 -> 'a) precision + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('x, 'b, 'c, 'd, 'e, 'f) fmt
  7. | Nativeint : int_conv + * ('x, 'y) padding + * ('y, nativeint -> 'a) precision + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('x, 'b, 'c, 'd, 'e, 'f) fmt
  8. | Int64 : int_conv + * ('x, 'y) padding + * ('y, int64 -> 'a) precision + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('x, 'b, 'c, 'd, 'e, 'f) fmt
  9. | Float : float_conv + * ('x, 'y) padding + * ('y, float -> 'a) precision + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('x, 'b, 'c, 'd, 'e, 'f) fmt
  10. | Bool : ('x, bool -> 'a) padding + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('x, 'b, 'c, 'd, 'e, 'f) fmt
  11. | Flush : ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('a, 'b, 'c, 'd, 'e, 'f) fmt
  12. | String_literal : string + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('a, 'b, 'c, 'd, 'e, 'f) fmt
  13. | Char_literal : char + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('a, 'b, 'c, 'd, 'e, 'f) fmt
  14. | Format_arg : pad_option + * ('g, 'h, 'i, 'j, 'k, 'l) fmtty + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> (('g, 'h, 'i, 'j, 'k, 'l) format6 -> + 'a, + 'b, + 'c, + 'd, + 'e, + 'f) + fmt
  15. | Format_subst : pad_option + * ('g, 'h, 'i, 'j, 'k, 'l, 'g2, 'b, 'c, 'j2, 'd, 'a) fmtty_rel + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> (('g, 'h, 'i, 'j, 'k, 'l) format6 -> + 'g2, + 'b, + 'c, + 'j2, + 'e, + 'f) + fmt
  16. | Alpha : ('a, 'b, 'c, 'd, 'e, 'f) fmt -> (('b -> 'x -> 'c) -> + 'x -> + 'a, + 'b, + 'c, + 'd, + 'e, + 'f) + fmt
  17. | Theta : ('a, 'b, 'c, 'd, 'e, 'f) fmt -> (('b -> 'c) -> 'a, 'b, 'c, 'd, 'e, 'f) + fmt
  18. | Formatting_lit : formatting_lit + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('a, 'b, 'c, 'd, 'e, 'f) fmt
  19. | Formatting_gen : ('a1, 'b, 'c, 'd1, 'e1, 'f1) formatting_gen + * ('f1, 'b, 'c, 'e1, 'e2, 'f2) fmt -> ('a1, 'b, 'c, 'd1, 'e2, 'f2) fmt
  20. | Reader : ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('x -> + 'a, + 'b, + 'c, + ('b -> 'x) -> + 'd, + 'e, + 'f) + fmt
  21. | Scan_char_set : pad_option + * char_set + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> (string -> 'a, 'b, 'c, 'd, 'e, 'f) fmt
  22. | Scan_get_counter : counter + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> (int -> 'a, 'b, 'c, 'd, 'e, 'f) fmt
  23. | Scan_next_char : ('a, 'b, 'c, 'd, 'e, 'f) fmt -> (char -> + 'a, + 'b, + 'c, + 'd, + 'e, + 'f) + fmt
  24. | Ignored_param : ('a, 'b, 'c, 'd, 'y, 'x) ignored + * ('x, 'b, 'c, 'y, 'e, 'f) fmt -> ('a, 'b, 'c, 'd, 'e, 'f) fmt
  25. | Custom : ('a, 'x, 'y) custom_arity + * (unit -> + 'x) + * ('a, 'b, 'c, 'd, 'e, 'f) fmt -> ('y, 'b, 'c, 'd, 'e, 'f) fmt
  26. | End_of_format : ('f, 'b, 'c, 'e, 'e, 'f) fmt

List of format elements.

and ('a, 'b, 'c, 'd, 'e, 'f) ignored =
  1. | Ignored_char : ('a, 'b, 'c, 'd, 'd, 'a) ignored
  2. | Ignored_caml_char : ('a, 'b, 'c, 'd, 'd, 'a) ignored
  3. | Ignored_string : pad_option -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  4. | Ignored_caml_string : pad_option -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  5. | Ignored_int : int_conv * pad_option -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  6. | Ignored_int32 : int_conv * pad_option -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  7. | Ignored_nativeint : int_conv * pad_option -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  8. | Ignored_int64 : int_conv * pad_option -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  9. | Ignored_float : pad_option * prec_option -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  10. | Ignored_bool : pad_option -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  11. | Ignored_format_arg : pad_option + * ('g, 'h, 'i, 'j, 'k, 'l) fmtty -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  12. | Ignored_format_subst : pad_option + * ('a, 'b, 'c, 'd, 'e, 'f) fmtty -> ('a, 'b, 'c, 'd, 'e, 'f) ignored
  13. | Ignored_reader : ('a, 'b, 'c, ('b -> 'x) -> 'd, 'd, 'a) ignored
  14. | Ignored_scan_char_set : pad_option + * char_set -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  15. | Ignored_scan_get_counter : counter -> ('a, 'b, 'c, 'd, 'd, 'a) ignored
  16. | Ignored_scan_next_char : ('a, 'b, 'c, 'd, 'd, 'a) ignored
and ('a, 'b, 'c, 'd, 'e, 'f) format6 =
  1. | Format of ('a, 'b, 'c, 'd, 'e, 'f) fmt * string
val concat_fmtty : + ('g1, 'b1, 'c1, 'j1, 'd1, 'a1, 'g2, 'b2, 'c2, 'j2, 'd2, 'a2) fmtty_rel -> + ('a1, 'b1, 'c1, 'd1, 'e1, 'f1, 'a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmtty_rel -> + ('g1, 'b1, 'c1, 'j1, 'e1, 'f1, 'g2, 'b2, 'c2, 'j2, 'e2, 'f2) fmtty_rel
val erase_rel : + ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l) fmtty_rel -> + ('a, 'b, 'c, 'd, 'e, 'f) fmtty
val concat_fmt : + ('a, 'b, 'c, 'd, 'e, 'f) fmt -> + ('f, 'b, 'c, 'e, 'g, 'h) fmt -> + ('a, 'b, 'c, 'd, 'g, 'h) fmt
diff --git a/ocaml/CamlinternalLazy/index.html b/ocaml/CamlinternalLazy/index.html new file mode 100644 index 00000000..dfe97b3c --- /dev/null +++ b/ocaml/CamlinternalLazy/index.html @@ -0,0 +1,2 @@ + +CamlinternalLazy (ocaml.CamlinternalLazy)

Module CamlinternalLazy

Run-time support for lazy values. All functions in this module are for system use only, not for the casual user.

type 'a t = 'a lazy_t
exception Undefined
val force_lazy_block : 'a lazy_t -> 'a
val force_gen : only_val:bool -> 'a lazy_t -> 'a
diff --git a/ocaml/CamlinternalMenhirLib/Convert/Simplified/index.html b/ocaml/CamlinternalMenhirLib/Convert/Simplified/index.html new file mode 100644 index 00000000..b730c844 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Convert/Simplified/index.html @@ -0,0 +1,8 @@ + +Simplified (ocaml.CamlinternalMenhirLib.Convert.Simplified)

Module Convert.Simplified

val traditional2revised : + ('token, 'semantic_value) traditional -> + ('token * Stdlib.Lexing.position * Stdlib.Lexing.position, 'semantic_value) + revised
val revised2traditional : + ('token * Stdlib.Lexing.position * Stdlib.Lexing.position, 'semantic_value) + revised -> + ('token, 'semantic_value) traditional
diff --git a/ocaml/CamlinternalMenhirLib/Convert/index.html b/ocaml/CamlinternalMenhirLib/Convert/index.html new file mode 100644 index 00000000..b33fc522 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Convert/index.html @@ -0,0 +1,13 @@ + +Convert (ocaml.CamlinternalMenhirLib.Convert)

Module CamlinternalMenhirLib.Convert

type ('token, 'semantic_value) traditional = + (Stdlib.Lexing.lexbuf -> 'token) -> + Stdlib.Lexing.lexbuf -> + 'semantic_value
type ('token, 'semantic_value) revised = (unit -> 'token) -> 'semantic_value
val traditional2revised : + ('token -> 'raw_token) -> + ('token -> Stdlib.Lexing.position) -> + ('token -> Stdlib.Lexing.position) -> + ('raw_token, 'semantic_value) traditional -> + ('token, 'semantic_value) revised
val revised2traditional : + ('raw_token -> Stdlib.Lexing.position -> Stdlib.Lexing.position -> 'token) -> + ('token, 'semantic_value) revised -> + ('raw_token, 'semantic_value) traditional
module Simplified : sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/Log/index.html b/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/Log/index.html new file mode 100644 index 00000000..b71aa460 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/Log/index.html @@ -0,0 +1,6 @@ + +Log (ocaml.CamlinternalMenhirLib.Engine.Make.T.Log)

Module T.Log

val state : state -> unit
val shift : terminal -> state -> unit
val reduce_or_accept : production -> unit
val lookahead_token : + terminal -> + Stdlib.Lexing.position -> + Stdlib.Lexing.position -> + unit
val initiating_error_handling : unit -> unit
val resuming_error_handling : unit -> unit
val handling_error : state -> unit
diff --git a/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/index.html b/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/index.html new file mode 100644 index 00000000..fd08251e --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/index.html @@ -0,0 +1,17 @@ + +T (ocaml.CamlinternalMenhirLib.Engine.Make.T)

Parameter Make.T

type state
val number : state -> int
type token
type terminal
type nonterminal
type semantic_value
val token2terminal : token -> terminal
val token2value : token -> semantic_value
val error_terminal : terminal
val error_value : semantic_value
val foreach_terminal : (terminal -> 'a -> 'a) -> 'a -> 'a
type production
val production_index : production -> int
val find_production : int -> production
val default_reduction : + state -> + ('env -> production -> 'answer) -> + ('env -> 'answer) -> + 'env -> + 'answer
val action : + state -> + terminal -> + semantic_value -> + ('env -> bool -> terminal -> semantic_value -> state -> 'answer) -> + ('env -> production -> 'answer) -> + ('env -> 'answer) -> + 'env -> + 'answer
val goto_nt : state -> nonterminal -> state
val goto_prod : state -> production -> state
val maybe_goto_nt : state -> nonterminal -> state option
val is_start : production -> bool
exception Error
val semantic_action : production -> semantic_action
val may_reduce : state -> production -> bool
val log : bool
module Log : sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/Engine/Make/index.html b/ocaml/CamlinternalMenhirLib/Engine/Make/index.html new file mode 100644 index 00000000..5f1e09ae --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Engine/Make/index.html @@ -0,0 +1,40 @@ + +Make (ocaml.CamlinternalMenhirLib.Engine.Make)

Module Engine.Make

Parameters

Signature

include EngineTypes.MONOLITHIC_ENGINE + with type state = T.state + with type token = T.token + with type semantic_value = T.semantic_value
type state = T.state
type token = T.token
type semantic_value = T.semantic_value
exception Error
val entry : + [ `Legacy | `Simplified ] -> + state -> + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + semantic_value
include IncrementalEngine.INCREMENTAL_ENGINE + with type token := token + and type 'a lr1state = state + with type production = T.production + with type 'a env = (T.state, T.semantic_value, T.token) EngineTypes.env
type production = T.production
type 'a checkpoint = private
  1. | InputNeeded of 'a env
  2. | Shifting of 'a env * 'a env * bool
  3. | AboutToReduce of 'a env * production
  4. | HandlingError of 'a env
  5. | Accepted of 'a
  6. | Rejected
type strategy = [
  1. | `Legacy
  2. | `Simplified
]
val resume : ?strategy:strategy -> 'a checkpoint -> 'a checkpoint
val lexer_lexbuf_to_supplier : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + supplier
val loop : ?strategy:strategy -> supplier -> 'a checkpoint -> 'a
val loop_handle : + ('a -> 'answer) -> + ('a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val loop_handle_undo : + ('a -> 'answer) -> + ('a checkpoint -> 'a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val shifts : 'a checkpoint -> 'a env option
val acceptable : 'a checkpoint -> token -> IncrementalEngine.position -> bool
type 'a lr1state = state
val number : _ lr1state -> int
val production_index : production -> int
val find_production : int -> production
type element =
  1. | Element : 'a lr1state + * 'a + * IncrementalEngine.position + * IncrementalEngine.position -> element
type stack = element General.stream
val stack : 'a env -> stack
val top : 'a env -> element option
val pop_many : int -> 'a env -> 'a env option
val get : int -> 'a env -> element option
val current_state_number : 'a env -> int
val equal : 'a env -> 'a env -> bool
val env_has_default_reduction : 'a env -> bool
val state_has_default_reduction : _ lr1state -> bool
val pop : 'a env -> 'a env option
val force_reduction : production -> 'a env -> 'a env
val input_needed : 'a env -> 'a checkpoint
diff --git a/ocaml/CamlinternalMenhirLib/Engine/index.html b/ocaml/CamlinternalMenhirLib/Engine/index.html new file mode 100644 index 00000000..e09b2020 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Engine/index.html @@ -0,0 +1,9 @@ + +Engine (ocaml.CamlinternalMenhirLib.Engine)

Module CamlinternalMenhirLib.Engine

diff --git a/ocaml/CamlinternalMenhirLib/EngineTypes/index.html b/ocaml/CamlinternalMenhirLib/EngineTypes/index.html new file mode 100644 index 00000000..c780eb28 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/EngineTypes/index.html @@ -0,0 +1,2 @@ + +EngineTypes (ocaml.CamlinternalMenhirLib.EngineTypes)

Module CamlinternalMenhirLib.EngineTypes

type ('state, 'semantic_value) stack = {
  1. state : 'state;
  2. semv : 'semantic_value;
  3. startp : Stdlib.Lexing.position;
  4. endp : Stdlib.Lexing.position;
  5. next : ('state, 'semantic_value) stack;
}
type ('state, 'semantic_value, 'token) env = {
  1. error : bool;
  2. triple : 'token * Stdlib.Lexing.position * Stdlib.Lexing.position;
  3. stack : ('state, 'semantic_value) stack;
  4. current : 'state;
}
module type TABLE = sig ... end
module type MONOLITHIC_ENGINE = sig ... end
module type INCREMENTAL_ENGINE_START = sig ... end
module type ENGINE = sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-ENGINE/index.html b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-ENGINE/index.html new file mode 100644 index 00000000..93884975 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-ENGINE/index.html @@ -0,0 +1,35 @@ + +ENGINE (ocaml.CamlinternalMenhirLib.EngineTypes.ENGINE)

Module type EngineTypes.ENGINE

include MONOLITHIC_ENGINE
type state
type token
type semantic_value
exception Error
val entry : + [ `Legacy | `Simplified ] -> + state -> + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + semantic_value
include IncrementalEngine.INCREMENTAL_ENGINE + with type token := token + and type 'a lr1state = state
type production
type 'a env
type 'a checkpoint = private
  1. | InputNeeded of 'a env
  2. | Shifting of 'a env * 'a env * bool
  3. | AboutToReduce of 'a env * production
  4. | HandlingError of 'a env
  5. | Accepted of 'a
  6. | Rejected
type strategy = [
  1. | `Legacy
  2. | `Simplified
]
val resume : ?strategy:strategy -> 'a checkpoint -> 'a checkpoint
val lexer_lexbuf_to_supplier : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + supplier
val loop : ?strategy:strategy -> supplier -> 'a checkpoint -> 'a
val loop_handle : + ('a -> 'answer) -> + ('a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val loop_handle_undo : + ('a -> 'answer) -> + ('a checkpoint -> 'a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val shifts : 'a checkpoint -> 'a env option
val acceptable : 'a checkpoint -> token -> IncrementalEngine.position -> bool
type 'a lr1state = state
val number : _ lr1state -> int
val production_index : production -> int
val find_production : int -> production
type element =
  1. | Element : 'a lr1state + * 'a + * IncrementalEngine.position + * IncrementalEngine.position -> element
type stack = element General.stream
val stack : 'a env -> stack
val top : 'a env -> element option
val pop_many : int -> 'a env -> 'a env option
val get : int -> 'a env -> element option
val current_state_number : 'a env -> int
val equal : 'a env -> 'a env -> bool
val env_has_default_reduction : 'a env -> bool
val state_has_default_reduction : _ lr1state -> bool
val pop : 'a env -> 'a env option
val force_reduction : production -> 'a env -> 'a env
val input_needed : 'a env -> 'a checkpoint
diff --git a/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-INCREMENTAL_ENGINE_START/index.html b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-INCREMENTAL_ENGINE_START/index.html new file mode 100644 index 00000000..cf13dcb2 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-INCREMENTAL_ENGINE_START/index.html @@ -0,0 +1,2 @@ + +INCREMENTAL_ENGINE_START (ocaml.CamlinternalMenhirLib.EngineTypes.INCREMENTAL_ENGINE_START)

Module type EngineTypes.INCREMENTAL_ENGINE_START

type state
type semantic_value
type 'a checkpoint
diff --git a/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-MONOLITHIC_ENGINE/index.html b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-MONOLITHIC_ENGINE/index.html new file mode 100644 index 00000000..2aa5abb3 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-MONOLITHIC_ENGINE/index.html @@ -0,0 +1,7 @@ + +MONOLITHIC_ENGINE (ocaml.CamlinternalMenhirLib.EngineTypes.MONOLITHIC_ENGINE)

Module type EngineTypes.MONOLITHIC_ENGINE

type state
type token
type semantic_value
exception Error
val entry : + [ `Legacy | `Simplified ] -> + state -> + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + semantic_value
diff --git a/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/Log/index.html b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/Log/index.html new file mode 100644 index 00000000..fb1add9a --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/Log/index.html @@ -0,0 +1,6 @@ + +Log (ocaml.CamlinternalMenhirLib.EngineTypes.TABLE.Log)

Module TABLE.Log

val state : state -> unit
val shift : terminal -> state -> unit
val reduce_or_accept : production -> unit
val lookahead_token : + terminal -> + Stdlib.Lexing.position -> + Stdlib.Lexing.position -> + unit
val initiating_error_handling : unit -> unit
val resuming_error_handling : unit -> unit
val handling_error : state -> unit
diff --git a/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/index.html b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/index.html new file mode 100644 index 00000000..b5e29c15 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/index.html @@ -0,0 +1,17 @@ + +TABLE (ocaml.CamlinternalMenhirLib.EngineTypes.TABLE)

Module type EngineTypes.TABLE

type state
val number : state -> int
type token
type terminal
type nonterminal
type semantic_value
val token2terminal : token -> terminal
val token2value : token -> semantic_value
val error_terminal : terminal
val error_value : semantic_value
val foreach_terminal : (terminal -> 'a -> 'a) -> 'a -> 'a
type production
val production_index : production -> int
val find_production : int -> production
val default_reduction : + state -> + ('env -> production -> 'answer) -> + ('env -> 'answer) -> + 'env -> + 'answer
val action : + state -> + terminal -> + semantic_value -> + ('env -> bool -> terminal -> semantic_value -> state -> 'answer) -> + ('env -> production -> 'answer) -> + ('env -> 'answer) -> + 'env -> + 'answer
val goto_nt : state -> nonterminal -> state
val goto_prod : state -> production -> state
val maybe_goto_nt : state -> nonterminal -> state option
val is_start : production -> bool
exception Error
type semantic_action = + (state, semantic_value, token) env -> + (state, semantic_value) stack
val semantic_action : production -> semantic_action
val may_reduce : state -> production -> bool
val log : bool
module Log : sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/ErrorReports/index.html b/ocaml/CamlinternalMenhirLib/ErrorReports/index.html new file mode 100644 index 00000000..d7d1e53f --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/ErrorReports/index.html @@ -0,0 +1,13 @@ + +ErrorReports (ocaml.CamlinternalMenhirLib.ErrorReports)

Module CamlinternalMenhirLib.ErrorReports

type 'a buffer
val show : ('a -> string) -> 'a buffer -> string
val last : 'a buffer -> 'a
val extract : + string -> + (Stdlib.Lexing.position * Stdlib.Lexing.position) -> + string
val sanitize : string -> string
val compress : string -> string
val shorten : int -> string -> string
val expand : (int -> string) -> string -> string
diff --git a/ocaml/CamlinternalMenhirLib/General/index.html b/ocaml/CamlinternalMenhirLib/General/index.html new file mode 100644 index 00000000..631b3f7e --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/General/index.html @@ -0,0 +1,2 @@ + +General (ocaml.CamlinternalMenhirLib.General)

Module CamlinternalMenhirLib.General

val take : int -> 'a list -> 'a list
val drop : int -> 'a list -> 'a list
val uniq : ('a -> 'a -> int) -> 'a list -> 'a list
val weed : ('a -> 'a -> int) -> 'a list -> 'a list
type 'a stream = 'a head Stdlib.Lazy.t
and 'a head =
  1. | Nil
  2. | Cons of 'a * 'a stream
val length : 'a stream -> int
val foldr : ('a -> 'b -> 'b) -> 'a stream -> 'b -> 'b
diff --git a/ocaml/CamlinternalMenhirLib/IncrementalEngine/index.html b/ocaml/CamlinternalMenhirLib/IncrementalEngine/index.html new file mode 100644 index 00000000..c1c229bb --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/IncrementalEngine/index.html @@ -0,0 +1,2 @@ + +IncrementalEngine (ocaml.CamlinternalMenhirLib.IncrementalEngine)

Module CamlinternalMenhirLib.IncrementalEngine

type position = Stdlib.Lexing.position
module type INCREMENTAL_ENGINE = sig ... end
module type SYMBOLS = sig ... end
module type INSPECTION = sig ... end
module type EVERYTHING = sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-EVERYTHING/index.html b/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-EVERYTHING/index.html new file mode 100644 index 00000000..6f690866 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-EVERYTHING/index.html @@ -0,0 +1,18 @@ + +EVERYTHING (ocaml.CamlinternalMenhirLib.IncrementalEngine.EVERYTHING)

Module type IncrementalEngine.EVERYTHING

include INCREMENTAL_ENGINE
type token
type production
type 'a env
type 'a checkpoint = private
  1. | InputNeeded of 'a env
  2. | Shifting of 'a env * 'a env * bool
  3. | AboutToReduce of 'a env * production
  4. | HandlingError of 'a env
  5. | Accepted of 'a
  6. | Rejected
val offer : 'a checkpoint -> (token * position * position) -> 'a checkpoint
type strategy = [
  1. | `Legacy
  2. | `Simplified
]
val resume : ?strategy:strategy -> 'a checkpoint -> 'a checkpoint
type supplier = unit -> token * position * position
val lexer_lexbuf_to_supplier : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + supplier
val loop : ?strategy:strategy -> supplier -> 'a checkpoint -> 'a
val loop_handle : + ('a -> 'answer) -> + ('a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val loop_handle_undo : + ('a -> 'answer) -> + ('a checkpoint -> 'a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val shifts : 'a checkpoint -> 'a env option
val acceptable : 'a checkpoint -> token -> position -> bool
type 'a lr1state
val number : _ lr1state -> int
val production_index : production -> int
val find_production : int -> production
type element =
  1. | Element : 'a lr1state * 'a * position * position -> element
type stack = element General.stream
val stack : 'a env -> stack
val top : 'a env -> element option
val pop_many : int -> 'a env -> 'a env option
val get : int -> 'a env -> element option
val current_state_number : 'a env -> int
val equal : 'a env -> 'a env -> bool
val positions : 'a env -> position * position
val env_has_default_reduction : 'a env -> bool
val state_has_default_reduction : _ lr1state -> bool
val pop : 'a env -> 'a env option
val force_reduction : production -> 'a env -> 'a env
val input_needed : 'a env -> 'a checkpoint
include INSPECTION + with type 'a lr1state := 'a lr1state + with type production := production + with type 'a env := 'a env
include SYMBOLS
type 'a terminal
type 'a nonterminal
type 'a symbol =
  1. | T : 'a terminal -> 'a symbol
  2. | N : 'a nonterminal -> 'a symbol
type xsymbol =
  1. | X : 'a symbol -> xsymbol
type item = production * int
val compare_terminals : _ terminal -> _ terminal -> int
val compare_nonterminals : _ nonterminal -> _ nonterminal -> int
val compare_symbols : xsymbol -> xsymbol -> int
val compare_productions : production -> production -> int
val compare_items : item -> item -> int
val incoming_symbol : 'a lr1state -> 'a symbol
val items : _ lr1state -> item list
val lhs : production -> xsymbol
val rhs : production -> xsymbol list
val nullable : _ nonterminal -> bool
val first : _ nonterminal -> _ terminal -> bool
val xfirst : xsymbol -> _ terminal -> bool
val foreach_terminal : (xsymbol -> 'a -> 'a) -> 'a -> 'a
val foreach_terminal_but_error : (xsymbol -> 'a -> 'a) -> 'a -> 'a
val feed : 'a symbol -> position -> 'a -> position -> 'b env -> 'b env
diff --git a/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-INCREMENTAL_ENGINE/index.html b/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-INCREMENTAL_ENGINE/index.html new file mode 100644 index 00000000..14b88247 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-INCREMENTAL_ENGINE/index.html @@ -0,0 +1,15 @@ + +INCREMENTAL_ENGINE (ocaml.CamlinternalMenhirLib.IncrementalEngine.INCREMENTAL_ENGINE)

Module type IncrementalEngine.INCREMENTAL_ENGINE

type token
type production
type 'a env
type 'a checkpoint = private
  1. | InputNeeded of 'a env
  2. | Shifting of 'a env * 'a env * bool
  3. | AboutToReduce of 'a env * production
  4. | HandlingError of 'a env
  5. | Accepted of 'a
  6. | Rejected
val offer : 'a checkpoint -> (token * position * position) -> 'a checkpoint
type strategy = [
  1. | `Legacy
  2. | `Simplified
]
val resume : ?strategy:strategy -> 'a checkpoint -> 'a checkpoint
type supplier = unit -> token * position * position
val lexer_lexbuf_to_supplier : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + supplier
val loop : ?strategy:strategy -> supplier -> 'a checkpoint -> 'a
val loop_handle : + ('a -> 'answer) -> + ('a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val loop_handle_undo : + ('a -> 'answer) -> + ('a checkpoint -> 'a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val shifts : 'a checkpoint -> 'a env option
val acceptable : 'a checkpoint -> token -> position -> bool
type 'a lr1state
val number : _ lr1state -> int
val production_index : production -> int
val find_production : int -> production
type element =
  1. | Element : 'a lr1state * 'a * position * position -> element
type stack = element General.stream
val stack : 'a env -> stack
val top : 'a env -> element option
val pop_many : int -> 'a env -> 'a env option
val get : int -> 'a env -> element option
val current_state_number : 'a env -> int
val equal : 'a env -> 'a env -> bool
val positions : 'a env -> position * position
val env_has_default_reduction : 'a env -> bool
val state_has_default_reduction : _ lr1state -> bool
val pop : 'a env -> 'a env option
val force_reduction : production -> 'a env -> 'a env
val input_needed : 'a env -> 'a checkpoint
diff --git a/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-INSPECTION/index.html b/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-INSPECTION/index.html new file mode 100644 index 00000000..6e375e01 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-INSPECTION/index.html @@ -0,0 +1,2 @@ + +INSPECTION (ocaml.CamlinternalMenhirLib.IncrementalEngine.INSPECTION)

Module type IncrementalEngine.INSPECTION

include SYMBOLS
type 'a terminal
type 'a nonterminal
type 'a symbol =
  1. | T : 'a terminal -> 'a symbol
  2. | N : 'a nonterminal -> 'a symbol
type xsymbol =
  1. | X : 'a symbol -> xsymbol
type 'a lr1state
type production
type item = production * int
val compare_terminals : _ terminal -> _ terminal -> int
val compare_nonterminals : _ nonterminal -> _ nonterminal -> int
val compare_symbols : xsymbol -> xsymbol -> int
val compare_productions : production -> production -> int
val compare_items : item -> item -> int
val incoming_symbol : 'a lr1state -> 'a symbol
val items : _ lr1state -> item list
val lhs : production -> xsymbol
val rhs : production -> xsymbol list
val nullable : _ nonterminal -> bool
val first : _ nonterminal -> _ terminal -> bool
val xfirst : xsymbol -> _ terminal -> bool
val foreach_terminal : (xsymbol -> 'a -> 'a) -> 'a -> 'a
val foreach_terminal_but_error : (xsymbol -> 'a -> 'a) -> 'a -> 'a
type 'a env
val feed : 'a symbol -> position -> 'a -> position -> 'b env -> 'b env
diff --git a/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-SYMBOLS/index.html b/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-SYMBOLS/index.html new file mode 100644 index 00000000..d21dbfb7 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/IncrementalEngine/module-type-SYMBOLS/index.html @@ -0,0 +1,2 @@ + +SYMBOLS (ocaml.CamlinternalMenhirLib.IncrementalEngine.SYMBOLS)

Module type IncrementalEngine.SYMBOLS

type 'a terminal
type 'a nonterminal
type 'a symbol =
  1. | T : 'a terminal -> 'a symbol
  2. | N : 'a nonterminal -> 'a symbol
type xsymbol =
  1. | X : 'a symbol -> xsymbol
diff --git a/ocaml/CamlinternalMenhirLib/InfiniteArray/index.html b/ocaml/CamlinternalMenhirLib/InfiniteArray/index.html new file mode 100644 index 00000000..4d4a9334 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InfiniteArray/index.html @@ -0,0 +1,2 @@ + +InfiniteArray (ocaml.CamlinternalMenhirLib.InfiniteArray)

Module CamlinternalMenhirLib.InfiniteArray

type 'a t

This module implements infinite arrays. *

val make : 'a -> 'a t

make x creates an infinite array, where every slot contains x. *

val get : 'a t -> int -> 'a

get a i returns the element contained at offset i in the array a. Slots are numbered 0 and up. *

val set : 'a t -> int -> 'a -> unit

set a i x sets the element contained at offset i in the array a to x. Slots are numbered 0 and up. *

val extent : 'a t -> int

extent a is the length of an initial segment of the array a that is sufficiently large to contain all set operations ever performed. In other words, all elements beyond that segment have the default value.

val domain : 'a t -> 'a array

domain a is a fresh copy of an initial segment of the array a whose length is extent a.

diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableFormat/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableFormat/index.html new file mode 100644 index 00000000..03abeed5 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableFormat/index.html @@ -0,0 +1,2 @@ + +InspectionTableFormat (ocaml.CamlinternalMenhirLib.InspectionTableFormat)

Module CamlinternalMenhirLib.InspectionTableFormat

module type TABLES = sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableFormat/module-type-TABLES/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableFormat/module-type-TABLES/index.html new file mode 100644 index 00000000..6092ebee --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableFormat/module-type-TABLES/index.html @@ -0,0 +1,2 @@ + +TABLES (ocaml.CamlinternalMenhirLib.InspectionTableFormat.TABLES)

Module type InspectionTableFormat.TABLES

include IncrementalEngine.SYMBOLS
type 'a terminal
type 'a nonterminal
type 'a symbol =
  1. | T : 'a terminal -> 'a symbol
  2. | N : 'a nonterminal -> 'a symbol
type xsymbol =
  1. | X : 'a symbol -> xsymbol
type 'a lr1state
val terminal : int -> xsymbol
val nonterminal : int -> xsymbol
val lr0_core : PackedIntArray.t
val lr0_incoming : PackedIntArray.t
val nullable : string
val first : int * string
diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-1-TT/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-1-TT/index.html new file mode 100644 index 00000000..f42c57d1 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-1-TT/index.html @@ -0,0 +1,5 @@ + +TT (ocaml.CamlinternalMenhirLib.InspectionTableInterpreter.Make.TT)

Parameter Make.TT

type token
val token2terminal : token -> int
val error_terminal : int
val token2value : token -> Stdlib.Obj.t
val default_reduction : PackedIntArray.t
val error : int * string
val start : int
val semantic_action : + ((int, Stdlib.Obj.t, token) EngineTypes.env -> + (int, Stdlib.Obj.t) EngineTypes.stack) + array
exception Error
val trace : (string array * string array) option
diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-2-IT/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-2-IT/index.html new file mode 100644 index 00000000..e5b330ea --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-2-IT/index.html @@ -0,0 +1,2 @@ + +IT (ocaml.CamlinternalMenhirLib.InspectionTableInterpreter.Make.IT)

Parameter Make.IT

include IncrementalEngine.SYMBOLS
type 'a terminal
type 'a nonterminal
type 'a symbol =
  1. | T : 'a terminal -> 'a symbol
  2. | N : 'a nonterminal -> 'a symbol
type xsymbol =
  1. | X : 'a symbol -> xsymbol
type 'a lr1state = int
val terminal : int -> xsymbol
val nonterminal : int -> xsymbol
val lr0_core : PackedIntArray.t
val lr0_incoming : PackedIntArray.t
val nullable : string
val first : int * string
diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/Log/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/Log/index.html new file mode 100644 index 00000000..98882173 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/Log/index.html @@ -0,0 +1,6 @@ + +Log (ocaml.CamlinternalMenhirLib.InspectionTableInterpreter.Make.ET.Log)

Module ET.Log

val state : state -> unit
val shift : terminal -> state -> unit
val reduce_or_accept : production -> unit
val lookahead_token : + terminal -> + Stdlib.Lexing.position -> + Stdlib.Lexing.position -> + unit
val initiating_error_handling : unit -> unit
val resuming_error_handling : unit -> unit
val handling_error : state -> unit
diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/index.html new file mode 100644 index 00000000..84f589cd --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/index.html @@ -0,0 +1,17 @@ + +ET (ocaml.CamlinternalMenhirLib.InspectionTableInterpreter.Make.ET)

Parameter Make.ET

type state
val number : state -> int
type token
type terminal = int
type nonterminal = int
type semantic_value = Stdlib.Obj.t
val token2terminal : token -> terminal
val token2value : token -> semantic_value
val error_terminal : terminal
val error_value : semantic_value
val foreach_terminal : (terminal -> 'a -> 'a) -> 'a -> 'a
type production
val production_index : production -> int
val find_production : int -> production
val default_reduction : + state -> + ('env -> production -> 'answer) -> + ('env -> 'answer) -> + 'env -> + 'answer
val action : + state -> + terminal -> + semantic_value -> + ('env -> bool -> terminal -> semantic_value -> state -> 'answer) -> + ('env -> production -> 'answer) -> + ('env -> 'answer) -> + 'env -> + 'answer
val goto_nt : state -> nonterminal -> state
val goto_prod : state -> production -> state
val maybe_goto_nt : state -> nonterminal -> state option
val is_start : production -> bool
exception Error
val semantic_action : production -> semantic_action
val may_reduce : state -> production -> bool
val log : bool
module Log : sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-4-E/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-4-E/index.html new file mode 100644 index 00000000..cb36f91b --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-4-E/index.html @@ -0,0 +1,2 @@ + +E (ocaml.CamlinternalMenhirLib.InspectionTableInterpreter.Make.E)

Parameter Make.E

diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/index.html new file mode 100644 index 00000000..5bc3fb85 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/index.html @@ -0,0 +1,14 @@ + +Make (ocaml.CamlinternalMenhirLib.InspectionTableInterpreter.Make)

Module InspectionTableInterpreter.Make

Parameters

module IT : InspectionTableFormat.TABLES with type 'a lr1state = int
module ET : + EngineTypes.TABLE + with type terminal = int + and type nonterminal = int + and type semantic_value = Stdlib.Obj.t
module E : sig ... end

Signature

include IncrementalEngine.SYMBOLS + with type 'a terminal := 'a IT.terminal + with type 'a nonterminal := 'a IT.nonterminal
type 'a symbol =
  1. | T : 'a IT.terminal -> 'a symbol
  2. | N : 'a IT.nonterminal -> 'a symbol
type xsymbol =
  1. | X : 'a symbol -> xsymbol
type item = int * int
val compare_terminals : _ IT.terminal -> _ IT.terminal -> int
val compare_nonterminals : _ IT.nonterminal -> _ IT.nonterminal -> int
val compare_symbols : xsymbol -> xsymbol -> int
val compare_productions : int -> int -> int
val compare_items : item -> item -> int
val incoming_symbol : 'a IT.lr1state -> 'a symbol
val items : _ IT.lr1state -> item list
val lhs : int -> xsymbol
val rhs : int -> xsymbol list
val nullable : _ IT.nonterminal -> bool
val first : _ IT.nonterminal -> _ IT.terminal -> bool
val xfirst : xsymbol -> _ IT.terminal -> bool
val foreach_terminal : (xsymbol -> 'a -> 'a) -> 'a -> 'a
val foreach_terminal_but_error : (xsymbol -> 'a -> 'a) -> 'a -> 'a
val feed : + 'a symbol -> + IncrementalEngine.position -> + 'a -> + IncrementalEngine.position -> + 'b E.env -> + 'b E.env
diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Symbols/argument-1-T/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Symbols/argument-1-T/index.html new file mode 100644 index 00000000..ff8c9c97 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Symbols/argument-1-T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.CamlinternalMenhirLib.InspectionTableInterpreter.Symbols.T)

Parameter Symbols.T

type 'a terminal
type 'a nonterminal
diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Symbols/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Symbols/index.html new file mode 100644 index 00000000..14ddf7d2 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Symbols/index.html @@ -0,0 +1,2 @@ + +Symbols (ocaml.CamlinternalMenhirLib.InspectionTableInterpreter.Symbols)

Module InspectionTableInterpreter.Symbols

Parameters

module T : sig ... end

Signature

type 'a symbol =
  1. | T : 'a T.terminal -> 'a symbol
  2. | N : 'a T.nonterminal -> 'a symbol
type xsymbol =
  1. | X : 'a symbol -> xsymbol
diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/index.html new file mode 100644 index 00000000..777c208c --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/index.html @@ -0,0 +1,20 @@ + +InspectionTableInterpreter (ocaml.CamlinternalMenhirLib.InspectionTableInterpreter)

Module CamlinternalMenhirLib.InspectionTableInterpreter

module Symbols + (T : sig ... end) : + IncrementalEngine.SYMBOLS + with type 'a terminal := 'a T.terminal + and type 'a nonterminal := 'a T.nonterminal
module Make + (TT : TableFormat.TABLES) + (IT : InspectionTableFormat.TABLES with type 'a lr1state = int) + (ET : + EngineTypes.TABLE + with type terminal = int + and type nonterminal = int + and type semantic_value = Stdlib.Obj.t) + (E : sig ... end) : + IncrementalEngine.INSPECTION + with type 'a terminal := 'a IT.terminal + and type 'a nonterminal := 'a IT.nonterminal + and type 'a lr1state := 'a IT.lr1state + and type production := int + and type 'a env := 'a E.env
diff --git a/ocaml/CamlinternalMenhirLib/LexerUtil/index.html b/ocaml/CamlinternalMenhirLib/LexerUtil/index.html new file mode 100644 index 00000000..bcf673ae --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/LexerUtil/index.html @@ -0,0 +1,2 @@ + +LexerUtil (ocaml.CamlinternalMenhirLib.LexerUtil)

Module CamlinternalMenhirLib.LexerUtil

val read : string -> string * Stdlib.Lexing.lexbuf
val newline : Stdlib.Lexing.lexbuf -> unit
diff --git a/ocaml/CamlinternalMenhirLib/LinearizedArray/index.html b/ocaml/CamlinternalMenhirLib/LinearizedArray/index.html new file mode 100644 index 00000000..82f1ced4 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/LinearizedArray/index.html @@ -0,0 +1,2 @@ + +LinearizedArray (ocaml.CamlinternalMenhirLib.LinearizedArray)

Module CamlinternalMenhirLib.LinearizedArray

type 'a t = 'a array * int array
val make : 'a array array -> 'a t
val read : 'a t -> int -> int -> 'a
val write : 'a t -> int -> int -> 'a -> unit
val length : 'a t -> int
val row_length : 'a t -> int -> int
val read_row : 'a t -> int -> 'a list
val row_length_via : (int -> int) -> int -> int
val read_via : (int -> 'a) -> (int -> int) -> int -> int -> 'a
val read_row_via : (int -> 'a) -> (int -> int) -> int -> 'a list
diff --git a/ocaml/CamlinternalMenhirLib/PackedIntArray/index.html b/ocaml/CamlinternalMenhirLib/PackedIntArray/index.html new file mode 100644 index 00000000..0e0e3139 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/PackedIntArray/index.html @@ -0,0 +1,2 @@ + +PackedIntArray (ocaml.CamlinternalMenhirLib.PackedIntArray)

Module CamlinternalMenhirLib.PackedIntArray

type t = int * string
val pack : int array -> t
val get : t -> int -> int
val get1 : string -> int -> int
val unflatten1 : (int * string) -> int -> int -> int
diff --git a/ocaml/CamlinternalMenhirLib/Printers/Make/argument-1-I/index.html b/ocaml/CamlinternalMenhirLib/Printers/Make/argument-1-I/index.html new file mode 100644 index 00000000..4f042fda --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Printers/Make/argument-1-I/index.html @@ -0,0 +1,34 @@ + +I (ocaml.CamlinternalMenhirLib.Printers.Make.I)

Parameter Make.I

include IncrementalEngine.INCREMENTAL_ENGINE
type token
type production
type 'a env
type 'a checkpoint = private
  1. | InputNeeded of 'a env
  2. | Shifting of 'a env * 'a env * bool
  3. | AboutToReduce of 'a env * production
  4. | HandlingError of 'a env
  5. | Accepted of 'a
  6. | Rejected
type strategy = [
  1. | `Legacy
  2. | `Simplified
]
val resume : ?strategy:strategy -> 'a checkpoint -> 'a checkpoint
val lexer_lexbuf_to_supplier : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + supplier
val loop : ?strategy:strategy -> supplier -> 'a checkpoint -> 'a
val loop_handle : + ('a -> 'answer) -> + ('a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val loop_handle_undo : + ('a -> 'answer) -> + ('a checkpoint -> 'a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val shifts : 'a checkpoint -> 'a env option
val acceptable : 'a checkpoint -> token -> IncrementalEngine.position -> bool
type 'a lr1state
val number : _ lr1state -> int
val production_index : production -> int
val find_production : int -> production
type element =
  1. | Element : 'a lr1state + * 'a + * IncrementalEngine.position + * IncrementalEngine.position -> element
type stack = element General.stream
val stack : 'a env -> stack
val top : 'a env -> element option
val pop_many : int -> 'a env -> 'a env option
val get : int -> 'a env -> element option
val current_state_number : 'a env -> int
val equal : 'a env -> 'a env -> bool
val env_has_default_reduction : 'a env -> bool
val state_has_default_reduction : _ lr1state -> bool
val pop : 'a env -> 'a env option
val force_reduction : production -> 'a env -> 'a env
val input_needed : 'a env -> 'a checkpoint
include IncrementalEngine.INSPECTION + with type 'a lr1state := 'a lr1state + with type production := production + with type 'a env := 'a env
include IncrementalEngine.SYMBOLS
type 'a terminal
type 'a nonterminal
type 'a symbol =
  1. | T : 'a terminal -> 'a symbol
  2. | N : 'a nonterminal -> 'a symbol
type xsymbol =
  1. | X : 'a symbol -> xsymbol
type item = production * int
val compare_terminals : _ terminal -> _ terminal -> int
val compare_nonterminals : _ nonterminal -> _ nonterminal -> int
val compare_symbols : xsymbol -> xsymbol -> int
val compare_productions : production -> production -> int
val compare_items : item -> item -> int
val incoming_symbol : 'a lr1state -> 'a symbol
val items : _ lr1state -> item list
val lhs : production -> xsymbol
val rhs : production -> xsymbol list
val nullable : _ nonterminal -> bool
val first : _ nonterminal -> _ terminal -> bool
val xfirst : xsymbol -> _ terminal -> bool
val foreach_terminal : (xsymbol -> 'a -> 'a) -> 'a -> 'a
val foreach_terminal_but_error : (xsymbol -> 'a -> 'a) -> 'a -> 'a
val feed : + 'a symbol -> + IncrementalEngine.position -> + 'a -> + IncrementalEngine.position -> + 'b env -> + 'b env
diff --git a/ocaml/CamlinternalMenhirLib/Printers/Make/argument-2-User/index.html b/ocaml/CamlinternalMenhirLib/Printers/Make/argument-2-User/index.html new file mode 100644 index 00000000..10f9f449 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Printers/Make/argument-2-User/index.html @@ -0,0 +1,2 @@ + +User (ocaml.CamlinternalMenhirLib.Printers.Make.User)

Parameter Make.User

val print : string -> unit
val print_symbol : I.xsymbol -> unit
val print_element : (I.element -> unit) option
diff --git a/ocaml/CamlinternalMenhirLib/Printers/Make/index.html b/ocaml/CamlinternalMenhirLib/Printers/Make/index.html new file mode 100644 index 00000000..c66149cb --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Printers/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.CamlinternalMenhirLib.Printers.Make)

Module Printers.Make

Parameters

module User : sig ... end

Signature

val print_symbols : I.xsymbol list -> unit
val print_element_as_symbol : I.element -> unit
val print_stack : 'a I.env -> unit
val print_item : I.item -> unit
val print_production : I.production -> unit
val print_current_state : 'a I.env -> unit
val print_env : 'a I.env -> unit
diff --git a/ocaml/CamlinternalMenhirLib/Printers/index.html b/ocaml/CamlinternalMenhirLib/Printers/index.html new file mode 100644 index 00000000..707160cb --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/Printers/index.html @@ -0,0 +1,5 @@ + +Printers (ocaml.CamlinternalMenhirLib.Printers)

Module CamlinternalMenhirLib.Printers

module Make + (I : IncrementalEngine.EVERYTHING) + (User : sig ... end) : + sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/RowDisplacement/index.html b/ocaml/CamlinternalMenhirLib/RowDisplacement/index.html new file mode 100644 index 00000000..b67e842f --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/RowDisplacement/index.html @@ -0,0 +1,15 @@ + +RowDisplacement (ocaml.CamlinternalMenhirLib.RowDisplacement)

Module CamlinternalMenhirLib.RowDisplacement

type 'a table = int array * 'a array
val compress : + ('a -> 'a -> bool) -> + ('a -> bool) -> + 'a -> + int -> + int -> + 'a array array -> + 'a table
val get : 'a table -> int -> int -> 'a
val getget : + ('displacement -> int -> int) -> + ('data -> int -> 'a) -> + ('displacement * 'data) -> + int -> + int -> + 'a
diff --git a/ocaml/CamlinternalMenhirLib/StaticVersion/index.html b/ocaml/CamlinternalMenhirLib/StaticVersion/index.html new file mode 100644 index 00000000..0090f8e7 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/StaticVersion/index.html @@ -0,0 +1,2 @@ + +StaticVersion (ocaml.CamlinternalMenhirLib.StaticVersion)

Module CamlinternalMenhirLib.StaticVersion

val require_20210419 : unit
diff --git a/ocaml/CamlinternalMenhirLib/TableFormat/index.html b/ocaml/CamlinternalMenhirLib/TableFormat/index.html new file mode 100644 index 00000000..0dea3750 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/TableFormat/index.html @@ -0,0 +1,2 @@ + +TableFormat (ocaml.CamlinternalMenhirLib.TableFormat)

Module CamlinternalMenhirLib.TableFormat

module type TABLES = sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/TableFormat/module-type-TABLES/index.html b/ocaml/CamlinternalMenhirLib/TableFormat/module-type-TABLES/index.html new file mode 100644 index 00000000..5975e65a --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/TableFormat/module-type-TABLES/index.html @@ -0,0 +1,5 @@ + +TABLES (ocaml.CamlinternalMenhirLib.TableFormat.TABLES)

Module type TableFormat.TABLES

type token
val token2terminal : token -> int
val error_terminal : int
val token2value : token -> Stdlib.Obj.t
val default_reduction : PackedIntArray.t
val error : int * string
val start : int
val semantic_action : + ((int, Stdlib.Obj.t, token) EngineTypes.env -> + (int, Stdlib.Obj.t) EngineTypes.stack) + array
exception Error
val trace : (string array * string array) option
diff --git a/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/Log/index.html b/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/Log/index.html new file mode 100644 index 00000000..b47baa53 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/Log/index.html @@ -0,0 +1,6 @@ + +Log (ocaml.CamlinternalMenhirLib.TableInterpreter.MakeEngineTable.Log)

Module MakeEngineTable.Log

val state : state -> unit
val shift : terminal -> state -> unit
val reduce_or_accept : production -> unit
val lookahead_token : + terminal -> + Stdlib.Lexing.position -> + Stdlib.Lexing.position -> + unit
val initiating_error_handling : unit -> unit
val resuming_error_handling : unit -> unit
val handling_error : state -> unit
diff --git a/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/argument-1-T/index.html b/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/argument-1-T/index.html new file mode 100644 index 00000000..220f9551 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/argument-1-T/index.html @@ -0,0 +1,5 @@ + +T (ocaml.CamlinternalMenhirLib.TableInterpreter.MakeEngineTable.T)

Parameter MakeEngineTable.T

type token
val token2terminal : token -> int
val error_terminal : int
val token2value : token -> Stdlib.Obj.t
val default_reduction : PackedIntArray.t
val error : int * string
val start : int
val semantic_action : + ((int, Stdlib.Obj.t, token) EngineTypes.env -> + (int, Stdlib.Obj.t) EngineTypes.stack) + array
exception Error
val trace : (string array * string array) option
diff --git a/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/index.html b/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/index.html new file mode 100644 index 00000000..7eed4c2f --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/index.html @@ -0,0 +1,17 @@ + +MakeEngineTable (ocaml.CamlinternalMenhirLib.TableInterpreter.MakeEngineTable)

Module TableInterpreter.MakeEngineTable

Parameters

Signature

type state = int
val number : state -> int
type token = T.token
type terminal = int
type nonterminal = int
type semantic_value = Stdlib.Obj.t
val token2terminal : token -> terminal
val token2value : token -> semantic_value
val error_terminal : terminal
val error_value : semantic_value
val foreach_terminal : (terminal -> 'a -> 'a) -> 'a -> 'a
type production = int
val production_index : production -> int
val find_production : int -> production
val default_reduction : + state -> + ('env -> production -> 'answer) -> + ('env -> 'answer) -> + 'env -> + 'answer
val action : + state -> + terminal -> + semantic_value -> + ('env -> bool -> terminal -> semantic_value -> state -> 'answer) -> + ('env -> production -> 'answer) -> + ('env -> 'answer) -> + 'env -> + 'answer
val goto_nt : state -> nonterminal -> state
val goto_prod : state -> production -> state
val maybe_goto_nt : state -> nonterminal -> state option
val is_start : production -> bool
exception Error
val semantic_action : production -> semantic_action
val may_reduce : state -> production -> bool
val log : bool
module Log : sig ... end
diff --git a/ocaml/CamlinternalMenhirLib/TableInterpreter/index.html b/ocaml/CamlinternalMenhirLib/TableInterpreter/index.html new file mode 100644 index 00000000..da023611 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/TableInterpreter/index.html @@ -0,0 +1,10 @@ + +TableInterpreter (ocaml.CamlinternalMenhirLib.TableInterpreter)

Module CamlinternalMenhirLib.TableInterpreter

module MakeEngineTable + (T : TableFormat.TABLES) : + EngineTypes.TABLE + with type state = int + and type token = T.token + and type semantic_value = Stdlib.Obj.t + and type production = int + and type terminal = int + and type nonterminal = int
diff --git a/ocaml/CamlinternalMenhirLib/index.html b/ocaml/CamlinternalMenhirLib/index.html new file mode 100644 index 00000000..d58e08ae --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/index.html @@ -0,0 +1,2 @@ + +CamlinternalMenhirLib (ocaml.CamlinternalMenhirLib)

Module CamlinternalMenhirLib

module General : sig ... end
module Convert : sig ... end
module IncrementalEngine : sig ... end
module EngineTypes : sig ... end
module Engine : sig ... end
module ErrorReports : sig ... end
module LexerUtil : sig ... end
module Printers : sig ... end
module InfiniteArray : sig ... end
module PackedIntArray : sig ... end
module RowDisplacement : sig ... end
module LinearizedArray : sig ... end
module TableFormat : sig ... end
module InspectionTableFormat : sig ... end
module InspectionTableInterpreter : sig ... end
module TableInterpreter : sig ... end
module StaticVersion : sig ... end
diff --git a/ocaml/CamlinternalMod/index.html b/ocaml/CamlinternalMod/index.html new file mode 100644 index 00000000..66e82ea2 --- /dev/null +++ b/ocaml/CamlinternalMod/index.html @@ -0,0 +1,2 @@ + +CamlinternalMod (ocaml.CamlinternalMod)

Module CamlinternalMod

Run-time support for recursive modules. All functions in this module are for system use only, not for the casual user.

type shape =
  1. | Function
  2. | Lazy
  3. | Class
  4. | Module of shape array
  5. | Value of Stdlib.Obj.t
val init_mod : (string * int * int) -> shape -> Stdlib.Obj.t
val update_mod : shape -> Stdlib.Obj.t -> Stdlib.Obj.t -> unit
diff --git a/ocaml/CamlinternalOO/index.html b/ocaml/CamlinternalOO/index.html new file mode 100644 index 00000000..d7da2311 --- /dev/null +++ b/ocaml/CamlinternalOO/index.html @@ -0,0 +1,18 @@ + +CamlinternalOO (ocaml.CamlinternalOO)

Module CamlinternalOO

Run-time support for objects and classes. All functions in this module are for system use only, not for the casual user.

Classes

type tag
type label
type table
type meth
type t
type obj
type closure
val public_method_label : string -> tag
val new_method : table -> label
val new_variable : table -> string -> int
val new_methods_variables : + table -> + string array -> + string array -> + label array
val get_variable : table -> string -> int
val get_variables : table -> string array -> int array
val get_method_label : table -> string -> label
val get_method_labels : table -> string array -> label array
val get_method : table -> label -> meth
val set_method : table -> label -> meth -> unit
val set_methods : table -> label array -> unit
val narrow : table -> string array -> string array -> string array -> unit
val widen : table -> unit
val add_initializer : table -> (obj -> unit) -> unit
val dummy_table : table
val create_table : string array -> table
val init_class : table -> unit
val inherits : + table -> + string array -> + string array -> + string array -> + (t * (table -> obj -> Stdlib.Obj.t) * t * obj) -> + bool -> + Stdlib.Obj.t array
val make_class : + string array -> + (table -> Stdlib.Obj.t -> t) -> + t * (table -> Stdlib.Obj.t -> t) * (Stdlib.Obj.t -> t) * Stdlib.Obj.t
type init_table
val make_class_store : string array -> (table -> t) -> init_table -> unit
val dummy_class : + (string * int * int) -> + t * (table -> Stdlib.Obj.t -> t) * (Stdlib.Obj.t -> t) * Stdlib.Obj.t

Objects

val copy : < .. > as 'a -> 'a
val create_object : table -> obj
val create_object_opt : obj -> table -> obj
val run_initializers : obj -> table -> unit
val run_initializers_opt : obj -> obj -> table -> obj
val create_object_and_run_initializers : obj -> table -> obj
val send : obj -> tag -> t
val sendcache : obj -> tag -> t -> int -> t
val sendself : obj -> label -> t
val get_public_method : obj -> tag -> closure

Table cache

type tables
val lookup_tables : tables -> closure array -> tables

Builtins to reduce code size

type impl =
  1. | GetConst
  2. | GetVar
  3. | GetEnv
  4. | GetMeth
  5. | SetVar
  6. | AppConst
  7. | AppVar
  8. | AppEnv
  9. | AppMeth
  10. | AppConstConst
  11. | AppConstVar
  12. | AppConstEnv
  13. | AppConstMeth
  14. | AppVarConst
  15. | AppEnvConst
  16. | AppMethConst
  17. | MethAppConst
  18. | MethAppVar
  19. | MethAppEnv
  20. | MethAppMeth
  21. | SendConst
  22. | SendVar
  23. | SendEnv
  24. | SendMeth
  25. | Closure of closure

Parameters

type params = {
  1. mutable compact_table : bool;
  2. mutable copy_parent : bool;
  3. mutable clean_when_copying : bool;
  4. mutable retry_count : int;
  5. mutable bucket_small_size : int;
}
val params : params

Statistics

type stats = {
  1. classes : int;
  2. methods : int;
  3. inst_vars : int;
}
val stats : unit -> stats
diff --git a/ocaml/Ccomp/index.html b/ocaml/Ccomp/index.html new file mode 100644 index 00000000..9ee4ebcb --- /dev/null +++ b/ocaml/Ccomp/index.html @@ -0,0 +1,7 @@ + +Ccomp (ocaml.Ccomp)

Module Ccomp

Compiling C files and building C libraries

Warning: this module is unstable and part of compiler-libs.

val command : string -> int
val run_command : string -> unit
val compile_file : + ?output:string -> + ?opt:string -> + ?stable_name:string -> + string -> + int
val create_archive : string -> string list -> int
val quote_files : response_files:bool -> string list -> string
val quote_optfile : string option -> string
val call_linker : link_mode -> string -> string list -> string -> int
diff --git a/ocaml/Clambda/index.html b/ocaml/Clambda/index.html new file mode 100644 index 00000000..cab1c60c --- /dev/null +++ b/ocaml/Clambda/index.html @@ -0,0 +1,19 @@ + +Clambda (ocaml.Clambda)

Module Clambda

type function_label = string
type ustructured_constant =
  1. | Uconst_float of float
  2. | Uconst_int32 of int32
  3. | Uconst_int64 of int64
  4. | Uconst_nativeint of nativeint
  5. | Uconst_block of int * uconstant list
  6. | Uconst_float_array of float list
  7. | Uconst_string of string
  8. | Uconst_closure of ufunction list * string * uconstant list
and uconstant =
  1. | Uconst_ref of string * ustructured_constant option
  2. | Uconst_int of int
and uphantom_defining_expr =
  1. | Uphantom_const of uconstant
    (*

    The phantom-let-bound variable is a constant.

    *)
  2. | Uphantom_var of Backend_var.t
    (*

    The phantom-let-bound variable is an alias for another variable.

    *)
  3. | Uphantom_offset_var of {
    1. var : Backend_var.t;
    2. offset_in_words : int;
    }
    (*

    The phantom-let-bound-variable's value is defined by adding the given number of words to the pointer contained in the given identifier.

    *)
  4. | Uphantom_read_field of {
    1. var : Backend_var.t;
    2. field : int;
    }
    (*

    The phantom-let-bound-variable's value is found by adding the given number of words to the pointer contained in the given identifier, then dereferencing.

    *)
  5. | Uphantom_read_symbol_field of {
    1. sym : string;
    2. field : int;
    }
    (*

    As for Uphantom_read_var_field, but with the pointer specified by a symbol.

    *)
  6. | Uphantom_block of {
    1. tag : int;
    2. fields : Backend_var.t list;
    }
    (*

    The phantom-let-bound variable points at a block with the given structure.

    *)
and ulambda =
  1. | Uvar of Backend_var.t
  2. | Uconst of uconstant
  3. | Udirect_apply of function_label * ulambda list * Debuginfo.t
  4. | Ugeneric_apply of ulambda * ulambda list * Debuginfo.t
  5. | Uclosure of ufunction list * ulambda list
  6. | Uoffset of ulambda * int
  7. | Ulet of Asttypes.mutable_flag + * Lambda.value_kind + * Backend_var.With_provenance.t + * ulambda + * ulambda
  8. | Uphantom_let of Backend_var.With_provenance.t + * uphantom_defining_expr option + * ulambda
  9. | Uletrec of (Backend_var.With_provenance.t * ulambda) list * ulambda
  10. | Uprim of Clambda_primitives.primitive * ulambda list * Debuginfo.t
  11. | Uswitch of ulambda * ulambda_switch * Debuginfo.t
  12. | Ustringswitch of ulambda * (string * ulambda) list * ulambda option
  13. | Ustaticfail of int * ulambda list
  14. | Ucatch of int + * (Backend_var.With_provenance.t * Lambda.value_kind) list + * ulambda + * ulambda
  15. | Utrywith of ulambda * Backend_var.With_provenance.t * ulambda
  16. | Uifthenelse of ulambda * ulambda * ulambda
  17. | Usequence of ulambda * ulambda
  18. | Uwhile of ulambda * ulambda
  19. | Ufor of Backend_var.With_provenance.t + * ulambda + * ulambda + * Asttypes.direction_flag + * ulambda
  20. | Uassign of Backend_var.t * ulambda
  21. | Usend of Lambda.meth_kind * ulambda * ulambda * ulambda list * Debuginfo.t
  22. | Uunreachable
and ufunction = {
  1. label : function_label;
  2. arity : int;
  3. params : (Backend_var.With_provenance.t * Lambda.value_kind) list;
  4. return : Lambda.value_kind;
  5. body : ulambda;
  6. dbg : Debuginfo.t;
  7. env : Backend_var.t option;
  8. poll : Lambda.poll_attribute;
}
and ulambda_switch = {
  1. us_index_consts : int array;
  2. us_actions_consts : ulambda array;
  3. us_index_blocks : int array;
  4. us_actions_blocks : ulambda array;
}
type function_description = {
  1. fun_label : function_label;
  2. fun_arity : int;
  3. mutable fun_closed : bool;
  4. mutable fun_inline : (Backend_var.With_provenance.t list * ulambda) option;
  5. mutable fun_float_const_prop : bool;
  6. fun_poll : Lambda.poll_attribute;
}
type value_approximation =
  1. | Value_closure of function_description * value_approximation
  2. | Value_tuple of value_approximation array
  3. | Value_unknown
  4. | Value_const of uconstant
  5. | Value_global_field of string * int
val compare_structured_constants : + ustructured_constant -> + ustructured_constant -> + int
val compare_constants : uconstant -> uconstant -> int
type usymbol_provenance = {
  1. original_idents : Ident.t list;
  2. module_path : Path.t;
}
type uconstant_block_field =
  1. | Uconst_field_ref of string
  2. | Uconst_field_int of int
type preallocated_block = {
  1. symbol : string;
  2. exported : bool;
  3. tag : int;
  4. fields : uconstant_block_field option list;
  5. provenance : usymbol_provenance option;
}
type preallocated_constant = {
  1. symbol : string;
  2. exported : bool;
  3. definition : ustructured_constant;
  4. provenance : usymbol_provenance option;
}
type with_constants = + ulambda * preallocated_block list * preallocated_constant list
diff --git a/ocaml/Clambda_primitives/index.html b/ocaml/Clambda_primitives/index.html new file mode 100644 index 00000000..af00765f --- /dev/null +++ b/ocaml/Clambda_primitives/index.html @@ -0,0 +1,2 @@ + +Clambda_primitives (ocaml.Clambda_primitives)

Module Clambda_primitives

type mutable_flag = Asttypes.mutable_flag
type immediate_or_pointer = Lambda.immediate_or_pointer
type initialization_or_assignment = Lambda.initialization_or_assignment
type is_safe = Lambda.is_safe
type boxed =
  1. | Boxed
  2. | Unboxed
type memory_access_size =
  1. | Sixteen
  2. | Thirty_two
  3. | Sixty_four
type primitive =
  1. | Pread_symbol of string
  2. | Pmakeblock of int * mutable_flag * block_shape
  3. | Pfield of int * immediate_or_pointer * mutable_flag
  4. | Pfield_computed
  5. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
  6. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
  7. | Pfloatfield of int
  8. | Psetfloatfield of int * initialization_or_assignment
  9. | Pduprecord of Types.record_representation * int
  10. | Prunstack
  11. | Pperform
  12. | Presume
  13. | Preperform
  14. | Pccall of Primitive.description
  15. | Praise of raise_kind
  16. | Psequand
  17. | Psequor
  18. | Pnot
  19. | Pnegint
  20. | Paddint
  21. | Psubint
  22. | Pmulint
  23. | Pdivint of is_safe
  24. | Pmodint of is_safe
  25. | Pandint
  26. | Porint
  27. | Pxorint
  28. | Plslint
  29. | Plsrint
  30. | Pasrint
  31. | Pintcomp of integer_comparison
  32. | Pcompare_ints
  33. | Pcompare_floats
  34. | Pcompare_bints of boxed_integer
  35. | Poffsetint of int
  36. | Poffsetref of int
  37. | Pintoffloat
  38. | Pfloatofint
  39. | Pnegfloat
  40. | Pabsfloat
  41. | Paddfloat
  42. | Psubfloat
  43. | Pmulfloat
  44. | Pdivfloat
  45. | Pfloatcomp of float_comparison
  46. | Pstringlength
  47. | Pstringrefu
  48. | Pstringrefs
  49. | Pbyteslength
  50. | Pbytesrefu
  51. | Pbytessetu
  52. | Pbytesrefs
  53. | Pbytessets
  54. | Pmakearray of array_kind * mutable_flag
    (*

    For Pmakearray, the list of arguments must not be empty. The empty array should be represented by a distinguished constant in the middle end.

    *)
  55. | Pduparray of array_kind * mutable_flag
    (*

    For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

    *)
  56. | Parraylength of array_kind
  57. | Parrayrefu of array_kind
  58. | Parraysetu of array_kind
  59. | Parrayrefs of array_kind
  60. | Parraysets of array_kind
  61. | Pisint
  62. | Pisout
  63. | Pbintofint of boxed_integer
  64. | Pintofbint of boxed_integer
  65. | Pcvtbint of boxed_integer * boxed_integer
  66. | Pnegbint of boxed_integer
  67. | Paddbint of boxed_integer
  68. | Psubbint of boxed_integer
  69. | Pmulbint of boxed_integer
  70. | Pdivbint of {
    1. size : boxed_integer;
    2. is_safe : is_safe;
    }
  71. | Pmodbint of {
    1. size : boxed_integer;
    2. is_safe : is_safe;
    }
  72. | Pandbint of boxed_integer
  73. | Porbint of boxed_integer
  74. | Pxorbint of boxed_integer
  75. | Plslbint of boxed_integer
  76. | Plsrbint of boxed_integer
  77. | Pasrbint of boxed_integer
  78. | Pbintcomp of boxed_integer * integer_comparison
  79. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
  80. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
  81. | Pbigarraydim of int
  82. | Pstring_load of memory_access_size * is_safe
  83. | Pbytes_load of memory_access_size * is_safe
  84. | Pbytes_set of memory_access_size * is_safe
  85. | Pbigstring_load of memory_access_size * is_safe
  86. | Pbigstring_set of memory_access_size * is_safe
  87. | Pbswap16
  88. | Pbbswap of boxed_integer
  89. | Pint_as_pointer
  90. | Patomic_load of {
    1. immediate_or_pointer : immediate_or_pointer;
    }
  91. | Patomic_exchange
  92. | Patomic_cas
  93. | Patomic_fetch_add
  94. | Popaque
  95. | Pdls_get
and integer_comparison = Lambda.integer_comparison =
  1. | Ceq
  2. | Cne
  3. | Clt
  4. | Cgt
  5. | Cle
  6. | Cge
and float_comparison = Lambda.float_comparison =
  1. | CFeq
  2. | CFneq
  3. | CFlt
  4. | CFnlt
  5. | CFgt
  6. | CFngt
  7. | CFle
  8. | CFnle
  9. | CFge
  10. | CFnge
and array_kind = Lambda.array_kind =
  1. | Pgenarray
  2. | Paddrarray
  3. | Pintarray
  4. | Pfloatarray
and value_kind = Lambda.value_kind =
  1. | Pgenval
  2. | Pfloatval
  3. | Pboxedintval of boxed_integer
  4. | Pintval
and block_shape = Lambda.block_shape
and boxed_integer = Primitive.boxed_integer =
  1. | Pnativeint
  2. | Pint32
  3. | Pint64
and bigarray_kind = Lambda.bigarray_kind =
  1. | Pbigarray_unknown
  2. | Pbigarray_float32
  3. | Pbigarray_float64
  4. | Pbigarray_sint8
  5. | Pbigarray_uint8
  6. | Pbigarray_sint16
  7. | Pbigarray_uint16
  8. | Pbigarray_int32
  9. | Pbigarray_int64
  10. | Pbigarray_caml_int
  11. | Pbigarray_native_int
  12. | Pbigarray_complex32
  13. | Pbigarray_complex64
and bigarray_layout = Lambda.bigarray_layout =
  1. | Pbigarray_unknown_layout
  2. | Pbigarray_c_layout
  3. | Pbigarray_fortran_layout
and raise_kind = Lambda.raise_kind =
  1. | Raise_regular
  2. | Raise_reraise
  3. | Raise_notrace
val equal : primitive -> primitive -> bool
diff --git a/ocaml/Clflags/Compiler_pass/index.html b/ocaml/Clflags/Compiler_pass/index.html new file mode 100644 index 00000000..c476674a --- /dev/null +++ b/ocaml/Clflags/Compiler_pass/index.html @@ -0,0 +1,2 @@ + +Compiler_pass (ocaml.Clflags.Compiler_pass)

Module Clflags.Compiler_pass

type t =
  1. | Parsing
  2. | Typing
  3. | Lambda
  4. | Scheduling
  5. | Emit
val of_string : string -> t option
val to_string : t -> string
val is_compilation_pass : t -> bool
val available_pass_names : filter:(t -> bool) -> native:bool -> string list
val can_save_ir_after : t -> bool
val compare : t -> t -> int
val to_output_filename : t -> prefix:string -> string
val of_input_filename : string -> t option
diff --git a/ocaml/Clflags/Float_arg_helper/index.html b/ocaml/Clflags/Float_arg_helper/index.html new file mode 100644 index 00000000..d44bed87 --- /dev/null +++ b/ocaml/Clflags/Float_arg_helper/index.html @@ -0,0 +1,2 @@ + +Float_arg_helper (ocaml.Clflags.Float_arg_helper)

Module Clflags.Float_arg_helper

Optimization parameters represented as floats indexed by round number.

type parsed
val parse : string -> string -> parsed ref -> unit
type parse_result =
  1. | Ok
  2. | Parse_failed of exn
val parse_no_error : string -> parsed ref -> parse_result
val get : key:int -> parsed -> float
diff --git a/ocaml/Clflags/Int_arg_helper/index.html b/ocaml/Clflags/Int_arg_helper/index.html new file mode 100644 index 00000000..d3669c92 --- /dev/null +++ b/ocaml/Clflags/Int_arg_helper/index.html @@ -0,0 +1,2 @@ + +Int_arg_helper (ocaml.Clflags.Int_arg_helper)

Module Clflags.Int_arg_helper

Optimization parameters represented as ints indexed by round number.

type parsed
val parse : string -> string -> parsed ref -> unit
type parse_result =
  1. | Ok
  2. | Parse_failed of exn
val parse_no_error : string -> parsed ref -> parse_result
val get : key:int -> parsed -> int
diff --git a/ocaml/Clflags/index.html b/ocaml/Clflags/index.html new file mode 100644 index 00000000..085c51d0 --- /dev/null +++ b/ocaml/Clflags/index.html @@ -0,0 +1,2 @@ + +Clflags (ocaml.Clflags)

Module Clflags

Command line flags

module Int_arg_helper : sig ... end

Optimization parameters represented as ints indexed by round number.

module Float_arg_helper : sig ... end

Optimization parameters represented as floats indexed by round number.

type inlining_arguments = {
  1. inline_call_cost : int option;
  2. inline_alloc_cost : int option;
  3. inline_prim_cost : int option;
  4. inline_branch_cost : int option;
  5. inline_indirect_cost : int option;
  6. inline_lifting_benefit : int option;
  7. inline_branch_factor : float option;
  8. inline_max_depth : int option;
  9. inline_max_unroll : int option;
  10. inline_threshold : float option;
  11. inline_toplevel_threshold : int option;
}
val classic_arguments : inlining_arguments
val o1_arguments : inlining_arguments
val o2_arguments : inlining_arguments
val o3_arguments : inlining_arguments
val use_inlining_arguments_set : ?round:int -> inlining_arguments -> unit

Set all the inlining arguments for a round. The default is set if no round is provided.

val objfiles : string list ref
val ccobjs : string list ref
val dllibs : string list ref
val cmi_file : string option ref
val compile_only : bool ref
val output_name : string option ref
val include_dirs : string list ref
val no_std_include : bool ref
val no_cwd : bool ref
val print_types : bool ref
val make_archive : bool ref
val debug : bool ref
val debug_full : bool ref
val unsafe : bool ref
val use_linscan : bool ref
val custom_runtime : bool ref
val no_check_prims : bool ref
val bytecode_compatible_32 : bool ref
val output_c_object : bool ref
val output_complete_object : bool ref
val output_complete_executable : bool ref
val all_ccopts : string list ref
val classic : bool ref
val nopervasives : bool ref
val match_context_rows : int ref
val safer_matching : bool ref
val open_modules : string list ref
val preprocessor : string option ref
val all_ppx : string list ref
val absname : bool ref
val annotations : bool ref
val binary_annotations : bool ref
val use_threads : bool ref
val noassert : bool ref
val verbose : bool ref
val noprompt : bool ref
val nopromptcont : bool ref
val init_file : string option ref
val noinit : bool ref
val noversion : bool ref
val use_prims : string ref
val use_runtime : string ref
val plugin : bool ref
val principal : bool ref
val real_paths : bool ref
val recursive_types : bool ref
val strict_sequence : bool ref
val strict_formats : bool ref
val applicative_functors : bool ref
val make_runtime : bool ref
val c_compiler : string option ref
val dllpaths : string list ref
val make_package : bool ref
val for_package : string option ref
val error_size : int ref
val float_const_prop : bool ref
val transparent_modules : bool ref
val unique_ids : bool ref
val locations : bool ref
val dump_source : bool ref
val dump_parsetree : bool ref
val dump_typedtree : bool ref
val dump_shape : bool ref
val dump_rawlambda : bool ref
val dump_lambda : bool ref
val dump_rawclambda : bool ref
val dump_clambda : bool ref
val dump_rawflambda : bool ref
val dump_flambda : bool ref
val dump_flambda_let : int option ref
val dump_instr : bool ref
val keep_camlprimc_file : bool ref
val keep_asm_file : bool ref
val optimize_for_speed : bool ref
val dump_cmm : bool ref
val dump_selection : bool ref
val dump_cse : bool ref
val dump_live : bool ref
val dump_spill : bool ref
val dump_split : bool ref
val dump_interf : bool ref
val dump_prefer : bool ref
val dump_regalloc : bool ref
val dump_reload : bool ref
val dump_scheduling : bool ref
val dump_linear : bool ref
val dump_interval : bool ref
val keep_startup_file : bool ref
val dump_combine : bool ref
val native_code : bool ref
val default_inline_threshold : float
val inline_threshold : Float_arg_helper.parsed ref
val inlining_report : bool ref
val simplify_rounds : int option ref
val default_simplify_rounds : int ref
val rounds : unit -> int
val default_inline_max_unroll : int
val inline_max_unroll : Int_arg_helper.parsed ref
val default_inline_toplevel_threshold : int
val inline_toplevel_threshold : Int_arg_helper.parsed ref
val default_inline_call_cost : int
val default_inline_alloc_cost : int
val default_inline_prim_cost : int
val default_inline_branch_cost : int
val default_inline_indirect_cost : int
val default_inline_lifting_benefit : int
val inline_call_cost : Int_arg_helper.parsed ref
val inline_alloc_cost : Int_arg_helper.parsed ref
val inline_prim_cost : Int_arg_helper.parsed ref
val inline_branch_cost : Int_arg_helper.parsed ref
val inline_indirect_cost : Int_arg_helper.parsed ref
val inline_lifting_benefit : Int_arg_helper.parsed ref
val default_inline_branch_factor : float
val inline_branch_factor : Float_arg_helper.parsed ref
val dont_write_files : bool ref
val std_include_flag : string -> string
val std_include_dir : unit -> string list
val shared : bool ref
val dlcode : bool ref
val pic_code : bool ref
val runtime_variant : string ref
val with_runtime : bool ref
val force_slash : bool ref
val keep_docs : bool ref
val keep_locs : bool ref
val opaque : bool ref
val profile_columns : Profile.column list ref
val flambda_invariant_checks : bool ref
val unbox_closures : bool ref
val unbox_closures_factor : int ref
val default_unbox_closures_factor : int
val unbox_free_vars_of_closures : bool ref
val unbox_specialised_args : bool ref
val clambda_checks : bool ref
val cmm_invariants : bool ref
val default_inline_max_depth : int
val inline_max_depth : Int_arg_helper.parsed ref
val remove_unused_arguments : bool ref
val dump_flambda_verbose : bool ref
val classic_inlining : bool ref
val afl_instrument : bool ref
val afl_inst_ratio : int ref
val function_sections : bool ref
val all_passes : string list ref
val dumped_pass : string -> bool
val set_dumped_pass : string -> bool -> unit
val dump_into_file : bool ref
val dump_dir : string option ref
type 'a env_reader = {
  1. parse : string -> 'a option;
  2. print : 'a -> string;
  3. usage : string;
  4. env_var : string;
}
val color : Misc.Color.setting option ref
val color_reader : Misc.Color.setting env_reader
val error_style : Misc.Error_style.setting option ref
val error_style_reader : Misc.Error_style.setting env_reader
val unboxed_types : bool ref
val insn_sched : bool ref
val insn_sched_default : bool
module Compiler_pass : sig ... end
val stop_after : Compiler_pass.t option ref
val should_stop_after : Compiler_pass.t -> bool
val set_save_ir_after : Compiler_pass.t -> bool -> unit
val should_save_ir_after : Compiler_pass.t -> bool
val arg_spec : (string * Stdlib.Arg.spec * string) list ref
val add_arguments : string -> (string * Stdlib.Arg.spec * string) list -> unit
val create_usage_msg : string -> string
val print_arguments : string -> unit
val reset_arguments : unit -> unit
diff --git a/ocaml/Closure/index.html b/ocaml/Closure/index.html new file mode 100644 index 00000000..5bff32e8 --- /dev/null +++ b/ocaml/Closure/index.html @@ -0,0 +1,6 @@ + +Closure (ocaml.Closure)

Module Closure

val intro : + backend:(module Backend_intf.S) -> + size:int -> + Lambda.lambda -> + Clambda.ulambda
val reset : unit -> unit
diff --git a/ocaml/Closure_conversion/index.html b/ocaml/Closure_conversion/index.html new file mode 100644 index 00000000..0b8b1387 --- /dev/null +++ b/ocaml/Closure_conversion/index.html @@ -0,0 +1,7 @@ + +Closure_conversion (ocaml.Closure_conversion)

Module Closure_conversion

val lambda_to_flambda : + backend:(module Backend_intf.S) -> + module_ident:Ident.t -> + size:int -> + Lambda.lambda -> + Flambda.program

Generation of Flambda intermediate language code from Lambda code by performing a form of closure conversion.

Function declarations (which may bind one or more variables identifying functions, possibly with mutual recursion) are transformed to Set_of_closures expressions. Project_closure expressions are then used to select a closure for a particular function from a Set_of_closures expression. The Set_of_closures expressions say nothing about the actual runtime layout of the closures; this is handled when Flambda code is translated to Clambda code.

The following transformations are also performed during closure conversion:

  • Constant blocks (by which is meant things wrapped in Lambda.Const_block) are converted to applications of the Pmakeblock primitive.
  • Levent debugging event nodes are removed and the information within them attached to function, method and raise calls.
  • Tuplified functions are converted to curried functions and a stub function emitted to call the curried version. For example: let rec f (x, y) = f (x + 1, y + 1) is transformed to: let rec internal_f x y = f (x + 1,y + 1) and f (x, y) = internal_f x y (* f is marked as a stub function *)
  • The Pdirapply and Prevapply application primitives are removed and converted to normal Flambda application nodes.

The lambda_to_flambda function is not re-entrant.

diff --git a/ocaml/Closure_conversion_aux/Env/index.html b/ocaml/Closure_conversion_aux/Env/index.html new file mode 100644 index 00000000..71cb86b2 --- /dev/null +++ b/ocaml/Closure_conversion_aux/Env/index.html @@ -0,0 +1,2 @@ + +Env (ocaml.Closure_conversion_aux.Env)

Module Closure_conversion_aux.Env

Used to remember which Variable.t values correspond to which Ident.t values during closure conversion, and similarly for static exception identifiers.

type t
val empty : t
val add_var : t -> Ident.t -> Variable.t -> t
val add_vars : t -> Ident.t list -> Variable.t list -> t
val find_var : t -> Ident.t -> Variable.t
val find_var_exn : t -> Ident.t -> Variable.t
val add_mutable_var : t -> Ident.t -> Mutable_variable.t -> t
val find_mutable_var_exn : t -> Ident.t -> Mutable_variable.t
val add_static_exception : t -> int -> Static_exception.t -> t
val find_static_exception : t -> int -> Static_exception.t
val add_global : t -> int -> Symbol.t -> t
val find_global : t -> int -> Symbol.t
diff --git a/ocaml/Closure_conversion_aux/Function_decls/Function_decl/index.html b/ocaml/Closure_conversion_aux/Function_decls/Function_decl/index.html new file mode 100644 index 00000000..086a68a2 --- /dev/null +++ b/ocaml/Closure_conversion_aux/Function_decls/Function_decl/index.html @@ -0,0 +1,10 @@ + +Function_decl (ocaml.Closure_conversion_aux.Function_decls.Function_decl)

Module Function_decls.Function_decl

type t
val create : + let_rec_ident:Ident.t option -> + closure_bound_var:Variable.t -> + kind:Lambda.function_kind -> + params:Ident.t list -> + body:Lambda.lambda -> + attr:Lambda.function_attribute -> + loc:Lambda.scoped_location -> + t
val let_rec_ident : t -> Ident.t
val closure_bound_var : t -> Variable.t
val kind : t -> Lambda.function_kind
val params : t -> Ident.t list
val body : t -> Lambda.lambda
val inline : t -> Lambda.inline_attribute
val specialise : t -> Lambda.specialise_attribute
val is_a_functor : t -> bool
val stub : t -> bool
val poll_attribute : t -> Lambda.poll_attribute
val free_idents : t -> Ident.Set.t
diff --git a/ocaml/Closure_conversion_aux/Function_decls/index.html b/ocaml/Closure_conversion_aux/Function_decls/index.html new file mode 100644 index 00000000..c058d308 --- /dev/null +++ b/ocaml/Closure_conversion_aux/Function_decls/index.html @@ -0,0 +1,2 @@ + +Function_decls (ocaml.Closure_conversion_aux.Function_decls)

Module Closure_conversion_aux.Function_decls

Used to represent information about a set of function declarations during closure conversion. (The only case in which such a set may contain more than one declaration is when processing "let rec".)

module Function_decl : sig ... end
type t
val create : Function_decl.t list -> t
val to_list : t -> Function_decl.t list
val all_free_idents : t -> Ident.Set.t
val closure_env_without_parameters : Env.t -> t -> Env.t
diff --git a/ocaml/Closure_conversion_aux/index.html b/ocaml/Closure_conversion_aux/index.html new file mode 100644 index 00000000..44102abf --- /dev/null +++ b/ocaml/Closure_conversion_aux/index.html @@ -0,0 +1,2 @@ + +Closure_conversion_aux (ocaml.Closure_conversion_aux)

Module Closure_conversion_aux

Environments and auxiliary structures used during closure conversion.

module Env : sig ... end

Used to remember which Variable.t values correspond to which Ident.t values during closure conversion, and similarly for static exception identifiers.

module Function_decls : sig ... end

Used to represent information about a set of function declarations during closure conversion. (The only case in which such a set may contain more than one declaration is when processing "let rec".)

diff --git a/ocaml/Closure_element/Map/index.html b/ocaml/Closure_element/Map/index.html new file mode 100644 index 00000000..6fc89293 --- /dev/null +++ b/ocaml/Closure_element/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Closure_element.Map)

Module Closure_element.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Closure_element/Set/index.html b/ocaml/Closure_element/Set/index.html new file mode 100644 index 00000000..52957da9 --- /dev/null +++ b/ocaml/Closure_element/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Closure_element.Set)

Module Closure_element.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Closure_element/T/index.html b/ocaml/Closure_element/T/index.html new file mode 100644 index 00000000..787562b3 --- /dev/null +++ b/ocaml/Closure_element/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Closure_element.T)

Module Closure_element.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Closure_element/Tbl/index.html b/ocaml/Closure_element/Tbl/index.html new file mode 100644 index 00000000..615dfb40 --- /dev/null +++ b/ocaml/Closure_element/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Closure_element.Tbl)

Module Closure_element.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Closure_element/index.html b/ocaml/Closure_element/index.html new file mode 100644 index 00000000..0b97e276 --- /dev/null +++ b/ocaml/Closure_element/index.html @@ -0,0 +1,2 @@ + +Closure_element (ocaml.Closure_element)

Module Closure_element

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val wrap : Variable.t -> t
val unwrap : t -> Variable.t
val wrap_map : 'a Variable.Map.t -> 'a Map.t
val unwrap_set : Set.t -> Variable.Set.t
val in_compilation_unit : t -> Compilation_unit.t -> bool
val get_compilation_unit : t -> Compilation_unit.t
val unique_name : t -> string
val output_full : out_channel -> t -> unit
diff --git a/ocaml/Closure_id/Map/index.html b/ocaml/Closure_id/Map/index.html new file mode 100644 index 00000000..b447a8dc --- /dev/null +++ b/ocaml/Closure_id/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Closure_id.Map)

Module Closure_id.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Closure_id/Set/index.html b/ocaml/Closure_id/Set/index.html new file mode 100644 index 00000000..d521a5db --- /dev/null +++ b/ocaml/Closure_id/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Closure_id.Set)

Module Closure_id.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Closure_id/T/index.html b/ocaml/Closure_id/T/index.html new file mode 100644 index 00000000..f95eb2ae --- /dev/null +++ b/ocaml/Closure_id/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Closure_id.T)

Module Closure_id.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Closure_id/Tbl/index.html b/ocaml/Closure_id/Tbl/index.html new file mode 100644 index 00000000..fdea567f --- /dev/null +++ b/ocaml/Closure_id/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Closure_id.Tbl)

Module Closure_id.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Closure_id/index.html b/ocaml/Closure_id/index.html new file mode 100644 index 00000000..65c79590 --- /dev/null +++ b/ocaml/Closure_id/index.html @@ -0,0 +1,2 @@ + +Closure_id (ocaml.Closure_id)

Module Closure_id

CR-someday lwhite: "Closure_id" is quite a generic name. I wonder whether something like "Closure_label" would better capture that it is the label of a projection.

An identifier, unique across the whole program (not just one compilation unit), that identifies a closure within a particular set of closures (viz. Project_closure).

include module type of Closure_element
include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val wrap : Variable.t -> t
val unwrap : t -> Variable.t
val wrap_map : 'a Variable.Map.t -> 'a Map.t
val unwrap_set : Set.t -> Variable.Set.t
val in_compilation_unit : t -> Compilation_unit.t -> bool
val get_compilation_unit : t -> Compilation_unit.t
val unique_name : t -> string
val output_full : out_channel -> t -> unit
diff --git a/ocaml/Closure_middle_end/index.html b/ocaml/Closure_middle_end/index.html new file mode 100644 index 00000000..6f10851e --- /dev/null +++ b/ocaml/Closure_middle_end/index.html @@ -0,0 +1,7 @@ + +Closure_middle_end (ocaml.Closure_middle_end)

Module Closure_middle_end

val lambda_to_clambda : + backend:(module Backend_intf.S) -> + prefixname:string -> + ppf_dump:Stdlib.Format.formatter -> + Lambda.program -> + Clambda.with_constants
diff --git a/ocaml/Closure_offsets/index.html b/ocaml/Closure_offsets/index.html new file mode 100644 index 00000000..d1318888 --- /dev/null +++ b/ocaml/Closure_offsets/index.html @@ -0,0 +1,2 @@ + +Closure_offsets (ocaml.Closure_offsets)

Module Closure_offsets

Assign numerical offsets, within closure blocks, for code pointers and environment entries.

type result = private {
  1. function_offsets : int Closure_id.Map.t;
  2. free_variable_offsets : int Var_within_closure.Map.t;
}
val compute : Flambda.program -> result
diff --git a/ocaml/Closure_origin/Map/index.html b/ocaml/Closure_origin/Map/index.html new file mode 100644 index 00000000..4139c2fc --- /dev/null +++ b/ocaml/Closure_origin/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Closure_origin.Map)

Module Closure_origin.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Closure_origin/Set/index.html b/ocaml/Closure_origin/Set/index.html new file mode 100644 index 00000000..86f5ff2a --- /dev/null +++ b/ocaml/Closure_origin/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Closure_origin.Set)

Module Closure_origin.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Closure_origin/T/index.html b/ocaml/Closure_origin/T/index.html new file mode 100644 index 00000000..1524eb15 --- /dev/null +++ b/ocaml/Closure_origin/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Closure_origin.T)

Module Closure_origin.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Closure_origin/Tbl/index.html b/ocaml/Closure_origin/Tbl/index.html new file mode 100644 index 00000000..f4934fc4 --- /dev/null +++ b/ocaml/Closure_origin/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Closure_origin.Tbl)

Module Closure_origin.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Closure_origin/index.html b/ocaml/Closure_origin/index.html new file mode 100644 index 00000000..26c1f550 --- /dev/null +++ b/ocaml/Closure_origin/index.html @@ -0,0 +1,2 @@ + +Closure_origin (ocaml.Closure_origin)

Module Closure_origin

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create : Closure_id.t -> t
val get_compilation_unit : t -> Compilation_unit.t
diff --git a/ocaml/Cmi_format/index.html b/ocaml/Cmi_format/index.html new file mode 100644 index 00000000..006b7a6d --- /dev/null +++ b/ocaml/Cmi_format/index.html @@ -0,0 +1,2 @@ + +Cmi_format (ocaml.Cmi_format)

Module Cmi_format

type pers_flags =
  1. | Rectypes
  2. | Alerts of Misc.alerts
  3. | Opaque
type cmi_infos = {
  1. cmi_name : Misc.modname;
  2. cmi_sign : Types.signature_item list;
  3. cmi_crcs : Misc.crcs;
  4. cmi_flags : pers_flags list;
}
val output_cmi : string -> out_channel -> cmi_infos -> Stdlib.Digest.t
val input_cmi : in_channel -> cmi_infos
val read_cmi : string -> cmi_infos
type error =
  1. | Not_an_interface of Misc.filepath
  2. | Wrong_version_interface of Misc.filepath * string
  3. | Corrupted_interface of Misc.filepath
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Cmm/index.html b/ocaml/Cmm/index.html new file mode 100644 index 00000000..bd490ebb --- /dev/null +++ b/ocaml/Cmm/index.html @@ -0,0 +1,30 @@ + +Cmm (ocaml.Cmm)

Module Cmm

type machtype_component =
  1. | Val
  2. | Addr
  3. | Int
  4. | Float
type machtype = machtype_component array
val typ_void : machtype
val typ_val : machtype
val typ_addr : machtype
val typ_int : machtype
val typ_float : machtype

Least upper bound of two machtype_components.

val ge_component : machtype_component -> machtype_component -> bool

Returns true iff the first supplied machtype_component is greater than or equal to the second under the relation used by lub_component.

type exttype =
  1. | XInt
    (*

    r OCaml value, word-sized integer

    *)
  2. | XInt32
    (*

    r 32-bit integer

    *)
  3. | XInt64
    (*

    r 64-bit integer

    *)
  4. | XFloat
    (*

    r double-precision FP number

    *)

A variant of machtype used to describe arguments to external C functions

val machtype_of_exttype : exttype -> machtype
val machtype_of_exttype_list : exttype list -> machtype
type integer_comparison = Lambda.integer_comparison =
  1. | Ceq
  2. | Cne
  3. | Clt
  4. | Cgt
  5. | Cle
  6. | Cge
val negate_integer_comparison : integer_comparison -> integer_comparison
val swap_integer_comparison : integer_comparison -> integer_comparison
type float_comparison = Lambda.float_comparison =
  1. | CFeq
  2. | CFneq
  3. | CFlt
  4. | CFnlt
  5. | CFgt
  6. | CFngt
  7. | CFle
  8. | CFnle
  9. | CFge
  10. | CFnge
val negate_float_comparison : float_comparison -> float_comparison
val swap_float_comparison : float_comparison -> float_comparison
type label = int
val new_label : unit -> label
val set_label : label -> unit
val cur_label : unit -> label
type rec_flag =
  1. | Nonrecursive
  2. | Recursive
type phantom_defining_expr =
  1. | Cphantom_const_int of Targetint.t
    (*

    The phantom-let-bound variable is a constant integer. The argument must be the tagged representation of an integer within the range of type int on the target. (Analogously to Cconst_int.)

    *)
  2. | Cphantom_const_symbol of string
    (*

    The phantom-let-bound variable is an alias for a symbol.

    *)
  3. | Cphantom_var of Backend_var.t
    (*

    The phantom-let-bound variable is an alias for another variable. The aliased variable must not be a bound by a phantom let.

    *)
  4. | Cphantom_offset_var of {
    1. var : Backend_var.t;
    2. offset_in_words : int;
    }
    (*

    The phantom-let-bound-variable's value is defined by adding the given number of words to the pointer contained in the given identifier.

    *)
  5. | Cphantom_read_field of {
    1. var : Backend_var.t;
    2. field : int;
    }
    (*

    The phantom-let-bound-variable's value is found by adding the given number of words to the pointer contained in the given identifier, then dereferencing.

    *)
  6. | Cphantom_read_symbol_field of {
    1. sym : string;
    2. field : int;
    }
    (*

    As for Uphantom_read_var_field, but with the pointer specified by a symbol.

    *)
  7. | Cphantom_block of {
    1. tag : int;
    2. fields : Backend_var.t list;
    }
    (*

    The phantom-let-bound variable points at a block with the given structure.

    *)
type memory_chunk =
  1. | Byte_unsigned
  2. | Byte_signed
  3. | Sixteen_unsigned
  4. | Sixteen_signed
  5. | Thirtytwo_unsigned
  6. | Thirtytwo_signed
  7. | Word_int
  8. | Word_val
  9. | Single
  10. | Double
and operation =
  1. | Capply of machtype
  2. | Cextcall of string * machtype * exttype list * bool
    (*

    The machtype is the machine type of the result. The exttype list describes the unboxing types of the arguments. An empty list means "all arguments are machine words XInt". The boolean indicates whether the function may allocate.

    *)
  3. | Cload of {
    1. memory_chunk : memory_chunk;
    2. mutability : Asttypes.mutable_flag;
    3. is_atomic : bool;
    }
  4. | Calloc
  5. | Cstore of memory_chunk * Lambda.initialization_or_assignment
  6. | Caddi
  7. | Csubi
  8. | Cmuli
  9. | Cmulhi
  10. | Cdivi
  11. | Cmodi
  12. | Cand
  13. | Cor
  14. | Cxor
  15. | Clsl
  16. | Clsr
  17. | Casr
  18. | Ccmpi of integer_comparison
  19. | Caddv
  20. | Cadda
  21. | Ccmpa of integer_comparison
  22. | Cnegf
  23. | Cabsf
  24. | Caddf
  25. | Csubf
  26. | Cmulf
  27. | Cdivf
  28. | Cfloatofint
  29. | Cintoffloat
  30. | Ccmpf of float_comparison
  31. | Craise of Lambda.raise_kind
  32. | Ccheckbound
  33. | Copaque
  34. | Cdls_get
and expression =
  1. | Cconst_int of int * Debuginfo.t
  2. | Cconst_natint of nativeint * Debuginfo.t
  3. | Cconst_float of float * Debuginfo.t
  4. | Cconst_symbol of string * Debuginfo.t
  5. | Cvar of Backend_var.t
  6. | Clet of Backend_var.With_provenance.t * expression * expression
  7. | Clet_mut of Backend_var.With_provenance.t * machtype * expression * expression
  8. | Cphantom_let of Backend_var.With_provenance.t + * phantom_defining_expr option + * expression
  9. | Cassign of Backend_var.t * expression
  10. | Ctuple of expression list
  11. | Cop of operation * expression list * Debuginfo.t
  12. | Csequence of expression * expression
  13. | Cifthenelse of expression + * Debuginfo.t + * expression + * Debuginfo.t + * expression + * Debuginfo.t
  14. | Cswitch of expression + * int array + * (expression * Debuginfo.t) array + * Debuginfo.t
  15. | Ccatch of rec_flag + * (int + * (Backend_var.With_provenance.t * machtype) list + * expression + * Debuginfo.t) + list + * expression
  16. | Cexit of int * expression list
  17. | Ctrywith of expression + * Backend_var.With_provenance.t + * expression + * Debuginfo.t

Every basic block should have a corresponding Debuginfo.t for its beginning.

type codegen_option =
  1. | Reduce_code_size
  2. | No_CSE
type fundecl = {
  1. fun_name : string;
  2. fun_args : (Backend_var.With_provenance.t * machtype) list;
  3. fun_body : expression;
  4. fun_codegen_options : codegen_option list;
  5. fun_poll : Lambda.poll_attribute;
  6. fun_dbg : Debuginfo.t;
}
type data_item =
  1. | Cdefine_symbol of string
  2. | Cglobal_symbol of string
  3. | Cint8 of int
  4. | Cint16 of int
  5. | Cint32 of nativeint
  6. | Cint of nativeint
  7. | Csingle of float
  8. | Cdouble of float
  9. | Csymbol_address of string
  10. | Cstring of string
  11. | Cskip of int
  12. | Calign of int
type phrase =
  1. | Cfunction of fundecl
  2. | Cdata of data_item list
val ccatch : + (int + * (Backend_var.With_provenance.t * machtype) list + * expression + * expression + * Debuginfo.t) -> + expression
val reset : unit -> unit
val iter_shallow_tail : (expression -> unit) -> expression -> bool

Either apply the callback to all immediate sub-expressions that can produce the final result for the expression and return true, or do nothing and return false. Note that the notion of "tail" sub-expression used here does not match the one used to trigger tail calls; in particular, try...with handlers are considered to be in tail position (because their result become the final result for the expression).

val map_tail : (expression -> expression) -> expression -> expression

Apply the transformation to an expression, trying to push it to all inner sub-expressions that can produce the final result. Same disclaimer as for iter_shallow_tail about the notion of "tail" sub-expression.

val map_shallow : (expression -> expression) -> expression -> expression

Apply the transformation to each immediate sub-expression.

diff --git a/ocaml/Cmm_helpers/index.html b/ocaml/Cmm_helpers/index.html new file mode 100644 index 00000000..894cfdf5 --- /dev/null +++ b/ocaml/Cmm_helpers/index.html @@ -0,0 +1,324 @@ + +Cmm_helpers (ocaml.Cmm_helpers)

Module Cmm_helpers

val bind : + string -> + Cmm.expression -> + (Cmm.expression -> Cmm.expression) -> + Cmm.expression

bind name arg fn is equivalent to let name = arg in fn name, or simply fn arg if arg is simple enough

val bind_load : + string -> + Cmm.expression -> + (Cmm.expression -> Cmm.expression) -> + Cmm.expression

Same as bind, but also treats loads from a variable as simple

val bind_nonvar : + string -> + Cmm.expression -> + (Cmm.expression -> Cmm.expression) -> + Cmm.expression

Same as bind, but does not treat variables as simple

Headers

val caml_black : nativeint

A null header with GC bits set to black

val floatarray_tag : Debuginfo.t -> Cmm.expression

A constant equal to the tag for float arrays

val block_header : int -> int -> nativeint

block_header tag size creates a header with tag tag for a block of size size

val black_block_header : int -> int -> nativeint

Same as block_header, but with GC bits set to black

val white_closure_header : int -> nativeint

Closure headers of the given size

val black_closure_header : int -> nativeint
val infix_header : int -> nativeint

Infix header at the given offset

val float_header : nativeint

Header for a boxed float value

val floatarray_header : int -> nativeint

Header for an unboxed float array of the given size

val string_header : int -> nativeint

Header for a string (or bytes) of the given length

val boxedint32_header : nativeint

Boxed integer headers

val boxedint64_header : nativeint
val boxedintnat_header : nativeint
val closure_info : arity:int -> startenv:int -> nativeint

Closure info for a closure of given arity and distance to environment

val alloc_float_header : Debuginfo.t -> Cmm.expression

Wrappers

val alloc_floatarray_header : int -> Debuginfo.t -> Cmm.expression
val alloc_closure_header : int -> Debuginfo.t -> Cmm.expression
val alloc_infix_header : int -> Debuginfo.t -> Cmm.expression
val alloc_closure_info : + arity:int -> + startenv:int -> + Debuginfo.t -> + Cmm.expression
val alloc_boxedint32_header : Debuginfo.t -> Cmm.expression
val alloc_boxedint64_header : Debuginfo.t -> Cmm.expression
val alloc_boxedintnat_header : Debuginfo.t -> Cmm.expression

Integers

val max_repr_int : int

Minimal/maximal OCaml integer values whose backend representation fits in a regular OCaml integer

val min_repr_int : int
val int_const : Debuginfo.t -> int -> Cmm.expression

Make an integer constant from the given integer (tags the integer)

val cint_const : int -> Cmm.data_item
val targetint_const : int -> Targetint.t
val natint_const_untagged : Debuginfo.t -> Stdlib.Nativeint.t -> Cmm.expression

Make a Cmm constant holding the given nativeint value. Uses Cconst_int instead of Cconst_nativeint when possible to preserve peephole optimisations.

val add_const : Cmm.expression -> int -> Debuginfo.t -> Cmm.expression

Add an integer to the given expression

Increment/decrement of integers

val ignore_low_bit_int : Cmm.expression -> Cmm.expression

Simplify the given expression knowing its last bit will be irrelevant

val ignore_high_bit_int : Cmm.expression -> Cmm.expression

Simplify the given expression knowing its first bit will be irrelevant

Arithmetical operations on integers

Integer tagging. tag_int x = (x lsl 1) + 1

Integer untagging. untag_int x = (x asr 1)

Specific division operations for boxed integers

val mk_if_then_else : + Debuginfo.t -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression -> + Cmm.expression

If-Then-Else expression mk_if_then_else dbg cond ifso_dbg ifso ifnot_dbg ifnot associates dbg to the global if-then-else expression, ifso_dbg to the then branch ifso, and ifnot_dbg to the else branch ifnot

Boolean negation

val mk_compare_ints : + Debuginfo.t -> + Cmm.expression -> + Cmm.expression -> + Cmm.expression

Integer and float comparison that returns int not bool

val mk_compare_floats : + Debuginfo.t -> + Cmm.expression -> + Cmm.expression -> + Cmm.expression
val create_loop : Cmm.expression -> Debuginfo.t -> Cmm.expression

Loop construction (while true do expr done). Used to be represented as Cloop.

val raise_symbol : Debuginfo.t -> string -> Cmm.expression

Exception raising

Convert a tagged integer into a raw integer with boolean meaning

Float boxing and unboxing

val unbox_float : Debuginfo.t -> Cmm.expression -> Cmm.expression
val box_complex : + Debuginfo.t -> + Cmm.expression -> + Cmm.expression -> + Cmm.expression

Complex number creation and access

val return_unit : Debuginfo.t -> Cmm.expression -> Cmm.expression

Make the given expression return a unit value

val remove_unit : Cmm.expression -> Cmm.expression

Remove a trailing unit return if any

Blocks

val mk_load_mut : Cmm.memory_chunk -> Cmm.operation

Non-atomic load of a mutable field

val mk_load_atomic : Cmm.memory_chunk -> Cmm.operation

Atomic load. All atomic fields are mutable.

val field_address : Cmm.expression -> int -> Debuginfo.t -> Cmm.expression

field_address ptr n dbg returns an expression for the address of the nth field of the block pointed to by ptr

val get_field_gen : + Asttypes.mutable_flag -> + Cmm.expression -> + int -> + Debuginfo.t -> + Cmm.expression

get_field_gen mut ptr n dbg returns an expression for the access to the nth field of the block pointed to by ptr

set_field ptr n newval init dbg returns an expression for setting the nth field of the block pointed to by ptr to newval

Load a block's header

val get_header_masked : Cmm.expression -> Debuginfo.t -> Cmm.expression

Same as get_header, but also clear all reserved bits of the result

Load a block's tag

Load a block's size

Arrays

val wordsize_shift : int
val numfloat_shift : int
val is_addr_array_hdr : Cmm.expression -> Debuginfo.t -> Cmm.expression

Check whether the given array is an array of regular OCaml values (as opposed to unboxed floats), from its header or pointer

val is_addr_array_ptr : Cmm.expression -> Debuginfo.t -> Cmm.expression
val addr_array_length_shifted : Cmm.expression -> Debuginfo.t -> Cmm.expression

Get the length of an array from its header Shifts by one bit less than necessary, keeping one of the GC colour bits, to save an operation when returning the length as a caml integer or when comparing it to a caml integer. Assumes that the reserved bits are clear (see get_header_masked)

val float_array_length_shifted : + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val array_indexing : + ?typ:Cmm.machtype_component -> + int -> + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression

For array_indexing ?typ log2size ptr ofs dbg : Produces a pointer to the element of the array ptr on the position ofs with the given element log2size log2 element size. ofs is given as a tagged int expression. The optional ?typ argument is the C-- type of the result. By default, it is Addr, meaning we are constructing a derived pointer into the heap. If we know the pointer is outside the heap (this is the case for bigarray indexing), we give type Int instead.

val addr_array_ref : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression

Array loads and stores unboxed_float_array_ref and float_array_ref differ in the boxing of the result; float_array_set takes an unboxed float

val int_array_ref : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val unboxed_float_array_ref : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val float_array_ref : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val addr_array_set : + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val addr_array_initialize : + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val int_array_set : + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val float_array_set : + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression

Strings

val string_length : Cmm.expression -> Debuginfo.t -> Cmm.expression
val bigstring_length : Cmm.expression -> Debuginfo.t -> Cmm.expression

Objects

val lookup_tag : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression

Lookup a method by its hash, using caml_get_public_method Arguments :

  • obj : the object from which to lookup
  • tag : the hash of the method name, as a tagged integer
val lookup_label : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression

Lookup a method by its offset in the method table Arguments :

  • obj : the object from which to lookup
  • lab : the position of the required method in the object's method array, as a tagged integer
val call_cached_method : + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Cmm.expression list -> + Debuginfo.t -> + Cmm.expression

Lookup and call a method using the method cache Arguments :

  • obj : the object from which to lookup
  • tag : the hash of the method name, as a tagged integer
  • cache : the method cache array
  • pos : the position of the cache entry in the cache array
  • args : the additional arguments to the method call

Allocations

val make_alloc : Debuginfo.t -> int -> Cmm.expression list -> Cmm.expression

Allocate a block of regular values with the given tag

val make_float_alloc : + Debuginfo.t -> + int -> + Cmm.expression list -> + Cmm.expression

Allocate a block of unboxed floats with the given tag

Bounds checking

val make_checkbound : Debuginfo.t -> Cmm.expression list -> Cmm.expression

Generate a Ccheckbound term

check_bound safety access_size dbg length a2 k prefixes expression k with a check that reading access_size bits starting at position a2 in a string/bytes value of length length is within bounds, unless safety is Unsafe.

Sys.opaque_identity

Generic application functions

val apply_function_sym : int -> string

Get the symbol for the generic application with n arguments, and ensure its presence in the set of defined symbols

val curry_function_sym : int -> string

If n is positive, get the symbol for the generic currying wrapper with n arguments, and ensure its presence in the set of defined symbols. Otherwise, do the same for the generic tuple wrapper with -n arguments.

Bigarrays

val bigarray_get : + bool -> + Lambda.bigarray_kind -> + Lambda.bigarray_layout -> + Cmm.expression -> + Cmm.expression list -> + Debuginfo.t -> + Cmm.expression

bigarray_get unsafe kind layout b args dbg

  • unsafe : if true, do not insert bound checks
  • kind : see Lambda.bigarray_kind
  • layout : see Lambda.bigarray_layout
  • b : the bigarray to load from
  • args : a list of tagged integer expressions, corresponding to the indices in the respective dimensions
  • dbg : debugging information

bigarray_set unsafe kind layout b args newval dbg Same as bigarray_get, with newval the value being assigned

Operations on 32-bit integers

low_32 _ x is a value which agrees with x on at least the low 32 bits

val sign_extend_32 : Debuginfo.t -> Cmm.expression -> Cmm.expression

Sign extend from 32 bits to the word size

val zero_extend_32 : Debuginfo.t -> Cmm.expression -> Cmm.expression

Zero extend from 32 bits to the word size

Boxed numbers

val caml_nativeint_ops : string

Global symbols for the ops field of boxed integers

val caml_int32_ops : string
val caml_int64_ops : string

Box a given integer, without sharing of constants

Unbox a given boxed integer

val make_unsigned_int : + Primitive.boxed_integer -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression

Used to prepare 32-bit integers on 64-bit platforms for a lsr operation

val unaligned_load_16 : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val unaligned_set_16 : + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val unaligned_load_32 : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val unaligned_set_32 : + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val unaligned_load_64 : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
val unaligned_set_64 : + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression

Raw memory accesses

unaligned_set size ptr idx newval dbg

unaligned_load size ptr idx dbg

box_sized size dbg exp

Primitives

type unary_primitive = Cmm.expression -> Debuginfo.t -> Cmm.expression
val floatfield : int -> unary_primitive

Return the n-th field of a float array (or float-only record), as an unboxed float

val int_as_pointer : unary_primitive

Int_as_pointer primitive

Raise primitive

val negint : unary_primitive

Unary negation of an OCaml integer

val offsetint : int -> unary_primitive

Add a constant number to an OCaml integer

val offsetref : int -> unary_primitive

Add a constant number to an OCaml integer reference

val arraylength : Lambda.array_kind -> unary_primitive

Return the length of the array argument, as an OCaml integer

Byte swap primitive Operates on Cmm integers (unboxed values)

val bswap16 : unary_primitive

16-bit byte swap primitive Operates on Cmm integers (untagged integers)

type binary_primitive = + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression
type assignment_kind =
  1. | Caml_modify
  2. | Caml_initialize
  3. | Simple

setfield offset value_is_ptr init ptr value dbg

val setfloatfield : + int -> + Lambda.initialization_or_assignment -> + binary_primitive

setfloatfield offset init ptr value dbg value is expected to be an unboxed floating point number

val add_int_caml : binary_primitive

Operations on OCaml integers

val sub_int_caml : binary_primitive
val mul_int_caml : binary_primitive
val div_int_caml : Lambda.is_safe -> binary_primitive
val mod_int_caml : Lambda.is_safe -> binary_primitive
val and_int_caml : binary_primitive
val or_int_caml : binary_primitive
val xor_int_caml : binary_primitive
val lsl_int_caml : binary_primitive
val lsr_int_caml : binary_primitive
val asr_int_caml : binary_primitive

Strings, Bytes and Bigstrings

val stringref_unsafe : binary_primitive

Regular string/bytes access. Args: string/bytes, index

val stringref_safe : binary_primitive

Load by chunk from string/bytes, bigstring. Args: string, index

Arrays

val arrayref_unsafe : Lambda.array_kind -> binary_primitive

Array access. Args: array, index

val arrayref_safe : Lambda.array_kind -> binary_primitive
type ternary_primitive = + Cmm.expression -> + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression

Same as setfield, except the offset is one of the arguments. Args: pointer (structure/array/...), index, value

val bytesset_unsafe : ternary_primitive

Set the byte at the given offset to the given value. Args: bytes, index, value

val bytesset_safe : ternary_primitive
val arrayset_unsafe : Lambda.array_kind -> ternary_primitive

Set the element at the given index in the given array to the given value. WARNING: if kind is Pfloatarray, then value is expected to be an _unboxed_ float. Otherwise, it is expected to be a regular caml value, including in the case where the array contains floats. Args: array, index, value

val arrayset_safe : Lambda.array_kind -> ternary_primitive

Set a chunk of data in the given bytes or bigstring structure. See also string_load and bigstring_load. Note: value is expected to be an unboxed number of the given size. Args: pointer, index, value

Switch

val transl_isout : + Cmm.expression -> + Cmm.expression -> + Debuginfo.t -> + Cmm.expression

transl_isout h arg dbg

val make_switch : + Cmm.expression -> + int array -> + (Cmm.expression * Debuginfo.t) array -> + Debuginfo.t -> + Cmm.expression

make_switch arg cases actions dbg : Generate a Cswitch construct, or optimize as a static table lookup when possible.

val transl_int_switch : + Debuginfo.t -> + Cmm.expression -> + int -> + int -> + (int * Cmm.expression) list -> + Cmm.expression -> + Cmm.expression

transl_int_switch loc arg low high cases default

val transl_switch_clambda : + Debuginfo.t -> + Cmm.expression -> + int array -> + Cmm.expression array -> + Cmm.expression

transl_switch_clambda loc arg index cases

val strmatch_compile : + Debuginfo.t -> + Cmm.expression -> + Cmm.expression option -> + (string * Cmm.expression) list -> + Cmm.expression

strmatch_compile dbg arg default cases

Closures and function applications

val ptr_offset : Cmm.expression -> int -> Debuginfo.t -> Cmm.expression

Adds a constant offset to a pointer (for infix access)

val direct_apply : + string -> + Cmm.expression list -> + Debuginfo.t -> + Cmm.expression

Direct application of a function via a symbol

val generic_apply : + Asttypes.mutable_flag -> + Cmm.expression -> + Cmm.expression list -> + Debuginfo.t -> + Cmm.expression

Generic application of a function to one or several arguments. The mutable_flag argument annotates the loading of the code pointer from the closure. The Cmmgen code uses a mutable load by default, with a special case when the load is from (the first function of) the currently defined closure.

Method call : send kind met obj args dbg

  • met is a method identifier, which can be a hashed variant or an index in obj's method table, depending on kind
  • obj is the object whose method is being called
  • args is the extra arguments to the method call (Note: I'm not aware of any way for the frontend to generate any arguments other than the cache and cache position)

Generic Cmm fragments

val generic_functions : bool -> Cmx_format.unit_infos list -> Cmm.phrase list

Generate generic functions

val placeholder_dbg : unit -> Debuginfo.t
val placeholder_fun_dbg : human_name:string -> Debuginfo.t
val entry_point : string list -> Cmm.phrase

Entry point

val global_table : string list -> Cmm.phrase

Generate the caml_globals table

val reference_symbols : string list -> Cmm.phrase

Add references to the given symbols

val globals_map : + (string * Stdlib.Digest.t option * Stdlib.Digest.t option * string list) list -> + Cmm.phrase

Generate the caml_globals_map structure, as a marshalled string constant

val frame_table : string list -> Cmm.phrase

Generate the caml_frametable table, referencing the frametables from the given compilation units

val data_segment_table : string list -> Cmm.phrase

Generate the tables for data and code positions respectively of the given compilation units

val code_segment_table : string list -> Cmm.phrase
val predef_exception : int -> string -> Cmm.phrase

Generate data for a predefined exception

val plugin_header : + (Cmx_format.unit_infos * Stdlib.Digest.t) list -> + Cmm.phrase

Emit constant symbols

val cdefine_symbol : (string * Cmmgen_state.is_global) -> Cmm.data_item list

Produce the data_item list corresponding to a symbol definition

val emit_block : + (string * Cmmgen_state.is_global) -> + nativeint -> + Cmm.data_item list -> + Cmm.data_item list

emit_block symb white_header cont prepends to cont the header and symbol for the block. cont must already contain the fields of the block (and may contain additional data items afterwards).

val emit_float_constant : + (string * Cmmgen_state.is_global) -> + float -> + Cmm.data_item list -> + Cmm.data_item list

Emit specific kinds of constant blocks as data items

val emit_string_constant : + (string * Cmmgen_state.is_global) -> + string -> + Cmm.data_item list -> + Cmm.data_item list
val emit_int32_constant : + (string * Cmmgen_state.is_global) -> + int32 -> + Cmm.data_item list -> + Cmm.data_item list
val emit_int64_constant : + (string * Cmmgen_state.is_global) -> + int64 -> + Cmm.data_item list -> + Cmm.data_item list
val emit_nativeint_constant : + (string * Cmmgen_state.is_global) -> + nativeint -> + Cmm.data_item list -> + Cmm.data_item list
val emit_float_array_constant : + (string * Cmmgen_state.is_global) -> + float list -> + Cmm.data_item list -> + Cmm.data_item list
val fundecls_size : Clambda.ufunction list -> int
val emit_constant_closure : + (string * Cmmgen_state.is_global) -> + Clambda.ufunction list -> + Cmm.data_item list -> + Cmm.data_item list -> + Cmm.data_item list
val emit_preallocated_blocks : + Clambda.preallocated_block list -> + Cmm.phrase list -> + Cmm.phrase list
diff --git a/ocaml/Cmm_invariants/index.html b/ocaml/Cmm_invariants/index.html new file mode 100644 index 00000000..7e121f1e --- /dev/null +++ b/ocaml/Cmm_invariants/index.html @@ -0,0 +1,2 @@ + +Cmm_invariants (ocaml.Cmm_invariants)

Module Cmm_invariants

Check a number of continuation-related invariants

run ppf fundecl analyses the given function, and returns whether any errors were encountered (with corresponding error messages printed on the given formatter).

diff --git a/ocaml/Cmmgen/index.html b/ocaml/Cmmgen/index.html new file mode 100644 index 00000000..2bd83e7b --- /dev/null +++ b/ocaml/Cmmgen/index.html @@ -0,0 +1,6 @@ + +Cmmgen (ocaml.Cmmgen)

Module Cmmgen

diff --git a/ocaml/Cmmgen_state/index.html b/ocaml/Cmmgen_state/index.html new file mode 100644 index 00000000..7dc09619 --- /dev/null +++ b/ocaml/Cmmgen_state/index.html @@ -0,0 +1,2 @@ + +Cmmgen_state (ocaml.Cmmgen_state)

Module Cmmgen_state

Mutable state used by Cmmgen.

type is_global =
  1. | Global
  2. | Local
type constant =
  1. | Const_closure of is_global * Clambda.ufunction list * Clambda.uconstant list
  2. | Const_table of is_global * Cmm.data_item list
val add_constant : Misc.Stdlib.String.t -> constant -> unit
val add_data_items : Cmm.data_item list -> unit
val add_function : Clambda.ufunction -> unit
val get_and_clear_constants : unit -> constant Misc.Stdlib.String.Map.t
val get_and_clear_data_items : unit -> Cmm.data_item list
val next_function : unit -> Clambda.ufunction option
val no_more_functions : unit -> bool
val set_structured_constants : Clambda.preallocated_constant list -> unit
val add_structured_constant : string -> Clambda.ustructured_constant -> unit
val structured_constant_of_sym : string -> Clambda.ustructured_constant option
diff --git a/ocaml/Cmo_format/index.html b/ocaml/Cmo_format/index.html new file mode 100644 index 00000000..776e5132 --- /dev/null +++ b/ocaml/Cmo_format/index.html @@ -0,0 +1,2 @@ + +Cmo_format (ocaml.Cmo_format)

Module Cmo_format

type reloc_info =
  1. | Reloc_literal of Stdlib.Obj.t
  2. | Reloc_getglobal of Ident.t
  3. | Reloc_setglobal of Ident.t
  4. | Reloc_primitive of string
type compilation_unit = {
  1. cu_name : Misc.modname;
  2. mutable cu_pos : int;
  3. cu_codesize : int;
  4. cu_reloc : (reloc_info * int) list;
  5. cu_imports : Misc.crcs;
  6. cu_required_globals : Ident.t list;
  7. cu_primitives : string list;
  8. mutable cu_debug : int;
  9. cu_debugsize : int;
}
type library = {
  1. lib_units : compilation_unit list;
  2. lib_custom : bool;
  3. lib_ccobjs : string list;
  4. lib_ccopts : string list;
  5. lib_dllibs : string list;
}
diff --git a/ocaml/Cmt2annot/index.html b/ocaml/Cmt2annot/index.html new file mode 100644 index 00000000..4504d1d5 --- /dev/null +++ b/ocaml/Cmt2annot/index.html @@ -0,0 +1,7 @@ + +Cmt2annot (ocaml.Cmt2annot)

Module Cmt2annot

val gen_annot : + string option -> + sourcefile:string option -> + use_summaries:bool -> + Cmt_format.binary_annots -> + unit
diff --git a/ocaml/Cmt_format/index.html b/ocaml/Cmt_format/index.html new file mode 100644 index 00000000..6a2074d5 --- /dev/null +++ b/ocaml/Cmt_format/index.html @@ -0,0 +1,15 @@ + +Cmt_format (ocaml.Cmt_format)

Module Cmt_format

cmt and cmti files format.

The layout of a cmt file is as follows: <cmt> := {<cmi>} <cmt magic> {cmt infos} {<source info>} where <cmi> is the cmi file format: <cmi> := <cmi magic> <cmi info>. More precisely, the optional <cmi> part must be present if and only if the file is:

  • a cmti, or
  • a cmt, for a ml file which has no corresponding mli (hence no corresponding cmti).

Thus, we provide a common reading function for cmi and cmt(i) files which returns an option for each of the three parts: cmi info, cmt info, source info.

type binary_annots =
  1. | Packed of Types.signature * string list
  2. | Implementation of Typedtree.structure
  3. | Interface of Typedtree.signature
  4. | Partial_implementation of binary_part array
  5. | Partial_interface of binary_part array
and binary_part =
  1. | Partial_structure of Typedtree.structure
  2. | Partial_structure_item of Typedtree.structure_item
  3. | Partial_expression of Typedtree.expression
  4. | Partial_pattern : 'k Typedtree.pattern_category + * 'k Typedtree.general_pattern -> binary_part
  5. | Partial_class_expr of Typedtree.class_expr
  6. | Partial_signature of Typedtree.signature
  7. | Partial_signature_item of Typedtree.signature_item
  8. | Partial_module_type of Typedtree.module_type
type cmt_infos = {
  1. cmt_modname : Misc.modname;
  2. cmt_annots : binary_annots;
  3. cmt_value_dependencies : (Types.value_description * Types.value_description) + list;
  4. cmt_comments : (string * Location.t) list;
  5. cmt_args : string array;
  6. cmt_sourcefile : string option;
  7. cmt_builddir : string;
  8. cmt_loadpath : string list;
  9. cmt_source_digest : string option;
  10. cmt_initial_env : Env.t;
  11. cmt_imports : Misc.crcs;
  12. cmt_interface_digest : Stdlib.Digest.t option;
  13. cmt_use_summaries : bool;
  14. cmt_uid_to_loc : Location.t Shape.Uid.Tbl.t;
  15. cmt_impl_shape : Shape.t option;
}
type error =
  1. | Not_a_typedtree of string
exception Error of error
val read : string -> Cmi_format.cmi_infos option * cmt_infos option

read filename opens filename, and extract both the cmi_infos, if it exists, and the cmt_infos, if it exists. Thus, it can be used with .cmi, .cmt and .cmti files.

.cmti files always contain a cmi_infos at the beginning. .cmt files only contain a cmi_infos at the beginning if there is no associated .cmti file.

val read_cmt : string -> cmt_infos
val read_cmi : string -> Cmi_format.cmi_infos
val save_cmt : + string -> + string -> + binary_annots -> + string option -> + Env.t -> + Cmi_format.cmi_infos option -> + Shape.t option -> + unit

save_cmt filename modname binary_annots sourcefile initial_env cmi writes a cmt(i) file.

val read_magic_number : in_channel -> string
val clear : unit -> unit
val add_saved_type : binary_part -> unit
val get_saved_types : unit -> binary_part list
val set_saved_types : binary_part list -> unit
val record_value_dependency : + Types.value_description -> + Types.value_description -> + unit
diff --git a/ocaml/Cmx_format/index.html b/ocaml/Cmx_format/index.html new file mode 100644 index 00000000..7fae70b6 --- /dev/null +++ b/ocaml/Cmx_format/index.html @@ -0,0 +1,2 @@ + +Cmx_format (ocaml.Cmx_format)

Module Cmx_format

type export_info =
  1. | Clambda of Clambda.value_approximation
  2. | Flambda of Export_info.t
type unit_infos = {
  1. mutable ui_name : Misc.modname;
  2. mutable ui_symbol : string;
  3. mutable ui_defines : string list;
  4. mutable ui_imports_cmi : Misc.crcs;
  5. mutable ui_imports_cmx : Misc.crcs;
  6. mutable ui_curry_fun : int list;
  7. mutable ui_apply_fun : int list;
  8. mutable ui_send_fun : int list;
  9. mutable ui_export_info : export_info;
  10. mutable ui_for_pack : string option;
}
type library_infos = {
  1. lib_units : (unit_infos * Stdlib.Digest.t) list;
  2. lib_ccobjs : string list;
  3. lib_ccopts : string list;
}
diff --git a/ocaml/Cmxs_format/index.html b/ocaml/Cmxs_format/index.html new file mode 100644 index 00000000..906ba7f1 --- /dev/null +++ b/ocaml/Cmxs_format/index.html @@ -0,0 +1,2 @@ + +Cmxs_format (ocaml.Cmxs_format)

Module Cmxs_format

type modname = string
type crcs = (modname * Stdlib.Digest.t option) list
type dynunit = {
  1. dynu_name : modname;
  2. dynu_crc : Stdlib.Digest.t;
  3. dynu_imports_cmi : crcs;
  4. dynu_imports_cmx : crcs;
  5. dynu_defines : string list;
}
type dynheader = {
  1. dynu_magic : string;
  2. dynu_units : dynunit list;
}
diff --git a/ocaml/Coloring/index.html b/ocaml/Coloring/index.html new file mode 100644 index 00000000..e5523142 --- /dev/null +++ b/ocaml/Coloring/index.html @@ -0,0 +1,2 @@ + +Coloring (ocaml.Coloring)

Module Coloring

val allocate_registers : unit -> int array
diff --git a/ocaml/Comballoc/index.html b/ocaml/Comballoc/index.html new file mode 100644 index 00000000..a8c173fe --- /dev/null +++ b/ocaml/Comballoc/index.html @@ -0,0 +1,2 @@ + +Comballoc (ocaml.Comballoc)

Module Comballoc

val fundecl : Mach.fundecl -> Mach.fundecl
diff --git a/ocaml/Compenv/index.html b/ocaml/Compenv/index.html new file mode 100644 index 00000000..5e414d81 --- /dev/null +++ b/ocaml/Compenv/index.html @@ -0,0 +1,18 @@ + +Compenv (ocaml.Compenv)

Module Compenv

exception Exit_with_status of int
val module_of_filename : string -> string -> string
val output_prefix : string -> string
val extract_output : string option -> string
val default_output : string option -> string
val print_version_and_library : string -> 'a
val print_version_string : unit -> 'a
val print_standard_library : unit -> 'a
val fatal : string -> 'a
val first_ccopts : string list ref
val first_ppx : string list ref
val first_include_dirs : string list ref
val last_include_dirs : string list ref
val get_objfiles : with_ocamlparam:bool -> string list
val last_objfiles : string list ref
val first_objfiles : string list ref
val stop_early : bool ref
val has_linker_inputs : bool ref
type filename = string
type readenv_position =
  1. | Before_args
  2. | Before_compile of filename
val readenv : Stdlib.Format.formatter -> readenv_position -> unit
val is_unit_name : string -> bool
val check_unit_name : string -> string -> unit
type deferred_action =
  1. | ProcessImplementation of string
  2. | ProcessInterface of string
  3. | ProcessCFile of string
  4. | ProcessOtherFile of string
  5. | ProcessObjects of string list
  6. | ProcessDLLs of string list
val c_object_of_filename : string -> string
val defer : deferred_action -> unit
val anonymous : string -> unit
val impl : string -> unit
val intf : string -> unit
val process_deferred_actions : + (Stdlib.Format.formatter + * (start_from:Clflags.Compiler_pass.t -> + source_file:string -> + output_prefix:string -> + unit) + * (source_file:string -> + output_prefix:string -> + unit) + * string + * string) -> + unit
val parse_arguments : + ?current:int ref -> + string array ref -> + Stdlib.Arg.anon_fun -> + string -> + unit
diff --git a/ocaml/Compilation_unit/Map/index.html b/ocaml/Compilation_unit/Map/index.html new file mode 100644 index 00000000..2039d28b --- /dev/null +++ b/ocaml/Compilation_unit/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Compilation_unit.Map)

Module Compilation_unit.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Compilation_unit/Set/index.html b/ocaml/Compilation_unit/Set/index.html new file mode 100644 index 00000000..e608b06e --- /dev/null +++ b/ocaml/Compilation_unit/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Compilation_unit.Set)

Module Compilation_unit.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Compilation_unit/T/index.html b/ocaml/Compilation_unit/T/index.html new file mode 100644 index 00000000..859565c2 --- /dev/null +++ b/ocaml/Compilation_unit/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Compilation_unit.T)

Module Compilation_unit.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Compilation_unit/Tbl/index.html b/ocaml/Compilation_unit/Tbl/index.html new file mode 100644 index 00000000..ec16b6eb --- /dev/null +++ b/ocaml/Compilation_unit/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Compilation_unit.Tbl)

Module Compilation_unit.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Compilation_unit/index.html b/ocaml/Compilation_unit/index.html new file mode 100644 index 00000000..e22d79e5 --- /dev/null +++ b/ocaml/Compilation_unit/index.html @@ -0,0 +1,2 @@ + +Compilation_unit (ocaml.Compilation_unit)

Module Compilation_unit

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create : Ident.t -> Linkage_name.t -> t
val get_persistent_ident : t -> Ident.t
val get_linkage_name : t -> Linkage_name.t
val is_current : t -> bool
val set_current : t -> unit
val get_current : unit -> t option
val get_current_exn : unit -> t
val get_current_id_exn : unit -> Ident.t
val string_for_printing : t -> string
diff --git a/ocaml/Compile/index.html b/ocaml/Compile/index.html new file mode 100644 index 00000000..57680c8b --- /dev/null +++ b/ocaml/Compile/index.html @@ -0,0 +1,12 @@ + +Compile (ocaml.Compile)

Module Compile

Bytecode compilation for .ml and .mli files.

val interface : source_file:string -> output_prefix:string -> unit
val implementation : + start_from:Clflags.Compiler_pass.t -> + source_file:string -> + output_prefix:string -> + unit

Internal functions

*

to_bytecode info typed takes a typechecked implementation and returns its bytecode.

val emit_bytecode : + Compile_common.info -> + (Instruct.instruction list * Ident.Set.t) -> + unit

emit_bytecode bytecode output the bytecode executable.

diff --git a/ocaml/Compile_common/index.html b/ocaml/Compile_common/index.html new file mode 100644 index 00000000..9f29c195 --- /dev/null +++ b/ocaml/Compile_common/index.html @@ -0,0 +1,12 @@ + +Compile_common (ocaml.Compile_common)

Module Compile_common

Common compilation pipeline between bytecode and native.

Initialization

type info = {
  1. source_file : string;
  2. module_name : string;
  3. output_prefix : string;
  4. env : Env.t;
  5. ppf_dump : Stdlib.Format.formatter;
  6. tool_name : string;
  7. native : bool;
}

Information needed to compile a file.

val with_info : + native:bool -> + tool_name:string -> + source_file:string -> + output_prefix:string -> + dump_ext:string -> + (info -> 'a) -> + 'a

with_info ~native ~tool_name ~source_file ~output_prefix ~dump_ext k invokes its continuation k with an info structure built from its input, after initializing various global variables. This info structure and the initialized global state are not valid anymore after the continuation returns.

Due to current implementation limitations in the compiler, it is unsafe to try to compile several distinct compilation units by calling with_info several times.

Interfaces

val parse_intf : info -> Parsetree.signature

parse_intf info parses an interface (usually an .mli file).

val typecheck_intf : info -> Parsetree.signature -> Typedtree.signature

typecheck_intf info parsetree typechecks an interface and returns the typedtree of the associated signature.

val emit_signature : info -> Parsetree.signature -> Typedtree.signature -> unit

emit_signature info parsetree typedtree emits the .cmi file containing the given signature.

val interface : info -> unit

The complete compilation pipeline for interfaces.

Implementations

val parse_impl : info -> Parsetree.structure

parse_impl info parses an implementation (usually an .ml file).

typecheck_impl info parsetree typechecks an implementation and returns the typedtree of the associated module, its public interface, and a coercion against that public interface.

val implementation : + info -> + backend:(info -> Typedtree.implementation -> unit) -> + unit

The complete compilation pipeline for implementations.

Build artifacts

val cmo : info -> string
val cmx : info -> string
val obj : info -> string
val annot : info -> string

Return the filename of some compiler build artifacts associated with the file being compiled.

diff --git a/ocaml/Compilenv/index.html b/ocaml/Compilenv/index.html new file mode 100644 index 00000000..c8f38378 --- /dev/null +++ b/ocaml/Compilenv/index.html @@ -0,0 +1,8 @@ + +Compilenv (ocaml.Compilenv)

Module Compilenv

val imported_sets_of_closures_table : + Simple_value_approx.function_declarations option Set_of_closures_id.Tbl.t
val reset : ?packname:string -> string -> unit
val unit_id_from_name : string -> Ident.t
val current_unit_infos : unit -> Cmx_format.unit_infos
val current_unit_name : unit -> string
val current_unit_linkage_name : unit -> Linkage_name.t
val current_unit : unit -> Compilation_unit.t
val current_unit_symbol : unit -> Symbol.t
val make_symbol : ?unitname:string -> string option -> string
val symbol_in_current_unit : string -> bool
val is_predefined_exception : Symbol.t -> bool
val unit_for_global : Ident.t -> Compilation_unit.t
val symbol_for_global : Ident.t -> string
val symbol_for_global' : Ident.t -> Symbol.t
val global_approx : Ident.t -> Clambda.value_approximation
val set_global_approx : Clambda.value_approximation -> unit
val record_global_approx_toplevel : unit -> unit
val set_export_info : Export_info.t -> unit
val approx_env : unit -> Export_info.t
val approx_for_global : Compilation_unit.t -> Export_info.t option
val need_curry_fun : int -> unit
val need_apply_fun : int -> unit
val need_send_fun : int -> unit
val new_const_symbol : unit -> string
val closure_symbol : Closure_id.t -> Symbol.t
val function_label : Closure_id.t -> string
val new_structured_constant : + Clambda.ustructured_constant -> + shared:bool -> + string
val structured_constants : unit -> Clambda.preallocated_constant list
val clear_structured_constants : unit -> unit
val structured_constant_of_symbol : + string -> + Clambda.ustructured_constant option
val add_exported_constant : string -> unit
type structured_constants
val snapshot : unit -> structured_constants
val backtrack : structured_constants -> unit
val read_unit_info : string -> Cmx_format.unit_infos * Stdlib.Digest.t
val write_unit_info : Cmx_format.unit_infos -> string -> unit
val save_unit_info : string -> unit
val cache_unit_info : Cmx_format.unit_infos -> unit
val require_global : Ident.t -> unit
val read_library_info : string -> Cmx_format.library_infos
type error =
  1. | Not_a_unit_info of string
  2. | Corrupted_unit_info of string
  3. | Illegal_renaming of string * string * string
  4. | Mismatching_for_pack of string * string * string * string option
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Compmisc/index.html b/ocaml/Compmisc/index.html new file mode 100644 index 00000000..b9234533 --- /dev/null +++ b/ocaml/Compmisc/index.html @@ -0,0 +1,6 @@ + +Compmisc (ocaml.Compmisc)

Module Compmisc

val init_path : + ?auto_include:Load_path.auto_include_callback -> + ?dir:string -> + unit -> + unit
val initial_env : unit -> Env.t
val set_from_env : 'a option ref -> 'a Clflags.env_reader -> unit
val read_clflags_from_env : unit -> unit
val with_ppf_dump : file_prefix:string -> (Stdlib.Format.formatter -> 'a) -> 'a

auto_include find_in_dir fn is a callback function to be passed to Load_path.init and automatically adds -I +lib to the load path after displaying an alert.

diff --git a/ocaml/Compression/index.html b/ocaml/Compression/index.html new file mode 100644 index 00000000..8422e01c --- /dev/null +++ b/ocaml/Compression/index.html @@ -0,0 +1,2 @@ + +Compression (ocaml.Compression)

Module Compression

val output_value : out_channel -> 'a -> unit

Compression.output_value chan v writes the representation of v on channel chan. If compression is supported, the marshaled data representing value v is compressed before being written to channel chan. If compression is not supported, this function behaves like Stdlib.output_value.

val input_value : in_channel -> 'a

Compression.input_value chan reads from channel chan the byte representation of a structured value, as produced by Compression.output_value, and reconstructs and returns the corresponding value. If compression is not supported, this function behaves like Stdlib.input_value.

val compression_supported : bool

Reports whether compression is supported.

diff --git a/ocaml/Config/index.html b/ocaml/Config/index.html new file mode 100644 index 00000000..a14feb8f --- /dev/null +++ b/ocaml/Config/index.html @@ -0,0 +1,2 @@ + +Config (ocaml.Config)

Module Config

System configuration

Warning: this module is unstable and part of compiler-libs.

val version : string

The current version number of the system

val bindir : string

The directory containing the binary programs

val standard_library : string

The directory containing the standard libraries

val ccomp_type : string

The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

val c_compiler : string

The compiler to use for compiling C files

val c_output_obj : string

Name of the option of the C compiler for specifying the output file

val c_has_debug_prefix_map : bool

Whether the C compiler supports -fdebug-prefix-map

val as_has_debug_prefix_map : bool

Whether the assembler supports --debug-prefix-map

val ocamlc_cflags : string

The flags ocamlc should pass to the C compiler

val ocamlc_cppflags : string

The flags ocamlc should pass to the C preprocessor

val ocamlopt_cflags : string
  • deprecated

    ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

val ocamlopt_cppflags : string
  • deprecated

    ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

val bytecomp_c_libraries : string

The C libraries to link with custom runtimes

val native_c_libraries : string

The C libraries to link with native-code programs

val native_pack_linker : string

The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

val mkdll : string

The linker command line to build dynamic libraries.

val mkexe : string

The linker command line to build executables.

val mkmaindll : string

The linker command line to build main programs as dlls.

val default_rpath : string

Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

val mksharedlibrpath : string

Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

val ar : string

Name of the ar command, or "" if not needed (MSVC)

val interface_suffix : string ref

Suffix for interface file names

val exec_magic_number : string

Magic number for bytecode executable files

val cmi_magic_number : string

Magic number for compiled interface files

val cmo_magic_number : string

Magic number for object bytecode files

val cma_magic_number : string

Magic number for archive files

val cmx_magic_number : string

Magic number for compilation unit descriptions

val cmxa_magic_number : string

Magic number for libraries of compilation unit descriptions

val ast_intf_magic_number : string

Magic number for file holding an interface syntax tree

val ast_impl_magic_number : string

Magic number for file holding an implementation syntax tree

val cmxs_magic_number : string

Magic number for dynamically-loadable plugins

val cmt_magic_number : string

Magic number for compiled interface files

val linear_magic_number : string

Magic number for Linear internal representation files

val max_tag : int

Biggest tag that can be stored in the header of a regular block.

val lazy_tag : int

Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

val max_young_wosize : int

Maximal size of arrays that are directly allocated in the minor heap

val stack_threshold : int

Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

val stack_safety_margin : int

Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

val native_compiler : bool

Whether the native compiler is available or not

  • since 5.1
val architecture : string

Name of processor type for the native-code compiler

val model : string

Name of processor submodel for the native-code compiler

val system : string

Name of operating system for the native-code compiler

val asm : string

The assembler (and flags) to use for assembling ocamlopt-generated code.

val asm_cfi_supported : bool

Whether assembler understands CFI directives

val with_frame_pointers : bool

Whether assembler should maintain frame pointers

val ext_obj : string

Extension for object files, e.g. .o under Unix.

val ext_asm : string

Extension for assembler files, e.g. .s under Unix.

val ext_lib : string

Extension for library files, e.g. .a under Unix.

val ext_dll : string

Extension for dynamically-loaded libraries, e.g. .so under Unix.

val ext_exe : string

Extension for executable programs, e.g. .exe under Windows.

  • since 4.12
val default_executable_name : string

Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

val systhread_supported : bool

Whether the system thread library is implemented

val flexdll_dirs : string list

Directories needed for the FlexDLL objects

val host : string

Whether the compiler is a cross-compiler

val target : string

Whether the compiler is a cross-compiler

val flambda : bool

Whether the compiler was configured for flambda

val with_flambda_invariants : bool

Whether the invariants checks for flambda are enabled

val with_cmm_invariants : bool

Whether the invariants checks for Cmm are enabled

val reserved_header_bits : int

How many bits of a block's header are reserved

val flat_float_array : bool

Whether the compiler and runtime automagically flatten float arrays

val function_sections : bool

Whether the compiler was configured to generate each function in a separate section

val windows_unicode : bool

Whether Windows Unicode runtime is enabled

val naked_pointers : bool

Whether the runtime supports naked pointers

  • since 4.14
val supports_shared_libraries : bool

Whether shared libraries are supported

  • since 4.08

Whether native shared libraries are supported

  • since 5.1
val afl_instrument : bool

Whether afl-fuzz instrumentation is generated by default

val ar_supports_response_files : bool

Whether ar supports @FILE arguments.

val print_config : out_channel -> unit

Access to configuration values

val config_var : string -> string option

the configuration value of a variable, if it exists

diff --git a/ocaml/Config_boot/index.html b/ocaml/Config_boot/index.html new file mode 100644 index 00000000..e5e8ccd0 --- /dev/null +++ b/ocaml/Config_boot/index.html @@ -0,0 +1,2 @@ + +Config_boot (ocaml.Config_boot)

Module Config_boot

System configuration

Warning: this module is unstable and part of compiler-libs.

val version : string

The current version number of the system

val bindir : string

The directory containing the binary programs

val standard_library : string

The directory containing the standard libraries

val ccomp_type : string

The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

val c_compiler : string

The compiler to use for compiling C files

val c_output_obj : string

Name of the option of the C compiler for specifying the output file

val c_has_debug_prefix_map : bool

Whether the C compiler supports -fdebug-prefix-map

val as_has_debug_prefix_map : bool

Whether the assembler supports --debug-prefix-map

val ocamlc_cflags : string

The flags ocamlc should pass to the C compiler

val ocamlc_cppflags : string

The flags ocamlc should pass to the C preprocessor

val ocamlopt_cflags : string
  • deprecated

    ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

val ocamlopt_cppflags : string
  • deprecated

    ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

val bytecomp_c_libraries : string

The C libraries to link with custom runtimes

val native_c_libraries : string

The C libraries to link with native-code programs

val native_pack_linker : string

The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

val mkdll : string

The linker command line to build dynamic libraries.

val mkexe : string

The linker command line to build executables.

val mkmaindll : string

The linker command line to build main programs as dlls.

val default_rpath : string

Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

val mksharedlibrpath : string

Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

val ar : string

Name of the ar command, or "" if not needed (MSVC)

val interface_suffix : string ref

Suffix for interface file names

val exec_magic_number : string

Magic number for bytecode executable files

val cmi_magic_number : string

Magic number for compiled interface files

val cmo_magic_number : string

Magic number for object bytecode files

val cma_magic_number : string

Magic number for archive files

val cmx_magic_number : string

Magic number for compilation unit descriptions

val cmxa_magic_number : string

Magic number for libraries of compilation unit descriptions

val ast_intf_magic_number : string

Magic number for file holding an interface syntax tree

val ast_impl_magic_number : string

Magic number for file holding an implementation syntax tree

val cmxs_magic_number : string

Magic number for dynamically-loadable plugins

val cmt_magic_number : string

Magic number for compiled interface files

val linear_magic_number : string

Magic number for Linear internal representation files

val max_tag : int

Biggest tag that can be stored in the header of a regular block.

val lazy_tag : int

Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

val max_young_wosize : int

Maximal size of arrays that are directly allocated in the minor heap

val stack_threshold : int

Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

val stack_safety_margin : int

Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

val native_compiler : bool

Whether the native compiler is available or not

  • since 5.1
val architecture : string

Name of processor type for the native-code compiler

val model : string

Name of processor submodel for the native-code compiler

val system : string

Name of operating system for the native-code compiler

val asm : string

The assembler (and flags) to use for assembling ocamlopt-generated code.

val asm_cfi_supported : bool

Whether assembler understands CFI directives

val with_frame_pointers : bool

Whether assembler should maintain frame pointers

val ext_obj : string

Extension for object files, e.g. .o under Unix.

val ext_asm : string

Extension for assembler files, e.g. .s under Unix.

val ext_lib : string

Extension for library files, e.g. .a under Unix.

val ext_dll : string

Extension for dynamically-loaded libraries, e.g. .so under Unix.

val ext_exe : string

Extension for executable programs, e.g. .exe under Windows.

  • since 4.12
val default_executable_name : string

Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

val systhread_supported : bool

Whether the system thread library is implemented

val flexdll_dirs : string list

Directories needed for the FlexDLL objects

val host : string

Whether the compiler is a cross-compiler

val target : string

Whether the compiler is a cross-compiler

val flambda : bool

Whether the compiler was configured for flambda

val with_flambda_invariants : bool

Whether the invariants checks for flambda are enabled

val with_cmm_invariants : bool

Whether the invariants checks for Cmm are enabled

val reserved_header_bits : int

How many bits of a block's header are reserved

val flat_float_array : bool

Whether the compiler and runtime automagically flatten float arrays

val function_sections : bool

Whether the compiler was configured to generate each function in a separate section

val windows_unicode : bool

Whether Windows Unicode runtime is enabled

val naked_pointers : bool

Whether the runtime supports naked pointers

  • since 4.14
val supports_shared_libraries : bool

Whether shared libraries are supported

  • since 4.08

Whether native shared libraries are supported

  • since 5.1
val afl_instrument : bool

Whether afl-fuzz instrumentation is generated by default

val ar_supports_response_files : bool

Whether ar supports @FILE arguments.

val print_config : out_channel -> unit

Access to configuration values

val config_var : string -> string option

the configuration value of a variable, if it exists

diff --git a/ocaml/Config_main/index.html b/ocaml/Config_main/index.html new file mode 100644 index 00000000..d03e8f4c --- /dev/null +++ b/ocaml/Config_main/index.html @@ -0,0 +1,2 @@ + +Config_main (ocaml.Config_main)

Module Config_main

System configuration

Warning: this module is unstable and part of compiler-libs.

val version : string

The current version number of the system

val bindir : string

The directory containing the binary programs

val standard_library : string

The directory containing the standard libraries

val ccomp_type : string

The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

val c_compiler : string

The compiler to use for compiling C files

val c_output_obj : string

Name of the option of the C compiler for specifying the output file

val c_has_debug_prefix_map : bool

Whether the C compiler supports -fdebug-prefix-map

val as_has_debug_prefix_map : bool

Whether the assembler supports --debug-prefix-map

val ocamlc_cflags : string

The flags ocamlc should pass to the C compiler

val ocamlc_cppflags : string

The flags ocamlc should pass to the C preprocessor

val ocamlopt_cflags : string
  • deprecated

    ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

val ocamlopt_cppflags : string
  • deprecated

    ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

val bytecomp_c_libraries : string

The C libraries to link with custom runtimes

val native_c_libraries : string

The C libraries to link with native-code programs

val native_pack_linker : string

The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

val mkdll : string

The linker command line to build dynamic libraries.

val mkexe : string

The linker command line to build executables.

val mkmaindll : string

The linker command line to build main programs as dlls.

val default_rpath : string

Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

val mksharedlibrpath : string

Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

val ar : string

Name of the ar command, or "" if not needed (MSVC)

val interface_suffix : string ref

Suffix for interface file names

val exec_magic_number : string

Magic number for bytecode executable files

val cmi_magic_number : string

Magic number for compiled interface files

val cmo_magic_number : string

Magic number for object bytecode files

val cma_magic_number : string

Magic number for archive files

val cmx_magic_number : string

Magic number for compilation unit descriptions

val cmxa_magic_number : string

Magic number for libraries of compilation unit descriptions

val ast_intf_magic_number : string

Magic number for file holding an interface syntax tree

val ast_impl_magic_number : string

Magic number for file holding an implementation syntax tree

val cmxs_magic_number : string

Magic number for dynamically-loadable plugins

val cmt_magic_number : string

Magic number for compiled interface files

val linear_magic_number : string

Magic number for Linear internal representation files

val max_tag : int

Biggest tag that can be stored in the header of a regular block.

val lazy_tag : int

Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

val max_young_wosize : int

Maximal size of arrays that are directly allocated in the minor heap

val stack_threshold : int

Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

val stack_safety_margin : int

Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

val native_compiler : bool

Whether the native compiler is available or not

  • since 5.1
val architecture : string

Name of processor type for the native-code compiler

val model : string

Name of processor submodel for the native-code compiler

val system : string

Name of operating system for the native-code compiler

val asm : string

The assembler (and flags) to use for assembling ocamlopt-generated code.

val asm_cfi_supported : bool

Whether assembler understands CFI directives

val with_frame_pointers : bool

Whether assembler should maintain frame pointers

val ext_obj : string

Extension for object files, e.g. .o under Unix.

val ext_asm : string

Extension for assembler files, e.g. .s under Unix.

val ext_lib : string

Extension for library files, e.g. .a under Unix.

val ext_dll : string

Extension for dynamically-loaded libraries, e.g. .so under Unix.

val ext_exe : string

Extension for executable programs, e.g. .exe under Windows.

  • since 4.12
val default_executable_name : string

Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

val systhread_supported : bool

Whether the system thread library is implemented

val flexdll_dirs : string list

Directories needed for the FlexDLL objects

val host : string

Whether the compiler is a cross-compiler

val target : string

Whether the compiler is a cross-compiler

val flambda : bool

Whether the compiler was configured for flambda

val with_flambda_invariants : bool

Whether the invariants checks for flambda are enabled

val with_cmm_invariants : bool

Whether the invariants checks for Cmm are enabled

val reserved_header_bits : int

How many bits of a block's header are reserved

val flat_float_array : bool

Whether the compiler and runtime automagically flatten float arrays

val function_sections : bool

Whether the compiler was configured to generate each function in a separate section

val windows_unicode : bool

Whether Windows Unicode runtime is enabled

val naked_pointers : bool

Whether the runtime supports naked pointers

  • since 4.14
val supports_shared_libraries : bool

Whether shared libraries are supported

  • since 4.08

Whether native shared libraries are supported

  • since 5.1
val afl_instrument : bool

Whether afl-fuzz instrumentation is generated by default

val ar_supports_response_files : bool

Whether ar supports @FILE arguments.

val print_config : out_channel -> unit

Access to configuration values

val config_var : string -> string option

the configuration value of a variable, if it exists

diff --git a/ocaml/Consistbl/Make/argument-1-Module_name/Map/index.html b/ocaml/Consistbl/Make/argument-1-Module_name/Map/index.html new file mode 100644 index 00000000..fe6a76da --- /dev/null +++ b/ocaml/Consistbl/Make/argument-1-Module_name/Map/index.html @@ -0,0 +1,8 @@ + +Map (ocaml.Consistbl.Make.Module_name.Map)

Module Module_name.Map

Maps

type key = t

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Consistbl/Make/argument-1-Module_name/Set/index.html b/ocaml/Consistbl/Make/argument-1-Module_name/Set/index.html new file mode 100644 index 00000000..bbd717f6 --- /dev/null +++ b/ocaml/Consistbl/Make/argument-1-Module_name/Set/index.html @@ -0,0 +1,3 @@ + +Set (ocaml.Consistbl.Make.Module_name.Set)

Module Module_name.Set

Sets

type elt = t

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Consistbl/Make/argument-1-Module_name/Tbl/index.html b/ocaml/Consistbl/Make/argument-1-Module_name/Tbl/index.html new file mode 100644 index 00000000..de425eae --- /dev/null +++ b/ocaml/Consistbl/Make/argument-1-Module_name/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Consistbl.Make.Module_name.Tbl)

Module Module_name.Tbl

type key = t
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Consistbl/Make/argument-1-Module_name/index.html b/ocaml/Consistbl/Make/argument-1-Module_name/index.html new file mode 100644 index 00000000..907b643d --- /dev/null +++ b/ocaml/Consistbl/Make/argument-1-Module_name/index.html @@ -0,0 +1,2 @@ + +Module_name (ocaml.Consistbl.Make.Module_name)

Parameter Make.Module_name

type t
module Set : Set.S with type elt = t
module Map : Map.S with type key = t
module Tbl : Hashtbl.S with type key = t
val compare : t -> t -> int
diff --git a/ocaml/Consistbl/Make/index.html b/ocaml/Consistbl/Make/index.html new file mode 100644 index 00000000..49152221 --- /dev/null +++ b/ocaml/Consistbl/Make/index.html @@ -0,0 +1,13 @@ + +Make (ocaml.Consistbl.Make)

Module Consistbl.Make

Parameters

module Module_name : sig ... end

Signature

type t
val create : unit -> t
val clear : t -> unit
val check : t -> Module_name.t -> Stdlib.Digest.t -> Misc.filepath -> unit
val check_noadd : + t -> + Module_name.t -> + Stdlib.Digest.t -> + Misc.filepath -> + unit
val source : t -> Module_name.t -> Misc.filepath
val extract : + Module_name.t list -> + t -> + (Module_name.t * Stdlib.Digest.t option) list
val extract_map : + Module_name.Set.t -> + t -> + Stdlib.Digest.t option Module_name.Map.t
val filter : (Module_name.t -> bool) -> t -> unit
exception Inconsistency of {
  1. unit_name : Module_name.t;
  2. inconsistent_source : string;
  3. original_source : string;
}
exception Not_available of Module_name.t
diff --git a/ocaml/Consistbl/index.html b/ocaml/Consistbl/index.html new file mode 100644 index 00000000..d049d4de --- /dev/null +++ b/ocaml/Consistbl/index.html @@ -0,0 +1,2 @@ + +Consistbl (ocaml.Consistbl)

Module Consistbl

Consistency tables: for checking consistency of module CRCs

Warning: this module is unstable and part of compiler-libs.

module Make (Module_name : sig ... end) : sig ... end
diff --git a/ocaml/Convert_primitives/index.html b/ocaml/Convert_primitives/index.html new file mode 100644 index 00000000..21c3e356 --- /dev/null +++ b/ocaml/Convert_primitives/index.html @@ -0,0 +1,2 @@ + +Convert_primitives (ocaml.Convert_primitives)

Module Convert_primitives

diff --git a/ocaml/Ctype/index.html b/ocaml/Ctype/index.html new file mode 100644 index 00000000..63c5a15d --- /dev/null +++ b/ocaml/Ctype/index.html @@ -0,0 +1,190 @@ + +Ctype (ocaml.Ctype)

Module Ctype

exception Unify of Errortrace.unification_error
exception Equality of Errortrace.equality_error
exception Moregen of Errortrace.moregen_error
exception Subtype of Errortrace.Subtype.error
exception Tags of Asttypes.label * Asttypes.label
exception Cannot_expand
exception Cannot_apply
exception Matches_failure of Env.t * Errortrace.unification_error
exception Incompatible
val with_local_level : ?post:('a -> unit) -> (unit -> 'a) -> 'a
val with_local_level_if : bool -> (unit -> 'a) -> post:('a -> unit) -> 'a
val with_local_level_iter : (unit -> 'a * 'b list) -> post:('b -> unit) -> 'a
val with_local_level_iter_if : + bool -> + (unit -> 'a * 'b list) -> + post:('b -> unit) -> + 'a
val with_level : level:int -> (unit -> 'a) -> 'a
val with_level_if : bool -> level:int -> (unit -> 'a) -> 'a
val with_local_level_if_principal : (unit -> 'a) -> post:('a -> unit) -> 'a
val with_local_level_iter_if_principal : + (unit -> 'a * 'b list) -> + post:('b -> unit) -> + 'a
val with_local_level_for_class : ?post:('a -> unit) -> (unit -> 'a) -> 'a
val with_raised_nongen_level : (unit -> 'a) -> 'a
val reset_global_level : unit -> unit
val increase_global_level : unit -> int
val restore_global_level : int -> unit
val create_scope : unit -> int
val new_scoped_ty : int -> Types.type_desc -> Types.type_expr
val newvar : ?name:string -> unit -> Types.type_expr
val newvar2 : ?name:string -> int -> Types.type_expr
val new_global_var : ?name:string -> unit -> Types.type_expr
val newconstr : Path.t -> Types.type_expr list -> Types.type_expr
val none : Types.type_expr
val object_fields : Types.type_expr -> Types.type_expr
val flatten_fields : + Types.type_expr -> + (string * Types.field_kind * Types.type_expr) list * Types.type_expr

Transform a field type into a list of pairs label-type. The fields are sorted.

Beware of the interaction with GADTs:

Due to the introduction of object indexes for GADTs, the row variable of an object may now be an expansible type abbreviation. A first consequence is that flatten_fields will not completely flatten the object, since the type abbreviation will not be expanded (flatten_fields does not receive the current environment). Another consequence is that various functions may be called with the expansion of this type abbreviation, which is a Tfield, e.g. during printing.

Concrete problems have been fixed, but new bugs may appear in the future. (Test cases were added to typing-gadts/test.ml)

val associate_fields : + (string * Types.field_kind * Types.type_expr) list -> + (string * Types.field_kind * Types.type_expr) list -> + (string + * Types.field_kind + * Types.type_expr + * Types.field_kind + * Types.type_expr) + list + * (string * Types.field_kind * Types.type_expr) list + * (string * Types.field_kind * Types.type_expr) list
val opened_object : Types.type_expr -> bool
val set_object_name : + Ident.t -> + Types.type_expr list -> + Types.type_expr -> + unit
val remove_object_name : Types.type_expr -> unit
val find_cltype_for_path : + Env.t -> + Path.t -> + Types.type_declaration * Types.type_expr
val sort_row_fields : + (Asttypes.label * Types.row_field) list -> + (Asttypes.label * Types.row_field) list
val filter_row_fields : + bool -> + (Asttypes.label * Types.row_field) list -> + (Asttypes.label * Types.row_field) list
val generalize : Types.type_expr -> unit
val lower_contravariant : Env.t -> Types.type_expr -> unit
val lower_variables_only : Env.t -> int -> Types.type_expr -> unit
val enforce_current_level : Env.t -> Types.type_expr -> unit
val generalize_structure : Types.type_expr -> unit
val generalize_class_type : Types.class_type -> unit
val generalize_class_type_structure : Types.class_type -> unit
val generalize_class_signature_spine : Env.t -> Types.class_signature -> unit
val correct_levels : Types.type_expr -> Types.type_expr
val limited_generalize : Types.type_expr -> Types.type_expr -> unit
val limited_generalize_class_type : Types.type_expr -> Types.class_type -> unit
val fully_generic : Types.type_expr -> bool
val check_scope_escape : Env.t -> int -> Types.type_expr -> unit
val instance : ?partial:bool -> Types.type_expr -> Types.type_expr
val generic_instance : Types.type_expr -> Types.type_expr
val instance_list : Types.type_expr list -> Types.type_expr list
val new_local_type : + ?loc:Location.t -> + ?manifest_and_scope:(Types.type_expr * int) -> + unit -> + Types.type_declaration
val existential_name : + Types.constructor_description -> + Types.type_expr -> + string
type existential_treatment =
  1. | Keep_existentials_flexible
  2. | Make_existentials_abstract of {
    1. env : Env.t ref;
    2. scope : int;
    }
val instance_parameterized_type : + ?keep_names:bool -> + Types.type_expr list -> + Types.type_expr -> + Types.type_expr list * Types.type_expr
val instance_declaration : Types.type_declaration -> Types.type_declaration
val generic_instance_declaration : + Types.type_declaration -> + Types.type_declaration
val instance_class : + Types.type_expr list -> + Types.class_type -> + Types.type_expr list * Types.class_type
val instance_poly : + ?keep_names:bool -> + bool -> + Types.type_expr list -> + Types.type_expr -> + Types.type_expr list * Types.type_expr
val polyfy : + Env.t -> + Types.type_expr -> + Types.type_expr list -> + Types.type_expr * bool
val instance_label : + bool -> + Types.label_description -> + Types.type_expr list * Types.type_expr * Types.type_expr
val apply : + ?use_current_level:bool -> + Env.t -> + Types.type_expr list -> + Types.type_expr -> + Types.type_expr list -> + Types.type_expr
val try_expand_once_opt : Env.t -> Types.type_expr -> Types.type_expr
val try_expand_safe_opt : Env.t -> Types.type_expr -> Types.type_expr
val expand_head_once : Env.t -> Types.type_expr -> Types.type_expr
val expand_head : Env.t -> Types.type_expr -> Types.type_expr
val expand_head_opt : Env.t -> Types.type_expr -> Types.type_expr

The compiler's own version of expand_head necessary for type-based optimisations.

Expansion of types for error traces; lives here instead of in Errortrace because the expansion machinery lives here.

val expanded_diff : + Env.t -> + got:Types.type_expr -> + expected:Types.type_expr -> + (Errortrace.expanded_type, 'variant) Errortrace.elt

Create an Errortrace.Diff by expanding the two types

val unexpanded_diff : + got:Types.type_expr -> + expected:Types.type_expr -> + (Errortrace.expanded_type, 'variant) Errortrace.elt

Create an Errortrace.Diff by *duplicating* the two types, so that each one's expansion is identical to itself. Despite the name, does create Errortrace.expanded_types.

val full_expand : + may_forget_scope:bool -> + Env.t -> + Types.type_expr -> + Types.type_expr
type typedecl_extraction_result =
  1. | Typedecl of Path.t * Path.t * Types.type_declaration
  2. | Has_no_typedecl
  3. | May_have_typedecl
val extract_concrete_typedecl : + Env.t -> + Types.type_expr -> + typedecl_extraction_result
val unify : Env.t -> Types.type_expr -> Types.type_expr -> unit
val unify_gadt : + equations_level:int -> + allow_recursive_equations:bool -> + Env.t ref -> + Types.type_expr -> + Types.type_expr -> + Btype.TypePairs.t
val unify_var : Env.t -> Types.type_expr -> Types.type_expr -> unit
val filter_method : Env.t -> string -> Types.type_expr -> Types.type_expr
val occur_in : Env.t -> Types.type_expr -> Types.type_expr -> bool
val deep_occur : Types.type_expr -> Types.type_expr -> bool
val moregeneral : Env.t -> bool -> Types.type_expr -> Types.type_expr -> unit
val is_moregeneral : + Env.t -> + bool -> + Types.type_expr -> + Types.type_expr -> + bool
val rigidify : Types.type_expr -> Types.type_expr list
val all_distinct_vars : Env.t -> Types.type_expr list -> bool
val matches : + expand_error_trace:bool -> + Env.t -> + Types.type_expr -> + Types.type_expr -> + unit
val does_match : Env.t -> Types.type_expr -> Types.type_expr -> bool
val reify_univars : Env.t -> Types.type_expr -> Types.type_expr
type filter_arrow_failure =
  1. | Unification_error of Errortrace.unification_error
  2. | Label_mismatch of {
    1. got : Asttypes.arg_label;
    2. expected : Asttypes.arg_label;
    3. expected_type : Types.type_expr;
    }
  3. | Not_a_function
exception Filter_arrow_failed of filter_arrow_failure
type filter_method_failure =
  1. | Unification_error of Errortrace.unification_error
  2. | Not_a_method
  3. | Not_an_object of Types.type_expr
exception Filter_method_failed of filter_method_failure
type class_match_failure =
  1. | CM_Virtual_class
  2. | CM_Parameter_arity_mismatch of int * int
  3. | CM_Type_parameter_mismatch of Env.t * Errortrace.equality_error
  4. | CM_Class_type_mismatch of Env.t * Types.class_type * Types.class_type
  5. | CM_Parameter_mismatch of Env.t * Errortrace.moregen_error
  6. | CM_Val_type_mismatch of string * Env.t * Errortrace.comparison_error
  7. | CM_Meth_type_mismatch of string * Env.t * Errortrace.comparison_error
  8. | CM_Non_mutable_value of string
  9. | CM_Non_concrete_value of string
  10. | CM_Missing_value of string
  11. | CM_Missing_method of string
  12. | CM_Hide_public of string
  13. | CM_Hide_virtual of string * string
  14. | CM_Public_method of string
  15. | CM_Private_method of string
  16. | CM_Virtual_method of string
val match_class_types : + ?trace:bool -> + Env.t -> + Types.class_type -> + Types.class_type -> + class_match_failure list
val equal : + Env.t -> + bool -> + Types.type_expr list -> + Types.type_expr list -> + unit
val is_equal : + Env.t -> + bool -> + Types.type_expr list -> + Types.type_expr list -> + bool
val equal_private : + Env.t -> + Types.type_expr list -> + Types.type_expr -> + Types.type_expr list -> + Types.type_expr -> + unit
val match_class_declarations : + Env.t -> + Types.type_expr list -> + Types.class_type -> + Types.type_expr list -> + Types.class_type -> + class_match_failure list
val enlarge_type : Env.t -> Types.type_expr -> Types.type_expr * bool
val subtype : Env.t -> Types.type_expr -> Types.type_expr -> unit -> unit
val new_class_signature : unit -> Types.class_signature
val add_dummy_method : Env.t -> scope:int -> Types.class_signature -> unit
type add_method_failure =
  1. | Unexpected_method
  2. | Type_mismatch of Errortrace.unification_error
exception Add_method_failed of add_method_failure
type add_instance_variable_failure =
  1. | Mutability_mismatch of Asttypes.mutable_flag
  2. | Type_mismatch of Errortrace.unification_error
exception Add_instance_variable_failed of add_instance_variable_failure
val add_instance_variable : + strict:bool -> + Env.t -> + Asttypes.label -> + Asttypes.mutable_flag -> + Asttypes.virtual_flag -> + Types.type_expr -> + Types.class_signature -> + unit
type inherit_class_signature_failure =
  1. | Self_type_mismatch of Errortrace.unification_error
  2. | Method of Asttypes.label * add_method_failure
  3. | Instance_variable of Asttypes.label * add_instance_variable_failure
exception Inherit_class_signature_failed of inherit_class_signature_failure
val inherit_class_signature : + strict:bool -> + Env.t -> + Types.class_signature -> + Types.class_signature -> + unit
val update_class_signature : + Env.t -> + Types.class_signature -> + Asttypes.label list * Asttypes.label list
val hide_private_methods : Env.t -> Types.class_signature -> unit
val close_class_signature : Env.t -> Types.class_signature -> bool
exception Nondep_cannot_erase of Ident.t
val nondep_type : Env.t -> Ident.t list -> Types.type_expr -> Types.type_expr
val nondep_type_decl : + Env.t -> + Ident.t list -> + bool -> + Types.type_declaration -> + Types.type_declaration
val nondep_extension_constructor : + Env.t -> + Ident.t list -> + Types.extension_constructor -> + Types.extension_constructor
val nondep_class_declaration : + Env.t -> + Ident.t list -> + Types.class_declaration -> + Types.class_declaration
val nondep_cltype_declaration : + Env.t -> + Ident.t list -> + Types.class_type_declaration -> + Types.class_type_declaration
val is_contractive : Env.t -> Path.t -> bool
val normalize_type : Types.type_expr -> unit
val nongen_vars_in_schema : Env.t -> Types.type_expr -> Btype.TypeSet.t option
val nongen_vars_in_class_declaration : + Types.class_declaration -> + Btype.TypeSet.t option
type variable_kind =
  1. | Row_variable
  2. | Type_variable
type closed_class_failure = {
  1. free_variable : Types.type_expr * variable_kind;
  2. meth : string;
  3. meth_ty : Types.type_expr;
}
val free_variables : ?env:Env.t -> Types.type_expr -> Types.type_expr list
val closed_type_decl : Types.type_declaration -> Types.type_expr option
val closed_extension_constructor : + Types.extension_constructor -> + Types.type_expr option
val closed_class : + Types.type_expr list -> + Types.class_signature -> + closed_class_failure option
val arity : Types.type_expr -> int
val collapse_conj_params : Env.t -> Types.type_expr list -> unit
val get_current_level : unit -> int
val wrap_trace_gadt_instances : Env.t -> ('a -> 'b) -> 'a -> 'b
val immediacy : Env.t -> Types.type_expr -> Type_immediacy.t
val package_subtype : + (Env.t -> + Path.t -> + (Longident.t * Types.type_expr) list -> + Path.t -> + (Longident.t * Types.type_expr) list -> + bool) + ref
val mcomp : Env.t -> Types.type_expr -> Types.type_expr -> unit
diff --git a/ocaml/Dataflow/Backward/argument-1-D/index.html b/ocaml/Dataflow/Backward/argument-1-D/index.html new file mode 100644 index 00000000..376c87d8 --- /dev/null +++ b/ocaml/Dataflow/Backward/argument-1-D/index.html @@ -0,0 +1,2 @@ + +D (ocaml.Dataflow.Backward.D)

Parameter Backward.D

type t
val bot : t
val join : t -> t -> t
val lessequal : t -> t -> bool
diff --git a/ocaml/Dataflow/Backward/index.html b/ocaml/Dataflow/Backward/index.html new file mode 100644 index 00000000..20e510aa --- /dev/null +++ b/ocaml/Dataflow/Backward/index.html @@ -0,0 +1,7 @@ + +Backward (ocaml.Dataflow.Backward)

Module Dataflow.Backward

Parameters

module D : DOMAIN

Signature

val analyze : + ?exnhandler:(D.t -> D.t) -> + ?exnescape:D.t -> + transfer:(Mach.instruction -> next:D.t -> exn:D.t -> D.t) -> + Mach.instruction -> + D.t * (int -> D.t)
diff --git a/ocaml/Dataflow/index.html b/ocaml/Dataflow/index.html new file mode 100644 index 00000000..5e6788d2 --- /dev/null +++ b/ocaml/Dataflow/index.html @@ -0,0 +1,2 @@ + +Dataflow (ocaml.Dataflow)

Module Dataflow

module type DOMAIN = sig ... end
module Backward (D : DOMAIN) : sig ... end
diff --git a/ocaml/Dataflow/module-type-DOMAIN/index.html b/ocaml/Dataflow/module-type-DOMAIN/index.html new file mode 100644 index 00000000..a6233f19 --- /dev/null +++ b/ocaml/Dataflow/module-type-DOMAIN/index.html @@ -0,0 +1,2 @@ + +DOMAIN (ocaml.Dataflow.DOMAIN)

Module type Dataflow.DOMAIN

type t
val bot : t
val join : t -> t -> t
val lessequal : t -> t -> bool
diff --git a/ocaml/Datarepr/index.html b/ocaml/Datarepr/index.html new file mode 100644 index 00000000..8229bf71 --- /dev/null +++ b/ocaml/Datarepr/index.html @@ -0,0 +1,19 @@ + +Datarepr (ocaml.Datarepr)

Module Datarepr

val extension_descr : + current_unit:string -> + Path.t -> + Types.extension_constructor -> + Types.constructor_description
val labels_of_type : + Path.t -> + Types.type_declaration -> + (Ident.t * Types.label_description) list
val constructors_of_type : + current_unit:string -> + Path.t -> + Types.type_declaration -> + (Ident.t * Types.constructor_description) list
exception Constr_not_found
val constructor_existentials : + Types.constructor_arguments -> + Types.type_expr option -> + Types.type_expr list * Types.type_expr list

Takes cd_args and cd_res from a constructor_declaration and returns:

  • the types of the constructor's arguments
  • the existential variables introduced by the constructor
diff --git a/ocaml/Deadcode/index.html b/ocaml/Deadcode/index.html new file mode 100644 index 00000000..58fe8968 --- /dev/null +++ b/ocaml/Deadcode/index.html @@ -0,0 +1,2 @@ + +Deadcode (ocaml.Deadcode)

Module Deadcode

val fundecl : Mach.fundecl -> Mach.fundecl
diff --git a/ocaml/Debuginfo/Scoped_location/index.html b/ocaml/Debuginfo/Scoped_location/index.html new file mode 100644 index 00000000..e8d3217d --- /dev/null +++ b/ocaml/Debuginfo/Scoped_location/index.html @@ -0,0 +1,2 @@ + +Scoped_location (ocaml.Debuginfo.Scoped_location)

Module Debuginfo.Scoped_location

type scopes
val string_of_scopes : scopes -> string
val empty_scopes : scopes
val enter_anonymous_function : scopes:scopes -> scopes
val enter_value_definition : scopes:scopes -> Ident.t -> scopes
val enter_module_definition : scopes:scopes -> Ident.t -> scopes
val enter_class_definition : scopes:scopes -> Ident.t -> scopes
val enter_method_definition : scopes:scopes -> Asttypes.label -> scopes
type t =
  1. | Loc_unknown
  2. | Loc_known of {
    1. loc : Location.t;
    2. scopes : scopes;
    }
val of_location : scopes:scopes -> Location.t -> t
val to_location : t -> Location.t
val string_of_scoped_location : t -> string
diff --git a/ocaml/Debuginfo/index.html b/ocaml/Debuginfo/index.html new file mode 100644 index 00000000..f63c353c --- /dev/null +++ b/ocaml/Debuginfo/index.html @@ -0,0 +1,2 @@ + +Debuginfo (ocaml.Debuginfo)

Module Debuginfo

module Scoped_location : sig ... end
type item = private {
  1. dinfo_file : string;
  2. dinfo_line : int;
  3. dinfo_char_start : int;
  4. dinfo_char_end : int;
  5. dinfo_start_bol : int;
  6. dinfo_end_bol : int;
  7. dinfo_end_line : int;
  8. dinfo_scopes : Scoped_location.scopes;
}
type t = item list
type alloc_dbginfo_item = {
  1. alloc_words : int;
  2. alloc_dbg : t;
}

Due to Comballoc, a single Ialloc instruction may combine several unrelated allocations. Their Debuginfo.t (which may differ) are stored as a list of alloc_dbginfo. This list is in order of increasing memory address, which is the reverse of the original allocation order. Later allocations are consed to the front of this list by Comballoc.

type alloc_dbginfo = alloc_dbginfo_item list
val none : t
val is_none : t -> bool
val to_string : t -> string
val from_location : Scoped_location.t -> t
val to_location : t -> Location.t
val inline : t -> t -> t
val compare : t -> t -> int
val hash : t -> int
val print_compact : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Depend/index.html b/ocaml/Depend/index.html new file mode 100644 index 00000000..1d2ac65f --- /dev/null +++ b/ocaml/Depend/index.html @@ -0,0 +1,2 @@ + +Depend (ocaml.Depend)

Module Depend

Module dependencies.

Warning: this module is unstable and part of compiler-libs.

module String = Misc.Stdlib.String
type map_tree =
  1. | Node of String.Set.t * bound_map
and bound_map = map_tree String.Map.t
val make_leaf : string -> map_tree
val make_node : bound_map -> map_tree
val weaken_map : String.Set.t -> map_tree -> map_tree
val free_structure_names : String.Set.t ref
val pp_deps : string list ref

dependencies found by preprocessing tools

val open_module : bound_map -> Longident.t -> bound_map
val add_use_file : bound_map -> Parsetree.toplevel_phrase list -> unit
val add_signature : bound_map -> Parsetree.signature -> unit
val add_implementation : bound_map -> Parsetree.structure -> unit
val add_implementation_binding : bound_map -> Parsetree.structure -> bound_map
val add_signature_binding : bound_map -> Parsetree.signature -> bound_map
diff --git a/ocaml/Diffing/Define/Left_variadic/argument-1-_/index.html b/ocaml/Diffing/Define/Left_variadic/argument-1-_/index.html new file mode 100644 index 00000000..bc75a453 --- /dev/null +++ b/ocaml/Diffing/Define/Left_variadic/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Diffing.Define.Left_variadic._)

Parameter Left_variadic._

val weight : change -> int

weight ch returns the weight of the change ch. Used to find the smallest patch.

val test : D.state -> D.left -> D.right -> (D.eq, D.diff) result

test st xl xr tests if the elements xl and xr are co mpatible (Ok) or not (Error).

val update : change -> D.state -> D.state * D.left array

update ch st returns the new state after applying a change. The update_result type also contains expansions in the variadic case.

diff --git a/ocaml/Diffing/Define/Left_variadic/index.html b/ocaml/Diffing/Define/Left_variadic/index.html new file mode 100644 index 00000000..42ff4280 --- /dev/null +++ b/ocaml/Diffing/Define/Left_variadic/index.html @@ -0,0 +1,2 @@ + +Left_variadic (ocaml.Diffing.Define.Left_variadic)

Module Define.Left_variadic

Variadic diffing

Variadic diffing allows to expand the lists being diffed during diffing. in one specific direction.

Parameters

module _ : Parameters with type update_result := D.state * D.left array

Signature

val diff : D.state -> D.left array -> D.right array -> patch

diff state l r computes the optimal patch between l and r, using the initial state state.

diff --git a/ocaml/Diffing/Define/Right_variadic/argument-1-_/index.html b/ocaml/Diffing/Define/Right_variadic/argument-1-_/index.html new file mode 100644 index 00000000..6064743c --- /dev/null +++ b/ocaml/Diffing/Define/Right_variadic/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Diffing.Define.Right_variadic._)

Parameter Right_variadic._

val weight : change -> int

weight ch returns the weight of the change ch. Used to find the smallest patch.

val test : D.state -> D.left -> D.right -> (D.eq, D.diff) result

test st xl xr tests if the elements xl and xr are co mpatible (Ok) or not (Error).

val update : change -> D.state -> D.state * D.right array

update ch st returns the new state after applying a change. The update_result type also contains expansions in the variadic case.

diff --git a/ocaml/Diffing/Define/Right_variadic/index.html b/ocaml/Diffing/Define/Right_variadic/index.html new file mode 100644 index 00000000..3ac2e8f5 --- /dev/null +++ b/ocaml/Diffing/Define/Right_variadic/index.html @@ -0,0 +1,2 @@ + +Right_variadic (ocaml.Diffing.Define.Right_variadic)

Module Define.Right_variadic

Parameters

module _ : Parameters with type update_result := D.state * D.right array

Signature

val diff : D.state -> D.left array -> D.right array -> patch

diff state l r computes the optimal patch between l and r, using the initial state state.

diff --git a/ocaml/Diffing/Define/Simple/argument-1-_/index.html b/ocaml/Diffing/Define/Simple/argument-1-_/index.html new file mode 100644 index 00000000..2854dc11 --- /dev/null +++ b/ocaml/Diffing/Define/Simple/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Diffing.Define.Simple._)

Parameter Simple._

val weight : change -> int

weight ch returns the weight of the change ch. Used to find the smallest patch.

val test : D.state -> D.left -> D.right -> (D.eq, D.diff) result

test st xl xr tests if the elements xl and xr are co mpatible (Ok) or not (Error).

val update : change -> D.state -> D.state

update ch st returns the new state after applying a change. The update_result type also contains expansions in the variadic case.

diff --git a/ocaml/Diffing/Define/Simple/index.html b/ocaml/Diffing/Define/Simple/index.html new file mode 100644 index 00000000..7344ff7f --- /dev/null +++ b/ocaml/Diffing/Define/Simple/index.html @@ -0,0 +1,2 @@ + +Simple (ocaml.Diffing.Define.Simple)

Module Define.Simple

Parameters

module _ : Parameters with type update_result := D.state

Signature

val diff : D.state -> D.left array -> D.right array -> patch

diff state l r computes the optimal patch between l and r, using the initial state state.

diff --git a/ocaml/Diffing/Define/argument-1-D/index.html b/ocaml/Diffing/Define/argument-1-D/index.html new file mode 100644 index 00000000..ce64a99a --- /dev/null +++ b/ocaml/Diffing/Define/argument-1-D/index.html @@ -0,0 +1,2 @@ + +D (ocaml.Diffing.Define.D)

Parameter Define.D

type left
type right
type eq

Detailed equality trace

type diff

Detailed difference trace

type state

environment of a partial patch

diff --git a/ocaml/Diffing/Define/index.html b/ocaml/Diffing/Define/index.html new file mode 100644 index 00000000..821f9f4d --- /dev/null +++ b/ocaml/Diffing/Define/index.html @@ -0,0 +1,6 @@ + +Define (ocaml.Diffing.Define)

Module Diffing.Define

Define(Defs) creates the diffing types from the types defined in Defs and the functors that need to be instantatied with the diffing algorithm parameters

Parameters

module D : Defs

Signature

type nonrec change = (D.left, D.right, D.eq, D.diff) change

The type of potential changes on a list.

type patch = change list

A patch is an ordered list of changes.

module type Parameters = sig ... end
module type S = sig ... end
module Simple (_ : Parameters with type update_result := D.state) : S
module Left_variadic + (_ : Parameters with type update_result := D.state * D.left array) : + S
module Right_variadic + (_ : Parameters with type update_result := D.state * D.right array) : + S
diff --git a/ocaml/Diffing/Define/module-type-Parameters/index.html b/ocaml/Diffing/Define/module-type-Parameters/index.html new file mode 100644 index 00000000..60eb97b2 --- /dev/null +++ b/ocaml/Diffing/Define/module-type-Parameters/index.html @@ -0,0 +1,2 @@ + +Parameters (ocaml.Diffing.Define.Parameters)

Module type Define.Parameters

type update_result
val weight : change -> int

weight ch returns the weight of the change ch. Used to find the smallest patch.

val test : D.state -> D.left -> D.right -> (D.eq, D.diff) result

test st xl xr tests if the elements xl and xr are co mpatible (Ok) or not (Error).

val update : change -> D.state -> update_result

update ch st returns the new state after applying a change. The update_result type also contains expansions in the variadic case.

diff --git a/ocaml/Diffing/Define/module-type-S/index.html b/ocaml/Diffing/Define/module-type-S/index.html new file mode 100644 index 00000000..cf736b92 --- /dev/null +++ b/ocaml/Diffing/Define/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Diffing.Define.S)

Module type Define.S

val diff : D.state -> D.left array -> D.right array -> patch

diff state l r computes the optimal patch between l and r, using the initial state state.

diff --git a/ocaml/Diffing/index.html b/ocaml/Diffing/index.html new file mode 100644 index 00000000..0122b4f0 --- /dev/null +++ b/ocaml/Diffing/index.html @@ -0,0 +1,2 @@ + +Diffing (ocaml.Diffing)

Module Diffing

Parametric diffing

This module implements diffing over lists of arbitrary content. It is parameterized by

  • The content of the two lists
  • The equality witness when an element is kept
  • The diffing witness when an element is changed

Diffing is extended to maintain state depending on the computed changes while walking through the two lists.

The underlying algorithm is a modified Wagner-Fischer algorithm (see <https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm>).

We provide the following guarantee: Given two lists l and r, if different patches result in different states, we say that the state diverges.

  • We always return the optimal patch on prefixes of l and r on which state does not diverge.
  • Otherwise, we return a correct but non-optimal patch where subpatches with no divergent states are optimal for the given initial state.

More precisely, the optimality of Wagner-Fischer depends on the property that the edit-distance between a k-prefix of the left input and a l-prefix of the right input d(k,l) satisfies

d(k,l) = min ( del_cost + d(k-1,l), insert_cost + d(k,l-1), change_cost + d(k-1,l-1) )

Under this hypothesis, it is optimal to choose greedily the state of the minimal patch transforming the left k-prefix into the right l-prefix as a representative of the states of all possible patches transforming the left k-prefix into the right l-prefix.

If this property is not satisfied, we can still choose greedily a representative state. However, the computed patch is no more guaranteed to be globally optimal. Nevertheless, it is still a correct patch, which is even optimal among all explored patches.

module type Defs = sig ... end

The core types of a diffing implementation

type change_kind =
  1. | Deletion
  2. | Insertion
  3. | Modification
  4. | Preservation

The kind of changes which is used to share printing and styling across implementation

val prefix : Stdlib.Format.formatter -> (int * change_kind) -> unit
val style : change_kind -> Misc.Color.style list
type ('left, 'right, 'eq, 'diff) change =
  1. | Delete of 'left
  2. | Insert of 'right
  3. | Keep of 'left * 'right * 'eq
  4. | Change of 'left * 'right * 'diff
val classify : (_, _, _, _) change -> change_kind
module Define (D : Defs) : sig ... end

Define(Defs) creates the diffing types from the types defined in Defs and the functors that need to be instantatied with the diffing algorithm parameters

diff --git a/ocaml/Diffing/module-type-Defs/index.html b/ocaml/Diffing/module-type-Defs/index.html new file mode 100644 index 00000000..11a1361c --- /dev/null +++ b/ocaml/Diffing/module-type-Defs/index.html @@ -0,0 +1,2 @@ + +Defs (ocaml.Diffing.Defs)

Module type Diffing.Defs

The core types of a diffing implementation

type left
type right
type eq

Detailed equality trace

type diff

Detailed difference trace

type state

environment of a partial patch

diff --git a/ocaml/Diffing_with_keys/Define/Simple/argument-1-_/index.html b/ocaml/Diffing_with_keys/Define/Simple/argument-1-_/index.html new file mode 100644 index 00000000..1684b960 --- /dev/null +++ b/ocaml/Diffing_with_keys/Define/Simple/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Diffing_with_keys.Define.Simple._)

Parameter Simple._

val weight : change -> int
val test : D.state -> left -> right -> (unit, diff) result
val update : change -> D.state -> D.state
val key_left : D.left -> string
val key_right : D.right -> string
diff --git a/ocaml/Diffing_with_keys/Define/Simple/index.html b/ocaml/Diffing_with_keys/Define/Simple/index.html new file mode 100644 index 00000000..714bb420 --- /dev/null +++ b/ocaml/Diffing_with_keys/Define/Simple/index.html @@ -0,0 +1,2 @@ + +Simple (ocaml.Diffing_with_keys.Define.Simple)

Module Define.Simple

Parameters

module _ : Parameters

Signature

val diff : D.state -> D.left list -> D.right list -> patch
diff --git a/ocaml/Diffing_with_keys/Define/argument-1-D/index.html b/ocaml/Diffing_with_keys/Define/argument-1-D/index.html new file mode 100644 index 00000000..2b7abe35 --- /dev/null +++ b/ocaml/Diffing_with_keys/Define/argument-1-D/index.html @@ -0,0 +1,2 @@ + +D (ocaml.Diffing_with_keys.Define.D)

Parameter Define.D

type left
type right
type diff

Detailed difference trace

type state

environment of a partial patch

diff --git a/ocaml/Diffing_with_keys/Define/index.html b/ocaml/Diffing_with_keys/Define/index.html new file mode 100644 index 00000000..c1fd456d --- /dev/null +++ b/ocaml/Diffing_with_keys/Define/index.html @@ -0,0 +1,2 @@ + +Define (ocaml.Diffing_with_keys.Define)

Module Diffing_with_keys.Define

Parameters

module D : Diffing.Defs with type eq := unit

Signature

type diff = (D.left, D.right, D.diff) mismatch
type left = D.left with_pos
type right = D.right with_pos
type composite_change = (D.left, D.right, D.diff) change

Composite changes and patches

type patch = composite_change list
type change = (left, right, unit, diff) Diffing.change

Atomic changes

module type Parameters = sig ... end
module Simple (_ : Parameters) : sig ... end
diff --git a/ocaml/Diffing_with_keys/Define/module-type-Parameters/index.html b/ocaml/Diffing_with_keys/Define/module-type-Parameters/index.html new file mode 100644 index 00000000..cd008704 --- /dev/null +++ b/ocaml/Diffing_with_keys/Define/module-type-Parameters/index.html @@ -0,0 +1,2 @@ + +Parameters (ocaml.Diffing_with_keys.Define.Parameters)

Module type Define.Parameters

val weight : change -> int
val test : D.state -> left -> right -> (unit, diff) result
val update : change -> D.state -> D.state
val key_left : D.left -> string
val key_right : D.right -> string
diff --git a/ocaml/Diffing_with_keys/index.html b/ocaml/Diffing_with_keys/index.html new file mode 100644 index 00000000..6a9d9af5 --- /dev/null +++ b/ocaml/Diffing_with_keys/index.html @@ -0,0 +1,2 @@ + +Diffing_with_keys (ocaml.Diffing_with_keys)

Module Diffing_with_keys

When diffing lists where each element has a distinct key, we can refine the diffing patch by introducing two composite edit moves: swaps and moves.

Swaps exchange the position of two elements. Swap cost is set to 2 * change - epsilon. Moves change the position of one element. Move cost is set to delete + addition - epsilon.

When the cost delete + addition is greater than change and with those specific weights, the optimal patch with Swaps and Moves can be computed directly and cheaply from the original optimal patch.

type 'a with_pos = {
  1. pos : int;
  2. data : 'a;
}
val with_pos : 'a list -> 'a with_pos list
type ('l, 'r, 'diff) mismatch =
  1. | Name of {
    1. pos : int;
    2. got : string;
    3. expected : string;
    4. types_match : bool;
    }
  2. | Type of {
    1. pos : int;
    2. got : 'l;
    3. expected : 'r;
    4. reason : 'diff;
    }
type ('l, 'r, 'diff) change =
  1. | Change of ('l, 'r, 'diff) mismatch
  2. | Swap of {
    1. pos : int * int;
    2. first : string;
    3. last : string;
    }
  3. | Move of {
    1. name : string;
    2. got : int;
    3. expected : int;
    }
  4. | Insert of {
    1. pos : int;
    2. insert : 'r;
    }
  5. | Delete of {
    1. pos : int;
    2. delete : 'l;
    }

This specialized version of changes introduces two composite changes: Move and Swap

val prefix : Stdlib.Format.formatter -> ('l, 'r, 'diff) change -> unit
module Define (D : Diffing.Defs with type eq := unit) : sig ... end
diff --git a/ocaml/Dll/index.html b/ocaml/Dll/index.html new file mode 100644 index 00000000..24a52059 --- /dev/null +++ b/ocaml/Dll/index.html @@ -0,0 +1,2 @@ + +Dll (ocaml.Dll)

Module Dll

val extract_dll_name : string -> string
type dll_mode =
  1. | For_checking
  2. | For_execution
val open_dlls : dll_mode -> string list -> unit
val close_all_dlls : unit -> unit
type dll_address
type primitive_address =
  1. | Prim_loaded of dll_address
  2. | Prim_exists
val find_primitive : string -> primitive_address option
val synchronize_primitive : int -> dll_address -> unit
val add_path : string list -> unit
val remove_path : string list -> unit
val init_compile : bool -> unit
val init_toplevel : string list -> unit
val reset : unit -> unit
diff --git a/ocaml/Docstrings/WithMenhir/index.html b/ocaml/Docstrings/WithMenhir/index.html new file mode 100644 index 00000000..e93d58ef --- /dev/null +++ b/ocaml/Docstrings/WithMenhir/index.html @@ -0,0 +1,9 @@ + +WithMenhir (ocaml.Docstrings.WithMenhir)

Module Docstrings.WithMenhir

Fetch the item documentation for the current symbol. This also marks this documentation (for ambiguity warnings).

Fetch the item documentation for the symbols between two positions. This also marks this documentation (for ambiguity warnings).

val mark_symbol_docs : + (Stdlib.Lexing.position * Stdlib.Lexing.position) -> + unit

Mark the item documentation for the current symbol (for ambiguity warnings).

val mark_rhs_docs : Stdlib.Lexing.position -> Stdlib.Lexing.position -> unit

Mark as associated the item documentation for the symbols between two positions (for ambiguity warnings)

val symbol_info : Stdlib.Lexing.position -> info

Fetch the field info for the current symbol.

val rhs_info : Stdlib.Lexing.position -> info

Fetch the field info following the symbol at a given position.

val symbol_text : Stdlib.Lexing.position -> text

Fetch the text preceding the current symbol.

val symbol_text_lazy : Stdlib.Lexing.position -> text Stdlib.Lazy.t
val rhs_text : Stdlib.Lexing.position -> text

Fetch the text preceding the symbol at the given position.

Extra text

There may be additional text attached to the delimiters of a block (e.g. struct and end). This is fetched by the following functions, which are applied to the contents of the block rather than the delimiters.

val symbol_pre_extra_text : Stdlib.Lexing.position -> text

Fetch additional text preceding the current symbol

val symbol_post_extra_text : Stdlib.Lexing.position -> text

Fetch additional text following the current symbol

val rhs_pre_extra_text : Stdlib.Lexing.position -> text

Fetch additional text preceding the symbol at the given position

val rhs_post_extra_text : Stdlib.Lexing.position -> text

Fetch additional text following the symbol at the given position

val rhs_post_text : Stdlib.Lexing.position -> text

Fetch text following the symbol at the given position

diff --git a/ocaml/Docstrings/index.html b/ocaml/Docstrings/index.html new file mode 100644 index 00000000..81ccacfd --- /dev/null +++ b/ocaml/Docstrings/index.html @@ -0,0 +1,5 @@ + +Docstrings (ocaml.Docstrings)

Module Docstrings

Documentation comments

Warning: this module is unstable and part of compiler-libs.

val init : unit -> unit

(Re)Initialise all docstring state

val warn_bad_docstrings : unit -> unit

Emit warnings for unattached and ambiguous docstrings

Docstrings

type docstring

Documentation comments

val docstring : string -> Location.t -> docstring

Create a docstring

val register : docstring -> unit

Register a docstring

val docstring_body : docstring -> string

Get the text of a docstring

val docstring_loc : docstring -> Location.t

Get the location of a docstring

Set functions

These functions are used by the lexer to associate docstrings to the locations of tokens.

val set_pre_docstrings : Stdlib.Lexing.position -> docstring list -> unit

Docstrings immediately preceding a token

val set_post_docstrings : Stdlib.Lexing.position -> docstring list -> unit

Docstrings immediately following a token

val set_floating_docstrings : Stdlib.Lexing.position -> docstring list -> unit

Docstrings not immediately adjacent to a token

val set_pre_extra_docstrings : Stdlib.Lexing.position -> docstring list -> unit

Docstrings immediately following the token which precedes this one

val set_post_extra_docstrings : + Stdlib.Lexing.position -> + docstring list -> + unit

Docstrings immediately preceding the token which follows this one

Items

The docs type represents documentation attached to an item.

type docs = {
  1. docs_pre : docstring option;
  2. docs_post : docstring option;
}
val empty_docs : docs
val docs_attr : docstring -> Parsetree.attribute

Convert item documentation to attributes and add them to an attribute list

val symbol_docs : unit -> docs

Fetch the item documentation for the current symbol. This also marks this documentation (for ambiguity warnings).

val symbol_docs_lazy : unit -> docs Stdlib.Lazy.t
val rhs_docs : int -> int -> docs

Fetch the item documentation for the symbols between two positions. This also marks this documentation (for ambiguity warnings).

val rhs_docs_lazy : int -> int -> docs Stdlib.Lazy.t
val mark_symbol_docs : unit -> unit

Mark the item documentation for the current symbol (for ambiguity warnings).

val mark_rhs_docs : int -> int -> unit

Mark as associated the item documentation for the symbols between two positions (for ambiguity warnings)

Fields and constructors

The info type represents documentation attached to a field or constructor.

type info = docstring option
val empty_info : info
val info_attr : docstring -> Parsetree.attribute

Convert field info to attributes and add them to an attribute list

val symbol_info : unit -> info

Fetch the field info for the current symbol.

val rhs_info : int -> info

Fetch the field info following the symbol at a given position.

Unattached comments

The text type represents documentation which is not attached to anything.

type text = docstring list
val empty_text : text
val empty_text_lazy : text Stdlib.Lazy.t
val text_attr : docstring -> Parsetree.attribute

Convert text to attributes and add them to an attribute list

val symbol_text : unit -> text

Fetch the text preceding the current symbol.

val symbol_text_lazy : unit -> text Stdlib.Lazy.t
val rhs_text : int -> text

Fetch the text preceding the symbol at the given position.

val rhs_text_lazy : int -> text Stdlib.Lazy.t

Extra text

There may be additional text attached to the delimiters of a block (e.g. struct and end). This is fetched by the following functions, which are applied to the contents of the block rather than the delimiters.

val symbol_pre_extra_text : unit -> text

Fetch additional text preceding the current symbol

val symbol_post_extra_text : unit -> text

Fetch additional text following the current symbol

val rhs_pre_extra_text : int -> text

Fetch additional text preceding the symbol at the given position

val rhs_post_extra_text : int -> text

Fetch additional text following the symbol at the given position

val rhs_post_text : int -> text

Fetch text following the symbol at the given position

module WithMenhir : sig ... end
diff --git a/ocaml/Domainstate/index.html b/ocaml/Domainstate/index.html new file mode 100644 index 00000000..92da54be --- /dev/null +++ b/ocaml/Domainstate/index.html @@ -0,0 +1,2 @@ + +Domainstate (ocaml.Domainstate)

Module Domainstate

val stack_ctx_words : int
type t =
  1. | Domain_young_limit
  2. | Domain_young_ptr
  3. | Domain_young_start
  4. | Domain_young_end
  5. | Domain_young_trigger
  6. | Domain_current_stack
  7. | Domain_exn_handler
  8. | Domain_action_pending
  9. | Domain_c_stack
  10. | Domain_stack_cache
  11. | Domain_gc_regs_buckets
  12. | Domain_gc_regs
  13. | Domain_minor_tables
  14. | Domain_mark_stack
  15. | Domain_marking_done
  16. | Domain_sweeping_done
  17. | Domain_allocated_words
  18. | Domain_swept_words
  19. | Domain_major_slice_epoch
  20. | Domain_local_roots
  21. | Domain_ephe_info
  22. | Domain_final_info
  23. | Domain_backtrace_pos
  24. | Domain_backtrace_active
  25. | Domain_backtrace_buffer
  26. | Domain_backtrace_last_exn
  27. | Domain_compare_unordered
  28. | Domain_oo_next_id_local
  29. | Domain_requested_major_slice
  30. | Domain_requested_global_major_slice
  31. | Domain_requested_minor_gc
  32. | Domain_requested_external_interrupt
  33. | Domain_parser_trace
  34. | Domain_minor_heap_wsz
  35. | Domain_shared_heap
  36. | Domain_id
  37. | Domain_unique_id
  38. | Domain_dls_root
  39. | Domain_extra_heap_resources
  40. | Domain_extra_heap_resources_minor
  41. | Domain_dependent_size
  42. | Domain_dependent_allocated
  43. | Domain_slice_target
  44. | Domain_slice_budget
  45. | Domain_major_work_done_between_slices
  46. | Domain_extern_state
  47. | Domain_intern_state
  48. | Domain_stat_minor_words
  49. | Domain_stat_promoted_words
  50. | Domain_stat_major_words
  51. | Domain_stat_forced_major_collections
  52. | Domain_stat_blocks_marked
  53. | Domain_inside_stw_handler
  54. | Domain_trap_sp_off
  55. | Domain_trap_barrier_off
  56. | Domain_trap_barrier_block
  57. | Domain_external_raise
  58. | Domain_extra_params
val idx_of_field : t -> int
diff --git a/ocaml/Dynlink/index.html b/ocaml/Dynlink/index.html new file mode 100644 index 00000000..9aecfc7a --- /dev/null +++ b/ocaml/Dynlink/index.html @@ -0,0 +1,2 @@ + +Dynlink (ocaml.Dynlink)

Module Dynlink

Dynamic loading of .cmo, .cma and .cmxs files.

val is_native : bool

true if the program is native, false if the program is bytecode.

Dynamic loading of compiled files

val loadfile : string -> unit

In bytecode: load the given bytecode object file (.cmo file) or bytecode library file (.cma file), and link it with the running program. In native code: load the given OCaml plugin file (usually .cmxs), and link it with the running program.

All toplevel expressions in the loaded compilation units are evaluated. No facilities are provided to access value names defined by the unit. Therefore, the unit must itself register its entry points with the main program (or a previously-loaded library) e.g. by modifying tables of functions.

An exception will be raised if the given library defines toplevel modules whose names clash with modules existing either in the main program or a shared library previously loaded with loadfile. Modules from shared libraries previously loaded with loadfile_private are not included in this restriction.

The compilation units loaded by this function are added to the "allowed units" list (see set_allowed_units).

val loadfile_private : string -> unit

Same as loadfile, except that the compilation units just loaded are hidden (cannot be referenced) from other modules dynamically loaded afterwards.

An exception will be raised if the given library defines toplevel modules whose names clash with modules existing in either the main program or a shared library previously loaded with loadfile. Modules from shared libraries previously loaded with loadfile_private are not included in this restriction.

An exception will also be raised if the given library defines toplevel modules whose name matches that of an interface depended on by a module existing in either the main program or a shared library previously loaded with loadfile. This applies even if such dependency is only a "module alias" dependency (i.e. just on the name rather than the contents of the interface).

The compilation units loaded by this function are not added to the "allowed units" list (see set_allowed_units) since they cannot be referenced from other compilation units.

val adapt_filename : string -> string

In bytecode, the identity function. In native code, replace the last extension with .cmxs.

Access control

val set_allowed_units : string list -> unit

Set the list of compilation units that may be referenced from units that are dynamically loaded in the future to be exactly the given value.

Initially all compilation units composing the program currently running are available for reference from dynamically-linked units. set_allowed_units can be used to restrict access to a subset of these units, e.g. to the units that compose the API for dynamically-linked code, and prevent access to all other units, e.g. private, internal modules of the running program.

Note that loadfile changes the allowed-units list.

val allow_only : string list -> unit

allow_only units sets the list of allowed units to be the intersection of the existing allowed units and the given list of units. As such it can never increase the set of allowed units.

val prohibit : string list -> unit

prohibit units prohibits dynamically-linked units from referencing the units named in list units by removing such units from the allowed units list. This can be used to prevent access to selected units, e.g. private, internal modules of the running program.

val main_program_units : unit -> string list

Return the list of compilation units that form the main program (i.e. are not dynamically linked).

val public_dynamically_loaded_units : unit -> string list

Return the list of compilation units that have been dynamically loaded via loadfile (and not via loadfile_private). Note that compilation units loaded dynamically cannot be unloaded.

val all_units : unit -> string list

Return the list of compilation units that form the main program together with those that have been dynamically loaded via loadfile (and not via loadfile_private).

val allow_unsafe_modules : bool -> unit

Govern whether unsafe object files are allowed to be dynamically linked. A compilation unit is 'unsafe' if it contains declarations of external functions, which can break type safety. By default, dynamic linking of unsafe object files is not allowed. In native code, this function does nothing; object files with external functions are always allowed to be dynamically linked.

Error reporting

type linking_error = private
  1. | Undefined_global of string
  2. | Unavailable_primitive of string
  3. | Uninitialized_global of string
type error = private
  1. | Not_a_bytecode_file of string
  2. | Inconsistent_import of string
  3. | Unavailable_unit of string
  4. | Unsafe_file
  5. | Linking_error of string * linking_error
  6. | Corrupted_interface of string
  7. | Cannot_open_dynamic_library of exn
  8. | Library's_module_initializers_failed of exn
  9. | Inconsistent_implementation of string
  10. | Module_already_loaded of string
  11. | Private_library_cannot_implement_interface of string
exception Error of error

Errors in dynamic linking are reported by raising the Error exception with a description of the error. A common case is the dynamic library not being found on the system: this is reported via Cannot_open_dynamic_library (the enclosed exception may be platform-specific).

val error_message : error -> string

Convert an error description to a printable message.

diff --git a/ocaml/Effect_analysis/index.html b/ocaml/Effect_analysis/index.html new file mode 100644 index 00000000..4ce8ec2f --- /dev/null +++ b/ocaml/Effect_analysis/index.html @@ -0,0 +1,2 @@ + +Effect_analysis (ocaml.Effect_analysis)

Module Effect_analysis

Simple side effect analysis.

val no_effects : Flambda.t -> bool

Conservative approximation as to whether a given Flambda expression may have any side effects.

val no_effects_named : Flambda.named -> bool
diff --git a/ocaml/Emit/index.html b/ocaml/Emit/index.html new file mode 100644 index 00000000..bb7b1ffb --- /dev/null +++ b/ocaml/Emit/index.html @@ -0,0 +1,2 @@ + +Emit (ocaml.Emit)

Module Emit

val fundecl : Linear.fundecl -> unit
val data : Cmm.data_item list -> unit
val begin_assembly : unit -> unit
val end_assembly : unit -> unit
diff --git a/ocaml/Emitaux/index.html b/ocaml/Emitaux/index.html new file mode 100644 index 00000000..aa60f9aa --- /dev/null +++ b/ocaml/Emitaux/index.html @@ -0,0 +1,15 @@ + +Emitaux (ocaml.Emitaux)

Module Emitaux

val output_channel : out_channel ref
val emit_string : string -> unit
val emit_int : int -> unit
val emit_nativeint : nativeint -> unit
val emit_int32 : int32 -> unit
val emit_symbol : string -> unit
val emit_printf : ('a, out_channel, unit) format -> 'a
val emit_char : char -> unit
val emit_string_literal : string -> unit
val emit_string_directive : string -> string -> unit
val emit_bytes_directive : string -> string -> unit
val emit_float64_directive : string -> int64 -> unit
val emit_float64_split_directive : string -> int64 -> unit
val emit_float32_directive : string -> int32 -> unit
val reset : unit -> unit
val reset_debug_info : unit -> unit
val emit_debug_info : Debuginfo.t -> unit
val emit_debug_info_gen : + Debuginfo.t -> + (file_num:int -> file_name:string -> unit) -> + (file_num:int -> line:int -> col:int -> unit) -> + unit
type frame_debuginfo =
  1. | Dbg_alloc of Debuginfo.alloc_dbginfo
  2. | Dbg_raise of Debuginfo.t
  3. | Dbg_other of Debuginfo.t
val record_frame_descr : + label:int -> + frame_size:int -> + live_offset:int list -> + frame_debuginfo -> + unit
type emit_frame_actions = {
  1. efa_code_label : int -> unit;
  2. efa_data_label : int -> unit;
  3. efa_8 : int -> unit;
  4. efa_16 : int -> unit;
  5. efa_32 : int32 -> unit;
  6. efa_word : int -> unit;
  7. efa_align : int -> unit;
  8. efa_label_rel : int -> int32 -> unit;
  9. efa_def_label : int -> unit;
  10. efa_string : string -> unit;
}
val emit_frames : emit_frame_actions -> unit
val is_generic_function : string -> bool
val cfi_startproc : unit -> unit
val cfi_endproc : unit -> unit
val cfi_adjust_cfa_offset : int -> unit
val cfi_offset : reg:int -> offset:int -> unit
val cfi_def_cfa_offset : int -> unit
val cfi_remember_state : unit -> unit
val cfi_restore_state : unit -> unit
val cfi_def_cfa_register : reg:int -> unit
val binary_backend_available : bool ref

Is a binary backend available. If yes, we don't need to generate the textual assembly file (unless the user request it with -S).

val create_asm_file : bool ref

Are we actually generating the textual assembly file?

type error =
  1. | Stack_frame_too_large of int
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
type preproc_stack_check_result = {
  1. max_frame_size : int;
  2. contains_nontail_calls : bool;
}
val preproc_stack_check : + fun_body:Linear.instruction -> + frame_size:int -> + trap_size:int -> + preproc_stack_check_result
diff --git a/ocaml/Emitcode/index.html b/ocaml/Emitcode/index.html new file mode 100644 index 00000000..a550d3d8 --- /dev/null +++ b/ocaml/Emitcode/index.html @@ -0,0 +1,24 @@ + +Emitcode (ocaml.Emitcode)

Module Emitcode

val to_file : + out_channel -> + string -> + string -> + required_globals:Ident.Set.t -> + Instruct.instruction list -> + unit
val to_memory : + Instruct.instruction list -> + Instruct.instruction list -> + Misc.LongString.t + * (Cmo_format.reloc_info * int) list + * Instruct.debug_event list
val to_packed_file : + out_channel -> + Instruct.instruction list -> + int + * (Cmo_format.reloc_info * int) list + * Instruct.debug_event list + * Misc.Stdlib.String.Set.t
val marshal_to_channel_with_possibly_32bit_compat : + filename:string -> + kind:string -> + out_channel -> + 'a -> + unit
diff --git a/ocaml/Emitenv/index.html b/ocaml/Emitenv/index.html new file mode 100644 index 00000000..cc7f2f1b --- /dev/null +++ b/ocaml/Emitenv/index.html @@ -0,0 +1,2 @@ + +Emitenv (ocaml.Emitenv)

Module Emitenv

type label = Linear.label
type gc_call = {
  1. gc_lbl : label;
  2. gc_return_lbl : label;
  3. gc_frame_lbl : label;
}
type bound_error_call = {
  1. bd_lbl : label;
  2. bd_frame : label;
}
type float_literal = {
  1. fl : int64;
  2. lbl : label;
}
type int_literal = {
  1. n : nativeint;
  2. n_lbl : label;
}
type offset_computation = {
  1. lbl : label;
  2. dst : label;
  3. src : label;
}
type gotrel_literal = {
  1. lbl_got : label;
  2. lbl_pic : label;
}
type symbol_literal = {
  1. sym : string;
  2. lbl : label;
}
type per_function_env = {
  1. f : Linear.fundecl;
  2. mutable stack_offset : int;
  3. mutable call_gc_sites : gc_call list;
  4. mutable call_gc_label : label;
  5. mutable bound_error_sites : bound_error_call list;
  6. mutable bound_error_call : label option;
  7. mutable jumptables_lbl : label option;
  8. mutable jumptables : label list;
  9. mutable float_literals : float_literal list;
  10. mutable int_literals : int_literal list;
}
diff --git a/ocaml/Env/index.html b/ocaml/Env/index.html new file mode 100644 index 00000000..0222371f --- /dev/null +++ b/ocaml/Env/index.html @@ -0,0 +1,308 @@ + +Env (ocaml.Env)

Module Env

val register_uid : Types.Uid.t -> Location.t -> unit
val get_uid_to_loc_tbl : unit -> Location.t Types.Uid.Tbl.t
type value_unbound_reason =
  1. | Val_unbound_instance_variable
  2. | Val_unbound_self
  3. | Val_unbound_ancestor
  4. | Val_unbound_ghost_recursive of Location.t
type module_unbound_reason =
  1. | Mod_unbound_illegal_recursion
type summary =
  1. | Env_empty
  2. | Env_value of summary * Ident.t * Types.value_description
  3. | Env_type of summary * Ident.t * Types.type_declaration
  4. | Env_extension of summary * Ident.t * Types.extension_constructor
  5. | Env_module of summary + * Ident.t + * Types.module_presence + * Types.module_declaration
  6. | Env_modtype of summary * Ident.t * Types.modtype_declaration
  7. | Env_class of summary * Ident.t * Types.class_declaration
  8. | Env_cltype of summary * Ident.t * Types.class_type_declaration
  9. | Env_open of summary * Path.t
    (*

    The string set argument of Env_open represents a list of module names to skip, i.e. that won't be imported in the toplevel namespace.

    *)
  10. | Env_functor_arg of summary * Ident.t
  11. | Env_constraints of summary * Types.type_declaration Path.Map.t
  12. | Env_copy_types of summary
  13. | Env_persistent of summary * Ident.t
  14. | Env_value_unbound of summary * string * value_unbound_reason
  15. | Env_module_unbound of summary * string * module_unbound_reason
type address =
  1. | Aident of Ident.t
  2. | Adot of address * int
type t
val empty : t
val initial : t
val diff : t -> t -> Ident.t list
type type_descriptions = type_descr_kind
type iter_cont
val iter_types : + (Path.t -> (Path.t * Types.type_declaration) -> unit) -> + t -> + iter_cont
val run_iter_cont : iter_cont list -> (Path.t * iter_cont) list
val same_types : t -> t -> bool
val used_persistent : unit -> Misc.Stdlib.String.Set.t
val find_shadowed_types : Path.t -> t -> Path.t list
val without_cmis : ('a -> 'b) -> 'a -> 'b
val find_value : Path.t -> t -> Types.value_description
val find_type : Path.t -> t -> Types.type_declaration
val find_type_descrs : Path.t -> t -> type_descriptions
val find_module : Path.t -> t -> Types.module_declaration
val find_modtype : Path.t -> t -> Types.modtype_declaration
val find_class : Path.t -> t -> Types.class_declaration
val find_cltype : Path.t -> t -> Types.class_type_declaration
val find_strengthened_module : + aliasable:bool -> + Path.t -> + t -> + Types.module_type
val find_ident_constructor : Ident.t -> t -> Types.constructor_description
val find_ident_label : Ident.t -> t -> Types.label_description
val find_type_expansion : + Path.t -> + t -> + Types.type_expr list * Types.type_expr * int
val find_type_expansion_opt : + Path.t -> + t -> + Types.type_expr list * Types.type_expr * int
val find_modtype_expansion : Path.t -> t -> Types.module_type
val find_modtype_expansion_lazy : Path.t -> t -> Subst.Lazy.modtype
val find_hash_type : Path.t -> t -> Types.type_declaration
val find_value_address : Path.t -> t -> address
val find_module_address : Path.t -> t -> address
val find_class_address : Path.t -> t -> address
val find_constructor_address : Path.t -> t -> address
val shape_of_path : + namespace:Shape.Sig_component_kind.t -> + t -> + Path.t -> + Shape.t
val add_functor_arg : Ident.t -> t -> t
val is_functor_arg : Path.t -> t -> bool
val normalize_module_path : Location.t option -> t -> Path.t -> Path.t
val normalize_type_path : Location.t option -> t -> Path.t -> Path.t
val normalize_value_path : Location.t option -> t -> Path.t -> Path.t
val normalize_modtype_path : t -> Path.t -> Path.t
val reset_required_globals : unit -> unit
val get_required_globals : unit -> Ident.t list
val add_required_global : Ident.t -> unit
val has_local_constraints : t -> bool
val mark_value_used : Types.Uid.t -> unit
val mark_module_used : Types.Uid.t -> unit
val mark_type_used : Types.Uid.t -> unit
type constructor_usage =
  1. | Positive
  2. | Pattern
  3. | Exported_private
  4. | Exported
val mark_constructor_used : + constructor_usage -> + Types.constructor_declaration -> + unit
val mark_extension_used : + constructor_usage -> + Types.extension_constructor -> + unit
type label_usage =
  1. | Projection
  2. | Mutation
  3. | Construct
  4. | Exported_private
  5. | Exported
val mark_label_used : label_usage -> Types.label_declaration -> unit
type unbound_value_hint =
  1. | No_hint
  2. | Missing_rec of Location.t
type lookup_error =
  1. | Unbound_value of Longident.t * unbound_value_hint
  2. | Unbound_type of Longident.t
  3. | Unbound_constructor of Longident.t
  4. | Unbound_label of Longident.t
  5. | Unbound_module of Longident.t
  6. | Unbound_class of Longident.t
  7. | Unbound_modtype of Longident.t
  8. | Unbound_cltype of Longident.t
  9. | Unbound_instance_variable of string
  10. | Not_an_instance_variable of string
  11. | Masked_instance_variable of Longident.t
  12. | Masked_self_variable of Longident.t
  13. | Masked_ancestor_variable of Longident.t
  14. | Structure_used_as_functor of Longident.t
  15. | Abstract_used_as_functor of Longident.t
  16. | Functor_used_as_structure of Longident.t
  17. | Abstract_used_as_structure of Longident.t
  18. | Generative_used_as_applicative of Longident.t
  19. | Illegal_reference_to_recursive_module
  20. | Cannot_scrape_alias of Longident.t * Path.t
val lookup_error : Location.t -> t -> lookup_error -> 'a
val lookup_value : + ?use:bool -> + loc:Location.t -> + Longident.t -> + t -> + Path.t * Types.value_description
val lookup_type : + ?use:bool -> + loc:Location.t -> + Longident.t -> + t -> + Path.t * Types.type_declaration
val lookup_module : + ?use:bool -> + loc:Location.t -> + Longident.t -> + t -> + Path.t * Types.module_declaration
val lookup_modtype : + ?use:bool -> + loc:Location.t -> + Longident.t -> + t -> + Path.t * Types.modtype_declaration
val lookup_class : + ?use:bool -> + loc:Location.t -> + Longident.t -> + t -> + Path.t * Types.class_declaration
val lookup_cltype : + ?use:bool -> + loc:Location.t -> + Longident.t -> + t -> + Path.t * Types.class_type_declaration
val lookup_module_path : + ?use:bool -> + loc:Location.t -> + load:bool -> + Longident.t -> + t -> + Path.t
val lookup_modtype_path : + ?use:bool -> + loc:Location.t -> + Longident.t -> + t -> + Path.t
val lookup_constructor : + ?use:bool -> + loc:Location.t -> + constructor_usage -> + Longident.t -> + t -> + Types.constructor_description
val lookup_all_constructors : + ?use:bool -> + loc:Location.t -> + constructor_usage -> + Longident.t -> + t -> + ((Types.constructor_description * (unit -> unit)) list, + Location.t * t * lookup_error) + result
val lookup_all_constructors_from_type : + ?use:bool -> + loc:Location.t -> + constructor_usage -> + Path.t -> + t -> + (Types.constructor_description * (unit -> unit)) list
val lookup_label : + ?use:bool -> + loc:Location.t -> + label_usage -> + Longident.t -> + t -> + Types.label_description
val lookup_all_labels : + ?use:bool -> + loc:Location.t -> + label_usage -> + Longident.t -> + t -> + ((Types.label_description * (unit -> unit)) list, + Location.t * t * lookup_error) + result
val lookup_all_labels_from_type : + ?use:bool -> + loc:Location.t -> + label_usage -> + Path.t -> + t -> + (Types.label_description * (unit -> unit)) list
val lookup_instance_variable : + ?use:bool -> + loc:Location.t -> + string -> + t -> + Path.t * Asttypes.mutable_flag * string * Types.type_expr
val find_value_by_name : Longident.t -> t -> Path.t * Types.value_description
val find_type_by_name : Longident.t -> t -> Path.t * Types.type_declaration
val find_module_by_name : Longident.t -> t -> Path.t * Types.module_declaration
val find_modtype_by_name : + Longident.t -> + t -> + Path.t * Types.modtype_declaration
val find_class_by_name : Longident.t -> t -> Path.t * Types.class_declaration
val find_cltype_by_name : + Longident.t -> + t -> + Path.t * Types.class_type_declaration
val find_constructor_by_name : + Longident.t -> + t -> + Types.constructor_description
val find_label_by_name : Longident.t -> t -> Types.label_description
val find_value_index : Ident.t -> t -> int option

The find_*_index functions computes a "namespaced" De Bruijn index of an identifier in a given environment. In other words, it returns how many times an identifier has been shadowed by a more recent identifiers with the same name in a given environment. Those functions return None when the identifier is not bound in the environment. This behavior is there to facilitate the detection of inconsistent printing environment, but should disappear in the long term.

val find_type_index : Ident.t -> t -> int option
val find_module_index : Ident.t -> t -> int option
val find_modtype_index : Ident.t -> t -> int option
val find_class_index : Ident.t -> t -> int option
val find_cltype_index : Ident.t -> t -> int option
val bound_value : string -> t -> bool
val bound_module : string -> t -> bool
val bound_type : string -> t -> bool
val bound_modtype : string -> t -> bool
val bound_class : string -> t -> bool
val bound_cltype : string -> t -> bool
val make_copy_of_types : t -> t -> t
val add_value : + ?check:(string -> Warnings.t) -> + Ident.t -> + Types.value_description -> + t -> + t
val add_type : check:bool -> Ident.t -> Types.type_declaration -> t -> t
val add_extension : + check:bool -> + rebind:bool -> + Ident.t -> + Types.extension_constructor -> + t -> + t
val add_module : + ?arg:bool -> + ?shape:Shape.t -> + Ident.t -> + Types.module_presence -> + Types.module_type -> + t -> + t
val add_module_lazy : + update_summary:bool -> + Ident.t -> + Types.module_presence -> + Subst.Lazy.modtype -> + t -> + t
val add_module_declaration : + ?arg:bool -> + ?shape:Shape.t -> + check:bool -> + Ident.t -> + Types.module_presence -> + Types.module_declaration -> + t -> + t
val add_module_declaration_lazy : + update_summary:bool -> + Ident.t -> + Types.module_presence -> + Subst.Lazy.module_decl -> + t -> + t
val add_modtype : Ident.t -> Types.modtype_declaration -> t -> t
val add_modtype_lazy : + update_summary:bool -> + Ident.t -> + Subst.Lazy.modtype_declaration -> + t -> + t
val add_class : Ident.t -> Types.class_declaration -> t -> t
val add_cltype : Ident.t -> Types.class_type_declaration -> t -> t
val add_local_type : Path.t -> Types.type_declaration -> t -> t
val add_persistent_structure : Ident.t -> t -> t
val persistent_structures_of_dir : Load_path.Dir.t -> Misc.Stdlib.String.Set.t
val filter_non_loaded_persistent : (Ident.t -> bool) -> t -> t
val add_signature : Types.signature -> t -> t
val open_signature : + ?used_slot:bool ref -> + ?loc:Location.t -> + ?toplevel:bool -> + Asttypes.override_flag -> + Path.t -> + t -> + (t, [ `Not_found | `Functor ]) result
val open_pers_signature : string -> t -> (t, [ `Not_found ]) result
val remove_last_open : Path.t -> t -> t option
val enter_value : + ?check:(string -> Warnings.t) -> + string -> + Types.value_description -> + t -> + Ident.t * t
val enter_type : + scope:int -> + string -> + Types.type_declaration -> + t -> + Ident.t * t
val enter_extension : + scope:int -> + rebind:bool -> + string -> + Types.extension_constructor -> + t -> + Ident.t * t
val enter_module : + scope:int -> + ?arg:bool -> + string -> + Types.module_presence -> + Types.module_type -> + t -> + Ident.t * t
val enter_module_declaration : + scope:int -> + ?arg:bool -> + ?shape:Shape.t -> + string -> + Types.module_presence -> + Types.module_declaration -> + t -> + Ident.t * t
val enter_modtype : + scope:int -> + string -> + Types.modtype_declaration -> + t -> + Ident.t * t
val enter_class : + scope:int -> + string -> + Types.class_declaration -> + t -> + Ident.t * t
val enter_cltype : + scope:int -> + string -> + Types.class_type_declaration -> + t -> + Ident.t * t
val enter_signature : + ?mod_shape:Shape.t -> + scope:int -> + Types.signature -> + t -> + Types.signature * t
val enter_signature_and_shape : + scope:int -> + parent_shape:Shape.Map.t -> + Shape.t -> + Types.signature -> + t -> + Types.signature * Shape.Map.t * t
val enter_unbound_value : string -> value_unbound_reason -> t -> t
val enter_unbound_module : string -> module_unbound_reason -> t -> t
val reset_cache : unit -> unit
val reset_cache_toplevel : unit -> unit
val set_unit_name : string -> unit
val get_unit_name : unit -> string
val read_signature : Misc.modname -> Misc.filepath -> Types.signature
val save_signature : + alerts:Misc.alerts -> + Types.signature -> + Misc.modname -> + Misc.filepath -> + Cmi_format.cmi_infos
val save_signature_with_imports : + alerts:Misc.alerts -> + Types.signature -> + Misc.modname -> + Misc.filepath -> + Misc.crcs -> + Cmi_format.cmi_infos
val crc_of_unit : Misc.modname -> Stdlib.Digest.t
val imports : unit -> Misc.crcs
val import_crcs : source:string -> Misc.crcs -> unit
val is_imported_opaque : Misc.modname -> bool
val register_import_as_opaque : Misc.modname -> unit
val summary : t -> summary
val keep_only_summary : t -> t
val env_of_only_summary : (summary -> Subst.t -> t) -> t -> t
type error =
  1. | Missing_module of Location.t * Path.t * Path.t
  2. | Illegal_value_name of Location.t * string
  3. | Lookup_error of Location.t * t * lookup_error
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
val report_lookup_error : + Location.t -> + t -> + Stdlib.Format.formatter -> + lookup_error -> + unit
val in_signature : bool -> t -> t
val is_in_signature : t -> bool
val set_value_used_callback : Types.value_description -> (unit -> unit) -> unit
val set_type_used_callback : + Types.type_declaration -> + ((unit -> unit) -> unit) -> + unit
val check_functor_application : + (errors:bool -> + loc:Location.t -> + lid_whole_app:Longident.t -> + f0_path:Path.t -> + args:(Path.t * Types.module_type) list -> + arg_path:Path.t -> + arg_mty:Types.module_type -> + param_mty:Types.module_type -> + t -> + unit) + ref
val check_well_formed_module : + (t -> Location.t -> string -> Types.module_type -> unit) ref
val add_delayed_check_forward : ((unit -> unit) -> unit) ref
val strengthen : + (aliasable:bool -> + t -> + Subst.Lazy.modtype -> + Path.t -> + Subst.Lazy.modtype) + ref
val same_constr : (t -> Types.type_expr -> Types.type_expr -> bool) ref
val print_longident : (Stdlib.Format.formatter -> Longident.t -> unit) ref
val print_path : (Stdlib.Format.formatter -> Path.t -> unit) ref

Folds

val fold_values : + (string -> Path.t -> Types.value_description -> 'a -> 'a) -> + Longident.t option -> + t -> + 'a -> + 'a
val fold_types : + (string -> Path.t -> Types.type_declaration -> 'a -> 'a) -> + Longident.t option -> + t -> + 'a -> + 'a
val fold_constructors : + (Types.constructor_description -> 'a -> 'a) -> + Longident.t option -> + t -> + 'a -> + 'a
val fold_labels : + (Types.label_description -> 'a -> 'a) -> + Longident.t option -> + t -> + 'a -> + 'a
val fold_modules : + (string -> Path.t -> Types.module_declaration -> 'a -> 'a) -> + Longident.t option -> + t -> + 'a -> + 'a

Persistent structures are only traversed if they are already loaded.

val fold_modtypes : + (string -> Path.t -> Types.modtype_declaration -> 'a -> 'a) -> + Longident.t option -> + t -> + 'a -> + 'a
val fold_classes : + (string -> Path.t -> Types.class_declaration -> 'a -> 'a) -> + Longident.t option -> + t -> + 'a -> + 'a
val fold_cltypes : + (string -> Path.t -> Types.class_type_declaration -> 'a -> 'a) -> + Longident.t option -> + t -> + 'a -> + 'a
val scrape_alias : t -> Types.module_type -> Types.module_type

Utilities

val check_value_name : string -> Location.t -> unit
val print_address : Stdlib.Format.formatter -> address -> unit
diff --git a/ocaml/Envaux/index.html b/ocaml/Envaux/index.html new file mode 100644 index 00000000..988a76ad --- /dev/null +++ b/ocaml/Envaux/index.html @@ -0,0 +1,2 @@ + +Envaux (ocaml.Envaux)

Module Envaux

val env_from_summary : Env.summary -> Subst.t -> Env.t
val reset_cache : unit -> unit
val env_of_only_summary : Env.t -> Env.t
type error =
  1. | Module_not_found of Path.t
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Errors/index.html b/ocaml/Errors/index.html new file mode 100644 index 00000000..a43244d0 --- /dev/null +++ b/ocaml/Errors/index.html @@ -0,0 +1,2 @@ + +Errors (ocaml.Errors)

Module Errors

val report_error : Stdlib.Format.formatter -> exn -> unit
diff --git a/ocaml/Errortrace/Subtype/index.html b/ocaml/Errortrace/Subtype/index.html new file mode 100644 index 00000000..262a6d72 --- /dev/null +++ b/ocaml/Errortrace/Subtype/index.html @@ -0,0 +1,5 @@ + +Subtype (ocaml.Errortrace.Subtype)

Module Errortrace.Subtype

type 'a elt =
  1. | Diff of 'a diff
type 'a t = 'a elt list

Just as outside Subtype, we split traces, completed traces, and complete errors. However, in a minor asymmetry, the name Subtype.error_trace corresponds to the outside error type, and Subtype.error corresponds to the outside *_error types (e.g., unification_error). This error type has the invariant that the subtype trace is nonempty; note that no such invariant is imposed on the unification trace.

type trace = Types.type_expr t
type error_trace = expanded_type t
type unification_error_trace = unification error

To avoid shadowing

type nonrec error = private {
  1. trace : error_trace;
  2. unification_trace : unification error;
}
val error : + trace:error_trace -> + unification_trace:unification_error_trace -> + error
val map : ('a -> 'b) -> 'a t -> 'b t
diff --git a/ocaml/Errortrace/index.html b/ocaml/Errortrace/index.html new file mode 100644 index 00000000..8b476435 --- /dev/null +++ b/ocaml/Errortrace/index.html @@ -0,0 +1,11 @@ + +Errortrace (ocaml.Errortrace)

Module Errortrace

type position =
  1. | First
  2. | Second
val swap_position : position -> position
val print_pos : Stdlib.Format.formatter -> position -> unit
type expanded_type = {
  1. ty : Types.type_expr;
  2. expanded : Types.type_expr;
}
val trivial_expansion : Types.type_expr -> expanded_type

trivial_expansion ty creates an expanded_type whose expansion is also ty. Usually, you want Ctype.expand_type instead, since the expansion carries useful information; however, in certain circumstances, the error is about the expansion of the type, meaning that actually performing the expansion produces more confusing or inaccurate output.

type 'a diff = {
  1. got : 'a;
  2. expected : 'a;
}
val map_diff : ('a -> 'b) -> 'a diff -> 'b diff

map_diff f {expected;got} is {expected=f expected; got=f got}

type 'a escape_kind =
  1. | Constructor of Path.t
  2. | Univ of Types.type_expr
  3. | Self
  4. | Module_type of Path.t
  5. | Equation of 'a
  6. | Constraint

Scope escape related errors

type 'a escape = {
  1. kind : 'a escape_kind;
  2. context : Types.type_expr option;
}
val map_escape : ('a -> 'b) -> 'a escape -> 'b escape
val explain : 'a list -> (prev:'a option -> 'a -> 'b option) -> 'b option
type unification = private
  1. | Unification

Type indices

type comparison = private
  1. | Comparison
type fixed_row_case =
  1. | Cannot_be_closed
  2. | Cannot_add_tags of string list
type 'variety variant =
  1. | Incompatible_types_for : string -> _ variant
  2. | No_tags : position * (Asttypes.label * Types.row_field) list -> _ variant
  3. | No_intersection : unification variant
  4. | Fixed_row : position + * fixed_row_case + * Types.fixed_explanation -> unification variant
  5. | Presence_not_guaranteed_for : position * string -> comparison variant
  6. | Openness : position -> comparison variant
type 'variety obj =
  1. | Missing_field : position * string -> _ obj
  2. | Abstract_row : position -> _ obj
  3. | Self_cannot_be_closed : unification obj
type ('a, 'variety) elt =
  1. | Diff : 'a diff -> ('a, _) elt
  2. | Variant : 'variety variant -> ('a, 'variety) elt
  3. | Obj : 'variety obj -> ('a, 'variety) elt
  4. | Escape : 'a escape -> ('a, _) elt
  5. | Incompatible_fields : {
    1. name : string;
    2. diff : Types.type_expr diff;
    } -> ('a, _) elt
  6. | Rec_occur : Types.type_expr * Types.type_expr -> ('a, _) elt
type ('a, 'variety) t = ('a, 'variety) elt list
type 'variety trace = (Types.type_expr, 'variety) t
type 'variety error = (expanded_type, 'variety) t
val map : ('a -> 'b) -> ('a, 'variety) t -> ('b, 'variety) t
val incompatible_fields : + name:string -> + got:Types.type_expr -> + expected:Types.type_expr -> + (Types.type_expr, _) elt
val swap_trace : ('a, 'variety) t -> ('a, 'variety) t

The traces ('variety t) are the core error types. However, we bundle them up into three "top-level" error types, which are used elsewhere: unification_error, equality_error, and moregen_error. In the case of equality_error, this has to bundle in extra information; in general, it distinguishes the three types of errors and allows us to distinguish traces that are being built (or processed) from those that are complete and have become the final error. These error types have the invariants that their traces are nonempty; we ensure that through three smart constructors with matching names.

type unification_error = private {
  1. trace : unification error;
}
type equality_error = private {
  1. trace : comparison error;
  2. subst : (Types.type_expr * Types.type_expr) list;
}
type moregen_error = private {
  1. trace : comparison error;
}
val unification_error : trace:unification error -> unification_error
val equality_error : + trace:comparison error -> + subst:(Types.type_expr * Types.type_expr) list -> + equality_error
val moregen_error : trace:comparison error -> moregen_error
type comparison_error =
  1. | Equality_error of equality_error
  2. | Moregen_error of moregen_error

Wraps up the two different kinds of comparison errors in one type

val swap_unification_error : unification_error -> unification_error

Lift swap_trace to unification_error

module Subtype : sig ... end
diff --git a/ocaml/Event/index.html b/ocaml/Event/index.html new file mode 100644 index 00000000..0d4966af --- /dev/null +++ b/ocaml/Event/index.html @@ -0,0 +1,2 @@ + +Event (ocaml.Event)

Module Event

First-class synchronous communication.

This module implements synchronous inter-thread communications over channels. As in John Reppy's Concurrent ML system, the communication events are first-class values: they can be built and combined independently before being offered for communication.

type 'a channel

The type of communication channels carrying values of type 'a.

val new_channel : unit -> 'a channel

Return a new channel.

type +'a event

The type of communication events returning a result of type 'a.

val send : 'a channel -> 'a -> unit event

send ch v returns the event consisting in sending the value v over the channel ch. The result value of this event is ().

val receive : 'a channel -> 'a event

receive ch returns the event consisting in receiving a value from the channel ch. The result value of this event is the value received.

val always : 'a -> 'a event

always v returns an event that is always ready for synchronization. The result value of this event is v.

val choose : 'a event list -> 'a event

choose evl returns the event that is the alternative of all the events in the list evl.

val wrap : 'a event -> ('a -> 'b) -> 'b event

wrap ev fn returns the event that performs the same communications as ev, then applies the post-processing function fn on the return value.

val wrap_abort : 'a event -> (unit -> unit) -> 'a event

wrap_abort ev fn returns the event that performs the same communications as ev, but if it is not selected the function fn is called after the synchronization.

val guard : (unit -> 'a event) -> 'a event

guard fn returns the event that, when synchronized, computes fn() and behaves as the resulting event. This enables computing events with side-effects at the time of the synchronization operation.

val sync : 'a event -> 'a

'Synchronize' on an event: offer all the communication possibilities specified in the event to the outside world, and block until one of the communications succeed. The result value of that communication is returned.

val select : 'a event list -> 'a

'Synchronize' on an alternative of events. select evl is shorthand for sync(choose evl).

val poll : 'a event -> 'a option

Non-blocking version of Event.sync: offer all the communication possibilities specified in the event to the outside world, and if one can take place immediately, perform it and return Some r where r is the result value of that communication. Otherwise, return None without blocking.

diff --git a/ocaml/Export_id/Map/index.html b/ocaml/Export_id/Map/index.html new file mode 100644 index 00000000..79043f81 --- /dev/null +++ b/ocaml/Export_id/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Export_id.Map)

Module Export_id.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Export_id/Set/index.html b/ocaml/Export_id/Set/index.html new file mode 100644 index 00000000..bff23413 --- /dev/null +++ b/ocaml/Export_id/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Export_id.Set)

Module Export_id.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Export_id/T/index.html b/ocaml/Export_id/T/index.html new file mode 100644 index 00000000..611af0f6 --- /dev/null +++ b/ocaml/Export_id/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Export_id.T)

Module Export_id.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Export_id/Tbl/index.html b/ocaml/Export_id/Tbl/index.html new file mode 100644 index 00000000..6c1db983 --- /dev/null +++ b/ocaml/Export_id/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Export_id.Tbl)

Module Export_id.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Export_id/index.html b/ocaml/Export_id/index.html new file mode 100644 index 00000000..01741077 --- /dev/null +++ b/ocaml/Export_id/index.html @@ -0,0 +1,2 @@ + +Export_id (ocaml.Export_id)

Module Export_id

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create : ?name:string -> Compilation_unit.t -> t
val name : t -> string option
val get_compilation_unit : t -> Compilation_unit.t
diff --git a/ocaml/Export_info/index.html b/ocaml/Export_info/index.html new file mode 100644 index 00000000..015a6dcf --- /dev/null +++ b/ocaml/Export_info/index.html @@ -0,0 +1,34 @@ + +Export_info (ocaml.Export_info)

Module Export_info

Exported information (that is to say, information written into a .cmx file) about a compilation unit.

type value_string_contents =
  1. | Contents of string
  2. | Unknown_or_mutable
type value_string = {
  1. contents : value_string_contents;
  2. size : int;
}
type value_float_array_contents =
  1. | Contents of float option array
  2. | Unknown_or_mutable
type value_float_array = {
  1. contents : value_float_array_contents;
  2. size : int;
}
type descr =
  1. | Value_block of Tag.t * approx array
  2. | Value_mutable_block of Tag.t * int
  3. | Value_int of int
  4. | Value_char of char
  5. | Value_float of float
  6. | Value_float_array of value_float_array
  7. | Value_boxed_int : 'a A.boxed_int * 'a -> descr
  8. | Value_string of value_string
  9. | Value_closure of value_closure
  10. | Value_set_of_closures of value_set_of_closures
  11. | Value_unknown_descr
and value_closure = {
  1. closure_id : Closure_id.t;
  2. set_of_closures : value_set_of_closures;
}
and value_set_of_closures = {
  1. set_of_closures_id : Set_of_closures_id.t;
  2. bound_vars : approx Var_within_closure.Map.t;
  3. free_vars : Flambda.specialised_to Variable.Map.t;
  4. results : approx Closure_id.Map.t;
  5. aliased_symbol : Symbol.t option;
}
and approx =
  1. | Value_unknown
  2. | Value_id of Export_id.t
  3. | Value_symbol of Symbol.t
type t = private {
  1. sets_of_closures : A.function_declarations Set_of_closures_id.Map.t;
    (*

    Code of exported functions indexed by set of closures IDs.

    *)
  2. values : descr Export_id.Map.t Compilation_unit.Map.t;
    (*

    Structure of exported values.

    *)
  3. symbol_id : Export_id.t Symbol.Map.t;
    (*

    Associates symbols and values.

    *)
  4. offset_fun : int Closure_id.Map.t;
    (*

    Positions of function pointers in their closures.

    *)
  5. offset_fv : int Var_within_closure.Map.t;
    (*

    Positions of value pointers in their closures.

    *)
  6. constant_closures : Closure_id.Set.t;
  7. invariant_params : Variable.Set.t Variable.Map.t Set_of_closures_id.Map.t;
  8. recursive : Variable.Set.t Set_of_closures_id.Map.t;
}

A structure that describes what a single compilation unit exports.

type transient = private {
  1. sets_of_closures : A.function_declarations Set_of_closures_id.Map.t;
  2. values : descr Export_id.Map.t Compilation_unit.Map.t;
  3. symbol_id : Export_id.t Symbol.Map.t;
  4. invariant_params : Variable.Set.t Variable.Map.t Set_of_closures_id.Map.t;
  5. recursive : Variable.Set.t Set_of_closures_id.Map.t;
  6. relevant_local_closure_ids : Closure_id.Set.t;
  7. relevant_imported_closure_ids : Closure_id.Set.t;
  8. relevant_local_vars_within_closure : Var_within_closure.Set.t;
  9. relevant_imported_vars_within_closure : Var_within_closure.Set.t;
}
val empty : t

Export information for a compilation unit that exports nothing.

val opaque_transient : + compilation_unit:Compilation_unit.t -> + root_symbol:Symbol.t -> + transient
val create : + sets_of_closures:A.function_declarations Set_of_closures_id.Map.t -> + values:descr Export_id.Map.t Compilation_unit.Map.t -> + symbol_id:Export_id.t Symbol.Map.t -> + offset_fun:int Closure_id.Map.t -> + offset_fv:int Var_within_closure.Map.t -> + constant_closures:Closure_id.Set.t -> + invariant_params:Variable.Set.t Variable.Map.t Set_of_closures_id.Map.t -> + recursive:Variable.Set.t Set_of_closures_id.Map.t -> + t

Create a new export information structure.

val create_transient : + sets_of_closures:A.function_declarations Set_of_closures_id.Map.t -> + values:descr Export_id.Map.t Compilation_unit.Map.t -> + symbol_id:Export_id.t Symbol.Map.t -> + invariant_params:Variable.Set.t Variable.Map.t Set_of_closures_id.Map.t -> + recursive:Variable.Set.t Set_of_closures_id.Map.t -> + relevant_local_closure_ids:Closure_id.Set.t -> + relevant_imported_closure_ids:Closure_id.Set.t -> + relevant_local_vars_within_closure:Var_within_closure.Set.t -> + relevant_imported_vars_within_closure:Var_within_closure.Set.t -> + transient
val t_of_transient : + transient -> + program:Flambda.program -> + local_offset_fun:int Closure_id.Map.t -> + local_offset_fv:int Var_within_closure.Map.t -> + imported_offset_fun:int Closure_id.Map.t -> + imported_offset_fv:int Var_within_closure.Map.t -> + constant_closures:Closure_id.Set.t -> + t

Record information about the layout of closures and which sets of closures are constant. These are all worked out during the Flambda_to_clambda pass.

val merge : t -> t -> t

Union of export information. Verifies that there are no identifier clashes.

val find_description : t -> Export_id.t -> descr

Look up the description of an exported value given its export ID.

Partition a mapping from export IDs by compilation unit.

diff --git a/ocaml/Export_info_for_pack/index.html b/ocaml/Export_info_for_pack/index.html new file mode 100644 index 00000000..78cdbcd4 --- /dev/null +++ b/ocaml/Export_info_for_pack/index.html @@ -0,0 +1,6 @@ + +Export_info_for_pack (ocaml.Export_info_for_pack)

Module Export_info_for_pack

Transformations on export information that are only used for the building of packs.

val import_for_pack : + pack_units:Compilation_unit.Set.t -> + pack:Compilation_unit.t -> + Export_info.t -> + Export_info.t

Transform the information from exported to be suitable to be reexported as the information for a pack named pack containing units pack_units. It mainly changes symbols of units pack_units to refer to pack instead.

val clear_import_state : unit -> unit

Drops the state after importing several units in the same pack.

diff --git a/ocaml/Expunge/index.html b/ocaml/Expunge/index.html new file mode 100644 index 00000000..dd63e510 --- /dev/null +++ b/ocaml/Expunge/index.html @@ -0,0 +1,2 @@ + +Expunge (ocaml.Expunge)

Module Expunge

val main : unit -> unit

The entry point for expunge

diff --git a/ocaml/Extract_projections/index.html b/ocaml/Extract_projections/index.html new file mode 100644 index 00000000..26e10e53 --- /dev/null +++ b/ocaml/Extract_projections/index.html @@ -0,0 +1,6 @@ + +Extract_projections (ocaml.Extract_projections)

Module Extract_projections

Identify projections from variables used in function bodies (free variables or specialised args, for example, according to which_variables below). Projections from variables that are also used boxed are not returned.

val from_function_decl : + env:Inline_and_simplify_aux.Env.t -> + which_variables:Flambda.specialised_to Variable.Map.t -> + function_decl:Flambda.function_declaration -> + Projection.Set.t

which_variables maps (existing) inner variables to (existing) outer variables in the manner of free_vars and specialised_args in Flambda.set_of_closures.

The returned projections are projecting_from (cf. projection.mli) the "existing inner vars".

diff --git a/ocaml/Find_recursive_functions/index.html b/ocaml/Find_recursive_functions/index.html new file mode 100644 index 00000000..36e2e440 --- /dev/null +++ b/ocaml/Find_recursive_functions/index.html @@ -0,0 +1,7 @@ + +Find_recursive_functions (ocaml.Find_recursive_functions)

Module Find_recursive_functions

"Recursive functions" are those functions f that might call either:

  • themselves, or
  • another function that in turn might call f.

For example in the following simultaneous definition of f g and h, f and g are recursive functions, but not h: let rec f x = g x + and g x = f x + and h x = g x

val in_function_declarations : + Flambda.function_declarations -> + backend:(module Backend_intf.S) -> + Variable.Set.t

Determine the recursive functions, if any, bound by the given set of function declarations. This is only intended to be used by Flambda.create_function_declarations.

diff --git a/ocaml/Flambda/Constant_defining_value/Map/index.html b/ocaml/Flambda/Constant_defining_value/Map/index.html new file mode 100644 index 00000000..2cc55f10 --- /dev/null +++ b/ocaml/Flambda/Constant_defining_value/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Flambda.Constant_defining_value.Map)

Module Constant_defining_value.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Flambda/Constant_defining_value/Set/index.html b/ocaml/Flambda/Constant_defining_value/Set/index.html new file mode 100644 index 00000000..4c4315f1 --- /dev/null +++ b/ocaml/Flambda/Constant_defining_value/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Flambda.Constant_defining_value.Set)

Module Constant_defining_value.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Flambda/Constant_defining_value/T/index.html b/ocaml/Flambda/Constant_defining_value/T/index.html new file mode 100644 index 00000000..71e8b79d --- /dev/null +++ b/ocaml/Flambda/Constant_defining_value/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Flambda.Constant_defining_value.T)

Module Constant_defining_value.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Flambda/Constant_defining_value/Tbl/index.html b/ocaml/Flambda/Constant_defining_value/Tbl/index.html new file mode 100644 index 00000000..1b131ea5 --- /dev/null +++ b/ocaml/Flambda/Constant_defining_value/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Flambda.Constant_defining_value.Tbl)

Module Constant_defining_value.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Flambda/Constant_defining_value/index.html b/ocaml/Flambda/Constant_defining_value/index.html new file mode 100644 index 00000000..f3cbe679 --- /dev/null +++ b/ocaml/Flambda/Constant_defining_value/index.html @@ -0,0 +1,2 @@ + +Constant_defining_value (ocaml.Flambda.Constant_defining_value)

Module Flambda.Constant_defining_value

module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
diff --git a/ocaml/Flambda/With_free_variables/index.html b/ocaml/Flambda/With_free_variables/index.html new file mode 100644 index 00000000..4b667f65 --- /dev/null +++ b/ocaml/Flambda/With_free_variables/index.html @@ -0,0 +1,2 @@ + +With_free_variables (ocaml.Flambda.With_free_variables)

Module Flambda.With_free_variables

A module for the manipulation of terms where the recomputation of free variable sets is to be kept to a minimum.

type 'a t
val of_defining_expr_of_let : let_expr -> named t

O(1) time.

val of_body_of_let : let_expr -> expr t

O(1) time.

val of_expr : expr -> expr t

Takes the time required to calculate the free variables of the given term (proportional to the size of the term, except that the calculation for Let is O(1)).

val of_named : named -> named t
val create_let_reusing_defining_expr : Variable.t -> named t -> expr -> expr

Takes the time required to calculate the free variables of the given expr.

val create_let_reusing_body : Variable.t -> named -> expr t -> expr

Takes the time required to calculate the free variables of the given named.

val create_let_reusing_both : Variable.t -> named t -> expr t -> expr

O(1) time.

val expr : expr t -> named t

The equivalent of the Expr constructor.

val contents : 'a t -> 'a
val free_variables : _ t -> Variable.Set.t

O(1) time.

diff --git a/ocaml/Flambda/index.html b/ocaml/Flambda/index.html new file mode 100644 index 00000000..92f81885 --- /dev/null +++ b/ocaml/Flambda/index.html @@ -0,0 +1,120 @@ + +Flambda (ocaml.Flambda)

Module Flambda

Intermediate language used for tree-based analysis and optimization.

type call_kind =
  1. | Indirect
  2. | Direct of Closure_id.t

Whether the callee in a function application is known at compile time.

type const =
  1. | Int of int
  2. | Char of char
    (*

    Char is kept separate from Int to improve printing

    *)

Simple constants. ("Structured constants" are rewritten to invocations of Pmakeblock so that they easily take part in optimizations.)

type apply = {
  1. func : Variable.t;
  2. args : Variable.t list;
  3. kind : call_kind;
  4. dbg : Debuginfo.t;
  5. inline : Lambda.inline_attribute;
    (*

    Instructions from the source code as to whether the callee should be inlined.

    *)
  6. specialise : Lambda.specialise_attribute;
    (*

    Instructions from the source code as to whether the callee should be specialised.

    *)
}

The application of a function to a list of arguments.

type assign = {
  1. being_assigned : Mutable_variable.t;
  2. new_value : Variable.t;
}

The update of a mutable variable. Mutable variables are distinct from immutable variables in Flambda.

type send = {
  1. kind : Lambda.meth_kind;
  2. meth : Variable.t;
  3. obj : Variable.t;
  4. args : Variable.t list;
  5. dbg : Debuginfo.t;
}

The invocation of a method.

type project_closure = Projection.project_closure

For details on these types, see projection.mli.

type move_within_set_of_closures = Projection.move_within_set_of_closures
type project_var = Projection.project_var
type specialised_to = {
  1. var : Variable.t;
    (*

    The "outer variable".

    *)
  2. projection : Projection.t option;
    (*

    The projecting_from value (see projection.mli) of any projection must be another free variable or specialised argument (depending on whether this record type is involved in free_vars or specialised_args respectively) in the same set of closures. As such, this field describes a relation of projections between either the free_vars or the specialised_args.

    *)
}

See free_vars and specialised_args, below.

type t =
  1. | Var of Variable.t
  2. | Let of let_expr
  3. | Let_mutable of let_mutable
  4. | Let_rec of (Variable.t * named) list * t
    (*

    CR-someday lwhite: give Let_rec the same fields as Let.

    *)
  5. | Apply of apply
  6. | Send of send
  7. | Assign of assign
  8. | If_then_else of Variable.t * t * t
  9. | Switch of Variable.t * switch
  10. | String_switch of Variable.t * (string * t) list * t option
    (*

    Restrictions on Lambda.Lstringswitch also apply to String_switch.

    *)
  11. | Static_raise of Static_exception.t * Variable.t list
  12. | Static_catch of Static_exception.t * Variable.t list * t * t
  13. | Try_with of t * Variable.t * t
  14. | While of t * t
  15. | For of for_loop
  16. | Proved_unreachable

Flambda terms are partitioned in a pseudo-ANF manner; many terms are required to be let-bound. This in particular ensures there is always a variable name for an expression that may be lifted out (for example if it is found to be constant). Note: All bound variables in Flambda terms must be distinct. Flambda_invariants verifies this.

and named =
  1. | Symbol of Symbol.t
  2. | Const of const
  3. | Allocated_const of Allocated_const.t
  4. | Read_mutable of Mutable_variable.t
  5. | Read_symbol_field of Symbol.t * int
    (*

    During the lifting of let bindings to program constructions after closure conversion, we generate symbols and their corresponding definitions (which may or may not be constant), together with field accesses to such symbols. We would like it to be the case that such field accesses are simplified to the relevant component of the symbol concerned. (The rationale is to generate efficient code and share constants as expected: see e.g. tests/asmcomp/staticalloc.ml.) The components of the symbol would be identified by other symbols. This sort of access pattern is feasible because the top-level structure of symbols is statically allocated and fixed at compile time. It may seem that Prim (Pfield, ...) expressions could be used to perform the field accesses. However for simplicity, to avoid having to keep track of properties of individual fields of blocks, Inconstant_idents never deems a Prim (Pfield, ...) expression to be constant. This would in general prevent field accesses to symbols from being simplified in the way we would like, since Lift_constants would not assign new symbols (i.e. the things we would like to simplify to) to the various projections from the symbols in question. To circumvent this problem we use Read_symbol_field when generating projections from the top level of symbols. Owing to the properties of symbols described above, such expressions may be eligible for declaration as constant by Inconstant_idents (and thus themselves lifted to another symbol), without any further complication. Read_symbol_field may only be used when the definition of the symbol is in scope in the program. For external unresolved symbols, Pfield may still be used; it will be changed to Read_symbol_field by Inline_and_simplify when (and if) the symbol is imported.

    *)
  6. | Set_of_closures of set_of_closures
  7. | Project_closure of project_closure
  8. | Move_within_set_of_closures of move_within_set_of_closures
  9. | Project_var of project_var
  10. | Prim of Clambda_primitives.primitive * Variable.t list * Debuginfo.t
  11. | Expr of t
    (*

    ANF escape hatch.

    *)

Values of type named will always be let-bound to a Variable.t.

and let_expr = private {
  1. var : Variable.t;
  2. defining_expr : named;
  3. body : t;
  4. free_vars_of_defining_expr : Variable.Set.t;
    (*

    A cache of the free variables in the defining expression of the let.

    *)
  5. free_vars_of_body : Variable.Set.t;
    (*

    A cache of the free variables of the body of the let. This is an important optimization.

    *)
}
and let_mutable = {
  1. var : Mutable_variable.t;
  2. initial_value : Variable.t;
  3. contents_kind : Lambda.value_kind;
  4. body : t;
}
and set_of_closures = private {
  1. function_decls : function_declarations;
  2. free_vars : specialised_to Variable.Map.t;
    (*

    Mapping from all variables free in the body of the function_decls to variables in scope at the definition point of the set_of_closures. The domain of this map is sometimes known as the "variables bound by the closure".

    *)
  3. specialised_args : specialised_to Variable.Map.t;
    (*

    Parameters whose corresponding arguments are known to always alias a particular value. These are the only parameters that may, during Inline_and_simplify, have non-unknown approximations.

    An argument may only be specialised to a variable in the scope of the corresponding set of closures declaration. Usually, that variable itself also appears in the position of the specialised argument at all call sites of the function. However it may also be the case (for example in code generated as a result of Augment_specialised_args) that the various call sites of such a function have differing variables in the position of the specialised argument. This is permissible *so long as it is certain they all alias the same value*. Great care must be taken in transformations that result in this situation since there are no invariant checks for correctness.

    As an example, supposing all call sites of f are represented here: let x = ... in + let f a b c = ... in + let y = ... in + f x y 1; + f x y 1 the specialised arguments of f can (but does not necessarily) contain the association a -> x, but cannot contain b -> y because f is not in the scope of y. If f were the recursive function let rec f a b c = f a 1 2 in, a -> x would still be a valid specialised argument because all recursive calls maintain the invariant.

    This information is used for optimization purposes, if such a binding is known, it is possible to specialise the body of the function according to its parameter. This is usually introduced when specialising a recursive function, for instance. let rec map f = function + | [] -> [] + | h :: t -> f h :: map f t + let map_succ l = + let succ x = x + 1 in + map succ l map can be duplicated in map_succ to be specialised for the argument f. This will result in let map_succ l = + let succ x = x + 1 in + let rec map f = function + | [] -> [] + | h :: t -> f h :: map f t in + map succ l with map having f -> succ in its specialised_args field.

    Specialised argument information for arguments that are used must never be erased. This ensures that specialised arguments whose approximations describe closures maintain those approximations, which is essential to transport the closure freshening information to the point of use (e.g. a Project_var from such an argument).

    *)
  4. direct_call_surrogates : Variable.t Variable.Map.t;
    (*

    If direct_call_surrogates maps fun_var1 to fun_var2 then direct calls to fun_var1 should be redirected to fun_var2. This is used to reduce the overhead of transformations that introduce wrapper functions (which will be inlined at direct call sites, but will penalise indirect call sites). direct_call_surrogates may not be transitively closed.

    *)
}

The representation of a set of function declarations (possibly mutually recursive). Such a set encapsulates the declarations themselves, information about their defining environment, and information used specifically for optimization. Before a function can be applied it must be "projected" from a set of closures to yield a "closure". This is done using Project_closure (see above). Given a closure, not only can it be applied, but information about its defining environment can be retrieved (using Project_var, see above). At runtime, a set_of_closures corresponds to an OCaml value with tag Closure_tag (possibly with inline Infix_tag(s)). As an optimization, an operation (Move_within_set_of_closures) is provided (see above) which enables one closure within a set to be located given another closure in the same set. This avoids keeping a pointer to the whole set of closures alive when compiling, for example, mutually-recursive functions.

and function_declarations = private {
  1. is_classic_mode : bool;
    (*

    Indicates whether this function_declarations was compiled with -Oclassic.

    *)
  2. set_of_closures_id : Set_of_closures_id.t;
    (*

    An identifier (unique across all Flambda trees currently in memory) of the set of closures associated with this set of function declarations.

    *)
  3. set_of_closures_origin : Set_of_closures_origin.t;
    (*

    An identifier of the original set of closures on which this set of function declarations is based. Used to prevent different specialisations of the same functions from being inlined/specialised within each other.

    *)
  4. funs : function_declaration Variable.Map.t;
    (*

    The function(s) defined by the set of function declarations. The keys of this map are often referred to in the code as "fun_var"s.

    *)
}
and function_declaration = private {
  1. closure_origin : Closure_origin.t;
  2. params : Parameter.t list;
  3. body : t;
  4. free_variables : Variable.Set.t;
    (*

    All variables free in the *body* of the function. For example, a variable that is bound as one of the function's parameters will still be included in this set. This field is present as an optimization.

    *)
  5. free_symbols : Symbol.Set.t;
    (*

    All symbols that occur in the function's body. (Symbols can never be bound in a function's body; the only thing that binds symbols is the program constructions below.)

    *)
  6. stub : bool;
    (*

    A stub function is a generated function used to prepare arguments or return values to allow indirect calls to functions with a special calling convention. For instance indirect calls to tuplified functions must go through a stub. Stubs will be unconditionally inlined.

    *)
  7. dbg : Debuginfo.t;
    (*

    Debug info for the function declaration.

    *)
  8. inline : Lambda.inline_attribute;
    (*

    Inlining requirements from the source code.

    *)
  9. specialise : Lambda.specialise_attribute;
    (*

    Specialising requirements from the source code.

    *)
  10. is_a_functor : bool;
    (*

    Whether the function is known definitively to be a functor.

    *)
  11. poll : Lambda.poll_attribute;
    (*

    Behaviour for polls

    *)
}
and switch = {
  1. numconsts : Numbers.Int.Set.t;
    (*

    Integer cases

    *)
  2. consts : (int * t) list;
    (*

    Integer cases

    *)
  3. numblocks : Numbers.Int.Set.t;
    (*

    Number of tag block cases

    *)
  4. blocks : (int * t) list;
    (*

    Tag block cases

    *)
  5. failaction : t option;
    (*

    Action to take if none matched

    *)
}

Equivalent to the similar type in Lambda.

and for_loop = {
  1. bound_var : Variable.t;
  2. from_value : Variable.t;
  3. to_value : Variable.t;
  4. direction : Asttypes.direction_flag;
  5. body : t;
}

Equivalent to the similar type in Lambda.

and constant_defining_value =
  1. | Allocated_const of Allocated_const.t
    (*

    A single constant. These are never "simple constants" (type const) but instead more complicated constructions.

    *)
  2. | Block of Tag.t * constant_defining_value_block_field list
    (*

    A pre-allocated block full of constants (either simple constants or references to other constants, see below).

    *)
  3. | Set_of_closures of set_of_closures
    (*

    A closed (and thus constant) set of closures. (That is to say, free_vars must be empty.)

    *)
  4. | Project_closure of Symbol.t * Closure_id.t
    (*

    Selection of one closure from a constant set of closures. Analogous to the equivalent operation on expressions.

    *)

Like a subset of Flambda.named, except that instead of Variable.ts we have Symbol.ts, and everything is a constant (i.e. with a fixed value known at compile time). Values of this type describe constants that will be directly assigned to symbols in the object file (see below).

and constant_defining_value_block_field =
  1. | Symbol of Symbol.t
  2. | Const of const
type expr = t
type program_body =
  1. | Let_symbol of Symbol.t * constant_defining_value * program_body
    (*

    Define the given symbol to have the given constant value.

    *)
  2. | Let_rec_symbol of (Symbol.t * constant_defining_value) list * program_body
    (*

    As for Let_symbol, but recursive. This is needed to treat examples like this, where a constant set of closures is lifted to toplevel:

    let rec f x = f x

    After lifting this produces (in pseudo-Flambda):

    Let_rec_symbol set_of_closures_symbol = (Set_of_closures f x -> + let applied_function = Symbol f_closure in + Apply (applied_function, x) ) and f_closure = Project_closure (set_of_closures_symbol, f)

    Use of Let_rec_symbol, by virtue of the special handling in Inline_and_simplify.define_let_rec_symbol_approx, enables the approximation of the set of closures to be present in order to correctly simplify the Project_closure construction. (See Inline_and_simplify.simplify_project_closure for that part.)

    *)
  3. | Initialize_symbol of Symbol.t * Tag.t * t list * program_body
    (*

    Define the given symbol as a constant block of the given size and tag; but with a possibly non-constant initializer. The initializer will be executed at most once (from the entry point of the compilation unit).

    *)
  4. | Effect of t * program_body
    (*

    Cause the given expression, which may have a side effect, to be executed. The resulting value is discarded. Effect constructions are never re-ordered.

    *)
  5. | End of Symbol.t
    (*

    End accepts the root symbol: the only symbol that can never be eliminated.

    *)

A "program" is the contents of one compilation unit. It describes the various values that are assigned to symbols (and in some cases fields of such symbols) in the object file. As such, it is closely related to the compilation of toplevel modules.

type program = {
  1. imported_symbols : Symbol.Set.t;
  2. program_body : program_body;
}
val free_variables : + ?ignore_uses_as_callee:unit -> + ?ignore_uses_as_argument:unit -> + ?ignore_uses_in_project_var:unit -> + t -> + Variable.Set.t

Compute the free variables of a term. (This is O(1) for Lets). If ignore_uses_as_callee, all free variables inside Apply expressions are ignored. Likewise ignore_uses_in_project_var for Project_var expressions.

val free_variables_named : + ?ignore_uses_in_project_var:unit -> + named -> + Variable.Set.t

Compute the free variables of a named expression.

val used_variables : + ?ignore_uses_as_callee:unit -> + ?ignore_uses_as_argument:unit -> + ?ignore_uses_in_project_var:unit -> + t -> + Variable.Set.t

Compute _all_ variables occurring inside an expression.

val used_variables_named : + ?ignore_uses_in_project_var:unit -> + named -> + Variable.Set.t

Compute _all_ variables occurring inside a named expression.

val free_symbols : expr -> Symbol.Set.t
val free_symbols_named : named -> Symbol.Set.t
val free_symbols_program : program -> Symbol.Set.t
val fold_lets_option : + t -> + init:'a -> + for_defining_expr:('a -> Variable.t -> named -> 'a * Variable.t * named) -> + for_last_body:('a -> t -> t * 'b) -> + filter_defining_expr: + ('b -> + Variable.t -> + named -> + Variable.Set.t -> + 'b * Variable.t * named option) -> + t * 'b

Used to avoid exceeding the stack limit when handling expressions with multiple consecutive nested Let-expressions. This saves rewriting large simplification functions in CPS. This function provides for the rewriting or elimination of expressions during the fold.

val map_lets : + t -> + for_defining_expr:(Variable.t -> named -> named) -> + for_last_body:(t -> t) -> + after_rebuild:(t -> t) -> + t

Like fold_lets_option, but just a map.

val iter_lets : + t -> + for_defining_expr:(Variable.t -> named -> unit) -> + for_last_body:(t -> unit) -> + for_each_let:(t -> unit) -> + unit

Like map_lets, but just an iterator.

val create_let : Variable.t -> named -> t -> t

Creates a Let expression. (This computes the free variables of the defining expression and the body.)

val map_defining_expr_of_let : let_expr -> f:(named -> named) -> t

Apply the specified function f to the defining expression of the given Let-expression, returning a new Let.

module With_free_variables : sig ... end

A module for the manipulation of terms where the recomputation of free variable sets is to be kept to a minimum.

val create_function_declaration : + params:Parameter.t list -> + body:t -> + stub:bool -> + dbg:Debuginfo.t -> + inline:Lambda.inline_attribute -> + specialise:Lambda.specialise_attribute -> + is_a_functor:bool -> + closure_origin:Closure_origin.t -> + poll:Lambda.poll_attribute -> + function_declaration

Create a function declaration. This calculates the free variables and symbols occurring in the specified body.

val update_function_declaration : + function_declaration -> + params:Parameter.t list -> + body:t -> + function_declaration

Create a function declaration based on another function declaration

val create_function_declarations : + is_classic_mode:bool -> + funs:function_declaration Variable.Map.t -> + function_declarations

Create a set of function declarations given the individual declarations.

val create_function_declarations_with_origin : + is_classic_mode:bool -> + funs:function_declaration Variable.Map.t -> + set_of_closures_origin:Set_of_closures_origin.t -> + function_declarations

Create a set of function declarations with a given set of closures origin.

val update_body_of_function_declaration : + function_declaration -> + body:expr -> + function_declaration

Change only the code of a function declaration.

val update_function_decl's_params_and_body : + function_declaration -> + params:Parameter.t list -> + body:expr -> + function_declaration

Change only the code and parameters of a function declaration.

val update_function_declarations : + function_declarations -> + funs:function_declaration Variable.Map.t -> + function_declarations

Create a set of function declarations based on another set of function declarations.

val create_function_declarations_with_closures_origin : + is_classic_mode:bool -> + funs:function_declaration Variable.Map.t -> + set_of_closures_origin:Set_of_closures_origin.t -> + function_declarations
val create_set_of_closures : + function_decls:function_declarations -> + free_vars:specialised_to Variable.Map.t -> + specialised_args:specialised_to Variable.Map.t -> + direct_call_surrogates:Variable.t Variable.Map.t -> + set_of_closures

Create a set of closures. Checks are made to ensure that free_vars and specialised_args are reasonable.

Given a function declaration, find which of its parameters (if any) are used in the body.

type maybe_named =
  1. | Is_expr of t
  2. | Is_named of named
val iter_general : + toplevel:bool -> + (t -> unit) -> + (named -> unit) -> + maybe_named -> + unit

This function is designed for the internal use of Flambda_iterators. See that module for iterators to be used over Flambda terms.

val print : Stdlib.Format.formatter -> t -> unit
val print_named : Stdlib.Format.formatter -> named -> unit
val print_program : Stdlib.Format.formatter -> program -> unit
val print_const : Stdlib.Format.formatter -> const -> unit
val print_constant_defining_value : + Stdlib.Format.formatter -> + constant_defining_value -> + unit
val print_function_declaration : + Stdlib.Format.formatter -> + (Variable.t * function_declaration) -> + unit
val print_function_declarations : + Stdlib.Format.formatter -> + function_declarations -> + unit
val print_project_closure : Stdlib.Format.formatter -> project_closure -> unit
val print_move_within_set_of_closures : + Stdlib.Format.formatter -> + move_within_set_of_closures -> + unit
val print_project_var : Stdlib.Format.formatter -> project_var -> unit
val print_set_of_closures : Stdlib.Format.formatter -> set_of_closures -> unit
val print_specialised_to : Stdlib.Format.formatter -> specialised_to -> unit
val equal_call_kind : call_kind -> call_kind -> bool
val equal_specialised_to : specialised_to -> specialised_to -> bool
val compare_const : const -> const -> int
val compare_project_var : project_var -> project_var -> int
val compare_move_within_set_of_closures : + move_within_set_of_closures -> + move_within_set_of_closures -> + int
val compare_project_closure : project_closure -> project_closure -> int
diff --git a/ocaml/Flambda_invariants/index.html b/ocaml/Flambda_invariants/index.html new file mode 100644 index 00000000..00a67d0c --- /dev/null +++ b/ocaml/Flambda_invariants/index.html @@ -0,0 +1,2 @@ + +Flambda_invariants (ocaml.Flambda_invariants)

Module Flambda_invariants

type flambda_kind =
  1. | Normal
  2. | Lifted
val check_exn : ?kind:flambda_kind -> Flambda.program -> unit

Checking of invariants on Flambda expressions. Raises an exception if a check fails.

diff --git a/ocaml/Flambda_iterators/index.html b/ocaml/Flambda_iterators/index.html new file mode 100644 index 00000000..18eb3713 --- /dev/null +++ b/ocaml/Flambda_iterators/index.html @@ -0,0 +1,95 @@ + +Flambda_iterators (ocaml.Flambda_iterators)

Module Flambda_iterators

val apply_on_subexpressions : + (Flambda.t -> unit) -> + (Flambda.named -> unit) -> + Flambda.t -> + unit

Apply the given functions to the immediate subexpressions of the given Flambda expression. For avoidance of doubt, if a subexpression is Expr, it is passed to the function taking Flambda.named, rather than being followed and passed to the function taking Flambda.t.

val map_subexpressions : + (Flambda.t -> Flambda.t) -> + (Variable.t -> Flambda.named -> Flambda.named) -> + Flambda.t -> + Flambda.t
val iter : (Flambda.t -> unit) -> (Flambda.named -> unit) -> Flambda.t -> unit
val iter_expr : (Flambda.t -> unit) -> Flambda.t -> unit
val iter_on_named : + (Flambda.t -> unit) -> + (Flambda.named -> unit) -> + Flambda.named -> + unit
val iter_named : (Flambda.named -> unit) -> Flambda.t -> unit
val iter_named_on_named : (Flambda.named -> unit) -> Flambda.named -> unit
val iter_toplevel : + (Flambda.t -> unit) -> + (Flambda.named -> unit) -> + Flambda.t -> + unit

iter_toplevel f t applies f on every toplevel subexpression of t. In particular, it never applies f to the body of a function (which will always be contained within an Set_of_closures expression).

val iter_named_toplevel : + (Flambda.t -> unit) -> + (Flambda.named -> unit) -> + Flambda.named -> + unit
val iter_on_sets_of_closures : + (Flambda.set_of_closures -> unit) -> + Flambda.t -> + unit
val iter_on_set_of_closures_of_program : + Flambda.program -> + f:(constant:bool -> Flambda.set_of_closures -> unit) -> + unit
val iter_all_immutable_let_and_let_rec_bindings : + Flambda.t -> + f:(Variable.t -> Flambda.named -> unit) -> + unit
val iter_all_toplevel_immutable_let_and_let_rec_bindings : + Flambda.t -> + f:(Variable.t -> Flambda.named -> unit) -> + unit
val iter_exprs_at_toplevel_of_program : + Flambda.program -> + f:(Flambda.t -> unit) -> + unit
val iter_named_of_program : + Flambda.program -> + f:(Flambda.named -> unit) -> + unit
val iter_constant_defining_values_on_program : + Flambda.program -> + f:(Flambda.constant_defining_value -> unit) -> + unit
val iter_apply_on_program : + Flambda.program -> + f:(Flambda.apply -> unit) -> + unit
val map : + (Flambda.t -> Flambda.t) -> + (Flambda.named -> Flambda.named) -> + Flambda.t -> + Flambda.t
val map_expr : (Flambda.t -> Flambda.t) -> Flambda.t -> Flambda.t
val map_named : (Flambda.named -> Flambda.named) -> Flambda.t -> Flambda.t
val map_toplevel : + (Flambda.t -> Flambda.t) -> + (Flambda.named -> Flambda.named) -> + Flambda.t -> + Flambda.t
val map_toplevel_expr : (Flambda.t -> Flambda.t) -> Flambda.t -> Flambda.t
val map_toplevel_named : + (Flambda.named -> Flambda.named) -> + Flambda.t -> + Flambda.t
val map_symbols : Flambda.t -> f:(Symbol.t -> Symbol.t) -> Flambda.t
val map_symbols_on_set_of_closures : + Flambda.set_of_closures -> + f:(Symbol.t -> Symbol.t) -> + Flambda.set_of_closures
val map_toplevel_sets_of_closures : + Flambda.t -> + f:(Flambda.set_of_closures -> Flambda.set_of_closures) -> + Flambda.t
val map_apply : Flambda.t -> f:(Flambda.apply -> Flambda.apply) -> Flambda.t
val map_function_bodies : + Flambda.set_of_closures -> + f:(Flambda.t -> Flambda.t) -> + Flambda.set_of_closures
val map_sets_of_closures : + Flambda.t -> + f:(Flambda.set_of_closures -> Flambda.set_of_closures) -> + Flambda.t
val map_sets_of_closures_of_program : + Flambda.program -> + f:(Flambda.set_of_closures -> Flambda.set_of_closures) -> + Flambda.program
val map_project_var_to_expr_opt : + Flambda.t -> + f:(Flambda.project_var -> Flambda.t option) -> + Flambda.t
val map_project_var_to_named_opt : + Flambda.t -> + f:(Flambda.project_var -> Flambda.named option) -> + Flambda.t
val map_exprs_at_toplevel_of_program : + Flambda.program -> + f:(Flambda.t -> Flambda.t) -> + Flambda.program
val map_named_of_program : + Flambda.program -> + f:(Variable.t -> Flambda.named -> Flambda.named) -> + Flambda.program
val map_all_immutable_let_and_let_rec_bindings : + Flambda.t -> + f:(Variable.t -> Flambda.named -> Flambda.named) -> + Flambda.t
val fold_function_decls_ignoring_stubs : + Flambda.set_of_closures -> + init:'a -> + f: + (fun_var:Variable.t -> + function_decl:Flambda.function_declaration -> + 'a -> + 'a) -> + 'a
diff --git a/ocaml/Flambda_middle_end/index.html b/ocaml/Flambda_middle_end/index.html new file mode 100644 index 00000000..935841c5 --- /dev/null +++ b/ocaml/Flambda_middle_end/index.html @@ -0,0 +1,7 @@ + +Flambda_middle_end (ocaml.Flambda_middle_end)

Module Flambda_middle_end

Translate Lambda code to Flambda code, optimize it, and produce Clambda.

val lambda_to_clambda : + backend:(module Backend_intf.S) -> + prefixname:string -> + ppf_dump:Stdlib.Format.formatter -> + Lambda.program -> + Clambda.with_constants
diff --git a/ocaml/Flambda_to_clambda/index.html b/ocaml/Flambda_to_clambda/index.html new file mode 100644 index 00000000..f6572571 --- /dev/null +++ b/ocaml/Flambda_to_clambda/index.html @@ -0,0 +1,5 @@ + +Flambda_to_clambda (ocaml.Flambda_to_clambda)

Module Flambda_to_clambda

type result = {
  1. expr : Clambda.ulambda;
  2. preallocated_blocks : Clambda.preallocated_block list;
  3. structured_constants : Clambda.ustructured_constant Symbol.Map.t;
  4. exported : Export_info.t;
}

Convert an Flambda program, with associated proto-export information, to Clambda. This yields a Clambda expression together with augmented export information and details about required statically-allocated values (preallocated blocks, for Initialize_symbol, and structured constants).

It is during this process that accesses to variables within closures are transformed to field accesses within closure values. For direct calls, the hidden closure parameter is added. Switch tables are also built.

diff --git a/ocaml/Flambda_utils/Switch_storer/index.html b/ocaml/Flambda_utils/Switch_storer/index.html new file mode 100644 index 00000000..163d8d87 --- /dev/null +++ b/ocaml/Flambda_utils/Switch_storer/index.html @@ -0,0 +1,2 @@ + +Switch_storer (ocaml.Flambda_utils.Switch_storer)

Module Flambda_utils.Switch_storer

For the compilation of switch statements.

val mk_store : unit -> (Flambda.t, unit) Switch.t_store
diff --git a/ocaml/Flambda_utils/index.html b/ocaml/Flambda_utils/index.html new file mode 100644 index 00000000..70e46a30 --- /dev/null +++ b/ocaml/Flambda_utils/index.html @@ -0,0 +1,53 @@ + +Flambda_utils (ocaml.Flambda_utils)

Module Flambda_utils

Utility functions for the Flambda intermediate language.

Access functions

find_declaration f decl raises Not_found if f is not in decl.

val find_declaration_variable : + Closure_id.t -> + Flambda.function_declarations -> + Variable.t

find_declaration_variable f decl raises Not_found if f is not in decl.

val find_free_variable : + Var_within_closure.t -> + Flambda.set_of_closures -> + Variable.t

find_free_variable v clos raises Not_found if c is not in clos.

Utility functions

val function_arity : Flambda.function_declaration -> int
val variables_bound_by_the_closure : + Closure_id.t -> + Flambda.function_declarations -> + Variable.Set.t

Variables "bound by a closure" are those variables free in the corresponding function's body that are neither:

  • bound as parameters of that function; nor
  • bound by the let binding that introduces the function declaration(s). In particular, if f, g and h are being introduced by a simultaneous, possibly mutually-recursive let binding then none of f, g or h are bound in any of the closures for f, g and h.
val can_be_merged : Flambda.t -> Flambda.t -> bool

If can_be_merged f1 f2 is true, it is safe to merge switch branches containing f1 and f2.

val description_of_toplevel_node : Flambda.t -> string
val make_closure_declaration : + is_classic_mode:bool -> + id:Variable.t -> + body:Flambda.t -> + params:Parameter.t list -> + Flambda.t
val toplevel_substitution : + Variable.t Variable.Map.t -> + Flambda.expr -> + Flambda.expr
val toplevel_substitution_named : + Variable.t Variable.Map.t -> + Flambda.named -> + Flambda.named
val bind : + bindings:(Variable.t * Flambda.named) list -> + body:Flambda.t -> + Flambda.t

bind [var1, expr1; ...; varN, exprN] body binds using Immutable Let expressions the given (var, expr) pairs around the body.

val name_expr_from_var : var:Variable.t -> Flambda.named -> Flambda.t
val initialize_symbols : + Flambda.program -> + (Symbol.t * Tag.t * Flambda.t list) list
val imported_symbols : Flambda.program -> Symbol.Set.t
val needed_import_symbols : Flambda.program -> Symbol.Set.t
val introduce_needed_import_symbols : Flambda.program -> Flambda.program
val root_symbol : Flambda.program -> Symbol.t
val might_raise_static_exn : Flambda.named -> Static_exception.t -> bool

Returns true iff the given term might raise the given static exception.

Creates a map from closure IDs to set_of_closure IDs by iterating over all sets of closures in the given program.

val all_lifted_constants : + Flambda.program -> + (Symbol.t * Flambda.constant_defining_value) list

The definitions of all constants that have been lifted out to Let_symbol or Let_rec_symbol constructions.

val all_lifted_constants_as_map : + Flambda.program -> + Flambda.constant_defining_value Symbol.Map.t

Like all_lifted_constant_symbols, but returns a map instead of a list.

val all_lifted_constant_sets_of_closures : + Flambda.program -> + Set_of_closures_id.Set.t

The identifiers of all constant sets of closures that have been lifted out to Let_symbol or Let_rec_symbol constructions.

val all_lifted_constant_closures : Flambda.program -> Closure_id.Set.t
val all_sets_of_closures : Flambda.program -> Flambda.set_of_closures list

All sets of closures in the given program (whether or not bound to a symbol.)

val substitute_read_symbol_field_for_variables : + (Symbol.t * int list) Variable.Map.t -> + Flambda.t -> + Flambda.t
module Switch_storer : sig ... end

For the compilation of switch statements.

val fun_vars_referenced_in_decls : + Flambda.function_declarations -> + closure_symbol:(Closure_id.t -> Symbol.t) -> + Variable.Set.t Variable.Map.t

Within a set of function declarations there is a set of function bodies, each of which may (or may not) reference one of the other functions in the same set. Initially such intra-set references are by Vars (known as "fun_var"s) but if the function is lifted by Lift_constants then the references will be translated to Symbols. This means that optimization passes that need to identify whether a given "fun_var" (i.e. a key in the funs map in a value of type function_declarations) is used in one of the function bodies need to examine the free_symbols as well as the free_variables members of function_declarations. This function makes that process easier by computing all used "fun_var"s in the bodies of the given set of function declarations, including the cases where the references are Symbols. The returned value is a map from "fun_var"s to the "fun_var"s (if any) used in the body of the function associated with that "fun_var".

val closures_required_by_entry_point : + entry_point:Closure_id.t -> + closure_symbol:(Closure_id.t -> Symbol.t) -> + Flambda.function_declarations -> + Variable.Set.t

Computes the set of closure_id in the set of closures that are required used (transitively) the entry_point

val all_functions_parameters : Flambda.function_declarations -> Variable.Set.t
val contains_stub : Flambda.function_declarations -> bool
val clean_projections : + which_variables:Flambda.specialised_to Variable.Map.t -> + Flambda.specialised_to Variable.Map.t
val projection_to_named : Projection.t -> Flambda.named
type specialised_to_same_as =
  1. | Not_specialised
  2. | Specialised_and_aliased_to of Variable.Set.t
val parameters_specialised_to_the_same_variable : + function_decls:Flambda.function_declarations -> + specialised_args:Flambda.specialised_to Variable.Map.t -> + specialised_to_same_as list Variable.Map.t

For each parameter in a given set of function declarations and the usual specialised-args mapping, determine which other parameters are specialised to the same variable as that parameter. The result is presented as a map from fun_vars to lists, corresponding componentwise to the usual params list in the corresponding function declaration.

diff --git a/ocaml/Freshening/Project_var/index.html b/ocaml/Freshening/Project_var/index.html new file mode 100644 index 00000000..00ea24b6 --- /dev/null +++ b/ocaml/Freshening/Project_var/index.html @@ -0,0 +1,9 @@ + +Project_var (ocaml.Freshening.Project_var)

Module Freshening.Project_var

type t

A table used for freshening of identifiers in Project_closure and Move_within_set_of_closures ("ids of closures"); and Project_var ("bound vars of closures") expressions.

This information is propagated bottom up and populated when inlining a function containing a closure declaration.

For instance, let f x = + let g y = ... x ... in + ... g.x ... (Project_var x) + ... g 1 ... (Apply (Project_closure g ...)) +

If f is inlined, g is renamed. The approximation of g will carry this table such that later the access to the field x of g and selection of g in the closure can be substituted.

val empty : t
val compose : earlier:t -> later:t -> t

Composition of two freshenings.

val apply_closure_id : t -> Closure_id.t -> Closure_id.t

Freshen a closure ID based on the given renaming. The same ID is returned if the renaming does not affect it. If dealing with approximations, you probably want to use Simple_value_approx.freshen_and_check_closure_id instead of this function.

val apply_var_within_closure : + t -> + Var_within_closure.t -> + Var_within_closure.t

Like apply_closure_id, but for variables within closures.

val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Freshening/index.html b/ocaml/Freshening/index.html new file mode 100644 index 00000000..2162cf70 --- /dev/null +++ b/ocaml/Freshening/index.html @@ -0,0 +1,22 @@ + +Freshening (ocaml.Freshening)

Module Freshening

Freshening of various identifiers.

type t

A table used for freshening variables and static exception identifiers.

type subst = t
val empty : t

The freshening that does nothing. This is the unique inactive freshening.

val is_empty : t -> bool
val activate : t -> t

Activate the freshening. Without activation, operations to request freshenings have no effect (cf. the documentation below for add_variable). As such, the inactive renaming is unique.

val empty_preserving_activation_state : t -> t

Given the inactive freshening, return the same; otherwise, return an empty active freshening.

val add_variable : t -> Variable.t -> Variable.t * t

add_variable t var If t is active: It returns a fresh variable new_var and adds var -> new_var to the freshening. If a renaming other_var -> var or symbol -> var was already present in t, it will also add other_var -> new_var and symbol -> new_var. If t is inactive, this is the identity.

val add_variables' : t -> Variable.t list -> Variable.t list * t

Like add_variable, but for multiple variables, each freshened separately.

val add_variables : t -> (Variable.t * 'a) list -> (Variable.t * 'a) list * t

Like add_variables', but passes through the second component of the input list unchanged.

val add_mutable_variable : t -> Mutable_variable.t -> Mutable_variable.t * t

Like add_variable, but for mutable variables.

val add_static_exception : t -> Static_exception.t -> Static_exception.t * t

As for add_variable, but for static exception identifiers.

val apply_variable : t -> Variable.t -> Variable.t

apply_variable t var applies the freshening t to var. If no renaming is specified in t for var it is returned unchanged.

val apply_mutable_variable : t -> Mutable_variable.t -> Mutable_variable.t

As for apply_variable, but for mutable variables.

val apply_static_exception : t -> Static_exception.t -> Static_exception.t

As for apply_variable, but for static exception identifiers.

val rewrite_recursive_calls_with_symbols : + t -> + Flambda.function_declarations -> + make_closure_symbol:(Closure_id.t -> Symbol.t) -> + Flambda.function_declarations

Replace recursive accesses to the closures in the set through Symbol by the corresponding Var. This is used to recover the recursive call when importing code from another compilation unit.

If the renaming is inactive, this is the identity.

module Project_var : sig ... end
val apply_function_decls_and_free_vars : + t -> + (Flambda.specialised_to * 'a) Variable.Map.t -> + Flambda.function_declarations -> + only_freshen_parameters:bool -> + (Flambda.specialised_to * 'a) Variable.Map.t + * Flambda.function_declarations + * t + * Project_var.t
val does_not_freshen : t -> Variable.t list -> bool
val print : Stdlib.Format.formatter -> t -> unit
val freshen_projection_relation : + Flambda.specialised_to Variable.Map.t -> + freshening:t -> + closure_freshening:Project_var.t -> + Flambda.specialised_to Variable.Map.t

N.B. This does not freshen the domain of the supplied map, only the range.

val freshen_projection_relation' : + (Flambda.specialised_to * 'a) Variable.Map.t -> + freshening:t -> + closure_freshening:Project_var.t -> + (Flambda.specialised_to * 'a) Variable.Map.t
diff --git a/ocaml/Genprintval/Make/argument-1-O/index.html b/ocaml/Genprintval/Make/argument-1-O/index.html new file mode 100644 index 00000000..80057275 --- /dev/null +++ b/ocaml/Genprintval/Make/argument-1-O/index.html @@ -0,0 +1,2 @@ + +O (ocaml.Genprintval.Make.O)

Parameter Make.O

type t
val repr : 'a -> t
val obj : t -> 'a
val is_block : t -> bool
val tag : t -> int
val size : t -> int
val field : t -> int -> t
val double_array_tag : int
val double_field : t -> int -> float
diff --git a/ocaml/Genprintval/Make/argument-2-_/index.html b/ocaml/Genprintval/Make/argument-2-_/index.html new file mode 100644 index 00000000..7b334ecb --- /dev/null +++ b/ocaml/Genprintval/Make/argument-2-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Genprintval.Make._)

Parameter Make._

type valu = O.t
val eval_address : Env.address -> valu
exception Error
val same_value : valu -> valu -> bool
diff --git a/ocaml/Genprintval/Make/index.html b/ocaml/Genprintval/Make/index.html new file mode 100644 index 00000000..4b55b64f --- /dev/null +++ b/ocaml/Genprintval/Make/index.html @@ -0,0 +1,23 @@ + +Make (ocaml.Genprintval.Make)

Module Genprintval.Make

Parameters

module O : OBJ
module _ : EVALPATH with type valu = O.t

Signature

type t = O.t
val install_printer : + Path.t -> + Types.type_expr -> + (Stdlib.Format.formatter -> t -> unit) -> + unit
val install_generic_printer : + Path.t -> + Path.t -> + (int -> + (int -> t -> Outcometree.out_value, t -> Outcometree.out_value) gen_printer) -> + unit
val install_generic_printer' : + Path.t -> + Path.t -> + (Stdlib.Format.formatter -> t -> unit, Stdlib.Format.formatter -> t -> unit) + gen_printer -> + unit

install_generic_printer' function_path constructor_path printer function_path is used to remove the printer.

val remove_printer : Path.t -> unit
val outval_of_untyped_exception : t -> Outcometree.out_value
val outval_of_value : + int -> + int -> + (int -> t -> Types.type_expr -> Outcometree.out_value option) -> + Env.t -> + t -> + Types.type_expr -> + Outcometree.out_value
diff --git a/ocaml/Genprintval/index.html b/ocaml/Genprintval/index.html new file mode 100644 index 00000000..aff3ea59 --- /dev/null +++ b/ocaml/Genprintval/index.html @@ -0,0 +1,2 @@ + +Genprintval (ocaml.Genprintval)

Module Genprintval

module type OBJ = sig ... end
module type EVALPATH = sig ... end
type ('a, 'b) gen_printer =
  1. | Zero of 'b
  2. | Succ of 'a -> ('a, 'b) gen_printer
module type S = sig ... end
module Make (O : OBJ) (_ : EVALPATH with type valu = O.t) : S with type t = O.t
diff --git a/ocaml/Genprintval/module-type-EVALPATH/index.html b/ocaml/Genprintval/module-type-EVALPATH/index.html new file mode 100644 index 00000000..a715e653 --- /dev/null +++ b/ocaml/Genprintval/module-type-EVALPATH/index.html @@ -0,0 +1,2 @@ + +EVALPATH (ocaml.Genprintval.EVALPATH)

Module type Genprintval.EVALPATH

type valu
val eval_address : Env.address -> valu
exception Error
val same_value : valu -> valu -> bool
diff --git a/ocaml/Genprintval/module-type-OBJ/index.html b/ocaml/Genprintval/module-type-OBJ/index.html new file mode 100644 index 00000000..80e39523 --- /dev/null +++ b/ocaml/Genprintval/module-type-OBJ/index.html @@ -0,0 +1,2 @@ + +OBJ (ocaml.Genprintval.OBJ)

Module type Genprintval.OBJ

type t
val repr : 'a -> t
val obj : t -> 'a
val is_block : t -> bool
val tag : t -> int
val size : t -> int
val field : t -> int -> t
val double_array_tag : int
val double_field : t -> int -> float
diff --git a/ocaml/Genprintval/module-type-S/index.html b/ocaml/Genprintval/module-type-S/index.html new file mode 100644 index 00000000..c2d0fb73 --- /dev/null +++ b/ocaml/Genprintval/module-type-S/index.html @@ -0,0 +1,23 @@ + +S (ocaml.Genprintval.S)

Module type Genprintval.S

type t
val install_printer : + Path.t -> + Types.type_expr -> + (Stdlib.Format.formatter -> t -> unit) -> + unit
val install_generic_printer : + Path.t -> + Path.t -> + (int -> + (int -> t -> Outcometree.out_value, t -> Outcometree.out_value) gen_printer) -> + unit
val install_generic_printer' : + Path.t -> + Path.t -> + (Stdlib.Format.formatter -> t -> unit, Stdlib.Format.formatter -> t -> unit) + gen_printer -> + unit

install_generic_printer' function_path constructor_path printer function_path is used to remove the printer.

val remove_printer : Path.t -> unit
val outval_of_untyped_exception : t -> Outcometree.out_value
val outval_of_value : + int -> + int -> + (int -> t -> Types.type_expr -> Outcometree.out_value option) -> + Env.t -> + t -> + Types.type_expr -> + Outcometree.out_value
diff --git a/ocaml/Id_types/Id/index.html b/ocaml/Id_types/Id/index.html new file mode 100644 index 00000000..4a598deb --- /dev/null +++ b/ocaml/Id_types/Id/index.html @@ -0,0 +1,2 @@ + +Id (ocaml.Id_types.Id)

Module Id_types.Id

Parameters

Signature

include BaseId
type t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val name : t -> string option
val to_string : t -> string
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val create : ?name:string -> unit -> t
diff --git a/ocaml/Id_types/UnitId/argument-1-_/index.html b/ocaml/Id_types/UnitId/argument-1-_/index.html new file mode 100644 index 00000000..b678fd59 --- /dev/null +++ b/ocaml/Id_types/UnitId/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Id_types.UnitId._)

Parameter UnitId._

include BaseId
type t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val name : t -> string option
val to_string : t -> string
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val create : ?name:string -> unit -> t
diff --git a/ocaml/Id_types/UnitId/argument-2-Compilation_unit/index.html b/ocaml/Id_types/UnitId/argument-2-Compilation_unit/index.html new file mode 100644 index 00000000..e98a3a2a --- /dev/null +++ b/ocaml/Id_types/UnitId/argument-2-Compilation_unit/index.html @@ -0,0 +1,2 @@ + +Compilation_unit (ocaml.Id_types.UnitId.Compilation_unit)

Parameter UnitId.Compilation_unit

type t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Id_types/UnitId/index.html b/ocaml/Id_types/UnitId/index.html new file mode 100644 index 00000000..3582d692 --- /dev/null +++ b/ocaml/Id_types/UnitId/index.html @@ -0,0 +1,2 @@ + +UnitId (ocaml.Id_types.UnitId)

Module Id_types.UnitId

Parameters

module _ : Id

Signature

include BaseId
type t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val name : t -> string option
val to_string : t -> string
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val create : ?name:string -> Compilation_unit.t -> t
val unit : t -> Compilation_unit.t
diff --git a/ocaml/Id_types/index.html b/ocaml/Id_types/index.html new file mode 100644 index 00000000..15adf12b --- /dev/null +++ b/ocaml/Id_types/index.html @@ -0,0 +1,5 @@ + +Id_types (ocaml.Id_types)

Module Id_types

module type BaseId = sig ... end

Generic identifier type

module type Id = sig ... end
module type UnitId = sig ... end

Fully qualified identifiers

module Id () : Id
diff --git a/ocaml/Id_types/module-type-BaseId/index.html b/ocaml/Id_types/module-type-BaseId/index.html new file mode 100644 index 00000000..5b40a31a --- /dev/null +++ b/ocaml/Id_types/module-type-BaseId/index.html @@ -0,0 +1,2 @@ + +BaseId (ocaml.Id_types.BaseId)

Module type Id_types.BaseId

Generic identifier type

type t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val name : t -> string option
val to_string : t -> string
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Id_types/module-type-Id/index.html b/ocaml/Id_types/module-type-Id/index.html new file mode 100644 index 00000000..f01683c8 --- /dev/null +++ b/ocaml/Id_types/module-type-Id/index.html @@ -0,0 +1,2 @@ + +Id (ocaml.Id_types.Id)

Module type Id_types.Id

include BaseId
type t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val name : t -> string option
val to_string : t -> string
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val create : ?name:string -> unit -> t
diff --git a/ocaml/Id_types/module-type-UnitId/Compilation_unit/index.html b/ocaml/Id_types/module-type-UnitId/Compilation_unit/index.html new file mode 100644 index 00000000..917df57a --- /dev/null +++ b/ocaml/Id_types/module-type-UnitId/Compilation_unit/index.html @@ -0,0 +1,2 @@ + +Compilation_unit (ocaml.Id_types.UnitId.Compilation_unit)

Module UnitId.Compilation_unit

type t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Id_types/module-type-UnitId/index.html b/ocaml/Id_types/module-type-UnitId/index.html new file mode 100644 index 00000000..22cd047b --- /dev/null +++ b/ocaml/Id_types/module-type-UnitId/index.html @@ -0,0 +1,2 @@ + +UnitId (ocaml.Id_types.UnitId)

Module type Id_types.UnitId

Fully qualified identifiers

include BaseId
type t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val name : t -> string option
val to_string : t -> string
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val create : ?name:string -> Compilation_unit.t -> t
val unit : t -> Compilation_unit.t
diff --git a/ocaml/Ident/Map/index.html b/ocaml/Ident/Map/index.html new file mode 100644 index 00000000..dbe760be --- /dev/null +++ b/ocaml/Ident/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Ident.Map)

Module Ident.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Ident/Set/index.html b/ocaml/Ident/Set/index.html new file mode 100644 index 00000000..5fc2bffc --- /dev/null +++ b/ocaml/Ident/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Ident.Set)

Module Ident.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Ident/T/index.html b/ocaml/Ident/T/index.html new file mode 100644 index 00000000..c8e5ca35 --- /dev/null +++ b/ocaml/Ident/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Ident.T)

Module Ident.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Ident/Tbl/index.html b/ocaml/Ident/Tbl/index.html new file mode 100644 index 00000000..5906c9e0 --- /dev/null +++ b/ocaml/Ident/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Ident.Tbl)

Module Ident.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Ident/index.html b/ocaml/Ident/index.html new file mode 100644 index 00000000..723d6989 --- /dev/null +++ b/ocaml/Ident/index.html @@ -0,0 +1,2 @@ + +Ident (ocaml.Ident)

Module Ident

type t
include Identifiable.S with type t := t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val print_with_scope : Stdlib.Format.formatter -> t -> unit

Same as print except that it will also add a "n" suffix if the scope of the argument is n.

val create_scoped : scope:int -> string -> t
val create_local : string -> t
val create_persistent : string -> t
val create_predef : string -> t
val rename : t -> t

Creates an identifier with the same name as the input, a fresh stamp, and no scope.

  • raises [Fatal_error]

    if called on a persistent / predef ident.

val name : t -> string
val unique_name : t -> string
val unique_toplevel_name : t -> string
val persistent : t -> bool
val same : t -> t -> bool

Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

val compare : t -> t -> int
val global : t -> bool
val is_predef : t -> bool
val scope : t -> int
val lowest_scope : int
val highest_scope : int
val reinit : unit -> unit
type 'a tbl

'a tbl represents association tables from identifiers to values of type 'a.

'a tbl plays the role of map, but bindings can be looked up from either the full Ident using find_same, or just its user-visible name using find_name. In general the two lookups may not return the same result, as an identifier may have been shadowed in the environment by a distinct identifier with the same name.

find_all returns the bindings for all idents of a given name, most recently introduced first.

In other words, 'a tbl corresponds to (Ident.t * 'a) list Map.Make(String) and the implementation is very close to that representation.

Note in particular that searching among idents of the same name takes linear time, and that add simply extends the list without checking for duplicates. So it is not a good idea to implement union by repeated add calls, which may result in many duplicated identifiers and poor find_same performance. It is even possible to build overly large same-name lists such that non-recursive functions like find_all or fold_all blow the stack.

You should probably use Map.Make(Ident) instead, unless you really need to query bindings by user-visible name, not just by unique identifiers.

val empty : 'a tbl
val add : t -> 'a -> 'a tbl -> 'a tbl
val find_same : t -> 'a tbl -> 'a
val find_name : string -> 'a tbl -> t * 'a
val find_all : string -> 'a tbl -> (t * 'a) list
val find_all_seq : string -> 'a tbl -> (t * 'a) Stdlib.Seq.t
val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
val iter : (t -> 'a -> unit) -> 'a tbl -> unit
val remove : t -> 'a tbl -> 'a tbl
val make_key_generator : unit -> t -> t
diff --git a/ocaml/Identifiable/Make/Map/index.html b/ocaml/Identifiable/Make/Map/index.html new file mode 100644 index 00000000..bb8502ab --- /dev/null +++ b/ocaml/Identifiable/Make/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Identifiable.Make.Map)

Module Make.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Identifiable/Make/Set/index.html b/ocaml/Identifiable/Make/Set/index.html new file mode 100644 index 00000000..8ce982e3 --- /dev/null +++ b/ocaml/Identifiable/Make/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Identifiable.Make.Set)

Module Make.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Identifiable/Make/T/index.html b/ocaml/Identifiable/Make/T/index.html new file mode 100644 index 00000000..91db79b1 --- /dev/null +++ b/ocaml/Identifiable/Make/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Identifiable.Make.T)

Module Make.T

type t = T.t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Identifiable/Make/Tbl/index.html b/ocaml/Identifiable/Make/Tbl/index.html new file mode 100644 index 00000000..f6ca4abf --- /dev/null +++ b/ocaml/Identifiable/Make/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Identifiable.Make.Tbl)

Module Make.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Identifiable/Make/argument-1-T/index.html b/ocaml/Identifiable/Make/argument-1-T/index.html new file mode 100644 index 00000000..12b69478 --- /dev/null +++ b/ocaml/Identifiable/Make/argument-1-T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Identifiable.Make.T)

Parameter Make.T

type t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Identifiable/Make/index.html b/ocaml/Identifiable/Make/index.html new file mode 100644 index 00000000..d0e03356 --- /dev/null +++ b/ocaml/Identifiable/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Identifiable.Make)

Module Identifiable.Make

Parameters

module T : Thing

Signature

module T : Thing with type t = T.t
include Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Set with module T := T
module Map : Map with module T := T
module Tbl : Tbl with module T := T
diff --git a/ocaml/Identifiable/Pair/argument-1-A/index.html b/ocaml/Identifiable/Pair/argument-1-A/index.html new file mode 100644 index 00000000..eabc0a67 --- /dev/null +++ b/ocaml/Identifiable/Pair/argument-1-A/index.html @@ -0,0 +1,2 @@ + +A (ocaml.Identifiable.Pair.A)

Parameter Pair.A

type t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Identifiable/Pair/argument-2-B/index.html b/ocaml/Identifiable/Pair/argument-2-B/index.html new file mode 100644 index 00000000..3ac70569 --- /dev/null +++ b/ocaml/Identifiable/Pair/argument-2-B/index.html @@ -0,0 +1,2 @@ + +B (ocaml.Identifiable.Pair.B)

Parameter Pair.B

type t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Identifiable/Pair/index.html b/ocaml/Identifiable/Pair/index.html new file mode 100644 index 00000000..d006f8f8 --- /dev/null +++ b/ocaml/Identifiable/Pair/index.html @@ -0,0 +1,2 @@ + +Pair (ocaml.Identifiable.Pair)

Module Identifiable.Pair

Parameters

module A : Thing
module B : Thing

Signature

type t = A.t * B.t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Identifiable/index.html b/ocaml/Identifiable/index.html new file mode 100644 index 00000000..4df3497f --- /dev/null +++ b/ocaml/Identifiable/index.html @@ -0,0 +1,2 @@ + +Identifiable (ocaml.Identifiable)

Module Identifiable

Uniform interface for common data structures over various things.

Warning: this module is unstable and part of compiler-libs.

module type Thing = sig ... end
module Pair (A : Thing) (B : Thing) : Thing with type t = A.t * B.t
module type Set = sig ... end
module type Map = sig ... end
module type Tbl = sig ... end
module type S = sig ... end
module Make (T : Thing) : S with type t := T.t
diff --git a/ocaml/Identifiable/module-type-Map/T/index.html b/ocaml/Identifiable/module-type-Map/T/index.html new file mode 100644 index 00000000..da1ddef0 --- /dev/null +++ b/ocaml/Identifiable/module-type-Map/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Identifiable.Map.T)

Module Map.T

type t

The type of the map keys.

val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Identifiable/module-type-Map/index.html b/ocaml/Identifiable/module-type-Map/index.html new file mode 100644 index 00000000..622629b7 --- /dev/null +++ b/ocaml/Identifiable/module-type-Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Identifiable.Map)

Module type Identifiable.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Identifiable/module-type-S/Map/index.html b/ocaml/Identifiable/module-type-S/Map/index.html new file mode 100644 index 00000000..2b6593f7 --- /dev/null +++ b/ocaml/Identifiable/module-type-S/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Identifiable.S.Map)

Module S.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Identifiable/module-type-S/Set/index.html b/ocaml/Identifiable/module-type-S/Set/index.html new file mode 100644 index 00000000..9fe2ac35 --- /dev/null +++ b/ocaml/Identifiable/module-type-S/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Identifiable.S.Set)

Module S.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Identifiable/module-type-S/T/index.html b/ocaml/Identifiable/module-type-S/T/index.html new file mode 100644 index 00000000..2b46db9f --- /dev/null +++ b/ocaml/Identifiable/module-type-S/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Identifiable.S.T)

Module S.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Identifiable/module-type-S/Tbl/index.html b/ocaml/Identifiable/module-type-S/Tbl/index.html new file mode 100644 index 00000000..f7196969 --- /dev/null +++ b/ocaml/Identifiable/module-type-S/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Identifiable.S.Tbl)

Module S.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Identifiable/module-type-S/index.html b/ocaml/Identifiable/module-type-S/index.html new file mode 100644 index 00000000..cc206bbf --- /dev/null +++ b/ocaml/Identifiable/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Identifiable.S)

Module type Identifiable.S

type t
module T : Thing with type t = t
include Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Set with module T := T
module Map : Map with module T := T
module Tbl : Tbl with module T := T
diff --git a/ocaml/Identifiable/module-type-Set/T/index.html b/ocaml/Identifiable/module-type-Set/T/index.html new file mode 100644 index 00000000..c4f09aae --- /dev/null +++ b/ocaml/Identifiable/module-type-Set/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Identifiable.Set.T)

Module Set.T

type t

The type of the set elements.

val compare : t -> t -> int

A total ordering function over the set elements. This is a two-argument function f such that f e1 e2 is zero if the elements e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Identifiable/module-type-Set/index.html b/ocaml/Identifiable/module-type-Set/index.html new file mode 100644 index 00000000..8e8561a1 --- /dev/null +++ b/ocaml/Identifiable/module-type-Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Identifiable.Set)

Module type Identifiable.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Identifiable/module-type-Tbl/T/index.html b/ocaml/Identifiable/module-type-Tbl/T/index.html new file mode 100644 index 00000000..fead34ab --- /dev/null +++ b/ocaml/Identifiable/module-type-Tbl/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Identifiable.Tbl.T)

Module Tbl.T

type t
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Identifiable/module-type-Tbl/index.html b/ocaml/Identifiable/module-type-Tbl/index.html new file mode 100644 index 00000000..c3c1f730 --- /dev/null +++ b/ocaml/Identifiable/module-type-Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Identifiable.Tbl)

Module type Identifiable.Tbl

module T : sig ... end
include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Identifiable/module-type-Thing/index.html b/ocaml/Identifiable/module-type-Thing/index.html new file mode 100644 index 00000000..4e5391e4 --- /dev/null +++ b/ocaml/Identifiable/module-type-Thing/index.html @@ -0,0 +1,2 @@ + +Thing (ocaml.Identifiable.Thing)

Module type Identifiable.Thing

type t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Import_approx/index.html b/ocaml/Import_approx/index.html new file mode 100644 index 00000000..0df4df9f --- /dev/null +++ b/ocaml/Import_approx/index.html @@ -0,0 +1,2 @@ + +Import_approx (ocaml.Import_approx)

Module Import_approx

Create simple value approximations from the export information in .cmx files.

Given an approximation description, load .cmx files (possibly more than one) until the description is fully resolved. If a necessary .cmx file cannot be found, "unresolved" will be returned.

val really_import_approx : Simple_value_approx.t -> Simple_value_approx.t

Maps the description of the given approximation through really_import.

val import_symbol : Symbol.t -> Simple_value_approx.t

Read and convert the approximation of a given symbol from the relevant .cmx file. Unlike the "really_" functions, this does not continue to load .cmx files until the approximation is fully resolved.

diff --git a/ocaml/Includeclass/index.html b/ocaml/Includeclass/index.html new file mode 100644 index 00000000..93e2ed6e --- /dev/null +++ b/ocaml/Includeclass/index.html @@ -0,0 +1,19 @@ + +Includeclass (ocaml.Includeclass)

Module Includeclass

val class_types : + Env.t -> + Types.class_type -> + Types.class_type -> + Ctype.class_match_failure list
val class_type_declarations : + loc:Location.t -> + Env.t -> + Types.class_type_declaration -> + Types.class_type_declaration -> + Ctype.class_match_failure list
val report_error : + Printtyp.type_or_scheme -> + Stdlib.Format.formatter -> + Ctype.class_match_failure list -> + unit
diff --git a/ocaml/Includecore/index.html b/ocaml/Includecore/index.html new file mode 100644 index 00000000..663b61fd --- /dev/null +++ b/ocaml/Includecore/index.html @@ -0,0 +1,51 @@ + +Includecore (ocaml.Includecore)

Module Includecore

type position = Errortrace.position =
  1. | First
  2. | Second
type primitive_mismatch =
  1. | Name
  2. | Arity
  3. | No_alloc of position
  4. | Native_name
  5. | Result_repr
  6. | Argument_repr of int
type value_mismatch =
  1. | Primitive_mismatch of primitive_mismatch
  2. | Not_a_primitive
  3. | Type of Errortrace.moregen_error
exception Dont_match of value_mismatch
type privacy_mismatch =
  1. | Private_type_abbreviation
  2. | Private_variant_type
  3. | Private_record_type
  4. | Private_extensible_variant
  5. | Private_row_type
type type_kind =
  1. | Kind_abstract
  2. | Kind_record
  3. | Kind_variant
  4. | Kind_open
type kind_mismatch = type_kind * type_kind
type label_mismatch =
  1. | Type of Errortrace.equality_error
  2. | Mutability of position
type record_change = + (Types.label_declaration as 'ld, 'ld, label_mismatch) + Diffing_with_keys.change
type record_mismatch =
  1. | Label_mismatch of record_change list
  2. | Unboxed_float_representation of position
type constructor_mismatch =
  1. | Type of Errortrace.equality_error
  2. | Arity
  3. | Inline_record of record_change list
  4. | Kind of position
  5. | Explicit_return_type of position
type extension_constructor_mismatch =
  1. | Constructor_privacy
  2. | Constructor_mismatch of Ident.t + * Types.extension_constructor + * Types.extension_constructor + * constructor_mismatch
type private_variant_mismatch =
  1. | Only_outer_closed
  2. | Missing of position * string
  3. | Presence of string
  4. | Incompatible_types_for of string
  5. | Types of Errortrace.equality_error
type private_object_mismatch =
  1. | Missing of string
  2. | Types of Errortrace.equality_error
type type_mismatch =
  1. | Arity
  2. | Privacy of privacy_mismatch
  3. | Kind of kind_mismatch
  4. | Constraint of Errortrace.equality_error
  5. | Manifest of Errortrace.equality_error
  6. | Private_variant of Types.type_expr * Types.type_expr * private_variant_mismatch
  7. | Private_object of Types.type_expr * Types.type_expr * private_object_mismatch
  8. | Variance
  9. | Record_mismatch of record_mismatch
  10. | Variant_mismatch of variant_change list
  11. | Unboxed_representation of position
  12. | Immediate of Type_immediacy.Violation.t
val value_descriptions : + loc:Location.t -> + Env.t -> + string -> + Types.value_description -> + Types.value_description -> + Typedtree.module_coercion
val type_declarations : + ?equality:bool -> + loc:Location.t -> + Env.t -> + mark:bool -> + string -> + Types.type_declaration -> + Path.t -> + Types.type_declaration -> + type_mismatch option
val extension_constructors : + loc:Location.t -> + Env.t -> + mark:bool -> + Ident.t -> + Types.extension_constructor -> + Types.extension_constructor -> + extension_constructor_mismatch option
val report_value_mismatch : + string -> + string -> + Env.t -> + Stdlib.Format.formatter -> + value_mismatch -> + unit
val report_type_mismatch : + string -> + string -> + string -> + Env.t -> + Stdlib.Format.formatter -> + type_mismatch -> + unit
val report_extension_constructor_mismatch : + string -> + string -> + string -> + Env.t -> + Stdlib.Format.formatter -> + extension_constructor_mismatch -> + unit
diff --git a/ocaml/Includemod/Error/index.html b/ocaml/Includemod/Error/index.html new file mode 100644 index 00000000..33ee9e07 --- /dev/null +++ b/ocaml/Includemod/Error/index.html @@ -0,0 +1,13 @@ + +Error (ocaml.Includemod.Error)

Module Includemod.Error

type ('elt, 'explanation) diff = {
  1. got : 'elt;
  2. expected : 'elt;
  3. symptom : 'explanation;
}
type 'elt core_diff = ('elt, unit) diff
type functor_arg_descr =
  1. | Anonymous
  2. | Named of Path.t
  3. | Unit
  4. | Empty_struct
    (*

    For backward compatibility's sake, an empty struct can be implicitly converted to an unit module.

    *)
type core_sigitem_symptom =
  1. | Value_descriptions of (Types.value_description, Includecore.value_mismatch) + diff
  2. | Type_declarations of (Types.type_declaration, Includecore.type_mismatch) diff
  3. | Extension_constructors of (Types.extension_constructor, + Includecore.extension_constructor_mismatch) + diff
  4. | Class_type_declarations of (Types.class_type_declaration, + Ctype.class_match_failure list) + diff
  5. | Class_declarations of (Types.class_declaration, Ctype.class_match_failure list) + diff
type core_module_type_symptom =
  1. | Not_an_alias
  2. | Not_an_identifier
  3. | Incompatible_aliases
  4. | Abstract_module_type
  5. | Unbound_module_path of Path.t
type module_type_symptom =
  1. | Mt_core of core_module_type_symptom
  2. | Signature of signature_symptom
  3. | Functor of functor_symptom
  4. | Invalid_module_alias of Path.t
  5. | After_alias_expansion of module_type_diff
and module_type_diff = (Types.module_type, module_type_symptom) diff
and functor_symptom =
  1. | Params of functor_params_diff
  2. | Result of module_type_diff
and ('arg, 'path) functor_param_symptom =
  1. | Incompatible_params of 'arg * Types.functor_parameter
  2. | Mismatch of module_type_diff
and arg_functor_param_symptom = + (Types.functor_parameter, Ident.t) functor_param_symptom
and functor_params_diff = + (Types.functor_parameter list * Types.module_type) core_diff
and signature_symptom = {
  1. env : Env.t;
  2. missings : Types.signature_item list;
  3. incompatibles : (Ident.t * sigitem_symptom) list;
  4. oks : (int * Typedtree.module_coercion) list;
  5. leftovers : (Types.signature_item as 'it * 'it * int) list;
    (*

    signature items that could not be compared due to type divergence

    *)
}
and sigitem_symptom =
  1. | Core of core_sigitem_symptom
  2. | Module_type_declaration of (Types.modtype_declaration, + module_type_declaration_symptom) + diff
  3. | Module_type of module_type_diff
and module_type_declaration_symptom =
  1. | Illegal_permutation of Typedtree.module_coercion
  2. | Not_greater_than of module_type_diff
  3. | Not_less_than of module_type_diff
  4. | Incomparable of {
    1. less_than : module_type_diff;
    2. greater_than : module_type_diff;
    }
type all =
  1. | In_Compilation_unit of (string, signature_symptom) diff
  2. | In_Signature of signature_symptom
  3. | In_Module_type of module_type_diff
  4. | In_Module_type_substitution of Ident.t + * (Types.module_type, module_type_declaration_symptom) diff
  5. | In_Type_declaration of Ident.t * core_sigitem_symptom
  6. | In_Expansion of core_module_type_symptom
diff --git a/ocaml/Includemod/FieldMap/index.html b/ocaml/Includemod/FieldMap/index.html new file mode 100644 index 00000000..4c188527 --- /dev/null +++ b/ocaml/Includemod/FieldMap/index.html @@ -0,0 +1,8 @@ + +FieldMap (ocaml.Includemod.FieldMap)

Module Includemod.FieldMap

Map indexed by both field types and names. This avoids name clashes between different sorts of fields such as values and types.

Maps

type key = field_desc

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Includemod/Functor_app_diff/Defs/index.html b/ocaml/Includemod/Functor_app_diff/Defs/index.html new file mode 100644 index 00000000..351f04dc --- /dev/null +++ b/ocaml/Includemod/Functor_app_diff/Defs/index.html @@ -0,0 +1,2 @@ + +Defs (ocaml.Includemod.Functor_app_diff.Defs)

Module Functor_app_diff.Defs

diff --git a/ocaml/Includemod/Functor_app_diff/index.html b/ocaml/Includemod/Functor_app_diff/index.html new file mode 100644 index 00000000..5d49024a --- /dev/null +++ b/ocaml/Includemod/Functor_app_diff/index.html @@ -0,0 +1,6 @@ + +Functor_app_diff (ocaml.Includemod.Functor_app_diff)

Module Includemod.Functor_app_diff

module Defs : sig ... end
diff --git a/ocaml/Includemod/Functor_inclusion_diff/Defs/index.html b/ocaml/Includemod/Functor_inclusion_diff/Defs/index.html new file mode 100644 index 00000000..130f038c --- /dev/null +++ b/ocaml/Includemod/Functor_inclusion_diff/Defs/index.html @@ -0,0 +1,2 @@ + +Defs (ocaml.Includemod.Functor_inclusion_diff.Defs)

Module Functor_inclusion_diff.Defs

diff --git a/ocaml/Includemod/Functor_inclusion_diff/index.html b/ocaml/Includemod/Functor_inclusion_diff/index.html new file mode 100644 index 00000000..3d4f6185 --- /dev/null +++ b/ocaml/Includemod/Functor_inclusion_diff/index.html @@ -0,0 +1,6 @@ + +Functor_inclusion_diff (ocaml.Includemod.Functor_inclusion_diff)

Module Includemod.Functor_inclusion_diff

diff --git a/ocaml/Includemod/index.html b/ocaml/Includemod/index.html new file mode 100644 index 00000000..8d240bc0 --- /dev/null +++ b/ocaml/Includemod/index.html @@ -0,0 +1,79 @@ + +Includemod (ocaml.Includemod)

Module Includemod

type mark =
  1. | Mark_both
    (*

    Mark definitions used from both arguments

    *)
  2. | Mark_positive
    (*

    Mark definitions used from the positive (first) argument

    *)
  3. | Mark_negative
    (*

    Mark definitions used from the negative (second) argument

    *)
  4. | Mark_neither
    (*

    Do not mark definitions used from either argument

    *)

Type describing which arguments of an inclusion to consider as used for the usage warnings. Mark_both is the default.

module Error : sig ... end
type explanation = Env.t * Error.all
type field_kind =
  1. | Field_value
  2. | Field_type
  3. | Field_exception
  4. | Field_typext
  5. | Field_module
  6. | Field_modtype
  7. | Field_class
  8. | Field_classtype
type field_desc = {
  1. name : string;
  2. kind : field_kind;
}
val kind_of_field_desc : field_desc -> string
val field_desc : field_kind -> Ident.t -> field_desc
module FieldMap : Map.S with type key = field_desc

Map indexed by both field types and names. This avoids name clashes between different sorts of fields such as values and types.

val item_ident_name : Types.signature_item -> Ident.t * Location.t * field_desc
val is_runtime_component : Types.signature_item -> bool
val modtypes : + loc:Location.t -> + Env.t -> + mark:mark -> + Types.module_type -> + Types.module_type -> + Typedtree.module_coercion
val modtypes_with_shape : + shape:Shape.t -> + loc:Location.t -> + Env.t -> + mark:mark -> + Types.module_type -> + Types.module_type -> + Typedtree.module_coercion * Shape.t
val strengthened_module_decl : + loc:Location.t -> + aliasable:bool -> + Env.t -> + mark:mark -> + Types.module_declaration -> + Path.t -> + Types.module_declaration -> + Typedtree.module_coercion
val check_modtype_inclusion : + loc:Location.t -> + Env.t -> + Types.module_type -> + Path.t -> + Types.module_type -> + explanation option

check_modtype_inclusion ~loc env mty1 path1 mty2 checks that the functor application F(M) is well typed, where mty2 is the type of the argument of F and path1/mty1 is the path/unstrenghened type of M.

val check_modtype_equiv : + loc:Location.t -> + Env.t -> + Ident.t -> + Types.module_type -> + Types.module_type -> + unit
val signatures : + Env.t -> + mark:mark -> + Types.signature -> + Types.signature -> + Typedtree.module_coercion
val compunit : + Env.t -> + mark:mark -> + string -> + Types.signature -> + string -> + Types.signature -> + Shape.t -> + Typedtree.module_coercion * Shape.t
val type_declarations : + loc:Location.t -> + Env.t -> + mark:mark -> + Ident.t -> + Types.type_declaration -> + Types.type_declaration -> + unit
val print_coercion : + Stdlib.Format.formatter -> + Typedtree.module_coercion -> + unit
type symptom =
  1. | Missing_field of Ident.t * Location.t * string
  2. | Value_descriptions of Ident.t + * Types.value_description + * Types.value_description + * Includecore.value_mismatch
  3. | Type_declarations of Ident.t + * Types.type_declaration + * Types.type_declaration + * Includecore.type_mismatch
  4. | Extension_constructors of Ident.t + * Types.extension_constructor + * Types.extension_constructor + * Includecore.extension_constructor_mismatch
  5. | Module_types of Types.module_type * Types.module_type
  6. | Modtype_infos of Ident.t + * Types.modtype_declaration + * Types.modtype_declaration
  7. | Modtype_permutation of Types.module_type * Typedtree.module_coercion
  8. | Interface_mismatch of string * string
  9. | Class_type_declarations of Ident.t + * Types.class_type_declaration + * Types.class_type_declaration + * Ctype.class_match_failure list
  10. | Class_declarations of Ident.t + * Types.class_declaration + * Types.class_declaration + * Ctype.class_match_failure list
  11. | Unbound_module_path of Path.t
  12. | Invalid_module_alias of Path.t
type pos =
  1. | Module of Ident.t
  2. | Modtype of Ident.t
  3. | Arg of Types.functor_parameter
  4. | Body of Types.functor_parameter
exception Error of explanation
exception Apply_error of {
  1. loc : Location.t;
  2. env : Env.t;
  3. lid_app : Longident.t option;
  4. mty_f : Types.module_type;
  5. args : (Error.functor_arg_descr * Types.module_type) list;
}
val expand_module_alias : + strengthen:bool -> + Env.t -> + Path.t -> + Types.module_type
module Functor_inclusion_diff : sig ... end
module Functor_app_diff : sig ... end
diff --git a/ocaml/Includemod_errorprinter/index.html b/ocaml/Includemod_errorprinter/index.html new file mode 100644 index 00000000..f1902006 --- /dev/null +++ b/ocaml/Includemod_errorprinter/index.html @@ -0,0 +1,2 @@ + +Includemod_errorprinter (ocaml.Includemod_errorprinter)

Module Includemod_errorprinter

val register : unit -> unit
diff --git a/ocaml/Inconstant_idents/index.html b/ocaml/Inconstant_idents/index.html new file mode 100644 index 00000000..e9a03494 --- /dev/null +++ b/ocaml/Inconstant_idents/index.html @@ -0,0 +1,6 @@ + +Inconstant_idents (ocaml.Inconstant_idents)

Module Inconstant_idents

type result
val inconstants_on_program : + compilation_unit:Compilation_unit.t -> + backend:(module Backend_intf.S) -> + Flambda.program -> + result

inconstants_on_program finds those variables and set-of-closures identifiers that cannot be compiled to constants by Flambda_to_clambda.

val variable : Variable.t -> result -> bool

variable var res returns true if var is marked as inconstant in res.

val closure : Set_of_closures_id.t -> result -> bool

closure cl res returns true if cl is marked as inconstant in res.

diff --git a/ocaml/Initialize_symbol_to_let_symbol/index.html b/ocaml/Initialize_symbol_to_let_symbol/index.html new file mode 100644 index 00000000..1ebe43c5 --- /dev/null +++ b/ocaml/Initialize_symbol_to_let_symbol/index.html @@ -0,0 +1,4 @@ + +Initialize_symbol_to_let_symbol (ocaml.Initialize_symbol_to_let_symbol)

Module Initialize_symbol_to_let_symbol

val constant_field : + Flambda.t -> + Flambda.constant_defining_value_block_field option

Transform Initialize_symbol with only constant fields to let_symbol construction.

diff --git a/ocaml/Inline_and_simplify/index.html b/ocaml/Inline_and_simplify/index.html new file mode 100644 index 00000000..ebfab10a --- /dev/null +++ b/ocaml/Inline_and_simplify/index.html @@ -0,0 +1,14 @@ + +Inline_and_simplify (ocaml.Inline_and_simplify)

Module Inline_and_simplify

val run : + never_inline:bool -> + backend:(module Backend_intf.S) -> + prefixname:string -> + round:int -> + ppf_dump:Stdlib.Format.formatter -> + Flambda.program -> + Flambda.program

Simplification of Flambda programs combined with function inlining: for the most part a beta-reduction pass.

Readers interested in the inlining strategy should read the Inlining_decision module first.

val duplicate_function : + env:Inline_and_simplify_aux.Env.t -> + set_of_closures:Flambda.set_of_closures -> + fun_var:Variable.t -> + new_fun_var:Variable.t -> + Flambda.function_declaration * Flambda.specialised_to Variable.Map.t
diff --git a/ocaml/Inline_and_simplify_aux/Env/index.html b/ocaml/Inline_and_simplify_aux/Env/index.html new file mode 100644 index 00000000..d8d7da67 --- /dev/null +++ b/ocaml/Inline_and_simplify_aux/Env/index.html @@ -0,0 +1,17 @@ + +Env (ocaml.Inline_and_simplify_aux.Env)

Module Inline_and_simplify_aux.Env

type t

Environments follow the lexical scopes of the program.

val create : + never_inline:bool -> + backend:(module Backend_intf.S) -> + round:int -> + ppf_dump:Stdlib.Format.formatter -> + t

Create a new environment. If never_inline is true then the returned environment will prevent Inline_and_simplify from inlining. The backend parameter is used for passing information about the compiler backend being used. Newly-created environments have inactive Freshenings (see below) and do not initially hold any approximation information.

val backend : t -> (module Backend_intf.S)

Obtain the first-class module that gives information about the compiler backend being used for compilation.

val really_import_approx : t -> Simple_value_approx.t -> Simple_value_approx.t

Obtain the really_import_approx function from the backend module.

val round : t -> int

Which simplification round we are currently in.

val ppf_dump : t -> Stdlib.Format.formatter

Where to print intermediate asts and similar debug information

val add : t -> Variable.t -> Simple_value_approx.t -> t

Add the approximation of a variable---that is to say, some knowledge about the value(s) the variable may take on at runtime---to the environment.

val add_outer_scope : t -> Variable.t -> Simple_value_approx.t -> t
val add_mutable : t -> Mutable_variable.t -> Simple_value_approx.t -> t

Like add, but for mutable variables.

val find_exn : t -> Variable.t -> Simple_value_approx.t

Find the approximation of a given variable, raising a fatal error if the environment does not know about the variable. Use find_opt instead if you need to catch the failure case.

val find_mutable_exn : t -> Mutable_variable.t -> Simple_value_approx.t

Like find_exn, but for mutable variables.

type scope =
  1. | Current
  2. | Outer
val find_with_scope_exn : t -> Variable.t -> scope * Simple_value_approx.t
val find_opt : t -> Variable.t -> Simple_value_approx.t option

Like find_exn, but intended for use where the "not present in environment" case is to be handled by the caller.

val find_list_exn : t -> Variable.t list -> Simple_value_approx.t list

Like find_exn, but for a list of variables.

val does_not_bind : t -> Variable.t list -> bool
val does_not_freshen : t -> Variable.t list -> bool
val add_symbol : t -> Symbol.t -> Simple_value_approx.t -> t
val redefine_symbol : t -> Symbol.t -> Simple_value_approx.t -> t
val find_symbol_exn : t -> Symbol.t -> Simple_value_approx.t
val find_symbol_opt : t -> Symbol.t -> Simple_value_approx.t option
val find_symbol_fatal : t -> Symbol.t -> Simple_value_approx.t
val find_or_load_symbol : t -> Symbol.t -> Simple_value_approx.t
val add_projection : t -> projection:Projection.t -> bound_to:Variable.t -> t

Note that the given bound_to holds the given projection.

val find_projection : t -> projection:Projection.t -> Variable.t option

Determine if the environment knows about a variable that is bound to the given projection.

val mem : t -> Variable.t -> bool

Whether the environment has an approximation for the given variable.

val freshening : t -> Freshening.t

Return the freshening that should be applied to variables when rewriting code (in Inline_and_simplify, etc.) using the given environment.

val set_freshening : t -> Freshening.t -> t

Set the freshening that should be used as per freshening, above.

val activate_freshening : t -> t

Causes every bound variable in code rewritten during inlining and simplification, using the given environment, to be freshened. This is used when descending into subexpressions substituted into existing expressions.

val local : t -> t

Erase all variable approximation information and freshening information from the given environment. However, the freshening activation state is preserved. This function is used when rewriting inside a function declaration, to avoid (due to a compiler bug) accidental use of variables from outer scopes that are not accessible.

val inside_set_of_closures_declaration : Set_of_closures_origin.t -> t -> bool

Determine whether the inliner is currently inside a function body from the given set of closures. This is used to detect whether a given function call refers to a function which exists somewhere on the current inlining stack.

val at_toplevel : t -> bool

Not inside a closure declaration. Toplevel code is the one evaluated when the compilation unit is loaded

val is_inside_branch : t -> bool
val branch_depth : t -> int
val inside_branch : t -> t
val increase_closure_depth : t -> t
val set_never_inline : t -> t

Mark that call sites contained within code rewritten using the given environment should never be replaced by inlined (or unrolled) versions of the callee(s).

val set_never_inline_inside_closures : t -> t

Equivalent to set_never_inline but only applies to code inside a set of closures.

val unset_never_inline_inside_closures : t -> t

Unset the restriction from set_never_inline_inside_closures

val set_never_inline_outside_closures : t -> t

Equivalent to set_never_inline but does not apply to code inside a set of closures.

val unset_never_inline_outside_closures : t -> t

Unset the restriction from set_never_inline_outside_closures

val never_inline : t -> bool

Return whether set_never_inline is currently in effect on the given environment.

val inlining_level : t -> int
val inlining_level_up : t -> t

Mark that this environment is used to rewrite code for inlining. This is used by the inlining heuristics to decide whether to continue. Unconditionally inlined does not take this into account.

val actively_unrolling : t -> Set_of_closures_origin.t -> int option

Whether we are actively unrolling a given function.

val start_actively_unrolling : t -> Set_of_closures_origin.t -> int -> t

Start actively unrolling a given function n times.

val continue_actively_unrolling : t -> Set_of_closures_origin.t -> t

Unroll a function currently actively being unrolled.

val unrolling_allowed : t -> Set_of_closures_origin.t -> bool

Whether it is permissible to unroll a call to a recursive function in the given environment.

val inside_unrolled_function : t -> Set_of_closures_origin.t -> t

Whether the given environment is currently being used to rewrite the body of an unrolled recursive function.

val inlining_allowed : t -> Closure_origin.t -> bool

Whether it is permissible to inline a call to a function in the given environment.

val inside_inlined_function : t -> Closure_origin.t -> t

Whether the given environment is currently being used to rewrite the body of an inlined function.

val note_entering_closure : + t -> + closure_id:Closure_id.t -> + dbg:Debuginfo.t -> + t

If collecting inlining statistics, record that the inliner is about to descend into closure_id. This information enables us to produce a stack of closures that form a kind of context around an inlining decision point.

val note_entering_call : t -> closure_id:Closure_id.t -> dbg:Debuginfo.t -> t

If collecting inlining statistics, record that the inliner is about to descend into a call to closure_id. This information enables us to produce a stack of closures that form a kind of context around an inlining decision point.

val note_entering_inlined : t -> t

If collecting inlining statistics, record that the inliner is about to descend into an inlined function call. This requires that the inliner has already entered the call with note_entering_call.

val note_entering_specialised : t -> closure_ids:Closure_id.Set.t -> t

If collecting inlining statistics, record that the inliner is about to descend into a specialised function definition. This requires that the inliner has already entered the call with note_entering_call.

val enter_closure : + t -> + closure_id:Closure_id.t -> + inline_inside:bool -> + dbg:Debuginfo.t -> + f:(t -> 'a) -> + 'a

Update a given environment to record that the inliner is about to descend into closure_id and pass the resulting environment to f. If inline_inside is false then the environment passed to f will be marked as never_inline (see above).

val record_decision : t -> Inlining_stats_types.Decision.t -> unit

If collecting inlining statistics, record an inlining decision for the call at the top of the closure stack stored inside the given environment.

val print : Stdlib.Format.formatter -> t -> unit

Print a human-readable version of the given environment.

val set_inline_debuginfo : t -> dbg:Debuginfo.t -> t

The environment stores the call-site being inlined to produce precise location information. This function sets the current call-site being inlined.

val add_inlined_debuginfo : t -> dbg:Debuginfo.t -> Debuginfo.t

Appends the locations of inlined call-sites to the ~dbg argument

diff --git a/ocaml/Inline_and_simplify_aux/Result/index.html b/ocaml/Inline_and_simplify_aux/Result/index.html new file mode 100644 index 00000000..439794c3 --- /dev/null +++ b/ocaml/Inline_and_simplify_aux/Result/index.html @@ -0,0 +1,5 @@ + +Result (ocaml.Inline_and_simplify_aux.Result)

Module Inline_and_simplify_aux.Result

type t

Result structures approximately follow the evaluation order of the program. They are returned by the simplification algorithm acting on an Flambda subexpression.

val create : unit -> t
val approx : t -> Simple_value_approx.t

The approximation of the subexpression that has just been simplified.

val set_approx : t -> Simple_value_approx.t -> t

Set the approximation of the subexpression that has just been simplified. Typically used just before returning from a case of the simplification algorithm.

val meet_approx : t -> Env.t -> Simple_value_approx.t -> t

Set the approximation of the subexpression to the meet of the current return approximation and the provided one. Typically used just before returning from a branch case of the simplification algorithm.

val used_static_exceptions : t -> Static_exception.Set.t

All static exceptions for which use_staticfail has been called on the given result structure.

val use_static_exception : t -> Static_exception.t -> t

Mark that the given static exception has been used.

val exit_scope_catch : t -> Static_exception.t -> t

Mark that we are moving up out of the scope of a static-catch block that catches the given static exception identifier. This has the effect of removing the identifier from the used_staticfail set.

val benefit : t -> Inlining_cost.Benefit.t

The benefit to be gained by inlining the subexpression whose simplification yielded the given result structure.

val map_benefit : + t -> + (Inlining_cost.Benefit.t -> Inlining_cost.Benefit.t) -> + t

Apply a transformation to the inlining benefit stored within the given result structure.

val add_benefit : t -> Inlining_cost.Benefit.t -> t

Add some benefit to the inlining benefit stored within the given result structure.

val reset_benefit : t -> t

Set the benefit of inlining the subexpression corresponding to the given result structure to zero.

val set_inlining_threshold : t -> Inlining_cost.Threshold.t option -> t
val add_inlining_threshold : t -> Inlining_cost.Threshold.t -> t
val sub_inlining_threshold : t -> Inlining_cost.Threshold.t -> t
val inlining_threshold : t -> Inlining_cost.Threshold.t option
val seen_direct_application : t -> t
val num_direct_applications : t -> int
diff --git a/ocaml/Inline_and_simplify_aux/index.html b/ocaml/Inline_and_simplify_aux/index.html new file mode 100644 index 00000000..3c7ae7ab --- /dev/null +++ b/ocaml/Inline_and_simplify_aux/index.html @@ -0,0 +1,26 @@ + +Inline_and_simplify_aux (ocaml.Inline_and_simplify_aux)

Module Inline_and_simplify_aux

Environments and result structures used during inlining and simplification. (See inline_and_simplify.ml.)

module Env : sig ... end
module Result : sig ... end
val initial_inlining_threshold : round:int -> Inlining_cost.Threshold.t

Command line argument -inline

val initial_inlining_toplevel_threshold : + round:int -> + Inlining_cost.Threshold.t

Command line argument -inline-toplevel

val prepare_to_simplify_closure : + function_decl:Flambda.function_declaration -> + free_vars:(Flambda.specialised_to * Simple_value_approx.t) Variable.Map.t -> + specialised_args:Flambda.specialised_to Variable.Map.t -> + parameter_approximations:Simple_value_approx.t Variable.Map.t -> + set_of_closures_env:Env.t -> + Env.t
val keep_body_check : + is_classic_mode:bool -> + recursive:Variable.Set.t Stdlib.Lazy.t -> + Variable.t -> + Flambda.function_declaration -> + bool
diff --git a/ocaml/Inlining_cost/Benefit/index.html b/ocaml/Inlining_cost/Benefit/index.html new file mode 100644 index 00000000..56093cfe --- /dev/null +++ b/ocaml/Inlining_cost/Benefit/index.html @@ -0,0 +1,2 @@ + +Benefit (ocaml.Inlining_cost.Benefit)

Module Inlining_cost.Benefit

type t
val zero : t
val (+) : t -> t -> t
val max : round:int -> t -> t -> t
val remove_call : t -> t
val remove_alloc : t -> t
val remove_prim : t -> t
val remove_prims : t -> int -> t
val remove_branch : t -> t
val direct_call_of_indirect : t -> t
val requested_inline : t -> size_of:Flambda.t -> t
val remove_code : Flambda.t -> t -> t
val remove_code_named : Flambda.named -> t -> t
val remove_projection : Projection.t -> t -> t
val add_code : Flambda.t -> t -> t
val add_code_named : Flambda.named -> t -> t
val add_projection : Projection.t -> t -> t
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Inlining_cost/Threshold/index.html b/ocaml/Inlining_cost/Threshold/index.html new file mode 100644 index 00000000..165aa42a --- /dev/null +++ b/ocaml/Inlining_cost/Threshold/index.html @@ -0,0 +1,2 @@ + +Threshold (ocaml.Inlining_cost.Threshold)

Module Inlining_cost.Threshold

type t =
  1. | Never_inline
  2. | Can_inline_if_no_larger_than of int

The maximum size, in some abstract measure of space cost, that an Flambda expression may be in order to be inlined.

val add : t -> t -> t
val sub : t -> t -> t
val min : t -> t -> t
val equal : t -> t -> bool
diff --git a/ocaml/Inlining_cost/Whether_sufficient_benefit/index.html b/ocaml/Inlining_cost/Whether_sufficient_benefit/index.html new file mode 100644 index 00000000..f0680c44 --- /dev/null +++ b/ocaml/Inlining_cost/Whether_sufficient_benefit/index.html @@ -0,0 +1,22 @@ + +Whether_sufficient_benefit (ocaml.Inlining_cost.Whether_sufficient_benefit)

Module Inlining_cost.Whether_sufficient_benefit

type t
val create : + original:Flambda.t -> + toplevel:bool -> + branch_depth:int -> + Flambda.t -> + benefit:Benefit.t -> + lifting:bool -> + round:int -> + t
val create_estimate : + original_size:int -> + toplevel:bool -> + branch_depth:int -> + new_size:int -> + benefit:Benefit.t -> + lifting:bool -> + round:int -> + t
val evaluate : t -> bool
val to_string : t -> string
val print_description : + subfunctions:bool -> + Stdlib.Format.formatter -> + t -> + unit
diff --git a/ocaml/Inlining_cost/index.html b/ocaml/Inlining_cost/index.html new file mode 100644 index 00000000..30eceab0 --- /dev/null +++ b/ocaml/Inlining_cost/index.html @@ -0,0 +1,7 @@ + +Inlining_cost (ocaml.Inlining_cost)

Module Inlining_cost

Measurement of the cost (including cost in space) of Flambda terms in the context of inlining.

module Threshold : sig ... end
val can_inline : Flambda.t -> Threshold.t -> bonus:int -> bool
val can_try_inlining : + Flambda.t -> + Threshold.t -> + number_of_arguments:int -> + size_from_approximation:int option -> + Threshold.t
module Benefit : sig ... end
module Whether_sufficient_benefit : sig ... end
val scale_inline_threshold_by : int
val default_toplevel_multiplier : int
val direct_call_size : int
val maximum_interesting_size_of_function_body : int -> int

If a function body exceeds this size, we can make a fast decision not to inline it (see Inlining_decision).

val lambda_smaller' : Flambda.expr -> than:int -> int option

Measure the given expression to determine whether its size is at or below the given threshold. None is returned if it is too big; otherwise Some is returned with the measured size.

val lambda_size : Flambda.expr -> int
diff --git a/ocaml/Inlining_decision/index.html b/ocaml/Inlining_decision/index.html new file mode 100644 index 00000000..21c2fd0b --- /dev/null +++ b/ocaml/Inlining_decision/index.html @@ -0,0 +1,16 @@ + +Inlining_decision (ocaml.Inlining_decision)

Module Inlining_decision

See the Flambda manual chapter for an explanation in prose of the inlining decision procedure.

val for_call_site : + env:Inline_and_simplify_aux.Env.t -> + r:Inline_and_simplify_aux.Result.t -> + function_decls:Simple_value_approx.function_declarations -> + lhs_of_application:Variable.t -> + closure_id_being_applied:Closure_id.t -> + function_decl:Simple_value_approx.function_declaration -> + value_set_of_closures:Simple_value_approx.value_set_of_closures -> + args:Variable.t list -> + args_approxs:Simple_value_approx.t list -> + dbg:Debuginfo.t -> + simplify:Inlining_decision_intf.simplify -> + inline_requested:Lambda.inline_attribute -> + specialise_requested:Lambda.specialise_attribute -> + Flambda.t * Inline_and_simplify_aux.Result.t

Try to inline a full application of a known function, guided by various heuristics.

val should_inline_inside_declaration : Flambda.function_declaration -> bool

When a function declaration is encountered by for_call_site, the body may be subject to inlining immediately, thus changing the declaration. This function must return true for that to be able to happen.

diff --git a/ocaml/Inlining_decision_intf/index.html b/ocaml/Inlining_decision_intf/index.html new file mode 100644 index 00000000..a830dc14 --- /dev/null +++ b/ocaml/Inlining_decision_intf/index.html @@ -0,0 +1,25 @@ + +Inlining_decision_intf (ocaml.Inlining_decision_intf)

Module Inlining_decision_intf

type 'a by_copying_function_declaration = + env:Inline_and_simplify_aux.Env.t -> + r:Inline_and_simplify_aux.Result.t -> + funct:Flambda.t -> + clos:Flambda.function_declarations -> + fun_id:Closure_id.t -> + func:Flambda.function_declaration -> + args_with_approxs:(Flambda.t list * Simple_value_approx.t list) -> + invariant_params:Variable.Set.t -> + specialised_args:Variable.Set.t -> + dbg:Debuginfo.t -> + (Flambda.t * Inline_and_simplify_aux.Result.t) option
diff --git a/ocaml/Inlining_stats/Closure_stack/index.html b/ocaml/Inlining_stats/Closure_stack/index.html new file mode 100644 index 00000000..3f73219e --- /dev/null +++ b/ocaml/Inlining_stats/Closure_stack/index.html @@ -0,0 +1,6 @@ + +Closure_stack (ocaml.Inlining_stats.Closure_stack)

Module Inlining_stats.Closure_stack

type t
val create : unit -> t
val note_entering_closure : + t -> + closure_id:Closure_id.t -> + dbg:Debuginfo.t -> + t
val note_entering_call : t -> closure_id:Closure_id.t -> dbg:Debuginfo.t -> t
val note_entering_inlined : t -> t
val note_entering_specialised : t -> closure_ids:Closure_id.Set.t -> t
diff --git a/ocaml/Inlining_stats/index.html b/ocaml/Inlining_stats/index.html new file mode 100644 index 00000000..d49633be --- /dev/null +++ b/ocaml/Inlining_stats/index.html @@ -0,0 +1,5 @@ + +Inlining_stats (ocaml.Inlining_stats)

Module Inlining_stats

module Closure_stack : sig ... end
val record_decision : + Inlining_stats_types.Decision.t -> + closure_stack:Closure_stack.t -> + unit
val save_then_forget_decisions : output_prefix:string -> unit
diff --git a/ocaml/Inlining_stats_types/Decision/index.html b/ocaml/Inlining_stats_types/Decision/index.html new file mode 100644 index 00000000..b32c16a2 --- /dev/null +++ b/ocaml/Inlining_stats_types/Decision/index.html @@ -0,0 +1,2 @@ + +Decision (ocaml.Inlining_stats_types.Decision)

Module Inlining_stats_types.Decision

type t =
  1. | Prevented of Prevented.t
  2. | Specialised of Specialised.t
  3. | Inlined of Not_specialised.t * Inlined.t
  4. | Unchanged of Not_specialised.t * Not_inlined.t
val summary : Stdlib.Format.formatter -> t -> unit
val calculation : depth:int -> Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Inlining_stats_types/Inlined/index.html b/ocaml/Inlining_stats_types/Inlined/index.html new file mode 100644 index 00000000..5264bdb8 --- /dev/null +++ b/ocaml/Inlining_stats_types/Inlined/index.html @@ -0,0 +1,3 @@ + +Inlined (ocaml.Inlining_stats_types.Inlined)

Module Inlining_stats_types.Inlined

type t =
  1. | Classic_mode
  2. | Annotation
  3. | Decl_local_to_application
  4. | Without_subfunctions of Inlining_cost.Whether_sufficient_benefit.t
  5. | With_subfunctions of Inlining_cost.Whether_sufficient_benefit.t + * Inlining_cost.Whether_sufficient_benefit.t
diff --git a/ocaml/Inlining_stats_types/Not_inlined/index.html b/ocaml/Inlining_stats_types/Not_inlined/index.html new file mode 100644 index 00000000..d83a6404 --- /dev/null +++ b/ocaml/Inlining_stats_types/Not_inlined/index.html @@ -0,0 +1,3 @@ + +Not_inlined (ocaml.Inlining_stats_types.Not_inlined)

Module Inlining_stats_types.Not_inlined

type t =
  1. | Classic_mode
  2. | Above_threshold of int
  3. | Annotation
  4. | No_useful_approximations
  5. | Unrolling_depth_exceeded
  6. | Self_call
  7. | Without_subfunctions of Inlining_cost.Whether_sufficient_benefit.t
  8. | With_subfunctions of Inlining_cost.Whether_sufficient_benefit.t + * Inlining_cost.Whether_sufficient_benefit.t
diff --git a/ocaml/Inlining_stats_types/Not_specialised/index.html b/ocaml/Inlining_stats_types/Not_specialised/index.html new file mode 100644 index 00000000..a8d4171e --- /dev/null +++ b/ocaml/Inlining_stats_types/Not_specialised/index.html @@ -0,0 +1,3 @@ + +Not_specialised (ocaml.Inlining_stats_types.Not_specialised)

Module Inlining_stats_types.Not_specialised

type t =
  1. | Classic_mode
  2. | Above_threshold of int
  3. | Annotation
  4. | Not_recursive
  5. | Not_closed
  6. | No_invariant_parameters
  7. | No_useful_approximations
  8. | Self_call
  9. | Not_beneficial of Inlining_cost.Whether_sufficient_benefit.t + * Inlining_cost.Whether_sufficient_benefit.t
diff --git a/ocaml/Inlining_stats_types/Prevented/index.html b/ocaml/Inlining_stats_types/Prevented/index.html new file mode 100644 index 00000000..17d540c9 --- /dev/null +++ b/ocaml/Inlining_stats_types/Prevented/index.html @@ -0,0 +1,2 @@ + +Prevented (ocaml.Inlining_stats_types.Prevented)

Module Inlining_stats_types.Prevented

type t =
  1. | Function_prevented_from_inlining
  2. | Level_exceeded
diff --git a/ocaml/Inlining_stats_types/Specialised/index.html b/ocaml/Inlining_stats_types/Specialised/index.html new file mode 100644 index 00000000..d81f6281 --- /dev/null +++ b/ocaml/Inlining_stats_types/Specialised/index.html @@ -0,0 +1,3 @@ + +Specialised (ocaml.Inlining_stats_types.Specialised)

Module Inlining_stats_types.Specialised

diff --git a/ocaml/Inlining_stats_types/index.html b/ocaml/Inlining_stats_types/index.html new file mode 100644 index 00000000..cc9c420c --- /dev/null +++ b/ocaml/Inlining_stats_types/index.html @@ -0,0 +1,2 @@ + +Inlining_stats_types (ocaml.Inlining_stats_types)

Module Inlining_stats_types

module Inlined : sig ... end
module Not_inlined : sig ... end
module Specialised : sig ... end
module Not_specialised : sig ... end
module Prevented : sig ... end
module Decision : sig ... end
diff --git a/ocaml/Inlining_transforms/index.html b/ocaml/Inlining_transforms/index.html new file mode 100644 index 00000000..a4f78549 --- /dev/null +++ b/ocaml/Inlining_transforms/index.html @@ -0,0 +1,32 @@ + +Inlining_transforms (ocaml.Inlining_transforms)

Module Inlining_transforms

Source code transformations used during inlining.

val inline_by_copying_function_body : + env:Inline_and_simplify_aux.Env.t -> + r:Inline_and_simplify_aux.Result.t -> + lhs_of_application:Variable.t -> + inline_requested:Lambda.inline_attribute -> + specialise_requested:Lambda.specialise_attribute -> + closure_id_being_applied:Closure_id.t -> + function_decl:Simple_value_approx.function_declaration -> + function_body:Simple_value_approx.function_body -> + fun_vars:Variable.Set.t -> + args:Variable.t list -> + dbg:Debuginfo.t -> + simplify:Inlining_decision_intf.simplify -> + Flambda.t * Inline_and_simplify_aux.Result.t

Inline a function by substituting its body (which may be subject to further transformation) at a call site. The function's declaration is not copied.

This transformation is used when:

  • inlining a call to a non-recursive function;
  • inlining a call, within a recursive or mutually-recursive function, to the same or another function being defined simultaneously ("unrolling"). The maximum depth of unrolling is bounded (see E.unrolling_allowed).

In both cases, the body of the function is copied, within a sequence of lets that bind the function parameters, the variables "bound by the closure" (see flambda.mli), and any function identifiers introduced by the set of closures. These stages are delimited below by comments.

As an example, suppose we are inlining the following function:

let f x = x + y ... let p = f, f in (fst p) 42

The call site (fst p) 42 will be transformed to:

let clos_id = fst p in (* must eventually yield a closure *) let y = <access to y in clos_id> in let x' = 42 in let x = x' in x + y

When unrolling a recursive function we rename the arguments to the recursive call in order to avoid clashes with existing bindings. For example, suppose we are inlining the following call to f, which lies within its own declaration:

let rec f x y = f (fst x) (y + snd x)

This will be transformed to:

let rec f x y = let clos_id = f in (* not used this time, since f has no free vars *) let x' = fst x in let y' = y + snd x in f (fst x') (y' + snd x') (* body of f with parameters freshened *)

val inline_by_copying_function_declaration : + env:Inline_and_simplify_aux.Env.t -> + r:Inline_and_simplify_aux.Result.t -> + function_decls:Simple_value_approx.function_declarations -> + lhs_of_application:Variable.t -> + inline_requested:Lambda.inline_attribute -> + closure_id_being_applied:Closure_id.t -> + function_decl:Simple_value_approx.function_declaration -> + args:Variable.t list -> + args_approxs:Simple_value_approx.t list -> + invariant_params:Variable.Set.t Variable.Map.t lazy_t -> + specialised_args:Flambda.specialised_to Variable.Map.t -> + free_vars:Flambda.specialised_to Variable.Map.t -> + direct_call_surrogates:Closure_id.t Closure_id.Map.t -> + dbg:Debuginfo.t -> + simplify:Inlining_decision_intf.simplify -> + (Flambda.t * Inline_and_simplify_aux.Result.t) option

Inlining of recursive function(s) yields a copy of the functions' definitions (not just their bodies, unlike the non-recursive case) and a direct application of the new body. Note: the function really does need to be recursive (but possibly only via some mutual recursion) to end up in here; a simultaneous binding that is + non-recursive is not sufficient.

diff --git a/ocaml/Instruct/index.html b/ocaml/Instruct/index.html new file mode 100644 index 00000000..252fdc5c --- /dev/null +++ b/ocaml/Instruct/index.html @@ -0,0 +1,2 @@ + +Instruct (ocaml.Instruct)

Module Instruct

type compilation_env = {
  1. ce_stack : int Ident.tbl;
  2. ce_heap : int Ident.tbl;
  3. ce_rec : int Ident.tbl;
}
type debug_event = {
  1. mutable ev_pos : int;
  2. ev_module : string;
  3. ev_loc : Location.t;
  4. ev_kind : debug_event_kind;
  5. ev_defname : string;
  6. ev_info : debug_event_info;
  7. ev_typenv : Env.summary;
  8. ev_typsubst : Subst.t;
  9. ev_compenv : compilation_env;
  10. ev_stacksize : int;
  11. ev_repr : debug_event_repr;
}
and debug_event_kind =
  1. | Event_before
  2. | Event_after of Types.type_expr
  3. | Event_pseudo
and debug_event_info =
  1. | Event_function
  2. | Event_return of int
  3. | Event_other
and debug_event_repr =
  1. | Event_none
  2. | Event_parent of int ref
  3. | Event_child of int ref
type label = int
type instruction =
  1. | Klabel of label
  2. | Kacc of int
  3. | Kenvacc of int
  4. | Kpush
  5. | Kpop of int
  6. | Kassign of int
  7. | Kpush_retaddr of label
  8. | Kapply of int
  9. | Kappterm of int * int
  10. | Kreturn of int
  11. | Krestart
  12. | Kgrab of int
  13. | Kclosure of label * int
  14. | Kclosurerec of label list * int
  15. | Koffsetclosure of int
  16. | Kgetglobal of Ident.t
  17. | Ksetglobal of Ident.t
  18. | Kconst of Lambda.structured_constant
  19. | Kmakeblock of int * int
  20. | Kmakefloatblock of int
  21. | Kgetfield of int
  22. | Ksetfield of int
  23. | Kgetfloatfield of int
  24. | Ksetfloatfield of int
  25. | Kvectlength
  26. | Kgetvectitem
  27. | Ksetvectitem
  28. | Kgetstringchar
  29. | Kgetbyteschar
  30. | Ksetbyteschar
  31. | Kbranch of label
  32. | Kbranchif of label
  33. | Kbranchifnot of label
  34. | Kstrictbranchif of label
  35. | Kstrictbranchifnot of label
  36. | Kswitch of label array * label array
  37. | Kboolnot
  38. | Kpushtrap of label
  39. | Kpoptrap
  40. | Kraise of Lambda.raise_kind
  41. | Kcheck_signals
  42. | Kccall of string * int
  43. | Knegint
  44. | Kaddint
  45. | Ksubint
  46. | Kmulint
  47. | Kdivint
  48. | Kmodint
  49. | Kandint
  50. | Korint
  51. | Kxorint
  52. | Klslint
  53. | Klsrint
  54. | Kasrint
  55. | Kintcomp of Lambda.integer_comparison
  56. | Koffsetint of int
  57. | Koffsetref of int
  58. | Kisint
  59. | Kisout
  60. | Kgetmethod
  61. | Kgetpubmet of int
  62. | Kgetdynmet
  63. | Kevent of debug_event
  64. | Kperform
  65. | Kresume
  66. | Kresumeterm of int
  67. | Kreperformterm of int
  68. | Kstop
val immed_min : int
val immed_max : int
diff --git a/ocaml/Int_replace_polymorphic_compare/index.html b/ocaml/Int_replace_polymorphic_compare/index.html new file mode 100644 index 00000000..4bc341d4 --- /dev/null +++ b/ocaml/Int_replace_polymorphic_compare/index.html @@ -0,0 +1,2 @@ + +Int_replace_polymorphic_compare (ocaml.Int_replace_polymorphic_compare)

Module Int_replace_polymorphic_compare

val (=) : int -> int -> bool
val (<>) : int -> int -> bool
val (<) : int -> int -> bool
val (>) : int -> int -> bool
val (<=) : int -> int -> bool
val (>=) : int -> int -> bool
val compare : int -> int -> int
diff --git a/ocaml/Interf/index.html b/ocaml/Interf/index.html new file mode 100644 index 00000000..9985b621 --- /dev/null +++ b/ocaml/Interf/index.html @@ -0,0 +1,2 @@ + +Interf (ocaml.Interf)

Module Interf

val build_graph : Mach.fundecl -> unit
diff --git a/ocaml/Internal_variable_names/index.html b/ocaml/Internal_variable_names/index.html new file mode 100644 index 00000000..47797056 --- /dev/null +++ b/ocaml/Internal_variable_names/index.html @@ -0,0 +1,2 @@ + +Internal_variable_names (ocaml.Internal_variable_names)

Module Internal_variable_names

type t = private string
val apply_arg : t
val apply_funct : t
val block_symbol : t
val block_symbol_get : t
val block_symbol_get_field : t
val closure : t
val cond : t
val cond_sequor : t
val const_block : t
val const_bool : t
val const_boxed_int : t
val const_char : t
val const_false : t
val const_float : t
val const_int : t
val const_one : t
val const_ptr : t
val const_ptr_one : t
val const_ptr_zero : t
val const_sequand : t
val const_string : t
val const_true : t
val const_zero : t
val denominator : t
val division_by_zero : t
val dummy : t
val dup_func : t
val dup_set_of_closures : t
val const_float_array : t
val fake_effect_symbol : t
val for_from : t
val for_to : t
val from_closure : t
val full_apply : t
val get_symbol_field : t
val const_immstring : t
val const_int32 : t
val const_int64 : t
val ignore : t
val is_zero : t
val lifted_let_rec_block : t
val meth : t
val module_as_block : t
val const_nativeint : t
val new_value : t
val numerator : t
val obj : t
val offsetted : t
val partial_fun : t
val pgetglobal : t
val pointer : t
val predef_exn : t
val project_closure : t
val raise : t
val raise_arg : t
val read_mutable : t
val remove_unused_arguments : t
val result : t
val send_arg : t
val sequence : t
val set_of_closures : t
val staticraise_arg : t
val simplify_fv : t
val string_switch : t
val switch : t
val symbol : t
val symbol_field : t
val symbol_field_block : t
val the_dead_constant : t
val toplevel_substitution_named : t
val unbox_free_vars_of_closures : t
val unit : t
val zero : t
val of_primitive : Lambda.primitive -> t
val of_primitive_arg : Lambda.primitive -> t
val anon_fn_with_loc : Lambda.scoped_location -> t
diff --git a/ocaml/Interval/index.html b/ocaml/Interval/index.html new file mode 100644 index 00000000..6902110b --- /dev/null +++ b/ocaml/Interval/index.html @@ -0,0 +1,2 @@ + +Interval (ocaml.Interval)

Module Interval

type range = {
  1. mutable rbegin : int;
  2. mutable rend : int;
}
type t = {
  1. mutable reg : Reg.t;
  2. mutable ibegin : int;
  3. mutable iend : int;
  4. mutable ranges : range list;
}
type result = {
  1. intervals : t list;
  2. fixed_intervals : t list;
}
val overlap : t -> t -> bool
val is_live : t -> int -> bool
val remove_expired_ranges : t -> int -> unit
val build_intervals : Mach.fundecl -> result
diff --git a/ocaml/Invariant_params/index.html b/ocaml/Invariant_params/index.html new file mode 100644 index 00000000..35955337 --- /dev/null +++ b/ocaml/Invariant_params/index.html @@ -0,0 +1,11 @@ + +Invariant_params (ocaml.Invariant_params)

Module Invariant_params

val invariant_params_in_recursion : + Flambda.function_declarations -> + backend:(module Backend_intf.S) -> + Variable.Set.t Variable.Map.t
val invariant_param_sources : + Flambda.function_declarations -> + backend:(module Backend_intf.S) -> + Variable.Pair.Set.t Variable.Map.t
val unused_arguments : + Flambda.function_declarations -> + backend:(module Backend_intf.S) -> + Variable.Set.t
diff --git a/ocaml/Lambda/index.html b/ocaml/Lambda/index.html new file mode 100644 index 00000000..0a065bcb --- /dev/null +++ b/ocaml/Lambda/index.html @@ -0,0 +1,36 @@ + +Lambda (ocaml.Lambda)

Module Lambda

type compile_time_constant =
  1. | Big_endian
  2. | Word_size
  3. | Int_size
  4. | Max_wosize
  5. | Ostype_unix
  6. | Ostype_win32
  7. | Ostype_cygwin
  8. | Backend_type
type immediate_or_pointer =
  1. | Immediate
  2. | Pointer
type initialization_or_assignment =
  1. | Assignment
  2. | Heap_initialization
  3. | Root_initialization
type is_safe =
  1. | Safe
  2. | Unsafe
type primitive =
  1. | Pbytes_to_string
  2. | Pbytes_of_string
  3. | Pignore
  4. | Pgetglobal of Ident.t
  5. | Psetglobal of Ident.t
  6. | Pmakeblock of int * Asttypes.mutable_flag * block_shape
  7. | Pfield of int * immediate_or_pointer * Asttypes.mutable_flag
  8. | Pfield_computed
  9. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
  10. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
  11. | Pfloatfield of int
  12. | Psetfloatfield of int * initialization_or_assignment
  13. | Pduprecord of Types.record_representation * int
  14. | Prunstack
  15. | Pperform
  16. | Presume
  17. | Preperform
  18. | Pccall of Primitive.description
  19. | Praise of raise_kind
  20. | Psequand
  21. | Psequor
  22. | Pnot
  23. | Pnegint
  24. | Paddint
  25. | Psubint
  26. | Pmulint
  27. | Pdivint of is_safe
  28. | Pmodint of is_safe
  29. | Pandint
  30. | Porint
  31. | Pxorint
  32. | Plslint
  33. | Plsrint
  34. | Pasrint
  35. | Pintcomp of integer_comparison
  36. | Pcompare_ints
  37. | Pcompare_floats
  38. | Pcompare_bints of boxed_integer
  39. | Poffsetint of int
  40. | Poffsetref of int
  41. | Pintoffloat
  42. | Pfloatofint
  43. | Pnegfloat
  44. | Pabsfloat
  45. | Paddfloat
  46. | Psubfloat
  47. | Pmulfloat
  48. | Pdivfloat
  49. | Pfloatcomp of float_comparison
  50. | Pstringlength
  51. | Pstringrefu
  52. | Pstringrefs
  53. | Pbyteslength
  54. | Pbytesrefu
  55. | Pbytessetu
  56. | Pbytesrefs
  57. | Pbytessets
  58. | Pmakearray of array_kind * Asttypes.mutable_flag
  59. | Pduparray of array_kind * Asttypes.mutable_flag
    (*

    For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

    *)
  60. | Parraylength of array_kind
  61. | Parrayrefu of array_kind
  62. | Parraysetu of array_kind
  63. | Parrayrefs of array_kind
  64. | Parraysets of array_kind
  65. | Pisint
  66. | Pisout
  67. | Pbintofint of boxed_integer
  68. | Pintofbint of boxed_integer
  69. | Pcvtbint of boxed_integer * boxed_integer
  70. | Pnegbint of boxed_integer
  71. | Paddbint of boxed_integer
  72. | Psubbint of boxed_integer
  73. | Pmulbint of boxed_integer
  74. | Pdivbint of {
    1. size : boxed_integer;
    2. is_safe : is_safe;
    }
  75. | Pmodbint of {
    1. size : boxed_integer;
    2. is_safe : is_safe;
    }
  76. | Pandbint of boxed_integer
  77. | Porbint of boxed_integer
  78. | Pxorbint of boxed_integer
  79. | Plslbint of boxed_integer
  80. | Plsrbint of boxed_integer
  81. | Pasrbint of boxed_integer
  82. | Pbintcomp of boxed_integer * integer_comparison
  83. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
  84. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
  85. | Pbigarraydim of int
  86. | Pstring_load_16 of bool
  87. | Pstring_load_32 of bool
  88. | Pstring_load_64 of bool
  89. | Pbytes_load_16 of bool
  90. | Pbytes_load_32 of bool
  91. | Pbytes_load_64 of bool
  92. | Pbytes_set_16 of bool
  93. | Pbytes_set_32 of bool
  94. | Pbytes_set_64 of bool
  95. | Pbigstring_load_16 of bool
  96. | Pbigstring_load_32 of bool
  97. | Pbigstring_load_64 of bool
  98. | Pbigstring_set_16 of bool
  99. | Pbigstring_set_32 of bool
  100. | Pbigstring_set_64 of bool
  101. | Pctconst of compile_time_constant
  102. | Pbswap16
  103. | Pbbswap of boxed_integer
  104. | Pint_as_pointer
  105. | Patomic_load of {
    1. immediate_or_pointer : immediate_or_pointer;
    }
  106. | Patomic_exchange
  107. | Patomic_cas
  108. | Patomic_fetch_add
  109. | Popaque
  110. | Pdls_get
and integer_comparison =
  1. | Ceq
  2. | Cne
  3. | Clt
  4. | Cgt
  5. | Cle
  6. | Cge
and float_comparison =
  1. | CFeq
  2. | CFneq
  3. | CFlt
  4. | CFnlt
  5. | CFgt
  6. | CFngt
  7. | CFle
  8. | CFnle
  9. | CFge
  10. | CFnge
and array_kind =
  1. | Pgenarray
  2. | Paddrarray
  3. | Pintarray
  4. | Pfloatarray
and value_kind =
  1. | Pgenval
  2. | Pfloatval
  3. | Pboxedintval of boxed_integer
  4. | Pintval
and block_shape = value_kind list option
and boxed_integer = Primitive.boxed_integer =
  1. | Pnativeint
  2. | Pint32
  3. | Pint64
and bigarray_kind =
  1. | Pbigarray_unknown
  2. | Pbigarray_float32
  3. | Pbigarray_float64
  4. | Pbigarray_sint8
  5. | Pbigarray_uint8
  6. | Pbigarray_sint16
  7. | Pbigarray_uint16
  8. | Pbigarray_int32
  9. | Pbigarray_int64
  10. | Pbigarray_caml_int
  11. | Pbigarray_native_int
  12. | Pbigarray_complex32
  13. | Pbigarray_complex64
and bigarray_layout =
  1. | Pbigarray_unknown_layout
  2. | Pbigarray_c_layout
  3. | Pbigarray_fortran_layout
and raise_kind =
  1. | Raise_regular
  2. | Raise_reraise
  3. | Raise_notrace
val equal_primitive : primitive -> primitive -> bool
val equal_value_kind : value_kind -> value_kind -> bool
val equal_boxed_integer : boxed_integer -> boxed_integer -> bool
type structured_constant =
  1. | Const_base of Asttypes.constant
  2. | Const_block of int * structured_constant list
  3. | Const_float_array of string list
  4. | Const_immstring of string
type tailcall_attribute =
  1. | Tailcall_expectation of bool
  2. | Default_tailcall
type inline_attribute =
  1. | Always_inline
  2. | Never_inline
  3. | Hint_inline
  4. | Unroll of int
  5. | Default_inline
val equal_inline_attribute : inline_attribute -> inline_attribute -> bool
type specialise_attribute =
  1. | Always_specialise
  2. | Never_specialise
  3. | Default_specialise
val equal_specialise_attribute : + specialise_attribute -> + specialise_attribute -> + bool
type local_attribute =
  1. | Always_local
  2. | Never_local
  3. | Default_local
type poll_attribute =
  1. | Error_poll
  2. | Default_poll
type function_kind =
  1. | Curried
  2. | Tupled
type let_kind =
  1. | Strict
  2. | Alias
  3. | StrictOpt
type meth_kind =
  1. | Self
  2. | Public
  3. | Cached
val equal_meth_kind : meth_kind -> meth_kind -> bool
type shared_code = (int * int) list
type function_attribute = {
  1. inline : inline_attribute;
  2. specialise : specialise_attribute;
  3. local : local_attribute;
  4. poll : poll_attribute;
  5. is_a_functor : bool;
  6. stub : bool;
  7. tmc_candidate : bool;
}
type scoped_location = Debuginfo.Scoped_location.t
type lambda =
  1. | Lvar of Ident.t
  2. | Lmutvar of Ident.t
  3. | Lconst of structured_constant
  4. | Lapply of lambda_apply
  5. | Lfunction of lfunction
  6. | Llet of let_kind * value_kind * Ident.t * lambda * lambda
  7. | Lmutlet of value_kind * Ident.t * lambda * lambda
  8. | Lletrec of (Ident.t * lambda) list * lambda
  9. | Lprim of primitive * lambda list * scoped_location
  10. | Lswitch of lambda * lambda_switch * scoped_location
  11. | Lstringswitch of lambda + * (string * lambda) list + * lambda option + * scoped_location
  12. | Lstaticraise of int * lambda list
  13. | Lstaticcatch of lambda * int * (Ident.t * value_kind) list * lambda
  14. | Ltrywith of lambda * Ident.t * lambda
  15. | Lifthenelse of lambda * lambda * lambda
  16. | Lsequence of lambda * lambda
  17. | Lwhile of lambda * lambda
  18. | Lfor of Ident.t * lambda * lambda * Asttypes.direction_flag * lambda
  19. | Lassign of Ident.t * lambda
  20. | Lsend of meth_kind * lambda * lambda * lambda list * scoped_location
  21. | Levent of lambda * lambda_event
  22. | Lifused of Ident.t * lambda
and lfunction = private {
  1. kind : function_kind;
  2. params : (Ident.t * value_kind) list;
  3. return : value_kind;
  4. body : lambda;
  5. attr : function_attribute;
  6. loc : scoped_location;
}
and lambda_apply = {
  1. ap_func : lambda;
  2. ap_args : lambda list;
  3. ap_loc : scoped_location;
  4. ap_tailcall : tailcall_attribute;
  5. ap_inlined : inline_attribute;
  6. ap_specialised : specialise_attribute;
}
and lambda_switch = {
  1. sw_numconsts : int;
  2. sw_consts : (int * lambda) list;
  3. sw_numblocks : int;
  4. sw_blocks : (int * lambda) list;
  5. sw_failaction : lambda option;
}
and lambda_event = {
  1. lev_loc : scoped_location;
  2. lev_kind : lambda_event_kind;
  3. lev_repr : int ref option;
  4. lev_env : Env.t;
}
and lambda_event_kind =
  1. | Lev_before
  2. | Lev_after of Types.type_expr
  3. | Lev_function
  4. | Lev_pseudo
type program = {
  1. module_ident : Ident.t;
  2. main_module_block_size : int;
  3. required_globals : Ident.Set.t;
  4. code : lambda;
}
val make_key : lambda -> lambda option
val const_unit : structured_constant
val const_int : int -> structured_constant
val lambda_unit : lambda
val name_lambda : let_kind -> lambda -> (Ident.t -> lambda) -> lambda
val name_lambda_list : lambda list -> (lambda list -> lambda) -> lambda
val lfunction : + kind:function_kind -> + params:(Ident.t * value_kind) list -> + return:value_kind -> + body:lambda -> + attr:function_attribute -> + loc:scoped_location -> + lambda
val iter_head_constructor : (lambda -> unit) -> lambda -> unit

iter_head_constructor f lam apply f to only the first level of sub expressions of lam. It does not recursively traverse the expression.

val shallow_iter : + tail:(lambda -> unit) -> + non_tail:(lambda -> unit) -> + lambda -> + unit

Same as iter_head_constructor, but use a different callback for sub-terms which are in tail position or not.

val transl_prim : string -> string -> lambda

Translate a value from a persistent module. For instance:

transl_internal_value "CamlinternalLazy" "force"
val free_variables : lambda -> Ident.Set.t
val transl_module_path : scoped_location -> Env.t -> Path.t -> lambda
val transl_value_path : scoped_location -> Env.t -> Path.t -> lambda
val transl_extension_path : scoped_location -> Env.t -> Path.t -> lambda
val transl_class_path : scoped_location -> Env.t -> Path.t -> lambda
val make_sequence : ('a -> lambda) -> 'a list -> lambda
val subst : + (Ident.t -> Types.value_description -> Env.t -> Env.t) -> + ?freshen_bound_variables:bool -> + lambda Ident.Map.t -> + lambda -> + lambda

subst update_env ?freshen_bound_variables s lt applies a substitution s to the lambda-term lt.

Assumes that the image of the substitution is out of reach of the bound variables of the lambda-term (no capture).

update_env is used to refresh the environment contained in debug events.

freshen_bound_variables, which defaults to false, freshens the bound variables within lt.

val rename : Ident.t Ident.Map.t -> lambda -> lambda

A version of subst specialized for the case where we're just renaming idents.

val duplicate : lambda -> lambda

Duplicate a term, freshening all locally-bound identifiers.

val map : (lambda -> lambda) -> lambda -> lambda

Bottom-up rewriting, applying the function on each node from the leaves to the root.

val shallow_map : (lambda -> lambda) -> lambda -> lambda

Rewrite each immediate sub-term with the function.

val bind : let_kind -> Ident.t -> lambda -> lambda -> lambda
val bind_with_value_kind : + let_kind -> + (Ident.t * value_kind) -> + lambda -> + lambda -> + lambda
val negate_integer_comparison : integer_comparison -> integer_comparison
val swap_integer_comparison : integer_comparison -> integer_comparison
val negate_float_comparison : float_comparison -> float_comparison
val swap_float_comparison : float_comparison -> float_comparison
val default_function_attribute : function_attribute
val default_stub_attribute : function_attribute
val function_is_curried : lfunction -> bool
val find_exact_application : + function_kind -> + arity:int -> + lambda list -> + lambda list option
val max_arity : unit -> int

Maximal number of parameters for a function, or in other words, maximal length of the params list of a lfunction record. This is unlimited (max_int) for bytecode, but limited (currently to 126) for native code.

val next_raise_count : unit -> int
val staticfail : lambda
val is_guarded : lambda -> bool
val patch_guarded : lambda -> lambda -> lambda
val raise_kind : raise_kind -> string
val merge_inline_attributes : + inline_attribute -> + inline_attribute -> + inline_attribute option
val reset : unit -> unit
diff --git a/ocaml/Lazy_backtrack/index.html b/ocaml/Lazy_backtrack/index.html new file mode 100644 index 00000000..37e56d9b --- /dev/null +++ b/ocaml/Lazy_backtrack/index.html @@ -0,0 +1,6 @@ + +Lazy_backtrack (ocaml.Lazy_backtrack)

Module Lazy_backtrack

type ('a, 'b) t
type log
val force : ('a -> 'b) -> ('a, 'b) t -> 'b
val create : 'a -> ('a, 'b) t
val get_arg : ('a, 'b) t -> 'a option
val get_contents : ('a, 'b) t -> ('a, 'b) Stdlib.Either.t
val create_forced : 'b -> ('a, 'b) t
val create_failed : exn -> ('a, 'b) t
val log : unit -> log
val force_logged : + log -> + ('a -> ('b, 'c) result) -> + ('a, ('b, 'c) result) t -> + ('b, 'c) result
val backtrack : log -> unit
diff --git a/ocaml/Lexer/index.html b/ocaml/Lexer/index.html new file mode 100644 index 00000000..3f860177 --- /dev/null +++ b/ocaml/Lexer/index.html @@ -0,0 +1,7 @@ + +Lexer (ocaml.Lexer)

Module Lexer

The lexical analyzer

Warning: this module is unstable and part of compiler-libs.

val init : unit -> unit
val skip_hash_bang : Stdlib.Lexing.lexbuf -> unit
type error =
  1. | Illegal_character of char
  2. | Illegal_escape of string * string option
  3. | Reserved_sequence of string * string option
  4. | Unterminated_comment of Location.t
  5. | Unterminated_string
  6. | Unterminated_string_in_comment of Location.t * Location.t
  7. | Empty_character_literal
  8. | Keyword_as_label of string
  9. | Invalid_literal of string
  10. | Invalid_directive of string * string option
exception Error of error * Location.t
val in_comment : unit -> bool
val in_string : unit -> bool
val print_warnings : bool ref
val handle_docstrings : bool ref
val comments : unit -> (string * Location.t) list
val token_with_comments : Stdlib.Lexing.lexbuf -> Parser.token
val set_preprocessor : + (unit -> unit) -> + ((Stdlib.Lexing.lexbuf -> Parser.token) -> + Stdlib.Lexing.lexbuf -> + Parser.token) -> + unit
diff --git a/ocaml/Lift_code/index.html b/ocaml/Lift_code/index.html new file mode 100644 index 00000000..7c24c3b9 --- /dev/null +++ b/ocaml/Lift_code/index.html @@ -0,0 +1,7 @@ + +Lift_code (ocaml.Lift_code)

Module Lift_code

val lift_lets : lifter

Lift let bindings to attempt to increase the length of scopes, as an aid to further optimizations. For example: let c = let b = <expr> in b, b in fst c would be transformed to: let b = <expr> in let c = b, b in fst c which is then clearly just: <expr>

val lift_lets_expr : Flambda.t -> toplevel:bool -> Flambda.t
val lifting_helper : + Flambda.t list -> + evaluation_order:[ `Left_to_right | `Right_to_left ] -> + create_body:(Variable.t list -> Flambda.t) -> + name:Internal_variable_names.t -> + Flambda.t
diff --git a/ocaml/Lift_constants/index.html b/ocaml/Lift_constants/index.html new file mode 100644 index 00000000..8cefb7af --- /dev/null +++ b/ocaml/Lift_constants/index.html @@ -0,0 +1,5 @@ + +Lift_constants (ocaml.Lift_constants)

Module Lift_constants

The aim of this pass is to assign symbols to values known to be constant (in other words, whose values we know at compile time), with appropriate sharing of constants, and replace the occurrences of the constants with their corresponding symbols.

This pass uses the results of two other passes, Inconstant_idents and Alias_analysis. The relationship between these two deserves some attention.

Inconstant_idents is a "backwards" analysis that propagates implications about inconstantness of variables and set of closures IDs.

Alias_analysis is a "forwards" analysis that is analogous to the propagation of Simple_value_approx.t values during Inline_and_simplify. It gives us information about relationships between values but not actually about their constantness.

Combining these two into a single pass has been attempted previously, but was not thought to be successful; this experiment could be repeated in the future. (If "constant" is considered as "top" and "inconstant" is considered as "bottom", then Alias_analysis corresponds to a least fixed point and Inconstant_idents corresponds to a greatest fixed point.)

At a high level, this pass operates as follows. Symbols are assigned to variables known to be constant and their defining expressions examined. Based on the results of Alias_analysis, we simplify the destructive elements within the defining expressions (specifically, projection of fields from blocks), to eventually yield Flambda.constant_defining_values that are entirely constructive. These will be bound to symbols in the resulting program.

Another approach to this pass could be to only use the results of Inconstant_idents and then repeatedly lift constants and run Inline_and_simplify until a fixpoint. It was thought more robust to instead use Alias_analysis, where the fixpointing involves a less complicated function.

We still run Inline_and_simplify once after this pass since the lifting of constants may enable more functions to become closed; the simplification pass provides an easy way of cleaning up (e.g. making sure free_vars maps in sets of closures are correct).

val lift_constants : + Flambda.program -> + backend:(module Backend_intf.S) -> + Flambda.program
diff --git a/ocaml/Lift_let_to_initialize_symbol/index.html b/ocaml/Lift_let_to_initialize_symbol/index.html new file mode 100644 index 00000000..fdb4a89d --- /dev/null +++ b/ocaml/Lift_let_to_initialize_symbol/index.html @@ -0,0 +1,5 @@ + +Lift_let_to_initialize_symbol (ocaml.Lift_let_to_initialize_symbol)

Module Lift_let_to_initialize_symbol

val lift : + backend:(module Backend_intf.S) -> + Flambda.program -> + Flambda.program

Lift toplevel Let-expressions to Flambda program constructions such that the results of evaluation of such expressions may be accessed directly, through symbols, rather than through closures. The Let-expressions typically come from the compilation of modules (using the bytecode strategy) in Translmod.

This means of compilation supersedes the old "transl_store_" methodology for native code.

An Initialize_symbol construction generated by this pass may be subsequently rewritten to Let_symbol if it is discovered that the initializer is in fact constant. (See Initialize_symbol_to_let_symbol.)

The program constructions generated by this pass will be joined by others that arise from the lifting of constants (see Lift_constants).

diff --git a/ocaml/Linear/index.html b/ocaml/Linear/index.html new file mode 100644 index 00000000..97f3e950 --- /dev/null +++ b/ocaml/Linear/index.html @@ -0,0 +1,7 @@ + +Linear (ocaml.Linear)

Module Linear

type label = Cmm.label
type instruction = {
  1. mutable desc : instruction_desc;
  2. mutable next : instruction;
  3. arg : Reg.t array;
  4. res : Reg.t array;
  5. dbg : Debuginfo.t;
  6. live : Reg.Set.t;
}
and instruction_desc =
  1. | Lprologue
  2. | Lend
  3. | Lop of Mach.operation
  4. | Lreloadretaddr
  5. | Lreturn
  6. | Llabel of label
  7. | Lbranch of label
  8. | Lcondbranch of Mach.test * label
  9. | Lcondbranch3 of label option * label option * label option
  10. | Lswitch of label array
  11. | Lentertrap
  12. | Ladjust_trap_depth of {
    1. delta_traps : int;
    }
  13. | Lpushtrap of {
    1. lbl_handler : label;
    }
  14. | Lpoptrap
  15. | Lraise of Lambda.raise_kind
val has_fallthrough : instruction_desc -> bool
val end_instr : instruction
val instr_cons : + instruction_desc -> + Reg.t array -> + Reg.t array -> + instruction -> + instruction
val invert_test : Mach.test -> Mach.test
type fundecl = {
  1. fun_name : string;
  2. fun_args : Reg.Set.t;
  3. fun_body : instruction;
  4. fun_fast : bool;
  5. fun_dbg : Debuginfo.t;
  6. fun_tailrec_entry_point_label : label;
  7. fun_contains_calls : bool;
  8. fun_num_stack_slots : int array;
  9. fun_frame_required : bool;
  10. fun_prologue_required : bool;
}
diff --git a/ocaml/Linear_format/index.html b/ocaml/Linear_format/index.html new file mode 100644 index 00000000..2bac637e --- /dev/null +++ b/ocaml/Linear_format/index.html @@ -0,0 +1,2 @@ + +Linear_format (ocaml.Linear_format)

Module Linear_format

type linear_item_info =
  1. | Func of Linear.fundecl
  2. | Data of Cmm.data_item list
type linear_unit_info = {
  1. mutable unit_name : string;
  2. mutable items : linear_item_info list;
  3. mutable for_pack : string option;
}
val save : string -> linear_unit_info -> unit
val restore : string -> linear_unit_info * Stdlib.Digest.t
diff --git a/ocaml/Linearize/index.html b/ocaml/Linearize/index.html new file mode 100644 index 00000000..ba309eb5 --- /dev/null +++ b/ocaml/Linearize/index.html @@ -0,0 +1,2 @@ + +Linearize (ocaml.Linearize)

Module Linearize

val fundecl : Mach.fundecl -> Linear.fundecl
diff --git a/ocaml/Linkage_name/Map/index.html b/ocaml/Linkage_name/Map/index.html new file mode 100644 index 00000000..c3d340e1 --- /dev/null +++ b/ocaml/Linkage_name/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Linkage_name.Map)

Module Linkage_name.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Linkage_name/Set/index.html b/ocaml/Linkage_name/Set/index.html new file mode 100644 index 00000000..cebb75b7 --- /dev/null +++ b/ocaml/Linkage_name/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Linkage_name.Set)

Module Linkage_name.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Linkage_name/T/index.html b/ocaml/Linkage_name/T/index.html new file mode 100644 index 00000000..9304e18f --- /dev/null +++ b/ocaml/Linkage_name/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Linkage_name.T)

Module Linkage_name.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Linkage_name/Tbl/index.html b/ocaml/Linkage_name/Tbl/index.html new file mode 100644 index 00000000..4db83684 --- /dev/null +++ b/ocaml/Linkage_name/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Linkage_name.Tbl)

Module Linkage_name.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Linkage_name/index.html b/ocaml/Linkage_name/index.html new file mode 100644 index 00000000..1ebd51fa --- /dev/null +++ b/ocaml/Linkage_name/index.html @@ -0,0 +1,2 @@ + +Linkage_name (ocaml.Linkage_name)

Module Linkage_name

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create : string -> t
val to_string : t -> string
diff --git a/ocaml/Linscan/index.html b/ocaml/Linscan/index.html new file mode 100644 index 00000000..f3c55fc2 --- /dev/null +++ b/ocaml/Linscan/index.html @@ -0,0 +1,2 @@ + +Linscan (ocaml.Linscan)

Module Linscan

val allocate_registers : Interval.result -> int array
diff --git a/ocaml/Liveness/index.html b/ocaml/Liveness/index.html new file mode 100644 index 00000000..565eeaf7 --- /dev/null +++ b/ocaml/Liveness/index.html @@ -0,0 +1,2 @@ + +Liveness (ocaml.Liveness)

Module Liveness

val fundecl : Mach.fundecl -> unit
diff --git a/ocaml/Load_path/Dir/index.html b/ocaml/Load_path/Dir/index.html new file mode 100644 index 00000000..78bbc87b --- /dev/null +++ b/ocaml/Load_path/Dir/index.html @@ -0,0 +1,2 @@ + +Dir (ocaml.Load_path.Dir)

Module Load_path.Dir

type t

Represent one directory in the load path.

val create : string -> t
val path : t -> string
val files : t -> string list

All the files in that directory. This doesn't include files in sub-directories of this directory.

val find : t -> string -> string option

find dir fn returns the full path to fn in dir.

val find_uncap : t -> string -> string option

As find, but search also for uncapitalized name, i.e. if name is Foo.ml, either /path/Foo.ml or /path/foo.ml may be returned.

diff --git a/ocaml/Load_path/index.html b/ocaml/Load_path/index.html new file mode 100644 index 00000000..d1d86539 --- /dev/null +++ b/ocaml/Load_path/index.html @@ -0,0 +1,5 @@ + +Load_path (ocaml.Load_path)

Module Load_path

Management of include directories.

This module offers a high level interface to locating files in the load path, which is constructed from -I command line flags and a few other parameters.

It makes the assumption that the contents of include directories doesn't change during the execution of the compiler.

val add_dir : string -> unit

Add a directory to the end of the load path (i.e. at lowest priority.)

val remove_dir : string -> unit

Remove a directory from the load path

val reset : unit -> unit

Remove all directories

module Dir : sig ... end
type auto_include_callback = + (Dir.t -> string -> string option) -> + string -> + string

The type of callback functions on for init ~auto_include

val no_auto_include : auto_include_callback

No automatic directory inclusion: misses in the load path raise Not_found as normal.

val init : auto_include:auto_include_callback -> string list -> unit

init l is the same as reset (); List.iter add_dir (List.rev l)

val auto_include_otherlibs : (string -> unit) -> auto_include_callback

auto_include_otherlibs alert is a callback function to be passed to Load_path.init and automatically adds -I +lib to the load path after calling alert lib.

val get_paths : unit -> string list

Return the list of directories passed to add_dir so far.

val find : string -> string

Locate a file in the load path. Raise Not_found if the file cannot be found. This function is optimized for the case where the filename is a basename, i.e. doesn't contain a directory separator.

val find_uncap : string -> string

Same as find, but search also for uncapitalized name, i.e. if name is Foo.ml, allow /path/Foo.ml and /path/foo.ml to match.

val add : Dir.t -> unit

Old name for append_dir

  • deprecated
val append_dir : Dir.t -> unit

append_dir d adds d to the end of the load path (i.e. at lowest priority.

val prepend_dir : Dir.t -> unit

prepend_dir d adds d to the start of the load path (i.e. at highest priority.

val get : unit -> Dir.t list

Same as get_paths (), except that it returns a Dir.t list.

diff --git a/ocaml/Local_store/index.html b/ocaml/Local_store/index.html new file mode 100644 index 00000000..f7031b80 --- /dev/null +++ b/ocaml/Local_store/index.html @@ -0,0 +1,2 @@ + +Local_store (ocaml.Local_store)

Module Local_store

This module provides some facilities for creating references (and hash tables) which can easily be snapshoted and restored to an arbitrary version.

It is used throughout the frontend (read: typechecker), to register all (well, hopefully) the global state. Thus making it easy for tools like Merlin to go back and forth typechecking different files.

Creators

val s_ref : 'a -> 'a ref

Similar to Stdlib.ref, except the allocated reference is registered into the store.

val s_table : ('a -> 'b) -> 'a -> 'b ref

Used to register hash tables. Those also need to be placed into refs to be easily swapped out, but one can't just "snapshot" the initial value to create fresh instances, so instead an initializer is required.

Use it like this:

let my_table = s_table Hashtbl.create 42

State management

Note: all the following functions are currently unused inside the compiler codebase. Merlin is their only user at the moment.

type store
val fresh : unit -> store

Returns a fresh instance of the store.

The first time this function is called, it snapshots the value of all the registered references, later calls to fresh will return instances initialized to those values.

val with_store : store -> (unit -> 'a) -> 'a

with_store s f resets all the registered references to the value they have in s for the run of f. If f updates any of the registered refs, s is updated to remember those changes.

val reset : unit -> unit

Resets all the references to the initial snapshot (i.e. to the same values that new instances start with).

val is_bound : unit -> bool

Returns true when a store is active (i.e. when called from the callback passed to with_store), false otherwise.

diff --git a/ocaml/Location/index.html b/ocaml/Location/index.html new file mode 100644 index 00000000..a7908f3b --- /dev/null +++ b/ocaml/Location/index.html @@ -0,0 +1,42 @@ + +Location (ocaml.Location)

Module Location

Source code locations (ranges of positions), used in parsetree.

Warning: this module is unstable and part of compiler-libs.

type t = Warnings.loc = {
  1. loc_start : Stdlib.Lexing.position;
  2. loc_end : Stdlib.Lexing.position;
  3. loc_ghost : bool;
}

Note on the use of Lexing.position in this module. If pos_fname = "", then use !input_name instead. If pos_lnum = -1, then pos_bol = 0. Use pos_cnum and re-parse the file to get the line and character numbers. Else all fields are correct.

val none : t

An arbitrary value of type t; describes an empty ghost range.

val is_none : t -> bool

True for Location.none, false any other location

val in_file : string -> t

Return an empty ghost range located in a given file.

val init : Stdlib.Lexing.lexbuf -> string -> unit

Set the file name and line number of the lexbuf to be the start of the named file.

val curr : Stdlib.Lexing.lexbuf -> t

Get the location of the current token from the lexbuf.

val symbol_rloc : unit -> t
val symbol_gloc : unit -> t
val rhs_loc : int -> t

rhs_loc n returns the location of the symbol at position n, starting at 1, in the current parser rule.

val rhs_interval : int -> int -> t
val get_pos_info : Stdlib.Lexing.position -> string * int * int

file, line, char

type 'a loc = {
  1. txt : 'a;
  2. loc : t;
}
val mknoloc : 'a -> 'a loc
val mkloc : 'a -> t -> 'a loc

Input info

val input_name : string ref
val input_lexbuf : Stdlib.Lexing.lexbuf option ref
val input_phrase_buffer : Stdlib.Buffer.t option ref

Toplevel-specific functions

val echo_eof : unit -> unit
val separate_new_message : Stdlib.Format.formatter -> unit
val reset : unit -> unit

Rewriting path

val rewrite_absolute_path : string -> string

rewrite_absolute_path path rewrites path to honor the BUILD_PATH_PREFIX_MAP variable if it is set. It does not check whether path is absolute or not. The result is as follows:

  • If BUILD_PATH_PREFIX_MAP is not set, just return path.
  • otherwise, rewrite using the mapping (and if there are no matching prefixes that will just return path).

See the BUILD_PATH_PREFIX_MAP spec

val rewrite_find_first_existing : string -> string option

rewrite_find_first_existing path uses a BUILD_PATH_PREFIX_MAP mapping and tries to find a source in mapping that maps to a result that exists in the file system. There are the following return values:

  • None, means either

    • BUILD_PATH_PREFIX_MAP is not set and path does not exists, or
    • no source prefixes of path in the mapping were found,
  • Some target, means target exists and either

    • BUILD_PATH_PREFIX_MAP is not set and target = path, or
    • target is the first file (in priority order) that path mapped to that exists in the file system.
  • Not_found raised, means some source prefixes in the map were found that matched path, but none of them existed in the file system. The caller should catch this and issue an appropriate error message.

See the BUILD_PATH_PREFIX_MAP spec

val rewrite_find_all_existing_dirs : string -> string list

rewrite_find_all_existing_dirs dir accumulates a list of existing directories, dirs, that are the result of mapping a potentially abstract directory, dir, over all the mapping pairs in the BUILD_PATH_PREFIX_MAP environment variable, if any. The list dirs will be in priority order (head as highest priority).

The possible results are:

  • [], means either

    • BUILD_PATH_PREFIX_MAP is not set and dir is not an existing directory, or
    • if set, then there were no matching prefixes of dir.
  • Some dirs, means dirs are the directories found. Either

    • BUILD_PATH_PREFIX_MAP is not set and dirs = [dir], or
    • it was set and dirs are the mapped existing directories.
  • Not_found raised, means some source prefixes in the map were found that matched dir, but none of mapping results were existing directories (possibly due to misconfiguration). The caller should catch this and issue an appropriate error message.

See the BUILD_PATH_PREFIX_MAP spec

val absolute_path : string -> string

absolute_path path first makes an absolute path, s from path, prepending the current working directory if path was relative. Then s is rewritten using rewrite_absolute_path. Finally the result is normalized by eliminating instances of '.' or '..'.

Printing locations

val show_filename : string -> string

In -absname mode, return the absolute path for this filename. Otherwise, returns the filename unchanged.

val print_filename : Stdlib.Format.formatter -> string -> unit
val print_loc : Stdlib.Format.formatter -> t -> unit
val print_locs : Stdlib.Format.formatter -> t list -> unit

Toplevel-specific location highlighting

val highlight_terminfo : + Stdlib.Lexing.lexbuf -> + Stdlib.Format.formatter -> + t list -> + unit

Reporting errors and warnings

The type of reports and report printers

type msg = (Stdlib.Format.formatter -> unit) loc
val msg : ?loc:t -> ('a, Stdlib.Format.formatter, unit, msg) format4 -> 'a
type report_kind =
  1. | Report_error
  2. | Report_warning of string
  3. | Report_warning_as_error of string
  4. | Report_alert of string
  5. | Report_alert_as_error of string
type report = {
  1. kind : report_kind;
  2. main : msg;
  3. sub : msg list;
}
type report_printer = {
  1. pp : report_printer -> Stdlib.Format.formatter -> report -> unit;
  2. pp_report_kind : report_printer -> + report -> + Stdlib.Format.formatter -> + report_kind -> + unit;
  3. pp_main_loc : report_printer -> report -> Stdlib.Format.formatter -> t -> unit;
  4. pp_main_txt : report_printer -> + report -> + Stdlib.Format.formatter -> + (Stdlib.Format.formatter -> unit) -> + unit;
  5. pp_submsgs : report_printer -> + report -> + Stdlib.Format.formatter -> + msg list -> + unit;
  6. pp_submsg : report_printer -> report -> Stdlib.Format.formatter -> msg -> unit;
  7. pp_submsg_loc : report_printer -> + report -> + Stdlib.Format.formatter -> + t -> + unit;
  8. pp_submsg_txt : report_printer -> + report -> + Stdlib.Format.formatter -> + (Stdlib.Format.formatter -> unit) -> + unit;
}

A printer for reports, defined using open-recursion. The goal is to make it easy to define new printers by re-using code from existing ones.

Report printers used in the compiler

val batch_mode_printer : report_printer
val terminfo_toplevel_printer : Stdlib.Lexing.lexbuf -> report_printer
val best_toplevel_printer : unit -> report_printer

Detects the terminal capabilities and selects an adequate printer

Printing a report

val print_report : Stdlib.Format.formatter -> report -> unit

Display an error or warning report.

val report_printer : (unit -> report_printer) ref

Hook for redefining the printer of reports.

The hook is a unit -> report_printer and not simply a report_printer: this is useful so that it can detect the type of the output (a file, a terminal, ...) and select a printer accordingly.

val default_report_printer : unit -> report_printer

Original report printer for use in hooks.

Reporting warnings

Converting a Warnings.t into a report

val report_warning : t -> Warnings.t -> report option

report_warning loc w produces a report for the given warning w, or None if the warning is not to be printed.

val warning_reporter : (t -> Warnings.t -> report option) ref

Hook for intercepting warnings.

val default_warning_reporter : t -> Warnings.t -> report option

Original warning reporter for use in hooks.

Printing warnings

val formatter_for_warnings : Stdlib.Format.formatter ref
val print_warning : t -> Stdlib.Format.formatter -> Warnings.t -> unit

Prints a warning. This is simply the composition of report_warning and print_report.

val prerr_warning : t -> Warnings.t -> unit

Same as print_warning, but uses !formatter_for_warnings as output formatter.

Reporting alerts

Converting an Alert.t into a report

val report_alert : t -> Warnings.alert -> report option

report_alert loc w produces a report for the given alert w, or None if the alert is not to be printed.

val alert_reporter : (t -> Warnings.alert -> report option) ref

Hook for intercepting alerts.

val default_alert_reporter : t -> Warnings.alert -> report option

Original alert reporter for use in hooks.

Printing alerts

val print_alert : t -> Stdlib.Format.formatter -> Warnings.alert -> unit

Prints an alert. This is simply the composition of report_alert and print_report.

val prerr_alert : t -> Warnings.alert -> unit

Same as print_alert, but uses !formatter_for_warnings as output formatter.

val deprecated : ?def:t -> ?use:t -> t -> string -> unit

Prints a deprecation alert.

val alert : ?def:t -> ?use:t -> kind:string -> t -> string -> unit

Prints an arbitrary alert.

val auto_include_alert : string -> unit

Prints an alert that -I +lib has been automatically added to the load path

val deprecated_script_alert : string -> unit

deprecated_script_alert command prints an alert that command foo has been deprecated in favour of command ./foo

Reporting errors

type error = report

An error is a report which report_kind must be Report_error.

val error : ?loc:t -> ?sub:msg list -> string -> error
val errorf : + ?loc:t -> + ?sub:msg list -> + ('a, Stdlib.Format.formatter, unit, error) format4 -> + 'a
val error_of_printer : + ?loc:t -> + ?sub:msg list -> + (Stdlib.Format.formatter -> 'a -> unit) -> + 'a -> + error
val error_of_printer_file : + (Stdlib.Format.formatter -> 'a -> unit) -> + 'a -> + error

Automatically reporting errors for raised exceptions

val register_error_of_exn : (exn -> error option) -> unit

Each compiler module which defines a custom type of exception which can surface as a user-visible error should register a "printer" for this exception using register_error_of_exn. The result of the printer is an error value containing a location, a message, and optionally sub-messages (each of them being located as well).

val error_of_exn : exn -> [ `Ok of error | `Already_displayed ] option
exception Error of error

Raising Error e signals an error e; the exception will be caught and the error will be printed.

exception Already_displayed_error

Raising Already_displayed_error signals an error which has already been printed. The exception will be caught, but nothing will be printed

val raise_errorf : + ?loc:t -> + ?sub:msg list -> + ('a, Stdlib.Format.formatter, unit, 'b) format4 -> + 'a
val report_exception : Stdlib.Format.formatter -> exn -> unit

Reraise the exception if it is unknown.

diff --git a/ocaml/Longident/index.html b/ocaml/Longident/index.html new file mode 100644 index 00000000..e6d9c301 --- /dev/null +++ b/ocaml/Longident/index.html @@ -0,0 +1,3 @@ + +Longident (ocaml.Longident)

Module Longident

Long identifiers, used in parsetree.

Warning: this module is unstable and part of compiler-libs.

To print a longident, see Pprintast.longident, using Format.asprintf to convert to a string.

type t =
  1. | Lident of string
  2. | Ldot of t * string
  3. | Lapply of t * t
val flatten : t -> string list
val unflatten : string list -> t option

For a non-empty list l, unflatten l is Some lid where lid is the long identifier created by concatenating the elements of l with Ldot. unflatten [] is None.

val last : t -> string
val parse : string -> t

This function is broken on identifiers that are not just "Word.Word.word"; for example, it returns incorrect results on infix operators and extended module paths.

If you want to generate long identifiers that are a list of dot-separated identifiers, the function unflatten is safer and faster. unflatten is available since OCaml 4.06.0.

If you want to parse any identifier correctly, use the long-identifiers functions from the Parse module, in particular Parse.longident. They are available since OCaml 4.11, and also provide proper input-location support.

  • deprecated this function may misparse its input, +use "Parse.longident" or "Longident.unflatten"
diff --git a/ocaml/Mach/index.html b/ocaml/Mach/index.html new file mode 100644 index 00000000..9390d0ef --- /dev/null +++ b/ocaml/Mach/index.html @@ -0,0 +1,13 @@ + +Mach (ocaml.Mach)

Module Mach

type integer_comparison =
  1. | Isigned of Cmm.integer_comparison
  2. | Iunsigned of Cmm.integer_comparison
type integer_operation =
  1. | Iadd
  2. | Isub
  3. | Imul
  4. | Imulh
  5. | Idiv
  6. | Imod
  7. | Iand
  8. | Ior
  9. | Ixor
  10. | Ilsl
  11. | Ilsr
  12. | Iasr
  13. | Icomp of integer_comparison
  14. | Icheckbound
type float_comparison = Cmm.float_comparison
type test =
  1. | Itruetest
  2. | Ifalsetest
  3. | Iinttest of integer_comparison
  4. | Iinttest_imm of integer_comparison * int
  5. | Ifloattest of float_comparison
  6. | Ioddtest
  7. | Ieventest
type operation =
  1. | Imove
  2. | Ispill
  3. | Ireload
  4. | Iconst_int of nativeint
  5. | Iconst_float of int64
  6. | Iconst_symbol of string
  7. | Icall_ind
  8. | Icall_imm of {
    1. func : string;
    }
  9. | Itailcall_ind
  10. | Itailcall_imm of {
    1. func : string;
    }
  11. | Iextcall of {
    1. func : string;
    2. ty_res : Cmm.machtype;
    3. ty_args : Cmm.exttype list;
    4. alloc : bool;
    5. stack_ofs : int;
    }
  12. | Istackoffset of int
  13. | Iload of {
    1. memory_chunk : Cmm.memory_chunk;
    2. addressing_mode : Arch.addressing_mode;
    3. mutability : Asttypes.mutable_flag;
    4. is_atomic : bool;
    }
  14. | Istore of Cmm.memory_chunk * Arch.addressing_mode * bool
  15. | Ialloc of {
    1. bytes : int;
    2. dbginfo : Debuginfo.alloc_dbginfo;
    }
  16. | Iintop of integer_operation
  17. | Iintop_imm of integer_operation * int
  18. | Icompf of float_comparison
  19. | Inegf
  20. | Iabsf
  21. | Iaddf
  22. | Isubf
  23. | Imulf
  24. | Idivf
  25. | Ifloatofint
  26. | Iintoffloat
  27. | Iopaque
  28. | Ispecific of Arch.specific_operation
  29. | Ipoll of {
    1. return_label : Cmm.label option;
    }
  30. | Idls_get
type instruction = {
  1. desc : instruction_desc;
  2. next : instruction;
  3. arg : Reg.t array;
  4. res : Reg.t array;
  5. dbg : Debuginfo.t;
  6. mutable live : Reg.Set.t;
}
and instruction_desc =
  1. | Iend
  2. | Iop of operation
  3. | Ireturn
  4. | Iifthenelse of test * instruction * instruction
  5. | Iswitch of int array * instruction array
  6. | Icatch of Cmm.rec_flag * (int * instruction) list * instruction
  7. | Iexit of int
  8. | Itrywith of instruction * instruction
  9. | Iraise of Lambda.raise_kind
type fundecl = {
  1. fun_name : string;
  2. fun_args : Reg.t array;
  3. fun_body : instruction;
  4. fun_codegen_options : Cmm.codegen_option list;
  5. fun_dbg : Debuginfo.t;
  6. fun_poll : Lambda.poll_attribute;
  7. fun_num_stack_slots : int array;
  8. fun_contains_calls : bool;
}
val dummy_instr : instruction
val end_instr : unit -> instruction
val instr_cons : + instruction_desc -> + Reg.t array -> + Reg.t array -> + instruction -> + instruction
val instr_cons_debug : + instruction_desc -> + Reg.t array -> + Reg.t array -> + Debuginfo.t -> + instruction -> + instruction
val instr_iter : (instruction -> unit) -> instruction -> unit
val operation_is_pure : operation -> bool

Returns true if the given operation only produces a result in its destination registers, but has no side effects whatsoever: it doesn't raise exceptions, it doesn't modify already-allocated blocks, it doesn't adjust the stack frame, etc.

val operation_can_raise : operation -> bool

Returns true if the given operation can raise an exception.

diff --git a/ocaml/Main/index.html b/ocaml/Main/index.html new file mode 100644 index 00000000..6b5bdb14 --- /dev/null +++ b/ocaml/Main/index.html @@ -0,0 +1,2 @@ + +Main (ocaml.Main)

Module Main

diff --git a/ocaml/Main_args/Default/Main/index.html b/ocaml/Main_args/Default/Main/index.html new file mode 100644 index 00000000..67711ef7 --- /dev/null +++ b/ocaml/Main_args/Default/Main/index.html @@ -0,0 +1,2 @@ + +Main (ocaml.Main_args.Default.Main)

Module Default.Main

include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
include Compiler_options
val _a : unit -> unit
val _annot : unit -> unit
val _binannot : unit -> unit
val _c : unit -> unit
val _cc : string -> unit
val _cclib : string -> unit
val _ccopt : string -> unit
val _cmi_file : string -> unit
val _config : unit -> unit
val _config_var : string -> unit
val _for_pack : string -> unit
val _g : unit -> unit
val _no_g : unit -> unit
val _stop_after : string -> unit
val _i : unit -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _keep_docs : unit -> unit
val _no_keep_docs : unit -> unit
val _keep_locs : unit -> unit
val _no_keep_locs : unit -> unit
val _linkall : unit -> unit
val _o : string -> unit
val _opaque : unit -> unit
val _output_obj : unit -> unit
val _output_complete_obj : unit -> unit
val _pack : unit -> unit
val _plugin : string -> unit
val _pp : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _runtime_variant : string -> unit
val _with_runtime : unit -> unit
val _without_runtime : unit -> unit
val _short_paths : unit -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
val _color : string -> unit
val _error_style : string -> unit
val _match_context_rows : int -> unit
val _dtimings : unit -> unit
val _dprofile : unit -> unit
val _dump_into_file : unit -> unit
val _dump_dir : string -> unit
val _args : string -> string array
val _args0 : string -> string array
val _compat_32 : unit -> unit
val _custom : unit -> unit
val _no_check_prims : unit -> unit
val _dllib : string -> unit
val _dllpath : string -> unit
val _make_runtime : unit -> unit
val _vmthread : unit -> unit
val _use_runtime : string -> unit
val _output_complete_exe : unit -> unit
val _dinstr : unit -> unit
val _dcamlprimc : unit -> unit
val _use_prims : string -> unit
diff --git a/ocaml/Main_args/Default/Odoc_args/index.html b/ocaml/Main_args/Default/Odoc_args/index.html new file mode 100644 index 00000000..05199b56 --- /dev/null +++ b/ocaml/Main_args/Default/Odoc_args/index.html @@ -0,0 +1,2 @@ + +Odoc_args (ocaml.Main_args.Default.Odoc_args)

Module Default.Odoc_args

include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _pp : string -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _vmthread : unit -> unit
diff --git a/ocaml/Main_args/Default/Optmain/index.html b/ocaml/Main_args/Default/Optmain/index.html new file mode 100644 index 00000000..e840fd3c --- /dev/null +++ b/ocaml/Main_args/Default/Optmain/index.html @@ -0,0 +1,2 @@ + +Optmain (ocaml.Main_args.Default.Optmain)

Module Default.Optmain

include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
include Compiler_options
val _a : unit -> unit
val _annot : unit -> unit
val _binannot : unit -> unit
val _c : unit -> unit
val _cc : string -> unit
val _cclib : string -> unit
val _ccopt : string -> unit
val _cmi_file : string -> unit
val _config : unit -> unit
val _config_var : string -> unit
val _for_pack : string -> unit
val _g : unit -> unit
val _no_g : unit -> unit
val _stop_after : string -> unit
val _i : unit -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _keep_docs : unit -> unit
val _no_keep_docs : unit -> unit
val _keep_locs : unit -> unit
val _no_keep_locs : unit -> unit
val _linkall : unit -> unit
val _o : string -> unit
val _opaque : unit -> unit
val _output_obj : unit -> unit
val _output_complete_obj : unit -> unit
val _pack : unit -> unit
val _plugin : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _runtime_variant : string -> unit
val _with_runtime : unit -> unit
val _without_runtime : unit -> unit
val _short_paths : unit -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
val _color : string -> unit
val _error_style : string -> unit
val _match_context_rows : int -> unit
val _dtimings : unit -> unit
val _dprofile : unit -> unit
val _dump_into_file : unit -> unit
val _dump_dir : string -> unit
val _args : string -> string array
val _args0 : string -> string array
include Optcommon_options
val _compact : unit -> unit
val _inline : string -> unit
val _inline_toplevel : string -> unit
val _inlining_report : unit -> unit
val _dump_pass : string -> unit
val _inline_max_depth : string -> unit
val _rounds : int -> unit
val _inline_max_unroll : string -> unit
val _classic_inlining : unit -> unit
val _inline_call_cost : string -> unit
val _inline_alloc_cost : string -> unit
val _inline_prim_cost : string -> unit
val _inline_branch_cost : string -> unit
val _inline_indirect_cost : string -> unit
val _inline_lifting_benefit : string -> unit
val _unbox_closures : unit -> unit
val _unbox_closures_factor : int -> unit
val _inline_branch_factor : string -> unit
val _remove_unused_arguments : unit -> unit
val _no_unbox_free_vars_of_closures : unit -> unit
val _no_unbox_specialised_args : unit -> unit
val _o2 : unit -> unit
val _o3 : unit -> unit
val _insn_sched : unit -> unit
val _no_insn_sched : unit -> unit
val _linscan : unit -> unit
val _no_float_const_prop : unit -> unit
val _clambda_checks : unit -> unit
val _dflambda : unit -> unit
val _drawflambda : unit -> unit
val _dflambda_invariants : unit -> unit
val _dflambda_no_invariants : unit -> unit
val _dflambda_let : int -> unit
val _dflambda_verbose : unit -> unit
val _drawclambda : unit -> unit
val _dclambda : unit -> unit
val _dcmm_invariants : unit -> unit
val _dcmm : unit -> unit
val _dsel : unit -> unit
val _dcombine : unit -> unit
val _dcse : unit -> unit
val _dlive : unit -> unit
val _dspill : unit -> unit
val _dsplit : unit -> unit
val _dinterf : unit -> unit
val _dprefer : unit -> unit
val _dalloc : unit -> unit
val _dreload : unit -> unit
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dinterval : unit -> unit
val _dstartup : unit -> unit
val _p : unit -> unit
val _pp : string -> unit
val _S : unit -> unit
val _shared : unit -> unit
val _afl_instrument : unit -> unit
val _afl_inst_ratio : int -> unit
val _function_sections : unit -> unit
val _save_ir_after : string -> unit
diff --git a/ocaml/Main_args/Default/Opttopmain/index.html b/ocaml/Main_args/Default/Opttopmain/index.html new file mode 100644 index 00000000..e83c58ba --- /dev/null +++ b/ocaml/Main_args/Default/Opttopmain/index.html @@ -0,0 +1,2 @@ + +Opttopmain (ocaml.Main_args.Default.Opttopmain)

Module Default.Opttopmain

include Toplevel_options
include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
val _init : string -> unit
val _noinit : unit -> unit
val _no_version : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
val _stdin : unit -> unit
val _args : string -> string array
val _args0 : string -> string array
val _color : string -> unit
val _error_style : string -> unit
val _eval : string -> unit
include Optcommon_options
val _compact : unit -> unit
val _inline : string -> unit
val _inline_toplevel : string -> unit
val _inlining_report : unit -> unit
val _dump_pass : string -> unit
val _inline_max_depth : string -> unit
val _rounds : int -> unit
val _inline_max_unroll : string -> unit
val _classic_inlining : unit -> unit
val _inline_call_cost : string -> unit
val _inline_alloc_cost : string -> unit
val _inline_prim_cost : string -> unit
val _inline_branch_cost : string -> unit
val _inline_indirect_cost : string -> unit
val _inline_lifting_benefit : string -> unit
val _unbox_closures : unit -> unit
val _unbox_closures_factor : int -> unit
val _inline_branch_factor : string -> unit
val _remove_unused_arguments : unit -> unit
val _no_unbox_free_vars_of_closures : unit -> unit
val _no_unbox_specialised_args : unit -> unit
val _o2 : unit -> unit
val _o3 : unit -> unit
val _insn_sched : unit -> unit
val _no_insn_sched : unit -> unit
val _linscan : unit -> unit
val _no_float_const_prop : unit -> unit
val _clambda_checks : unit -> unit
val _dflambda : unit -> unit
val _drawflambda : unit -> unit
val _dflambda_invariants : unit -> unit
val _dflambda_no_invariants : unit -> unit
val _dflambda_let : int -> unit
val _dflambda_verbose : unit -> unit
val _drawclambda : unit -> unit
val _dclambda : unit -> unit
val _dcmm_invariants : unit -> unit
val _dcmm : unit -> unit
val _dsel : unit -> unit
val _dcombine : unit -> unit
val _dcse : unit -> unit
val _dlive : unit -> unit
val _dspill : unit -> unit
val _dsplit : unit -> unit
val _dinterf : unit -> unit
val _dprefer : unit -> unit
val _dalloc : unit -> unit
val _dreload : unit -> unit
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dinterval : unit -> unit
val _dstartup : unit -> unit
val _verbose : unit -> unit
val _S : unit -> unit
diff --git a/ocaml/Main_args/Default/Topmain/index.html b/ocaml/Main_args/Default/Topmain/index.html new file mode 100644 index 00000000..07662ab9 --- /dev/null +++ b/ocaml/Main_args/Default/Topmain/index.html @@ -0,0 +1,2 @@ + +Topmain (ocaml.Main_args.Default.Topmain)

Module Default.Topmain

include Toplevel_options
include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
val _init : string -> unit
val _noinit : unit -> unit
val _no_version : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
val _stdin : unit -> unit
val _args : string -> string array
val _args0 : string -> string array
val _color : string -> unit
val _error_style : string -> unit
val _eval : string -> unit
val _dinstr : unit -> unit
diff --git a/ocaml/Main_args/Default/index.html b/ocaml/Main_args/Default/index.html new file mode 100644 index 00000000..bae9e916 --- /dev/null +++ b/ocaml/Main_args/Default/index.html @@ -0,0 +1,2 @@ + +Default (ocaml.Main_args.Default)

Module Main_args.Default

diff --git a/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html b/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html new file mode 100644 index 00000000..62ced327 --- /dev/null +++ b/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Main_args.Make_bytecomp_options._)

Parameter Make_bytecomp_options._

include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
include Compiler_options
val _a : unit -> unit
val _annot : unit -> unit
val _binannot : unit -> unit
val _c : unit -> unit
val _cc : string -> unit
val _cclib : string -> unit
val _ccopt : string -> unit
val _cmi_file : string -> unit
val _config : unit -> unit
val _config_var : string -> unit
val _for_pack : string -> unit
val _g : unit -> unit
val _no_g : unit -> unit
val _stop_after : string -> unit
val _i : unit -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _keep_docs : unit -> unit
val _no_keep_docs : unit -> unit
val _keep_locs : unit -> unit
val _no_keep_locs : unit -> unit
val _linkall : unit -> unit
val _o : string -> unit
val _opaque : unit -> unit
val _output_obj : unit -> unit
val _output_complete_obj : unit -> unit
val _pack : unit -> unit
val _plugin : string -> unit
val _pp : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _runtime_variant : string -> unit
val _with_runtime : unit -> unit
val _without_runtime : unit -> unit
val _short_paths : unit -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
val _color : string -> unit
val _error_style : string -> unit
val _match_context_rows : int -> unit
val _dtimings : unit -> unit
val _dprofile : unit -> unit
val _dump_into_file : unit -> unit
val _dump_dir : string -> unit
val _args : string -> string array
val _args0 : string -> string array
val _compat_32 : unit -> unit
val _custom : unit -> unit
val _no_check_prims : unit -> unit
val _dllib : string -> unit
val _dllpath : string -> unit
val _make_runtime : unit -> unit
val _vmthread : unit -> unit
val _use_runtime : string -> unit
val _output_complete_exe : unit -> unit
val _dinstr : unit -> unit
val _dcamlprimc : unit -> unit
val _use_prims : string -> unit
diff --git a/ocaml/Main_args/Make_bytecomp_options/index.html b/ocaml/Main_args/Make_bytecomp_options/index.html new file mode 100644 index 00000000..cb4d3b8e --- /dev/null +++ b/ocaml/Main_args/Make_bytecomp_options/index.html @@ -0,0 +1,2 @@ + +Make_bytecomp_options (ocaml.Main_args.Make_bytecomp_options)

Module Main_args.Make_bytecomp_options

Parameters

Signature

val list : (string * Stdlib.Arg.spec * string) list
diff --git a/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html b/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html new file mode 100644 index 00000000..7554e09a --- /dev/null +++ b/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Main_args.Make_bytetop_options._)

Parameter Make_bytetop_options._

include Toplevel_options
include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
val _init : string -> unit
val _noinit : unit -> unit
val _no_version : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
val _stdin : unit -> unit
val _args : string -> string array
val _args0 : string -> string array
val _color : string -> unit
val _error_style : string -> unit
val _eval : string -> unit
val _dinstr : unit -> unit
diff --git a/ocaml/Main_args/Make_bytetop_options/index.html b/ocaml/Main_args/Make_bytetop_options/index.html new file mode 100644 index 00000000..a21f6758 --- /dev/null +++ b/ocaml/Main_args/Make_bytetop_options/index.html @@ -0,0 +1,2 @@ + +Make_bytetop_options (ocaml.Main_args.Make_bytetop_options)

Module Main_args.Make_bytetop_options

Parameters

Signature

val list : (string * Stdlib.Arg.spec * string) list
diff --git a/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html b/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html new file mode 100644 index 00000000..29cf3602 --- /dev/null +++ b/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Main_args.Make_ocamldoc_options._)

Parameter Make_ocamldoc_options._

include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _pp : string -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _vmthread : unit -> unit
diff --git a/ocaml/Main_args/Make_ocamldoc_options/index.html b/ocaml/Main_args/Make_ocamldoc_options/index.html new file mode 100644 index 00000000..a2700725 --- /dev/null +++ b/ocaml/Main_args/Make_ocamldoc_options/index.html @@ -0,0 +1,2 @@ + +Make_ocamldoc_options (ocaml.Main_args.Make_ocamldoc_options)

Module Main_args.Make_ocamldoc_options

Parameters

Signature

val list : (string * Stdlib.Arg.spec * string) list
diff --git a/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html b/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html new file mode 100644 index 00000000..24112417 --- /dev/null +++ b/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Main_args.Make_optcomp_options._)

Parameter Make_optcomp_options._

include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
include Compiler_options
val _a : unit -> unit
val _annot : unit -> unit
val _binannot : unit -> unit
val _c : unit -> unit
val _cc : string -> unit
val _cclib : string -> unit
val _ccopt : string -> unit
val _cmi_file : string -> unit
val _config : unit -> unit
val _config_var : string -> unit
val _for_pack : string -> unit
val _g : unit -> unit
val _no_g : unit -> unit
val _stop_after : string -> unit
val _i : unit -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _keep_docs : unit -> unit
val _no_keep_docs : unit -> unit
val _keep_locs : unit -> unit
val _no_keep_locs : unit -> unit
val _linkall : unit -> unit
val _o : string -> unit
val _opaque : unit -> unit
val _output_obj : unit -> unit
val _output_complete_obj : unit -> unit
val _pack : unit -> unit
val _plugin : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _runtime_variant : string -> unit
val _with_runtime : unit -> unit
val _without_runtime : unit -> unit
val _short_paths : unit -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
val _color : string -> unit
val _error_style : string -> unit
val _match_context_rows : int -> unit
val _dtimings : unit -> unit
val _dprofile : unit -> unit
val _dump_into_file : unit -> unit
val _dump_dir : string -> unit
val _args : string -> string array
val _args0 : string -> string array
include Optcommon_options
val _compact : unit -> unit
val _inline : string -> unit
val _inline_toplevel : string -> unit
val _inlining_report : unit -> unit
val _dump_pass : string -> unit
val _inline_max_depth : string -> unit
val _rounds : int -> unit
val _inline_max_unroll : string -> unit
val _classic_inlining : unit -> unit
val _inline_call_cost : string -> unit
val _inline_alloc_cost : string -> unit
val _inline_prim_cost : string -> unit
val _inline_branch_cost : string -> unit
val _inline_indirect_cost : string -> unit
val _inline_lifting_benefit : string -> unit
val _unbox_closures : unit -> unit
val _unbox_closures_factor : int -> unit
val _inline_branch_factor : string -> unit
val _remove_unused_arguments : unit -> unit
val _no_unbox_free_vars_of_closures : unit -> unit
val _no_unbox_specialised_args : unit -> unit
val _o2 : unit -> unit
val _o3 : unit -> unit
val _insn_sched : unit -> unit
val _no_insn_sched : unit -> unit
val _linscan : unit -> unit
val _no_float_const_prop : unit -> unit
val _clambda_checks : unit -> unit
val _dflambda : unit -> unit
val _drawflambda : unit -> unit
val _dflambda_invariants : unit -> unit
val _dflambda_no_invariants : unit -> unit
val _dflambda_let : int -> unit
val _dflambda_verbose : unit -> unit
val _drawclambda : unit -> unit
val _dclambda : unit -> unit
val _dcmm_invariants : unit -> unit
val _dcmm : unit -> unit
val _dsel : unit -> unit
val _dcombine : unit -> unit
val _dcse : unit -> unit
val _dlive : unit -> unit
val _dspill : unit -> unit
val _dsplit : unit -> unit
val _dinterf : unit -> unit
val _dprefer : unit -> unit
val _dalloc : unit -> unit
val _dreload : unit -> unit
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dinterval : unit -> unit
val _dstartup : unit -> unit
val _p : unit -> unit
val _pp : string -> unit
val _S : unit -> unit
val _shared : unit -> unit
val _afl_instrument : unit -> unit
val _afl_inst_ratio : int -> unit
val _function_sections : unit -> unit
val _save_ir_after : string -> unit
diff --git a/ocaml/Main_args/Make_optcomp_options/index.html b/ocaml/Main_args/Make_optcomp_options/index.html new file mode 100644 index 00000000..57ae64b1 --- /dev/null +++ b/ocaml/Main_args/Make_optcomp_options/index.html @@ -0,0 +1,2 @@ + +Make_optcomp_options (ocaml.Main_args.Make_optcomp_options)

Module Main_args.Make_optcomp_options

Parameters

Signature

val list : (string * Stdlib.Arg.spec * string) list
diff --git a/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html b/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html new file mode 100644 index 00000000..bfc2c642 --- /dev/null +++ b/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Main_args.Make_opttop_options._)

Parameter Make_opttop_options._

include Toplevel_options
include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
val _init : string -> unit
val _noinit : unit -> unit
val _no_version : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
val _stdin : unit -> unit
val _args : string -> string array
val _args0 : string -> string array
val _color : string -> unit
val _error_style : string -> unit
val _eval : string -> unit
include Optcommon_options
val _compact : unit -> unit
val _inline : string -> unit
val _inline_toplevel : string -> unit
val _inlining_report : unit -> unit
val _dump_pass : string -> unit
val _inline_max_depth : string -> unit
val _rounds : int -> unit
val _inline_max_unroll : string -> unit
val _classic_inlining : unit -> unit
val _inline_call_cost : string -> unit
val _inline_alloc_cost : string -> unit
val _inline_prim_cost : string -> unit
val _inline_branch_cost : string -> unit
val _inline_indirect_cost : string -> unit
val _inline_lifting_benefit : string -> unit
val _unbox_closures : unit -> unit
val _unbox_closures_factor : int -> unit
val _inline_branch_factor : string -> unit
val _remove_unused_arguments : unit -> unit
val _no_unbox_free_vars_of_closures : unit -> unit
val _no_unbox_specialised_args : unit -> unit
val _o2 : unit -> unit
val _o3 : unit -> unit
val _insn_sched : unit -> unit
val _no_insn_sched : unit -> unit
val _linscan : unit -> unit
val _no_float_const_prop : unit -> unit
val _clambda_checks : unit -> unit
val _dflambda : unit -> unit
val _drawflambda : unit -> unit
val _dflambda_invariants : unit -> unit
val _dflambda_no_invariants : unit -> unit
val _dflambda_let : int -> unit
val _dflambda_verbose : unit -> unit
val _drawclambda : unit -> unit
val _dclambda : unit -> unit
val _dcmm_invariants : unit -> unit
val _dcmm : unit -> unit
val _dsel : unit -> unit
val _dcombine : unit -> unit
val _dcse : unit -> unit
val _dlive : unit -> unit
val _dspill : unit -> unit
val _dsplit : unit -> unit
val _dinterf : unit -> unit
val _dprefer : unit -> unit
val _dalloc : unit -> unit
val _dreload : unit -> unit
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dinterval : unit -> unit
val _dstartup : unit -> unit
val _verbose : unit -> unit
val _S : unit -> unit
diff --git a/ocaml/Main_args/Make_opttop_options/index.html b/ocaml/Main_args/Make_opttop_options/index.html new file mode 100644 index 00000000..ad4039f5 --- /dev/null +++ b/ocaml/Main_args/Make_opttop_options/index.html @@ -0,0 +1,2 @@ + +Make_opttop_options (ocaml.Main_args.Make_opttop_options)

Module Main_args.Make_opttop_options

Parameters

module _ : Opttop_options

Signature

val list : (string * Stdlib.Arg.spec * string) list
diff --git a/ocaml/Main_args/index.html b/ocaml/Main_args/index.html new file mode 100644 index 00000000..55bf9c20 --- /dev/null +++ b/ocaml/Main_args/index.html @@ -0,0 +1,5 @@ + +Main_args (ocaml.Main_args)

Module Main_args

module type Common_options = sig ... end
module type Core_options = sig ... end
module type Compiler_options = sig ... end
module type Toplevel_options = sig ... end
module type Bytecomp_options = sig ... end
module type Bytetop_options = sig ... end
module type Optcommon_options = sig ... end
module type Optcomp_options = sig ... end
module type Opttop_options = sig ... end
module type Ocamldoc_options = sig ... end
module type Arg_list = sig ... end
val options_with_command_line_syntax : + (string * Stdlib.Arg.spec * string) list -> + string list ref -> + (string * Stdlib.Arg.spec * string) list

options_with_command_line_syntax options r returns options2 that behaves like options, but additionally pushes command line argument on r (quoted by Filename.quote when necessary). This is meant for ocamlc,optp, which use this to forward most of their arguments to ocamlc,opt.

module Default : sig ... end
diff --git a/ocaml/Main_args/module-type-Arg_list/index.html b/ocaml/Main_args/module-type-Arg_list/index.html new file mode 100644 index 00000000..4515c9e5 --- /dev/null +++ b/ocaml/Main_args/module-type-Arg_list/index.html @@ -0,0 +1,2 @@ + +Arg_list (ocaml.Main_args.Arg_list)

Module type Main_args.Arg_list

val list : (string * Stdlib.Arg.spec * string) list
diff --git a/ocaml/Main_args/module-type-Bytecomp_options/index.html b/ocaml/Main_args/module-type-Bytecomp_options/index.html new file mode 100644 index 00000000..24052fd2 --- /dev/null +++ b/ocaml/Main_args/module-type-Bytecomp_options/index.html @@ -0,0 +1,2 @@ + +Bytecomp_options (ocaml.Main_args.Bytecomp_options)

Module type Main_args.Bytecomp_options

include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
include Compiler_options
val _a : unit -> unit
val _annot : unit -> unit
val _binannot : unit -> unit
val _c : unit -> unit
val _cc : string -> unit
val _cclib : string -> unit
val _ccopt : string -> unit
val _cmi_file : string -> unit
val _config : unit -> unit
val _config_var : string -> unit
val _for_pack : string -> unit
val _g : unit -> unit
val _no_g : unit -> unit
val _stop_after : string -> unit
val _i : unit -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _keep_docs : unit -> unit
val _no_keep_docs : unit -> unit
val _keep_locs : unit -> unit
val _no_keep_locs : unit -> unit
val _linkall : unit -> unit
val _o : string -> unit
val _opaque : unit -> unit
val _output_obj : unit -> unit
val _output_complete_obj : unit -> unit
val _pack : unit -> unit
val _plugin : string -> unit
val _pp : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _runtime_variant : string -> unit
val _with_runtime : unit -> unit
val _without_runtime : unit -> unit
val _short_paths : unit -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
val _color : string -> unit
val _error_style : string -> unit
val _match_context_rows : int -> unit
val _dtimings : unit -> unit
val _dprofile : unit -> unit
val _dump_into_file : unit -> unit
val _dump_dir : string -> unit
val _args : string -> string array
val _args0 : string -> string array
val _compat_32 : unit -> unit
val _custom : unit -> unit
val _no_check_prims : unit -> unit
val _dllib : string -> unit
val _dllpath : string -> unit
val _make_runtime : unit -> unit
val _vmthread : unit -> unit
val _use_runtime : string -> unit
val _output_complete_exe : unit -> unit
val _dinstr : unit -> unit
val _dcamlprimc : unit -> unit
val _use_prims : string -> unit
diff --git a/ocaml/Main_args/module-type-Bytetop_options/index.html b/ocaml/Main_args/module-type-Bytetop_options/index.html new file mode 100644 index 00000000..284e537b --- /dev/null +++ b/ocaml/Main_args/module-type-Bytetop_options/index.html @@ -0,0 +1,2 @@ + +Bytetop_options (ocaml.Main_args.Bytetop_options)

Module type Main_args.Bytetop_options

include Toplevel_options
include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
val _init : string -> unit
val _noinit : unit -> unit
val _no_version : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
val _stdin : unit -> unit
val _args : string -> string array
val _args0 : string -> string array
val _color : string -> unit
val _error_style : string -> unit
val _eval : string -> unit
val _dinstr : unit -> unit
diff --git a/ocaml/Main_args/module-type-Common_options/index.html b/ocaml/Main_args/module-type-Common_options/index.html new file mode 100644 index 00000000..aed51486 --- /dev/null +++ b/ocaml/Main_args/module-type-Common_options/index.html @@ -0,0 +1,2 @@ + +Common_options (ocaml.Main_args.Common_options)

Module type Main_args.Common_options

val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
diff --git a/ocaml/Main_args/module-type-Compiler_options/index.html b/ocaml/Main_args/module-type-Compiler_options/index.html new file mode 100644 index 00000000..602bda9d --- /dev/null +++ b/ocaml/Main_args/module-type-Compiler_options/index.html @@ -0,0 +1,2 @@ + +Compiler_options (ocaml.Main_args.Compiler_options)

Module type Main_args.Compiler_options

val _a : unit -> unit
val _annot : unit -> unit
val _binannot : unit -> unit
val _c : unit -> unit
val _cc : string -> unit
val _cclib : string -> unit
val _ccopt : string -> unit
val _cmi_file : string -> unit
val _config : unit -> unit
val _config_var : string -> unit
val _for_pack : string -> unit
val _g : unit -> unit
val _no_g : unit -> unit
val _stop_after : string -> unit
val _i : unit -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _keep_docs : unit -> unit
val _no_keep_docs : unit -> unit
val _keep_locs : unit -> unit
val _no_keep_locs : unit -> unit
val _linkall : unit -> unit
val _o : string -> unit
val _opaque : unit -> unit
val _output_obj : unit -> unit
val _output_complete_obj : unit -> unit
val _pack : unit -> unit
val _plugin : string -> unit
val _pp : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _runtime_variant : string -> unit
val _with_runtime : unit -> unit
val _without_runtime : unit -> unit
val _short_paths : unit -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
val _color : string -> unit
val _error_style : string -> unit
val _match_context_rows : int -> unit
val _dtimings : unit -> unit
val _dprofile : unit -> unit
val _dump_into_file : unit -> unit
val _dump_dir : string -> unit
val _args : string -> string array
val _args0 : string -> string array
diff --git a/ocaml/Main_args/module-type-Core_options/index.html b/ocaml/Main_args/module-type-Core_options/index.html new file mode 100644 index 00000000..7f7f59a0 --- /dev/null +++ b/ocaml/Main_args/module-type-Core_options/index.html @@ -0,0 +1,2 @@ + +Core_options (ocaml.Main_args.Core_options)

Module type Main_args.Core_options

include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
diff --git a/ocaml/Main_args/module-type-Ocamldoc_options/index.html b/ocaml/Main_args/module-type-Ocamldoc_options/index.html new file mode 100644 index 00000000..5ca6fc1a --- /dev/null +++ b/ocaml/Main_args/module-type-Ocamldoc_options/index.html @@ -0,0 +1,2 @@ + +Ocamldoc_options (ocaml.Main_args.Ocamldoc_options)

Module type Main_args.Ocamldoc_options

include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _pp : string -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _vmthread : unit -> unit
diff --git a/ocaml/Main_args/module-type-Optcommon_options/index.html b/ocaml/Main_args/module-type-Optcommon_options/index.html new file mode 100644 index 00000000..4d117b38 --- /dev/null +++ b/ocaml/Main_args/module-type-Optcommon_options/index.html @@ -0,0 +1,2 @@ + +Optcommon_options (ocaml.Main_args.Optcommon_options)

Module type Main_args.Optcommon_options

val _compact : unit -> unit
val _inline : string -> unit
val _inline_toplevel : string -> unit
val _inlining_report : unit -> unit
val _dump_pass : string -> unit
val _inline_max_depth : string -> unit
val _rounds : int -> unit
val _inline_max_unroll : string -> unit
val _classic_inlining : unit -> unit
val _inline_call_cost : string -> unit
val _inline_alloc_cost : string -> unit
val _inline_prim_cost : string -> unit
val _inline_branch_cost : string -> unit
val _inline_indirect_cost : string -> unit
val _inline_lifting_benefit : string -> unit
val _unbox_closures : unit -> unit
val _unbox_closures_factor : int -> unit
val _inline_branch_factor : string -> unit
val _remove_unused_arguments : unit -> unit
val _no_unbox_free_vars_of_closures : unit -> unit
val _no_unbox_specialised_args : unit -> unit
val _o2 : unit -> unit
val _o3 : unit -> unit
val _insn_sched : unit -> unit
val _no_insn_sched : unit -> unit
val _linscan : unit -> unit
val _no_float_const_prop : unit -> unit
val _clambda_checks : unit -> unit
val _dflambda : unit -> unit
val _drawflambda : unit -> unit
val _dflambda_invariants : unit -> unit
val _dflambda_no_invariants : unit -> unit
val _dflambda_let : int -> unit
val _dflambda_verbose : unit -> unit
val _drawclambda : unit -> unit
val _dclambda : unit -> unit
val _dcmm_invariants : unit -> unit
val _dcmm : unit -> unit
val _dsel : unit -> unit
val _dcombine : unit -> unit
val _dcse : unit -> unit
val _dlive : unit -> unit
val _dspill : unit -> unit
val _dsplit : unit -> unit
val _dinterf : unit -> unit
val _dprefer : unit -> unit
val _dalloc : unit -> unit
val _dreload : unit -> unit
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dinterval : unit -> unit
val _dstartup : unit -> unit
diff --git a/ocaml/Main_args/module-type-Optcomp_options/index.html b/ocaml/Main_args/module-type-Optcomp_options/index.html new file mode 100644 index 00000000..835630e9 --- /dev/null +++ b/ocaml/Main_args/module-type-Optcomp_options/index.html @@ -0,0 +1,2 @@ + +Optcomp_options (ocaml.Main_args.Optcomp_options)

Module type Main_args.Optcomp_options

include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
include Compiler_options
val _a : unit -> unit
val _annot : unit -> unit
val _binannot : unit -> unit
val _c : unit -> unit
val _cc : string -> unit
val _cclib : string -> unit
val _ccopt : string -> unit
val _cmi_file : string -> unit
val _config : unit -> unit
val _config_var : string -> unit
val _for_pack : string -> unit
val _g : unit -> unit
val _no_g : unit -> unit
val _stop_after : string -> unit
val _i : unit -> unit
val _impl : string -> unit
val _intf : string -> unit
val _intf_suffix : string -> unit
val _keep_docs : unit -> unit
val _no_keep_docs : unit -> unit
val _keep_locs : unit -> unit
val _no_keep_locs : unit -> unit
val _linkall : unit -> unit
val _o : string -> unit
val _opaque : unit -> unit
val _output_obj : unit -> unit
val _output_complete_obj : unit -> unit
val _pack : unit -> unit
val _plugin : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _runtime_variant : string -> unit
val _with_runtime : unit -> unit
val _without_runtime : unit -> unit
val _short_paths : unit -> unit
val _thread : unit -> unit
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
val _color : string -> unit
val _error_style : string -> unit
val _match_context_rows : int -> unit
val _dtimings : unit -> unit
val _dprofile : unit -> unit
val _dump_into_file : unit -> unit
val _dump_dir : string -> unit
val _args : string -> string array
val _args0 : string -> string array
include Optcommon_options
val _compact : unit -> unit
val _inline : string -> unit
val _inline_toplevel : string -> unit
val _inlining_report : unit -> unit
val _dump_pass : string -> unit
val _inline_max_depth : string -> unit
val _rounds : int -> unit
val _inline_max_unroll : string -> unit
val _classic_inlining : unit -> unit
val _inline_call_cost : string -> unit
val _inline_alloc_cost : string -> unit
val _inline_prim_cost : string -> unit
val _inline_branch_cost : string -> unit
val _inline_indirect_cost : string -> unit
val _inline_lifting_benefit : string -> unit
val _unbox_closures : unit -> unit
val _unbox_closures_factor : int -> unit
val _inline_branch_factor : string -> unit
val _remove_unused_arguments : unit -> unit
val _no_unbox_free_vars_of_closures : unit -> unit
val _no_unbox_specialised_args : unit -> unit
val _o2 : unit -> unit
val _o3 : unit -> unit
val _insn_sched : unit -> unit
val _no_insn_sched : unit -> unit
val _linscan : unit -> unit
val _no_float_const_prop : unit -> unit
val _clambda_checks : unit -> unit
val _dflambda : unit -> unit
val _drawflambda : unit -> unit
val _dflambda_invariants : unit -> unit
val _dflambda_no_invariants : unit -> unit
val _dflambda_let : int -> unit
val _dflambda_verbose : unit -> unit
val _drawclambda : unit -> unit
val _dclambda : unit -> unit
val _dcmm_invariants : unit -> unit
val _dcmm : unit -> unit
val _dsel : unit -> unit
val _dcombine : unit -> unit
val _dcse : unit -> unit
val _dlive : unit -> unit
val _dspill : unit -> unit
val _dsplit : unit -> unit
val _dinterf : unit -> unit
val _dprefer : unit -> unit
val _dalloc : unit -> unit
val _dreload : unit -> unit
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dinterval : unit -> unit
val _dstartup : unit -> unit
val _p : unit -> unit
val _pp : string -> unit
val _S : unit -> unit
val _shared : unit -> unit
val _afl_instrument : unit -> unit
val _afl_inst_ratio : int -> unit
val _function_sections : unit -> unit
val _save_ir_after : string -> unit
diff --git a/ocaml/Main_args/module-type-Opttop_options/index.html b/ocaml/Main_args/module-type-Opttop_options/index.html new file mode 100644 index 00000000..93feae33 --- /dev/null +++ b/ocaml/Main_args/module-type-Opttop_options/index.html @@ -0,0 +1,2 @@ + +Opttop_options (ocaml.Main_args.Opttop_options)

Module type Main_args.Opttop_options

include Toplevel_options
include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
val _init : string -> unit
val _noinit : unit -> unit
val _no_version : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
val _stdin : unit -> unit
val _args : string -> string array
val _args0 : string -> string array
val _color : string -> unit
val _error_style : string -> unit
val _eval : string -> unit
include Optcommon_options
val _compact : unit -> unit
val _inline : string -> unit
val _inline_toplevel : string -> unit
val _inlining_report : unit -> unit
val _dump_pass : string -> unit
val _inline_max_depth : string -> unit
val _rounds : int -> unit
val _inline_max_unroll : string -> unit
val _classic_inlining : unit -> unit
val _inline_call_cost : string -> unit
val _inline_alloc_cost : string -> unit
val _inline_prim_cost : string -> unit
val _inline_branch_cost : string -> unit
val _inline_indirect_cost : string -> unit
val _inline_lifting_benefit : string -> unit
val _unbox_closures : unit -> unit
val _unbox_closures_factor : int -> unit
val _inline_branch_factor : string -> unit
val _remove_unused_arguments : unit -> unit
val _no_unbox_free_vars_of_closures : unit -> unit
val _no_unbox_specialised_args : unit -> unit
val _o2 : unit -> unit
val _o3 : unit -> unit
val _insn_sched : unit -> unit
val _no_insn_sched : unit -> unit
val _linscan : unit -> unit
val _no_float_const_prop : unit -> unit
val _clambda_checks : unit -> unit
val _dflambda : unit -> unit
val _drawflambda : unit -> unit
val _dflambda_invariants : unit -> unit
val _dflambda_no_invariants : unit -> unit
val _dflambda_let : int -> unit
val _dflambda_verbose : unit -> unit
val _drawclambda : unit -> unit
val _dclambda : unit -> unit
val _dcmm_invariants : unit -> unit
val _dcmm : unit -> unit
val _dsel : unit -> unit
val _dcombine : unit -> unit
val _dcse : unit -> unit
val _dlive : unit -> unit
val _dspill : unit -> unit
val _dsplit : unit -> unit
val _dinterf : unit -> unit
val _dprefer : unit -> unit
val _dalloc : unit -> unit
val _dreload : unit -> unit
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dinterval : unit -> unit
val _dstartup : unit -> unit
val _verbose : unit -> unit
val _S : unit -> unit
diff --git a/ocaml/Main_args/module-type-Toplevel_options/index.html b/ocaml/Main_args/module-type-Toplevel_options/index.html new file mode 100644 index 00000000..6f9a35c1 --- /dev/null +++ b/ocaml/Main_args/module-type-Toplevel_options/index.html @@ -0,0 +1,2 @@ + +Toplevel_options (ocaml.Main_args.Toplevel_options)

Module type Main_args.Toplevel_options

include Core_options
include Common_options
val _absname : unit -> unit
val _no_absname : unit -> unit
val _alert : string -> unit
val _I : string -> unit
val _labels : unit -> unit
val _alias_deps : unit -> unit
val _no_alias_deps : unit -> unit
val _app_funct : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
val _nolabels : unit -> unit
val _nostdlib : unit -> unit
val _nocwd : unit -> unit
val _open : string -> unit
val _ppx : string -> unit
val _principal : unit -> unit
val _no_principal : unit -> unit
val _rectypes : unit -> unit
val _no_rectypes : unit -> unit
val _safer_matching : unit -> unit
val _short_paths : unit -> unit
val _strict_sequence : unit -> unit
val _no_strict_sequence : unit -> unit
val _strict_formats : unit -> unit
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
val anonymous : string -> unit
val _nopervasives : unit -> unit
val _unsafe : unit -> unit
val _warn_error : string -> unit
val _warn_help : unit -> unit
val _dno_unique_ids : unit -> unit
val _dunique_ids : unit -> unit
val _dno_locations : unit -> unit
val _dlocations : unit -> unit
val _dsource : unit -> unit
val _dparsetree : unit -> unit
val _dtypedtree : unit -> unit
val _dshape : unit -> unit
val _drawlambda : unit -> unit
val _dlambda : unit -> unit
val _init : string -> unit
val _noinit : unit -> unit
val _no_version : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
val _stdin : unit -> unit
val _args : string -> string array
val _args0 : string -> string array
val _color : string -> unit
val _error_style : string -> unit
val _eval : string -> unit
diff --git a/ocaml/Maindriver/index.html b/ocaml/Maindriver/index.html new file mode 100644 index 00000000..26cf6883 --- /dev/null +++ b/ocaml/Maindriver/index.html @@ -0,0 +1,2 @@ + +Maindriver (ocaml.Maindriver)

Module Maindriver

val main : string array -> Stdlib.Format.formatter -> int
diff --git a/ocaml/Makedepend/index.html b/ocaml/Makedepend/index.html new file mode 100644 index 00000000..9ee46ca1 --- /dev/null +++ b/ocaml/Makedepend/index.html @@ -0,0 +1,2 @@ + +Makedepend (ocaml.Makedepend)

Module Makedepend

val main : unit -> unit
val main_from_option : unit -> unit
diff --git a/ocaml/Matching/index.html b/ocaml/Matching/index.html new file mode 100644 index 00000000..e0535da5 --- /dev/null +++ b/ocaml/Matching/index.html @@ -0,0 +1,40 @@ + +Matching (ocaml.Matching)

Module Matching

val for_function : + scopes:Debuginfo.Scoped_location.scopes -> + Location.t -> + int ref option -> + Lambda.lambda -> + (Typedtree.pattern * Lambda.lambda) list -> + Typedtree.partial -> + Lambda.lambda
val for_multiple_match : + scopes:Debuginfo.Scoped_location.scopes -> + Location.t -> + Lambda.lambda list -> + (Typedtree.pattern * Lambda.lambda) list -> + Typedtree.partial -> + Lambda.lambda
val for_tupled_function : + scopes:Debuginfo.Scoped_location.scopes -> + Location.t -> + Ident.t list -> + (Typedtree.pattern list * Lambda.lambda) list -> + Typedtree.partial -> + Lambda.lambda
exception Cannot_flatten
val flatten_pattern : int -> Typedtree.pattern -> Typedtree.pattern list
val expand_stringswitch : + Lambda.scoped_location -> + Lambda.lambda -> + (string * Lambda.lambda) list -> + Lambda.lambda option -> + Lambda.lambda
val inline_lazy_force : + Lambda.lambda -> + Lambda.scoped_location -> + Lambda.lambda
diff --git a/ocaml/Meta/index.html b/ocaml/Meta/index.html new file mode 100644 index 00000000..fe782e69 --- /dev/null +++ b/ocaml/Meta/index.html @@ -0,0 +1,10 @@ + +Meta (ocaml.Meta)

Module Meta

val global_data : unit -> Stdlib.Obj.t array
val realloc_global_data : int -> unit
type closure = unit -> Stdlib.Obj.t
type bytecode
val reify_bytecode : + bytes array -> + Instruct.debug_event list array -> + string option -> + bytecode * closure
val release_bytecode : bytecode -> unit
val invoke_traced_function : + Stdlib.Obj.raw_data -> + Stdlib.Obj.t -> + Stdlib.Obj.t -> + Stdlib.Obj.t
val get_section_table : unit -> (string * Stdlib.Obj.t) list
diff --git a/ocaml/Misc/Color/index.html b/ocaml/Misc/Color/index.html new file mode 100644 index 00000000..1f0761d9 --- /dev/null +++ b/ocaml/Misc/Color/index.html @@ -0,0 +1,2 @@ + +Color (ocaml.Misc.Color)

Module Misc.Color

type color =
  1. | Black
  2. | Red
  3. | Green
  4. | Yellow
  5. | Blue
  6. | Magenta
  7. | Cyan
  8. | White
type style =
  1. | FG of color
  2. | BG of color
  3. | Bold
  4. | Reset
type Stdlib.Format.stag +=
  1. | Style of style list
val ansi_of_style_l : style list -> string
type styles = {
  1. error : style list;
  2. warning : style list;
  3. loc : style list;
  4. hint : style list;
}
val default_styles : styles
val get_styles : unit -> styles
val set_styles : styles -> unit
type setting =
  1. | Auto
  2. | Always
  3. | Never
val default_setting : setting
val setup : setting option -> unit
val set_color_tag_handling : Stdlib.Format.formatter -> unit
diff --git a/ocaml/Misc/Error_style/index.html b/ocaml/Misc/Error_style/index.html new file mode 100644 index 00000000..bfadd2e7 --- /dev/null +++ b/ocaml/Misc/Error_style/index.html @@ -0,0 +1,2 @@ + +Error_style (ocaml.Misc.Error_style)

Module Misc.Error_style

type setting =
  1. | Contextual
  2. | Short
val default_setting : setting
diff --git a/ocaml/Misc/Int_literal_converter/index.html b/ocaml/Misc/Int_literal_converter/index.html new file mode 100644 index 00000000..78cc11f0 --- /dev/null +++ b/ocaml/Misc/Int_literal_converter/index.html @@ -0,0 +1,2 @@ + +Int_literal_converter (ocaml.Misc.Int_literal_converter)

Module Misc.Int_literal_converter

val int : string -> int

Convert a string to an integer. Unlike Stdlib.int_of_string, this function accepts the string representation of max_int + 1 and returns min_int in this case.

val int32 : string -> int32

Likewise, at type int32

val int64 : string -> int64

Likewise, at type int64

val nativeint : string -> nativeint

Likewise, at type nativeint

diff --git a/ocaml/Misc/LongString/index.html b/ocaml/Misc/LongString/index.html new file mode 100644 index 00000000..6d9a1aac --- /dev/null +++ b/ocaml/Misc/LongString/index.html @@ -0,0 +1,2 @@ + +LongString (ocaml.Misc.LongString)

Module Misc.LongString

type t = bytes array
val create : int -> t
val length : t -> int
val get : t -> int -> char
val set : t -> int -> char -> unit
val blit : t -> int -> t -> int -> int -> unit
val blit_string : string -> int -> t -> int -> int -> unit
val output : out_channel -> t -> int -> int -> unit
val input_bytes_into : t -> in_channel -> int -> unit
val input_bytes : in_channel -> int -> t
diff --git a/ocaml/Misc/Magic_number/index.html b/ocaml/Misc/Magic_number/index.html new file mode 100644 index 00000000..4ccf15a3 --- /dev/null +++ b/ocaml/Misc/Magic_number/index.html @@ -0,0 +1,17 @@ + +Magic_number (ocaml.Misc.Magic_number)

Module Misc.Magic_number

a typical magic number is "Caml1999I011"; it is formed of an alphanumeric prefix, here Caml1990I, followed by a version, here 011. The prefix identifies the kind of the versioned data: here the I indicates that it is the magic number for .cmi files.

All magic numbers have the same byte length, magic_length, and this is important for users as it gives them the number of bytes to read to obtain the byte sequence that should be a magic number. Typical user code will look like:

let ic = open_in_bin path in
+let magic =
+  try really_input_string ic Magic_number.magic_length
+  with End_of_file -> ... in
+match Magic_number.parse magic with
+| Error parse_error -> ...
+| Ok info -> ...

A given compiler version expects one specific version for each kind of object file, and will fail if given an unsupported version. Because versions grow monotonically, you can compare the parsed version with the expected "current version" for a kind, to tell whether the wrong-magic object file comes from the past or from the future.

An example of code block that expects the "currently supported version" of a given kind of magic numbers, here Cmxa, is as follows:

let ic = open_in_bin path in
+begin
+  try Magic_number.(expect_current Cmxa (get_info ic)) with
+  | Parse_error error -> ...
+  | Unexpected error -> ...
+end;
+...

Parse errors distinguish inputs that are Not_a_magic_number str, which are likely to come from the file being completely different, and Truncated str, raised by headers that are the (possibly empty) prefix of a valid magic number.

Unexpected errors correspond to valid magic numbers that are not the one expected, either because it corresponds to a different kind, or to a newer or older version.

The helper functions explain_parse_error and explain_unexpected_error will generate a textual explanation of each error, for use in error messages.

  • since 4.11
type native_obj_config = {
  1. flambda : bool;
}

native object files have a format and magic number that depend on certain native-compiler configuration parameters. This configuration space is expressed by the native_obj_config type.

val native_obj_config : native_obj_config

the native object file configuration of the active/configured compiler.

type version = int
type kind =
  1. | Exec
  2. | Cmi
  3. | Cmo
  4. | Cma
  5. | Cmx of native_obj_config
  6. | Cmxa of native_obj_config
  7. | Cmxs
  8. | Cmt
  9. | Ast_impl
  10. | Ast_intf
type info = {
  1. kind : kind;
  2. version : version;
    (*

    Note: some versions of the compiler use the same version suffix for all kinds, but others use different versions counters for different kinds. We may only assume that versions are growing monotonically (not necessarily always by one) between compiler versions.

    *)
}
type raw = string

the type of raw magic numbers, such as "Caml1999A027" for the .cma files of OCaml 4.10

Parsing magic numbers

type parse_error =
  1. | Truncated of string
  2. | Not_a_magic_number of string
val explain_parse_error : kind option -> parse_error -> string

Produces an explanation for a parse error. If no kind is provided, we use an unspecific formulation suggesting that any compiler-produced object file would have been satisfying.

val parse : raw -> (info, parse_error) result

Parses a raw magic number

val read_info : in_channel -> (info, parse_error) result

Read a raw magic number from an input channel.

If the data read str is not a valid magic number, it can be recovered from the Truncated str | Not_a_magic_number str payload of the Error parse_error case.

If parsing succeeds with an Ok info result, we know that exactly magic_length bytes have been consumed from the input_channel.

If you also wish to enforce that the magic number is at the current version, see read_current_info below.

val magic_length : int

all magic numbers take the same number of bytes

Checking that magic numbers are current

type 'a unexpected = {
  1. expected : 'a;
  2. actual : 'a;
}
type unexpected_error =
  1. | Kind of kind unexpected
  2. | Version of kind * version unexpected
val check_current : kind -> info -> (unit, unexpected_error) result

check_current kind info checks that the provided magic info is the current version of kind's magic header.

val explain_unexpected_error : unexpected_error -> string

Provides an explanation of the unexpected_error.

type error =
  1. | Parse_error of parse_error
  2. | Unexpected_error of unexpected_error
val read_current_info : + expected_kind:kind option -> + in_channel -> + (info, error) result

Read a magic number as read_info, and check that it is the current version as its kind. If the expected_kind argument is None, any kind is accepted.

Information on magic numbers

val string_of_kind : kind -> string

a user-printable string for a kind, eg. "exec" or "cmo", to use in error messages.

val human_name_of_kind : kind -> string

a user-meaningful name for a kind, eg. "executable file" or "bytecode object file", to use in error messages.

val current_raw : kind -> raw

the current magic number of each kind

val current_version : kind -> version

the current version of each kind

Raw representations

Mainly for internal usage and testing.

type raw_kind = string

the type of raw magic numbers kinds, such as "Caml1999A" for .cma files

val parse_kind : raw_kind -> kind option

parse a raw kind into a kind

val raw_kind : kind -> raw_kind

the current raw representation of a kind.

In some cases the raw representation of a kind has changed over compiler versions, so other files of the same kind may have different raw kinds. Note that all currently known cases are parsed correctly by parse_kind.

val raw : info -> raw

A valid raw representation of the magic number.

Due to past and future changes in the string representation of magic numbers, we cannot guarantee that the raw strings returned for past and future versions actually match the expectations of those compilers. The representation is accurate for current versions, and it is correctly parsed back into the desired version by the parsing functions above.

val all_kinds : kind list
diff --git a/ocaml/Misc/Stdlib/Array/index.html b/ocaml/Misc/Stdlib/Array/index.html new file mode 100644 index 00000000..8a62e7d5 --- /dev/null +++ b/ocaml/Misc/Stdlib/Array/index.html @@ -0,0 +1,2 @@ + +Array (ocaml.Misc.Stdlib.Array)

Module Stdlib.Array

Extensions to the Array module

val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

Same as Array.exists2 from the standard library.

val for_alli : (int -> 'a -> bool) -> 'a array -> bool

Same as Array.for_all from the standard library, but the function is applied with the index of the element as first argument, and the element itself as second argument.

val all_somes : 'a option array -> 'a array option
diff --git a/ocaml/Misc/Stdlib/List/index.html b/ocaml/Misc/Stdlib/List/index.html new file mode 100644 index 00000000..fccf10e8 --- /dev/null +++ b/ocaml/Misc/Stdlib/List/index.html @@ -0,0 +1,6 @@ + +List (ocaml.Misc.Stdlib.List)

Module Stdlib.List

Extensions to the List module

type 'a t = 'a list
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

The lexicographic order supported by the provided order. There is no constraint on the relative lengths of the lists.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

Returns true if and only if the given lists have the same length and content with respect to the given equality function.

val some_if_all_elements_are_some : 'a option t -> 'a t option

If all elements of the given list are Some _ then Some xs is returned with the xs being the contents of those Somes, with order preserved. Otherwise return None.

val map2_prefix : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t * 'b t

let r1, r2 = map2_prefix f l1 l2 If l1 is of length n and l2 = h2 @ t2 with h2 of length n, r1 is List.map2 f l1 h1 and r2 is t2.

val split_at : int -> 'a t -> 'a t * 'a t

split_at n l returns the pair before, after where before is the n first elements of l and after the remaining ones. If l has less than n elements, raises Invalid_argument.

val is_prefix : equal:('a -> 'a -> bool) -> 'a list -> of_:'a list -> bool

Returns true if and only if the given list, with respect to the given equality function on list members, is a prefix of the list of_.

type 'a longest_common_prefix_result = private {
  1. longest_common_prefix : 'a list;
  2. first_without_longest_common_prefix : 'a list;
  3. second_without_longest_common_prefix : 'a list;
}
val find_and_chop_longest_common_prefix : + equal:('a -> 'a -> bool) -> + first:'a list -> + second:'a list -> + 'a longest_common_prefix_result

Returns the longest list that, with respect to the provided equality function, is a prefix of both of the given lists. The input lists, each with such longest common prefix removed, are also returned.

diff --git a/ocaml/Misc/Stdlib/Option/index.html b/ocaml/Misc/Stdlib/Option/index.html new file mode 100644 index 00000000..1a9deed5 --- /dev/null +++ b/ocaml/Misc/Stdlib/Option/index.html @@ -0,0 +1,6 @@ + +Option (ocaml.Misc.Stdlib.Option)

Module Stdlib.Option

Extensions to the Option module

type 'a t = 'a option
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Misc/Stdlib/String/Map/index.html b/ocaml/Misc/Stdlib/String/Map/index.html new file mode 100644 index 00000000..eabb5c89 --- /dev/null +++ b/ocaml/Misc/Stdlib/String/Map/index.html @@ -0,0 +1,8 @@ + +Map (ocaml.Misc.Stdlib.String.Map)

Module String.Map

Maps

type key = string

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Misc/Stdlib/String/Set/index.html b/ocaml/Misc/Stdlib/String/Set/index.html new file mode 100644 index 00000000..bed08f44 --- /dev/null +++ b/ocaml/Misc/Stdlib/String/Set/index.html @@ -0,0 +1,3 @@ + +Set (ocaml.Misc.Stdlib.String.Set)

Module String.Set

Sets

type elt = string

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Misc/Stdlib/String/Tbl/index.html b/ocaml/Misc/Stdlib/String/Tbl/index.html new file mode 100644 index 00000000..d3caf334 --- /dev/null +++ b/ocaml/Misc/Stdlib/String/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Misc.Stdlib.String.Tbl)

Module String.Tbl

type key = string
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Misc/Stdlib/String/index.html b/ocaml/Misc/Stdlib/String/index.html new file mode 100644 index 00000000..9366fea6 --- /dev/null +++ b/ocaml/Misc/Stdlib/String/index.html @@ -0,0 +1,3 @@ + +String (ocaml.Misc.Stdlib.String)

Module Stdlib.String

Extensions to the String module

include module type of Stdlib.String

Strings

type t = string

The type for strings.

val make : int -> char -> string

make n c is a string of length n with each index holding the character c.

  • raises Invalid_argument

    if n < 0 or n > Sys.max_string_length.

val init : int -> (int -> char) -> string

init n f is a string of length n with index i holding the character f i (called in increasing index order).

  • raises Invalid_argument

    if n < 0 or n > Sys.max_string_length.

  • since 4.02
val empty : string

The empty string.

  • since 4.13
val length : string -> int

length s is the length (number of bytes/characters) of s.

val get : string -> int -> char

get s i is the character at index i in s. This is the same as writing s.[i].

  • raises Invalid_argument

    if i not an index of s.

val of_bytes : bytes -> string

Return a new string that contains the same bytes as the given byte sequence.

  • since 4.13
val to_bytes : string -> bytes

Return a new byte sequence that contains the same bytes as the given string.

  • since 4.13
val blit : string -> int -> bytes -> int -> int -> unit

Same as Bytes.blit_string which should be preferred.

Concatenating

Note. The Stdlib.(^) binary operator concatenates two strings.

val concat : string -> string list -> string

concat sep ss concatenates the list of strings ss, inserting the separator string sep between each.

  • raises Invalid_argument

    if the result is longer than Sys.max_string_length bytes.

val cat : string -> string -> string

cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

  • raises Invalid_argument

    if the result is longer than Sys.max_string_length bytes.

  • since 4.13

Predicates and comparisons

val equal : t -> t -> bool

equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

  • since 4.03 (4.05 in StringLabels)
val compare : t -> t -> int

compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

val starts_with : prefix:string -> string -> bool

starts_with ~prefix s is true if and only if s starts with prefix.

  • since 4.13
val ends_with : suffix:string -> string -> bool

ends_with ~suffix s is true if and only if s ends with suffix.

  • since 4.13
val contains_from : string -> int -> char -> bool

contains_from s start c is true if and only if c appears in s after position start.

  • raises Invalid_argument

    if start is not a valid position in s.

val rcontains_from : string -> int -> char -> bool

rcontains_from s stop c is true if and only if c appears in s before position stop+1.

  • raises Invalid_argument

    if stop < 0 or stop+1 is not a valid position in s.

val contains : string -> char -> bool

contains s c is String.contains_from s 0 c.

Extracting substrings

val sub : string -> int -> int -> string

sub s pos len is a string of length len, containing the substring of s that starts at position pos and has length len.

  • raises Invalid_argument

    if pos and len do not designate a valid substring of s.

val split_on_char : char -> string -> string list

split_on_char sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

The function's result is specified by the following invariants:

  • The list is not empty.
  • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) + (split_on_char sep s) = s).
  • No string in the result contains the sep character.
  • since 4.04 (4.05 in StringLabels)

Transforming

val map : (char -> char) -> string -> string

map f s is the string resulting from applying f to all the characters of s in increasing order.

  • since 4.00
val mapi : (int -> char -> char) -> string -> string

mapi f s is like map but the index of the character is also passed to f.

  • since 4.02
val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc

fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

  • since 4.13
val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc

fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

  • since 4.13
val exists : (char -> bool) -> string -> bool

exists p s checks if at least one character of s satisfies the predicate p.

  • since 4.13
val trim : string -> string

trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

  • since 4.00
val escaped : string -> string

escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

  • raises Invalid_argument

    if the result is longer than Sys.max_string_length bytes.

val uppercase_ascii : string -> string

uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

  • since 4.03 (4.05 in StringLabels)
val lowercase_ascii : string -> string

lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

  • since 4.03 (4.05 in StringLabels)
val capitalize_ascii : string -> string

capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

  • since 4.03 (4.05 in StringLabels)
val uncapitalize_ascii : string -> string

uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

  • since 4.03 (4.05 in StringLabels)

Traversing

val iter : (char -> unit) -> string -> unit

iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

val iteri : (int -> char -> unit) -> string -> unit

iteri is like iter, but the function is also given the corresponding character index.

  • since 4.00

Searching

val index_from : string -> int -> char -> int

index_from s i c is the index of the first occurrence of c in s after position i.

  • raises Not_found

    if c does not occur in s after position i.

  • raises Invalid_argument

    if i is not a valid position in s.

val index_from_opt : string -> int -> char -> int option

index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

  • raises Invalid_argument

    if i is not a valid position in s.

  • since 4.05
val rindex_from : string -> int -> char -> int

rindex_from s i c is the index of the last occurrence of c in s before position i+1.

  • raises Not_found

    if c does not occur in s before position i+1.

  • raises Invalid_argument

    if i+1 is not a valid position in s.

val rindex_from_opt : string -> int -> char -> int option

rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

  • raises Invalid_argument

    if i+1 is not a valid position in s.

  • since 4.05
val index : string -> char -> int

index s c is String.index_from s 0 c.

val index_opt : string -> char -> int option

index_opt s c is String.index_from_opt s 0 c.

  • since 4.05
val rindex : string -> char -> int

rindex s c is String.rindex_from s (length s - 1) c.

val rindex_opt : string -> char -> int option

rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

  • since 4.05

Strings and Sequences

val to_seq : t -> char Stdlib.Seq.t

to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

  • since 4.07
val to_seqi : t -> (int * char) Stdlib.Seq.t

to_seqi s is like to_seq but also tuples the corresponding index.

  • since 4.07
val of_seq : char Stdlib.Seq.t -> t

of_seq s is a string made of the sequence's characters.

  • since 4.07

UTF decoding and validations

  • since 4.14

UTF-8

val get_utf_8_uchar : t -> int -> Stdlib.Uchar.utf_decode

get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

val is_valid_utf_8 : t -> bool

is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

UTF-16BE

val get_utf_16be_uchar : t -> int -> Stdlib.Uchar.utf_decode

get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

val is_valid_utf_16be : t -> bool

is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

UTF-16LE

val get_utf_16le_uchar : t -> int -> Stdlib.Uchar.utf_decode

get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

val is_valid_utf_16le : t -> bool

is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

Binary decoding of integers

The functions in this section binary decode integers from strings.

All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

val get_uint8 : string -> int -> int

get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

  • since 4.13
val get_int8 : string -> int -> int

get_int8 b i is b's signed 8-bit integer starting at character index i.

  • since 4.13
val get_uint16_ne : string -> int -> int

get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

  • since 4.13
val get_uint16_be : string -> int -> int

get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

  • since 4.13
val get_uint16_le : string -> int -> int

get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

  • since 4.13
val get_int16_ne : string -> int -> int

get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

  • since 4.13
val get_int16_be : string -> int -> int

get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

  • since 4.13
val get_int16_le : string -> int -> int

get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

  • since 4.13
val get_int32_ne : string -> int -> int32

get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

  • since 4.13
val hash : t -> int

An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.0
val seeded_hash : int -> t -> int

A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.0
val get_int32_be : string -> int -> int32

get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

  • since 4.13
val get_int32_le : string -> int -> int32

get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

  • since 4.13
val get_int64_ne : string -> int -> int64

get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

  • since 4.13
val get_int64_be : string -> int -> int64

get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

  • since 4.13
val get_int64_le : string -> int -> int64

get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

  • since 4.13
module Set : Set.S with type elt = string
module Map : Map.S with type key = string
module Tbl : Hashtbl.S with type key = string
val print : Stdlib.Format.formatter -> t -> unit
val for_all : (char -> bool) -> t -> bool
diff --git a/ocaml/Misc/Stdlib/index.html b/ocaml/Misc/Stdlib/index.html new file mode 100644 index 00000000..31676f9b --- /dev/null +++ b/ocaml/Misc/Stdlib/index.html @@ -0,0 +1,2 @@ + +Stdlib (ocaml.Misc.Stdlib)

Module Misc.Stdlib

module List : sig ... end
module Option : sig ... end
module Array : sig ... end
module String : sig ... end
val compare : 'a -> 'a -> int
diff --git a/ocaml/Misc/index.html b/ocaml/Misc/index.html new file mode 100644 index 00000000..8b6de6ed --- /dev/null +++ b/ocaml/Misc/index.html @@ -0,0 +1,37 @@ + +Misc (ocaml.Misc)

Module Misc

Miscellaneous useful types and functions

Warning: this module is unstable and part of compiler-libs.

Reporting fatal errors

val fatal_error : string -> 'a

Raise the Fatal_error exception with the given string.

val fatal_errorf : ('a, Stdlib.Format.formatter, unit, 'b) format4 -> 'a

Format the arguments according to the given format string and raise Fatal_error with the resulting string.

exception Fatal_error

Exceptions and finalization

val try_finally : + ?always:(unit -> unit) -> + ?exceptionally:(unit -> unit) -> + (unit -> 'a) -> + 'a

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). For example:

let objfile = outputprefix ^ ".cmo" in
+let oc = open_out_bin objfile in
+Misc.try_finally
+  (fun () ->
+     bytecode
+     ++ Timings.(accumulate_time (Generate sourcefile))
+         (Emitcode.to_file oc modulename objfile);
+     Warnings.check_fatal ())
+  ~always:(fun () -> close_out oc)
+  ~exceptionally:(fun _exn -> remove_file objfile);

If exceptionally fail with an exception, it is propagated as usual.

If always or exceptionally use exceptions internally for control-flow but do not raise, then try_finally is careful to preserve any exception backtrace coming from work or always for easier debugging.

val reraise_preserving_backtrace : exn -> (unit -> unit) -> 'a

reraise_preserving_backtrace e f is (f (); raise e) except that the current backtrace is preserved, even if f uses exceptions internally.

List operations

val map_end : ('a -> 'b) -> 'a list -> 'b list -> 'b list

map_end f l t is map f l @ t, just more efficient.

val map_left_right : ('a -> 'b) -> 'a list -> 'b list

Like List.map, with guaranteed left-to-right evaluation order

val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

Same as List.for_all but for a binary predicate. In addition, this for_all2 never fails: given two lists with different lengths, it returns false.

val replicate_list : 'a -> int -> 'a list

replicate_list elem n is the list with n elements all identical to elem.

val list_remove : 'a -> 'a list -> 'a list

list_remove x l returns a copy of l with the first element equal to x removed.

val split_last : 'a list -> 'a list * 'a

Return the last element and the other elements of the given list.

Hash table operations

val create_hashtable : int -> ('a * 'b) list -> ('a, 'b) Stdlib.Hashtbl.t

Create a hashtable with the given initial size and fills it with the given bindings.

Extensions to the standard library

module Stdlib : sig ... end

Operations on files and file paths

val find_in_path : string list -> string -> string

Search a file in a list of directories.

val find_in_path_rel : string list -> string -> string

Search a relative file in a list of directories.

val find_in_path_uncap : string list -> string -> string

Same, but search also for uncapitalized name, i.e. if name is Foo.ml, allow /path/Foo.ml and /path/foo.ml to match.

val remove_file : string -> unit

Delete the given file if it exists and is a regular file. Does nothing for other kinds of files. Never raises an error.

val expand_directory : string -> string -> string

expand_directory alt file eventually expands a + at the beginning of file into alt (an alternate root directory)

val split_path_contents : ?sep:char -> string -> string list

split_path_contents ?sep s interprets s as the value of a "PATH"-like variable and returns the corresponding list of directories. s is split using the platform-specific delimiter, or ~sep if it is passed.

Returns the empty list if s is empty.

val copy_file : in_channel -> out_channel -> unit

copy_file ic oc reads the contents of file ic and copies them to oc. It stops when encountering EOF on ic.

val copy_file_chunk : in_channel -> out_channel -> int -> unit

copy_file_chunk ic oc n reads n bytes from ic and copies them to oc. It raises End_of_file when encountering EOF on ic.

val string_of_file : in_channel -> string

string_of_file ic reads the contents of file ic and copies them to a string. It stops when encountering EOF on ic.

val output_to_file_via_temporary : + ?mode:open_flag list -> + string -> + (string -> out_channel -> 'a) -> + 'a

Produce output in temporary file, then rename it (as atomically as possible) to the desired output file name. output_to_file_via_temporary filename fn opens a temporary file which is passed to fn (name + output channel). When fn returns, the channel is closed and the temporary file is renamed to filename.

val protect_writing_to_file : filename:string -> f:(out_channel -> 'a) -> 'a

Open the given filename for writing (in binary mode), pass the out_channel to the given function, then close the channel. If the function raises an exception then filename will be removed.

val concat_null_terminated : string list -> string

concat_null_terminated [x1;x2; ... xn] is x1 ^ "\000" ^ x2 ^ "\000" ^ ... ^ xn ^ "\000"

val split_null_terminated : string -> string list

split_null_terminated s is similar String.split_on_char '\000' but ignores the trailing separator, if any

val chop_extensions : string -> string

Return the given file name without its extensions. The extensions is the longest suffix starting with a period and not including a directory separator, .xyz.uvw for instance.

Return the given name if it does not contain an extension.

Integer operations

val log2 : int -> int

log2 n returns s such that n = 1 lsl s if n is a power of 2

val align : int -> int -> int

align n a rounds n upwards to a multiple of a (a power of 2).

val no_overflow_add : int -> int -> bool

no_overflow_add n1 n2 returns true if the computation of n1 + n2 does not overflow.

val no_overflow_sub : int -> int -> bool

no_overflow_sub n1 n2 returns true if the computation of n1 - n2 does not overflow.

val no_overflow_mul : int -> int -> bool

no_overflow_mul n1 n2 returns true if the computation of n1 * n2 does not overflow.

val no_overflow_lsl : int -> int -> bool

no_overflow_lsl n k returns true if the computation of n lsl k does not overflow.

module Int_literal_converter : sig ... end
val find_first_mono : (int -> bool) -> int

find_first_mono p takes an integer predicate p : int -> bool that we assume: 1. is monotonic on natural numbers: if a <= b then p a implies p b, 2. is satisfied for some natural numbers in range 0; max_int (this is equivalent to: p max_int = true).

find_first_mono p is the smallest natural number N that satisfies p, computed in O(log(N)) calls to p.

Our implementation supports two cases where the preconditions on p are not respected:

  • If p is always false, we silently return max_int instead of looping or crashing.
  • If p is non-monotonic but eventually true, we return some satisfying value.

String operations

val search_substring : string -> string -> int -> int

search_substring pat str start returns the position of the first occurrence of string pat in string str. Search starts at offset start in str. Raise Not_found if pat does not occur.

val replace_substring : before:string -> after:string -> string -> string

replace_substring ~before ~after str replaces all occurrences of before with after in str and returns the resulting string.

val rev_split_words : string -> string list

rev_split_words s splits s in blank-separated words, and returns the list of words in reverse order.

val cut_at : string -> char -> string * string

String.cut_at s c returns a pair containing the sub-string before the first occurrence of c in s, and the sub-string after the first occurrence of c in s. let (before, after) = String.cut_at s c in + before ^ String.make 1 c ^ after is the identity if s contains c.

Raise Not_found if the character does not appear in the string

  • since 4.01
val ordinal_suffix : int -> string

ordinal_suffix n is the appropriate suffix to append to the numeral n as an ordinal number: 1 -> "st", 2 -> "nd", 3 -> "rd", 4 -> "th", and so on. Handles larger numbers (e.g., 42 -> "nd") and the numbers 11--13 (which all get "th") correctly.

val normalise_eol : string -> string

normalise_eol s returns a fresh copy of s with any '\r' characters removed. Intended for pre-processing text which will subsequently be printed on a channel which performs EOL transformations (i.e. Windows)

val delete_eol_spaces : string -> string

delete_eol_spaces s returns a fresh copy of s with any end of line spaces removed. Intended to normalize the output of the toplevel for tests.

Operations on references

type ref_and_value =
  1. | R : 'a ref * 'a -> ref_and_value
val protect_refs : ref_and_value list -> (unit -> 'a) -> 'a

protect_refs l f temporarily sets r to v for each R (r, v) in l while executing f. The previous contents of the references is restored even if f raises an exception, without altering the exception backtrace.

val get_ref : 'a list ref -> 'a list

get_ref lr returns the content of the list reference lr and reset its content to the empty list.

val set_or_ignore : ('a -> 'b option) -> 'b option ref -> 'a -> unit

set_or_ignore f opt x sets opt to f x if it returns Some _, or leaves it unmodified if it returns None.

Operations on triples and quadruples

val fst3 : ('a * 'b * 'c) -> 'a
val snd3 : ('a * 'b * 'c) -> 'b
val thd3 : ('a * 'b * 'c) -> 'c
val fst4 : ('a * 'b * 'c * 'd) -> 'a
val snd4 : ('a * 'b * 'c * 'd) -> 'b
val thd4 : ('a * 'b * 'c * 'd) -> 'c
val for4 : ('a * 'b * 'c * 'd) -> 'd

Long strings

``Long strings'' are mutable arrays of characters that are not limited in length to Sys.max_string_length.

module LongString : sig ... end

Spell checking and ``did you mean'' suggestions

val edit_distance : string -> string -> int -> int option

edit_distance a b cutoff computes the edit distance between strings a and b. To help efficiency, it uses a cutoff: if the distance d is smaller than cutoff, it returns Some d, else None.

The distance algorithm currently used is Damerau-Levenshtein: it computes the number of insertion, deletion, substitution of letters, or swapping of adjacent letters to go from one word to the other. The particular algorithm may change in the future.

val spellcheck : string list -> string -> string list

spellcheck env name takes a list of names env that exist in the current environment and an erroneous name, and returns a list of suggestions taken from env, that are close enough to name that it may be a typo for one of them.

val did_you_mean : Stdlib.Format.formatter -> (unit -> string list) -> unit

did_you_mean ppf get_choices hints that the user may have meant one of the option returned by calling get_choices. It does nothing if the returned list is empty.

The unit -> ... thunking is meant to delay any potentially-slow computation (typically computing edit-distance with many things from the current environment) to when the hint message is to be printed. You should print an understandable error message before calling did_you_mean, so that users get a clear notification of the failure even if producing the hint is slow.

Colored terminal output

module Color : sig ... end
module Error_style : sig ... end

Formatted output

val print_if : + Stdlib.Format.formatter -> + bool ref -> + (Stdlib.Format.formatter -> 'a -> unit) -> + 'a -> + 'a

print_if ppf flag fmt x prints x with fmt on ppf if b is true.

val pp_two_columns : + ?sep:string -> + ?max_lines:int -> + Stdlib.Format.formatter -> + (string * string) list -> + unit

pp_two_columns ?sep ?max_lines ppf l prints the lines in l as two columns separated by sep ("|" by default). max_lines can be used to indicate a maximum number of lines to print -- an ellipsis gets inserted at the middle if the input has too many lines.

Example:

pp_two_columns ~max_lines:3 Format.std_formatter [
+      "abc", "hello";
+      "def", "zzz";
+      "a"  , "bllbl";
+      "bb" , "dddddd";
+    ]

prints

    abc | hello
+    ...
+    bb  | dddddd
val print_see_manual : Stdlib.Format.formatter -> int list -> unit

See manual section

Displaying configuration variables

val show_config_and_exit : unit -> unit

Display the values of all compiler configuration variables from module Config, then exit the program with code 0.

val show_config_variable_and_exit : string -> unit

Display the value of the given configuration variable, then exit the program with code 0.

Handling of build maps

Build maps cause the compiler to normalize file names embedded in object files, thus leading to more reproducible builds.

val get_build_path_prefix_map : unit -> Build_path_prefix_map.map option

Returns the map encoded in the BUILD_PATH_PREFIX_MAP environment variable.

val debug_prefix_map_flags : unit -> string list

Returns the list of --debug-prefix-map flags to be passed to the assembler, built from the BUILD_PATH_PREFIX_MAP environment variable.

Handling of magic numbers

module Magic_number : sig ... end

a typical magic number is "Caml1999I011"; it is formed of an alphanumeric prefix, here Caml1990I, followed by a version, here 011. The prefix identifies the kind of the versioned data: here the I indicates that it is the magic number for .cmi files.

Miscellaneous type aliases

type filepath = string
type modname = string
type crcs = (modname * Stdlib.Digest.t option) list
type alerts = string Stdlib.String.Map.t
diff --git a/ocaml/Mtype/index.html b/ocaml/Mtype/index.html new file mode 100644 index 00000000..f67579b3 --- /dev/null +++ b/ocaml/Mtype/index.html @@ -0,0 +1,29 @@ + +Mtype (ocaml.Mtype)

Module Mtype

val scrape_for_functor_arg : Env.t -> Types.module_type -> Types.module_type
val scrape_for_type_of : + remove_aliases:bool -> + Env.t -> + Types.module_type -> + Types.module_type
val freshen : scope:int -> Types.module_type -> Types.module_type
val strengthen : + aliasable:bool -> + Env.t -> + Types.module_type -> + Path.t -> + Types.module_type
val strengthen_decl : + aliasable:bool -> + Env.t -> + Types.module_declaration -> + Path.t -> + Types.module_declaration
val nondep_supertype : + Env.t -> + Ident.t list -> + Types.module_type -> + Types.module_type
val nondep_sig_item : + Env.t -> + Ident.t list -> + Types.signature_item -> + Types.signature_item
val no_code_needed : Env.t -> Types.module_type -> bool
val no_code_needed_sig : Env.t -> Types.signature -> bool
val enrich_modtype : Env.t -> Path.t -> Types.module_type -> Types.module_type
val enrich_typedecl : + Env.t -> + Path.t -> + Ident.t -> + Types.type_declaration -> + Types.type_declaration
val type_paths : Env.t -> Path.t -> Types.module_type -> Path.t list
val contains_type : Env.t -> Types.module_type -> bool
val lower_nongen : int -> Types.module_type -> unit
diff --git a/ocaml/Mutable_variable/Map/index.html b/ocaml/Mutable_variable/Map/index.html new file mode 100644 index 00000000..41429a04 --- /dev/null +++ b/ocaml/Mutable_variable/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Mutable_variable.Map)

Module Mutable_variable.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Mutable_variable/Set/index.html b/ocaml/Mutable_variable/Set/index.html new file mode 100644 index 00000000..aaa000d2 --- /dev/null +++ b/ocaml/Mutable_variable/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Mutable_variable.Set)

Module Mutable_variable.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Mutable_variable/T/index.html b/ocaml/Mutable_variable/T/index.html new file mode 100644 index 00000000..8675251a --- /dev/null +++ b/ocaml/Mutable_variable/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Mutable_variable.T)

Module Mutable_variable.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Mutable_variable/Tbl/index.html b/ocaml/Mutable_variable/Tbl/index.html new file mode 100644 index 00000000..0c3b0584 --- /dev/null +++ b/ocaml/Mutable_variable/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Mutable_variable.Tbl)

Module Mutable_variable.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Mutable_variable/index.html b/ocaml/Mutable_variable/index.html new file mode 100644 index 00000000..e7a24347 --- /dev/null +++ b/ocaml/Mutable_variable/index.html @@ -0,0 +1,8 @@ + +Mutable_variable (ocaml.Mutable_variable)

Module Mutable_variable

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create : + ?current_compilation_unit:Compilation_unit.t -> + Internal_variable_names.t -> + t
val create_with_same_name_as_ident : Ident.t -> t
val create_from_variable : + ?current_compilation_unit:Compilation_unit.t -> + Variable.t -> + t
val rename : ?current_compilation_unit:Compilation_unit.t -> t -> t
val in_compilation_unit : t -> Compilation_unit.t -> bool
val name : t -> string
val unique_name : t -> string
val print_list : Stdlib.Format.formatter -> t list -> unit
val print_opt : Stdlib.Format.formatter -> t option -> unit
val output_full : out_channel -> t -> unit
diff --git a/ocaml/Numbers/Float/Map/index.html b/ocaml/Numbers/Float/Map/index.html new file mode 100644 index 00000000..a3928bd2 --- /dev/null +++ b/ocaml/Numbers/Float/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Numbers.Float.Map)

Module Float.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Numbers/Float/Set/index.html b/ocaml/Numbers/Float/Set/index.html new file mode 100644 index 00000000..b39e0f74 --- /dev/null +++ b/ocaml/Numbers/Float/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Numbers.Float.Set)

Module Float.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Numbers/Float/T/index.html b/ocaml/Numbers/Float/T/index.html new file mode 100644 index 00000000..bed329ed --- /dev/null +++ b/ocaml/Numbers/Float/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Numbers.Float.T)

Module Float.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Numbers/Float/Tbl/index.html b/ocaml/Numbers/Float/Tbl/index.html new file mode 100644 index 00000000..16d40e55 --- /dev/null +++ b/ocaml/Numbers/Float/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Numbers.Float.Tbl)

Module Float.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Numbers/Float/index.html b/ocaml/Numbers/Float/index.html new file mode 100644 index 00000000..d603ad1d --- /dev/null +++ b/ocaml/Numbers/Float/index.html @@ -0,0 +1,2 @@ + +Float (ocaml.Numbers.Float)

Module Numbers.Float

type t = float
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
diff --git a/ocaml/Numbers/Int/Map/index.html b/ocaml/Numbers/Int/Map/index.html new file mode 100644 index 00000000..d2590978 --- /dev/null +++ b/ocaml/Numbers/Int/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Numbers.Int.Map)

Module Int.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Numbers/Int/Set/index.html b/ocaml/Numbers/Int/Set/index.html new file mode 100644 index 00000000..cf242a7d --- /dev/null +++ b/ocaml/Numbers/Int/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Numbers.Int.Set)

Module Int.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Numbers/Int/T/index.html b/ocaml/Numbers/Int/T/index.html new file mode 100644 index 00000000..6d13efeb --- /dev/null +++ b/ocaml/Numbers/Int/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Numbers.Int.T)

Module Int.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Numbers/Int/Tbl/index.html b/ocaml/Numbers/Int/Tbl/index.html new file mode 100644 index 00000000..ff183e67 --- /dev/null +++ b/ocaml/Numbers/Int/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Numbers.Int.Tbl)

Module Int.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Numbers/Int/index.html b/ocaml/Numbers/Int/index.html new file mode 100644 index 00000000..98f3eb18 --- /dev/null +++ b/ocaml/Numbers/Int/index.html @@ -0,0 +1,2 @@ + +Int (ocaml.Numbers.Int)

Module Numbers.Int

include Identifiable.S with type t = int
type t = int
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val zero_to_n : int -> Set.t

zero_to_n n is the set of numbers {0, ..., n} (inclusive).

val to_string : int -> string
diff --git a/ocaml/Numbers/Int16/index.html b/ocaml/Numbers/Int16/index.html new file mode 100644 index 00000000..f4e0a5fa --- /dev/null +++ b/ocaml/Numbers/Int16/index.html @@ -0,0 +1,2 @@ + +Int16 (ocaml.Numbers.Int16)

Module Numbers.Int16

type t
val of_int_exn : int -> t
val of_int64_exn : Stdlib.Int64.t -> t
val to_int : t -> int
diff --git a/ocaml/Numbers/Int8/index.html b/ocaml/Numbers/Int8/index.html new file mode 100644 index 00000000..0e75688f --- /dev/null +++ b/ocaml/Numbers/Int8/index.html @@ -0,0 +1,2 @@ + +Int8 (ocaml.Numbers.Int8)

Module Numbers.Int8

type t
val zero : t
val one : t
val of_int_exn : int -> t
val to_int : t -> int
diff --git a/ocaml/Numbers/index.html b/ocaml/Numbers/index.html new file mode 100644 index 00000000..a691e9ef --- /dev/null +++ b/ocaml/Numbers/index.html @@ -0,0 +1,2 @@ + +Numbers (ocaml.Numbers)

Module Numbers

Modules about numbers, some of which satisfy Identifiable.S.

Warning: this module is unstable and part of compiler-libs.

module Int : sig ... end
module Int8 : sig ... end
module Int16 : sig ... end
module Float : Identifiable.S with type t = float
diff --git a/ocaml/Odoc/index.html b/ocaml/Odoc/index.html new file mode 100644 index 00000000..9280470b --- /dev/null +++ b/ocaml/Odoc/index.html @@ -0,0 +1,2 @@ + +Odoc (ocaml.Odoc)

Module Odoc

diff --git a/ocaml/Odoc_analyse/index.html b/ocaml/Odoc_analyse/index.html new file mode 100644 index 00000000..9f754547 --- /dev/null +++ b/ocaml/Odoc_analyse/index.html @@ -0,0 +1,5 @@ + +Odoc_analyse (ocaml.Odoc_analyse)

Module Odoc_analyse

val analyse_files : + ?init:Odoc_module.t_module list -> + Odoc_global.source_file list -> + Odoc_module.t_module list
val dump_modules : string -> Odoc_module.t_module list -> unit
val load_modules : string -> Odoc_module.t_module list
diff --git a/ocaml/Odoc_args/index.html b/ocaml/Odoc_args/index.html new file mode 100644 index 00000000..8d27a34e --- /dev/null +++ b/ocaml/Odoc_args/index.html @@ -0,0 +1,2 @@ + +Odoc_args (ocaml.Odoc_args)

Module Odoc_args

val current_generator : Odoc_gen.generator option ref
val set_generator : Odoc_gen.generator -> unit
val extend_html_generator : (module Odoc_gen.Html_functor) -> unit
val extend_latex_generator : (module Odoc_gen.Latex_functor) -> unit
val extend_texi_generator : (module Odoc_gen.Texi_functor) -> unit
val extend_man_generator : (module Odoc_gen.Man_functor) -> unit
val extend_dot_generator : (module Odoc_gen.Dot_functor) -> unit
val extend_base_generator : (module Odoc_gen.Base_functor) -> unit
val add_option : (string * Stdlib.Arg.spec * string) -> unit
val parse : unit -> unit
diff --git a/ocaml/Odoc_ast/Analyser/argument-1-_/index.html b/ocaml/Odoc_ast/Analyser/argument-1-_/index.html new file mode 100644 index 00000000..5ddf6516 --- /dev/null +++ b/ocaml/Odoc_ast/Analyser/argument-1-_/index.html @@ -0,0 +1,6 @@ + +_ (ocaml.Odoc_ast.Analyser._)

Parameter Analyser._

val all_special : string -> string -> int * Odoc_types.info list
val blank_line_outside_simple : string -> string -> bool
val just_after_special : string -> string -> int * Odoc_types.info option
val first_special : string -> string -> int * Odoc_types.info option
val get_comments : + (Odoc_types.text -> 'a) -> + string -> + string -> + Odoc_types.info option * 'a list
diff --git a/ocaml/Odoc_ast/Analyser/index.html b/ocaml/Odoc_ast/Analyser/index.html new file mode 100644 index 00000000..bc59337c --- /dev/null +++ b/ocaml/Odoc_ast/Analyser/index.html @@ -0,0 +1,7 @@ + +Analyser (ocaml.Odoc_ast.Analyser)

Module Odoc_ast.Analyser

Parameters

Signature

val analyse_typed_tree : + string -> + string -> + Parsetree.structure -> + typedtree -> + Odoc_module.t_module
diff --git a/ocaml/Odoc_ast/Typedtree_search/index.html b/ocaml/Odoc_ast/Typedtree_search/index.html new file mode 100644 index 00000000..42ad2605 --- /dev/null +++ b/ocaml/Odoc_ast/Typedtree_search/index.html @@ -0,0 +1,21 @@ + +Typedtree_search (ocaml.Odoc_ast.Typedtree_search)

Module Odoc_ast.Typedtree_search

type ele
val tables : Typedtree.structure_item list -> tab * tab_values
val search_module : tab -> string -> Typedtree.module_expr
val search_module_type : tab -> string -> Typedtree.module_type_declaration
val search_extension : tab -> string -> Typedtree.type_extension
val search_type_declaration : tab -> string -> Typedtree.type_declaration
val search_class_exp : + tab -> + string -> + Typedtree.class_expr * Types.type_expr list
val search_class_type_declaration : + tab -> + string -> + Typedtree.class_type_declaration
val search_value : + tab_values -> + string -> + Typedtree.pattern * Typedtree.expression
val search_primitive : tab -> string -> Types.type_expr
val get_nth_inherit_class_expr : + Typedtree.class_structure -> + int -> + Typedtree.class_expr
val search_attribute_type : + Typedtree.class_structure -> + string -> + Types.type_expr
val search_method_expression : + Typedtree.class_structure -> + string -> + Typedtree.expression
diff --git a/ocaml/Odoc_ast/index.html b/ocaml/Odoc_ast/index.html new file mode 100644 index 00000000..c233aea9 --- /dev/null +++ b/ocaml/Odoc_ast/index.html @@ -0,0 +1,2 @@ + +Odoc_ast (ocaml.Odoc_ast)

Module Odoc_ast

module Analyser (_ : Odoc_sig.Info_retriever) : sig ... end
diff --git a/ocaml/Odoc_class/index.html b/ocaml/Odoc_class/index.html new file mode 100644 index 00000000..c5258a81 --- /dev/null +++ b/ocaml/Odoc_class/index.html @@ -0,0 +1,11 @@ + +Odoc_class (ocaml.Odoc_class)

Module Odoc_class

module Name = Odoc_name
type class_element =
  1. | Class_attribute of Odoc_value.t_attribute
  2. | Class_method of Odoc_value.t_method
  3. | Class_comment of Odoc_types.text
type cct =
  1. | Cl of t_class
  2. | Cltype of t_class_type * Types.type_expr list
and inherited_class = {
  1. ic_name : Name.t;
  2. mutable ic_class : cct option;
  3. ic_text : Odoc_types.text option;
}
and class_apply = {
  1. capp_name : Name.t;
  2. mutable capp_class : t_class option;
  3. capp_params : Types.type_expr list;
  4. capp_params_code : string list;
}
and class_constr = {
  1. cco_name : Name.t;
  2. mutable cco_class : cct option;
  3. cco_type_parameters : Types.type_expr list;
}
and class_kind =
  1. | Class_structure of inherited_class list * class_element list
  2. | Class_apply of class_apply
  3. | Class_constr of class_constr
  4. | Class_constraint of class_kind * class_type_kind
and t_class = {
  1. cl_name : Name.t;
  2. mutable cl_info : Odoc_types.info option;
  3. cl_type : Types.class_type;
  4. cl_type_parameters : Types.type_expr list;
  5. cl_virtual : bool;
  6. mutable cl_kind : class_kind;
  7. mutable cl_parameters : Odoc_parameter.parameter list;
  8. mutable cl_loc : Odoc_types.location;
}
and class_type_alias = {
  1. cta_name : Name.t;
  2. mutable cta_class : cct option;
  3. cta_type_parameters : Types.type_expr list;
}
and class_type_kind =
  1. | Class_signature of inherited_class list * class_element list
  2. | Class_type of class_type_alias
and t_class_type = {
  1. clt_name : Name.t;
  2. mutable clt_info : Odoc_types.info option;
  3. clt_type : Types.class_type;
  4. clt_type_parameters : Types.type_expr list;
  5. clt_virtual : bool;
  6. mutable clt_kind : class_type_kind;
  7. mutable clt_loc : Odoc_types.location;
}
val class_parameter_text_by_name : t_class -> string -> Odoc_types.text option
val class_elements : ?trans:bool -> t_class -> class_element list
val class_type_elements : ?trans:bool -> t_class_type -> class_element list
val class_attributes : ?trans:bool -> t_class -> Odoc_value.t_attribute list
val class_methods : ?trans:bool -> t_class -> Odoc_value.t_method list
val class_comments : ?trans:bool -> t_class -> Odoc_types.text list
val class_update_parameters_text : t_class -> unit
val class_type_attributes : + ?trans:bool -> + t_class_type -> + Odoc_value.t_attribute list
val class_type_methods : + ?trans:bool -> + t_class_type -> + Odoc_value.t_method list
val class_type_comments : ?trans:bool -> t_class_type -> Odoc_types.text list
val class_type_parameter_text_by_name : + t_class_type -> + string -> + Odoc_types.text option
diff --git a/ocaml/Odoc_comments/Basic_info_retriever/index.html b/ocaml/Odoc_comments/Basic_info_retriever/index.html new file mode 100644 index 00000000..0c4e4dd7 --- /dev/null +++ b/ocaml/Odoc_comments/Basic_info_retriever/index.html @@ -0,0 +1,6 @@ + +Basic_info_retriever (ocaml.Odoc_comments.Basic_info_retriever)

Module Odoc_comments.Basic_info_retriever

val blank_line_outside_simple : string -> string -> bool
val all_special : string -> string -> int * Odoc_types.info list
val just_after_special : string -> string -> int * Odoc_types.info option
val first_special : string -> string -> int * Odoc_types.info option
val get_comments : + (Odoc_types.text -> 'a) -> + string -> + string -> + Odoc_types.info option * 'a list
diff --git a/ocaml/Odoc_comments/index.html b/ocaml/Odoc_comments/index.html new file mode 100644 index 00000000..fa1e3804 --- /dev/null +++ b/ocaml/Odoc_comments/index.html @@ -0,0 +1,5 @@ + +Odoc_comments (ocaml.Odoc_comments)

Module Odoc_comments

val simple_blank : string
module type Texter = sig ... end
module Basic_info_retriever : sig ... end
val info_of_string : string -> Odoc_types.info
val info_of_comment_file : + Odoc_module.t_module list -> + string -> + Odoc_types.info
diff --git a/ocaml/Odoc_comments/module-type-Texter/index.html b/ocaml/Odoc_comments/module-type-Texter/index.html new file mode 100644 index 00000000..ec44c0b7 --- /dev/null +++ b/ocaml/Odoc_comments/module-type-Texter/index.html @@ -0,0 +1,2 @@ + +Texter (ocaml.Odoc_comments.Texter)

Module type Odoc_comments.Texter

val text_of_string : string -> Odoc_types.text
diff --git a/ocaml/Odoc_comments_global/index.html b/ocaml/Odoc_comments_global/index.html new file mode 100644 index 00000000..83acbc3f --- /dev/null +++ b/ocaml/Odoc_comments_global/index.html @@ -0,0 +1,2 @@ + +Odoc_comments_global (ocaml.Odoc_comments_global)

Module Odoc_comments_global

val nb_chars : int ref
val authors : string list ref
val version : string option ref
val sees : string list ref
val since : string option ref
val before : (string * string) list ref
val deprecated : string option ref
val params : (string * string) list ref
val raised_exceptions : (string * string) list ref
val return_value : string option ref
val customs : (string * string) list ref
val init : unit -> unit
diff --git a/ocaml/Odoc_config/index.html b/ocaml/Odoc_config/index.html new file mode 100644 index 00000000..05c8352b --- /dev/null +++ b/ocaml/Odoc_config/index.html @@ -0,0 +1,2 @@ + +Odoc_config (ocaml.Odoc_config)

Module Odoc_config

val custom_generators_path : string
val print_warnings : bool ref
diff --git a/ocaml/Odoc_cross/index.html b/ocaml/Odoc_cross/index.html new file mode 100644 index 00000000..29aea9ef --- /dev/null +++ b/ocaml/Odoc_cross/index.html @@ -0,0 +1,6 @@ + +Odoc_cross (ocaml.Odoc_cross)

Module Odoc_cross

val associate : Odoc_module.t_module list -> unit
val assoc_comments_info : + string -> + Odoc_module.t_module list -> + Odoc_types.info -> + Odoc_types.info
diff --git a/ocaml/Odoc_dag2html/index.html b/ocaml/Odoc_dag2html/index.html new file mode 100644 index 00000000..386d0756 --- /dev/null +++ b/ocaml/Odoc_dag2html/index.html @@ -0,0 +1,5 @@ + +Odoc_dag2html (ocaml.Odoc_dag2html)

Module Odoc_dag2html

type !'a dag = {
  1. mutable dag : 'a node array;
}
and !'a node = {
  1. mutable pare : idag list;
  2. valu : 'a;
  3. mutable chil : idag list;
}
and idag = int
val html_of_dag : string dag -> string
val create_class_dag : + Odoc_info.Class.t_class list -> + Odoc_info.Class.t_class_type list -> + (Odoc_info.Name.t * Odoc_info.Class.cct option) dag
diff --git a/ocaml/Odoc_dep/index.html b/ocaml/Odoc_dep/index.html new file mode 100644 index 00000000..eb6ed2d5 --- /dev/null +++ b/ocaml/Odoc_dep/index.html @@ -0,0 +1,5 @@ + +Odoc_dep (ocaml.Odoc_dep)

Module Odoc_dep

Top modules dependencies.

val impl_dependencies : Parsetree.structure -> Misc.Stdlib.String.Set.elt list
val intf_dependencies : Parsetree.signature -> Misc.Stdlib.String.Set.elt list
val kernel_deps_of_modules : Odoc_module.t_module list -> unit
val deps_of_types : + ?kernel:bool -> + Odoc_type.t_type list -> + (Odoc_type.t_type * Misc.Stdlib.String.Set.elt list) list
diff --git a/ocaml/Odoc_dot/Generator/class-dot/index.html b/ocaml/Odoc_dot/Generator/class-dot/index.html new file mode 100644 index 00000000..6c2771bf --- /dev/null +++ b/ocaml/Odoc_dot/Generator/class-dot/index.html @@ -0,0 +1,11 @@ + +dot (ocaml.Odoc_dot.Generator.dot)

Class Generator.dot

val mutable colors : string list
val mutable loc_colors : (Odoc_info.Name.t * string) list
val mutable modules : Odoc_info.Module.t_module list
method generate : Odoc_info.Module.t_module list -> unit
method generate_for_module : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method generate_for_type : Format.formatter -> + (Odoc_info.Type.t_type * Odoc_info.Name.t list) -> + unit
method generate_modules : Odoc_info.Module.t_module list -> unit
method generate_types : Odoc_info.Type.t_type list -> unit
method get_one_color : string option
method header : string
method node_color : Odoc_info.Name.t -> string option
method print_module_atts : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method print_one_dep : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Name.t -> + unit
method print_type_atts : Format.formatter -> Odoc_info.Type.t_type -> unit
diff --git a/ocaml/Odoc_dot/Generator/index.html b/ocaml/Odoc_dot/Generator/index.html new file mode 100644 index 00000000..7a6497e0 --- /dev/null +++ b/ocaml/Odoc_dot/Generator/index.html @@ -0,0 +1,2 @@ + +Generator (ocaml.Odoc_dot.Generator)

Module Odoc_dot.Generator

class dot : object ... end
diff --git a/ocaml/Odoc_dot/index.html b/ocaml/Odoc_dot/index.html new file mode 100644 index 00000000..3d706831 --- /dev/null +++ b/ocaml/Odoc_dot/index.html @@ -0,0 +1,2 @@ + +Odoc_dot (ocaml.Odoc_dot)

Module Odoc_dot

Definition of a class which outputs a dot file showing top modules dependencies.

val dot_include_all : bool ref
val dot_types : bool ref
val dot_reduce : bool ref
val dot_colors : string list ref
module Generator : sig ... end
module type Dot_generator = sig ... end
diff --git a/ocaml/Odoc_dot/module-type-Dot_generator/class-dot/index.html b/ocaml/Odoc_dot/module-type-Dot_generator/class-dot/index.html new file mode 100644 index 00000000..6e0b9990 --- /dev/null +++ b/ocaml/Odoc_dot/module-type-Dot_generator/class-dot/index.html @@ -0,0 +1,11 @@ + +dot (ocaml.Odoc_dot.Dot_generator.dot)

Class Dot_generator.dot

val mutable colors : string list
val mutable loc_colors : (Odoc_info.Name.t * string) list
val mutable modules : Odoc_info.Module.t_module list
method generate : Odoc_info.Module.t_module list -> unit
method generate_for_module : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method generate_for_type : Format.formatter -> + (Odoc_info.Type.t_type * Odoc_info.Name.t list) -> + unit
method generate_modules : Odoc_info.Module.t_module list -> unit
method generate_types : Odoc_info.Type.t_type list -> unit
method get_one_color : string option
method header : string
method node_color : Odoc_info.Name.t -> string option
method print_module_atts : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method print_one_dep : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Name.t -> + unit
method print_type_atts : Format.formatter -> Odoc_info.Type.t_type -> unit
diff --git a/ocaml/Odoc_dot/module-type-Dot_generator/index.html b/ocaml/Odoc_dot/module-type-Dot_generator/index.html new file mode 100644 index 00000000..41b6e2aa --- /dev/null +++ b/ocaml/Odoc_dot/module-type-Dot_generator/index.html @@ -0,0 +1,2 @@ + +Dot_generator (ocaml.Odoc_dot.Dot_generator)

Module type Odoc_dot.Dot_generator

class dot : object ... end
diff --git a/ocaml/Odoc_env/index.html b/ocaml/Odoc_env/index.html new file mode 100644 index 00000000..71b782d3 --- /dev/null +++ b/ocaml/Odoc_env/index.html @@ -0,0 +1,2 @@ + +Odoc_env (ocaml.Odoc_env)

Module Odoc_env

type env
val empty : env
val add_signature : env -> string -> ?rel:string -> Types.signature -> env
val add_extension : env -> Odoc_name.t -> env
val add_type : env -> Odoc_name.t -> env
val add_value : env -> Odoc_name.t -> env
val add_module : env -> Odoc_name.t -> env
val add_module_type : env -> Odoc_name.t -> env
val add_class : env -> Odoc_name.t -> env
val add_class_type : env -> Odoc_name.t -> env
val full_module_name : env -> Odoc_name.t -> Odoc_name.t
val full_module_type_name : env -> Odoc_name.t -> Odoc_name.t
val full_module_or_module_type_name : env -> Odoc_name.t -> Odoc_name.t
val full_type_name : env -> Odoc_name.t -> Odoc_name.t
val full_value_name : env -> Odoc_name.t -> Odoc_name.t
val full_extension_constructor_name : env -> Odoc_name.t -> Odoc_name.t
val full_class_name : env -> Odoc_name.t -> Odoc_name.t
val full_class_type_name : env -> Odoc_name.t -> Odoc_name.t
val full_class_or_class_type_name : env -> Odoc_name.t -> Odoc_name.t
val subst_type : env -> Types.type_expr -> Types.type_expr
val subst_module_type : env -> Types.module_type -> Types.module_type
val subst_class_type : env -> Types.class_type -> Types.class_type
diff --git a/ocaml/Odoc_exception/index.html b/ocaml/Odoc_exception/index.html new file mode 100644 index 00000000..e5e2b540 --- /dev/null +++ b/ocaml/Odoc_exception/index.html @@ -0,0 +1,2 @@ + +Odoc_exception (ocaml.Odoc_exception)

Module Odoc_exception

module Name = Odoc_name
type exception_alias = {
  1. ea_name : Name.t;
  2. mutable ea_ex : t_exception option;
}
and t_exception = {
  1. ex_name : Name.t;
  2. mutable ex_info : Odoc_types.info option;
  3. ex_args : Odoc_type.constructor_args;
  4. ex_ret : Types.type_expr option;
  5. ex_alias : exception_alias option;
  6. mutable ex_loc : Odoc_types.location;
  7. mutable ex_code : string option;
}
diff --git a/ocaml/Odoc_extension/index.html b/ocaml/Odoc_extension/index.html new file mode 100644 index 00000000..b47c65e2 --- /dev/null +++ b/ocaml/Odoc_extension/index.html @@ -0,0 +1,2 @@ + +Odoc_extension (ocaml.Odoc_extension)

Module Odoc_extension

Representation and manipulation of type extensions.

module Name = Odoc_name
type private_flag = Asttypes.private_flag =
  1. | Private
  2. | Public
type extension_alias = {
  1. xa_name : Name.t;
  2. mutable xa_xt : t_extension_constructor option;
}
and t_extension_constructor = {
  1. xt_name : Name.t;
  2. xt_args : Odoc_type.constructor_args;
  3. xt_ret : Types.type_expr option;
  4. xt_type_extension : t_type_extension;
  5. xt_alias : extension_alias option;
  6. mutable xt_loc : Odoc_types.location;
  7. mutable xt_text : Odoc_types.info option;
}
and t_type_extension = {
  1. mutable te_info : Odoc_types.info option;
  2. te_type_name : Name.t;
  3. te_type_parameters : Types.type_expr list;
  4. te_private : private_flag;
  5. mutable te_constructors : t_extension_constructor list;
  6. mutable te_loc : Odoc_types.location;
  7. mutable te_code : string option;
}
val extension_constructors : t_type_extension -> t_extension_constructor list
diff --git a/ocaml/Odoc_gen/Base_generator/class-generator/index.html b/ocaml/Odoc_gen/Base_generator/class-generator/index.html new file mode 100644 index 00000000..65dbbbf5 --- /dev/null +++ b/ocaml/Odoc_gen/Base_generator/class-generator/index.html @@ -0,0 +1,2 @@ + +generator (ocaml.Odoc_gen.Base_generator.generator)

Class Base_generator.generator

method generate : Odoc_module.t_module list -> unit
diff --git a/ocaml/Odoc_gen/Base_generator/index.html b/ocaml/Odoc_gen/Base_generator/index.html new file mode 100644 index 00000000..463e2621 --- /dev/null +++ b/ocaml/Odoc_gen/Base_generator/index.html @@ -0,0 +1,2 @@ + +Base_generator (ocaml.Odoc_gen.Base_generator)

Module Odoc_gen.Base_generator

diff --git a/ocaml/Odoc_gen/class-type-doc_generator/index.html b/ocaml/Odoc_gen/class-type-doc_generator/index.html new file mode 100644 index 00000000..96df542c --- /dev/null +++ b/ocaml/Odoc_gen/class-type-doc_generator/index.html @@ -0,0 +1,2 @@ + +doc_generator (ocaml.Odoc_gen.doc_generator)

Class type Odoc_gen.doc_generator

method generate : Odoc_module.t_module list -> unit
diff --git a/ocaml/Odoc_gen/index.html b/ocaml/Odoc_gen/index.html new file mode 100644 index 00000000..cfc4c592 --- /dev/null +++ b/ocaml/Odoc_gen/index.html @@ -0,0 +1,12 @@ + +Odoc_gen (ocaml.Odoc_gen)

Module Odoc_gen

class type doc_generator = object ... end
module type Base = sig ... end
module type Base_functor = functor (_ : Base) -> Base
type generator =
  1. | Html of (module Odoc_html.Html_generator)
  2. | Latex of (module Odoc_latex.Latex_generator)
  3. | Texi of (module Odoc_texi.Texi_generator)
  4. | Man of (module Odoc_man.Man_generator)
  5. | Dot of (module Odoc_dot.Dot_generator)
  6. | Base of (module Base)
val get_minimal_generator : generator -> doc_generator
diff --git a/ocaml/Odoc_gen/module-type-Base/class-generator/index.html b/ocaml/Odoc_gen/module-type-Base/class-generator/index.html new file mode 100644 index 00000000..a2b55337 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Base/class-generator/index.html @@ -0,0 +1,2 @@ + +generator (ocaml.Odoc_gen.Base.generator)

Class Base.generator

method generate : Odoc_module.t_module list -> unit
diff --git a/ocaml/Odoc_gen/module-type-Base/index.html b/ocaml/Odoc_gen/module-type-Base/index.html new file mode 100644 index 00000000..ac4831d2 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Base/index.html @@ -0,0 +1,2 @@ + +Base (ocaml.Odoc_gen.Base)

Module type Odoc_gen.Base

diff --git a/ocaml/Odoc_gen/module-type-Base_functor/argument-1-_/class-generator/index.html b/ocaml/Odoc_gen/module-type-Base_functor/argument-1-_/class-generator/index.html new file mode 100644 index 00000000..a75c08df --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Base_functor/argument-1-_/class-generator/index.html @@ -0,0 +1,2 @@ + +generator (ocaml.Odoc_gen.Base_functor._.generator)

Class _.generator

method generate : Odoc_module.t_module list -> unit
diff --git a/ocaml/Odoc_gen/module-type-Base_functor/argument-1-_/index.html b/ocaml/Odoc_gen/module-type-Base_functor/argument-1-_/index.html new file mode 100644 index 00000000..a24c078b --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Base_functor/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Odoc_gen.Base_functor._)

Parameter Base_functor._

diff --git a/ocaml/Odoc_gen/module-type-Base_functor/class-generator/index.html b/ocaml/Odoc_gen/module-type-Base_functor/class-generator/index.html new file mode 100644 index 00000000..d1b4ea00 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Base_functor/class-generator/index.html @@ -0,0 +1,2 @@ + +generator (ocaml.Odoc_gen.Base_functor.generator)

Class Base_functor.generator

method generate : Odoc_module.t_module list -> unit
diff --git a/ocaml/Odoc_gen/module-type-Base_functor/index.html b/ocaml/Odoc_gen/module-type-Base_functor/index.html new file mode 100644 index 00000000..fb5d1a69 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Base_functor/index.html @@ -0,0 +1,2 @@ + +Base_functor (ocaml.Odoc_gen.Base_functor)

Module type Odoc_gen.Base_functor

Parameters

module _ : Base

Signature

diff --git a/ocaml/Odoc_gen/module-type-Dot_functor/argument-1-_/class-dot/index.html b/ocaml/Odoc_gen/module-type-Dot_functor/argument-1-_/class-dot/index.html new file mode 100644 index 00000000..b619bd29 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Dot_functor/argument-1-_/class-dot/index.html @@ -0,0 +1,11 @@ + +dot (ocaml.Odoc_gen.Dot_functor._.dot)

Class _.dot

val mutable colors : string list
val mutable loc_colors : (Odoc_info.Name.t * string) list
val mutable modules : Odoc_info.Module.t_module list
method generate : Odoc_info.Module.t_module list -> unit
method generate_for_module : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method generate_for_type : Format.formatter -> + (Odoc_info.Type.t_type * Odoc_info.Name.t list) -> + unit
method generate_modules : Odoc_info.Module.t_module list -> unit
method generate_types : Odoc_info.Type.t_type list -> unit
method get_one_color : string option
method header : string
method node_color : Odoc_info.Name.t -> string option
method print_module_atts : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method print_one_dep : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Name.t -> + unit
method print_type_atts : Format.formatter -> Odoc_info.Type.t_type -> unit
diff --git a/ocaml/Odoc_gen/module-type-Dot_functor/argument-1-_/index.html b/ocaml/Odoc_gen/module-type-Dot_functor/argument-1-_/index.html new file mode 100644 index 00000000..368d4042 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Dot_functor/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Odoc_gen.Dot_functor._)

Parameter Dot_functor._

class dot : object ... end
diff --git a/ocaml/Odoc_gen/module-type-Dot_functor/class-dot/index.html b/ocaml/Odoc_gen/module-type-Dot_functor/class-dot/index.html new file mode 100644 index 00000000..bd7fabee --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Dot_functor/class-dot/index.html @@ -0,0 +1,11 @@ + +dot (ocaml.Odoc_gen.Dot_functor.dot)

Class Dot_functor.dot

val mutable colors : string list
val mutable loc_colors : (Odoc_info.Name.t * string) list
val mutable modules : Odoc_info.Module.t_module list
method generate : Odoc_info.Module.t_module list -> unit
method generate_for_module : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method generate_for_type : Format.formatter -> + (Odoc_info.Type.t_type * Odoc_info.Name.t list) -> + unit
method generate_modules : Odoc_info.Module.t_module list -> unit
method generate_types : Odoc_info.Type.t_type list -> unit
method get_one_color : string option
method header : string
method node_color : Odoc_info.Name.t -> string option
method print_module_atts : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method print_one_dep : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Name.t -> + unit
method print_type_atts : Format.formatter -> Odoc_info.Type.t_type -> unit
diff --git a/ocaml/Odoc_gen/module-type-Dot_functor/index.html b/ocaml/Odoc_gen/module-type-Dot_functor/index.html new file mode 100644 index 00000000..2e4a4d72 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Dot_functor/index.html @@ -0,0 +1,2 @@ + +Dot_functor (ocaml.Odoc_gen.Dot_functor)

Module type Odoc_gen.Dot_functor

Parameters

Signature

class dot : object ... end
diff --git a/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/class-html/index.html b/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/class-html/index.html new file mode 100644 index 00000000..a7d38dd0 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/class-html/index.html @@ -0,0 +1,166 @@ + +html (ocaml.Odoc_gen.Html_functor._.html)

Class _.html

val mutable default_style_options : string list
val mutable doctype : string
val mutable header : Buffer.t -> + ?nav: + (Odoc_info.Name.t option * Odoc_info.Name.t option * Odoc_info.Name.t) + option -> + ?comments:Odoc_info.text list -> + string -> + unit
val mutable known_classes_names : Odoc_html.String.Set.t
val mutable known_modules_names : Odoc_html.String.Set.t
val mutable known_types_names : Odoc_html.String.Set.t
val mutable list_attributes : Odoc_info.Value.t_attribute list
val mutable list_class_types : Odoc_info.Class.t_class_type list
val mutable list_classes : Odoc_info.Class.t_class list
val mutable list_exceptions : Odoc_info.Exception.t_exception list
val mutable list_extensions : Odoc_info.Extension.t_extension_constructor list
val mutable list_methods : Odoc_info.Value.t_method list
val mutable list_module_types : Odoc_info.Module.t_module_type list
val mutable list_modules : Odoc_info.Module.t_module list
val mutable list_types : Odoc_info.Type.t_type list
val mutable list_values : Odoc_info.Value.t_value list
val mutable style : string
val mutable style_file : string
val mutable tag_functions : (string * (Odoc_info.text -> string)) list
method character_encoding : Buffer.t -> unit
method constructor : string -> string
method create_title_label : (int * string option * Odoc_info.text) -> string
method escape : string -> string
method generate : Odoc_info.Module.t_module list -> unit
method generate_attributes_index : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : Buffer.t -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : Buffer.t -> + Odoc_info.Class.t_class_type -> + unit
method generate_class_types_index : Odoc_info.Module.t_module list -> unit
method generate_classes_index : Odoc_info.Module.t_module list -> unit
method generate_elements : ('a option -> 'a option -> 'a -> unit) -> + 'a list -> + unit
method generate_elements_index : ?strip_libname:bool -> + 'a list -> + ('a -> Odoc_info.Name.t) -> + ('a -> Odoc_info.info option) -> + ('a -> string) -> + string -> + string -> + unit
method generate_exceptions_index : Odoc_info.Module.t_module list -> unit
method generate_extensions_index : Odoc_info.Module.t_module list -> unit
method generate_for_class : Odoc_info.Class.t_class option -> + Odoc_info.Class.t_class option -> + Odoc_info.Class.t_class -> + unit
method generate_for_class_type : Odoc_info.Class.t_class_type option -> + Odoc_info.Class.t_class_type option -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_module : Odoc_info.Module.t_module option -> + Odoc_info.Module.t_module option -> + Odoc_info.Module.t_module -> + unit
method generate_for_module_type : Odoc_info.Module.t_module_type option -> + Odoc_info.Module.t_module_type option -> + Odoc_info.Module.t_module_type -> + unit
method generate_index : Odoc_info.Module.t_module list -> unit
method generate_inheritance_info : Buffer.t -> + Odoc_info.Class.inherited_class list -> + unit
method generate_methods_index : Odoc_info.Module.t_module list -> unit
method generate_module_types_index : Odoc_info.Module.t_module list -> unit
method generate_modules_index : Odoc_info.Module.t_module list -> unit
method generate_types_index : Odoc_info.Module.t_module list -> unit
method generate_values_index : Odoc_info.Module.t_module list -> unit
method html_of_Block : Buffer.t -> Odoc_info.text -> unit
method html_of_Bold : Buffer.t -> Odoc_info.text -> unit
method html_of_Center : Buffer.t -> Odoc_info.text -> unit
method html_of_Code : Buffer.t -> string -> unit
method html_of_CodePre : Buffer.t -> string -> unit
method html_of_Emphasize : Buffer.t -> Odoc_info.text -> unit
method html_of_Enum : Buffer.t -> Odoc_info.text list -> unit
method html_of_Index_list : Buffer.t -> unit
method html_of_Italic : Buffer.t -> Odoc_info.text -> unit
method html_of_Latex : Buffer.t -> string -> unit
method html_of_Left : Buffer.t -> Odoc_info.text -> unit
method html_of_List : Buffer.t -> Odoc_info.text list -> unit
method html_of_Module_list : Buffer.t -> Odoc_info.Name.t list -> unit
method html_of_Newline : Buffer.t -> unit
method html_of_Raw : Buffer.t -> string -> unit
method html_of_Ref : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.text option -> + unit
method html_of_Right : Buffer.t -> Odoc_info.text -> unit
method html_of_Subscript : Buffer.t -> Odoc_info.text -> unit
method html_of_Superscript : Buffer.t -> Odoc_info.text -> unit
method html_of_Target : Buffer.t -> target:string -> code:string -> unit
method html_of_Title : Buffer.t -> + int -> + string option -> + Odoc_info.text -> + unit
method html_of_Verbatim : Buffer.t -> string -> unit
method html_of_alerts : Buffer.t -> Odoc_info.alert list -> unit
method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
method html_of_author_list : Buffer.t -> string list -> unit
method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
method html_of_class : Buffer.t -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Class.t_class -> + unit
method html_of_class_comment : Buffer.t -> Odoc_info.text -> unit
method html_of_class_element : Buffer.t -> + Odoc_info.Class.class_element -> + unit
method html_of_class_kind : Buffer.t -> + Odoc_info.Name.t -> + ?cl:Odoc_info.Class.t_class -> + Odoc_info.Class.class_kind -> + unit
method html_of_class_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + unit
method html_of_class_type : Buffer.t -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Class.t_class_type -> + unit
method html_of_class_type_kind : Buffer.t -> + Odoc_info.Name.t -> + ?ct:Odoc_info.Class.t_class_type -> + Odoc_info.Class.class_type_kind -> + unit
method html_of_class_type_param_expr_list : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr list -> + unit
method html_of_code : Buffer.t -> ?with_pre:bool -> string -> unit
method html_of_cstr_args : ?par:bool -> + Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Name.t -> + string -> + Odoc_info.Type.constructor_args -> + unit
method html_of_custom : Buffer.t -> (string * Odoc_info.text) list -> unit
method html_of_custom_text : Buffer.t -> string -> Odoc_info.text -> unit
method html_of_dag : (Odoc_info.Name.t * Odoc_info.Class.cct option) + Odoc_dag2html.dag -> + string
method html_of_described_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_parameter.parameter list -> + unit
method html_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
method html_of_included_module : Buffer.t -> + Odoc_info.Module.included_module -> + unit
method html_of_info : ?cls:string -> + ?indent:bool -> + Buffer.t -> + Odoc_types.info option -> + unit
method html_of_info_first_sentence : Buffer.t -> Odoc_info.info option -> unit
method html_of_method : Buffer.t -> Odoc_info.Value.t_method -> unit
method html_of_modtype : Buffer.t -> + ?info:bool -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Module.t_module_type -> + unit
method html_of_module : Buffer.t -> + ?info:bool -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Module.t_module -> + unit
method html_of_module_comment : Buffer.t -> Odoc_info.text -> unit
method html_of_module_element : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + unit
method html_of_module_kind : Buffer.t -> + Odoc_info.Name.t -> + ?modu:Odoc_info.Module.t_module -> + Odoc_info.Module.module_kind -> + unit
method html_of_module_parameter : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method html_of_module_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + (Odoc_info.Module.module_parameter * Odoc_info.text option) list -> + unit
method html_of_module_parameter_type : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method html_of_module_type : Buffer.t -> + ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + unit
method html_of_module_type_kind : Buffer.t -> + Odoc_info.Name.t -> + ?modu:Odoc_info.Module.t_module -> + ?mt:Odoc_info.Module.t_module_type -> + Odoc_info.Module.module_type_kind -> + unit
method html_of_parameter_description : Buffer.t -> + Odoc_info.Parameter.parameter -> + unit
method html_of_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_parameter.parameter list -> + unit
method html_of_raised_exceptions : Buffer.t -> + (string * Odoc_info.text) list -> + unit
method html_of_record : father:Odoc_info.Name.t -> + close_env:string -> + (Odoc_info.Type.record_field -> string) -> + Buffer.t -> + Odoc_info.Type.record_field list -> + unit
method html_of_return_opt : Buffer.t -> Odoc_info.text option -> unit
method html_of_see : Buffer.t -> (Odoc_info.see_ref * Odoc_info.text) -> unit
method html_of_sees : Buffer.t -> + (Odoc_info.see_ref * Odoc_info.text) list -> + unit
method html_of_since_opt : Buffer.t -> string option -> unit
method html_of_text : ?with_p:bool -> Buffer.t -> Odoc_info.text -> unit
method html_of_text_element : Buffer.t -> Odoc_info.text_element -> unit
method html_of_text_with_p : Buffer.t -> Odoc_info.text -> unit
method html_of_type : Buffer.t -> Odoc_info.Type.t_type -> unit
method html_of_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr -> + unit
method html_of_type_expr_param_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method html_of_type_extension : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + unit
method html_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
method html_of_version_opt : Buffer.t -> string option -> unit
method index : string
method index_attributes : string
method index_class_types : string
method index_classes : string
method index_exceptions : string
method index_extensions : string
method index_methods : string
method index_module_types : string
method index_modules : string
method index_prefix : string
method index_types : string
method index_values : string
method init_style : unit
method inner_title : Odoc_info.Name.t -> string
method keep_alpha_num : string -> string
method keyword : string -> string
method label_of_text : Odoc_info.text -> string
method list_attributes : Odoc_info.Value.t_attribute list
method list_class_types : Odoc_info.Class.t_class_type list
method list_classes : Odoc_info.Class.t_class list
method list_exceptions : Odoc_info.Exception.t_exception list
method list_extensions : Odoc_info.Extension.t_extension_constructor list
method list_methods : Odoc_info.Value.t_method list
method list_module_types : Odoc_info.Module.t_module_type list
method list_modules : Odoc_info.Module.t_module list
method list_types : Odoc_info.Type.t_type list
method list_values : Odoc_info.Value.t_value list
method meta : Buffer.t -> unit
method output_class_type : Odoc_info.Name.t -> + string -> + Types.class_type -> + unit
method private output_code : ?with_pre:bool -> + Odoc_info.Name.t -> + string -> + string -> + unit
method output_module_type : Odoc_info.Name.t -> + string -> + Types.module_type -> + unit
method prepare_header : Odoc_info.Module.t_module list -> unit
method print_header : Buffer.t -> + ?nav: + (Odoc_info.Name.t option * Odoc_info.Name.t option * Odoc_info.Name.t) + option -> + ?comments:Odoc_info.text list -> + string -> + unit
method print_navbar : Buffer.t -> + Odoc_info.Name.t option -> + Odoc_info.Name.t option -> + Odoc_info.Name.t -> + unit
method title : string
diff --git a/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/index.html b/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/index.html new file mode 100644 index 00000000..e3efc943 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Odoc_gen.Html_functor._)

Parameter Html_functor._

class html : object ... end
diff --git a/ocaml/Odoc_gen/module-type-Html_functor/class-html/index.html b/ocaml/Odoc_gen/module-type-Html_functor/class-html/index.html new file mode 100644 index 00000000..bf4e5219 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Html_functor/class-html/index.html @@ -0,0 +1,166 @@ + +html (ocaml.Odoc_gen.Html_functor.html)

Class Html_functor.html

val mutable default_style_options : string list
val mutable doctype : string
val mutable header : Buffer.t -> + ?nav: + (Odoc_info.Name.t option * Odoc_info.Name.t option * Odoc_info.Name.t) + option -> + ?comments:Odoc_info.text list -> + string -> + unit
val mutable known_classes_names : Odoc_html.String.Set.t
val mutable known_modules_names : Odoc_html.String.Set.t
val mutable known_types_names : Odoc_html.String.Set.t
val mutable list_attributes : Odoc_info.Value.t_attribute list
val mutable list_class_types : Odoc_info.Class.t_class_type list
val mutable list_classes : Odoc_info.Class.t_class list
val mutable list_exceptions : Odoc_info.Exception.t_exception list
val mutable list_extensions : Odoc_info.Extension.t_extension_constructor list
val mutable list_methods : Odoc_info.Value.t_method list
val mutable list_module_types : Odoc_info.Module.t_module_type list
val mutable list_modules : Odoc_info.Module.t_module list
val mutable list_types : Odoc_info.Type.t_type list
val mutable list_values : Odoc_info.Value.t_value list
val mutable style : string
val mutable style_file : string
val mutable tag_functions : (string * (Odoc_info.text -> string)) list
method character_encoding : Buffer.t -> unit
method constructor : string -> string
method create_title_label : (int * string option * Odoc_info.text) -> string
method escape : string -> string
method generate : Odoc_info.Module.t_module list -> unit
method generate_attributes_index : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : Buffer.t -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : Buffer.t -> + Odoc_info.Class.t_class_type -> + unit
method generate_class_types_index : Odoc_info.Module.t_module list -> unit
method generate_classes_index : Odoc_info.Module.t_module list -> unit
method generate_elements : ('a option -> 'a option -> 'a -> unit) -> + 'a list -> + unit
method generate_elements_index : ?strip_libname:bool -> + 'a list -> + ('a -> Odoc_info.Name.t) -> + ('a -> Odoc_info.info option) -> + ('a -> string) -> + string -> + string -> + unit
method generate_exceptions_index : Odoc_info.Module.t_module list -> unit
method generate_extensions_index : Odoc_info.Module.t_module list -> unit
method generate_for_class : Odoc_info.Class.t_class option -> + Odoc_info.Class.t_class option -> + Odoc_info.Class.t_class -> + unit
method generate_for_class_type : Odoc_info.Class.t_class_type option -> + Odoc_info.Class.t_class_type option -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_module : Odoc_info.Module.t_module option -> + Odoc_info.Module.t_module option -> + Odoc_info.Module.t_module -> + unit
method generate_for_module_type : Odoc_info.Module.t_module_type option -> + Odoc_info.Module.t_module_type option -> + Odoc_info.Module.t_module_type -> + unit
method generate_index : Odoc_info.Module.t_module list -> unit
method generate_inheritance_info : Buffer.t -> + Odoc_info.Class.inherited_class list -> + unit
method generate_methods_index : Odoc_info.Module.t_module list -> unit
method generate_module_types_index : Odoc_info.Module.t_module list -> unit
method generate_modules_index : Odoc_info.Module.t_module list -> unit
method generate_types_index : Odoc_info.Module.t_module list -> unit
method generate_values_index : Odoc_info.Module.t_module list -> unit
method html_of_Block : Buffer.t -> Odoc_info.text -> unit
method html_of_Bold : Buffer.t -> Odoc_info.text -> unit
method html_of_Center : Buffer.t -> Odoc_info.text -> unit
method html_of_Code : Buffer.t -> string -> unit
method html_of_CodePre : Buffer.t -> string -> unit
method html_of_Emphasize : Buffer.t -> Odoc_info.text -> unit
method html_of_Enum : Buffer.t -> Odoc_info.text list -> unit
method html_of_Index_list : Buffer.t -> unit
method html_of_Italic : Buffer.t -> Odoc_info.text -> unit
method html_of_Latex : Buffer.t -> string -> unit
method html_of_Left : Buffer.t -> Odoc_info.text -> unit
method html_of_List : Buffer.t -> Odoc_info.text list -> unit
method html_of_Module_list : Buffer.t -> Odoc_info.Name.t list -> unit
method html_of_Newline : Buffer.t -> unit
method html_of_Raw : Buffer.t -> string -> unit
method html_of_Ref : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.text option -> + unit
method html_of_Right : Buffer.t -> Odoc_info.text -> unit
method html_of_Subscript : Buffer.t -> Odoc_info.text -> unit
method html_of_Superscript : Buffer.t -> Odoc_info.text -> unit
method html_of_Target : Buffer.t -> target:string -> code:string -> unit
method html_of_Title : Buffer.t -> + int -> + string option -> + Odoc_info.text -> + unit
method html_of_Verbatim : Buffer.t -> string -> unit
method html_of_alerts : Buffer.t -> Odoc_info.alert list -> unit
method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
method html_of_author_list : Buffer.t -> string list -> unit
method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
method html_of_class : Buffer.t -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Class.t_class -> + unit
method html_of_class_comment : Buffer.t -> Odoc_info.text -> unit
method html_of_class_element : Buffer.t -> + Odoc_info.Class.class_element -> + unit
method html_of_class_kind : Buffer.t -> + Odoc_info.Name.t -> + ?cl:Odoc_info.Class.t_class -> + Odoc_info.Class.class_kind -> + unit
method html_of_class_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + unit
method html_of_class_type : Buffer.t -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Class.t_class_type -> + unit
method html_of_class_type_kind : Buffer.t -> + Odoc_info.Name.t -> + ?ct:Odoc_info.Class.t_class_type -> + Odoc_info.Class.class_type_kind -> + unit
method html_of_class_type_param_expr_list : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr list -> + unit
method html_of_code : Buffer.t -> ?with_pre:bool -> string -> unit
method html_of_cstr_args : ?par:bool -> + Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Name.t -> + string -> + Odoc_info.Type.constructor_args -> + unit
method html_of_custom : Buffer.t -> (string * Odoc_info.text) list -> unit
method html_of_custom_text : Buffer.t -> string -> Odoc_info.text -> unit
method html_of_dag : (Odoc_info.Name.t * Odoc_info.Class.cct option) + Odoc_dag2html.dag -> + string
method html_of_described_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_parameter.parameter list -> + unit
method html_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
method html_of_included_module : Buffer.t -> + Odoc_info.Module.included_module -> + unit
method html_of_info : ?cls:string -> + ?indent:bool -> + Buffer.t -> + Odoc_types.info option -> + unit
method html_of_info_first_sentence : Buffer.t -> Odoc_info.info option -> unit
method html_of_method : Buffer.t -> Odoc_info.Value.t_method -> unit
method html_of_modtype : Buffer.t -> + ?info:bool -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Module.t_module_type -> + unit
method html_of_module : Buffer.t -> + ?info:bool -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Module.t_module -> + unit
method html_of_module_comment : Buffer.t -> Odoc_info.text -> unit
method html_of_module_element : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + unit
method html_of_module_kind : Buffer.t -> + Odoc_info.Name.t -> + ?modu:Odoc_info.Module.t_module -> + Odoc_info.Module.module_kind -> + unit
method html_of_module_parameter : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method html_of_module_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + (Odoc_info.Module.module_parameter * Odoc_info.text option) list -> + unit
method html_of_module_parameter_type : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method html_of_module_type : Buffer.t -> + ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + unit
method html_of_module_type_kind : Buffer.t -> + Odoc_info.Name.t -> + ?modu:Odoc_info.Module.t_module -> + ?mt:Odoc_info.Module.t_module_type -> + Odoc_info.Module.module_type_kind -> + unit
method html_of_parameter_description : Buffer.t -> + Odoc_info.Parameter.parameter -> + unit
method html_of_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_parameter.parameter list -> + unit
method html_of_raised_exceptions : Buffer.t -> + (string * Odoc_info.text) list -> + unit
method html_of_record : father:Odoc_info.Name.t -> + close_env:string -> + (Odoc_info.Type.record_field -> string) -> + Buffer.t -> + Odoc_info.Type.record_field list -> + unit
method html_of_return_opt : Buffer.t -> Odoc_info.text option -> unit
method html_of_see : Buffer.t -> (Odoc_info.see_ref * Odoc_info.text) -> unit
method html_of_sees : Buffer.t -> + (Odoc_info.see_ref * Odoc_info.text) list -> + unit
method html_of_since_opt : Buffer.t -> string option -> unit
method html_of_text : ?with_p:bool -> Buffer.t -> Odoc_info.text -> unit
method html_of_text_element : Buffer.t -> Odoc_info.text_element -> unit
method html_of_text_with_p : Buffer.t -> Odoc_info.text -> unit
method html_of_type : Buffer.t -> Odoc_info.Type.t_type -> unit
method html_of_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr -> + unit
method html_of_type_expr_param_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method html_of_type_extension : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + unit
method html_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
method html_of_version_opt : Buffer.t -> string option -> unit
method index : string
method index_attributes : string
method index_class_types : string
method index_classes : string
method index_exceptions : string
method index_extensions : string
method index_methods : string
method index_module_types : string
method index_modules : string
method index_prefix : string
method index_types : string
method index_values : string
method init_style : unit
method inner_title : Odoc_info.Name.t -> string
method keep_alpha_num : string -> string
method keyword : string -> string
method label_of_text : Odoc_info.text -> string
method list_attributes : Odoc_info.Value.t_attribute list
method list_class_types : Odoc_info.Class.t_class_type list
method list_classes : Odoc_info.Class.t_class list
method list_exceptions : Odoc_info.Exception.t_exception list
method list_extensions : Odoc_info.Extension.t_extension_constructor list
method list_methods : Odoc_info.Value.t_method list
method list_module_types : Odoc_info.Module.t_module_type list
method list_modules : Odoc_info.Module.t_module list
method list_types : Odoc_info.Type.t_type list
method list_values : Odoc_info.Value.t_value list
method meta : Buffer.t -> unit
method output_class_type : Odoc_info.Name.t -> + string -> + Types.class_type -> + unit
method private output_code : ?with_pre:bool -> + Odoc_info.Name.t -> + string -> + string -> + unit
method output_module_type : Odoc_info.Name.t -> + string -> + Types.module_type -> + unit
method prepare_header : Odoc_info.Module.t_module list -> unit
method print_header : Buffer.t -> + ?nav: + (Odoc_info.Name.t option * Odoc_info.Name.t option * Odoc_info.Name.t) + option -> + ?comments:Odoc_info.text list -> + string -> + unit
method print_navbar : Buffer.t -> + Odoc_info.Name.t option -> + Odoc_info.Name.t option -> + Odoc_info.Name.t -> + unit
method title : string
diff --git a/ocaml/Odoc_gen/module-type-Html_functor/index.html b/ocaml/Odoc_gen/module-type-Html_functor/index.html new file mode 100644 index 00000000..8dac33fe --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Html_functor/index.html @@ -0,0 +1,2 @@ + +Html_functor (ocaml.Odoc_gen.Html_functor)

Module type Odoc_gen.Html_functor

Parameters

Signature

class html : object ... end
diff --git a/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/class-latex/index.html b/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/class-latex/index.html new file mode 100644 index 00000000..94a608b2 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/class-latex/index.html @@ -0,0 +1,140 @@ + +latex (ocaml.Odoc_gen.Latex_functor._.latex)

Class _.latex

val subst_strings : (Str.regexp * string) list
val subst_strings_code : (Str.regexp * string) list
val subst_strings_simple : (Str.regexp * string) list
val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
method attribute_label : ?no_:bool -> Odoc_info.Name.t -> string
method class_label : ?no_:bool -> Odoc_info.Name.t -> string
method class_type_label : ?no_:bool -> Odoc_info.Name.t -> string
method const_label : ?no_:bool -> Odoc_info.Name.t -> string
method entry_comment : (Format.formatter * (unit -> string)) -> + Odoc_info.info option -> + Odoc_info.text_element list
method escape : string -> string
method escape_code : string -> string
method escape_simple : string -> string
method exception_label : ?no_:bool -> Odoc_info.Name.t -> string
method extension_label : ?no_:bool -> Odoc_info.Name.t -> string
method first_and_rest_of_info : Odoc_info.info option -> + Odoc_info.text * Odoc_info.text
method generate : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_top_module : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method generate_inheritance_info : Format.formatter -> + Odoc_info.Class.inherited_class list -> + unit
method generate_style_file : unit
method label : ?no_:bool -> Odoc_info.Name.t -> string
method latex_for_class_index : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method latex_for_class_label : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method latex_for_class_type_index : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_for_class_type_label : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_for_module_index : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method latex_for_module_label : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method latex_for_module_type_index : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_for_module_type_label : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_header : Format.formatter -> + Odoc_info.Module.t_module list -> + unit
method latex_of_Block : Format.formatter -> Odoc_info.text -> unit
method latex_of_Bold : Format.formatter -> Odoc_info.text -> unit
method latex_of_Center : Format.formatter -> Odoc_info.text -> unit
method latex_of_Code : Format.formatter -> string -> unit
method latex_of_CodePre : Format.formatter -> string -> unit
method latex_of_Emphasize : Format.formatter -> Odoc_info.text -> unit
method latex_of_Enum : Format.formatter -> Odoc_info.text list -> unit
method latex_of_Italic : Format.formatter -> Odoc_info.text -> unit
method latex_of_Latex : Format.formatter -> string -> unit
method latex_of_Left : Format.formatter -> Odoc_info.text -> unit
method latex_of_List : Format.formatter -> Odoc_info.text list -> unit
method latex_of_Newline : Format.formatter -> unit
method latex_of_Raw : Format.formatter -> string -> unit
method latex_of_Ref : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.text option -> + unit
method latex_of_Right : Format.formatter -> Odoc_info.text -> unit
method latex_of_Subscript : Format.formatter -> Odoc_info.text -> unit
method latex_of_Superscript : Format.formatter -> Odoc_info.text -> unit
method latex_of_Target : Format.formatter -> + target:string -> + code:string -> + unit
method latex_of_Title : Format.formatter -> + int -> + Odoc_info.Name.t option -> + Odoc_info.text -> + unit
method latex_of_Verbatim : Format.formatter -> string -> unit
method latex_of_attribute : Format.formatter -> + Odoc_info.Value.t_attribute -> + unit
method latex_of_class : Format.formatter -> Odoc_info.Class.t_class -> unit
method latex_of_class_element : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_element -> + unit
method latex_of_class_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + unit
method latex_of_class_parameter_list : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + unit
method latex_of_class_type : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_of_class_type_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + unit
method latex_of_cstr_args : (Format.formatter * (unit -> string)) -> + Odoc_info.Name.t -> + (Odoc_info.Type.constructor_args * Types.type_expr option) -> + Odoc_info.text_element list
method latex_of_custom_text : Format.formatter -> + string -> + Odoc_info.text -> + unit
method latex_of_exception : Format.formatter -> + Odoc_info.Exception.t_exception -> + unit
method latex_of_included_module : Format.formatter -> + Odoc_info.Module.included_module -> + unit
method latex_of_info : Format.formatter -> + ?block:bool -> + Odoc_info.info option -> + unit
method latex_of_method : Format.formatter -> Odoc_info.Value.t_method -> unit
method latex_of_module : Format.formatter -> Odoc_info.Module.t_module -> unit
method latex_of_module_element : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + unit
method latex_of_module_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_kind -> + unit
method latex_of_module_parameter : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method latex_of_module_type : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_of_module_type_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_type_kind -> + unit
method latex_of_record : (Format.formatter * (unit -> string)) -> + Odoc_info.Name.t -> + Odoc_info.Type.record_field list -> + Odoc_info.text_element list
method latex_of_text : Format.formatter -> Odoc_info.text -> unit
method latex_of_text_element : Format.formatter -> + Odoc_info.text_element -> + unit
method latex_of_type : Format.formatter -> Odoc_info.Type.t_type -> unit
method latex_of_type_extension : Odoc_info.Name.t -> + Format.formatter -> + Odoc_info.Extension.t_type_extension -> + unit
method latex_of_type_params : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method latex_of_value : Format.formatter -> Odoc_info.Value.t_value -> unit
method make_label : string -> string
method make_ref : string -> string
method method_label : ?no_:bool -> Odoc_info.Name.t -> string
method module_label : ?no_:bool -> Odoc_info.Name.t -> string
method module_type_label : ?no_:bool -> Odoc_info.Name.t -> string
method normal_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + string
method normal_class_type : Odoc_info.Name.t -> Types.class_type -> string
method normal_class_type_param_list : Odoc_info.Name.t -> + Types.type_expr list -> + string
method normal_cstr_args : ?par:bool -> + Odoc_info.Name.t -> + Odoc_info.Type.constructor_args -> + string
method normal_module_type : ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + string
method normal_type : Odoc_info.Name.t -> Types.type_expr -> string
method normal_type_list : ?par:bool -> + Odoc_info.Name.t -> + string -> + Types.type_expr list -> + string
method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
method relative_idents : Odoc_info.Name.t -> string -> string
method relative_module_idents : Odoc_info.Name.t -> string -> string
method section_style : int -> string -> string
method subst : (Str.regexp * string) list -> string -> string
method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element list
method text_of_author_list : string list -> Odoc_info.text_element list
method text_of_before : (string * Odoc_info.text) list -> + Odoc_info.text_element list
method text_of_class_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + Odoc_info.text_element list
method text_of_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + Odoc_types.text
method text_of_class_type_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + Odoc_info.text_element list
method text_of_class_type_param_expr_list : Odoc_info.Name.t -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
method text_of_exception : Odoc_info.Exception.t_exception -> + Odoc_info.text_element list
method text_of_info : ?block:bool -> Odoc_info.info option -> Odoc_info.text
method text_of_method : Odoc_info.Value.t_method -> Odoc_info.text_element list
method text_of_module_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_kind -> + Odoc_info.text_element list
method text_of_module_parameter_list : (Odoc_info.Module.module_parameter + * Odoc_info.text_element list option) + list -> + Odoc_info.text_element list
method text_of_module_type : Types.module_type -> Odoc_info.text_element list
method text_of_module_type_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_type_kind -> + Odoc_info.text_element list
method text_of_parameter_description : Odoc_info.Parameter.parameter -> + Odoc_info.text
method text_of_parameter_list : Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + Odoc_info.text_element list
method text_of_raised_exceptions : Odoc_info.raised_exception list -> + Odoc_info.text_element list
method text_of_return_opt : Odoc_info.text option -> + Odoc_info.text_element list
method text_of_see : Odoc_info.see -> Odoc_info.text
method text_of_sees : Odoc_info.see list -> Odoc_info.text_element list
method text_of_short_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_since_opt : string option -> Odoc_info.text_element list
method text_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_type_expr_list : Odoc_info.Name.t -> + string -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_value : Odoc_info.Value.t_value -> Odoc_info.text_element list
method text_of_version_opt : string option -> Odoc_info.text_element list
method type_label : ?no_:bool -> Odoc_info.Name.t -> string
method value_label : ?no_:bool -> Odoc_info.Name.t -> string
diff --git a/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/index.html b/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/index.html new file mode 100644 index 00000000..415b0537 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Odoc_gen.Latex_functor._)

Parameter Latex_functor._

class latex : object ... end
diff --git a/ocaml/Odoc_gen/module-type-Latex_functor/class-latex/index.html b/ocaml/Odoc_gen/module-type-Latex_functor/class-latex/index.html new file mode 100644 index 00000000..8a608066 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Latex_functor/class-latex/index.html @@ -0,0 +1,140 @@ + +latex (ocaml.Odoc_gen.Latex_functor.latex)

Class Latex_functor.latex

val subst_strings : (Str.regexp * string) list
val subst_strings_code : (Str.regexp * string) list
val subst_strings_simple : (Str.regexp * string) list
val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
method attribute_label : ?no_:bool -> Odoc_info.Name.t -> string
method class_label : ?no_:bool -> Odoc_info.Name.t -> string
method class_type_label : ?no_:bool -> Odoc_info.Name.t -> string
method const_label : ?no_:bool -> Odoc_info.Name.t -> string
method entry_comment : (Format.formatter * (unit -> string)) -> + Odoc_info.info option -> + Odoc_info.text_element list
method escape : string -> string
method escape_code : string -> string
method escape_simple : string -> string
method exception_label : ?no_:bool -> Odoc_info.Name.t -> string
method extension_label : ?no_:bool -> Odoc_info.Name.t -> string
method first_and_rest_of_info : Odoc_info.info option -> + Odoc_info.text * Odoc_info.text
method generate : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_top_module : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method generate_inheritance_info : Format.formatter -> + Odoc_info.Class.inherited_class list -> + unit
method generate_style_file : unit
method label : ?no_:bool -> Odoc_info.Name.t -> string
method latex_for_class_index : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method latex_for_class_label : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method latex_for_class_type_index : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_for_class_type_label : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_for_module_index : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method latex_for_module_label : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method latex_for_module_type_index : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_for_module_type_label : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_header : Format.formatter -> + Odoc_info.Module.t_module list -> + unit
method latex_of_Block : Format.formatter -> Odoc_info.text -> unit
method latex_of_Bold : Format.formatter -> Odoc_info.text -> unit
method latex_of_Center : Format.formatter -> Odoc_info.text -> unit
method latex_of_Code : Format.formatter -> string -> unit
method latex_of_CodePre : Format.formatter -> string -> unit
method latex_of_Emphasize : Format.formatter -> Odoc_info.text -> unit
method latex_of_Enum : Format.formatter -> Odoc_info.text list -> unit
method latex_of_Italic : Format.formatter -> Odoc_info.text -> unit
method latex_of_Latex : Format.formatter -> string -> unit
method latex_of_Left : Format.formatter -> Odoc_info.text -> unit
method latex_of_List : Format.formatter -> Odoc_info.text list -> unit
method latex_of_Newline : Format.formatter -> unit
method latex_of_Raw : Format.formatter -> string -> unit
method latex_of_Ref : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.text option -> + unit
method latex_of_Right : Format.formatter -> Odoc_info.text -> unit
method latex_of_Subscript : Format.formatter -> Odoc_info.text -> unit
method latex_of_Superscript : Format.formatter -> Odoc_info.text -> unit
method latex_of_Target : Format.formatter -> + target:string -> + code:string -> + unit
method latex_of_Title : Format.formatter -> + int -> + Odoc_info.Name.t option -> + Odoc_info.text -> + unit
method latex_of_Verbatim : Format.formatter -> string -> unit
method latex_of_attribute : Format.formatter -> + Odoc_info.Value.t_attribute -> + unit
method latex_of_class : Format.formatter -> Odoc_info.Class.t_class -> unit
method latex_of_class_element : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_element -> + unit
method latex_of_class_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + unit
method latex_of_class_parameter_list : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + unit
method latex_of_class_type : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_of_class_type_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + unit
method latex_of_cstr_args : (Format.formatter * (unit -> string)) -> + Odoc_info.Name.t -> + (Odoc_info.Type.constructor_args * Types.type_expr option) -> + Odoc_info.text_element list
method latex_of_custom_text : Format.formatter -> + string -> + Odoc_info.text -> + unit
method latex_of_exception : Format.formatter -> + Odoc_info.Exception.t_exception -> + unit
method latex_of_included_module : Format.formatter -> + Odoc_info.Module.included_module -> + unit
method latex_of_info : Format.formatter -> + ?block:bool -> + Odoc_info.info option -> + unit
method latex_of_method : Format.formatter -> Odoc_info.Value.t_method -> unit
method latex_of_module : Format.formatter -> Odoc_info.Module.t_module -> unit
method latex_of_module_element : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + unit
method latex_of_module_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_kind -> + unit
method latex_of_module_parameter : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method latex_of_module_type : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_of_module_type_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_type_kind -> + unit
method latex_of_record : (Format.formatter * (unit -> string)) -> + Odoc_info.Name.t -> + Odoc_info.Type.record_field list -> + Odoc_info.text_element list
method latex_of_text : Format.formatter -> Odoc_info.text -> unit
method latex_of_text_element : Format.formatter -> + Odoc_info.text_element -> + unit
method latex_of_type : Format.formatter -> Odoc_info.Type.t_type -> unit
method latex_of_type_extension : Odoc_info.Name.t -> + Format.formatter -> + Odoc_info.Extension.t_type_extension -> + unit
method latex_of_type_params : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method latex_of_value : Format.formatter -> Odoc_info.Value.t_value -> unit
method make_label : string -> string
method make_ref : string -> string
method method_label : ?no_:bool -> Odoc_info.Name.t -> string
method module_label : ?no_:bool -> Odoc_info.Name.t -> string
method module_type_label : ?no_:bool -> Odoc_info.Name.t -> string
method normal_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + string
method normal_class_type : Odoc_info.Name.t -> Types.class_type -> string
method normal_class_type_param_list : Odoc_info.Name.t -> + Types.type_expr list -> + string
method normal_cstr_args : ?par:bool -> + Odoc_info.Name.t -> + Odoc_info.Type.constructor_args -> + string
method normal_module_type : ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + string
method normal_type : Odoc_info.Name.t -> Types.type_expr -> string
method normal_type_list : ?par:bool -> + Odoc_info.Name.t -> + string -> + Types.type_expr list -> + string
method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
method relative_idents : Odoc_info.Name.t -> string -> string
method relative_module_idents : Odoc_info.Name.t -> string -> string
method section_style : int -> string -> string
method subst : (Str.regexp * string) list -> string -> string
method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element list
method text_of_author_list : string list -> Odoc_info.text_element list
method text_of_before : (string * Odoc_info.text) list -> + Odoc_info.text_element list
method text_of_class_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + Odoc_info.text_element list
method text_of_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + Odoc_types.text
method text_of_class_type_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + Odoc_info.text_element list
method text_of_class_type_param_expr_list : Odoc_info.Name.t -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
method text_of_exception : Odoc_info.Exception.t_exception -> + Odoc_info.text_element list
method text_of_info : ?block:bool -> Odoc_info.info option -> Odoc_info.text
method text_of_method : Odoc_info.Value.t_method -> Odoc_info.text_element list
method text_of_module_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_kind -> + Odoc_info.text_element list
method text_of_module_parameter_list : (Odoc_info.Module.module_parameter + * Odoc_info.text_element list option) + list -> + Odoc_info.text_element list
method text_of_module_type : Types.module_type -> Odoc_info.text_element list
method text_of_module_type_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_type_kind -> + Odoc_info.text_element list
method text_of_parameter_description : Odoc_info.Parameter.parameter -> + Odoc_info.text
method text_of_parameter_list : Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + Odoc_info.text_element list
method text_of_raised_exceptions : Odoc_info.raised_exception list -> + Odoc_info.text_element list
method text_of_return_opt : Odoc_info.text option -> + Odoc_info.text_element list
method text_of_see : Odoc_info.see -> Odoc_info.text
method text_of_sees : Odoc_info.see list -> Odoc_info.text_element list
method text_of_short_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_since_opt : string option -> Odoc_info.text_element list
method text_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_type_expr_list : Odoc_info.Name.t -> + string -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_value : Odoc_info.Value.t_value -> Odoc_info.text_element list
method text_of_version_opt : string option -> Odoc_info.text_element list
method type_label : ?no_:bool -> Odoc_info.Name.t -> string
method value_label : ?no_:bool -> Odoc_info.Name.t -> string
diff --git a/ocaml/Odoc_gen/module-type-Latex_functor/index.html b/ocaml/Odoc_gen/module-type-Latex_functor/index.html new file mode 100644 index 00000000..fd1600d8 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Latex_functor/index.html @@ -0,0 +1,2 @@ + +Latex_functor (ocaml.Odoc_gen.Latex_functor)

Module type Odoc_gen.Latex_functor

Parameters

Signature

class latex : object ... end
diff --git a/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/class-man/index.html b/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/class-man/index.html new file mode 100644 index 00000000..b8b08e47 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/class-man/index.html @@ -0,0 +1,46 @@ + +man (ocaml.Odoc_gen.Man_functor._.man)

Class _.man

val mutable tag_functions : (string * (Odoc_info.text -> string)) list
method create_groups : bool -> + Odoc_info.Module.t_module list -> + Odoc_info.Search.result_element list list
method escape : string -> string
method field_comment : Buffer.t -> Odoc_info.info option -> unit
method file_name : Odoc_info.Name.t -> string
method generate : Odoc_info.Module.t_module list -> unit
method generate_for_class : Odoc_info.Class.t_class -> unit
method generate_for_class_type : Odoc_info.Class.t_class_type -> unit
method generate_for_group : Odoc_info.Search.result_element list -> unit
method generate_for_module : Odoc_info.Module.t_module -> unit
method generate_for_module_type : Odoc_info.Module.t_module_type -> unit
method man_of_Target : Buffer.t -> target:string -> code:string -> unit
method man_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
method man_of_class : Buffer.t -> Odoc_info.Class.t_class -> unit
method man_of_class_comment : Buffer.t -> Odoc_info.text -> unit
method man_of_class_type : Buffer.t -> Odoc_info.Class.t_class_type -> unit
method man_of_class_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.class_type -> + unit
method man_of_code : Buffer.t -> string -> unit
method man_of_const : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.variant_constructor -> + unit
method man_of_cstr_args : ?par:bool -> + Buffer.t -> + Odoc_info.Name.t -> + string -> + Odoc_info.Type.constructor_args -> + unit
method man_of_custom_text : Buffer.t -> string -> Odoc_info.text -> unit
method man_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
method man_of_included_module : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.included_module -> + unit
method man_of_info : ?margin:int -> Buffer.t -> Odoc_types.info option -> unit
method man_of_method : Buffer.t -> Odoc_info.Value.t_method -> unit
method man_of_modtype : Buffer.t -> Odoc_info.Module.t_module_type -> unit
method man_of_module : Buffer.t -> Odoc_info.Module.t_module -> unit
method man_of_module_body : Buffer.t -> Odoc_info.Module.t_module -> unit
method man_of_module_comment : Buffer.t -> Odoc_info.text -> unit
method man_of_module_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + (Odoc_info.Module.module_parameter * Odoc_info.text option) list -> + unit
method man_of_module_type : Buffer.t -> + Odoc_info.Name.t -> + Types.module_type -> + unit
method man_of_module_type_body : Buffer.t -> + Odoc_info.Module.t_module_type -> + unit
method man_of_parameter_description : Buffer.t -> + Odoc_info.Parameter.parameter -> + unit
method man_of_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + unit
method man_of_recfield : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.record_field -> + unit
method man_of_record : Odoc_info.Name.t -> + Buffer.t -> + Odoc_info.Type.record_field list -> + unit
method man_of_text : Buffer.t -> Odoc_info.text -> unit
method private man_of_text2 : Buffer.t -> Odoc_info.text -> unit
method man_of_text_element : Buffer.t -> Odoc_info.text_element -> unit
method man_of_type : Buffer.t -> Odoc_info.Type.t_type -> unit
method man_of_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr -> + unit
method man_of_type_expr_param_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method man_of_type_extension : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + unit
method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
method open_out : string -> out_channel
method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
method remove_newlines : string -> string
method str_man_of_alerts : Odoc_info.alert list -> string list
method str_man_of_author_list : string list -> string
method str_man_of_before : (string * Odoc_info.text) list -> string
method str_man_of_custom : (string * Odoc_info.text) list -> string list
method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
method str_man_of_return_opt : Odoc_info.text option -> string
method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
method str_man_of_since_opt : string option -> string
method str_man_of_text : Odoc_info.text -> string
method str_man_of_version_opt : string option -> string
diff --git a/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/index.html b/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/index.html new file mode 100644 index 00000000..e682f1fd --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Odoc_gen.Man_functor._)

Parameter Man_functor._

class man : object ... end
diff --git a/ocaml/Odoc_gen/module-type-Man_functor/class-man/index.html b/ocaml/Odoc_gen/module-type-Man_functor/class-man/index.html new file mode 100644 index 00000000..51d3ea71 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Man_functor/class-man/index.html @@ -0,0 +1,46 @@ + +man (ocaml.Odoc_gen.Man_functor.man)

Class Man_functor.man

val mutable tag_functions : (string * (Odoc_info.text -> string)) list
method create_groups : bool -> + Odoc_info.Module.t_module list -> + Odoc_info.Search.result_element list list
method escape : string -> string
method field_comment : Buffer.t -> Odoc_info.info option -> unit
method file_name : Odoc_info.Name.t -> string
method generate : Odoc_info.Module.t_module list -> unit
method generate_for_class : Odoc_info.Class.t_class -> unit
method generate_for_class_type : Odoc_info.Class.t_class_type -> unit
method generate_for_group : Odoc_info.Search.result_element list -> unit
method generate_for_module : Odoc_info.Module.t_module -> unit
method generate_for_module_type : Odoc_info.Module.t_module_type -> unit
method man_of_Target : Buffer.t -> target:string -> code:string -> unit
method man_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
method man_of_class : Buffer.t -> Odoc_info.Class.t_class -> unit
method man_of_class_comment : Buffer.t -> Odoc_info.text -> unit
method man_of_class_type : Buffer.t -> Odoc_info.Class.t_class_type -> unit
method man_of_class_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.class_type -> + unit
method man_of_code : Buffer.t -> string -> unit
method man_of_const : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.variant_constructor -> + unit
method man_of_cstr_args : ?par:bool -> + Buffer.t -> + Odoc_info.Name.t -> + string -> + Odoc_info.Type.constructor_args -> + unit
method man_of_custom_text : Buffer.t -> string -> Odoc_info.text -> unit
method man_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
method man_of_included_module : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.included_module -> + unit
method man_of_info : ?margin:int -> Buffer.t -> Odoc_types.info option -> unit
method man_of_method : Buffer.t -> Odoc_info.Value.t_method -> unit
method man_of_modtype : Buffer.t -> Odoc_info.Module.t_module_type -> unit
method man_of_module : Buffer.t -> Odoc_info.Module.t_module -> unit
method man_of_module_body : Buffer.t -> Odoc_info.Module.t_module -> unit
method man_of_module_comment : Buffer.t -> Odoc_info.text -> unit
method man_of_module_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + (Odoc_info.Module.module_parameter * Odoc_info.text option) list -> + unit
method man_of_module_type : Buffer.t -> + Odoc_info.Name.t -> + Types.module_type -> + unit
method man_of_module_type_body : Buffer.t -> + Odoc_info.Module.t_module_type -> + unit
method man_of_parameter_description : Buffer.t -> + Odoc_info.Parameter.parameter -> + unit
method man_of_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + unit
method man_of_recfield : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.record_field -> + unit
method man_of_record : Odoc_info.Name.t -> + Buffer.t -> + Odoc_info.Type.record_field list -> + unit
method man_of_text : Buffer.t -> Odoc_info.text -> unit
method private man_of_text2 : Buffer.t -> Odoc_info.text -> unit
method man_of_text_element : Buffer.t -> Odoc_info.text_element -> unit
method man_of_type : Buffer.t -> Odoc_info.Type.t_type -> unit
method man_of_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr -> + unit
method man_of_type_expr_param_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method man_of_type_extension : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + unit
method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
method open_out : string -> out_channel
method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
method remove_newlines : string -> string
method str_man_of_alerts : Odoc_info.alert list -> string list
method str_man_of_author_list : string list -> string
method str_man_of_before : (string * Odoc_info.text) list -> string
method str_man_of_custom : (string * Odoc_info.text) list -> string list
method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
method str_man_of_return_opt : Odoc_info.text option -> string
method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
method str_man_of_since_opt : string option -> string
method str_man_of_text : Odoc_info.text -> string
method str_man_of_version_opt : string option -> string
diff --git a/ocaml/Odoc_gen/module-type-Man_functor/index.html b/ocaml/Odoc_gen/module-type-Man_functor/index.html new file mode 100644 index 00000000..11ce697b --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Man_functor/index.html @@ -0,0 +1,2 @@ + +Man_functor (ocaml.Odoc_gen.Man_functor)

Module type Odoc_gen.Man_functor

Parameters

Signature

class man : object ... end
diff --git a/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/class-texi/index.html b/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/class-texi/index.html new file mode 100644 index 00000000..f0affe7e --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/class-texi/index.html @@ -0,0 +1,97 @@ + +texi (ocaml.Odoc_gen.Texi_functor._.texi)

Class _.texi

val mutable indices_to_build : [ `Class + | `Class_att + | `Class_type + | `Exception + | `Extension + | `Method + | `Module + | `Module_type + | `Type + | `Value ] + list
val linebreak : Odoc_info.text_element
val maxdepth : int
val node_tbl : (Odoc_info.Name.t, unit) Hashtbl.t
val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
method do_index : [ `Class + | `Class_att + | `Class_type + | `Exception + | `Extension + | `Method + | `Module + | `Module_type + | `Type + | `Value ] -> + unit
method private fix_linebreaks : Odoc_info.text -> Odoc_info.text
method generate : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : out_channel -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : out_channel -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_class : out_channel -> Odoc_info.Class.t_class -> unit
method generate_for_class_type : out_channel -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_module : out_channel -> Odoc_info.Module.t_module -> unit
method generate_for_module_type : out_channel -> + Odoc_info.Module.t_module_type -> + unit
method generate_inheritance_info : out_channel -> + Odoc_info.Class.inherited_class list -> + unit
method generate_texi_header : out_channel -> + string -> + Odoc_info.Module.t_module list -> + unit
method generate_texi_trailer : out_channel -> unit
method heading : int -> Odoc_info.text -> string
method label : ?no_:bool -> string -> string
method normal_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + string
method normal_class_type : Odoc_info.Name.t -> Types.class_type -> string
method normal_class_type_param_list : Odoc_info.Name.t -> + Types.type_expr list -> + string
method normal_cstr_args : ?par:bool -> + Odoc_info.Name.t -> + Odoc_info.Type.constructor_args -> + string
method normal_module_type : ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + string
method normal_type : Odoc_info.Name.t -> Types.type_expr -> string
method normal_type_list : ?par:bool -> + Odoc_info.Name.t -> + string -> + Types.type_expr list -> + string
method relative_idents : Odoc_info.Name.t -> string -> string
method relative_module_idents : Odoc_info.Name.t -> string -> string
method scan_for_index : Odoc_texi.subparts -> unit
method scan_for_index_in_class : Odoc_info.Class.class_element -> unit
method scan_for_index_in_mod : Odoc_info.Module.module_element -> unit
method private soft_fix_linebreaks : int -> + Odoc_info.text_element list -> + Odoc_info.text_element list
method string_of_type_args : Odoc_info.Type.constructor_args -> + Types.type_expr option -> + string
method string_of_type_parameters : Odoc_info.Type.t_type -> string
method texi_of_Block : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Bold : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Center : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Code : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_CodePre : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_Emphasize : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Enum : Odoc_info.text list -> Odoc_info.Name.t
method texi_of_Italic : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Left : Odoc_info.text -> Odoc_info.Name.t
method texi_of_List : Odoc_info.text list -> Odoc_info.Name.t
method texi_of_Newline : Odoc_info.Name.t
method texi_of_Raw : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_Ref : Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.Name.t
method texi_of_Right : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Subscript : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Superscript : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Target : target:string -> + code:Odoc_info.Name.t -> + Odoc_info.Name.t
method texi_of_Title : int -> Odoc_info.text -> Odoc_info.Name.t
method texi_of_Verbatim : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_attribute : Odoc_info.Value.t_attribute -> string
method texi_of_class : Odoc_info.Class.t_class -> string
method texi_of_class_element : Odoc_info.Name.t -> + Odoc_info.Class.class_element -> + string
method texi_of_class_type : Odoc_info.Class.t_class_type -> string
method texi_of_custom_text : string -> Odoc_info.text -> Odoc_info.Name.t
method texi_of_exception : Odoc_info.Exception.t_exception -> string
method texi_of_included_module : Odoc_info.Module.included_module -> string
method texi_of_info : Odoc_info.info option -> string
method texi_of_method : Odoc_info.Value.t_method -> string
method texi_of_module : Odoc_info.Module.t_module -> string
method texi_of_module_element : Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + string
method texi_of_module_type : Odoc_info.Module.t_module_type -> string
method texi_of_text : Odoc_info.text -> string
method texi_of_text_element : Odoc_info.text_element -> Odoc_info.Name.t
method texi_of_type : Odoc_info.Type.t_type -> string
method texi_of_type_extension : Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + string
method texi_of_value : Odoc_info.Value.t_value -> string
method text_el_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element
method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element list
method text_of_author_list : string list -> Odoc_info.text_element list
method text_of_before : (string * Odoc_info.text) list -> + Odoc_info.text_element list
method text_of_class_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + Odoc_info.text_element list
method text_of_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + Odoc_types.text
method text_of_class_type_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + Odoc_info.text_element list
method text_of_class_type_param_expr_list : Odoc_info.Name.t -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
method text_of_desc : Odoc_info.text option -> Odoc_info.text_element list
method text_of_exception : Odoc_info.Exception.t_exception -> + Odoc_info.text_element list
method text_of_info : ?block:bool -> + Odoc_info.info option -> + Odoc_info.text_element list
method text_of_method : Odoc_info.Value.t_method -> Odoc_info.text_element list
method text_of_module_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_kind -> + Odoc_info.text_element list
method text_of_module_parameter_list : (Odoc_info.Module.module_parameter + * Odoc_info.text_element list option) + list -> + Odoc_info.text_element list
method text_of_module_type : Types.module_type -> Odoc_info.text_element list
method text_of_module_type_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_type_kind -> + Odoc_info.text_element list
method text_of_parameter_description : Odoc_info.Parameter.parameter -> + Odoc_info.text
method text_of_parameter_list : Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + Odoc_info.text_element list
method text_of_params : Odoc_info.param list -> Odoc_info.text_element list
method text_of_raised_exceptions : Odoc_info.raised_exception list -> + Odoc_info.text_element list
method text_of_return_opt : Odoc_info.text option -> + Odoc_info.text_element list
method text_of_see : Odoc_info.see -> Odoc_info.text
method text_of_sees : Odoc_info.see list -> Odoc_info.text_element list
method text_of_sees_opt : Odoc_info.see list -> Odoc_info.text_element list
method text_of_short_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_since_opt : string option -> Odoc_info.text_element list
method text_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_type_expr_list : Odoc_info.Name.t -> + string -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_value : Odoc_info.Value.t_value -> Odoc_info.text_element list
method text_of_version_opt : string option -> Odoc_info.text_element list
diff --git a/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/index.html b/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/index.html new file mode 100644 index 00000000..24a87286 --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Odoc_gen.Texi_functor._)

Parameter Texi_functor._

class texi : object ... end
diff --git a/ocaml/Odoc_gen/module-type-Texi_functor/class-texi/index.html b/ocaml/Odoc_gen/module-type-Texi_functor/class-texi/index.html new file mode 100644 index 00000000..bd7ae00d --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Texi_functor/class-texi/index.html @@ -0,0 +1,97 @@ + +texi (ocaml.Odoc_gen.Texi_functor.texi)

Class Texi_functor.texi

val mutable indices_to_build : [ `Class + | `Class_att + | `Class_type + | `Exception + | `Extension + | `Method + | `Module + | `Module_type + | `Type + | `Value ] + list
val linebreak : Odoc_info.text_element
val maxdepth : int
val node_tbl : (Odoc_info.Name.t, unit) Hashtbl.t
val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
method do_index : [ `Class + | `Class_att + | `Class_type + | `Exception + | `Extension + | `Method + | `Module + | `Module_type + | `Type + | `Value ] -> + unit
method private fix_linebreaks : Odoc_info.text -> Odoc_info.text
method generate : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : out_channel -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : out_channel -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_class : out_channel -> Odoc_info.Class.t_class -> unit
method generate_for_class_type : out_channel -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_module : out_channel -> Odoc_info.Module.t_module -> unit
method generate_for_module_type : out_channel -> + Odoc_info.Module.t_module_type -> + unit
method generate_inheritance_info : out_channel -> + Odoc_info.Class.inherited_class list -> + unit
method generate_texi_header : out_channel -> + string -> + Odoc_info.Module.t_module list -> + unit
method generate_texi_trailer : out_channel -> unit
method heading : int -> Odoc_info.text -> string
method label : ?no_:bool -> string -> string
method normal_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + string
method normal_class_type : Odoc_info.Name.t -> Types.class_type -> string
method normal_class_type_param_list : Odoc_info.Name.t -> + Types.type_expr list -> + string
method normal_cstr_args : ?par:bool -> + Odoc_info.Name.t -> + Odoc_info.Type.constructor_args -> + string
method normal_module_type : ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + string
method normal_type : Odoc_info.Name.t -> Types.type_expr -> string
method normal_type_list : ?par:bool -> + Odoc_info.Name.t -> + string -> + Types.type_expr list -> + string
method relative_idents : Odoc_info.Name.t -> string -> string
method relative_module_idents : Odoc_info.Name.t -> string -> string
method scan_for_index : Odoc_texi.subparts -> unit
method scan_for_index_in_class : Odoc_info.Class.class_element -> unit
method scan_for_index_in_mod : Odoc_info.Module.module_element -> unit
method private soft_fix_linebreaks : int -> + Odoc_info.text_element list -> + Odoc_info.text_element list
method string_of_type_args : Odoc_info.Type.constructor_args -> + Types.type_expr option -> + string
method string_of_type_parameters : Odoc_info.Type.t_type -> string
method texi_of_Block : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Bold : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Center : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Code : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_CodePre : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_Emphasize : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Enum : Odoc_info.text list -> Odoc_info.Name.t
method texi_of_Italic : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Left : Odoc_info.text -> Odoc_info.Name.t
method texi_of_List : Odoc_info.text list -> Odoc_info.Name.t
method texi_of_Newline : Odoc_info.Name.t
method texi_of_Raw : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_Ref : Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.Name.t
method texi_of_Right : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Subscript : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Superscript : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Target : target:string -> + code:Odoc_info.Name.t -> + Odoc_info.Name.t
method texi_of_Title : int -> Odoc_info.text -> Odoc_info.Name.t
method texi_of_Verbatim : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_attribute : Odoc_info.Value.t_attribute -> string
method texi_of_class : Odoc_info.Class.t_class -> string
method texi_of_class_element : Odoc_info.Name.t -> + Odoc_info.Class.class_element -> + string
method texi_of_class_type : Odoc_info.Class.t_class_type -> string
method texi_of_custom_text : string -> Odoc_info.text -> Odoc_info.Name.t
method texi_of_exception : Odoc_info.Exception.t_exception -> string
method texi_of_included_module : Odoc_info.Module.included_module -> string
method texi_of_info : Odoc_info.info option -> string
method texi_of_method : Odoc_info.Value.t_method -> string
method texi_of_module : Odoc_info.Module.t_module -> string
method texi_of_module_element : Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + string
method texi_of_module_type : Odoc_info.Module.t_module_type -> string
method texi_of_text : Odoc_info.text -> string
method texi_of_text_element : Odoc_info.text_element -> Odoc_info.Name.t
method texi_of_type : Odoc_info.Type.t_type -> string
method texi_of_type_extension : Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + string
method texi_of_value : Odoc_info.Value.t_value -> string
method text_el_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element
method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element list
method text_of_author_list : string list -> Odoc_info.text_element list
method text_of_before : (string * Odoc_info.text) list -> + Odoc_info.text_element list
method text_of_class_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + Odoc_info.text_element list
method text_of_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + Odoc_types.text
method text_of_class_type_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + Odoc_info.text_element list
method text_of_class_type_param_expr_list : Odoc_info.Name.t -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
method text_of_desc : Odoc_info.text option -> Odoc_info.text_element list
method text_of_exception : Odoc_info.Exception.t_exception -> + Odoc_info.text_element list
method text_of_info : ?block:bool -> + Odoc_info.info option -> + Odoc_info.text_element list
method text_of_method : Odoc_info.Value.t_method -> Odoc_info.text_element list
method text_of_module_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_kind -> + Odoc_info.text_element list
method text_of_module_parameter_list : (Odoc_info.Module.module_parameter + * Odoc_info.text_element list option) + list -> + Odoc_info.text_element list
method text_of_module_type : Types.module_type -> Odoc_info.text_element list
method text_of_module_type_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_type_kind -> + Odoc_info.text_element list
method text_of_parameter_description : Odoc_info.Parameter.parameter -> + Odoc_info.text
method text_of_parameter_list : Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + Odoc_info.text_element list
method text_of_params : Odoc_info.param list -> Odoc_info.text_element list
method text_of_raised_exceptions : Odoc_info.raised_exception list -> + Odoc_info.text_element list
method text_of_return_opt : Odoc_info.text option -> + Odoc_info.text_element list
method text_of_see : Odoc_info.see -> Odoc_info.text
method text_of_sees : Odoc_info.see list -> Odoc_info.text_element list
method text_of_sees_opt : Odoc_info.see list -> Odoc_info.text_element list
method text_of_short_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_since_opt : string option -> Odoc_info.text_element list
method text_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_type_expr_list : Odoc_info.Name.t -> + string -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_value : Odoc_info.Value.t_value -> Odoc_info.text_element list
method text_of_version_opt : string option -> Odoc_info.text_element list
diff --git a/ocaml/Odoc_gen/module-type-Texi_functor/index.html b/ocaml/Odoc_gen/module-type-Texi_functor/index.html new file mode 100644 index 00000000..e9abc05e --- /dev/null +++ b/ocaml/Odoc_gen/module-type-Texi_functor/index.html @@ -0,0 +1,2 @@ + +Texi_functor (ocaml.Odoc_gen.Texi_functor)

Module type Odoc_gen.Texi_functor

Parameters

Signature

class texi : object ... end
diff --git a/ocaml/Odoc_global/index.html b/ocaml/Odoc_global/index.html new file mode 100644 index 00000000..2fc5fb77 --- /dev/null +++ b/ocaml/Odoc_global/index.html @@ -0,0 +1,2 @@ + +Odoc_global (ocaml.Odoc_global)

Module Odoc_global

type source_file =
  1. | Impl_file of string
  2. | Intf_file of string
  3. | Text_file of string
val include_dirs : string list ref
val merge_options : Odoc_types.merge_option list ref
val classic : bool ref
val dump : string option ref
val load : string list ref
val sort_modules : bool ref
val no_stop : bool ref
val no_custom_tags : bool ref
val remove_stars : bool ref
val keep_code : bool ref
val inverse_merge_ml_mli : bool ref
val filter_with_module_constraints : bool ref
val hidden_modules : string list ref
val files : source_file list ref
val errors : int ref
val warn_error : bool ref
val show_missed_crossref : bool ref
val pwarning : string -> unit
val out_file : string ref
val verbose : bool ref
val intro_file : string option ref
val title : string option ref
val target_dir : string ref
val with_toc : bool ref
val with_index : bool ref
val with_header : bool ref
val with_trailer : bool ref
val initially_opened_module : string ref
val library_namespace : string ref
diff --git a/ocaml/Odoc_html/Generator/class-html/index.html b/ocaml/Odoc_html/Generator/class-html/index.html new file mode 100644 index 00000000..1a4955d4 --- /dev/null +++ b/ocaml/Odoc_html/Generator/class-html/index.html @@ -0,0 +1,166 @@ + +html (ocaml.Odoc_html.Generator.html)

Class Generator.html

val mutable default_style_options : string list
val mutable doctype : string
val mutable header : Buffer.t -> + ?nav: + (Odoc_info.Name.t option * Odoc_info.Name.t option * Odoc_info.Name.t) + option -> + ?comments:Odoc_info.text list -> + string -> + unit
val mutable known_classes_names : String.Set.t
val mutable known_modules_names : String.Set.t
val mutable known_types_names : String.Set.t
val mutable list_attributes : Odoc_info.Value.t_attribute list
val mutable list_class_types : Odoc_info.Class.t_class_type list
val mutable list_classes : Odoc_info.Class.t_class list
val mutable list_exceptions : Odoc_info.Exception.t_exception list
val mutable list_extensions : Odoc_info.Extension.t_extension_constructor list
val mutable list_methods : Odoc_info.Value.t_method list
val mutable list_module_types : Odoc_info.Module.t_module_type list
val mutable list_modules : Odoc_info.Module.t_module list
val mutable list_types : Odoc_info.Type.t_type list
val mutable list_values : Odoc_info.Value.t_value list
val mutable style : string
val mutable style_file : string
val mutable tag_functions : (string * (Odoc_info.text -> string)) list
method character_encoding : Buffer.t -> unit
method constructor : string -> string
method create_title_label : (int * string option * Odoc_info.text) -> string
method escape : string -> string
method generate : Odoc_info.Module.t_module list -> unit
method generate_attributes_index : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : Buffer.t -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : Buffer.t -> + Odoc_info.Class.t_class_type -> + unit
method generate_class_types_index : Odoc_info.Module.t_module list -> unit
method generate_classes_index : Odoc_info.Module.t_module list -> unit
method generate_elements : ('a option -> 'a option -> 'a -> unit) -> + 'a list -> + unit
method generate_elements_index : ?strip_libname:bool -> + 'a list -> + ('a -> Odoc_info.Name.t) -> + ('a -> Odoc_info.info option) -> + ('a -> string) -> + string -> + string -> + unit
method generate_exceptions_index : Odoc_info.Module.t_module list -> unit
method generate_extensions_index : Odoc_info.Module.t_module list -> unit
method generate_for_class : Odoc_info.Class.t_class option -> + Odoc_info.Class.t_class option -> + Odoc_info.Class.t_class -> + unit
method generate_for_class_type : Odoc_info.Class.t_class_type option -> + Odoc_info.Class.t_class_type option -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_module : Odoc_info.Module.t_module option -> + Odoc_info.Module.t_module option -> + Odoc_info.Module.t_module -> + unit
method generate_for_module_type : Odoc_info.Module.t_module_type option -> + Odoc_info.Module.t_module_type option -> + Odoc_info.Module.t_module_type -> + unit
method generate_index : Odoc_info.Module.t_module list -> unit
method generate_inheritance_info : Buffer.t -> + Odoc_info.Class.inherited_class list -> + unit
method generate_methods_index : Odoc_info.Module.t_module list -> unit
method generate_module_types_index : Odoc_info.Module.t_module list -> unit
method generate_modules_index : Odoc_info.Module.t_module list -> unit
method generate_types_index : Odoc_info.Module.t_module list -> unit
method generate_values_index : Odoc_info.Module.t_module list -> unit
method html_of_Block : Buffer.t -> Odoc_info.text -> unit
method html_of_Bold : Buffer.t -> Odoc_info.text -> unit
method html_of_Center : Buffer.t -> Odoc_info.text -> unit
method html_of_Code : Buffer.t -> string -> unit
method html_of_CodePre : Buffer.t -> string -> unit
method html_of_Emphasize : Buffer.t -> Odoc_info.text -> unit
method html_of_Enum : Buffer.t -> Odoc_info.text list -> unit
method html_of_Index_list : Buffer.t -> unit
method html_of_Italic : Buffer.t -> Odoc_info.text -> unit
method html_of_Latex : Buffer.t -> string -> unit
method html_of_Left : Buffer.t -> Odoc_info.text -> unit
method html_of_List : Buffer.t -> Odoc_info.text list -> unit
method html_of_Module_list : Buffer.t -> Odoc_info.Name.t list -> unit
method html_of_Newline : Buffer.t -> unit
method html_of_Raw : Buffer.t -> string -> unit
method html_of_Ref : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.text option -> + unit
method html_of_Right : Buffer.t -> Odoc_info.text -> unit
method html_of_Subscript : Buffer.t -> Odoc_info.text -> unit
method html_of_Superscript : Buffer.t -> Odoc_info.text -> unit
method html_of_Target : Buffer.t -> target:string -> code:string -> unit
method html_of_Title : Buffer.t -> + int -> + string option -> + Odoc_info.text -> + unit
method html_of_Verbatim : Buffer.t -> string -> unit
method html_of_alerts : Buffer.t -> Odoc_info.alert list -> unit
method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
method html_of_author_list : Buffer.t -> string list -> unit
method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
method html_of_class : Buffer.t -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Class.t_class -> + unit
method html_of_class_comment : Buffer.t -> Odoc_info.text -> unit
method html_of_class_element : Buffer.t -> + Odoc_info.Class.class_element -> + unit
method html_of_class_kind : Buffer.t -> + Odoc_info.Name.t -> + ?cl:Odoc_info.Class.t_class -> + Odoc_info.Class.class_kind -> + unit
method html_of_class_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + unit
method html_of_class_type : Buffer.t -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Class.t_class_type -> + unit
method html_of_class_type_kind : Buffer.t -> + Odoc_info.Name.t -> + ?ct:Odoc_info.Class.t_class_type -> + Odoc_info.Class.class_type_kind -> + unit
method html_of_class_type_param_expr_list : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr list -> + unit
method html_of_code : Buffer.t -> ?with_pre:bool -> string -> unit
method html_of_cstr_args : ?par:bool -> + Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Name.t -> + string -> + Odoc_info.Type.constructor_args -> + unit
method html_of_custom : Buffer.t -> (string * Odoc_info.text) list -> unit
method html_of_custom_text : Buffer.t -> string -> Odoc_info.text -> unit
method html_of_dag : (Odoc_info.Name.t * Odoc_info.Class.cct option) + Odoc_dag2html.dag -> + string
method html_of_described_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_parameter.parameter list -> + unit
method html_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
method html_of_included_module : Buffer.t -> + Odoc_info.Module.included_module -> + unit
method html_of_info : ?cls:string -> + ?indent:bool -> + Buffer.t -> + Odoc_types.info option -> + unit
method html_of_info_first_sentence : Buffer.t -> Odoc_info.info option -> unit
method html_of_method : Buffer.t -> Odoc_info.Value.t_method -> unit
method html_of_modtype : Buffer.t -> + ?info:bool -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Module.t_module_type -> + unit
method html_of_module : Buffer.t -> + ?info:bool -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Module.t_module -> + unit
method html_of_module_comment : Buffer.t -> Odoc_info.text -> unit
method html_of_module_element : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + unit
method html_of_module_kind : Buffer.t -> + Odoc_info.Name.t -> + ?modu:Odoc_info.Module.t_module -> + Odoc_info.Module.module_kind -> + unit
method html_of_module_parameter : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method html_of_module_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + (Odoc_info.Module.module_parameter * Odoc_info.text option) list -> + unit
method html_of_module_parameter_type : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method html_of_module_type : Buffer.t -> + ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + unit
method html_of_module_type_kind : Buffer.t -> + Odoc_info.Name.t -> + ?modu:Odoc_info.Module.t_module -> + ?mt:Odoc_info.Module.t_module_type -> + Odoc_info.Module.module_type_kind -> + unit
method html_of_parameter_description : Buffer.t -> + Odoc_info.Parameter.parameter -> + unit
method html_of_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_parameter.parameter list -> + unit
method html_of_raised_exceptions : Buffer.t -> + (string * Odoc_info.text) list -> + unit
method html_of_record : father:Odoc_info.Name.t -> + close_env:string -> + (Odoc_info.Type.record_field -> string) -> + Buffer.t -> + Odoc_info.Type.record_field list -> + unit
method html_of_return_opt : Buffer.t -> Odoc_info.text option -> unit
method html_of_see : Buffer.t -> (Odoc_info.see_ref * Odoc_info.text) -> unit
method html_of_sees : Buffer.t -> + (Odoc_info.see_ref * Odoc_info.text) list -> + unit
method html_of_since_opt : Buffer.t -> string option -> unit
method html_of_text : ?with_p:bool -> Buffer.t -> Odoc_info.text -> unit
method html_of_text_element : Buffer.t -> Odoc_info.text_element -> unit
method html_of_text_with_p : Buffer.t -> Odoc_info.text -> unit
method html_of_type : Buffer.t -> Odoc_info.Type.t_type -> unit
method html_of_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr -> + unit
method html_of_type_expr_param_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method html_of_type_extension : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + unit
method html_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
method html_of_version_opt : Buffer.t -> string option -> unit
method index : string
method index_attributes : string
method index_class_types : string
method index_classes : string
method index_exceptions : string
method index_extensions : string
method index_methods : string
method index_module_types : string
method index_modules : string
method index_prefix : string
method index_types : string
method index_values : string
method init_style : unit
method inner_title : Odoc_info.Name.t -> string
method keep_alpha_num : string -> string
method keyword : string -> string
method label_of_text : Odoc_info.text -> string
method list_attributes : Odoc_info.Value.t_attribute list
method list_class_types : Odoc_info.Class.t_class_type list
method list_classes : Odoc_info.Class.t_class list
method list_exceptions : Odoc_info.Exception.t_exception list
method list_extensions : Odoc_info.Extension.t_extension_constructor list
method list_methods : Odoc_info.Value.t_method list
method list_module_types : Odoc_info.Module.t_module_type list
method list_modules : Odoc_info.Module.t_module list
method list_types : Odoc_info.Type.t_type list
method list_values : Odoc_info.Value.t_value list
method meta : Buffer.t -> unit
method output_class_type : Odoc_info.Name.t -> + string -> + Types.class_type -> + unit
method private output_code : ?with_pre:bool -> + Odoc_info.Name.t -> + string -> + string -> + unit
method output_module_type : Odoc_info.Name.t -> + string -> + Types.module_type -> + unit
method prepare_header : Odoc_info.Module.t_module list -> unit
method print_header : Buffer.t -> + ?nav: + (Odoc_info.Name.t option * Odoc_info.Name.t option * Odoc_info.Name.t) + option -> + ?comments:Odoc_info.text list -> + string -> + unit
method print_navbar : Buffer.t -> + Odoc_info.Name.t option -> + Odoc_info.Name.t option -> + Odoc_info.Name.t -> + unit
method title : string
diff --git a/ocaml/Odoc_html/Generator/index.html b/ocaml/Odoc_html/Generator/index.html new file mode 100644 index 00000000..d0b15c54 --- /dev/null +++ b/ocaml/Odoc_html/Generator/index.html @@ -0,0 +1,2 @@ + +Generator (ocaml.Odoc_html.Generator)

Module Odoc_html.Generator

class html : object ... end
diff --git a/ocaml/Odoc_html/Naming/index.html b/ocaml/Odoc_html/Naming/index.html new file mode 100644 index 00000000..9c233f38 --- /dev/null +++ b/ocaml/Odoc_html/Naming/index.html @@ -0,0 +1,17 @@ + +Naming (ocaml.Odoc_html.Naming)

Module Odoc_html.Naming

val mark_module : string
val mark_module_type : string
val mark_type : string
val mark_type_elt : string
val mark_function : string
val mark_extension : string
val mark_exception : string
val mark_value : string
val mark_attribute : string
val mark_method : string
val code_prefix : string
val type_prefix : string
val html_files : string -> string * string
val target : string -> string -> string
val complete_target : string -> Odoc_info.Name.t -> string
val module_target : Odoc_info.Module.t_module -> string
val module_type_target : Odoc_info.Module.t_module_type -> string
val type_target : Odoc_info.Type.t_type -> string
val const_target : + Odoc_info.Type.t_type -> + Odoc_info.Type.variant_constructor -> + string
val recfield_target : + Odoc_info.Type.t_type -> + Odoc_info.Type.record_field -> + string
val inline_recfield_target : + string -> + string -> + Odoc_info.Type.record_field -> + string
val objfield_target : + Odoc_info.Type.t_type -> + Odoc_info.Type.object_field -> + string
val complete_type_target : Odoc_info.Type.t_type -> string
val complete_recfield_target : Odoc_info.Name.t -> string
val complete_const_target : Odoc_info.Name.t -> string
val extension_target : Odoc_info.Extension.t_extension_constructor -> string
val complete_extension_target : + Odoc_info.Extension.t_extension_constructor -> + string
val exception_target : Odoc_info.Exception.t_exception -> string
val complete_exception_target : Odoc_info.Exception.t_exception -> string
val value_target : Odoc_info.Value.t_value -> string
val subst_infix_symbols : string -> string
val complete_value_target : Odoc_info.Value.t_value -> string
val file_code_value_complete_target : Odoc_info.Value.t_value -> string
val attribute_target : Odoc_info.Value.t_attribute -> string
val complete_attribute_target : Odoc_info.Value.t_attribute -> string
val file_code_attribute_complete_target : Odoc_info.Value.t_attribute -> string
val method_target : Odoc_info.Value.t_method -> string
val complete_method_target : Odoc_info.Value.t_method -> string
val file_code_method_complete_target : Odoc_info.Value.t_method -> string
val label_target : string -> string
val complete_label_target : Odoc_info.Name.t -> string
val file_type_module_complete_target : string -> string
val file_code_module_complete_target : string -> string
val file_type_class_complete_target : string -> string
diff --git a/ocaml/Odoc_html/index.html b/ocaml/Odoc_html/index.html new file mode 100644 index 00000000..4e8c896b --- /dev/null +++ b/ocaml/Odoc_html/index.html @@ -0,0 +1,2 @@ + +Odoc_html (ocaml.Odoc_html)

Module Odoc_html

Generation of html documentation.

module String = Misc.Stdlib.String
val with_parameter_list : bool ref
val css_style : string option ref
val index_only : bool ref
val colorize_code : bool ref
val html_short_functors : bool ref
val charset : string ref
val show_navbar : bool ref
module Naming : sig ... end
module Generator : sig ... end
module type Html_generator = sig ... end
diff --git a/ocaml/Odoc_html/module-type-Html_generator/class-html/index.html b/ocaml/Odoc_html/module-type-Html_generator/class-html/index.html new file mode 100644 index 00000000..0b598f29 --- /dev/null +++ b/ocaml/Odoc_html/module-type-Html_generator/class-html/index.html @@ -0,0 +1,166 @@ + +html (ocaml.Odoc_html.Html_generator.html)

Class Html_generator.html

val mutable default_style_options : string list
val mutable doctype : string
val mutable header : Buffer.t -> + ?nav: + (Odoc_info.Name.t option * Odoc_info.Name.t option * Odoc_info.Name.t) + option -> + ?comments:Odoc_info.text list -> + string -> + unit
val mutable known_classes_names : String.Set.t
val mutable known_modules_names : String.Set.t
val mutable known_types_names : String.Set.t
val mutable list_attributes : Odoc_info.Value.t_attribute list
val mutable list_class_types : Odoc_info.Class.t_class_type list
val mutable list_classes : Odoc_info.Class.t_class list
val mutable list_exceptions : Odoc_info.Exception.t_exception list
val mutable list_extensions : Odoc_info.Extension.t_extension_constructor list
val mutable list_methods : Odoc_info.Value.t_method list
val mutable list_module_types : Odoc_info.Module.t_module_type list
val mutable list_modules : Odoc_info.Module.t_module list
val mutable list_types : Odoc_info.Type.t_type list
val mutable list_values : Odoc_info.Value.t_value list
val mutable style : string
val mutable style_file : string
val mutable tag_functions : (string * (Odoc_info.text -> string)) list
method character_encoding : Buffer.t -> unit
method constructor : string -> string
method create_title_label : (int * string option * Odoc_info.text) -> string
method escape : string -> string
method generate : Odoc_info.Module.t_module list -> unit
method generate_attributes_index : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : Buffer.t -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : Buffer.t -> + Odoc_info.Class.t_class_type -> + unit
method generate_class_types_index : Odoc_info.Module.t_module list -> unit
method generate_classes_index : Odoc_info.Module.t_module list -> unit
method generate_elements : ('a option -> 'a option -> 'a -> unit) -> + 'a list -> + unit
method generate_elements_index : ?strip_libname:bool -> + 'a list -> + ('a -> Odoc_info.Name.t) -> + ('a -> Odoc_info.info option) -> + ('a -> string) -> + string -> + string -> + unit
method generate_exceptions_index : Odoc_info.Module.t_module list -> unit
method generate_extensions_index : Odoc_info.Module.t_module list -> unit
method generate_for_class : Odoc_info.Class.t_class option -> + Odoc_info.Class.t_class option -> + Odoc_info.Class.t_class -> + unit
method generate_for_class_type : Odoc_info.Class.t_class_type option -> + Odoc_info.Class.t_class_type option -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_module : Odoc_info.Module.t_module option -> + Odoc_info.Module.t_module option -> + Odoc_info.Module.t_module -> + unit
method generate_for_module_type : Odoc_info.Module.t_module_type option -> + Odoc_info.Module.t_module_type option -> + Odoc_info.Module.t_module_type -> + unit
method generate_index : Odoc_info.Module.t_module list -> unit
method generate_inheritance_info : Buffer.t -> + Odoc_info.Class.inherited_class list -> + unit
method generate_methods_index : Odoc_info.Module.t_module list -> unit
method generate_module_types_index : Odoc_info.Module.t_module list -> unit
method generate_modules_index : Odoc_info.Module.t_module list -> unit
method generate_types_index : Odoc_info.Module.t_module list -> unit
method generate_values_index : Odoc_info.Module.t_module list -> unit
method html_of_Block : Buffer.t -> Odoc_info.text -> unit
method html_of_Bold : Buffer.t -> Odoc_info.text -> unit
method html_of_Center : Buffer.t -> Odoc_info.text -> unit
method html_of_Code : Buffer.t -> string -> unit
method html_of_CodePre : Buffer.t -> string -> unit
method html_of_Emphasize : Buffer.t -> Odoc_info.text -> unit
method html_of_Enum : Buffer.t -> Odoc_info.text list -> unit
method html_of_Index_list : Buffer.t -> unit
method html_of_Italic : Buffer.t -> Odoc_info.text -> unit
method html_of_Latex : Buffer.t -> string -> unit
method html_of_Left : Buffer.t -> Odoc_info.text -> unit
method html_of_List : Buffer.t -> Odoc_info.text list -> unit
method html_of_Module_list : Buffer.t -> Odoc_info.Name.t list -> unit
method html_of_Newline : Buffer.t -> unit
method html_of_Raw : Buffer.t -> string -> unit
method html_of_Ref : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.text option -> + unit
method html_of_Right : Buffer.t -> Odoc_info.text -> unit
method html_of_Subscript : Buffer.t -> Odoc_info.text -> unit
method html_of_Superscript : Buffer.t -> Odoc_info.text -> unit
method html_of_Target : Buffer.t -> target:string -> code:string -> unit
method html_of_Title : Buffer.t -> + int -> + string option -> + Odoc_info.text -> + unit
method html_of_Verbatim : Buffer.t -> string -> unit
method html_of_alerts : Buffer.t -> Odoc_info.alert list -> unit
method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
method html_of_author_list : Buffer.t -> string list -> unit
method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
method html_of_class : Buffer.t -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Class.t_class -> + unit
method html_of_class_comment : Buffer.t -> Odoc_info.text -> unit
method html_of_class_element : Buffer.t -> + Odoc_info.Class.class_element -> + unit
method html_of_class_kind : Buffer.t -> + Odoc_info.Name.t -> + ?cl:Odoc_info.Class.t_class -> + Odoc_info.Class.class_kind -> + unit
method html_of_class_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + unit
method html_of_class_type : Buffer.t -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Class.t_class_type -> + unit
method html_of_class_type_kind : Buffer.t -> + Odoc_info.Name.t -> + ?ct:Odoc_info.Class.t_class_type -> + Odoc_info.Class.class_type_kind -> + unit
method html_of_class_type_param_expr_list : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr list -> + unit
method html_of_code : Buffer.t -> ?with_pre:bool -> string -> unit
method html_of_cstr_args : ?par:bool -> + Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Name.t -> + string -> + Odoc_info.Type.constructor_args -> + unit
method html_of_custom : Buffer.t -> (string * Odoc_info.text) list -> unit
method html_of_custom_text : Buffer.t -> string -> Odoc_info.text -> unit
method html_of_dag : (Odoc_info.Name.t * Odoc_info.Class.cct option) + Odoc_dag2html.dag -> + string
method html_of_described_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_parameter.parameter list -> + unit
method html_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
method html_of_included_module : Buffer.t -> + Odoc_info.Module.included_module -> + unit
method html_of_info : ?cls:string -> + ?indent:bool -> + Buffer.t -> + Odoc_types.info option -> + unit
method html_of_info_first_sentence : Buffer.t -> Odoc_info.info option -> unit
method html_of_method : Buffer.t -> Odoc_info.Value.t_method -> unit
method html_of_modtype : Buffer.t -> + ?info:bool -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Module.t_module_type -> + unit
method html_of_module : Buffer.t -> + ?info:bool -> + ?complete:bool -> + ?with_link:bool -> + Odoc_info.Module.t_module -> + unit
method html_of_module_comment : Buffer.t -> Odoc_info.text -> unit
method html_of_module_element : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + unit
method html_of_module_kind : Buffer.t -> + Odoc_info.Name.t -> + ?modu:Odoc_info.Module.t_module -> + Odoc_info.Module.module_kind -> + unit
method html_of_module_parameter : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method html_of_module_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + (Odoc_info.Module.module_parameter * Odoc_info.text option) list -> + unit
method html_of_module_parameter_type : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method html_of_module_type : Buffer.t -> + ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + unit
method html_of_module_type_kind : Buffer.t -> + Odoc_info.Name.t -> + ?modu:Odoc_info.Module.t_module -> + ?mt:Odoc_info.Module.t_module_type -> + Odoc_info.Module.module_type_kind -> + unit
method html_of_parameter_description : Buffer.t -> + Odoc_info.Parameter.parameter -> + unit
method html_of_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_parameter.parameter list -> + unit
method html_of_raised_exceptions : Buffer.t -> + (string * Odoc_info.text) list -> + unit
method html_of_record : father:Odoc_info.Name.t -> + close_env:string -> + (Odoc_info.Type.record_field -> string) -> + Buffer.t -> + Odoc_info.Type.record_field list -> + unit
method html_of_return_opt : Buffer.t -> Odoc_info.text option -> unit
method html_of_see : Buffer.t -> (Odoc_info.see_ref * Odoc_info.text) -> unit
method html_of_sees : Buffer.t -> + (Odoc_info.see_ref * Odoc_info.text) list -> + unit
method html_of_since_opt : Buffer.t -> string option -> unit
method html_of_text : ?with_p:bool -> Buffer.t -> Odoc_info.text -> unit
method html_of_text_element : Buffer.t -> Odoc_info.text_element -> unit
method html_of_text_with_p : Buffer.t -> Odoc_info.text -> unit
method html_of_type : Buffer.t -> Odoc_info.Type.t_type -> unit
method html_of_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr -> + unit
method html_of_type_expr_param_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method html_of_type_extension : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + unit
method html_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
method html_of_version_opt : Buffer.t -> string option -> unit
method index : string
method index_attributes : string
method index_class_types : string
method index_classes : string
method index_exceptions : string
method index_extensions : string
method index_methods : string
method index_module_types : string
method index_modules : string
method index_prefix : string
method index_types : string
method index_values : string
method init_style : unit
method inner_title : Odoc_info.Name.t -> string
method keep_alpha_num : string -> string
method keyword : string -> string
method label_of_text : Odoc_info.text -> string
method list_attributes : Odoc_info.Value.t_attribute list
method list_class_types : Odoc_info.Class.t_class_type list
method list_classes : Odoc_info.Class.t_class list
method list_exceptions : Odoc_info.Exception.t_exception list
method list_extensions : Odoc_info.Extension.t_extension_constructor list
method list_methods : Odoc_info.Value.t_method list
method list_module_types : Odoc_info.Module.t_module_type list
method list_modules : Odoc_info.Module.t_module list
method list_types : Odoc_info.Type.t_type list
method list_values : Odoc_info.Value.t_value list
method meta : Buffer.t -> unit
method output_class_type : Odoc_info.Name.t -> + string -> + Types.class_type -> + unit
method private output_code : ?with_pre:bool -> + Odoc_info.Name.t -> + string -> + string -> + unit
method output_module_type : Odoc_info.Name.t -> + string -> + Types.module_type -> + unit
method prepare_header : Odoc_info.Module.t_module list -> unit
method print_header : Buffer.t -> + ?nav: + (Odoc_info.Name.t option * Odoc_info.Name.t option * Odoc_info.Name.t) + option -> + ?comments:Odoc_info.text list -> + string -> + unit
method print_navbar : Buffer.t -> + Odoc_info.Name.t option -> + Odoc_info.Name.t option -> + Odoc_info.Name.t -> + unit
method title : string
diff --git a/ocaml/Odoc_html/module-type-Html_generator/index.html b/ocaml/Odoc_html/module-type-Html_generator/index.html new file mode 100644 index 00000000..14a32e2d --- /dev/null +++ b/ocaml/Odoc_html/module-type-Html_generator/index.html @@ -0,0 +1,2 @@ + +Html_generator (ocaml.Odoc_html.Html_generator)

Module type Odoc_html.Html_generator

class html : object ... end
diff --git a/ocaml/Odoc_info/Class/index.html b/ocaml/Odoc_info/Class/index.html new file mode 100644 index 00000000..1e49ee03 --- /dev/null +++ b/ocaml/Odoc_info/Class/index.html @@ -0,0 +1,5 @@ + +Class (ocaml.Odoc_info.Class)

Module Odoc_info.Class

Representation and manipulation of classes and class types.

Types

type class_element = Odoc_class.class_element =
  1. | Class_attribute of Value.t_attribute
  2. | Class_method of Value.t_method
  3. | Class_comment of text

To keep the order of elements in a class.

type cct = Odoc_class.cct =
  1. | Cl of t_class
  2. | Cltype of t_class_type * Types.type_expr list
    (*

    Class type and type parameters.

    *)

Used when we can reference a t_class or a t_class_type.

and inherited_class = Odoc_class.inherited_class = {
  1. ic_name : Name.t;
    (*

    Complete name of the inherited class.

    *)
  2. mutable ic_class : cct option;
    (*

    The associated t_class or t_class_type.

    *)
  3. ic_text : text option;
    (*

    The inheritance description, if any.

    *)
}
and class_apply = Odoc_class.class_apply = {
  1. capp_name : Name.t;
    (*

    The complete name of the applied class.

    *)
  2. mutable capp_class : t_class option;
    (*

    The associated t_class if we found it.

    *)
  3. capp_params : Types.type_expr list;
    (*

    The type of expressions the class is applied to.

    *)
  4. capp_params_code : string list;
    (*

    The code of these expressions.

    *)
}
and class_constr = Odoc_class.class_constr = {
  1. cco_name : Name.t;
    (*

    The complete name of the applied class.

    *)
  2. mutable cco_class : cct option;
    (*

    The associated class or class type if we found it.

    *)
  3. cco_type_parameters : Types.type_expr list;
    (*

    The type parameters of the class, if needed.

    *)
}
and class_kind = Odoc_class.class_kind =
  1. | Class_structure of inherited_class list * class_element list
    (*

    An explicit class structure, used in implementation and interface.

    *)
  2. | Class_apply of class_apply
    (*

    Application/alias of a class, used in implementation only.

    *)
  3. | Class_constr of class_constr
    (*

    A class used to give the type of the defined class, instead of a structure, used in interface only. For example, it will be used with the name M1.M2....bar when the class foo is defined like this : class foo : int -> bar

    *)
  4. | Class_constraint of class_kind * class_type_kind
    (*

    A class definition with a constraint.

    *)
and t_class = Odoc_class.t_class = {
  1. cl_name : Name.t;
    (*

    Complete name of the class.

    *)
  2. mutable cl_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  3. cl_type : Types.class_type;
    (*

    Type of the class.

    *)
  4. cl_type_parameters : Types.type_expr list;
    (*

    Type parameters.

    *)
  5. cl_virtual : bool;
    (*

    true when the class is virtual.

    *)
  6. mutable cl_kind : class_kind;
    (*

    The way the class is defined.

    *)
  7. mutable cl_parameters : Parameter.parameter list;
    (*

    The parameters of the class.

    *)
  8. mutable cl_loc : location;
}

Representation of a class.

and class_type_alias = Odoc_class.class_type_alias = {
  1. cta_name : Name.t;
    (*

    Complete name of the target class type.

    *)
  2. mutable cta_class : cct option;
    (*

    The target t_class or t_class_type, if we found it.

    *)
  3. cta_type_parameters : Types.type_expr list;
    (*

    The type parameters. FIXME : use strings?

    *)
}
and class_type_kind = Odoc_class.class_type_kind =
  1. | Class_signature of inherited_class list * class_element list
  2. | Class_type of class_type_alias
    (*

    A class type eventually applied to type args.

    *)
and t_class_type = Odoc_class.t_class_type = {
  1. clt_name : Name.t;
    (*

    Complete name of the type.

    *)
  2. mutable clt_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  3. clt_type : Types.class_type;
  4. clt_type_parameters : Types.type_expr list;
    (*

    Type parameters.

    *)
  5. clt_virtual : bool;
    (*

    true if the class type is virtual

    *)
  6. mutable clt_kind : class_type_kind;
    (*

    The way the class type is defined.

    *)
  7. mutable clt_loc : location;
}

Representation of a class type.

Functions

val class_elements : ?trans:bool -> t_class -> class_element list

Access to the elements of a class.

val class_attributes : ?trans:bool -> t_class -> Value.t_attribute list

Access to the list of class attributes.

val class_parameter_text_by_name : t_class -> string -> text option

Access to the description associated to the given class parameter name.

val class_methods : ?trans:bool -> t_class -> Value.t_method list

Access to the methods of a class.

val class_comments : ?trans:bool -> t_class -> text list

Access to the comments of a class.

val class_type_elements : ?trans:bool -> t_class_type -> class_element list

Access to the elements of a class type.

val class_type_attributes : + ?trans:bool -> + t_class_type -> + Value.t_attribute list

Access to the list of class type attributes.

val class_type_parameter_text_by_name : t_class_type -> string -> text option

Access to the description associated to the given class type parameter name.

val class_type_methods : ?trans:bool -> t_class_type -> Value.t_method list

Access to the methods of a class type.

val class_type_comments : ?trans:bool -> t_class_type -> text list

Access to the comments of a class type.

diff --git a/ocaml/Odoc_info/Dep/index.html b/ocaml/Odoc_info/Dep/index.html new file mode 100644 index 00000000..d03b349f --- /dev/null +++ b/ocaml/Odoc_info/Dep/index.html @@ -0,0 +1,5 @@ + +Dep (ocaml.Odoc_info.Dep)

Module Odoc_info.Dep

Computation of dependencies.

val kernel_deps_of_modules : Module.t_module list -> unit

Modify the module dependencies of the given list of modules, to get the minimum transitivity kernel.

val deps_of_types : + ?kernel:bool -> + Type.t_type list -> + (Type.t_type * Name.t list) list

Return the list of dependencies between the given types, in the form of a list (type name, names of types it depends on).

  • parameter kernel

    indicates if we must keep only the transitivity kernel of the dependencies. Default is false.

diff --git a/ocaml/Odoc_info/Exception/index.html b/ocaml/Odoc_info/Exception/index.html new file mode 100644 index 00000000..6061737f --- /dev/null +++ b/ocaml/Odoc_info/Exception/index.html @@ -0,0 +1,2 @@ + +Exception (ocaml.Odoc_info.Exception)

Module Odoc_info.Exception

Representation and manipulation of exceptions.

type exception_alias = Odoc_exception.exception_alias = {
  1. ea_name : Name.t;
    (*

    The complete name of the target exception.

    *)
  2. mutable ea_ex : t_exception option;
    (*

    The target exception, if we found it.

    *)
}

Used when the exception is a rebind of another exception, when we have exception Ex = Target_ex.

and t_exception = Odoc_exception.t_exception = {
  1. ex_name : Name.t;
  2. mutable ex_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  3. ex_args : Odoc_type.constructor_args;
  4. ex_ret : Types.type_expr option;
    (*

    The optional return type of the exception.

    *)
  5. ex_alias : exception_alias option;
    (*

    None when the exception is not a rebind.

    *)
  6. mutable ex_loc : location;
  7. mutable ex_code : string option;
}
diff --git a/ocaml/Odoc_info/Extension/index.html b/ocaml/Odoc_info/Extension/index.html new file mode 100644 index 00000000..b5dea2f3 --- /dev/null +++ b/ocaml/Odoc_info/Extension/index.html @@ -0,0 +1,2 @@ + +Extension (ocaml.Odoc_info.Extension)

Module Odoc_info.Extension

Representation and manipulation of extensions.

type private_flag = Odoc_extension.private_flag =
  1. | Private
  2. | Public
type extension_alias = Odoc_extension.extension_alias = {
  1. xa_name : Name.t;
    (*

    The complete name of the target extension.

    *)
  2. mutable xa_xt : t_extension_constructor option;
    (*

    The target extension, if we found it.

    *)
}

Used when the extension is a rebind of another extension, when we have extension Xt = Target_xt.

and t_extension_constructor = Odoc_extension.t_extension_constructor = {
  1. xt_name : Name.t;
  2. xt_args : Odoc_type.constructor_args;
  3. xt_ret : Types.type_expr option;
    (*

    the optional return type of the extension

    *)
  4. xt_type_extension : t_type_extension;
    (*

    the type extension containing this constructor

    *)
  5. xt_alias : extension_alias option;
    (*

    None when the extension is not a rebind.

    *)
  6. mutable xt_loc : Odoc_types.location;
  7. mutable xt_text : Odoc_types.info option;
    (*

    optional user description

    *)
}
and t_type_extension = Odoc_extension.t_type_extension = {
  1. mutable te_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  2. te_type_name : Name.t;
    (*

    The type of the extension

    *)
  3. te_type_parameters : Types.type_expr list;
  4. te_private : private_flag;
  5. mutable te_constructors : t_extension_constructor list;
  6. mutable te_loc : location;
  7. mutable te_code : string option;
}
val extension_constructors : t_type_extension -> t_extension_constructor list

Access to the extensions in a group.

diff --git a/ocaml/Odoc_info/Global/index.html b/ocaml/Odoc_info/Global/index.html new file mode 100644 index 00000000..df878da3 --- /dev/null +++ b/ocaml/Odoc_info/Global/index.html @@ -0,0 +1,2 @@ + +Global (ocaml.Odoc_info.Global)

Module Odoc_info.Global

val errors : int ref
val warn_error : bool ref
val out_file : string ref

The file used by the generators outputting only one file.

val verbose : bool ref

Verbose mode or not.

val target_dir : string ref

The directory where files have to be generated.

val title : string option ref

The optional title to use in the generated documentation.

val intro_file : string option ref

The optional file whose content can be used as intro text.

val with_toc : bool ref

The flag which indicates if we must generate a table of contents.

val with_index : bool ref

The flag which indicates if we must generate an index.

val with_header : bool ref

The flag which indicates if we must generate a header.

val with_trailer : bool ref

The flag which indicates if we must generate a trailer.

diff --git a/ocaml/Odoc_info/Module/index.html b/ocaml/Odoc_info/Module/index.html new file mode 100644 index 00000000..bbbc5d77 --- /dev/null +++ b/ocaml/Odoc_info/Module/index.html @@ -0,0 +1,29 @@ + +Module (ocaml.Odoc_info.Module)

Module Odoc_info.Module

Representation and manipulation of modules and module types.

Types

type module_element = Odoc_module.module_element =
  1. | Element_module of t_module
  2. | Element_module_type of t_module_type
  3. | Element_included_module of included_module
  4. | Element_class of Class.t_class
  5. | Element_class_type of Class.t_class_type
  6. | Element_value of Value.t_value
  7. | Element_type_extension of Extension.t_type_extension
  8. | Element_exception of Exception.t_exception
  9. | Element_type of Type.t_type
  10. | Element_module_comment of text

To keep the order of elements in a module.

and mmt = Odoc_module.mmt =
  1. | Mod of t_module
  2. | Modtype of t_module_type

Used where we can reference t_module or t_module_type.

and included_module = Odoc_module.included_module = {
  1. im_name : Name.t;
    (*

    Complete name of the included module.

    *)
  2. mutable im_module : mmt option;
    (*

    The included module or module type, if we found it.

    *)
  3. mutable im_info : Odoc_types.info option;
    (*

    comment associated with the include directive

    *)
}
and module_alias = Odoc_module.module_alias = {
  1. ma_name : Name.t;
    (*

    Complete name of the target module.

    *)
  2. mutable ma_module : mmt option;
    (*

    The real module or module type if we could associate it.

    *)
}
and module_parameter = Odoc_module.module_parameter = {
  1. mp_name : string;
    (*

    the name

    *)
  2. mp_type : Types.module_type option;
    (*

    the type

    *)
  3. mp_type_code : string;
    (*

    the original code

    *)
  4. mp_kind : module_type_kind;
    (*

    the way the parameter was built

    *)
}
and module_kind = Odoc_module.module_kind =
  1. | Module_struct of module_element list
    (*

    A complete module structure.

    *)
  2. | Module_alias of module_alias
    (*

    Complete name and corresponding module if we found it

    *)
  3. | Module_functor of module_parameter * module_kind
    (*

    A functor, with its parameter and the rest of its definition

    *)
  4. | Module_apply of module_kind * module_kind
    (*

    A module defined by application of a functor.

    *)
  5. | Module_apply_unit of module_kind
    (*

    A generative application of a functor.

    *)
  6. | Module_with of module_type_kind * string
    (*

    A module whose type is a with ... constraint. Should appear in interface files only.

    *)
  7. | Module_constraint of module_kind * module_type_kind
    (*

    A module constraint by a module type.

    *)
  8. | Module_typeof of string
    (*

    by now only the code of the module expression

    *)
  9. | Module_unpack of string * module_type_alias
    (*

    code of the expression and module type alias

    *)

Different kinds of a module.

and t_module = Odoc_module.t_module = {
  1. m_name : Name.t;
    (*

    Complete name of the module.

    *)
  2. mutable m_type : Types.module_type;
    (*

    The type of the module.

    *)
  3. mutable m_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  4. m_is_interface : bool;
    (*

    true for modules read from interface files

    *)
  5. m_file : string;
    (*

    The file the module is defined in.

    *)
  6. mutable m_kind : module_kind;
    (*

    The way the module is defined.

    *)
  7. mutable m_loc : location;
  8. mutable m_top_deps : Name.t list;
    (*

    The toplevels module names this module depends on.

    *)
  9. mutable m_code : string option;
    (*

    The whole code of the module

    *)
  10. mutable m_code_intf : string option;
    (*

    The whole code of the interface of the module

    *)
  11. m_text_only : bool;
    (*

    true if the module comes from a text file

    *)
}

Representation of a module.

and module_type_alias = Odoc_module.module_type_alias = {
  1. mta_name : Name.t;
    (*

    Complete name of the target module type.

    *)
  2. mutable mta_module : t_module_type option;
    (*

    The real module type if we could associate it.

    *)
}
and module_type_kind = Odoc_module.module_type_kind =
  1. | Module_type_struct of module_element list
    (*

    A complete module signature.

    *)
  2. | Module_type_functor of module_parameter * module_type_kind
    (*

    A functor, with its parameter and the rest of its definition

    *)
  3. | Module_type_alias of module_type_alias
    (*

    Complete alias name and corresponding module type if we found it.

    *)
  4. | Module_type_with of module_type_kind * string
    (*

    The module type kind and the code of the with constraint.

    *)
  5. | Module_type_typeof of string
    (*

    by now only the code of the module expression

    *)

Different kinds of module type.

and t_module_type = Odoc_module.t_module_type = {
  1. mt_name : Name.t;
    (*

    Complete name of the module type.

    *)
  2. mutable mt_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  3. mutable mt_type : Types.module_type option;
    (*

    None means that the module type is abstract.

    *)
  4. mt_is_interface : bool;
    (*

    true for modules read from interface files.

    *)
  5. mt_file : string;
    (*

    The file the module type is defined in.

    *)
  6. mutable mt_kind : module_type_kind option;
    (*

    The way the module is defined. None means that module type is abstract. It is always None when the module type was extracted from the implementation file. That means module types are only analysed in interface files.

    *)
  7. mutable mt_loc : location;
}

Representation of a module type.

Functions for modules

val module_elements : ?trans:bool -> t_module -> module_element list

Access to the elements of a module.

val module_modules : ?trans:bool -> t_module -> t_module list

Access to the submodules of a module.

val module_module_types : ?trans:bool -> t_module -> t_module_type list

Access to the module types of a module.

val module_included_modules : ?trans:bool -> t_module -> included_module list

Access to the included modules of a module.

val module_type_extensions : + ?trans:bool -> + t_module -> + Extension.t_type_extension list

Access to the type extensions of a module.

val module_exceptions : ?trans:bool -> t_module -> Exception.t_exception list

Access to the exceptions of a module.

val module_types : ?trans:bool -> t_module -> Type.t_type list

Access to the types of a module.

val module_values : ?trans:bool -> t_module -> Value.t_value list

Access to the values of a module.

val module_functions : ?trans:bool -> t_module -> Value.t_value list

Access to functional values of a module.

val module_simple_values : ?trans:bool -> t_module -> Value.t_value list

Access to non-functional values of a module.

val module_classes : ?trans:bool -> t_module -> Class.t_class list

Access to the classes of a module.

val module_class_types : ?trans:bool -> t_module -> Class.t_class_type list

Access to the class types of a module.

val module_all_classes : ?trans:bool -> t_module -> Class.t_class list

The list of classes defined in this module and all its submodules and functors.

val module_is_functor : t_module -> bool

true if the module is functor.

val module_parameters : + ?trans:bool -> + t_module -> + (module_parameter * text option) list

The list of couples (module parameter, optional description).

val module_comments : ?trans:bool -> t_module -> text list

The list of module comments.

Functions for module types

val module_type_elements : ?trans:bool -> t_module_type -> module_element list

Access to the elements of a module type.

val module_type_modules : ?trans:bool -> t_module_type -> t_module list

Access to the submodules of a module type.

val module_type_module_types : + ?trans:bool -> + t_module_type -> + t_module_type list

Access to the module types of a module type.

val module_type_included_modules : + ?trans:bool -> + t_module_type -> + included_module list

Access to the included modules of a module type.

val module_type_exceptions : + ?trans:bool -> + t_module_type -> + Exception.t_exception list

Access to the exceptions of a module type.

val module_type_types : ?trans:bool -> t_module_type -> Type.t_type list

Access to the types of a module type.

val module_type_values : ?trans:bool -> t_module_type -> Value.t_value list

Access to the values of a module type.

val module_type_functions : ?trans:bool -> t_module_type -> Value.t_value list

Access to functional values of a module type.

val module_type_simple_values : + ?trans:bool -> + t_module_type -> + Value.t_value list

Access to non-functional values of a module type.

val module_type_classes : ?trans:bool -> t_module_type -> Class.t_class list

Access to the classes of a module type.

val module_type_class_types : + ?trans:bool -> + t_module_type -> + Class.t_class_type list

Access to the class types of a module type.

val module_type_all_classes : + ?trans:bool -> + t_module_type -> + Class.t_class list

The list of classes defined in this module type and all its submodules and functors.

val module_type_is_functor : t_module_type -> bool

true if the module type is functor.

val module_type_parameters : + ?trans:bool -> + t_module_type -> + (module_parameter * text option) list

The list of couples (module parameter, optional description).

val module_type_comments : ?trans:bool -> t_module_type -> text list

The list of module comments.

diff --git a/ocaml/Odoc_info/Name/index.html b/ocaml/Odoc_info/Name/index.html new file mode 100644 index 00000000..a3b7e28e --- /dev/null +++ b/ocaml/Odoc_info/Name/index.html @@ -0,0 +1,2 @@ + +Name (ocaml.Odoc_info.Name)

Module Odoc_info.Name

Representation of element names.

type t = string
val simple : t -> t

Access to the simple name.

val concat : t -> t -> t

concat t1 t2 returns the concatenation of t1 and t2.

val depth : t -> int

Return the depth of the name, i.e. the number of levels to the root. Example : depth "Toto.Tutu.name" = 3.

val get_relative : t -> t -> t

Take two names n1 and n2 = n3.n4 and return n4 if n3=n1 or else n2.

val get_relative_opt : t -> t -> t

Take two names n1 and n2 = n3.n4 and return n4 if n3=n1 and n1<>"" or else n2.

val father : t -> t

Return the name of the 'father' (like dirname for a file name).

diff --git a/ocaml/Odoc_info/Parameter/index.html b/ocaml/Odoc_info/Parameter/index.html new file mode 100644 index 00000000..de0c4289 --- /dev/null +++ b/ocaml/Odoc_info/Parameter/index.html @@ -0,0 +1,2 @@ + +Parameter (ocaml.Odoc_info.Parameter)

Module Odoc_info.Parameter

Representation and manipulation of method / function / class / module parameters.

Types

type simple_name = Odoc_parameter.simple_name = {
  1. sn_name : string;
  2. sn_type : Types.type_expr;
  3. mutable sn_text : text option;
}

Representation of a simple parameter name

type param_info = Odoc_parameter.param_info =
  1. | Simple_name of simple_name
  2. | Tuple of param_info list * Types.type_expr

Representation of parameter names. We need it to represent parameter names in tuples. The value Tuple ([], t) stands for an anonymous parameter.

type parameter = param_info

A parameter is just a param_info.

Functions

val complete_name : parameter -> string

Access to the name as a string. For tuples, parentheses and commas are added.

Access to the complete type.

val names : parameter -> string list

Access to the list of names ; only one for a simple parameter, or a list for a tuple.

val desc_by_name : parameter -> string -> text option

Access to the description of a specific name.

  • raises Not_found

    if no description is associated to the given name.

val type_by_name : parameter -> string -> Types.type_expr

Access to the type of a specific name.

  • raises Not_found

    if no type is associated to the given name.

diff --git a/ocaml/Odoc_info/Scan/class-scanner/index.html b/ocaml/Odoc_info/Scan/class-scanner/index.html new file mode 100644 index 00000000..52184cd6 --- /dev/null +++ b/ocaml/Odoc_info/Scan/class-scanner/index.html @@ -0,0 +1,2 @@ + +scanner (ocaml.Odoc_info.Scan.scanner)

Class Scan.scanner

method scan_value : Value.t_value -> unit
method scan_type_pre : Type.t_type -> bool
method scan_type_const : Type.t_type -> Type.variant_constructor -> unit
method scan_type_recfield : Type.t_type -> Type.record_field -> unit
method scan_type : Type.t_type -> unit
method scan_extension_constructor : Extension.t_extension_constructor -> unit
method scan_exception : Exception.t_exception -> unit
method scan_attribute : Value.t_attribute -> unit
method scan_method : Value.t_method -> unit
method scan_included_module : Module.included_module -> unit

Scan of a type extension

method scan_type_extension_pre : Extension.t_type_extension -> bool

Override this method to perform controls on the extension's type, private and info. This method is called before scanning the extension's constructors.

  • returns

    true if the extension's constructors must be scanned.

method scan_type_extension_constructors : Extension.t_type_extension -> unit

This method scans the constructors of the given type extension.

method scan_type_extension : Extension.t_type_extension -> unit

Scan of a type extension. Should not be overridden. It calls scan_type_extension_pre and if scan_type_extension_pre returns true, then it calls scan_type_extension_constructors.

Scan of a class.

method scan_class_comment : text -> unit

Scan of a comment inside a class.

method scan_class_pre : Class.t_class -> bool

Override this method to perform controls on the class comment and params. This method is called before scanning the class elements.

  • returns

    true if the class elements must be scanned.

method scan_class_elements : Class.t_class -> unit

This method scans the elements of the given class.

method scan_class : Class.t_class -> unit

Scan of a class. Should not be overridden. It calls scan_class_pre and if scan_class_pre returns true, then it calls scan_class_elements.

Scan of a class type.

method scan_class_type_comment : text -> unit

Scan of a comment inside a class type.

method scan_class_type_pre : Class.t_class_type -> bool

Override this method to perform controls on the class type comment and form. This method is called before scanning the class type elements.

  • returns

    true if the class type elements must be scanned.

method scan_class_type_elements : Class.t_class_type -> unit

This method scans the elements of the given class type.

method scan_class_type : Class.t_class_type -> unit

Scan of a class type. Should not be overridden. It calls scan_class_type_pre and if scan_class_type_pre returns true, then it calls scan_class_type_elements.

Scan of modules.

method scan_module_comment : text -> unit

Scan of a comment inside a module.

method scan_module_pre : Module.t_module -> bool

Override this method to perform controls on the module comment and form. This method is called before scanning the module elements.

  • returns

    true if the module elements must be scanned.

method scan_module_elements : Module.t_module -> unit

This method scans the elements of the given module.

method scan_module : Module.t_module -> unit

Scan of a module. Should not be overridden. It calls scan_module_pre and if scan_module_pre returns true, then it calls scan_module_elements.

Scan of module types.

method scan_module_type_comment : text -> unit

Scan of a comment inside a module type.

method scan_module_type_pre : Module.t_module_type -> bool

Override this method to perform controls on the module type comment and form. This method is called before scanning the module type elements.

  • returns

    true if the module type elements must be scanned.

method scan_module_type_elements : Module.t_module_type -> unit

This method scans the elements of the given module type.

method scan_module_type : Module.t_module_type -> unit

Scan of a module type. Should not be overridden. It calls scan_module_type_pre and if scan_module_type_pre returns true, then it calls scan_module_type_elements.

Main scanning method.

method scan_module_list : Module.t_module list -> unit

Scan a list of modules.

diff --git a/ocaml/Odoc_info/Scan/index.html b/ocaml/Odoc_info/Scan/index.html new file mode 100644 index 00000000..a9e765db --- /dev/null +++ b/ocaml/Odoc_info/Scan/index.html @@ -0,0 +1,2 @@ + +Scan (ocaml.Odoc_info.Scan)

Module Odoc_info.Scan

Scanning of collected information

class scanner : object ... end
diff --git a/ocaml/Odoc_info/Search/index.html b/ocaml/Odoc_info/Search/index.html new file mode 100644 index 00000000..126bc8f4 --- /dev/null +++ b/ocaml/Odoc_info/Search/index.html @@ -0,0 +1,2 @@ + +Search (ocaml.Odoc_info.Search)

Module Odoc_info.Search

Research in elements

type result_element = Odoc_search.result_element =
  1. | Res_module of Module.t_module
  2. | Res_module_type of Module.t_module_type
  3. | Res_class of Class.t_class
  4. | Res_class_type of Class.t_class_type
  5. | Res_value of Value.t_value
  6. | Res_type of Type.t_type
  7. | Res_extension of Extension.t_extension_constructor
  8. | Res_exception of Exception.t_exception
  9. | Res_attribute of Value.t_attribute
  10. | Res_method of Value.t_method
  11. | Res_section of string * text
  12. | Res_recfield of Type.t_type * Type.record_field
  13. | Res_const of Type.t_type * Type.variant_constructor
type search_result = result_element list

The type representing a research result.

val search_by_name : Module.t_module list -> Str.regexp -> search_result

Research of the elements whose name matches the given regular expression.

val values : Module.t_module list -> Value.t_value list

A function to search all the values in a list of modules.

A function to search all the extensions in a list of modules.

val exceptions : Module.t_module list -> Exception.t_exception list

A function to search all the exceptions in a list of modules.

val types : Module.t_module list -> Type.t_type list

A function to search all the types in a list of modules.

val attributes : Module.t_module list -> Value.t_attribute list

A function to search all the class attributes in a list of modules.

val methods : Module.t_module list -> Value.t_method list

A function to search all the class methods in a list of modules.

val classes : Module.t_module list -> Class.t_class list

A function to search all the classes in a list of modules.

val class_types : Module.t_module list -> Class.t_class_type list

A function to search all the class types in a list of modules.

val modules : Module.t_module list -> Module.t_module list

A function to search all the modules in a list of modules.

val module_types : Module.t_module list -> Module.t_module_type list

A function to search all the module types in a list of modules.

diff --git a/ocaml/Odoc_info/Type/index.html b/ocaml/Odoc_info/Type/index.html new file mode 100644 index 00000000..5dd67210 --- /dev/null +++ b/ocaml/Odoc_info/Type/index.html @@ -0,0 +1,2 @@ + +Type (ocaml.Odoc_info.Type)

Module Odoc_info.Type

Representation and manipulation of types.

type private_flag = Odoc_type.private_flag =
  1. | Private
  2. | Public
type record_field = Odoc_type.record_field = {
  1. rf_name : string;
    (*

    Name of the field.

    *)
  2. rf_mutable : bool;
    (*

    true if mutable.

    *)
  3. rf_type : Types.type_expr;
    (*

    Type of the field.

    *)
  4. mutable rf_text : info option;
    (*

    Optional description in the associated comment.

    *)
}

Description of a record type field.

type constructor_args = Odoc_type.constructor_args =
  1. | Cstr_record of record_field list
  2. | Cstr_tuple of Types.type_expr list

Description of a variant type constructor.

type variant_constructor = Odoc_type.variant_constructor = {
  1. vc_name : string;
    (*

    Name of the constructor.

    *)
  2. vc_args : constructor_args;
  3. vc_ret : Types.type_expr option;
  4. mutable vc_text : info option;
    (*

    Optional description in the associated comment.

    *)
}
type type_kind = Odoc_type.type_kind =
  1. | Type_abstract
    (*

    Type is abstract, for example type t.

    *)
  2. | Type_variant of variant_constructor list
    (*

    constructors

    *)
  3. | Type_record of record_field list
    (*

    fields

    *)
  4. | Type_open
    (*

    Type is open

    *)

The various kinds of a type.

type object_field = Odoc_type.object_field = {
  1. of_name : string;
  2. of_type : Types.type_expr;
  3. mutable of_text : Odoc_types.info option;
    (*

    optional user description

    *)
}
type type_manifest = Odoc_type.type_manifest =
  1. | Other of Types.type_expr
    (*

    Type manifest directly taken from Typedtree.

    *)
  2. | Object_type of object_field list
type t_type = Odoc_type.t_type = {
  1. ty_name : Name.t;
    (*

    Complete name of the type.

    *)
  2. mutable ty_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  3. ty_parameters : (Types.type_expr * Types.Variance.t) list;
    (*

    type parameters: (type, variance)

    *)
  4. ty_kind : type_kind;
    (*

    Type kind.

    *)
  5. ty_private : private_flag;
    (*

    Private or public type.

    *)
  6. ty_manifest : type_manifest option;
  7. mutable ty_loc : location;
  8. mutable ty_code : string option;
}

Representation of a type.

diff --git a/ocaml/Odoc_info/Value/index.html b/ocaml/Odoc_info/Value/index.html new file mode 100644 index 00000000..c8ea4bcf --- /dev/null +++ b/ocaml/Odoc_info/Value/index.html @@ -0,0 +1,2 @@ + +Value (ocaml.Odoc_info.Value)

Module Odoc_info.Value

Representation and manipulation of values, class attributes and class methods.

type t_value = Odoc_value.t_value = {
  1. val_name : Name.t;
    (*

    Complete name of the value.

    *)
  2. mutable val_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  3. val_type : Types.type_expr;
    (*

    Type of the value.

    *)
  4. val_recursive : bool;
    (*

    true if the value is recursive.

    *)
  5. mutable val_parameters : Odoc_parameter.parameter list;
    (*

    The parameters, if any.

    *)
  6. mutable val_code : string option;
    (*

    The code of the value, if we had the only the implementation file.

    *)
  7. mutable val_loc : location;
}

Representation of a value.

type t_attribute = Odoc_value.t_attribute = {
  1. att_value : t_value;
    (*

    an attribute has almost all the same information as a value

    *)
  2. att_mutable : bool;
    (*

    true if the attribute is mutable.

    *)
  3. att_virtual : bool;
    (*

    true if the attribute is virtual.

    *)
}

Representation of a class attribute.

type t_method = Odoc_value.t_method = {
  1. met_value : t_value;
    (*

    a method has almost all the same information as a value

    *)
  2. met_private : bool;
    (*

    true if the method is private.

    *)
  3. met_virtual : bool;
    (*

    true if the method is virtual.

    *)
}

Representation of a class method.

val is_function : t_value -> bool

Return true if the value is a function, i.e. it has a functional type.

val value_parameter_text_by_name : t_value -> string -> text option

Access to the description associated to the given parameter name.

diff --git a/ocaml/Odoc_info/index.html b/ocaml/Odoc_info/index.html new file mode 100644 index 00000000..ad7bf835 --- /dev/null +++ b/ocaml/Odoc_info/index.html @@ -0,0 +1,14 @@ + +Odoc_info (ocaml.Odoc_info)

Module Odoc_info

Interface to the information collected in source files.

type ref_kind = Odoc_types.ref_kind =
  1. | RK_module
  2. | RK_module_type
  3. | RK_class
  4. | RK_class_type
  5. | RK_value
  6. | RK_type
  7. | RK_extension
  8. | RK_exception
  9. | RK_attribute
  10. | RK_method
  11. | RK_section of text
  12. | RK_recfield
  13. | RK_const

The different kinds of element references.

and text_element = Odoc_types.text_element =
  1. | Raw of string
    (*

    Raw text.

    *)
  2. | Code of string
    (*

    The string is source code.

    *)
  3. | CodePre of string
    (*

    The string is pre-formatted source code.

    *)
  4. | Verbatim of string
    (*

    String 'as is'.

    *)
  5. | Bold of text
    (*

    Text in bold style.

    *)
  6. | Italic of text
    (*

    Text in italic.

    *)
  7. | Emphasize of text
    (*

    Emphasized text.

    *)
  8. | Center of text
    (*

    Centered text.

    *)
  9. | Left of text
    (*

    Left alignment.

    *)
  10. | Right of text
    (*

    Right alignment.

    *)
  11. | List of text list
    (*

    A list.

    *)
  12. | Enum of text list
    (*

    An enumerated list.

    *)
  13. | Newline
    (*

    To force a line break.

    *)
  14. | Block of text
    (*

    Like html's block quote.

    *)
  15. | Title of int * string option * text
    (*

    Style number, optional label, and text.

    *)
  16. | Latex of string
    (*

    A string for latex.

    *)
  17. | Ref of string * ref_kind option * text option
    (*

    A reference to an element. Complete name and kind. An optional text can be given to display this text instead of the element name.

    *)
  18. | Superscript of text
    (*

    Superscripts.

    *)
  19. | Subscript of text
    (*

    Subscripts.

    *)
  20. | Module_list of string list
    (*

    The table of the given modules with their abstract.

    *)
  21. | Index_list
    (*

    The links to the various indexes (values, types, ...)

    *)
  22. | Custom of string * text
    (*

    to extend {foo syntax

    *)
  23. | Target of string * string
    (*

    (target, code) : to specify code specific to a target format

    *)
and text = text_element list

A text is a list of text_element. The order matters.

type see_ref = Odoc_types.see_ref =
  1. | See_url of string
  2. | See_file of string
  3. | See_doc of string

The different forms of references in @see tags.

exception Text_syntax of int * int * string

Raised when parsing string to build a Odoc_info.text structure. (line, char, string)

type see = see_ref * text

The information in a @see tag.

type param = string * text

Parameter name and description.

type raised_exception = string * text

Raised exception name and description.

type alert = Odoc_types.alert = {
  1. alert_name : string;
  2. alert_payload : string option;
}
type info = Odoc_types.info = {
  1. i_desc : text option;
    (*

    The description text.

    *)
  2. i_authors : string list;
    (*

    The list of authors in @author tags.

    *)
  3. i_version : string option;
    (*

    The string in the @version tag.

    *)
  4. i_sees : see list;
    (*

    The list of @see tags.

    *)
  5. i_since : string option;
    (*

    The string in the @since tag.

    *)
  6. i_before : (string * text) list;
    (*

    the version number and text in @before tag

    *)
  7. i_deprecated : text option;
    (*

    The description text of the @deprecated tag.

    *)
  8. i_params : param list;
    (*

    The list of parameter descriptions.

    *)
  9. i_raised_exceptions : raised_exception list;
    (*

    The list of raised exceptions.

    *)
  10. i_return_value : text option;
    (*

    The description text of the return value.

    *)
  11. i_custom : (string * text) list;
    (*

    A text associated to a custom @-tag.

    *)
  12. i_alerts : alert list;
    (*

    Alerts associated to the same item. Not from special comments.

    *)
}

Information in a special comment

  • before 3.12

    @before information was not present.

type location = Odoc_types.location = {
  1. loc_impl : Location.t option;
    (*

    implementation location

    *)
  2. loc_inter : Location.t option;
    (*

    interface location

    *)
}

Location of elements in implementation and interface files.

val dummy_loc : location

A dummy location.

module Name : sig ... end

Representation of element names.

module Parameter : sig ... end

Representation and manipulation of method / function / class / module parameters.

module Extension : sig ... end

Representation and manipulation of extensions.

module Exception : sig ... end

Representation and manipulation of exceptions.

module Type : sig ... end

Representation and manipulation of types.

module Value : sig ... end

Representation and manipulation of values, class attributes and class methods.

module Class : sig ... end

Representation and manipulation of classes and class types.

module Module : sig ... end

Representation and manipulation of modules and module types.

Getting strings from values

val reset_type_names : unit -> unit

This function is used to reset the names of type variables. It must be called when printing the whole type of a function, but not when printing the type of its parameters. Same for classes (call it) and methods and attributes (don't call it).

val string_of_variance : Type.t_type -> Types.Variance.t -> string

string_of_variance t variance returns the variance and injectivity annotation (e.g "+" for covariance, "-" for contravariance, "!-" for injectivity) if the type t is abstract.

val string_of_type_expr : Types.type_expr -> string

This function returns a string representing a Types.type_expr.

val string_of_class_params : Class.t_class -> string
  • returns

    a string to display the parameters of the given class, in the same form as the compiler.

val string_of_type_list : ?par:bool -> string -> Types.type_expr list -> string

This function returns a string to represent the given list of types, with a given separator.

val string_of_type_param_list : Type.t_type -> string

This function returns a string to represent the list of type parameters for the given type.

val string_of_type_extension_param_list : Extension.t_type_extension -> string

This function returns a string to represent the list of type parameters for the given type extension.

val string_of_class_type_param_list : Types.type_expr list -> string

This function returns a string to represent the given list of type parameters of a class or class type, with a given separator.

val string_of_module_type : + ?code:string -> + ?complete:bool -> + Types.module_type -> + string

This function returns a string representing a Types.module_type.

  • parameter complete

    indicates if we must print complete signatures or just sig end. Default is false.

  • parameter code

    if complete = false and the type contains something else than identificators and functors, then the given code is used.

val string_of_class_type : ?complete:bool -> Types.class_type -> string

This function returns a string representing a Types.class_type.

  • parameter complete

    indicates if we must print complete signatures or just object end. Default is false.

val string_of_text : text -> string

Get a string from a text.

val string_of_info : info -> string

Get a string from an info structure.

val string_of_type : Type.t_type -> string
  • returns

    a string to describe the given type.

val string_of_record : Type.record_field list -> string
val string_of_type_extension : Extension.t_type_extension -> string
  • returns

    a string to describe the given type extension.

val string_of_exception : Exception.t_exception -> string
  • returns

    a string to describe the given exception.

val string_of_value : Value.t_value -> string
  • returns

    a string to describe the given value.

val string_of_attribute : Value.t_attribute -> string
  • returns

    a string to describe the given attribute.

val string_of_method : Value.t_method -> string
  • returns

    a string to describe the given method.

Miscellaneous functions

val first_sentence_of_text : text -> text

Return the first sentence (until the first dot followed by a blank or the first blank line) of a text. Don't stop in the middle of Code, CodePre, Verbatim, List, Enum, Latex, Link, Ref, Subscript or Superscript.

val first_sentence_and_rest_of_text : text -> text * text

Return the first sentence (until the first dot followed by a blank or the first blank line) of a text, and the remaining text after. Don't stop in the middle of Code, CodePre, Verbatim, List, Enum, Latex, Link, Ref, Subscript or Superscript.

val text_no_title_no_list : text -> text

Return the given text without any title or list.

val text_concat : Odoc_types.text -> Odoc_types.text list -> Odoc_types.text

concat sep l concats the given list of text l, each separated with the text sep.

val get_titles_in_text : text -> (int * string option * text) list

Return the list of titles in a text. A title is a title level, an optional label and a text.

val create_index_lists : 'a list -> ('a -> string) -> 'a list list

Take a sorted list of elements, a function to get the name of an element and return the list of list of elements, where each list group elements beginning by the same letter. Since the original list is sorted, elements whose name does not begin with a letter should be in the first returned list.

val remove_option : Types.type_expr -> Types.type_expr

Take a type and remove the option top constructor. This is useful when printing labels, we then remove the top option constructor for optional labels.

val is_optional : Asttypes.arg_label -> bool

Return true if the given label is optional.

val label_name : Asttypes.arg_label -> string

Return the label name for the given label, i.e. removes the beginning '?' if present.

val use_hidden_modules : Name.t -> Name.t

Return the given name where the module name or part of it was removed, according to the list of modules which must be hidden (cf Odoc_args.hidden_modules)

val verbose : string -> unit

Print the given string if the verbose mode is activated.

val warning : string -> unit

Print a warning message to stderr. If warnings must be treated as errors, then the error counter is incremented.

val print_warnings : bool ref

A flag to indicate whether ocamldoc warnings must be printed or not.

val errors : int ref

Increment this counter when an error is encountered. The ocamldoc tool will print the number of errors encountered exit with code 1 if this number is greater than 0.

val apply_opt : ('a -> 'b) -> 'a option -> 'b option

Apply a function to an optional value.

val apply_if_equal : ('a -> 'a) -> 'a -> 'a -> 'a

Apply a function to a first value if it is not different from a second value. If the two values are different, return the second one.

val text_of_string : string -> text

text_of_string s returns the text structure from the given string.

val text_string_of_text : text -> string

text_string_of_text text returns the string representing the given text. This string can then be parsed again by Odoc_info.text_of_string.

val info_of_string : string -> info

info_of_string s parses the given string like a regular ocamldoc comment and return an Odoc_info.info structure.

  • returns

    an empty structure if there was a syntax error. TODO: change this

val info_of_comment_file : Module.t_module list -> string -> info

info_of_comment_file file parses the given file and return an Odoc_info.info structure. The content of the file must have the same syntax as the content of a special comment. The given module list is used for cross reference.

  • raises Failure

    if the file could not be opened or there is a syntax error.

val remove_ending_newline : string -> string

remove_ending_newline s returns s without the optional ending newline.

Research in elements

module Scan : sig ... end

Scanning of collected information

module Dep : sig ... end

Computation of dependencies.

Some global variables

module Global : sig ... end
val analyse_files : + ?merge_options:Odoc_types.merge_option list -> + ?include_dirs:string list -> + ?labels:bool -> + ?sort_modules:bool -> + ?no_stop:bool -> + ?init:Odoc_module.t_module list -> + Odoc_global.source_file list -> + Module.t_module list

Analysis of the given source files.

  • parameter init

    is the list of modules already known from a previous analysis.

  • returns

    the list of analysed top modules.

val dump_modules : string -> Odoc_module.t_module list -> unit

Dump of a list of modules into a file.

  • raises Failure

    if an error occurs.

val load_modules : string -> Odoc_module.t_module list

Load of a list of modules from a file.

  • raises Failure

    if an error occurs.

diff --git a/ocaml/Odoc_latex/Generator/class-latex/index.html b/ocaml/Odoc_latex/Generator/class-latex/index.html new file mode 100644 index 00000000..ab5ac7ff --- /dev/null +++ b/ocaml/Odoc_latex/Generator/class-latex/index.html @@ -0,0 +1,140 @@ + +latex (ocaml.Odoc_latex.Generator.latex)

Class Generator.latex

val subst_strings : (Str.regexp * string) list
val subst_strings_code : (Str.regexp * string) list
val subst_strings_simple : (Str.regexp * string) list
val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
method attribute_label : ?no_:bool -> Odoc_info.Name.t -> string
method class_label : ?no_:bool -> Odoc_info.Name.t -> string
method class_type_label : ?no_:bool -> Odoc_info.Name.t -> string
method const_label : ?no_:bool -> Odoc_info.Name.t -> string
method entry_comment : (Format.formatter * (unit -> string)) -> + Odoc_info.info option -> + Odoc_info.text_element list
method escape : string -> string
method escape_code : string -> string
method escape_simple : string -> string
method exception_label : ?no_:bool -> Odoc_info.Name.t -> string
method extension_label : ?no_:bool -> Odoc_info.Name.t -> string
method first_and_rest_of_info : Odoc_info.info option -> + Odoc_info.text * Odoc_info.text
method generate : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_top_module : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method generate_inheritance_info : Format.formatter -> + Odoc_info.Class.inherited_class list -> + unit
method generate_style_file : unit
method label : ?no_:bool -> Odoc_info.Name.t -> string
method latex_for_class_index : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method latex_for_class_label : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method latex_for_class_type_index : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_for_class_type_label : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_for_module_index : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method latex_for_module_label : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method latex_for_module_type_index : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_for_module_type_label : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_header : Format.formatter -> + Odoc_info.Module.t_module list -> + unit
method latex_of_Block : Format.formatter -> Odoc_info.text -> unit
method latex_of_Bold : Format.formatter -> Odoc_info.text -> unit
method latex_of_Center : Format.formatter -> Odoc_info.text -> unit
method latex_of_Code : Format.formatter -> string -> unit
method latex_of_CodePre : Format.formatter -> string -> unit
method latex_of_Emphasize : Format.formatter -> Odoc_info.text -> unit
method latex_of_Enum : Format.formatter -> Odoc_info.text list -> unit
method latex_of_Italic : Format.formatter -> Odoc_info.text -> unit
method latex_of_Latex : Format.formatter -> string -> unit
method latex_of_Left : Format.formatter -> Odoc_info.text -> unit
method latex_of_List : Format.formatter -> Odoc_info.text list -> unit
method latex_of_Newline : Format.formatter -> unit
method latex_of_Raw : Format.formatter -> string -> unit
method latex_of_Ref : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.text option -> + unit
method latex_of_Right : Format.formatter -> Odoc_info.text -> unit
method latex_of_Subscript : Format.formatter -> Odoc_info.text -> unit
method latex_of_Superscript : Format.formatter -> Odoc_info.text -> unit
method latex_of_Target : Format.formatter -> + target:string -> + code:string -> + unit
method latex_of_Title : Format.formatter -> + int -> + Odoc_info.Name.t option -> + Odoc_info.text -> + unit
method latex_of_Verbatim : Format.formatter -> string -> unit
method latex_of_attribute : Format.formatter -> + Odoc_info.Value.t_attribute -> + unit
method latex_of_class : Format.formatter -> Odoc_info.Class.t_class -> unit
method latex_of_class_element : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_element -> + unit
method latex_of_class_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + unit
method latex_of_class_parameter_list : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + unit
method latex_of_class_type : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_of_class_type_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + unit
method latex_of_cstr_args : (Format.formatter * (unit -> string)) -> + Odoc_info.Name.t -> + (Odoc_info.Type.constructor_args * Types.type_expr option) -> + Odoc_info.text_element list
method latex_of_custom_text : Format.formatter -> + string -> + Odoc_info.text -> + unit
method latex_of_exception : Format.formatter -> + Odoc_info.Exception.t_exception -> + unit
method latex_of_included_module : Format.formatter -> + Odoc_info.Module.included_module -> + unit
method latex_of_info : Format.formatter -> + ?block:bool -> + Odoc_info.info option -> + unit
method latex_of_method : Format.formatter -> Odoc_info.Value.t_method -> unit
method latex_of_module : Format.formatter -> Odoc_info.Module.t_module -> unit
method latex_of_module_element : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + unit
method latex_of_module_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_kind -> + unit
method latex_of_module_parameter : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method latex_of_module_type : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_of_module_type_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_type_kind -> + unit
method latex_of_record : (Format.formatter * (unit -> string)) -> + Odoc_info.Name.t -> + Odoc_info.Type.record_field list -> + Odoc_info.text_element list
method latex_of_text : Format.formatter -> Odoc_info.text -> unit
method latex_of_text_element : Format.formatter -> + Odoc_info.text_element -> + unit
method latex_of_type : Format.formatter -> Odoc_info.Type.t_type -> unit
method latex_of_type_extension : Odoc_info.Name.t -> + Format.formatter -> + Odoc_info.Extension.t_type_extension -> + unit
method latex_of_type_params : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method latex_of_value : Format.formatter -> Odoc_info.Value.t_value -> unit
method make_label : string -> string
method make_ref : string -> string
method method_label : ?no_:bool -> Odoc_info.Name.t -> string
method module_label : ?no_:bool -> Odoc_info.Name.t -> string
method module_type_label : ?no_:bool -> Odoc_info.Name.t -> string
method normal_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + string
method normal_class_type : Odoc_info.Name.t -> Types.class_type -> string
method normal_class_type_param_list : Odoc_info.Name.t -> + Types.type_expr list -> + string
method normal_cstr_args : ?par:bool -> + Odoc_info.Name.t -> + Odoc_info.Type.constructor_args -> + string
method normal_module_type : ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + string
method normal_type : Odoc_info.Name.t -> Types.type_expr -> string
method normal_type_list : ?par:bool -> + Odoc_info.Name.t -> + string -> + Types.type_expr list -> + string
method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
method relative_idents : Odoc_info.Name.t -> string -> string
method relative_module_idents : Odoc_info.Name.t -> string -> string
method section_style : int -> string -> string
method subst : (Str.regexp * string) list -> string -> string
method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element list
method text_of_author_list : string list -> Odoc_info.text_element list
method text_of_before : (string * Odoc_info.text) list -> + Odoc_info.text_element list
method text_of_class_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + Odoc_info.text_element list
method text_of_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + Odoc_types.text
method text_of_class_type_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + Odoc_info.text_element list
method text_of_class_type_param_expr_list : Odoc_info.Name.t -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
method text_of_exception : Odoc_info.Exception.t_exception -> + Odoc_info.text_element list
method text_of_info : ?block:bool -> Odoc_info.info option -> Odoc_info.text
method text_of_method : Odoc_info.Value.t_method -> Odoc_info.text_element list
method text_of_module_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_kind -> + Odoc_info.text_element list
method text_of_module_parameter_list : (Odoc_info.Module.module_parameter + * Odoc_info.text_element list option) + list -> + Odoc_info.text_element list
method text_of_module_type : Types.module_type -> Odoc_info.text_element list
method text_of_module_type_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_type_kind -> + Odoc_info.text_element list
method text_of_parameter_description : Odoc_info.Parameter.parameter -> + Odoc_info.text
method text_of_parameter_list : Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + Odoc_info.text_element list
method text_of_raised_exceptions : Odoc_info.raised_exception list -> + Odoc_info.text_element list
method text_of_return_opt : Odoc_info.text option -> + Odoc_info.text_element list
method text_of_see : Odoc_info.see -> Odoc_info.text
method text_of_sees : Odoc_info.see list -> Odoc_info.text_element list
method text_of_short_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_since_opt : string option -> Odoc_info.text_element list
method text_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_type_expr_list : Odoc_info.Name.t -> + string -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_value : Odoc_info.Value.t_value -> Odoc_info.text_element list
method text_of_version_opt : string option -> Odoc_info.text_element list
method type_label : ?no_:bool -> Odoc_info.Name.t -> string
method value_label : ?no_:bool -> Odoc_info.Name.t -> string
diff --git a/ocaml/Odoc_latex/Generator/index.html b/ocaml/Odoc_latex/Generator/index.html new file mode 100644 index 00000000..96ca342b --- /dev/null +++ b/ocaml/Odoc_latex/Generator/index.html @@ -0,0 +1,2 @@ + +Generator (ocaml.Odoc_latex.Generator)

Module Odoc_latex.Generator

class latex : object ... end
diff --git a/ocaml/Odoc_latex/index.html b/ocaml/Odoc_latex/index.html new file mode 100644 index 00000000..46a7e54c --- /dev/null +++ b/ocaml/Odoc_latex/index.html @@ -0,0 +1,2 @@ + +Odoc_latex (ocaml.Odoc_latex)

Module Odoc_latex

Generation of LaTeX documentation.

val separate_files : bool ref
val latex_titles : (int * string) list ref
val latex_value_prefix : string ref
val latex_type_prefix : string ref
val latex_type_elt_prefix : string ref
val latex_extension_prefix : string ref
val latex_exception_prefix : string ref
val latex_module_prefix : string ref
val latex_module_type_prefix : string ref
val latex_class_prefix : string ref
val latex_class_type_prefix : string ref
val latex_attribute_prefix : string ref
val latex_method_prefix : string ref
module Generator : sig ... end
module type Latex_generator = sig ... end
diff --git a/ocaml/Odoc_latex/module-type-Latex_generator/class-latex/index.html b/ocaml/Odoc_latex/module-type-Latex_generator/class-latex/index.html new file mode 100644 index 00000000..a59608a3 --- /dev/null +++ b/ocaml/Odoc_latex/module-type-Latex_generator/class-latex/index.html @@ -0,0 +1,140 @@ + +latex (ocaml.Odoc_latex.Latex_generator.latex)

Class Latex_generator.latex

val subst_strings : (Str.regexp * string) list
val subst_strings_code : (Str.regexp * string) list
val subst_strings_simple : (Str.regexp * string) list
val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
method attribute_label : ?no_:bool -> Odoc_info.Name.t -> string
method class_label : ?no_:bool -> Odoc_info.Name.t -> string
method class_type_label : ?no_:bool -> Odoc_info.Name.t -> string
method const_label : ?no_:bool -> Odoc_info.Name.t -> string
method entry_comment : (Format.formatter * (unit -> string)) -> + Odoc_info.info option -> + Odoc_info.text_element list
method escape : string -> string
method escape_code : string -> string
method escape_simple : string -> string
method exception_label : ?no_:bool -> Odoc_info.Name.t -> string
method extension_label : ?no_:bool -> Odoc_info.Name.t -> string
method first_and_rest_of_info : Odoc_info.info option -> + Odoc_info.text * Odoc_info.text
method generate : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_top_module : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method generate_inheritance_info : Format.formatter -> + Odoc_info.Class.inherited_class list -> + unit
method generate_style_file : unit
method label : ?no_:bool -> Odoc_info.Name.t -> string
method latex_for_class_index : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method latex_for_class_label : Format.formatter -> + Odoc_info.Class.t_class -> + unit
method latex_for_class_type_index : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_for_class_type_label : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_for_module_index : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method latex_for_module_label : Format.formatter -> + Odoc_info.Module.t_module -> + unit
method latex_for_module_type_index : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_for_module_type_label : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_header : Format.formatter -> + Odoc_info.Module.t_module list -> + unit
method latex_of_Block : Format.formatter -> Odoc_info.text -> unit
method latex_of_Bold : Format.formatter -> Odoc_info.text -> unit
method latex_of_Center : Format.formatter -> Odoc_info.text -> unit
method latex_of_Code : Format.formatter -> string -> unit
method latex_of_CodePre : Format.formatter -> string -> unit
method latex_of_Emphasize : Format.formatter -> Odoc_info.text -> unit
method latex_of_Enum : Format.formatter -> Odoc_info.text list -> unit
method latex_of_Italic : Format.formatter -> Odoc_info.text -> unit
method latex_of_Latex : Format.formatter -> string -> unit
method latex_of_Left : Format.formatter -> Odoc_info.text -> unit
method latex_of_List : Format.formatter -> Odoc_info.text list -> unit
method latex_of_Newline : Format.formatter -> unit
method latex_of_Raw : Format.formatter -> string -> unit
method latex_of_Ref : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.text option -> + unit
method latex_of_Right : Format.formatter -> Odoc_info.text -> unit
method latex_of_Subscript : Format.formatter -> Odoc_info.text -> unit
method latex_of_Superscript : Format.formatter -> Odoc_info.text -> unit
method latex_of_Target : Format.formatter -> + target:string -> + code:string -> + unit
method latex_of_Title : Format.formatter -> + int -> + Odoc_info.Name.t option -> + Odoc_info.text -> + unit
method latex_of_Verbatim : Format.formatter -> string -> unit
method latex_of_attribute : Format.formatter -> + Odoc_info.Value.t_attribute -> + unit
method latex_of_class : Format.formatter -> Odoc_info.Class.t_class -> unit
method latex_of_class_element : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_element -> + unit
method latex_of_class_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + unit
method latex_of_class_parameter_list : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + unit
method latex_of_class_type : Format.formatter -> + Odoc_info.Class.t_class_type -> + unit
method latex_of_class_type_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + unit
method latex_of_cstr_args : (Format.formatter * (unit -> string)) -> + Odoc_info.Name.t -> + (Odoc_info.Type.constructor_args * Types.type_expr option) -> + Odoc_info.text_element list
method latex_of_custom_text : Format.formatter -> + string -> + Odoc_info.text -> + unit
method latex_of_exception : Format.formatter -> + Odoc_info.Exception.t_exception -> + unit
method latex_of_included_module : Format.formatter -> + Odoc_info.Module.included_module -> + unit
method latex_of_info : Format.formatter -> + ?block:bool -> + Odoc_info.info option -> + unit
method latex_of_method : Format.formatter -> Odoc_info.Value.t_method -> unit
method latex_of_module : Format.formatter -> Odoc_info.Module.t_module -> unit
method latex_of_module_element : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + unit
method latex_of_module_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_kind -> + unit
method latex_of_module_parameter : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_parameter -> + unit
method latex_of_module_type : Format.formatter -> + Odoc_info.Module.t_module_type -> + unit
method latex_of_module_type_kind : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Module.module_type_kind -> + unit
method latex_of_record : (Format.formatter * (unit -> string)) -> + Odoc_info.Name.t -> + Odoc_info.Type.record_field list -> + Odoc_info.text_element list
method latex_of_text : Format.formatter -> Odoc_info.text -> unit
method latex_of_text_element : Format.formatter -> + Odoc_info.text_element -> + unit
method latex_of_type : Format.formatter -> Odoc_info.Type.t_type -> unit
method latex_of_type_extension : Odoc_info.Name.t -> + Format.formatter -> + Odoc_info.Extension.t_type_extension -> + unit
method latex_of_type_params : Format.formatter -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method latex_of_value : Format.formatter -> Odoc_info.Value.t_value -> unit
method make_label : string -> string
method make_ref : string -> string
method method_label : ?no_:bool -> Odoc_info.Name.t -> string
method module_label : ?no_:bool -> Odoc_info.Name.t -> string
method module_type_label : ?no_:bool -> Odoc_info.Name.t -> string
method normal_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + string
method normal_class_type : Odoc_info.Name.t -> Types.class_type -> string
method normal_class_type_param_list : Odoc_info.Name.t -> + Types.type_expr list -> + string
method normal_cstr_args : ?par:bool -> + Odoc_info.Name.t -> + Odoc_info.Type.constructor_args -> + string
method normal_module_type : ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + string
method normal_type : Odoc_info.Name.t -> Types.type_expr -> string
method normal_type_list : ?par:bool -> + Odoc_info.Name.t -> + string -> + Types.type_expr list -> + string
method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
method relative_idents : Odoc_info.Name.t -> string -> string
method relative_module_idents : Odoc_info.Name.t -> string -> string
method section_style : int -> string -> string
method subst : (Str.regexp * string) list -> string -> string
method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element list
method text_of_author_list : string list -> Odoc_info.text_element list
method text_of_before : (string * Odoc_info.text) list -> + Odoc_info.text_element list
method text_of_class_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + Odoc_info.text_element list
method text_of_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + Odoc_types.text
method text_of_class_type_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + Odoc_info.text_element list
method text_of_class_type_param_expr_list : Odoc_info.Name.t -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
method text_of_exception : Odoc_info.Exception.t_exception -> + Odoc_info.text_element list
method text_of_info : ?block:bool -> Odoc_info.info option -> Odoc_info.text
method text_of_method : Odoc_info.Value.t_method -> Odoc_info.text_element list
method text_of_module_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_kind -> + Odoc_info.text_element list
method text_of_module_parameter_list : (Odoc_info.Module.module_parameter + * Odoc_info.text_element list option) + list -> + Odoc_info.text_element list
method text_of_module_type : Types.module_type -> Odoc_info.text_element list
method text_of_module_type_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_type_kind -> + Odoc_info.text_element list
method text_of_parameter_description : Odoc_info.Parameter.parameter -> + Odoc_info.text
method text_of_parameter_list : Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + Odoc_info.text_element list
method text_of_raised_exceptions : Odoc_info.raised_exception list -> + Odoc_info.text_element list
method text_of_return_opt : Odoc_info.text option -> + Odoc_info.text_element list
method text_of_see : Odoc_info.see -> Odoc_info.text
method text_of_sees : Odoc_info.see list -> Odoc_info.text_element list
method text_of_short_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_since_opt : string option -> Odoc_info.text_element list
method text_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_type_expr_list : Odoc_info.Name.t -> + string -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_value : Odoc_info.Value.t_value -> Odoc_info.text_element list
method text_of_version_opt : string option -> Odoc_info.text_element list
method type_label : ?no_:bool -> Odoc_info.Name.t -> string
method value_label : ?no_:bool -> Odoc_info.Name.t -> string
diff --git a/ocaml/Odoc_latex/module-type-Latex_generator/index.html b/ocaml/Odoc_latex/module-type-Latex_generator/index.html new file mode 100644 index 00000000..ef2fb0e9 --- /dev/null +++ b/ocaml/Odoc_latex/module-type-Latex_generator/index.html @@ -0,0 +1,2 @@ + +Latex_generator (ocaml.Odoc_latex.Latex_generator)

Module type Odoc_latex.Latex_generator

class latex : object ... end
diff --git a/ocaml/Odoc_latex_style/index.html b/ocaml/Odoc_latex_style/index.html new file mode 100644 index 00000000..3e64c9c8 --- /dev/null +++ b/ocaml/Odoc_latex_style/index.html @@ -0,0 +1,2 @@ + +Odoc_latex_style (ocaml.Odoc_latex_style)

Module Odoc_latex_style

The content of the LaTeX style to generate when generating LaTeX code.

val content : string
diff --git a/ocaml/Odoc_lexer/index.html b/ocaml/Odoc_lexer/index.html new file mode 100644 index 00000000..8801b207 --- /dev/null +++ b/ocaml/Odoc_lexer/index.html @@ -0,0 +1,2 @@ + +Odoc_lexer (ocaml.Odoc_lexer)

Module Odoc_lexer

val line_number : int ref
val comments_level : int ref
diff --git a/ocaml/Odoc_man/Generator/class-man/index.html b/ocaml/Odoc_man/Generator/class-man/index.html new file mode 100644 index 00000000..5f137848 --- /dev/null +++ b/ocaml/Odoc_man/Generator/class-man/index.html @@ -0,0 +1,46 @@ + +man (ocaml.Odoc_man.Generator.man)

Class Generator.man

val mutable tag_functions : (string * (Odoc_info.text -> string)) list
method create_groups : bool -> + Odoc_info.Module.t_module list -> + Odoc_info.Search.result_element list list
method escape : string -> string
method field_comment : Buffer.t -> Odoc_info.info option -> unit
method file_name : Odoc_info.Name.t -> string
method generate : Odoc_info.Module.t_module list -> unit
method generate_for_class : Odoc_info.Class.t_class -> unit
method generate_for_class_type : Odoc_info.Class.t_class_type -> unit
method generate_for_group : Odoc_info.Search.result_element list -> unit
method generate_for_module : Odoc_info.Module.t_module -> unit
method generate_for_module_type : Odoc_info.Module.t_module_type -> unit
method man_of_Target : Buffer.t -> target:string -> code:string -> unit
method man_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
method man_of_class : Buffer.t -> Odoc_info.Class.t_class -> unit
method man_of_class_comment : Buffer.t -> Odoc_info.text -> unit
method man_of_class_type : Buffer.t -> Odoc_info.Class.t_class_type -> unit
method man_of_class_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.class_type -> + unit
method man_of_code : Buffer.t -> string -> unit
method man_of_const : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.variant_constructor -> + unit
method man_of_cstr_args : ?par:bool -> + Buffer.t -> + Odoc_info.Name.t -> + string -> + Odoc_info.Type.constructor_args -> + unit
method man_of_custom_text : Buffer.t -> string -> Odoc_info.text -> unit
method man_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
method man_of_included_module : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.included_module -> + unit
method man_of_info : ?margin:int -> Buffer.t -> Odoc_types.info option -> unit
method man_of_method : Buffer.t -> Odoc_info.Value.t_method -> unit
method man_of_modtype : Buffer.t -> Odoc_info.Module.t_module_type -> unit
method man_of_module : Buffer.t -> Odoc_info.Module.t_module -> unit
method man_of_module_body : Buffer.t -> Odoc_info.Module.t_module -> unit
method man_of_module_comment : Buffer.t -> Odoc_info.text -> unit
method man_of_module_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + (Odoc_info.Module.module_parameter * Odoc_info.text option) list -> + unit
method man_of_module_type : Buffer.t -> + Odoc_info.Name.t -> + Types.module_type -> + unit
method man_of_module_type_body : Buffer.t -> + Odoc_info.Module.t_module_type -> + unit
method man_of_parameter_description : Buffer.t -> + Odoc_info.Parameter.parameter -> + unit
method man_of_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + unit
method man_of_recfield : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.record_field -> + unit
method man_of_record : Odoc_info.Name.t -> + Buffer.t -> + Odoc_info.Type.record_field list -> + unit
method man_of_text : Buffer.t -> Odoc_info.text -> unit
method private man_of_text2 : Buffer.t -> Odoc_info.text -> unit
method man_of_text_element : Buffer.t -> Odoc_info.text_element -> unit
method man_of_type : Buffer.t -> Odoc_info.Type.t_type -> unit
method man_of_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr -> + unit
method man_of_type_expr_param_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method man_of_type_extension : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + unit
method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
method open_out : string -> out_channel
method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
method remove_newlines : string -> string
method str_man_of_alerts : Odoc_info.alert list -> string list
method str_man_of_author_list : string list -> string
method str_man_of_before : (string * Odoc_info.text) list -> string
method str_man_of_custom : (string * Odoc_info.text) list -> string list
method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
method str_man_of_return_opt : Odoc_info.text option -> string
method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
method str_man_of_since_opt : string option -> string
method str_man_of_text : Odoc_info.text -> string
method str_man_of_version_opt : string option -> string
diff --git a/ocaml/Odoc_man/Generator/index.html b/ocaml/Odoc_man/Generator/index.html new file mode 100644 index 00000000..83424c90 --- /dev/null +++ b/ocaml/Odoc_man/Generator/index.html @@ -0,0 +1,2 @@ + +Generator (ocaml.Odoc_man.Generator)

Module Odoc_man.Generator

class man : object ... end
diff --git a/ocaml/Odoc_man/index.html b/ocaml/Odoc_man/index.html new file mode 100644 index 00000000..8d6d752e --- /dev/null +++ b/ocaml/Odoc_man/index.html @@ -0,0 +1,2 @@ + +Odoc_man (ocaml.Odoc_man)

Module Odoc_man

The man pages generator.

val man_suffix : string ref
val man_section : string ref
val man_mini : bool ref
module Generator : sig ... end
module type Man_generator = sig ... end
diff --git a/ocaml/Odoc_man/module-type-Man_generator/class-man/index.html b/ocaml/Odoc_man/module-type-Man_generator/class-man/index.html new file mode 100644 index 00000000..917e9e74 --- /dev/null +++ b/ocaml/Odoc_man/module-type-Man_generator/class-man/index.html @@ -0,0 +1,46 @@ + +man (ocaml.Odoc_man.Man_generator.man)

Class Man_generator.man

val mutable tag_functions : (string * (Odoc_info.text -> string)) list
method create_groups : bool -> + Odoc_info.Module.t_module list -> + Odoc_info.Search.result_element list list
method escape : string -> string
method field_comment : Buffer.t -> Odoc_info.info option -> unit
method file_name : Odoc_info.Name.t -> string
method generate : Odoc_info.Module.t_module list -> unit
method generate_for_class : Odoc_info.Class.t_class -> unit
method generate_for_class_type : Odoc_info.Class.t_class_type -> unit
method generate_for_group : Odoc_info.Search.result_element list -> unit
method generate_for_module : Odoc_info.Module.t_module -> unit
method generate_for_module_type : Odoc_info.Module.t_module_type -> unit
method man_of_Target : Buffer.t -> target:string -> code:string -> unit
method man_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
method man_of_class : Buffer.t -> Odoc_info.Class.t_class -> unit
method man_of_class_comment : Buffer.t -> Odoc_info.text -> unit
method man_of_class_type : Buffer.t -> Odoc_info.Class.t_class_type -> unit
method man_of_class_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.class_type -> + unit
method man_of_code : Buffer.t -> string -> unit
method man_of_const : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.variant_constructor -> + unit
method man_of_cstr_args : ?par:bool -> + Buffer.t -> + Odoc_info.Name.t -> + string -> + Odoc_info.Type.constructor_args -> + unit
method man_of_custom_text : Buffer.t -> string -> Odoc_info.text -> unit
method man_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
method man_of_included_module : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Module.included_module -> + unit
method man_of_info : ?margin:int -> Buffer.t -> Odoc_types.info option -> unit
method man_of_method : Buffer.t -> Odoc_info.Value.t_method -> unit
method man_of_modtype : Buffer.t -> Odoc_info.Module.t_module_type -> unit
method man_of_module : Buffer.t -> Odoc_info.Module.t_module -> unit
method man_of_module_body : Buffer.t -> Odoc_info.Module.t_module -> unit
method man_of_module_comment : Buffer.t -> Odoc_info.text -> unit
method man_of_module_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + (Odoc_info.Module.module_parameter * Odoc_info.text option) list -> + unit
method man_of_module_type : Buffer.t -> + Odoc_info.Name.t -> + Types.module_type -> + unit
method man_of_module_type_body : Buffer.t -> + Odoc_info.Module.t_module_type -> + unit
method man_of_parameter_description : Buffer.t -> + Odoc_info.Parameter.parameter -> + unit
method man_of_parameter_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + unit
method man_of_recfield : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.record_field -> + unit
method man_of_record : Odoc_info.Name.t -> + Buffer.t -> + Odoc_info.Type.record_field list -> + unit
method man_of_text : Buffer.t -> Odoc_info.text -> unit
method private man_of_text2 : Buffer.t -> Odoc_info.text -> unit
method man_of_text_element : Buffer.t -> Odoc_info.text_element -> unit
method man_of_type : Buffer.t -> Odoc_info.Type.t_type -> unit
method man_of_type_expr : Buffer.t -> + Odoc_info.Name.t -> + Types.type_expr -> + unit
method man_of_type_expr_param_list : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Type.t_type -> + unit
method man_of_type_extension : Buffer.t -> + Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + unit
method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
method open_out : string -> out_channel
method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
method remove_newlines : string -> string
method str_man_of_alerts : Odoc_info.alert list -> string list
method str_man_of_author_list : string list -> string
method str_man_of_before : (string * Odoc_info.text) list -> string
method str_man_of_custom : (string * Odoc_info.text) list -> string list
method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
method str_man_of_return_opt : Odoc_info.text option -> string
method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
method str_man_of_since_opt : string option -> string
method str_man_of_text : Odoc_info.text -> string
method str_man_of_version_opt : string option -> string
diff --git a/ocaml/Odoc_man/module-type-Man_generator/index.html b/ocaml/Odoc_man/module-type-Man_generator/index.html new file mode 100644 index 00000000..b3ced57f --- /dev/null +++ b/ocaml/Odoc_man/module-type-Man_generator/index.html @@ -0,0 +1,2 @@ + +Man_generator (ocaml.Odoc_man.Man_generator)

Module type Odoc_man.Man_generator

class man : object ... end
diff --git a/ocaml/Odoc_merge/index.html b/ocaml/Odoc_merge/index.html new file mode 100644 index 00000000..256aa1a6 --- /dev/null +++ b/ocaml/Odoc_merge/index.html @@ -0,0 +1,11 @@ + +Odoc_merge (ocaml.Odoc_merge)

Module Odoc_merge

val merge_before_tags : + (string * Odoc_types.text) list -> + (string * Odoc_types.text) list
val merge_info_opt : + Odoc_types.merge_option list -> + Odoc_types.info option -> + Odoc_types.info option -> + Odoc_types.info option
diff --git a/ocaml/Odoc_messages/index.html b/ocaml/Odoc_messages/index.html new file mode 100644 index 00000000..4ff06d7a --- /dev/null +++ b/ocaml/Odoc_messages/index.html @@ -0,0 +1,2 @@ + +Odoc_messages (ocaml.Odoc_messages)

Module Odoc_messages

The messages of the application.

val ok : string
val software : string
val config_version : string
val magic : string
val usage : string
val options_are : string
val latex_only : string
val texi_only : string
val latex_texi_only : string
val html_only : string
val html_latex_only : string
val html_latex_texi_only : string
val man_only : string
val option_impl : string
val option_intf : string
val option_text : string
val display_custom_generators_dir : string
val add_load_dir : string
val load_file : string
val werr : string
val show_missed_crossref : string
val hide_warnings : string
val target_dir : string
val dump : string
val load : string
val css_style : string
val index_only : string
val colorize_code : string
val html_short_functors : string
val charset : string -> string
val no_navbar : string
val generate_html : string
val generate_latex : string
val generate_texinfo : string
val generate_man : string
val generate_dot : string
val option_not_in_native_code : string -> string
val default_out_file : string
val out_file : string
val dot_include_all : string
val dot_types : string
val default_dot_colors : string list list
val dot_colors : string
val dot_reduce : string
val man_mini : string
val default_man_section : string
val man_section : string
val default_man_suffix : string
val man_suffix : string
val option_title : string
val option_intro : string
val with_parameter_list : string
val hide_modules : string
val no_header : string
val no_trailer : string
val separate_files : string
val latex_title : (int * string) list ref -> string
val default_latex_value_prefix : string
val latex_value_prefix : string
val default_latex_type_prefix : string
val latex_type_prefix : string
val default_latex_type_elt_prefix : string
val latex_type_elt_prefix : string
val default_latex_extension_prefix : string
val latex_extension_prefix : string
val default_latex_exception_prefix : string
val latex_exception_prefix : string
val default_latex_module_prefix : string
val latex_module_prefix : string
val default_latex_module_type_prefix : string
val latex_module_type_prefix : string
val default_latex_class_prefix : string
val latex_class_prefix : string
val default_latex_class_type_prefix : string
val latex_class_type_prefix : string
val default_latex_attribute_prefix : string
val latex_attribute_prefix : string
val default_latex_method_prefix : string
val latex_method_prefix : string
val no_toc : string
val sort_modules : string
val no_stop : string
val no_custom_tags : string
val remove_stars : string
val keep_code : string
val inverse_merge_ml_mli : string
val no_filter_with_module_constraints : string
val merge_description : char * string
val merge_author : char * string
val merge_version : char * string
val merge_see : char * string
val merge_since : char * string
val merge_before : char * string
val merge_deprecated : char * string
val merge_param : char * string
val merge_raised_exception : char * string
val merge_return_value : char * string
val merge_custom : char * string
val merge_all : char * string
val no_index : string
val esc_8bits : string
val texinfo_title : (int * (string * string)) list ref -> string
val info_section : string
val info_entry : string
val options_can_be : string
val string_of_options_list : (char * string) list -> string
val merge_options : string
val initially_opened_module : string
val library_namespace : string
val help : string
val warning : string
val error_location : string -> int -> int -> string
val bad_magic_number : string
val not_a_module_name : string -> string
val load_file_error : string -> string -> string
val wrong_format : string -> string
val errors_occured : int -> string
val parse_error : string
val text_parse_error : int -> int -> string -> string
val file_not_found_in_paths : string list -> string -> string
val tag_not_handled : string -> string
val should_escape_at_sign : string
val bad_tree : string
val not_a_valid_tag : string -> string
val fun_without_param : string -> string
val method_without_param : string -> string
val anonymous_parameters : string -> string
val function_colon : string -> string
val implicit_match_in_parameter : string
val unknown_extension : string -> string
val two_implementations : string -> string
val two_interfaces : string -> string
val too_many_module_objects : string -> string
val extension_not_found_in_implementation : string -> string -> string
val exception_not_found_in_implementation : string -> string -> string
val type_not_found_in_implementation : string -> string -> string
val module_not_found_in_implementation : string -> string -> string
val value_not_found_in_implementation : string -> string -> string
val class_not_found_in_implementation : string -> string -> string
val attribute_not_found_in_implementation : string -> string -> string
val method_not_found_in_implementation : string -> string -> string
val different_types : string -> string
val attribute_type_not_found : string -> string -> string
val method_type_not_found : string -> string -> string
val module_not_found : string -> string -> string
val module_type_not_found : string -> string -> string
val value_not_found : string -> string -> string
val extension_not_found : string -> string -> string
val exception_not_found : string -> string -> string
val type_not_found : string -> string -> string
val class_not_found : string -> string -> string
val class_type_not_found : string -> string -> string
val type_not_found_in_typedtree : string -> string
val extension_not_found_in_typedtree : string -> string
val exception_not_found_in_typedtree : string -> string
val module_type_not_found_in_typedtree : string -> string
val module_not_found_in_typedtree : string -> string
val class_not_found_in_typedtree : string -> string
val class_type_not_found_in_typedtree : string -> string
val inherit_classexp_not_found_in_typedtree : int -> string
val attribute_not_found_in_typedtree : string -> string
val method_not_found_in_typedtree : string -> string
val misplaced_comment : string -> int -> string
val cross_module_not_found : string -> string
val cross_module_type_not_found : string -> string
val cross_module_or_module_type_not_found : string -> string
val cross_class_not_found : string -> string
val cross_class_type_not_found : string -> string
val cross_class_or_class_type_not_found : string -> string
val cross_extension_not_found : string -> string
val cross_exception_not_found : string -> string
val cross_element_not_found : string -> string
val cross_method_not_found : string -> string
val cross_attribute_not_found : string -> string
val cross_section_not_found : string -> string
val cross_value_not_found : string -> string
val cross_type_not_found : string -> string
val cross_recfield_not_found : string -> string
val cross_const_not_found : string -> string
val code_could_be_cross_reference : string -> string -> string
val object_end : string
val struct_end : string
val sig_end : string
val current_generator_is_not : string -> string
val analysing : string -> string
val merging : string
val cross_referencing : string
val generating_doc : string
val loading : string -> string
val file_generated : string -> string
val file_exists_dont_generate : string -> string
val modul : string
val modules : string
val functors : string
val values : string
val types : string
val extensions : string
val exceptions : string
val record : string
val variant : string
val mutab : string
val functions : string
val parameters : string
val abstract : string
val functo : string
val clas : string
val classes : string
val attributes : string
val methods : string
val authors : string
val version : string
val since : string
val before : string
val deprecated : string
val alert : string
val raises : string
val returns : string
val inherits : string
val inheritance : string
val privat : string
val module_type : string
val class_type : string
val description : string
val interface : string
val type_parameters : string
val class_types : string
val module_types : string
val see_also : string
val documentation : string
val index_of : string
val top : string
val index_of_values : string
val index_of_extensions : string
val index_of_exceptions : string
val index_of_types : string
val index_of_attributes : string
val index_of_methods : string
val index_of_classes : string
val index_of_class_types : string
val index_of_modules : string
val index_of_module_types : string
val previous : string
val next : string
val up : string
diff --git a/ocaml/Odoc_misc/index.html b/ocaml/Odoc_misc/index.html new file mode 100644 index 00000000..db2318b6 --- /dev/null +++ b/ocaml/Odoc_misc/index.html @@ -0,0 +1,6 @@ + +Odoc_misc (ocaml.Odoc_misc)

Module Odoc_misc

val no_blanks : string -> string
val input_file_as_string : string -> string
val split_with_blanks : string -> string list
val string_of_longident : Longident.t -> string
val string_of_text : Odoc_types.text -> string
val string_of_author_list : string list -> string
val string_of_version_opt : string option -> string
val string_of_since_opt : string option -> string
val string_of_raised_exceptions : (string * Odoc_types.text) list -> string
val string_of_see : (Odoc_types.see_ref * Odoc_types.text) -> string
val string_of_sees : (Odoc_types.see_ref * Odoc_types.text) list -> string
val string_of_return_opt : Odoc_types.text option -> string
val string_of_info : Odoc_types.info -> string
val apply_opt : ('a -> 'b) -> 'a option -> 'b option
val string_of_date : ?absolute:bool -> ?hour:bool -> float -> string
val current_date : string
val first_sentence_of_text : Odoc_types.text -> Odoc_types.text
val first_sentence_and_rest_of_text : + Odoc_types.text -> + Odoc_types.text * Odoc_types.text
val text_no_title_no_list : Odoc_types.text -> Odoc_types.text
val text_concat : Odoc_types.text -> Odoc_types.text list -> Odoc_types.text
val get_titles_in_text : + Odoc_types.text -> + (int * string option * Odoc_types.text) list
val create_index_lists : 'a list -> ('a -> string) -> 'a list list
val remove_duplicates : ('a -> 'a -> int) -> 'a list -> 'a list
val remove_ending_newline : string -> string
val search_string_backward : pat:string -> s:string -> int
val remove_option : Types.type_expr -> Types.type_expr
val is_optional : Asttypes.arg_label -> bool
val label_name : Asttypes.arg_label -> string
diff --git a/ocaml/Odoc_module/index.html b/ocaml/Odoc_module/index.html new file mode 100644 index 00000000..335dc842 --- /dev/null +++ b/ocaml/Odoc_module/index.html @@ -0,0 +1,49 @@ + +Odoc_module (ocaml.Odoc_module)

Module Odoc_module

module String = Misc.Stdlib.String
module Name = Odoc_name
type module_element =
  1. | Element_module of t_module
  2. | Element_module_type of t_module_type
  3. | Element_included_module of included_module
  4. | Element_class of Odoc_class.t_class
  5. | Element_class_type of Odoc_class.t_class_type
  6. | Element_value of Odoc_value.t_value
  7. | Element_type_extension of Odoc_extension.t_type_extension
  8. | Element_exception of Odoc_exception.t_exception
  9. | Element_type of Odoc_type.t_type
  10. | Element_module_comment of Odoc_types.text
and mmt =
  1. | Mod of t_module
  2. | Modtype of t_module_type
and included_module = {
  1. im_name : Name.t;
  2. mutable im_module : mmt option;
  3. mutable im_info : Odoc_types.info option;
}
and module_alias = {
  1. ma_name : Name.t;
  2. mutable ma_module : mmt option;
}
and module_parameter = {
  1. mp_name : string;
  2. mp_type : Types.module_type option;
  3. mp_type_code : string;
  4. mp_kind : module_type_kind;
}
and module_kind =
  1. | Module_struct of module_element list
  2. | Module_alias of module_alias
  3. | Module_functor of module_parameter * module_kind
  4. | Module_apply of module_kind * module_kind
  5. | Module_apply_unit of module_kind
  6. | Module_with of module_type_kind * string
  7. | Module_constraint of module_kind * module_type_kind
  8. | Module_typeof of string
  9. | Module_unpack of string * module_type_alias
and t_module = {
  1. m_name : Name.t;
  2. mutable m_type : Types.module_type;
  3. mutable m_info : Odoc_types.info option;
  4. m_is_interface : bool;
  5. m_file : string;
  6. mutable m_kind : module_kind;
  7. mutable m_loc : Odoc_types.location;
  8. mutable m_top_deps : Name.t list;
  9. mutable m_code : string option;
  10. mutable m_code_intf : string option;
  11. m_text_only : bool;
}
and module_type_alias = {
  1. mta_name : Name.t;
  2. mutable mta_module : t_module_type option;
}
and module_type_kind =
  1. | Module_type_struct of module_element list
  2. | Module_type_functor of module_parameter * module_type_kind
  3. | Module_type_alias of module_type_alias
  4. | Module_type_with of module_type_kind * string
  5. | Module_type_typeof of string
and t_module_type = {
  1. mt_name : Name.t;
  2. mutable mt_info : Odoc_types.info option;
  3. mutable mt_type : Types.module_type option;
  4. mt_is_interface : bool;
  5. mt_file : string;
  6. mutable mt_kind : module_type_kind option;
  7. mutable mt_loc : Odoc_types.location;
}
val values : module_element list -> Odoc_value.t_value list
val types : module_element list -> Odoc_type.t_type list
val type_extensions : + module_element list -> + Odoc_extension.t_type_extension list
val exceptions : module_element list -> Odoc_exception.t_exception list
val classes : module_element list -> Odoc_class.t_class list
val class_types : module_element list -> Odoc_class.t_class_type list
val modules : module_element list -> t_module list
val mod_types : module_element list -> t_module_type list
val comments : module_element list -> Odoc_types.text list
val included_modules : module_element list -> included_module list
val module_type_elements : ?trans:bool -> t_module_type -> module_element list
val module_elements : ?trans:bool -> t_module -> module_element list
val module_values : ?trans:bool -> t_module -> Odoc_value.t_value list
val module_functions : ?trans:bool -> t_module -> Odoc_value.t_value list
val module_simple_values : ?trans:bool -> t_module -> Odoc_value.t_value list
val module_types : ?trans:bool -> t_module -> Odoc_type.t_type list
val module_type_extensions : + ?trans:bool -> + t_module -> + Odoc_extension.t_type_extension list
val module_exceptions : + ?trans:bool -> + t_module -> + Odoc_exception.t_exception list
val module_classes : ?trans:bool -> t_module -> Odoc_class.t_class list
val module_class_types : + ?trans:bool -> + t_module -> + Odoc_class.t_class_type list
val module_modules : ?trans:bool -> t_module -> t_module list
val module_module_types : ?trans:bool -> t_module -> t_module_type list
val module_included_modules : ?trans:bool -> t_module -> included_module list
val module_comments : ?trans:bool -> t_module -> Odoc_types.text list
val module_type_parameters : + ?trans:bool -> + t_module_type -> + (module_parameter * Odoc_types.text option) list
val module_parameters : + ?trans:bool -> + t_module -> + (module_parameter * Odoc_types.text option) list
val module_all_submodules : ?trans:bool -> t_module -> t_module list
val module_type_is_functor : t_module_type -> bool
val module_is_functor : t_module -> bool
val module_type_values : + ?trans:bool -> + t_module_type -> + Odoc_value.t_value list
val module_type_types : ?trans:bool -> t_module_type -> Odoc_type.t_type list
val module_type_type_extensions : + ?trans:bool -> + t_module_type -> + Odoc_extension.t_type_extension list
val module_type_exceptions : + ?trans:bool -> + t_module_type -> + Odoc_exception.t_exception list
val module_type_classes : + ?trans:bool -> + t_module_type -> + Odoc_class.t_class list
val module_type_class_types : + ?trans:bool -> + t_module_type -> + Odoc_class.t_class_type list
val module_type_modules : ?trans:bool -> t_module_type -> t_module list
val module_type_module_types : + ?trans:bool -> + t_module_type -> + t_module_type list
val module_type_included_modules : + ?trans:bool -> + t_module_type -> + included_module list
val module_type_comments : ?trans:bool -> t_module_type -> Odoc_types.text list
val module_type_functions : + ?trans:bool -> + t_module_type -> + Odoc_value.t_value list
val module_type_simple_values : + ?trans:bool -> + t_module_type -> + Odoc_value.t_value list
val module_all_classes : ?trans:bool -> t_module -> Odoc_class.t_class list
val module_type_all_classes : + ?trans:bool -> + t_module_type -> + Odoc_class.t_class list
diff --git a/ocaml/Odoc_name/Map/index.html b/ocaml/Odoc_name/Map/index.html new file mode 100644 index 00000000..5e1f7cb3 --- /dev/null +++ b/ocaml/Odoc_name/Map/index.html @@ -0,0 +1,6 @@ + +Map (ocaml.Odoc_name.Map)

Module Odoc_name.Map

type key = t
type !+'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
diff --git a/ocaml/Odoc_name/index.html b/ocaml/Odoc_name/index.html new file mode 100644 index 00000000..d853372e --- /dev/null +++ b/ocaml/Odoc_name/index.html @@ -0,0 +1,2 @@ + +Odoc_name (ocaml.Odoc_name)

Module Odoc_name

type t = string
val parens_if_infix : t -> t
val simple : t -> t
val father : t -> t
val concat : t -> t -> t
val normalize_name : t -> t
val head : t -> t
val depth : t -> int
val prefix : t -> t -> bool
val alias_unprefix : t -> t -> t
val get_relative : t -> t -> t
val get_relative_opt : t -> t -> t
val get_relative_raw : t -> t -> t
val hide_given_modules : t list -> t -> t
val qualified : t -> bool
val from_ident : Ident.t -> t
val from_path : Path.t -> t
val to_path : t -> Path.t
val from_longident : Longident.t -> t
module Map : sig ... end
diff --git a/ocaml/Odoc_ocamlhtml/index.html b/ocaml/Odoc_ocamlhtml/index.html new file mode 100644 index 00000000..4b327acc --- /dev/null +++ b/ocaml/Odoc_ocamlhtml/index.html @@ -0,0 +1,2 @@ + +Odoc_ocamlhtml (ocaml.Odoc_ocamlhtml)

Module Odoc_ocamlhtml

Generation of html code to display OCaml code.

val escape_base : string -> string
val html_of_comment : (string -> string) ref
val code_class : string
val html_of_code : Stdlib.Buffer.t -> ?with_pre:bool -> string -> unit
diff --git a/ocaml/Odoc_parameter/index.html b/ocaml/Odoc_parameter/index.html new file mode 100644 index 00000000..17702854 --- /dev/null +++ b/ocaml/Odoc_parameter/index.html @@ -0,0 +1,8 @@ + +Odoc_parameter (ocaml.Odoc_parameter)

Module Odoc_parameter

Representation and manipulation of method / function / class parameters.

Types

type simple_name = {
  1. sn_name : string;
  2. sn_type : Types.type_expr;
  3. mutable sn_text : Odoc_types.text option;
}

Representation of a simple parameter name

type param_info =
  1. | Simple_name of simple_name
  2. | Tuple of param_info list * Types.type_expr
    (*

    Representation of parameter names. We need it to represent parameter names in tuples. The value Tuple ([], t) stands for an anonymous parameter.

    *)
type parameter = param_info

A parameter is just a param_info.

Functions

val complete_name : parameter -> string

access to the name as a string. For tuples, parentheses and commas are added.

access to the complete type

val update_parameter_text : + (string -> Odoc_types.text option) -> + parameter -> + unit

Update the text of a parameter using a function returning the optional text associated to a parameter name.

val desc_by_name : parameter -> string -> Odoc_types.text option

access to the description of a specific name.

  • raises Not_found

    if no description is associated to the given name.

val names : parameter -> string list

access to the list of names ; only one for a simple parameter, or a list for tuples.

val type_by_name : parameter -> string -> Types.type_expr

access to the type of a specific name.

  • raises Not_found

    if no type is associated to the given name.

val desc_from_info_opt : + Odoc_types.info option -> + string -> + Odoc_types.text option

access to the optional description of a parameter name from an optional info structure.

diff --git a/ocaml/Odoc_parser/index.html b/ocaml/Odoc_parser/index.html new file mode 100644 index 00000000..32d19c6e --- /dev/null +++ b/ocaml/Odoc_parser/index.html @@ -0,0 +1,11 @@ + +Odoc_parser (ocaml.Odoc_parser)

Module Odoc_parser

type token =
  1. | Description of string * string option
  2. | See_url of string
  3. | See_file of string
  4. | See_doc of string
  5. | T_PARAM
  6. | T_AUTHOR
  7. | T_VERSION
  8. | T_SEE
  9. | T_SINCE
  10. | T_BEFORE
  11. | T_DEPRECATED
  12. | T_RAISES
  13. | T_RETURN
  14. | T_CUSTOM of string
  15. | EOF
  16. | Desc of string
val main : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + (string * string option) option
val info_part2 : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + unit
val see_info : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + Odoc_types.see_ref * string
diff --git a/ocaml/Odoc_print/index.html b/ocaml/Odoc_print/index.html new file mode 100644 index 00000000..e331dd3b --- /dev/null +++ b/ocaml/Odoc_print/index.html @@ -0,0 +1,6 @@ + +Odoc_print (ocaml.Odoc_print)

Module Odoc_print

val string_of_type_expr : Types.type_expr -> string
val string_of_module_type : + ?code:string -> + ?complete:bool -> + Types.module_type -> + string
val string_of_class_type : ?complete:bool -> Types.class_type -> string
diff --git a/ocaml/Odoc_scan/class-scanner/index.html b/ocaml/Odoc_scan/class-scanner/index.html new file mode 100644 index 00000000..f2411b5f --- /dev/null +++ b/ocaml/Odoc_scan/class-scanner/index.html @@ -0,0 +1,6 @@ + +scanner (ocaml.Odoc_scan.scanner)

Class Odoc_scan.scanner

method scan_attribute : Odoc_value.t_attribute -> unit
method scan_class : Odoc_class.t_class -> unit
method scan_class_comment : Odoc_types.text -> unit
method scan_class_elements : Odoc_class.t_class -> unit
method scan_class_pre : Odoc_class.t_class -> bool
method scan_class_type : Odoc_class.t_class_type -> unit
method scan_class_type_comment : Odoc_types.text -> unit
method scan_class_type_elements : Odoc_class.t_class_type -> unit
method scan_class_type_pre : Odoc_class.t_class_type -> bool
method scan_exception : Odoc_exception.t_exception -> unit
method scan_extension_constructor : Odoc_extension.t_extension_constructor -> + unit
method scan_included_module : Odoc_module.included_module -> unit
method scan_method : Odoc_value.t_method -> unit
method scan_module : Odoc_module.t_module -> unit
method scan_module_comment : Odoc_types.text -> unit
method scan_module_elements : Odoc_module.t_module -> unit
method scan_module_list : Odoc_module.t_module list -> unit
method scan_module_pre : Odoc_module.t_module -> bool
method scan_module_type : Odoc_module.t_module_type -> unit
method scan_module_type_comment : Odoc_types.text -> unit
method scan_module_type_elements : Odoc_module.t_module_type -> unit
method scan_module_type_pre : Odoc_module.t_module_type -> bool
method scan_type : Odoc_type.t_type -> unit
method scan_type_const : Odoc_type.t_type -> + Odoc_type.variant_constructor -> + unit
method scan_type_extension : Odoc_extension.t_type_extension -> unit
method scan_type_extension_constructors : Odoc_extension.t_type_extension -> + unit
method scan_type_extension_pre : Odoc_extension.t_type_extension -> bool
method scan_type_pre : Odoc_type.t_type -> bool
method scan_type_recfield : Odoc_type.t_type -> Odoc_type.record_field -> unit
method scan_value : Odoc_value.t_value -> unit
diff --git a/ocaml/Odoc_scan/index.html b/ocaml/Odoc_scan/index.html new file mode 100644 index 00000000..9621eb9c --- /dev/null +++ b/ocaml/Odoc_scan/index.html @@ -0,0 +1,2 @@ + +Odoc_scan (ocaml.Odoc_scan)

Module Odoc_scan

class scanner : object ... end
diff --git a/ocaml/Odoc_search/P_name/index.html b/ocaml/Odoc_search/P_name/index.html new file mode 100644 index 00000000..0bb34fdd --- /dev/null +++ b/ocaml/Odoc_search/P_name/index.html @@ -0,0 +1,10 @@ + +P_name (ocaml.Odoc_search.P_name)

Module Odoc_search.P_name

type t = Str.regexp
val (=~) : string -> Str.regexp -> bool
val p_module : Odoc_module.t_module -> Str.regexp -> bool * bool
val p_module_type : Odoc_module.t_module_type -> Str.regexp -> bool * bool
val p_class : Odoc_class.t_class -> Str.regexp -> bool * bool
val p_class_type : Odoc_class.t_class_type -> Str.regexp -> bool * bool
val p_value : Odoc_value.t_value -> Str.regexp -> bool
val p_recfield : + Odoc_type.t_type -> + Odoc_type.record_field -> + Str.regexp -> + bool
val p_const : + Odoc_type.t_type -> + Odoc_type.variant_constructor -> + Str.regexp -> + bool
val p_type : Odoc_type.t_type -> Str.regexp -> bool * bool
val p_exception : Odoc_exception.t_exception -> Str.regexp -> bool
val p_attribute : Odoc_value.t_attribute -> Str.regexp -> bool
val p_method : Odoc_value.t_method -> Str.regexp -> bool
diff --git a/ocaml/Odoc_search/Search/argument-1-P/index.html b/ocaml/Odoc_search/Search/argument-1-P/index.html new file mode 100644 index 00000000..2d2ae1bf --- /dev/null +++ b/ocaml/Odoc_search/Search/argument-1-P/index.html @@ -0,0 +1,2 @@ + +P (ocaml.Odoc_search.Search.P)

Parameter Search.P

type t
val p_module : Odoc_module.t_module -> t -> bool * bool
val p_module_type : Odoc_module.t_module_type -> t -> bool * bool
val p_class : Odoc_class.t_class -> t -> bool * bool
val p_class_type : Odoc_class.t_class_type -> t -> bool * bool
val p_value : Odoc_value.t_value -> t -> bool
val p_recfield : Odoc_type.t_type -> Odoc_type.record_field -> t -> bool
val p_type : Odoc_type.t_type -> t -> bool * bool
val p_extension : Odoc_extension.t_extension_constructor -> t -> bool
val p_exception : Odoc_exception.t_exception -> t -> bool
val p_attribute : Odoc_value.t_attribute -> t -> bool
val p_method : Odoc_value.t_method -> t -> bool
val p_section : string -> t -> bool
diff --git a/ocaml/Odoc_search/Search/index.html b/ocaml/Odoc_search/Search/index.html new file mode 100644 index 00000000..a00598f9 --- /dev/null +++ b/ocaml/Odoc_search/Search/index.html @@ -0,0 +1,19 @@ + +Search (ocaml.Odoc_search.Search)

Module Odoc_search.Search

Parameters

module P : Predicates

Signature

val search_section : Odoc_types.text -> string -> P.t -> result_element list
val search_value : Odoc_value.t_value -> P.t -> result_element list
val search_recfield : + Odoc_type.t_type -> + Odoc_type.record_field -> + P.t -> + result_element list
val search_const : + Odoc_type.t_type -> + Odoc_type.variant_constructor -> + P.t -> + result_element list
val search_type : Odoc_type.t_type -> P.t -> result_element list
val search_extension_constructor : + Odoc_extension.t_extension_constructor -> + P.t -> + result_element list
val search_type_extension : + Odoc_extension.t_type_extension -> + P.t -> + result_element list
val search_exception : Odoc_exception.t_exception -> P.t -> result_element list
val search_attribute : Odoc_value.t_attribute -> P.t -> result_element list
val search_method : Odoc_value.t_method -> P.t -> result_element list
val search_class : Odoc_class.t_class -> P.t -> result_element list
val search_class_type : Odoc_class.t_class_type -> P.t -> result_element list
val search_module_type : + Odoc_module.t_module_type -> + P.t -> + result_element list
val search_module : Odoc_module.t_module -> P.t -> result_element list
diff --git a/ocaml/Odoc_search/Search_by_name/index.html b/ocaml/Odoc_search/Search_by_name/index.html new file mode 100644 index 00000000..52419ac1 --- /dev/null +++ b/ocaml/Odoc_search/Search_by_name/index.html @@ -0,0 +1,32 @@ + +Search_by_name (ocaml.Odoc_search.Search_by_name)

Module Odoc_search.Search_by_name

val search_section : + Odoc_types.text -> + string -> + P_name.t -> + result_element list
val search_value : Odoc_value.t_value -> P_name.t -> result_element list
val search_recfield : + Odoc_type.t_type -> + Odoc_type.record_field -> + P_name.t -> + result_element list
val search_type : Odoc_type.t_type -> P_name.t -> result_element list
val search_extension_constructor : + Odoc_extension.t_extension_constructor -> + P_name.t -> + result_element list
val search_type_extension : + Odoc_extension.t_type_extension -> + P_name.t -> + result_element list
val search_exception : + Odoc_exception.t_exception -> + P_name.t -> + result_element list
val search_attribute : + Odoc_value.t_attribute -> + P_name.t -> + result_element list
val search_method : Odoc_value.t_method -> P_name.t -> result_element list
val search_class : Odoc_class.t_class -> P_name.t -> result_element list
val search_class_type : + Odoc_class.t_class_type -> + P_name.t -> + result_element list
val search_module_type : + Odoc_module.t_module_type -> + P_name.t -> + result_element list
val search_module : Odoc_module.t_module -> P_name.t -> result_element list
diff --git a/ocaml/Odoc_search/index.html b/ocaml/Odoc_search/index.html new file mode 100644 index 00000000..0c707197 --- /dev/null +++ b/ocaml/Odoc_search/index.html @@ -0,0 +1,4 @@ + +Odoc_search (ocaml.Odoc_search)

Module Odoc_search

type result_element =
  1. | Res_module of Odoc_module.t_module
  2. | Res_module_type of Odoc_module.t_module_type
  3. | Res_class of Odoc_class.t_class
  4. | Res_class_type of Odoc_class.t_class_type
  5. | Res_value of Odoc_value.t_value
  6. | Res_type of Odoc_type.t_type
  7. | Res_extension of Odoc_extension.t_extension_constructor
  8. | Res_exception of Odoc_exception.t_exception
  9. | Res_attribute of Odoc_value.t_attribute
  10. | Res_method of Odoc_value.t_method
  11. | Res_section of string * Odoc_types.text
  12. | Res_recfield of Odoc_type.t_type * Odoc_type.record_field
  13. | Res_const of Odoc_type.t_type * Odoc_type.variant_constructor
type result = result_element list
module type Predicates = sig ... end
module P_name : sig ... end
module Search_by_name : sig ... end
val values : Odoc_module.t_module list -> Odoc_value.t_value list
val exceptions : Odoc_module.t_module list -> Odoc_exception.t_exception list
val types : Odoc_module.t_module list -> Odoc_type.t_type list
val attributes : Odoc_module.t_module list -> Odoc_value.t_attribute list
val methods : Odoc_module.t_module list -> Odoc_value.t_method list
val classes : Odoc_module.t_module list -> Odoc_class.t_class list
val class_types : Odoc_module.t_module list -> Odoc_class.t_class_type list
val modules : Odoc_module.t_module list -> Odoc_module.t_module list
val module_types : Odoc_module.t_module list -> Odoc_module.t_module_type list
val type_exists : Odoc_module.t_module list -> Str.regexp -> bool
val value_exists : Odoc_module.t_module list -> Str.regexp -> bool
val module_exists : Odoc_module.t_module list -> Str.regexp -> bool
val module_type_exists : Odoc_module.t_module list -> Str.regexp -> bool
val class_exists : Odoc_module.t_module list -> Str.regexp -> bool
val class_type_exists : Odoc_module.t_module list -> Str.regexp -> bool
val extension_exists : Odoc_module.t_module list -> Str.regexp -> bool
val exception_exists : Odoc_module.t_module list -> Str.regexp -> bool
val attribute_exists : Odoc_module.t_module list -> Str.regexp -> bool
val method_exists : Odoc_module.t_module list -> Str.regexp -> bool
val find_section : Odoc_module.t_module list -> Str.regexp -> Odoc_types.text
diff --git a/ocaml/Odoc_search/module-type-Predicates/index.html b/ocaml/Odoc_search/module-type-Predicates/index.html new file mode 100644 index 00000000..e9171fa5 --- /dev/null +++ b/ocaml/Odoc_search/module-type-Predicates/index.html @@ -0,0 +1,2 @@ + +Predicates (ocaml.Odoc_search.Predicates)

Module type Odoc_search.Predicates

type t
val p_module : Odoc_module.t_module -> t -> bool * bool
val p_module_type : Odoc_module.t_module_type -> t -> bool * bool
val p_class : Odoc_class.t_class -> t -> bool * bool
val p_class_type : Odoc_class.t_class_type -> t -> bool * bool
val p_value : Odoc_value.t_value -> t -> bool
val p_recfield : Odoc_type.t_type -> Odoc_type.record_field -> t -> bool
val p_type : Odoc_type.t_type -> t -> bool * bool
val p_extension : Odoc_extension.t_extension_constructor -> t -> bool
val p_exception : Odoc_exception.t_exception -> t -> bool
val p_attribute : Odoc_value.t_attribute -> t -> bool
val p_method : Odoc_value.t_method -> t -> bool
val p_section : string -> t -> bool
diff --git a/ocaml/Odoc_see_lexer/index.html b/ocaml/Odoc_see_lexer/index.html new file mode 100644 index 00000000..7459bac9 --- /dev/null +++ b/ocaml/Odoc_see_lexer/index.html @@ -0,0 +1,2 @@ + +Odoc_see_lexer (ocaml.Odoc_see_lexer)

Module Odoc_see_lexer

diff --git a/ocaml/Odoc_sig/Analyser/argument-1-_/index.html b/ocaml/Odoc_sig/Analyser/argument-1-_/index.html new file mode 100644 index 00000000..de74513d --- /dev/null +++ b/ocaml/Odoc_sig/Analyser/argument-1-_/index.html @@ -0,0 +1,6 @@ + +_ (ocaml.Odoc_sig.Analyser._)

Parameter Analyser._

val all_special : string -> string -> int * Odoc_types.info list
val blank_line_outside_simple : string -> string -> bool
val just_after_special : string -> string -> int * Odoc_types.info option
val first_special : string -> string -> int * Odoc_types.info option
val get_comments : + (Odoc_types.text -> 'a) -> + string -> + string -> + Odoc_types.info option * 'a list
diff --git a/ocaml/Odoc_sig/Analyser/index.html b/ocaml/Odoc_sig/Analyser/index.html new file mode 100644 index 00000000..731fd103 --- /dev/null +++ b/ocaml/Odoc_sig/Analyser/index.html @@ -0,0 +1,51 @@ + +Analyser (ocaml.Odoc_sig.Analyser)

Module Odoc_sig.Analyser

Parameters

module _ : Info_retriever

Signature

val file : string ref
val file_name : string ref
val get_string_of_file : int -> int -> string
val prepare_file : string -> string -> unit
val preamble : + string -> + string -> + ('a -> Location.t) -> + 'a list -> + int * Odoc_types.info option
val get_comments_in_class : + int -> + int -> + Odoc_types.info option * Odoc_class.class_element list
val get_comments_in_module : + int -> + int -> + Odoc_types.info option * Odoc_module.module_element list
val name_comment_from_type_decl : + int -> + int -> + Parsetree.type_declaration -> + int * (string * Odoc_types.info option) list
val manifest_structure : + Odoc_env.env -> + (string * Odoc_types.info option) list -> + Types.type_expr -> + Odoc_type.type_manifest
val get_type_kind : + Odoc_env.env -> + (string * Odoc_types.info option) list -> + Types.type_decl_kind -> + Odoc_type.type_kind
val merge_infos : + Odoc_types.info option -> + Odoc_types.info option -> + Odoc_types.info option
val analyse_module_type_kind : + ?erased: + [ `Constrained of Parsetree.with_constraint list | `Removed ] + Odoc_name.Map.t -> + Odoc_env.env -> + Odoc_name.t -> + Parsetree.module_type -> + Types.module_type -> + Odoc_module.module_type_kind
val analyse_class_type_kind : + Odoc_env.env -> + Odoc_name.t -> + int -> + Parsetree.class_type -> + Types.class_type -> + Odoc_class.class_type_kind
val analyse_signature : + string -> + string -> + Parsetree.signature -> + Types.signature -> + Odoc_module.t_module
diff --git a/ocaml/Odoc_sig/Signature_search/index.html b/ocaml/Odoc_sig/Signature_search/index.html new file mode 100644 index 00000000..7a97724c --- /dev/null +++ b/ocaml/Odoc_sig/Signature_search/index.html @@ -0,0 +1,5 @@ + +Signature_search (ocaml.Odoc_sig.Signature_search)

Module Odoc_sig.Signature_search

type ele
val table : Types.signature -> tab
val search_value : tab -> string -> Types.type_expr
val search_extension : tab -> string -> Types.extension_constructor
val search_type : tab -> string -> Types.type_declaration
val search_class : tab -> string -> Types.class_declaration
val search_class_type : tab -> string -> Types.class_type_declaration
val search_module : tab -> string -> Types.module_type
val search_module_type : tab -> string -> Types.module_type option
val search_attribute_type : + Types.Vars.key -> + Types.class_signature -> + Types.type_expr
val search_method_type : string -> Types.class_signature -> Types.type_expr
diff --git a/ocaml/Odoc_sig/index.html b/ocaml/Odoc_sig/index.html new file mode 100644 index 00000000..4c4a9ad3 --- /dev/null +++ b/ocaml/Odoc_sig/index.html @@ -0,0 +1,5 @@ + +Odoc_sig (ocaml.Odoc_sig)

Module Odoc_sig

module type Info_retriever = sig ... end
val analyze_alerts : + Odoc_types.info option -> + Parsetree.attributes -> + Odoc_types.info option
module Analyser (_ : Info_retriever) : sig ... end
diff --git a/ocaml/Odoc_sig/module-type-Info_retriever/index.html b/ocaml/Odoc_sig/module-type-Info_retriever/index.html new file mode 100644 index 00000000..29dd96c3 --- /dev/null +++ b/ocaml/Odoc_sig/module-type-Info_retriever/index.html @@ -0,0 +1,6 @@ + +Info_retriever (ocaml.Odoc_sig.Info_retriever)

Module type Odoc_sig.Info_retriever

val all_special : string -> string -> int * Odoc_types.info list
val blank_line_outside_simple : string -> string -> bool
val just_after_special : string -> string -> int * Odoc_types.info option
val first_special : string -> string -> int * Odoc_types.info option
val get_comments : + (Odoc_types.text -> 'a) -> + string -> + string -> + Odoc_types.info option * 'a list
diff --git a/ocaml/Odoc_str/index.html b/ocaml/Odoc_str/index.html new file mode 100644 index 00000000..77a5b6fd --- /dev/null +++ b/ocaml/Odoc_str/index.html @@ -0,0 +1,4 @@ + +Odoc_str (ocaml.Odoc_str)

Module Odoc_str

val string_of_variance : Odoc_type.t_type -> Types.Variance.t -> string
val string_of_type_list : ?par:bool -> string -> Types.type_expr list -> string
val string_of_type_param_list : Odoc_type.t_type -> string
val string_of_type_extension_param_list : + Odoc_extension.t_type_extension -> + string
val string_of_class_type_param_list : Types.type_expr list -> string
val string_of_type : Odoc_type.t_type -> string
val string_of_record : Odoc_type.record_field list -> string
val string_of_class_params : Odoc_class.t_class -> string
val string_of_type_extension : Odoc_extension.t_type_extension -> string
val string_of_exception : Odoc_exception.t_exception -> string
val string_of_value : Odoc_value.t_value -> string
val string_of_attribute : Odoc_value.t_attribute -> string
val string_of_method : Odoc_value.t_method -> string
diff --git a/ocaml/Odoc_test/index.html b/ocaml/Odoc_test/index.html new file mode 100644 index 00000000..7fcfee2c --- /dev/null +++ b/ocaml/Odoc_test/index.html @@ -0,0 +1,2 @@ + +Odoc_test (ocaml.Odoc_test)

Module Odoc_test

diff --git a/ocaml/Odoc_texi/Generator/class-texi/index.html b/ocaml/Odoc_texi/Generator/class-texi/index.html new file mode 100644 index 00000000..2b346595 --- /dev/null +++ b/ocaml/Odoc_texi/Generator/class-texi/index.html @@ -0,0 +1,97 @@ + +texi (ocaml.Odoc_texi.Generator.texi)

Class Generator.texi

val mutable indices_to_build : [ `Class + | `Class_att + | `Class_type + | `Exception + | `Extension + | `Method + | `Module + | `Module_type + | `Type + | `Value ] + list
val linebreak : Odoc_info.text_element
val maxdepth : int
val node_tbl : (Odoc_info.Name.t, unit) Hashtbl.t
val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
method do_index : [ `Class + | `Class_att + | `Class_type + | `Exception + | `Extension + | `Method + | `Module + | `Module_type + | `Type + | `Value ] -> + unit
method private fix_linebreaks : Odoc_info.text -> Odoc_info.text
method generate : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : out_channel -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : out_channel -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_class : out_channel -> Odoc_info.Class.t_class -> unit
method generate_for_class_type : out_channel -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_module : out_channel -> Odoc_info.Module.t_module -> unit
method generate_for_module_type : out_channel -> + Odoc_info.Module.t_module_type -> + unit
method generate_inheritance_info : out_channel -> + Odoc_info.Class.inherited_class list -> + unit
method generate_texi_header : out_channel -> + string -> + Odoc_info.Module.t_module list -> + unit
method generate_texi_trailer : out_channel -> unit
method heading : int -> Odoc_info.text -> string
method label : ?no_:bool -> string -> string
method normal_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + string
method normal_class_type : Odoc_info.Name.t -> Types.class_type -> string
method normal_class_type_param_list : Odoc_info.Name.t -> + Types.type_expr list -> + string
method normal_cstr_args : ?par:bool -> + Odoc_info.Name.t -> + Odoc_info.Type.constructor_args -> + string
method normal_module_type : ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + string
method normal_type : Odoc_info.Name.t -> Types.type_expr -> string
method normal_type_list : ?par:bool -> + Odoc_info.Name.t -> + string -> + Types.type_expr list -> + string
method relative_idents : Odoc_info.Name.t -> string -> string
method relative_module_idents : Odoc_info.Name.t -> string -> string
method scan_for_index : subparts -> unit
method scan_for_index_in_class : Odoc_info.Class.class_element -> unit
method scan_for_index_in_mod : Odoc_info.Module.module_element -> unit
method private soft_fix_linebreaks : int -> + Odoc_info.text_element list -> + Odoc_info.text_element list
method string_of_type_args : Odoc_info.Type.constructor_args -> + Types.type_expr option -> + string
method string_of_type_parameters : Odoc_info.Type.t_type -> string
method texi_of_Block : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Bold : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Center : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Code : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_CodePre : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_Emphasize : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Enum : Odoc_info.text list -> Odoc_info.Name.t
method texi_of_Italic : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Left : Odoc_info.text -> Odoc_info.Name.t
method texi_of_List : Odoc_info.text list -> Odoc_info.Name.t
method texi_of_Newline : Odoc_info.Name.t
method texi_of_Raw : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_Ref : Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.Name.t
method texi_of_Right : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Subscript : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Superscript : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Target : target:string -> + code:Odoc_info.Name.t -> + Odoc_info.Name.t
method texi_of_Title : int -> Odoc_info.text -> Odoc_info.Name.t
method texi_of_Verbatim : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_attribute : Odoc_info.Value.t_attribute -> string
method texi_of_class : Odoc_info.Class.t_class -> string
method texi_of_class_element : Odoc_info.Name.t -> + Odoc_info.Class.class_element -> + string
method texi_of_class_type : Odoc_info.Class.t_class_type -> string
method texi_of_custom_text : string -> Odoc_info.text -> Odoc_info.Name.t
method texi_of_exception : Odoc_info.Exception.t_exception -> string
method texi_of_included_module : Odoc_info.Module.included_module -> string
method texi_of_info : Odoc_info.info option -> string
method texi_of_method : Odoc_info.Value.t_method -> string
method texi_of_module : Odoc_info.Module.t_module -> string
method texi_of_module_element : Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + string
method texi_of_module_type : Odoc_info.Module.t_module_type -> string
method texi_of_text : Odoc_info.text -> string
method texi_of_text_element : Odoc_info.text_element -> Odoc_info.Name.t
method texi_of_type : Odoc_info.Type.t_type -> string
method texi_of_type_extension : Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + string
method texi_of_value : Odoc_info.Value.t_value -> string
method text_el_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element
method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element list
method text_of_author_list : string list -> Odoc_info.text_element list
method text_of_before : (string * Odoc_info.text) list -> + Odoc_info.text_element list
method text_of_class_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + Odoc_info.text_element list
method text_of_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + Odoc_types.text
method text_of_class_type_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + Odoc_info.text_element list
method text_of_class_type_param_expr_list : Odoc_info.Name.t -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
method text_of_desc : Odoc_info.text option -> Odoc_info.text_element list
method text_of_exception : Odoc_info.Exception.t_exception -> + Odoc_info.text_element list
method text_of_info : ?block:bool -> + Odoc_info.info option -> + Odoc_info.text_element list
method text_of_method : Odoc_info.Value.t_method -> Odoc_info.text_element list
method text_of_module_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_kind -> + Odoc_info.text_element list
method text_of_module_parameter_list : (Odoc_info.Module.module_parameter + * Odoc_info.text_element list option) + list -> + Odoc_info.text_element list
method text_of_module_type : Types.module_type -> Odoc_info.text_element list
method text_of_module_type_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_type_kind -> + Odoc_info.text_element list
method text_of_parameter_description : Odoc_info.Parameter.parameter -> + Odoc_info.text
method text_of_parameter_list : Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + Odoc_info.text_element list
method text_of_params : Odoc_info.param list -> Odoc_info.text_element list
method text_of_raised_exceptions : Odoc_info.raised_exception list -> + Odoc_info.text_element list
method text_of_return_opt : Odoc_info.text option -> + Odoc_info.text_element list
method text_of_see : Odoc_info.see -> Odoc_info.text
method text_of_sees : Odoc_info.see list -> Odoc_info.text_element list
method text_of_sees_opt : Odoc_info.see list -> Odoc_info.text_element list
method text_of_short_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_since_opt : string option -> Odoc_info.text_element list
method text_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_type_expr_list : Odoc_info.Name.t -> + string -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_value : Odoc_info.Value.t_value -> Odoc_info.text_element list
method text_of_version_opt : string option -> Odoc_info.text_element list
diff --git a/ocaml/Odoc_texi/Generator/index.html b/ocaml/Odoc_texi/Generator/index.html new file mode 100644 index 00000000..34534b0c --- /dev/null +++ b/ocaml/Odoc_texi/Generator/index.html @@ -0,0 +1,2 @@ + +Generator (ocaml.Odoc_texi.Generator)

Module Odoc_texi.Generator

class texi : object ... end
diff --git a/ocaml/Odoc_texi/index.html b/ocaml/Odoc_texi/index.html new file mode 100644 index 00000000..6f63c437 --- /dev/null +++ b/ocaml/Odoc_texi/index.html @@ -0,0 +1,2 @@ + +Odoc_texi (ocaml.Odoc_texi)

Module Odoc_texi

Generation of Texinfo documentation.

val esc_8bits : bool ref
val info_section : string ref
val info_entry : string list ref
val titles_and_headings : (int * (string * string)) list ref
type subparts = [
  1. | `Class of Odoc_info.Class.t_class
  2. | `Class_type of Odoc_info.Class.t_class_type
  3. | `Module of Odoc_info.Module.t_module
  4. | `Module_type of Odoc_info.Module.t_module_type
]
type indices = [
  1. | `Class
  2. | `Class_att
  3. | `Class_type
  4. | `Exception
  5. | `Extension
  6. | `Method
  7. | `Module
  8. | `Module_type
  9. | `Type
  10. | `Value
]
module Generator : sig ... end
module type Texi_generator = sig ... end
diff --git a/ocaml/Odoc_texi/module-type-Texi_generator/class-texi/index.html b/ocaml/Odoc_texi/module-type-Texi_generator/class-texi/index.html new file mode 100644 index 00000000..c87ef37a --- /dev/null +++ b/ocaml/Odoc_texi/module-type-Texi_generator/class-texi/index.html @@ -0,0 +1,97 @@ + +texi (ocaml.Odoc_texi.Texi_generator.texi)

Class Texi_generator.texi

val mutable indices_to_build : [ `Class + | `Class_att + | `Class_type + | `Exception + | `Extension + | `Method + | `Module + | `Module_type + | `Type + | `Value ] + list
val linebreak : Odoc_info.text_element
val maxdepth : int
val node_tbl : (Odoc_info.Name.t, unit) Hashtbl.t
val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
method do_index : [ `Class + | `Class_att + | `Class_type + | `Exception + | `Extension + | `Method + | `Module + | `Module_type + | `Type + | `Value ] -> + unit
method private fix_linebreaks : Odoc_info.text -> Odoc_info.text
method generate : Odoc_info.Module.t_module list -> unit
method generate_class_inheritance_info : out_channel -> + Odoc_info.Class.t_class -> + unit
method generate_class_type_inheritance_info : out_channel -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_class : out_channel -> Odoc_info.Class.t_class -> unit
method generate_for_class_type : out_channel -> + Odoc_info.Class.t_class_type -> + unit
method generate_for_module : out_channel -> Odoc_info.Module.t_module -> unit
method generate_for_module_type : out_channel -> + Odoc_info.Module.t_module_type -> + unit
method generate_inheritance_info : out_channel -> + Odoc_info.Class.inherited_class list -> + unit
method generate_texi_header : out_channel -> + string -> + Odoc_info.Module.t_module list -> + unit
method generate_texi_trailer : out_channel -> unit
method heading : int -> Odoc_info.text -> string
method label : ?no_:bool -> string -> string
method normal_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + string
method normal_class_type : Odoc_info.Name.t -> Types.class_type -> string
method normal_class_type_param_list : Odoc_info.Name.t -> + Types.type_expr list -> + string
method normal_cstr_args : ?par:bool -> + Odoc_info.Name.t -> + Odoc_info.Type.constructor_args -> + string
method normal_module_type : ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + string
method normal_type : Odoc_info.Name.t -> Types.type_expr -> string
method normal_type_list : ?par:bool -> + Odoc_info.Name.t -> + string -> + Types.type_expr list -> + string
method relative_idents : Odoc_info.Name.t -> string -> string
method relative_module_idents : Odoc_info.Name.t -> string -> string
method scan_for_index : subparts -> unit
method scan_for_index_in_class : Odoc_info.Class.class_element -> unit
method scan_for_index_in_mod : Odoc_info.Module.module_element -> unit
method private soft_fix_linebreaks : int -> + Odoc_info.text_element list -> + Odoc_info.text_element list
method string_of_type_args : Odoc_info.Type.constructor_args -> + Types.type_expr option -> + string
method string_of_type_parameters : Odoc_info.Type.t_type -> string
method texi_of_Block : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Bold : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Center : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Code : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_CodePre : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_Emphasize : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Enum : Odoc_info.text list -> Odoc_info.Name.t
method texi_of_Italic : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Left : Odoc_info.text -> Odoc_info.Name.t
method texi_of_List : Odoc_info.text list -> Odoc_info.Name.t
method texi_of_Newline : Odoc_info.Name.t
method texi_of_Raw : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_Ref : Odoc_info.Name.t -> + Odoc_info.ref_kind option -> + Odoc_info.Name.t
method texi_of_Right : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Subscript : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Superscript : Odoc_info.text -> Odoc_info.Name.t
method texi_of_Target : target:string -> + code:Odoc_info.Name.t -> + Odoc_info.Name.t
method texi_of_Title : int -> Odoc_info.text -> Odoc_info.Name.t
method texi_of_Verbatim : Odoc_info.Name.t -> Odoc_info.Name.t
method texi_of_attribute : Odoc_info.Value.t_attribute -> string
method texi_of_class : Odoc_info.Class.t_class -> string
method texi_of_class_element : Odoc_info.Name.t -> + Odoc_info.Class.class_element -> + string
method texi_of_class_type : Odoc_info.Class.t_class_type -> string
method texi_of_custom_text : string -> Odoc_info.text -> Odoc_info.Name.t
method texi_of_exception : Odoc_info.Exception.t_exception -> string
method texi_of_included_module : Odoc_info.Module.included_module -> string
method texi_of_info : Odoc_info.info option -> string
method texi_of_method : Odoc_info.Value.t_method -> string
method texi_of_module : Odoc_info.Module.t_module -> string
method texi_of_module_element : Odoc_info.Name.t -> + Odoc_info.Module.module_element -> + string
method texi_of_module_type : Odoc_info.Module.t_module_type -> string
method texi_of_text : Odoc_info.text -> string
method texi_of_text_element : Odoc_info.text_element -> Odoc_info.Name.t
method texi_of_type : Odoc_info.Type.t_type -> string
method texi_of_type_extension : Odoc_info.Name.t -> + Odoc_info.Extension.t_type_extension -> + string
method texi_of_value : Odoc_info.Value.t_value -> string
method text_el_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element
method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element list
method text_of_author_list : string list -> Odoc_info.text_element list
method text_of_before : (string * Odoc_info.text) list -> + Odoc_info.text_element list
method text_of_class_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + Odoc_info.text_element list
method text_of_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + Odoc_types.text
method text_of_class_type_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + Odoc_info.text_element list
method text_of_class_type_param_expr_list : Odoc_info.Name.t -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
method text_of_desc : Odoc_info.text option -> Odoc_info.text_element list
method text_of_exception : Odoc_info.Exception.t_exception -> + Odoc_info.text_element list
method text_of_info : ?block:bool -> + Odoc_info.info option -> + Odoc_info.text_element list
method text_of_method : Odoc_info.Value.t_method -> Odoc_info.text_element list
method text_of_module_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_kind -> + Odoc_info.text_element list
method text_of_module_parameter_list : (Odoc_info.Module.module_parameter + * Odoc_info.text_element list option) + list -> + Odoc_info.text_element list
method text_of_module_type : Types.module_type -> Odoc_info.text_element list
method text_of_module_type_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_type_kind -> + Odoc_info.text_element list
method text_of_parameter_description : Odoc_info.Parameter.parameter -> + Odoc_info.text
method text_of_parameter_list : Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + Odoc_info.text_element list
method text_of_params : Odoc_info.param list -> Odoc_info.text_element list
method text_of_raised_exceptions : Odoc_info.raised_exception list -> + Odoc_info.text_element list
method text_of_return_opt : Odoc_info.text option -> + Odoc_info.text_element list
method text_of_see : Odoc_info.see -> Odoc_info.text
method text_of_sees : Odoc_info.see list -> Odoc_info.text_element list
method text_of_sees_opt : Odoc_info.see list -> Odoc_info.text_element list
method text_of_short_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_since_opt : string option -> Odoc_info.text_element list
method text_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_type_expr_list : Odoc_info.Name.t -> + string -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_value : Odoc_info.Value.t_value -> Odoc_info.text_element list
method text_of_version_opt : string option -> Odoc_info.text_element list
diff --git a/ocaml/Odoc_texi/module-type-Texi_generator/index.html b/ocaml/Odoc_texi/module-type-Texi_generator/index.html new file mode 100644 index 00000000..e09c4ad1 --- /dev/null +++ b/ocaml/Odoc_texi/module-type-Texi_generator/index.html @@ -0,0 +1,2 @@ + +Texi_generator (ocaml.Odoc_texi.Texi_generator)

Module type Odoc_texi.Texi_generator

class texi : object ... end
diff --git a/ocaml/Odoc_text/Texter/index.html b/ocaml/Odoc_text/Texter/index.html new file mode 100644 index 00000000..efda3675 --- /dev/null +++ b/ocaml/Odoc_text/Texter/index.html @@ -0,0 +1,2 @@ + +Texter (ocaml.Odoc_text.Texter)

Module Odoc_text.Texter

val text_of_string : string -> Odoc_types.text
val string_of_text : Odoc_types.text -> string
diff --git a/ocaml/Odoc_text/index.html b/ocaml/Odoc_text/index.html new file mode 100644 index 00000000..900d4331 --- /dev/null +++ b/ocaml/Odoc_text/index.html @@ -0,0 +1,2 @@ + +Odoc_text (ocaml.Odoc_text)

Module Odoc_text

exception Text_syntax of int * int * string
module Texter : sig ... end
diff --git a/ocaml/Odoc_text_lexer/index.html b/ocaml/Odoc_text_lexer/index.html new file mode 100644 index 00000000..2fe2c126 --- /dev/null +++ b/ocaml/Odoc_text_lexer/index.html @@ -0,0 +1,2 @@ + +Odoc_text_lexer (ocaml.Odoc_text_lexer)

Module Odoc_text_lexer

The lexer for string to build text structures.

val line_number : int ref
val char_number : int ref
val init : unit -> unit
diff --git a/ocaml/Odoc_text_parser/index.html b/ocaml/Odoc_text_parser/index.html new file mode 100644 index 00000000..890213db --- /dev/null +++ b/ocaml/Odoc_text_parser/index.html @@ -0,0 +1,8 @@ + +Odoc_text_parser (ocaml.Odoc_text_parser)

Module Odoc_text_parser

type token =
  1. | END
  2. | Title of int * string option
  3. | BOLD
  4. | EMP
  5. | CENTER
  6. | LEFT
  7. | RIGHT
  8. | ITALIC
  9. | CUSTOM of string
  10. | LIST
  11. | ENUM
  12. | ITEM
  13. | CODE
  14. | END_CODE
  15. | CODE_PRE
  16. | END_CODE_PRE
  17. | VERB
  18. | END_VERB
  19. | LATEX
  20. | Target of string
  21. | END_TARGET
  22. | LBRACE
  23. | ELE_REF
  24. | VAL_REF
  25. | TYP_REF
  26. | EXT_REF
  27. | EXC_REF
  28. | MOD_REF
  29. | MODT_REF
  30. | CLA_REF
  31. | CLT_REF
  32. | ATT_REF
  33. | MET_REF
  34. | SEC_REF
  35. | RECF_REF
  36. | CONST_REF
  37. | MOD_LIST_REF
  38. | INDEX_LIST
  39. | SUPERSCRIPT
  40. | SUBSCRIPT
  41. | BEGIN_SHORTCUT_LIST_ITEM
  42. | BEGIN_SHORTCUT_ENUM_ITEM
  43. | SHORTCUT_LIST_ITEM
  44. | SHORTCUT_ENUM_ITEM
  45. | END_SHORTCUT_LIST
  46. | BLANK_LINE
  47. | EOF
  48. | Char of string
val located_element_list : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + (int * int * Odoc_types.text_element) list
diff --git a/ocaml/Odoc_to_text/class-to_text/index.html b/ocaml/Odoc_to_text/class-to_text/index.html new file mode 100644 index 00000000..3212611b --- /dev/null +++ b/ocaml/Odoc_to_text/class-to_text/index.html @@ -0,0 +1,48 @@ + +to_text (ocaml.Odoc_to_text.to_text)

Class Odoc_to_text.to_text

val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
method virtual label : ?no_:bool -> string -> string
method normal_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + string
method normal_class_type : Odoc_info.Name.t -> Types.class_type -> string
method normal_class_type_param_list : Odoc_info.Name.t -> + Types.type_expr list -> + string
method normal_cstr_args : ?par:bool -> + Odoc_info.Name.t -> + Odoc_info.Type.constructor_args -> + string
method normal_module_type : ?code:string -> + Odoc_info.Name.t -> + Types.module_type -> + string
method normal_type : Odoc_info.Name.t -> Types.type_expr -> string
method normal_type_list : ?par:bool -> + Odoc_info.Name.t -> + string -> + Types.type_expr list -> + string
method relative_idents : Odoc_info.Name.t -> string -> string
method relative_module_idents : Odoc_info.Name.t -> string -> string
method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element list
method text_of_author_list : string list -> Odoc_info.text_element list
method text_of_before : (string * Odoc_info.text) list -> + Odoc_info.text_element list
method text_of_class_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_kind -> + Odoc_info.text_element list
method text_of_class_params : Odoc_info.Name.t -> + Odoc_info.Class.t_class -> + Odoc_types.text
method text_of_class_type_kind : Odoc_info.Name.t -> + Odoc_info.Class.class_type_kind -> + Odoc_info.text_element list
method text_of_class_type_param_expr_list : Odoc_info.Name.t -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
method text_of_exception : Odoc_info.Exception.t_exception -> + Odoc_info.text_element list
method text_of_info : ?block:bool -> + Odoc_info.info option -> + Odoc_info.text_element list
method text_of_method : Odoc_info.Value.t_method -> Odoc_info.text_element list
method text_of_module_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_kind -> + Odoc_info.text_element list
method text_of_module_parameter_list : (Odoc_info.Module.module_parameter + * Odoc_info.text_element list option) + list -> + Odoc_info.text_element list
method text_of_module_type : Types.module_type -> Odoc_info.text_element list
method text_of_module_type_kind : ?with_def_syntax:bool -> + Odoc_info.Module.module_type_kind -> + Odoc_info.text_element list
method text_of_parameter_description : Odoc_info.Parameter.parameter -> + Odoc_info.text
method text_of_parameter_list : Odoc_info.Name.t -> + Odoc_info.Parameter.parameter list -> + Odoc_info.text_element list
method text_of_raised_exceptions : Odoc_info.raised_exception list -> + Odoc_info.text_element list
method text_of_return_opt : Odoc_info.text option -> + Odoc_info.text_element list
method text_of_see : Odoc_info.see -> Odoc_info.text
method text_of_sees : Odoc_info.see list -> Odoc_info.text_element list
method text_of_short_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_since_opt : string option -> Odoc_info.text_element list
method text_of_type_expr : Odoc_info.Name.t -> + Types.type_expr -> + Odoc_info.text_element list
method text_of_type_expr_list : Odoc_info.Name.t -> + string -> + Types.type_expr list -> + Odoc_info.text_element list
method text_of_value : Odoc_info.Value.t_value -> Odoc_info.text_element list
method text_of_version_opt : string option -> Odoc_info.text_element list
diff --git a/ocaml/Odoc_to_text/index.html b/ocaml/Odoc_to_text/index.html new file mode 100644 index 00000000..2de79ffb --- /dev/null +++ b/ocaml/Odoc_to_text/index.html @@ -0,0 +1,2 @@ + +Odoc_to_text (ocaml.Odoc_to_text)

Module Odoc_to_text

Text generation.

class virtual to_text : object ... end
diff --git a/ocaml/Odoc_type/index.html b/ocaml/Odoc_type/index.html new file mode 100644 index 00000000..1d132a1e --- /dev/null +++ b/ocaml/Odoc_type/index.html @@ -0,0 +1,2 @@ + +Odoc_type (ocaml.Odoc_type)

Module Odoc_type

Representation and manipulation of a type, but not class nor module type.

This module has an implementation although it declares only types. This is because other modules use the let module construct or access it so it is needed as a real module.

module Name = Odoc_name
type private_flag = Asttypes.private_flag =
  1. | Private
  2. | Public
type record_field = {
  1. rf_name : string;
  2. rf_mutable : bool;
  3. rf_type : Types.type_expr;
  4. mutable rf_text : Odoc_types.info option;
}

Description of a record type field.

type constructor_args =
  1. | Cstr_record of record_field list
  2. | Cstr_tuple of Types.type_expr list
type variant_constructor = {
  1. vc_name : string;
  2. vc_args : constructor_args;
  3. vc_ret : Types.type_expr option;
  4. mutable vc_text : Odoc_types.info option;
}

Description of a variant type constructor.

type type_kind =
  1. | Type_abstract
  2. | Type_variant of variant_constructor list
  3. | Type_record of record_field list
  4. | Type_open
    (*

    The various kinds of type.

    *)
type object_field = {
  1. of_name : string;
  2. of_type : Types.type_expr;
  3. mutable of_text : Odoc_types.info option;
}
type type_manifest =
  1. | Other of Types.type_expr
  2. | Object_type of object_field list
type t_type = {
  1. ty_name : Name.t;
  2. mutable ty_info : Odoc_types.info option;
  3. ty_parameters : (Types.type_expr * Types.Variance.t) list;
  4. ty_kind : type_kind;
  5. ty_private : private_flag;
  6. ty_manifest : type_manifest option;
  7. mutable ty_loc : Odoc_types.location;
  8. mutable ty_code : string option;
}

Representation of a type.

diff --git a/ocaml/Odoc_types/index.html b/ocaml/Odoc_types/index.html new file mode 100644 index 00000000..891fbcba --- /dev/null +++ b/ocaml/Odoc_types/index.html @@ -0,0 +1,2 @@ + +Odoc_types (ocaml.Odoc_types)

Module Odoc_types

type ref_kind =
  1. | RK_module
  2. | RK_module_type
  3. | RK_class
  4. | RK_class_type
  5. | RK_value
  6. | RK_type
  7. | RK_extension
  8. | RK_exception
  9. | RK_attribute
  10. | RK_method
  11. | RK_section of text
  12. | RK_recfield
  13. | RK_const
and text_element =
  1. | Raw of string
  2. | Code of string
  3. | CodePre of string
  4. | Verbatim of string
  5. | Bold of text
  6. | Italic of text
  7. | Emphasize of text
  8. | Center of text
  9. | Left of text
  10. | Right of text
  11. | List of text list
  12. | Enum of text list
  13. | Newline
  14. | Block of text
  15. | Title of int * string option * text
  16. | Latex of string
  17. | Ref of string * ref_kind option * text option
  18. | Superscript of text
  19. | Subscript of text
  20. | Module_list of string list
  21. | Index_list
  22. | Custom of string * text
  23. | Target of string * string
and text = text_element list
type see_ref =
  1. | See_url of string
  2. | See_file of string
  3. | See_doc of string
type see = see_ref * text
type param = string * text
type raised_exception = string * text
type alert = {
  1. alert_name : string;
  2. alert_payload : string option;
}
type info = {
  1. i_desc : text option;
  2. i_authors : string list;
  3. i_version : string option;
  4. i_sees : see list;
  5. i_since : string option;
  6. i_before : (string * text) list;
  7. i_deprecated : text option;
  8. i_params : param list;
  9. i_raised_exceptions : raised_exception list;
  10. i_return_value : text option;
  11. i_custom : (string * text) list;
  12. i_alerts : alert list;
}
val dummy_info : info
type location = {
  1. loc_impl : Location.t option;
  2. loc_inter : Location.t option;
}
val dummy_loc : location
type merge_option =
  1. | Merge_description
  2. | Merge_author
  3. | Merge_version
  4. | Merge_see
  5. | Merge_since
  6. | Merge_before
  7. | Merge_deprecated
  8. | Merge_param
  9. | Merge_raised_exception
  10. | Merge_return_value
  11. | Merge_custom
val all_merge_options : merge_option list
type magic
val magic : magic
type 'a dump
val make_dump : 'a -> 'a dump
val open_dump : 'a dump -> 'a
diff --git a/ocaml/Odoc_value/index.html b/ocaml/Odoc_value/index.html new file mode 100644 index 00000000..992450fa --- /dev/null +++ b/ocaml/Odoc_value/index.html @@ -0,0 +1,2 @@ + +Odoc_value (ocaml.Odoc_value)

Module Odoc_value

Representation and manipulation of values, class attributes and class methods.

module Name = Odoc_name

Types

type t_value = {
  1. val_name : Name.t;
  2. mutable val_info : Odoc_types.info option;
  3. val_type : Types.type_expr;
  4. val_recursive : bool;
  5. mutable val_parameters : Odoc_parameter.parameter list;
  6. mutable val_code : string option;
  7. mutable val_loc : Odoc_types.location;
}

Representation of a value.

type t_attribute = {
  1. att_value : t_value;
  2. att_mutable : bool;
  3. att_virtual : bool;
}

Representation of a class attribute.

type t_method = {
  1. met_value : t_value;
  2. met_private : bool;
  3. met_virtual : bool;
}

Representation of a class method.

Functions

val value_parameter_text_by_name : t_value -> string -> Odoc_types.text option

Returns the text associated to the given parameter name in the given value, or None.

val update_value_parameters_text : t_value -> unit

Update the parameters text of a t_value, according to the val_info field.

val dummy_parameter_list : Types.type_expr -> Odoc_parameter.param_info list

Create a list of parameters with dummy names "??" from a type list. Used when we want to merge the parameters of a value, from the .ml and the .mli file. In the .mli file we don't have parameter names so there is nothing to merge. With this dummy list we can merge the parameter names from the .ml and the type from the .mli file.

val is_function : t_value -> bool

Return true if the value is a function, i.e. has a functional type.

diff --git a/ocaml/Opcodes/index.html b/ocaml/Opcodes/index.html new file mode 100644 index 00000000..84b6a965 --- /dev/null +++ b/ocaml/Opcodes/index.html @@ -0,0 +1,2 @@ + +Opcodes (ocaml.Opcodes)

Module Opcodes

val opACC0 : int
val opACC1 : int
val opACC2 : int
val opACC3 : int
val opACC4 : int
val opACC5 : int
val opACC6 : int
val opACC7 : int
val opACC : int
val opPUSH : int
val opPUSHACC0 : int
val opPUSHACC1 : int
val opPUSHACC2 : int
val opPUSHACC3 : int
val opPUSHACC4 : int
val opPUSHACC5 : int
val opPUSHACC6 : int
val opPUSHACC7 : int
val opPUSHACC : int
val opPOP : int
val opASSIGN : int
val opENVACC1 : int
val opENVACC2 : int
val opENVACC3 : int
val opENVACC4 : int
val opENVACC : int
val opPUSHENVACC1 : int
val opPUSHENVACC2 : int
val opPUSHENVACC3 : int
val opPUSHENVACC4 : int
val opPUSHENVACC : int
val opPUSH_RETADDR : int
val opAPPLY : int
val opAPPLY1 : int
val opAPPLY2 : int
val opAPPLY3 : int
val opAPPTERM : int
val opAPPTERM1 : int
val opAPPTERM2 : int
val opAPPTERM3 : int
val opRETURN : int
val opRESTART : int
val opGRAB : int
val opCLOSURE : int
val opCLOSUREREC : int
val opOFFSETCLOSUREM3 : int
val opOFFSETCLOSURE0 : int
val opOFFSETCLOSURE3 : int
val opOFFSETCLOSURE : int
val opPUSHOFFSETCLOSUREM3 : int
val opPUSHOFFSETCLOSURE0 : int
val opPUSHOFFSETCLOSURE3 : int
val opPUSHOFFSETCLOSURE : int
val opGETGLOBAL : int
val opPUSHGETGLOBAL : int
val opGETGLOBALFIELD : int
val opPUSHGETGLOBALFIELD : int
val opSETGLOBAL : int
val opATOM0 : int
val opATOM : int
val opPUSHATOM0 : int
val opPUSHATOM : int
val opMAKEBLOCK : int
val opMAKEBLOCK1 : int
val opMAKEBLOCK2 : int
val opMAKEBLOCK3 : int
val opMAKEFLOATBLOCK : int
val opGETFIELD0 : int
val opGETFIELD1 : int
val opGETFIELD2 : int
val opGETFIELD3 : int
val opGETFIELD : int
val opGETFLOATFIELD : int
val opSETFIELD0 : int
val opSETFIELD1 : int
val opSETFIELD2 : int
val opSETFIELD3 : int
val opSETFIELD : int
val opSETFLOATFIELD : int
val opVECTLENGTH : int
val opGETVECTITEM : int
val opSETVECTITEM : int
val opGETBYTESCHAR : int
val opSETBYTESCHAR : int
val opBRANCH : int
val opBRANCHIF : int
val opBRANCHIFNOT : int
val opSWITCH : int
val opBOOLNOT : int
val opPUSHTRAP : int
val opPOPTRAP : int
val opRAISE : int
val opCHECK_SIGNALS : int
val opC_CALL1 : int
val opC_CALL2 : int
val opC_CALL3 : int
val opC_CALL4 : int
val opC_CALL5 : int
val opC_CALLN : int
val opCONST0 : int
val opCONST1 : int
val opCONST2 : int
val opCONST3 : int
val opCONSTINT : int
val opPUSHCONST0 : int
val opPUSHCONST1 : int
val opPUSHCONST2 : int
val opPUSHCONST3 : int
val opPUSHCONSTINT : int
val opNEGINT : int
val opADDINT : int
val opSUBINT : int
val opMULINT : int
val opDIVINT : int
val opMODINT : int
val opANDINT : int
val opORINT : int
val opXORINT : int
val opLSLINT : int
val opLSRINT : int
val opASRINT : int
val opEQ : int
val opNEQ : int
val opLTINT : int
val opLEINT : int
val opGTINT : int
val opGEINT : int
val opOFFSETINT : int
val opOFFSETREF : int
val opISINT : int
val opGETMETHOD : int
val opBEQ : int
val opBNEQ : int
val opBLTINT : int
val opBLEINT : int
val opBGTINT : int
val opBGEINT : int
val opULTINT : int
val opUGEINT : int
val opBULTINT : int
val opBUGEINT : int
val opGETPUBMET : int
val opGETDYNMET : int
val opSTOP : int
val opEVENT : int
val opBREAK : int
val opRERAISE : int
val opRAISE_NOTRACE : int
val opGETSTRINGCHAR : int
val opPERFORM : int
val opRESUME : int
val opRESUMETERM : int
val opREPERFORMTERM : int
diff --git a/ocaml/Oprint/index.html b/ocaml/Oprint/index.html new file mode 100644 index 00000000..d3440551 --- /dev/null +++ b/ocaml/Oprint/index.html @@ -0,0 +1,18 @@ + +Oprint (ocaml.Oprint)

Module Oprint

val out_label : + (Stdlib.Format.formatter -> + (string * bool * Outcometree.out_type) -> + unit) + ref
val out_type_args : + (Stdlib.Format.formatter -> Outcometree.out_type list -> unit) ref
val out_class_type : + (Stdlib.Format.formatter -> Outcometree.out_class_type -> unit) ref
val out_module_type : + (Stdlib.Format.formatter -> Outcometree.out_module_type -> unit) ref
val out_sig_item : + (Stdlib.Format.formatter -> Outcometree.out_sig_item -> unit) ref
val out_signature : + (Stdlib.Format.formatter -> Outcometree.out_sig_item list -> unit) ref
val out_functor_parameters : + (Stdlib.Format.formatter -> + (string option * Outcometree.out_module_type) option list -> + unit) + ref
val out_type_extension : + (Stdlib.Format.formatter -> Outcometree.out_type_extension -> unit) ref
val out_phrase : + (Stdlib.Format.formatter -> Outcometree.out_phrase -> unit) ref
val parenthesized_ident : string -> bool
diff --git a/ocaml/Optcompile/index.html b/ocaml/Optcompile/index.html new file mode 100644 index 00000000..54c3737b --- /dev/null +++ b/ocaml/Optcompile/index.html @@ -0,0 +1,15 @@ + +Optcompile (ocaml.Optcompile)

Module Optcompile

Native compilation for .ml and .mli files.

val interface : source_file:string -> output_prefix:string -> unit
val implementation : + backend:(module Backend_intf.S) -> + start_from:Clflags.Compiler_pass.t -> + source_file:string -> + output_prefix:string -> + unit

Internal functions

*

val clambda : + Compile_common.info -> + (module Backend_intf.S) -> + Typedtree.implementation -> + unit

clambda info typed applies the regular compilation pipeline to the given typechecked implementation and outputs the resulting files.

val flambda : + Compile_common.info -> + (module Backend_intf.S) -> + Typedtree.implementation -> + unit

flambda info backend typed applies the Flambda compilation pipeline to the given typechecked implementation and outputs the resulting files.

diff --git a/ocaml/Opterrors/index.html b/ocaml/Opterrors/index.html new file mode 100644 index 00000000..067f045c --- /dev/null +++ b/ocaml/Opterrors/index.html @@ -0,0 +1,2 @@ + +Opterrors (ocaml.Opterrors)

Module Opterrors

val report_error : Stdlib.Format.formatter -> exn -> unit
diff --git a/ocaml/Optmain/index.html b/ocaml/Optmain/index.html new file mode 100644 index 00000000..c45ecd79 --- /dev/null +++ b/ocaml/Optmain/index.html @@ -0,0 +1,2 @@ + +Optmain (ocaml.Optmain)

Module Optmain

diff --git a/ocaml/Optmaindriver/index.html b/ocaml/Optmaindriver/index.html new file mode 100644 index 00000000..5578b02d --- /dev/null +++ b/ocaml/Optmaindriver/index.html @@ -0,0 +1,2 @@ + +Optmaindriver (ocaml.Optmaindriver)

Module Optmaindriver

val main : string array -> Stdlib.Format.formatter -> int
diff --git a/ocaml/Outcometree/index.html b/ocaml/Outcometree/index.html new file mode 100644 index 00000000..b211c55e --- /dev/null +++ b/ocaml/Outcometree/index.html @@ -0,0 +1,10 @@ + +Outcometree (ocaml.Outcometree)

Module Outcometree

type out_name = {
  1. mutable printed_name : string;
}

An out_name is a string representation of an identifier which can be rewritten on the fly to avoid name collisions

type out_ident =
  1. | Oide_apply of out_ident * out_ident
  2. | Oide_dot of out_ident * string
  3. | Oide_ident of out_name
type out_string =
  1. | Ostr_string
  2. | Ostr_bytes
type out_attribute = {
  1. oattr_name : string;
}
type out_value =
  1. | Oval_array of out_value list
  2. | Oval_char of char
  3. | Oval_constr of out_ident * out_value list
  4. | Oval_ellipsis
  5. | Oval_float of float
  6. | Oval_int of int
  7. | Oval_int32 of int32
  8. | Oval_int64 of int64
  9. | Oval_nativeint of nativeint
  10. | Oval_list of out_value list
  11. | Oval_printer of Stdlib.Format.formatter -> unit
  12. | Oval_record of (out_ident * out_value) list
  13. | Oval_string of string * int * out_string
  14. | Oval_stuff of string
  15. | Oval_tuple of out_value list
  16. | Oval_variant of string * out_value option
type out_type_param = string * (Asttypes.variance * Asttypes.injectivity)
type out_type =
  1. | Otyp_abstract
  2. | Otyp_open
  3. | Otyp_alias of {
    1. non_gen : bool;
    2. aliased : out_type;
    3. alias : string;
    }
  4. | Otyp_arrow of string * out_type * out_type
  5. | Otyp_class of out_ident * out_type list
  6. | Otyp_constr of out_ident * out_type list
  7. | Otyp_manifest of out_type * out_type
  8. | Otyp_object of {
    1. fields : (string * out_type) list;
    2. open_row : bool;
    }
  9. | Otyp_record of (string * bool * out_type) list
  10. | Otyp_stuff of string
  11. | Otyp_sum of out_constructor list
  12. | Otyp_tuple of out_type list
  13. | Otyp_var of bool * string
  14. | Otyp_variant of out_variant * bool * string list option
  15. | Otyp_poly of string list * out_type
  16. | Otyp_module of out_ident * (string * out_type) list
  17. | Otyp_attribute of out_type * out_attribute
and out_constructor = {
  1. ocstr_name : string;
  2. ocstr_args : out_type list;
  3. ocstr_return_type : out_type option;
}
and out_variant =
  1. | Ovar_fields of (string * bool * out_type list) list
  2. | Ovar_typ of out_type
type out_class_type =
  1. | Octy_constr of out_ident * out_type list
  2. | Octy_arrow of string * out_type * out_class_type
  3. | Octy_signature of out_type option * out_class_sig_item list
and out_class_sig_item =
  1. | Ocsg_constraint of out_type * out_type
  2. | Ocsg_method of string * bool * bool * out_type
  3. | Ocsg_value of string * bool * bool * out_type
type out_module_type =
  1. | Omty_abstract
  2. | Omty_functor of (string option * out_module_type) option * out_module_type
  3. | Omty_ident of out_ident
  4. | Omty_signature of out_sig_item list
  5. | Omty_alias of out_ident
and out_sig_item =
  1. | Osig_class of bool + * string + * out_type_param list + * out_class_type + * out_rec_status
  2. | Osig_class_type of bool + * string + * out_type_param list + * out_class_type + * out_rec_status
  3. | Osig_typext of out_extension_constructor * out_ext_status
  4. | Osig_modtype of string * out_module_type
  5. | Osig_module of string * out_module_type * out_rec_status
  6. | Osig_type of out_type_decl * out_rec_status
  7. | Osig_value of out_val_decl
  8. | Osig_ellipsis
and out_type_decl = {
  1. otype_name : string;
  2. otype_params : out_type_param list;
  3. otype_type : out_type;
  4. otype_private : Asttypes.private_flag;
  5. otype_immediate : Type_immediacy.t;
  6. otype_unboxed : bool;
  7. otype_cstrs : (out_type * out_type) list;
}
and out_extension_constructor = {
  1. oext_name : string;
  2. oext_type_name : string;
  3. oext_type_params : string list;
  4. oext_args : out_type list;
  5. oext_ret_type : out_type option;
  6. oext_private : Asttypes.private_flag;
}
and out_type_extension = {
  1. otyext_name : string;
  2. otyext_params : string list;
  3. otyext_constructors : out_constructor list;
  4. otyext_private : Asttypes.private_flag;
}
and out_val_decl = {
  1. oval_name : string;
  2. oval_type : out_type;
  3. oval_prims : string list;
  4. oval_attributes : out_attribute list;
}
and out_rec_status =
  1. | Orec_not
  2. | Orec_first
  3. | Orec_next
and out_ext_status =
  1. | Oext_first
  2. | Oext_next
  3. | Oext_exception
type out_phrase =
  1. | Ophr_eval of out_value * out_type
  2. | Ophr_signature of (out_sig_item * out_value option) list
  3. | Ophr_exception of exn * out_value
diff --git a/ocaml/Parameter/List/index.html b/ocaml/Parameter/List/index.html new file mode 100644 index 00000000..4ecb2626 --- /dev/null +++ b/ocaml/Parameter/List/index.html @@ -0,0 +1,2 @@ + +List (ocaml.Parameter.List)

Module Parameter.List

val vars : t list -> Variable.t list

extract variables from a list of parameters, preserving the order

diff --git a/ocaml/Parameter/Map/index.html b/ocaml/Parameter/Map/index.html new file mode 100644 index 00000000..a451228b --- /dev/null +++ b/ocaml/Parameter/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Parameter.Map)

Module Parameter.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Parameter/Set/index.html b/ocaml/Parameter/Set/index.html new file mode 100644 index 00000000..e5cf89e3 --- /dev/null +++ b/ocaml/Parameter/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Parameter.Set)

Module Parameter.Set

include Identifiable.Set with module T := T
include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
val vars : parameter list -> Variable.Set.t
diff --git a/ocaml/Parameter/T/index.html b/ocaml/Parameter/T/index.html new file mode 100644 index 00000000..04e82e34 --- /dev/null +++ b/ocaml/Parameter/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Parameter.T)

Module Parameter.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Parameter/Tbl/index.html b/ocaml/Parameter/Tbl/index.html new file mode 100644 index 00000000..6f0daa70 --- /dev/null +++ b/ocaml/Parameter/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Parameter.Tbl)

Module Parameter.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Parameter/index.html b/ocaml/Parameter/index.html new file mode 100644 index 00000000..846cad96 --- /dev/null +++ b/ocaml/Parameter/index.html @@ -0,0 +1,2 @@ + +Parameter (ocaml.Parameter)

Module Parameter

Parameter.t carries a unique Variable.t used as function parameter. It can also carry annotations about the usage of the variable.

type t
type parameter = t
val wrap : Variable.t -> t

Make a parameter from a variable with default attributes

val var : t -> Variable.t
val rename : ?current_compilation_unit:Compilation_unit.t -> t -> t

Rename the inner variable of the parameter

val map_var : (Variable.t -> Variable.t) -> t -> t
module T : Identifiable.Thing with type t = t
module Set : sig ... end
include Identifiable.S with type t := t and module T := T and module Set := Set
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
module List : sig ... end
diff --git a/ocaml/Parmatch/Compat/argument-1-_/index.html b/ocaml/Parmatch/Compat/argument-1-_/index.html new file mode 100644 index 00000000..e68b72d5 --- /dev/null +++ b/ocaml/Parmatch/Compat/argument-1-_/index.html @@ -0,0 +1,5 @@ + +_ (ocaml.Parmatch.Compat._)

Parameter Compat._

diff --git a/ocaml/Parmatch/Compat/index.html b/ocaml/Parmatch/Compat/index.html new file mode 100644 index 00000000..ea717b38 --- /dev/null +++ b/ocaml/Parmatch/Compat/index.html @@ -0,0 +1,2 @@ + +Compat (ocaml.Parmatch.Compat)

Module Parmatch.Compat

Exported compatibility functor, abstracted over constructor equality

Parameters

module _ : sig ... end

Signature

val compat : Typedtree.pattern -> Typedtree.pattern -> bool
val compats : Typedtree.pattern list -> Typedtree.pattern list -> bool
diff --git a/ocaml/Parmatch/index.html b/ocaml/Parmatch/index.html new file mode 100644 index 00000000..b1d5711c --- /dev/null +++ b/ocaml/Parmatch/index.html @@ -0,0 +1,27 @@ + +Parmatch (ocaml.Parmatch)

Module Parmatch

Detection of partial matches and unused match cases.

val const_compare : Asttypes.constant -> Asttypes.constant -> int

const_compare c1 c2 compares the actual values represented by c1 and c2, while simply using Stdlib.compare would compare the representations.

cf. MPR#5758

val le_pat : Typedtree.pattern -> Typedtree.pattern -> bool

le_pat p q means: forall V, V matches q implies V matches p

val le_pats : Typedtree.pattern list -> Typedtree.pattern list -> bool

le_pats (p1 .. pm) (q1 .. qn) means: forall i <= m, le_pat pi qi

module Compat (_ : sig ... end) : sig ... end

Exported compatibility functor, abstracted over constructor equality

exception Empty

lub p q is a pattern that matches all values matched by p and q. May raise Empty, when p and q are not compatible.

val lubs : + Typedtree.pattern list -> + Typedtree.pattern list -> + Typedtree.pattern list

lubs [p1; ...; pn] [q1; ...; qk], where n < k, is [lub p1 q1; ...; lub pk qk].

val get_mins : ('a -> 'a -> bool) -> 'a list -> 'a list
val set_args : + Typedtree.pattern -> + Typedtree.pattern list -> + Typedtree.pattern list

Those two functions recombine one pattern and its arguments: For instance: (_,_)::p1::p2::rem -> (p1, p2)::rem The second one will replace mutable arguments by '_'

val set_args_erase_mutable : + Typedtree.pattern -> + Typedtree.pattern list -> + Typedtree.pattern list
val pats_of_type : Env.t -> Types.type_expr -> Typedtree.pattern list

pats_of_type builds a list of patterns from a given expected type, for explosion of wildcard patterns in Typecore.type_pat.

There are four interesting cases:

  • the type is empty ()
  • no further explosion is necessary (Pat_any)
  • a single pattern is generated, from a record or tuple type or a single-variant type (tp)
  • a list of patterns, in the case that all branches are GADT constructors (tp1; ..; tpn).
val pressure_variants : Env.t -> Typedtree.pattern list -> unit
val pressure_variants_in_computation_pattern : + Env.t -> + Typedtree.computation Typedtree.general_pattern list -> + unit

check_partial pred loc caselist and check_unused refute pred caselist are called with a function pred which will be given counter-example candidates: they may be partially ill-typed, and have to be type-checked to extract a valid counter-example. pred returns a valid counter-example or None. refute indicates that check_unused was called on a refutation clause.

val check_unused : + (bool -> Typedtree.pattern -> Typedtree.pattern option) -> + Typedtree.value Typedtree.case list -> + unit
val irrefutable : Typedtree.pattern -> bool
val inactive : partial:Typedtree.partial -> Typedtree.pattern -> bool

An inactive pattern is a pattern, matching against which can be duplicated, erased or delayed without change in observable behavior of the program. Patterns containing (lazy _) subpatterns or reads of mutable fields are active.

val check_ambiguous_bindings : Typedtree.value Typedtree.case list -> unit
val some_private_tag : Asttypes.label
diff --git a/ocaml/Parse/index.html b/ocaml/Parse/index.html new file mode 100644 index 00000000..bbeb3943 --- /dev/null +++ b/ocaml/Parse/index.html @@ -0,0 +1,2 @@ + +Parse (ocaml.Parse)

Module Parse

Entry points in the parser

Warning: this module is unstable and part of compiler-libs.

The functions below can be used to parse Longident safely.

The function longident is guaranteed to parse all subclasses of Longident.t used in OCaml: values, constructors, simple or extended module paths, and types or module types.

However, this function accepts inputs which are not accepted by the compiler, because they combine functor applications and infix operators. In valid OCaml syntax, only value-level identifiers may end with infix operators Foo.( + ). Moreover, in value-level identifiers the module path Foo must be simple (M.N rather than F(X)): functor applications may only appear in type-level identifiers. As a consequence, a path such as F(X).( + ) is not a valid OCaml identifier; but it is accepted by this function.

The next functions are specialized to a subclass of Longident.t

This function parses a syntactically valid path for a value. For instance, x, M.x, and (+.) are valid. Contrarily, M.A, F(X).x, and true are rejected.

Longident for OCaml's value cannot contain functor application. The last component of the Longident.t is not capitalized, but can be an operator A.Path.To.(.%.%.(;..)<-)

val constr_ident : Stdlib.Lexing.lexbuf -> Longident.t

This function parses a syntactically valid path for a variant constructor. For instance, A, M.A and M.(::) are valid, but both M.a and F(X).A are rejected.

Longident for OCaml's variant constructors cannot contain functor application. The last component of the Longident.t is capitalized, or it may be one the special constructors: true,false,(),[],(::). Among those special constructors, only (::) can be prefixed by a module path (A.B.C.(::)).

val simple_module_path : Stdlib.Lexing.lexbuf -> Longident.t

This function parses a syntactically valid path for a module. For instance, A, and M.A are valid, but both M.a and F(X).A are rejected.

Longident for OCaml's module cannot contain functor application. The last component of the Longident.t is capitalized.

val extended_module_path : Stdlib.Lexing.lexbuf -> Longident.t

This function parse syntactically valid path for an extended module. For instance, A.B and F(A).B are valid. Contrarily, (.%()) or [] are both rejected.

The last component of the Longident.t is capitalized.

val type_ident : Stdlib.Lexing.lexbuf -> Longident.t

This function parse syntactically valid path for a type or a module type. For instance, A, t, M.t and F(X).t are valid. Contrarily, (.%()) or [] are both rejected.

In path for type and module types, only operators and special constructors are rejected.

diff --git a/ocaml/Parser/Incremental/index.html b/ocaml/Parser/Incremental/index.html new file mode 100644 index 00000000..b4a28a6a --- /dev/null +++ b/ocaml/Parser/Incremental/index.html @@ -0,0 +1,32 @@ + +Incremental (ocaml.Parser.Incremental)

Module Parser.Incremental

diff --git a/ocaml/Parser/MenhirInterpreter/index.html b/ocaml/Parser/MenhirInterpreter/index.html new file mode 100644 index 00000000..bb449863 --- /dev/null +++ b/ocaml/Parser/MenhirInterpreter/index.html @@ -0,0 +1,35 @@ + +MenhirInterpreter (ocaml.Parser.MenhirInterpreter)

Module Parser.MenhirInterpreter

include CamlinternalMenhirLib.IncrementalEngine.INCREMENTAL_ENGINE + with type token = token
type token = token
type production
type 'a env
type 'a checkpoint = private
  1. | InputNeeded of 'a env
  2. | Shifting of 'a env * 'a env * bool
  3. | AboutToReduce of 'a env * production
  4. | HandlingError of 'a env
  5. | Accepted of 'a
  6. | Rejected
type strategy = [
  1. | `Legacy
  2. | `Simplified
]
val resume : ?strategy:strategy -> 'a checkpoint -> 'a checkpoint
val lexer_lexbuf_to_supplier : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + supplier
val loop : ?strategy:strategy -> supplier -> 'a checkpoint -> 'a
val loop_handle : + ('a -> 'answer) -> + ('a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val loop_handle_undo : + ('a -> 'answer) -> + ('a checkpoint -> 'a checkpoint -> 'answer) -> + supplier -> + 'a checkpoint -> + 'answer
val shifts : 'a checkpoint -> 'a env option
val acceptable : + 'a checkpoint -> + token -> + CamlinternalMenhirLib.IncrementalEngine.position -> + bool
type 'a lr1state
val number : _ lr1state -> int
val production_index : production -> int
val find_production : int -> production
val stack : 'a env -> stack
val top : 'a env -> element option
val pop_many : int -> 'a env -> 'a env option
val get : int -> 'a env -> element option
val current_state_number : 'a env -> int
val equal : 'a env -> 'a env -> bool
val env_has_default_reduction : 'a env -> bool
val state_has_default_reduction : _ lr1state -> bool
val pop : 'a env -> 'a env option
val force_reduction : production -> 'a env -> 'a env
val input_needed : 'a env -> 'a checkpoint
diff --git a/ocaml/Parser/index.html b/ocaml/Parser/index.html new file mode 100644 index 00000000..eb25c4ce --- /dev/null +++ b/ocaml/Parser/index.html @@ -0,0 +1,47 @@ + +Parser (ocaml.Parser)

Module Parser

type token =
  1. | WITH
  2. | WHILE
  3. | WHEN
  4. | VIRTUAL
  5. | VAL
  6. | UNDERSCORE
  7. | UIDENT of string
  8. | TYPE
  9. | TRY
  10. | TRUE
  11. | TO
  12. | TILDE
  13. | THEN
  14. | STRUCT
  15. | STRING of string * Location.t * string option
  16. | STAR
  17. | SIG
  18. | SEMISEMI
  19. | SEMI
  20. | RPAREN
  21. | REC
  22. | RBRACKET
  23. | RBRACE
  24. | QUOTED_STRING_ITEM of string * Location.t * string * Location.t * string option
  25. | QUOTED_STRING_EXPR of string * Location.t * string * Location.t * string option
  26. | QUOTE
  27. | QUESTION
  28. | PRIVATE
  29. | PREFIXOP of string
  30. | PLUSEQ
  31. | PLUSDOT
  32. | PLUS
  33. | PERCENT
  34. | OR
  35. | OPTLABEL of string
  36. | OPEN
  37. | OF
  38. | OBJECT
  39. | NONREC
  40. | NEW
  41. | MUTABLE
  42. | MODULE
  43. | MINUSGREATER
  44. | MINUSDOT
  45. | MINUS
  46. | METHOD
  47. | MATCH
  48. | LPAREN
  49. | LIDENT of string
  50. | LETOP of string
  51. | LET
  52. | LESSMINUS
  53. | LESS
  54. | LBRACKETPERCENTPERCENT
  55. | LBRACKETPERCENT
  56. | LBRACKETLESS
  57. | LBRACKETGREATER
  58. | LBRACKETBAR
  59. | LBRACKETATATAT
  60. | LBRACKETATAT
  61. | LBRACKETAT
  62. | LBRACKET
  63. | LBRACELESS
  64. | LBRACE
  65. | LAZY
  66. | LABEL of string
  67. | INT of string * char option
  68. | INITIALIZER
  69. | INHERIT
  70. | INFIXOP4 of string
  71. | INFIXOP3 of string
  72. | INFIXOP2 of string
  73. | INFIXOP1 of string
  74. | INFIXOP0 of string
  75. | INCLUDE
  76. | IN
  77. | IF
  78. | HASHOP of string
  79. | HASH
  80. | GREATERRBRACKET
  81. | GREATERRBRACE
  82. | GREATER
  83. | FUNCTOR
  84. | FUNCTION
  85. | FUN
  86. | FOR
  87. | FLOAT of string * char option
  88. | FALSE
  89. | EXTERNAL
  90. | EXCEPTION
  91. | EQUAL
  92. | EOL
  93. | EOF
  94. | END
  95. | ELSE
  96. | DOWNTO
  97. | DOTOP of string
  98. | DOTDOT
  99. | DOT
  100. | DONE
  101. | DOCSTRING of Docstrings.docstring
  102. | DO
  103. | CONSTRAINT
  104. | COMMENT of string * Location.t
  105. | COMMA
  106. | COLONGREATER
  107. | COLONEQUAL
  108. | COLONCOLON
  109. | COLON
  110. | CLASS
  111. | CHAR of char
  112. | BEGIN
  113. | BARRBRACKET
  114. | BARBAR
  115. | BAR
  116. | BANG
  117. | BACKQUOTE
  118. | ASSERT
  119. | AS
  120. | ANDOP of string
  121. | AND
  122. | AMPERSAND
  123. | AMPERAMPER
exception Error
val parse_val_longident : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + Longident.t
val parse_mty_longident : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + Longident.t
val parse_module_type : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + Parsetree.module_type
val parse_module_expr : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + Parsetree.module_expr
val parse_mod_longident : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + Longident.t
val parse_mod_ext_longident : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + Longident.t
val parse_constr_longident : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + Longident.t
val parse_any_longident : + (Stdlib.Lexing.lexbuf -> token) -> + Stdlib.Lexing.lexbuf -> + Longident.t
module MenhirInterpreter : sig ... end
module Incremental : sig ... end
diff --git a/ocaml/Parsetree/index.html b/ocaml/Parsetree/index.html new file mode 100644 index 00000000..a228156e --- /dev/null +++ b/ocaml/Parsetree/index.html @@ -0,0 +1,22 @@ + +Parsetree (ocaml.Parsetree)

Module Parsetree

Abstract syntax tree produced by parsing

Warning: this module is unstable and part of compiler-libs.

type constant =
  1. | Pconst_integer of string * char option
    (*

    Integer constants such as 3 3l 3L 3n.

    Suffixes [g-z][G-Z] are accepted by the parser. Suffixes except 'l', 'L' and 'n' are rejected by the typechecker

    *)
  2. | Pconst_char of char
    (*

    Character such as 'c'.

    *)
  3. | Pconst_string of string * Location.t * string option
    (*

    Constant string such as "constant" or {delim|other constant|delim}.

    The location span the content of the string, without the delimiters.

    *)
  4. | Pconst_float of string * char option
    (*

    Float constant such as 3.4, 2e5 or 1.4e-4.

    Suffixes g-zG-Z are accepted by the parser. Suffixes are rejected by the typechecker.

    *)
type location_stack = Location.t list

Extension points

type attribute = {
  1. attr_name : string Asttypes.loc;
  2. attr_payload : payload;
  3. attr_loc : Location.t;
}

Attributes such as [\@id ARG] and [\@\@id ARG].

Metadata containers passed around within the AST. The compiler ignores unknown attributes.

and extension = string Asttypes.loc * payload

Extension points such as [%id ARG] and [%%id ARG].

Sub-language placeholder -- rejected by the typechecker.

and attributes = attribute list
and payload =
  1. | PStr of structure
  2. | PSig of signature
    (*

    : SIG in an attribute or an extension point

    *)
  3. | PTyp of core_type
    (*

    : T in an attribute or an extension point

    *)
  4. | PPat of pattern * expression option
    (*

    ? P or ? P when E, in an attribute or an extension point

    *)

Core language

Type expressions

and core_type = {
  1. ptyp_desc : core_type_desc;
  2. ptyp_loc : Location.t;
  3. ptyp_loc_stack : location_stack;
  4. ptyp_attributes : attributes;
    (*

    ... [\@id1] [\@id2]

    *)
}
and core_type_desc =
  1. | Ptyp_any
    (*

    _

    *)
  2. | Ptyp_var of string
    (*

    A type variable such as 'a

    *)
  3. | Ptyp_arrow of Asttypes.arg_label * core_type * core_type
    (*

    Ptyp_arrow(lbl, T1, T2) represents:

    *)
  4. | Ptyp_tuple of core_type list
    (*

    Ptyp_tuple([T1 ; ... ; Tn]) represents a product type T1 * ... * Tn.

    Invariant: n >= 2.

    *)
  5. | Ptyp_constr of Longident.t Asttypes.loc * core_type list
    (*

    Ptyp_constr(lident, l) represents:

    • tconstr when l=[],
    • T tconstr when l=[T],
    • (T1, ..., Tn) tconstr when l=[T1 ; ... ; Tn].
    *)
  6. | Ptyp_object of object_field list * Asttypes.closed_flag
    (*

    Ptyp_object([ l1:T1; ...; ln:Tn ], flag) represents:

    • < l1:T1; ...; ln:Tn > when flag is Closed,
    • < l1:T1; ...; ln:Tn; .. > when flag is Open.
    *)
  7. | Ptyp_class of Longident.t Asttypes.loc * core_type list
    (*

    Ptyp_class(tconstr, l) represents:

    • #tconstr when l=[],
    • T #tconstr when l=[T],
    • (T1, ..., Tn) #tconstr when l=[T1 ; ... ; Tn].
    *)
  8. | Ptyp_alias of core_type * string
    (*

    T as 'a.

    *)
  9. | Ptyp_variant of row_field list + * Asttypes.closed_flag + * Asttypes.label list option
    (*

    Ptyp_variant([`A;`B], flag, labels) represents:

    • [ `A|`B ] when flag is Closed, and labels is None,
    • [> `A|`B ] when flag is Open, and labels is None,
    • [< `A|`B ] when flag is Closed, and labels is Some [],
    • [< `A|`B > `X `Y ] when flag is Closed, and labels is Some ["X";"Y"].
    *)
  10. | Ptyp_poly of string Asttypes.loc list * core_type
    (*

    'a1 ... 'an. T

    Can only appear in the following context:

    • As the core_type of a Ppat_constraint node corresponding to a constraint on a let-binding:

      let x : 'a1 ... 'an. T = e ...
    *)
  11. | Ptyp_package of package_type
    (*

    (module S).

    *)
  12. | Ptyp_extension of extension
    (*

    [%id].

    *)

As package_type typed values:

  • (S, []) represents (module S),
  • (S, [(t1, T1) ; ... ; (tn, Tn)]) represents (module S with type t1 = T1 and ... and tn = Tn).
and row_field = {
  1. prf_desc : row_field_desc;
  2. prf_loc : Location.t;
  3. prf_attributes : attributes;
}
and row_field_desc =
  1. | Rtag of Asttypes.label Asttypes.loc * bool * core_type list
    (*

    Rtag(`A, b, l) represents:

    • `A when b is true and l is [],
    • `A of T when b is false and l is [T],
    • `A of T1 & .. & Tn when b is false and l is [T1;...Tn],
    • `A of & T1 & .. & Tn when b is true and l is [T1;...Tn].
    • The bool field is true if the tag contains a constant (empty) constructor.
    • & occurs when several types are used for the same constructor (see 4.2 in the manual)
    *)
  2. | Rinherit of core_type
    (*

    [ | t ]

    *)
and object_field = {
  1. pof_desc : object_field_desc;
  2. pof_loc : Location.t;
  3. pof_attributes : attributes;
}
and object_field_desc =
  1. | Otag of Asttypes.label Asttypes.loc * core_type
  2. | Oinherit of core_type

Patterns

and pattern = {
  1. ppat_desc : pattern_desc;
  2. ppat_loc : Location.t;
  3. ppat_loc_stack : location_stack;
  4. ppat_attributes : attributes;
    (*

    ... [\@id1] [\@id2]

    *)
}
and pattern_desc =
  1. | Ppat_any
    (*

    The pattern _.

    *)
  2. | Ppat_var of string Asttypes.loc
    (*

    A variable pattern such as x

    *)
  3. | Ppat_alias of pattern * string Asttypes.loc
    (*

    An alias pattern such as P as 'a

    *)
  4. | Ppat_constant of constant
    (*

    Patterns such as 1, 'a', "true", 1.0, 1l, 1L, 1n

    *)
  5. | Ppat_interval of constant * constant
    (*

    Patterns such as 'a'..'z'.

    Other forms of interval are recognized by the parser but rejected by the type-checker.

    *)
  6. | Ppat_tuple of pattern list
    (*

    Patterns (P1, ..., Pn).

    Invariant: n >= 2

    *)
  7. | Ppat_construct of Longident.t Asttypes.loc + * (string Asttypes.loc list * pattern) option
    (*

    Ppat_construct(C, args) represents:

    • C when args is None,
    • C P when args is Some ([], P)
    • C (P1, ..., Pn) when args is Some ([], Ppat_tuple [P1; ...; Pn])
    • C (type a b) P when args is Some ([a; b], P)
    *)
  8. | Ppat_variant of Asttypes.label * pattern option
    (*

    Ppat_variant(`A, pat) represents:

    • `A when pat is None,
    • `A P when pat is Some P
    *)
  9. | Ppat_record of (Longident.t Asttypes.loc * pattern) list * Asttypes.closed_flag
    (*

    Ppat_record([(l1, P1) ; ... ; (ln, Pn)], flag) represents:

    • { l1=P1; ...; ln=Pn } when flag is Closed
    • { l1=P1; ...; ln=Pn; _} when flag is Open

    Invariant: n > 0

    *)
  10. | Ppat_array of pattern list
    (*

    Pattern [| P1; ...; Pn |]

    *)
  11. | Ppat_or of pattern * pattern
    (*

    Pattern P1 | P2

    *)
  12. | Ppat_constraint of pattern * core_type
    (*

    Pattern (P : T)

    *)
  13. | Ppat_type of Longident.t Asttypes.loc
    (*

    Pattern #tconst

    *)
  14. | Ppat_lazy of pattern
    (*

    Pattern lazy P

    *)
  15. | Ppat_unpack of string option Asttypes.loc
    (*

    Ppat_unpack(s) represents:

    • (module P) when s is Some "P"
    • (module _) when s is None

    Note: (module P : S) is represented as Ppat_constraint(Ppat_unpack(Some "P"), Ptyp_package S)

    *)
  16. | Ppat_exception of pattern
    (*

    Pattern exception P

    *)
  17. | Ppat_extension of extension
    (*

    Pattern [%id]

    *)
  18. | Ppat_open of Longident.t Asttypes.loc * pattern
    (*

    Pattern M.(P)

    *)

Value expressions

and expression = {
  1. pexp_desc : expression_desc;
  2. pexp_loc : Location.t;
  3. pexp_loc_stack : location_stack;
  4. pexp_attributes : attributes;
    (*

    ... [\@id1] [\@id2]

    *)
}
and expression_desc =
  1. | Pexp_ident of Longident.t Asttypes.loc
    (*

    Identifiers such as x and M.x

    *)
  2. | Pexp_constant of constant
    (*

    Expressions constant such as 1, 'a', "true", 1.0, 1l, 1L, 1n

    *)
  3. | Pexp_let of Asttypes.rec_flag * value_binding list * expression
    (*

    Pexp_let(flag, [(P1,E1) ; ... ; (Pn,En)], E) represents:

    • let P1 = E1 and ... and Pn = EN in E when flag is Nonrecursive,
    • let rec P1 = E1 and ... and Pn = EN in E when flag is Recursive.
    *)
  4. | Pexp_function of case list
    (*

    function P1 -> E1 | ... | Pn -> En

    *)
  5. | Pexp_fun of Asttypes.arg_label * expression option * pattern * expression
    (*

    Pexp_fun(lbl, exp0, P, E1) represents:

    • fun P -> E1 when lbl is Nolabel and exp0 is None
    • fun ~l:P -> E1 when lbl is Labelled l and exp0 is None
    • fun ?l:P -> E1 when lbl is Optional l and exp0 is None
    • fun ?l:(P = E0) -> E1 when lbl is Optional l and exp0 is Some E0

    Notes:

    • If E0 is provided, only Optional is allowed.
    • fun P1 P2 .. Pn -> E1 is represented as nested Pexp_fun.
    • let f P = E is represented using Pexp_fun.
    *)
  6. | Pexp_apply of expression * (Asttypes.arg_label * expression) list
    (*

    Pexp_apply(E0, [(l1, E1) ; ... ; (ln, En)]) represents E0 ~l1:E1 ... ~ln:En

    li can be Nolabel (non labeled argument), Labelled (labelled arguments) or Optional (optional argument).

    Invariant: n > 0

    *)
  7. | Pexp_match of expression * case list
    (*

    match E0 with P1 -> E1 | ... | Pn -> En

    *)
  8. | Pexp_try of expression * case list
    (*

    try E0 with P1 -> E1 | ... | Pn -> En

    *)
  9. | Pexp_tuple of expression list
    (*

    Expressions (E1, ..., En)

    Invariant: n >= 2

    *)
  10. | Pexp_construct of Longident.t Asttypes.loc * expression option
    (*

    Pexp_construct(C, exp) represents:

    • C when exp is None,
    • C E when exp is Some E,
    • C (E1, ..., En) when exp is Some (Pexp_tuple[E1;...;En])
    *)
  11. | Pexp_variant of Asttypes.label * expression option
    (*

    Pexp_variant(`A, exp) represents

    • `A when exp is None
    • `A E when exp is Some E
    *)
  12. | Pexp_record of (Longident.t Asttypes.loc * expression) list * expression option
    (*

    Pexp_record([(l1,P1) ; ... ; (ln,Pn)], exp0) represents

    • { l1=P1; ...; ln=Pn } when exp0 is None
    • { E0 with l1=P1; ...; ln=Pn } when exp0 is Some E0

    Invariant: n > 0

    *)
  13. | Pexp_field of expression * Longident.t Asttypes.loc
    (*

    E.l

    *)
  14. | Pexp_setfield of expression * Longident.t Asttypes.loc * expression
    (*

    E1.l <- E2

    *)
  15. | Pexp_array of expression list
    (*

    [| E1; ...; En |]

    *)
  16. | Pexp_ifthenelse of expression * expression * expression option
    (*

    if E1 then E2 else E3

    *)
  17. | Pexp_sequence of expression * expression
    (*

    E1; E2

    *)
  18. | Pexp_while of expression * expression
    (*

    while E1 do E2 done

    *)
  19. | Pexp_for of pattern + * expression + * expression + * Asttypes.direction_flag + * expression
    (*

    Pexp_for(i, E1, E2, direction, E3) represents:

    • for i = E1 to E2 do E3 done when direction is Upto
    • for i = E1 downto E2 do E3 done when direction is Downto
    *)
  20. | Pexp_constraint of expression * core_type
    (*

    (E : T)

    *)
  21. | Pexp_coerce of expression * core_type option * core_type
    (*

    Pexp_coerce(E, from, T) represents

    • (E :> T) when from is None,
    • (E : T0 :> T) when from is Some T0.
    *)
  22. | Pexp_send of expression * Asttypes.label Asttypes.loc
    (*

    E # m

    *)
  23. | Pexp_new of Longident.t Asttypes.loc
    (*

    new M.c

    *)
  24. | Pexp_setinstvar of Asttypes.label Asttypes.loc * expression
    (*

    x <- 2

    *)
  25. | Pexp_override of (Asttypes.label Asttypes.loc * expression) list
    (*

    {< x1 = E1; ...; xn = En >}

    *)
  26. | Pexp_letmodule of string option Asttypes.loc * module_expr * expression
    (*

    let module M = ME in E

    *)
  27. | Pexp_letexception of extension_constructor * expression
    (*

    let exception C in E

    *)
  28. | Pexp_assert of expression
    (*

    assert E.

    Note: assert false is treated in a special way by the type-checker.

    *)
  29. | Pexp_lazy of expression
    (*

    lazy E

    *)
  30. | Pexp_poly of expression * core_type option
    (*

    Used for method bodies.

    Can only be used as the expression under Cfk_concrete for methods (not values).

    *)
  31. | Pexp_object of class_structure
    (*

    object ... end

    *)
  32. | Pexp_newtype of string Asttypes.loc * expression
    (*

    fun (type t) -> E

    *)
  33. | Pexp_pack of module_expr
    (*

    (module ME).

    (module ME : S) is represented as Pexp_constraint(Pexp_pack ME, Ptyp_package S)

    *)
  34. | Pexp_open of open_declaration * expression
    (*
    • M.(E)
    • let open M in E
    • let open! M in E
    *)
  35. | Pexp_letop of letop
    (*
    • let* P = E0 in E1
    • let* P0 = E00 and* P1 = E01 in E1
    *)
  36. | Pexp_extension of extension
    (*

    [%id]

    *)
  37. | Pexp_unreachable
    (*

    .

    *)
and case = {
  1. pc_lhs : pattern;
  2. pc_guard : expression option;
  3. pc_rhs : expression;
}

Values of type case represents (P -> E) or (P when E0 -> E)

and letop = {
  1. let_ : binding_op;
  2. ands : binding_op list;
  3. body : expression;
}
and binding_op = {
  1. pbop_op : string Asttypes.loc;
  2. pbop_pat : pattern;
  3. pbop_exp : expression;
  4. pbop_loc : Location.t;
}

Value descriptions

and value_description = {
  1. pval_name : string Asttypes.loc;
  2. pval_type : core_type;
  3. pval_prim : string list;
  4. pval_attributes : attributes;
    (*

    ... [\@\@id1] [\@\@id2]

    *)
  5. pval_loc : Location.t;
}

Values of type value_description represents:

  • val x: T, when pval_prim is []
  • external x: T = "s1" ... "sn" when pval_prim is ["s1";..."sn"]

Type declarations

and type_declaration = {
  1. ptype_name : string Asttypes.loc;
  2. ptype_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
    (*

    ('a1,...'an) t

    *)
  3. ptype_cstrs : (core_type * core_type * Location.t) list;
    (*

    ... constraint T1=T1' ... constraint Tn=Tn'

    *)
  4. ptype_kind : type_kind;
  5. ptype_private : Asttypes.private_flag;
    (*

    for = private ...

    *)
  6. ptype_manifest : core_type option;
    (*

    represents = T

    *)
  7. ptype_attributes : attributes;
    (*

    ... [\@\@id1] [\@\@id2]

    *)
  8. ptype_loc : Location.t;
}

Here are type declarations and their representation, for various ptype_kind and ptype_manifest values:

  • type t when type_kind is Ptype_abstract, and manifest is None,
  • type t = T0 when type_kind is Ptype_abstract, and manifest is Some T0,
  • type t = C of T | ... when type_kind is Ptype_variant, and manifest is None,
  • type t = T0 = C of T | ... when type_kind is Ptype_variant, and manifest is Some T0,
  • type t = {l: T; ...} when type_kind is Ptype_record, and manifest is None,
  • type t = T0 = {l : T; ...} when type_kind is Ptype_record, and manifest is Some T0,
  • type t = .. when type_kind is Ptype_open, and manifest is None.
and type_kind =
  1. | Ptype_abstract
  2. | Ptype_variant of constructor_declaration list
  3. | Ptype_record of label_declaration list
    (*

    Invariant: non-empty list

    *)
  4. | Ptype_open
and label_declaration = {
  1. pld_name : string Asttypes.loc;
  2. pld_mutable : Asttypes.mutable_flag;
  3. pld_type : core_type;
  4. pld_loc : Location.t;
  5. pld_attributes : attributes;
    (*

    l : T [\@id1] [\@id2]

    *)
}

Note: T can be a Ptyp_poly.

and constructor_declaration = {
  1. pcd_name : string Asttypes.loc;
  2. pcd_vars : string Asttypes.loc list;
  3. pcd_args : constructor_arguments;
  4. pcd_res : core_type option;
  5. pcd_loc : Location.t;
  6. pcd_attributes : attributes;
    (*

    C of ... [\@id1] [\@id2]

    *)
}
and constructor_arguments =
  1. | Pcstr_tuple of core_type list
  2. | Pcstr_record of label_declaration list
    (*

    Values of type constructor_declaration represents the constructor arguments of:

    • C of T1 * ... * Tn when res = None, and args = Pcstr_tuple [T1; ... ; Tn],
    • C: T0 when res = Some T0, and args = Pcstr_tuple [],
    • C: T1 * ... * Tn -> T0 when res = Some T0, and args = Pcstr_tuple [T1; ... ; Tn],
    • C of {...} when res = None, and args = Pcstr_record [...],
    • C: {...} -> T0 when res = Some T0, and args = Pcstr_record [...].
    *)
and type_extension = {
  1. ptyext_path : Longident.t Asttypes.loc;
  2. ptyext_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
  3. ptyext_constructors : extension_constructor list;
  4. ptyext_private : Asttypes.private_flag;
  5. ptyext_loc : Location.t;
  6. ptyext_attributes : attributes;
    (*

    ... \@\@id1 \@\@id2

    *)
}

Definition of new extensions constructors for the extensive sum type t (type t += ...).

and extension_constructor = {
  1. pext_name : string Asttypes.loc;
  2. pext_kind : extension_constructor_kind;
  3. pext_loc : Location.t;
  4. pext_attributes : attributes;
    (*

    C of ... [\@id1] [\@id2]

    *)
}
and type_exception = {
  1. ptyexn_constructor : extension_constructor;
  2. ptyexn_loc : Location.t;
  3. ptyexn_attributes : attributes;
    (*

    ... [\@\@id1] [\@\@id2]

    *)
}

Definition of a new exception (exception E).

and extension_constructor_kind =
  1. | Pext_decl of string Asttypes.loc list + * constructor_arguments + * core_type option
    (*

    Pext_decl(existentials, c_args, t_opt) describes a new extension constructor. It can be:

    • C of T1 * ... * Tn when:

      • existentials is [],
      • c_args is [T1; ...; Tn],
      • t_opt is None
    • C: T0 when

      • existentials is [],
      • c_args is [],
      • t_opt is Some T0.
    • C: T1 * ... * Tn -> T0 when

      • existentials is [],
      • c_args is [T1; ...; Tn],
      • t_opt is Some T0.
    • C: 'a... . T1 * ... * Tn -> T0 when

      • existentials is ['a;...],
      • c_args is [T1; ... ; Tn],
      • t_opt is Some T0.
    *)
  2. | Pext_rebind of Longident.t Asttypes.loc
    (*

    Pext_rebind(D) re-export the constructor D with the new name C

    *)

Class language

Type expressions for the class language

and class_type = {
  1. pcty_desc : class_type_desc;
  2. pcty_loc : Location.t;
  3. pcty_attributes : attributes;
    (*

    ... [\@id1] [\@id2]

    *)
}
and class_type_desc =
  1. | Pcty_constr of Longident.t Asttypes.loc * core_type list
    (*
    • c
    • ['a1, ..., 'an] c
    *)
  2. | Pcty_signature of class_signature
    (*

    object ... end

    *)
  3. | Pcty_arrow of Asttypes.arg_label * core_type * class_type
    (*

    Pcty_arrow(lbl, T, CT) represents:

    *)
  4. | Pcty_extension of extension
    (*

    %id

    *)
  5. | Pcty_open of open_description * class_type
    (*

    let open M in CT

    *)
and class_signature = {
  1. pcsig_self : core_type;
  2. pcsig_fields : class_type_field list;
}

Values of type class_signature represents:

and class_type_field = {
  1. pctf_desc : class_type_field_desc;
  2. pctf_loc : Location.t;
  3. pctf_attributes : attributes;
    (*

    ... [\@\@id1] [\@\@id2]

    *)
}
and class_type_field_desc =
  1. | Pctf_inherit of class_type
    (*

    inherit CT

    *)
  2. | Pctf_val of Asttypes.label Asttypes.loc + * Asttypes.mutable_flag + * Asttypes.virtual_flag + * core_type
    (*

    val x: T

    *)
  3. | Pctf_method of Asttypes.label Asttypes.loc + * Asttypes.private_flag + * Asttypes.virtual_flag + * core_type
    (*

    method x: T

    Note: T can be a Ptyp_poly.

    *)
  4. | Pctf_constraint of core_type * core_type
    (*

    constraint T1 = T2

    *)
  5. | Pctf_attribute of attribute
    (*

    [\@\@\@id]

    *)
  6. | Pctf_extension of extension
    (*

    [%%id]

    *)
and 'a class_infos = {
  1. pci_virt : Asttypes.virtual_flag;
  2. pci_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
  3. pci_name : string Asttypes.loc;
  4. pci_expr : 'a;
  5. pci_loc : Location.t;
  6. pci_attributes : attributes;
    (*

    ... [\@\@id1] [\@\@id2]

    *)
}

Values of type class_expr class_infos represents:

  • class c = ...
  • class ['a1,...,'an] c = ...
  • class virtual c = ...

They are also used for "class type" declaration.

and class_description = class_type class_infos
and class_type_declaration = class_type class_infos

Value expressions for the class language

and class_expr = {
  1. pcl_desc : class_expr_desc;
  2. pcl_loc : Location.t;
  3. pcl_attributes : attributes;
    (*

    ... [\@id1] [\@id2]

    *)
}
and class_expr_desc =
  1. | Pcl_constr of Longident.t Asttypes.loc * core_type list
    (*

    c and ['a1, ..., 'an] c

    *)
  2. | Pcl_structure of class_structure
    (*

    object ... end

    *)
  3. | Pcl_fun of Asttypes.arg_label * expression option * pattern * class_expr
    (*

    Pcl_fun(lbl, exp0, P, CE) represents:

    • fun P -> CE when lbl is Nolabel and exp0 is None,
    • fun ~l:P -> CE when lbl is Labelled l and exp0 is None,
    • fun ?l:P -> CE when lbl is Optional l and exp0 is None,
    • fun ?l:(P = E0) -> CE when lbl is Optional l and exp0 is Some E0.
    *)
  4. | Pcl_apply of class_expr * (Asttypes.arg_label * expression) list
    (*

    Pcl_apply(CE, [(l1,E1) ; ... ; (ln,En)]) represents CE ~l1:E1 ... ~ln:En. li can be empty (non labeled argument) or start with ? (optional argument).

    Invariant: n > 0

    *)
  5. | Pcl_let of Asttypes.rec_flag * value_binding list * class_expr
    (*

    Pcl_let(rec, [(P1, E1); ... ; (Pn, En)], CE) represents:

    • let P1 = E1 and ... and Pn = EN in CE when rec is Nonrecursive,
    • let rec P1 = E1 and ... and Pn = EN in CE when rec is Recursive.
    *)
  6. | Pcl_constraint of class_expr * class_type
    (*

    (CE : CT)

    *)
  7. | Pcl_extension of extension
    (*

    [%id]

    *)
  8. | Pcl_open of open_description * class_expr
    (*

    let open M in CE

    *)
and class_structure = {
  1. pcstr_self : pattern;
  2. pcstr_fields : class_field list;
}

Values of type class_structure represents:

and class_field = {
  1. pcf_desc : class_field_desc;
  2. pcf_loc : Location.t;
  3. pcf_attributes : attributes;
    (*

    ... [\@\@id1] [\@\@id2]

    *)
}
and class_field_desc =
  1. | Pcf_inherit of Asttypes.override_flag * class_expr * string Asttypes.loc option
    (*

    Pcf_inherit(flag, CE, s) represents:

    • inherit CE when flag is Fresh and s is None,
    • inherit CE as x when flag is Fresh and s is Some x,
    • inherit! CE when flag is Override and s is None,
    • inherit! CE as x when flag is Override and s is Some x
    *)
  2. | Pcf_val of Asttypes.label Asttypes.loc + * Asttypes.mutable_flag + * class_field_kind
    (*

    Pcf_val(x,flag, kind) represents:

    *)
  3. | Pcf_method of Asttypes.label Asttypes.loc + * Asttypes.private_flag + * class_field_kind
    (**)
  4. | Pcf_constraint of core_type * core_type
    (*

    constraint T1 = T2

    *)
  5. | Pcf_initializer of expression
    (*

    initializer E

    *)
  6. | Pcf_attribute of attribute
    (*

    [\@\@\@id]

    *)
  7. | Pcf_extension of extension
    (*

    [%%id]

    *)
and class_field_kind =
  1. | Cfk_virtual of core_type
  2. | Cfk_concrete of Asttypes.override_flag * expression
and class_declaration = class_expr class_infos

Module language

Type expressions for the module language

and module_type = {
  1. pmty_desc : module_type_desc;
  2. pmty_loc : Location.t;
  3. pmty_attributes : attributes;
    (*

    ... [\@id1] [\@id2]

    *)
}
and module_type_desc =
  1. | Pmty_ident of Longident.t Asttypes.loc
    (*

    Pmty_ident(S) represents S

    *)
  2. | Pmty_signature of signature
    (*

    sig ... end

    *)
  3. | Pmty_functor of functor_parameter * module_type
    (*

    functor(X : MT1) -> MT2

    *)
  4. | Pmty_with of module_type * with_constraint list
    (*

    MT with ...

    *)
  5. | Pmty_typeof of module_expr
    (*

    module type of ME

    *)
  6. | Pmty_extension of extension
    (*

    [%id]

    *)
  7. | Pmty_alias of Longident.t Asttypes.loc
    (*

    (module M)

    *)
and functor_parameter =
  1. | Unit
    (*

    ()

    *)
  2. | Named of string option Asttypes.loc * module_type
    (*

    Named(name, MT) represents:

    • (X : MT) when name is Some X,
    • (_ : MT) when name is None
    *)
and signature = signature_item list
and signature_item = {
  1. psig_desc : signature_item_desc;
  2. psig_loc : Location.t;
}
and signature_item_desc =
  1. | Psig_value of value_description
    (*
    • val x: T
    • external x: T = "s1" ... "sn"
    *)
  2. | Psig_type of Asttypes.rec_flag * type_declaration list
    (*

    type t1 = ... and ... and tn = ...

    *)
  3. | Psig_typesubst of type_declaration list
    (*

    type t1 := ... and ... and tn := ...

    *)
  4. | Psig_typext of type_extension
    (*

    type t1 += ...

    *)
  5. | Psig_exception of type_exception
    (*

    exception C of T

    *)
  6. | Psig_module of module_declaration
    (*

    module X = M and module X : MT

    *)
  7. | Psig_modsubst of module_substitution
    (*

    module X := M

    *)
  8. | Psig_recmodule of module_declaration list
    (*

    module rec X1 : MT1 and ... and Xn : MTn

    *)
  9. | Psig_modtype of module_type_declaration
    (*

    module type S = MT and module type S

    *)
  10. | Psig_modtypesubst of module_type_declaration
    (*

    module type S := ...

    *)
  11. | Psig_open of open_description
    (*

    open X

    *)
  12. | Psig_include of include_description
    (*

    include MT

    *)
  13. | Psig_class of class_description list
    (*

    class c1 : ... and ... and cn : ...

    *)
  14. | Psig_class_type of class_type_declaration list
    (*

    class type ct1 = ... and ... and ctn = ...

    *)
  15. | Psig_attribute of attribute
    (*

    [\@\@\@id]

    *)
  16. | Psig_extension of extension * attributes
    (*

    [%%id]

    *)
and module_declaration = {
  1. pmd_name : string option Asttypes.loc;
  2. pmd_type : module_type;
  3. pmd_attributes : attributes;
    (*

    ... [\@\@id1] [\@\@id2]

    *)
  4. pmd_loc : Location.t;
}

Values of type module_declaration represents S : MT

and module_substitution = {
  1. pms_name : string Asttypes.loc;
  2. pms_manifest : Longident.t Asttypes.loc;
  3. pms_attributes : attributes;
    (*

    ... [\@\@id1] [\@\@id2]

    *)
  4. pms_loc : Location.t;
}

Values of type module_substitution represents S := M

and module_type_declaration = {
  1. pmtd_name : string Asttypes.loc;
  2. pmtd_type : module_type option;
  3. pmtd_attributes : attributes;
    (*

    ... [\@\@id1] [\@\@id2]

    *)
  4. pmtd_loc : Location.t;
}

Values of type module_type_declaration represents:

  • S = MT,
  • S for abstract module type declaration, when pmtd_type is None.
and 'a open_infos = {
  1. popen_expr : 'a;
  2. popen_override : Asttypes.override_flag;
  3. popen_loc : Location.t;
  4. popen_attributes : attributes;
}

Values of type 'a open_infos represents:

and open_description = Longident.t Asttypes.loc open_infos

Values of type open_description represents:

  • open M.N
  • open M(N).O
and open_declaration = module_expr open_infos

Values of type open_declaration represents:

  • open M.N
  • open M(N).O
  • open struct ... end
and 'a include_infos = {
  1. pincl_mod : 'a;
  2. pincl_loc : Location.t;
  3. pincl_attributes : attributes;
}
and include_description = module_type include_infos

Values of type include_description represents include MT

and include_declaration = module_expr include_infos

Values of type include_declaration represents include ME

and with_constraint =
  1. | Pwith_type of Longident.t Asttypes.loc * type_declaration
    (*

    with type X.t = ...

    Note: the last component of the longident must match the name of the type_declaration.

    *)
  2. | Pwith_module of Longident.t Asttypes.loc * Longident.t Asttypes.loc
    (*

    with module X.Y = Z

    *)
  3. | Pwith_modtype of Longident.t Asttypes.loc * module_type
    (*

    with module type X.Y = Z

    *)
  4. | Pwith_modtypesubst of Longident.t Asttypes.loc * module_type
    (*

    with module type X.Y := sig end

    *)
  5. | Pwith_typesubst of Longident.t Asttypes.loc * type_declaration
    (*

    with type X.t := ..., same format as [Pwith_type]

    *)
  6. | Pwith_modsubst of Longident.t Asttypes.loc * Longident.t Asttypes.loc
    (*

    with module X.Y := Z

    *)

Value expressions for the module language

and module_expr = {
  1. pmod_desc : module_expr_desc;
  2. pmod_loc : Location.t;
  3. pmod_attributes : attributes;
    (*

    ... [\@id1] [\@id2]

    *)
}
and module_expr_desc =
  1. | Pmod_ident of Longident.t Asttypes.loc
    (*

    X

    *)
  2. | Pmod_structure of structure
    (*

    struct ... end

    *)
  3. | Pmod_functor of functor_parameter * module_expr
    (*

    functor(X : MT1) -> ME

    *)
  4. | Pmod_apply of module_expr * module_expr
    (*

    ME1(ME2)

    *)
  5. | Pmod_apply_unit of module_expr
    (*

    ME1()

    *)
  6. | Pmod_constraint of module_expr * module_type
    (*

    (ME : MT)

    *)
  7. | Pmod_unpack of expression
    (*

    (val E)

    *)
  8. | Pmod_extension of extension
    (*

    [%id]

    *)
and structure = structure_item list
and structure_item = {
  1. pstr_desc : structure_item_desc;
  2. pstr_loc : Location.t;
}
and structure_item_desc =
  1. | Pstr_eval of expression * attributes
    (*

    E

    *)
  2. | Pstr_value of Asttypes.rec_flag * value_binding list
    (*

    Pstr_value(rec, [(P1, E1 ; ... ; (Pn, En))]) represents:

    • let P1 = E1 and ... and Pn = EN when rec is Nonrecursive,
    • let rec P1 = E1 and ... and Pn = EN when rec is Recursive.
    *)
  3. | Pstr_primitive of value_description
    (*
    • val x: T
    • external x: T = "s1" ... "sn"
    *)
  4. | Pstr_type of Asttypes.rec_flag * type_declaration list
    (*

    type t1 = ... and ... and tn = ...

    *)
  5. | Pstr_typext of type_extension
    (*

    type t1 += ...

    *)
  6. | Pstr_exception of type_exception
    (*
    • exception C of T
    • exception C = M.X
    *)
  7. | Pstr_module of module_binding
    (*

    module X = ME

    *)
  8. | Pstr_recmodule of module_binding list
    (*

    module rec X1 = ME1 and ... and Xn = MEn

    *)
  9. | Pstr_modtype of module_type_declaration
    (*

    module type S = MT

    *)
  10. | Pstr_open of open_declaration
    (*

    open X

    *)
  11. | Pstr_class of class_declaration list
    (*

    class c1 = ... and ... and cn = ...

    *)
  12. | Pstr_class_type of class_type_declaration list
    (*

    class type ct1 = ... and ... and ctn = ...

    *)
  13. | Pstr_include of include_declaration
    (*

    include ME

    *)
  14. | Pstr_attribute of attribute
    (*

    [\@\@\@id]

    *)
  15. | Pstr_extension of extension * attributes
    (*

    [%%id]

    *)
and value_constraint =
  1. | Pvc_constraint of {
    1. locally_abstract_univars : string Asttypes.loc list;
    2. typ : core_type;
    }
  2. | Pvc_coercion of {
    1. ground : core_type option;
    2. coercion : core_type;
    }
    (*
    • Pvc_constraint { locally_abstract_univars=[]; typ} is a simple type constraint on a value binding: let x : typ
    • More generally, in Pvc_constraint { locally_abstract_univars; typ} locally_abstract_univars is the list of locally abstract type variables in let x: type a ... . typ
    • Pvc_coercion { ground=None; coercion } represents let x :> typ
    • Pvc_coercion { ground=Some g; coercion } represents let x : g :> typ
    *)
and value_binding = {
  1. pvb_pat : pattern;
  2. pvb_expr : expression;
  3. pvb_constraint : value_constraint option;
  4. pvb_attributes : attributes;
  5. pvb_loc : Location.t;
}

let pat : type_constraint = exp

and module_binding = {
  1. pmb_name : string option Asttypes.loc;
  2. pmb_expr : module_expr;
  3. pmb_attributes : attributes;
  4. pmb_loc : Location.t;
}

Values of type module_binding represents module X = ME

Toplevel

Toplevel phrases

type toplevel_phrase =
  1. | Ptop_def of structure
  2. | Ptop_dir of toplevel_directive
    (*

    #use, #load ...

    *)
and toplevel_directive = {
  1. pdir_name : string Asttypes.loc;
  2. pdir_arg : directive_argument option;
  3. pdir_loc : Location.t;
}
and directive_argument = {
  1. pdira_desc : directive_argument_desc;
  2. pdira_loc : Location.t;
}
and directive_argument_desc =
  1. | Pdir_string of string
  2. | Pdir_int of string * char option
  3. | Pdir_ident of Longident.t
  4. | Pdir_bool of bool
diff --git a/ocaml/Pass_wrapper/index.html b/ocaml/Pass_wrapper/index.html new file mode 100644 index 00000000..1aa5c76e --- /dev/null +++ b/ocaml/Pass_wrapper/index.html @@ -0,0 +1,9 @@ + +Pass_wrapper (ocaml.Pass_wrapper)

Module Pass_wrapper

val register : pass_name:string -> unit
val with_dump : + ppf_dump:Stdlib.Format.formatter -> + pass_name:string -> + f:(unit -> 'b option) -> + input:'a -> + print_input:(Stdlib.Format.formatter -> 'a -> unit) -> + print_output:(Stdlib.Format.formatter -> 'b -> unit) -> + 'b option
diff --git a/ocaml/Path/Map/index.html b/ocaml/Path/Map/index.html new file mode 100644 index 00000000..40af010f --- /dev/null +++ b/ocaml/Path/Map/index.html @@ -0,0 +1,8 @@ + +Map (ocaml.Path.Map)

Module Path.Map

Maps

type key = t

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Path/Set/index.html b/ocaml/Path/Set/index.html new file mode 100644 index 00000000..5de1a466 --- /dev/null +++ b/ocaml/Path/Set/index.html @@ -0,0 +1,3 @@ + +Set (ocaml.Path.Set)

Module Path.Set

Sets

type elt = t

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Path/index.html b/ocaml/Path/index.html new file mode 100644 index 00000000..d8a68310 --- /dev/null +++ b/ocaml/Path/index.html @@ -0,0 +1,2 @@ + +Path (ocaml.Path)

Module Path

type t =
  1. | Pident of Ident.t
    (*

    Examples: x, List, int

    *)
  2. | Pdot of t * string
    (*

    Examples: List.map, Float.Array

    *)
  3. | Papply of t * t
    (*

    Examples: Set.Make(Int), Map.Make(Set.Make(Int))

    *)
  4. | Pextra_ty of t * extra_ty
    (*

    Pextra_ty (p, extra) are additional paths of types introduced by specific OCaml constructs. See below.

    *)
and extra_ty =
  1. | Pcstr_ty of string
    (*

    Pextra_ty (p, Pcstr_ty c) is the type of the inline record for constructor c inside type p.

    For example, in

    type 'a t = Nil | Cons of {hd : 'a; tl : 'a t}

    The inline record type {hd : 'a; tl : 'a t} cannot be named by the user in the surface syntax, but internally it has the path Pextra_ty (Pident `t`, Pcstr_ty "Cons").

    *)
  2. | Pext_ty
    (*

    Pextra_ty (p, Pext_ty) is the type of the inline record for the extension constructor p.

    For example, in

    type exn += Error of {loc : loc; msg : string}

    The inline record type {loc : loc; msg : string} cannot be named by the user in the surface syntax, but internally it has the path Pextra_ty (Pident `Error`, Pext_ty).

    *)
val same : t -> t -> bool
val compare : t -> t -> int
val compare_extra : extra_ty -> extra_ty -> int
val find_free_opt : Ident.t list -> t -> Ident.t option
val exists_free : Ident.t list -> t -> bool
val scope : t -> int
val flatten : t -> [ `Contains_apply | `Ok of Ident.t * string list ]
val name : ?paren:(string -> bool) -> t -> string
val head : t -> Ident.t
val print : Stdlib.Format.formatter -> t -> unit
val heads : t -> Ident.t list
val last : t -> string
val is_constructor_typath : t -> bool
module Map : Map.S with type key = t
module Set : Set.S with type elt = t
diff --git a/ocaml/Patterns/General/index.html b/ocaml/Patterns/General/index.html new file mode 100644 index 00000000..1088217d --- /dev/null +++ b/ocaml/Patterns/General/index.html @@ -0,0 +1,2 @@ + +General (ocaml.Patterns.General)

Module Patterns.General

type view = [
  1. | Half_simple.view
  2. | `Var of Ident.t * string Asttypes.loc
  3. | `Alias of Typedtree.pattern * Ident.t * string Asttypes.loc
]
val strip_vars : pattern -> Half_simple.pattern
diff --git a/ocaml/Patterns/Half_simple/index.html b/ocaml/Patterns/Half_simple/index.html new file mode 100644 index 00000000..f92b727d --- /dev/null +++ b/ocaml/Patterns/Half_simple/index.html @@ -0,0 +1,2 @@ + +Half_simple (ocaml.Patterns.Half_simple)

Module Patterns.Half_simple

diff --git a/ocaml/Patterns/Head/index.html b/ocaml/Patterns/Head/index.html new file mode 100644 index 00000000..647a42d8 --- /dev/null +++ b/ocaml/Patterns/Head/index.html @@ -0,0 +1,2 @@ + +Head (ocaml.Patterns.Head)

Module Patterns.Head

type desc =
  1. | Any
  2. | Construct of Types.constructor_description
  3. | Constant of Asttypes.constant
  4. | Tuple of int
  5. | Record of Types.label_description list
  6. | Variant of {
    1. tag : Asttypes.label;
    2. has_arg : bool;
    3. cstr_row : Types.row_desc ref;
    4. type_row : unit -> Types.row_desc;
    }
  7. | Array of int
  8. | Lazy
val arity : t -> int
val deconstruct : Simple.pattern -> t * Typedtree.pattern list

deconstruct p returns the head of p and the list of sub patterns.

  • raises [Invalid_arg

    _] if p is an or- or an exception-pattern.

val to_omega_pattern : t -> Typedtree.pattern

reconstructs a pattern, putting wildcards as sub-patterns.

val omega : t
diff --git a/ocaml/Patterns/Non_empty_row/index.html b/ocaml/Patterns/Non_empty_row/index.html new file mode 100644 index 00000000..c62dda98 --- /dev/null +++ b/ocaml/Patterns/Non_empty_row/index.html @@ -0,0 +1,2 @@ + +Non_empty_row (ocaml.Patterns.Non_empty_row)

Module Patterns.Non_empty_row

type 'a t = 'a * Typedtree.pattern list
val of_initial : Typedtree.pattern list -> Typedtree.pattern t

'assert false' on empty rows

val map_first : ('a -> 'b) -> 'a t -> 'b t
diff --git a/ocaml/Patterns/Simple/index.html b/ocaml/Patterns/Simple/index.html new file mode 100644 index 00000000..850a48f6 --- /dev/null +++ b/ocaml/Patterns/Simple/index.html @@ -0,0 +1,7 @@ + +Simple (ocaml.Patterns.Simple)

Module Patterns.Simple

diff --git a/ocaml/Patterns/index.html b/ocaml/Patterns/index.html new file mode 100644 index 00000000..c4173b5c --- /dev/null +++ b/ocaml/Patterns/index.html @@ -0,0 +1,2 @@ + +Patterns (ocaml.Patterns)

Module Patterns

val omega : Typedtree.pattern

aka. "Tpat_any" or "_"

val omegas : int -> Typedtree.pattern list

List.init (fun _ -> omega)

val omega_list : 'a list -> Typedtree.pattern list

List.map (fun _ -> omega)

module Non_empty_row : sig ... end
module Simple : sig ... end
module Half_simple : sig ... end
module General : sig ... end
module Head : sig ... end
diff --git a/ocaml/Persistent_env/Consistbl/index.html b/ocaml/Persistent_env/Consistbl/index.html new file mode 100644 index 00000000..c58bcf0b --- /dev/null +++ b/ocaml/Persistent_env/Consistbl/index.html @@ -0,0 +1,18 @@ + +Consistbl (ocaml.Persistent_env.Consistbl)

Module Persistent_env.Consistbl

val create : unit -> t
val clear : t -> unit
val check : + t -> + Misc.Stdlib.String.t -> + Stdlib.Digest.t -> + Misc.filepath -> + unit
val check_noadd : + t -> + Misc.Stdlib.String.t -> + Stdlib.Digest.t -> + Misc.filepath -> + unit
val extract : + Misc.Stdlib.String.t list -> + t -> + (Misc.Stdlib.String.t * Stdlib.Digest.t option) list
val filter : (Misc.Stdlib.String.t -> bool) -> t -> unit
exception Inconsistency of {
  1. unit_name : Misc.Stdlib.String.t;
  2. inconsistent_source : string;
  3. original_source : string;
}
exception Not_available of Misc.Stdlib.String.t
diff --git a/ocaml/Persistent_env/Persistent_signature/index.html b/ocaml/Persistent_env/Persistent_signature/index.html new file mode 100644 index 00000000..517d22c6 --- /dev/null +++ b/ocaml/Persistent_env/Persistent_signature/index.html @@ -0,0 +1,2 @@ + +Persistent_signature (ocaml.Persistent_env.Persistent_signature)

Module Persistent_env.Persistent_signature

type t = {
  1. filename : string;
    (*

    Name of the file containing the signature.

    *)
  2. cmi : Cmi_format.cmi_infos;
}
val load : (unit_name:string -> t option) ref

Function used to load a persistent signature. The default is to look for the .cmi file in the load path. This function can be overridden to load it from memory, for instance to build a self-contained toplevel.

diff --git a/ocaml/Persistent_env/index.html b/ocaml/Persistent_env/index.html new file mode 100644 index 00000000..daead360 --- /dev/null +++ b/ocaml/Persistent_env/index.html @@ -0,0 +1,22 @@ + +Persistent_env (ocaml.Persistent_env)

Module Persistent_env

module Consistbl : + module type of struct include Consistbl.Make(Misc.Stdlib.String) end
type error =
  1. | Illegal_renaming of Misc.modname * Misc.modname * Misc.filepath
  2. | Inconsistent_import of Misc.modname * Misc.filepath * Misc.filepath
  3. | Need_recursive_types of Misc.modname
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
module Persistent_signature : sig ... end
type can_load_cmis =
  1. | Can_load_cmis
  2. | Cannot_load_cmis of Lazy_backtrack.log
type 'a t
val empty : unit -> 'a t
val clear : 'a t -> unit
val clear_missing : 'a t -> unit
val fold : 'a t -> (Misc.modname -> 'a -> 'b -> 'b) -> 'b -> 'b
val read : + 'a t -> + (Persistent_signature.t -> 'a) -> + Misc.modname -> + Misc.filepath -> + 'a
val find : 'a t -> (Persistent_signature.t -> 'a) -> Misc.modname -> 'a
val find_in_cache : 'a t -> Misc.modname -> 'a option
val check : + 'a t -> + (Persistent_signature.t -> 'a) -> + loc:Location.t -> + Misc.modname -> + unit
val looked_up : 'a t -> Misc.modname -> bool
val is_imported : 'a t -> Misc.modname -> bool
val is_imported_opaque : 'a t -> Misc.modname -> bool
val register_import_as_opaque : 'a t -> Misc.modname -> unit
val make_cmi : + 'a t -> + Misc.modname -> + Types.signature -> + Misc.alerts -> + Cmi_format.cmi_infos
val save_cmi : 'a t -> Persistent_signature.t -> 'a -> unit
val can_load_cmis : 'a t -> can_load_cmis
val set_can_load_cmis : 'a t -> can_load_cmis -> unit
val without_cmis : 'a t -> ('b -> 'c) -> 'b -> 'c
val import_crcs : 'a t -> source:Misc.filepath -> Misc.crcs -> unit
val imports : 'a t -> Misc.crcs
val crc_of_unit : + 'a t -> + (Persistent_signature.t -> 'a) -> + Misc.modname -> + Stdlib.Digest.t
val add_delayed_check_forward : ((unit -> unit) -> unit) ref
diff --git a/ocaml/Polling/index.html b/ocaml/Polling/index.html new file mode 100644 index 00000000..f1174209 --- /dev/null +++ b/ocaml/Polling/index.html @@ -0,0 +1,9 @@ + +Polling (ocaml.Polling)

Module Polling

Analyses related to the insertion of Ipoll operations.

val instrument_fundecl : + future_funcnames:Misc.Stdlib.String.Set.t -> + Mach.fundecl -> + Mach.fundecl
val requires_prologue_poll : + future_funcnames:Misc.Stdlib.String.Set.t -> + fun_name:string -> + Mach.instruction -> + bool
diff --git a/ocaml/Pparse/index.html b/ocaml/Pparse/index.html new file mode 100644 index 00000000..100ad417 --- /dev/null +++ b/ocaml/Pparse/index.html @@ -0,0 +1,20 @@ + +Pparse (ocaml.Pparse)

Module Pparse

Driver for the parser and external preprocessors.

Warning: this module is unstable and part of compiler-libs.

type error =
  1. | CannotRun of string
  2. | WrongMagic of string
exception Error of error
val preprocess : string -> string
val remove_preprocessed : string -> unit
type 'a ast_kind =
  1. | Structure : Parsetree.structure ast_kind
  2. | Signature : Parsetree.signature ast_kind
val read_ast : 'a ast_kind -> string -> 'a
val write_ast : 'a ast_kind -> string -> 'a -> unit
val file : + tool_name:string -> + string -> + (Stdlib.Lexing.lexbuf -> 'a) -> + 'a ast_kind -> + 'a
val apply_rewriters : + ?restore:bool -> + tool_name:string -> + 'a ast_kind -> + 'a -> + 'a

If restore = true (the default), cookies set by external rewriters will be kept for later calls.

val apply_rewriters_str : + ?restore:bool -> + tool_name:string -> + Parsetree.structure -> + Parsetree.structure
val apply_rewriters_sig : + ?restore:bool -> + tool_name:string -> + Parsetree.signature -> + Parsetree.signature
val report_error : Stdlib.Format.formatter -> error -> unit
val parse_implementation : tool_name:string -> string -> Parsetree.structure
val parse_interface : tool_name:string -> string -> Parsetree.signature
val call_external_preprocessor : string -> string -> string
val open_and_check_magic : string -> string -> in_channel * bool
diff --git a/ocaml/Pprintast/index.html b/ocaml/Pprintast/index.html new file mode 100644 index 00000000..a8284809 --- /dev/null +++ b/ocaml/Pprintast/index.html @@ -0,0 +1,14 @@ + +Pprintast (ocaml.Pprintast)

Module Pprintast

Pretty-printers for Parsetree

Warning: this module is unstable and part of compiler-libs.

type space_formatter = (unit, Stdlib.Format.formatter, unit) format
val longident : Stdlib.Format.formatter -> Longident.t -> unit
val expression : Stdlib.Format.formatter -> Parsetree.expression -> unit
val string_of_expression : Parsetree.expression -> string
val core_type : Stdlib.Format.formatter -> Parsetree.core_type -> unit
val signature : Stdlib.Format.formatter -> Parsetree.signature -> unit
val structure : Stdlib.Format.formatter -> Parsetree.structure -> unit
val string_of_structure : Parsetree.structure -> string
val module_expr : Stdlib.Format.formatter -> Parsetree.module_expr -> unit
val toplevel_phrase : + Stdlib.Format.formatter -> + Parsetree.toplevel_phrase -> + unit
val class_field : Stdlib.Format.formatter -> Parsetree.class_field -> unit
val class_type_field : + Stdlib.Format.formatter -> + Parsetree.class_type_field -> + unit
val class_expr : Stdlib.Format.formatter -> Parsetree.class_expr -> unit
val class_type : Stdlib.Format.formatter -> Parsetree.class_type -> unit
val module_type : Stdlib.Format.formatter -> Parsetree.module_type -> unit
val structure_item : + Stdlib.Format.formatter -> + Parsetree.structure_item -> + unit
val signature_item : + Stdlib.Format.formatter -> + Parsetree.signature_item -> + unit
val tyvar : Stdlib.Format.formatter -> string -> unit

Print a type variable name, taking care of the special treatment required for the single quote character in second position.

diff --git a/ocaml/Predef/index.html b/ocaml/Predef/index.html new file mode 100644 index 00000000..5dd4fb1e --- /dev/null +++ b/ocaml/Predef/index.html @@ -0,0 +1,6 @@ + +Predef (ocaml.Predef)

Module Predef

val type_int : Types.type_expr
val type_char : Types.type_expr
val type_string : Types.type_expr
val type_bytes : Types.type_expr
val type_float : Types.type_expr
val type_bool : Types.type_expr
val type_unit : Types.type_expr
val type_exn : Types.type_expr
val type_array : Types.type_expr -> Types.type_expr
val type_list : Types.type_expr -> Types.type_expr
val type_option : Types.type_expr -> Types.type_expr
val type_nativeint : Types.type_expr
val type_int32 : Types.type_expr
val type_int64 : Types.type_expr
val type_lazy_t : Types.type_expr -> Types.type_expr
val type_extension_constructor : Types.type_expr
val type_floatarray : Types.type_expr
val path_int : Path.t
val path_char : Path.t
val path_string : Path.t
val path_bytes : Path.t
val path_float : Path.t
val path_bool : Path.t
val path_unit : Path.t
val path_exn : Path.t
val path_array : Path.t
val path_list : Path.t
val path_option : Path.t
val path_nativeint : Path.t
val path_int32 : Path.t
val path_int64 : Path.t
val path_lazy_t : Path.t
val path_extension_constructor : Path.t
val path_floatarray : Path.t
val path_match_failure : Path.t
val path_assert_failure : Path.t
val path_undefined_recursive_module : Path.t
val ident_false : Ident.t
val ident_true : Ident.t
val ident_void : Ident.t
val ident_nil : Ident.t
val ident_cons : Ident.t
val ident_none : Ident.t
val ident_some : Ident.t
val build_initial_env : + (Ident.t -> Types.type_declaration -> 'a -> 'a) -> + (Ident.t -> Types.extension_constructor -> 'a -> 'a) -> + 'a -> + 'a
val builtin_values : (string * Ident.t) list
val builtin_idents : (string * Ident.t) list
val ident_division_by_zero : Ident.t

All predefined exceptions, exposed as Ident.t for flambda (for building value approximations). The Ident.t for division by zero is also exported explicitly so flambda can generate code to raise it.

val all_predef_exns : Ident.t list
diff --git a/ocaml/Primitive/index.html b/ocaml/Primitive/index.html new file mode 100644 index 00000000..8a9fb11e --- /dev/null +++ b/ocaml/Primitive/index.html @@ -0,0 +1,12 @@ + +Primitive (ocaml.Primitive)

Module Primitive

type boxed_integer =
  1. | Pnativeint
  2. | Pint32
  3. | Pint64
type native_repr =
  1. | Same_as_ocaml_repr
  2. | Unboxed_float
  3. | Unboxed_integer of boxed_integer
  4. | Untagged_int
type description = private {
  1. prim_name : string;
  2. prim_arity : int;
  3. prim_alloc : bool;
  4. prim_native_name : string;
  5. prim_native_repr_args : native_repr list;
  6. prim_native_repr_res : native_repr;
}
val simple : name:string -> arity:int -> alloc:bool -> description
val make : + name:string -> + alloc:bool -> + native_name:string -> + native_repr_args:native_repr list -> + native_repr_res:native_repr -> + description
val parse_declaration : + Parsetree.value_description -> + native_repr_args:native_repr list -> + native_repr_res:native_repr -> + description
val native_name : description -> string
val byte_name : description -> string
val equal_boxed_integer : boxed_integer -> boxed_integer -> bool
val equal_native_repr : native_repr -> native_repr -> bool
val native_name_is_external : description -> bool

native_name_is_externa returns true iff the native_name for the given primitive identifies that the primitive is not implemented in the compiler itself.

type error =
  1. | Old_style_float_with_native_repr_attribute
  2. | Old_style_noalloc_with_noalloc_attribute
  3. | No_native_primitive_with_repr_attribute
exception Error of Location.t * error
diff --git a/ocaml/Printast/index.html b/ocaml/Printast/index.html new file mode 100644 index 00000000..2e3aeea1 --- /dev/null +++ b/ocaml/Printast/index.html @@ -0,0 +1,8 @@ + +Printast (ocaml.Printast)

Module Printast

Raw printer for Parsetree

Warning: this module is unstable and part of compiler-libs.

val interface : + Stdlib.Format.formatter -> + Parsetree.signature_item list -> + unit
val implementation : + Stdlib.Format.formatter -> + Parsetree.structure_item list -> + unit
val expression : int -> Stdlib.Format.formatter -> Parsetree.expression -> unit
val structure : int -> Stdlib.Format.formatter -> Parsetree.structure -> unit
val payload : int -> Stdlib.Format.formatter -> Parsetree.payload -> unit
diff --git a/ocaml/Printclambda/index.html b/ocaml/Printclambda/index.html new file mode 100644 index 00000000..149db195 --- /dev/null +++ b/ocaml/Printclambda/index.html @@ -0,0 +1,8 @@ + +Printclambda (ocaml.Printclambda)

Module Printclambda

val clambda : Stdlib.Format.formatter -> Clambda.ulambda -> unit
val structured_constant : + Stdlib.Format.formatter -> + Clambda.ustructured_constant -> + unit
val phantom_defining_expr_opt : + Stdlib.Format.formatter -> + Clambda.uphantom_defining_expr option -> + unit
diff --git a/ocaml/Printclambda_primitives/index.html b/ocaml/Printclambda_primitives/index.html new file mode 100644 index 00000000..a053d52d --- /dev/null +++ b/ocaml/Printclambda_primitives/index.html @@ -0,0 +1,2 @@ + +Printclambda_primitives (ocaml.Printclambda_primitives)

Module Printclambda_primitives

diff --git a/ocaml/Printcmm/index.html b/ocaml/Printcmm/index.html new file mode 100644 index 00000000..304fd744 --- /dev/null +++ b/ocaml/Printcmm/index.html @@ -0,0 +1,8 @@ + +Printcmm (ocaml.Printcmm)

Module Printcmm

val rec_flag : Stdlib.Format.formatter -> Cmm.rec_flag -> unit
val machtype_component : + Stdlib.Format.formatter -> + Cmm.machtype_component -> + unit
val machtype : Stdlib.Format.formatter -> Cmm.machtype -> unit
val exttype : Stdlib.Format.formatter -> Cmm.exttype -> unit
val extcall_signature : + Stdlib.Format.formatter -> + (Cmm.machtype * Cmm.exttype list) -> + unit
val integer_comparison : Cmm.integer_comparison -> string
val float_comparison : Cmm.float_comparison -> string
val chunk : Cmm.memory_chunk -> string
val operation : Debuginfo.t -> Cmm.operation -> string
val expression : Stdlib.Format.formatter -> Cmm.expression -> unit
val fundecl : Stdlib.Format.formatter -> Cmm.fundecl -> unit
val data : Stdlib.Format.formatter -> Cmm.data_item list -> unit
val phrase : Stdlib.Format.formatter -> Cmm.phrase -> unit
diff --git a/ocaml/Printinstr/index.html b/ocaml/Printinstr/index.html new file mode 100644 index 00000000..da2147b7 --- /dev/null +++ b/ocaml/Printinstr/index.html @@ -0,0 +1,2 @@ + +Printinstr (ocaml.Printinstr)

Module Printinstr

val instruction : Stdlib.Format.formatter -> Instruct.instruction -> unit
val instrlist : Stdlib.Format.formatter -> Instruct.instruction list -> unit
diff --git a/ocaml/Printlambda/index.html b/ocaml/Printlambda/index.html new file mode 100644 index 00000000..f24e7e77 --- /dev/null +++ b/ocaml/Printlambda/index.html @@ -0,0 +1,20 @@ + +Printlambda (ocaml.Printlambda)

Module Printlambda

val integer_comparison : + Stdlib.Format.formatter -> + Lambda.integer_comparison -> + unit
val float_comparison : + Stdlib.Format.formatter -> + Lambda.float_comparison -> + unit
val structured_constant : + Stdlib.Format.formatter -> + Lambda.structured_constant -> + unit
val lambda : Stdlib.Format.formatter -> Lambda.lambda -> unit
val program : Stdlib.Format.formatter -> Lambda.program -> unit
val primitive : Stdlib.Format.formatter -> Lambda.primitive -> unit
val name_of_primitive : Lambda.primitive -> string
val value_kind : Stdlib.Format.formatter -> Lambda.value_kind -> unit
val block_shape : + Stdlib.Format.formatter -> + Lambda.value_kind list option -> + unit
val print_bigarray : + string -> + bool -> + Lambda.bigarray_kind -> + Stdlib.Format.formatter -> + Lambda.bigarray_layout -> + unit
diff --git a/ocaml/Printlinear/index.html b/ocaml/Printlinear/index.html new file mode 100644 index 00000000..5ac29152 --- /dev/null +++ b/ocaml/Printlinear/index.html @@ -0,0 +1,2 @@ + +Printlinear (ocaml.Printlinear)

Module Printlinear

diff --git a/ocaml/Printmach/index.html b/ocaml/Printmach/index.html new file mode 100644 index 00000000..0fe30148 --- /dev/null +++ b/ocaml/Printmach/index.html @@ -0,0 +1,7 @@ + +Printmach (ocaml.Printmach)

Module Printmach

val reg : Stdlib.Format.formatter -> Reg.t -> unit
val regs : Stdlib.Format.formatter -> Reg.t array -> unit
val regset : Stdlib.Format.formatter -> Reg.Set.t -> unit
val regsetaddr : Stdlib.Format.formatter -> Reg.Set.t -> unit
val operation : + Mach.operation -> + Reg.t array -> + Stdlib.Format.formatter -> + Reg.t array -> + unit
val test : Mach.test -> Stdlib.Format.formatter -> Reg.t array -> unit
val fundecl : Stdlib.Format.formatter -> Mach.fundecl -> unit
val phase : string -> Stdlib.Format.formatter -> Mach.fundecl -> unit
val interferences : Stdlib.Format.formatter -> unit -> unit
val intervals : Stdlib.Format.formatter -> Interval.result -> unit
val preferences : Stdlib.Format.formatter -> unit -> unit
diff --git a/ocaml/Printpat/index.html b/ocaml/Printpat/index.html new file mode 100644 index 00000000..8eea8d2a --- /dev/null +++ b/ocaml/Printpat/index.html @@ -0,0 +1,11 @@ + +Printpat (ocaml.Printpat)

Module Printpat

val pretty_const : Asttypes.constant -> string
val top_pretty : + Stdlib.Format.formatter -> + 'k Typedtree.general_pattern -> + unit
val pretty_pat : 'k Typedtree.general_pattern -> unit
val pretty_line : + Stdlib.Format.formatter -> + 'k Typedtree.general_pattern list -> + unit
val pretty_matrix : + Stdlib.Format.formatter -> + 'k Typedtree.general_pattern list list -> + unit
diff --git a/ocaml/Printtyp/Conflicts/index.html b/ocaml/Printtyp/Conflicts/index.html new file mode 100644 index 00000000..49f51bf0 --- /dev/null +++ b/ocaml/Printtyp/Conflicts/index.html @@ -0,0 +1,5 @@ + +Conflicts (ocaml.Printtyp.Conflicts)

Module Printtyp.Conflicts

The Conflicts module keeps track of conflicts arising when attributing names to identifiers and provides functions that can print explanations for these conflict in error messages

val exists : unit -> bool

exists() returns true if the current naming context renamed an identifier to avoid a name collision

type explanation = {
  1. kind : Shape.Sig_component_kind.t;
  2. name : string;
  3. root_name : string;
  4. location : Location.t;
}
val list_explanations : unit -> explanation list

list_explanations() return the list of conflict explanations collected up to this point, and reset the list of collected explanations

val print_located_explanations : + Stdlib.Format.formatter -> + explanation list -> + unit
val print_explanations : Stdlib.Format.formatter -> unit

Print all conflict explanations collected up to this point

val reset : unit -> unit
diff --git a/ocaml/Printtyp/Naming_context/index.html b/ocaml/Printtyp/Naming_context/index.html new file mode 100644 index 00000000..769fb01f --- /dev/null +++ b/ocaml/Printtyp/Naming_context/index.html @@ -0,0 +1,2 @@ + +Naming_context (ocaml.Printtyp.Naming_context)

Module Printtyp.Naming_context

val enable : bool -> unit

When contextual names are enabled, the mapping between identifiers and names is ensured to be one-to-one.

diff --git a/ocaml/Printtyp/Out_name/index.html b/ocaml/Printtyp/Out_name/index.html new file mode 100644 index 00000000..640df783 --- /dev/null +++ b/ocaml/Printtyp/Out_name/index.html @@ -0,0 +1,2 @@ + +Out_name (ocaml.Printtyp.Out_name)

Module Printtyp.Out_name

val create : string -> Outcometree.out_name
val print : Outcometree.out_name -> string
diff --git a/ocaml/Printtyp/Subtype/index.html b/ocaml/Printtyp/Subtype/index.html new file mode 100644 index 00000000..9f19e81d --- /dev/null +++ b/ocaml/Printtyp/Subtype/index.html @@ -0,0 +1,7 @@ + +Subtype (ocaml.Printtyp.Subtype)

Module Printtyp.Subtype

val report_error : + Stdlib.Format.formatter -> + Env.t -> + Errortrace.Subtype.error -> + string -> + unit
diff --git a/ocaml/Printtyp/index.html b/ocaml/Printtyp/index.html new file mode 100644 index 00000000..d2c026e0 --- /dev/null +++ b/ocaml/Printtyp/index.html @@ -0,0 +1,132 @@ + +Printtyp (ocaml.Printtyp)

Module Printtyp

val longident : Stdlib.Format.formatter -> Longident.t -> unit
val ident : Stdlib.Format.formatter -> Ident.t -> unit
val namespaced_ident : Shape.Sig_component_kind.t -> Ident.t -> string
val tree_of_path : Path.t -> Outcometree.out_ident
val path : Stdlib.Format.formatter -> Path.t -> unit
val string_of_path : Path.t -> string
val type_path : Stdlib.Format.formatter -> Path.t -> unit

Print a type path taking account of -short-paths. Calls should be within wrap_printing_env.

module Out_name : sig ... end
type namespace := Shape.Sig_component_kind.t option
val strings_of_paths : namespace -> Path.t list -> string list

Print a list of paths, using the same naming context to avoid name collisions

val raw_type_expr : Stdlib.Format.formatter -> Types.type_expr -> unit
val string_of_label : Asttypes.arg_label -> string
val wrap_printing_env : error:bool -> Env.t -> (unit -> 'a) -> 'a
module Naming_context : sig ... end
module Conflicts : sig ... end

The Conflicts module keeps track of conflicts arising when attributing names to identifiers and provides functions that can print explanations for these conflict in error messages

val reset : unit -> unit
val type_expr : Stdlib.Format.formatter -> Types.type_expr -> unit

Print out a type. This will pick names for type variables, and will not reuse names for common type variables shared across multiple type expressions. (It will also reset the printing state, which matters for other type formatters such as prepared_type_expr.) If you want multiple types to use common names for type variables, see prepare_for_printing and prepared_type_expr.

val prepare_for_printing : Types.type_expr list -> unit

prepare_for_printing resets the global printing environment, a la reset, and prepares the types for printing by reserving names and marking loops. Any type variables that are shared between multiple types in the input list will be given the same name when printed with prepared_type_expr.

val add_type_to_preparation : Types.type_expr -> unit

add_type_to_preparation ty extend a previous type expression preparation to the type expression ty

val prepared_type_expr : Stdlib.Format.formatter -> Types.type_expr -> unit

The function prepared_type_expr is a less-safe but more-flexible version of type_expr that should only be called on type_exprs that have been passed to prepare_for_printing. Unlike type_expr, this function does no extra work before printing a type; in particular, this means that any loops in the type expression may cause a stack overflow (see #8860) since this function does not mark any loops. The benefit of this is that if multiple type expressions are prepared simultaneously and then printed with prepared_type_expr, they will use the same names for the same type variables.

val constructor_arguments : + Stdlib.Format.formatter -> + Types.constructor_arguments -> + unit
val tree_of_type_scheme : Types.type_expr -> Outcometree.out_type
val type_scheme : Stdlib.Format.formatter -> Types.type_expr -> unit
val prepared_type_scheme : Stdlib.Format.formatter -> Types.type_expr -> unit
val shared_type_scheme : Stdlib.Format.formatter -> Types.type_expr -> unit

shared_type_scheme is very similar to type_scheme, but does not reset the printing context first. This is intended to be used in cases where the printing should have a particularly wide context, such as documentation generators; most use cases, such as error messages, have narrower contexts for which type_scheme is better suited.

val tree_of_value_description : + Ident.t -> + Types.value_description -> + Outcometree.out_sig_item
val value_description : + Ident.t -> + Stdlib.Format.formatter -> + Types.value_description -> + unit
val add_constructor_to_preparation : Types.constructor_declaration -> unit
val prepared_constructor : + Stdlib.Format.formatter -> + Types.constructor_declaration -> + unit
val constructor : + Stdlib.Format.formatter -> + Types.constructor_declaration -> + unit
val tree_of_type_declaration : + Ident.t -> + Types.type_declaration -> + Types.rec_status -> + Outcometree.out_sig_item
val add_type_declaration_to_preparation : + Ident.t -> + Types.type_declaration -> + unit
val prepared_type_declaration : + Ident.t -> + Stdlib.Format.formatter -> + Types.type_declaration -> + unit
val type_declaration : + Ident.t -> + Stdlib.Format.formatter -> + Types.type_declaration -> + unit
val tree_of_extension_constructor : + Ident.t -> + Types.extension_constructor -> + Types.ext_status -> + Outcometree.out_sig_item
val add_extension_constructor_to_preparation : + Types.extension_constructor -> + unit
val prepared_extension_constructor : + Ident.t -> + Stdlib.Format.formatter -> + Types.extension_constructor -> + unit
val extension_constructor : + Ident.t -> + Stdlib.Format.formatter -> + Types.extension_constructor -> + unit
val extension_only_constructor : + Ident.t -> + Stdlib.Format.formatter -> + Types.extension_constructor -> + unit
val tree_of_module : + Ident.t -> + ?ellipsis:bool -> + Types.module_type -> + Types.rec_status -> + Outcometree.out_sig_item
val signature : Stdlib.Format.formatter -> Types.signature -> unit
val tree_of_modtype_declaration : + Ident.t -> + Types.modtype_declaration -> + Outcometree.out_sig_item
val functor_parameters : + sep:(Stdlib.Format.formatter -> unit -> unit) -> + ('b -> Stdlib.Format.formatter -> unit) -> + (Ident.t option * 'b) list -> + Stdlib.Format.formatter -> + unit

Print a list of functor parameters while adjusting the printing environment for each functor argument.

Currently, we are disabling disambiguation for functor argument name to avoid the need to track the moving association between identifiers and syntactic names in situation like:

got: (X: sig module type T end) (Y:X.T) (X:sig module type T end) (Z:X.T) expect: (_: sig end) (Y:X.T) (_:sig end) (Z:X.T)

type type_or_scheme =
  1. | Type
  2. | Type_scheme
val tree_of_signature : Types.signature -> Outcometree.out_sig_item list
val modtype_declaration : + Ident.t -> + Stdlib.Format.formatter -> + Types.modtype_declaration -> + unit
val class_type : Stdlib.Format.formatter -> Types.class_type -> unit
val tree_of_class_declaration : + Ident.t -> + Types.class_declaration -> + Types.rec_status -> + Outcometree.out_sig_item
val class_declaration : + Ident.t -> + Stdlib.Format.formatter -> + Types.class_declaration -> + unit
val tree_of_cltype_declaration : + Ident.t -> + Types.class_type_declaration -> + Types.rec_status -> + Outcometree.out_sig_item
val cltype_declaration : + Ident.t -> + Stdlib.Format.formatter -> + Types.class_type_declaration -> + unit
val type_expansion : + type_or_scheme -> + Stdlib.Format.formatter -> + Errortrace.expanded_type -> + unit
val report_ambiguous_type_error : + Stdlib.Format.formatter -> + Env.t -> + (Path.t * Path.t) -> + (Path.t * Path.t) list -> + (Stdlib.Format.formatter -> unit) -> + (Stdlib.Format.formatter -> unit) -> + (Stdlib.Format.formatter -> unit) -> + unit
val report_unification_error : + Stdlib.Format.formatter -> + Env.t -> + Errortrace.unification_error -> + ?type_expected_explanation:(Stdlib.Format.formatter -> unit) -> + (Stdlib.Format.formatter -> unit) -> + (Stdlib.Format.formatter -> unit) -> + unit
val report_equality_error : + Stdlib.Format.formatter -> + type_or_scheme -> + Env.t -> + Errortrace.equality_error -> + (Stdlib.Format.formatter -> unit) -> + (Stdlib.Format.formatter -> unit) -> + unit
val report_moregen_error : + Stdlib.Format.formatter -> + type_or_scheme -> + Env.t -> + Errortrace.moregen_error -> + (Stdlib.Format.formatter -> unit) -> + (Stdlib.Format.formatter -> unit) -> + unit
val report_comparison_error : + Stdlib.Format.formatter -> + type_or_scheme -> + Env.t -> + Errortrace.comparison_error -> + (Stdlib.Format.formatter -> unit) -> + (Stdlib.Format.formatter -> unit) -> + unit
module Subtype : sig ... end
val print_items : + (Env.t -> Types.signature_item -> 'a option) -> + Env.t -> + Types.signature_item list -> + (Outcometree.out_sig_item * 'a option) list
val rewrite_double_underscore_paths : Env.t -> Path.t -> Path.t
val printed_signature : + string -> + Stdlib.Format.formatter -> + Types.signature -> + unit

printed_signature sourcefile ppf sg print the signature sg of sourcefile with potential warnings for name collisions

diff --git a/ocaml/Printtyped/index.html b/ocaml/Printtyped/index.html new file mode 100644 index 00000000..28eb4107 --- /dev/null +++ b/ocaml/Printtyped/index.html @@ -0,0 +1,5 @@ + +Printtyped (ocaml.Printtyped)

Module Printtyped

val interface : Stdlib.Format.formatter -> Typedtree.signature -> unit
val implementation : Stdlib.Format.formatter -> Typedtree.structure -> unit
val implementation_with_coercion : + Stdlib.Format.formatter -> + Typedtree.implementation -> + unit
diff --git a/ocaml/Proc/index.html b/ocaml/Proc/index.html new file mode 100644 index 00000000..97fe6164 --- /dev/null +++ b/ocaml/Proc/index.html @@ -0,0 +1,2 @@ + +Proc (ocaml.Proc)

Module Proc

val word_addressed : bool
val num_register_classes : int
val register_class : Reg.t -> int
val num_available_registers : int array
val first_available_register : int array
val register_name : int -> string
val phys_reg : int -> Reg.t
val rotate_registers : bool
val loc_arguments : Cmm.machtype -> Reg.t array * int
val loc_results : Cmm.machtype -> Reg.t array
val loc_parameters : Cmm.machtype -> Reg.t array
val loc_external_arguments : Cmm.exttype list -> Reg.t array array * int
val loc_external_results : Cmm.machtype -> Reg.t array
val loc_exn_bucket : Reg.t
val max_arguments_for_tailcalls : int
val safe_register_pressure : Mach.operation -> int
val max_register_pressure : Mach.operation -> int array
val destroyed_at_oper : Mach.instruction_desc -> Reg.t array
val destroyed_at_raise : Reg.t array
val destroyed_at_reloadretaddr : Reg.t array
val frame_required : Mach.fundecl -> bool
val prologue_required : Mach.fundecl -> bool
val dwarf_register_numbers : reg_class:int -> int array

For a given register class, the DWARF register numbering for that class. Given an allocated register with location Reg n and class reg_class, the returned array contains the corresponding DWARF register number at index n - first_available_register.(reg_class).

val stack_ptr_dwarf_register_number : int

The DWARF register number corresponding to the stack pointer.

val assemble_file : string -> string -> int
val init : unit -> unit
diff --git a/ocaml/Profile/index.html b/ocaml/Profile/index.html new file mode 100644 index 00000000..6b6b5b5a --- /dev/null +++ b/ocaml/Profile/index.html @@ -0,0 +1,2 @@ + +Profile (ocaml.Profile)

Module Profile

Compiler performance recording

Warning: this module is unstable and part of compiler-libs.

type file = string
val reset : unit -> unit

erase all recorded profile information

val record_call : ?accumulate:bool -> string -> (unit -> 'a) -> 'a

record_call pass f calls f and records its profile information.

val record : ?accumulate:bool -> string -> ('a -> 'b) -> 'a -> 'b

record pass f arg records the profile information of f arg

type column = [
  1. | `Time
  2. | `Alloc
  3. | `Top_heap
  4. | `Abs_top_heap
]
val print : Stdlib.Format.formatter -> column list -> unit

Prints the selected recorded profiling information to the formatter.

Command line flags

val options_doc : string
val all_columns : column list

A few pass names that are needed in several places, and shared to avoid typos.

val generate : string
val transl : string
val typing : string
diff --git a/ocaml/Profiling/index.html b/ocaml/Profiling/index.html new file mode 100644 index 00000000..c645e862 --- /dev/null +++ b/ocaml/Profiling/index.html @@ -0,0 +1,2 @@ + +Profiling (ocaml.Profiling)

Module Profiling

val counters : (string * (string * int array)) list ref
val incr : int array -> int -> unit
diff --git a/ocaml/Projection/Map/index.html b/ocaml/Projection/Map/index.html new file mode 100644 index 00000000..6e195f11 --- /dev/null +++ b/ocaml/Projection/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Projection.Map)

Module Projection.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Projection/Set/index.html b/ocaml/Projection/Set/index.html new file mode 100644 index 00000000..f2606ea9 --- /dev/null +++ b/ocaml/Projection/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Projection.Set)

Module Projection.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Projection/T/index.html b/ocaml/Projection/T/index.html new file mode 100644 index 00000000..a0403af1 --- /dev/null +++ b/ocaml/Projection/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Projection.T)

Module Projection.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Projection/Tbl/index.html b/ocaml/Projection/Tbl/index.html new file mode 100644 index 00000000..d0983570 --- /dev/null +++ b/ocaml/Projection/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Projection.Tbl)

Module Projection.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Projection/index.html b/ocaml/Projection/index.html new file mode 100644 index 00000000..eb385de5 --- /dev/null +++ b/ocaml/Projection/index.html @@ -0,0 +1,8 @@ + +Projection (ocaml.Projection)

Module Projection

Representation of projections from closures and blocks.

type project_closure = {
  1. set_of_closures : Variable.t;
    (*

    must yield a set of closures

    *)
  2. closure_id : Closure_id.t;
}

The selection of one closure given a set of closures, required before a function defined by said set of closures can be applied. See more detailed documentation below on set_of_closures.

type move_within_set_of_closures = {
  1. closure : Variable.t;
    (*

    must yield a closure

    *)
  2. start_from : Closure_id.t;
  3. move_to : Closure_id.t;
}

The selection of one closure given another closure in the same set of closures. See more detailed documentation below on set_of_closures. The move_to closure must be part of the free variables of start_from.

type project_var = {
  1. closure : Variable.t;
    (*

    must yield a closure

    *)
  2. closure_id : Closure_id.t;
  3. var : Var_within_closure.t;
}

The selection from a closure of a variable bound by said closure. In other words, access to a function's environment. Also see more detailed documentation below on set_of_closures.

val print_project_closure : Stdlib.Format.formatter -> project_closure -> unit
val print_move_within_set_of_closures : + Stdlib.Format.formatter -> + move_within_set_of_closures -> + unit
val print_project_var : Stdlib.Format.formatter -> project_var -> unit
val compare_project_var : project_var -> project_var -> int
val compare_project_closure : project_closure -> project_closure -> int
val compare_move_within_set_of_closures : + move_within_set_of_closures -> + move_within_set_of_closures -> + int
type t =
  1. | Project_var of project_var
  2. | Project_closure of project_closure
  3. | Move_within_set_of_closures of move_within_set_of_closures
  4. | Field of int * Variable.t
include Identifiable.S with type t := t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val projecting_from : t -> Variable.t

Return which variable the given projection projects from.

val map_projecting_from : t -> f:(Variable.t -> Variable.t) -> t

Change the variable that the given projection projects from.

diff --git a/ocaml/Rec_check/index.html b/ocaml/Rec_check/index.html new file mode 100644 index 00000000..df903435 --- /dev/null +++ b/ocaml/Rec_check/index.html @@ -0,0 +1,5 @@ + +Rec_check (ocaml.Rec_check)

Module Rec_check

exception Illegal_expr
val is_valid_recursive_expression : + Ident.t list -> + Typedtree.expression -> + bool
val is_valid_class_expr : Ident.t list -> Typedtree.class_expr -> bool
diff --git a/ocaml/Ref_to_variables/index.html b/ocaml/Ref_to_variables/index.html new file mode 100644 index 00000000..b87e6955 --- /dev/null +++ b/ocaml/Ref_to_variables/index.html @@ -0,0 +1,2 @@ + +Ref_to_variables (ocaml.Ref_to_variables)

Module Ref_to_variables

Transform let-bound references into variables.

val eliminate_ref : Flambda.program -> Flambda.program
diff --git a/ocaml/Reg/Map/index.html b/ocaml/Reg/Map/index.html new file mode 100644 index 00000000..d28809e0 --- /dev/null +++ b/ocaml/Reg/Map/index.html @@ -0,0 +1,8 @@ + +Map (ocaml.Reg.Map)

Module Reg.Map

Maps

type key = t

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Reg/Raw_name/index.html b/ocaml/Reg/Raw_name/index.html new file mode 100644 index 00000000..bb708530 --- /dev/null +++ b/ocaml/Reg/Raw_name/index.html @@ -0,0 +1,2 @@ + +Raw_name (ocaml.Reg.Raw_name)

Module Reg.Raw_name

type t
val create_from_var : Backend_var.t -> t
diff --git a/ocaml/Reg/Set/index.html b/ocaml/Reg/Set/index.html new file mode 100644 index 00000000..4ffcb449 --- /dev/null +++ b/ocaml/Reg/Set/index.html @@ -0,0 +1,3 @@ + +Set (ocaml.Reg.Set)

Module Reg.Set

Sets

type elt = t

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Reg/index.html b/ocaml/Reg/index.html new file mode 100644 index 00000000..11fc8616 --- /dev/null +++ b/ocaml/Reg/index.html @@ -0,0 +1,2 @@ + +Reg (ocaml.Reg)

Module Reg

module Raw_name : sig ... end
type t = {
  1. mutable raw_name : Raw_name.t;
  2. stamp : int;
  3. typ : Cmm.machtype_component;
  4. mutable loc : location;
  5. mutable spill : bool;
  6. mutable part : int option;
  7. mutable interf : t list;
  8. mutable prefer : (t * int) list;
  9. mutable degree : int;
  10. mutable spill_cost : int;
  11. mutable visited : int;
}
and location =
  1. | Unknown
  2. | Reg of int
  3. | Stack of stack_location
and stack_location =
  1. | Local of int
  2. | Incoming of int
  3. | Outgoing of int
  4. | Domainstate of int
val dummy : t
val create : Cmm.machtype_component -> t
val createv : Cmm.machtype -> t array
val createv_like : t array -> t array
val clone : t -> t
val at_location : Cmm.machtype_component -> location -> t
val typv : t array -> Cmm.machtype
val anonymous : t -> bool
val name : t -> string
module Set : Set.S with type elt = t
module Map : Map.S with type key = t
val add_set_array : Set.t -> t array -> Set.t
val diff_set_array : Set.t -> t array -> Set.t
val inter_set_array : Set.t -> t array -> Set.t
val disjoint_set_array : Set.t -> t array -> bool
val set_of_array : t array -> Set.t
val reset : unit -> unit
val all_registers : unit -> t list
val num_registers : unit -> int
val reinit : unit -> unit
val mark_visited : t -> unit
val is_visited : t -> bool
val clear_visited_marks : unit -> unit
diff --git a/ocaml/Reload/index.html b/ocaml/Reload/index.html new file mode 100644 index 00000000..8f387a2c --- /dev/null +++ b/ocaml/Reload/index.html @@ -0,0 +1,2 @@ + +Reload (ocaml.Reload)

Module Reload

val fundecl : Mach.fundecl -> int array -> Mach.fundecl * bool
diff --git a/ocaml/Reloadgen/class-reload_generic/index.html b/ocaml/Reloadgen/class-reload_generic/index.html new file mode 100644 index 00000000..9d4bb28d --- /dev/null +++ b/ocaml/Reloadgen/class-reload_generic/index.html @@ -0,0 +1,5 @@ + +reload_generic (ocaml.Reloadgen.reload_generic)

Class Reloadgen.reload_generic

method reload_operation : Mach.operation -> + Reg.t array -> + Reg.t array -> + Reg.t array * Reg.t array
method reload_test : Mach.test -> Reg.t array -> Reg.t array
method makereg : Reg.t -> Reg.t
method makeregs : Reg.t array -> Reg.t array
method fundecl : Mach.fundecl -> int array -> Mach.fundecl * bool
diff --git a/ocaml/Reloadgen/index.html b/ocaml/Reloadgen/index.html new file mode 100644 index 00000000..f1be7880 --- /dev/null +++ b/ocaml/Reloadgen/index.html @@ -0,0 +1,2 @@ + +Reloadgen (ocaml.Reloadgen)

Module Reloadgen

class reload_generic : object ... end
diff --git a/ocaml/Remove_free_vars_equal_to_args/index.html b/ocaml/Remove_free_vars_equal_to_args/index.html new file mode 100644 index 00000000..87d26b9f --- /dev/null +++ b/ocaml/Remove_free_vars_equal_to_args/index.html @@ -0,0 +1,5 @@ + +Remove_free_vars_equal_to_args (ocaml.Remove_free_vars_equal_to_args)

Module Remove_free_vars_equal_to_args

Replace free variables in closures known to be equal to specialised arguments of such closures with those specialised arguments.

diff --git a/ocaml/Remove_unused_arguments/index.html b/ocaml/Remove_unused_arguments/index.html new file mode 100644 index 00000000..9ae93605 --- /dev/null +++ b/ocaml/Remove_unused_arguments/index.html @@ -0,0 +1,13 @@ + +Remove_unused_arguments (ocaml.Remove_unused_arguments)

Module Remove_unused_arguments

val separate_unused_arguments_in_closures : + Flambda.program -> + backend:(module Backend_intf.S) -> + Flambda.program

Introduce a stub function to avoid depending on unused arguments.

For instance, it turns let rec fact n unused = + if n = 0 then 1 + else n * fact (n-1) unused into let rec fact' n = + if n = 0 then 1 + else n * fact' (n-1) + and fact n unused = fact' n

val separate_unused_arguments_in_set_of_closures : + Flambda.set_of_closures -> + backend:(module Backend_intf.S) -> + Flambda.set_of_closures option
diff --git a/ocaml/Remove_unused_closure_vars/index.html b/ocaml/Remove_unused_closure_vars/index.html new file mode 100644 index 00000000..fc3d4bc1 --- /dev/null +++ b/ocaml/Remove_unused_closure_vars/index.html @@ -0,0 +1,5 @@ + +Remove_unused_closure_vars (ocaml.Remove_unused_closure_vars)

Module Remove_unused_closure_vars

val remove_unused_closure_variables : + remove_direct_call_surrogates:bool -> + Flambda.program -> + Flambda.program

Eliminate variables bound by sets of closures that are not required. Also eliminate functions within sets of closures that are not required.

diff --git a/ocaml/Remove_unused_program_constructs/index.html b/ocaml/Remove_unused_program_constructs/index.html new file mode 100644 index 00000000..e68375f2 --- /dev/null +++ b/ocaml/Remove_unused_program_constructs/index.html @@ -0,0 +1,2 @@ + +Remove_unused_program_constructs (ocaml.Remove_unused_program_constructs)

Module Remove_unused_program_constructs

val remove_unused_program_constructs : Flambda.program -> Flambda.program
diff --git a/ocaml/Runtime_events/Callbacks/index.html b/ocaml/Runtime_events/Callbacks/index.html new file mode 100644 index 00000000..9aed4e08 --- /dev/null +++ b/ocaml/Runtime_events/Callbacks/index.html @@ -0,0 +1,14 @@ + +Callbacks (ocaml.Runtime_events.Callbacks)

Module Runtime_events.Callbacks

type t

Type of callbacks

val create : + ?runtime_begin:(int -> Timestamp.t -> runtime_phase -> unit) -> + ?runtime_end:(int -> Timestamp.t -> runtime_phase -> unit) -> + ?runtime_counter:(int -> Timestamp.t -> runtime_counter -> int -> unit) -> + ?alloc:(int -> Timestamp.t -> int array -> unit) -> + ?lifecycle:(int -> Timestamp.t -> lifecycle -> int option -> unit) -> + ?lost_events:(int -> int -> unit) -> + unit -> + t

Create a Callback that optionally subscribes to one or more runtime events. The first int supplied to callbacks is the ring buffer index. Each domain owns a single ring buffer for the duration of the domain's existence. After a domain terminates, a newly spawned domain may take ownership of the ring buffer. A runtime_begin callback is called when the runtime enters a new phase (e.g a runtime_begin with EV_MINOR is called at the start of a minor GC). A runtime_end callback is called when the runtime leaves a certain phase. The runtime_counter callback is called when a counter is emitted by the runtime. lifecycle callbacks are called when the ring undergoes a change in lifecycle and a consumer may need to respond. alloc callbacks are currently only called on the instrumented runtime. lost_events callbacks are called if the consumer code detects some unconsumed events have been overwritten.

val add_user_event : + 'a Type.t -> + (int -> Timestamp.t -> 'a User.t -> 'a -> unit) -> + t -> + t

add_user_event ty callback t extends t to additionally subscribe to user events of type ty. When such an event happens, callback is called with the corresponding event and payload.

diff --git a/ocaml/Runtime_events/Timestamp/index.html b/ocaml/Runtime_events/Timestamp/index.html new file mode 100644 index 00000000..7b09d9fe --- /dev/null +++ b/ocaml/Runtime_events/Timestamp/index.html @@ -0,0 +1,2 @@ + +Timestamp (ocaml.Runtime_events.Timestamp)

Module Runtime_events.Timestamp

type t

Type for the int64 timestamp to allow for future changes

val to_int64 : t -> int64
diff --git a/ocaml/Runtime_events/Type/index.html b/ocaml/Runtime_events/Type/index.html new file mode 100644 index 00000000..d30f93eb --- /dev/null +++ b/ocaml/Runtime_events/Type/index.html @@ -0,0 +1,5 @@ + +Type (ocaml.Runtime_events.Type)

Module Runtime_events.Type

type 'a t

The type for a user event content type

val unit : unit t

An event that has no data associated with it

type span =
  1. | Begin
  2. | End
val span : span t

An event that has a beginning and an end

val int : int t

An event containing an integer value

val register : + encode:(bytes -> 'a -> int) -> + decode:(bytes -> int -> 'a) -> + 'a t

Registers a custom type by providing an encoder and a decoder. The encoder writes the value in the provided buffer and returns the number of bytes written. The decoder gets a slice of the buffer of specified length, and returns the decoded value.

The maximum value length is 1024 bytes.

diff --git a/ocaml/Runtime_events/User/index.html b/ocaml/Runtime_events/User/index.html new file mode 100644 index 00000000..f16ef2cf --- /dev/null +++ b/ocaml/Runtime_events/User/index.html @@ -0,0 +1,2 @@ + +User (ocaml.Runtime_events.User)

Module Runtime_events.User

User events is a way for libraries to provide runtime events that can be consumed by other tools. These events can carry known data types or custom values. The current maximum number of user events is 8192.

type tag = ..

The type for a user event tag. Tags are used to discriminate between user events of the same type

type 'value t

The type for a user event. User events describe their tag, carried data type and an unique string-based name

val register : string -> tag -> 'value Type.t -> 'value t

register name tag ty registers a new event with an unique name, carrying a tag and values of type ty

val write : 'value t -> 'value -> unit

write t v records a new event t with value v

val name : _ t -> string

name t is the uniquely identifying name of event t

val tag : 'a t -> tag

tag t is the associated tag of event t, when it is known. An event can be unknown if it was not registered in the consumer program.

diff --git a/ocaml/Runtime_events/index.html b/ocaml/Runtime_events/index.html new file mode 100644 index 00000000..ebf8b145 --- /dev/null +++ b/ocaml/Runtime_events/index.html @@ -0,0 +1,2 @@ + +Runtime_events (ocaml.Runtime_events)

Module Runtime_events

Runtime events - ring buffer-based runtime tracing

This module enables users to enable and subscribe to tracing events from the Garbage Collector and other parts of the OCaml runtime. This can be useful for diagnostic or performance monitoring purposes. This module can be used to subscribe to events for the current process or external processes asynchronously.

When enabled (either via setting the OCAML_RUNTIME_EVENTS_START environment variable or calling Runtime_events.start) a file with the pid of the process and extension .events will be created. By default this is in the current directory but can be over-ridden by the OCAML_RUNTIME_EVENTS_DIR environment variable. Each domain maintains its own ring buffer in a section of the larger file into which it emits events.

There is additionally a set of C APIs in runtime_events.h that can enable zero-impact monitoring of the current process or bindings for other languages.

The runtime events system's behaviour can be controlled by the following environment variables:

  • OCAML_RUNTIME_EVENTS_START if set will cause the runtime events system to be started as part of the OCaml runtime initialization.
  • OCAML_RUNTIME_EVENTS_DIR sets the directory where the runtime events ring buffers will be located. If not present the program's working directory will be used.
  • OCAML_RUNTIME_EVENTS_PRESERVE if set will prevent the OCaml runtime from removing its ring buffers when it terminates. This can help if monitoring very short running programs.
type runtime_counter =
  1. | EV_C_FORCE_MINOR_ALLOC_SMALL
  2. | EV_C_FORCE_MINOR_MAKE_VECT
  3. | EV_C_FORCE_MINOR_SET_MINOR_HEAP_SIZE
  4. | EV_C_FORCE_MINOR_MEMPROF
  5. | EV_C_MINOR_PROMOTED
  6. | EV_C_MINOR_ALLOCATED
  7. | EV_C_REQUEST_MAJOR_ALLOC_SHR
  8. | EV_C_REQUEST_MAJOR_ADJUST_GC_SPEED
  9. | EV_C_REQUEST_MINOR_REALLOC_REF_TABLE
  10. | EV_C_REQUEST_MINOR_REALLOC_EPHE_REF_TABLE
  11. | EV_C_REQUEST_MINOR_REALLOC_CUSTOM_TABLE
  12. | EV_C_MAJOR_HEAP_POOL_WORDS
    (*

    Total words in a Domain's major heap pools. This is the sum of unallocated and live words in each pool.

    • since 5.1
    *)
  13. | EV_C_MAJOR_HEAP_POOL_LIVE_WORDS
    (*

    Current live words in a Domain's major heap pools.

    • since 5.1
    *)
  14. | EV_C_MAJOR_HEAP_LARGE_WORDS
    (*

    Total words of a Domain's major heap large allocations. A large allocation is an allocation larger than the largest sized pool.

    • since 5.1
    *)
  15. | EV_C_MAJOR_HEAP_POOL_FRAG_WORDS
    (*

    Words in a Domain's major heap pools lost to fragmentation. This is due to there not being a pool with the exact size of an allocation and a larger sized pool needing to be used.

    • since 5.1
    *)
  16. | EV_C_MAJOR_HEAP_POOL_LIVE_BLOCKS
    (*

    Live blocks of a Domain's major heap pools.

    • since 5.1
    *)
  17. | EV_C_MAJOR_HEAP_LARGE_BLOCKS
    (*

    Live blocks of a Domain's major heap large allocations.

    • since 5.1
    *)

The type for counter events emitted by the runtime

type runtime_phase =
  1. | EV_EXPLICIT_GC_SET
  2. | EV_EXPLICIT_GC_STAT
  3. | EV_EXPLICIT_GC_MINOR
  4. | EV_EXPLICIT_GC_MAJOR
  5. | EV_EXPLICIT_GC_FULL_MAJOR
  6. | EV_EXPLICIT_GC_COMPACT
  7. | EV_MAJOR
  8. | EV_MAJOR_SWEEP
  9. | EV_MAJOR_MARK_ROOTS
  10. | EV_MAJOR_MARK
  11. | EV_MINOR
  12. | EV_MINOR_LOCAL_ROOTS
  13. | EV_MINOR_FINALIZED
  14. | EV_EXPLICIT_GC_MAJOR_SLICE
  15. | EV_FINALISE_UPDATE_FIRST
  16. | EV_FINALISE_UPDATE_LAST
  17. | EV_INTERRUPT_REMOTE
  18. | EV_MAJOR_EPHE_MARK
  19. | EV_MAJOR_EPHE_SWEEP
  20. | EV_MAJOR_FINISH_MARKING
  21. | EV_MAJOR_GC_CYCLE_DOMAINS
  22. | EV_MAJOR_GC_PHASE_CHANGE
  23. | EV_MAJOR_GC_STW
  24. | EV_MAJOR_MARK_OPPORTUNISTIC
  25. | EV_MAJOR_SLICE
  26. | EV_MAJOR_FINISH_CYCLE
  27. | EV_MINOR_CLEAR
  28. | EV_MINOR_FINALIZERS_OLDIFY
  29. | EV_MINOR_GLOBAL_ROOTS
  30. | EV_MINOR_LEAVE_BARRIER
  31. | EV_STW_API_BARRIER
  32. | EV_STW_HANDLER
  33. | EV_STW_LEADER
  34. | EV_MAJOR_FINISH_SWEEPING
  35. | EV_MINOR_FINALIZERS_ADMIN
  36. | EV_MINOR_REMEMBERED_SET
  37. | EV_MINOR_REMEMBERED_SET_PROMOTE
  38. | EV_MINOR_LOCAL_ROOTS_PROMOTE
  39. | EV_DOMAIN_CONDITION_WAIT
  40. | EV_DOMAIN_RESIZE_HEAP_RESERVATION

The type for span events emitted by the runtime

type lifecycle =
  1. | EV_RING_START
  2. | EV_RING_STOP
  3. | EV_RING_PAUSE
  4. | EV_RING_RESUME
  5. | EV_FORK_PARENT
  6. | EV_FORK_CHILD
  7. | EV_DOMAIN_SPAWN
  8. | EV_DOMAIN_TERMINATE

Lifecycle events for the ring itself

val lifecycle_name : lifecycle -> string

Return a string representation of a given lifecycle event type

val runtime_phase_name : runtime_phase -> string

Return a string representation of a given runtime phase event type

val runtime_counter_name : runtime_counter -> string

Return a string representation of a given runtime counter type

type cursor

Type of the cursor used when consuming

module Timestamp : sig ... end
module Type : sig ... end
module User : sig ... end

User events is a way for libraries to provide runtime events that can be consumed by other tools. These events can carry known data types or custom values. The current maximum number of user events is 8192.

module Callbacks : sig ... end
val start : unit -> unit

start () will start the collection of events in the runtime if not already started.

Events can be consumed by creating a cursor with create_cursor and providing a set of callbacks to be called for each type of event.

val pause : unit -> unit

pause () will pause the collection of events in the runtime. Traces are collected if the program has called Runtime_events.start () or the OCAML_RUNTIME_EVENTS_START environment variable has been set.

val resume : unit -> unit

resume () will resume the collection of events in the runtime. Traces are collected if the program has called Runtime_events.start () or the OCAML_RUNTIME_EVENTS_START environment variable has been set.

val create_cursor : (string * int) option -> cursor

create_cursor path_pid creates a cursor to read from an runtime_events. Cursors can be created for runtime_events in and out of process. A runtime_events ring-buffer may have multiple cursors reading from it at any point in time and a program may have multiple cursors open concurrently (for example if multiple consumers want different sets of events). If path_pid is None then a cursor is created for the current process. Otherwise the pair contains a string path to the directory that contains the pid.events file and int pid for the runtime_events of an external process to monitor.

val free_cursor : cursor -> unit

Free a previously created runtime_events cursor

val read_poll : cursor -> Callbacks.t -> int option -> int

read_poll cursor callbacks max_option calls the corresponding functions on callbacks for up to max_option events read off cursor's runtime_events and returns the number of events read.

diff --git a/ocaml/Runtimedef/index.html b/ocaml/Runtimedef/index.html new file mode 100644 index 00000000..cc06ad7c --- /dev/null +++ b/ocaml/Runtimedef/index.html @@ -0,0 +1,2 @@ + +Runtimedef (ocaml.Runtimedef)

Module Runtimedef

val builtin_exceptions : string array
val builtin_primitives : string array
diff --git a/ocaml/Schedgen/class-scheduler_generic/index.html b/ocaml/Schedgen/class-scheduler_generic/index.html new file mode 100644 index 00000000..923cfb53 --- /dev/null +++ b/ocaml/Schedgen/class-scheduler_generic/index.html @@ -0,0 +1,2 @@ + +scheduler_generic (ocaml.Schedgen.scheduler_generic)

Class Schedgen.scheduler_generic

method virtual oper_issue_cycles : Mach.operation -> int
method virtual oper_latency : Mach.operation -> int
method reload_retaddr_issue_cycles : int
method reload_retaddr_latency : int
method oper_in_basic_block : Mach.operation -> bool
method is_store : Mach.operation -> bool
method is_load : Mach.operation -> bool
method is_checkbound : Mach.operation -> bool
method schedule_fundecl : Linear.fundecl -> Linear.fundecl
diff --git a/ocaml/Schedgen/index.html b/ocaml/Schedgen/index.html new file mode 100644 index 00000000..70726d1c --- /dev/null +++ b/ocaml/Schedgen/index.html @@ -0,0 +1,2 @@ + +Schedgen (ocaml.Schedgen)

Module Schedgen

type code_dag_node = {
  1. instr : Linear.instruction;
  2. delay : int;
  3. mutable sons : (code_dag_node * int) list;
  4. mutable date : int;
  5. mutable length : int;
  6. mutable ancestors : int;
  7. mutable emitted_ancestors : int;
}
class virtual scheduler_generic : object ... end
val reset : unit -> unit
diff --git a/ocaml/Scheduling/index.html b/ocaml/Scheduling/index.html new file mode 100644 index 00000000..bd56e2be --- /dev/null +++ b/ocaml/Scheduling/index.html @@ -0,0 +1,2 @@ + +Scheduling (ocaml.Scheduling)

Module Scheduling

diff --git a/ocaml/Selectgen/Coeffect/index.html b/ocaml/Selectgen/Coeffect/index.html new file mode 100644 index 00000000..a17a25a1 --- /dev/null +++ b/ocaml/Selectgen/Coeffect/index.html @@ -0,0 +1,2 @@ + +Coeffect (ocaml.Selectgen.Coeffect)

Module Selectgen.Coeffect

type t =
  1. | None
  2. | Read_mutable
  3. | Arbitrary
diff --git a/ocaml/Selectgen/Effect/index.html b/ocaml/Selectgen/Effect/index.html new file mode 100644 index 00000000..3d79337f --- /dev/null +++ b/ocaml/Selectgen/Effect/index.html @@ -0,0 +1,2 @@ + +Effect (ocaml.Selectgen.Effect)

Module Selectgen.Effect

type t =
  1. | None
  2. | Raise
  3. | Arbitrary
diff --git a/ocaml/Selectgen/Effect_and_coeffect/index.html b/ocaml/Selectgen/Effect_and_coeffect/index.html new file mode 100644 index 00000000..9d054647 --- /dev/null +++ b/ocaml/Selectgen/Effect_and_coeffect/index.html @@ -0,0 +1,2 @@ + +Effect_and_coeffect (ocaml.Selectgen.Effect_and_coeffect)

Module Selectgen.Effect_and_coeffect

type t
val none : t
val arbitrary : t
val effect : t -> Effect.t
val coeffect : t -> Coeffect.t
val effect_only : Effect.t -> t
val coeffect_only : Coeffect.t -> t
val join : t -> t -> t
val join_list_map : 'a list -> ('a -> t) -> t
diff --git a/ocaml/Selectgen/class-selector_generic/index.html b/ocaml/Selectgen/class-selector_generic/index.html new file mode 100644 index 00000000..9d5a0406 --- /dev/null +++ b/ocaml/Selectgen/class-selector_generic/index.html @@ -0,0 +1,45 @@ + +selector_generic (ocaml.Selectgen.selector_generic)

Class Selectgen.selector_generic

method is_immediate : Mach.integer_operation -> int -> bool
method virtual is_immediate_test : Mach.integer_comparison -> int -> bool
method virtual select_addressing : Cmm.memory_chunk -> + Cmm.expression -> + Arch.addressing_mode * Cmm.expression
method is_simple_expr : Cmm.expression -> bool
method effects_of : Cmm.expression -> Effect_and_coeffect.t
method select_operation : Cmm.operation -> + Cmm.expression list -> + Debuginfo.t -> + Mach.operation * Cmm.expression list
method select_condition : Cmm.expression -> Mach.test * Cmm.expression
method select_store : bool -> + Arch.addressing_mode -> + Cmm.expression -> + Mach.operation * Cmm.expression
method regs_for : Cmm.machtype -> Reg.t array
method insert_op : environment -> + Mach.operation -> + Reg.t array -> + Reg.t array -> + Reg.t array
method insert_op_debug : environment -> + Mach.operation -> + Debuginfo.t -> + Reg.t array -> + Reg.t array -> + Reg.t array
method insert_move_extcall_arg : environment -> + Cmm.exttype -> + Reg.t array -> + Reg.t array -> + unit
method emit_extcall_args : environment -> + Cmm.exttype list -> + Cmm.expression list -> + Reg.t array * int
method emit_stores : environment -> Cmm.expression list -> Reg.t array -> unit
method mark_call : unit
method mark_tailcall : unit
method mark_c_tailcall : unit
method mark_instr : Mach.instruction_desc -> unit
method emit_fundecl : future_funcnames:Misc.Stdlib.String.Set.t -> + Cmm.fundecl -> + Mach.fundecl
method extract_onto : Mach.instruction -> Mach.instruction
method extract : Mach.instruction
method insert : environment -> + Mach.instruction_desc -> + Reg.t array -> + Reg.t array -> + unit
method insert_debug : environment -> + Mach.instruction_desc -> + Debuginfo.t -> + Reg.t array -> + Reg.t array -> + unit
method insert_move : environment -> Reg.t -> Reg.t -> unit
method insert_move_args : environment -> + Reg.t array -> + Reg.t array -> + int -> + unit
method insert_move_results : environment -> + Reg.t array -> + Reg.t array -> + int -> + unit
method insert_moves : environment -> Reg.t array -> Reg.t array -> unit
method emit_expr : environment -> Cmm.expression -> Reg.t array option
method emit_tail : environment -> Cmm.expression -> unit
val contains_calls : bool ref
diff --git a/ocaml/Selectgen/index.html b/ocaml/Selectgen/index.html new file mode 100644 index 00000000..4d4b249c --- /dev/null +++ b/ocaml/Selectgen/index.html @@ -0,0 +1,7 @@ + +Selectgen (ocaml.Selectgen)

Module Selectgen

type environment
val env_find : Backend_var.t -> environment -> Reg.t array
val size_expr : environment -> Cmm.expression -> int
module Effect : sig ... end
module Coeffect : sig ... end
module Effect_and_coeffect : sig ... end
class virtual selector_generic : object ... end
val reset : unit -> unit
diff --git a/ocaml/Selection/index.html b/ocaml/Selection/index.html new file mode 100644 index 00000000..5de57eb1 --- /dev/null +++ b/ocaml/Selection/index.html @@ -0,0 +1,5 @@ + +Selection (ocaml.Selection)

Module Selection

val fundecl : + future_funcnames:Misc.Stdlib.String.Set.t -> + Cmm.fundecl -> + Mach.fundecl
diff --git a/ocaml/Semantics_of_primitives/index.html b/ocaml/Semantics_of_primitives/index.html new file mode 100644 index 00000000..ba47c713 --- /dev/null +++ b/ocaml/Semantics_of_primitives/index.html @@ -0,0 +1,2 @@ + +Semantics_of_primitives (ocaml.Semantics_of_primitives)

Module Semantics_of_primitives

Description of the semantics of primitives, to be used for optimization purposes.

"No effects" means that the primitive does not change the observable state of the world. For example, it must not write to any mutable storage, call arbitrary external functions or change control flow (e.g. by raising an exception). Note that allocation is not "No effects" (see below).

It is assumed in the compiler that applications of primitives with no effects, whose results are not used, may be eliminated. It is further assumed that applications of primitives with no effects may be duplicated (and thus possibly executed more than once).

(Exceptions arising from allocation points, for example "out of memory" or exceptions propagated from finalizers or signal handlers, are treated as "effects out of the ether" and thus ignored for our determination here of effectfulness. The same goes for floating point operations that may cause hardware traps on some platforms.)

"Only generative effects" means that a primitive does not change the observable state of the world save for possibly affecting the state of the garbage collector by performing an allocation. Applications of primitives that only have generative effects and whose results are unused may be eliminated by the compiler. However, unlike "No effects" primitives, such applications will never be eligible for duplication.

"Arbitrary effects" covers all other primitives.

"No coeffects" means that the primitive does not observe the effects (in the sense described above) of other expressions. For example, it must not read from any mutable storage or call arbitrary external functions.

It is assumed in the compiler that, subject to data dependencies, expressions with neither effects nor coeffects may be reordered with respect to other expressions.

type effects =
  1. | No_effects
  2. | Only_generative_effects
  3. | Arbitrary_effects
type coeffects =
  1. | No_coeffects
  2. | Has_coeffects

Describe the semantics of a primitive. This does not take into account of the (non-)(co)effectfulness of the arguments in a primitive application. To determine whether such an application is (co)effectful, the arguments must also be analysed.

type return_type =
  1. | Float
  2. | Other
val return_type_of_primitive : Clambda_primitives.primitive -> return_type
diff --git a/ocaml/Set_of_closures_id/Map/index.html b/ocaml/Set_of_closures_id/Map/index.html new file mode 100644 index 00000000..2f1c4f64 --- /dev/null +++ b/ocaml/Set_of_closures_id/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Set_of_closures_id.Map)

Module Set_of_closures_id.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Set_of_closures_id/Set/index.html b/ocaml/Set_of_closures_id/Set/index.html new file mode 100644 index 00000000..0d9d7268 --- /dev/null +++ b/ocaml/Set_of_closures_id/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Set_of_closures_id.Set)

Module Set_of_closures_id.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Set_of_closures_id/T/index.html b/ocaml/Set_of_closures_id/T/index.html new file mode 100644 index 00000000..29853256 --- /dev/null +++ b/ocaml/Set_of_closures_id/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Set_of_closures_id.T)

Module Set_of_closures_id.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Set_of_closures_id/Tbl/index.html b/ocaml/Set_of_closures_id/Tbl/index.html new file mode 100644 index 00000000..ad2a3723 --- /dev/null +++ b/ocaml/Set_of_closures_id/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Set_of_closures_id.Tbl)

Module Set_of_closures_id.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Set_of_closures_id/index.html b/ocaml/Set_of_closures_id/index.html new file mode 100644 index 00000000..6cdaa639 --- /dev/null +++ b/ocaml/Set_of_closures_id/index.html @@ -0,0 +1,2 @@ + +Set_of_closures_id (ocaml.Set_of_closures_id)

Module Set_of_closures_id

An identifier, unique across the whole program, that identifies a set of closures (viz. Set_of_closures).

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create : ?name:string -> Compilation_unit.t -> t
val name : t -> string option
val get_compilation_unit : t -> Compilation_unit.t
diff --git a/ocaml/Set_of_closures_origin/Map/index.html b/ocaml/Set_of_closures_origin/Map/index.html new file mode 100644 index 00000000..7a36c2b2 --- /dev/null +++ b/ocaml/Set_of_closures_origin/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Set_of_closures_origin.Map)

Module Set_of_closures_origin.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Set_of_closures_origin/Set/index.html b/ocaml/Set_of_closures_origin/Set/index.html new file mode 100644 index 00000000..15d45fac --- /dev/null +++ b/ocaml/Set_of_closures_origin/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Set_of_closures_origin.Set)

Module Set_of_closures_origin.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Set_of_closures_origin/T/index.html b/ocaml/Set_of_closures_origin/T/index.html new file mode 100644 index 00000000..6cb48a0d --- /dev/null +++ b/ocaml/Set_of_closures_origin/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Set_of_closures_origin.T)

Module Set_of_closures_origin.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Set_of_closures_origin/Tbl/index.html b/ocaml/Set_of_closures_origin/Tbl/index.html new file mode 100644 index 00000000..4fa66f9e --- /dev/null +++ b/ocaml/Set_of_closures_origin/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Set_of_closures_origin.Tbl)

Module Set_of_closures_origin.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Set_of_closures_origin/index.html b/ocaml/Set_of_closures_origin/index.html new file mode 100644 index 00000000..79bceae7 --- /dev/null +++ b/ocaml/Set_of_closures_origin/index.html @@ -0,0 +1,2 @@ + +Set_of_closures_origin (ocaml.Set_of_closures_origin)

Module Set_of_closures_origin

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create : Set_of_closures_id.t -> t
val get_compilation_unit : t -> Compilation_unit.t
diff --git a/ocaml/Shape/Item/Map/index.html b/ocaml/Shape/Item/Map/index.html new file mode 100644 index 00000000..2a18c94b --- /dev/null +++ b/ocaml/Shape/Item/Map/index.html @@ -0,0 +1,8 @@ + +Map (ocaml.Shape.Item.Map)

Module Item.Map

Maps

type key = t

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Shape/Item/index.html b/ocaml/Shape/Item/index.html new file mode 100644 index 00000000..0f887dfe --- /dev/null +++ b/ocaml/Shape/Item/index.html @@ -0,0 +1,2 @@ + +Item (ocaml.Shape.Item)

Module Shape.Item

type t
val make : string -> Sig_component_kind.t -> t
val value : Ident.t -> t
val type_ : Ident.t -> t
val module_ : Ident.t -> t
val module_type : Ident.t -> t
val extension_constructor : Ident.t -> t
val class_ : Ident.t -> t
val class_type : Ident.t -> t
module Map : Map.S with type key = t
diff --git a/ocaml/Shape/Make_reduce/argument-1-Context/index.html b/ocaml/Shape/Make_reduce/argument-1-Context/index.html new file mode 100644 index 00000000..cfa50ba0 --- /dev/null +++ b/ocaml/Shape/Make_reduce/argument-1-Context/index.html @@ -0,0 +1,2 @@ + +Context (ocaml.Shape.Make_reduce.Context)

Parameter Make_reduce.Context

type env
val fuel : int
val read_unit_shape : unit_name:string -> t option
val find_shape : env -> Ident.t -> t
diff --git a/ocaml/Shape/Make_reduce/index.html b/ocaml/Shape/Make_reduce/index.html new file mode 100644 index 00000000..18d43d7c --- /dev/null +++ b/ocaml/Shape/Make_reduce/index.html @@ -0,0 +1,2 @@ + +Make_reduce (ocaml.Shape.Make_reduce)

Module Shape.Make_reduce

The Make_reduce functor is used to generate a reduction function for shapes.

It is parametrized by:

  • an environment and a function to find shapes by path in that environment
  • a function to load the shape of an external compilation unit
  • some fuel, which is used to bound recursion when dealing with recursive shapes introduced by recursive modules. (FTR: merlin currently uses a fuel of 10, which seems to be enough for most practical examples)

Parameters

module Context : sig ... end

Signature

val reduce : Context.env -> t -> t
diff --git a/ocaml/Shape/Map/index.html b/ocaml/Shape/Map/index.html new file mode 100644 index 00000000..cbf1ea90 --- /dev/null +++ b/ocaml/Shape/Map/index.html @@ -0,0 +1,2 @@ + +Map (ocaml.Shape.Map)

Module Shape.Map

type shape = t
type nonrec t = t Item.Map.t
val empty : t
val add : t -> Item.t -> shape -> t
val add_value : t -> Ident.t -> Uid.t -> t
val add_value_proj : t -> Ident.t -> shape -> t
val add_type : t -> Ident.t -> Uid.t -> t
val add_type_proj : t -> Ident.t -> shape -> t
val add_module : t -> Ident.t -> shape -> t
val add_module_proj : t -> Ident.t -> shape -> t
val add_module_type : t -> Ident.t -> Uid.t -> t
val add_module_type_proj : t -> Ident.t -> shape -> t
val add_extcons : t -> Ident.t -> Uid.t -> t
val add_extcons_proj : t -> Ident.t -> shape -> t
val add_class : t -> Ident.t -> Uid.t -> t
val add_class_proj : t -> Ident.t -> shape -> t
val add_class_type : t -> Ident.t -> Uid.t -> t
val add_class_type_proj : t -> Ident.t -> shape -> t
diff --git a/ocaml/Shape/Sig_component_kind/index.html b/ocaml/Shape/Sig_component_kind/index.html new file mode 100644 index 00000000..2310cbfb --- /dev/null +++ b/ocaml/Shape/Sig_component_kind/index.html @@ -0,0 +1,2 @@ + +Sig_component_kind (ocaml.Shape.Sig_component_kind)

Module Shape.Sig_component_kind

type t =
  1. | Value
  2. | Type
  3. | Module
  4. | Module_type
  5. | Extension_constructor
  6. | Class
  7. | Class_type
val to_string : t -> string
val can_appear_in_types : t -> bool

Whether the name of a component of that kind can appear in a type.

diff --git a/ocaml/Shape/Uid/Map/index.html b/ocaml/Shape/Uid/Map/index.html new file mode 100644 index 00000000..48fedea7 --- /dev/null +++ b/ocaml/Shape/Uid/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Shape.Uid.Map)

Module Uid.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Shape/Uid/Set/index.html b/ocaml/Shape/Uid/Set/index.html new file mode 100644 index 00000000..798535af --- /dev/null +++ b/ocaml/Shape/Uid/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Shape.Uid.Set)

Module Uid.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Shape/Uid/T/index.html b/ocaml/Shape/Uid/T/index.html new file mode 100644 index 00000000..9a83a345 --- /dev/null +++ b/ocaml/Shape/Uid/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Shape.Uid.T)

Module Uid.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Shape/Uid/Tbl/index.html b/ocaml/Shape/Uid/Tbl/index.html new file mode 100644 index 00000000..6a5e4ac2 --- /dev/null +++ b/ocaml/Shape/Uid/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Shape.Uid.Tbl)

Module Uid.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Shape/Uid/index.html b/ocaml/Shape/Uid/index.html new file mode 100644 index 00000000..c3303005 --- /dev/null +++ b/ocaml/Shape/Uid/index.html @@ -0,0 +1,2 @@ + +Uid (ocaml.Shape.Uid)

Module Shape.Uid

type t = private
  1. | Compilation_unit of string
  2. | Item of {
    1. comp_unit : string;
    2. id : int;
    }
  3. | Internal
  4. | Predef of string
val reinit : unit -> unit
val mk : current_unit:string -> t
val of_compilation_unit_id : Ident.t -> t
val of_predef_id : Ident.t -> t
val internal_not_actually_unique : t
val for_actual_declaration : t -> bool
include Identifiable.S with type t := t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
diff --git a/ocaml/Shape/index.html b/ocaml/Shape/index.html new file mode 100644 index 00000000..0249cd8d --- /dev/null +++ b/ocaml/Shape/index.html @@ -0,0 +1,6 @@ + +Shape (ocaml.Shape)

Module Shape

module Uid : sig ... end
module Sig_component_kind : sig ... end
module Item : sig ... end
type var = Ident.t
type t = {
  1. uid : Uid.t option;
  2. desc : desc;
}
and desc =
  1. | Var of var
  2. | Abs of var * t
  3. | App of t * t
  4. | Struct of t Item.Map.t
  5. | Leaf
  6. | Proj of t * Item.t
  7. | Comp_unit of string
val print : Stdlib.Format.formatter -> t -> unit
val for_unnamed_functor_param : var
val fresh_var : ?name:string -> Uid.t -> var * t
val var : Uid.t -> Ident.t -> t
val abs : ?uid:Uid.t -> var -> t -> t
val app : ?uid:Uid.t -> t -> arg:t -> t
val str : ?uid:Uid.t -> t Item.Map.t -> t
val proj : ?uid:Uid.t -> t -> Item.t -> t
val leaf : Uid.t -> t
val decompose_abs : t -> (var * t) option
val for_persistent_unit : string -> t
val leaf_for_unpack : t
module Map : sig ... end
val dummy_mod : t
val of_path : + find_shape:(Sig_component_kind.t -> Ident.t -> t) -> + namespace:Sig_component_kind.t -> + Path.t -> + t
val set_uid_if_none : t -> Uid.t -> t
module Make_reduce (Context : sig ... end) : sig ... end

The Make_reduce functor is used to generate a reduction function for shapes.

val local_reduce : t -> t
diff --git a/ocaml/Share_constants/index.html b/ocaml/Share_constants/index.html new file mode 100644 index 00000000..a2f4fef6 --- /dev/null +++ b/ocaml/Share_constants/index.html @@ -0,0 +1,2 @@ + +Share_constants (ocaml.Share_constants)

Module Share_constants

Share lifted constants that are eligible for sharing (e.g. not strings) and have equal definitions.

val share_constants : Flambda.program -> Flambda.program
diff --git a/ocaml/Signature_group/index.html b/ocaml/Signature_group/index.html new file mode 100644 index 00000000..079cd4ed --- /dev/null +++ b/ocaml/Signature_group/index.html @@ -0,0 +1,7 @@ + +Signature_group (ocaml.Signature_group)

Module Signature_group

Iterate on signature by syntactic group of items

Classes, class types and private row types adds ghost components to the signature where they are defined.

When editing or printing a signature it is therefore important to identify those ghost components.

This module provides type grouping together ghost components with the corresponding core item (or recursive group) and the corresponding iterators.

type sig_item = {
  1. src : Types.signature_item;
    (*

    the syntactic item

    *)
  2. post_ghosts : Types.signature_item list;
    (*

    ghost classes types are post-declared

    *)
}

Classes and class types generate ghosts signature items, we group them together before printing

val flatten : sig_item -> Types.signature

flatten sig_item is x.src :: x.post_ghosts

type core_rec_group =
  1. | Not_rec of sig_item
  2. | Rec_group of sig_item list

A group of mutually recursive definition

val rec_items : core_rec_group -> sig_item list

rec_items group is the list of sig_items in the group

type rec_group = {
  1. pre_ghosts : Types.signature_item list;
  2. group : core_rec_group;
}

Private #row types are manifested as a sequence of definitions preceding a recursive group, we collect them and separate them from the syntactic recursive group.

val next : Types.signature -> (rec_group * Types.signature) option

The sequence seq signature iterates over signature rec_group by rec_group. The second element of the tuple in the full_seq case is the not-yet traversed part of the signature.

val iter : (rec_group -> unit) -> Types.signature -> unit
val fold : ('acc -> rec_group -> 'acc) -> 'acc -> Types.signature -> 'acc
type in_place_patch = {
  1. ghosts : Types.signature;
    (*

    updated list of ghost items

    *)
  2. replace_by : Types.signature_item option;
    (*

    replacement for the selected item

    *)
}

Describe how to amend one element of a signature

val replace_in_place : + (ghosts:Types.signature -> + Types.signature_item -> + ('a * in_place_patch) option) -> + Types.signature -> + ('a * Types.signature) option

!replace_in_place patch sg replaces the first element of the signature for which patch ~rec_group ~ghosts component returns Some (value,patch). The rec_group argument is the remaining part of the mutually recursive group of component. The ghosts list is the current prefix of ghost components associated to component

diff --git a/ocaml/Simple_value_approx/index.html b/ocaml/Simple_value_approx/index.html new file mode 100644 index 00000000..5f381a20 --- /dev/null +++ b/ocaml/Simple_value_approx/index.html @@ -0,0 +1,83 @@ + +Simple_value_approx (ocaml.Simple_value_approx)

Module Simple_value_approx

Simple approximations to the runtime results of computations. This pass is designed for speed rather than accuracy; the performance is important since it is used heavily during inlining.

type 'a boxed_int =
  1. | Int32 : int32 boxed_int
  2. | Int64 : int64 boxed_int
  3. | Nativeint : nativeint boxed_int
type value_string = {
  1. contents : string option;
  2. size : int;
}
type unresolved_value =
  1. | Set_of_closures_id of Set_of_closures_id.t
  2. | Symbol of Symbol.t
type unknown_because_of =
  1. | Unresolved_value of unresolved_value
  2. | Other
type t = private {
  1. descr : descr;
  2. var : Variable.t option;
  3. symbol : (Symbol.t * int option) option;
}

A value of type t corresponds to an "approximation" of the result of a computation in the program being compiled. That is to say, it represents what knowledge we have about such a result at compile time. The simplification pass exploits this information to partially evaluate computations.

At a high level, an approximation for a value v has three parts:

  • the "description" (for example, "the constant integer 42");
  • an optional variable;
  • an optional symbol or symbol field. If the variable (resp. symbol) is present then that variable (resp. symbol) may be used to obtain the value v.

The exact semantics of the variable and symbol fields follows.

Approximations are deduced at particular points in an expression tree, but may subsequently be propagated to other locations.

At the point at which an approximation is built for some value v, we can construct a set of variables (call the set S) that are known to alias the same value v. Each member of S will have the same or a more precise descr field in its approximation relative to the approximation for v. (An increase in precision may currently be introduced for pattern matches.) If S is non-empty then it is guaranteed that there is a unique member of S that was declared in a scope further out ("earlier") than all other members of S. If such a member exists then it is recorded in the var field. Otherwise var is None.

Analogous to the construction of the set S, we can construct a set T consisting of all symbols that are known to alias the value whose approximation is being constructed. If T is non-empty then the symbol field is set to some member of T; it does not matter which one. (There is no notion of scope for symbols.)

Note about mutable blocks:

Mutable blocks are always represented by Value_unknown or Value_bottom. Any other approximation could leave the door open to a miscompilation. Such bad scenarios are most likely a user using Obj.magic or Obj.set_field in an inappropriate situation. Such a situation might be: let x = (1, 1) in + Obj.set_field (Obj.repr x) 0 (Obj.repr 2); + assert(fst x = 2) The user would probably expect the assertion to be true, but the compiler could in fact propagate the value of x across the Obj.set_field.

Insisting that mutable blocks have Value_unknown or Value_bottom approximations certainly won't always prevent this kind of error, but should help catch many of them.

It is possible that there may be some false positives, with correct but unreachable code causing this check to fail. However the likelihood of this seems sufficiently low, especially compared to the advantages gained by performing the check, that we include it.

An example of a pattern that might trigger a false positive is: type a = { a : int } + type b = { mutable b : int } + type _ t = + | A : a t + | B : b t + let f (type x) (v:x t) (r:x) = + match v with + | A -> r.a + | B -> r.b <- 2; 3 + let v = + let r = + ref A in + r := A; (* Some pattern that the compiler can't understand *) + f !r { a = 1 } When inlining f, the B branch is unreachable, yet the compiler cannot prove it and must therefore keep it.

and descr = private
  1. | Value_block of Tag.t * t array
  2. | Value_int of int
  3. | Value_char of char
  4. | Value_float of float option
  5. | Value_boxed_int : 'a boxed_int * 'a -> descr
  6. | Value_set_of_closures of value_set_of_closures
  7. | Value_closure of value_closure
  8. | Value_string of value_string
  9. | Value_float_array of value_float_array
  10. | Value_unknown of unknown_because_of
  11. | Value_bottom
  12. | Value_extern of Export_id.t
  13. | Value_symbol of Symbol.t
  14. | Value_unresolved of unresolved_value
and value_closure = {
  1. set_of_closures : t;
  2. closure_id : Closure_id.t;
}
and function_declarations = private {
  1. is_classic_mode : bool;
  2. set_of_closures_id : Set_of_closures_id.t;
  3. set_of_closures_origin : Set_of_closures_origin.t;
  4. funs : function_declaration Variable.Map.t;
}
and function_body = private {
  1. free_variables : Variable.Set.t;
  2. free_symbols : Symbol.Set.t;
  3. stub : bool;
  4. dbg : Debuginfo.t;
  5. inline : Lambda.inline_attribute;
  6. specialise : Lambda.specialise_attribute;
  7. is_a_functor : bool;
  8. body : Flambda.t;
  9. poll : Lambda.poll_attribute;
}
and function_declaration = private {
  1. closure_origin : Closure_origin.t;
  2. params : Parameter.t list;
  3. function_body : function_body option;
}
and value_set_of_closures = private {
  1. function_decls : function_declarations;
  2. bound_vars : t Var_within_closure.Map.t;
  3. free_vars : Flambda.specialised_to Variable.Map.t;
  4. invariant_params : Variable.Set.t Variable.Map.t Stdlib.Lazy.t;
  5. recursive : Variable.Set.t Stdlib.Lazy.t;
  6. size : int option Variable.Map.t Stdlib.Lazy.t;
    (*

    For functions that are very likely to be inlined, the size of the function's body.

    *)
  7. specialised_args : Flambda.specialised_to Variable.Map.t;
  8. freshening : Freshening.Project_var.t;
  9. direct_call_surrogates : Closure_id.t Closure_id.Map.t;
}
and value_float_array_contents =
  1. | Contents of t array
  2. | Unknown_or_mutable
and value_float_array = {
  1. contents : value_float_array_contents;
  2. size : int;
}
val descr : t -> descr

Extraction of the description of approximation(s).

val descrs : t list -> descr list
val print : Stdlib.Format.formatter -> t -> unit

Pretty-printing of approximations to a formatter.

val print_descr : Stdlib.Format.formatter -> descr -> unit
val print_value_set_of_closures : + Stdlib.Format.formatter -> + value_set_of_closures -> + unit
val print_function_declarations : + Stdlib.Format.formatter -> + function_declarations -> + unit
val function_declarations_approx : + keep_body:(Variable.t -> Flambda.function_declaration -> bool) -> + Flambda.function_declarations -> + function_declarations
val create_value_set_of_closures : + function_decls:function_declarations -> + bound_vars:t Var_within_closure.Map.t -> + free_vars:Flambda.specialised_to Variable.Map.t -> + invariant_params:Variable.Set.t Variable.Map.t lazy_t -> + recursive:Variable.Set.t Stdlib.Lazy.t -> + specialised_args:Flambda.specialised_to Variable.Map.t -> + freshening:Freshening.Project_var.t -> + direct_call_surrogates:Closure_id.t Closure_id.Map.t -> + value_set_of_closures
val update_freshening_of_value_set_of_closures : + value_set_of_closures -> + freshening:Freshening.Project_var.t -> + value_set_of_closures
val value_unknown : unknown_because_of -> t

Basic construction of approximations.

val value_int : int -> t
val value_char : char -> t
val value_float : float -> t
val value_any_float : t
val value_mutable_float_array : size:int -> t
val value_immutable_float_array : t array -> t
val value_string : int -> string option -> t
val value_boxed_int : 'i boxed_int -> 'i -> t
val value_block : Tag.t -> t array -> t
val value_extern : Export_id.t -> t
val value_symbol : Symbol.t -> t
val value_bottom : t
val value_unresolved : unresolved_value -> t
val value_closure : + ?closure_var:Variable.t -> + ?set_of_closures_var:Variable.t -> + ?set_of_closures_symbol:Symbol.t -> + value_set_of_closures -> + Closure_id.t -> + t

Construct a closure approximation given the approximation of the corresponding set of closures and the closure ID of the closure to be projected from such set. closure_var and/or set_of_closures_var may be specified to augment the approximation with variables that may be used to access the closure value itself, so long as they are in scope at the proposed point of use.

val value_set_of_closures : + ?set_of_closures_var:Variable.t -> + value_set_of_closures -> + t

Construct a set of closures approximation. set_of_closures_var is as for the parameter of the same name in value_closure, above.

val make_const_int : int -> Flambda.t * t

Take the given constant and produce an appropriate approximation for it together with an Flambda expression representing it.

val make_const_char : char -> Flambda.t * t
val make_const_bool : bool -> Flambda.t * t
val make_const_float : float -> Flambda.t * t
val make_const_boxed_int : 'i boxed_int -> 'i -> Flambda.t * t
val make_const_int_named : int -> Flambda.named * t
val make_const_char_named : char -> Flambda.named * t
val make_const_bool_named : bool -> Flambda.named * t
val make_const_float_named : float -> Flambda.named * t
val make_const_boxed_int_named : 'i boxed_int -> 'i -> Flambda.named * t
val augment_with_variable : t -> Variable.t -> t

Augment an approximation with a given variable (see comment above). If the approximation was already augmented with a variable, the one passed to this function replaces it within the approximation.

val augment_with_symbol : t -> Symbol.t -> t

Like augment_with_variable, but for symbol information.

val augment_with_symbol_field : t -> Symbol.t -> int -> t

Like augment_with_symbol, but for symbol field information.

val replace_description : t -> descr -> t

Replace the description within an approximation.

val augment_with_kind : t -> Lambda.value_kind -> t

Improve the description by taking the kind into account

val augment_kind_with_approx : t -> Lambda.value_kind -> Lambda.value_kind

Improve the kind by taking the description into account

val equal_boxed_int : 'a boxed_int -> 'a -> 'b boxed_int -> 'b -> bool
val meet : really_import_approx:(t -> t) -> t -> t -> t
val known : t -> bool

An approximation is "known" iff it is not Value_unknown.

val useful : t -> bool

An approximation is "useful" iff it is neither unknown nor bottom.

val all_not_useful : t list -> bool

Whether all approximations in the given list do *not* satisfy useful.

val warn_on_mutation : t -> bool

Whether to warn on attempts to mutate a value. It must have been resolved (it cannot be Value_extern or Value_symbol). (See comment above for further explanation.)

type simplification_summary =
  1. | Nothing_done
  2. | Replaced_term
type simplification_result = Flambda.t * simplification_summary * t
type simplification_result_named = Flambda.named * simplification_summary * t
val simplify : t -> Flambda.t -> simplification_result

Given an expression and its approximation, attempt to simplify the expression to a constant (with associated approximation), taking into account whether the expression has any side effects.

val simplify_using_env : + t -> + is_present_in_env:(Variable.t -> bool) -> + Flambda.t -> + simplification_result

As for simplify, but also enables us to simplify based on equalities between variables. The caller must provide a function that tells us whether, if we simplify to a given variable, the value of that variable will be accessible in the current environment.

val simplify_named : t -> Flambda.named -> simplification_result_named
val simplify_named_using_env : + t -> + is_present_in_env:(Variable.t -> bool) -> + Flambda.named -> + simplification_result_named
val simplify_var_to_var_using_env : + t -> + is_present_in_env:(Variable.t -> bool) -> + Variable.t option

If the given approximation identifies another variable and is_present_in_env deems it to be in scope, return that variable (wrapped in a Some), otherwise return None.

val simplify_var : t -> (Flambda.named * t) option
type get_field_result =
  1. | Ok of t
  2. | Unreachable
val get_field : t -> field_index:int -> get_field_result

Given the approximation t of a value, expected to correspond to a block (in the Pmakeblock sense of the word), and a field index then return an appropriate approximation for that field of the block (or Unreachable if the code with the approximation t is unreachable). N.B. Not all cases of unreachable code are returned as Unreachable.

type checked_approx_for_block =
  1. | Wrong
  2. | Ok of Tag.t * t array
val check_approx_for_block : t -> checked_approx_for_block

Try to prove that a value with the given approximation may be used as a block.

val approx_for_bound_var : value_set_of_closures -> Var_within_closure.t -> t

Find the approximation for a bound variable in a set-of-closures approximation. A fatal error is produced if the variable is not bound in the given approximation.

val freshen_and_check_closure_id : + value_set_of_closures -> + Closure_id.t -> + Closure_id.t

Given a set-of-closures approximation and a closure ID, apply any freshening specified by the approximation to the closure ID, and return the resulting ID. Causes a fatal error if the resulting closure ID does not correspond to any function declaration in the approximation.

type strict_checked_approx_for_set_of_closures =
  1. | Wrong
  2. | Ok of Variable.t option * value_set_of_closures
val strict_check_approx_for_set_of_closures : + t -> + strict_checked_approx_for_set_of_closures
type checked_approx_for_set_of_closures =
  1. | Wrong
  2. | Unresolved of unresolved_value
  3. | Unknown
  4. | Unknown_because_of_unresolved_value of unresolved_value
  5. | Ok of Variable.t option * value_set_of_closures
val check_approx_for_set_of_closures : t -> checked_approx_for_set_of_closures

Try to prove that a value with the given approximation may be used as a set of closures. Values coming from external compilation units with unresolved approximations are permitted.

type checked_approx_for_closure =
  1. | Wrong
  2. | Ok of value_closure + * Variable.t option + * Symbol.t option + * value_set_of_closures
val check_approx_for_closure : t -> checked_approx_for_closure

Try to prove that a value with the given approximation may be used as a closure. Values coming from external compilation units with unresolved approximations are not permitted.

type checked_approx_for_closure_allowing_unresolved =
  1. | Wrong
  2. | Unresolved of unresolved_value
  3. | Unknown
  4. | Unknown_because_of_unresolved_value of unresolved_value
  5. | Ok of value_closure + * Variable.t option + * Symbol.t option + * value_set_of_closures
val check_approx_for_closure_allowing_unresolved : + t -> + checked_approx_for_closure_allowing_unresolved

As for check_approx_for_closure, but values coming from external compilation units with unresolved approximations are permitted.

val check_approx_for_float : t -> float option

Returns the value if it can be proved to be a constant float

val float_array_as_constant : value_float_array -> float list option

Returns the value if it can be proved to be a constant float array

val check_approx_for_string : t -> string option

Returns the value if it can be proved to be a constant string

type switch_branch_selection =
  1. | Cannot_be_taken
  2. | Can_be_taken
  3. | Must_be_taken
val potentially_taken_const_switch_branch : t -> int -> switch_branch_selection

Check that the branch is compatible with the approximation

val potentially_taken_block_switch_branch : t -> int -> switch_branch_selection
val function_arity : function_declaration -> int
val update_function_declarations : + function_declarations -> + funs:function_declaration Variable.Map.t -> + function_declarations

Create a set of function declarations based on another set of function declarations.

val update_function_declaration_body : + function_declaration -> + (Flambda.t -> Flambda.t) -> + function_declaration

Creates a map from closure IDs to function declarations by iterating over all sets of closures in the given map.

val clear_function_bodies : function_declarations -> function_declarations
diff --git a/ocaml/Simplif/index.html b/ocaml/Simplif/index.html new file mode 100644 index 00000000..cd29153b --- /dev/null +++ b/ocaml/Simplif/index.html @@ -0,0 +1,10 @@ + +Simplif (ocaml.Simplif)

Module Simplif

Lambda simplification.

Warning: this module is unstable and part of compiler-libs.

val simplify_lambda : Lambda.lambda -> Lambda.lambda
val split_default_wrapper : + id:Ident.t -> + kind:Lambda.function_kind -> + params:(Ident.t * Lambda.value_kind) list -> + return:Lambda.value_kind -> + body:Lambda.lambda -> + attr:Lambda.function_attribute -> + loc:Lambda.scoped_location -> + (Ident.t * Lambda.lambda) list
diff --git a/ocaml/Simplify_boxed_integer_ops/Simplify_boxed_int32/index.html b/ocaml/Simplify_boxed_integer_ops/Simplify_boxed_int32/index.html new file mode 100644 index 00000000..c43e133f --- /dev/null +++ b/ocaml/Simplify_boxed_integer_ops/Simplify_boxed_int32/index.html @@ -0,0 +1,20 @@ + +Simplify_boxed_int32 (ocaml.Simplify_boxed_integer_ops.Simplify_boxed_int32)

Module Simplify_boxed_integer_ops.Simplify_boxed_int32

diff --git a/ocaml/Simplify_boxed_integer_ops/Simplify_boxed_int64/index.html b/ocaml/Simplify_boxed_integer_ops/Simplify_boxed_int64/index.html new file mode 100644 index 00000000..a7e8e167 --- /dev/null +++ b/ocaml/Simplify_boxed_integer_ops/Simplify_boxed_int64/index.html @@ -0,0 +1,20 @@ + +Simplify_boxed_int64 (ocaml.Simplify_boxed_integer_ops.Simplify_boxed_int64)

Module Simplify_boxed_integer_ops.Simplify_boxed_int64

diff --git a/ocaml/Simplify_boxed_integer_ops/Simplify_boxed_nativeint/index.html b/ocaml/Simplify_boxed_integer_ops/Simplify_boxed_nativeint/index.html new file mode 100644 index 00000000..5fa51444 --- /dev/null +++ b/ocaml/Simplify_boxed_integer_ops/Simplify_boxed_nativeint/index.html @@ -0,0 +1,20 @@ + +Simplify_boxed_nativeint (ocaml.Simplify_boxed_integer_ops.Simplify_boxed_nativeint)

Module Simplify_boxed_integer_ops.Simplify_boxed_nativeint

diff --git a/ocaml/Simplify_boxed_integer_ops/index.html b/ocaml/Simplify_boxed_integer_ops/index.html new file mode 100644 index 00000000..66598e8b --- /dev/null +++ b/ocaml/Simplify_boxed_integer_ops/index.html @@ -0,0 +1,5 @@ + +Simplify_boxed_integer_ops (ocaml.Simplify_boxed_integer_ops)

Module Simplify_boxed_integer_ops

diff --git a/ocaml/Simplify_boxed_integer_ops_intf/index.html b/ocaml/Simplify_boxed_integer_ops_intf/index.html new file mode 100644 index 00000000..fbcc5099 --- /dev/null +++ b/ocaml/Simplify_boxed_integer_ops_intf/index.html @@ -0,0 +1,2 @@ + +Simplify_boxed_integer_ops_intf (ocaml.Simplify_boxed_integer_ops_intf)

Module Simplify_boxed_integer_ops_intf

module type S = sig ... end
diff --git a/ocaml/Simplify_boxed_integer_ops_intf/module-type-S/index.html b/ocaml/Simplify_boxed_integer_ops_intf/module-type-S/index.html new file mode 100644 index 00000000..db8c6482 --- /dev/null +++ b/ocaml/Simplify_boxed_integer_ops_intf/module-type-S/index.html @@ -0,0 +1,20 @@ + +S (ocaml.Simplify_boxed_integer_ops_intf.S)

Module type Simplify_boxed_integer_ops_intf.S

diff --git a/ocaml/Simplify_common/index.html b/ocaml/Simplify_common/index.html new file mode 100644 index 00000000..1ae6feef --- /dev/null +++ b/ocaml/Simplify_common/index.html @@ -0,0 +1,28 @@ + +Simplify_common (ocaml.Simplify_common)

Module Simplify_common

const_*_expr expr v annot, where the expression expr is known to evaluate to the value v, attempt to produce a more simple expression together with its approximation and the benefit gained by replacing expr with this new expression. This simplification is only performed if expr is known to have no side effects. Otherwise, expr itself is returned, with an appropriate approximation but zero benefit.

const_boxed_int_expr takes an additional argument specifying the kind of boxed integer to which the given expression evaluates.

val const_float_expr : + Flambda.named -> + float -> + Flambda.named * Simple_value_approx.t * Inlining_cost.Benefit.t
val const_integer_comparison_expr : + Flambda.named -> + Lambda.integer_comparison -> + 'a -> + 'a -> + Flambda.named * Simple_value_approx.t * Inlining_cost.Benefit.t
val const_float_comparison_expr : + Flambda.named -> + Lambda.float_comparison -> + float -> + float -> + Flambda.named * Simple_value_approx.t * Inlining_cost.Benefit.t
val swap16 : int -> int

Functions for transposing the order of bytes within words of various sizes.

val swap32 : int32 -> int32
val swap64 : int64 -> int64
val swapnative : nativeint -> nativeint
diff --git a/ocaml/Simplify_primitives/index.html b/ocaml/Simplify_primitives/index.html new file mode 100644 index 00000000..9465ea5a --- /dev/null +++ b/ocaml/Simplify_primitives/index.html @@ -0,0 +1,8 @@ + +Simplify_primitives (ocaml.Simplify_primitives)

Module Simplify_primitives

Simplifies an application of a primitive based on approximation information.

diff --git a/ocaml/Spill/index.html b/ocaml/Spill/index.html new file mode 100644 index 00000000..59888d3c --- /dev/null +++ b/ocaml/Spill/index.html @@ -0,0 +1,2 @@ + +Spill (ocaml.Spill)

Module Spill

val fundecl : Mach.fundecl -> Mach.fundecl
diff --git a/ocaml/Split/index.html b/ocaml/Split/index.html new file mode 100644 index 00000000..364797b1 --- /dev/null +++ b/ocaml/Split/index.html @@ -0,0 +1,2 @@ + +Split (ocaml.Split)

Module Split

val fundecl : Mach.fundecl -> Mach.fundecl
val reset : unit -> unit
diff --git a/ocaml/Static_exception/Map/index.html b/ocaml/Static_exception/Map/index.html new file mode 100644 index 00000000..9513306c --- /dev/null +++ b/ocaml/Static_exception/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Static_exception.Map)

Module Static_exception.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Static_exception/Set/index.html b/ocaml/Static_exception/Set/index.html new file mode 100644 index 00000000..6df54150 --- /dev/null +++ b/ocaml/Static_exception/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Static_exception.Set)

Module Static_exception.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Static_exception/T/index.html b/ocaml/Static_exception/T/index.html new file mode 100644 index 00000000..eb37bca5 --- /dev/null +++ b/ocaml/Static_exception/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Static_exception.T)

Module Static_exception.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Static_exception/Tbl/index.html b/ocaml/Static_exception/Tbl/index.html new file mode 100644 index 00000000..d14e7346 --- /dev/null +++ b/ocaml/Static_exception/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Static_exception.Tbl)

Module Static_exception.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Static_exception/index.html b/ocaml/Static_exception/index.html new file mode 100644 index 00000000..cee826fb --- /dev/null +++ b/ocaml/Static_exception/index.html @@ -0,0 +1,2 @@ + +Static_exception (ocaml.Static_exception)

Module Static_exception

An identifier that is used to label static exceptions. Its uniqueness properties are unspecified.

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create : unit -> t
val to_int : t -> int
diff --git a/ocaml/Std_exit/index.html b/ocaml/Std_exit/index.html new file mode 100644 index 00000000..7f15baa5 --- /dev/null +++ b/ocaml/Std_exit/index.html @@ -0,0 +1,2 @@ + +Std_exit (ocaml.Std_exit)

Module Std_exit

diff --git a/ocaml/Stdlib/Arg/index.html b/ocaml/Stdlib/Arg/index.html new file mode 100644 index 00000000..fa21fedb --- /dev/null +++ b/ocaml/Stdlib/Arg/index.html @@ -0,0 +1,38 @@ + +Arg (ocaml.Stdlib.Arg)

Module Stdlib.Arg

Parsing of command line arguments.

This module provides a general mechanism for extracting options and arguments from the command line to the program. For example:

let usage_msg = "append [-verbose] <file1> [<file2>] ... -o <output>"
+let verbose = ref false
+let input_files = ref []
+let output_file = ref ""
+
+let anon_fun filename =
+  input_files := filename::!input_files
+
+let speclist =
+  [("-verbose", Arg.Set verbose, "Output debug information");
+   ("-o", Arg.Set_string output_file, "Set output file name")]
+
+let () =
+  Arg.parse speclist anon_fun usage_msg;
+  (* Main functionality here *)

Syntax of command lines: A keyword is a character string starting with a -. An option is a keyword alone or followed by an argument. The types of keywords are: Unit, Bool, Set, Clear, String, Set_string, Int, Set_int, Float, Set_float, Tuple, Symbol, Rest, Rest_all and Expand.

Unit, Set and Clear keywords take no argument.

A Rest or Rest_all keyword takes the remainder of the command line as arguments. (More explanations below.)

Every other keyword takes the following word on the command line as argument. For compatibility with GNU getopt_long, keyword=arg is also allowed. Arguments not preceded by a keyword are called anonymous arguments.

Examples (cmd is assumed to be the command name):

  • cmd -flag (a unit option)
  • cmd -int 1 (an int option with argument 1)
  • cmd -string foobar (a string option with argument "foobar")
  • cmd -float 12.34 (a float option with argument 12.34)
  • cmd a b c (three anonymous arguments: "a", "b", and "c")
  • cmd a b -- c d (two anonymous arguments and a rest option with two arguments)

Rest takes a function that is called repeatedly for each remaining command line argument. Rest_all takes a function that is called once, with the list of all remaining arguments.

Note that if no arguments follow a Rest keyword then the function is not called at all whereas the function for a Rest_all keyword is called with an empty list.

  • alert unsynchronized_access The Arg module relies on a mutable global state, parsing functions should only be called from a single domain.
type spec =
  1. | Unit of unit -> unit
    (*

    Call the function with unit argument

    *)
  2. | Bool of bool -> unit
    (*

    Call the function with a bool argument

    *)
  3. | Set of bool ref
    (*

    Set the reference to true

    *)
  4. | Clear of bool ref
    (*

    Set the reference to false

    *)
  5. | String of string -> unit
    (*

    Call the function with a string argument

    *)
  6. | Set_string of string ref
    (*

    Set the reference to the string argument

    *)
  7. | Int of int -> unit
    (*

    Call the function with an int argument

    *)
  8. | Set_int of int ref
    (*

    Set the reference to the int argument

    *)
  9. | Float of float -> unit
    (*

    Call the function with a float argument

    *)
  10. | Set_float of float ref
    (*

    Set the reference to the float argument

    *)
  11. | Tuple of spec list
    (*

    Take several arguments according to the spec list

    *)
  12. | Symbol of string list * string -> unit
    (*

    Take one of the symbols as argument and call the function with the symbol

    *)
  13. | Rest of string -> unit
    (*

    Stop interpreting keywords and call the function with each remaining argument

    *)
  14. | Rest_all of string list -> unit
    (*

    Stop interpreting keywords and call the function with all remaining arguments

    *)
  15. | Expand of string -> string array
    (*

    If the remaining arguments to process are of the form ["-foo"; "arg"] @ rest where "foo" is registered as Expand f, then the arguments f "arg" @ rest are processed. Only allowed in parse_and_expand_argv_dynamic.

    *)

The concrete type describing the behavior associated with a keyword.

type key = string
type doc = string
type usage_msg = string
type anon_fun = string -> unit
val parse : (key * spec * doc) list -> anon_fun -> usage_msg -> unit

Arg.parse speclist anon_fun usage_msg parses the command line. speclist is a list of triples (key, spec, doc). key is the option keyword, it must start with a '-' character. spec gives the option type and the function to call when this option is found on the command line. doc is a one-line description of this option. anon_fun is called on anonymous arguments. The functions in spec and anon_fun are called in the same order as their arguments appear on the command line.

If an error occurs, Arg.parse exits the program, after printing to standard error an error message as follows:

  • The reason for the error: unknown option, invalid or missing argument, etc.
  • usage_msg
  • The list of options, each followed by the corresponding doc string. Beware: options that have an empty doc string will not be included in the list.

For the user to be able to specify anonymous arguments starting with a -, include for example ("-", String anon_fun, doc) in speclist.

By default, parse recognizes two unit options, -help and --help, which will print to standard output usage_msg and the list of options, and exit the program. You can override this behaviour by specifying your own -help and --help options in speclist.

val parse_dynamic : + (key * spec * doc) list ref -> + anon_fun -> + usage_msg -> + unit

Same as Arg.parse, except that the speclist argument is a reference and may be updated during the parsing. A typical use for this feature is to parse command lines of the form:

  • command subcommand options where the list of options depends on the value of the subcommand argument.
  • since 4.01
val parse_argv : + ?current:int ref -> + string array -> + (key * spec * doc) list -> + anon_fun -> + usage_msg -> + unit

Arg.parse_argv ~current args speclist anon_fun usage_msg parses the array args as if it were the command line. It uses and updates the value of ~current (if given), or Arg.current. You must set it before calling parse_argv. The initial value of current is the index of the program name (argument 0) in the array. If an error occurs, Arg.parse_argv raises Arg.Bad with the error message as argument. If option -help or --help is given, Arg.parse_argv raises Arg.Help with the help message as argument.

val parse_argv_dynamic : + ?current:int ref -> + string array -> + (key * spec * doc) list ref -> + anon_fun -> + string -> + unit

Same as Arg.parse_argv, except that the speclist argument is a reference and may be updated during the parsing. See Arg.parse_dynamic.

  • since 4.01
val parse_and_expand_argv_dynamic : + int ref -> + string array ref -> + (key * spec * doc) list ref -> + anon_fun -> + string -> + unit

Same as Arg.parse_argv_dynamic, except that the argv argument is a reference and may be updated during the parsing of Expand arguments. See Arg.parse_argv_dynamic.

  • since 4.05
val parse_expand : (key * spec * doc) list -> anon_fun -> usage_msg -> unit

Same as Arg.parse, except that the Expand arguments are allowed and the current reference is not updated.

  • since 4.05
exception Help of string

Raised by Arg.parse_argv when the user asks for help.

exception Bad of string

Functions in spec or anon_fun can raise Arg.Bad with an error message to reject invalid arguments. Arg.Bad is also raised by Arg.parse_argv in case of an error.

val usage : (key * spec * doc) list -> usage_msg -> unit

Arg.usage speclist usage_msg prints to standard error an error message that includes the list of valid options. This is the same message that Arg.parse prints in case of error. speclist and usage_msg are the same as for Arg.parse.

val usage_string : (key * spec * doc) list -> usage_msg -> string

Returns the message that would have been printed by Arg.usage, if provided with the same parameters.

val align : ?limit:int -> (key * spec * doc) list -> (key * spec * doc) list

Align the documentation strings by inserting spaces at the first alignment separator (tab or, if tab is not found, space), according to the length of the keyword. Use a alignment separator as the first character in a doc string if you want to align the whole string. The doc strings corresponding to Symbol arguments are aligned on the next line.

  • parameter limit

    options with keyword and message longer than limit will not be used to compute the alignment.

val current : int ref

Position (in Sys.argv) of the argument being processed. You can change this value, e.g. to force Arg.parse to skip some arguments. Arg.parse uses the initial value of Arg.current as the index of argument 0 (the program name) and starts parsing arguments at the next element.

val read_arg : string -> string array

Arg.read_arg file reads newline-terminated command line arguments from file file.

  • since 4.05
val read_arg0 : string -> string array

Identical to Arg.read_arg but assumes null character terminated command line arguments.

  • since 4.05
val write_arg : string -> string array -> unit

Arg.write_arg file args writes the arguments args newline-terminated into the file file. If any of the arguments in args contains a newline, use Arg.write_arg0 instead.

  • since 4.05
val write_arg0 : string -> string array -> unit

Identical to Arg.write_arg but uses the null character for terminator instead of newline.

  • since 4.05
diff --git a/ocaml/Stdlib/Array/index.html b/ocaml/Stdlib/Array/index.html new file mode 100644 index 00000000..f8cc2e13 --- /dev/null +++ b/ocaml/Stdlib/Array/index.html @@ -0,0 +1,19 @@ + +Array (ocaml.Stdlib.Array)

Module Stdlib.Array

Array operations.

The labeled version of this module can be used as described in the StdLabels module.

type 'a t = 'a array

An alias for the type of arrays.

val length : 'a array -> int

Return the length (number of elements) of the given array.

val get : 'a array -> int -> 'a

get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

val set : 'a array -> int -> 'a -> unit

set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

val make : int -> 'a -> 'a array

make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

  • raises Invalid_argument

    if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

val create_float : int -> float array

create_float n returns a fresh float array of length n, with uninitialized data.

  • since 4.03
val init : int -> (int -> 'a) -> 'a array

init n f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied in order to the integers 0 to n-1.

  • raises Invalid_argument

    if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

val make_matrix : int -> int -> 'a -> 'a array array

make_matrix dimx dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

  • raises Invalid_argument

    if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

val append : 'a array -> 'a array -> 'a array

append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

val concat : 'a array list -> 'a array

Same as append, but concatenates a list of arrays.

val sub : 'a array -> int -> int -> 'a array

sub a pos len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

  • raises Invalid_argument

    if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

val copy : 'a array -> 'a array

copy a returns a copy of a, that is, a fresh array containing the same elements as a.

val fill : 'a array -> int -> int -> 'a -> unit

fill a pos len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

val blit : 'a array -> int -> 'a array -> int -> int -> unit

blit src src_pos dst dst_pos len copies len elements from array src, starting at element number src_pos, to array dst, starting at element number dst_pos. It works correctly even if src and dst are the same array, and the source and destination chunks overlap.

  • raises Invalid_argument

    if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

val to_list : 'a array -> 'a list

to_list a returns the list of all the elements of a.

val of_list : 'a list -> 'a array

of_list l returns a fresh array containing the elements of l.

  • raises Invalid_argument

    if the length of l is greater than Sys.max_array_length.

Iterators

val iter : ('a -> unit) -> 'a array -> unit

iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

val iteri : (int -> 'a -> unit) -> 'a array -> unit

Same as iter, but the function is applied to the index of the element as first argument, and the element itself as second argument.

val map : ('a -> 'b) -> 'a array -> 'b array

map f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

val map_inplace : ('a -> 'a) -> 'a array -> unit

map_inplace f a applies function f to all elements of a, and updates their values in place.

  • since 5.1
val mapi : (int -> 'a -> 'b) -> 'a array -> 'b array

Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

val mapi_inplace : (int -> 'a -> 'a) -> 'a array -> unit

Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

  • since 5.1
val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a array -> 'acc

fold_left f init a computes f (... (f (f init a.(0)) a.(1)) ...) a.(n-1), where n is the length of the array a.

val fold_left_map : + ('acc -> 'a -> 'acc * 'b) -> + 'acc -> + 'a array -> + 'acc * 'b array

fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

  • since 4.13
val fold_right : ('a -> 'acc -> 'acc) -> 'a array -> 'acc -> 'acc

fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

Iterators on two arrays

val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit

iter2 f a b applies function f to all the elements of a and b.

  • since 4.03 (4.05 in ArrayLabels)
val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

map2 f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

  • since 4.03 (4.05 in ArrayLabels)

Array scanning

val for_all : ('a -> bool) -> 'a array -> bool

for_all f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

  • since 4.03
val exists : ('a -> bool) -> 'a array -> bool

exists f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

  • since 4.03
val for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

Same as for_all, but for a two-argument predicate.

  • since 4.11
val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

Same as exists, but for a two-argument predicate.

  • since 4.11
val mem : 'a -> 'a array -> bool

mem a set is true if and only if a is structurally equal to an element of l (i.e. there is an x in l such that compare a x = 0).

  • since 4.03
val memq : 'a -> 'a array -> bool

Same as mem, but uses physical equality instead of structural equality to compare list elements.

  • since 4.03
val find_opt : ('a -> bool) -> 'a array -> 'a option

find_opt f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

  • since 4.13
val find_index : ('a -> bool) -> 'a array -> int option

find_index f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

It returns None if there is no such element.

  • since 5.1
val find_map : ('a -> 'b option) -> 'a array -> 'b option

find_map f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

  • since 4.13
val find_mapi : (int -> 'a -> 'b option) -> 'a array -> 'b option

Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 5.1

Arrays of pairs

val split : ('a * 'b) array -> 'a array * 'b array

split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

  • since 4.13
val combine : 'a array -> 'b array -> ('a * 'b) array

combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

  • since 4.13

Sorting

val sort : ('a -> 'a -> int) -> 'a array -> unit

Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

The current implementation uses Heap Sort. It runs in constant stack space.

Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

  • cmp x y > 0 if and only if cmp y x < 0
  • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

  • cmp a.(i) a.(j) >= 0 if and only if i >= j
val stable_sort : ('a -> 'a -> int) -> 'a array -> unit

Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

val fast_sort : ('a -> 'a -> int) -> 'a array -> unit

Same as sort or stable_sort, whichever is faster on typical input.

Arrays and Sequences

val to_seq : 'a array -> 'a Seq.t

Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

  • since 4.07
val to_seqi : 'a array -> (int * 'a) Seq.t

Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

  • since 4.07
val of_seq : 'a Seq.t -> 'a array

Create an array from the generator

  • since 4.07

Arrays and concurrency safety

Care must be taken when concurrently accessing arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

Atomicity

Every array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

For example, consider the following program:

let size = 100_000_000
+let a = Array.make size 1
+let d1 = Domain.spawn (fun () ->
+   Array.iteri (fun i x -> a.(i) <- x + 1) a
+)
+let d2 = Domain.spawn (fun () ->
+  Array.iteri (fun i x -> a.(i) <- 2 * x + 1) a
+)
+let () = Domain.join d1; Domain.join d2

After executing this code, each field of the array a is either 2, 3, 4 or 5. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

Data races

If two domains only access disjoint parts of the array, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

A data race is said to occur when two domains access the same array element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the array elements.

Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location (with a few exceptions for float arrays).

Float arrays

Float arrays have two supplementary caveats in the presence of data races.

First, the blit operation might copy an array byte-by-byte. Data races between such a blit operation and another operation might produce surprising values due to tearing: partial writes interleaved with other operations can create float values that would not exist with a sequential execution.

For instance, at the end of

let zeros = Array.make size 0.
+let max_floats = Array.make size Float.max_float
+let res = Array.copy zeros
+let d1 = Domain.spawn (fun () -> Array.blit zeros 0 res 0 size)
+let d2 = Domain.spawn (fun () -> Array.blit max_floats 0 res 0 size)
+let () = Domain.join d1; Domain.join d2

the res array might contain values that are neither 0. nor max_float.

Second, on 32-bit architectures, getting or setting a field involves two separate memory accesses. In the presence of data races, the user may observe tearing on any operation.

diff --git a/ocaml/Stdlib/ArrayLabels/index.html b/ocaml/Stdlib/ArrayLabels/index.html new file mode 100644 index 00000000..2e69f81a --- /dev/null +++ b/ocaml/Stdlib/ArrayLabels/index.html @@ -0,0 +1,25 @@ + +ArrayLabels (ocaml.Stdlib.ArrayLabels)

Module Stdlib.ArrayLabels

Array operations.

The labeled version of this module can be used as described in the StdLabels module.

type 'a t = 'a array

An alias for the type of arrays.

val length : 'a array -> int

Return the length (number of elements) of the given array.

val get : 'a array -> int -> 'a

get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

val set : 'a array -> int -> 'a -> unit

set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

val make : int -> 'a -> 'a array

make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

  • raises Invalid_argument

    if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

val create_float : int -> float array

create_float n returns a fresh float array of length n, with uninitialized data.

  • since 4.03
val init : int -> f:(int -> 'a) -> 'a array

init n ~f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied in order to the integers 0 to n-1.

  • raises Invalid_argument

    if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array

make_matrix ~dimx ~dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

  • raises Invalid_argument

    if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

val append : 'a array -> 'a array -> 'a array

append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

val concat : 'a array list -> 'a array

Same as append, but concatenates a list of arrays.

val sub : 'a array -> pos:int -> len:int -> 'a array

sub a ~pos ~len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

  • raises Invalid_argument

    if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

val copy : 'a array -> 'a array

copy a returns a copy of a, that is, a fresh array containing the same elements as a.

val fill : 'a array -> pos:int -> len:int -> 'a -> unit

fill a ~pos ~len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

val blit : + src:'a array -> + src_pos:int -> + dst:'a array -> + dst_pos:int -> + len:int -> + unit

blit ~src ~src_pos ~dst ~dst_pos ~len copies len elements from array src, starting at element number src_pos, to array dst, starting at element number dst_pos. It works correctly even if src and dst are the same array, and the source and destination chunks overlap.

  • raises Invalid_argument

    if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

val to_list : 'a array -> 'a list

to_list a returns the list of all the elements of a.

val of_list : 'a list -> 'a array

of_list l returns a fresh array containing the elements of l.

  • raises Invalid_argument

    if the length of l is greater than Sys.max_array_length.

Iterators

val iter : f:('a -> unit) -> 'a array -> unit

iter ~f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

val iteri : f:(int -> 'a -> unit) -> 'a array -> unit

Same as iter, but the function is applied to the index of the element as first argument, and the element itself as second argument.

val map : f:('a -> 'b) -> 'a array -> 'b array

map ~f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

val map_inplace : f:('a -> 'a) -> 'a array -> unit

map_inplace ~f a applies function f to all elements of a, and updates their values in place.

  • since 5.1
val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array

Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

val mapi_inplace : f:(int -> 'a -> 'a) -> 'a array -> unit

Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

  • since 5.1
val fold_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a array -> 'acc

fold_left ~f ~init a computes f (... (f (f init a.(0)) a.(1)) ...) a.(n-1), where n is the length of the array a.

val fold_left_map : + f:('acc -> 'a -> 'acc * 'b) -> + init:'acc -> + 'a array -> + 'acc * 'b array

fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

  • since 4.13
val fold_right : f:('a -> 'acc -> 'acc) -> 'a array -> init:'acc -> 'acc

fold_right ~f a ~init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

Iterators on two arrays

val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit

iter2 ~f a b applies function f to all the elements of a and b.

  • since 4.05
val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

map2 ~f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

  • since 4.05

Array scanning

val for_all : f:('a -> bool) -> 'a array -> bool

for_all ~f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

  • since 4.03
val exists : f:('a -> bool) -> 'a array -> bool

exists ~f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

  • since 4.03
val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

Same as for_all, but for a two-argument predicate.

  • since 4.11
val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

Same as exists, but for a two-argument predicate.

  • since 4.11
val mem : 'a -> set:'a array -> bool

mem a ~set is true if and only if a is structurally equal to an element of l (i.e. there is an x in l such that compare a x = 0).

  • since 4.03
val memq : 'a -> set:'a array -> bool

Same as mem, but uses physical equality instead of structural equality to compare list elements.

  • since 4.03
val find_opt : f:('a -> bool) -> 'a array -> 'a option

find_opt ~f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

  • since 4.13
val find_index : f:('a -> bool) -> 'a array -> int option

find_index ~f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

It returns None if there is no such element.

  • since 5.1
val find_map : f:('a -> 'b option) -> 'a array -> 'b option

find_map ~f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

  • since 4.13
val find_mapi : f:(int -> 'a -> 'b option) -> 'a array -> 'b option

Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 5.1

Arrays of pairs

val split : ('a * 'b) array -> 'a array * 'b array

split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

  • since 4.13
val combine : 'a array -> 'b array -> ('a * 'b) array

combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

  • since 4.13

Sorting

val sort : cmp:('a -> 'a -> int) -> 'a array -> unit

Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

The current implementation uses Heap Sort. It runs in constant stack space.

Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

  • cmp x y > 0 if and only if cmp y x < 0
  • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

  • cmp a.(i) a.(j) >= 0 if and only if i >= j
val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

val fast_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

Same as sort or stable_sort, whichever is faster on typical input.

Arrays and Sequences

val to_seq : 'a array -> 'a Seq.t

Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

  • since 4.07
val to_seqi : 'a array -> (int * 'a) Seq.t

Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

  • since 4.07
val of_seq : 'a Seq.t -> 'a array

Create an array from the generator

  • since 4.07

Arrays and concurrency safety

Care must be taken when concurrently accessing arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

Atomicity

Every array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

For example, consider the following program:

let size = 100_000_000
+let a = ArrayLabels.make size 1
+let d1 = Domain.spawn (fun () ->
+   ArrayLabels.iteri ~f:(fun i x -> a.(i) <- x + 1) a
+)
+let d2 = Domain.spawn (fun () ->
+  ArrayLabels.iteri ~f:(fun i x -> a.(i) <- 2 * x + 1) a
+)
+let () = Domain.join d1; Domain.join d2

After executing this code, each field of the array a is either 2, 3, 4 or 5. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

Data races

If two domains only access disjoint parts of the array, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

A data race is said to occur when two domains access the same array element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the array elements.

Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location (with a few exceptions for float arrays).

Float arrays

Float arrays have two supplementary caveats in the presence of data races.

First, the blit operation might copy an array byte-by-byte. Data races between such a blit operation and another operation might produce surprising values due to tearing: partial writes interleaved with other operations can create float values that would not exist with a sequential execution.

For instance, at the end of

let zeros = Array.make size 0.
+let max_floats = Array.make size Float.max_float
+let res = Array.copy zeros
+let d1 = Domain.spawn (fun () -> Array.blit zeros 0 res 0 size)
+let d2 = Domain.spawn (fun () -> Array.blit max_floats 0 res 0 size)
+let () = Domain.join d1; Domain.join d2

the res array might contain values that are neither 0. nor max_float.

Second, on 32-bit architectures, getting or setting a field involves two separate memory accesses. In the presence of data races, the user may observe tearing on any operation.

diff --git a/ocaml/Stdlib/Atomic/index.html b/ocaml/Stdlib/Atomic/index.html new file mode 100644 index 00000000..0f9c905f --- /dev/null +++ b/ocaml/Stdlib/Atomic/index.html @@ -0,0 +1,64 @@ + +Atomic (ocaml.Stdlib.Atomic)

Module Stdlib.Atomic

Atomic references.

See the examples below. See 'Memory model: The hard bits' chapter in the manual.

  • since 4.12
type !'a t

An atomic (mutable) reference to a value of type 'a.

val make : 'a -> 'a t

Create an atomic reference.

val get : 'a t -> 'a

Get the current value of the atomic reference.

val set : 'a t -> 'a -> unit

Set a new value for the atomic reference.

val exchange : 'a t -> 'a -> 'a

Set a new value for the atomic reference, and return the current value.

val compare_and_set : 'a t -> 'a -> 'a -> bool

compare_and_set r seen v sets the new value of r to v only if its current value is physically equal to seen -- the comparison and the set occur atomically. Returns true if the comparison succeeded (so the set happened) and false otherwise.

val fetch_and_add : int t -> int -> int

fetch_and_add r n atomically increments the value of r by n, and returns the current value (before the increment).

val incr : int t -> unit

incr r atomically increments the value of r by 1.

val decr : int t -> unit

decr r atomically decrements the value of r by 1.

Examples

Basic Thread Coordination

A basic use case is to have global counters that are updated in a thread-safe way, for example to keep some sorts of metrics over IOs performed by the program. Another basic use case is to coordinate the termination of threads in a given program, for example when one thread finds an answer, or when the program is shut down by the user.

Here, for example, we're going to try to find a number whose hash satisfies a basic property. To do that, we'll run multiple threads which will try random numbers until they find one that works.

Of course the output below is a sample run and will change every time the program is run.

(* use for termination *)
+let stop_all_threads = Atomic.make false
+
+(* total number of individual attempts to find a number *)
+let num_attempts = Atomic.make 0
+
+(* find a number that satisfies [p], by... trying random numbers
+   until one fits. *)
+let find_number_where (p:int -> bool) =
+  let rand = Random.State.make_self_init() in
+  while not (Atomic.get stop_all_threads) do
+
+    let n = Random.State.full_int rand max_int in
+    ignore (Atomic.fetch_and_add num_attempts 1 : int);
+
+    if p (Hashtbl.hash n) then (
+      Printf.printf "found %d (hash=%d)\n%!" n (Hashtbl.hash n);
+      Atomic.set stop_all_threads true; (* signal all threads to stop *)
+    )
+  done;;
+
+
+(* run multiple domains to search for a [n] where [hash n <= 100] *)
+let () =
+  let criterion n = n <= 100 in
+  let threads =
+    Array.init 8
+      (fun _ -> Domain.spawn (fun () -> find_number_where criterion))
+  in
+  Array.iter Domain.join threads;
+  Printf.printf "total number of attempts: %d\n%!"
+    (Atomic.get num_attempts) ;;
+
+- : unit = ()
+found 1651745641680046833 (hash=33)
+total number of attempts: 30230350

Treiber Stack

Another example is a basic Treiber stack (a thread-safe stack) that can be safely shared between threads.

Note how both push and pop are recursive, because they attempt to swap the new stack (with one more, or one fewer, element) with the old stack. This is optimistic concurrency: each iteration of, say, push stack x gets the old stack l, and hopes that by the time it tries to replace l with x::l, nobody else has had time to modify the list. If the compare_and_set fails it means we were too optimistic, and must try again.

type 'a stack = 'a list Atomic.t
+
+let rec push (stack: _ stack) elt : unit =
+  let cur = Atomic.get stack in
+  let success = Atomic.compare_and_set stack cur (elt :: cur) in
+  if not success then
+    push stack elt
+
+let rec pop (stack: _ stack) : _ option =
+  let cur = Atomic.get stack in
+  match cur with
+  | [] -> None
+  | x :: tail ->
+    let success = Atomic.compare_and_set stack cur tail in
+    if success then Some x
+    else pop stack
+
+# let st = Atomic.make []
+# push st 1
+- : unit = ()
+# push st 2
+- : unit = ()
+# pop st
+- : int option = Some 2
+# pop st
+- : int option = Some 1
+# pop st
+- : int option = None
diff --git a/ocaml/Stdlib/Bigarray/Array0/index.html b/ocaml/Stdlib/Bigarray/Array0/index.html new file mode 100644 index 00000000..e2eb398e --- /dev/null +++ b/ocaml/Stdlib/Bigarray/Array0/index.html @@ -0,0 +1,2 @@ + +Array0 (ocaml.Stdlib.Bigarray.Array0)

Module Bigarray.Array0

Zero-dimensional arrays. The Array0 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of zero-dimensional arrays that only contain a single scalar value. Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

  • since 4.05
type (!'a, !'b, !'c) t

The type of zero-dimensional Bigarrays whose elements have OCaml type 'a, representation kind 'b, and memory layout 'c.

val create : ('a, 'b) kind -> 'c layout -> ('a, 'b, 'c) t

Array0.create kind layout returns a new Bigarray of zero dimension. kind and layout determine the array element kind and the array layout as described for Genarray.create.

val init : ('a, 'b) kind -> 'c layout -> 'a -> ('a, 'b, 'c) t

Array0.init kind layout v behaves like Array0.create kind layout except that the element is additionally initialized to the value v.

  • since 4.12
val kind : ('a, 'b, 'c) t -> ('a, 'b) kind

Return the kind of the given Bigarray.

val layout : ('a, 'b, 'c) t -> 'c layout

Return the layout of the given Bigarray.

val change_layout : ('a, 'b, 'c) t -> 'd layout -> ('a, 'b, 'd) t

Array0.change_layout a layout returns a Bigarray with the specified layout, sharing the data with a. No copying of elements is involved: the new array and the original array share the same storage space.

  • since 4.06
val size_in_bytes : ('a, 'b, 'c) t -> int

size_in_bytes a is a's kind_size_in_bytes.

val get : ('a, 'b, 'c) t -> 'a

Array0.get a returns the only element in a.

val set : ('a, 'b, 'c) t -> 'a -> unit

Array0.set a x v stores the value v in a.

val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit

Copy the first Bigarray to the second Bigarray. See Genarray.blit for more details.

val fill : ('a, 'b, 'c) t -> 'a -> unit

Fill the given Bigarray with the given value. See Genarray.fill for more details.

val of_value : ('a, 'b) kind -> 'c layout -> 'a -> ('a, 'b, 'c) t

Build a zero-dimensional Bigarray initialized from the given value.

diff --git a/ocaml/Stdlib/Bigarray/Array1/index.html b/ocaml/Stdlib/Bigarray/Array1/index.html new file mode 100644 index 00000000..4131ab89 --- /dev/null +++ b/ocaml/Stdlib/Bigarray/Array1/index.html @@ -0,0 +1,2 @@ + +Array1 (ocaml.Stdlib.Bigarray.Array1)

Module Bigarray.Array1

One-dimensional arrays. The Array1 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of one-dimensional arrays. (The Array2 and Array3 structures below provide operations specialized for two- and three-dimensional arrays.) Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

type (!'a, !'b, !'c) t

The type of one-dimensional Bigarrays whose elements have OCaml type 'a, representation kind 'b, and memory layout 'c.

val create : ('a, 'b) kind -> 'c layout -> int -> ('a, 'b, 'c) t

Array1.create kind layout dim returns a new Bigarray of one dimension, whose size is dim. kind and layout determine the array element kind and the array layout as described for Genarray.create.

val init : ('a, 'b) kind -> 'c layout -> int -> (int -> 'a) -> ('a, 'b, 'c) t

Array1.init kind layout dim f returns a new Bigarray b of one dimension, whose size is dim. kind and layout determine the array element kind and the array layout as described for Genarray.create.

Each element Array1.get b i of the array is initialized to the result of f i.

In other words, Array1.init kind layout dimensions f tabulates the results of f applied to the indices of a new Bigarray whose layout is described by kind, layout and dim.

  • since 4.12
val dim : ('a, 'b, 'c) t -> int

Return the size (dimension) of the given one-dimensional Bigarray.

val kind : ('a, 'b, 'c) t -> ('a, 'b) kind

Return the kind of the given Bigarray.

val layout : ('a, 'b, 'c) t -> 'c layout

Return the layout of the given Bigarray.

val change_layout : ('a, 'b, 'c) t -> 'd layout -> ('a, 'b, 'd) t

Array1.change_layout a layout returns a Bigarray with the specified layout, sharing the data with a (and hence having the same dimension as a). No copying of elements is involved: the new array and the original array share the same storage space.

  • since 4.06
val size_in_bytes : ('a, 'b, 'c) t -> int

size_in_bytes a is the number of elements in a multiplied by a's kind_size_in_bytes.

  • since 4.03
val get : ('a, 'b, 'c) t -> int -> 'a

Array1.get a x, or alternatively a.{x}, returns the element of a at index x. x must be greater or equal than 0 and strictly less than Array1.dim a if a has C layout. If a has Fortran layout, x must be greater or equal than 1 and less or equal than Array1.dim a. Otherwise, Invalid_argument is raised.

val set : ('a, 'b, 'c) t -> int -> 'a -> unit

Array1.set a x v, also written a.{x} <- v, stores the value v at index x in a. x must be inside the bounds of a as described in Bigarray.Array1.get; otherwise, Invalid_argument is raised.

val sub : ('a, 'b, 'c) t -> int -> int -> ('a, 'b, 'c) t

Extract a sub-array of the given one-dimensional Bigarray. See Genarray.sub_left for more details.

val slice : ('a, 'b, 'c) t -> int -> ('a, 'b, 'c) Array0.t

Extract a scalar (zero-dimensional slice) of the given one-dimensional Bigarray. The integer parameter is the index of the scalar to extract. See Bigarray.Genarray.slice_left and Bigarray.Genarray.slice_right for more details.

  • since 4.05
val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit

Copy the first Bigarray to the second Bigarray. See Genarray.blit for more details.

val fill : ('a, 'b, 'c) t -> 'a -> unit

Fill the given Bigarray with the given value. See Genarray.fill for more details.

val of_array : ('a, 'b) kind -> 'c layout -> 'a array -> ('a, 'b, 'c) t

Build a one-dimensional Bigarray initialized from the given array.

val unsafe_get : ('a, 'b, 'c) t -> int -> 'a

Like Bigarray.Array1.get, but bounds checking is not always performed. Use with caution and only when the program logic guarantees that the access is within bounds.

val unsafe_set : ('a, 'b, 'c) t -> int -> 'a -> unit

Like Bigarray.Array1.set, but bounds checking is not always performed. Use with caution and only when the program logic guarantees that the access is within bounds.

diff --git a/ocaml/Stdlib/Bigarray/Array2/index.html b/ocaml/Stdlib/Bigarray/Array2/index.html new file mode 100644 index 00000000..8c3b8ea6 --- /dev/null +++ b/ocaml/Stdlib/Bigarray/Array2/index.html @@ -0,0 +1,15 @@ + +Array2 (ocaml.Stdlib.Bigarray.Array2)

Module Bigarray.Array2

Two-dimensional arrays. The Array2 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of two-dimensional arrays.

type (!'a, !'b, !'c) t

The type of two-dimensional Bigarrays whose elements have OCaml type 'a, representation kind 'b, and memory layout 'c.

val create : ('a, 'b) kind -> 'c layout -> int -> int -> ('a, 'b, 'c) t

Array2.create kind layout dim1 dim2 returns a new Bigarray of two dimensions, whose size is dim1 in the first dimension and dim2 in the second dimension. kind and layout determine the array element kind and the array layout as described for Bigarray.Genarray.create.

val init : + ('a, 'b) kind -> + 'c layout -> + int -> + int -> + (int -> int -> 'a) -> + ('a, 'b, 'c) t

Array2.init kind layout dim1 dim2 f returns a new Bigarray b of two dimensions, whose size is dim2 in the first dimension and dim2 in the second dimension. kind and layout determine the array element kind and the array layout as described for Bigarray.Genarray.create.

Each element Array2.get b i j of the array is initialized to the result of f i j.

In other words, Array2.init kind layout dim1 dim2 f tabulates the results of f applied to the indices of a new Bigarray whose layout is described by kind, layout, dim1 and dim2.

  • since 4.12
val dim1 : ('a, 'b, 'c) t -> int

Return the first dimension of the given two-dimensional Bigarray.

val dim2 : ('a, 'b, 'c) t -> int

Return the second dimension of the given two-dimensional Bigarray.

val kind : ('a, 'b, 'c) t -> ('a, 'b) kind

Return the kind of the given Bigarray.

val layout : ('a, 'b, 'c) t -> 'c layout

Return the layout of the given Bigarray.

val change_layout : ('a, 'b, 'c) t -> 'd layout -> ('a, 'b, 'd) t

Array2.change_layout a layout returns a Bigarray with the specified layout, sharing the data with a (and hence having the same dimensions as a). No copying of elements is involved: the new array and the original array share the same storage space. The dimensions are reversed, such that get v [| a; b |] in C layout becomes get v [| b+1; a+1 |] in Fortran layout.

  • since 4.06
val size_in_bytes : ('a, 'b, 'c) t -> int

size_in_bytes a is the number of elements in a multiplied by a's kind_size_in_bytes.

  • since 4.03
val get : ('a, 'b, 'c) t -> int -> int -> 'a

Array2.get a x y, also written a.{x,y}, returns the element of a at coordinates (x, y). x and y must be within the bounds of a, as described for Bigarray.Genarray.get; otherwise, Invalid_argument is raised.

val set : ('a, 'b, 'c) t -> int -> int -> 'a -> unit

Array2.set a x y v, or alternatively a.{x,y} <- v, stores the value v at coordinates (x, y) in a. x and y must be within the bounds of a, as described for Bigarray.Genarray.set; otherwise, Invalid_argument is raised.

val sub_left : ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) t

Extract a two-dimensional sub-array of the given two-dimensional Bigarray by restricting the first dimension. See Bigarray.Genarray.sub_left for more details. Array2.sub_left applies only to arrays with C layout.

val sub_right : + ('a, 'b, fortran_layout) t -> + int -> + int -> + ('a, 'b, fortran_layout) t

Extract a two-dimensional sub-array of the given two-dimensional Bigarray by restricting the second dimension. See Bigarray.Genarray.sub_right for more details. Array2.sub_right applies only to arrays with Fortran layout.

val slice_left : ('a, 'b, c_layout) t -> int -> ('a, 'b, c_layout) Array1.t

Extract a row (one-dimensional slice) of the given two-dimensional Bigarray. The integer parameter is the index of the row to extract. See Bigarray.Genarray.slice_left for more details. Array2.slice_left applies only to arrays with C layout.

val slice_right : + ('a, 'b, fortran_layout) t -> + int -> + ('a, 'b, fortran_layout) Array1.t

Extract a column (one-dimensional slice) of the given two-dimensional Bigarray. The integer parameter is the index of the column to extract. See Bigarray.Genarray.slice_right for more details. Array2.slice_right applies only to arrays with Fortran layout.

val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit

Copy the first Bigarray to the second Bigarray. See Bigarray.Genarray.blit for more details.

val fill : ('a, 'b, 'c) t -> 'a -> unit

Fill the given Bigarray with the given value. See Bigarray.Genarray.fill for more details.

val of_array : ('a, 'b) kind -> 'c layout -> 'a array array -> ('a, 'b, 'c) t

Build a two-dimensional Bigarray initialized from the given array of arrays.

val unsafe_get : ('a, 'b, 'c) t -> int -> int -> 'a

Like Bigarray.Array2.get, but bounds checking is not always performed.

val unsafe_set : ('a, 'b, 'c) t -> int -> int -> 'a -> unit

Like Bigarray.Array2.set, but bounds checking is not always performed.

diff --git a/ocaml/Stdlib/Bigarray/Array3/index.html b/ocaml/Stdlib/Bigarray/Array3/index.html new file mode 100644 index 00000000..d9520e0a --- /dev/null +++ b/ocaml/Stdlib/Bigarray/Array3/index.html @@ -0,0 +1,28 @@ + +Array3 (ocaml.Stdlib.Bigarray.Array3)

Module Bigarray.Array3

Three-dimensional arrays. The Array3 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of three-dimensional arrays.

type (!'a, !'b, !'c) t

The type of three-dimensional Bigarrays whose elements have OCaml type 'a, representation kind 'b, and memory layout 'c.

val create : ('a, 'b) kind -> 'c layout -> int -> int -> int -> ('a, 'b, 'c) t

Array3.create kind layout dim1 dim2 dim3 returns a new Bigarray of three dimensions, whose size is dim1 in the first dimension, dim2 in the second dimension, and dim3 in the third. kind and layout determine the array element kind and the array layout as described for Bigarray.Genarray.create.

val init : + ('a, 'b) kind -> + 'c layout -> + int -> + int -> + int -> + (int -> int -> int -> 'a) -> + ('a, 'b, 'c) t

Array3.init kind layout dim1 dim2 dim3 f returns a new Bigarray b of three dimensions, whose size is dim1 in the first dimension, dim2 in the second dimension, and dim3 in the third. kind and layout determine the array element kind and the array layout as described for Bigarray.Genarray.create.

Each element Array3.get b i j k of the array is initialized to the result of f i j k.

In other words, Array3.init kind layout dim1 dim2 dim3 f tabulates the results of f applied to the indices of a new Bigarray whose layout is described by kind, layout, dim1, dim2 and dim3.

  • since 4.12
val dim1 : ('a, 'b, 'c) t -> int

Return the first dimension of the given three-dimensional Bigarray.

val dim2 : ('a, 'b, 'c) t -> int

Return the second dimension of the given three-dimensional Bigarray.

val dim3 : ('a, 'b, 'c) t -> int

Return the third dimension of the given three-dimensional Bigarray.

val kind : ('a, 'b, 'c) t -> ('a, 'b) kind

Return the kind of the given Bigarray.

val layout : ('a, 'b, 'c) t -> 'c layout

Return the layout of the given Bigarray.

val change_layout : ('a, 'b, 'c) t -> 'd layout -> ('a, 'b, 'd) t

Array3.change_layout a layout returns a Bigarray with the specified layout, sharing the data with a (and hence having the same dimensions as a). No copying of elements is involved: the new array and the original array share the same storage space. The dimensions are reversed, such that get v [| a; b; c |] in C layout becomes get v [| c+1; b+1; a+1 |] in Fortran layout.

  • since 4.06
val size_in_bytes : ('a, 'b, 'c) t -> int

size_in_bytes a is the number of elements in a multiplied by a's kind_size_in_bytes.

  • since 4.03
val get : ('a, 'b, 'c) t -> int -> int -> int -> 'a

Array3.get a x y z, also written a.{x,y,z}, returns the element of a at coordinates (x, y, z). x, y and z must be within the bounds of a, as described for Bigarray.Genarray.get; otherwise, Invalid_argument is raised.

val set : ('a, 'b, 'c) t -> int -> int -> int -> 'a -> unit

Array3.set a x y v, or alternatively a.{x,y,z} <- v, stores the value v at coordinates (x, y, z) in a. x, y and z must be within the bounds of a, as described for Bigarray.Genarray.set; otherwise, Invalid_argument is raised.

val sub_left : ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) t

Extract a three-dimensional sub-array of the given three-dimensional Bigarray by restricting the first dimension. See Bigarray.Genarray.sub_left for more details. Array3.sub_left applies only to arrays with C layout.

val sub_right : + ('a, 'b, fortran_layout) t -> + int -> + int -> + ('a, 'b, fortran_layout) t

Extract a three-dimensional sub-array of the given three-dimensional Bigarray by restricting the second dimension. See Bigarray.Genarray.sub_right for more details. Array3.sub_right applies only to arrays with Fortran layout.

val slice_left_1 : + ('a, 'b, c_layout) t -> + int -> + int -> + ('a, 'b, c_layout) Array1.t

Extract a one-dimensional slice of the given three-dimensional Bigarray by fixing the first two coordinates. The integer parameters are the coordinates of the slice to extract. See Bigarray.Genarray.slice_left for more details. Array3.slice_left_1 applies only to arrays with C layout.

val slice_right_1 : + ('a, 'b, fortran_layout) t -> + int -> + int -> + ('a, 'b, fortran_layout) Array1.t

Extract a one-dimensional slice of the given three-dimensional Bigarray by fixing the last two coordinates. The integer parameters are the coordinates of the slice to extract. See Bigarray.Genarray.slice_right for more details. Array3.slice_right_1 applies only to arrays with Fortran layout.

val slice_left_2 : ('a, 'b, c_layout) t -> int -> ('a, 'b, c_layout) Array2.t

Extract a two-dimensional slice of the given three-dimensional Bigarray by fixing the first coordinate. The integer parameter is the first coordinate of the slice to extract. See Bigarray.Genarray.slice_left for more details. Array3.slice_left_2 applies only to arrays with C layout.

val slice_right_2 : + ('a, 'b, fortran_layout) t -> + int -> + ('a, 'b, fortran_layout) Array2.t

Extract a two-dimensional slice of the given three-dimensional Bigarray by fixing the last coordinate. The integer parameter is the coordinate of the slice to extract. See Bigarray.Genarray.slice_right for more details. Array3.slice_right_2 applies only to arrays with Fortran layout.

val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit

Copy the first Bigarray to the second Bigarray. See Bigarray.Genarray.blit for more details.

val fill : ('a, 'b, 'c) t -> 'a -> unit

Fill the given Bigarray with the given value. See Bigarray.Genarray.fill for more details.

val of_array : + ('a, 'b) kind -> + 'c layout -> + 'a array array array -> + ('a, 'b, 'c) t

Build a three-dimensional Bigarray initialized from the given array of arrays of arrays.

val unsafe_get : ('a, 'b, 'c) t -> int -> int -> int -> 'a

Like Bigarray.Array3.get, but bounds checking is not always performed.

val unsafe_set : ('a, 'b, 'c) t -> int -> int -> int -> 'a -> unit

Like Bigarray.Array3.set, but bounds checking is not always performed.

diff --git a/ocaml/Stdlib/Bigarray/Genarray/index.html b/ocaml/Stdlib/Bigarray/Genarray/index.html new file mode 100644 index 00000000..98bb6438 --- /dev/null +++ b/ocaml/Stdlib/Bigarray/Genarray/index.html @@ -0,0 +1,15 @@ + +Genarray (ocaml.Stdlib.Bigarray.Genarray)

Module Bigarray.Genarray

type (!'a, !'b, !'c) t

The type Genarray.t is the type of Bigarrays with variable numbers of dimensions. Any number of dimensions between 0 and 16 is supported.

The three type parameters to Genarray.t identify the array element kind and layout, as follows:

  • the first parameter, 'a, is the OCaml type for accessing array elements (float, int, int32, int64, nativeint);
  • the second parameter, 'b, is the actual kind of array elements (float32_elt, float64_elt, int8_signed_elt, int8_unsigned_elt, etc);
  • the third parameter, 'c, identifies the array layout (c_layout or fortran_layout).

For instance, (float, float32_elt, fortran_layout) Genarray.t is the type of generic Bigarrays containing 32-bit floats in Fortran layout; reads and writes in this array use the OCaml type float.

val create : ('a, 'b) kind -> 'c layout -> int array -> ('a, 'b, 'c) t

Genarray.create kind layout dimensions returns a new Bigarray whose element kind is determined by the parameter kind (one of float32, float64, int8_signed, etc) and whose layout is determined by the parameter layout (one of c_layout or fortran_layout). The dimensions parameter is an array of integers that indicate the size of the Bigarray in each dimension. The length of dimensions determines the number of dimensions of the Bigarray.

For instance, Genarray.create int32 c_layout [|4;6;8|] returns a fresh Bigarray of 32-bit integers, in C layout, having three dimensions, the three dimensions being 4, 6 and 8 respectively.

Bigarrays returned by Genarray.create are not initialized: the initial values of array elements is unspecified.

Genarray.create raises Invalid_argument if the number of dimensions is not in the range 0 to 16 inclusive, or if one of the dimensions is negative.

val init : + ('a, 'b) kind -> + 'c layout -> + int array -> + (int array -> 'a) -> + ('a, 'b, 'c) t

Genarray.init kind layout dimensions f returns a new Bigarray b whose element kind is determined by the parameter kind (one of float32, float64, int8_signed, etc) and whose layout is determined by the parameter layout (one of c_layout or fortran_layout). The dimensions parameter is an array of integers that indicate the size of the Bigarray in each dimension. The length of dimensions determines the number of dimensions of the Bigarray.

Each element Genarray.get b i is initialized to the result of f i. In other words, Genarray.init kind layout dimensions f tabulates the results of f applied to the indices of a new Bigarray whose layout is described by kind, layout and dimensions. The index array i may be shared and mutated between calls to f.

For instance, Genarray.init int c_layout [|2; 1; 3|] + (Array.fold_left (+) 0) returns a fresh Bigarray of integers, in C layout, having three dimensions (2, 1, 3, respectively), with the element values 0, 1, 2, 1, 2, 3.

Genarray.init raises Invalid_argument if the number of dimensions is not in the range 0 to 16 inclusive, or if one of the dimensions is negative.

  • since 4.12
val num_dims : ('a, 'b, 'c) t -> int

Return the number of dimensions of the given Bigarray.

val dims : ('a, 'b, 'c) t -> int array

Genarray.dims a returns all dimensions of the Bigarray a, as an array of integers of length Genarray.num_dims a.

val nth_dim : ('a, 'b, 'c) t -> int -> int

Genarray.nth_dim a n returns the n-th dimension of the Bigarray a. The first dimension corresponds to n = 0; the second dimension corresponds to n = 1; the last dimension, to n = Genarray.num_dims a - 1.

  • raises Invalid_argument

    if n is less than 0 or greater or equal than Genarray.num_dims a.

val kind : ('a, 'b, 'c) t -> ('a, 'b) kind

Return the kind of the given Bigarray.

val layout : ('a, 'b, 'c) t -> 'c layout

Return the layout of the given Bigarray.

val change_layout : ('a, 'b, 'c) t -> 'd layout -> ('a, 'b, 'd) t

Genarray.change_layout a layout returns a Bigarray with the specified layout, sharing the data with a (and hence having the same dimensions as a). No copying of elements is involved: the new array and the original array share the same storage space. The dimensions are reversed, such that get v [| a; b |] in C layout becomes get v [| b+1; a+1 |] in Fortran layout.

  • since 4.04
val size_in_bytes : ('a, 'b, 'c) t -> int

size_in_bytes a is the number of elements in a multiplied by a's kind_size_in_bytes.

  • since 4.03
val get : ('a, 'b, 'c) t -> int array -> 'a

Read an element of a generic Bigarray. Genarray.get a [|i1; ...; iN|] returns the element of a whose coordinates are i1 in the first dimension, i2 in the second dimension, ..., iN in the N-th dimension.

If a has C layout, the coordinates must be greater or equal than 0 and strictly less than the corresponding dimensions of a. If a has Fortran layout, the coordinates must be greater or equal than 1 and less or equal than the corresponding dimensions of a.

If N > 3, alternate syntax is provided: you can write a.{i1, i2, ..., iN} instead of Genarray.get a [|i1; ...; iN|]. (The syntax a.{...} with one, two or three coordinates is reserved for accessing one-, two- and three-dimensional arrays as described below.)

  • raises Invalid_argument

    if the array a does not have exactly N dimensions, or if the coordinates are outside the array bounds.

val set : ('a, 'b, 'c) t -> int array -> 'a -> unit

Assign an element of a generic Bigarray. Genarray.set a [|i1; ...; iN|] v stores the value v in the element of a whose coordinates are i1 in the first dimension, i2 in the second dimension, ..., iN in the N-th dimension.

The array a must have exactly N dimensions, and all coordinates must lie inside the array bounds, as described for Genarray.get; otherwise, Invalid_argument is raised.

If N > 3, alternate syntax is provided: you can write a.{i1, i2, ..., iN} <- v instead of Genarray.set a [|i1; ...; iN|] v. (The syntax a.{...} <- v with one, two or three coordinates is reserved for updating one-, two- and three-dimensional arrays as described below.)

val sub_left : ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) t

Extract a sub-array of the given Bigarray by restricting the first (left-most) dimension. Genarray.sub_left a ofs len returns a Bigarray with the same number of dimensions as a, and the same dimensions as a, except the first dimension, which corresponds to the interval [ofs ... ofs + len - 1] of the first dimension of a. No copying of elements is involved: the sub-array and the original array share the same storage space. In other terms, the element at coordinates [|i1; ...; iN|] of the sub-array is identical to the element at coordinates [|i1+ofs; ...; iN|] of the original array a.

Genarray.sub_left applies only to Bigarrays in C layout.

  • raises Invalid_argument

    if ofs and len do not designate a valid sub-array of a, that is, if ofs < 0, or len < 0, or ofs + len > Genarray.nth_dim a 0.

val sub_right : + ('a, 'b, fortran_layout) t -> + int -> + int -> + ('a, 'b, fortran_layout) t

Extract a sub-array of the given Bigarray by restricting the last (right-most) dimension. Genarray.sub_right a ofs len returns a Bigarray with the same number of dimensions as a, and the same dimensions as a, except the last dimension, which corresponds to the interval [ofs ... ofs + len - 1] of the last dimension of a. No copying of elements is involved: the sub-array and the original array share the same storage space. In other terms, the element at coordinates [|i1; ...; iN|] of the sub-array is identical to the element at coordinates [|i1; ...; iN+ofs|] of the original array a.

Genarray.sub_right applies only to Bigarrays in Fortran layout.

  • raises Invalid_argument

    if ofs and len do not designate a valid sub-array of a, that is, if ofs < 1, or len < 0, or ofs + len > Genarray.nth_dim a (Genarray.num_dims a - 1).

val slice_left : ('a, 'b, c_layout) t -> int array -> ('a, 'b, c_layout) t

Extract a sub-array of lower dimension from the given Bigarray by fixing one or several of the first (left-most) coordinates. Genarray.slice_left a [|i1; ... ; iM|] returns the 'slice' of a obtained by setting the first M coordinates to i1, ..., iM. If a has N dimensions, the slice has dimension N - M, and the element at coordinates [|j1; ...; j(N-M)|] in the slice is identical to the element at coordinates [|i1; ...; iM; j1; ...; j(N-M)|] in the original array a. No copying of elements is involved: the slice and the original array share the same storage space.

Genarray.slice_left applies only to Bigarrays in C layout.

  • raises Invalid_argument

    if M >= N, or if [|i1; ... ; iM|] is outside the bounds of a.

val slice_right : + ('a, 'b, fortran_layout) t -> + int array -> + ('a, 'b, fortran_layout) t

Extract a sub-array of lower dimension from the given Bigarray by fixing one or several of the last (right-most) coordinates. Genarray.slice_right a [|i1; ... ; iM|] returns the 'slice' of a obtained by setting the last M coordinates to i1, ..., iM. If a has N dimensions, the slice has dimension N - M, and the element at coordinates [|j1; ...; j(N-M)|] in the slice is identical to the element at coordinates [|j1; ...; j(N-M); i1; ...; iM|] in the original array a. No copying of elements is involved: the slice and the original array share the same storage space.

Genarray.slice_right applies only to Bigarrays in Fortran layout.

  • raises Invalid_argument

    if M >= N, or if [|i1; ... ; iM|] is outside the bounds of a.

val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit

Copy all elements of a Bigarray in another Bigarray. Genarray.blit src dst copies all elements of src into dst. Both arrays src and dst must have the same number of dimensions and equal dimensions. Copying a sub-array of src to a sub-array of dst can be achieved by applying Genarray.blit to sub-array or slices of src and dst.

val fill : ('a, 'b, 'c) t -> 'a -> unit

Set all elements of a Bigarray to a given value. Genarray.fill a v stores the value v in all elements of the Bigarray a. Setting only some elements of a to v can be achieved by applying Genarray.fill to a sub-array or a slice of a.

diff --git a/ocaml/Stdlib/Bigarray/index.html b/ocaml/Stdlib/Bigarray/index.html new file mode 100644 index 00000000..4bc429a1 --- /dev/null +++ b/ocaml/Stdlib/Bigarray/index.html @@ -0,0 +1,24 @@ + +Bigarray (ocaml.Stdlib.Bigarray)

Module Stdlib.Bigarray

Large, multi-dimensional, numerical arrays.

This module implements multi-dimensional arrays of integers and floating-point numbers, thereafter referred to as 'Bigarrays', to distinguish them from the standard OCaml arrays described in Array.

The implementation allows efficient sharing of large numerical arrays between OCaml code and C or Fortran numerical libraries.

The main differences between 'Bigarrays' and standard OCaml arrays are as follows:

  • Bigarrays are not limited in size, unlike OCaml arrays. (Normal float arrays are limited to 2,097,151 elements on a 32-bit platform, and normal arrays of other types to 4,194,303 elements.)
  • Bigarrays are multi-dimensional. Any number of dimensions between 0 and 16 is supported. In contrast, OCaml arrays are mono-dimensional and require encoding multi-dimensional arrays as arrays of arrays.
  • Bigarrays can only contain integers and floating-point numbers, while OCaml arrays can contain arbitrary OCaml data types.
  • Bigarrays provide more space-efficient storage of integer and floating-point elements than normal OCaml arrays, in particular because they support 'small' types such as single-precision floats and 8 and 16-bit integers, in addition to the standard OCaml types of double-precision floats and 32 and 64-bit integers.
  • The memory layout of Bigarrays is entirely compatible with that of arrays in C and Fortran, allowing large arrays to be passed back and forth between OCaml code and C / Fortran code with no data copying at all.
  • Bigarrays support interesting high-level operations that normal arrays do not provide efficiently, such as extracting sub-arrays and 'slicing' a multi-dimensional array along certain dimensions, all without any copying.

Users of this module are encouraged to do open Bigarray in their source, then refer to array types and operations via short dot notation, e.g. Array1.t or Array2.sub.

Bigarrays support all the OCaml ad-hoc polymorphic operations:

Element kinds

Bigarrays can contain elements of the following kinds:

Each element kind is represented at the type level by one of the *_elt types defined below (defined with a single constructor instead of abstract types for technical injectivity reasons).

  • since 4.07 Moved from otherlibs to stdlib.
type float32_elt =
  1. | Float32_elt
type float64_elt =
  1. | Float64_elt
type int8_signed_elt =
  1. | Int8_signed_elt
type int8_unsigned_elt =
  1. | Int8_unsigned_elt
type int16_signed_elt =
  1. | Int16_signed_elt
type int16_unsigned_elt =
  1. | Int16_unsigned_elt
type int32_elt =
  1. | Int32_elt
type int64_elt =
  1. | Int64_elt
type int_elt =
  1. | Int_elt
type nativeint_elt =
  1. | Nativeint_elt
type complex32_elt =
  1. | Complex32_elt
type complex64_elt =
  1. | Complex64_elt
type ('a, 'b) kind =
  1. | Float32 : (float, float32_elt) kind
  2. | Float64 : (float, float64_elt) kind
  3. | Int8_signed : (int, int8_signed_elt) kind
  4. | Int8_unsigned : (int, int8_unsigned_elt) kind
  5. | Int16_signed : (int, int16_signed_elt) kind
  6. | Int16_unsigned : (int, int16_unsigned_elt) kind
  7. | Int32 : (int32, int32_elt) kind
  8. | Int64 : (int64, int64_elt) kind
  9. | Int : (int, int_elt) kind
  10. | Nativeint : (nativeint, nativeint_elt) kind
  11. | Complex32 : (Complex.t, complex32_elt) kind
  12. | Complex64 : (Complex.t, complex64_elt) kind
  13. | Char : (char, int8_unsigned_elt) kind

To each element kind is associated an OCaml type, which is the type of OCaml values that can be stored in the Bigarray or read back from it. This type is not necessarily the same as the type of the array elements proper: for instance, a Bigarray whose elements are of kind float32_elt contains 32-bit single precision floats, but reading or writing one of its elements from OCaml uses the OCaml type float, which is 64-bit double precision floats.

The GADT type ('a, 'b) kind captures this association of an OCaml type 'a for values read or written in the Bigarray, and of an element kind 'b which represents the actual contents of the Bigarray. Its constructors list all possible associations of OCaml types with element kinds, and are re-exported below for backward-compatibility reasons.

Using a generalized algebraic datatype (GADT) here allows writing well-typed polymorphic functions whose return type depend on the argument type, such as:

let zero : type a b. (a, b) kind -> a = function
+  | Float32 -> 0.0 | Complex32 -> Complex.zero
+  | Float64 -> 0.0 | Complex64 -> Complex.zero
+  | Int8_signed -> 0 | Int8_unsigned -> 0
+  | Int16_signed -> 0 | Int16_unsigned -> 0
+  | Int32 -> 0l | Int64 -> 0L
+  | Int -> 0 | Nativeint -> 0n
+  | Char -> '\000'
val float32 : (float, float32_elt) kind
val float64 : (float, float64_elt) kind
val complex32 : (Complex.t, complex32_elt) kind
val complex64 : (Complex.t, complex64_elt) kind
val int8_signed : (int, int8_signed_elt) kind
val int8_unsigned : (int, int8_unsigned_elt) kind
val int16_signed : (int, int16_signed_elt) kind
val int16_unsigned : (int, int16_unsigned_elt) kind
val int : (int, int_elt) kind
val int32 : (int32, int32_elt) kind
val int64 : (int64, int64_elt) kind
val nativeint : (nativeint, nativeint_elt) kind
val char : (char, int8_unsigned_elt) kind

As shown by the types of the values above, Bigarrays of kind float32_elt and float64_elt are accessed using the OCaml type float. Bigarrays of complex kinds complex32_elt, complex64_elt are accessed with the OCaml type Complex.t. Bigarrays of integer kinds are accessed using the smallest OCaml integer type large enough to represent the array elements: int for 8- and 16-bit integer Bigarrays, as well as OCaml-integer Bigarrays; int32 for 32-bit integer Bigarrays; int64 for 64-bit integer Bigarrays; and nativeint for platform-native integer Bigarrays. Finally, Bigarrays of kind int8_unsigned_elt can also be accessed as arrays of characters instead of arrays of small integers, by using the kind value char instead of int8_unsigned.

val kind_size_in_bytes : ('a, 'b) kind -> int

kind_size_in_bytes k is the number of bytes used to store an element of type k.

  • since 4.03

Array layouts

type c_layout =
  1. | C_layout_typ
type fortran_layout =
  1. | Fortran_layout_typ

To facilitate interoperability with existing C and Fortran code, this library supports two different memory layouts for Bigarrays, one compatible with the C conventions, the other compatible with the Fortran conventions.

In the C-style layout, array indices start at 0, and multi-dimensional arrays are laid out in row-major format. That is, for a two-dimensional array, all elements of row 0 are contiguous in memory, followed by all elements of row 1, etc. In other terms, the array elements at (x,y) and (x, y+1) are adjacent in memory.

In the Fortran-style layout, array indices start at 1, and multi-dimensional arrays are laid out in column-major format. That is, for a two-dimensional array, all elements of column 0 are contiguous in memory, followed by all elements of column 1, etc. In other terms, the array elements at (x,y) and (x+1, y) are adjacent in memory.

Each layout style is identified at the type level by the phantom types Bigarray.c_layout and Bigarray.fortran_layout respectively.

Supported layouts

The GADT type 'a layout represents one of the two supported memory layouts: C-style or Fortran-style. Its constructors are re-exported as values below for backward-compatibility reasons.

type 'a layout =
  1. | C_layout : c_layout layout
  2. | Fortran_layout : fortran_layout layout
val c_layout : c_layout layout
val fortran_layout : fortran_layout layout

Generic arrays (of arbitrarily many dimensions)

module Genarray : sig ... end

Zero-dimensional arrays

module Array0 : sig ... end

Zero-dimensional arrays. The Array0 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of zero-dimensional arrays that only contain a single scalar value. Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

One-dimensional arrays

module Array1 : sig ... end

One-dimensional arrays. The Array1 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of one-dimensional arrays. (The Array2 and Array3 structures below provide operations specialized for two- and three-dimensional arrays.) Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

Two-dimensional arrays

module Array2 : sig ... end

Two-dimensional arrays. The Array2 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of two-dimensional arrays.

Three-dimensional arrays

module Array3 : sig ... end

Three-dimensional arrays. The Array3 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of three-dimensional arrays.

Coercions between generic Bigarrays and fixed-dimension Bigarrays

val genarray_of_array0 : ('a, 'b, 'c) Array0.t -> ('a, 'b, 'c) Genarray.t

Return the generic Bigarray corresponding to the given zero-dimensional Bigarray.

  • since 4.05
val genarray_of_array1 : ('a, 'b, 'c) Array1.t -> ('a, 'b, 'c) Genarray.t

Return the generic Bigarray corresponding to the given one-dimensional Bigarray.

val genarray_of_array2 : ('a, 'b, 'c) Array2.t -> ('a, 'b, 'c) Genarray.t

Return the generic Bigarray corresponding to the given two-dimensional Bigarray.

val genarray_of_array3 : ('a, 'b, 'c) Array3.t -> ('a, 'b, 'c) Genarray.t

Return the generic Bigarray corresponding to the given three-dimensional Bigarray.

val array0_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array0.t

Return the zero-dimensional Bigarray corresponding to the given generic Bigarray.

  • raises Invalid_argument

    if the generic Bigarray does not have exactly zero dimension.

  • since 4.05
val array1_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array1.t

Return the one-dimensional Bigarray corresponding to the given generic Bigarray.

  • raises Invalid_argument

    if the generic Bigarray does not have exactly one dimension.

val array2_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array2.t

Return the two-dimensional Bigarray corresponding to the given generic Bigarray.

  • raises Invalid_argument

    if the generic Bigarray does not have exactly two dimensions.

val array3_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array3.t

Return the three-dimensional Bigarray corresponding to the given generic Bigarray.

  • raises Invalid_argument

    if the generic Bigarray does not have exactly three dimensions.

Re-shaping Bigarrays

val reshape : ('a, 'b, 'c) Genarray.t -> int array -> ('a, 'b, 'c) Genarray.t

reshape b [|d1;...;dN|] converts the Bigarray b to a N-dimensional array of dimensions d1...dN. The returned array and the original array b share their data and have the same layout. For instance, assuming that b is a one-dimensional array of dimension 12, reshape b [|3;4|] returns a two-dimensional array b' of dimensions 3 and 4. If b has C layout, the element (x,y) of b' corresponds to the element x * 3 + y of b. If b has Fortran layout, the element (x,y) of b' corresponds to the element x + (y - 1) * 4 of b. The returned Bigarray must have exactly the same number of elements as the original Bigarray b. That is, the product of the dimensions of b must be equal to i1 * ... * iN. Otherwise, Invalid_argument is raised.

val reshape_0 : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array0.t

Specialized version of Bigarray.reshape for reshaping to zero-dimensional arrays.

  • since 4.05
val reshape_1 : ('a, 'b, 'c) Genarray.t -> int -> ('a, 'b, 'c) Array1.t

Specialized version of Bigarray.reshape for reshaping to one-dimensional arrays.

val reshape_2 : ('a, 'b, 'c) Genarray.t -> int -> int -> ('a, 'b, 'c) Array2.t

Specialized version of Bigarray.reshape for reshaping to two-dimensional arrays.

val reshape_3 : + ('a, 'b, 'c) Genarray.t -> + int -> + int -> + int -> + ('a, 'b, 'c) Array3.t

Specialized version of Bigarray.reshape for reshaping to three-dimensional arrays.

Bigarrays and concurrency safety

Care must be taken when concurrently accessing bigarrays from multiple domains: accessing a bigarray will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

Atomicity

Every bigarray operation that accesses more than one array element is not atomic. This includes slicing, bliting, and filling bigarrays.

For example, consider the following program:

open Bigarray
+let size = 100_000_000
+let a = Array1.init Int C_layout size (fun _ -> 1)
+let update f a () =
+  for i = 0 to size - 1 do a.{i} <- f a.{i} done
+let d1 = Domain.spawn (update (fun x -> x + 1) a)
+let d2 = Domain.spawn (update (fun x -> 2 * x + 1) a)
+let () = Domain.join d1; Domain.join d2

After executing this code, each field of the bigarray a is either 2, 3, 4 or 5. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

Data races

If two domains only access disjoint parts of the bigarray, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

A data race is said to occur when two domains access the same bigarray element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the bigarray elements.

Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains.

Tearing

Bigarrays have a distinct caveat in the presence of data races: concurrent bigarray operations might produce surprising values due to tearing. More precisely, the interleaving of partial writes and reads might create values that would not exist with a sequential execution. For instance, at the end of

let res = Array1.init Complex64 c_layout size (fun _ -> Complex.zero)
+let d1 = Domain.spawn (fun () -> Array1.fill res Complex.one)
+let d2 = Domain.spawn (fun () -> Array1.fill res Complex.i)
+let () = Domain.join d1; Domain.join d2

the res bigarray might contain values that are neither Complex.i nor Complex.one (for instance 1 + i).

diff --git a/ocaml/Stdlib/Bool/index.html b/ocaml/Stdlib/Bool/index.html new file mode 100644 index 00000000..2e027b38 --- /dev/null +++ b/ocaml/Stdlib/Bool/index.html @@ -0,0 +1,2 @@ + +Bool (ocaml.Stdlib.Bool)

Module Stdlib.Bool

Boolean values.

  • since 4.08

Booleans

type t = bool =
  1. | false
  2. | true

The type of booleans (truth values).

The constructors false and true are included here so that they have paths, but they are not intended to be used in user-defined data types.

val not : bool -> bool

not b is the boolean negation of b.

val (&&) : bool -> bool -> bool

e0 && e1 is the lazy boolean conjunction of expressions e0 and e1. If e0 evaluates to false, e1 is not evaluated. Right-associative operator at precedence level 3/11.

val (||) : bool -> bool -> bool

e0 || e1 is the lazy boolean disjunction of expressions e0 and e1. If e0 evaluates to true, e1 is not evaluated. Right-associative operator at precedence level 2/11.

Predicates and comparisons

val equal : bool -> bool -> bool

equal b0 b1 is true if and only if b0 and b1 are both true or both false.

val compare : bool -> bool -> int

compare b0 b1 is a total order on boolean values. false is smaller than true.

Converting

val to_int : bool -> int

to_int b is 0 if b is false and 1 if b is true.

val to_float : bool -> float

to_float b is 0. if b is false and 1. if b is true.

val to_string : bool -> string

to_string b is "true" if b is true and "false" if b is false.

val seeded_hash : int -> bool -> int

A seeded hash function for booleans, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.1
val hash : bool -> int

An unseeded hash function for booleans, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.1
diff --git a/ocaml/Stdlib/Buffer/index.html b/ocaml/Stdlib/Buffer/index.html new file mode 100644 index 00000000..4d1ab586 --- /dev/null +++ b/ocaml/Stdlib/Buffer/index.html @@ -0,0 +1,5 @@ + +Buffer (ocaml.Stdlib.Buffer)

Module Stdlib.Buffer

Extensible buffers.

This module implements buffers that automatically expand as necessary. It provides accumulative concatenation of strings in linear time (instead of quadratic time when strings are concatenated pairwise). For example:

let concat_strings ss =
+  let b = Buffer.create 16 in
+    List.iter (Buffer.add_string b) ss;
+    Buffer.contents b

Unsynchronized accesses

Unsynchronized accesses to a buffer may lead to an invalid buffer state. Thus, concurrent accesses to a buffer must be synchronized (for instance with a Mutex.t).

type t

The abstract type of buffers.

val create : int -> t

create n returns a fresh buffer, initially empty. The n parameter is the initial size of the internal byte sequence that holds the buffer contents. That byte sequence is automatically reallocated when more than n characters are stored in the buffer, but shrinks back to n characters when reset is called. For best performance, n should be of the same order of magnitude as the number of characters that are expected to be stored in the buffer (for instance, 80 for a buffer that holds one output line). Nothing bad will happen if the buffer grows beyond that limit, however. In doubt, take n = 16 for instance. If n is not between 1 and Sys.max_string_length, it will be clipped to that interval.

val contents : t -> string

Return a copy of the current contents of the buffer. The buffer itself is unchanged.

val to_bytes : t -> bytes

Return a copy of the current contents of the buffer. The buffer itself is unchanged.

  • since 4.02
val sub : t -> int -> int -> string

Buffer.sub b off len returns a copy of len bytes from the current contents of the buffer b, starting at offset off.

val blit : t -> int -> bytes -> int -> int -> unit

Buffer.blit src srcoff dst dstoff len copies len characters from the current contents of the buffer src, starting at offset srcoff to dst, starting at character dstoff.

  • raises Invalid_argument

    if srcoff and len do not designate a valid range of src, or if dstoff and len do not designate a valid range of dst.

  • since 3.11.2
val nth : t -> int -> char

Get the n-th character of the buffer.

val length : t -> int

Return the number of characters currently contained in the buffer.

val clear : t -> unit

Empty the buffer.

val reset : t -> unit

Empty the buffer and deallocate the internal byte sequence holding the buffer contents, replacing it with the initial internal byte sequence of length n that was allocated by Buffer.create n. For long-lived buffers that may have grown a lot, reset allows faster reclamation of the space used by the buffer.

val output_buffer : out_channel -> t -> unit

output_buffer oc b writes the current contents of buffer b on the output channel oc.

val truncate : t -> int -> unit

truncate b len truncates the length of b to len Note: the internal byte sequence is not shortened.

  • since 4.05

Appending

Note: all add_* operations can raise Failure if the internal byte sequence of the buffer would need to grow beyond Sys.max_string_length.

val add_char : t -> char -> unit

add_char b c appends the character c at the end of buffer b.

val add_utf_8_uchar : t -> Uchar.t -> unit

add_utf_8_uchar b u appends the UTF-8 encoding of u at the end of buffer b.

  • since 4.06
val add_utf_16le_uchar : t -> Uchar.t -> unit

add_utf_16le_uchar b u appends the UTF-16LE encoding of u at the end of buffer b.

  • since 4.06
val add_utf_16be_uchar : t -> Uchar.t -> unit

add_utf_16be_uchar b u appends the UTF-16BE encoding of u at the end of buffer b.

  • since 4.06
val add_string : t -> string -> unit

add_string b s appends the string s at the end of buffer b.

val add_bytes : t -> bytes -> unit

add_bytes b s appends the byte sequence s at the end of buffer b.

  • since 4.02
val add_substring : t -> string -> int -> int -> unit

add_substring b s ofs len takes len characters from offset ofs in string s and appends them at the end of buffer b.

val add_subbytes : t -> bytes -> int -> int -> unit

add_subbytes b s ofs len takes len characters from offset ofs in byte sequence s and appends them at the end of buffer b.

  • since 4.02
val add_substitute : t -> (string -> string) -> string -> unit

add_substitute b f s appends the string pattern s at the end of buffer b with substitution. The substitution process looks for variables into the pattern and substitutes each variable name by its value, as obtained by applying the mapping f to the variable name. Inside the string pattern, a variable name immediately follows a non-escaped $ character and is one of the following:

  • a non empty sequence of alphanumeric or _ characters,
  • an arbitrary sequence of characters enclosed by a pair of matching parentheses or curly brackets. An escaped $ character is a $ that immediately follows a backslash character; it then stands for a plain $.
  • raises Not_found

    if the closing character of a parenthesized variable cannot be found.

val add_buffer : t -> t -> unit

add_buffer b1 b2 appends the current contents of buffer b2 at the end of buffer b1. b2 is not modified.

val add_channel : t -> in_channel -> int -> unit

add_channel b ic n reads at most n characters from the input channel ic and stores them at the end of buffer b.

  • raises End_of_file

    if the channel contains fewer than n characters. In this case, the characters are still added to the buffer, so as to avoid loss of data.

Buffers and Sequences

val to_seq : t -> char Seq.t

Iterate on the buffer, in increasing order.

The behavior is not specified if the buffer is modified during iteration.

  • since 4.07
val to_seqi : t -> (int * char) Seq.t

Iterate on the buffer, in increasing order, yielding indices along chars.

The behavior is not specified if the buffer is modified during iteration.

  • since 4.07
val add_seq : t -> char Seq.t -> unit

Add chars to the buffer

  • since 4.07
val of_seq : char Seq.t -> t

Create a buffer from the generator

  • since 4.07

Binary encoding of integers

The functions in this section append binary encodings of integers to buffers.

Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. Functions that encode these values truncate their inputs to their least significant bytes.

val add_uint8 : t -> int -> unit

add_uint8 b i appends a binary unsigned 8-bit integer i to b.

  • since 4.08
val add_int8 : t -> int -> unit

add_int8 b i appends a binary signed 8-bit integer i to b.

  • since 4.08
val add_uint16_ne : t -> int -> unit

add_uint16_ne b i appends a binary native-endian unsigned 16-bit integer i to b.

  • since 4.08
val add_uint16_be : t -> int -> unit

add_uint16_be b i appends a binary big-endian unsigned 16-bit integer i to b.

  • since 4.08
val add_uint16_le : t -> int -> unit

add_uint16_le b i appends a binary little-endian unsigned 16-bit integer i to b.

  • since 4.08
val add_int16_ne : t -> int -> unit

add_int16_ne b i appends a binary native-endian signed 16-bit integer i to b.

  • since 4.08
val add_int16_be : t -> int -> unit

add_int16_be b i appends a binary big-endian signed 16-bit integer i to b.

  • since 4.08
val add_int16_le : t -> int -> unit

add_int16_le b i appends a binary little-endian signed 16-bit integer i to b.

  • since 4.08
val add_int32_ne : t -> int32 -> unit

add_int32_ne b i appends a binary native-endian 32-bit integer i to b.

  • since 4.08
val add_int32_be : t -> int32 -> unit

add_int32_be b i appends a binary big-endian 32-bit integer i to b.

  • since 4.08
val add_int32_le : t -> int32 -> unit

add_int32_le b i appends a binary little-endian 32-bit integer i to b.

  • since 4.08
val add_int64_ne : t -> int64 -> unit

add_int64_ne b i appends a binary native-endian 64-bit integer i to b.

  • since 4.08
val add_int64_be : t -> int64 -> unit

add_int64_be b i appends a binary big-endian 64-bit integer i to b.

  • since 4.08
val add_int64_le : t -> int64 -> unit

add_int64_ne b i appends a binary little-endian 64-bit integer i to b.

  • since 4.08
diff --git a/ocaml/Stdlib/Bytes/index.html b/ocaml/Stdlib/Bytes/index.html new file mode 100644 index 00000000..7a531203 --- /dev/null +++ b/ocaml/Stdlib/Bytes/index.html @@ -0,0 +1,17 @@ + +Bytes (ocaml.Stdlib.Bytes)

Module Stdlib.Bytes

Byte sequence operations.

A byte sequence is a mutable data structure that contains a fixed-length sequence of bytes. Each byte can be indexed in constant time for reading or writing.

Given a byte sequence s of length l, we can access each of the l bytes of s via its index in the sequence. Indexes start at 0, and we will call an index valid in s if it falls within the range [0...l-1] (inclusive). A position is the point between two bytes or at the beginning or end of the sequence. We call a position valid in s if it falls within the range [0...l] (inclusive). Note that the byte at index n is between positions n and n+1.

Two parameters start and len are said to designate a valid range of s if len >= 0 and start and start+len are valid positions in s.

Byte sequences can be modified in place, for instance via the set and blit functions described below. See also strings (module String), which are almost the same data structure, but cannot be modified in place.

Bytes are represented by the OCaml type char.

The labeled version of this module can be used as described in the StdLabels module.

  • since 4.02
val length : bytes -> int

Return the length (number of bytes) of the argument.

val get : bytes -> int -> char

get s n returns the byte at index n in argument s.

val set : bytes -> int -> char -> unit

set s n c modifies s in place, replacing the byte at index n with c.

val create : int -> bytes

create n returns a new byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

val make : int -> char -> bytes

make n c returns a new byte sequence of length n, filled with the byte c.

val init : int -> (int -> char) -> bytes

init n f returns a fresh byte sequence of length n, with character i initialized to the result of f i (in increasing index order).

val empty : bytes

A byte sequence of size 0.

val copy : bytes -> bytes

Return a new byte sequence that contains the same bytes as the argument.

val of_string : string -> bytes

Return a new byte sequence that contains the same bytes as the given string.

val to_string : bytes -> string

Return a new string that contains the same bytes as the given byte sequence.

val sub : bytes -> int -> int -> bytes

sub s pos len returns a new byte sequence of length len, containing the subsequence of s that starts at position pos and has length len.

val sub_string : bytes -> int -> int -> string

Same as sub but return a string instead of a byte sequence.

val extend : bytes -> int -> int -> bytes

extend s left right returns a new byte sequence that contains the bytes of s, with left uninitialized bytes prepended and right uninitialized bytes appended to it. If left or right is negative, then bytes are removed (instead of appended) from the corresponding side of s.

  • since 4.05 in BytesLabels
val fill : bytes -> int -> int -> char -> unit

fill s pos len c modifies s in place, replacing len characters with c, starting at pos.

val blit : bytes -> int -> bytes -> int -> int -> unit

blit src src_pos dst dst_pos len copies len bytes from byte sequence src, starting at index src_pos, to byte sequence dst, starting at index dst_pos. It works correctly even if src and dst are the same byte sequence, and the source and destination intervals overlap.

  • raises Invalid_argument

    if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

val blit_string : string -> int -> bytes -> int -> int -> unit

blit_string src src_pos dst dst_pos len copies len bytes from string src, starting at index src_pos, to byte sequence dst, starting at index dst_pos.

  • raises Invalid_argument

    if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

  • since 4.05 in BytesLabels
val concat : bytes -> bytes list -> bytes

concat sep sl concatenates the list of byte sequences sl, inserting the separator byte sequence sep between each, and returns the result as a new byte sequence.

val cat : bytes -> bytes -> bytes

cat s1 s2 concatenates s1 and s2 and returns the result as a new byte sequence.

  • since 4.05 in BytesLabels
val iter : (char -> unit) -> bytes -> unit

iter f s applies function f in turn to all the bytes of s. It is equivalent to f (get s 0); f (get s 1); ...; f (get s + (length s - 1)); ().

val iteri : (int -> char -> unit) -> bytes -> unit

Same as iter, but the function is applied to the index of the byte as first argument and the byte itself as second argument.

val map : (char -> char) -> bytes -> bytes

map f s applies function f in turn to all the bytes of s (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

val mapi : (int -> char -> char) -> bytes -> bytes

mapi f s calls f with each character of s and its index (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

val fold_left : ('acc -> char -> 'acc) -> 'acc -> bytes -> 'acc

fold_left f x s computes f (... (f (f x (get s 0)) (get s 1)) ...) (get s (n-1)), where n is the length of s.

  • since 4.13
val fold_right : (char -> 'acc -> 'acc) -> bytes -> 'acc -> 'acc

fold_right f s x computes f (get s 0) (f (get s 1) ( ... (f (get s (n-1)) x) ...)), where n is the length of s.

  • since 4.13
val for_all : (char -> bool) -> bytes -> bool

for_all p s checks if all characters in s satisfy the predicate p.

  • since 4.13
val exists : (char -> bool) -> bytes -> bool

exists p s checks if at least one character of s satisfies the predicate p.

  • since 4.13
val trim : bytes -> bytes

Return a copy of the argument, without leading and trailing whitespace. The bytes regarded as whitespace are the ASCII characters ' ', '\012', '\n', '\r', and '\t'.

val escaped : bytes -> bytes

Return a copy of the argument, with special characters represented by escape sequences, following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash and double-quote.

val index : bytes -> char -> int

index s c returns the index of the first occurrence of byte c in s.

val index_opt : bytes -> char -> int option

index_opt s c returns the index of the first occurrence of byte c in s or None if c does not occur in s.

  • since 4.05
val rindex : bytes -> char -> int

rindex s c returns the index of the last occurrence of byte c in s.

val rindex_opt : bytes -> char -> int option

rindex_opt s c returns the index of the last occurrence of byte c in s or None if c does not occur in s.

  • since 4.05
val index_from : bytes -> int -> char -> int

index_from s i c returns the index of the first occurrence of byte c in s after position i. index s c is equivalent to index_from s 0 c.

  • raises Not_found

    if c does not occur in s after position i.

val index_from_opt : bytes -> int -> char -> int option

index_from_opt s i c returns the index of the first occurrence of byte c in s after position i or None if c does not occur in s after position i. index_opt s c is equivalent to index_from_opt s 0 c.

  • since 4.05
val rindex_from : bytes -> int -> char -> int

rindex_from s i c returns the index of the last occurrence of byte c in s before position i+1. rindex s c is equivalent to rindex_from s (length s - 1) c.

  • raises Not_found

    if c does not occur in s before position i+1.

val rindex_from_opt : bytes -> int -> char -> int option

rindex_from_opt s i c returns the index of the last occurrence of byte c in s before position i+1 or None if c does not occur in s before position i+1. rindex_opt s c is equivalent to rindex_from s (length s - 1) c.

  • since 4.05
val contains : bytes -> char -> bool

contains s c tests if byte c appears in s.

val contains_from : bytes -> int -> char -> bool

contains_from s start c tests if byte c appears in s after position start. contains s c is equivalent to contains_from + s 0 c.

val rcontains_from : bytes -> int -> char -> bool

rcontains_from s stop c tests if byte c appears in s before position stop+1.

val uppercase_ascii : bytes -> bytes

Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

  • since 4.03 (4.05 in BytesLabels)
val lowercase_ascii : bytes -> bytes

Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

  • since 4.03 (4.05 in BytesLabels)
val capitalize_ascii : bytes -> bytes

Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

  • since 4.03 (4.05 in BytesLabels)
val uncapitalize_ascii : bytes -> bytes

Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

  • since 4.03 (4.05 in BytesLabels)
type t = bytes

An alias for the type of byte sequences.

val compare : t -> t -> int

The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

val equal : t -> t -> bool

The equality function for byte sequences.

  • since 4.03 (4.05 in BytesLabels)
val starts_with : prefix:bytes -> bytes -> bool

starts_with ~prefix s is true if and only if s starts with prefix.

  • since 4.13
val ends_with : suffix:bytes -> bytes -> bool

ends_with ~suffix s is true if and only if s ends with suffix.

  • since 4.13

Unsafe conversions (for advanced users)

This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings provided by the -safe-string option. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

val unsafe_to_string : bytes -> string

Unsafely convert a byte sequence into a string.

To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

  • Unique ownership: the data may be accessed and mutated
  • Shared ownership: the data has several owners, that may only access it, not mutate it.

Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

There are two valid use-cases that respect this ownership discipline:

1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

let string_init len f : string =
+  let s = Bytes.create len in
+  for i = 0 to len - 1 do Bytes.set s i (f i) done;
+  Bytes.unsafe_to_string s

This function is safe because the byte sequence s will never be accessed or mutated after unsafe_to_string is called. The string_init code gives up ownership of s, and returns the ownership of the resulting string to its caller.

Note that it would be unsafe if s was passed as an additional parameter to the function f as it could escape this way and be mutated in the future -- string_init would give up ownership of s to pass it to f, and could not call unsafe_to_string safely.

We have provided the String.init, String.map and String.mapi functions to cover most cases of building new strings. You should prefer those over to_string or unsafe_to_string whenever applicable.

2. Temporarily giving ownership of a byte sequence to a function that expects a uniquely owned string and returns ownership back, so that we can mutate the sequence again after the call ended.

let bytes_length (s : bytes) =
+  String.length (Bytes.unsafe_to_string s)

In this use-case, we do not promise that s will never be mutated after the call to bytes_length s. The String.length function temporarily borrows unique ownership of the byte sequence (and sees it as a string), but returns this ownership back to the caller, which may assume that s is still a valid byte sequence after the call. Note that this is only correct because we know that String.length does not capture its argument -- it could escape by a side-channel such as a memoization combinator.

The caller may not mutate s while the string is borrowed (it has temporarily given up ownership). This affects concurrent programs, but also higher-order functions: if String.length returned a closure to be called later, s should not be mutated until this closure is fully applied and returns ownership.

val unsafe_of_string : string -> bytes

Unsafely convert a shared string to a byte sequence that should not be mutated.

The same ownership discipline that makes unsafe_to_string correct applies to unsafe_of_string: you may use it if you were the owner of the string value, and you will own the return bytes in the same mode.

In practice, unique ownership of string values is extremely difficult to reason about correctly. You should always assume strings are shared, never uniquely owned.

For example, string literals are implicitly shared by the compiler, so you never uniquely own them.

let incorrect = Bytes.unsafe_of_string "hello"
+let s = Bytes.of_string "hello"

The first declaration is incorrect, because the string literal "hello" could be shared by the compiler with other parts of the program, and mutating incorrect is a bug. You must always use the second version, which performs a copy and is thus correct.

Assuming unique ownership of strings that are not string literals, but are (partly) built from string literals, is also incorrect. For example, mutating unsafe_of_string ("foo" ^ s) could mutate the shared string "foo" -- assuming a rope-like representation of strings. More generally, functions operating on strings will assume shared ownership, they do not preserve unique ownership. It is thus incorrect to assume unique ownership of the result of unsafe_of_string.

The only case we have reasonable confidence is safe is if the produced bytes is shared -- used as an immutable byte sequence. This is possibly useful for incremental migration of low-level programs that manipulate immutable sequences of bytes (for example Marshal.from_bytes) and previously used the string type for this purpose.

val split_on_char : char -> bytes -> bytes list

split_on_char sep s returns the list of all (possibly empty) subsequences of s that are delimited by the sep character.

The function's output is specified by the following invariants:

  • The list is not empty.
  • Concatenating its elements using sep as a separator returns a byte sequence equal to the input (Bytes.concat (Bytes.make 1 sep) + (Bytes.split_on_char sep s) = s).
  • No byte sequence in the result contains the sep character.
  • since 4.13

Iterators

val to_seq : t -> char Seq.t

Iterate on the string, in increasing index order. Modifications of the string during iteration will be reflected in the sequence.

  • since 4.07
val to_seqi : t -> (int * char) Seq.t

Iterate on the string, in increasing order, yielding indices along chars

  • since 4.07
val of_seq : char Seq.t -> t

Create a string from the generator

  • since 4.07

UTF codecs and validations

  • since 4.14

UTF-8

val get_utf_8_uchar : t -> int -> Uchar.utf_decode

get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

val set_utf_8_uchar : t -> int -> Uchar.t -> int

set_utf_8_uchar b i u UTF-8 encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

val is_valid_utf_8 : t -> bool

is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

UTF-16BE

val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

val set_utf_16be_uchar : t -> int -> Uchar.t -> int

set_utf_16be_uchar b i u UTF-16BE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

val is_valid_utf_16be : t -> bool

is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

UTF-16LE

val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

val set_utf_16le_uchar : t -> int -> Uchar.t -> int

set_utf_16le_uchar b i u UTF-16LE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

val is_valid_utf_16le : t -> bool

is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

Binary encoding/decoding of integers

The functions in this section binary encode and decode integers to and from byte sequences.

All following functions raise Invalid_argument if the space needed at index i to decode or encode the integer is not available.

Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are handled as follows:

  • Functions that decode signed (resp. unsigned) 8-bit or 16-bit integers represented by int values sign-extend (resp. zero-extend) their result.
  • Functions that encode 8-bit or 16-bit integers represented by int values truncate their input to their least significant bytes.
val get_uint8 : bytes -> int -> int

get_uint8 b i is b's unsigned 8-bit integer starting at byte index i.

  • since 4.08
val get_int8 : bytes -> int -> int

get_int8 b i is b's signed 8-bit integer starting at byte index i.

  • since 4.08
val get_uint16_ne : bytes -> int -> int

get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at byte index i.

  • since 4.08
val get_uint16_be : bytes -> int -> int

get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at byte index i.

  • since 4.08
val get_uint16_le : bytes -> int -> int

get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at byte index i.

  • since 4.08
val get_int16_ne : bytes -> int -> int

get_int16_ne b i is b's native-endian signed 16-bit integer starting at byte index i.

  • since 4.08
val get_int16_be : bytes -> int -> int

get_int16_be b i is b's big-endian signed 16-bit integer starting at byte index i.

  • since 4.08
val get_int16_le : bytes -> int -> int

get_int16_le b i is b's little-endian signed 16-bit integer starting at byte index i.

  • since 4.08
val get_int32_ne : bytes -> int -> int32

get_int32_ne b i is b's native-endian 32-bit integer starting at byte index i.

  • since 4.08
val get_int32_be : bytes -> int -> int32

get_int32_be b i is b's big-endian 32-bit integer starting at byte index i.

  • since 4.08
val get_int32_le : bytes -> int -> int32

get_int32_le b i is b's little-endian 32-bit integer starting at byte index i.

  • since 4.08
val get_int64_ne : bytes -> int -> int64

get_int64_ne b i is b's native-endian 64-bit integer starting at byte index i.

  • since 4.08
val get_int64_be : bytes -> int -> int64

get_int64_be b i is b's big-endian 64-bit integer starting at byte index i.

  • since 4.08
val get_int64_le : bytes -> int -> int64

get_int64_le b i is b's little-endian 64-bit integer starting at byte index i.

  • since 4.08
val set_uint8 : bytes -> int -> int -> unit

set_uint8 b i v sets b's unsigned 8-bit integer starting at byte index i to v.

  • since 4.08
val set_int8 : bytes -> int -> int -> unit

set_int8 b i v sets b's signed 8-bit integer starting at byte index i to v.

  • since 4.08
val set_uint16_ne : bytes -> int -> int -> unit

set_uint16_ne b i v sets b's native-endian unsigned 16-bit integer starting at byte index i to v.

  • since 4.08
val set_uint16_be : bytes -> int -> int -> unit

set_uint16_be b i v sets b's big-endian unsigned 16-bit integer starting at byte index i to v.

  • since 4.08
val set_uint16_le : bytes -> int -> int -> unit

set_uint16_le b i v sets b's little-endian unsigned 16-bit integer starting at byte index i to v.

  • since 4.08
val set_int16_ne : bytes -> int -> int -> unit

set_int16_ne b i v sets b's native-endian signed 16-bit integer starting at byte index i to v.

  • since 4.08
val set_int16_be : bytes -> int -> int -> unit

set_int16_be b i v sets b's big-endian signed 16-bit integer starting at byte index i to v.

  • since 4.08
val set_int16_le : bytes -> int -> int -> unit

set_int16_le b i v sets b's little-endian signed 16-bit integer starting at byte index i to v.

  • since 4.08
val set_int32_ne : bytes -> int -> int32 -> unit

set_int32_ne b i v sets b's native-endian 32-bit integer starting at byte index i to v.

  • since 4.08
val set_int32_be : bytes -> int -> int32 -> unit

set_int32_be b i v sets b's big-endian 32-bit integer starting at byte index i to v.

  • since 4.08
val set_int32_le : bytes -> int -> int32 -> unit

set_int32_le b i v sets b's little-endian 32-bit integer starting at byte index i to v.

  • since 4.08
val set_int64_ne : bytes -> int -> int64 -> unit

set_int64_ne b i v sets b's native-endian 64-bit integer starting at byte index i to v.

  • since 4.08
val set_int64_be : bytes -> int -> int64 -> unit

set_int64_be b i v sets b's big-endian 64-bit integer starting at byte index i to v.

  • since 4.08
val set_int64_le : bytes -> int -> int64 -> unit

set_int64_le b i v sets b's little-endian 64-bit integer starting at byte index i to v.

  • since 4.08

Byte sequences and concurrency safety

Care must be taken when concurrently accessing byte sequences from multiple domains: accessing a byte sequence will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

Atomicity

Every byte sequence operation that accesses more than one byte is not atomic. This includes iteration and scanning.

For example, consider the following program:

let size = 100_000_000
+let b = Bytes.make size  ' '
+let update b f ()  =
+  Bytes.iteri (fun i x -> Bytes.set b i (Char.chr (f (Char.code x)))) b
+let d1 = Domain.spawn (update b (fun x -> x + 1))
+let d2 = Domain.spawn (update b (fun x -> 2 * x + 1))
+let () = Domain.join d1; Domain.join d2

the bytes sequence b may contain a non-deterministic mixture of '!', 'A', 'B', and 'C' values.

After executing this code, each byte of the sequence b is either '!', 'A', 'B', or 'C'. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

Data races

If two domains only access disjoint parts of a byte sequence, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

A data race is said to occur when two domains access the same byte without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the elements of the sequence.

Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location.

Mixed-size accesses

Another subtle point is that if a data race involves mixed-size writes and reads to the same location, the order in which those writes and reads are observed by domains is not specified. For instance, the following code write sequentially a 32-bit integer and a char to the same index

let b = Bytes.make 10 '\000'
+let d1 = Domain.spawn (fun () -> Bytes.set_int32_ne b 0 100; b.[0] <- 'd' )

In this situation, a domain that observes the write of 'd' to b.0 is not guaranteed to also observe the write to indices 1, 2, or 3.

diff --git a/ocaml/Stdlib/BytesLabels/index.html b/ocaml/Stdlib/BytesLabels/index.html new file mode 100644 index 00000000..fba37899 --- /dev/null +++ b/ocaml/Stdlib/BytesLabels/index.html @@ -0,0 +1,29 @@ + +BytesLabels (ocaml.Stdlib.BytesLabels)

Module Stdlib.BytesLabels

Byte sequence operations.

A byte sequence is a mutable data structure that contains a fixed-length sequence of bytes. Each byte can be indexed in constant time for reading or writing.

Given a byte sequence s of length l, we can access each of the l bytes of s via its index in the sequence. Indexes start at 0, and we will call an index valid in s if it falls within the range [0...l-1] (inclusive). A position is the point between two bytes or at the beginning or end of the sequence. We call a position valid in s if it falls within the range [0...l] (inclusive). Note that the byte at index n is between positions n and n+1.

Two parameters start and len are said to designate a valid range of s if len >= 0 and start and start+len are valid positions in s.

Byte sequences can be modified in place, for instance via the set and blit functions described below. See also strings (module String), which are almost the same data structure, but cannot be modified in place.

Bytes are represented by the OCaml type char.

The labeled version of this module can be used as described in the StdLabels module.

  • since 4.02
val length : bytes -> int

Return the length (number of bytes) of the argument.

val get : bytes -> int -> char

get s n returns the byte at index n in argument s.

val set : bytes -> int -> char -> unit

set s n c modifies s in place, replacing the byte at index n with c.

val create : int -> bytes

create n returns a new byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

val make : int -> char -> bytes

make n c returns a new byte sequence of length n, filled with the byte c.

val init : int -> f:(int -> char) -> bytes

init n f returns a fresh byte sequence of length n, with character i initialized to the result of f i (in increasing index order).

val empty : bytes

A byte sequence of size 0.

val copy : bytes -> bytes

Return a new byte sequence that contains the same bytes as the argument.

val of_string : string -> bytes

Return a new byte sequence that contains the same bytes as the given string.

val to_string : bytes -> string

Return a new string that contains the same bytes as the given byte sequence.

val sub : bytes -> pos:int -> len:int -> bytes

sub s ~pos ~len returns a new byte sequence of length len, containing the subsequence of s that starts at position pos and has length len.

val sub_string : bytes -> pos:int -> len:int -> string

Same as sub but return a string instead of a byte sequence.

val extend : bytes -> left:int -> right:int -> bytes

extend s ~left ~right returns a new byte sequence that contains the bytes of s, with left uninitialized bytes prepended and right uninitialized bytes appended to it. If left or right is negative, then bytes are removed (instead of appended) from the corresponding side of s.

  • since 4.05 in BytesLabels
val fill : bytes -> pos:int -> len:int -> char -> unit

fill s ~pos ~len c modifies s in place, replacing len characters with c, starting at pos.

val blit : + src:bytes -> + src_pos:int -> + dst:bytes -> + dst_pos:int -> + len:int -> + unit

blit ~src ~src_pos ~dst ~dst_pos ~len copies len bytes from byte sequence src, starting at index src_pos, to byte sequence dst, starting at index dst_pos. It works correctly even if src and dst are the same byte sequence, and the source and destination intervals overlap.

  • raises Invalid_argument

    if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

val blit_string : + src:string -> + src_pos:int -> + dst:bytes -> + dst_pos:int -> + len:int -> + unit

blit_string ~src ~src_pos ~dst ~dst_pos ~len copies len bytes from string src, starting at index src_pos, to byte sequence dst, starting at index dst_pos.

  • raises Invalid_argument

    if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

  • since 4.05 in BytesLabels
val concat : sep:bytes -> bytes list -> bytes

concat ~sep sl concatenates the list of byte sequences sl, inserting the separator byte sequence sep between each, and returns the result as a new byte sequence.

val cat : bytes -> bytes -> bytes

cat s1 s2 concatenates s1 and s2 and returns the result as a new byte sequence.

  • since 4.05 in BytesLabels
val iter : f:(char -> unit) -> bytes -> unit

iter ~f s applies function f in turn to all the bytes of s. It is equivalent to f (get s 0); f (get s 1); ...; f (get s + (length s - 1)); ().

val iteri : f:(int -> char -> unit) -> bytes -> unit

Same as iter, but the function is applied to the index of the byte as first argument and the byte itself as second argument.

val map : f:(char -> char) -> bytes -> bytes

map ~f s applies function f in turn to all the bytes of s (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

val mapi : f:(int -> char -> char) -> bytes -> bytes

mapi ~f s calls f with each character of s and its index (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> bytes -> 'acc

fold_left f x s computes f (... (f (f x (get s 0)) (get s 1)) ...) (get s (n-1)), where n is the length of s.

  • since 4.13
val fold_right : f:(char -> 'acc -> 'acc) -> bytes -> init:'acc -> 'acc

fold_right f s x computes f (get s 0) (f (get s 1) ( ... (f (get s (n-1)) x) ...)), where n is the length of s.

  • since 4.13
val for_all : f:(char -> bool) -> bytes -> bool

for_all p s checks if all characters in s satisfy the predicate p.

  • since 4.13
val exists : f:(char -> bool) -> bytes -> bool

exists p s checks if at least one character of s satisfies the predicate p.

  • since 4.13
val trim : bytes -> bytes

Return a copy of the argument, without leading and trailing whitespace. The bytes regarded as whitespace are the ASCII characters ' ', '\012', '\n', '\r', and '\t'.

val escaped : bytes -> bytes

Return a copy of the argument, with special characters represented by escape sequences, following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash and double-quote.

val index : bytes -> char -> int

index s c returns the index of the first occurrence of byte c in s.

val index_opt : bytes -> char -> int option

index_opt s c returns the index of the first occurrence of byte c in s or None if c does not occur in s.

  • since 4.05
val rindex : bytes -> char -> int

rindex s c returns the index of the last occurrence of byte c in s.

val rindex_opt : bytes -> char -> int option

rindex_opt s c returns the index of the last occurrence of byte c in s or None if c does not occur in s.

  • since 4.05
val index_from : bytes -> int -> char -> int

index_from s i c returns the index of the first occurrence of byte c in s after position i. index s c is equivalent to index_from s 0 c.

  • raises Not_found

    if c does not occur in s after position i.

val index_from_opt : bytes -> int -> char -> int option

index_from_opt s i c returns the index of the first occurrence of byte c in s after position i or None if c does not occur in s after position i. index_opt s c is equivalent to index_from_opt s 0 c.

  • since 4.05
val rindex_from : bytes -> int -> char -> int

rindex_from s i c returns the index of the last occurrence of byte c in s before position i+1. rindex s c is equivalent to rindex_from s (length s - 1) c.

  • raises Not_found

    if c does not occur in s before position i+1.

val rindex_from_opt : bytes -> int -> char -> int option

rindex_from_opt s i c returns the index of the last occurrence of byte c in s before position i+1 or None if c does not occur in s before position i+1. rindex_opt s c is equivalent to rindex_from s (length s - 1) c.

  • since 4.05
val contains : bytes -> char -> bool

contains s c tests if byte c appears in s.

val contains_from : bytes -> int -> char -> bool

contains_from s start c tests if byte c appears in s after position start. contains s c is equivalent to contains_from + s 0 c.

val rcontains_from : bytes -> int -> char -> bool

rcontains_from s stop c tests if byte c appears in s before position stop+1.

val uppercase_ascii : bytes -> bytes

Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

  • since 4.05
val lowercase_ascii : bytes -> bytes

Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

  • since 4.05
val capitalize_ascii : bytes -> bytes

Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

  • since 4.05
val uncapitalize_ascii : bytes -> bytes

Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

  • since 4.05
type t = bytes

An alias for the type of byte sequences.

val compare : t -> t -> int

The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

val equal : t -> t -> bool

The equality function for byte sequences.

  • since 4.05
val starts_with : prefix:bytes -> bytes -> bool

starts_with ~prefix s is true if and only if s starts with prefix.

  • since 4.13
val ends_with : suffix:bytes -> bytes -> bool

ends_with ~suffix s is true if and only if s ends with suffix.

  • since 4.13

Unsafe conversions (for advanced users)

This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings provided by the -safe-string option. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

val unsafe_to_string : bytes -> string

Unsafely convert a byte sequence into a string.

To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

  • Unique ownership: the data may be accessed and mutated
  • Shared ownership: the data has several owners, that may only access it, not mutate it.

Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

There are two valid use-cases that respect this ownership discipline:

1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

let string_init len f : string =
+  let s = Bytes.create len in
+  for i = 0 to len - 1 do Bytes.set s i (f i) done;
+  Bytes.unsafe_to_string s

This function is safe because the byte sequence s will never be accessed or mutated after unsafe_to_string is called. The string_init code gives up ownership of s, and returns the ownership of the resulting string to its caller.

Note that it would be unsafe if s was passed as an additional parameter to the function f as it could escape this way and be mutated in the future -- string_init would give up ownership of s to pass it to f, and could not call unsafe_to_string safely.

We have provided the String.init, String.map and String.mapi functions to cover most cases of building new strings. You should prefer those over to_string or unsafe_to_string whenever applicable.

2. Temporarily giving ownership of a byte sequence to a function that expects a uniquely owned string and returns ownership back, so that we can mutate the sequence again after the call ended.

let bytes_length (s : bytes) =
+  String.length (Bytes.unsafe_to_string s)

In this use-case, we do not promise that s will never be mutated after the call to bytes_length s. The String.length function temporarily borrows unique ownership of the byte sequence (and sees it as a string), but returns this ownership back to the caller, which may assume that s is still a valid byte sequence after the call. Note that this is only correct because we know that String.length does not capture its argument -- it could escape by a side-channel such as a memoization combinator.

The caller may not mutate s while the string is borrowed (it has temporarily given up ownership). This affects concurrent programs, but also higher-order functions: if String.length returned a closure to be called later, s should not be mutated until this closure is fully applied and returns ownership.

val unsafe_of_string : string -> bytes

Unsafely convert a shared string to a byte sequence that should not be mutated.

The same ownership discipline that makes unsafe_to_string correct applies to unsafe_of_string: you may use it if you were the owner of the string value, and you will own the return bytes in the same mode.

In practice, unique ownership of string values is extremely difficult to reason about correctly. You should always assume strings are shared, never uniquely owned.

For example, string literals are implicitly shared by the compiler, so you never uniquely own them.

let incorrect = Bytes.unsafe_of_string "hello"
+let s = Bytes.of_string "hello"

The first declaration is incorrect, because the string literal "hello" could be shared by the compiler with other parts of the program, and mutating incorrect is a bug. You must always use the second version, which performs a copy and is thus correct.

Assuming unique ownership of strings that are not string literals, but are (partly) built from string literals, is also incorrect. For example, mutating unsafe_of_string ("foo" ^ s) could mutate the shared string "foo" -- assuming a rope-like representation of strings. More generally, functions operating on strings will assume shared ownership, they do not preserve unique ownership. It is thus incorrect to assume unique ownership of the result of unsafe_of_string.

The only case we have reasonable confidence is safe is if the produced bytes is shared -- used as an immutable byte sequence. This is possibly useful for incremental migration of low-level programs that manipulate immutable sequences of bytes (for example Marshal.from_bytes) and previously used the string type for this purpose.

val split_on_char : sep:char -> bytes -> bytes list

split_on_char sep s returns the list of all (possibly empty) subsequences of s that are delimited by the sep character.

The function's output is specified by the following invariants:

  • The list is not empty.
  • Concatenating its elements using sep as a separator returns a byte sequence equal to the input (Bytes.concat (Bytes.make 1 sep) + (Bytes.split_on_char sep s) = s).
  • No byte sequence in the result contains the sep character.
  • since 4.13

Iterators

val to_seq : t -> char Seq.t

Iterate on the string, in increasing index order. Modifications of the string during iteration will be reflected in the sequence.

  • since 4.07
val to_seqi : t -> (int * char) Seq.t

Iterate on the string, in increasing order, yielding indices along chars

  • since 4.07
val of_seq : char Seq.t -> t

Create a string from the generator

  • since 4.07

UTF codecs and validations

  • since 4.14

UTF-8

val get_utf_8_uchar : t -> int -> Uchar.utf_decode

get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

val set_utf_8_uchar : t -> int -> Uchar.t -> int

set_utf_8_uchar b i u UTF-8 encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

val is_valid_utf_8 : t -> bool

is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

UTF-16BE

val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

val set_utf_16be_uchar : t -> int -> Uchar.t -> int

set_utf_16be_uchar b i u UTF-16BE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

val is_valid_utf_16be : t -> bool

is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

UTF-16LE

val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

val set_utf_16le_uchar : t -> int -> Uchar.t -> int

set_utf_16le_uchar b i u UTF-16LE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

val is_valid_utf_16le : t -> bool

is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

Binary encoding/decoding of integers

The functions in this section binary encode and decode integers to and from byte sequences.

All following functions raise Invalid_argument if the space needed at index i to decode or encode the integer is not available.

Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are handled as follows:

  • Functions that decode signed (resp. unsigned) 8-bit or 16-bit integers represented by int values sign-extend (resp. zero-extend) their result.
  • Functions that encode 8-bit or 16-bit integers represented by int values truncate their input to their least significant bytes.
val get_uint8 : bytes -> int -> int

get_uint8 b i is b's unsigned 8-bit integer starting at byte index i.

  • since 4.08
val get_int8 : bytes -> int -> int

get_int8 b i is b's signed 8-bit integer starting at byte index i.

  • since 4.08
val get_uint16_ne : bytes -> int -> int

get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at byte index i.

  • since 4.08
val get_uint16_be : bytes -> int -> int

get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at byte index i.

  • since 4.08
val get_uint16_le : bytes -> int -> int

get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at byte index i.

  • since 4.08
val get_int16_ne : bytes -> int -> int

get_int16_ne b i is b's native-endian signed 16-bit integer starting at byte index i.

  • since 4.08
val get_int16_be : bytes -> int -> int

get_int16_be b i is b's big-endian signed 16-bit integer starting at byte index i.

  • since 4.08
val get_int16_le : bytes -> int -> int

get_int16_le b i is b's little-endian signed 16-bit integer starting at byte index i.

  • since 4.08
val get_int32_ne : bytes -> int -> int32

get_int32_ne b i is b's native-endian 32-bit integer starting at byte index i.

  • since 4.08
val get_int32_be : bytes -> int -> int32

get_int32_be b i is b's big-endian 32-bit integer starting at byte index i.

  • since 4.08
val get_int32_le : bytes -> int -> int32

get_int32_le b i is b's little-endian 32-bit integer starting at byte index i.

  • since 4.08
val get_int64_ne : bytes -> int -> int64

get_int64_ne b i is b's native-endian 64-bit integer starting at byte index i.

  • since 4.08
val get_int64_be : bytes -> int -> int64

get_int64_be b i is b's big-endian 64-bit integer starting at byte index i.

  • since 4.08
val get_int64_le : bytes -> int -> int64

get_int64_le b i is b's little-endian 64-bit integer starting at byte index i.

  • since 4.08
val set_uint8 : bytes -> int -> int -> unit

set_uint8 b i v sets b's unsigned 8-bit integer starting at byte index i to v.

  • since 4.08
val set_int8 : bytes -> int -> int -> unit

set_int8 b i v sets b's signed 8-bit integer starting at byte index i to v.

  • since 4.08
val set_uint16_ne : bytes -> int -> int -> unit

set_uint16_ne b i v sets b's native-endian unsigned 16-bit integer starting at byte index i to v.

  • since 4.08
val set_uint16_be : bytes -> int -> int -> unit

set_uint16_be b i v sets b's big-endian unsigned 16-bit integer starting at byte index i to v.

  • since 4.08
val set_uint16_le : bytes -> int -> int -> unit

set_uint16_le b i v sets b's little-endian unsigned 16-bit integer starting at byte index i to v.

  • since 4.08
val set_int16_ne : bytes -> int -> int -> unit

set_int16_ne b i v sets b's native-endian signed 16-bit integer starting at byte index i to v.

  • since 4.08
val set_int16_be : bytes -> int -> int -> unit

set_int16_be b i v sets b's big-endian signed 16-bit integer starting at byte index i to v.

  • since 4.08
val set_int16_le : bytes -> int -> int -> unit

set_int16_le b i v sets b's little-endian signed 16-bit integer starting at byte index i to v.

  • since 4.08
val set_int32_ne : bytes -> int -> int32 -> unit

set_int32_ne b i v sets b's native-endian 32-bit integer starting at byte index i to v.

  • since 4.08
val set_int32_be : bytes -> int -> int32 -> unit

set_int32_be b i v sets b's big-endian 32-bit integer starting at byte index i to v.

  • since 4.08
val set_int32_le : bytes -> int -> int32 -> unit

set_int32_le b i v sets b's little-endian 32-bit integer starting at byte index i to v.

  • since 4.08
val set_int64_ne : bytes -> int -> int64 -> unit

set_int64_ne b i v sets b's native-endian 64-bit integer starting at byte index i to v.

  • since 4.08
val set_int64_be : bytes -> int -> int64 -> unit

set_int64_be b i v sets b's big-endian 64-bit integer starting at byte index i to v.

  • since 4.08
val set_int64_le : bytes -> int -> int64 -> unit

set_int64_le b i v sets b's little-endian 64-bit integer starting at byte index i to v.

  • since 4.08

Byte sequences and concurrency safety

Care must be taken when concurrently accessing byte sequences from multiple domains: accessing a byte sequence will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

Atomicity

Every byte sequence operation that accesses more than one byte is not atomic. This includes iteration and scanning.

For example, consider the following program:

let size = 100_000_000
+let b = Bytes.make size  ' '
+let update b f ()  =
+  Bytes.iteri (fun i x -> Bytes.set b i (Char.chr (f (Char.code x)))) b
+let d1 = Domain.spawn (update b (fun x -> x + 1))
+let d2 = Domain.spawn (update b (fun x -> 2 * x + 1))
+let () = Domain.join d1; Domain.join d2

the bytes sequence b may contain a non-deterministic mixture of '!', 'A', 'B', and 'C' values.

After executing this code, each byte of the sequence b is either '!', 'A', 'B', or 'C'. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

Data races

If two domains only access disjoint parts of a byte sequence, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

A data race is said to occur when two domains access the same byte without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the elements of the sequence.

Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location.

Mixed-size accesses

Another subtle point is that if a data race involves mixed-size writes and reads to the same location, the order in which those writes and reads are observed by domains is not specified. For instance, the following code write sequentially a 32-bit integer and a char to the same index

let b = Bytes.make 10 '\000'
+let d1 = Domain.spawn (fun () -> Bytes.set_int32_ne b 0 100; b.[0] <- 'd' )

In this situation, a domain that observes the write of 'd' to b.0 is not guaranteed to also observe the write to indices 1, 2, or 3.

diff --git a/ocaml/Stdlib/Callback/index.html b/ocaml/Stdlib/Callback/index.html new file mode 100644 index 00000000..b083b012 --- /dev/null +++ b/ocaml/Stdlib/Callback/index.html @@ -0,0 +1,2 @@ + +Callback (ocaml.Stdlib.Callback)

Module Stdlib.Callback

Registering OCaml values with the C runtime.

This module allows OCaml values to be registered with the C runtime under a symbolic name, so that C code can later call back registered OCaml functions, or raise registered OCaml exceptions.

val register : string -> 'a -> unit

Callback.register n v registers the value v under the name n. C code can later retrieve a handle to v by calling caml_named_value(n).

val register_exception : string -> exn -> unit

Callback.register_exception n exn registers the exception contained in the exception value exn under the name n. C code can later retrieve a handle to the exception by calling caml_named_value(n). The exception value thus obtained is suitable for passing as first argument to raise_constant or raise_with_arg.

diff --git a/ocaml/Stdlib/Char/index.html b/ocaml/Stdlib/Char/index.html new file mode 100644 index 00000000..0ed746a5 --- /dev/null +++ b/ocaml/Stdlib/Char/index.html @@ -0,0 +1,2 @@ + +Char (ocaml.Stdlib.Char)

Module Stdlib.Char

Character operations.

val code : char -> int

Return the ASCII code of the argument.

val chr : int -> char

Return the character with the given ASCII code.

val escaped : char -> string

Return a string representing the given character, with special characters escaped following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash, double-quote, and single-quote.

val lowercase_ascii : char -> char

Convert the given character to its equivalent lowercase character, using the US-ASCII character set.

  • since 4.03
val uppercase_ascii : char -> char

Convert the given character to its equivalent uppercase character, using the US-ASCII character set.

  • since 4.03
type t = char

An alias for the type of characters.

val compare : t -> t -> int

The comparison function for characters, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Char to be passed as argument to the functors Set.Make and Map.Make.

val equal : t -> t -> bool

The equal function for chars.

  • since 4.03
val seeded_hash : int -> t -> int

A seeded hash function for characters, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.1
val hash : t -> int

An unseeded hash function for characters, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.1
diff --git a/ocaml/Stdlib/Complex/index.html b/ocaml/Stdlib/Complex/index.html new file mode 100644 index 00000000..17d5e4cd --- /dev/null +++ b/ocaml/Stdlib/Complex/index.html @@ -0,0 +1,2 @@ + +Complex (ocaml.Stdlib.Complex)

Module Stdlib.Complex

Complex numbers.

This module provides arithmetic operations on complex numbers. Complex numbers are represented by their real and imaginary parts (cartesian representation). Each part is represented by a double-precision floating-point number (type float).

type t = {
  1. re : float;
  2. im : float;
}

The type of complex numbers. re is the real part and im the imaginary part.

val zero : t

The complex number 0.

val one : t

The complex number 1.

val i : t

The complex number i.

val neg : t -> t

Unary negation.

val conj : t -> t

Conjugate: given the complex x + i.y, returns x - i.y.

val add : t -> t -> t

Addition

val sub : t -> t -> t

Subtraction

val mul : t -> t -> t

Multiplication

val inv : t -> t

Multiplicative inverse (1/z).

val div : t -> t -> t

Division

val sqrt : t -> t

Square root. The result x + i.y is such that x > 0 or x = 0 and y >= 0. This function has a discontinuity along the negative real axis.

val norm2 : t -> float

Norm squared: given x + i.y, returns x^2 + y^2.

val norm : t -> float

Norm: given x + i.y, returns sqrt(x^2 + y^2).

val arg : t -> float

Argument. The argument of a complex number is the angle in the complex plane between the positive real axis and a line passing through zero and the number. This angle ranges from -pi to pi. This function has a discontinuity along the negative real axis.

val polar : float -> float -> t

polar norm arg returns the complex having norm norm and argument arg.

val exp : t -> t

Exponentiation. exp z returns e to the z power.

val log : t -> t

Natural logarithm (in base e).

val pow : t -> t -> t

Power function. pow z1 z2 returns z1 to the z2 power.

diff --git a/ocaml/Stdlib/Condition/index.html b/ocaml/Stdlib/Condition/index.html new file mode 100644 index 00000000..f07ded55 --- /dev/null +++ b/ocaml/Stdlib/Condition/index.html @@ -0,0 +1,31 @@ + +Condition (ocaml.Stdlib.Condition)

Module Stdlib.Condition

Condition variables.

Condition variables are useful when several threads wish to access a shared data structure that is protected by a mutex (a mutual exclusion lock).

A condition variable is a communication channel. On the receiver side, one or more threads can indicate that they wish to wait for a certain property to become true. On the sender side, a thread can signal that this property has become true, causing one (or more) waiting threads to be woken up.

For instance, in the implementation of a queue data structure, if a thread that wishes to extract an element finds that the queue is currently empty, then this thread waits for the queue to become nonempty. A thread that inserts an element into the queue signals that the queue has become nonempty. A condition variable is used for this purpose. This communication channel conveys the information that the property "the queue is nonempty" is true, or more accurately, may be true. (We explain below why the receiver of a signal cannot be certain that the property holds.)

To continue the example of the queue, assuming that the queue has a fixed maximum capacity, then a thread that wishes to insert an element may find that the queue is full. Then, this thread must wait for the queue to become not full, and a thread that extracts an element of the queue signals that the queue has become not full. Another condition variable is used for this purpose.

In short, a condition variable c is used to convey the information that a certain property P about a shared data structure D, protected by a mutex m, may be true.

Condition variables provide an efficient alternative to busy-waiting. When one wishes to wait for the property P to be true, instead of writing a busy-waiting loop:

Mutex.lock m;
+while not P do
+  Mutex.unlock m; Mutex.lock m
+done;
+<update the data structure>;
+Mutex.unlock m

one uses wait in the body of the loop, as follows:

Mutex.lock m;
+while not P do
+  Condition.wait c m
+done;
+<update the data structure>;
+Mutex.unlock m

The busy-waiting loop is inefficient because the waiting thread consumes processing time and creates contention of the mutex m. Calling wait allows the waiting thread to be suspended, so it does not consume any computing resources while waiting.

With a condition variable c, exactly one mutex m is associated. This association is implicit: the mutex m is not explicitly passed as an argument to create. It is up to the programmer to know, for each condition variable c, which is the associated mutex m.

With a mutex m, several condition variables can be associated. In the example of the bounded queue, one condition variable is used to indicate that the queue is nonempty, and another condition variable is used to indicate that the queue is not full.

With a condition variable c, exactly one logical property P should be associated. Examples of such properties include "the queue is nonempty" and "the queue is not full". It is up to the programmer to keep track, for each condition variable, of the corresponding property P. A signal is sent on the condition variable c as an indication that the property P is true, or may be true. On the receiving end, however, a thread that is woken up cannot assume that P is true; after a call to wait terminates, one must explicitly test whether P is true. There are several reasons why this is so. One reason is that, between the moment when the signal is sent and the moment when a waiting thread receives the signal and is scheduled, the property P may be falsified by some other thread that is able to acquire the mutex m and alter the data structure D. Another reason is that spurious wakeups may occur: a waiting thread can be woken up even if no signal was sent.

Here is a complete example, where a mutex protects a sequential unbounded queue, and where a condition variable is used to signal that the queue is nonempty.

type 'a safe_queue =
+  { queue : 'a Queue.t; mutex : Mutex.t; nonempty : Condition.t }
+
+let create () =
+  { queue = Queue.create(); mutex = Mutex.create();
+    nonempty = Condition.create() }
+
+let add v q =
+  Mutex.lock q.mutex;
+  let was_empty = Queue.is_empty q.queue in
+  Queue.add v q.queue;
+  if was_empty then Condition.broadcast q.nonempty;
+  Mutex.unlock q.mutex
+
+let take q =
+  Mutex.lock q.mutex;
+  while Queue.is_empty q.queue do Condition.wait q.nonempty q.mutex done;
+  let v = Queue.take q.queue in (* cannot fail since queue is nonempty *)
+  Mutex.unlock q.mutex;
+  v

Because the call to broadcast takes place inside the critical section, the following property holds whenever the mutex is unlocked: if the queue is nonempty, then no thread is waiting, or, in other words, if some thread is waiting, then the queue must be empty. This is a desirable property: if a thread that attempts to execute a take operation could remain suspended even though the queue is nonempty, that would be a problematic situation, known as a deadlock.

type t

The type of condition variables.

val create : unit -> t

create() creates and returns a new condition variable. This condition variable should be associated (in the programmer's mind) with a certain mutex m and with a certain property P of the data structure that is protected by the mutex m.

val wait : t -> Mutex.t -> unit

The call wait c m is permitted only if m is the mutex associated with the condition variable c, and only if m is currently locked. This call atomically unlocks the mutex m and suspends the current thread on the condition variable c. This thread can later be woken up after the condition variable c has been signaled via signal or broadcast; however, it can also be woken up for no reason. The mutex m is locked again before wait returns. One cannot assume that the property P associated with the condition variable c holds when wait returns; one must explicitly test whether P holds after calling wait.

val signal : t -> unit

signal c wakes up one of the threads waiting on the condition variable c, if there is one. If there is none, this call has no effect.

It is recommended to call signal c inside a critical section, that is, while the mutex m associated with c is locked.

val broadcast : t -> unit

broadcast c wakes up all threads waiting on the condition variable c. If there are none, this call has no effect.

It is recommended to call broadcast c inside a critical section, that is, while the mutex m associated with c is locked.

diff --git a/ocaml/Stdlib/Digest/index.html b/ocaml/Stdlib/Digest/index.html new file mode 100644 index 00000000..dfa5e381 --- /dev/null +++ b/ocaml/Stdlib/Digest/index.html @@ -0,0 +1,2 @@ + +Digest (ocaml.Stdlib.Digest)

Module Stdlib.Digest

MD5 message digest.

This module provides functions to compute 128-bit 'digests' of arbitrary-length strings or files. The algorithm used is MD5.

The MD5 hash function is not cryptographically secure. Hence, this module should not be used for security-sensitive applications. More recent, stronger cryptographic primitives should be used instead.

type t = string

The type of digests: 16-character strings.

val compare : t -> t -> int

The comparison function for 16-character digest, with the same specification as Stdlib.compare and the implementation shared with String.compare. Along with the type t, this function compare allows the module Digest to be passed as argument to the functors Set.Make and Map.Make.

  • since 4.00
val equal : t -> t -> bool

The equal function for 16-character digest.

  • since 4.03
val string : string -> t

Return the digest of the given string.

val bytes : bytes -> t

Return the digest of the given byte sequence.

  • since 4.02
val substring : string -> int -> int -> t

Digest.substring s ofs len returns the digest of the substring of s starting at index ofs and containing len characters.

val subbytes : bytes -> int -> int -> t

Digest.subbytes s ofs len returns the digest of the subsequence of s starting at index ofs and containing len bytes.

  • since 4.02
val channel : in_channel -> int -> t

If len is nonnegative, Digest.channel ic len reads len characters from channel ic and returns their digest, or raises End_of_file if end-of-file is reached before len characters are read. If len is negative, Digest.channel ic len reads all characters from ic until end-of-file is reached and return their digest.

val file : string -> t

Return the digest of the file whose name is given.

val output : out_channel -> t -> unit

Write a digest on the given output channel.

val input : in_channel -> t

Read a digest from the given input channel.

val to_hex : t -> string

Return the printable hexadecimal representation of the given digest.

val from_hex : string -> t

Convert a hexadecimal representation back into the corresponding digest.

  • raises Invalid_argument

    if the argument is not exactly 32 hexadecimal characters.

  • since 4.00
diff --git a/ocaml/Stdlib/Domain/DLS/index.html b/ocaml/Stdlib/Domain/DLS/index.html new file mode 100644 index 00000000..0d6462d2 --- /dev/null +++ b/ocaml/Stdlib/Domain/DLS/index.html @@ -0,0 +1,12 @@ + +DLS (ocaml.Stdlib.Domain.DLS)

Module Domain.DLS

Domain-local Storage

type 'a key

Type of a DLS key

val new_key : ?split_from_parent:('a -> 'a) -> (unit -> 'a) -> 'a key

new_key f returns a new key bound to initialiser f for accessing , domain-local variables.

If split_from_parent is not provided, the value for a new domain will be computed on-demand by the new domain: the first get call will call the initializer f and store that value.

If split_from_parent is provided, spawning a domain will derive the child value (for this key) from the parent value. This computation happens in the parent domain and it always happens, regardless of whether the child domain will use it. If the splitting function is expensive or requires child-side computation, consider using 'a Lazy.t key:

let init () = ...
+
+let split_from_parent parent_value =
+  ... parent-side computation ...;
+  lazy (
+    ... child-side computation ...
+  )
+
+let key = Domain.DLS.new_key ~split_from_parent init
+
+let get () = Lazy.force (Domain.DLS.get key)

In this case a part of the computation happens on the child domain; in particular, it can access parent_value concurrently with the parent domain, which may require explicit synchronization to avoid data races.

val get : 'a key -> 'a

get k returns v if a value v is associated to the key k on the calling domain's domain-local state. Sets k's value with its initialiser and returns it otherwise.

val set : 'a key -> 'a -> unit

set k v updates the calling domain's domain-local state to associate the key k with value v. It overwrites any previous values associated to k, which cannot be restored later.

diff --git a/ocaml/Stdlib/Domain/index.html b/ocaml/Stdlib/Domain/index.html new file mode 100644 index 00000000..e4f77816 --- /dev/null +++ b/ocaml/Stdlib/Domain/index.html @@ -0,0 +1,5 @@ + +Domain (ocaml.Stdlib.Domain)

Module Stdlib.Domain

  • alert unstable The Domain interface may change in incompatible ways in the future.

Domains.

See 'Parallel programming' chapter in the manual.

  • since 5.0
  • alert unstable The Domain interface may change in incompatible ways in the future.
type !'a t

A domain of type 'a t runs independently, eventually producing a result of type 'a, or an exception

val spawn : (unit -> 'a) -> 'a t

spawn f creates a new domain that runs in parallel with the current domain.

  • raises Failure

    if the program has insufficient resources to create another domain.

val join : 'a t -> 'a

join d blocks until domain d runs to completion. If d results in a value, then that is returned by join d. If d raises an uncaught exception, then that is re-raised by join d.

type id = private int

Domains have unique integer identifiers

val get_id : 'a t -> id

get_id d returns the identifier of the domain d

val self : unit -> id

self () is the identifier of the currently running domain

val before_first_spawn : (unit -> unit) -> unit

before_first_spawn f registers f to be called before the first domain is spawned by the program. The functions registered with before_first_spawn are called on the main (initial) domain. The functions registered with before_first_spawn are called in 'first in, first out' order: the oldest function added with before_first_spawn is called first.

val at_exit : (unit -> unit) -> unit

at_exit f registers f to be called when the current domain exits. Note that at_exit callbacks are domain-local and only apply to the calling domain. The registered functions are called in 'last in, first out' order: the function most recently added with at_exit is called first. An example:

let temp_file_key = Domain.DLS.new_key (fun _ ->
+  let tmp = snd (Filename.open_temp_file "" "") in
+  Domain.at_exit (fun () -> close_out_noerr tmp);
+  tmp)

The snippet above creates a key that when retrieved for the first time will open a temporary file and register an at_exit callback to close it, thus guaranteeing the descriptor is not leaked in case the current domain exits.

val cpu_relax : unit -> unit

If busy-waiting, calling cpu_relax () between iterations will improve performance on some CPU architectures

val is_main_domain : unit -> bool

is_main_domain () returns true if called from the initial domain.

The recommended maximum number of domains which should be running simultaneously (including domains already running).

The value returned is at least 1.

module DLS : sig ... end

Domain-local Storage

diff --git a/ocaml/Stdlib/Effect/Deep/index.html b/ocaml/Stdlib/Effect/Deep/index.html new file mode 100644 index 00000000..237c9279 --- /dev/null +++ b/ocaml/Stdlib/Effect/Deep/index.html @@ -0,0 +1,6 @@ + +Deep (ocaml.Stdlib.Effect.Deep)

Module Effect.Deep

Deep handlers

type ('a, 'b) continuation

('a,'b) continuation is a delimited continuation that expects a 'a value and returns a 'b value.

val continue : ('a, 'b) continuation -> 'a -> 'b

continue k x resumes the continuation k by passing x to k.

val discontinue : ('a, 'b) continuation -> exn -> 'b

discontinue k e resumes the continuation k by raising the exception e in k.

val discontinue_with_backtrace : + ('a, 'b) continuation -> + exn -> + Printexc.raw_backtrace -> + 'b

discontinue_with_backtrace k e bt resumes the continuation k by raising the exception e in k using bt as the origin for the exception.

type ('a, 'b) handler = {
  1. retc : 'a -> 'b;
  2. exnc : exn -> 'b;
  3. effc : 'c. 'c t -> (('c, 'b) continuation -> 'b) option;
}

('a,'b) handler is a handler record with three fields -- retc is the value handler, exnc handles exceptions, and effc handles the effects performed by the computation enclosed by the handler.

val match_with : ('c -> 'a) -> 'c -> ('a, 'b) handler -> 'b

match_with f v h runs the computation f v in the handler h.

type 'a effect_handler = {
  1. effc : 'b. 'b t -> (('b, 'a) continuation -> 'a) option;
}

'a effect_handler is a deep handler with an identity value handler fun x -> x and an exception handler that raises any exception fun e -> raise e.

val try_with : ('b -> 'a) -> 'b -> 'a effect_handler -> 'a

try_with f v h runs the computation f v under the handler h.

val get_callstack : ('a, 'b) continuation -> int -> Printexc.raw_backtrace

get_callstack c n returns a description of the top of the call stack on the continuation c, with at most n entries.

diff --git a/ocaml/Stdlib/Effect/Shallow/index.html b/ocaml/Stdlib/Effect/Shallow/index.html new file mode 100644 index 00000000..c3b54a83 --- /dev/null +++ b/ocaml/Stdlib/Effect/Shallow/index.html @@ -0,0 +1,7 @@ + +Shallow (ocaml.Stdlib.Effect.Shallow)

Module Effect.Shallow

type ('a, 'b) continuation

('a,'b) continuation is a delimited continuation that expects a 'a value and returns a 'b value.

val fiber : ('a -> 'b) -> ('a, 'b) continuation

fiber f constructs a continuation that runs the computation f.

type ('a, 'b) handler = {
  1. retc : 'a -> 'b;
  2. exnc : exn -> 'b;
  3. effc : 'c. 'c t -> (('c, 'a) continuation -> 'b) option;
}

('a,'b) handler is a handler record with three fields -- retc is the value handler, exnc handles exceptions, and effc handles the effects performed by the computation enclosed by the handler.

val continue_with : ('c, 'a) continuation -> 'c -> ('a, 'b) handler -> 'b

continue_with k v h resumes the continuation k with value v with the handler h.

val discontinue_with : ('c, 'a) continuation -> exn -> ('a, 'b) handler -> 'b

discontinue_with k e h resumes the continuation k by raising the exception e with the handler h.

val discontinue_with_backtrace : + ('a, 'b) continuation -> + exn -> + Printexc.raw_backtrace -> + ('b, 'c) handler -> + 'c

discontinue_with k e bt h resumes the continuation k by raising the exception e with the handler h using the raw backtrace bt as the origin of the exception.

val get_callstack : ('a, 'b) continuation -> int -> Printexc.raw_backtrace

get_callstack c n returns a description of the top of the call stack on the continuation c, with at most n entries.

diff --git a/ocaml/Stdlib/Effect/index.html b/ocaml/Stdlib/Effect/index.html new file mode 100644 index 00000000..7c1957a9 --- /dev/null +++ b/ocaml/Stdlib/Effect/index.html @@ -0,0 +1,2 @@ + +Effect (ocaml.Stdlib.Effect)

Module Stdlib.Effect

  • alert unstable The Effect interface may change in incompatible ways in the future.

Effects.

See 'Language extensions/Effect handlers' section in the manual.

  • since 5.0
  • alert unstable The Effect interface may change in incompatible ways in the future.
type _ t = ..

The type of effects.

exception Unhandled : 'a t -> exn

Unhandled e is raised when effect e is performed and there is no handler for it.

exception Continuation_already_resumed

Exception raised when a continuation is continued or discontinued more than once.

val perform : 'a t -> 'a

perform e performs an effect e.

  • raises Unhandled

    if there is no handler for e.

module Deep : sig ... end

Deep handlers

module Shallow : sig ... end
diff --git a/ocaml/Stdlib/Either/index.html b/ocaml/Stdlib/Either/index.html new file mode 100644 index 00000000..cb2c5f6f --- /dev/null +++ b/ocaml/Stdlib/Either/index.html @@ -0,0 +1,17 @@ + +Either (ocaml.Stdlib.Either)

Module Stdlib.Either

Either type.

Either is the simplest and most generic sum/variant type: a value of ('a, 'b) Either.t is either a Left (v : 'a) or a Right (v : 'b).

It is a natural choice in the API of generic functions where values could fall in two different cases, possibly at different types, without assigning a specific meaning to what each case should be.

For example:

List.partition_map:
+  ('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list

If you are looking for a parametrized type where one alternative means success and the other means failure, you should use the more specific type Result.t.

  • since 4.12
type ('a, 'b) t =
  1. | Left of 'a
  2. | Right of 'b

A value of ('a, 'b) Either.t contains either a value of 'a or a value of 'b

val left : 'a -> ('a, 'b) t

left v is Left v.

val right : 'b -> ('a, 'b) t

right v is Right v.

val is_left : ('a, 'b) t -> bool

is_left (Left v) is true, is_left (Right v) is false.

val is_right : ('a, 'b) t -> bool

is_right (Left v) is false, is_right (Right v) is true.

val find_left : ('a, 'b) t -> 'a option

find_left (Left v) is Some v, find_left (Right _) is None

val find_right : ('a, 'b) t -> 'b option

find_right (Right v) is Some v, find_right (Left _) is None

val map_left : ('a1 -> 'a2) -> ('a1, 'b) t -> ('a2, 'b) t

map_left f e is Left (f v) if e is Left v and e if e is Right _.

val map_right : ('b1 -> 'b2) -> ('a, 'b1) t -> ('a, 'b2) t

map_right f e is Right (f v) if e is Right v and e if e is Left _.

val map : + left:('a1 -> 'a2) -> + right:('b1 -> 'b2) -> + ('a1, 'b1) t -> + ('a2, 'b2) t

map ~left ~right (Left v) is Left (left v), map ~left ~right (Right v) is Right (right v).

val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'c

fold ~left ~right (Left v) is left v, and fold ~left ~right (Right v) is right v.

val iter : left:('a -> unit) -> right:('b -> unit) -> ('a, 'b) t -> unit

iter ~left ~right (Left v) is left v, and iter ~left ~right (Right v) is right v.

val for_all : left:('a -> bool) -> right:('b -> bool) -> ('a, 'b) t -> bool

for_all ~left ~right (Left v) is left v, and for_all ~left ~right (Right v) is right v.

val equal : + left:('a -> 'a -> bool) -> + right:('b -> 'b -> bool) -> + ('a, 'b) t -> + ('a, 'b) t -> + bool

equal ~left ~right e0 e1 tests equality of e0 and e1 using left and right to respectively compare values wrapped by Left _ and Right _.

val compare : + left:('a -> 'a -> int) -> + right:('b -> 'b -> int) -> + ('a, 'b) t -> + ('a, 'b) t -> + int

compare ~left ~right e0 e1 totally orders e0 and e1 using left and right to respectively compare values wrapped by Left _ and Right _. Left _ values are smaller than Right _ values.

diff --git a/ocaml/Stdlib/Ephemeron/K1/Bucket/index.html b/ocaml/Stdlib/Ephemeron/K1/Bucket/index.html new file mode 100644 index 00000000..2ff2e5e8 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K1/Bucket/index.html @@ -0,0 +1,2 @@ + +Bucket (ocaml.Stdlib.Ephemeron.K1.Bucket)

Module K1.Bucket

type ('k, 'd) t

A bucket is a mutable "list" of ephemerons.

val make : unit -> ('k, 'd) t

Create a new bucket.

val add : ('k, 'd) t -> 'k -> 'd -> unit

Add an ephemeron to the bucket.

val remove : ('k, 'd) t -> 'k -> unit

remove b k removes from b the most-recently added ephemeron with key k, or does nothing if there is no such ephemeron.

val find : ('k, 'd) t -> 'k -> 'd option

Returns the data of the most-recently added ephemeron with the given key, or None if there is no such ephemeron.

val length : ('k, 'd) t -> int

Returns an upper bound on the length of the bucket.

val clear : ('k, 'd) t -> unit

Remove all ephemerons from the bucket.

diff --git a/ocaml/Stdlib/Ephemeron/K1/Make/argument-1-H/index.html b/ocaml/Stdlib/Ephemeron/K1/Make/argument-1-H/index.html new file mode 100644 index 00000000..1cda9574 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K1/Make/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (ocaml.Stdlib.Ephemeron.K1.Make.H)

Parameter Make.H

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Stdlib/Ephemeron/K1/Make/index.html b/ocaml/Stdlib/Ephemeron/K1/Make/index.html new file mode 100644 index 00000000..4a3f6595 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K1/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Stdlib.Ephemeron.K1.Make)

Module K1.Make

Functor building an implementation of a weak hash table

Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

Parameters

Signature

type key = H.t
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
val clean : 'a t -> unit

remove all dead bindings. Done automatically during automatic resizing.

val stats_alive : 'a t -> Hashtbl.statistics

same as Hashtbl.SeededS.stats but only count the alive bindings

diff --git a/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/argument-1-H/index.html b/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/argument-1-H/index.html new file mode 100644 index 00000000..11bda4cd --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (ocaml.Stdlib.Ephemeron.K1.MakeSeeded.H)

Parameter MakeSeeded.H

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val seeded_hash : int -> t -> int

A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

diff --git a/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/index.html b/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/index.html new file mode 100644 index 00000000..303a25d2 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/index.html @@ -0,0 +1,2 @@ + +MakeSeeded (ocaml.Stdlib.Ephemeron.K1.MakeSeeded)

Module K1.MakeSeeded

Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

Parameters

Signature

type key = H.t
type !'a t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
val clean : 'a t -> unit

remove all dead bindings. Done automatically during automatic resizing.

val stats_alive : 'a t -> Hashtbl.statistics

same as Hashtbl.SeededS.stats but only count the alive bindings

diff --git a/ocaml/Stdlib/Ephemeron/K1/index.html b/ocaml/Stdlib/Ephemeron/K1/index.html new file mode 100644 index 00000000..55160d67 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K1/index.html @@ -0,0 +1,2 @@ + +K1 (ocaml.Stdlib.Ephemeron.K1)

Module Ephemeron.K1

Ephemerons with one key.

type ('k, 'd) t

an ephemeron with one key

val make : 'k -> 'd -> ('k, 'd) t

Ephemeron.K1.make k d creates an ephemeron with key k and data d.

val query : ('k, 'd) t -> 'k -> 'd option

Ephemeron.K1.query eph key returns Some x (where x is the ephemeron's data) if key is physically equal to eph's key, and None if eph is empty or key is not equal to eph's key.

module Make (H : Hashtbl.HashedType) : S with type key = H.t

Functor building an implementation of a weak hash table

Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

module Bucket : sig ... end
diff --git a/ocaml/Stdlib/Ephemeron/K2/Bucket/index.html b/ocaml/Stdlib/Ephemeron/K2/Bucket/index.html new file mode 100644 index 00000000..9109c0ee --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K2/Bucket/index.html @@ -0,0 +1,2 @@ + +Bucket (ocaml.Stdlib.Ephemeron.K2.Bucket)

Module K2.Bucket

type ('k1, 'k2, 'd) t

A bucket is a mutable "list" of ephemerons.

val make : unit -> ('k1, 'k2, 'd) t

Create a new bucket.

val add : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd -> unit

Add an ephemeron to the bucket.

val remove : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> unit

remove b k1 k2 removes from b the most-recently added ephemeron with keys k1 and k2, or does nothing if there is no such ephemeron.

val find : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option

Returns the data of the most-recently added ephemeron with the given keys, or None if there is no such ephemeron.

val length : ('k1, 'k2, 'd) t -> int

Returns an upper bound on the length of the bucket.

val clear : ('k1, 'k2, 'd) t -> unit

Remove all ephemerons from the bucket.

diff --git a/ocaml/Stdlib/Ephemeron/K2/Make/argument-1-H1/index.html b/ocaml/Stdlib/Ephemeron/K2/Make/argument-1-H1/index.html new file mode 100644 index 00000000..38ff7803 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K2/Make/argument-1-H1/index.html @@ -0,0 +1,2 @@ + +H1 (ocaml.Stdlib.Ephemeron.K2.Make.H1)

Parameter Make.H1

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Stdlib/Ephemeron/K2/Make/argument-2-H2/index.html b/ocaml/Stdlib/Ephemeron/K2/Make/argument-2-H2/index.html new file mode 100644 index 00000000..aac146bc --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K2/Make/argument-2-H2/index.html @@ -0,0 +1,2 @@ + +H2 (ocaml.Stdlib.Ephemeron.K2.Make.H2)

Parameter Make.H2

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Stdlib/Ephemeron/K2/Make/index.html b/ocaml/Stdlib/Ephemeron/K2/Make/index.html new file mode 100644 index 00000000..eff546b1 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K2/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Stdlib.Ephemeron.K2.Make)

Module K2.Make

Functor building an implementation of a weak hash table

Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

Parameters

Signature

type key = H1.t * H2.t
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
val clean : 'a t -> unit

remove all dead bindings. Done automatically during automatic resizing.

val stats_alive : 'a t -> Hashtbl.statistics

same as Hashtbl.SeededS.stats but only count the alive bindings

diff --git a/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-1-H1/index.html b/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-1-H1/index.html new file mode 100644 index 00000000..31ddc688 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-1-H1/index.html @@ -0,0 +1,2 @@ + +H1 (ocaml.Stdlib.Ephemeron.K2.MakeSeeded.H1)

Parameter MakeSeeded.H1

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val seeded_hash : int -> t -> int

A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

diff --git a/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-2-H2/index.html b/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-2-H2/index.html new file mode 100644 index 00000000..b7fbdcc9 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-2-H2/index.html @@ -0,0 +1,2 @@ + +H2 (ocaml.Stdlib.Ephemeron.K2.MakeSeeded.H2)

Parameter MakeSeeded.H2

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val seeded_hash : int -> t -> int

A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

diff --git a/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/index.html b/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/index.html new file mode 100644 index 00000000..101705b3 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/index.html @@ -0,0 +1,2 @@ + +MakeSeeded (ocaml.Stdlib.Ephemeron.K2.MakeSeeded)

Module K2.MakeSeeded

Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

Parameters

Signature

type key = H1.t * H2.t
type !'a t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
val clean : 'a t -> unit

remove all dead bindings. Done automatically during automatic resizing.

val stats_alive : 'a t -> Hashtbl.statistics

same as Hashtbl.SeededS.stats but only count the alive bindings

diff --git a/ocaml/Stdlib/Ephemeron/K2/index.html b/ocaml/Stdlib/Ephemeron/K2/index.html new file mode 100644 index 00000000..7a066b0a --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/K2/index.html @@ -0,0 +1,8 @@ + +K2 (ocaml.Stdlib.Ephemeron.K2)

Module Ephemeron.K2

Ephemerons with two keys.

type ('k1, 'k2, 'd) t

an ephemeron with two keys

val make : 'k1 -> 'k2 -> 'd -> ('k1, 'k2, 'd) t
val query : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option
module Make + (H1 : Hashtbl.HashedType) + (H2 : Hashtbl.HashedType) : + S with type key = H1.t * H2.t

Functor building an implementation of a weak hash table

Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

module Bucket : sig ... end
diff --git a/ocaml/Stdlib/Ephemeron/Kn/Bucket/index.html b/ocaml/Stdlib/Ephemeron/Kn/Bucket/index.html new file mode 100644 index 00000000..57788fad --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/Kn/Bucket/index.html @@ -0,0 +1,2 @@ + +Bucket (ocaml.Stdlib.Ephemeron.Kn.Bucket)

Module Kn.Bucket

type ('k, 'd) t

A bucket is a mutable "list" of ephemerons.

val make : unit -> ('k, 'd) t

Create a new bucket.

val add : ('k, 'd) t -> 'k array -> 'd -> unit

Add an ephemeron to the bucket.

val remove : ('k, 'd) t -> 'k array -> unit

remove b k removes from b the most-recently added ephemeron with keys k, or does nothing if there is no such ephemeron.

val find : ('k, 'd) t -> 'k array -> 'd option

Returns the data of the most-recently added ephemeron with the given keys, or None if there is no such ephemeron.

val length : ('k, 'd) t -> int

Returns an upper bound on the length of the bucket.

val clear : ('k, 'd) t -> unit

Remove all ephemerons from the bucket.

diff --git a/ocaml/Stdlib/Ephemeron/Kn/Make/argument-1-H/index.html b/ocaml/Stdlib/Ephemeron/Kn/Make/argument-1-H/index.html new file mode 100644 index 00000000..baf5516b --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/Kn/Make/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (ocaml.Stdlib.Ephemeron.Kn.Make.H)

Parameter Make.H

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Stdlib/Ephemeron/Kn/Make/index.html b/ocaml/Stdlib/Ephemeron/Kn/Make/index.html new file mode 100644 index 00000000..c59e8fef --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/Kn/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Stdlib.Ephemeron.Kn.Make)

Module Kn.Make

Functor building an implementation of a weak hash table

Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

Parameters

Signature

type key = H.t array
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
val clean : 'a t -> unit

remove all dead bindings. Done automatically during automatic resizing.

val stats_alive : 'a t -> Hashtbl.statistics

same as Hashtbl.SeededS.stats but only count the alive bindings

diff --git a/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/argument-1-H/index.html b/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/argument-1-H/index.html new file mode 100644 index 00000000..8e43ada4 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (ocaml.Stdlib.Ephemeron.Kn.MakeSeeded.H)

Parameter MakeSeeded.H

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val seeded_hash : int -> t -> int

A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

diff --git a/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/index.html b/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/index.html new file mode 100644 index 00000000..15fc62ee --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/index.html @@ -0,0 +1,2 @@ + +MakeSeeded (ocaml.Stdlib.Ephemeron.Kn.MakeSeeded)

Module Kn.MakeSeeded

Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

Parameters

Signature

type key = H.t array
type !'a t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
val clean : 'a t -> unit

remove all dead bindings. Done automatically during automatic resizing.

val stats_alive : 'a t -> Hashtbl.statistics

same as Hashtbl.SeededS.stats but only count the alive bindings

diff --git a/ocaml/Stdlib/Ephemeron/Kn/index.html b/ocaml/Stdlib/Ephemeron/Kn/index.html new file mode 100644 index 00000000..031a5b8f --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/Kn/index.html @@ -0,0 +1,4 @@ + +Kn (ocaml.Stdlib.Ephemeron.Kn)

Module Ephemeron.Kn

Ephemerons with arbitrary number of keys of the same type.

type ('k, 'd) t

an ephemeron with an arbitrary number of keys of the same type

val make : 'k array -> 'd -> ('k, 'd) t
val query : ('k, 'd) t -> 'k array -> 'd option
module Make (H : Hashtbl.HashedType) : S with type key = H.t array

Functor building an implementation of a weak hash table

module MakeSeeded + (H : Hashtbl.SeededHashedType) : + SeededS with type key = H.t array

Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

module Bucket : sig ... end
diff --git a/ocaml/Stdlib/Ephemeron/index.html b/ocaml/Stdlib/Ephemeron/index.html new file mode 100644 index 00000000..7cf013c7 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/index.html @@ -0,0 +1,2 @@ + +Ephemeron (ocaml.Stdlib.Ephemeron)

Module Stdlib.Ephemeron

Ephemerons and weak hash tables.

Ephemerons and weak hash tables are useful when one wants to cache or memorize the computation of a function, as long as the arguments and the function are used, without creating memory leaks by continuously keeping old computation results that are not useful anymore because one argument or the function is freed. An implementation using Hashtbl.t is not suitable because all associations would keep the arguments and the result in memory.

Ephemerons can also be used for "adding" a field to an arbitrary boxed OCaml value: you can attach some information to a value created by an external library without memory leaks.

Ephemerons hold some keys and one or no data. They are all boxed OCaml values. The keys of an ephemeron have the same behavior as weak pointers according to the garbage collector. In fact OCaml weak pointers are implemented as ephemerons without data.

The keys and data of an ephemeron are said to be full if they point to a value, or empty if the value has never been set, has been unset, or was erased by the GC. In the function that accesses the keys or data these two states are represented by the option type.

The data is considered by the garbage collector alive if all the full keys are alive and if the ephemeron is alive. When one of the keys is not considered alive anymore by the GC, the data is emptied from the ephemeron. The data could be alive for another reason and in that case the GC will not free it, but the ephemeron will not hold the data anymore.

The ephemerons complicate the notion of liveness of values, because it is not anymore an equivalence with the reachability from root value by usual pointers (not weak and not ephemerons). With ephemerons the notion of liveness is constructed by the least fixpoint of: A value is alive if:

  • it is a root value
  • it is reachable from alive value by usual pointers
  • it is the data of an alive ephemeron with all its full keys alive

Notes:

Ephemerons are defined in a language agnostic way in this paper: B. Hayes, Ephemerons: A New Finalization Mechanism, OOPSLA'97

  • since 4.03

Unsynchronized accesses

Unsynchronized accesses to a weak hash table may lead to an invalid weak hash table state. Thus, concurrent accesses to a buffer must be synchronized (for instance with a Mutex.t).

module type S = sig ... end

The output signature of the functors K1.Make and K2.Make. These hash tables are weak in the keys. If all the keys of a binding are alive the binding is kept, but if one of the keys of the binding is dead then the binding is removed.

module type SeededS = sig ... end

The output signature of the functors K1.MakeSeeded and K2.MakeSeeded.

module K1 : sig ... end

Ephemerons with one key.

module K2 : sig ... end

Ephemerons with two keys.

module Kn : sig ... end

Ephemerons with arbitrary number of keys of the same type.

diff --git a/ocaml/Stdlib/Ephemeron/module-type-S/index.html b/ocaml/Stdlib/Ephemeron/module-type-S/index.html new file mode 100644 index 00000000..d6be94bd --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Stdlib.Ephemeron.S)

Module type Ephemeron.S

The output signature of the functors K1.Make and K2.Make. These hash tables are weak in the keys. If all the keys of a binding are alive the binding is kept, but if one of the keys of the binding is dead then the binding is removed.

Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
val clean : 'a t -> unit

remove all dead bindings. Done automatically during automatic resizing.

val stats_alive : 'a t -> Hashtbl.statistics

same as Hashtbl.SeededS.stats but only count the alive bindings

diff --git a/ocaml/Stdlib/Ephemeron/module-type-SeededS/index.html b/ocaml/Stdlib/Ephemeron/module-type-SeededS/index.html new file mode 100644 index 00000000..8212b168 --- /dev/null +++ b/ocaml/Stdlib/Ephemeron/module-type-SeededS/index.html @@ -0,0 +1,2 @@ + +SeededS (ocaml.Stdlib.Ephemeron.SeededS)

Module type Ephemeron.SeededS

The output signature of the functors K1.MakeSeeded and K2.MakeSeeded.

type key
type !'a t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
val clean : 'a t -> unit

remove all dead bindings. Done automatically during automatic resizing.

val stats_alive : 'a t -> Hashtbl.statistics

same as Hashtbl.SeededS.stats but only count the alive bindings

diff --git a/ocaml/Stdlib/Filename/index.html b/ocaml/Stdlib/Filename/index.html new file mode 100644 index 00000000..b390d31e --- /dev/null +++ b/ocaml/Stdlib/Filename/index.html @@ -0,0 +1,14 @@ + +Filename (ocaml.Stdlib.Filename)

Module Stdlib.Filename

Operations on file names.

val current_dir_name : string

The conventional name for the current directory (e.g. . in Unix).

val parent_dir_name : string

The conventional name for the parent of the current directory (e.g. .. in Unix).

val dir_sep : string

The directory separator (e.g. / in Unix).

  • since 3.11.2
val concat : string -> string -> string

concat dir file returns a file name that designates file file in directory dir.

val is_relative : string -> bool

Return true if the file name is relative to the current directory, false if it is absolute (i.e. in Unix, starts with /).

val is_implicit : string -> bool

Return true if the file name is relative and does not start with an explicit reference to the current directory (./ or ../ in Unix), false if it starts with an explicit reference to the root directory or the current directory.

val check_suffix : string -> string -> bool

check_suffix name suff returns true if the filename name ends with the suffix suff.

Under Windows ports (including Cygwin), comparison is case-insensitive, relying on String.lowercase_ascii. Note that this does not match exactly the interpretation of case-insensitive filename equivalence from Windows.

val chop_suffix : string -> string -> string

chop_suffix name suff removes the suffix suff from the filename name.

val chop_suffix_opt : suffix:string -> string -> string option

chop_suffix_opt ~suffix filename removes the suffix from the filename if possible, or returns None if the filename does not end with the suffix.

Under Windows ports (including Cygwin), comparison is case-insensitive, relying on String.lowercase_ascii. Note that this does not match exactly the interpretation of case-insensitive filename equivalence from Windows.

  • since 4.08
val extension : string -> string

extension name is the shortest suffix ext of name0 where:

  • name0 is the longest suffix of name that does not contain a directory separator;
  • ext starts with a period;
  • ext is preceded by at least one non-period character in name0.

If such a suffix does not exist, extension name is the empty string.

  • since 4.04
val remove_extension : string -> string

Return the given file name without its extension, as defined in Filename.extension. If the extension is empty, the function returns the given file name.

The following invariant holds for any file name s:

remove_extension s ^ extension s = s

  • since 4.04
val chop_extension : string -> string

Same as Filename.remove_extension, but raise Invalid_argument if the given name has an empty extension.

val basename : string -> string

Split a file name into directory name / base file name. If name is a valid file name, then concat (dirname name) (basename name) returns a file name which is equivalent to name. Moreover, after setting the current directory to dirname name (with Sys.chdir), references to basename name (which is a relative file name) designate the same file as name before the call to Sys.chdir.

This function conforms to the specification of POSIX.1-2008 for the basename utility.

val dirname : string -> string

See Filename.basename. This function conforms to the specification of POSIX.1-2008 for the dirname utility.

val null : string

null is "/dev/null" on POSIX and "NUL" on Windows. It represents a file on the OS that discards all writes and returns end of file on reads.

  • since 4.10
val temp_file : ?temp_dir:string -> string -> string -> string

temp_file prefix suffix returns the name of a fresh temporary file in the temporary directory. The base name of the temporary file is formed by concatenating prefix, then a suitably chosen integer number, then suffix. The optional argument temp_dir indicates the temporary directory to use, defaulting to the current result of Filename.get_temp_dir_name. The temporary file is created empty, with permissions 0o600 (readable and writable only by the file owner). The file is guaranteed to be different from any other file that existed when temp_file was called.

  • raises Sys_error

    if the file could not be created.

  • before 3.11.2

    no ?temp_dir optional argument

val open_temp_file : + ?mode:open_flag list -> + ?perms:int -> + ?temp_dir:string -> + string -> + string -> + string * out_channel

Same as Filename.temp_file, but returns both the name of a fresh temporary file, and an output channel opened (atomically) on this file. This function is more secure than temp_file: there is no risk that the temporary file will be modified (e.g. replaced by a symbolic link) before the program opens it. The optional argument mode is a list of additional flags to control the opening of the file. It can contain one or several of Open_append, Open_binary, and Open_text. The default is [Open_text] (open in text mode). The file is created with permissions perms (defaults to readable and writable only by the file owner, 0o600).

  • raises Sys_error

    if the file could not be opened.

  • before 4.03

    no ?perms optional argument

  • before 3.11.2

    no ?temp_dir optional argument

val temp_dir : ?temp_dir:string -> ?perms:int -> string -> string -> string

temp_dir prefix suffix creates and returns the name of a fresh temporary directory with permissions perms (defaults to 0o700) inside temp_dir. The base name of the temporary directory is formed by concatenating prefix, then a suitably chosen integer number, then suffix. The optional argument temp_dir indicates the temporary directory to use, defaulting to the current result of Filename.get_temp_dir_name. The temporary directory is created empty, with permissions 0o700 (readable, writable, and searchable only by the file owner). The directory is guaranteed to be different from any other directory that existed when temp_dir was called.

If temp_dir does not exist, this function does not create it. Instead, it raises Sys_error.

  • raises Sys_error

    if the directory could not be created.

  • since 5.1
val get_temp_dir_name : unit -> string

The name of the temporary directory: Under Unix, the value of the TMPDIR environment variable, or "/tmp" if the variable is not set. Under Windows, the value of the TEMP environment variable, or "." if the variable is not set. The temporary directory can be changed with Filename.set_temp_dir_name.

  • since 4.00
val set_temp_dir_name : string -> unit

Change the temporary directory returned by Filename.get_temp_dir_name and used by Filename.temp_file and Filename.open_temp_file. The temporary directory is a domain-local value which is inherited by child domains.

  • since 4.00
val quote : string -> string

Return a quoted version of a file name, suitable for use as one argument in a command line, escaping all meta-characters. Warning: under Windows, the output is only suitable for use with programs that follow the standard Windows quoting conventions.

val quote_command : + string -> + ?stdin:string -> + ?stdout:string -> + ?stderr:string -> + string list -> + string

quote_command cmd args returns a quoted command line, suitable for use as an argument to Sys.command, Unix.system, and the Unix.open_process functions.

The string cmd is the command to call. The list args is the list of arguments to pass to this command. It can be empty.

The optional arguments ?stdin and ?stdout and ?stderr are file names used to redirect the standard input, the standard output, or the standard error of the command. If ~stdin:f is given, a redirection < f is performed and the standard input of the command reads from file f. If ~stdout:f is given, a redirection > f is performed and the standard output of the command is written to file f. If ~stderr:f is given, a redirection 2> f is performed and the standard error of the command is written to file f. If both ~stdout:f and ~stderr:f are given, with the exact same file name f, a 2>&1 redirection is performed so that the standard output and the standard error of the command are interleaved and redirected to the same file f.

Under Unix and Cygwin, the command, the arguments, and the redirections if any are quoted using Filename.quote, then concatenated. Under Win32, additional quoting is performed as required by the cmd.exe shell that is called by Sys.command.

  • raises Failure

    if the command cannot be escaped on the current platform.

  • since 4.10
diff --git a/ocaml/Stdlib/Float/Array/index.html b/ocaml/Stdlib/Float/Array/index.html new file mode 100644 index 00000000..7ced590a --- /dev/null +++ b/ocaml/Stdlib/Float/Array/index.html @@ -0,0 +1,13 @@ + +Array (ocaml.Stdlib.Float.Array)

Module Float.Array

Float arrays with packed representation.

type t = floatarray

The type of float arrays with packed representation.

  • since 4.08
val length : t -> int

Return the length (number of elements) of the given floatarray.

val get : t -> int -> float

get a n returns the element number n of floatarray a.

val set : t -> int -> float -> unit

set a n x modifies floatarray a in place, replacing element number n with x.

val make : int -> float -> t

make n x returns a fresh floatarray of length n, initialized with x.

val create : int -> t

create n returns a fresh floatarray of length n, with uninitialized data.

val init : int -> (int -> float) -> t

init n f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied to the integers 0 to n-1.

val append : t -> t -> t

append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

val concat : t list -> t

Same as append, but concatenates a list of floatarrays.

val sub : t -> int -> int -> t

sub a pos len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

  • raises Invalid_argument

    if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

val copy : t -> t

copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

val fill : t -> int -> int -> float -> unit

fill a pos len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

val blit : t -> int -> t -> int -> int -> unit

blit src src_pos dst dst_pos len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

  • raises Invalid_argument

    if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

val to_list : t -> float list

to_list a returns the list of all the elements of a.

val of_list : float list -> t

of_list l returns a fresh floatarray containing the elements of l.

  • raises Invalid_argument

    if the length of l is greater than Sys.max_floatarray_length.

Iterators

val iter : (float -> unit) -> t -> unit

iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

val iteri : (int -> float -> unit) -> t -> unit

Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

val map : (float -> float) -> t -> t

map f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

val map_inplace : (float -> float) -> t -> unit

map_inplace f a applies function f to all elements of a, and updates their values in place.

  • since 5.1
val mapi : (int -> float -> float) -> t -> t

Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

val mapi_inplace : (int -> float -> float) -> t -> unit

Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

  • since 5.1
val fold_left : ('acc -> float -> 'acc) -> 'acc -> t -> 'acc

fold_left f x init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

val fold_right : (float -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

Iterators on two arrays

val iter2 : (float -> float -> unit) -> t -> t -> unit

Array.iter2 f a b applies function f to all the elements of a and b.

val map2 : (float -> float -> float) -> t -> t -> t

map2 f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

Array scanning

val for_all : (float -> bool) -> t -> bool

for_all f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

val exists : (float -> bool) -> t -> bool

exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

val mem : float -> t -> bool

mem a set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

val mem_ieee : float -> t -> bool

Same as mem, but uses IEEE equality instead of structural equality.

Array searching

val find_opt : (float -> bool) -> t -> float option
val find_index : (float -> bool) -> t -> int option

find_index f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

It returns None if there is no such element.

  • since 5.1
val find_map : (float -> 'a option) -> t -> 'a option
val find_mapi : (int -> float -> 'a option) -> t -> 'a option

Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 5.1

Sorting

val sort : (float -> float -> int) -> t -> unit

Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

The current implementation uses Heap Sort. It runs in constant stack space.

Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

  • cmp x y > 0 if and only if cmp y x < 0
  • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

  • cmp a.(i) a.(j) >= 0 if and only if i >= j
val stable_sort : (float -> float -> int) -> t -> unit

Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

val fast_sort : (float -> float -> int) -> t -> unit

Same as sort or stable_sort, whichever is faster on typical input.

Float arrays and Sequences

val to_seq : t -> float Seq.t

Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

val to_seqi : t -> (int * float) Seq.t

Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

val of_seq : float Seq.t -> t

Create an array from the generator.

val map_to_array : (float -> 'a) -> t -> 'a array

map_to_array f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

val map_from_array : ('a -> float) -> 'a array -> t

map_from_array f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

Arrays and concurrency safety

Care must be taken when concurrently accessing float arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

Atomicity

Every float array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

For example, consider the following program:

let size = 100_000_000
+let a = Float.Array.make size 1.
+let update a f () =
+   Float.Array.iteri (fun i x -> Float.Array.set a i (f x)) a
+let d1 = Domain.spawn (update a (fun x -> x +. 1.))
+let d2 = Domain.spawn (update a (fun x ->  2. *. x +. 1.))
+let () = Domain.join d1; Domain.join d2

After executing this code, each field of the float array a is either 2., 3., 4. or 5.. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

Data races

If two domains only access disjoint parts of the array, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

A data race is said to occur when two domains access the same array element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the array elements.

Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location with a few exceptions.

Tearing

Float arrays have two supplementary caveats in the presence of data races.

First, the blit operation might copy an array byte-by-byte. Data races between such a blit operation and another operation might produce surprising values due to tearing: partial writes interleaved with other operations can create float values that would not exist with a sequential execution.

For instance, at the end of

let zeros = Float.Array.make size 0.
+let max_floats = Float.Array.make size Float.max_float
+let res = Float.Array.copy zeros
+let d1 = Domain.spawn (fun () -> Float.Array.blit zeros 0 res 0 size)
+let d2 = Domain.spawn (fun () -> Float.Array.blit max_floats 0 res 0 size)
+let () = Domain.join d1; Domain.join d2

the res float array might contain values that are neither 0. nor max_float.

Second, on 32-bit architectures, getting or setting a field involves two separate memory accesses. In the presence of data races, the user may observe tearing on any operation.

diff --git a/ocaml/Stdlib/Float/ArrayLabels/index.html b/ocaml/Stdlib/Float/ArrayLabels/index.html new file mode 100644 index 00000000..25d017c1 --- /dev/null +++ b/ocaml/Stdlib/Float/ArrayLabels/index.html @@ -0,0 +1,13 @@ + +ArrayLabels (ocaml.Stdlib.Float.ArrayLabels)

Module Float.ArrayLabels

Float arrays with packed representation (labeled functions).

type t = floatarray

The type of float arrays with packed representation.

  • since 4.08
val length : t -> int

Return the length (number of elements) of the given floatarray.

val get : t -> int -> float

get a n returns the element number n of floatarray a.

val set : t -> int -> float -> unit

set a n x modifies floatarray a in place, replacing element number n with x.

val make : int -> float -> t

make n x returns a fresh floatarray of length n, initialized with x.

val create : int -> t

create n returns a fresh floatarray of length n, with uninitialized data.

val init : int -> f:(int -> float) -> t

init n ~f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied to the integers 0 to n-1.

val append : t -> t -> t

append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

val concat : t list -> t

Same as append, but concatenates a list of floatarrays.

val sub : t -> pos:int -> len:int -> t

sub a ~pos ~len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

  • raises Invalid_argument

    if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

val copy : t -> t

copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

val fill : t -> pos:int -> len:int -> float -> unit

fill a ~pos ~len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit

blit ~src ~src_pos ~dst ~dst_pos ~len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

  • raises Invalid_argument

    if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

val to_list : t -> float list

to_list a returns the list of all the elements of a.

val of_list : float list -> t

of_list l returns a fresh floatarray containing the elements of l.

  • raises Invalid_argument

    if the length of l is greater than Sys.max_floatarray_length.

Iterators

val iter : f:(float -> unit) -> t -> unit

iter ~f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

val iteri : f:(int -> float -> unit) -> t -> unit

Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

val map : f:(float -> float) -> t -> t

map ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

val map_inplace : f:(float -> float) -> t -> unit

map_inplace f a applies function f to all elements of a, and updates their values in place.

  • since 5.1
val mapi : f:(int -> float -> float) -> t -> t

Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

val mapi_inplace : f:(int -> float -> float) -> t -> unit

Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

  • since 5.1
val fold_left : f:('acc -> float -> 'acc) -> init:'acc -> t -> 'acc

fold_left ~f x ~init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

val fold_right : f:(float -> 'acc -> 'acc) -> t -> init:'acc -> 'acc

fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

Iterators on two arrays

val iter2 : f:(float -> float -> unit) -> t -> t -> unit

Array.iter2 ~f a b applies function f to all the elements of a and b.

val map2 : f:(float -> float -> float) -> t -> t -> t

map2 ~f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

Array scanning

val for_all : f:(float -> bool) -> t -> bool

for_all ~f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

val exists : f:(float -> bool) -> t -> bool

exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

val mem : float -> set:t -> bool

mem a ~set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

val mem_ieee : float -> set:t -> bool

Same as mem, but uses IEEE equality instead of structural equality.

Array searching

val find_opt : f:(float -> bool) -> t -> float option
val find_index : f:(float -> bool) -> t -> int option

find_index ~f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

It returns None if there is no such element.

  • since 5.1
val find_map : f:(float -> 'a option) -> t -> 'a option
val find_mapi : f:(int -> float -> 'a option) -> t -> 'a option

Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 5.1

Sorting

val sort : cmp:(float -> float -> int) -> t -> unit

Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

The current implementation uses Heap Sort. It runs in constant stack space.

Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

  • cmp x y > 0 if and only if cmp y x < 0
  • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

  • cmp a.(i) a.(j) >= 0 if and only if i >= j
val stable_sort : cmp:(float -> float -> int) -> t -> unit

Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

val fast_sort : cmp:(float -> float -> int) -> t -> unit

Same as sort or stable_sort, whichever is faster on typical input.

Float arrays and Sequences

val to_seq : t -> float Seq.t

Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

val to_seqi : t -> (int * float) Seq.t

Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

val of_seq : float Seq.t -> t

Create an array from the generator.

val map_to_array : f:(float -> 'a) -> t -> 'a array

map_to_array ~f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

val map_from_array : f:('a -> float) -> 'a array -> t

map_from_array ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

Arrays and concurrency safety

Care must be taken when concurrently accessing float arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

Atomicity

Every float array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

For example, consider the following program:

let size = 100_000_000
+let a = Float.ArrayLabels.make size 1.
+let update a f () =
+   Float.ArrayLabels.iteri ~f:(fun i x -> Float.Array.set a i (f x)) a
+let d1 = Domain.spawn (update a (fun x -> x +. 1.))
+let d2 = Domain.spawn (update a (fun x ->  2. *. x +. 1.))
+let () = Domain.join d1; Domain.join d2

After executing this code, each field of the float array a is either 2., 3., 4. or 5.. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

Data races

If two domains only access disjoint parts of the array, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

A data race is said to occur when two domains access the same array element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the array elements.

Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location with a few exceptions.

Tearing

Float arrays have two supplementary caveats in the presence of data races.

First, the blit operation might copy an array byte-by-byte. Data races between such a blit operation and another operation might produce surprising values due to tearing: partial writes interleaved with other operations can create float values that would not exist with a sequential execution.

For instance, at the end of

let zeros = Float.Array.make size 0.
+let max_floats = Float.Array.make size Float.max_float
+let res = Float.Array.copy zeros
+let d1 = Domain.spawn (fun () -> Float.Array.blit zeros 0 res 0 size)
+let d2 = Domain.spawn (fun () -> Float.Array.blit max_floats 0 res 0 size)
+let () = Domain.join d1; Domain.join d2

the res float array might contain values that are neither 0. nor max_float.

Second, on 32-bit architectures, getting or setting a field involves two separate memory accesses. In the presence of data races, the user may observe tearing on any operation.

diff --git a/ocaml/Stdlib/Float/index.html b/ocaml/Stdlib/Float/index.html new file mode 100644 index 00000000..402b012d --- /dev/null +++ b/ocaml/Stdlib/Float/index.html @@ -0,0 +1,2 @@ + +Float (ocaml.Stdlib.Float)

Module Stdlib.Float

Floating-point arithmetic.

OCaml's floating-point numbers follow the IEEE 754 standard, using double precision (64 bits) numbers. Floating-point operations never raise an exception on overflow, underflow, division by zero, etc. Instead, special IEEE numbers are returned as appropriate, such as infinity for 1.0 /. 0.0, neg_infinity for -1.0 /. 0.0, and nan ('not a number') for 0.0 /. 0.0. These special numbers then propagate through floating-point computations as expected: for instance, 1.0 /. infinity is 0.0, basic arithmetic operations (+., -., *., /.) with nan as an argument return nan, ...

  • since 4.07
val zero : float

The floating point 0.

  • since 4.08
val one : float

The floating-point 1.

  • since 4.08
val minus_one : float

The floating-point -1.

  • since 4.08
val neg : float -> float

Unary negation.

val add : float -> float -> float

Floating-point addition.

val sub : float -> float -> float

Floating-point subtraction.

val mul : float -> float -> float

Floating-point multiplication.

val div : float -> float -> float

Floating-point division.

val fma : float -> float -> float -> float

fma x y z returns x * y + z, with a best effort for computing this expression with a single rounding, using either hardware instructions (providing full IEEE compliance) or a software emulation.

On 64-bit Cygwin, 64-bit mingw-w64 and MSVC 2017 and earlier, this function may be emulated owing to known bugs on limitations on these platforms. Note: since software emulation of the fma is costly, make sure that you are using hardware fma support if performance matters.

  • since 4.08
val rem : float -> float -> float

rem a b returns the remainder of a with respect to b. The returned value is a -. n *. b, where n is the quotient a /. b rounded towards zero to an integer.

val succ : float -> float

succ x returns the floating point number right after x i.e., the smallest floating-point number greater than x. See also next_after.

  • since 4.08
val pred : float -> float

pred x returns the floating-point number right before x i.e., the greatest floating-point number smaller than x. See also next_after.

  • since 4.08
val abs : float -> float

abs f returns the absolute value of f.

val infinity : float

Positive infinity.

val neg_infinity : float

Negative infinity.

val nan : float

A special floating-point value denoting the result of an undefined operation such as 0.0 /. 0.0. Stands for 'not a number'. Any floating-point operation with nan as argument returns nan as result, unless otherwise specified in IEEE 754 standard. As for floating-point comparisons, =, <, <=, > and >= return false and <> returns true if one or both of their arguments is nan.

nan is quiet_nan since 5.1; it was a signaling NaN before.

val signaling_nan : float

Signaling NaN. The corresponding signals do not raise OCaml exception, but the value can be useful for interoperability with C libraries.

  • since 5.1
val quiet_nan : float

Quiet NaN.

  • since 5.1
val pi : float

The constant pi.

val max_float : float

The largest positive finite value of type float.

val min_float : float

The smallest positive, non-zero, non-denormalized value of type float.

val epsilon : float

The difference between 1.0 and the smallest exactly representable floating-point number greater than 1.0.

val is_finite : float -> bool

is_finite x is true if and only if x is finite i.e., not infinite and not nan.

  • since 4.08
val is_infinite : float -> bool

is_infinite x is true if and only if x is infinity or neg_infinity.

  • since 4.08
val is_nan : float -> bool

is_nan x is true if and only if x is not a number (see nan).

  • since 4.08
val is_integer : float -> bool

is_integer x is true if and only if x is an integer.

  • since 4.08
val of_int : int -> float

Convert an integer to floating-point.

val to_int : float -> int

Truncate the given floating-point number to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.

val of_string : string -> float

Convert the given string to a float. The string is read in decimal (by default) or in hexadecimal (marked by 0x or 0X). The format of decimal floating-point numbers is [-] dd.ddd (e|E) [+|-] dd , where d stands for a decimal digit. The format of hexadecimal floating-point numbers is [-] 0(x|X) hh.hhh (p|P) [+|-] dd , where h stands for an hexadecimal digit and d for a decimal digit. In both cases, at least one of the integer and fractional parts must be given; the exponent part is optional. The _ (underscore) character can appear anywhere in the string and is ignored. Depending on the execution platforms, other representations of floating-point numbers can be accepted, but should not be relied upon.

  • raises Failure

    if the given string is not a valid representation of a float.

val of_string_opt : string -> float option

Same as of_string, but returns None instead of raising.

val to_string : float -> string

Return a string representation of a floating-point number.

This conversion can involve a loss of precision. For greater control over the manner in which the number is printed, see Printf.

This function is an alias for Stdlib.string_of_float.

type fpclass = fpclass =
  1. | FP_normal
    (*

    Normal number, none of the below

    *)
  2. | FP_subnormal
    (*

    Number very close to 0.0, has reduced precision

    *)
  3. | FP_zero
    (*

    Number is 0.0 or -0.0

    *)
  4. | FP_infinite
    (*

    Number is positive or negative infinity

    *)
  5. | FP_nan
    (*

    Not a number: result of an undefined operation

    *)

The five classes of floating-point numbers, as determined by the classify_float function.

val classify_float : float -> fpclass

Return the class of the given floating-point number: normal, subnormal, zero, infinite, or not a number.

val pow : float -> float -> float

Exponentiation.

val sqrt : float -> float

Square root.

val cbrt : float -> float

Cube root.

  • since 4.13
val exp : float -> float

Exponential.

val exp2 : float -> float

Base 2 exponential function.

  • since 4.13
val log : float -> float

Natural logarithm.

val log10 : float -> float

Base 10 logarithm.

val log2 : float -> float

Base 2 logarithm.

  • since 4.13
val expm1 : float -> float

expm1 x computes exp x -. 1.0, giving numerically-accurate results even if x is close to 0.0.

val log1p : float -> float

log1p x computes log(1.0 +. x) (natural logarithm), giving numerically-accurate results even if x is close to 0.0.

val cos : float -> float

Cosine. Argument is in radians.

val sin : float -> float

Sine. Argument is in radians.

val tan : float -> float

Tangent. Argument is in radians.

val acos : float -> float

Arc cosine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between 0.0 and pi.

val asin : float -> float

Arc sine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between -pi/2 and pi/2.

val atan : float -> float

Arc tangent. Result is in radians and is between -pi/2 and pi/2.

val atan2 : float -> float -> float

atan2 y x returns the arc tangent of y /. x. The signs of x and y are used to determine the quadrant of the result. Result is in radians and is between -pi and pi.

val hypot : float -> float -> float

hypot x y returns sqrt(x *. x +. y *. y), that is, the length of the hypotenuse of a right-angled triangle with sides of length x and y, or, equivalently, the distance of the point (x,y) to origin. If one of x or y is infinite, returns infinity even if the other is nan.

val cosh : float -> float

Hyperbolic cosine. Argument is in radians.

val sinh : float -> float

Hyperbolic sine. Argument is in radians.

val tanh : float -> float

Hyperbolic tangent. Argument is in radians.

val acosh : float -> float

Hyperbolic arc cosine. The argument must fall within the range [1.0, inf]. Result is in radians and is between 0.0 and inf.

  • since 4.13
val asinh : float -> float

Hyperbolic arc sine. The argument and result range over the entire real line. Result is in radians.

  • since 4.13
val atanh : float -> float

Hyperbolic arc tangent. The argument must fall within the range [-1.0, 1.0]. Result is in radians and ranges over the entire real line.

  • since 4.13
val erf : float -> float

Error function. The argument ranges over the entire real line. The result is always within [-1.0, 1.0].

  • since 4.13
val erfc : float -> float

Complementary error function (erfc x = 1 - erf x). The argument ranges over the entire real line. The result is always within [-1.0, 1.0].

  • since 4.13
val trunc : float -> float

trunc x rounds x to the nearest integer whose absolute value is less than or equal to x.

  • since 4.08
val round : float -> float

round x rounds x to the nearest integer with ties (fractional values of 0.5) rounded away from zero, regardless of the current rounding direction. If x is an integer, +0., -0., nan, or infinite, x itself is returned.

On 64-bit mingw-w64, this function may be emulated owing to a bug in the C runtime library (CRT) on this platform.

  • since 4.08
val ceil : float -> float

Round above to an integer value. ceil f returns the least integer value greater than or equal to f. The result is returned as a float.

val floor : float -> float

Round below to an integer value. floor f returns the greatest integer value less than or equal to f. The result is returned as a float.

val next_after : float -> float -> float

next_after x y returns the next representable floating-point value following x in the direction of y. More precisely, if y is greater (resp. less) than x, it returns the smallest (resp. largest) representable number greater (resp. less) than x. If x equals y, the function returns y. If x or y is nan, a nan is returned. Note that next_after max_float infinity = infinity and that next_after 0. infinity is the smallest denormalized positive number. If x is the smallest denormalized positive number, next_after x 0. = 0.

  • since 4.08
val copy_sign : float -> float -> float

copy_sign x y returns a float whose absolute value is that of x and whose sign is that of y. If x is nan, returns nan. If y is nan, returns either x or -. x, but it is not specified which.

val sign_bit : float -> bool

sign_bit x is true if and only if the sign bit of x is set. For example sign_bit 1. and signbit 0. are false while sign_bit (-1.) and sign_bit (-0.) are true.

  • since 4.08
val frexp : float -> float * int

frexp f returns the pair of the significant and the exponent of f. When f is zero, the significant x and the exponent n of f are equal to zero. When f is non-zero, they are defined by f = x *. 2 ** n and 0.5 <= x < 1.0.

val ldexp : float -> int -> float

ldexp x n returns x *. 2 ** n.

val modf : float -> float * float

modf f returns the pair of the fractional and integral part of f.

type t = float

An alias for the type of floating-point numbers.

val compare : t -> t -> int

compare x y returns 0 if x is equal to y, a negative integer if x is less than y, and a positive integer if x is greater than y. compare treats nan as equal to itself and less than any other float value. This treatment of nan ensures that compare defines a total ordering relation.

val equal : t -> t -> bool

The equal function for floating-point numbers, compared using compare.

val min : t -> t -> t

min x y returns the minimum of x and y. It returns nan when x or y is nan. Moreover min (-0.) (+0.) = -0.

  • since 4.08
val max : float -> float -> float

max x y returns the maximum of x and y. It returns nan when x or y is nan. Moreover max (-0.) (+0.) = +0.

  • since 4.08
val min_max : float -> float -> float * float

min_max x y is (min x y, max x y), just more efficient.

  • since 4.08
val min_num : t -> t -> t

min_num x y returns the minimum of x and y treating nan as missing values. If both x and y are nan, nan is returned. Moreover min_num (-0.) (+0.) = -0.

  • since 4.08
val max_num : t -> t -> t

max_num x y returns the maximum of x and y treating nan as missing values. If both x and y are nan nan is returned. Moreover max_num (-0.) (+0.) = +0.

  • since 4.08
val min_max_num : float -> float -> float * float

min_max_num x y is (min_num x y, max_num x y), just more efficient. Note that in particular min_max_num x nan = (x, x) and min_max_num nan y = (y, y).

  • since 4.08
val seeded_hash : int -> t -> int

A seeded hash function for floats, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.1
val hash : t -> int

An unseeded hash function for floats, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

module Array : sig ... end

Float arrays with packed representation.

module ArrayLabels : sig ... end

Float arrays with packed representation (labeled functions).

diff --git a/ocaml/Stdlib/Format/index.html b/ocaml/Stdlib/Format/index.html new file mode 100644 index 00000000..458e449c --- /dev/null +++ b/ocaml/Stdlib/Format/index.html @@ -0,0 +1,148 @@ + +Format (ocaml.Stdlib.Format)

Module Stdlib.Format

Pretty-printing.

If you are new to this module, see the examples below.

This module implements a pretty-printing facility to format values within 'pretty-printing boxes' and 'semantic tags' combined with a set of printf-like functions. The pretty-printer splits lines at specified break hints, and indents lines according to the box structure. Similarly, semantic tags can be used to decouple text presentation from its contents.

This pretty-printing facility is implemented as an overlay on top of abstract formatters which provide basic output functions. Some formatters are predefined, notably:

Most functions in the Format module come in two variants: a short version that operates on the current domain's standard formatter as obtained using get_std_formatter and the generic version prefixed by pp_ that takes a formatter as its first argument. For the version that operates on the current domain's standard formatter, the call to get_std_formatter is delayed until the last argument is received.

More formatters can be created with formatter_of_out_channel, formatter_of_buffer, formatter_of_symbolic_output_buffer or using custom formatters.

Warning: Since formatters contain mutable state, it is not thread-safe to use the same formatter on multiple domains in parallel without synchronization.

If multiple domains write to the same output channel using the predefined formatters (as obtained by get_std_formatter or get_err_formatter), the output from the domains will be interleaved with each other at points where the formatters are flushed, such as with print_flush. This synchronization is not performed by formatters obtained from formatter_of_out_channel (on the standard out channels or others).

Introduction

You may consider this module as providing an extension to the printf facility to provide automatic line splitting. The addition of pretty-printing annotations to your regular printf format strings gives you fancy indentation and line breaks. Pretty-printing annotations are described below in the documentation of the function Format.fprintf.

You may also use the explicit pretty-printing box management and printing functions provided by this module. This style is more basic but more verbose than the concise fprintf format strings.

For instance, the sequence open_box 0; print_string "x ="; print_space (); + print_int 1; close_box (); print_newline () that prints x = 1 within a pretty-printing box, can be abbreviated as printf "@[%s@ %i@]@." "x =" 1, or even shorter printf "@[x =@ %i@]@." 1.

Rule of thumb for casual users of this library:

  • use simple pretty-printing boxes (as obtained by open_box 0);
  • use simple break hints as obtained by print_cut () that outputs a simple break hint, or by print_space () that outputs a space indicating a break hint;
  • once a pretty-printing box is open, display its material with basic printing functions (e. g. print_int and print_string);
  • when the material for a pretty-printing box has been printed, call close_box () to close the box;
  • at the end of pretty-printing, flush the pretty-printer to display all the remaining material, e.g. evaluate print_newline ().

The behavior of pretty-printing commands is unspecified if there is no open pretty-printing box. Each box opened by one of the open_ functions below must be closed using close_box for proper formatting. Otherwise, some of the material printed in the boxes may not be output, or may be formatted incorrectly.

In case of interactive use, each phrase is executed in the initial state of the standard pretty-printer: after each phrase execution, the interactive system closes all open pretty-printing boxes, flushes all pending text, and resets the standard pretty-printer.

Warning: mixing calls to pretty-printing functions of this module with calls to Stdlib low level output functions is error prone.

The pretty-printing functions output material that is delayed in the pretty-printer queue and stacks in order to compute proper line splitting. In contrast, basic I/O output functions write directly in their output device. As a consequence, the output of a basic I/O function may appear before the output of a pretty-printing function that has been called before. For instance, + Stdlib.print_string "<"; + Format.print_string "PRETTY"; + Stdlib.print_string ">"; + Format.print_string "TEXT"; + leads to output <>PRETTYTEXT.

Formatters

type formatter

Abstract data corresponding to a pretty-printer (also called a formatter) and all its machinery. See also Defining formatters.

Pretty-printing boxes

The pretty-printing engine uses the concepts of pretty-printing box and break hint to drive indentation and line splitting behavior of the pretty-printer.

Each different pretty-printing box kind introduces a specific line splitting policy:

  • within an horizontal box, break hints never split the line (but the line may be split in a box nested deeper),
  • within a vertical box, break hints always split the line,
  • within an horizontal/vertical box, if the box fits on the current line then break hints never split the line, otherwise break hint always split the line,
  • within a compacting box, a break hint never splits the line, unless there is no more room on the current line.

Note that line splitting policy is box specific: the policy of a box does not rule the policy of inner boxes. For instance, if a vertical box is nested in an horizontal box, all break hints within the vertical box will split the line.

Moreover, opening a box after the maximum indentation limit splits the line whether or not the box would end up fitting on the line.

val pp_open_box : formatter -> int -> unit
val open_box : int -> unit

pp_open_box ppf d opens a new compacting pretty-printing box with offset d in the formatter ppf.

Within this box, the pretty-printer prints as much as possible material on every line.

A break hint splits the line if there is no more room on the line to print the remainder of the box.

Within this box, the pretty-printer emphasizes the box structure: if a structural box does not fit fully on a simple line, a break hint also splits the line if the splitting ``moves to the left'' (i.e. the new line gets an indentation smaller than the one of the current line).

This box is the general purpose pretty-printing box.

If the pretty-printer splits the line in the box, offset d is added to the current indentation.

val pp_close_box : formatter -> unit -> unit
val close_box : unit -> unit

Closes the most recently open pretty-printing box.

val pp_open_hbox : formatter -> unit -> unit
val open_hbox : unit -> unit

pp_open_hbox ppf () opens a new 'horizontal' pretty-printing box.

This box prints material on a single line.

Break hints in a horizontal box never split the line. (Line splitting may still occur inside boxes nested deeper).

val pp_open_vbox : formatter -> int -> unit
val open_vbox : int -> unit

pp_open_vbox ppf d opens a new 'vertical' pretty-printing box with offset d.

This box prints material on as many lines as break hints in the box.

Every break hint in a vertical box splits the line.

If the pretty-printer splits the line in the box, d is added to the current indentation.

val pp_open_hvbox : formatter -> int -> unit
val open_hvbox : int -> unit

pp_open_hvbox ppf d opens a new 'horizontal/vertical' pretty-printing box with offset d.

This box behaves as an horizontal box if it fits on a single line, otherwise it behaves as a vertical box.

If the pretty-printer splits the line in the box, d is added to the current indentation.

val pp_open_hovbox : formatter -> int -> unit
val open_hovbox : int -> unit

pp_open_hovbox ppf d opens a new 'horizontal-or-vertical' pretty-printing box with offset d.

This box prints material as much as possible on every line.

A break hint splits the line if there is no more room on the line to print the remainder of the box.

If the pretty-printer splits the line in the box, d is added to the current indentation.

Formatting functions

val pp_print_string : formatter -> string -> unit
val print_string : string -> unit

pp_print_string ppf s prints s in the current pretty-printing box.

val pp_print_bytes : formatter -> bytes -> unit
val print_bytes : bytes -> unit

pp_print_bytes ppf b prints b in the current pretty-printing box.

  • since 4.13
val pp_print_as : formatter -> int -> string -> unit
val print_as : int -> string -> unit

pp_print_as ppf len s prints s in the current pretty-printing box. The pretty-printer formats s as if it were of length len.

val pp_print_int : formatter -> int -> unit
val print_int : int -> unit

Print an integer in the current pretty-printing box.

val pp_print_float : formatter -> float -> unit
val print_float : float -> unit

Print a floating point number in the current pretty-printing box.

val pp_print_char : formatter -> char -> unit
val print_char : char -> unit

Print a character in the current pretty-printing box.

val pp_print_bool : formatter -> bool -> unit
val print_bool : bool -> unit

Print a boolean in the current pretty-printing box.

Break hints

A 'break hint' tells the pretty-printer to output some space or split the line whichever way is more appropriate to the current pretty-printing box splitting rules.

Break hints are used to separate printing items and are mandatory to let the pretty-printer correctly split lines and indent items.

Simple break hints are:

  • the 'space': output a space or split the line if appropriate,
  • the 'cut': split the line if appropriate.

Note: the notions of space and line splitting are abstract for the pretty-printing engine, since those notions can be completely redefined by the programmer. However, in the pretty-printer default setting, ``output a space'' simply means printing a space character (ASCII code 32) and ``split the line'' means printing a newline character (ASCII code 10).

val pp_print_space : formatter -> unit -> unit
val print_space : unit -> unit

pp_print_space ppf () emits a 'space' break hint: the pretty-printer may split the line at this point, otherwise it prints one space.

pp_print_space ppf () is equivalent to pp_print_break ppf 1 0.

val pp_print_cut : formatter -> unit -> unit
val print_cut : unit -> unit

pp_print_cut ppf () emits a 'cut' break hint: the pretty-printer may split the line at this point, otherwise it prints nothing.

pp_print_cut ppf () is equivalent to pp_print_break ppf 0 0.

val pp_print_break : formatter -> int -> int -> unit
val print_break : int -> int -> unit

pp_print_break ppf nspaces offset emits a 'full' break hint: the pretty-printer may split the line at this point, otherwise it prints nspaces spaces.

If the pretty-printer splits the line, offset is added to the current indentation.

val pp_print_custom_break : + formatter -> + fits:(string * int * string) -> + breaks:(string * int * string) -> + unit

pp_print_custom_break ppf ~fits:(s1, n, s2) ~breaks:(s3, m, s4) emits a custom break hint: the pretty-printer may split the line at this point.

If it does not split the line, then the s1 is emitted, then n spaces, then s2.

If it splits the line, then it emits the s3 string, then an indent (according to the box rules), then an offset of m spaces, then the s4 string.

While n and m are handled by formatter_out_functions.out_indent, the strings will be handled by formatter_out_functions.out_string. This allows for a custom formatter that handles indentation distinctly, for example, outputs <br/> tags or &nbsp; entities.

The custom break is useful if you want to change which visible (non-whitespace) characters are printed in case of break or no break. For example, when printing a list [a; b; c] , you might want to add a trailing semicolon when it is printed vertically:

[
+  a;
+  b;
+  c;
+]

You can do this as follows:

printf "@[<v 0>[@;<0 2>@[<v 0>a;@,b;@,c@]%t]@]@\n"
+  (pp_print_custom_break ~fits:("", 0, "") ~breaks:(";", 0, ""))
  • since 4.08
val pp_force_newline : formatter -> unit -> unit
val force_newline : unit -> unit

Force a new line in the current pretty-printing box.

The pretty-printer must split the line at this point,

Not the normal way of pretty-printing, since imperative line splitting may interfere with current line counters and box size calculation. Using break hints within an enclosing vertical box is a better alternative.

val pp_print_if_newline : formatter -> unit -> unit
val print_if_newline : unit -> unit

Execute the next formatting command if the preceding line has just been split. Otherwise, ignore the next formatting command.

Pretty-printing termination

val pp_print_flush : formatter -> unit -> unit
val print_flush : unit -> unit

End of pretty-printing: resets the pretty-printer to initial state.

All open pretty-printing boxes are closed, all pending text is printed. In addition, the pretty-printer low level output device is flushed to ensure that all pending text is really displayed.

Note: never use print_flush in the normal course of a pretty-printing routine, since the pretty-printer uses a complex buffering machinery to properly indent the output; manually flushing those buffers at random would conflict with the pretty-printer strategy and result to poor rendering.

Only consider using print_flush when displaying all pending material is mandatory (for instance in case of interactive use when you want the user to read some text) and when resetting the pretty-printer state will not disturb further pretty-printing.

Warning: If the output device of the pretty-printer is an output channel, repeated calls to print_flush means repeated calls to Stdlib.flush to flush the out channel; these explicit flush calls could foil the buffering strategy of output channels and could dramatically impact efficiency.

val pp_print_newline : formatter -> unit -> unit
val print_newline : unit -> unit

End of pretty-printing: resets the pretty-printer to initial state.

All open pretty-printing boxes are closed, all pending text is printed.

Equivalent to print_flush with a new line emitted on the pretty-printer low-level output device immediately before the device is flushed. See corresponding words of caution for print_flush.

Note: this is not the normal way to output a new line; the preferred method is using break hints within a vertical pretty-printing box.

Margin

val pp_set_margin : formatter -> int -> unit
val set_margin : int -> unit

pp_set_margin ppf d sets the right margin to d (in characters): the pretty-printer splits lines that overflow the right margin according to the break hints given. Setting the margin to d means that the formatting engine aims at printing at most d-1 characters per line. Nothing happens if d is smaller than 2. If d is too large, the right margin is set to the maximum admissible value (which is greater than 10 ^ 9). If d is less than the current maximum indentation limit, the maximum indentation limit is decreased while trying to preserve a minimal ratio max_indent/margin>=50% and if possible the current difference margin - max_indent.

See also pp_set_geometry.

val pp_get_margin : formatter -> unit -> int
val get_margin : unit -> int

Returns the position of the right margin.

Maximum indentation limit

val pp_set_max_indent : formatter -> int -> unit
val set_max_indent : int -> unit

pp_set_max_indent ppf d sets the maximum indentation limit of lines to d (in characters): once this limit is reached, new pretty-printing boxes are rejected to the left, unless the enclosing box fully fits on the current line. As an illustration,

set_margin 10; set_max_indent 5; printf "@[123456@[7@]89A@]@." 

yields

123456
+789A

because the nested box "@[7@]" is opened after the maximum indentation limit (7>5) and its parent box does not fit on the current line. Either decreasing the length of the parent box to make it fit on a line:

printf "@[123456@[7@]89@]@." 

or opening an intermediary box before the maximum indentation limit which fits on the current line

printf "@[123@[456@[7@]89@]A@]@." 

avoids the rejection to the left of the inner boxes and print respectively "123456789" and "123456789A" . Note also that vertical boxes never fit on a line whereas horizontal boxes always fully fit on the current line. Opening a box may split a line whereas the contents may have fit. If this behavior is problematic, it can be curtailed by setting the maximum indentation limit to margin - 1. Note that setting the maximum indentation limit to margin is invalid.

Nothing happens if d is smaller than 2.

If d is too large, the limit is set to the maximum admissible value (which is greater than 10 ^ 9).

If d is greater or equal than the current margin, it is ignored, and the current maximum indentation limit is kept.

See also pp_set_geometry.

val pp_get_max_indent : formatter -> unit -> int
val get_max_indent : unit -> int

Return the maximum indentation limit (in characters).

Geometry

Geometric functions can be used to manipulate simultaneously the coupled variables, margin and maximum indentation limit.

type geometry = {
  1. max_indent : int;
  2. margin : int;
}
  • since 4.08
val check_geometry : geometry -> bool

Check if the formatter geometry is valid: 1 < max_indent < margin

  • since 4.08
val pp_set_geometry : formatter -> max_indent:int -> margin:int -> unit
val set_geometry : max_indent:int -> margin:int -> unit
val pp_safe_set_geometry : formatter -> max_indent:int -> margin:int -> unit
val safe_set_geometry : max_indent:int -> margin:int -> unit

pp_set_geometry ppf ~max_indent ~margin sets both the margin and maximum indentation limit for ppf.

When 1 < max_indent < margin, pp_set_geometry ppf ~max_indent ~margin is equivalent to pp_set_margin ppf margin; pp_set_max_indent ppf max_indent; and avoids the subtly incorrect pp_set_max_indent ppf max_indent; pp_set_margin ppf margin;

Outside of this domain, pp_set_geometry raises an invalid argument exception whereas pp_safe_set_geometry does nothing.

  • since 4.08
val pp_update_geometry : formatter -> (geometry -> geometry) -> unit

pp_update_geometry ppf (fun geo -> { geo with ... }) lets you update a formatter's geometry in a way that is robust to extension of the geometry record with new fields.

Raises an invalid argument exception if the returned geometry does not satisfy check_geometry.

  • since 4.11
val update_geometry : (geometry -> geometry) -> unit
val pp_get_geometry : formatter -> unit -> geometry
val get_geometry : unit -> geometry

Return the current geometry of the formatter

  • since 4.08

Maximum formatting depth

The maximum formatting depth is the maximum number of pretty-printing boxes simultaneously open.

Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

val pp_set_max_boxes : formatter -> int -> unit
val set_max_boxes : int -> unit

pp_set_max_boxes ppf max sets the maximum number of pretty-printing boxes simultaneously open.

Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

Nothing happens if max is smaller than 2.

val pp_get_max_boxes : formatter -> unit -> int
val get_max_boxes : unit -> int

Returns the maximum number of pretty-printing boxes allowed before ellipsis.

val pp_over_max_boxes : formatter -> unit -> bool
val over_max_boxes : unit -> bool

Tests if the maximum number of pretty-printing boxes allowed have already been opened.

Tabulation boxes

A tabulation box prints material on lines divided into cells of fixed length. A tabulation box provides a simple way to display vertical columns of left adjusted text.

This box features command set_tab to define cell boundaries, and command print_tab to move from cell to cell and split the line when there is no more cells to print on the line.

Note: printing within tabulation box is line directed, so arbitrary line splitting inside a tabulation box leads to poor rendering. Yet, controlled use of tabulation boxes allows simple printing of columns within module Format.

val pp_open_tbox : formatter -> unit -> unit
val open_tbox : unit -> unit

open_tbox () opens a new tabulation box.

This box prints lines separated into cells of fixed width.

Inside a tabulation box, special tabulation markers defines points of interest on the line (for instance to delimit cell boundaries). Function Format.set_tab sets a tabulation marker at insertion point.

A tabulation box features specific tabulation breaks to move to next tabulation marker or split the line. Function Format.print_tbreak prints a tabulation break.

val pp_close_tbox : formatter -> unit -> unit
val close_tbox : unit -> unit

Closes the most recently opened tabulation box.

val pp_set_tab : formatter -> unit -> unit
val set_tab : unit -> unit

Sets a tabulation marker at current insertion point.

val pp_print_tab : formatter -> unit -> unit
val print_tab : unit -> unit

print_tab () emits a 'next' tabulation break hint: if not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right, or the pretty-printer splits the line and insertion point moves to the leftmost tabulation marker.

It is equivalent to print_tbreak 0 0.

val pp_print_tbreak : formatter -> int -> int -> unit
val print_tbreak : int -> int -> unit

print_tbreak nspaces offset emits a 'full' tabulation break hint.

If not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right and the pretty-printer prints nspaces spaces.

If there is no next tabulation marker on the right, the pretty-printer splits the line at this point, then insertion point moves to the leftmost tabulation marker of the box.

If the pretty-printer splits the line, offset is added to the current indentation.

Ellipsis

val pp_set_ellipsis_text : formatter -> string -> unit
val set_ellipsis_text : string -> unit

Set the text of the ellipsis printed when too many pretty-printing boxes are open (a single dot, ., by default).

val pp_get_ellipsis_text : formatter -> unit -> string
val get_ellipsis_text : unit -> string

Return the text of the ellipsis.

Semantic tags

type stag = ..

Semantic tags (or simply tags) are user's defined annotations to associate user's specific operations to printed entities.

Common usage of semantic tags is text decoration to get specific font or text size rendering for a display device, or marking delimitation of entities (e.g. HTML or TeX elements or terminal escape sequences). More sophisticated usage of semantic tags could handle dynamic modification of the pretty-printer behavior to properly print the material within some specific tags. For instance, we can define an RGB tag like so:

type stag += RGB of {r:int;g:int;b:int}

In order to properly delimit printed entities, a semantic tag must be opened before and closed after the entity. Semantic tags must be properly nested like parentheses using pp_open_stag and pp_close_stag.

Tag specific operations occur any time a tag is opened or closed, At each occurrence, two kinds of operations are performed tag-marking and tag-printing:

  • The tag-marking operation is the simpler tag specific operation: it simply writes a tag specific string into the output device of the formatter. Tag-marking does not interfere with line-splitting computation.
  • The tag-printing operation is the more involved tag specific operation: it can print arbitrary material to the formatter. Tag-printing is tightly linked to the current pretty-printer operations.

Roughly speaking, tag-marking is commonly used to get a better rendering of texts in the rendering device, while tag-printing allows fine tuning of printing routines to print the same entity differently according to the semantic tags (i.e. print additional material or even omit parts of the output).

More precisely: when a semantic tag is opened or closed then both and successive 'tag-printing' and 'tag-marking' operations occur:

  • Tag-printing a semantic tag means calling the formatter specific function print_open_stag (resp. print_close_stag) with the name of the tag as argument: that tag-printing function can then print any regular material to the formatter (so that this material is enqueued as usual in the formatter queue for further line splitting computation).
  • Tag-marking a semantic tag means calling the formatter specific function mark_open_stag (resp. mark_close_stag) with the name of the tag as argument: that tag-marking function can then return the 'tag-opening marker' (resp. `tag-closing marker') for direct output into the output device of the formatter.

Being written directly into the output device of the formatter, semantic tag marker strings are not considered as part of the printing material that drives line splitting (in other words, the length of the strings corresponding to tag markers is considered as zero for line splitting).

Thus, semantic tag handling is in some sense transparent to pretty-printing and does not interfere with usual indentation. Hence, a single pretty-printing routine can output both simple 'verbatim' material or richer decorated output depending on the treatment of tags. By default, tags are not active, hence the output is not decorated with tag information. Once set_tags is set to true, the pretty-printer engine honors tags and decorates the output accordingly.

Default tag-marking functions behave the HTML way: string tags are enclosed in "<" and ">" while other tags are ignored; hence, opening marker for tag string "t" is "<t>" and closing marker is "</t>".

Default tag-printing functions just do nothing.

Tag-marking and tag-printing functions are user definable and can be set by calling set_formatter_stag_functions.

Semantic tag operations may be set on or off with set_tags. Tag-marking operations may be set on or off with set_mark_tags. Tag-printing operations may be set on or off with set_print_tags.

  • since 4.08
type tag = string
type stag +=
  1. | String_tag of tag
    (*

    String_tag s is a string tag s. String tags can be inserted either by explicitly using the constructor String_tag or by using the dedicated format syntax "@{<s> ... @}".

    • since 4.08
    *)
val pp_open_stag : formatter -> stag -> unit
val open_stag : stag -> unit

pp_open_stag ppf t opens the semantic tag named t.

The print_open_stag tag-printing function of the formatter is called with t as argument; then the opening tag marker for t, as given by mark_open_stag t, is written into the output device of the formatter.

  • since 4.08
val pp_close_stag : formatter -> unit -> unit
val close_stag : unit -> unit

pp_close_stag ppf () closes the most recently opened semantic tag t.

The closing tag marker, as given by mark_close_stag t, is written into the output device of the formatter; then the print_close_stag tag-printing function of the formatter is called with t as argument.

  • since 4.08
val pp_set_tags : formatter -> bool -> unit
val set_tags : bool -> unit

pp_set_tags ppf b turns on or off the treatment of semantic tags (default is off).

val pp_set_print_tags : formatter -> bool -> unit
val set_print_tags : bool -> unit

pp_set_print_tags ppf b turns on or off the tag-printing operations.

val pp_set_mark_tags : formatter -> bool -> unit
val set_mark_tags : bool -> unit

pp_set_mark_tags ppf b turns on or off the tag-marking operations.

val pp_get_print_tags : formatter -> unit -> bool
val get_print_tags : unit -> bool

Return the current status of tag-printing operations.

val pp_get_mark_tags : formatter -> unit -> bool
val get_mark_tags : unit -> bool

Return the current status of tag-marking operations.

val pp_set_formatter_out_channel : formatter -> out_channel -> unit

Redirecting the standard formatter output

val set_formatter_out_channel : out_channel -> unit

Redirect the standard pretty-printer output to the given channel. (All the output functions of the standard formatter are set to the default output functions printing to the given channel.)

set_formatter_out_channel is equivalent to pp_set_formatter_out_channel std_formatter.

val pp_set_formatter_output_functions : + formatter -> + (string -> int -> int -> unit) -> + (unit -> unit) -> + unit
val set_formatter_output_functions : + (string -> int -> int -> unit) -> + (unit -> unit) -> + unit

pp_set_formatter_output_functions ppf out flush redirects the standard pretty-printer output functions to the functions out and flush.

The out function performs all the pretty-printer string output. It is called with a string s, a start position p, and a number of characters n; it is supposed to output characters p to p + n - 1 of s.

The flush function is called whenever the pretty-printer is flushed (via conversion %!, or pretty-printing indications @? or @., or using low level functions print_flush or print_newline).

val pp_get_formatter_output_functions : + formatter -> + unit -> + (string -> int -> int -> unit) * (unit -> unit)
val get_formatter_output_functions : + unit -> + (string -> int -> int -> unit) * (unit -> unit)

Return the current output functions of the standard pretty-printer.

Redefining formatter output

The Format module is versatile enough to let you completely redefine the meaning of pretty-printing output: you may provide your own functions to define how to handle indentation, line splitting, and even printing of all the characters that have to be printed!

Redefining output functions

type formatter_out_functions = {
  1. out_string : string -> int -> int -> unit;
  2. out_flush : unit -> unit;
  3. out_newline : unit -> unit;
  4. out_spaces : int -> unit;
  5. out_indent : int -> unit;
    (*
    • since 4.06
    *)
}

The set of output functions specific to a formatter:

  • the out_string function performs all the pretty-printer string output. It is called with a string s, a start position p, and a number of characters n; it is supposed to output characters p to p + n - 1 of s.
  • the out_flush function flushes the pretty-printer output device.
  • out_newline is called to open a new line when the pretty-printer splits the line.
  • the out_spaces function outputs spaces when a break hint leads to spaces instead of a line split. It is called with the number of spaces to output.
  • the out_indent function performs new line indentation when the pretty-printer splits the line. It is called with the indentation value of the new line.

By default:

  • fields out_string and out_flush are output device specific; (e.g. Stdlib.output_string and Stdlib.flush for a Stdlib.out_channel device, or Buffer.add_substring and Stdlib.ignore for a Buffer.t output device),
  • field out_newline is equivalent to out_string "\n" 0 1;
  • fields out_spaces and out_indent are equivalent to out_string (String.make n ' ') 0 n.
  • since 4.01
val pp_set_formatter_out_functions : + formatter -> + formatter_out_functions -> + unit
val set_formatter_out_functions : formatter_out_functions -> unit

pp_set_formatter_out_functions ppf out_funs Set all the pretty-printer output functions of ppf to those of argument out_funs,

This way, you can change the meaning of indentation (which can be something else than just printing space characters) and the meaning of new lines opening (which can be connected to any other action needed by the application at hand).

Reasonable defaults for functions out_spaces and out_newline are respectively out_funs.out_string (String.make n ' ') 0 n and out_funs.out_string "\n" 0 1.

  • since 4.01
val pp_get_formatter_out_functions : + formatter -> + unit -> + formatter_out_functions
val get_formatter_out_functions : unit -> formatter_out_functions

Return the current output functions of the pretty-printer, including line splitting and indentation functions. Useful to record the current setting and restore it afterwards.

  • since 4.01

Redefining semantic tag operations

type formatter_stag_functions = {
  1. mark_open_stag : stag -> string;
  2. mark_close_stag : stag -> string;
  3. print_open_stag : stag -> unit;
  4. print_close_stag : stag -> unit;
}

The semantic tag handling functions specific to a formatter: mark versions are the 'tag-marking' functions that associate a string marker to a tag in order for the pretty-printing engine to write those markers as 0 length tokens in the output device of the formatter. print versions are the 'tag-printing' functions that can perform regular printing when a tag is closed or opened.

  • since 4.08
val pp_set_formatter_stag_functions : + formatter -> + formatter_stag_functions -> + unit
val set_formatter_stag_functions : formatter_stag_functions -> unit

pp_set_formatter_stag_functions ppf tag_funs changes the meaning of opening and closing semantic tag operations to use the functions in tag_funs when printing on ppf.

When opening a semantic tag with name t, the string t is passed to the opening tag-marking function (the mark_open_stag field of the record tag_funs), that must return the opening tag marker for that name. When the next call to close_stag () happens, the semantic tag name t is sent back to the closing tag-marking function (the mark_close_stag field of record tag_funs), that must return a closing tag marker for that name.

The print_ field of the record contains the tag-printing functions that are called at tag opening and tag closing time, to output regular material in the pretty-printer queue.

  • since 4.08
val pp_get_formatter_stag_functions : + formatter -> + unit -> + formatter_stag_functions
val get_formatter_stag_functions : unit -> formatter_stag_functions

Return the current semantic tag operation functions of the standard pretty-printer.

  • since 4.08

Defining formatters

Defining new formatters permits unrelated output of material in parallel on several output devices. All the parameters of a formatter are local to the formatter: right margin, maximum indentation limit, maximum number of pretty-printing boxes simultaneously open, ellipsis, and so on, are specific to each formatter and may be fixed independently.

For instance, given a Buffer.t buffer b, formatter_of_buffer b returns a new formatter using buffer b as its output device. Similarly, given a Stdlib.out_channel output channel oc, formatter_of_out_channel oc returns a new formatter using channel oc as its output device.

Alternatively, given out_funs, a complete set of output functions for a formatter, then formatter_of_out_functions out_funs computes a new formatter using those functions for output.

val formatter_of_out_channel : out_channel -> formatter

formatter_of_out_channel oc returns a new formatter writing to the corresponding output channel oc.

val synchronized_formatter_of_out_channel : + out_channel -> + formatter Domain.DLS.key

synchronized_formatter_of_out_channel oc returns the key to the domain-local state that holds the domain-local formatter for writing to the corresponding output channel oc.

When the formatter is used with multiple domains, the output from the domains will be interleaved with each other at points where the formatter is flushed, such as with print_flush.

  • alert unstable
val std_formatter : formatter

The initial domain's standard formatter to write to standard output.

It is defined as formatter_of_out_channel Stdlib.stdout.

val get_std_formatter : unit -> formatter

get_std_formatter () returns the current domain's standard formatter used to write to standard output.

  • since 5.0
val err_formatter : formatter

The initial domain's formatter to write to standard error.

It is defined as formatter_of_out_channel Stdlib.stderr.

val get_err_formatter : unit -> formatter

get_err_formatter () returns the current domain's formatter used to write to standard error.

  • since 5.0
val formatter_of_buffer : Buffer.t -> formatter

formatter_of_buffer b returns a new formatter writing to buffer b. At the end of pretty-printing, the formatter must be flushed using pp_print_flush or pp_print_newline, to print all the pending material into the buffer.

val stdbuf : Buffer.t

The initial domain's string buffer in which str_formatter writes.

val get_stdbuf : unit -> Buffer.t

get_stdbuf () returns the current domain's string buffer in which the current domain's string formatter writes.

  • since 5.0
val str_formatter : formatter

The initial domain's formatter to output to the stdbuf string buffer.

str_formatter is defined as formatter_of_buffer stdbuf.

val get_str_formatter : unit -> formatter

The current domain's formatter to output to the current domains string buffer.

  • since 5.0
val flush_str_formatter : unit -> string

Returns the material printed with str_formatter of the current domain, flushes the formatter and resets the corresponding buffer.

val make_formatter : + (string -> int -> int -> unit) -> + (unit -> unit) -> + formatter

make_formatter out flush returns a new formatter that outputs with function out, and flushes with function flush.

For instance,

make_formatter
+  (Stdlib.output oc)
+  (fun () -> Stdlib.flush oc)

returns a formatter to the Stdlib.out_channel oc.

val make_synchronized_formatter : + (string -> int -> int -> unit) -> + (unit -> unit) -> + formatter Domain.DLS.key

make_synchronized_formatter out flush returns the key to the domain-local state that holds the domain-local formatter that outputs with function out, and flushes with function flush.

When the formatter is used with multiple domains, the output from the domains will be interleaved with each other at points where the formatter is flushed, such as with print_flush.

  • since 5.0
  • alert unstable
val formatter_of_out_functions : formatter_out_functions -> formatter

formatter_of_out_functions out_funs returns a new formatter that writes with the set of output functions out_funs.

See definition of type formatter_out_functions for the meaning of argument out_funs.

  • since 4.06

Symbolic pretty-printing

Symbolic pretty-printing is pretty-printing using a symbolic formatter, i.e. a formatter that outputs symbolic pretty-printing items.

When using a symbolic formatter, all regular pretty-printing activities occur but output material is symbolic and stored in a buffer of output items. At the end of pretty-printing, flushing the output buffer allows post-processing of symbolic output before performing low level output operations.

In practice, first define a symbolic output buffer b using:

  • let sob = make_symbolic_output_buffer (). Then define a symbolic formatter with:
  • let ppf = formatter_of_symbolic_output_buffer sob

Use symbolic formatter ppf as usual, and retrieve symbolic items at end of pretty-printing by flushing symbolic output buffer sob with:

  • flush_symbolic_output_buffer sob.
type symbolic_output_item =
  1. | Output_flush
    (*

    symbolic flush command

    *)
  2. | Output_newline
    (*

    symbolic newline command

    *)
  3. | Output_string of string
    (*

    Output_string s: symbolic output for string s

    *)
  4. | Output_spaces of int
    (*

    Output_spaces n: symbolic command to output n spaces

    *)
  5. | Output_indent of int
    (*

    Output_indent i: symbolic indentation of size i

    *)

Items produced by symbolic pretty-printers

  • since 4.06
type symbolic_output_buffer

The output buffer of a symbolic pretty-printer.

  • since 4.06
val make_symbolic_output_buffer : unit -> symbolic_output_buffer

make_symbolic_output_buffer () returns a fresh buffer for symbolic output.

  • since 4.06
val clear_symbolic_output_buffer : symbolic_output_buffer -> unit

clear_symbolic_output_buffer sob resets buffer sob.

  • since 4.06
val get_symbolic_output_buffer : + symbolic_output_buffer -> + symbolic_output_item list

get_symbolic_output_buffer sob returns the contents of buffer sob.

  • since 4.06
val flush_symbolic_output_buffer : + symbolic_output_buffer -> + symbolic_output_item list

flush_symbolic_output_buffer sob returns the contents of buffer sob and resets buffer sob. flush_symbolic_output_buffer sob is equivalent to let items = get_symbolic_output_buffer sob in + clear_symbolic_output_buffer sob; items

  • since 4.06
val add_symbolic_output_item : + symbolic_output_buffer -> + symbolic_output_item -> + unit

add_symbolic_output_item sob itm adds item itm to buffer sob.

  • since 4.06
val formatter_of_symbolic_output_buffer : symbolic_output_buffer -> formatter

formatter_of_symbolic_output_buffer sob returns a symbolic formatter that outputs to symbolic_output_buffer sob.

  • since 4.06

Convenience formatting functions.

val pp_print_iter : + ?pp_sep:(formatter -> unit -> unit) -> + (('a -> unit) -> 'b -> unit) -> + (formatter -> 'a -> unit) -> + formatter -> + 'b -> + unit

pp_print_iter ~pp_sep iter pp_v ppf v formats on ppf the iterations of iter over a collection v of values using pp_v. Iterations are separated by pp_sep (defaults to pp_print_cut).

  • since 5.1
val pp_print_list : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> + formatter -> + 'a list -> + unit

pp_print_list ?pp_sep pp_v ppf l prints items of list l, using pp_v to print each item, and calling pp_sep between items (pp_sep defaults to pp_print_cut). Does nothing on empty lists.

  • since 4.02
val pp_print_array : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> + formatter -> + 'a array -> + unit

pp_print_array ?pp_sep pp_v ppf a prints items of array a, using pp_v to print each item, and calling pp_sep between items (pp_sep defaults to pp_print_cut). Does nothing on empty arrays.

If a is mutated after pp_print_array is called, the printed values may not be what is expected because Format can delay the printing. This can be avoided by flushing ppf.

  • since 5.1
val pp_print_seq : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> + formatter -> + 'a Seq.t -> + unit

pp_print_seq ?pp_sep pp_v ppf s prints items of sequence s, using pp_v to print each item, and calling pp_sep between items (pp_sep defaults to pp_print_cut. Does nothing on empty sequences.

This function does not terminate on infinite sequences.

  • since 4.12
val pp_print_text : formatter -> string -> unit

pp_print_text ppf s prints s with spaces and newlines respectively printed using pp_print_space and pp_force_newline.

  • since 4.02
val pp_print_option : + ?none:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> + formatter -> + 'a option -> + unit

pp_print_option ?none pp_v ppf o prints o on ppf using pp_v if o is Some v and none if it is None. none prints nothing by default.

  • since 4.08
val pp_print_result : + ok:(formatter -> 'a -> unit) -> + error:(formatter -> 'e -> unit) -> + formatter -> + ('a, 'e) result -> + unit

pp_print_result ~ok ~error ppf r prints r on ppf using ok if r is Ok _ and error if r is Error _.

  • since 4.08
val pp_print_either : + left:(formatter -> 'a -> unit) -> + right:(formatter -> 'b -> unit) -> + formatter -> + ('a, 'b) Either.t -> + unit

pp_print_either ~left ~right ppf e prints e on ppf using left if e is Either.Left _ and right if e is Either.Right _.

  • since 4.13

Formatted pretty-printing

Module Format provides a complete set of printf like functions for pretty-printing using format string specifications.

Specific annotations may be added in the format strings to give pretty-printing commands to the pretty-printing engine.

Those annotations are introduced in the format strings using the @ character. For instance, @ means a space break, @, means a cut, @[ opens a new box, and @] closes the last open box.

val fprintf : formatter -> ('a, formatter, unit) format -> 'a

fprintf ff fmt arg1 ... argN formats the arguments arg1 to argN according to the format string fmt, and outputs the resulting string on the formatter ff.

The format string fmt is a character string which contains three types of objects: plain characters and conversion specifications as specified in the Printf module, and pretty-printing indications specific to the Format module.

The pretty-printing indication characters are introduced by a @ character, and their meanings are:

  • @[: open a pretty-printing box. The type and offset of the box may be optionally specified with the following syntax: the < character, followed by an optional box type indication, then an optional integer offset, and the closing > character. Pretty-printing box type is one of h, v, hv, b, or hov. 'h' stands for an 'horizontal' pretty-printing box, 'v' stands for a 'vertical' pretty-printing box, 'hv' stands for an 'horizontal/vertical' pretty-printing box, 'b' stands for an 'horizontal-or-vertical' pretty-printing box demonstrating indentation, 'hov' stands a simple 'horizontal-or-vertical' pretty-printing box. For instance, @[<hov 2> opens an 'horizontal-or-vertical' pretty-printing box with indentation 2 as obtained with open_hovbox 2. For more details about pretty-printing boxes, see the various box opening functions open_*box.
  • @]: close the most recently opened pretty-printing box.
  • @,: output a 'cut' break hint, as with print_cut ().
  • @ : output a 'space' break hint, as with print_space ().
  • @;: output a 'full' break hint as with print_break. The nspaces and offset parameters of the break hint may be optionally specified with the following syntax: the < character, followed by an integer nspaces value, then an integer offset, and a closing > character. If no parameters are provided, the full break defaults to a 'space' break hint.
  • @.: flush the pretty-printer and split the line, as with print_newline ().
  • @<n>: print the following item as if it were of length n. Hence, printf "@<0>%s" arg prints arg as a zero length string. If @<n> is not followed by a conversion specification, then the following character of the format is printed as if it were of length n.
  • @\{: open a semantic tag. The name of the tag may be optionally specified with the following syntax: the < character, followed by an optional string specification, and the closing > character. The string specification is any character string that does not contain the closing character '>'. If omitted, the tag name defaults to the empty string. For more details about semantic tags, see the functions open_stag and close_stag.
  • @\}: close the most recently opened semantic tag.
  • @?: flush the pretty-printer as with print_flush (). This is equivalent to the conversion %!.
  • @\n: force a newline, as with force_newline (), not the normal way of pretty-printing, you should prefer using break hints inside a vertical pretty-printing box.

Note: To prevent the interpretation of a @ character as a pretty-printing indication, escape it with a % character. Old quotation mode @@ is deprecated since it is not compatible with formatted input interpretation of character '@'.

Example: printf "@[%s@ %d@]@." "x =" 1 is equivalent to open_box (); print_string "x ="; print_space (); + print_int 1; close_box (); print_newline (). It prints x = 1 within a pretty-printing 'horizontal-or-vertical' box.

val printf : ('a, formatter, unit) format -> 'a

Same as fprintf above, but output on get_std_formatter ().

It is defined similarly to fun fmt -> fprintf (get_std_formatter ()) fmt but delays calling get_std_formatter until after the final argument required by the format is received. When used with multiple domains, the output from the domains will be interleaved with each other at points where the formatter is flushed, such as with print_flush.

val eprintf : ('a, formatter, unit) format -> 'a

Same as fprintf above, but output on get_err_formatter ().

It is defined similarly to fun fmt -> fprintf (get_err_formatter ()) fmt but delays calling get_err_formatter until after the final argument required by the format is received. When used with multiple domains, the output from the domains will be interleaved with each other at points where the formatter is flushed, such as with print_flush.

val sprintf : ('a, unit, string) format -> 'a

Same as printf above, but instead of printing on a formatter, returns a string containing the result of formatting the arguments. Note that the pretty-printer queue is flushed at the end of each call to sprintf. Note that if your format string contains a %a, you should use asprintf.

In case of multiple and related calls to sprintf to output material on a single string, you should consider using fprintf with the predefined formatter str_formatter and call flush_str_formatter () to get the final result.

Alternatively, you can use Format.fprintf with a formatter writing to a buffer of your own: flushing the formatter and the buffer at the end of pretty-printing returns the desired string.

val asprintf : ('a, formatter, unit, string) format4 -> 'a

Same as printf above, but instead of printing on a formatter, returns a string containing the result of formatting the arguments. The type of asprintf is general enough to interact nicely with %a conversions.

  • since 4.01
val dprintf : ('a, formatter, unit, formatter -> unit) format4 -> 'a

Same as fprintf, except the formatter is the last argument. dprintf "..." a b c is a function of type formatter -> unit which can be given to a format specifier %t.

This can be used as a replacement for asprintf to delay formatting decisions. Using the string returned by asprintf in a formatting context forces formatting decisions to be taken in isolation, and the final string may be created prematurely. dprintf allows delay of formatting decisions until the final formatting context is known. For example:

let t = Format.dprintf "%i@ %i@ %i" 1 2 3 in
+...
+Format.printf "@[<v>%t@]" t
  • since 4.08
val ifprintf : formatter -> ('a, formatter, unit) format -> 'a

Same as fprintf above, but does not print anything. Useful to ignore some material when conditionally printing.

  • since 3.10

Formatted Pretty-Printing with continuations.

val kfprintf : + (formatter -> 'a) -> + formatter -> + ('b, formatter, unit, 'a) format4 -> + 'b

Same as fprintf above, but instead of returning immediately, passes the formatter to its first argument at the end of printing.

val kdprintf : + ((formatter -> unit) -> 'a) -> + ('b, formatter, unit, 'a) format4 -> + 'b

Same as dprintf above, but instead of returning immediately, passes the suspended printer to its first argument at the end of printing.

  • since 4.08
val ikfprintf : + (formatter -> 'a) -> + formatter -> + ('b, formatter, unit, 'a) format4 -> + 'b

Same as kfprintf above, but does not print anything. Useful to ignore some material when conditionally printing.

  • since 3.12
val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b

Same as sprintf above, but instead of returning the string, passes it to the first argument.

val kasprintf : (string -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b

Same as asprintf above, but instead of returning the string, passes it to the first argument.

  • since 4.03

Examples

A few warmup examples to get an idea of how Format is used.

We have a list l of pairs (int * bool), which the toplevel prints for us:

# let l = List.init 20 (fun n -> n, n mod 2 = 0)
+val l : (int * bool) list =
+[(0, true); (1, false); (2, true); (3, false); (4, true); (5, false);
+ (6, true); (7, false); (8, true); (9, false); (10, true); (11, false);
+ (12, true); (13, false); (14, true); (15, false); (16, true); (17, false);
+ (18, true); (19, false)]

If we want to print it ourself without the toplevel magic, we can try this:

# let pp_pair out (x,y) = Format.fprintf out "(%d, %b)" x y
+val pp_pair : Format.formatter -> int * bool -> unit = <fun>
+# Format.printf "l: [@[<hov>%a@]]@."
+  Format.(pp_print_list ~pp_sep:(fun out () -> fprintf out ";@ ") pp_pair) l
+  l: [(0, true); (1, false); (2, true); (3, false); (4, true); (5, false);
+      (6, true); (7, false); (8, true); (9, false); (10, true); (11, false);
+      (12, true); (13, false); (14, true); (15, false); (16, true);
+      (17, false); (18, true); (19, false)]

What this does, briefly, is:

  • pp_pair prints a pair bool*int surrounded in "(" ")". It takes a formatter (into which formatting happens), and the pair itself. When printing is done it returns ().
  • Format.printf "l = [@[<hov>%a@]]@." ... l is like printf, but with additional formatting instructions (denoted with "@"). The pair "@<hov>" and "@" is a "horizontal-or-vertical box".
  • "@." ends formatting with a newline. It is similar to "\n" but is also aware of the Format.formatter's state. Do not use "\n" with Format.
  • "%a" is a formatting instruction, like "%d" or "%s" for printf. However, where "%d" prints an integer and "%s" prints a string, "%a" takes a printer (of type Format.formatter -> 'a -> unit) and a value (of type 'a) and applies the printer to the value. This is key to compositionality of printers.
  • We build a list printer using Format.pp_print_list ~pp_sep:(...) pp_pair. pp_print_list takes an element printer and returns a list printer. The ?pp_sep optional argument, if provided, is called in between each element to print a separator.
  • Here, for a separator, we use (fun out () -> Format.fprintf out ";@ "). It prints ";", and then "@ " which is a breaking space (either it prints " ", or it prints a newline if the box is about to overflow). This "@ " is responsible for the list printing splitting into several lines.

If we omit "@ ", we get an ugly single-line print:

# Format.printf "l: [@[<hov>%a@]]@."
+      Format.(pp_print_list ~pp_sep:(fun out () -> fprintf out "; ") pp_pair) l
+  l: [(0, true); (1, false); (2, true); (* ... *); (18, true); (19, false)]
+- : unit = ()

Generally, it is good practice to define custom printers for important types in your program. If, for example, you were to define basic geometry types like so:

type point = {
+  x: float;
+  y: float;
+}
+
+type rectangle = {
+  ll: point; (* lower left *)
+  ur: point; (* upper right *)
+}

For debugging purpose, or to display information in logs, or on the console, it would be convenient to define printers for these types. Here is an example of to do it. Note that "%.3f" is a float printer up to 3 digits of precision after the dot; "%f" would print as many digits as required, which is somewhat verbose; "%h" is an hexadecimal float printer.

let pp_point out (p:point) =
+  Format.fprintf out "{ @[x=%.3f;@ y=%.3f@] }" p.x p.y
+
+let pp_rectangle out (r:rectangle) =
+  Format.fprintf out "{ @[ll=%a;@ ur=%a@] }"
+    pp_point r.ll pp_point r.ur

In the .mli file, we could have:

val pp_point : Format.formatter -> point -> unit
+
+val pp_rectangle : Format.formatter -> rectangle -> unit

These printers can now be used with "%a" inside other printers.

# Format.printf "some rectangle: %a@."
+      (Format.pp_print_option pp_rectangle)
+      (Some {ll={x=1.; y=2.}; ur={x=42.; y=500.12345}})
+some rectangle: { l={ x=1.000; y=2.000 }; ur={ x=42.000; y=500.123 } }
+
+# Format.printf "no rectangle: %a@."
+      (Format.pp_option pp_rectangle)
+      None
+no rectangle:

See how we combine pp_print_option (option printer) and our newly defined rectangle printer, like we did with pp_print_list earlier.

For a more extensive tutorial, see "Using the Format module".

A final note: the Format module is a starting point. The OCaml ecosystem has libraries that makes formatting easier and more expressive, with more combinators, more concise names, etc. An example of such a library is Fmt.

Automatic deriving of pretty-printers from type definitions is also possible, using https://github.com/ocaml-ppx/ppx_deriving or similar ppx derivers.

diff --git a/ocaml/Stdlib/Fun/index.html b/ocaml/Stdlib/Fun/index.html new file mode 100644 index 00000000..62884149 --- /dev/null +++ b/ocaml/Stdlib/Fun/index.html @@ -0,0 +1,2 @@ + +Fun (ocaml.Stdlib.Fun)

Module Stdlib.Fun

Function manipulation.

  • since 4.08

Combinators

val id : 'a -> 'a

id is the identity function. For any argument x, id x is x.

val const : 'a -> _ -> 'a

const c is a function that always returns the value c. For any argument x, (const c) x is c.

val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c

flip f reverses the argument order of the binary function f. For any arguments x and y, (flip f) x y is f y x.

val negate : ('a -> bool) -> 'a -> bool

negate p is the negation of the predicate function p. For any argument x, (negate p) x is not (p x).

Exception handling

val protect : finally:(unit -> unit) -> (unit -> 'a) -> 'a

protect ~finally work invokes work () and then finally () before work () returns with its value or an exception. In the latter case the exception is re-raised after finally (). If finally () raises an exception, then the exception Finally_raised is raised instead.

protect can be used to enforce local invariants whether work () returns normally or raises an exception. However, it does not protect against unexpected exceptions raised inside finally () such as Stdlib.Out_of_memory, Stdlib.Stack_overflow, or asynchronous exceptions raised by signal handlers (e.g. Sys.Break).

Note: It is a programming error if other kinds of exceptions are raised by finally, as any exception raised in work () will be lost in the event of a Finally_raised exception. Therefore, one should make sure to handle those inside the finally.

exception Finally_raised of exn

Finally_raised exn is raised by protect ~finally work when finally raises an exception exn. This exception denotes either an unexpected exception or a programming error. As a general rule, one should not catch a Finally_raised exception except as part of a catch-all handler.

diff --git a/ocaml/Stdlib/Gc/Memprof/index.html b/ocaml/Stdlib/Gc/Memprof/index.html new file mode 100644 index 00000000..5e2967d3 --- /dev/null +++ b/ocaml/Stdlib/Gc/Memprof/index.html @@ -0,0 +1,6 @@ + +Memprof (ocaml.Stdlib.Gc.Memprof)

Module Gc.Memprof

Memprof is a sampling engine for allocated memory words. Every allocated word has a probability of being sampled equal to a configurable sampling rate. Once a block is sampled, it becomes tracked. A tracked block triggers a user-defined callback as soon as it is allocated, promoted or deallocated.

Since blocks are composed of several words, a block can potentially be sampled several times. If a block is sampled several times, then each of the callback is called once for each event of this block: the multiplicity is given in the n_samples field of the allocation structure.

This engine makes it possible to implement a low-overhead memory profiler as an OCaml library.

Note: this API is EXPERIMENTAL. It may change without prior notice.

type allocation_source =
  1. | Normal
  2. | Marshal
  3. | Custom
type allocation = private {
  1. n_samples : int;
    (*

    The number of samples in this block (>= 1).

    *)
  2. size : int;
    (*

    The size of the block, in words, excluding the header.

    *)
  3. source : allocation_source;
    (*

    The type of the allocation.

    *)
  4. callstack : Printexc.raw_backtrace;
    (*

    The callstack for the allocation.

    *)
}

The type of metadata associated with allocations. This is the type of records passed to the callback triggered by the sampling of an allocation.

type ('minor, 'major) tracker = {
  1. alloc_minor : allocation -> 'minor option;
  2. alloc_major : allocation -> 'major option;
  3. promote : 'minor -> 'major option;
  4. dealloc_minor : 'minor -> unit;
  5. dealloc_major : 'major -> unit;
}

A ('minor, 'major) tracker describes how memprof should track sampled blocks over their lifetime, keeping a user-defined piece of metadata for each of them: 'minor is the type of metadata to keep for minor blocks, and 'major the type of metadata for major blocks.

When using threads, it is guaranteed that allocation callbacks are always run in the thread where the allocation takes place.

If an allocation-tracking or promotion-tracking function returns None, memprof stops tracking the corresponding value.

val null_tracker : ('minor, 'major) tracker

Default callbacks simply return None or ()

val start : + sampling_rate:float -> + ?callstack_size:int -> + ('minor, 'major) tracker -> + unit

Start the sampling with the given parameters. Fails if sampling is already active.

The parameter sampling_rate is the sampling rate in samples per word (including headers). Usually, with cheap callbacks, a rate of 1e-4 has no visible effect on performance, and 1e-3 causes the program to run a few percent slower

The parameter callstack_size is the length of the callstack recorded at every sample. Its default is max_int.

The parameter tracker determines how to track sampled blocks over their lifetime in the minor and major heap.

Sampling is temporarily disabled when calling a callback for the current thread. So they do not need to be re-entrant if the program is single-threaded. However, if threads are used, it is possible that a context switch occurs during a callback, in this case the callback functions must be re-entrant.

Note that the callback can be postponed slightly after the actual event. The callstack passed to the callback is always accurate, but the program state may have evolved.

val stop : unit -> unit

Stop the sampling. Fails if sampling is not active.

This function does not allocate memory.

All the already tracked blocks are discarded. If there are pending postponed callbacks, they may be discarded.

Calling stop when a callback is running can lead to callbacks not being called even though some events happened.

diff --git a/ocaml/Stdlib/Gc/index.html b/ocaml/Stdlib/Gc/index.html new file mode 100644 index 00000000..42608414 --- /dev/null +++ b/ocaml/Stdlib/Gc/index.html @@ -0,0 +1,2 @@ + +Gc (ocaml.Stdlib.Gc)

Module Stdlib.Gc

Memory management control and statistics; finalised values.

type stat = {
  1. minor_words : float;
    (*

    Number of words allocated in the minor heap since the program was started.

    *)
  2. promoted_words : float;
    (*

    Number of words allocated in the minor heap that survived a minor collection and were moved to the major heap since the program was started.

    *)
  3. major_words : float;
    (*

    Number of words allocated in the major heap, including the promoted words, since the program was started.

    *)
  4. minor_collections : int;
    (*

    Number of minor collections since the program was started.

    *)
  5. major_collections : int;
    (*

    Number of major collection cycles completed since the program was started.

    *)
  6. heap_words : int;
    (*

    Total size of the major heap, in words.

    *)
  7. heap_chunks : int;
    (*

    Number of contiguous pieces of memory that make up the major heap. This metrics is currently not available in OCaml 5: the field value is always 0.

    *)
  8. live_words : int;
    (*

    Number of words of live data in the major heap, including the header words.

    Note that "live" words refers to every word in the major heap that isn't currently known to be collectable, which includes words that have become unreachable by the program after the start of the previous gc cycle. It is typically much simpler and more predictable to call Gc.full_major (or Gc.compact) then computing gc stats, as then "live" words has the simple meaning of "reachable by the program". One caveat is that a single call to Gc.full_major will not reclaim values that have a finaliser from Gc.finalise (this does not apply to Gc.finalise_last). If this caveat matters, simply call Gc.full_major twice instead of once.

    *)
  9. live_blocks : int;
    (*

    Number of live blocks in the major heap.

    See live_words for a caveat about what "live" means.

    *)
  10. free_words : int;
    (*

    Number of words in the free list.

    *)
  11. free_blocks : int;
    (*

    Number of blocks in the free list. This metrics is currently not available in OCaml 5: the field value is always 0.

    *)
  12. largest_free : int;
    (*

    Size (in words) of the largest block in the free list. This metrics is currently not available in OCaml 5: the field value is always 0.

    *)
  13. fragments : int;
    (*

    Number of wasted words due to fragmentation. These are 1-words free blocks placed between two live blocks. They are not available for allocation.

    *)
  14. compactions : int;
    (*

    Number of heap compactions since the program was started.

    *)
  15. top_heap_words : int;
    (*

    Maximum size reached by the major heap, in words.

    *)
  16. stack_size : int;
    (*

    Current size of the stack, in words. This metrics is currently not available in OCaml 5: the field value is always 0.

    • since 3.12
    *)
  17. forced_major_collections : int;
    (*

    Number of forced full major collections completed since the program was started.

    • since 4.12
    *)
}

The memory management counters are returned in a stat record. These counters give values for the whole program.

The total amount of memory allocated by the program since it was started is (in words) minor_words + major_words - promoted_words. Multiply by the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get the number of bytes.

type control = {
  1. minor_heap_size : int;
    (*

    The size (in words) of the minor heap. Changing this parameter will trigger a minor collection. The total size of the minor heap used by this program is the sum of the heap sizes of the active domains. Default: 256k.

    *)
  2. major_heap_increment : int;
    (*

    How much to add to the major heap when increasing it. If this number is less than or equal to 1000, it is a percentage of the current heap size (i.e. setting it to 100 will double the heap size at each increase). If it is more than 1000, it is a fixed number of words that will be added to the heap. Default: 15.

    *)
  3. space_overhead : int;
    (*

    The major GC speed is computed from this parameter. This is the memory that will be "wasted" because the GC does not immediately collect unreachable blocks. It is expressed as a percentage of the memory used for live data. The GC will work more (use more CPU time and collect blocks more eagerly) if space_overhead is smaller. Default: 120.

    *)
  4. verbose : int;
    (*

    This value controls the GC messages on standard error output. It is a sum of some of the following flags, to print messages on the corresponding events:

    • 0x001 Start and end of major GC cycle.
    • 0x002 Minor collection and major GC slice.
    • 0x004 Growing and shrinking of the heap.
    • 0x008 Resizing of stacks and memory manager tables.
    • 0x010 Heap compaction.
    • 0x020 Change of GC parameters.
    • 0x040 Computation of major GC slice size.
    • 0x080 Calling of finalisation functions.
    • 0x100 Bytecode executable and shared library search at start-up.
    • 0x200 Computation of compaction-triggering condition.
    • 0x400 Output GC statistics at program exit. Default: 0.
    *)
  5. max_overhead : int;
    (*

    Heap compaction is triggered when the estimated amount of "wasted" memory is more than max_overhead percent of the amount of live data. If max_overhead is set to 0, heap compaction is triggered at the end of each major GC cycle (this setting is intended for testing purposes only). If max_overhead >= 1000000, compaction is never triggered. If compaction is permanently disabled, it is strongly suggested to set allocation_policy to 2. Default: 500.

    *)
  6. stack_limit : int;
    (*

    The maximum size of the fiber stacks (in words). Default: 1024k.

    *)
  7. allocation_policy : int;
    (*

    The policy used for allocating in the major heap. Possible values are 0, 1 and 2.

    • 0 is the next-fit policy, which is usually fast but can result in fragmentation, increasing memory consumption.
    • 1 is the first-fit policy, which avoids fragmentation but has corner cases (in certain realistic workloads) where it is sensibly slower.
    • 2 is the best-fit policy, which is fast and avoids fragmentation. In our experiments it is faster and uses less memory than both next-fit and first-fit. (since OCaml 4.10)

    The default is best-fit.

    On one example that was known to be bad for next-fit and first-fit, next-fit takes 28s using 855Mio of memory, first-fit takes 47s using 566Mio of memory, best-fit takes 27s using 545Mio of memory.

    Note: If you change to next-fit, you may need to reduce the space_overhead setting, for example using 80 instead of the default 120 which is tuned for best-fit. Otherwise, your program will need more memory.

    Note: changing the allocation policy at run-time forces a heap compaction, which is a lengthy operation unless the heap is small (e.g. at the start of the program).

    Default: 2.

    • since 3.11
    *)
  8. window_size : int;
    (*

    The size of the window used by the major GC for smoothing out variations in its workload. This is an integer between 1 and 50. Default: 1.

    • since 4.03
    *)
  9. custom_major_ratio : int;
    (*

    Target ratio of floating garbage to major heap size for out-of-heap memory held by custom values located in the major heap. The GC speed is adjusted to try to use this much memory for dead values that are not yet collected. Expressed as a percentage of major heap size. The default value keeps the out-of-heap floating garbage about the same size as the in-heap overhead. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 44.

    • since 4.08
    *)
  10. custom_minor_ratio : int;
    (*

    Bound on floating garbage for out-of-heap memory held by custom values in the minor heap. A minor GC is triggered when this much memory is held by custom values located in the minor heap. Expressed as a percentage of minor heap size. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 100.

    • since 4.08
    *)
  11. custom_minor_max_size : int;
    (*

    Maximum amount of out-of-heap memory for each custom value allocated in the minor heap. Custom values that hold more than this many bytes are allocated on the major heap. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 70000 bytes.

    • since 4.08
    *)
}

The GC parameters are given as a control record. Note that these parameters can also be initialised by setting the OCAMLRUNPARAM environment variable. See the documentation of ocamlrun.

val stat : unit -> stat

Return the current values of the memory management counters in a stat record that represent the program's total memory stats. This function causes a full major collection.

val quick_stat : unit -> stat

Same as stat except that live_words, live_blocks, free_words, free_blocks, largest_free, and fragments are set to 0. Due to per-domain buffers it may only represent the state of the program's total memory usage since the last minor collection. This function is much faster than stat because it does not need to trigger a full major collection.

val counters : unit -> float * float * float

Return (minor_words, promoted_words, major_words) for the current domain or potentially previous domains. This function is as fast as quick_stat.

val minor_words : unit -> float

Number of words allocated in the minor heap by this domain or potentially previous domains. This number is accurate in byte-code programs, but only an approximation in programs compiled to native code.

In native code this function does not allocate.

  • since 4.04
val get : unit -> control

Return the current values of the GC parameters in a control record.

  • alert unsynchronized_access GC parameters are a mutable global state.
val set : control -> unit

set r changes the GC parameters according to the control record r. The normal usage is: Gc.set { (Gc.get()) with Gc.verbose = 0x00d }

  • alert unsynchronized_access GC parameters are a mutable global state.
val minor : unit -> unit

Trigger a minor collection.

val major_slice : int -> int

major_slice n Do a minor collection and a slice of major collection. n is the size of the slice: the GC will do enough work to free (on average) n words of memory. If n = 0, the GC will try to do enough work to ensure that the next automatic slice has no work to do. This function returns an unspecified integer (currently: 0).

val major : unit -> unit

Do a minor collection and finish the current major collection cycle.

val full_major : unit -> unit

Do a minor collection, finish the current major collection cycle, and perform a complete new cycle. This will collect all currently unreachable blocks.

val compact : unit -> unit

Perform a full major collection and compact the heap. Note that heap compaction is a lengthy operation.

val print_stat : out_channel -> unit

Print the current values of the memory management counters (in human-readable form) of the total program into the channel argument.

val allocated_bytes : unit -> float

Return the number of bytes allocated by this domain and potentially a previous domain. It is returned as a float to avoid overflow problems with int on 32-bit machines.

val get_minor_free : unit -> int

Return the current size of the free space inside the minor heap of this domain.

  • since 4.03
val finalise : ('a -> unit) -> 'a -> unit

finalise f v registers f as a finalisation function for v. v must be heap-allocated. f will be called with v as argument at some point between the first time v becomes unreachable (including through weak pointers) and the time v is collected by the GC. Several functions can be registered for the same value, or even several instances of the same function. Each instance will be called once (or never, if the program terminates before v becomes unreachable).

The GC will call the finalisation functions in the order of deallocation. When several values become unreachable at the same time (i.e. during the same GC cycle), the finalisation functions will be called in the reverse order of the corresponding calls to finalise. If finalise is called in the same order as the values are allocated, that means each value is finalised before the values it depends upon. Of course, this becomes false if additional dependencies are introduced by assignments.

In the presence of multiple OCaml threads it should be assumed that any particular finaliser may be executed in any of the threads.

Anything reachable from the closure of finalisation functions is considered reachable, so the following code will not work as expected:

  • let v = ... in Gc.finalise (fun _ -> ...v...) v

Instead you should make sure that v is not in the closure of the finalisation function by writing:

  • let f = fun x -> ... let v = ... in Gc.finalise f v

The f function can use all features of OCaml, including assignments that make the value reachable again. It can also loop forever (in this case, the other finalisation functions will not be called during the execution of f, unless it calls finalise_release). It can call finalise on v or other values to register other functions or even itself. It can raise an exception; in this case the exception will interrupt whatever the program was doing when the function was called.

finalise will raise Invalid_argument if v is not guaranteed to be heap-allocated. Some examples of values that are not heap-allocated are integers, constant constructors, booleans, the empty array, the empty list, the unit value. The exact list of what is heap-allocated or not is implementation-dependent. Some constant values can be heap-allocated but never deallocated during the lifetime of the program, for example a list of integer constants; this is also implementation-dependent. Note that values of types float are sometimes allocated and sometimes not, so finalising them is unsafe, and finalise will also raise Invalid_argument for them. Values of type 'a Lazy.t (for any 'a) are like float in this respect, except that the compiler sometimes optimizes them in a way that prevents finalise from detecting them. In this case, it will not raise Invalid_argument, but you should still avoid calling finalise on lazy values.

The results of calling String.make, Bytes.make, Bytes.create, Array.make, and Stdlib.ref are guaranteed to be heap-allocated and non-constant except when the length argument is 0.

val finalise_last : (unit -> unit) -> 'a -> unit

same as finalise except the value is not given as argument. So you can't use the given value for the computation of the finalisation function. The benefit is that the function is called after the value is unreachable for the last time instead of the first time. So contrary to finalise the value will never be reachable again or used again. In particular every weak pointer and ephemeron that contained this value as key or data is unset before running the finalisation function. Moreover the finalisation functions attached with finalise are always called before the finalisation functions attached with finalise_last.

  • since 4.04
val finalise_release : unit -> unit

A finalisation function may call finalise_release to tell the GC that it can launch the next finalisation function without waiting for the current one to return.

type alarm

An alarm is a piece of data that calls a user function at the end of each major GC cycle. The following functions are provided to create and delete alarms.

val create_alarm : (unit -> unit) -> alarm

create_alarm f will arrange for f to be called at the end of each major GC cycle, not caused by f itself, starting with the current cycle or the next one. A value of type alarm is returned that you can use to call delete_alarm.

val delete_alarm : alarm -> unit

delete_alarm a will stop the calls to the function associated to a. Calling delete_alarm a again has no effect.

val eventlog_pause : unit -> unit
  • deprecated Use Runtime_events.pause instead.
val eventlog_resume : unit -> unit
  • deprecated Use Runtime_events.resume instead.
module Memprof : sig ... end

Memprof is a sampling engine for allocated memory words. Every allocated word has a probability of being sampled equal to a configurable sampling rate. Once a block is sampled, it becomes tracked. A tracked block triggers a user-defined callback as soon as it is allocated, promoted or deallocated.

diff --git a/ocaml/Stdlib/Hashtbl/Make/argument-1-H/index.html b/ocaml/Stdlib/Hashtbl/Make/argument-1-H/index.html new file mode 100644 index 00000000..7344fda2 --- /dev/null +++ b/ocaml/Stdlib/Hashtbl/Make/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (ocaml.Stdlib.Hashtbl.Make.H)

Parameter Make.H

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Stdlib/Hashtbl/Make/index.html b/ocaml/Stdlib/Hashtbl/Make/index.html new file mode 100644 index 00000000..7d8b9020 --- /dev/null +++ b/ocaml/Stdlib/Hashtbl/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Stdlib.Hashtbl.Make)

Module Hashtbl.Make

Functor building an implementation of the hashtable structure. The functor Hashtbl.Make returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the hashing and equality functions specified in the functor argument H instead of generic equality and hashing. Since the hash function is not seeded, the create operation of the result structure always returns non-randomized hash tables.

Parameters

module H : HashedType

Signature

type key = H.t
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Stdlib/Hashtbl/MakeSeeded/argument-1-H/index.html b/ocaml/Stdlib/Hashtbl/MakeSeeded/argument-1-H/index.html new file mode 100644 index 00000000..4f1d47c4 --- /dev/null +++ b/ocaml/Stdlib/Hashtbl/MakeSeeded/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (ocaml.Stdlib.Hashtbl.MakeSeeded.H)

Parameter MakeSeeded.H

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val seeded_hash : int -> t -> int

A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

diff --git a/ocaml/Stdlib/Hashtbl/MakeSeeded/index.html b/ocaml/Stdlib/Hashtbl/MakeSeeded/index.html new file mode 100644 index 00000000..705ff80c --- /dev/null +++ b/ocaml/Stdlib/Hashtbl/MakeSeeded/index.html @@ -0,0 +1,2 @@ + +MakeSeeded (ocaml.Stdlib.Hashtbl.MakeSeeded)

Module Hashtbl.MakeSeeded

Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

  • since 4.00

Parameters

Signature

type key = H.t
type !'a t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Stdlib/Hashtbl/index.html b/ocaml/Stdlib/Hashtbl/index.html new file mode 100644 index 00000000..a4327ed8 --- /dev/null +++ b/ocaml/Stdlib/Hashtbl/index.html @@ -0,0 +1,80 @@ + +Hashtbl (ocaml.Stdlib.Hashtbl)

Module Stdlib.Hashtbl

Hash tables and hash functions.

Hash tables are hashed association tables, with in-place modification. Because most operations on a hash table modify their input, they're more commonly used in imperative code. The lookup of the value associated with a key (see find, find_opt) is normally very fast, often faster than the equivalent lookup in Map.

The functors Make and MakeSeeded can be used when performance or flexibility are key. The user provides custom equality and hash functions for the key type, and obtains a custom hash table type for this particular type of key.

Warning a hash table is only as good as the hash function. A bad hash function will turn the table into a degenerate association list, with linear time lookup instead of constant time lookup.

The polymorphic t hash table is useful in simpler cases or in interactive environments. It uses the polymorphic hash function defined in the OCaml runtime (at the time of writing, it's SipHash), as well as the polymorphic equality (=).

See the examples section.

Unsynchronized accesses

Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a Mutex.t).

Generic interface

type (!'a, !'b) t

The type of hash tables from type 'a to type 'b.

val create : ?random:bool -> int -> ('a, 'b) t

Hashtbl.create n creates a new, empty hash table, with initial size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess.

The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

  • before 4.00

    the ~random parameter was not present and all hash tables were created in non-randomized mode.

val clear : ('a, 'b) t -> unit

Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

val reset : ('a, 'b) t -> unit

Empty a hash table and shrink the size of the bucket table to its initial size.

  • since 4.00
val copy : ('a, 'b) t -> ('a, 'b) t

Return a copy of the given hashtable.

val add : ('a, 'b) t -> 'a -> 'b -> unit

Hashtbl.add tbl key data adds a binding of key to data in table tbl.

Warning: Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

If you desire the classic behavior of replacing elements, see replace.

val find : ('a, 'b) t -> 'a -> 'b

Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

val find_opt : ('a, 'b) t -> 'a -> 'b option

Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

  • since 4.05
val find_all : ('a, 'b) t -> 'a -> 'b list

Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

val mem : ('a, 'b) t -> 'a -> bool

Hashtbl.mem tbl x checks if x is bound in tbl.

val remove : ('a, 'b) t -> 'a -> unit

Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

val replace : ('a, 'b) t -> 'a -> 'b -> unit

Hashtbl.replace tbl key data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

val iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit

Hashtbl.iter f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

The behavior is not specified if the hash table is modified by f during the iteration.

val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit

Hashtbl.filter_map_inplace f tbl applies f to all bindings in table tbl and update each binding depending on the result of f. If f returns None, the binding is discarded. If it returns Some new_val, the binding is update to associate the key to new_val.

Other comments for iter apply as well.

  • since 4.03
val fold : ('a -> 'b -> 'acc -> 'acc) -> ('a, 'b) t -> 'acc -> 'acc

Hashtbl.fold f tbl init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in tbl, and d1 ... dN are the associated values. Each binding is presented exactly once to f.

The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

The behavior is not specified if the hash table is modified by f during the iteration.

val length : ('a, 'b) t -> int

Hashtbl.length tbl returns the number of bindings in tbl. It takes constant time. Multiple bindings are counted once each, so Hashtbl.length gives the number of times Hashtbl.iter calls its first argument.

val randomize : unit -> unit

After a call to Hashtbl.randomize(), hash tables are created in randomized mode by default: create returns randomized hash tables, unless the ~random:false optional parameter is given. The same effect can be achieved by setting the R parameter in the OCAMLRUNPARAM environment variable.

It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in create call Hashtbl.randomize() at initialization time before any domains are created.

Note that once Hashtbl.randomize() was called, there is no way to revert to the non-randomized default behavior of create. This is intentional. Non-randomized hash tables can still be created using Hashtbl.create ~random:false.

  • since 4.00
val is_randomized : unit -> bool

Return true if the tables are currently created in randomized mode by default, false otherwise.

  • since 4.03
val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t

Return a copy of the given hashtable. Unlike copy, rebuild h re-hashes all the (key, value) entries of the original table h. The returned hash table is randomized if h was randomized, or the optional random parameter is true, or if the default is to create randomized hash tables; see create for more information.

rebuild can safely be used to import a hash table built by an old version of the Hashtbl module, then marshaled to persistent storage. After unmarshaling, apply rebuild to produce a hash table for the current version of the Hashtbl module.

  • since 4.12
type statistics = {
  1. num_bindings : int;
    (*

    Number of bindings present in the table. Same value as returned by length.

    *)
  2. num_buckets : int;
    (*

    Number of buckets in the table.

    *)
  3. max_bucket_length : int;
    (*

    Maximal number of bindings per bucket.

    *)
  4. bucket_histogram : int array;
    (*

    Histogram of bucket sizes. This array histo has length max_bucket_length + 1. The value of histo.(i) is the number of buckets whose size is i.

    *)
}
  • since 4.00
val stats : ('a, 'b) t -> statistics

Hashtbl.stats tbl returns statistics about the table tbl: number of buckets, size of the biggest bucket, distribution of buckets by size.

  • since 4.00

Hash tables and Sequences

val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t

Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first.

The behavior is not specified if the hash table is modified during the iteration.

  • since 4.07
val to_seq_keys : ('a, _) t -> 'a Seq.t

Same as Seq.map fst (to_seq m)

  • since 4.07
val to_seq_values : (_, 'b) t -> 'b Seq.t

Same as Seq.map snd (to_seq m)

  • since 4.07
val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

Add the given bindings to the table, using add

  • since 4.07
val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

Add the given bindings to the table, using replace

  • since 4.07
val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t

Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using replace_seq, which means that if two pairs have the same key, only the latest one will appear in the table.

  • since 4.07

Functorial interface

The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins.

For instance, one might want to specialize a table for integer keys:

module IntHash =
+  struct
+    type t = int
+    let equal i j = i=j
+    let hash i = i land max_int
+  end
+
+module IntHashtbl = Hashtbl.Make(IntHash)
+
+let h = IntHashtbl.create 17 in
+IntHashtbl.add h 12 "hello"

This creates a new module IntHashtbl, with a new type 'a + IntHashtbl.t of tables from int to 'a. In this example, h contains string values so its type is string IntHashtbl.t.

Note that the new type 'a IntHashtbl.t is not compatible with the type ('a,'b) Hashtbl.t of the generic interface. For example, Hashtbl.length h would not type-check, you must use IntHashtbl.length.

module type HashedType = sig ... end

The input signature of the functor Make.

module type S = sig ... end

The output signature of the functor Make.

module Make (H : HashedType) : S with type key = H.t

Functor building an implementation of the hashtable structure. The functor Hashtbl.Make returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the hashing and equality functions specified in the functor argument H instead of generic equality and hashing. Since the hash function is not seeded, the create operation of the result structure always returns non-randomized hash tables.

module type SeededHashedType = sig ... end

The input signature of the functor MakeSeeded.

module type SeededS = sig ... end

The output signature of the functor MakeSeeded.

module MakeSeeded (H : SeededHashedType) : SeededS with type key = H.t

Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

The polymorphic hash functions

val hash : 'a -> int

Hashtbl.hash x associates a nonnegative integer to any value of any type. It is guaranteed that if x = y or Stdlib.compare x y = 0, then hash x = hash y. Moreover, hash always terminates, even on cyclic structures.

val seeded_hash : int -> 'a -> int

A variant of hash that is further parameterized by an integer seed.

  • since 4.00
val hash_param : int -> int -> 'a -> int

Hashtbl.hash_param meaningful total x computes a hash value for x, with the same properties as for hash. The two extra integer parameters meaningful and total give more precise control over hashing. Hashing performs a breadth-first, left-to-right traversal of the structure x, stopping after meaningful meaningful nodes were encountered, or total nodes (meaningful or not) were encountered. If total as specified by the user exceeds a certain value, currently 256, then it is capped to that value. Meaningful nodes are: integers; floating-point numbers; strings; characters; booleans; and constant constructors. Larger values of meaningful and total means that more nodes are taken into account to compute the final hash value, and therefore collisions are less likely to happen. However, hashing takes longer. The parameters meaningful and total govern the tradeoff between accuracy and speed. As default choices, hash and seeded_hash take meaningful = 10 and total = 100.

val seeded_hash_param : int -> int -> int -> 'a -> int

A variant of hash_param that is further parameterized by an integer seed. Usage: Hashtbl.seeded_hash_param meaningful total seed x.

  • since 4.00

Examples

Basic Example

(* 0...99 *)
+let seq = Seq.ints 0 |> Seq.take 100
+
+(* build from Seq.t *)
+# let tbl =
+    seq
+    |> Seq.map (fun x -> x, string_of_int x)
+    |> Hashtbl.of_seq
+val tbl : (int, string) Hashtbl.t = <abstr>
+
+# Hashtbl.length tbl
+- : int = 100
+
+# Hashtbl.find_opt tbl 32
+- : string option = Some "32"
+
+# Hashtbl.find_opt tbl 166
+- : string option = None
+
+# Hashtbl.replace tbl 166 "one six six"
+- : unit = ()
+
+# Hashtbl.find_opt tbl 166
+- : string option = Some "one six six"
+
+# Hashtbl.length tbl
+- : int = 101

Counting Elements

Given a sequence of elements (here, a Seq.t), we want to count how many times each distinct element occurs in the sequence. A simple way to do this, assuming the elements are comparable and hashable, is to use a hash table that maps elements to their number of occurrences.

Here we illustrate that principle using a sequence of (ascii) characters (type char). We use a custom Char_tbl specialized for char.

# module Char_tbl = Hashtbl.Make(struct
+    type t = char
+    let equal = Char.equal
+    let hash = Hashtbl.hash
+  end)
+
+(*  count distinct occurrences of chars in [seq] *)
+# let count_chars (seq : char Seq.t) : _ list =
+    let counts = Char_tbl.create 16 in
+    Seq.iter
+      (fun c ->
+        let count_c =
+          Char_tbl.find_opt counts c
+          |> Option.value ~default:0
+        in
+        Char_tbl.replace counts c (count_c + 1))
+      seq;
+    (* turn into a list *)
+    Char_tbl.fold (fun c n l -> (c,n) :: l) counts []
+      |> List.sort (fun (c1,_)(c2,_) -> Char.compare c1 c2)
+val count_chars : Char_tbl.key Seq.t -> (Char.t * int) list = <fun>
+
+(* basic seq from a string *)
+# let seq = String.to_seq "hello world, and all the camels in it!"
+val seq : char Seq.t = <fun>
+
+# count_chars seq
+- : (Char.t * int) list =
+[(' ', 7); ('!', 1); (',', 1); ('a', 3); ('c', 1); ('d', 2); ('e', 3);
+ ('h', 2); ('i', 2); ('l', 6); ('m', 1); ('n', 2); ('o', 2); ('r', 1);
+ ('s', 1); ('t', 2); ('w', 1)]
+
+(* "abcabcabc..." *)
+# let seq2 =
+    Seq.cycle (String.to_seq "abc") |> Seq.take 31
+val seq2 : char Seq.t = <fun>
+
+# String.of_seq seq2
+- : String.t = "abcabcabcabcabcabcabcabcabcabca"
+
+# count_chars seq2
+- : (Char.t * int) list = [('a', 11); ('b', 10); ('c', 10)]
diff --git a/ocaml/Stdlib/Hashtbl/module-type-HashedType/index.html b/ocaml/Stdlib/Hashtbl/module-type-HashedType/index.html new file mode 100644 index 00000000..908d843e --- /dev/null +++ b/ocaml/Stdlib/Hashtbl/module-type-HashedType/index.html @@ -0,0 +1,2 @@ + +HashedType (ocaml.Stdlib.Hashtbl.HashedType)

Module type Hashtbl.HashedType

The input signature of the functor Make.

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Stdlib/Hashtbl/module-type-S/index.html b/ocaml/Stdlib/Hashtbl/module-type-S/index.html new file mode 100644 index 00000000..94c5a6b1 --- /dev/null +++ b/ocaml/Stdlib/Hashtbl/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Stdlib.Hashtbl.S)

Module type Hashtbl.S

The output signature of the functor Make.

type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Stdlib/Hashtbl/module-type-SeededHashedType/index.html b/ocaml/Stdlib/Hashtbl/module-type-SeededHashedType/index.html new file mode 100644 index 00000000..080d7114 --- /dev/null +++ b/ocaml/Stdlib/Hashtbl/module-type-SeededHashedType/index.html @@ -0,0 +1,2 @@ + +SeededHashedType (ocaml.Stdlib.Hashtbl.SeededHashedType)

Module type Hashtbl.SeededHashedType

The input signature of the functor MakeSeeded.

  • since 4.00
type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val seeded_hash : int -> t -> int

A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

diff --git a/ocaml/Stdlib/Hashtbl/module-type-SeededS/index.html b/ocaml/Stdlib/Hashtbl/module-type-SeededS/index.html new file mode 100644 index 00000000..47c1e076 --- /dev/null +++ b/ocaml/Stdlib/Hashtbl/module-type-SeededS/index.html @@ -0,0 +1,2 @@ + +SeededS (ocaml.Stdlib.Hashtbl.SeededS)

Module type Hashtbl.SeededS

The output signature of the functor MakeSeeded.

  • since 4.00
type key
type !'a t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Stdlib/In_channel/index.html b/ocaml/Stdlib/In_channel/index.html new file mode 100644 index 00000000..b982abdf --- /dev/null +++ b/ocaml/Stdlib/In_channel/index.html @@ -0,0 +1,3 @@ + +In_channel (ocaml.Stdlib.In_channel)

Module Stdlib.In_channel

Input channels.

This module provides functions for working with input channels.

See the example section below.

  • since 4.14

Channels

type t = in_channel

The type of input channel.

type open_flag = open_flag =
  1. | Open_rdonly
    (*

    open for reading.

    *)
  2. | Open_wronly
    (*

    open for writing.

    *)
  3. | Open_append
    (*

    open for appending: always write at end of file.

    *)
  4. | Open_creat
    (*

    create the file if it does not exist.

    *)
  5. | Open_trunc
    (*

    empty the file if it already exists.

    *)
  6. | Open_excl
    (*

    fail if Open_creat and the file already exists.

    *)
  7. | Open_binary
    (*

    open in binary mode (no conversion).

    *)
  8. | Open_text
    (*

    open in text mode (may perform conversions).

    *)
  9. | Open_nonblock
    (*

    open in non-blocking mode.

    *)

Opening modes for open_gen.

val stdin : t

The standard input for the process.

val open_bin : string -> t

Open the named file for reading, and return a new input channel on that file, positioned at the beginning of the file.

val open_text : string -> t

Same as open_bin, but the file is opened in text mode, so that newline translation takes place during reads. On operating systems that do not distinguish between text mode and binary mode, this function behaves like open_bin.

val open_gen : open_flag list -> int -> string -> t

open_gen mode perm filename opens the named file for reading, as described above. The extra arguments mode and perm specify the opening mode and file permissions. open_text and open_bin are special cases of this function.

val with_open_bin : string -> (t -> 'a) -> 'a

with_open_bin fn f opens a channel ic on file fn and returns f + ic. After f returns, either with a value or by raising an exception, ic is guaranteed to be closed.

val with_open_text : string -> (t -> 'a) -> 'a

Like with_open_bin, but the channel is opened in text mode (see open_text).

val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a

Like with_open_bin, but can specify the opening mode and file permission, in case the file must be created (see open_gen).

val close : t -> unit

Close the given channel. Input functions raise a Sys_error exception when they are applied to a closed input channel, except close, which does nothing when applied to an already closed channel.

val close_noerr : t -> unit

Same as close, but ignore all errors.

Input

val input_char : t -> char option

Read one character from the given input channel. Returns None if there are no more characters to read.

val input_byte : t -> int option

Same as input_char, but return the 8-bit integer representing the character. Returns None if the end of file was reached.

val input_line : t -> string option

input_line ic reads characters from ic until a newline or the end of file is reached. Returns the string of all characters read, without the newline (if any). Returns None if the end of the file has been reached. In particular, this will be the case if the last line of input is empty.

A newline is the character \n unless the file is open in text mode and Sys.win32 is true in which case it is the sequence of characters \r\n.

val really_input_string : t -> int -> string option

really_input_string ic len reads len characters from channel ic and returns them in a new string. Returns None if the end of file is reached before len characters have been read.

If the same channel is read concurrently by multiple threads, the returned string is not guaranteed to contain contiguous characters from the input.

val input_all : t -> string

input_all ic reads all remaining data from ic.

If the same channel is read concurrently by multiple threads, the returned string is not guaranteed to contain contiguous characters from the input.

val input_lines : t -> string list

input_lines ic reads lines using input_line until the end of file is reached. It returns the list of all lines read, in the order they were read. The newline characters that terminate lines are not included in the returned strings. Empty lines produce empty strings.

  • since 5.1

Advanced input

val input : t -> bytes -> int -> int -> int

input ic buf pos len reads up to len characters from the given channel ic, storing them in byte sequence buf, starting at character number pos. It returns the actual number of characters read, between 0 and len (inclusive). A return value of 0 means that the end of file was reached.

Use really_input to read exactly len characters.

val really_input : t -> bytes -> int -> int -> unit option

really_input ic buf pos len reads len characters from channel ic, storing them in byte sequence buf, starting at character number pos.

Returns None if the end of file is reached before len characters have been read.

If the same channel is read concurrently by multiple threads, the bytes read by really_input are not guaranteed to be contiguous.

val fold_lines : ('acc -> string -> 'acc) -> 'acc -> t -> 'acc

fold_lines f init ic reads lines from ic using input_line until the end of file is reached, and successively passes each line to function f in the style of a fold. More precisely, if lines l1, ..., lN are read, fold_lines f init ic computes f (... (f (f init l1) l2) ...) lN. If f has no side effects, this is equivalent to List.fold_left f init (In_channel.input_lines ic), but is more efficient since it does not construct the list of all lines read.

  • since 5.1

Seeking

val seek : t -> int64 -> unit

seek chan pos sets the current reading position to pos for channel chan. This works only for regular files. On files of other kinds, the behavior is unspecified.

val pos : t -> int64

Return the current reading position for the given channel. For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos, then going back to this position using seek will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

Attributes

val length : t -> int64

Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless. The returned size does not take into account the end-of-line translations that can be performed when reading from a channel opened in text mode.

val set_binary_mode : t -> bool -> unit

set_binary_mode ic true sets the channel ic to binary mode: no translations take place during input.

set_binary_mode ic false sets the channel ic to text mode: depending on the operating system, some translations may take place during input. For instance, under Windows, end-of-lines will be translated from \r\n to \n.

This function has no effect under operating systems that do not distinguish between text mode and binary mode.

val isatty : t -> bool

isatty ic is true if ic refers to a terminal or console window, false otherwise.

  • since 5.1

Examples

Reading the contents of a file:

let read_file file = In_channel.with_open_bin file In_channel.input_all

Reading a line from stdin:

let user_input () = In_channel.input_line In_channel.stdin
diff --git a/ocaml/Stdlib/Int/index.html b/ocaml/Stdlib/Int/index.html new file mode 100644 index 00000000..f7c944ed --- /dev/null +++ b/ocaml/Stdlib/Int/index.html @@ -0,0 +1,2 @@ + +Int (ocaml.Stdlib.Int)

Module Stdlib.Int

Integer values.

Integers are Sys.int_size bits wide and use two's complement representation. All operations are taken modulo 2Sys.int_size. They do not fail on overflow.

  • since 4.08

Integers

type t = int

The type for integer values.

val zero : int

zero is the integer 0.

val one : int

one is the integer 1.

val minus_one : int

minus_one is the integer -1.

val neg : int -> int

neg x is ~-x.

val add : int -> int -> int

add x y is the addition x + y.

val sub : int -> int -> int

sub x y is the subtraction x - y.

val mul : int -> int -> int

mul x y is the multiplication x * y.

val div : int -> int -> int

div x y is the division x / y. See Stdlib.(/) for details.

val rem : int -> int -> int

rem x y is the remainder x mod y. See Stdlib.(mod) for details.

val succ : int -> int

succ x is add x 1.

val pred : int -> int

pred x is sub x 1.

val abs : int -> int

abs x is the absolute value of x. That is x if x is positive and neg x if x is negative. Warning. This may be negative if the argument is min_int.

val max_int : int

max_int is the greatest representable integer, 2{^[Sys.int_size - 1]} - 1.

val min_int : int

min_int is the smallest representable integer, -2{^[Sys.int_size - 1]}.

val logand : int -> int -> int

logand x y is the bitwise logical and of x and y.

val logor : int -> int -> int

logor x y is the bitwise logical or of x and y.

val logxor : int -> int -> int

logxor x y is the bitwise logical exclusive or of x and y.

val lognot : int -> int

lognot x is the bitwise logical negation of x.

val shift_left : int -> int -> int

shift_left x n shifts x to the left by n bits. The result is unspecified if n < 0 or n > Sys.int_size.

val shift_right : int -> int -> int

shift_right x n shifts x to the right by n bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if n < 0 or n > Sys.int_size.

val shift_right_logical : int -> int -> int

shift_right x n shifts x to the right by n bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if n < 0 or n > Sys.int_size.

Predicates and comparisons

val equal : int -> int -> bool

equal x y is true if and only if x = y.

val compare : int -> int -> int

compare x y is Stdlib.compare x y but more efficient.

val min : int -> int -> int

Return the smaller of the two arguments.

  • since 4.13
val max : int -> int -> int

Return the greater of the two arguments.

  • since 4.13

Converting

val to_float : int -> float

to_float x is x as a floating point number.

val of_float : float -> int

of_float x truncates x to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.

val to_string : int -> string

to_string x is the written representation of x in decimal.

val seeded_hash : int -> int -> int

A seeded hash function for ints, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.1
val hash : int -> int

An unseeded hash function for ints, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.1
diff --git a/ocaml/Stdlib/Int32/index.html b/ocaml/Stdlib/Int32/index.html new file mode 100644 index 00000000..fbeff82e --- /dev/null +++ b/ocaml/Stdlib/Int32/index.html @@ -0,0 +1,4 @@ + +Int32 (ocaml.Stdlib.Int32)

Module Stdlib.Int32

32-bit integers.

This module provides operations on the type int32 of signed 32-bit integers. Unlike the built-in int type, the type int32 is guaranteed to be exactly 32-bit wide on all platforms. All arithmetic operations over int32 are taken modulo 232.

Performance notice: values of type int32 occupy more memory space than values of type int, and arithmetic operations on int32 are generally slower than those on int. Use int32 only when the application requires exact 32-bit arithmetic.

Literals for 32-bit integers are suffixed by l:

let zero: int32 = 0l
+let one: int32 = 1l
+let m_one: int32 = -1l
val zero : int32

The 32-bit integer 0.

val one : int32

The 32-bit integer 1.

val minus_one : int32

The 32-bit integer -1.

val neg : int32 -> int32

Unary negation.

val add : int32 -> int32 -> int32

Addition.

val sub : int32 -> int32 -> int32

Subtraction.

val mul : int32 -> int32 -> int32

Multiplication.

val div : int32 -> int32 -> int32

Integer division. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val unsigned_div : int32 -> int32 -> int32

Same as div, except that arguments and result are interpreted as unsigned 32-bit integers.

  • since 4.08
val rem : int32 -> int32 -> int32

Integer remainder. If y is not zero, the result of Int32.rem x y satisfies the following property: x = Int32.add (Int32.mul (Int32.div x y) y) (Int32.rem x y). If y = 0, Int32.rem x y raises Division_by_zero.

val unsigned_rem : int32 -> int32 -> int32

Same as rem, except that arguments and result are interpreted as unsigned 32-bit integers.

  • since 4.08
val succ : int32 -> int32

Successor. Int32.succ x is Int32.add x Int32.one.

val pred : int32 -> int32

Predecessor. Int32.pred x is Int32.sub x Int32.one.

val abs : int32 -> int32

abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

val max_int : int32

The greatest representable 32-bit integer, 231 - 1.

val min_int : int32

The smallest representable 32-bit integer, -231.

val logand : int32 -> int32 -> int32

Bitwise logical and.

val logor : int32 -> int32 -> int32

Bitwise logical or.

val logxor : int32 -> int32 -> int32

Bitwise logical exclusive or.

val lognot : int32 -> int32

Bitwise logical negation.

val shift_left : int32 -> int -> int32

Int32.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= 32.

val shift_right : int32 -> int -> int32

Int32.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 32.

val shift_right_logical : int32 -> int -> int32

Int32.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 32.

val of_int : int -> int32

Convert the given integer (type int) to a 32-bit integer (type int32). On 64-bit platforms, the argument is taken modulo 232.

val to_int : int32 -> int

Convert the given 32-bit integer (type int32) to an integer (type int). On 32-bit platforms, the 32-bit integer is taken modulo 231, i.e. the high-order bit is lost during the conversion. On 64-bit platforms, the conversion is exact.

val unsigned_to_int : int32 -> int option

Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.

  • since 4.08
val of_float : float -> int32

Convert the given floating-point number to a 32-bit integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Int32.min_int, Int32.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.

val to_float : int32 -> float

Convert the given 32-bit integer to a floating-point number.

val of_string : string -> int32

Convert the given string to a 32-bit integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

The 0u prefix reads the input as an unsigned integer in the range [0, 2*Int32.max_int+1]. If the input exceeds Int32.max_int it is converted to the signed integer Int32.min_int + input - Int32.max_int - 1.

The _ (underscore) character can appear anywhere in the string and is ignored.

  • raises Failure

    if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int32.

val of_string_opt : string -> int32 option

Same as of_string, but return None instead of raising.

  • since 4.05
val to_string : int32 -> string

Return the string representation of its argument, in signed decimal.

val bits_of_float : float -> int32

Return the internal representation of the given float according to the IEEE 754 floating-point 'single format' bit layout. Bit 31 of the result represents the sign of the float; bits 30 to 23 represent the (biased) exponent; bits 22 to 0 represent the mantissa.

val float_of_bits : int32 -> float

Return the floating-point number whose internal representation, according to the IEEE 754 floating-point 'single format' bit layout, is the given int32.

type t = int32

An alias for the type of 32-bit integers.

val compare : t -> t -> int

The comparison function for 32-bit integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Int32 to be passed as argument to the functors Set.Make and Map.Make.

val unsigned_compare : t -> t -> int

Same as compare, except that arguments are interpreted as unsigned 32-bit integers.

  • since 4.08
val equal : t -> t -> bool

The equal function for int32s.

  • since 4.03
val min : t -> t -> t

Return the smaller of the two arguments.

  • since 4.13
val max : t -> t -> t

Return the greater of the two arguments.

  • since 4.13
val seeded_hash : int -> t -> int

A seeded hash function for 32-bit ints, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.1
val hash : t -> int

An unseeded hash function for 32-bit ints, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.1
diff --git a/ocaml/Stdlib/Int64/index.html b/ocaml/Stdlib/Int64/index.html new file mode 100644 index 00000000..f33a7624 --- /dev/null +++ b/ocaml/Stdlib/Int64/index.html @@ -0,0 +1,4 @@ + +Int64 (ocaml.Stdlib.Int64)

Module Stdlib.Int64

64-bit integers.

This module provides operations on the type int64 of signed 64-bit integers. Unlike the built-in int type, the type int64 is guaranteed to be exactly 64-bit wide on all platforms. All arithmetic operations over int64 are taken modulo 264

Performance notice: values of type int64 occupy more memory space than values of type int, and arithmetic operations on int64 are generally slower than those on int. Use int64 only when the application requires exact 64-bit arithmetic.

Literals for 64-bit integers are suffixed by L:

let zero: int64 = 0L
+let one: int64 = 1L
+let m_one: int64 = -1L
val zero : int64

The 64-bit integer 0.

val one : int64

The 64-bit integer 1.

val minus_one : int64

The 64-bit integer -1.

val neg : int64 -> int64

Unary negation.

val add : int64 -> int64 -> int64

Addition.

val sub : int64 -> int64 -> int64

Subtraction.

val mul : int64 -> int64 -> int64

Multiplication.

val div : int64 -> int64 -> int64

Integer division.

  • raises Division_by_zero

    if the second argument is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val unsigned_div : int64 -> int64 -> int64

Same as div, except that arguments and result are interpreted as unsigned 64-bit integers.

  • since 4.08
val rem : int64 -> int64 -> int64

Integer remainder. If y is not zero, the result of Int64.rem x y satisfies the following property: x = Int64.add (Int64.mul (Int64.div x y) y) (Int64.rem x y). If y = 0, Int64.rem x y raises Division_by_zero.

val unsigned_rem : int64 -> int64 -> int64

Same as rem, except that arguments and result are interpreted as unsigned 64-bit integers.

  • since 4.08
val succ : int64 -> int64

Successor. Int64.succ x is Int64.add x Int64.one.

val pred : int64 -> int64

Predecessor. Int64.pred x is Int64.sub x Int64.one.

val abs : int64 -> int64

abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

val max_int : int64

The greatest representable 64-bit integer, 263 - 1.

val min_int : int64

The smallest representable 64-bit integer, -263.

val logand : int64 -> int64 -> int64

Bitwise logical and.

val logor : int64 -> int64 -> int64

Bitwise logical or.

val logxor : int64 -> int64 -> int64

Bitwise logical exclusive or.

val lognot : int64 -> int64

Bitwise logical negation.

val shift_left : int64 -> int -> int64

Int64.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= 64.

val shift_right : int64 -> int -> int64

Int64.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 64.

val shift_right_logical : int64 -> int -> int64

Int64.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 64.

val of_int : int -> int64

Convert the given integer (type int) to a 64-bit integer (type int64).

val to_int : int64 -> int

Convert the given 64-bit integer (type int64) to an integer (type int). On 64-bit platforms, the 64-bit integer is taken modulo 263, i.e. the high-order bit is lost during the conversion. On 32-bit platforms, the 64-bit integer is taken modulo 231, i.e. the top 33 bits are lost during the conversion.

val unsigned_to_int : int64 -> int option

Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.

  • since 4.08
val of_float : float -> int64

Convert the given floating-point number to a 64-bit integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Int64.min_int, Int64.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.

val to_float : int64 -> float

Convert the given 64-bit integer to a floating-point number.

val of_int32 : int32 -> int64

Convert the given 32-bit integer (type int32) to a 64-bit integer (type int64).

val to_int32 : int64 -> int32

Convert the given 64-bit integer (type int64) to a 32-bit integer (type int32). The 64-bit integer is taken modulo 232, i.e. the top 32 bits are lost during the conversion.

val of_nativeint : nativeint -> int64

Convert the given native integer (type nativeint) to a 64-bit integer (type int64).

val to_nativeint : int64 -> nativeint

Convert the given 64-bit integer (type int64) to a native integer. On 32-bit platforms, the 64-bit integer is taken modulo 232. On 64-bit platforms, the conversion is exact.

val of_string : string -> int64

Convert the given string to a 64-bit integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

The 0u prefix reads the input as an unsigned integer in the range [0, 2*Int64.max_int+1]. If the input exceeds Int64.max_int it is converted to the signed integer Int64.min_int + input - Int64.max_int - 1.

The _ (underscore) character can appear anywhere in the string and is ignored.

  • raises Failure

    if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int64.

val of_string_opt : string -> int64 option

Same as of_string, but return None instead of raising.

  • since 4.05
val to_string : int64 -> string

Return the string representation of its argument, in decimal.

val bits_of_float : float -> int64

Return the internal representation of the given float according to the IEEE 754 floating-point 'double format' bit layout. Bit 63 of the result represents the sign of the float; bits 62 to 52 represent the (biased) exponent; bits 51 to 0 represent the mantissa.

val float_of_bits : int64 -> float

Return the floating-point number whose internal representation, according to the IEEE 754 floating-point 'double format' bit layout, is the given int64.

type t = int64

An alias for the type of 64-bit integers.

val compare : t -> t -> int

The comparison function for 64-bit integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Int64 to be passed as argument to the functors Set.Make and Map.Make.

val unsigned_compare : t -> t -> int

Same as compare, except that arguments are interpreted as unsigned 64-bit integers.

  • since 4.08
val equal : t -> t -> bool

The equal function for int64s.

  • since 4.03
val min : t -> t -> t

Return the smaller of the two arguments.

  • since 4.13
val max : t -> t -> t

Return the greater of the two arguments.

  • since 4.13
val seeded_hash : int -> t -> int

A seeded hash function for 64-bit ints, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.1
val hash : t -> int

An unseeded hash function for 64-bit ints, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.1
diff --git a/ocaml/Stdlib/LargeFile/index.html b/ocaml/Stdlib/LargeFile/index.html new file mode 100644 index 00000000..94500f58 --- /dev/null +++ b/ocaml/Stdlib/LargeFile/index.html @@ -0,0 +1,2 @@ + +LargeFile (ocaml.Stdlib.LargeFile)

Module Stdlib.LargeFile

Operations on large files. This sub-module provides 64-bit variants of the channel functions that manipulate file positions and file sizes. By representing positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), these alternate functions allow operating on files whose sizes are greater than max_int.

val seek_out : out_channel -> int64 -> unit
val pos_out : out_channel -> int64
val out_channel_length : out_channel -> int64
val seek_in : in_channel -> int64 -> unit
val pos_in : in_channel -> int64
val in_channel_length : in_channel -> int64
diff --git a/ocaml/Stdlib/Lazy/index.html b/ocaml/Stdlib/Lazy/index.html new file mode 100644 index 00000000..e625d7f5 --- /dev/null +++ b/ocaml/Stdlib/Lazy/index.html @@ -0,0 +1,5 @@ + +Lazy (ocaml.Stdlib.Lazy)

Module Stdlib.Lazy

Deferred computations.

type 'a t = 'a CamlinternalLazy.t

A value of type 'a Lazy.t is a deferred computation, called a suspension, that has a result of type 'a. The special expression syntax lazy (expr) makes a suspension of the computation of expr, without computing expr itself yet. "Forcing" the suspension will then compute expr and return its result. Matching a suspension with the special pattern syntax lazy(pattern) also computes the underlying expression and tries to bind it to pattern:

let lazy_option_map f x =
+match x with
+| lazy (Some x) -> Some (Lazy.force f x)
+| _ -> None

Note: If lazy patterns appear in multiple cases in a pattern-matching, lazy expressions may be forced even outside of the case ultimately selected by the pattern matching. In the example above, the suspension x is always computed.

Note: lazy_t is the built-in type constructor used by the compiler for the lazy keyword. You should not use it directly. Always use Lazy.t instead.

Note: Lazy.force is not concurrency-safe. If you use this module with multiple fibers, systhreads or domains, then you will need to add some locks. The module however ensures memory-safety, and hence, concurrently accessing this module will not lead to a crash but the behaviour is unspecified.

Note: if the program is compiled with the -rectypes option, ill-founded recursive definitions of the form let rec x = lazy x or let rec x = lazy(lazy(...(lazy x))) are accepted by the type-checker and lead, when forced, to ill-formed values that trigger infinite loops in the garbage collector and other parts of the run-time system. Without the -rectypes option, such ill-founded recursive definitions are rejected by the type-checker.

exception Undefined

Raised when forcing a suspension concurrently from multiple fibers, systhreads or domains, or when the suspension tries to force itself recursively.

val force : 'a t -> 'a

force x forces the suspension x and returns its result. If x has already been forced, Lazy.force x returns the same value again without recomputing it. If it raised an exception, the same exception is raised again.

Iterators

val map : ('a -> 'b) -> 'a t -> 'b t

map f x returns a suspension that, when forced, forces x and applies f to its value.

It is equivalent to lazy (f (Lazy.force x)).

  • since 4.13

Reasoning on already-forced suspensions

val is_val : 'a t -> bool

is_val x returns true if x has already been forced and did not raise an exception.

  • since 4.00
val from_val : 'a -> 'a t

from_val v evaluates v first (as any function would) and returns an already-forced suspension of its result. It is the same as let x = v in lazy x, but uses dynamic tests to optimize suspension creation in some cases.

  • since 4.00
val map_val : ('a -> 'b) -> 'a t -> 'b t

map_val f x applies f directly if x is already forced, otherwise it behaves as map f x.

When x is already forced, this behavior saves the construction of a suspension, but on the other hand it performs more work eagerly that may not be useful if you never force the function result.

If f raises an exception, it will be raised immediately when is_val x, or raised only when forcing the thunk otherwise.

If map_val f x does not raise an exception, then is_val (map_val f x) is equal to is_val x.

  • since 4.13

Advanced

The following definitions are for advanced uses only; they require familiary with the lazy compilation scheme to be used appropriately.

val from_fun : (unit -> 'a) -> 'a t

from_fun f is the same as lazy (f ()) but slightly more efficient.

It should only be used if the function f is already defined. In particular it is always less efficient to write from_fun (fun () -> expr) than lazy expr.

  • since 4.00
val force_val : 'a t -> 'a

force_val x forces the suspension x and returns its result. If x has already been forced, force_val x returns the same value again without recomputing it.

If the computation of x raises an exception, it is unspecified whether force_val x raises the same exception or Undefined.

  • raises Undefined

    if the forcing of x tries to force x itself recursively.

diff --git a/ocaml/Stdlib/Lexing/index.html b/ocaml/Stdlib/Lexing/index.html new file mode 100644 index 00000000..bfeb2567 --- /dev/null +++ b/ocaml/Stdlib/Lexing/index.html @@ -0,0 +1,2 @@ + +Lexing (ocaml.Stdlib.Lexing)

Module Stdlib.Lexing

The run-time library for lexers generated by ocamllex.

Positions

type position = {
  1. pos_fname : string;
  2. pos_lnum : int;
  3. pos_bol : int;
  4. pos_cnum : int;
}

A value of type position describes a point in a source file. pos_fname is the file name; pos_lnum is the line number; pos_bol is the offset of the beginning of the line (number of characters between the beginning of the lexbuf and the beginning of the line); pos_cnum is the offset of the position (number of characters between the beginning of the lexbuf and the position). The difference between pos_cnum and pos_bol is the character offset within the line (i.e. the column number, assuming each character is one column wide).

See the documentation of type lexbuf for information about how the lexing engine will manage positions.

val dummy_pos : position

A value of type position, guaranteed to be different from any valid position.

Lexer buffers

type lexbuf = {
  1. refill_buff : lexbuf -> unit;
  2. mutable lex_buffer : bytes;
  3. mutable lex_buffer_len : int;
  4. mutable lex_abs_pos : int;
  5. mutable lex_start_pos : int;
  6. mutable lex_curr_pos : int;
  7. mutable lex_last_pos : int;
  8. mutable lex_last_action : int;
  9. mutable lex_eof_reached : bool;
  10. mutable lex_mem : int array;
  11. mutable lex_start_p : position;
  12. mutable lex_curr_p : position;
}

The type of lexer buffers. A lexer buffer is the argument passed to the scanning functions defined by the generated scanners. The lexer buffer holds the current state of the scanner, plus a function to refill the buffer from the input.

Lexers can optionally maintain the lex_curr_p and lex_start_p position fields. This "position tracking" mode is the default, and it corresponds to passing ~with_position:true to functions that create lexer buffers. In this mode, the lexing engine and lexer actions are co-responsible for properly updating the position fields, as described in the next paragraph. When the mode is explicitly disabled (with ~with_position:false), the lexing engine will not touch the position fields and the lexer actions should be careful not to do it either; the lex_curr_p and lex_start_p field will then always hold the dummy_pos invalid position. Not tracking positions avoids allocations and memory writes and can significantly improve the performance of the lexer in contexts where lex_start_p and lex_curr_p are not needed.

Position tracking mode works as follows. At each token, the lexing engine will copy lex_curr_p to lex_start_p, then change the pos_cnum field of lex_curr_p by updating it with the number of characters read since the start of the lexbuf. The other fields are left unchanged by the lexing engine. In order to keep them accurate, they must be initialised before the first use of the lexbuf, and updated by the relevant lexer actions (i.e. at each end of line -- see also new_line).

val from_channel : ?with_positions:bool -> in_channel -> lexbuf

Create a lexer buffer on the given input channel. Lexing.from_channel inchan returns a lexer buffer which reads from the input channel inchan, at the current reading position.

val from_string : ?with_positions:bool -> string -> lexbuf

Create a lexer buffer which reads from the given string. Reading starts from the first character in the string. An end-of-input condition is generated when the end of the string is reached.

val from_function : ?with_positions:bool -> (bytes -> int -> int) -> lexbuf

Create a lexer buffer with the given function as its reading method. When the scanner needs more characters, it will call the given function, giving it a byte sequence s and a byte count n. The function should put n bytes or fewer in s, starting at index 0, and return the number of bytes provided. A return value of 0 means end of input.

val set_position : lexbuf -> position -> unit

Set the initial tracked input position for lexbuf to a custom value. Ignores pos_fname. See set_filename for changing this field.

  • since 4.11
val set_filename : lexbuf -> string -> unit

Set filename in the initial tracked position to file in lexbuf.

  • since 4.11
val with_positions : lexbuf -> bool

Tell whether the lexer buffer keeps track of position fields lex_curr_p / lex_start_p, as determined by the corresponding optional argument for functions that create lexer buffers (whose default value is true).

When with_positions is false, lexer actions should not modify position fields. Doing it nevertheless could re-enable the with_position mode and degrade performances.

Functions for lexer semantic actions

The following functions can be called from the semantic actions of lexer definitions (the ML code enclosed in braces that computes the value returned by lexing functions). They give access to the character string matched by the regular expression associated with the semantic action. These functions must be applied to the argument lexbuf, which, in the code generated by ocamllex, is bound to the lexer buffer passed to the parsing function.

val lexeme : lexbuf -> string

Lexing.lexeme lexbuf returns the string matched by the regular expression.

val lexeme_char : lexbuf -> int -> char

Lexing.lexeme_char lexbuf i returns character number i in the matched string.

val lexeme_start : lexbuf -> int

Lexing.lexeme_start lexbuf returns the offset in the input stream of the first character of the matched string. The first character of the stream has offset 0.

val lexeme_end : lexbuf -> int

Lexing.lexeme_end lexbuf returns the offset in the input stream of the character following the last character of the matched string. The first character of the stream has offset 0.

val lexeme_start_p : lexbuf -> position

Like lexeme_start, but return a complete position instead of an offset. When position tracking is disabled, the function returns dummy_pos.

val lexeme_end_p : lexbuf -> position

Like lexeme_end, but return a complete position instead of an offset. When position tracking is disabled, the function returns dummy_pos.

val new_line : lexbuf -> unit

Update the lex_curr_p field of the lexbuf to reflect the start of a new line. You can call this function in the semantic action of the rule that matches the end-of-line character. The function does nothing when position tracking is disabled.

  • since 3.11

Miscellaneous functions

val flush_input : lexbuf -> unit

Discard the contents of the buffer and reset the current position to 0. The next use of the lexbuf will trigger a refill.

diff --git a/ocaml/Stdlib/List/index.html b/ocaml/Stdlib/List/index.html new file mode 100644 index 00000000..fc7a1f8c --- /dev/null +++ b/ocaml/Stdlib/List/index.html @@ -0,0 +1,16 @@ + +List (ocaml.Stdlib.List)

Module Stdlib.List

List operations.

Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

The labeled version of this module can be used as described in the StdLabels module.

type 'a t = 'a list =
  1. | []
  2. | :: of 'a * 'a list

An alias for the type of lists.

val length : 'a list -> int

Return the length (number of elements) of the given list.

val compare_lengths : 'a list -> 'b list -> int

Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

  • since 4.05
val compare_length_with : 'a list -> int -> int

Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

  • since 4.05
val is_empty : 'a list -> bool

is_empty l is true if and only if l has no elements. It is equivalent to compare_length_with l 0 = 0.

  • since 5.1
val cons : 'a -> 'a list -> 'a list

cons x xs is x :: xs

  • since 4.03 (4.05 in ListLabels)
val hd : 'a list -> 'a

Return the first element of the given list.

  • raises Failure

    if the list is empty.

val tl : 'a list -> 'a list

Return the given list without its first element.

  • raises Failure

    if the list is empty.

val nth : 'a list -> int -> 'a

Return the n-th element of the given list. The first element (head of the list) is at position 0.

  • raises Failure

    if the list is too short.

val nth_opt : 'a list -> int -> 'a option

Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

  • since 4.05
val rev : 'a list -> 'a list

List reversal.

val init : int -> (int -> 'a) -> 'a list

init len f is [f 0; f 1; ...; f (len-1)], evaluated left to right.

  • since 4.06
val append : 'a list -> 'a list -> 'a list

append l0 l1 appends l1 to l0. Same function as the infix operator @.

  • since 5.1 this function is tail-recursive.
val rev_append : 'a list -> 'a list -> 'a list

rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2.

val concat : 'a list list -> 'a list

Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

val flatten : 'a list list -> 'a list

Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

Comparison

val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool

equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

  • since 4.12
val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int

compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

  • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
  • the empty list [] is strictly smaller than non-empty lists

Note: the cmp function will be called even if the lists have different lengths.

  • since 4.12

Iterators

val iter : ('a -> unit) -> 'a list -> unit

iter f [a1; ...; an] applies function f in turn to [a1; ...; an]. It is equivalent to f a1; f a2; ...; f an.

val iteri : (int -> 'a -> unit) -> 'a list -> unit

Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 4.00
val map : ('a -> 'b) -> 'a list -> 'b list

map f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f.

val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list

Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 4.00
val rev_map : ('a -> 'b) -> 'a list -> 'b list

rev_map f l gives the same result as rev (map f l), but is more efficient.

val filter_map : ('a -> 'b option) -> 'a list -> 'b list

filter_map f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

  • since 4.08
val concat_map : ('a -> 'b list) -> 'a list -> 'b list

concat_map f l gives the same result as concat (map f l). Tail-recursive.

  • since 4.10
val fold_left_map : + ('acc -> 'a -> 'acc * 'b) -> + 'acc -> + 'a list -> + 'acc * 'b list

fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

  • since 4.11
val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc

fold_left f init [b1; ...; bn] is f (... (f (f init b1) b2) ...) bn.

val fold_right : ('a -> 'acc -> 'acc) -> 'a list -> 'acc -> 'acc

fold_right f [a1; ...; an] init is f a1 (f a2 (... (f an init) ...)). Not tail-recursive.

Iterators on two lists

val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit

iter2 f [a1; ...; an] [b1; ...; bn] calls in turn f a1 b1; ...; f an bn.

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list

map2 f [a1; ...; an] [b1; ...; bn] is [f a1 b1; ...; f an bn].

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list

rev_map2 f l1 l2 gives the same result as rev (map2 f l1 l2), but is more efficient.

val fold_left2 : + ('acc -> 'a -> 'b -> 'acc) -> + 'acc -> + 'a list -> + 'b list -> + 'acc

fold_left2 f init [a1; ...; an] [b1; ...; bn] is f (... (f (f init a1 b1) a2 b2) ...) an bn.

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val fold_right2 : + ('a -> 'b -> 'acc -> 'acc) -> + 'a list -> + 'b list -> + 'acc -> + 'acc

fold_right2 f [a1; ...; an] [b1; ...; bn] init is f a1 b1 (f a2 b2 (... (f an bn init) ...)).

  • raises Invalid_argument

    if the two lists are determined to have different lengths. Not tail-recursive.

List scanning

val for_all : ('a -> bool) -> 'a list -> bool

for_all f [a1; ...; an] checks if all elements of the list satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an) for a non-empty list and true if the list is empty.

val exists : ('a -> bool) -> 'a list -> bool

exists f [a1; ...; an] checks if at least one element of the list satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an) for a non-empty list and false if the list is empty.

val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

Same as for_all, but for a two-argument predicate.

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

Same as exists, but for a two-argument predicate.

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val mem : 'a -> 'a list -> bool

mem a set is true if and only if a is equal to an element of set.

val memq : 'a -> 'a list -> bool

Same as mem, but uses physical equality instead of structural equality to compare list elements.

List searching

val find : ('a -> bool) -> 'a list -> 'a

find f l returns the first element of the list l that satisfies the predicate f.

  • raises Not_found

    if there is no value that satisfies f in the list l.

val find_opt : ('a -> bool) -> 'a list -> 'a option

find f l returns the first element of the list l that satisfies the predicate f. Returns None if there is no value that satisfies f in the list l.

  • since 4.05
val find_index : ('a -> bool) -> 'a list -> int option

find_index f xs returns Some i, where i is the index of the first element of the list xs that satisfies f x, if there is such an element.

It returns None if there is no such element.

  • since 5.1
val find_map : ('a -> 'b option) -> 'a list -> 'b option

find_map f l applies f to the elements of l in order, and returns the first result of the form Some v, or None if none exist.

  • since 4.10
val find_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b option

Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 5.1
val filter : ('a -> bool) -> 'a list -> 'a list

filter f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list is preserved.

val find_all : ('a -> bool) -> 'a list -> 'a list

find_all is another name for filter.

val filteri : (int -> 'a -> bool) -> 'a list -> 'a list

Same as filter, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 4.11
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list

partition f l returns a pair of lists (l1, l2), where l1 is the list of all the elements of l that satisfy the predicate f, and l2 is the list of all the elements of l that do not satisfy f. The order of the elements in the input list is preserved.

val partition_map : ('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list

partition_map f l returns a pair of lists (l1, l2) such that, for each element x of the input list l:

  • if f x is Left y1, then y1 is in l1, and
  • if f x is Right y2, then y2 is in l2.

The output elements are included in l1 and l2 in the same relative order as the corresponding input elements in l.

In particular, partition_map (fun x -> if f x then Left x else Right x) l is equivalent to partition f l.

  • since 4.12

Association lists

val assoc : 'a -> ('a * 'b) list -> 'b

assoc a l returns the value associated with key a in the list of pairs l. That is, assoc a [ ...; (a,b); ...] = b if (a,b) is the leftmost binding of a in list l.

  • raises Not_found

    if there is no value associated with a in the list l.

val assoc_opt : 'a -> ('a * 'b) list -> 'b option

assoc_opt a l returns the value associated with key a in the list of pairs l. That is, assoc_opt a [ ...; (a,b); ...] = Some b if (a,b) is the leftmost binding of a in list l. Returns None if there is no value associated with a in the list l.

  • since 4.05
val assq : 'a -> ('a * 'b) list -> 'b

Same as assoc, but uses physical equality instead of structural equality to compare keys.

val assq_opt : 'a -> ('a * 'b) list -> 'b option

Same as assoc_opt, but uses physical equality instead of structural equality to compare keys.

  • since 4.05
val mem_assoc : 'a -> ('a * 'b) list -> bool

Same as assoc, but simply return true if a binding exists, and false if no bindings exist for the given key.

val mem_assq : 'a -> ('a * 'b) list -> bool

Same as mem_assoc, but uses physical equality instead of structural equality to compare keys.

val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list

remove_assoc a l returns the list of pairs l without the first pair with key a, if any. Not tail-recursive.

val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list

Same as remove_assoc, but uses physical equality instead of structural equality to compare keys. Not tail-recursive.

Lists of pairs

val split : ('a * 'b) list -> 'a list * 'b list

Transform a list of pairs into a pair of lists: split [(a1,b1); ...; (an,bn)] is ([a1; ...; an], [b1; ...; bn]). Not tail-recursive.

val combine : 'a list -> 'b list -> ('a * 'b) list

Transform a pair of lists into a list of pairs: combine [a1; ...; an] [b1; ...; bn] is [(a1,b1); ...; (an,bn)].

  • raises Invalid_argument

    if the two lists have different lengths. Not tail-recursive.

Sorting

val sort : ('a -> 'a -> int) -> 'a list -> 'a list

Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, Stdlib.compare is a suitable comparison function. The resulting list is sorted in increasing order. sort is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space.

The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list

Same as sort, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order).

The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list

Same as sort or stable_sort, whichever is faster on typical input.

val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list

Same as sort, but also remove duplicates.

  • since 4.02 (4.03 in ListLabels)
val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

Merge two lists: Assuming that l1 and l2 are sorted according to the comparison function cmp, merge cmp l1 l2 will return a sorted list containing all the elements of l1 and l2. If several elements compare equal, the elements of l1 will be before the elements of l2. Not tail-recursive (sum of the lengths of the arguments).

Lists and Sequences

val to_seq : 'a list -> 'a Seq.t

Iterate on the list.

  • since 4.07
val of_seq : 'a Seq.t -> 'a list

Create a list from a sequence.

  • since 4.07
diff --git a/ocaml/Stdlib/ListLabels/index.html b/ocaml/Stdlib/ListLabels/index.html new file mode 100644 index 00000000..829e6973 --- /dev/null +++ b/ocaml/Stdlib/ListLabels/index.html @@ -0,0 +1,16 @@ + +ListLabels (ocaml.Stdlib.ListLabels)

Module Stdlib.ListLabels

List operations.

Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

The labeled version of this module can be used as described in the StdLabels module.

type 'a t = 'a list =
  1. | []
  2. | :: of 'a * 'a list

An alias for the type of lists.

val length : 'a list -> int

Return the length (number of elements) of the given list.

val compare_lengths : 'a list -> 'b list -> int

Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

  • since 4.05
val compare_length_with : 'a list -> len:int -> int

Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

  • since 4.05
val is_empty : 'a list -> bool

is_empty l is true if and only if l has no elements. It is equivalent to compare_length_with l 0 = 0.

  • since 5.1
val cons : 'a -> 'a list -> 'a list

cons x xs is x :: xs

  • since 4.05
val hd : 'a list -> 'a

Return the first element of the given list.

  • raises Failure

    if the list is empty.

val tl : 'a list -> 'a list

Return the given list without its first element.

  • raises Failure

    if the list is empty.

val nth : 'a list -> int -> 'a

Return the n-th element of the given list. The first element (head of the list) is at position 0.

  • raises Failure

    if the list is too short.

val nth_opt : 'a list -> int -> 'a option

Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

  • since 4.05
val rev : 'a list -> 'a list

List reversal.

val init : len:int -> f:(int -> 'a) -> 'a list

init ~len ~f is [f 0; f 1; ...; f (len-1)], evaluated left to right.

  • since 4.06
val append : 'a list -> 'a list -> 'a list

append l0 l1 appends l1 to l0. Same function as the infix operator @.

  • since 5.1 this function is tail-recursive.
val rev_append : 'a list -> 'a list -> 'a list

rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2.

val concat : 'a list list -> 'a list

Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

val flatten : 'a list list -> 'a list

Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

Comparison

val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool

equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

  • since 4.12
val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int

compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

  • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
  • the empty list [] is strictly smaller than non-empty lists

Note: the cmp function will be called even if the lists have different lengths.

  • since 4.12

Iterators

val iter : f:('a -> unit) -> 'a list -> unit

iter ~f [a1; ...; an] applies function f in turn to [a1; ...; an]. It is equivalent to f a1; f a2; ...; f an.

val iteri : f:(int -> 'a -> unit) -> 'a list -> unit

Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 4.00
val map : f:('a -> 'b) -> 'a list -> 'b list

map ~f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f.

val mapi : f:(int -> 'a -> 'b) -> 'a list -> 'b list

Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 4.00
val rev_map : f:('a -> 'b) -> 'a list -> 'b list

rev_map ~f l gives the same result as rev (map f l), but is more efficient.

val filter_map : f:('a -> 'b option) -> 'a list -> 'b list

filter_map ~f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

  • since 4.08
val concat_map : f:('a -> 'b list) -> 'a list -> 'b list

concat_map ~f l gives the same result as concat (map f l). Tail-recursive.

  • since 4.10
val fold_left_map : + f:('acc -> 'a -> 'acc * 'b) -> + init:'acc -> + 'a list -> + 'acc * 'b list

fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

  • since 4.11
val fold_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a list -> 'acc

fold_left ~f ~init [b1; ...; bn] is f (... (f (f init b1) b2) ...) bn.

val fold_right : f:('a -> 'acc -> 'acc) -> 'a list -> init:'acc -> 'acc

fold_right ~f [a1; ...; an] ~init is f a1 (f a2 (... (f an init) ...)). Not tail-recursive.

Iterators on two lists

val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit

iter2 ~f [a1; ...; an] [b1; ...; bn] calls in turn f a1 b1; ...; f an bn.

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list

map2 ~f [a1; ...; an] [b1; ...; bn] is [f a1 b1; ...; f an bn].

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list

rev_map2 ~f l1 l2 gives the same result as rev (map2 f l1 l2), but is more efficient.

val fold_left2 : + f:('acc -> 'a -> 'b -> 'acc) -> + init:'acc -> + 'a list -> + 'b list -> + 'acc

fold_left2 ~f ~init [a1; ...; an] [b1; ...; bn] is f (... (f (f init a1 b1) a2 b2) ...) an bn.

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val fold_right2 : + f:('a -> 'b -> 'acc -> 'acc) -> + 'a list -> + 'b list -> + init:'acc -> + 'acc

fold_right2 ~f [a1; ...; an] [b1; ...; bn] ~init is f a1 b1 (f a2 b2 (... (f an bn init) ...)).

  • raises Invalid_argument

    if the two lists are determined to have different lengths. Not tail-recursive.

List scanning

val for_all : f:('a -> bool) -> 'a list -> bool

for_all ~f [a1; ...; an] checks if all elements of the list satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an) for a non-empty list and true if the list is empty.

val exists : f:('a -> bool) -> 'a list -> bool

exists ~f [a1; ...; an] checks if at least one element of the list satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an) for a non-empty list and false if the list is empty.

val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool

Same as for_all, but for a two-argument predicate.

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool

Same as exists, but for a two-argument predicate.

  • raises Invalid_argument

    if the two lists are determined to have different lengths.

val mem : 'a -> set:'a list -> bool

mem a ~set is true if and only if a is equal to an element of set.

val memq : 'a -> set:'a list -> bool

Same as mem, but uses physical equality instead of structural equality to compare list elements.

List searching

val find : f:('a -> bool) -> 'a list -> 'a

find ~f l returns the first element of the list l that satisfies the predicate f.

  • raises Not_found

    if there is no value that satisfies f in the list l.

val find_opt : f:('a -> bool) -> 'a list -> 'a option

find ~f l returns the first element of the list l that satisfies the predicate f. Returns None if there is no value that satisfies f in the list l.

  • since 4.05
val find_index : f:('a -> bool) -> 'a list -> int option

find_index ~f xs returns Some i, where i is the index of the first element of the list xs that satisfies f x, if there is such an element.

It returns None if there is no such element.

  • since 5.1
val find_map : f:('a -> 'b option) -> 'a list -> 'b option

find_map ~f l applies f to the elements of l in order, and returns the first result of the form Some v, or None if none exist.

  • since 4.10
val find_mapi : f:(int -> 'a -> 'b option) -> 'a list -> 'b option

Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 5.1
val filter : f:('a -> bool) -> 'a list -> 'a list

filter ~f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list is preserved.

val find_all : f:('a -> bool) -> 'a list -> 'a list

find_all is another name for filter.

val filteri : f:(int -> 'a -> bool) -> 'a list -> 'a list

Same as filter, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

  • since 4.11
val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list

partition ~f l returns a pair of lists (l1, l2), where l1 is the list of all the elements of l that satisfy the predicate f, and l2 is the list of all the elements of l that do not satisfy f. The order of the elements in the input list is preserved.

val partition_map : f:('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list

partition_map f l returns a pair of lists (l1, l2) such that, for each element x of the input list l:

  • if f x is Left y1, then y1 is in l1, and
  • if f x is Right y2, then y2 is in l2.

The output elements are included in l1 and l2 in the same relative order as the corresponding input elements in l.

In particular, partition_map (fun x -> if f x then Left x else Right x) l is equivalent to partition f l.

  • since 4.12

Association lists

val assoc : 'a -> ('a * 'b) list -> 'b

assoc a l returns the value associated with key a in the list of pairs l. That is, assoc a [ ...; (a,b); ...] = b if (a,b) is the leftmost binding of a in list l.

  • raises Not_found

    if there is no value associated with a in the list l.

val assoc_opt : 'a -> ('a * 'b) list -> 'b option

assoc_opt a l returns the value associated with key a in the list of pairs l. That is, assoc_opt a [ ...; (a,b); ...] = Some b if (a,b) is the leftmost binding of a in list l. Returns None if there is no value associated with a in the list l.

  • since 4.05
val assq : 'a -> ('a * 'b) list -> 'b

Same as assoc, but uses physical equality instead of structural equality to compare keys.

val assq_opt : 'a -> ('a * 'b) list -> 'b option

Same as assoc_opt, but uses physical equality instead of structural equality to compare keys.

  • since 4.05
val mem_assoc : 'a -> map:('a * 'b) list -> bool

Same as assoc, but simply return true if a binding exists, and false if no bindings exist for the given key.

val mem_assq : 'a -> map:('a * 'b) list -> bool

Same as mem_assoc, but uses physical equality instead of structural equality to compare keys.

val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list

remove_assoc a l returns the list of pairs l without the first pair with key a, if any. Not tail-recursive.

val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list

Same as remove_assoc, but uses physical equality instead of structural equality to compare keys. Not tail-recursive.

Lists of pairs

val split : ('a * 'b) list -> 'a list * 'b list

Transform a list of pairs into a pair of lists: split [(a1,b1); ...; (an,bn)] is ([a1; ...; an], [b1; ...; bn]). Not tail-recursive.

val combine : 'a list -> 'b list -> ('a * 'b) list

Transform a pair of lists into a list of pairs: combine [a1; ...; an] [b1; ...; bn] is [(a1,b1); ...; (an,bn)].

  • raises Invalid_argument

    if the two lists have different lengths. Not tail-recursive.

Sorting

val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list

Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, Stdlib.compare is a suitable comparison function. The resulting list is sorted in increasing order. sort is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space.

The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list

Same as sort, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order).

The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

val fast_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list

Same as sort or stable_sort, whichever is faster on typical input.

val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list

Same as sort, but also remove duplicates.

  • since 4.03
val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

Merge two lists: Assuming that l1 and l2 are sorted according to the comparison function cmp, merge ~cmp l1 l2 will return a sorted list containing all the elements of l1 and l2. If several elements compare equal, the elements of l1 will be before the elements of l2. Not tail-recursive (sum of the lengths of the arguments).

Lists and Sequences

val to_seq : 'a list -> 'a Seq.t

Iterate on the list.

  • since 4.07
val of_seq : 'a Seq.t -> 'a list

Create a list from a sequence.

  • since 4.07
diff --git a/ocaml/Stdlib/Map/Make/argument-1-Ord/index.html b/ocaml/Stdlib/Map/Make/argument-1-Ord/index.html new file mode 100644 index 00000000..3a3e076f --- /dev/null +++ b/ocaml/Stdlib/Map/Make/argument-1-Ord/index.html @@ -0,0 +1,2 @@ + +Ord (ocaml.Stdlib.Map.Make.Ord)

Parameter Make.Ord

type t

The type of the map keys.

val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Stdlib/Map/Make/index.html b/ocaml/Stdlib/Map/Make/index.html new file mode 100644 index 00000000..2baea216 --- /dev/null +++ b/ocaml/Stdlib/Map/Make/index.html @@ -0,0 +1,8 @@ + +Make (ocaml.Stdlib.Map.Make)

Module Map.Make

Functor building an implementation of the map structure given a totally ordered type.

Parameters

module Ord : OrderedType

Signature

Maps

type key = Ord.t

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Stdlib/Map/index.html b/ocaml/Stdlib/Map/index.html new file mode 100644 index 00000000..9405ef35 --- /dev/null +++ b/ocaml/Stdlib/Map/index.html @@ -0,0 +1,13 @@ + +Map (ocaml.Stdlib.Map)

Module Stdlib.Map

Association tables over ordered types.

This module implements applicative association tables, also known as finite maps or dictionaries, given a total ordering function over the keys. All operations over maps are purely applicative (no side-effects). The implementation uses balanced binary trees, and therefore searching and insertion take time logarithmic in the size of the map.

For instance:

module IntPairs =
+  struct
+    type t = int * int
+    let compare (x0,y0) (x1,y1) =
+      match Stdlib.compare x0 x1 with
+          0 -> Stdlib.compare y0 y1
+        | c -> c
+  end
+
+module PairsMap = Map.Make(IntPairs)
+
+let m = PairsMap.(empty |> add (0,1) "hello" |> add (1,0) "world")

This creates a new module PairsMap, with a new type 'a PairsMap.t of maps from int * int to 'a. In this example, m contains string values so its type is string PairsMap.t.

module type OrderedType = sig ... end

Input signature of the functor Make.

module type S = sig ... end

Output signature of the functor Make.

module Make (Ord : OrderedType) : S with type key = Ord.t

Functor building an implementation of the map structure given a totally ordered type.

diff --git a/ocaml/Stdlib/Map/module-type-OrderedType/index.html b/ocaml/Stdlib/Map/module-type-OrderedType/index.html new file mode 100644 index 00000000..3d1d39ae --- /dev/null +++ b/ocaml/Stdlib/Map/module-type-OrderedType/index.html @@ -0,0 +1,2 @@ + +OrderedType (ocaml.Stdlib.Map.OrderedType)

Module type Map.OrderedType

Input signature of the functor Make.

type t

The type of the map keys.

val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Stdlib/Map/module-type-S/index.html b/ocaml/Stdlib/Map/module-type-S/index.html new file mode 100644 index 00000000..fde684c5 --- /dev/null +++ b/ocaml/Stdlib/Map/module-type-S/index.html @@ -0,0 +1,8 @@ + +S (ocaml.Stdlib.Map.S)

Module type Map.S

Output signature of the functor Make.

Maps

type key

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Stdlib/Marshal/index.html b/ocaml/Stdlib/Marshal/index.html new file mode 100644 index 00000000..83e98ec0 --- /dev/null +++ b/ocaml/Stdlib/Marshal/index.html @@ -0,0 +1,2 @@ + +Marshal (ocaml.Stdlib.Marshal)

Module Stdlib.Marshal

Marshaling of data structures.

This module provides functions to encode arbitrary data structures as sequences of bytes, which can then be written on a file or sent over a pipe or network connection. The bytes can then be read back later, possibly in another process, and decoded back into a data structure. The format for the byte sequences is compatible across all machines for a given version of OCaml.

Warning: marshaling is currently not type-safe. The type of marshaled data is not transmitted along the value of the data, making it impossible to check that the data read back possesses the type expected by the context. In particular, the result type of the Marshal.from_* functions is given as 'a, but this is misleading: the returned OCaml value does not possess type 'a for all 'a; it has one, unique type which cannot be determined at compile-time. The programmer should explicitly give the expected type of the returned value, using the following syntax:

  • (Marshal.from_channel chan : type). Anything can happen at run-time if the object in the file does not belong to the given type.

Values of extensible variant types, for example exceptions (of extensible type exn), returned by the unmarshaller should not be pattern-matched over through match ... with or try ... with, because unmarshalling does not preserve the information required for matching their constructors. Structural equalities with other extensible variant values does not work either. Most other uses such as Printexc.to_string, will still work as expected.

The representation of marshaled values is not human-readable, and uses bytes that are not printable characters. Therefore, input and output channels used in conjunction with Marshal.to_channel and Marshal.from_channel must be opened in binary mode, using e.g. open_out_bin or open_in_bin; channels opened in text mode will cause unmarshaling errors on platforms where text channels behave differently than binary channels, e.g. Windows.

type extern_flags =
  1. | No_sharing
    (*

    Don't preserve sharing

    *)
  2. | Closures
    (*

    Send function closures

    *)
  3. | Compat_32
    (*

    Ensure 32-bit compatibility

    *)

The flags to the Marshal.to_* functions below.

val to_channel : out_channel -> 'a -> extern_flags list -> unit

Marshal.to_channel chan v flags writes the representation of v on channel chan. The flags argument is a possibly empty list of flags that governs the marshaling behavior with respect to sharing, functional values, and compatibility between 32- and 64-bit platforms.

If flags does not contain Marshal.No_sharing, circularities and sharing inside the value v are detected and preserved in the sequence of bytes produced. In particular, this guarantees that marshaling always terminates. Sharing between values marshaled by successive calls to Marshal.to_channel is neither detected nor preserved, though. If flags contains Marshal.No_sharing, sharing is ignored. This results in faster marshaling if v contains no shared substructures, but may cause slower marshaling and larger byte representations if v actually contains sharing, or even non-termination if v contains cycles.

If flags does not contain Marshal.Closures, marshaling fails when it encounters a functional value inside v: only 'pure' data structures, containing neither functions nor objects, can safely be transmitted between different programs. If flags contains Marshal.Closures, functional values will be marshaled as a the position in the code of the program together with the values corresponding to the free variables captured in the closure. In this case, the output of marshaling can only be read back in processes that run exactly the same program, with exactly the same compiled code. (This is checked at un-marshaling time, using an MD5 digest of the code transmitted along with the code position.)

The exact definition of which free variables are captured in a closure is not specified and can vary between bytecode and native code (and according to optimization flags). In particular, a function value accessing a global reference may or may not include the reference in its closure. If it does, unmarshaling the corresponding closure will create a new reference, different from the global one.

If flags contains Marshal.Compat_32, marshaling fails when it encounters an integer value outside the range [-2{^30}, 2{^30}-1] of integers that are representable on a 32-bit platform. This ensures that marshaled data generated on a 64-bit platform can be safely read back on a 32-bit platform. If flags does not contain Marshal.Compat_32, integer values outside the range [-2{^30}, 2{^30}-1] are marshaled, and can be read back on a 64-bit platform, but will cause an error at un-marshaling time when read back on a 32-bit platform. The Mashal.Compat_32 flag only matters when marshaling is performed on a 64-bit platform; it has no effect if marshaling is performed on a 32-bit platform.

  • raises Failure

    if chan is not in binary mode.

val to_bytes : 'a -> extern_flags list -> bytes

Marshal.to_bytes v flags returns a byte sequence containing the representation of v. The flags argument has the same meaning as for Marshal.to_channel.

  • since 4.02
val to_string : 'a -> extern_flags list -> string

Same as to_bytes but return the result as a string instead of a byte sequence.

val to_buffer : bytes -> int -> int -> 'a -> extern_flags list -> int

Marshal.to_buffer buff ofs len v flags marshals the value v, storing its byte representation in the sequence buff, starting at index ofs, and writing at most len bytes. It returns the number of bytes actually written to the sequence. If the byte representation of v does not fit in len characters, the exception Failure is raised.

val from_channel : in_channel -> 'a

Marshal.from_channel chan reads from channel chan the byte representation of a structured value, as produced by one of the Marshal.to_* functions, and reconstructs and returns the corresponding value.

  • raises End_of_file

    if chan is already at the end of the file.

  • raises Failure

    if the end of the file is reached during unmarshalling itself or if chan is not in binary mode.

val from_bytes : bytes -> int -> 'a

Marshal.from_bytes buff ofs unmarshals a structured value like Marshal.from_channel does, except that the byte representation is not read from a channel, but taken from the byte sequence buff, starting at position ofs. The byte sequence is not mutated.

  • since 4.02
val from_string : string -> int -> 'a

Same as from_bytes but take a string as argument instead of a byte sequence.

val header_size : int

The bytes representing a marshaled value are composed of a fixed-size header and a variable-sized data part, whose size can be determined from the header. Marshal.header_size is the size, in bytes, of the header. Marshal.data_size buff ofs is the size, in bytes, of the data part, assuming a valid header is stored in buff starting at position ofs. Finally, Marshal.total_size buff ofs is the total size, in bytes, of the marshaled value. Both Marshal.data_size and Marshal.total_size raise Failure if buff, ofs does not contain a valid header.

To read the byte representation of a marshaled value into a byte sequence, the program needs to read first Marshal.header_size bytes into the sequence, then determine the length of the remainder of the representation using Marshal.data_size, make sure the sequence is large enough to hold the remaining data, then read it, and finally call Marshal.from_bytes to unmarshal the value.

val data_size : bytes -> int -> int
val total_size : bytes -> int -> int
diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/Make/argument-1-H/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/Make/argument-1-H/index.html new file mode 100644 index 00000000..e4b94669 --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/Make/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (ocaml.Stdlib.MoreLabels.Hashtbl.Make.H)

Parameter Make.H

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/Make/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/Make/index.html new file mode 100644 index 00000000..6296fe4c --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Stdlib.MoreLabels.Hashtbl.Make)

Module Hashtbl.Make

Functor building an implementation of the hashtable structure. The functor Hashtbl.Make returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the hashing and equality functions specified in the functor argument H instead of generic equality and hashing. Since the hash function is not seeded, the create operation of the result structure always returns non-randomized hash tables.

Parameters

module H : HashedType

Signature

type key = H.t
type 'a t = 'a Hashtbl.Make(H).t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key:key -> data:'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key:key -> data:'a -> unit
val mem : 'a t -> key -> bool
val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/argument-1-H/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/argument-1-H/index.html new file mode 100644 index 00000000..278b6f30 --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (ocaml.Stdlib.MoreLabels.Hashtbl.MakeSeeded.H)

Parameter MakeSeeded.H

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val seeded_hash : int -> t -> int

A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/index.html new file mode 100644 index 00000000..d4af3027 --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/index.html @@ -0,0 +1,2 @@ + +MakeSeeded (ocaml.Stdlib.MoreLabels.Hashtbl.MakeSeeded)

Module Hashtbl.MakeSeeded

Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

  • since 4.00

Parameters

Signature

type key = H.t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key:key -> data:'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key:key -> data:'a -> unit
val mem : 'a t -> key -> bool
val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/index.html new file mode 100644 index 00000000..023d1e9e --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/index.html @@ -0,0 +1,91 @@ + +Hashtbl (ocaml.Stdlib.MoreLabels.Hashtbl)

Module MoreLabels.Hashtbl

Hash tables and hash functions.

Hash tables are hashed association tables, with in-place modification. Because most operations on a hash table modify their input, they're more commonly used in imperative code. The lookup of the value associated with a key (see find, find_opt) is normally very fast, often faster than the equivalent lookup in Map.

The functors Make and MakeSeeded can be used when performance or flexibility are key. The user provides custom equality and hash functions for the key type, and obtains a custom hash table type for this particular type of key.

Warning a hash table is only as good as the hash function. A bad hash function will turn the table into a degenerate association list, with linear time lookup instead of constant time lookup.

The polymorphic t hash table is useful in simpler cases or in interactive environments. It uses the polymorphic hash function defined in the OCaml runtime (at the time of writing, it's SipHash), as well as the polymorphic equality (=).

See the examples section.

Unsynchronized accesses

Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a Mutex.t).

Generic interface

type (!'a, !'b) t = ('a, 'b) Hashtbl.t

The type of hash tables from type 'a to type 'b.

val create : ?random:bool -> int -> ('a, 'b) t

Hashtbl.create n creates a new, empty hash table, with initial size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess.

The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

  • before 4.00

    the ~random parameter was not present and all hash tables were created in non-randomized mode.

val clear : ('a, 'b) t -> unit

Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

val reset : ('a, 'b) t -> unit

Empty a hash table and shrink the size of the bucket table to its initial size.

  • since 4.00
val copy : ('a, 'b) t -> ('a, 'b) t

Return a copy of the given hashtable.

val add : ('a, 'b) t -> key:'a -> data:'b -> unit

Hashtbl.add tbl ~key ~data adds a binding of key to data in table tbl.

Warning: Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

If you desire the classic behavior of replacing elements, see replace.

val find : ('a, 'b) t -> 'a -> 'b

Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

val find_opt : ('a, 'b) t -> 'a -> 'b option

Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

  • since 4.05
val find_all : ('a, 'b) t -> 'a -> 'b list

Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

val mem : ('a, 'b) t -> 'a -> bool

Hashtbl.mem tbl x checks if x is bound in tbl.

val remove : ('a, 'b) t -> 'a -> unit

Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

val replace : ('a, 'b) t -> key:'a -> data:'b -> unit

Hashtbl.replace tbl ~key ~data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit

Hashtbl.iter ~f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

The behavior is not specified if the hash table is modified by f during the iteration.

val filter_map_inplace : + f:(key:'a -> data:'b -> 'b option) -> + ('a, 'b) t -> + unit

Hashtbl.filter_map_inplace ~f tbl applies f to all bindings in table tbl and update each binding depending on the result of f. If f returns None, the binding is discarded. If it returns Some new_val, the binding is update to associate the key to new_val.

Other comments for iter apply as well.

  • since 4.03
val fold : + f:(key:'a -> data:'b -> 'acc -> 'acc) -> + ('a, 'b) t -> + init:'acc -> + 'acc

Hashtbl.fold ~f tbl ~init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in tbl, and d1 ... dN are the associated values. Each binding is presented exactly once to f.

The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

The behavior is not specified if the hash table is modified by f during the iteration.

val length : ('a, 'b) t -> int

Hashtbl.length tbl returns the number of bindings in tbl. It takes constant time. Multiple bindings are counted once each, so Hashtbl.length gives the number of times Hashtbl.iter calls its first argument.

val randomize : unit -> unit

After a call to Hashtbl.randomize(), hash tables are created in randomized mode by default: create returns randomized hash tables, unless the ~random:false optional parameter is given. The same effect can be achieved by setting the R parameter in the OCAMLRUNPARAM environment variable.

It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in create call Hashtbl.randomize() at initialization time before any domains are created.

Note that once Hashtbl.randomize() was called, there is no way to revert to the non-randomized default behavior of create. This is intentional. Non-randomized hash tables can still be created using Hashtbl.create ~random:false.

  • since 4.00
val is_randomized : unit -> bool

Return true if the tables are currently created in randomized mode by default, false otherwise.

  • since 4.03
val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t

Return a copy of the given hashtable. Unlike copy, rebuild h re-hashes all the (key, value) entries of the original table h. The returned hash table is randomized if h was randomized, or the optional random parameter is true, or if the default is to create randomized hash tables; see create for more information.

rebuild can safely be used to import a hash table built by an old version of the Hashtbl module, then marshaled to persistent storage. After unmarshaling, apply rebuild to produce a hash table for the current version of the Hashtbl module.

  • since 4.12
type statistics = Hashtbl.statistics = {
  1. num_bindings : int;
    (*

    Number of bindings present in the table. Same value as returned by length.

    *)
  2. num_buckets : int;
    (*

    Number of buckets in the table.

    *)
  3. max_bucket_length : int;
    (*

    Maximal number of bindings per bucket.

    *)
  4. bucket_histogram : int array;
    (*

    Histogram of bucket sizes. This array histo has length max_bucket_length + 1. The value of histo.(i) is the number of buckets whose size is i.

    *)
}
  • since 4.00
val stats : ('a, 'b) t -> statistics

Hashtbl.stats tbl returns statistics about the table tbl: number of buckets, size of the biggest bucket, distribution of buckets by size.

  • since 4.00

Hash tables and Sequences

val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t

Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first.

The behavior is not specified if the hash table is modified during the iteration.

  • since 4.07
val to_seq_keys : ('a, _) t -> 'a Seq.t

Same as Seq.map fst (to_seq m)

  • since 4.07
val to_seq_values : (_, 'b) t -> 'b Seq.t

Same as Seq.map snd (to_seq m)

  • since 4.07
val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

Add the given bindings to the table, using add

  • since 4.07
val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

Add the given bindings to the table, using replace

  • since 4.07
val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t

Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using replace_seq, which means that if two pairs have the same key, only the latest one will appear in the table.

  • since 4.07

Functorial interface

The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins.

For instance, one might want to specialize a table for integer keys:

module IntHash =
+  struct
+    type t = int
+    let equal i j = i=j
+    let hash i = i land max_int
+  end
+
+module IntHashtbl = Hashtbl.Make(IntHash)
+
+let h = IntHashtbl.create 17 in
+IntHashtbl.add h 12 "hello"

This creates a new module IntHashtbl, with a new type 'a + IntHashtbl.t of tables from int to 'a. In this example, h contains string values so its type is string IntHashtbl.t.

Note that the new type 'a IntHashtbl.t is not compatible with the type ('a,'b) Hashtbl.t of the generic interface. For example, Hashtbl.length h would not type-check, you must use IntHashtbl.length.

module type HashedType = sig ... end

The input signature of the functor Make.

module type S = sig ... end

The output signature of the functor Make.

module Make + (H : HashedType) : + S with type key = H.t and type 'a t = 'a Hashtbl.Make(H).t

Functor building an implementation of the hashtable structure. The functor Hashtbl.Make returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the hashing and equality functions specified in the functor argument H instead of generic equality and hashing. Since the hash function is not seeded, the create operation of the result structure always returns non-randomized hash tables.

module type SeededHashedType = sig ... end

The input signature of the functor MakeSeeded.

module type SeededS = sig ... end

The output signature of the functor MakeSeeded.

module MakeSeeded + (H : SeededHashedType) : + SeededS with type key = H.t and type 'a t = 'a Hashtbl.MakeSeeded(H).t

Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

The polymorphic hash functions

val hash : 'a -> int

Hashtbl.hash x associates a nonnegative integer to any value of any type. It is guaranteed that if x = y or Stdlib.compare x y = 0, then hash x = hash y. Moreover, hash always terminates, even on cyclic structures.

val seeded_hash : int -> 'a -> int

A variant of hash that is further parameterized by an integer seed.

  • since 4.00
val hash_param : int -> int -> 'a -> int

Hashtbl.hash_param meaningful total x computes a hash value for x, with the same properties as for hash. The two extra integer parameters meaningful and total give more precise control over hashing. Hashing performs a breadth-first, left-to-right traversal of the structure x, stopping after meaningful meaningful nodes were encountered, or total nodes (meaningful or not) were encountered. If total as specified by the user exceeds a certain value, currently 256, then it is capped to that value. Meaningful nodes are: integers; floating-point numbers; strings; characters; booleans; and constant constructors. Larger values of meaningful and total means that more nodes are taken into account to compute the final hash value, and therefore collisions are less likely to happen. However, hashing takes longer. The parameters meaningful and total govern the tradeoff between accuracy and speed. As default choices, hash and seeded_hash take meaningful = 10 and total = 100.

val seeded_hash_param : int -> int -> int -> 'a -> int

A variant of hash_param that is further parameterized by an integer seed. Usage: Hashtbl.seeded_hash_param meaningful total seed x.

  • since 4.00

Examples

Basic Example

(* 0...99 *)
+let seq = Seq.ints 0 |> Seq.take 100
+
+(* build from Seq.t *)
+# let tbl =
+    seq
+    |> Seq.map (fun x -> x, string_of_int x)
+    |> Hashtbl.of_seq
+val tbl : (int, string) Hashtbl.t = <abstr>
+
+# Hashtbl.length tbl
+- : int = 100
+
+# Hashtbl.find_opt tbl 32
+- : string option = Some "32"
+
+# Hashtbl.find_opt tbl 166
+- : string option = None
+
+# Hashtbl.replace tbl 166 "one six six"
+- : unit = ()
+
+# Hashtbl.find_opt tbl 166
+- : string option = Some "one six six"
+
+# Hashtbl.length tbl
+- : int = 101

Counting Elements

Given a sequence of elements (here, a Seq.t), we want to count how many times each distinct element occurs in the sequence. A simple way to do this, assuming the elements are comparable and hashable, is to use a hash table that maps elements to their number of occurrences.

Here we illustrate that principle using a sequence of (ascii) characters (type char). We use a custom Char_tbl specialized for char.

# module Char_tbl = Hashtbl.Make(struct
+    type t = char
+    let equal = Char.equal
+    let hash = Hashtbl.hash
+  end)
+
+(*  count distinct occurrences of chars in [seq] *)
+# let count_chars (seq : char Seq.t) : _ list =
+    let counts = Char_tbl.create 16 in
+    Seq.iter
+      (fun c ->
+        let count_c =
+          Char_tbl.find_opt counts c
+          |> Option.value ~default:0
+        in
+        Char_tbl.replace counts c (count_c + 1))
+      seq;
+    (* turn into a list *)
+    Char_tbl.fold (fun c n l -> (c,n) :: l) counts []
+      |> List.sort (fun (c1,_)(c2,_) -> Char.compare c1 c2)
+val count_chars : Char_tbl.key Seq.t -> (Char.t * int) list = <fun>
+
+(* basic seq from a string *)
+# let seq = String.to_seq "hello world, and all the camels in it!"
+val seq : char Seq.t = <fun>
+
+# count_chars seq
+- : (Char.t * int) list =
+[(' ', 7); ('!', 1); (',', 1); ('a', 3); ('c', 1); ('d', 2); ('e', 3);
+ ('h', 2); ('i', 2); ('l', 6); ('m', 1); ('n', 2); ('o', 2); ('r', 1);
+ ('s', 1); ('t', 2); ('w', 1)]
+
+(* "abcabcabc..." *)
+# let seq2 =
+    Seq.cycle (String.to_seq "abc") |> Seq.take 31
+val seq2 : char Seq.t = <fun>
+
+# String.of_seq seq2
+- : String.t = "abcabcabcabcabcabcabcabcabcabca"
+
+# count_chars seq2
+- : (Char.t * int) list = [('a', 11); ('b', 10); ('c', 10)]
diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-HashedType/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-HashedType/index.html new file mode 100644 index 00000000..b559c847 --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-HashedType/index.html @@ -0,0 +1,2 @@ + +HashedType (ocaml.Stdlib.MoreLabels.Hashtbl.HashedType)

Module type Hashtbl.HashedType

The input signature of the functor Make.

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-S/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-S/index.html new file mode 100644 index 00000000..f04b8f3e --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Stdlib.MoreLabels.Hashtbl.S)

Module type Hashtbl.S

The output signature of the functor Make.

type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key:key -> data:'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key:key -> data:'a -> unit
val mem : 'a t -> key -> bool
val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededHashedType/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededHashedType/index.html new file mode 100644 index 00000000..61a4039f --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededHashedType/index.html @@ -0,0 +1,2 @@ + +SeededHashedType (ocaml.Stdlib.MoreLabels.Hashtbl.SeededHashedType)

Module type Hashtbl.SeededHashedType

The input signature of the functor MakeSeeded.

  • since 4.00
type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val seeded_hash : int -> t -> int

A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededS/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededS/index.html new file mode 100644 index 00000000..59ffdb8c --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededS/index.html @@ -0,0 +1,2 @@ + +SeededS (ocaml.Stdlib.MoreLabels.Hashtbl.SeededS)

Module type Hashtbl.SeededS

The output signature of the functor MakeSeeded.

  • since 4.00
type key
type !'a t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key:key -> data:'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key:key -> data:'a -> unit
val mem : 'a t -> key -> bool
val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t
  • since 4.07
diff --git a/ocaml/Stdlib/MoreLabels/Map/Make/argument-1-Ord/index.html b/ocaml/Stdlib/MoreLabels/Map/Make/argument-1-Ord/index.html new file mode 100644 index 00000000..f7d92471 --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Map/Make/argument-1-Ord/index.html @@ -0,0 +1,2 @@ + +Ord (ocaml.Stdlib.MoreLabels.Map.Make.Ord)

Parameter Make.Ord

type t

The type of the map keys.

val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Stdlib/MoreLabels/Map/Make/index.html b/ocaml/Stdlib/MoreLabels/Map/Make/index.html new file mode 100644 index 00000000..9cf6b2da --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Map/Make/index.html @@ -0,0 +1,8 @@ + +Make (ocaml.Stdlib.MoreLabels.Map.Make)

Module Map.Make

Functor building an implementation of the map structure given a totally ordered type.

Parameters

module Ord : OrderedType

Signature

Maps

type key = Ord.t

The type of the map keys.

type 'a t = 'a Map.Make(Ord).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key:key -> data:'a -> 'a t -> 'a t

add ~key ~data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key:key -> data:'a -> 'a list t -> 'a list t

add_to_list ~key ~data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key:key -> f:('a option -> 'a option) -> 'a t -> 'a t

update ~key ~f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + f:(key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge ~f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union ~f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : f:(key -> bool) -> 'a t -> key * 'a

find_first ~f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

find_first_opt ~f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : f:(key -> bool) -> 'a t -> key * 'a

find_last ~f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

find_last_opt ~f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit

iter ~f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc

fold ~f m ~init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : f:('a -> 'b) -> 'a t -> 'b t

map ~f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t

filter ~f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map ~f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : f:(key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition ~f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal ~cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : f:(key -> 'a -> bool) -> 'a t -> bool

for_all ~f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : f:(key -> 'a -> bool) -> 'a t -> bool

exists ~f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Stdlib/MoreLabels/Map/index.html b/ocaml/Stdlib/MoreLabels/Map/index.html new file mode 100644 index 00000000..40d23e8e --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Map/index.html @@ -0,0 +1,15 @@ + +Map (ocaml.Stdlib.MoreLabels.Map)

Module MoreLabels.Map

Association tables over ordered types.

This module implements applicative association tables, also known as finite maps or dictionaries, given a total ordering function over the keys. All operations over maps are purely applicative (no side-effects). The implementation uses balanced binary trees, and therefore searching and insertion take time logarithmic in the size of the map.

For instance:

module IntPairs =
+  struct
+    type t = int * int
+    let compare (x0,y0) (x1,y1) =
+      match Stdlib.compare x0 x1 with
+          0 -> Stdlib.compare y0 y1
+        | c -> c
+  end
+
+module PairsMap = Map.Make(IntPairs)
+
+let m = PairsMap.(empty |> add (0,1) "hello" |> add (1,0) "world")

This creates a new module PairsMap, with a new type 'a PairsMap.t of maps from int * int to 'a. In this example, m contains string values so its type is string PairsMap.t.

module type OrderedType = sig ... end

Input signature of the functor Make.

module type S = sig ... end

Output signature of the functor Make.

module Make + (Ord : OrderedType) : + S with type key = Ord.t and type 'a t = 'a Map.Make(Ord).t

Functor building an implementation of the map structure given a totally ordered type.

diff --git a/ocaml/Stdlib/MoreLabels/Map/module-type-OrderedType/index.html b/ocaml/Stdlib/MoreLabels/Map/module-type-OrderedType/index.html new file mode 100644 index 00000000..9ce8fc9f --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Map/module-type-OrderedType/index.html @@ -0,0 +1,2 @@ + +OrderedType (ocaml.Stdlib.MoreLabels.Map.OrderedType)

Module type Map.OrderedType

Input signature of the functor Make.

type t

The type of the map keys.

val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Stdlib/MoreLabels/Map/module-type-S/index.html b/ocaml/Stdlib/MoreLabels/Map/module-type-S/index.html new file mode 100644 index 00000000..6dedfde1 --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Map/module-type-S/index.html @@ -0,0 +1,8 @@ + +S (ocaml.Stdlib.MoreLabels.Map.S)

Module type Map.S

Output signature of the functor Make.

Maps

type key

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key:key -> data:'a -> 'a t -> 'a t

add ~key ~data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key:key -> data:'a -> 'a list t -> 'a list t

add_to_list ~key ~data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key:key -> f:('a option -> 'a option) -> 'a t -> 'a t

update ~key ~f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + f:(key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge ~f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union ~f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : f:(key -> bool) -> 'a t -> key * 'a

find_first ~f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

find_first_opt ~f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : f:(key -> bool) -> 'a t -> key * 'a

find_last ~f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

find_last_opt ~f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit

iter ~f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc

fold ~f m ~init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : f:('a -> 'b) -> 'a t -> 'b t

map ~f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t

filter ~f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map ~f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : f:(key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition ~f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal ~cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : f:(key -> 'a -> bool) -> 'a t -> bool

for_all ~f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : f:(key -> 'a -> bool) -> 'a t -> bool

exists ~f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Stdlib/MoreLabels/Set/Make/argument-1-Ord/index.html b/ocaml/Stdlib/MoreLabels/Set/Make/argument-1-Ord/index.html new file mode 100644 index 00000000..fdea3b86 --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Set/Make/argument-1-Ord/index.html @@ -0,0 +1,2 @@ + +Ord (ocaml.Stdlib.MoreLabels.Set.Make.Ord)

Parameter Make.Ord

type t

The type of the set elements.

val compare : t -> t -> int

A total ordering function over the set elements. This is a two-argument function f such that f e1 e2 is zero if the elements e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Stdlib/MoreLabels/Set/Make/index.html b/ocaml/Stdlib/MoreLabels/Set/Make/index.html new file mode 100644 index 00000000..65ecd2eb --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Set/Make/index.html @@ -0,0 +1,3 @@ + +Make (ocaml.Stdlib.MoreLabels.Set.Make)

Module Set.Make

Functor building an implementation of the set structure given a totally ordered type.

Parameters

module Ord : OrderedType

Signature

Sets

type elt = Ord.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : f:(elt -> bool) -> t -> elt

find_first ~f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : f:(elt -> bool) -> t -> elt option

find_first_opt ~f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : f:(elt -> bool) -> t -> elt

find_last ~f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : f:(elt -> bool) -> t -> elt option

find_last_opt ~f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : f:(elt -> unit) -> t -> unit

iter ~f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : f:(elt -> 'acc -> 'acc) -> t -> init:'acc -> 'acc

fold ~f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : f:(elt -> elt) -> t -> t

map ~f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : f:(elt -> bool) -> t -> t

filter ~f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : f:(elt -> elt option) -> t -> t

filter_map ~f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : f:(elt -> bool) -> t -> t * t

partition ~f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : f:(elt -> bool) -> t -> bool

for_all ~f s checks if all elements of the set satisfy the predicate f.

val exists : f:(elt -> bool) -> t -> bool

exists ~f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Stdlib/MoreLabels/Set/index.html b/ocaml/Stdlib/MoreLabels/Set/index.html new file mode 100644 index 00000000..92e03ed0 --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Set/index.html @@ -0,0 +1,15 @@ + +Set (ocaml.Stdlib.MoreLabels.Set)

Module MoreLabels.Set

Sets over ordered types.

This module implements the set data structure, given a total ordering function over the set elements. All operations over sets are purely applicative (no side-effects). The implementation uses balanced binary trees, and is therefore reasonably efficient: insertion and membership take time logarithmic in the size of the set, for instance.

The Make functor constructs implementations for any type, given a compare function. For instance:

module IntPairs =
+  struct
+    type t = int * int
+    let compare (x0,y0) (x1,y1) =
+      match Stdlib.compare x0 x1 with
+          0 -> Stdlib.compare y0 y1
+        | c -> c
+  end
+
+module PairsSet = Set.Make(IntPairs)
+
+let m = PairsSet.(empty |> add (2,3) |> add (5,7) |> add (11,13))

This creates a new module PairsSet, with a new type PairsSet.t of sets of int * int.

module type OrderedType = sig ... end

Input signature of the functor Make.

module type S = sig ... end

Output signature of the functor Make.

module Make + (Ord : OrderedType) : + S with type elt = Ord.t and type t = Set.Make(Ord).t

Functor building an implementation of the set structure given a totally ordered type.

diff --git a/ocaml/Stdlib/MoreLabels/Set/module-type-OrderedType/index.html b/ocaml/Stdlib/MoreLabels/Set/module-type-OrderedType/index.html new file mode 100644 index 00000000..e4fecb68 --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Set/module-type-OrderedType/index.html @@ -0,0 +1,2 @@ + +OrderedType (ocaml.Stdlib.MoreLabels.Set.OrderedType)

Module type Set.OrderedType

Input signature of the functor Make.

type t

The type of the set elements.

val compare : t -> t -> int

A total ordering function over the set elements. This is a two-argument function f such that f e1 e2 is zero if the elements e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Stdlib/MoreLabels/Set/module-type-S/index.html b/ocaml/Stdlib/MoreLabels/Set/module-type-S/index.html new file mode 100644 index 00000000..a9047c1f --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/Set/module-type-S/index.html @@ -0,0 +1,3 @@ + +S (ocaml.Stdlib.MoreLabels.Set.S)

Module type Set.S

Output signature of the functor Make.

Sets

type elt

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : f:(elt -> bool) -> t -> elt

find_first ~f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : f:(elt -> bool) -> t -> elt option

find_first_opt ~f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : f:(elt -> bool) -> t -> elt

find_last ~f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : f:(elt -> bool) -> t -> elt option

find_last_opt ~f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : f:(elt -> unit) -> t -> unit

iter ~f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : f:(elt -> 'acc -> 'acc) -> t -> init:'acc -> 'acc

fold ~f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : f:(elt -> elt) -> t -> t

map ~f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : f:(elt -> bool) -> t -> t

filter ~f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : f:(elt -> elt option) -> t -> t

filter_map ~f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : f:(elt -> bool) -> t -> t * t

partition ~f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : f:(elt -> bool) -> t -> bool

for_all ~f s checks if all elements of the set satisfy the predicate f.

val exists : f:(elt -> bool) -> t -> bool

exists ~f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Stdlib/MoreLabels/index.html b/ocaml/Stdlib/MoreLabels/index.html new file mode 100644 index 00000000..8529103e --- /dev/null +++ b/ocaml/Stdlib/MoreLabels/index.html @@ -0,0 +1,4 @@ + +MoreLabels (ocaml.Stdlib.MoreLabels)

Module Stdlib.MoreLabels

Extra labeled libraries.

This meta-module provides labelized versions of the Hashtbl, Map and Set modules.

This module is intended to be used through open MoreLabels which replaces Hashtbl, Map, and Set with their labeled counterparts.

For example:

open MoreLabels
+
+Hashtbl.iter ~f:(fun ~key ~data -> g key data) table
module Hashtbl : sig ... end

Hash tables and hash functions.

module Map : sig ... end

Association tables over ordered types.

module Set : sig ... end

Sets over ordered types.

diff --git a/ocaml/Stdlib/Mutex/index.html b/ocaml/Stdlib/Mutex/index.html new file mode 100644 index 00000000..6ce2b39a --- /dev/null +++ b/ocaml/Stdlib/Mutex/index.html @@ -0,0 +1,4 @@ + +Mutex (ocaml.Stdlib.Mutex)

Module Stdlib.Mutex

Locks for mutual exclusion.

Mutexes (mutual-exclusion locks) are used to implement critical sections and protect shared mutable data structures against concurrent accesses. The typical use is (if m is the mutex associated with the data structure D):

Mutex.lock m;
+(* Critical section that operates over D *);
+Mutex.unlock m
type t

The type of mutexes.

val create : unit -> t

Return a new mutex.

val lock : t -> unit

Lock the given mutex. Only one thread can have the mutex locked at any time. A thread that attempts to lock a mutex already locked by another thread will suspend until the other thread unlocks the mutex.

  • before 4.12

    Sys_error was not raised for recursive locking (platform-dependent behaviour)

val try_lock : t -> bool

Same as Mutex.lock, but does not suspend the calling thread if the mutex is already locked: just return false immediately in that case. If the mutex is unlocked, lock it and return true.

val unlock : t -> unit

Unlock the given mutex. Other threads suspended trying to lock the mutex will restart. The mutex must have been previously locked by the thread that calls Mutex.unlock.

  • raises Sys_error

    if the mutex is unlocked or was locked by another thread.

  • before 4.12

    Sys_error was not raised when unlocking an unlocked mutex or when unlocking a mutex from a different thread.

val protect : t -> (unit -> 'a) -> 'a

protect mutex f runs f() in a critical section where mutex is locked (using lock); it then takes care of releasing mutex, whether f() returned a value or raised an exception.

The unlocking operation is guaranteed to always takes place, even in the event an asynchronous exception (e.g. Sys.Break) is raised in some signal handler.

  • since 5.1
diff --git a/ocaml/Stdlib/Nativeint/index.html b/ocaml/Stdlib/Nativeint/index.html new file mode 100644 index 00000000..d1f00db1 --- /dev/null +++ b/ocaml/Stdlib/Nativeint/index.html @@ -0,0 +1,5 @@ + +Nativeint (ocaml.Stdlib.Nativeint)

Module Stdlib.Nativeint

Processor-native integers.

This module provides operations on the type nativeint of signed 32-bit integers (on 32-bit platforms) or signed 64-bit integers (on 64-bit platforms). This integer type has exactly the same width as that of a pointer type in the C compiler. All arithmetic operations over nativeint are taken modulo 232 or 264 depending on the word size of the architecture.

Performance notice: values of type nativeint occupy more memory space than values of type int, and arithmetic operations on nativeint are generally slower than those on int. Use nativeint only when the application requires the extra bit of precision over the int type.

Literals for native integers are suffixed by n:

let zero: nativeint = 0n
+let one: nativeint = 1n
+let m_one: nativeint = -1n
val zero : nativeint

The native integer 0.

val one : nativeint

The native integer 1.

val minus_one : nativeint

The native integer -1.

val neg : nativeint -> nativeint

Unary negation.

val add : nativeint -> nativeint -> nativeint

Addition.

val sub : nativeint -> nativeint -> nativeint

Subtraction.

val mul : nativeint -> nativeint -> nativeint

Multiplication.

val div : nativeint -> nativeint -> nativeint

Integer division. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val unsigned_div : nativeint -> nativeint -> nativeint

Same as div, except that arguments and result are interpreted as unsigned native integers.

  • since 4.08
val rem : nativeint -> nativeint -> nativeint

Integer remainder. If y is not zero, the result of Nativeint.rem x y satisfies the following properties: Nativeint.zero <= Nativeint.rem x y < Nativeint.abs y and x = Nativeint.add (Nativeint.mul (Nativeint.div x y) y) + (Nativeint.rem x y). If y = 0, Nativeint.rem x y raises Division_by_zero.

val unsigned_rem : nativeint -> nativeint -> nativeint

Same as rem, except that arguments and result are interpreted as unsigned native integers.

  • since 4.08
val succ : nativeint -> nativeint

Successor. Nativeint.succ x is Nativeint.add x Nativeint.one.

val pred : nativeint -> nativeint

Predecessor. Nativeint.pred x is Nativeint.sub x Nativeint.one.

val abs : nativeint -> nativeint

abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

val size : int

The size in bits of a native integer. This is equal to 32 on a 32-bit platform and to 64 on a 64-bit platform.

val max_int : nativeint

The greatest representable native integer, either 231 - 1 on a 32-bit platform, or 263 - 1 on a 64-bit platform.

val min_int : nativeint

The smallest representable native integer, either -231 on a 32-bit platform, or -263 on a 64-bit platform.

val logand : nativeint -> nativeint -> nativeint

Bitwise logical and.

val logor : nativeint -> nativeint -> nativeint

Bitwise logical or.

val logxor : nativeint -> nativeint -> nativeint

Bitwise logical exclusive or.

val lognot : nativeint -> nativeint

Bitwise logical negation.

val shift_left : nativeint -> int -> nativeint

Nativeint.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is 32 on a 32-bit platform and 64 on a 64-bit platform.

val shift_right : nativeint -> int -> nativeint

Nativeint.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= bitsize.

val shift_right_logical : nativeint -> int -> nativeint

Nativeint.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= bitsize.

val of_int : int -> nativeint

Convert the given integer (type int) to a native integer (type nativeint).

val to_int : nativeint -> int

Convert the given native integer (type nativeint) to an integer (type int). The high-order bit is lost during the conversion.

val unsigned_to_int : nativeint -> int option

Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.

  • since 4.08
val of_float : float -> nativeint

Convert the given floating-point number to a native integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Nativeint.min_int, Nativeint.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.

val to_float : nativeint -> float

Convert the given native integer to a floating-point number.

val of_int32 : int32 -> nativeint

Convert the given 32-bit integer (type int32) to a native integer.

val to_int32 : nativeint -> int32

Convert the given native integer to a 32-bit integer (type int32). On 64-bit platforms, the 64-bit native integer is taken modulo 232, i.e. the top 32 bits are lost. On 32-bit platforms, the conversion is exact.

val of_string : string -> nativeint

Convert the given string to a native integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

The 0u prefix reads the input as an unsigned integer in the range [0, 2*Nativeint.max_int+1]. If the input exceeds Nativeint.max_int it is converted to the signed integer Int64.min_int + input - Nativeint.max_int - 1.

  • raises Failure

    if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type nativeint.

val of_string_opt : string -> nativeint option

Same as of_string, but return None instead of raising.

  • since 4.05
val to_string : nativeint -> string

Return the string representation of its argument, in decimal.

type t = nativeint

An alias for the type of native integers.

val compare : t -> t -> int

The comparison function for native integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Nativeint to be passed as argument to the functors Set.Make and Map.Make.

val unsigned_compare : t -> t -> int

Same as compare, except that arguments are interpreted as unsigned native integers.

  • since 4.08
val equal : t -> t -> bool

The equal function for native ints.

  • since 4.03
val min : t -> t -> t

Return the smaller of the two arguments.

  • since 4.13
val max : t -> t -> t

Return the greater of the two arguments.

  • since 4.13
val seeded_hash : int -> t -> int

A seeded hash function for native ints, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.1
val hash : t -> int

An unseeded hash function for native ints, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.1
diff --git a/ocaml/Stdlib/Obj/Closure/index.html b/ocaml/Stdlib/Obj/Closure/index.html new file mode 100644 index 00000000..27b6cc78 --- /dev/null +++ b/ocaml/Stdlib/Obj/Closure/index.html @@ -0,0 +1,2 @@ + +Closure (ocaml.Stdlib.Obj.Closure)

Module Obj.Closure

type info = {
  1. arity : int;
  2. start_env : int;
}
val info : t -> info
diff --git a/ocaml/Stdlib/Obj/Ephemeron/index.html b/ocaml/Stdlib/Obj/Ephemeron/index.html new file mode 100644 index 00000000..5e2aa224 --- /dev/null +++ b/ocaml/Stdlib/Obj/Ephemeron/index.html @@ -0,0 +1,2 @@ + +Ephemeron (ocaml.Stdlib.Obj.Ephemeron)

Module Obj.Ephemeron

Ephemeron with arbitrary arity and untyped

type obj_t = t

alias for Obj.t

type t

an ephemeron cf Ephemeron

val create : int -> t

create n returns an ephemeron with n keys. All the keys and the data are initially empty. The argument n must be between zero and max_ephe_length (limits included).

val length : t -> int

return the number of keys

val get_key : t -> int -> obj_t option
val get_key_copy : t -> int -> obj_t option
val set_key : t -> int -> obj_t -> unit
val unset_key : t -> int -> unit
val check_key : t -> int -> bool
val blit_key : t -> int -> t -> int -> int -> unit
val get_data : t -> obj_t option
val get_data_copy : t -> obj_t option
val set_data : t -> obj_t -> unit
val unset_data : t -> unit
val check_data : t -> bool
val blit_data : t -> t -> unit
val max_ephe_length : int

Maximum length of an ephemeron, ie the maximum number of keys an ephemeron could contain

diff --git a/ocaml/Stdlib/Obj/Extension_constructor/index.html b/ocaml/Stdlib/Obj/Extension_constructor/index.html new file mode 100644 index 00000000..45bb680c --- /dev/null +++ b/ocaml/Stdlib/Obj/Extension_constructor/index.html @@ -0,0 +1,2 @@ + +Extension_constructor (ocaml.Stdlib.Obj.Extension_constructor)

Module Obj.Extension_constructor

type t = extension_constructor
val of_val : 'a -> t
val name : t -> string
val id : t -> int
diff --git a/ocaml/Stdlib/Obj/index.html b/ocaml/Stdlib/Obj/index.html new file mode 100644 index 00000000..8a784022 --- /dev/null +++ b/ocaml/Stdlib/Obj/index.html @@ -0,0 +1,2 @@ + +Obj (ocaml.Stdlib.Obj)

Module Stdlib.Obj

Operations on internal representations of values.

Not for the casual user.

type t
type raw_data = nativeint
val repr : 'a -> t
val obj : t -> 'a
val magic : 'a -> 'b
val is_block : t -> bool
val is_int : t -> bool
val tag : t -> int
val size : t -> int
val reachable_words : t -> int

Computes the total size (in words, including the headers) of all heap blocks accessible from the argument. Statically allocated blocks are included.

  • since 4.04
val field : t -> int -> t
val set_field : t -> int -> t -> unit

When using flambda:

set_field MUST NOT be called on immutable blocks. (Blocks allocated in C stubs, or with new_block below, are always considered mutable.)

The same goes for set_double_field.

For experts only: set_field et al can be made safe by first wrapping the block in Sys.opaque_identity, so any information about its contents will not be propagated.

val double_field : t -> int -> float
val set_double_field : t -> int -> float -> unit
val raw_field : t -> int -> raw_data
val set_raw_field : t -> int -> raw_data -> unit
val new_block : int -> int -> t
val dup : t -> t
val add_offset : t -> Int32.t -> t
val with_tag : int -> t -> t
val first_non_constant_constructor_tag : int
val last_non_constant_constructor_tag : int
val forcing_tag : int
val cont_tag : int
val lazy_tag : int
val closure_tag : int
val object_tag : int
val infix_tag : int
val forward_tag : int
val no_scan_tag : int
val abstract_tag : int
val string_tag : int
val double_tag : int
val double_array_tag : int
val custom_tag : int
val int_tag : int
val out_of_heap_tag : int
val unaligned_tag : int
module Closure : sig ... end
module Extension_constructor : sig ... end
module Ephemeron : sig ... end

Ephemeron with arbitrary arity and untyped

diff --git a/ocaml/Stdlib/Oo/index.html b/ocaml/Stdlib/Oo/index.html new file mode 100644 index 00000000..122dfca7 --- /dev/null +++ b/ocaml/Stdlib/Oo/index.html @@ -0,0 +1,2 @@ + +Oo (ocaml.Stdlib.Oo)

Module Stdlib.Oo

Operations on objects

val copy : < .. > as 'a -> 'a

Oo.copy o returns a copy of object o, that is a fresh object with the same methods and instance variables as o.

  • alert unsynchronized_access Unsynchronized accesses to mutable objects are a programming error.
val id : < .. > -> int

Return an integer identifying this object, unique for the current execution of the program. The generic comparison and hashing functions are based on this integer. When an object is obtained by unmarshaling, the id is refreshed, and thus different from the original object. As a consequence, the internal invariants of data structures such as hash table or sets containing objects are broken after unmarshaling the data structures.

diff --git a/ocaml/Stdlib/Option/index.html b/ocaml/Stdlib/Option/index.html new file mode 100644 index 00000000..1961f46f --- /dev/null +++ b/ocaml/Stdlib/Option/index.html @@ -0,0 +1,2 @@ + +Option (ocaml.Stdlib.Option)

Module Stdlib.Option

Option values.

Option values explicitly indicate the presence or absence of a value.

  • since 4.08

Options

type 'a t = 'a option =
  1. | None
  2. | Some of 'a

The type for option values. Either None or a value Some v.

val none : 'a option

none is None.

val some : 'a -> 'a option

some v is Some v.

val value : 'a option -> default:'a -> 'a

value o ~default is v if o is Some v and default otherwise.

val get : 'a option -> 'a

get o is v if o is Some v and raise otherwise.

val bind : 'a option -> ('a -> 'b option) -> 'b option

bind o f is f v if o is Some v and None if o is None.

val join : 'a option option -> 'a option

join oo is Some v if oo is Some (Some v) and None otherwise.

val map : ('a -> 'b) -> 'a option -> 'b option

map f o is None if o is None and Some (f v) if o is Some v.

val fold : none:'a -> some:('b -> 'a) -> 'b option -> 'a

fold ~none ~some o is none if o is None and some v if o is Some v.

val iter : ('a -> unit) -> 'a option -> unit

iter f o is f v if o is Some v and () otherwise.

Predicates and comparisons

val is_none : 'a option -> bool

is_none o is true if and only if o is None.

val is_some : 'a option -> bool

is_some o is true if and only if o is Some o.

val equal : ('a -> 'a -> bool) -> 'a option -> 'a option -> bool

equal eq o0 o1 is true if and only if o0 and o1 are both None or if they are Some v0 and Some v1 and eq v0 v1 is true.

val compare : ('a -> 'a -> int) -> 'a option -> 'a option -> int

compare cmp o0 o1 is a total order on options using cmp to compare values wrapped by Some _. None is smaller than Some _ values.

Converting

val to_result : none:'e -> 'a option -> ('a, 'e) result

to_result ~none o is Ok v if o is Some v and Error none otherwise.

val to_list : 'a option -> 'a list

to_list o is [] if o is None and [v] if o is Some v.

val to_seq : 'a option -> 'a Seq.t

to_seq o is o as a sequence. None is the empty sequence and Some v is the singleton sequence containing v.

diff --git a/ocaml/Stdlib/Out_channel/index.html b/ocaml/Stdlib/Out_channel/index.html new file mode 100644 index 00000000..6c482832 --- /dev/null +++ b/ocaml/Stdlib/Out_channel/index.html @@ -0,0 +1,5 @@ + +Out_channel (ocaml.Stdlib.Out_channel)

Module Stdlib.Out_channel

Output channels.

This module provides functions for working with output channels.

See the example section below.

  • since 4.14

Channels

type t = out_channel

The type of output channel.

type open_flag = open_flag =
  1. | Open_rdonly
    (*

    open for reading.

    *)
  2. | Open_wronly
    (*

    open for writing.

    *)
  3. | Open_append
    (*

    open for appending: always write at end of file.

    *)
  4. | Open_creat
    (*

    create the file if it does not exist.

    *)
  5. | Open_trunc
    (*

    empty the file if it already exists.

    *)
  6. | Open_excl
    (*

    fail if Open_creat and the file already exists.

    *)
  7. | Open_binary
    (*

    open in binary mode (no conversion).

    *)
  8. | Open_text
    (*

    open in text mode (may perform conversions).

    *)
  9. | Open_nonblock
    (*

    open in non-blocking mode.

    *)

Opening modes for open_gen.

val stdout : t

The standard output for the process.

val stderr : t

The standard error output for the process.

val open_bin : string -> t

Open the named file for writing, and return a new output channel on that file, positioned at the beginning of the file. The file is truncated to zero length if it already exists. It is created if it does not already exists.

val open_text : string -> t

Same as open_bin, but the file is opened in text mode, so that newline translation takes place during writes. On operating systems that do not distinguish between text mode and binary mode, this function behaves like open_bin.

val open_gen : open_flag list -> int -> string -> t

open_gen mode perm filename opens the named file for writing, as described above. The extra argument mode specifies the opening mode. The extra argument perm specifies the file permissions, in case the file must be created. open_text and open_bin are special cases of this function.

val with_open_bin : string -> (t -> 'a) -> 'a

with_open_bin fn f opens a channel oc on file fn and returns f + oc. After f returns, either with a value or by raising an exception, oc is guaranteed to be closed.

val with_open_text : string -> (t -> 'a) -> 'a

Like with_open_bin, but the channel is opened in text mode (see open_text).

val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a

Like with_open_bin, but can specify the opening mode and file permission, in case the file must be created (see open_gen).

val close : t -> unit

Close the given channel, flushing all buffered write operations. Output functions raise a Sys_error exception when they are applied to a closed output channel, except close and flush, which do nothing when applied to an already closed channel. Note that close may raise Sys_error if the operating system signals an error when flushing or closing.

val close_noerr : t -> unit

Same as close, but ignore all errors.

Output

val output_char : t -> char -> unit

Write the character on the given output channel.

val output_byte : t -> int -> unit

Write one 8-bit integer (as the single character with that code) on the given output channel. The given integer is taken modulo 256.

val output_string : t -> string -> unit

Write the string on the given output channel.

val output_bytes : t -> bytes -> unit

Write the byte sequence on the given output channel.

Advanced output

val output : t -> bytes -> int -> int -> unit

output oc buf pos len writes len characters from byte sequence buf, starting at offset pos, to the given output channel oc.

val output_substring : t -> string -> int -> int -> unit

Same as output but take a string as argument instead of a byte sequence.

Flushing

val flush : t -> unit

Flush the buffer associated with the given output channel, performing all pending writes on that channel. Interactive programs must be careful about flushing standard output and standard error at the right time.

val flush_all : unit -> unit

Flush all open output channels; ignore errors.

Seeking

val seek : t -> int64 -> unit

seek chan pos sets the current writing position to pos for channel chan. This works only for regular files. On files of other kinds (such as terminals, pipes and sockets), the behavior is unspecified.

val pos : t -> int64

Return the current writing position for the given channel. Does not work on channels opened with the Open_append flag (returns unspecified results).

For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos, then going back to this position using seek will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

Attributes

val length : t -> int64

Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless.

val set_binary_mode : t -> bool -> unit

set_binary_mode oc true sets the channel oc to binary mode: no translations take place during output.

set_binary_mode oc false sets the channel oc to text mode: depending on the operating system, some translations may take place during output. For instance, under Windows, end-of-lines will be translated from \n to \r\n.

This function has no effect under operating systems that do not distinguish between text mode and binary mode.

val set_buffered : t -> bool -> unit

set_buffered oc true sets the channel oc to buffered mode. In this mode, data output on oc will be buffered until either the internal buffer is full or the function flush or flush_all is called, at which point it will be sent to the output device.

set_buffered oc false sets the channel oc to unbuffered mode. In this mode, data output on oc will be sent to the output device immediately.

All channels are open in buffered mode by default.

val is_buffered : t -> bool

is_buffered oc returns whether the channel oc is buffered (see set_buffered).

val isatty : t -> bool

isatty oc is true if oc refers to a terminal or console window, false otherwise.

  • since 5.1

Examples

Writing the contents of a file:

let write_file file s =
+  Out_channel.with_open_bin file
+    (fun oc -> Out_channel.output_string oc s))
diff --git a/ocaml/Stdlib/Parsing/index.html b/ocaml/Stdlib/Parsing/index.html new file mode 100644 index 00000000..2c945727 --- /dev/null +++ b/ocaml/Stdlib/Parsing/index.html @@ -0,0 +1,2 @@ + +Parsing (ocaml.Stdlib.Parsing)

Module Stdlib.Parsing

The run-time library for parsers generated by ocamlyacc.

val symbol_start : unit -> int

symbol_start and Parsing.symbol_end are to be called in the action part of a grammar rule only. They return the offset of the string that matches the left-hand side of the rule: symbol_start() returns the offset of the first character; symbol_end() returns the offset after the last character. The first character in a file is at offset 0.

val symbol_end : unit -> int
val rhs_start : int -> int

Same as Parsing.symbol_start and Parsing.symbol_end, but return the offset of the string matching the nth item on the right-hand side of the rule, where n is the integer parameter to rhs_start and rhs_end. n is 1 for the leftmost item.

val rhs_end : int -> int
val symbol_start_pos : unit -> Lexing.position

Same as symbol_start, but return a position instead of an offset.

val symbol_end_pos : unit -> Lexing.position

Same as symbol_end, but return a position instead of an offset.

val rhs_start_pos : int -> Lexing.position

Same as rhs_start, but return a position instead of an offset.

val rhs_end_pos : int -> Lexing.position

Same as rhs_end, but return a position instead of an offset.

val clear_parser : unit -> unit

Empty the parser stack. Call it just after a parsing function has returned, to remove all pointers from the parser stack to structures that were built by semantic actions during parsing. This is optional, but lowers the memory requirements of the programs.

exception Parse_error

Raised when a parser encounters a syntax error. Can also be raised from the action part of a grammar rule, to initiate error recovery.

val set_trace : bool -> bool

Control debugging support for ocamlyacc-generated parsers. After Parsing.set_trace true, the pushdown automaton that executes the parsers prints a trace of its actions (reading a token, shifting a state, reducing by a rule) on standard output. Parsing.set_trace false turns this debugging trace off. The boolean returned is the previous state of the trace flag.

  • since 3.11
diff --git a/ocaml/Stdlib/Printexc/Slot/index.html b/ocaml/Stdlib/Printexc/Slot/index.html new file mode 100644 index 00000000..68faf81f --- /dev/null +++ b/ocaml/Stdlib/Printexc/Slot/index.html @@ -0,0 +1,2 @@ + +Slot (ocaml.Stdlib.Printexc.Slot)

Module Printexc.Slot

  • since 4.02
val is_raise : t -> bool

is_raise slot is true when slot refers to a raising point in the code, and false when it comes from a simple function call.

  • since 4.02
val is_inline : t -> bool

is_inline slot is true when slot refers to a call that got inlined by the compiler, and false when it comes from any other context.

  • since 4.04
val location : t -> location option

location slot returns the location information of the slot, if available, and None otherwise.

Some possible reasons for failing to return a location are as follow:

  • the slot corresponds to a compiler-inserted raise
  • the slot corresponds to a part of the program that has not been compiled with debug information (-g)
  • since 4.02
val name : t -> string option

name slot returns the name of the function or definition enclosing the location referred to by the slot.

name slot returns None if the name is unavailable, which may happen for the same reasons as location returning None.

  • since 4.11
val format : int -> t -> string option

format pos slot returns the string representation of slot as raw_backtrace_to_string would format it, assuming it is the pos-th element of the backtrace: the 0-th element is pretty-printed differently than the others.

Whole-backtrace printing functions also skip some uninformative slots; in that case, format pos slot returns None.

  • since 4.02
diff --git a/ocaml/Stdlib/Printexc/index.html b/ocaml/Stdlib/Printexc/index.html new file mode 100644 index 00000000..b1b1eb86 --- /dev/null +++ b/ocaml/Stdlib/Printexc/index.html @@ -0,0 +1,18 @@ + +Printexc (ocaml.Stdlib.Printexc)

Module Stdlib.Printexc

Facilities for printing exceptions and inspecting current call stack.

type t = exn = ..

The type of exception values.

val to_string : exn -> string

Printexc.to_string e returns a string representation of the exception e.

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 print : ('a -> 'b) -> 'a -> 'b

Printexc.print fn x applies fn to x and returns the result. If the evaluation of fn x raises any exception, the name of the exception is printed on standard error output, and the exception is raised again. The typical use is to catch and report exceptions that escape a function application.

val catch : ('a -> 'b) -> 'a -> 'b

Printexc.catch fn x is similar to Printexc.print, but aborts the program with exit code 2 after printing the uncaught exception. This function is deprecated: the runtime system is now able to print uncaught exceptions as precisely as Printexc.catch does. Moreover, calling Printexc.catch makes it harder to track the location of the exception using the debugger or the stack backtrace facility. So, do not use Printexc.catch in new code.

  • deprecated This function is no longer needed.
val print_backtrace : out_channel -> unit

Printexc.print_backtrace oc prints an exception backtrace on the output channel oc. The backtrace lists the program locations where the most-recently raised exception was raised and where it was propagated through function calls.

If the call is not inside an exception handler, the returned backtrace is unspecified. If the call is after some exception-catching code (before in the handler, or in a when-guard during the matching of the exception handler), the backtrace may correspond to a later exception than the handled one.

  • since 3.11
val get_backtrace : unit -> string

Printexc.get_backtrace () returns a string containing the same exception backtrace that Printexc.print_backtrace would print. Same restriction usage than print_backtrace.

  • since 3.11
val record_backtrace : bool -> unit

Printexc.record_backtrace b turns recording of exception backtraces on (if b = true) or off (if b = false). Initially, backtraces are not recorded, unless the b flag is given to the program through the OCAMLRUNPARAM variable.

  • since 3.11
val backtrace_status : unit -> bool

Printexc.backtrace_status() returns true if exception backtraces are currently recorded, false if not.

  • since 3.11
val register_printer : (exn -> string option) -> unit

Printexc.register_printer fn registers fn as an exception printer. The printer should return None or raise an exception if it does not know how to convert the passed exception, and Some + s with s the resulting string if it can convert the passed exception. Exceptions raised by the printer are ignored.

When converting an exception into a string, the printers will be invoked in the reverse order of their registrations, until a printer returns a Some s value (if no such printer exists, the runtime will use a generic printer).

When using this mechanism, one should be aware that an exception backtrace is attached to the thread that saw it raised, rather than to the exception itself. Practically, it means that the code related to fn should not use the backtrace if it has itself raised an exception before.

  • since 3.11.2
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

Raw backtraces

type raw_backtrace

The type raw_backtrace stores a backtrace in a low-level format, which can be converted to usable form using raw_backtrace_entries and backtrace_slots_of_raw_entry below.

Converting backtraces to backtrace_slots is slower than capturing the backtraces. If an application processes many backtraces, it can be useful to use raw_backtrace to avoid or delay conversion.

Raw backtraces cannot be marshalled. If you need marshalling, you should use the array returned by the backtrace_slots function of the next section.

  • since 4.01
type raw_backtrace_entry = private int

A raw_backtrace_entry is an element of a raw_backtrace.

Each raw_backtrace_entry is an opaque integer, whose value is not stable between different programs, or even between different runs of the same binary.

A raw_backtrace_entry can be converted to a usable form using backtrace_slots_of_raw_entry below. Note that, due to inlining, a single raw_backtrace_entry may convert to several backtrace_slots. Since the values of a raw_backtrace_entry are not stable, they cannot be marshalled. If they are to be converted, the conversion must be done by the process that generated them.

Again due to inlining, there may be multiple distinct raw_backtrace_entry values that convert to equal backtrace_slots. However, if two raw_backtrace_entrys are equal as integers, then they represent the same backtrace_slots.

  • since 4.12
val raw_backtrace_entries : raw_backtrace -> raw_backtrace_entry array
  • since 4.12
val get_raw_backtrace : unit -> raw_backtrace

Printexc.get_raw_backtrace () returns the same exception backtrace that Printexc.print_backtrace would print, but in a raw format. Same restriction usage than print_backtrace.

  • since 4.01
val print_raw_backtrace : out_channel -> raw_backtrace -> unit

Print a raw backtrace in the same format Printexc.print_backtrace uses.

  • since 4.01
val raw_backtrace_to_string : raw_backtrace -> string

Return a string from a raw backtrace, in the same format Printexc.get_backtrace uses.

  • since 4.01
val raise_with_backtrace : exn -> raw_backtrace -> 'a

Reraise the exception using the given raw_backtrace for the origin of the exception

  • since 4.05

Current call stack

val get_callstack : int -> raw_backtrace

Printexc.get_callstack n returns a description of the top of the call stack on the current program point (for the current thread), with at most n entries. (Note: this function is not related to exceptions at all, despite being part of the Printexc module.)

  • since 4.01

Uncaught exceptions

val default_uncaught_exception_handler : exn -> raw_backtrace -> unit

Printexc.default_uncaught_exception_handler prints the exception and backtrace on standard error output.

  • since 4.11
val set_uncaught_exception_handler : (exn -> raw_backtrace -> unit) -> unit

Printexc.set_uncaught_exception_handler fn registers fn as the handler for uncaught exceptions. The default handler is Printexc.default_uncaught_exception_handler.

Note that when fn is called all the functions registered with Stdlib.at_exit have already been called. Because of this you must make sure any output channel fn writes on is flushed.

Also note that exceptions raised by user code in the interactive toplevel are not passed to this function as they are caught by the toplevel itself.

If fn raises an exception, both the exceptions passed to fn and raised by fn will be printed with their respective backtrace.

  • since 4.02

Manipulation of backtrace information

These functions are used to traverse the slots of a raw backtrace and extract information from them in a programmer-friendly format.

type backtrace_slot

The abstract type backtrace_slot represents a single slot of a backtrace.

  • since 4.02
val backtrace_slots : raw_backtrace -> backtrace_slot array option

Returns the slots of a raw backtrace, or None if none of them contain useful information.

In the return array, the slot at index 0 corresponds to the most recent function call, raise, or primitive get_backtrace call in the trace.

Some possible reasons for returning None are as follow:

  • none of the slots in the trace come from modules compiled with debug information (-g)
  • the program is a bytecode program that has not been linked with debug information enabled (ocamlc -g)
  • since 4.02
val backtrace_slots_of_raw_entry : + raw_backtrace_entry -> + backtrace_slot array option

Returns the slots of a single raw backtrace entry, or None if this entry lacks debug information.

Slots are returned in the same order as backtrace_slots: the slot at index 0 is the most recent call, raise, or primitive, and subsequent slots represent callers.

  • since 4.12
type location = {
  1. filename : string;
  2. line_number : int;
  3. start_char : int;
  4. end_char : int;
}

The type of location information found in backtraces. start_char and end_char are positions relative to the beginning of the line.

  • since 4.02
module Slot : sig ... end

Raw backtrace slots

type raw_backtrace_slot

This type is used to iterate over the slots of a raw_backtrace. For most purposes, backtrace_slots_of_raw_entry is easier to use.

Like raw_backtrace_entry, values of this type are process-specific and must absolutely not be marshalled, and are unsafe to use for this reason (marshalling them may not fail, but un-marshalling and using the result will result in undefined behavior).

Elements of this type can still be compared and hashed: when two elements are equal, then they represent the same source location (the converse is not necessarily true in presence of inlining, for example).

  • since 4.02
val raw_backtrace_length : raw_backtrace -> int

raw_backtrace_length bckt returns the number of slots in the backtrace bckt.

  • since 4.02
val get_raw_backtrace_slot : raw_backtrace -> int -> raw_backtrace_slot

get_raw_backtrace_slot bckt pos returns the slot in position pos in the backtrace bckt.

  • since 4.02
val convert_raw_backtrace_slot : raw_backtrace_slot -> backtrace_slot

Extracts the user-friendly backtrace_slot from a low-level raw_backtrace_slot.

  • since 4.02
val get_raw_backtrace_next_slot : + raw_backtrace_slot -> + raw_backtrace_slot option

get_raw_backtrace_next_slot slot returns the next slot inlined, if any.

Sample code to iterate over all frames (inlined and non-inlined):

(* Iterate over inlined frames *)
+let rec iter_raw_backtrace_slot f slot =
+  f slot;
+  match get_raw_backtrace_next_slot slot with
+  | None -> ()
+  | Some slot' -> iter_raw_backtrace_slot f slot'
+
+(* Iterate over stack frames *)
+let iter_raw_backtrace f bt =
+  for i = 0 to raw_backtrace_length bt - 1 do
+    iter_raw_backtrace_slot f (get_raw_backtrace_slot bt i)
+  done
  • since 4.04

Exception slots

val exn_slot_id : exn -> int

Printexc.exn_slot_id returns an integer which uniquely identifies the constructor used to create the exception value exn (in the current runtime).

  • since 4.02
val exn_slot_name : exn -> string

Printexc.exn_slot_name exn returns the internal name of the constructor used to create the exception value exn.

  • since 4.02
diff --git a/ocaml/Stdlib/Printf/index.html b/ocaml/Stdlib/Printf/index.html new file mode 100644 index 00000000..e32b4ef7 --- /dev/null +++ b/ocaml/Stdlib/Printf/index.html @@ -0,0 +1,14 @@ + +Printf (ocaml.Stdlib.Printf)

Module Stdlib.Printf

Formatted output functions.

val fprintf : out_channel -> ('a, out_channel, unit) format -> 'a

fprintf outchan format arg1 ... argN formats the arguments arg1 to argN according to the format string format, and outputs the resulting string on the channel outchan.

The format string is a character string which contains two types of objects: plain characters, which are simply copied to the output channel, and conversion specifications, each of which causes conversion and printing of arguments.

Conversion specifications have the following form:

% [flags] [width] [.precision] type

In short, a conversion specification consists in the % character, followed by optional modifiers and a type which is made of one or two characters.

The types and their meanings are:

  • d, i: convert an integer argument to signed decimal. The flag # adds underscores to large values for readability.
  • u, n, l, L, or N: convert an integer argument to unsigned decimal. Warning: n, l, L, and N are used for scanf, and should not be used for printf. The flag # adds underscores to large values for readability.
  • x: convert an integer argument to unsigned hexadecimal, using lowercase letters. The flag # adds a 0x prefix to non zero values.
  • X: convert an integer argument to unsigned hexadecimal, using uppercase letters. The flag # adds a 0X prefix to non zero values.
  • o: convert an integer argument to unsigned octal. The flag # adds a 0 prefix to non zero values.
  • s: insert a string argument.
  • S: convert a string argument to OCaml syntax (double quotes, escapes).
  • c: insert a character argument.
  • C: convert a character argument to OCaml syntax (single quotes, escapes).
  • f: convert a floating-point argument to decimal notation, in the style dddd.ddd.
  • F: convert a floating-point argument to OCaml syntax (dddd. or dddd.ddd or d.ddd e+-dd). Converts to hexadecimal with the # flag (see h).
  • e or E: convert a floating-point argument to decimal notation, in the style d.ddd e+-dd (mantissa and exponent).
  • g or G: convert a floating-point argument to decimal notation, in style f or e, E (whichever is more compact). Moreover, any trailing zeros are removed from the fractional part of the result and the decimal-point character is removed if there is no fractional part remaining.
  • h or H: convert a floating-point argument to hexadecimal notation, in the style 0xh.hhhh p+-dd (hexadecimal mantissa, exponent in decimal and denotes a power of 2).
  • B: convert a boolean argument to the string true or false
  • b: convert a boolean argument (deprecated; do not use in new programs).
  • ld, li, lu, lx, lX, lo: convert an int32 argument to the format specified by the second letter (decimal, hexadecimal, etc).
  • nd, ni, nu, nx, nX, no: convert a nativeint argument to the format specified by the second letter.
  • Ld, Li, Lu, Lx, LX, Lo: convert an int64 argument to the format specified by the second letter.
  • a: user-defined printer. Take two arguments and apply the first one to outchan (the current output channel) and to the second argument. The first argument must therefore have type out_channel -> 'b -> unit and the second 'b. The output produced by the function is inserted in the output of fprintf at the current point.
  • t: same as %a, but take only one argument (with type out_channel -> unit) and apply it to outchan.
  • \{ fmt %\}: convert a format string argument to its type digest. The argument must have the same type as the internal format string fmt.
  • ( fmt %): format string substitution. Take a format string argument and substitute it to the internal format string fmt to print following arguments. The argument must have the same type as the internal format string fmt.
  • !: take no argument and flush the output.
  • %: take no argument and output one % character.
  • \@: take no argument and output one \@ character.
  • ,: take no argument and output nothing: a no-op delimiter for conversion specifications.

The optional flags are:

  • -: left-justify the output (default is right justification).
  • 0: for numerical conversions, pad with zeroes instead of spaces.
  • +: for signed numerical conversions, prefix number with a + sign if positive.
  • space: for signed numerical conversions, prefix number with a space if positive.
  • #: request an alternate formatting style for the integer types and the floating-point type F.

The optional width is an integer indicating the minimal width of the result. For instance, %6d prints an integer, prefixing it with spaces to fill at least 6 characters.

The optional precision is a dot . followed by an integer indicating how many digits follow the decimal point in the %f, %e, %E, %h, and %H conversions or the maximum number of significant digits to appear for the %F, %g and %G conversions. For instance, %.4f prints a float with 4 fractional digits.

The integer in a width or precision can also be specified as *, in which case an extra integer argument is taken to specify the corresponding width or precision. This integer argument precedes immediately the argument to print. For instance, %.*f prints a float with as many fractional digits as the value of the argument given before the float.

val printf : ('a, out_channel, unit) format -> 'a

Same as Printf.fprintf, but output on stdout.

val eprintf : ('a, out_channel, unit) format -> 'a

Same as Printf.fprintf, but output on stderr.

val sprintf : ('a, unit, string) format -> 'a

Same as Printf.fprintf, but instead of printing on an output channel, return a string containing the result of formatting the arguments.

val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a

Same as Printf.fprintf, but instead of printing on an output channel, append the formatted arguments to the given extensible buffer (see module Buffer).

val ifprintf : 'b -> ('a, 'b, 'c, unit) format4 -> 'a

Same as Printf.fprintf, but does not print anything. Useful to ignore some material when conditionally printing.

  • since 3.10
val ibprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a

Same as Printf.bprintf, but does not print anything. Useful to ignore some material when conditionally printing.

  • since 4.11

Formatted output functions with continuations.

val kfprintf : + (out_channel -> 'd) -> + out_channel -> + ('a, out_channel, unit, 'd) format4 -> + 'a

Same as fprintf, but instead of returning immediately, passes the out channel to its first argument at the end of printing.

  • since 3.09
val ikfprintf : ('b -> 'd) -> 'b -> ('a, 'b, 'c, 'd) format4 -> 'a

Same as kfprintf above, but does not print anything. Useful to ignore some material when conditionally printing.

  • since 4.01
val ksprintf : (string -> 'd) -> ('a, unit, string, 'd) format4 -> 'a

Same as sprintf above, but instead of returning the string, passes it to the first argument.

  • since 3.09
val kbprintf : + (Buffer.t -> 'd) -> + Buffer.t -> + ('a, Buffer.t, unit, 'd) format4 -> + 'a

Same as bprintf, but instead of returning immediately, passes the buffer to its first argument at the end of printing.

  • since 3.10
val ikbprintf : + (Buffer.t -> 'd) -> + Buffer.t -> + ('a, Buffer.t, unit, 'd) format4 -> + 'a

Same as kbprintf above, but does not print anything. Useful to ignore some material when conditionally printing.

  • since 4.11

Deprecated

val kprintf : (string -> 'b) -> ('a, unit, string, 'b) format4 -> 'a

A deprecated synonym for ksprintf.

  • deprecated Use Printf.ksprintf instead.
diff --git a/ocaml/Stdlib/Queue/index.html b/ocaml/Stdlib/Queue/index.html new file mode 100644 index 00000000..11a1edfb --- /dev/null +++ b/ocaml/Stdlib/Queue/index.html @@ -0,0 +1,78 @@ + +Queue (ocaml.Stdlib.Queue)

Module Stdlib.Queue

First-in first-out queues.

This module implements queues (FIFOs), with in-place modification. See the example section below.

Unsynchronized accesses

Unsynchronized accesses to a queue may lead to an invalid queue state. Thus, concurrent accesses to queues must be synchronized (for instance with a Mutex.t).

type !'a t

The type of queues containing elements of type 'a.

exception Empty

Raised when Queue.take or Queue.peek is applied to an empty queue.

val create : unit -> 'a t

Return a new queue, initially empty.

val add : 'a -> 'a t -> unit

add x q adds the element x at the end of the queue q.

val push : 'a -> 'a t -> unit

push is a synonym for add.

val take : 'a t -> 'a

take q removes and returns the first element in queue q, or raises Empty if the queue is empty.

val take_opt : 'a t -> 'a option

take_opt q removes and returns the first element in queue q, or returns None if the queue is empty.

  • since 4.08
val pop : 'a t -> 'a

pop is a synonym for take.

val peek : 'a t -> 'a

peek q returns the first element in queue q, without removing it from the queue, or raises Empty if the queue is empty.

val peek_opt : 'a t -> 'a option

peek_opt q returns the first element in queue q, without removing it from the queue, or returns None if the queue is empty.

  • since 4.08
val top : 'a t -> 'a

top is a synonym for peek.

val clear : 'a t -> unit

Discard all elements from a queue.

val copy : 'a t -> 'a t

Return a copy of the given queue.

val is_empty : 'a t -> bool

Return true if the given queue is empty, false otherwise.

val length : 'a t -> int

Return the number of elements in a queue.

val iter : ('a -> unit) -> 'a t -> unit

iter f q applies f in turn to all elements of q, from the least recently entered to the most recently entered. The queue itself is unchanged.

val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

fold f accu q is equivalent to List.fold_left f accu l, where l is the list of q's elements. The queue remains unchanged.

val transfer : 'a t -> 'a t -> unit

transfer q1 q2 adds all of q1's elements at the end of the queue q2, then clears q1. It is equivalent to the sequence iter (fun x -> add x q2) q1; clear q1, but runs in constant time.

Iterators

val to_seq : 'a t -> 'a Seq.t

Iterate on the queue, in front-to-back order. The behavior is not specified if the queue is modified during the iteration.

  • since 4.07
val add_seq : 'a t -> 'a Seq.t -> unit

Add the elements from a sequence to the end of the queue.

  • since 4.07
val of_seq : 'a Seq.t -> 'a t

Create a queue from a sequence.

  • since 4.07

Examples

Basic Example

A basic example:

# let q = Queue.create ()
+val q : '_weak1 Queue.t = <abstr>
+
+
+# Queue.push 1 q; Queue.push 2 q; Queue.push 3 q
+- : unit = ()
+
+# Queue.length q
+- : int = 3
+
+# Queue.pop q
+- : int = 1
+
+# Queue.pop q
+- : int = 2
+
+# Queue.pop q
+- : int = 3
+
+# Queue.pop q
+Exception: Stdlib.Queue.Empty.

Search Through a Graph

For a more elaborate example, a classic algorithmic use of queues is to implement a BFS (breadth-first search) through a graph.

 type graph = {
+   edges: (int, int list) Hashtbl.t
+ }
+
+(* Search in graph [g] using BFS, starting from node [start].
+   It returns the first node that satisfies [p], or [None] if
+   no node reachable from [start] satisfies [p].
+*)
+let search_for ~(g:graph) ~(start:int) (p:int -> bool) : int option =
+  let to_explore = Queue.create() in
+  let explored = Hashtbl.create 16 in
+
+  Queue.push start to_explore;
+  let rec loop () =
+    if Queue.is_empty to_explore then None
+    else
+      (* node to explore *)
+      let node = Queue.pop to_explore in
+      explore_node node
+
+  and explore_node node =
+    if not (Hashtbl.mem explored node) then (
+      if p node then Some node (* found *)
+      else (
+        Hashtbl.add explored node ();
+        let children =
+          Hashtbl.find_opt g.edges node
+          |> Option.value ~default:[]
+        in
+        List.iter (fun child -> Queue.push child to_explore) children;
+        loop()
+      )
+    ) else loop()
+  in
+  loop()
+
+(* a sample graph *)
+let my_graph: graph =
+  let edges =
+    List.to_seq [
+      1, [2;3];
+      2, [10; 11];
+      3, [4;5];
+      5, [100];
+      11, [0; 20];
+    ]
+    |> Hashtbl.of_seq
+  in {edges}
+
+# search_for ~g:my_graph ~start:1 (fun x -> x = 30)
+- : int option = None
+
+# search_for ~g:my_graph ~start:1 (fun x -> x >= 15)
+- : int option = Some 20
+
+# search_for ~g:my_graph ~start:1 (fun x -> x >= 50)
+- : int option = Some 100
diff --git a/ocaml/Stdlib/Random/State/index.html b/ocaml/Stdlib/Random/State/index.html new file mode 100644 index 00000000..96cea533 --- /dev/null +++ b/ocaml/Stdlib/Random/State/index.html @@ -0,0 +1,2 @@ + +State (ocaml.Stdlib.Random.State)

Module Random.State

type t

The type of PRNG states.

val make : int array -> t

Create a new state and initialize it with the given seed.

val make_self_init : unit -> t

Create a new state and initialize it with a random seed chosen in a system-dependent way. The seed is obtained as described in Random.self_init.

val copy : t -> t

Return a copy of the given state.

val bits : t -> int
val int : t -> int -> int
val full_int : t -> int -> int
val int32 : t -> Int32.t -> Int32.t
val nativeint : t -> Nativeint.t -> Nativeint.t
val int64 : t -> Int64.t -> Int64.t
val float : t -> float -> float
val bool : t -> bool
val bits32 : t -> Int32.t
val bits64 : t -> Int64.t
val nativebits : t -> Nativeint.t

These functions are the same as the basic functions, except that they use (and update) the given PRNG state instead of the default one.

val split : t -> t

Draw a fresh PRNG state from the given PRNG state. (The given PRNG state is modified.) The new PRNG is statistically independent from the given PRNG. Data can be drawn from both PRNGs, in any order, without risk of correlation. Both PRNGs can be split later, arbitrarily many times.

  • since 5.0
val to_binary_string : t -> string

Serializes the PRNG state into an immutable sequence of bytes. See of_binary_string for deserialization.

The string type is intended here for serialization only, the encoding is not human-readable and may not be printable.

Note that the serialization format may differ across OCaml versions.

  • since 5.1
val of_binary_string : string -> t

Deserializes a byte sequence obtained by calling to_binary_string. The resulting PRNG state will produce the same random numbers as the state that was passed as input to to_binary_string.

  • raises Failure

    if the input is not in the expected format.

    Note that the serialization format may differ across OCaml versions.

    Unlike the functions provided by the Marshal module, this function either produces a valid state or fails cleanly with a Failure exception. It can be safely used on user-provided, untrusted inputs.

  • since 5.1
diff --git a/ocaml/Stdlib/Random/index.html b/ocaml/Stdlib/Random/index.html new file mode 100644 index 00000000..0495f4af --- /dev/null +++ b/ocaml/Stdlib/Random/index.html @@ -0,0 +1,2 @@ + +Random (ocaml.Stdlib.Random)

Module Stdlib.Random

Pseudo-random number generators (PRNG).

With multiple domains, each domain has its own generator that evolves independently of the generators of other domains. When a domain is created, its generator is initialized by splitting the state of the generator associated with the parent domain.

In contrast, all threads within a domain share the same domain-local generator. Independent generators can be created with the Random.split function and used with the functions from the Random.State module.

Basic functions

val init : int -> unit

Initialize the domain-local generator, using the argument as a seed. The same seed will always yield the same sequence of numbers.

val full_init : int array -> unit

Same as Random.init but takes more data as seed.

val self_init : unit -> unit

Initialize the domain-local generator with a random seed chosen in a system-dependent way. If /dev/urandom is available on the host machine, it is used to provide a highly random initial seed. Otherwise, a less random seed is computed from system parameters (current time, process IDs, domain-local state).

val bits : unit -> int

Return 30 random bits in a nonnegative integer.

  • before 5.0

    used a different algorithm (affects all the following functions)

val int : int -> int

Random.int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0 and less than 230.

val full_int : int -> int

Random.full_int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound may be any positive integer.

If bound is less than 230, Random.full_int bound is equal to Random.int bound. If bound is greater than 230 (on 64-bit systems or non-standard environments, such as JavaScript), Random.full_int returns a value, where Random.int raises Stdlib.Invalid_argument.

  • since 4.13
val int32 : Int32.t -> Int32.t

Random.int32 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

val nativeint : Nativeint.t -> Nativeint.t

Random.nativeint bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

val int64 : Int64.t -> Int64.t

Random.int64 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

val float : float -> float

Random.float bound returns a random floating-point number between 0 and bound (inclusive). If bound is negative, the result is negative or zero. If bound is 0, the result is 0.

val bool : unit -> bool

Random.bool () returns true or false with probability 0.5 each.

val bits32 : unit -> Int32.t

Random.bits32 () returns 32 random bits as an integer between Int32.min_int and Int32.max_int.

  • since 4.14
val bits64 : unit -> Int64.t

Random.bits64 () returns 64 random bits as an integer between Int64.min_int and Int64.max_int.

  • since 4.14
val nativebits : unit -> Nativeint.t

Random.nativebits () returns 32 or 64 random bits (depending on the bit width of the platform) as an integer between Nativeint.min_int and Nativeint.max_int.

  • since 4.14

Advanced functions

The functions from module State manipulate the current state of the random generator explicitly. This allows using one or several deterministic PRNGs, even in a multi-threaded program, without interference from other parts of the program.

module State : sig ... end
val get_state : unit -> State.t

get_state() returns a fresh copy of the current state of the domain-local generator (which is used by the basic functions).

val set_state : State.t -> unit

set_state s updates the current state of the domain-local generator (which is used by the basic functions) by copying the state s into it.

val split : unit -> State.t

Draw a fresh PRNG state from the current state of the domain-local generator used by the default functions. (The state of the domain-local generator is modified.) See Random.State.split.

  • since 5.0
diff --git a/ocaml/Stdlib/Result/index.html b/ocaml/Stdlib/Result/index.html new file mode 100644 index 00000000..fe7adead --- /dev/null +++ b/ocaml/Stdlib/Result/index.html @@ -0,0 +1,12 @@ + +Result (ocaml.Stdlib.Result)

Module Stdlib.Result

Result values.

Result values handle computation results and errors in an explicit and declarative manner without resorting to exceptions.

  • since 4.08

Results

type ('a, 'e) t = ('a, 'e) result =
  1. | Ok of 'a
  2. | Error of 'e

The type for result values. Either a value Ok v or an error Error e.

val ok : 'a -> ('a, 'e) result

ok v is Ok v.

val error : 'e -> ('a, 'e) result

error e is Error e.

val value : ('a, 'e) result -> default:'a -> 'a

value r ~default is v if r is Ok v and default otherwise.

val get_ok : ('a, 'e) result -> 'a

get_ok r is v if r is Ok v and raise otherwise.

val get_error : ('a, 'e) result -> 'e

get_error r is e if r is Error e and raise otherwise.

val bind : ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result

bind r f is f v if r is Ok v and r if r is Error _.

val join : (('a, 'e) result, 'e) result -> ('a, 'e) result

join rr is r if rr is Ok r and rr if rr is Error _.

val map : ('a -> 'b) -> ('a, 'e) result -> ('b, 'e) result

map f r is Ok (f v) if r is Ok v and r if r is Error _.

val map_error : ('e -> 'f) -> ('a, 'e) result -> ('a, 'f) result

map_error f r is Error (f e) if r is Error e and r if r is Ok _.

val fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) result -> 'c

fold ~ok ~error r is ok v if r is Ok v and error e if r is Error e.

val iter : ('a -> unit) -> ('a, 'e) result -> unit

iter f r is f v if r is Ok v and () otherwise.

val iter_error : ('e -> unit) -> ('a, 'e) result -> unit

iter_error f r is f e if r is Error e and () otherwise.

Predicates and comparisons

val is_ok : ('a, 'e) result -> bool

is_ok r is true if and only if r is Ok _.

val is_error : ('a, 'e) result -> bool

is_error r is true if and only if r is Error _.

val equal : + ok:('a -> 'a -> bool) -> + error:('e -> 'e -> bool) -> + ('a, 'e) result -> + ('a, 'e) result -> + bool

equal ~ok ~error r0 r1 tests equality of r0 and r1 using ok and error to respectively compare values wrapped by Ok _ and Error _.

val compare : + ok:('a -> 'a -> int) -> + error:('e -> 'e -> int) -> + ('a, 'e) result -> + ('a, 'e) result -> + int

compare ~ok ~error r0 r1 totally orders r0 and r1 using ok and error to respectively compare values wrapped by Ok _ and Error _. Ok _ values are smaller than Error _ values.

Converting

val to_option : ('a, 'e) result -> 'a option

to_option r is r as an option, mapping Ok v to Some v and Error _ to None.

val to_list : ('a, 'e) result -> 'a list

to_list r is [v] if r is Ok v and [] otherwise.

val to_seq : ('a, 'e) result -> 'a Seq.t

to_seq r is r as a sequence. Ok v is the singleton sequence containing v and Error _ is the empty sequence.

diff --git a/ocaml/Stdlib/Scanf/Scanning/index.html b/ocaml/Stdlib/Scanf/Scanning/index.html new file mode 100644 index 00000000..98f69add --- /dev/null +++ b/ocaml/Stdlib/Scanf/Scanning/index.html @@ -0,0 +1,2 @@ + +Scanning (ocaml.Stdlib.Scanf.Scanning)

Module Scanf.Scanning

type in_channel

The notion of input channel for the Scanf module: those channels provide all the machinery necessary to read from any source of characters, including a Stdlib.in_channel value. A Scanf.Scanning.in_channel value is also called a formatted input channel or equivalently a scanning buffer. The type Scanning.scanbuf below is an alias for Scanning.in_channel. Note that a Scanning.in_channel is not concurrency-safe: concurrent use may produce arbitrary values or exceptions.

  • since 3.12
type scanbuf = in_channel

The type of scanning buffers. A scanning buffer is the source from which a formatted input function gets characters. The scanning buffer holds the current state of the scan, plus a function to get the next char from the input, and a token buffer to store the string matched so far.

Note: a scanning action may often require to examine one character in advance; when this 'lookahead' character does not belong to the token read, it is stored back in the scanning buffer and becomes the next character yet to be read.

val stdin : in_channel

The standard input notion for the Scanf module. Scanning.stdin is the Scanning.in_channel formatted input channel attached to Stdlib.stdin.

Note: in the interactive system, when input is read from Stdlib.stdin, the newline character that triggers evaluation is part of the input; thus, the scanning specifications must properly skip this additional newline character (for instance, simply add a '\n' as the last character of the format string).

  • since 3.12
type file_name = string

A convenient alias to designate a file name.

  • since 4.00
val open_in : file_name -> in_channel

Scanning.open_in fname returns a Scanning.in_channel formatted input channel for bufferized reading in text mode from file fname.

Note: open_in returns a formatted input channel that efficiently reads characters in large chunks; in contrast, from_channel below returns formatted input channels that must read one character at a time, leading to a much slower scanning rate.

  • since 3.12
val open_in_bin : file_name -> in_channel

Scanning.open_in_bin fname returns a Scanning.in_channel formatted input channel for bufferized reading in binary mode from file fname.

  • since 3.12
val close_in : in_channel -> unit

Closes the Stdlib.in_channel associated with the given Scanning.in_channel formatted input channel.

  • since 3.12
val from_file : file_name -> in_channel

An alias for Scanning.open_in above.

val from_file_bin : string -> in_channel

An alias for Scanning.open_in_bin above.

val from_string : string -> in_channel

Scanning.from_string s returns a Scanning.in_channel formatted input channel which reads from the given string. Reading starts from the first character in the string. The end-of-input condition is set when the end of the string is reached.

val from_function : (unit -> char) -> in_channel

Scanning.from_function f returns a Scanning.in_channel formatted input channel with the given function as its reading method.

When scanning needs one more character, the given function is called.

When the function has no more character to provide, it must signal an end-of-input condition by raising the exception End_of_file.

val from_channel : in_channel -> in_channel

Scanning.from_channel ic returns a Scanning.in_channel formatted input channel which reads from the regular Stdlib.in_channel input channel ic argument. Reading starts at current reading position of ic.

val end_of_input : in_channel -> bool

Scanning.end_of_input ic tests the end-of-input condition of the given Scanning.in_channel formatted input channel.

val beginning_of_input : in_channel -> bool

Scanning.beginning_of_input ic tests the beginning of input condition of the given Scanning.in_channel formatted input channel.

val name_of_input : in_channel -> string

Scanning.name_of_input ic returns the name of the character source for the given Scanning.in_channel formatted input channel.

  • since 3.09
diff --git a/ocaml/Stdlib/Scanf/index.html b/ocaml/Stdlib/Scanf/index.html new file mode 100644 index 00000000..f5be841d --- /dev/null +++ b/ocaml/Stdlib/Scanf/index.html @@ -0,0 +1,26 @@ + +Scanf (ocaml.Stdlib.Scanf)

Module Stdlib.Scanf

Formatted input functions.

Introduction

Functional input with format strings

The module Scanf provides formatted input functions or scanners.

The formatted input functions can read from any kind of input, including strings, files, or anything that can return characters. The more general source of characters is named a formatted input channel (or scanning buffer) and has type Scanning.in_channel. The more general formatted input function reads from any scanning buffer and is named bscanf.

Generally speaking, the formatted input functions have 3 arguments:

  • the first argument is a source of characters for the input,
  • the second argument is a format string that specifies the values to read,
  • the third argument is a receiver function that is applied to the values read.

Hence, a typical call to the formatted input function Scanf.bscanf is bscanf ic fmt f, where:

  • ic is a source of characters (typically a formatted input channel with type Scanning.in_channel),
  • fmt is a format string (the same format strings as those used to print material with module Printf or Format),
  • f is a function that has as many arguments as the number of values to read in the input according to fmt.

A simple example

As suggested above, the expression bscanf ic "%d" f reads a decimal integer n from the source of characters ic and returns f n.

For instance,

  • if we use stdin as the source of characters (Scanning.stdin is the predefined formatted input channel that reads from standard input),
  • if we define the receiver f as let f x = x + 1,

then bscanf Scanning.stdin "%d" f reads an integer n from the standard input and returns f n (that is n + 1). Thus, if we evaluate bscanf stdin "%d" f, and then enter 41 at the keyboard, the result we get is 42.

Formatted input as a functional feature

The OCaml scanning facility is reminiscent of the corresponding C feature. However, it is also largely different, simpler, and yet more powerful: the formatted input functions are higher-order functionals and the parameter passing mechanism is just the regular function application not the variable assignment based mechanism which is typical for formatted input in imperative languages; the OCaml format strings also feature useful additions to easily define complex tokens; as expected within a functional programming language, the formatted input functions also support polymorphism, in particular arbitrary interaction with polymorphic user-defined scanners. Furthermore, the OCaml formatted input facility is fully type-checked at compile time.

Unsynchronized accesses

Unsynchronized accesses to a Scanning.in_channel may lead to an invalid Scanning.in_channel state. Thus, concurrent accesses to Scanning.in_channels must be synchronized (for instance with a Mutex.t).

Formatted input channel

module Scanning : sig ... end

Type of formatted input functions

type ('a, 'b, 'c, 'd) scanner = + ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd, 'd) format6 -> + 'c

The type of formatted input scanners: ('a, 'b, 'c, 'd) scanner is the type of a formatted input function that reads from some formatted input channel according to some format string; more precisely, if scan is some formatted input function, then scan + ic fmt f applies f to all the arguments specified by format string fmt, when scan has read those arguments from the Scanning.in_channel formatted input channel ic.

For instance, the Scanf.scanf function below has type ('a, 'b, 'c, 'd) scanner, since it is a formatted input function that reads from Scanning.stdin: scanf fmt f applies f to the arguments specified by fmt, reading those arguments from Stdlib.stdin as expected.

If the format fmt has some %r indications, the corresponding formatted input functions must be provided before receiver function f. For instance, if read_elem is an input function for values of type t, then bscanf ic "%r;" read_elem f reads a value v of type t followed by a ';' character, and returns f v.

  • since 3.10
type ('a, 'b, 'c, 'd) scanner_opt = + ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd option, 'd) format6 -> + 'c
exception Scan_failure of string

When the input can not be read according to the format string specification, formatted input functions typically raise exception Scan_failure.

The general formatted input function

val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner

bscanf ic fmt r1 ... rN f reads characters from the Scanning.in_channel formatted input channel ic and converts them to values according to format string fmt. As a final step, receiver function f is applied to the values read and gives the result of the bscanf call.

For instance, if f is the function fun s i -> i + 1, then Scanf.sscanf "x = 1" "%s = %i" f returns 2.

Arguments r1 to rN are user-defined input functions that read the argument corresponding to the %r conversions specified in the format string.

val bscanf_opt : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner_opt

Same as Scanf.bscanf, but returns None in case of scanning failure.

  • since 5.0

Format string description

The format string is a character string which contains three types of objects:

  • plain characters, which are simply matched with the characters of the input (with a special case for space and line feed, see space),
  • conversion specifications, each of which causes reading and conversion of one argument for the function f (see conversion),
  • scanning indications to specify boundaries of tokens (see scanning indication).

The space character in format strings

As mentioned above, a plain character in the format string is just matched with the next character of the input; however, two characters are special exceptions to this rule: the space character (' ' or ASCII code 32) and the line feed character ('\n' or ASCII code 10). A space does not match a single space character, but any amount of 'whitespace' in the input. More precisely, a space inside the format string matches any number of tab, space, line feed and carriage return characters. Similarly, a line feed character in the format string matches either a single line feed or a carriage return followed by a line feed.

Matching any amount of whitespace, a space in the format string also matches no amount of whitespace at all; hence, the call bscanf ib + "Price = %d $" (fun p -> p) succeeds and returns 1 when reading an input with various whitespace in it, such as Price = 1 $, Price = 1 $, or even Price=1$.

Conversion specifications in format strings

Conversion specifications consist in the % character, followed by an optional flag, an optional field width, and followed by one or two conversion characters.

The conversion characters and their meanings are:

  • d: reads an optionally signed decimal integer (0-9+).
  • i: reads an optionally signed integer (usual input conventions for decimal (0-9+), hexadecimal (0x[0-9a-f]+ and 0X[0-9A-F]+), octal (0o[0-7]+), and binary (0b[0-1]+) notations are understood).
  • u: reads an unsigned decimal integer.
  • x or X: reads an unsigned hexadecimal integer ([0-9a-fA-F]+).
  • o: reads an unsigned octal integer ([0-7]+).
  • s: reads a string argument that spreads as much as possible, until the following bounding condition holds:

    • a whitespace has been found (see space),
    • a scanning indication (see scanning indication) has been encountered,
    • the end-of-input has been reached.

    Hence, this conversion always succeeds: it returns an empty string if the bounding condition holds when the scan begins.

  • S: reads a delimited string argument (delimiters and special escaped characters follow the lexical conventions of OCaml).
  • c: reads a single character. To test the current input character without reading it, specify a null field width, i.e. use specification %0c. Raise Invalid_argument, if the field width specification is greater than 1.
  • C: reads a single delimited character (delimiters and special escaped characters follow the lexical conventions of OCaml).
  • f, e, E, g, G: reads an optionally signed floating-point number in decimal notation, in the style dddd.ddd + e/E+-dd.
  • h, H: reads an optionally signed floating-point number in hexadecimal notation.
  • F: reads a floating point number according to the lexical conventions of OCaml (hence the decimal point is mandatory if the exponent part is not mentioned).
  • B: reads a boolean argument (true or false).
  • b: reads a boolean argument (for backward compatibility; do not use in new programs).
  • ld, li, lu, lx, lX, lo: reads an int32 argument to the format specified by the second letter for regular integers.
  • nd, ni, nu, nx, nX, no: reads a nativeint argument to the format specified by the second letter for regular integers.
  • Ld, Li, Lu, Lx, LX, Lo: reads an int64 argument to the format specified by the second letter for regular integers.
  • [ range ]: reads characters that matches one of the characters mentioned in the range of characters range (or not mentioned in it, if the range starts with ^). Reads a string that can be empty, if the next input character does not match the range. The set of characters from c1 to c2 (inclusively) is denoted by c1-c2. Hence, %[0-9] returns a string representing a decimal number or an empty string if no decimal digit is found; similarly, %[0-9a-f] returns a string of hexadecimal digits. If a closing bracket appears in a range, it must occur as the first character of the range (or just after the ^ in case of range negation); hence []] matches a ] character and [^]] matches any character that is not ]. Use %% and %@ to include a % or a @ in a range.
  • r: user-defined reader. Takes the next ri formatted input function and applies it to the scanning buffer ib to read the next argument. The input function ri must therefore have type Scanning.in_channel -> 'a and the argument read has type 'a.
  • { fmt %}: reads a format string argument. The format string read must have the same type as the format string specification fmt. For instance, "%{ %i %}" reads any format string that can read a value of type int; hence, if s is the string "fmt:\"number is %u\"", then Scanf.sscanf s "fmt: %{%i%}" succeeds and returns the format string "number is %u".
  • ( fmt %): scanning sub-format substitution. Reads a format string rf in the input, then goes on scanning with rf instead of scanning with fmt. The format string rf must have the same type as the format string specification fmt that it replaces. For instance, "%( %i %)" reads any format string that can read a value of type int. The conversion returns the format string read rf, and then a value read using rf. Hence, if s is the string "\"%4d\"1234.00", then Scanf.sscanf s "%(%i%)" (fun fmt i -> fmt, i) evaluates to ("%4d", 1234). This behaviour is not mere format substitution, since the conversion returns the format string read as additional argument. If you need pure format substitution, use special flag _ to discard the extraneous argument: conversion %_( fmt %) reads a format string rf and then behaves the same as format string rf. Hence, if s is the string "\"%4d\"1234.00", then Scanf.sscanf s "%_(%i%)" is simply equivalent to Scanf.sscanf "1234.00" "%4d".
  • l: returns the number of lines read so far.
  • n: returns the number of characters read so far.
  • N or L: returns the number of tokens read so far.
  • !: matches the end of input condition.
  • %: matches one % character in the input.
  • @: matches one @ character in the input.
  • ,: does nothing.

Following the % character that introduces a conversion, there may be the special flag _: the conversion that follows occurs as usual, but the resulting value is discarded. For instance, if f is the function fun i -> i + 1, and s is the string "x = 1", then Scanf.sscanf s "%_s = %i" f returns 2.

The field width is composed of an optional integer literal indicating the maximal width of the token to read. For instance, %6d reads an integer, having at most 6 decimal digits; %4f reads a float with at most 4 characters; and %8[\000-\255] returns the next 8 characters (or all the characters still available, if fewer than 8 characters are available in the input).

Notes:

  • as mentioned above, a %s conversion always succeeds, even if there is nothing to read in the input: in this case, it simply returns "".
  • in addition to the relevant digits, '_' characters may appear inside numbers (this is reminiscent to the usual OCaml lexical conventions). If stricter scanning is desired, use the range conversion facility instead of the number conversions.
  • the scanf facility is not intended for heavy duty lexical analysis and parsing. If it appears not expressive enough for your needs, several alternative exists: regular expressions (module Str), stream parsers, ocamllex-generated lexers, ocamlyacc-generated parsers.

Scanning indications in format strings

Scanning indications appear just after the string conversions %s and %[ range ] to delimit the end of the token. A scanning indication is introduced by a @ character, followed by some plain character c. It means that the string token should end just before the next matching c (which is skipped). If no c character is encountered, the string token spreads as much as possible. For instance, "%s@\t" reads a string up to the next tab character or to the end of input. If a @ character appears anywhere else in the format string, it is treated as a plain character.

Note:

  • As usual in format strings, % and @ characters must be escaped using %% and %@; this rule still holds within range specifications and scanning indications. For instance, format "%s@%%" reads a string up to the next % character, and format "%s@%@" reads a string up to the next @.
  • The scanning indications introduce slight differences in the syntax of Scanf format strings, compared to those used for the Printf module. However, the scanning indications are similar to those used in the Format module; hence, when producing formatted text to be scanned by Scanf.bscanf, it is wise to use printing functions from the Format module (or, if you need to use functions from Printf, banish or carefully double check the format strings that contain '@' characters).

Exceptions during scanning

Scanners may raise the following exceptions when the input cannot be read according to the format string:

  • Raise Failure if a conversion to a number is not possible.
  • Raise End_of_file if the end of input is encountered while some more characters are needed to read the current conversion specification.
  • Raise Invalid_argument if the format string is invalid.

Note:

  • as a consequence, scanning a %s conversion never raises exception End_of_file: if the end of input is reached the conversion succeeds and simply returns the characters read so far, or "" if none were ever read.

Specialised formatted input functions

val sscanf : string -> ('a, 'b, 'c, 'd) scanner

Same as Scanf.bscanf, but reads from the given string.

val sscanf_opt : string -> ('a, 'b, 'c, 'd) scanner_opt

Same as Scanf.sscanf, but returns None in case of scanning failure.

  • since 5.0
val scanf : ('a, 'b, 'c, 'd) scanner

Same as Scanf.bscanf, but reads from the predefined formatted input channel Scanf.Scanning.stdin that is connected to Stdlib.stdin.

val scanf_opt : ('a, 'b, 'c, 'd) scanner_opt

Same as Scanf.scanf, but returns None in case of scanning failure.

  • since 5.0
val kscanf : + Scanning.in_channel -> + (Scanning.in_channel -> exn -> 'd) -> + ('a, 'b, 'c, 'd) scanner

Same as Scanf.bscanf, but takes an additional function argument ef that is called in case of error: if the scanning process or some conversion fails, the scanning function aborts and calls the error handling function ef with the formatted input channel and the exception that aborted the scanning process as arguments.

val ksscanf : + string -> + (Scanning.in_channel -> exn -> 'd) -> + ('a, 'b, 'c, 'd) scanner

Same as Scanf.kscanf but reads from the given string.

  • since 4.02

Reading format strings from input

val bscanf_format : + Scanning.in_channel -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + (('a, 'b, 'c, 'd, 'e, 'f) format6 -> 'g) -> + 'g

bscanf_format ic fmt f reads a format string token from the formatted input channel ic, according to the given format string fmt, and applies f to the resulting format string value.

  • raises Scan_failure

    if the format string value read does not have the same type as fmt.

  • since 3.09
val sscanf_format : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + (('a, 'b, 'c, 'd, 'e, 'f) format6 -> 'g) -> + 'g

Same as Scanf.bscanf_format, but reads from the given string.

  • since 3.09
val format_from_string : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + ('a, 'b, 'c, 'd, 'e, 'f) format6

format_from_string s fmt converts a string argument to a format string, according to the given format string fmt.

  • raises Scan_failure

    if s, considered as a format string, does not have the same type as fmt.

  • since 3.10
val unescaped : string -> string

unescaped s return a copy of s with escape sequences (according to the lexical conventions of OCaml) replaced by their corresponding special characters. More precisely, Scanf.unescaped has the following property: for all string s, Scanf.unescaped (String.escaped s) = s.

Always return a copy of the argument, even if there is no escape sequence in the argument.

  • raises Scan_failure

    if s is not properly escaped (i.e. s has invalid escape sequences or special characters that are not properly escaped). For instance, Scanf.unescaped "\"" will fail.

  • since 4.00
diff --git a/ocaml/Stdlib/Semaphore/Binary/index.html b/ocaml/Stdlib/Semaphore/Binary/index.html new file mode 100644 index 00000000..f64116ea --- /dev/null +++ b/ocaml/Stdlib/Semaphore/Binary/index.html @@ -0,0 +1,2 @@ + +Binary (ocaml.Stdlib.Semaphore.Binary)

Module Semaphore.Binary

type t

The type of binary semaphores.

val make : bool -> t

make b returns a new binary semaphore. If b is true, the initial value of the semaphore is 1, meaning "available". If b is false, the initial value of the semaphore is 0, meaning "unavailable".

val release : t -> unit

release s sets the value of semaphore s to 1, putting it in the "available" state. If other threads are waiting on s, one of them is restarted.

val acquire : t -> unit

acquire s blocks the calling thread until the semaphore s has value 1 (is available), then atomically sets it to 0 and returns.

val try_acquire : t -> bool

try_acquire s immediately returns false if the semaphore s has value 0. If s has value 1, its value is atomically set to 0 and try_acquire s returns true.

diff --git a/ocaml/Stdlib/Semaphore/Counting/index.html b/ocaml/Stdlib/Semaphore/Counting/index.html new file mode 100644 index 00000000..1f187ac1 --- /dev/null +++ b/ocaml/Stdlib/Semaphore/Counting/index.html @@ -0,0 +1,2 @@ + +Counting (ocaml.Stdlib.Semaphore.Counting)

Module Semaphore.Counting

type t

The type of counting semaphores.

val make : int -> t

make n returns a new counting semaphore, with initial value n. The initial value n must be nonnegative.

val release : t -> unit

release s increments the value of semaphore s. If other threads are waiting on s, one of them is restarted. If the current value of s is equal to max_int, the value of the semaphore is unchanged and a Sys_error exception is raised to signal overflow.

  • raises Sys_error

    if the value of the semaphore would overflow max_int

val acquire : t -> unit

acquire s blocks the calling thread until the value of semaphore s is not zero, then atomically decrements the value of s and returns.

val try_acquire : t -> bool

try_acquire s immediately returns false if the value of semaphore s is zero. Otherwise, the value of s is atomically decremented and try_acquire s returns true.

val get_value : t -> int

get_value s returns the current value of semaphore s. The current value can be modified at any time by concurrent release and acquire operations. Hence, the get_value operation is racy, and its result should only be used for debugging or informational messages.

diff --git a/ocaml/Stdlib/Semaphore/index.html b/ocaml/Stdlib/Semaphore/index.html new file mode 100644 index 00000000..49e5b39f --- /dev/null +++ b/ocaml/Stdlib/Semaphore/index.html @@ -0,0 +1,2 @@ + +Semaphore (ocaml.Stdlib.Semaphore)

Module Stdlib.Semaphore

Semaphores

A semaphore is a thread synchronization device that can be used to control access to a shared resource.

Two flavors of semaphores are provided: counting semaphores and binary semaphores.

  • since 4.12

Counting semaphores

A counting semaphore is a counter that can be accessed concurrently by several threads. The typical use is to synchronize producers and consumers of a resource by counting how many units of the resource are available.

The two basic operations on semaphores are:

  • "release" (also called "V", "post", "up", and "signal"), which increments the value of the counter. This corresponds to producing one more unit of the shared resource and making it available to others.
  • "acquire" (also called "P", "wait", "down", and "pend"), which waits until the counter is greater than zero and decrements it. This corresponds to consuming one unit of the shared resource.
  • since 4.12
module Counting : sig ... end

Binary semaphores

Binary semaphores are a variant of counting semaphores where semaphores can only take two values, 0 and 1.

A binary semaphore can be used to control access to a single shared resource, with value 1 meaning "resource is available" and value 0 meaning "resource is unavailable".

The "release" operation of a binary semaphore sets its value to 1, and "acquire" waits until the value is 1 and sets it to 0.

A binary semaphore can be used instead of a mutex (see module Mutex) when the mutex discipline (of unlocking the mutex from the thread that locked it) is too restrictive. The "acquire" operation corresponds to locking the mutex, and the "release" operation to unlocking it, but "release" can be performed in a thread different than the one that performed the "acquire". Likewise, it is safe to release a binary semaphore that is already available.

  • since 4.12
module Binary : sig ... end
diff --git a/ocaml/Stdlib/Seq/index.html b/ocaml/Stdlib/Seq/index.html new file mode 100644 index 00000000..e286a6ec --- /dev/null +++ b/ocaml/Stdlib/Seq/index.html @@ -0,0 +1,2 @@ + +Seq (ocaml.Stdlib.Seq)

Module Stdlib.Seq

Sequences.

A sequence of type 'a Seq.t can be thought of as a delayed list, that is, a list whose elements are computed only when they are demanded by a consumer. This allows sequences to be produced and transformed lazily (one element at a time) rather than eagerly (all elements at once). This also allows constructing conceptually infinite sequences.

The type 'a Seq.t is defined as a synonym for unit -> 'a Seq.node. This is a function type: therefore, it is opaque. The consumer can query a sequence in order to request the next element (if there is one), but cannot otherwise inspect the sequence in any way.

Because it is opaque, the type 'a Seq.t does not reveal whether a sequence is:

  • persistent, which means that the sequence can be used as many times as desired, producing the same elements every time, just like an immutable list; or
  • ephemeral, which means that the sequence is not persistent. Querying an ephemeral sequence might have an observable side effect, such as incrementing a mutable counter. As a common special case, an ephemeral sequence can be affine, which means that it must be queried at most once.

It also does not reveal whether the elements of the sequence are:

  • pre-computed and stored in memory, which means that querying the sequence is cheap;
  • computed when first demanded and then stored in memory, which means that querying the sequence once can be expensive, but querying the same sequence again is cheap; or
  • re-computed every time they are demanded, which may or may not be cheap.

It is up to the programmer to keep these distinctions in mind so as to understand the time and space requirements of sequences.

For the sake of simplicity, most of the documentation that follows is written under the implicit assumption that the sequences at hand are persistent. We normally do not point out when or how many times each function is invoked, because that would be too verbose. For instance, in the description of map, we write: "if xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ...". If we wished to be more explicit, we could point out that the transformation takes place on demand: that is, the elements of map f xs are computed only when they are demanded. In other words, the definition let ys = map f xs terminates immediately and does not invoke f. The function call f x0 takes place only when the first element of ys is demanded, via the function call ys(). Furthermore, calling ys() twice causes f x0 to be called twice as well. If one wishes for f to be applied at most once to each element of xs, even in scenarios where ys is queried more than once, then one should use let ys = memoize (map f xs).

As a general rule, the functions that build sequences, such as map, filter, scan, take, etc., produce sequences whose elements are computed only on demand. The functions that eagerly consume sequences, such as is_empty, find, length, iter, fold_left, etc., are the functions that force computation to take place.

When possible, we recommend using sequences rather than dispensers (functions of type unit -> 'a option that produce elements upon demand). Whereas sequences can be persistent or ephemeral, dispensers are always ephemeral, and are typically more difficult to work with than sequences. Two conversion functions, to_dispenser and of_dispenser, are provided.

  • since 4.07
type 'a t = unit -> 'a node

A sequence xs of type 'a t is a delayed list of elements of type 'a. Such a sequence is queried by performing a function application xs(). This function application returns a node, allowing the caller to determine whether the sequence is empty or nonempty, and in the latter case, to obtain its head and tail.

and +'a node =
  1. | Nil
  2. | Cons of 'a * 'a t

A node is either Nil, which means that the sequence is empty, or Cons (x, xs), which means that x is the first element of the sequence and that xs is the remainder of the sequence.

Consuming sequences

The functions in this section consume their argument, a sequence, either partially or completely:

  • is_empty and uncons consume the sequence down to depth 1. That is, they demand the first argument of the sequence, if there is one.
  • iter, fold_left, length, etc., consume the sequence all the way to its end. They terminate only if the sequence is finite.
  • for_all, exists, find, etc. consume the sequence down to a certain depth, which is a priori unpredictable.

Similarly, among the functions that consume two sequences, one can distinguish two groups:

  • iter2 and fold_left2 consume both sequences all the way to the end, provided the sequences have the same length.
  • for_all2, exists2, equal, compare consume the sequences down to a certain depth, which is a priori unpredictable.

The functions that consume two sequences can be applied to two sequences of distinct lengths: in that case, the excess elements in the longer sequence are ignored. (It may be the case that one excess element is demanded, even though this element is not used.)

None of the functions in this section is lazy. These functions are consumers: they force some computation to take place.

val is_empty : 'a t -> bool

is_empty xs determines whether the sequence xs is empty.

It is recommended that the sequence xs be persistent. Indeed, is_empty xs demands the head of the sequence xs, so, if xs is ephemeral, it may be the case that xs cannot be used any more after this call has taken place.

  • since 4.14
val uncons : 'a t -> ('a * 'a t) option

If xs is empty, then uncons xs is None.

If xs is nonempty, then uncons xs is Some (x, ys) where x is the head of the sequence and ys its tail.

  • since 4.14
val length : 'a t -> int

length xs is the length of the sequence xs.

The sequence xs must be finite.

  • since 4.14
val iter : ('a -> unit) -> 'a t -> unit

iter f xs invokes f x successively for every element x of the sequence xs, from left to right.

It terminates only if the sequence xs is finite.

val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

fold_left f _ xs invokes f _ x successively for every element x of the sequence xs, from left to right.

An accumulator of type 'a is threaded through the calls to f.

It terminates only if the sequence xs is finite.

val iteri : (int -> 'a -> unit) -> 'a t -> unit

iteri f xs invokes f i x successively for every element x located at index i in the sequence xs.

It terminates only if the sequence xs is finite.

iteri f xs is equivalent to iter (fun (i, x) -> f i x) (zip (ints 0) xs).

  • since 4.14
val fold_lefti : ('acc -> int -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

fold_lefti f _ xs invokes f _ i x successively for every element x located at index i of the sequence xs.

An accumulator of type 'b is threaded through the calls to f.

It terminates only if the sequence xs is finite.

fold_lefti f accu xs is equivalent to fold_left (fun accu (i, x) -> f accu i x) accu (zip (ints 0) xs).

  • since 4.14
val for_all : ('a -> bool) -> 'a t -> bool

for_all p xs determines whether all elements x of the sequence xs satisfy p x.

The sequence xs must be finite.

  • since 4.14
val exists : ('a -> bool) -> 'a t -> bool

exists xs p determines whether at least one element x of the sequence xs satisfies p x.

The sequence xs must be finite.

  • since 4.14
val find : ('a -> bool) -> 'a t -> 'a option

find p xs returns Some x, where x is the first element of the sequence xs that satisfies p x, if there is such an element.

It returns None if there is no such element.

The sequence xs must be finite.

  • since 4.14
val find_index : ('a -> bool) -> 'a t -> int option

find_index p xs returns Some i, where i is the index of the first element of the sequence xs that satisfies p x, if there is such an element.

It returns None if there is no such element.

The sequence xs must be finite.

  • since 5.1
val find_map : ('a -> 'b option) -> 'a t -> 'b option

find_map f xs returns Some y, where x is the first element of the sequence xs such that f x = Some _, if there is such an element, and where y is defined by f x = Some y.

It returns None if there is no such element.

The sequence xs must be finite.

  • since 4.14
val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option

Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

The sequence xs must be finite.

  • since 5.1
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit

iter2 f xs ys invokes f x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

Iteration terminates only if at least one of the sequences xs and ys is finite.

iter2 f xs ys is equivalent to iter (fun (x, y) -> f x y) (zip xs ys).

  • since 4.14
val fold_left2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc

fold_left2 f _ xs ys invokes f _ x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

An accumulator of type 'a is threaded through the calls to f.

If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

Iteration terminates only if at least one of the sequences xs and ys is finite.

fold_left2 f accu xs ys is equivalent to fold_left (fun accu (x, y) -> f accu x y) (zip xs ys).

  • since 4.14
val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

for_all2 p xs ys determines whether all pairs (x, y) of elements drawn synchronously from the sequences xs and ys satisfy p x y.

If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. In particular, if xs or ys is empty, then for_all2 p xs ys is true. This is where for_all2 and equal differ: equal eq xs ys can be true only if xs and ys have the same length.

At least one of the sequences xs and ys must be finite.

for_all2 p xs ys is equivalent to for_all (fun b -> b) (map2 p xs ys).

  • since 4.14
val exists2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

exists2 p xs ys determines whether some pair (x, y) of elements drawn synchronously from the sequences xs and ys satisfies p x y.

If the sequences xs and ys have different lengths, then iteration must stop as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

At least one of the sequences xs and ys must be finite.

exists2 p xs ys is equivalent to exists (fun b -> b) (map2 p xs ys).

  • since 4.14
val equal : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

Provided the function eq defines an equality on elements, equal eq xs ys determines whether the sequences xs and ys are pointwise equal.

At least one of the sequences xs and ys must be finite.

  • since 4.14
val compare : ('a -> 'b -> int) -> 'a t -> 'b t -> int

Provided the function cmp defines a preorder on elements, compare cmp xs ys compares the sequences xs and ys according to the lexicographic preorder.

For more details on comparison functions, see Array.sort.

At least one of the sequences xs and ys must be finite.

  • since 4.14

Constructing sequences

The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

val empty : 'a t

empty is the empty sequence. It has no elements. Its length is 0.

val return : 'a -> 'a t

return x is the sequence whose sole element is x. Its length is 1.

val cons : 'a -> 'a t -> 'a t

cons x xs is the sequence that begins with the element x, followed with the sequence xs.

Writing cons (f()) xs causes the function call f() to take place immediately. For this call to be delayed until the sequence is queried, one must instead write (fun () -> Cons(f(), xs)).

  • since 4.11
val init : int -> (int -> 'a) -> 'a t

init n f is the sequence f 0; f 1; ...; f (n-1).

n must be nonnegative.

If desired, the infinite sequence f 0; f 1; ... can be defined as map f (ints 0).

  • since 4.14
val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t

unfold constructs a sequence out of a step function and an initial state.

If f u is None then unfold f u is the empty sequence. If f u is Some (x, u') then unfold f u is the nonempty sequence cons x (unfold f u').

For example, unfold (function [] -> None | h :: t -> Some (h, t)) l is equivalent to List.to_seq l.

  • since 4.11
val repeat : 'a -> 'a t

repeat x is the infinite sequence where the element x is repeated indefinitely.

repeat x is equivalent to cycle (return x).

  • since 4.14
val forever : (unit -> 'a) -> 'a t

forever f is an infinite sequence where every element is produced (on demand) by the function call f().

For instance, forever Random.bool is an infinite sequence of random bits.

forever f is equivalent to map f (repeat ()).

  • since 4.14
val cycle : 'a t -> 'a t

cycle xs is the infinite sequence that consists of an infinite number of repetitions of the sequence xs.

If xs is an empty sequence, then cycle xs is empty as well.

Consuming (a prefix of) the sequence cycle xs once can cause the sequence xs to be consumed more than once. Therefore, xs must be persistent.

  • since 4.14
val iterate : ('a -> 'a) -> 'a -> 'a t

iterate f x is the infinite sequence whose elements are x, f x, f (f x), and so on.

In other words, it is the orbit of the function f, starting at x.

  • since 4.14

Transforming sequences

The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

val map : ('a -> 'b) -> 'a t -> 'b t

map f xs is the image of the sequence xs through the transformation f.

If xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ....

val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t

mapi is analogous to map, but applies the function f to an index and an element.

mapi f xs is equivalent to map2 f (ints 0) xs.

  • since 4.14
val filter : ('a -> bool) -> 'a t -> 'a t

filter p xs is the sequence of the elements x of xs that satisfy p x.

In other words, filter p xs is the sequence xs, deprived of the elements x such that p x is false.

val filter_map : ('a -> 'b option) -> 'a t -> 'b t

filter_map f xs is the sequence of the elements y such that f x = Some y, where x ranges over xs.

filter_map f xs is equivalent to map Option.get (filter Option.is_some (map f xs)).

val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t

If xs is a sequence [x0; x1; x2; ...], then scan f a0 xs is a sequence of accumulators [a0; a1; a2; ...] where a1 is f a0 x0, a2 is f a1 x1, and so on.

Thus, scan f a0 xs is conceptually related to fold_left f a0 xs. However, instead of performing an eager iteration and immediately returning the final accumulator, it returns a sequence of accumulators.

For instance, scan (+) 0 transforms a sequence of integers into the sequence of its partial sums.

If xs has length n then scan f a0 xs has length n+1.

  • since 4.14
val take : int -> 'a t -> 'a t

take n xs is the sequence of the first n elements of xs.

If xs has fewer than n elements, then take n xs is equivalent to xs.

n must be nonnegative.

  • since 4.14
val drop : int -> 'a t -> 'a t

drop n xs is the sequence xs, deprived of its first n elements.

If xs has fewer than n elements, then drop n xs is empty.

n must be nonnegative.

drop is lazy: the first n+1 elements of the sequence xs are demanded only when the first element of drop n xs is demanded. For this reason, drop 1 xs is not equivalent to tail xs, which queries xs immediately.

  • since 4.14
val take_while : ('a -> bool) -> 'a t -> 'a t

take_while p xs is the longest prefix of the sequence xs where every element x satisfies p x.

  • since 4.14
val drop_while : ('a -> bool) -> 'a t -> 'a t

drop_while p xs is the sequence xs, deprived of the prefix take_while p xs.

  • since 4.14
val group : ('a -> 'a -> bool) -> 'a t -> 'a t t

Provided the function eq defines an equality on elements, group eq xs is the sequence of the maximal runs of adjacent duplicate elements of the sequence xs.

Every element of group eq xs is a nonempty sequence of equal elements.

The concatenation concat (group eq xs) is equal to xs.

Consuming group eq xs, and consuming the sequences that it contains, can cause xs to be consumed more than once. Therefore, xs must be persistent.

  • since 4.14
val memoize : 'a t -> 'a t

The sequence memoize xs has the same elements as the sequence xs.

Regardless of whether xs is ephemeral or persistent, memoize xs is persistent: even if it is queried several times, xs is queried at most once.

The construction of the sequence memoize xs internally relies on suspensions provided by the module Lazy. These suspensions are not thread-safe. Therefore, the sequence memoize xs must not be queried by multiple threads concurrently.

  • since 4.14
exception Forced_twice

This exception is raised when a sequence returned by once (or a suffix of it) is queried more than once.

  • since 4.14
val once : 'a t -> 'a t

The sequence once xs has the same elements as the sequence xs.

Regardless of whether xs is ephemeral or persistent, once xs is an ephemeral sequence: it can be queried at most once. If it (or a suffix of it) is queried more than once, then the exception Forced_twice is raised. This can be useful, while debugging or testing, to ensure that a sequence is consumed at most once.

  • raises Forced_twice

    if once xs, or a suffix of it, is queried more than once.

  • since 4.14
val transpose : 'a t t -> 'a t t

If xss is a matrix (a sequence of rows), then transpose xss is the sequence of the columns of the matrix xss.

The rows of the matrix xss are not required to have the same length.

The matrix xss is not required to be finite (in either direction).

The matrix xss must be persistent.

  • since 4.14

Combining sequences

val append : 'a t -> 'a t -> 'a t

append xs ys is the concatenation of the sequences xs and ys.

Its elements are the elements of xs, followed by the elements of ys.

  • since 4.11
val concat : 'a t t -> 'a t

If xss is a sequence of sequences, then concat xss is its concatenation.

If xss is the sequence xs0; xs1; ... then concat xss is the sequence xs0 @ xs1 @ ....

  • since 4.13
val flat_map : ('a -> 'b t) -> 'a t -> 'b t

flat_map f xs is equivalent to concat (map f xs).

val concat_map : ('a -> 'b t) -> 'a t -> 'b t

concat_map f xs is equivalent to concat (map f xs).

concat_map is an alias for flat_map.

  • since 4.13
val zip : 'a t -> 'b t -> ('a * 'b) t

zip xs ys is the sequence of pairs (x, y) drawn synchronously from the sequences xs and ys.

If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

zip xs ys is equivalent to map2 (fun a b -> (a, b)) xs ys.

  • since 4.14
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

map2 f xs ys is the sequence of the elements f x y, where the pairs (x, y) are drawn synchronously from the sequences xs and ys.

If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

map2 f xs ys is equivalent to map (fun (x, y) -> f x y) (zip xs ys).

  • since 4.14
val interleave : 'a t -> 'a t -> 'a t

interleave xs ys is the sequence that begins with the first element of xs, continues with the first element of ys, and so on.

When one of the sequences xs and ys is exhausted, interleave xs ys continues with the rest of the other sequence.

  • since 4.14
val sorted_merge : ('a -> 'a -> int) -> 'a t -> 'a t -> 'a t

If the sequences xs and ys are sorted according to the total preorder cmp, then sorted_merge cmp xs ys is the sorted sequence obtained by merging the sequences xs and ys.

For more details on comparison functions, see Array.sort.

  • since 4.14
val product : 'a t -> 'b t -> ('a * 'b) t

product xs ys is the Cartesian product of the sequences xs and ys.

For every element x of xs and for every element y of ys, the pair (x, y) appears once as an element of product xs ys.

The order in which the pairs appear is unspecified.

The sequences xs and ys are not required to be finite.

The sequences xs and ys must be persistent.

  • since 4.14
val map_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

The sequence map_product f xs ys is the image through f of the Cartesian product of the sequences xs and ys.

For every element x of xs and for every element y of ys, the element f x y appears once as an element of map_product f xs ys.

The order in which these elements appear is unspecified.

The sequences xs and ys are not required to be finite.

The sequences xs and ys must be persistent.

map_product f xs ys is equivalent to map (fun (x, y) -> f x y) (product xs ys).

  • since 4.14

Splitting a sequence into two sequences

val unzip : ('a * 'b) t -> 'a t * 'b t

unzip transforms a sequence of pairs into a pair of sequences.

unzip xs is equivalent to (map fst xs, map snd xs).

Querying either of the sequences returned by unzip xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use unzip (memoize xs).

  • since 4.14
val split : ('a * 'b) t -> 'a t * 'b t

split is an alias for unzip.

  • since 4.14
val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> 'b t * 'c t

partition_map f xs returns a pair of sequences (ys, zs), where:

  • ys is the sequence of the elements y such that f x = Left y, where x ranges over xs;
  • zs is the sequence of the elements z such that f x = Right z, where x ranges over xs.

partition_map f xs is equivalent to a pair of filter_map Either.find_left (map f xs) and filter_map Either.find_right (map f xs).

Querying either of the sequences returned by partition_map f xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use partition_map f (memoize xs).

  • since 4.14
val partition : ('a -> bool) -> 'a t -> 'a t * 'a t

partition p xs returns a pair of the subsequence of the elements of xs that satisfy p and the subsequence of the elements of xs that do not satisfy p.

partition p xs is equivalent to filter p xs, filter (fun x -> not (p x)) xs.

Consuming both of the sequences returned by partition p xs causes xs to be consumed twice and causes the function f to be applied twice to each element of the list. Therefore, f should be pure and cheap. Furthermore, xs should be persistent and cheap. If that is not the case, use partition p (memoize xs).

  • since 4.14

Converting between sequences and dispensers

A dispenser is a representation of a sequence as a function of type unit -> 'a option. Every time this function is invoked, it returns the next element of the sequence. When there are no more elements, it returns None. A dispenser has mutable internal state, therefore is ephemeral: the sequence that it represents can be consumed at most once.

val of_dispenser : (unit -> 'a option) -> 'a t

of_dispenser it is the sequence of the elements produced by the dispenser it. It is an ephemeral sequence: it can be consumed at most once. If a persistent sequence is needed, use memoize (of_dispenser it).

  • since 4.14
val to_dispenser : 'a t -> unit -> 'a option

to_dispenser xs is a fresh dispenser on the sequence xs.

This dispenser has mutable internal state, which is not protected by a lock; so, it must not be used by several threads concurrently.

  • since 4.14

Sequences of integers

val ints : int -> int t

ints i is the infinite sequence of the integers beginning at i and counting up.

  • since 4.14
diff --git a/ocaml/Stdlib/Set/Make/argument-1-Ord/index.html b/ocaml/Stdlib/Set/Make/argument-1-Ord/index.html new file mode 100644 index 00000000..9514e828 --- /dev/null +++ b/ocaml/Stdlib/Set/Make/argument-1-Ord/index.html @@ -0,0 +1,2 @@ + +Ord (ocaml.Stdlib.Set.Make.Ord)

Parameter Make.Ord

type t

The type of the set elements.

val compare : t -> t -> int

A total ordering function over the set elements. This is a two-argument function f such that f e1 e2 is zero if the elements e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Stdlib/Set/Make/index.html b/ocaml/Stdlib/Set/Make/index.html new file mode 100644 index 00000000..e9e71582 --- /dev/null +++ b/ocaml/Stdlib/Set/Make/index.html @@ -0,0 +1,3 @@ + +Make (ocaml.Stdlib.Set.Make)

Module Set.Make

Functor building an implementation of the set structure given a totally ordered type.

Parameters

module Ord : OrderedType

Signature

Sets

type elt = Ord.t

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Stdlib/Set/index.html b/ocaml/Stdlib/Set/index.html new file mode 100644 index 00000000..0a98be80 --- /dev/null +++ b/ocaml/Stdlib/Set/index.html @@ -0,0 +1,13 @@ + +Set (ocaml.Stdlib.Set)

Module Stdlib.Set

Sets over ordered types.

This module implements the set data structure, given a total ordering function over the set elements. All operations over sets are purely applicative (no side-effects). The implementation uses balanced binary trees, and is therefore reasonably efficient: insertion and membership take time logarithmic in the size of the set, for instance.

The Make functor constructs implementations for any type, given a compare function. For instance:

module IntPairs =
+  struct
+    type t = int * int
+    let compare (x0,y0) (x1,y1) =
+      match Stdlib.compare x0 x1 with
+          0 -> Stdlib.compare y0 y1
+        | c -> c
+  end
+
+module PairsSet = Set.Make(IntPairs)
+
+let m = PairsSet.(empty |> add (2,3) |> add (5,7) |> add (11,13))

This creates a new module PairsSet, with a new type PairsSet.t of sets of int * int.

module type OrderedType = sig ... end

Input signature of the functor Make.

module type S = sig ... end

Output signature of the functor Make.

module Make (Ord : OrderedType) : S with type elt = Ord.t

Functor building an implementation of the set structure given a totally ordered type.

diff --git a/ocaml/Stdlib/Set/module-type-OrderedType/index.html b/ocaml/Stdlib/Set/module-type-OrderedType/index.html new file mode 100644 index 00000000..56ef990d --- /dev/null +++ b/ocaml/Stdlib/Set/module-type-OrderedType/index.html @@ -0,0 +1,2 @@ + +OrderedType (ocaml.Stdlib.Set.OrderedType)

Module type Set.OrderedType

Input signature of the functor Make.

type t

The type of the set elements.

val compare : t -> t -> int

A total ordering function over the set elements. This is a two-argument function f such that f e1 e2 is zero if the elements e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

diff --git a/ocaml/Stdlib/Set/module-type-S/index.html b/ocaml/Stdlib/Set/module-type-S/index.html new file mode 100644 index 00000000..2497b312 --- /dev/null +++ b/ocaml/Stdlib/Set/module-type-S/index.html @@ -0,0 +1,3 @@ + +S (ocaml.Stdlib.Set.S)

Module type Set.S

Output signature of the functor Make.

Sets

type elt

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Stdlib/Stack/index.html b/ocaml/Stdlib/Stack/index.html new file mode 100644 index 00000000..6639237d --- /dev/null +++ b/ocaml/Stdlib/Stack/index.html @@ -0,0 +1,2 @@ + +Stack (ocaml.Stdlib.Stack)

Module Stdlib.Stack

Last-in first-out stacks.

This module implements stacks (LIFOs), with in-place modification.

Unsynchronized accesses

Unsynchronized accesses to a stack may lead to an invalid queue state. Thus, concurrent accesses to stacks must be synchronized (for instance with a Mutex.t).

type !'a t

The type of stacks containing elements of type 'a.

exception Empty

Raised when Stack.pop or Stack.top is applied to an empty stack.

val create : unit -> 'a t

Return a new stack, initially empty.

val push : 'a -> 'a t -> unit

push x s adds the element x at the top of stack s.

val pop : 'a t -> 'a

pop s removes and returns the topmost element in stack s, or raises Empty if the stack is empty.

val pop_opt : 'a t -> 'a option

pop_opt s removes and returns the topmost element in stack s, or returns None if the stack is empty.

  • since 4.08
val drop : 'a t -> unit

drop s removes the topmost element in stack s, or raises Empty if the stack is empty.

  • since 5.1
val top : 'a t -> 'a

top s returns the topmost element in stack s, or raises Empty if the stack is empty.

val top_opt : 'a t -> 'a option

top_opt s returns the topmost element in stack s, or None if the stack is empty.

  • since 4.08
val clear : 'a t -> unit

Discard all elements from a stack.

val copy : 'a t -> 'a t

Return a copy of the given stack.

val is_empty : 'a t -> bool

Return true if the given stack is empty, false otherwise.

val length : 'a t -> int

Return the number of elements in a stack. Time complexity O(1)

val iter : ('a -> unit) -> 'a t -> unit

iter f s applies f in turn to all elements of s, from the element at the top of the stack to the element at the bottom of the stack. The stack itself is unchanged.

val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

fold f accu s is (f (... (f (f accu x1) x2) ...) xn) where x1 is the top of the stack, x2 the second element, and xn the bottom element. The stack is unchanged.

  • since 4.03

Stacks and Sequences

val to_seq : 'a t -> 'a Seq.t

Iterate on the stack, top to bottom. It is safe to modify the stack during iteration.

  • since 4.07
val add_seq : 'a t -> 'a Seq.t -> unit

Add the elements from the sequence on the top of the stack.

  • since 4.07
val of_seq : 'a Seq.t -> 'a t

Create a stack from the sequence.

  • since 4.07
diff --git a/ocaml/Stdlib/StdLabels/index.html b/ocaml/Stdlib/StdLabels/index.html new file mode 100644 index 00000000..cb11b3bf --- /dev/null +++ b/ocaml/Stdlib/StdLabels/index.html @@ -0,0 +1,6 @@ + +StdLabels (ocaml.Stdlib.StdLabels)

Module Stdlib.StdLabels

Standard labeled libraries.

This meta-module provides versions of the Array, Bytes, List and String modules where function arguments are systematically labeled. It is intended to be opened at the top of source files, as shown below.

open StdLabels
+
+let to_upper = String.map ~f:Char.uppercase_ascii
+let seq len = List.init ~f:(fun i -> i) ~len
+let everything = Array.create_matrix ~dimx:42 ~dimy:42 42
module Array = ArrayLabels
module Bytes = BytesLabels
module List = ListLabels
module String = StringLabels
diff --git a/ocaml/Stdlib/String/index.html b/ocaml/Stdlib/String/index.html new file mode 100644 index 00000000..f9a21cde --- /dev/null +++ b/ocaml/Stdlib/String/index.html @@ -0,0 +1,6 @@ + +String (ocaml.Stdlib.String)

Module Stdlib.String

Strings.

A string s of length n is an indexable and immutable sequence of n bytes. For historical reasons these bytes are referred to as characters.

The semantics of string functions is defined in terms of indices and positions. These are depicted and described as follows.

positions  0   1   2   3   4    n-1    n
+           +---+---+---+---+     +-----+
+  indices  | 0 | 1 | 2 | 3 | ... | n-1 |
+           +---+---+---+---+     +-----+
  • An index i of s is an integer in the range [0;n-1]. It represents the ith byte (character) of s which can be accessed using the constant time string indexing operator s.[i].
  • A position i of s is an integer in the range [0;n]. It represents either the point at the beginning of the string, or the point between two indices, or the point at the end of the string. The ith byte index is between position i and i+1.

Two integers start and len are said to define a valid substring of s if len >= 0 and start, start+len are positions of s.

Unicode text. Strings being arbitrary sequences of bytes, they can hold any kind of textual encoding. However the recommended encoding for storing Unicode text in OCaml strings is UTF-8. This is the encoding used by Unicode escapes in string literals. For example the string "\u{1F42B}" is the UTF-8 encoding of the Unicode character U+1F42B.

Past mutability. Before OCaml 4.02, strings used to be modifiable in place like Bytes.t mutable sequences of bytes. OCaml 4 had various compiler flags and configuration options to support the transition period from mutable to immutable strings. Those options are no longer available, and strings are now always immutable.

The labeled version of this module can be used as described in the StdLabels module.

Strings

type t = string

The type for strings.

val make : int -> char -> string

make n c is a string of length n with each index holding the character c.

val init : int -> (int -> char) -> string

init n f is a string of length n with index i holding the character f i (called in increasing index order).

  • since 4.02
val empty : string

The empty string.

  • since 4.13
val length : string -> int

length s is the length (number of bytes/characters) of s.

val get : string -> int -> char

get s i is the character at index i in s. This is the same as writing s.[i].

val of_bytes : bytes -> string

Return a new string that contains the same bytes as the given byte sequence.

  • since 4.13
val to_bytes : string -> bytes

Return a new byte sequence that contains the same bytes as the given string.

  • since 4.13
val blit : string -> int -> bytes -> int -> int -> unit

Same as Bytes.blit_string which should be preferred.

Concatenating

Note. The Stdlib.(^) binary operator concatenates two strings.

val concat : string -> string list -> string

concat sep ss concatenates the list of strings ss, inserting the separator string sep between each.

val cat : string -> string -> string

cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

  • since 4.13

Predicates and comparisons

val equal : t -> t -> bool

equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

  • since 4.03 (4.05 in StringLabels)
val compare : t -> t -> int

compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

val starts_with : prefix:string -> string -> bool

starts_with ~prefix s is true if and only if s starts with prefix.

  • since 4.13
val ends_with : suffix:string -> string -> bool

ends_with ~suffix s is true if and only if s ends with suffix.

  • since 4.13
val contains_from : string -> int -> char -> bool

contains_from s start c is true if and only if c appears in s after position start.

val rcontains_from : string -> int -> char -> bool

rcontains_from s stop c is true if and only if c appears in s before position stop+1.

val contains : string -> char -> bool

contains s c is String.contains_from s 0 c.

Extracting substrings

val sub : string -> int -> int -> string

sub s pos len is a string of length len, containing the substring of s that starts at position pos and has length len.

val split_on_char : char -> string -> string list

split_on_char sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

The function's result is specified by the following invariants:

  • The list is not empty.
  • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) + (split_on_char sep s) = s).
  • No string in the result contains the sep character.
  • since 4.04 (4.05 in StringLabels)

Transforming

val map : (char -> char) -> string -> string

map f s is the string resulting from applying f to all the characters of s in increasing order.

  • since 4.00
val mapi : (int -> char -> char) -> string -> string

mapi f s is like map but the index of the character is also passed to f.

  • since 4.02
val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc

fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

  • since 4.13
val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc

fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

  • since 4.13
val for_all : (char -> bool) -> string -> bool

for_all p s checks if all characters in s satisfy the predicate p.

  • since 4.13
val exists : (char -> bool) -> string -> bool

exists p s checks if at least one character of s satisfies the predicate p.

  • since 4.13
val trim : string -> string

trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

  • since 4.00
val escaped : string -> string

escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

val uppercase_ascii : string -> string

uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

  • since 4.03 (4.05 in StringLabels)
val lowercase_ascii : string -> string

lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

  • since 4.03 (4.05 in StringLabels)
val capitalize_ascii : string -> string

capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

  • since 4.03 (4.05 in StringLabels)
val uncapitalize_ascii : string -> string

uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

  • since 4.03 (4.05 in StringLabels)

Traversing

val iter : (char -> unit) -> string -> unit

iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

val iteri : (int -> char -> unit) -> string -> unit

iteri is like iter, but the function is also given the corresponding character index.

  • since 4.00

Searching

val index_from : string -> int -> char -> int

index_from s i c is the index of the first occurrence of c in s after position i.

  • raises Not_found

    if c does not occur in s after position i.

val index_from_opt : string -> int -> char -> int option

index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

  • since 4.05
val rindex_from : string -> int -> char -> int

rindex_from s i c is the index of the last occurrence of c in s before position i+1.

  • raises Not_found

    if c does not occur in s before position i+1.

val rindex_from_opt : string -> int -> char -> int option

rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

  • since 4.05
val index : string -> char -> int

index s c is String.index_from s 0 c.

val index_opt : string -> char -> int option

index_opt s c is String.index_from_opt s 0 c.

  • since 4.05
val rindex : string -> char -> int

rindex s c is String.rindex_from s (length s - 1) c.

val rindex_opt : string -> char -> int option

rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

  • since 4.05

Strings and Sequences

val to_seq : t -> char Seq.t

to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

  • since 4.07
val to_seqi : t -> (int * char) Seq.t

to_seqi s is like to_seq but also tuples the corresponding index.

  • since 4.07
val of_seq : char Seq.t -> t

of_seq s is a string made of the sequence's characters.

  • since 4.07

UTF decoding and validations

  • since 4.14

UTF-8

val get_utf_8_uchar : t -> int -> Uchar.utf_decode

get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

val is_valid_utf_8 : t -> bool

is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

UTF-16BE

val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

val is_valid_utf_16be : t -> bool

is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

UTF-16LE

val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

val is_valid_utf_16le : t -> bool

is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

Binary decoding of integers

The functions in this section binary decode integers from strings.

All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

val get_uint8 : string -> int -> int

get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

  • since 4.13
val get_int8 : string -> int -> int

get_int8 b i is b's signed 8-bit integer starting at character index i.

  • since 4.13
val get_uint16_ne : string -> int -> int

get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

  • since 4.13
val get_uint16_be : string -> int -> int

get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

  • since 4.13
val get_uint16_le : string -> int -> int

get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

  • since 4.13
val get_int16_ne : string -> int -> int

get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

  • since 4.13
val get_int16_be : string -> int -> int

get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

  • since 4.13
val get_int16_le : string -> int -> int

get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

  • since 4.13
val get_int32_ne : string -> int -> int32

get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

  • since 4.13
val hash : t -> int

An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.0
val seeded_hash : int -> t -> int

A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.0
val get_int32_be : string -> int -> int32

get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

  • since 4.13
val get_int32_le : string -> int -> int32

get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

  • since 4.13
val get_int64_ne : string -> int -> int64

get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

  • since 4.13
val get_int64_be : string -> int -> int64

get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

  • since 4.13
val get_int64_le : string -> int -> int64

get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

  • since 4.13
diff --git a/ocaml/Stdlib/StringLabels/index.html b/ocaml/Stdlib/StringLabels/index.html new file mode 100644 index 00000000..6522b104 --- /dev/null +++ b/ocaml/Stdlib/StringLabels/index.html @@ -0,0 +1,12 @@ + +StringLabels (ocaml.Stdlib.StringLabels)

Module Stdlib.StringLabels

Strings.

A string s of length n is an indexable and immutable sequence of n bytes. For historical reasons these bytes are referred to as characters.

The semantics of string functions is defined in terms of indices and positions. These are depicted and described as follows.

positions  0   1   2   3   4    n-1    n
+           +---+---+---+---+     +-----+
+  indices  | 0 | 1 | 2 | 3 | ... | n-1 |
+           +---+---+---+---+     +-----+
  • An index i of s is an integer in the range [0;n-1]. It represents the ith byte (character) of s which can be accessed using the constant time string indexing operator s.[i].
  • A position i of s is an integer in the range [0;n]. It represents either the point at the beginning of the string, or the point between two indices, or the point at the end of the string. The ith byte index is between position i and i+1.

Two integers start and len are said to define a valid substring of s if len >= 0 and start, start+len are positions of s.

Unicode text. Strings being arbitrary sequences of bytes, they can hold any kind of textual encoding. However the recommended encoding for storing Unicode text in OCaml strings is UTF-8. This is the encoding used by Unicode escapes in string literals. For example the string "\u{1F42B}" is the UTF-8 encoding of the Unicode character U+1F42B.

Past mutability. Before OCaml 4.02, strings used to be modifiable in place like Bytes.t mutable sequences of bytes. OCaml 4 had various compiler flags and configuration options to support the transition period from mutable to immutable strings. Those options are no longer available, and strings are now always immutable.

The labeled version of this module can be used as described in the StdLabels module.

Strings

type t = string

The type for strings.

val make : int -> char -> string

make n c is a string of length n with each index holding the character c.

val init : int -> f:(int -> char) -> string

init n ~f is a string of length n with index i holding the character f i (called in increasing index order).

  • since 4.02
val empty : string

The empty string.

  • since 4.13
val length : string -> int

length s is the length (number of bytes/characters) of s.

val get : string -> int -> char

get s i is the character at index i in s. This is the same as writing s.[i].

val of_bytes : bytes -> string

Return a new string that contains the same bytes as the given byte sequence.

  • since 4.13
val to_bytes : string -> bytes

Return a new byte sequence that contains the same bytes as the given string.

  • since 4.13
val blit : + src:string -> + src_pos:int -> + dst:bytes -> + dst_pos:int -> + len:int -> + unit

Same as Bytes.blit_string which should be preferred.

Concatenating

Note. The Stdlib.(^) binary operator concatenates two strings.

val concat : sep:string -> string list -> string

concat ~sep ss concatenates the list of strings ss, inserting the separator string sep between each.

val cat : string -> string -> string

cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

  • since 4.13

Predicates and comparisons

val equal : t -> t -> bool

equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

  • since 4.05
val compare : t -> t -> int

compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

val starts_with : prefix:string -> string -> bool

starts_with ~prefix s is true if and only if s starts with prefix.

  • since 4.13
val ends_with : suffix:string -> string -> bool

ends_with ~suffix s is true if and only if s ends with suffix.

  • since 4.13
val contains_from : string -> int -> char -> bool

contains_from s start c is true if and only if c appears in s after position start.

val rcontains_from : string -> int -> char -> bool

rcontains_from s stop c is true if and only if c appears in s before position stop+1.

val contains : string -> char -> bool

contains s c is String.contains_from s 0 c.

Extracting substrings

val sub : string -> pos:int -> len:int -> string

sub s ~pos ~len is a string of length len, containing the substring of s that starts at position pos and has length len.

val split_on_char : sep:char -> string -> string list

split_on_char ~sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

The function's result is specified by the following invariants:

  • The list is not empty.
  • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) + (split_on_char sep s) = s).
  • No string in the result contains the sep character.
  • since 4.05

Transforming

val map : f:(char -> char) -> string -> string

map f s is the string resulting from applying f to all the characters of s in increasing order.

  • since 4.00
val mapi : f:(int -> char -> char) -> string -> string

mapi ~f s is like map but the index of the character is also passed to f.

  • since 4.02
val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> string -> 'acc

fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

  • since 4.13
val fold_right : f:(char -> 'acc -> 'acc) -> string -> init:'acc -> 'acc

fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

  • since 4.13
val for_all : f:(char -> bool) -> string -> bool

for_all p s checks if all characters in s satisfy the predicate p.

  • since 4.13
val exists : f:(char -> bool) -> string -> bool

exists p s checks if at least one character of s satisfies the predicate p.

  • since 4.13
val trim : string -> string

trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

  • since 4.00
val escaped : string -> string

escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

val uppercase_ascii : string -> string

uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

  • since 4.05
val lowercase_ascii : string -> string

lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

  • since 4.05
val capitalize_ascii : string -> string

capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

  • since 4.05
val uncapitalize_ascii : string -> string

uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

  • since 4.05

Traversing

val iter : f:(char -> unit) -> string -> unit

iter ~f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

val iteri : f:(int -> char -> unit) -> string -> unit

iteri is like iter, but the function is also given the corresponding character index.

  • since 4.00

Searching

val index_from : string -> int -> char -> int

index_from s i c is the index of the first occurrence of c in s after position i.

  • raises Not_found

    if c does not occur in s after position i.

val index_from_opt : string -> int -> char -> int option

index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

  • since 4.05
val rindex_from : string -> int -> char -> int

rindex_from s i c is the index of the last occurrence of c in s before position i+1.

  • raises Not_found

    if c does not occur in s before position i+1.

val rindex_from_opt : string -> int -> char -> int option

rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

  • since 4.05
val index : string -> char -> int

index s c is String.index_from s 0 c.

val index_opt : string -> char -> int option

index_opt s c is String.index_from_opt s 0 c.

  • since 4.05
val rindex : string -> char -> int

rindex s c is String.rindex_from s (length s - 1) c.

val rindex_opt : string -> char -> int option

rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

  • since 4.05

Strings and Sequences

val to_seq : t -> char Seq.t

to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

  • since 4.07
val to_seqi : t -> (int * char) Seq.t

to_seqi s is like to_seq but also tuples the corresponding index.

  • since 4.07
val of_seq : char Seq.t -> t

of_seq s is a string made of the sequence's characters.

  • since 4.07

UTF decoding and validations

  • since 4.14

UTF-8

val get_utf_8_uchar : t -> int -> Uchar.utf_decode

get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

val is_valid_utf_8 : t -> bool

is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

UTF-16BE

val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

val is_valid_utf_16be : t -> bool

is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

UTF-16LE

val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

val is_valid_utf_16le : t -> bool

is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

Binary decoding of integers

The functions in this section binary decode integers from strings.

All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

val get_uint8 : string -> int -> int

get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

  • since 4.13
val get_int8 : string -> int -> int

get_int8 b i is b's signed 8-bit integer starting at character index i.

  • since 4.13
val get_uint16_ne : string -> int -> int

get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

  • since 4.13
val get_uint16_be : string -> int -> int

get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

  • since 4.13
val get_uint16_le : string -> int -> int

get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

  • since 4.13
val get_int16_ne : string -> int -> int

get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

  • since 4.13
val get_int16_be : string -> int -> int

get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

  • since 4.13
val get_int16_le : string -> int -> int

get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

  • since 4.13
val get_int32_ne : string -> int -> int32

get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

  • since 4.13
val hash : t -> int

An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.0
val seeded_hash : int -> t -> int

A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.0
val get_int32_be : string -> int -> int32

get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

  • since 4.13
val get_int32_le : string -> int -> int32

get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

  • since 4.13
val get_int64_ne : string -> int -> int64

get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

  • since 4.13
val get_int64_be : string -> int -> int64

get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

  • since 4.13
val get_int64_le : string -> int -> int64

get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

  • since 4.13
diff --git a/ocaml/Stdlib/Sys/Immediate64/Make/argument-1-Immediate/index.html b/ocaml/Stdlib/Sys/Immediate64/Make/argument-1-Immediate/index.html new file mode 100644 index 00000000..4c2863f0 --- /dev/null +++ b/ocaml/Stdlib/Sys/Immediate64/Make/argument-1-Immediate/index.html @@ -0,0 +1,2 @@ + +Immediate (ocaml.Stdlib.Sys.Immediate64.Make.Immediate)

Parameter Make.Immediate

type t
diff --git a/ocaml/Stdlib/Sys/Immediate64/Make/argument-2-Non_immediate/index.html b/ocaml/Stdlib/Sys/Immediate64/Make/argument-2-Non_immediate/index.html new file mode 100644 index 00000000..b46bbf16 --- /dev/null +++ b/ocaml/Stdlib/Sys/Immediate64/Make/argument-2-Non_immediate/index.html @@ -0,0 +1,2 @@ + +Non_immediate (ocaml.Stdlib.Sys.Immediate64.Make.Non_immediate)

Parameter Make.Non_immediate

type t
diff --git a/ocaml/Stdlib/Sys/Immediate64/Make/index.html b/ocaml/Stdlib/Sys/Immediate64/Make/index.html new file mode 100644 index 00000000..854a325e --- /dev/null +++ b/ocaml/Stdlib/Sys/Immediate64/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Stdlib.Sys.Immediate64.Make)

Module Immediate64.Make

Parameters

Signature

type t
type 'a repr =
  1. | Immediate : Immediate.t repr
  2. | Non_immediate : Non_immediate.t repr
val repr : t repr
diff --git a/ocaml/Stdlib/Sys/Immediate64/index.html b/ocaml/Stdlib/Sys/Immediate64/index.html new file mode 100644 index 00000000..9dbab4da --- /dev/null +++ b/ocaml/Stdlib/Sys/Immediate64/index.html @@ -0,0 +1,5 @@ + +Immediate64 (ocaml.Stdlib.Sys.Immediate64)

Module Sys.Immediate64

This module allows to define a type t with the immediate64 attribute. This attribute means that the type is immediate on 64 bit architectures. On other architectures, it might or might not be immediate.

  • since 4.10
module type Non_immediate = sig ... end
module type Immediate = sig ... end
module Make + (Immediate : Immediate) + (Non_immediate : Non_immediate) : + sig ... end
diff --git a/ocaml/Stdlib/Sys/Immediate64/module-type-Immediate/index.html b/ocaml/Stdlib/Sys/Immediate64/module-type-Immediate/index.html new file mode 100644 index 00000000..c67a5e0a --- /dev/null +++ b/ocaml/Stdlib/Sys/Immediate64/module-type-Immediate/index.html @@ -0,0 +1,2 @@ + +Immediate (ocaml.Stdlib.Sys.Immediate64.Immediate)

Module type Immediate64.Immediate

type t
diff --git a/ocaml/Stdlib/Sys/Immediate64/module-type-Non_immediate/index.html b/ocaml/Stdlib/Sys/Immediate64/module-type-Non_immediate/index.html new file mode 100644 index 00000000..3d7b849f --- /dev/null +++ b/ocaml/Stdlib/Sys/Immediate64/module-type-Non_immediate/index.html @@ -0,0 +1,2 @@ + +Non_immediate (ocaml.Stdlib.Sys.Immediate64.Non_immediate)

Module type Immediate64.Non_immediate

type t
diff --git a/ocaml/Stdlib/Sys/index.html b/ocaml/Stdlib/Sys/index.html new file mode 100644 index 00000000..fd7514a9 --- /dev/null +++ b/ocaml/Stdlib/Sys/index.html @@ -0,0 +1,4 @@ + +Sys (ocaml.Stdlib.Sys)

Module Stdlib.Sys

System interface.

Every function in this module raises Sys_error with an informative message when the underlying system call signal an error.

val argv : string array

The command line arguments given to the process. The first element is the command name used to invoke the program. The following elements are the command-line arguments given to the program.

val executable_name : string

The name of the file containing the executable currently running. This name may be absolute or relative to the current directory, depending on the platform and whether the program was compiled to bytecode or a native executable.

val file_exists : string -> bool

Test if a file with the given name exists.

val is_directory : string -> bool

Returns true if the given name refers to a directory, false if it refers to another kind of file.

  • raises Sys_error

    if no file exists with the given name.

  • since 3.10
val is_regular_file : string -> bool

Returns true if the given name refers to a regular file, false if it refers to another kind of file.

  • raises Sys_error

    if no file exists with the given name.

  • since 5.1
val remove : string -> unit

Remove the given file name from the file system.

val rename : string -> string -> unit

Rename a file or directory. rename oldpath newpath renames the file or directory called oldpath, giving it newpath as its new name, moving it between (parent) directories if needed. If a file named newpath already exists, its contents will be replaced with those of oldpath. Depending on the operating system, the metadata (permissions, owner, etc) of newpath can either be preserved or be replaced by those of oldpath.

  • since 4.06 concerning the "replace existing file" behavior
val getenv : string -> string

Return the value associated to a variable in the process environment.

val getenv_opt : string -> string option

Return the value associated to a variable in the process environment or None if the variable is unbound.

  • since 4.05
val command : string -> int

Execute the given shell command and return its exit code.

The argument of Sys.command is generally the name of a command followed by zero, one or several arguments, separated by whitespace. The given argument is interpreted by a shell: either the Windows shell cmd.exe for the Win32 ports of OCaml, or the POSIX shell sh for other ports. It can contain shell builtin commands such as echo, and also special characters such as file redirections > and <, which will be honored by the shell.

Conversely, whitespace or special shell characters occurring in command names or in their arguments must be quoted or escaped so that the shell does not interpret them. The quoting rules vary between the POSIX shell and the Windows shell. The Filename.quote_command performs the appropriate quoting given a command name, a list of arguments, and optional file redirections.

val time : unit -> float

Return the processor time, in seconds, used by the program since the beginning of execution.

val chdir : string -> unit

Change the current working directory of the process.

val mkdir : string -> int -> unit

Create a directory with the given permissions.

  • since 4.12
val rmdir : string -> unit

Remove an empty directory.

  • since 4.12
val getcwd : unit -> string

Return the current working directory of the process.

val readdir : string -> string array

Return the names of all files present in the given directory. Names denoting the current directory and the parent directory ("." and ".." in Unix) are not returned. Each string in the result is a file name rather than a complete path. There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

val interactive : bool ref

This reference is initially set to false in standalone programs and to true if the code is being executed under the interactive toplevel system ocaml.

  • alert unsynchronized_access The interactive status is a mutable global state.
val os_type : string

Operating system currently executing the OCaml program. One of

  • "Unix" (for all Unix versions, including Linux and Mac OS X),
  • "Win32" (for MS-Windows, OCaml compiled with MSVC++ or MinGW-w64),
  • "Cygwin" (for MS-Windows, OCaml compiled with Cygwin).
type backend_type =
  1. | Native
  2. | Bytecode
  3. | Other of string

Currently, the official distribution only supports Native and Bytecode, but it can be other backends with alternative compilers, for example, javascript.

  • since 4.04
val backend_type : backend_type

Backend type currently executing the OCaml program.

  • since 4.04
val unix : bool

True if Sys.os_type = "Unix".

  • since 4.01
val win32 : bool

True if Sys.os_type = "Win32".

  • since 4.01
val cygwin : bool

True if Sys.os_type = "Cygwin".

  • since 4.01
val word_size : int

Size of one word on the machine currently executing the OCaml program, in bits: 32 or 64.

val int_size : int

Size of int, in bits. It is 31 (resp. 63) when using OCaml on a 32-bit (resp. 64-bit) platform. It may differ for other implementations, e.g. it can be 32 bits when compiling to JavaScript.

  • since 4.03
val big_endian : bool

Whether the machine currently executing the Caml program is big-endian.

  • since 4.00
val max_string_length : int

Maximum length of strings and byte sequences.

val max_array_length : int

Maximum length of a normal array (i.e. any array whose elements are not of type float). The maximum length of a float array is max_floatarray_length if OCaml was configured with --enable-flat-float-array and max_array_length if configured with --disable-flat-float-array.

val max_floatarray_length : int

Maximum length of a floatarray. This is also the maximum length of a float array when OCaml is configured with --enable-flat-float-array.

val runtime_variant : unit -> string

Return the name of the runtime variant the program is running on. This is normally the argument given to -runtime-variant at compile time, but for byte-code it can be changed after compilation.

  • since 4.03
val runtime_parameters : unit -> string

Return the value of the runtime parameters, in the same format as the contents of the OCAMLRUNPARAM environment variable.

  • since 4.03

Signal handling

type signal_behavior =
  1. | Signal_default
  2. | Signal_ignore
  3. | Signal_handle of int -> unit

What to do when receiving a signal:

  • Signal_default: take the default behavior (usually: abort the program)
  • Signal_ignore: ignore the signal
  • Signal_handle f: call function f, giving it the signal number as argument.
val signal : int -> signal_behavior -> signal_behavior

Set the behavior of the system on receipt of a given signal. The first argument is the signal number. Return the behavior previously associated with the signal. If the signal number is invalid (or not available on your system), an Invalid_argument exception is raised.

val set_signal : int -> signal_behavior -> unit

Same as Sys.signal but return value is ignored.

Signal numbers for the standard POSIX signals.

val sigabrt : int

Abnormal termination

val sigalrm : int

Timeout

val sigfpe : int

Arithmetic exception

val sighup : int

Hangup on controlling terminal

val sigill : int

Invalid hardware instruction

val sigint : int

Interactive interrupt (ctrl-C)

val sigkill : int

Termination (cannot be ignored)

val sigpipe : int

Broken pipe

val sigquit : int

Interactive termination

val sigsegv : int

Invalid memory reference

val sigterm : int

Termination

val sigusr1 : int

Application-defined signal 1

val sigusr2 : int

Application-defined signal 2

val sigchld : int

Child process terminated

val sigcont : int

Continue

val sigstop : int

Stop

val sigtstp : int

Interactive stop

val sigttin : int

Terminal read from background process

val sigttou : int

Terminal write from background process

val sigvtalrm : int

Timeout in virtual time

val sigprof : int

Profiling interrupt

val sigbus : int

Bus error

  • since 4.03
val sigpoll : int

Pollable event

  • since 4.03
val sigsys : int

Bad argument to routine

  • since 4.03
val sigtrap : int

Trace/breakpoint trap

  • since 4.03
val sigurg : int

Urgent condition on socket

  • since 4.03
val sigxcpu : int

Timeout in cpu time

  • since 4.03
val sigxfsz : int

File size limit exceeded

  • since 4.03
exception Break

Exception raised on interactive interrupt if Sys.catch_break is on.

val catch_break : bool -> unit

catch_break governs whether interactive interrupt (ctrl-C) terminates the program or raises the Break exception. Call catch_break true to enable raising Break, and catch_break false to let the system terminate the program on user interrupt.

val ocaml_version : string

ocaml_version is the version of OCaml. It is a string of the form "major.minor[.patchlevel][(+|~)additional-info]", where major, minor, and patchlevel are integers, and additional-info is an arbitrary string. The [.patchlevel] part was absent before version 3.08.0 and became mandatory from 3.08.0 onwards. The [(+|~)additional-info] part may be absent.

val development_version : bool

true if this is a development version, false otherwise.

  • since 4.14
type extra_prefix =
  1. | Plus
  2. | Tilde
    (*
    • since 4.14
    *)
type extra_info = extra_prefix * string
  • since 4.14
type ocaml_release_info = {
  1. major : int;
  2. minor : int;
  3. patchlevel : int;
  4. extra : extra_info option;
}
  • since 4.14
val ocaml_release : ocaml_release_info

ocaml_release is the version of OCaml.

  • since 4.14
val enable_runtime_warnings : bool -> unit

Control whether the OCaml runtime system can emit warnings on stderr. Currently, the only supported warning is triggered when a channel created by open_* functions is finalized without being closed. Runtime warnings are disabled by default.

  • since 4.03
  • alert unsynchronized_access The status of runtime warnings is a mutable global state.
val runtime_warnings_enabled : unit -> bool

Return whether runtime warnings are currently enabled.

  • since 4.03
  • alert unsynchronized_access The status of runtime warnings is a mutable global state.

Optimization

val opaque_identity : 'a -> 'a

For the purposes of optimization, opaque_identity behaves like an unknown (and thus possibly side-effecting) function.

At runtime, opaque_identity disappears altogether.

A typical use of this function is to prevent pure computations from being optimized away in benchmarking loops. For example:

for _round = 1 to 100_000 do
+  ignore (Sys.opaque_identity (my_pure_computation ()))
+done
  • since 4.03
module Immediate64 : sig ... end

This module allows to define a type t with the immediate64 attribute. This attribute means that the type is immediate on 64 bit architectures. On other architectures, it might or might not be immediate.

diff --git a/ocaml/Stdlib/Type/Id/index.html b/ocaml/Stdlib/Type/Id/index.html new file mode 100644 index 00000000..49b3bde4 --- /dev/null +++ b/ocaml/Stdlib/Type/Id/index.html @@ -0,0 +1,40 @@ + +Id (ocaml.Stdlib.Type.Id)

Module Type.Id

Type identifiers.

A type identifier is a value that denotes a type. Given two type identifiers, they can be tested for equality to prove they denote the same type. Note that:

  • Unequal identifiers do not imply unequal types: a given type can be denoted by more than one identifier.
  • Type identifiers can be marshalled, but they get a new, distinct, identity on unmarshalling, so the equalities are lost.

See an example of use.

Type identifiers

type !'a t

The type for identifiers for type 'a.

val make : unit -> 'a t

make () is a new type identifier.

val uid : 'a t -> int

uid id is a runtime unique identifier for id.

val provably_equal : 'a t -> 'b t -> ('a, 'b) eq option

provably_equal i0 i1 is Some Equal if identifier i0 is equal to i1 and None otherwise.

Example

The following shows how type identifiers can be used to implement a simple heterogeneous key-value dictionary. In contrast to Stdlib.Map values whose keys map to a single, homogeneous type of values, this dictionary can associate a different type of value to each key.

(** Heterogeneous dictionaries. *)
+module Dict : sig
+  type t
+  (** The type for dictionaries. *)
+
+  type 'a key
+  (** The type for keys binding values of type ['a]. *)
+
+  val key : unit -> 'a key
+  (** [key ()] is a new dictionary key. *)
+
+  val empty : t
+  (** [empty] is the empty dictionary. *)
+
+  val add : 'a key -> 'a -> t -> t
+  (** [add k v d] is [d] with [k] bound to [v]. *)
+
+  val remove : 'a key -> t -> t
+  (** [remove k d] is [d] with the last binding of [k] removed. *)
+
+  val find : 'a key -> t -> 'a option
+  (** [find k d] is the binding of [k] in [d], if any. *)
+end = struct
+  type 'a key = 'a Type.Id.t
+  type binding = B : 'a key * 'a -> binding
+  type t = (int * binding) list
+
+  let key () = Type.Id.make ()
+  let empty = []
+  let add k v d = (Type.Id.uid k, B (k, v)) :: d
+  let remove k d = List.remove_assoc (Type.Id.uid k) d
+  let find : type a. a key -> t -> a option = fun k d ->
+    match List.assoc_opt (Type.Id.uid k) d with
+    | None -> None
+    | Some (B (k', v)) ->
+        match Type.Id.provably_equal k k' with
+        | Some Type.Equal -> Some v
+        | None -> assert false
+end
diff --git a/ocaml/Stdlib/Type/index.html b/ocaml/Stdlib/Type/index.html new file mode 100644 index 00000000..73287983 --- /dev/null +++ b/ocaml/Stdlib/Type/index.html @@ -0,0 +1,2 @@ + +Type (ocaml.Stdlib.Type)

Module Stdlib.Type

Type introspection.

  • since 5.1

Type equality witness

type (_, _) eq =
  1. | Equal : ('a, 'a) eq

The purpose of eq is to represent type equalities that may not otherwise be known by the type checker (e.g. because they may depend on dynamic data).

A value of type (a, b) eq represents the fact that types a and b are equal.

If one has a value eq : (a, b) eq that proves types a and b are equal, one can use it to convert a value of type a to a value of type b by pattern matching on Equal:

let cast (type a) (type b) (Equal : (a, b) Type.eq) (a : a) : b = a

At runtime, this function simply returns its second argument unchanged.

Type identifiers

module Id : sig ... end

Type identifiers.

diff --git a/ocaml/Stdlib/Uchar/index.html b/ocaml/Stdlib/Uchar/index.html new file mode 100644 index 00000000..a8f3283f --- /dev/null +++ b/ocaml/Stdlib/Uchar/index.html @@ -0,0 +1,2 @@ + +Uchar (ocaml.Stdlib.Uchar)

Module Stdlib.Uchar

Unicode characters.

  • since 4.03
type t

The type for Unicode characters.

A value of this type represents a Unicode scalar value which is an integer in the ranges 0x0000...0xD7FF or 0xE000...0x10FFFF.

val min : t

min is U+0000.

val max : t

max is U+10FFFF.

val bom : t

bom is U+FEFF, the byte order mark (BOM) character.

  • since 4.06
val rep : t

rep is U+FFFD, the replacement character.

  • since 4.06
val succ : t -> t

succ u is the scalar value after u in the set of Unicode scalar values.

val pred : t -> t

pred u is the scalar value before u in the set of Unicode scalar values.

val is_valid : int -> bool

is_valid n is true if and only if n is a Unicode scalar value (i.e. in the ranges 0x0000...0xD7FF or 0xE000...0x10FFFF).

val of_int : int -> t

of_int i is i as a Unicode character.

val to_int : t -> int

to_int u is u as an integer.

val is_char : t -> bool

is_char u is true if and only if u is a latin1 OCaml character.

val of_char : char -> t

of_char c is c as a Unicode character.

val to_char : t -> char

to_char u is u as an OCaml latin1 character.

val equal : t -> t -> bool

equal u u' is u = u'.

val compare : t -> t -> int

compare u u' is Stdlib.compare u u'.

val hash : t -> int

hash u associates a non-negative integer to u.

UTF codecs tools

  • since 4.14
type utf_decode

The type for UTF decode results. Values of this type represent the result of a Unicode Transformation Format decoding attempt.

val utf_decode_is_valid : utf_decode -> bool

utf_decode_is_valid d is true if and only if d holds a valid decode.

val utf_decode_uchar : utf_decode -> t

utf_decode_uchar d is the Unicode character decoded by d if utf_decode_is_valid d is true and Uchar.rep otherwise.

val utf_decode_length : utf_decode -> int

utf_decode_length d is the number of elements from the source that were consumed by the decode d. This is always strictly positive and smaller or equal to 4. The kind of source elements depends on the actual decoder; for the decoders of the standard library this function always returns a length in bytes.

val utf_decode : int -> t -> utf_decode

utf_decode n u is a valid UTF decode for u that consumed n elements from the source for decoding. n must be positive and smaller or equal to 4 (this is not checked by the module).

val utf_decode_invalid : int -> utf_decode

utf_decode_invalid n is an invalid UTF decode that consumed n elements from the source to error. n must be positive and smaller or equal to 4 (this is not checked by the module). The resulting decode has rep as the decoded Unicode character.

val utf_8_byte_length : t -> int

utf_8_byte_length u is the number of bytes needed to encode u in UTF-8.

val utf_16_byte_length : t -> int

utf_16_byte_length u is the number of bytes needed to encode u in UTF-16.

diff --git a/ocaml/Stdlib/Unit/index.html b/ocaml/Stdlib/Unit/index.html new file mode 100644 index 00000000..a973fc60 --- /dev/null +++ b/ocaml/Stdlib/Unit/index.html @@ -0,0 +1,2 @@ + +Unit (ocaml.Stdlib.Unit)

Module Stdlib.Unit

Unit values.

  • since 4.08

The unit type

type t = unit =
  1. | ()

The unit type.

The constructor () is included here so that it has a path, but it is not intended to be used in user-defined data types.

val equal : t -> t -> bool

equal u1 u2 is true.

val compare : t -> t -> int

compare u1 u2 is 0.

val to_string : t -> string

to_string b is "()".

diff --git a/ocaml/Stdlib/Weak/Make/argument-1-H/index.html b/ocaml/Stdlib/Weak/Make/argument-1-H/index.html new file mode 100644 index 00000000..bcd4cab4 --- /dev/null +++ b/ocaml/Stdlib/Weak/Make/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (ocaml.Stdlib.Weak.Make.H)

Parameter Make.H

type t

The type of the hashtable keys.

val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
diff --git a/ocaml/Stdlib/Weak/Make/index.html b/ocaml/Stdlib/Weak/Make/index.html new file mode 100644 index 00000000..5dce54ec --- /dev/null +++ b/ocaml/Stdlib/Weak/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Stdlib.Weak.Make)

Module Weak.Make

Functor building an implementation of the weak hash set structure. H.equal can't be the physical equality, since only shallow copies of the elements in the set are given to it.

Parameters

Signature

type data = H.t

The type of the elements stored in the table.

type t

The type of tables that contain elements of type data. Note that weak hash sets cannot be marshaled using Stdlib.output_value or the functions of the Marshal module.

val create : int -> t

create n creates a new empty weak hash set, of initial size n. The table will grow as needed.

val clear : t -> unit

Remove all elements from the table.

val merge : t -> data -> data

merge t x returns an instance of x found in t if any, or else adds x to t and return x.

val add : t -> data -> unit

add t x adds x to t. If there is already an instance of x in t, it is unspecified which one will be returned by subsequent calls to find and merge.

val remove : t -> data -> unit

remove t x removes from t one instance of x. Does nothing if there is no instance of x in t.

val find : t -> data -> data

find t x returns an instance of x found in t.

  • raises Not_found

    if there is no such element.

val find_opt : t -> data -> data option

find_opt t x returns an instance of x found in t or None if there is no such element.

  • since 4.05
val find_all : t -> data -> data list

find_all t x returns a list of all the instances of x found in t.

val mem : t -> data -> bool

mem t x returns true if there is at least one instance of x in t, false otherwise.

val iter : (data -> unit) -> t -> unit

iter f t calls f on each element of t, in some unspecified order. It is not specified what happens if f tries to change t itself.

val fold : (data -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f t init computes (f d1 (... (f dN init))) where d1 ... dN are the elements of t in some unspecified order. It is not specified what happens if f tries to change t itself.

val count : t -> int

Count the number of elements in the table. count t gives the same result as fold (fun _ n -> n+1) t 0 but does not delay the deallocation of the dead elements.

val stats : t -> int * int * int * int * int * int

Return statistics on the table. The numbers are, in order: table length, number of entries, sum of bucket lengths, smallest bucket length, median bucket length, biggest bucket length.

diff --git a/ocaml/Stdlib/Weak/index.html b/ocaml/Stdlib/Weak/index.html new file mode 100644 index 00000000..a8f79530 --- /dev/null +++ b/ocaml/Stdlib/Weak/index.html @@ -0,0 +1,2 @@ + +Weak (ocaml.Stdlib.Weak)

Module Stdlib.Weak

Arrays of weak pointers and hash sets of weak pointers.

Low-level functions

type !'a t

The type of arrays of weak pointers (weak arrays). A weak pointer is a value that the garbage collector may erase whenever the value is not used any more (through normal pointers) by the program. Note that finalisation functions are run before the weak pointers are erased, because the finalisation functions can make values alive again (before 4.03 the finalisation functions were run after).

A weak pointer is said to be full if it points to a value, empty if the value was erased by the GC.

Notes:

  • Integers are not allocated and cannot be stored in weak arrays.
  • Weak arrays cannot be marshaled using Stdlib.output_value nor the functions of the Marshal module.
val create : int -> 'a t

Weak.create n returns a new weak array of length n. All the pointers are initially empty.

val length : 'a t -> int

Weak.length ar returns the length (number of elements) of ar.

val set : 'a t -> int -> 'a option -> unit

Weak.set ar n (Some el) sets the nth cell of ar to be a (full) pointer to el; Weak.set ar n None sets the nth cell of ar to empty.

val get : 'a t -> int -> 'a option

Weak.get ar n returns None if the nth cell of ar is empty, Some x (where x is the value) if it is full.

val get_copy : 'a t -> int -> 'a option

Weak.get_copy ar n returns None if the nth cell of ar is empty, Some x (where x is a (shallow) copy of the value) if it is full. In addition to pitfalls with mutable values, the interesting difference with get is that get_copy does not prevent the incremental GC from erasing the value in its current cycle (get may delay the erasure to the next GC cycle).

val check : 'a t -> int -> bool

Weak.check ar n returns true if the nth cell of ar is full, false if it is empty. Note that even if Weak.check ar n returns true, a subsequent Weak.get ar n can return None.

val fill : 'a t -> int -> int -> 'a option -> unit

Weak.fill ar ofs len el sets to el all pointers of ar from ofs to ofs + len - 1.

val blit : 'a t -> int -> 'a t -> int -> int -> unit

Weak.blit ar1 off1 ar2 off2 len copies len weak pointers from ar1 (starting at off1) to ar2 (starting at off2). It works correctly even if ar1 and ar2 are the same.

  • raises Invalid_argument

    if off1 and len do not designate a valid subarray of ar1, or if off2 and len do not designate a valid subarray of ar2.

Weak hash sets

A weak hash set is a hashed set of values. Each value may magically disappear from the set when it is not used by the rest of the program any more. This is normally used to share data structures without inducing memory leaks. Weak hash sets are defined on values from a Hashtbl.HashedType module; the equal relation and hash function are taken from that module. We will say that v is an instance of x if equal x v is true.

The equal relation must be able to work on a shallow copy of the values and give the same result as with the values themselves.

Unsynchronized accesses

Unsynchronized accesses to weak hash sets are a programming error. Unsynchronized accesses to a weak hash set may lead to an invalid weak hash set state. Thus, concurrent accesses to weak hash sets must be synchronized (for instance with a Mutex.t).

module type S = sig ... end

The output signature of the functor Weak.Make.

module Make (H : Hashtbl.HashedType) : S with type data = H.t

Functor building an implementation of the weak hash set structure. H.equal can't be the physical equality, since only shallow copies of the elements in the set are given to it.

diff --git a/ocaml/Stdlib/Weak/module-type-S/index.html b/ocaml/Stdlib/Weak/module-type-S/index.html new file mode 100644 index 00000000..47ee288c --- /dev/null +++ b/ocaml/Stdlib/Weak/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Stdlib.Weak.S)

Module type Weak.S

The output signature of the functor Weak.Make.

type data

The type of the elements stored in the table.

type t

The type of tables that contain elements of type data. Note that weak hash sets cannot be marshaled using Stdlib.output_value or the functions of the Marshal module.

val create : int -> t

create n creates a new empty weak hash set, of initial size n. The table will grow as needed.

val clear : t -> unit

Remove all elements from the table.

val merge : t -> data -> data

merge t x returns an instance of x found in t if any, or else adds x to t and return x.

val add : t -> data -> unit

add t x adds x to t. If there is already an instance of x in t, it is unspecified which one will be returned by subsequent calls to find and merge.

val remove : t -> data -> unit

remove t x removes from t one instance of x. Does nothing if there is no instance of x in t.

val find : t -> data -> data

find t x returns an instance of x found in t.

  • raises Not_found

    if there is no such element.

val find_opt : t -> data -> data option

find_opt t x returns an instance of x found in t or None if there is no such element.

  • since 4.05
val find_all : t -> data -> data list

find_all t x returns a list of all the instances of x found in t.

val mem : t -> data -> bool

mem t x returns true if there is at least one instance of x in t, false otherwise.

val iter : (data -> unit) -> t -> unit

iter f t calls f on each element of t, in some unspecified order. It is not specified what happens if f tries to change t itself.

val fold : (data -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f t init computes (f d1 (... (f dN init))) where d1 ... dN are the elements of t in some unspecified order. It is not specified what happens if f tries to change t itself.

val count : t -> int

Count the number of elements in the table. count t gives the same result as fold (fun _ n -> n+1) t 0 but does not delay the deallocation of the dead elements.

val stats : t -> int * int * int * int * int * int

Return statistics on the table. The numbers are, in order: table length, number of entries, sum of bucket lengths, smallest bucket length, median bucket length, biggest bucket length.

diff --git a/ocaml/Stdlib/index.html b/ocaml/Stdlib/index.html new file mode 100644 index 00000000..235164a1 --- /dev/null +++ b/ocaml/Stdlib/index.html @@ -0,0 +1,8 @@ + +Stdlib (ocaml.Stdlib)

Module Stdlib

The OCaml Standard library.

This module is automatically opened at the beginning of each compilation. All components of this module can therefore be referred by their short name, without prefixing them by Stdlib.

In particular, it provides the basic operations over the built-in types (numbers, booleans, byte sequences, strings, exceptions, references, lists, arrays, input-output channels, ...) and the standard library modules.

Exceptions

val raise : exn -> 'a

Raise the given exception value

val raise_notrace : exn -> 'a

A faster version raise which does not record the backtrace.

  • since 4.02
val invalid_arg : string -> 'a

Raise exception Invalid_argument with the given string.

val failwith : string -> 'a

Raise exception Failure with the given string.

exception Exit

The Exit exception is not raised by any library function. It is provided for use in your programs.

exception Match_failure of string * int * int

Exception raised when none of the cases of a pattern-matching apply. The arguments are the location of the match keyword in the source code (file name, line number, column number).

exception Assert_failure of string * int * int

Exception raised when an assertion fails. The arguments are the location of the assert keyword in the source code (file name, line number, column number).

exception Invalid_argument of string

Exception raised by library functions to signal that the given arguments do not make sense. The string gives some information to the programmer. As a general rule, this exception should not be caught, it denotes a programming error and the code should be modified not to trigger it.

exception Failure of string

Exception raised by library functions to signal that they are undefined on the given arguments. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Failure _ instead).

exception Not_found

Exception raised by search functions when the desired object could not be found.

exception Out_of_memory

Exception raised by the garbage collector when there is insufficient memory to complete the computation. (Not reliable for allocations on the minor heap.)

exception Stack_overflow

Exception raised by the bytecode interpreter when the evaluation stack reaches its maximal size. This often indicates infinite or excessively deep recursion in the user's program.

Before 4.10, it was not fully implemented by the native-code compiler.

exception Sys_error of string

Exception raised by the input/output functions to report an operating system error. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Sys_error _ instead).

exception End_of_file

Exception raised by input functions to signal that the end of file has been reached.

exception Division_by_zero

Exception raised by integer division and remainder operations when their second argument is zero.

exception Sys_blocked_io

A special case of Sys_error raised when no I/O is possible on a non-blocking I/O channel.

exception Undefined_recursive_module of string * int * int

Exception raised when an ill-founded recursive module definition is evaluated. The arguments are the location of the definition in the source code (file name, line number, column number).

Comparisons

val (=) : 'a -> 'a -> bool

e1 = e2 tests for structural equality of e1 and e2. Mutable structures (e.g. references and arrays) are equal if and only if their current contents are structurally equal, even if the two mutable objects are not the same physical object. Equality between functional values raises Invalid_argument. Equality between cyclic data structures may not terminate. Left-associative operator, see Ocaml_operators for more information.

val (<>) : 'a -> 'a -> bool

Negation of Stdlib.(=). Left-associative operator, see Ocaml_operators for more information.

val (<) : 'a -> 'a -> bool

See Stdlib.(>=). Left-associative operator, see Ocaml_operators for more information.

val (>) : 'a -> 'a -> bool

See Stdlib.(>=). Left-associative operator, see Ocaml_operators for more information.

val (<=) : 'a -> 'a -> bool

See Stdlib.(>=). Left-associative operator, see Ocaml_operators for more information.

val (>=) : 'a -> 'a -> bool

Structural ordering functions. These functions coincide with the usual orderings over integers, characters, strings, byte sequences and floating-point numbers, and extend them to a total ordering over all types. The ordering is compatible with ( = ). As in the case of ( = ), mutable structures are compared by contents. Comparison between functional values raises Invalid_argument. Comparison between cyclic structures may not terminate. Left-associative operator, see Ocaml_operators for more information.

val compare : 'a -> 'a -> int

compare x y returns 0 if x is equal to y, a negative integer if x is less than y, and a positive integer if x is greater than y. The ordering implemented by compare is compatible with the comparison predicates =, < and > defined above, with one difference on the treatment of the float value Stdlib.nan. Namely, the comparison predicates treat nan as different from any other float value, including itself; while compare treats nan as equal to itself and less than any other float value. This treatment of nan ensures that compare defines a total ordering relation.

compare applied to functional values may raise Invalid_argument. compare applied to cyclic structures may not terminate.

The compare function can be used as the comparison function required by the Set.Make and Map.Make functors, as well as the List.sort and Array.sort functions.

val min : 'a -> 'a -> 'a

Return the smaller of the two arguments. The result is unspecified if one of the arguments contains the float value nan.

val max : 'a -> 'a -> 'a

Return the greater of the two arguments. The result is unspecified if one of the arguments contains the float value nan.

val (==) : 'a -> 'a -> bool

e1 == e2 tests for physical equality of e1 and e2. On mutable types such as references, arrays, byte sequences, records with mutable fields and objects with mutable instance variables, e1 == e2 is true if and only if physical modification of e1 also affects e2. On non-mutable types, the behavior of ( == ) is implementation-dependent; however, it is guaranteed that e1 == e2 implies compare e1 e2 = 0. Left-associative operator, see Ocaml_operators for more information.

val (!=) : 'a -> 'a -> bool

Negation of Stdlib.(==). Left-associative operator, see Ocaml_operators for more information.

Boolean operations

val not : bool -> bool

The boolean negation.

val (&&) : bool -> bool -> bool

The boolean 'and'. Evaluation is sequential, left-to-right: in e1 && e2, e1 is evaluated first, and if it returns false, e2 is not evaluated at all. Right-associative operator, see Ocaml_operators for more information.

val (||) : bool -> bool -> bool

The boolean 'or'. Evaluation is sequential, left-to-right: in e1 || e2, e1 is evaluated first, and if it returns true, e2 is not evaluated at all. Right-associative operator, see Ocaml_operators for more information.

Debugging

val __LOC__ : string

__LOC__ returns the location at which this expression appears in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d".

  • since 4.02
val __FILE__ : string

__FILE__ returns the name of the file currently being parsed by the compiler.

  • since 4.02
val __LINE__ : int

__LINE__ returns the line number at which this expression appears in the file currently being parsed by the compiler.

  • since 4.02
val __MODULE__ : string

__MODULE__ returns the module name of the file being parsed by the compiler.

  • since 4.02
val __POS__ : string * int * int * int

__POS__ returns a tuple (file,lnum,cnum,enum), corresponding to the location at which this expression appears in the file currently being parsed by the compiler. file is the current filename, lnum the line number, cnum the character position in the line and enum the last character position in the line.

  • since 4.02
val __FUNCTION__ : string

__FUNCTION__ returns the name of the current function or method, including any enclosing modules or classes.

  • since 4.12
val __LOC_OF__ : 'a -> string * 'a

__LOC_OF__ expr returns a pair (loc, expr) where loc is the location of expr in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d".

  • since 4.02
val __LINE_OF__ : 'a -> int * 'a

__LINE_OF__ expr returns a pair (line, expr), where line is the line number at which the expression expr appears in the file currently being parsed by the compiler.

  • since 4.02
val __POS_OF__ : 'a -> (string * int * int * int) * 'a

__POS_OF__ expr returns a pair (loc,expr), where loc is a tuple (file,lnum,cnum,enum) corresponding to the location at which the expression expr appears in the file currently being parsed by the compiler. file is the current filename, lnum the line number, cnum the character position in the line and enum the last character position in the line.

  • since 4.02

Composition operators

val (|>) : 'a -> ('a -> 'b) -> 'b

Reverse-application operator: x |> f |> g is exactly equivalent to g (f (x)). Left-associative operator, see Ocaml_operators for more information.

  • since 4.01
val (@@) : ('a -> 'b) -> 'a -> 'b

Application operator: g @@ f @@ x is exactly equivalent to g (f (x)). Right-associative operator, see Ocaml_operators for more information.

  • since 4.01

Integer arithmetic

Integers are Sys.int_size bits wide. All operations are taken modulo 2Sys.int_size. They do not fail on overflow.

val (~-) : int -> int

Unary negation. You can also write - e instead of ~- e. Unary operator, see Ocaml_operators for more information.

val (~+) : int -> int

Unary addition. You can also write + e instead of ~+ e. Unary operator, see Ocaml_operators for more information.

  • since 3.12
val succ : int -> int

succ x is x + 1.

val pred : int -> int

pred x is x - 1.

val (+) : int -> int -> int

Integer addition. Left-associative operator, see Ocaml_operators for more information.

val (-) : int -> int -> int

Integer subtraction. Left-associative operator, , see Ocaml_operators for more information.

val (*) : int -> int -> int

Integer multiplication. Left-associative operator, see Ocaml_operators for more information.

val (/) : int -> int -> int

Integer division. Integer division rounds the real quotient of its arguments towards zero. More precisely, if x >= 0 and y > 0, x / y is the greatest integer less than or equal to the real quotient of x by y. Moreover, (- x) / y = x / (- y) = - (x / y). Left-associative operator, see Ocaml_operators for more information.

val (mod) : int -> int -> int

Integer remainder. If y is not zero, the result of x mod y satisfies the following properties: x = (x / y) * y + x mod y and abs(x mod y) <= abs(y) - 1. If y = 0, x mod y raises Division_by_zero. Note that x mod y is negative only if x < 0. Left-associative operator, see Ocaml_operators for more information.

val abs : int -> int

abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

val max_int : int

The greatest representable integer.

val min_int : int

The smallest representable integer.

Bitwise operations

val (land) : int -> int -> int

Bitwise logical and. Left-associative operator, see Ocaml_operators for more information.

val (lor) : int -> int -> int

Bitwise logical or. Left-associative operator, see Ocaml_operators for more information.

val (lxor) : int -> int -> int

Bitwise logical exclusive or. Left-associative operator, see Ocaml_operators for more information.

val lnot : int -> int

Bitwise logical negation.

val (lsl) : int -> int -> int

n lsl m shifts n to the left by m bits. The result is unspecified if m < 0 or m > Sys.int_size. Right-associative operator, see Ocaml_operators for more information.

val (lsr) : int -> int -> int

n lsr m shifts n to the right by m bits. This is a logical shift: zeroes are inserted regardless of the sign of n. The result is unspecified if m < 0 or m > Sys.int_size. Right-associative operator, see Ocaml_operators for more information.

val (asr) : int -> int -> int

n asr m shifts n to the right by m bits. This is an arithmetic shift: the sign bit of n is replicated. The result is unspecified if m < 0 or m > Sys.int_size. Right-associative operator, see Ocaml_operators for more information.

Floating-point arithmetic

OCaml's floating-point numbers follow the IEEE 754 standard, using double precision (64 bits) numbers. Floating-point operations never raise an exception on overflow, underflow, division by zero, etc. Instead, special IEEE numbers are returned as appropriate, such as infinity for 1.0 /. 0.0, neg_infinity for -1.0 /. 0.0, and nan ('not a number') for 0.0 /. 0.0. These special numbers then propagate through floating-point computations as expected: for instance, 1.0 /. infinity is 0.0, basic arithmetic operations (+., -., *., /.) with nan as an argument return nan, ...

val (~-.) : float -> float

Unary negation. You can also write -. e instead of ~-. e. Unary operator, see Ocaml_operators for more information.

val (~+.) : float -> float

Unary addition. You can also write +. e instead of ~+. e. Unary operator, see Ocaml_operators for more information.

  • since 3.12
val (+.) : float -> float -> float

Floating-point addition. Left-associative operator, see Ocaml_operators for more information.

val (-.) : float -> float -> float

Floating-point subtraction. Left-associative operator, see Ocaml_operators for more information.

val (*.) : float -> float -> float

Floating-point multiplication. Left-associative operator, see Ocaml_operators for more information.

val (/.) : float -> float -> float

Floating-point division. Left-associative operator, see Ocaml_operators for more information.

val (**) : float -> float -> float

Exponentiation. Right-associative operator, see Ocaml_operators for more information.

val sqrt : float -> float

Square root.

val exp : float -> float

Exponential.

val log : float -> float

Natural logarithm.

val log10 : float -> float

Base 10 logarithm.

val expm1 : float -> float

expm1 x computes exp x -. 1.0, giving numerically-accurate results even if x is close to 0.0.

  • since 3.12
val log1p : float -> float

log1p x computes log(1.0 +. x) (natural logarithm), giving numerically-accurate results even if x is close to 0.0.

  • since 3.12
val cos : float -> float

Cosine. Argument is in radians.

val sin : float -> float

Sine. Argument is in radians.

val tan : float -> float

Tangent. Argument is in radians.

val acos : float -> float

Arc cosine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between 0.0 and pi.

val asin : float -> float

Arc sine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between -pi/2 and pi/2.

val atan : float -> float

Arc tangent. Result is in radians and is between -pi/2 and pi/2.

val atan2 : float -> float -> float

atan2 y x returns the arc tangent of y /. x. The signs of x and y are used to determine the quadrant of the result. Result is in radians and is between -pi and pi.

val hypot : float -> float -> float

hypot x y returns sqrt(x *. x + y *. y), that is, the length of the hypotenuse of a right-angled triangle with sides of length x and y, or, equivalently, the distance of the point (x,y) to origin. If one of x or y is infinite, returns infinity even if the other is nan.

  • since 4.00
val cosh : float -> float

Hyperbolic cosine. Argument is in radians.

val sinh : float -> float

Hyperbolic sine. Argument is in radians.

val tanh : float -> float

Hyperbolic tangent. Argument is in radians.

val acosh : float -> float

Hyperbolic arc cosine. The argument must fall within the range [1.0, inf]. Result is in radians and is between 0.0 and inf.

  • since 4.13
val asinh : float -> float

Hyperbolic arc sine. The argument and result range over the entire real line. Result is in radians.

  • since 4.13
val atanh : float -> float

Hyperbolic arc tangent. The argument must fall within the range [-1.0, 1.0]. Result is in radians and ranges over the entire real line.

  • since 4.13
val ceil : float -> float

Round above to an integer value. ceil f returns the least integer value greater than or equal to f. The result is returned as a float.

val floor : float -> float

Round below to an integer value. floor f returns the greatest integer value less than or equal to f. The result is returned as a float.

val abs_float : float -> float

abs_float f returns the absolute value of f.

val copysign : float -> float -> float

copysign x y returns a float whose absolute value is that of x and whose sign is that of y. If x is nan, returns nan. If y is nan, returns either x or -. x, but it is not specified which.

  • since 4.00
val mod_float : float -> float -> float

mod_float a b returns the remainder of a with respect to b. The returned value is a -. n *. b, where n is the quotient a /. b rounded towards zero to an integer.

val frexp : float -> float * int

frexp f returns the pair of the significant and the exponent of f. When f is zero, the significant x and the exponent n of f are equal to zero. When f is non-zero, they are defined by f = x *. 2 ** n and 0.5 <= x < 1.0.

val ldexp : float -> int -> float

ldexp x n returns x *. 2 ** n.

val modf : float -> float * float

modf f returns the pair of the fractional and integral part of f.

val float : int -> float
val float_of_int : int -> float

Convert an integer to floating-point.

val truncate : float -> int
val int_of_float : float -> int

Truncate the given floating-point number to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.

val infinity : float

Positive infinity.

val neg_infinity : float

Negative infinity.

val nan : float

A special floating-point value denoting the result of an undefined operation such as 0.0 /. 0.0. Stands for 'not a number'. Any floating-point operation with nan as argument returns nan as result, unless otherwise specified in IEEE 754 standard. As for floating-point comparisons, =, <, <=, > and >= return false and <> returns true if one or both of their arguments is nan.

nan is a quiet NaN since 5.1; it was a signaling NaN before.

val max_float : float

The largest positive finite value of type float.

val min_float : float

The smallest positive, non-zero, non-denormalized value of type float.

val epsilon_float : float

The difference between 1.0 and the smallest exactly representable floating-point number greater than 1.0.

type fpclass =
  1. | FP_normal
    (*

    Normal number, none of the below

    *)
  2. | FP_subnormal
    (*

    Number very close to 0.0, has reduced precision

    *)
  3. | FP_zero
    (*

    Number is 0.0 or -0.0

    *)
  4. | FP_infinite
    (*

    Number is positive or negative infinity

    *)
  5. | FP_nan
    (*

    Not a number: result of an undefined operation

    *)

The five classes of floating-point numbers, as determined by the Stdlib.classify_float function.

val classify_float : float -> fpclass

Return the class of the given floating-point number: normal, subnormal, zero, infinite, or not a number.

String operations

More string operations are provided in module String.

val (^) : string -> string -> string

String concatenation. Right-associative operator, see Ocaml_operators for more information.

Character operations

More character operations are provided in module Char.

val int_of_char : char -> int

Return the ASCII code of the argument.

val char_of_int : int -> char

Return the character with the given ASCII code.

Unit operations

val ignore : 'a -> unit

Discard the value of its argument and return (). For instance, ignore(f x) discards the result of the side-effecting function f. It is equivalent to f x; (), except that the latter may generate a compiler warning; writing ignore(f x) instead avoids the warning.

String conversion functions

val string_of_bool : bool -> string

Return the string representation of a boolean. As the returned values may be shared, the user should not modify them directly.

val bool_of_string_opt : string -> bool option

Convert the given string to a boolean.

Return None if the string is not "true" or "false".

  • since 4.05
val bool_of_string : string -> bool

Same as Stdlib.bool_of_string_opt, but raise Invalid_argument "bool_of_string" instead of returning None.

val string_of_int : int -> string

Return the string representation of an integer, in decimal.

val int_of_string_opt : string -> int option

Convert the given string to an integer. The string is read in decimal (by default, or if the string begins with 0u), in hexadecimal (if it begins with 0x or 0X), in octal (if it begins with 0o or 0O), or in binary (if it begins with 0b or 0B).

The 0u prefix reads the input as an unsigned integer in the range [0, 2*max_int+1]. If the input exceeds max_int it is converted to the signed integer min_int + input - max_int - 1.

The _ (underscore) character can appear anywhere in the string and is ignored.

Return None if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int.

  • since 4.05
val int_of_string : string -> int

Same as Stdlib.int_of_string_opt, but raise Failure "int_of_string" instead of returning None.

val string_of_float : float -> string

Return a string representation of a floating-point number.

This conversion can involve a loss of precision. For greater control over the manner in which the number is printed, see Printf.

val float_of_string_opt : string -> float option

Convert the given string to a float. The string is read in decimal (by default) or in hexadecimal (marked by 0x or 0X).

The format of decimal floating-point numbers is [-] dd.ddd (e|E) [+|-] dd , where d stands for a decimal digit.

The format of hexadecimal floating-point numbers is [-] 0(x|X) hh.hhh (p|P) [+|-] dd , where h stands for an hexadecimal digit and d for a decimal digit.

In both cases, at least one of the integer and fractional parts must be given; the exponent part is optional.

The _ (underscore) character can appear anywhere in the string and is ignored.

Depending on the execution platforms, other representations of floating-point numbers can be accepted, but should not be relied upon.

Return None if the given string is not a valid representation of a float.

  • since 4.05
val float_of_string : string -> float

Same as Stdlib.float_of_string_opt, but raise Failure "float_of_string" instead of returning None.

Pair operations

val fst : ('a * 'b) -> 'a

Return the first component of a pair.

val snd : ('a * 'b) -> 'b

Return the second component of a pair.

List operations

More list operations are provided in module List.

val (@) : 'a list -> 'a list -> 'a list

l0 @ l1 appends l1 to l0. Same function as List.append. Right-associative operator, see Ocaml_operators for more information.

  • since 5.1 this function is tail-recursive.

Input/output

Note: all input/output functions can raise Sys_error when the system calls they invoke fail.

type in_channel

The type of input channel.

type out_channel

The type of output channel.

val stdin : in_channel

The standard input for the process.

val stdout : out_channel

The standard output for the process.

val stderr : out_channel

The standard error output for the process.

Output functions on standard output

val print_char : char -> unit

Print a character on standard output.

val print_string : string -> unit

Print a string on standard output.

val print_bytes : bytes -> unit

Print a byte sequence on standard output.

  • since 4.02
val print_int : int -> unit

Print an integer, in decimal, on standard output.

val print_float : float -> unit

Print a floating-point number, in decimal, on standard output.

The conversion of the number to a string uses string_of_float and can involve a loss of precision.

val print_endline : string -> unit

Print a string, followed by a newline character, on standard output and flush standard output.

val print_newline : unit -> unit

Print a newline character on standard output, and flush standard output. This can be used to simulate line buffering of standard output.

Output functions on standard error

val prerr_char : char -> unit

Print a character on standard error.

val prerr_string : string -> unit

Print a string on standard error.

val prerr_bytes : bytes -> unit

Print a byte sequence on standard error.

  • since 4.02
val prerr_int : int -> unit

Print an integer, in decimal, on standard error.

val prerr_float : float -> unit

Print a floating-point number, in decimal, on standard error.

The conversion of the number to a string uses string_of_float and can involve a loss of precision.

val prerr_endline : string -> unit

Print a string, followed by a newline character on standard error and flush standard error.

val prerr_newline : unit -> unit

Print a newline character on standard error, and flush standard error.

Input functions on standard input

val read_line : unit -> string

Flush standard output, then read characters from standard input until a newline character is encountered.

Return the string of all characters read, without the newline character at the end.

  • raises End_of_file

    if the end of the file is reached at the beginning of line.

val read_int_opt : unit -> int option

Flush standard output, then read one line from standard input and convert it to an integer.

Return None if the line read is not a valid representation of an integer.

  • since 4.05
val read_int : unit -> int

Same as Stdlib.read_int_opt, but raise Failure "int_of_string" instead of returning None.

val read_float_opt : unit -> float option

Flush standard output, then read one line from standard input and convert it to a floating-point number.

Return None if the line read is not a valid representation of a floating-point number.

  • since 4.05
val read_float : unit -> float

Same as Stdlib.read_float_opt, but raise Failure "float_of_string" instead of returning None.

General output functions

type open_flag =
  1. | Open_rdonly
    (*

    open for reading.

    *)
  2. | Open_wronly
    (*

    open for writing.

    *)
  3. | Open_append
    (*

    open for appending: always write at end of file.

    *)
  4. | Open_creat
    (*

    create the file if it does not exist.

    *)
  5. | Open_trunc
    (*

    empty the file if it already exists.

    *)
  6. | Open_excl
    (*

    fail if Open_creat and the file already exists.

    *)
  7. | Open_binary
    (*

    open in binary mode (no conversion).

    *)
  8. | Open_text
    (*

    open in text mode (may perform conversions).

    *)
  9. | Open_nonblock
    (*

    open in non-blocking mode.

    *)
val open_out : string -> out_channel

Open the named file for writing, and return a new output channel on that file, positioned at the beginning of the file. The file is truncated to zero length if it already exists. It is created if it does not already exists.

val open_out_bin : string -> out_channel

Same as Stdlib.open_out, but the file is opened in binary mode, so that no translation takes place during writes. On operating systems that do not distinguish between text mode and binary mode, this function behaves like Stdlib.open_out.

val open_out_gen : open_flag list -> int -> string -> out_channel

open_out_gen mode perm filename opens the named file for writing, as described above. The extra argument mode specifies the opening mode. The extra argument perm specifies the file permissions, in case the file must be created. Stdlib.open_out and Stdlib.open_out_bin are special cases of this function.

val flush : out_channel -> unit

Flush the buffer associated with the given output channel, performing all pending writes on that channel. Interactive programs must be careful about flushing standard output and standard error at the right time.

val flush_all : unit -> unit

Flush all open output channels; ignore errors.

val output_char : out_channel -> char -> unit

Write the character on the given output channel.

val output_string : out_channel -> string -> unit

Write the string on the given output channel.

val output_bytes : out_channel -> bytes -> unit

Write the byte sequence on the given output channel.

  • since 4.02
val output : out_channel -> bytes -> int -> int -> unit

output oc buf pos len writes len characters from byte sequence buf, starting at offset pos, to the given output channel oc.

val output_substring : out_channel -> string -> int -> int -> unit

Same as output but take a string as argument instead of a byte sequence.

  • since 4.02
val output_byte : out_channel -> int -> unit

Write one 8-bit integer (as the single character with that code) on the given output channel. The given integer is taken modulo 256.

val output_binary_int : out_channel -> int -> unit

Write one integer in binary format (4 bytes, big-endian) on the given output channel. The given integer is taken modulo 232. The only reliable way to read it back is through the Stdlib.input_binary_int function. The format is compatible across all machines for a given version of OCaml.

val output_value : out_channel -> 'a -> unit

Write the representation of a structured value of any type to a channel. Circularities and sharing inside the value are detected and preserved. The object can be read back, by the function Stdlib.input_value. See the description of module Marshal for more information. Stdlib.output_value is equivalent to Marshal.to_channel with an empty list of flags.

val seek_out : out_channel -> int -> unit

seek_out chan pos sets the current writing position to pos for channel chan. This works only for regular files. On files of other kinds (such as terminals, pipes and sockets), the behavior is unspecified.

val pos_out : out_channel -> int

Return the current writing position for the given channel. Does not work on channels opened with the Open_append flag (returns unspecified results). For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos_out, then going back to this position using seek_out will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

val out_channel_length : out_channel -> int

Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless.

val close_out : out_channel -> unit

Close the given channel, flushing all buffered write operations. Output functions raise a Sys_error exception when they are applied to a closed output channel, except close_out and flush, which do nothing when applied to an already closed channel. Note that close_out may raise Sys_error if the operating system signals an error when flushing or closing.

val close_out_noerr : out_channel -> unit

Same as close_out, but ignore all errors.

val set_binary_mode_out : out_channel -> bool -> unit

set_binary_mode_out oc true sets the channel oc to binary mode: no translations take place during output. set_binary_mode_out oc false sets the channel oc to text mode: depending on the operating system, some translations may take place during output. For instance, under Windows, end-of-lines will be translated from \n to \r\n. This function has no effect under operating systems that do not distinguish between text mode and binary mode.

General input functions

val open_in : string -> in_channel

Open the named file for reading, and return a new input channel on that file, positioned at the beginning of the file.

val open_in_bin : string -> in_channel

Same as Stdlib.open_in, but the file is opened in binary mode, so that no translation takes place during reads. On operating systems that do not distinguish between text mode and binary mode, this function behaves like Stdlib.open_in.

val open_in_gen : open_flag list -> int -> string -> in_channel

open_in_gen mode perm filename opens the named file for reading, as described above. The extra arguments mode and perm specify the opening mode and file permissions. Stdlib.open_in and Stdlib.open_in_bin are special cases of this function.

val input_char : in_channel -> char

Read one character from the given input channel.

  • raises End_of_file

    if there are no more characters to read.

val input_line : in_channel -> string

Read characters from the given input channel, until a newline character is encountered. Return the string of all characters read, without the newline character at the end.

  • raises End_of_file

    if the end of the file is reached at the beginning of line.

val input : in_channel -> bytes -> int -> int -> int

input ic buf pos len reads up to len characters from the given channel ic, storing them in byte sequence buf, starting at character number pos. It returns the actual number of characters read, between 0 and len (inclusive). A return value of 0 means that the end of file was reached. A return value between 0 and len exclusive means that not all requested len characters were read, either because no more characters were available at that time, or because the implementation found it convenient to do a partial read; input must be called again to read the remaining characters, if desired. (See also Stdlib.really_input for reading exactly len characters.) Exception Invalid_argument "input" is raised if pos and len do not designate a valid range of buf.

val really_input : in_channel -> bytes -> int -> int -> unit

really_input ic buf pos len reads len characters from channel ic, storing them in byte sequence buf, starting at character number pos.

  • raises End_of_file

    if the end of file is reached before len characters have been read.

val really_input_string : in_channel -> int -> string

really_input_string ic len reads len characters from channel ic and returns them in a new string.

  • raises End_of_file

    if the end of file is reached before len characters have been read.

  • since 4.02
val input_byte : in_channel -> int

Same as Stdlib.input_char, but return the 8-bit integer representing the character.

val input_binary_int : in_channel -> int

Read an integer encoded in binary format (4 bytes, big-endian) from the given input channel. See Stdlib.output_binary_int.

  • raises End_of_file

    if the end of file was reached while reading the integer.

val input_value : in_channel -> 'a

Read the representation of a structured value, as produced by Stdlib.output_value, and return the corresponding value. This function is identical to Marshal.from_channel; see the description of module Marshal for more information, in particular concerning the lack of type safety.

val seek_in : in_channel -> int -> unit

seek_in chan pos sets the current reading position to pos for channel chan. This works only for regular files. On files of other kinds, the behavior is unspecified.

val pos_in : in_channel -> int

Return the current reading position for the given channel. For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos_in, then going back to this position using seek_in will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

val in_channel_length : in_channel -> int

Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless. The returned size does not take into account the end-of-line translations that can be performed when reading from a channel opened in text mode.

val close_in : in_channel -> unit

Close the given channel. Input functions raise a Sys_error exception when they are applied to a closed input channel, except close_in, which does nothing when applied to an already closed channel.

val close_in_noerr : in_channel -> unit

Same as close_in, but ignore all errors.

val set_binary_mode_in : in_channel -> bool -> unit

set_binary_mode_in ic true sets the channel ic to binary mode: no translations take place during input. set_binary_mode_out ic false sets the channel ic to text mode: depending on the operating system, some translations may take place during input. For instance, under Windows, end-of-lines will be translated from \r\n to \n. This function has no effect under operating systems that do not distinguish between text mode and binary mode.

Operations on large files

module LargeFile : sig ... end

Operations on large files. This sub-module provides 64-bit variants of the channel functions that manipulate file positions and file sizes. By representing positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), these alternate functions allow operating on files whose sizes are greater than max_int.

References

type 'a ref = {
  1. mutable contents : 'a;
}

The type of references (mutable indirection cells) containing a value of type 'a.

val ref : 'a -> 'a ref

Return a fresh reference containing the given value.

val (!) : 'a ref -> 'a

!r returns the current contents of reference r. Equivalent to fun r -> r.contents. Unary operator, see Ocaml_operators for more information.

val (:=) : 'a ref -> 'a -> unit

r := a stores the value of a in reference r. Equivalent to fun r v -> r.contents <- v. Right-associative operator, see Ocaml_operators for more information.

val incr : int ref -> unit

Increment the integer contained in the given reference. Equivalent to fun r -> r := succ !r.

val decr : int ref -> unit

Decrement the integer contained in the given reference. Equivalent to fun r -> r := pred !r.

Result type

type ('a, 'b) result =
  1. | Ok of 'a
  2. | Error of 'b
  • since 4.03

Operations on format strings

Format strings are character strings with special lexical conventions that defines the functionality of formatted input/output functions. Format strings are used to read data with formatted input functions from module Scanf and to print data with formatted output functions from modules Printf and Format.

Format strings are made of three kinds of entities:

  • conversions specifications, introduced by the special character '%' followed by one or more characters specifying what kind of argument to read or print,
  • formatting indications, introduced by the special character '@' followed by one or more characters specifying how to read or print the argument,
  • plain characters that are regular characters with usual lexical conventions. Plain characters specify string literals to be read in the input or printed in the output.

There is an additional lexical rule to escape the special characters '%' and '@' in format strings: if a special character follows a '%' character, it is treated as a plain character. In other words, "%%" is considered as a plain '%' and "%@" as a plain '@'.

For more information about conversion specifications and formatting indications available, read the documentation of modules Scanf, Printf and Format.

Format strings have a general and highly polymorphic type ('a, 'b, 'c, 'd, 'e, 'f) format6. The two simplified types, format and format4 below are included for backward compatibility with earlier releases of OCaml.

The meaning of format string type parameters is as follows:

  • 'a is the type of the parameters of the format for formatted output functions (printf-style functions); 'a is the type of the values read by the format for formatted input functions (scanf-style functions).
  • 'b is the type of input source for formatted input functions and the type of output target for formatted output functions. For printf-style functions from module Printf, 'b is typically out_channel; for printf-style functions from module Format, 'b is typically Format.formatter; for scanf-style functions from module Scanf, 'b is typically Scanf.Scanning.in_channel.

Type argument 'b is also the type of the first argument given to user's defined printing functions for %a and %t conversions, and user's defined reading functions for %r conversion.

  • 'c is the type of the result of the %a and %t printing functions, and also the type of the argument transmitted to the first argument of kprintf-style functions or to the kscanf-style functions.
  • 'd is the type of parameters for the scanf-style functions.
  • 'e is the type of the receiver function for the scanf-style functions.
  • 'f is the final result type of a formatted input/output function invocation: for the printf-style functions, it is typically unit; for the scanf-style functions, it is typically the result type of the receiver function.
type ('a, 'b, 'c, 'd, 'e, 'f) format6 = + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6
type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'c, 'c, 'd) format6
type ('a, 'b, 'c) format = ('a, 'b, 'c, 'c) format4
val string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string

Converts a format string into a string.

val format_of_string : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + ('a, 'b, 'c, 'd, 'e, 'f) format6

format_of_string s returns a format string read from the string literal s. Note: format_of_string can not convert a string argument that is not a literal. If you need this functionality, use the more general Scanf.format_from_string function.

val (^^) : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + ('f, 'b, 'c, 'e, 'g, 'h) format6 -> + ('a, 'b, 'c, 'd, 'g, 'h) format6

f1 ^^ f2 catenates format strings f1 and f2. The result is a format string that behaves as the concatenation of format strings f1 and f2: in case of formatted output, it accepts arguments from f1, then arguments from f2; in case of formatted input, it returns results from f1, then results from f2. Right-associative operator, see Ocaml_operators for more information.

Program termination

val exit : int -> 'a

Terminate the process, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. All open output channels are flushed with flush_all. The callbacks registered with Domain.at_exit are called followed by those registered with Stdlib.at_exit.

An implicit exit 0 is performed each time a program terminates normally. An implicit exit 2 is performed if the program terminates early because of an uncaught exception.

val at_exit : (unit -> unit) -> unit

Register the given function to be called at program termination time. The functions registered with at_exit will be called when the program does any of the following:

  • executes Stdlib.exit
  • terminates, either normally or because of an uncaught exception
  • executes the C function caml_shutdown. The functions are called in 'last in, first out' order: the function most recently added with at_exit is called first.

Standard library modules

module Arg : sig ... end

Parsing of command line arguments.

module Array : sig ... end

Array operations.

module ArrayLabels : sig ... end

Array operations.

module Atomic : sig ... end

Atomic references.

module Bigarray : sig ... end

Large, multi-dimensional, numerical arrays.

module Bool : sig ... end

Boolean values.

module Buffer : sig ... end

Extensible buffers.

module Bytes : sig ... end

Byte sequence operations.

module BytesLabels : sig ... end

Byte sequence operations.

module Callback : sig ... end

Registering OCaml values with the C runtime.

module Char : sig ... end

Character operations.

module Complex : sig ... end

Complex numbers.

module Condition : sig ... end

Condition variables.

module Digest : sig ... end

MD5 message digest.

module Domain : sig ... end
module Effect : sig ... end
module Either : sig ... end

Either type.

module Ephemeron : sig ... end

Ephemerons and weak hash tables.

module Filename : sig ... end

Operations on file names.

module Float : sig ... end

Floating-point arithmetic.

module Format : sig ... end

Pretty-printing.

module Fun : sig ... end

Function manipulation.

module Gc : sig ... end

Memory management control and statistics; finalised values.

module Hashtbl : sig ... end

Hash tables and hash functions.

module In_channel : sig ... end

Input channels.

module Int : sig ... end

Integer values.

module Int32 : sig ... end

32-bit integers.

module Int64 : sig ... end

64-bit integers.

module Lazy : sig ... end

Deferred computations.

module Lexing : sig ... end

The run-time library for lexers generated by ocamllex.

module List : sig ... end

List operations.

module ListLabels : sig ... end

List operations.

module Map : sig ... end

Association tables over ordered types.

module Marshal : sig ... end

Marshaling of data structures.

module MoreLabels : sig ... end

Extra labeled libraries.

module Mutex : sig ... end

Locks for mutual exclusion.

module Nativeint : sig ... end

Processor-native integers.

module Obj : sig ... end

Operations on internal representations of values.

module Oo : sig ... end

Operations on objects

module Option : sig ... end

Option values.

module Out_channel : sig ... end

Output channels.

module Parsing : sig ... end

The run-time library for parsers generated by ocamlyacc.

module Printexc : sig ... end

Facilities for printing exceptions and inspecting current call stack.

module Printf : sig ... end

Formatted output functions.

module Queue : sig ... end

First-in first-out queues.

module Random : sig ... end

Pseudo-random number generators (PRNG).

module Result : sig ... end

Result values.

module Scanf : sig ... end

Formatted input functions.

module Semaphore : sig ... end

Semaphores

module Seq : sig ... end

Sequences.

module Set : sig ... end

Sets over ordered types.

module Stack : sig ... end

Last-in first-out stacks.

module StdLabels : sig ... end

Standard labeled libraries.

module String : sig ... end

Strings.

module StringLabels : sig ... end

Strings.

module Sys : sig ... end

System interface.

module Type : sig ... end

Type introspection.

module Uchar : sig ... end

Unicode characters.

module Unit : sig ... end

Unit values.

module Weak : sig ... end

Arrays of weak pointers and hash sets of weak pointers.

diff --git a/ocaml/Stdlib__Arg/index.html b/ocaml/Stdlib__Arg/index.html new file mode 100644 index 00000000..5338e3ca --- /dev/null +++ b/ocaml/Stdlib__Arg/index.html @@ -0,0 +1,2 @@ + +Stdlib__Arg (ocaml.Stdlib__Arg)

Module Stdlib__Arg

This module is hidden.

diff --git a/ocaml/Stdlib__Array/index.html b/ocaml/Stdlib__Array/index.html new file mode 100644 index 00000000..ebeb57c1 --- /dev/null +++ b/ocaml/Stdlib__Array/index.html @@ -0,0 +1,2 @@ + +Stdlib__Array (ocaml.Stdlib__Array)

Module Stdlib__Array

This module is hidden.

diff --git a/ocaml/Stdlib__ArrayLabels/index.html b/ocaml/Stdlib__ArrayLabels/index.html new file mode 100644 index 00000000..1c32febe --- /dev/null +++ b/ocaml/Stdlib__ArrayLabels/index.html @@ -0,0 +1,2 @@ + +Stdlib__ArrayLabels (ocaml.Stdlib__ArrayLabels)

Module Stdlib__ArrayLabels

This module is hidden.

diff --git a/ocaml/Stdlib__Atomic/index.html b/ocaml/Stdlib__Atomic/index.html new file mode 100644 index 00000000..9a34e38a --- /dev/null +++ b/ocaml/Stdlib__Atomic/index.html @@ -0,0 +1,2 @@ + +Stdlib__Atomic (ocaml.Stdlib__Atomic)

Module Stdlib__Atomic

This module is hidden.

diff --git a/ocaml/Stdlib__Bigarray/index.html b/ocaml/Stdlib__Bigarray/index.html new file mode 100644 index 00000000..c9632ac0 --- /dev/null +++ b/ocaml/Stdlib__Bigarray/index.html @@ -0,0 +1,2 @@ + +Stdlib__Bigarray (ocaml.Stdlib__Bigarray)

Module Stdlib__Bigarray

This module is hidden.

diff --git a/ocaml/Stdlib__Bool/index.html b/ocaml/Stdlib__Bool/index.html new file mode 100644 index 00000000..cab3b010 --- /dev/null +++ b/ocaml/Stdlib__Bool/index.html @@ -0,0 +1,2 @@ + +Stdlib__Bool (ocaml.Stdlib__Bool)

Module Stdlib__Bool

This module is hidden.

diff --git a/ocaml/Stdlib__Buffer/index.html b/ocaml/Stdlib__Buffer/index.html new file mode 100644 index 00000000..c448fe8f --- /dev/null +++ b/ocaml/Stdlib__Buffer/index.html @@ -0,0 +1,2 @@ + +Stdlib__Buffer (ocaml.Stdlib__Buffer)

Module Stdlib__Buffer

This module is hidden.

diff --git a/ocaml/Stdlib__Bytes/index.html b/ocaml/Stdlib__Bytes/index.html new file mode 100644 index 00000000..ec269db0 --- /dev/null +++ b/ocaml/Stdlib__Bytes/index.html @@ -0,0 +1,2 @@ + +Stdlib__Bytes (ocaml.Stdlib__Bytes)

Module Stdlib__Bytes

This module is hidden.

diff --git a/ocaml/Stdlib__BytesLabels/index.html b/ocaml/Stdlib__BytesLabels/index.html new file mode 100644 index 00000000..2a7fef7b --- /dev/null +++ b/ocaml/Stdlib__BytesLabels/index.html @@ -0,0 +1,2 @@ + +Stdlib__BytesLabels (ocaml.Stdlib__BytesLabels)

Module Stdlib__BytesLabels

This module is hidden.

diff --git a/ocaml/Stdlib__Callback/index.html b/ocaml/Stdlib__Callback/index.html new file mode 100644 index 00000000..26e0db13 --- /dev/null +++ b/ocaml/Stdlib__Callback/index.html @@ -0,0 +1,2 @@ + +Stdlib__Callback (ocaml.Stdlib__Callback)

Module Stdlib__Callback

This module is hidden.

diff --git a/ocaml/Stdlib__Char/index.html b/ocaml/Stdlib__Char/index.html new file mode 100644 index 00000000..b3c2ee55 --- /dev/null +++ b/ocaml/Stdlib__Char/index.html @@ -0,0 +1,2 @@ + +Stdlib__Char (ocaml.Stdlib__Char)

Module Stdlib__Char

This module is hidden.

diff --git a/ocaml/Stdlib__Complex/index.html b/ocaml/Stdlib__Complex/index.html new file mode 100644 index 00000000..1c5ec9a9 --- /dev/null +++ b/ocaml/Stdlib__Complex/index.html @@ -0,0 +1,2 @@ + +Stdlib__Complex (ocaml.Stdlib__Complex)

Module Stdlib__Complex

This module is hidden.

diff --git a/ocaml/Stdlib__Condition/index.html b/ocaml/Stdlib__Condition/index.html new file mode 100644 index 00000000..935c616f --- /dev/null +++ b/ocaml/Stdlib__Condition/index.html @@ -0,0 +1,2 @@ + +Stdlib__Condition (ocaml.Stdlib__Condition)

Module Stdlib__Condition

This module is hidden.

diff --git a/ocaml/Stdlib__Digest/index.html b/ocaml/Stdlib__Digest/index.html new file mode 100644 index 00000000..1afcbe5f --- /dev/null +++ b/ocaml/Stdlib__Digest/index.html @@ -0,0 +1,2 @@ + +Stdlib__Digest (ocaml.Stdlib__Digest)

Module Stdlib__Digest

This module is hidden.

diff --git a/ocaml/Stdlib__Domain/index.html b/ocaml/Stdlib__Domain/index.html new file mode 100644 index 00000000..f53a2aaf --- /dev/null +++ b/ocaml/Stdlib__Domain/index.html @@ -0,0 +1,2 @@ + +Stdlib__Domain (ocaml.Stdlib__Domain)

Module Stdlib__Domain

This module is hidden.

diff --git a/ocaml/Stdlib__Effect/index.html b/ocaml/Stdlib__Effect/index.html new file mode 100644 index 00000000..fa65fc01 --- /dev/null +++ b/ocaml/Stdlib__Effect/index.html @@ -0,0 +1,2 @@ + +Stdlib__Effect (ocaml.Stdlib__Effect)

Module Stdlib__Effect

This module is hidden.

diff --git a/ocaml/Stdlib__Either/index.html b/ocaml/Stdlib__Either/index.html new file mode 100644 index 00000000..bf145dce --- /dev/null +++ b/ocaml/Stdlib__Either/index.html @@ -0,0 +1,2 @@ + +Stdlib__Either (ocaml.Stdlib__Either)

Module Stdlib__Either

This module is hidden.

diff --git a/ocaml/Stdlib__Ephemeron/index.html b/ocaml/Stdlib__Ephemeron/index.html new file mode 100644 index 00000000..6da410b3 --- /dev/null +++ b/ocaml/Stdlib__Ephemeron/index.html @@ -0,0 +1,2 @@ + +Stdlib__Ephemeron (ocaml.Stdlib__Ephemeron)

Module Stdlib__Ephemeron

This module is hidden.

diff --git a/ocaml/Stdlib__Filename/index.html b/ocaml/Stdlib__Filename/index.html new file mode 100644 index 00000000..49d4989a --- /dev/null +++ b/ocaml/Stdlib__Filename/index.html @@ -0,0 +1,2 @@ + +Stdlib__Filename (ocaml.Stdlib__Filename)

Module Stdlib__Filename

This module is hidden.

diff --git a/ocaml/Stdlib__Float/index.html b/ocaml/Stdlib__Float/index.html new file mode 100644 index 00000000..da287feb --- /dev/null +++ b/ocaml/Stdlib__Float/index.html @@ -0,0 +1,2 @@ + +Stdlib__Float (ocaml.Stdlib__Float)

Module Stdlib__Float

This module is hidden.

diff --git a/ocaml/Stdlib__Format/index.html b/ocaml/Stdlib__Format/index.html new file mode 100644 index 00000000..1511a4c0 --- /dev/null +++ b/ocaml/Stdlib__Format/index.html @@ -0,0 +1,2 @@ + +Stdlib__Format (ocaml.Stdlib__Format)

Module Stdlib__Format

This module is hidden.

diff --git a/ocaml/Stdlib__Fun/index.html b/ocaml/Stdlib__Fun/index.html new file mode 100644 index 00000000..0e3f2851 --- /dev/null +++ b/ocaml/Stdlib__Fun/index.html @@ -0,0 +1,2 @@ + +Stdlib__Fun (ocaml.Stdlib__Fun)

Module Stdlib__Fun

This module is hidden.

diff --git a/ocaml/Stdlib__Gc/index.html b/ocaml/Stdlib__Gc/index.html new file mode 100644 index 00000000..2f879156 --- /dev/null +++ b/ocaml/Stdlib__Gc/index.html @@ -0,0 +1,2 @@ + +Stdlib__Gc (ocaml.Stdlib__Gc)

Module Stdlib__Gc

This module is hidden.

diff --git a/ocaml/Stdlib__Hashtbl/index.html b/ocaml/Stdlib__Hashtbl/index.html new file mode 100644 index 00000000..58669ab4 --- /dev/null +++ b/ocaml/Stdlib__Hashtbl/index.html @@ -0,0 +1,2 @@ + +Stdlib__Hashtbl (ocaml.Stdlib__Hashtbl)

Module Stdlib__Hashtbl

This module is hidden.

diff --git a/ocaml/Stdlib__In_channel/index.html b/ocaml/Stdlib__In_channel/index.html new file mode 100644 index 00000000..f1f6559a --- /dev/null +++ b/ocaml/Stdlib__In_channel/index.html @@ -0,0 +1,2 @@ + +Stdlib__In_channel (ocaml.Stdlib__In_channel)

Module Stdlib__In_channel

This module is hidden.

diff --git a/ocaml/Stdlib__Int/index.html b/ocaml/Stdlib__Int/index.html new file mode 100644 index 00000000..e008d55c --- /dev/null +++ b/ocaml/Stdlib__Int/index.html @@ -0,0 +1,2 @@ + +Stdlib__Int (ocaml.Stdlib__Int)

Module Stdlib__Int

This module is hidden.

diff --git a/ocaml/Stdlib__Int32/index.html b/ocaml/Stdlib__Int32/index.html new file mode 100644 index 00000000..e4110400 --- /dev/null +++ b/ocaml/Stdlib__Int32/index.html @@ -0,0 +1,2 @@ + +Stdlib__Int32 (ocaml.Stdlib__Int32)

Module Stdlib__Int32

This module is hidden.

diff --git a/ocaml/Stdlib__Int64/index.html b/ocaml/Stdlib__Int64/index.html new file mode 100644 index 00000000..ee4ed3d7 --- /dev/null +++ b/ocaml/Stdlib__Int64/index.html @@ -0,0 +1,2 @@ + +Stdlib__Int64 (ocaml.Stdlib__Int64)

Module Stdlib__Int64

This module is hidden.

diff --git a/ocaml/Stdlib__Lazy/index.html b/ocaml/Stdlib__Lazy/index.html new file mode 100644 index 00000000..9b8aeec4 --- /dev/null +++ b/ocaml/Stdlib__Lazy/index.html @@ -0,0 +1,2 @@ + +Stdlib__Lazy (ocaml.Stdlib__Lazy)

Module Stdlib__Lazy

This module is hidden.

diff --git a/ocaml/Stdlib__Lexing/index.html b/ocaml/Stdlib__Lexing/index.html new file mode 100644 index 00000000..7a3cae12 --- /dev/null +++ b/ocaml/Stdlib__Lexing/index.html @@ -0,0 +1,2 @@ + +Stdlib__Lexing (ocaml.Stdlib__Lexing)

Module Stdlib__Lexing

This module is hidden.

diff --git a/ocaml/Stdlib__List/index.html b/ocaml/Stdlib__List/index.html new file mode 100644 index 00000000..e23cd756 --- /dev/null +++ b/ocaml/Stdlib__List/index.html @@ -0,0 +1,2 @@ + +Stdlib__List (ocaml.Stdlib__List)

Module Stdlib__List

This module is hidden.

diff --git a/ocaml/Stdlib__ListLabels/index.html b/ocaml/Stdlib__ListLabels/index.html new file mode 100644 index 00000000..c1418fff --- /dev/null +++ b/ocaml/Stdlib__ListLabels/index.html @@ -0,0 +1,2 @@ + +Stdlib__ListLabels (ocaml.Stdlib__ListLabels)

Module Stdlib__ListLabels

This module is hidden.

diff --git a/ocaml/Stdlib__Map/index.html b/ocaml/Stdlib__Map/index.html new file mode 100644 index 00000000..dfc90020 --- /dev/null +++ b/ocaml/Stdlib__Map/index.html @@ -0,0 +1,2 @@ + +Stdlib__Map (ocaml.Stdlib__Map)

Module Stdlib__Map

This module is hidden.

diff --git a/ocaml/Stdlib__Marshal/index.html b/ocaml/Stdlib__Marshal/index.html new file mode 100644 index 00000000..48704506 --- /dev/null +++ b/ocaml/Stdlib__Marshal/index.html @@ -0,0 +1,2 @@ + +Stdlib__Marshal (ocaml.Stdlib__Marshal)

Module Stdlib__Marshal

This module is hidden.

diff --git a/ocaml/Stdlib__MoreLabels/index.html b/ocaml/Stdlib__MoreLabels/index.html new file mode 100644 index 00000000..128b1e7c --- /dev/null +++ b/ocaml/Stdlib__MoreLabels/index.html @@ -0,0 +1,2 @@ + +Stdlib__MoreLabels (ocaml.Stdlib__MoreLabels)

Module Stdlib__MoreLabels

This module is hidden.

diff --git a/ocaml/Stdlib__Mutex/index.html b/ocaml/Stdlib__Mutex/index.html new file mode 100644 index 00000000..36112753 --- /dev/null +++ b/ocaml/Stdlib__Mutex/index.html @@ -0,0 +1,2 @@ + +Stdlib__Mutex (ocaml.Stdlib__Mutex)

Module Stdlib__Mutex

This module is hidden.

diff --git a/ocaml/Stdlib__Nativeint/index.html b/ocaml/Stdlib__Nativeint/index.html new file mode 100644 index 00000000..d566d6fe --- /dev/null +++ b/ocaml/Stdlib__Nativeint/index.html @@ -0,0 +1,2 @@ + +Stdlib__Nativeint (ocaml.Stdlib__Nativeint)

Module Stdlib__Nativeint

This module is hidden.

diff --git a/ocaml/Stdlib__Obj/index.html b/ocaml/Stdlib__Obj/index.html new file mode 100644 index 00000000..d061b2ec --- /dev/null +++ b/ocaml/Stdlib__Obj/index.html @@ -0,0 +1,2 @@ + +Stdlib__Obj (ocaml.Stdlib__Obj)

Module Stdlib__Obj

This module is hidden.

diff --git a/ocaml/Stdlib__Oo/index.html b/ocaml/Stdlib__Oo/index.html new file mode 100644 index 00000000..c41137a2 --- /dev/null +++ b/ocaml/Stdlib__Oo/index.html @@ -0,0 +1,2 @@ + +Stdlib__Oo (ocaml.Stdlib__Oo)

Module Stdlib__Oo

This module is hidden.

diff --git a/ocaml/Stdlib__Option/index.html b/ocaml/Stdlib__Option/index.html new file mode 100644 index 00000000..0a1f3794 --- /dev/null +++ b/ocaml/Stdlib__Option/index.html @@ -0,0 +1,2 @@ + +Stdlib__Option (ocaml.Stdlib__Option)

Module Stdlib__Option

This module is hidden.

diff --git a/ocaml/Stdlib__Out_channel/index.html b/ocaml/Stdlib__Out_channel/index.html new file mode 100644 index 00000000..2747fdcc --- /dev/null +++ b/ocaml/Stdlib__Out_channel/index.html @@ -0,0 +1,2 @@ + +Stdlib__Out_channel (ocaml.Stdlib__Out_channel)

Module Stdlib__Out_channel

This module is hidden.

diff --git a/ocaml/Stdlib__Parsing/index.html b/ocaml/Stdlib__Parsing/index.html new file mode 100644 index 00000000..94b71986 --- /dev/null +++ b/ocaml/Stdlib__Parsing/index.html @@ -0,0 +1,2 @@ + +Stdlib__Parsing (ocaml.Stdlib__Parsing)

Module Stdlib__Parsing

This module is hidden.

diff --git a/ocaml/Stdlib__Printexc/index.html b/ocaml/Stdlib__Printexc/index.html new file mode 100644 index 00000000..2341770a --- /dev/null +++ b/ocaml/Stdlib__Printexc/index.html @@ -0,0 +1,2 @@ + +Stdlib__Printexc (ocaml.Stdlib__Printexc)

Module Stdlib__Printexc

This module is hidden.

diff --git a/ocaml/Stdlib__Printf/index.html b/ocaml/Stdlib__Printf/index.html new file mode 100644 index 00000000..777f8489 --- /dev/null +++ b/ocaml/Stdlib__Printf/index.html @@ -0,0 +1,2 @@ + +Stdlib__Printf (ocaml.Stdlib__Printf)

Module Stdlib__Printf

This module is hidden.

diff --git a/ocaml/Stdlib__Queue/index.html b/ocaml/Stdlib__Queue/index.html new file mode 100644 index 00000000..b6281e63 --- /dev/null +++ b/ocaml/Stdlib__Queue/index.html @@ -0,0 +1,2 @@ + +Stdlib__Queue (ocaml.Stdlib__Queue)

Module Stdlib__Queue

This module is hidden.

diff --git a/ocaml/Stdlib__Random/index.html b/ocaml/Stdlib__Random/index.html new file mode 100644 index 00000000..de956d1e --- /dev/null +++ b/ocaml/Stdlib__Random/index.html @@ -0,0 +1,2 @@ + +Stdlib__Random (ocaml.Stdlib__Random)

Module Stdlib__Random

This module is hidden.

diff --git a/ocaml/Stdlib__Result/index.html b/ocaml/Stdlib__Result/index.html new file mode 100644 index 00000000..bcf44ecf --- /dev/null +++ b/ocaml/Stdlib__Result/index.html @@ -0,0 +1,2 @@ + +Stdlib__Result (ocaml.Stdlib__Result)

Module Stdlib__Result

This module is hidden.

diff --git a/ocaml/Stdlib__Scanf/index.html b/ocaml/Stdlib__Scanf/index.html new file mode 100644 index 00000000..81eebff8 --- /dev/null +++ b/ocaml/Stdlib__Scanf/index.html @@ -0,0 +1,2 @@ + +Stdlib__Scanf (ocaml.Stdlib__Scanf)

Module Stdlib__Scanf

This module is hidden.

diff --git a/ocaml/Stdlib__Semaphore/index.html b/ocaml/Stdlib__Semaphore/index.html new file mode 100644 index 00000000..dc46d934 --- /dev/null +++ b/ocaml/Stdlib__Semaphore/index.html @@ -0,0 +1,2 @@ + +Stdlib__Semaphore (ocaml.Stdlib__Semaphore)

Module Stdlib__Semaphore

This module is hidden.

diff --git a/ocaml/Stdlib__Seq/index.html b/ocaml/Stdlib__Seq/index.html new file mode 100644 index 00000000..9e66c326 --- /dev/null +++ b/ocaml/Stdlib__Seq/index.html @@ -0,0 +1,2 @@ + +Stdlib__Seq (ocaml.Stdlib__Seq)

Module Stdlib__Seq

This module is hidden.

diff --git a/ocaml/Stdlib__Set/index.html b/ocaml/Stdlib__Set/index.html new file mode 100644 index 00000000..8a4b0917 --- /dev/null +++ b/ocaml/Stdlib__Set/index.html @@ -0,0 +1,2 @@ + +Stdlib__Set (ocaml.Stdlib__Set)

Module Stdlib__Set

This module is hidden.

diff --git a/ocaml/Stdlib__Stack/index.html b/ocaml/Stdlib__Stack/index.html new file mode 100644 index 00000000..aa47a892 --- /dev/null +++ b/ocaml/Stdlib__Stack/index.html @@ -0,0 +1,2 @@ + +Stdlib__Stack (ocaml.Stdlib__Stack)

Module Stdlib__Stack

This module is hidden.

diff --git a/ocaml/Stdlib__StdLabels/index.html b/ocaml/Stdlib__StdLabels/index.html new file mode 100644 index 00000000..9621059e --- /dev/null +++ b/ocaml/Stdlib__StdLabels/index.html @@ -0,0 +1,2 @@ + +Stdlib__StdLabels (ocaml.Stdlib__StdLabels)

Module Stdlib__StdLabels

This module is hidden.

diff --git a/ocaml/Stdlib__String/index.html b/ocaml/Stdlib__String/index.html new file mode 100644 index 00000000..ad0e79ae --- /dev/null +++ b/ocaml/Stdlib__String/index.html @@ -0,0 +1,2 @@ + +Stdlib__String (ocaml.Stdlib__String)

Module Stdlib__String

This module is hidden.

diff --git a/ocaml/Stdlib__StringLabels/index.html b/ocaml/Stdlib__StringLabels/index.html new file mode 100644 index 00000000..3c47af82 --- /dev/null +++ b/ocaml/Stdlib__StringLabels/index.html @@ -0,0 +1,2 @@ + +Stdlib__StringLabels (ocaml.Stdlib__StringLabels)

Module Stdlib__StringLabels

This module is hidden.

diff --git a/ocaml/Stdlib__Sys/index.html b/ocaml/Stdlib__Sys/index.html new file mode 100644 index 00000000..6509214b --- /dev/null +++ b/ocaml/Stdlib__Sys/index.html @@ -0,0 +1,2 @@ + +Stdlib__Sys (ocaml.Stdlib__Sys)

Module Stdlib__Sys

This module is hidden.

diff --git a/ocaml/Stdlib__Type/index.html b/ocaml/Stdlib__Type/index.html new file mode 100644 index 00000000..ae2cdb62 --- /dev/null +++ b/ocaml/Stdlib__Type/index.html @@ -0,0 +1,2 @@ + +Stdlib__Type (ocaml.Stdlib__Type)

Module Stdlib__Type

This module is hidden.

diff --git a/ocaml/Stdlib__Uchar/index.html b/ocaml/Stdlib__Uchar/index.html new file mode 100644 index 00000000..d0d669c6 --- /dev/null +++ b/ocaml/Stdlib__Uchar/index.html @@ -0,0 +1,2 @@ + +Stdlib__Uchar (ocaml.Stdlib__Uchar)

Module Stdlib__Uchar

This module is hidden.

diff --git a/ocaml/Stdlib__Unit/index.html b/ocaml/Stdlib__Unit/index.html new file mode 100644 index 00000000..7afc8e1e --- /dev/null +++ b/ocaml/Stdlib__Unit/index.html @@ -0,0 +1,2 @@ + +Stdlib__Unit (ocaml.Stdlib__Unit)

Module Stdlib__Unit

This module is hidden.

diff --git a/ocaml/Stdlib__Weak/index.html b/ocaml/Stdlib__Weak/index.html new file mode 100644 index 00000000..caedf535 --- /dev/null +++ b/ocaml/Stdlib__Weak/index.html @@ -0,0 +1,2 @@ + +Stdlib__Weak (ocaml.Stdlib__Weak)

Module Stdlib__Weak

This module is hidden.

diff --git a/ocaml/Str/index.html b/ocaml/Str/index.html new file mode 100644 index 00000000..5431115c --- /dev/null +++ b/ocaml/Str/index.html @@ -0,0 +1,4 @@ + +Str (ocaml.Str)

Module Str

Regular expressions and high-level string processing

Regular expressions

The Str library provides regular expressions on sequences of bytes. It is, in general, unsuitable to match Unicode characters.

type regexp

The type of compiled regular expressions.

val regexp : string -> regexp

Compile a regular expression. The following constructs are recognized:

  • . Matches any character except newline.
  • * (postfix) Matches the preceding expression zero, one or several times
  • + (postfix) Matches the preceding expression one or several times
  • ? (postfix) Matches the preceding expression once or not at all
  • [..] Character set. Ranges are denoted with -, as in [a-z]. An initial ^, as in [^0-9], complements the set. To include a ] character in a set, make it the first character of the set. To include a - character in a set, make it the first or the last character of the set.
  • ^ Matches at beginning of line: either at the beginning of the matched string, or just after a '\n' character.
  • $ Matches at end of line: either at the end of the matched string, or just before a '\n' character.
  • \| (infix) Alternative between two expressions.
  • \(..\) Grouping and naming of the enclosed expression.
  • \1 The text matched by the first \(...\) expression (\2 for the second expression, and so on up to \9).
  • \b Matches word boundaries.
  • \ Quotes special characters. The special characters are $^\.*+?[].

In regular expressions you will often use backslash characters; it's easier to use a quoted string literal {|...|} to avoid having to escape backslashes.

For example, the following expression:

let r = Str.regexp {|hello \([A-Za-z]+\)|} in
+Str.replace_first r {|\1|} "hello world" 

returns the string "world".

If you want a regular expression that matches a literal backslash character, you need to double it: Str.regexp {|\\|}.

You can use regular string literals "..." too, however you will have to escape backslashes. The example above can be rewritten with a regular string literal as:

let r = Str.regexp "hello \\([A-Za-z]+\\)" in
+Str.replace_first r "\\1" "hello world" 

And the regular expression for matching a backslash becomes a quadruple backslash: Str.regexp "\\\\".

val regexp_case_fold : string -> regexp

Same as regexp, but the compiled expression will match text in a case-insensitive way: uppercase and lowercase letters will be considered equivalent.

val quote : string -> string

Str.quote s returns a regexp string that matches exactly s and nothing else.

val regexp_string : string -> regexp

Str.regexp_string s returns a regular expression that matches exactly s and nothing else.

val regexp_string_case_fold : string -> regexp

Str.regexp_string_case_fold is similar to Str.regexp_string, but the regexp matches in a case-insensitive way.

String matching and searching

val string_match : regexp -> string -> int -> bool

string_match r s start tests whether a substring of s that starts at position start matches the regular expression r. The first character of a string has position 0, as usual.

val search_forward : regexp -> string -> int -> int

search_forward r s start searches the string s for a substring matching the regular expression r. The search starts at position start and proceeds towards the end of the string. Return the position of the first character of the matched substring.

  • raises Not_found

    if no substring matches.

val search_backward : regexp -> string -> int -> int

search_backward r s last searches the string s for a substring matching the regular expression r. The search first considers substrings that start at position last and proceeds towards the beginning of string. Return the position of the first character of the matched substring.

  • raises Not_found

    if no substring matches.

val string_partial_match : regexp -> string -> int -> bool

Similar to Str.string_match, but also returns true if the argument string is a prefix of a string that matches. This includes the case of a true complete match.

val matched_string : string -> string

matched_string s returns the substring of s that was matched by the last call to one of the following matching or searching functions:

provided that none of the following functions was called in between:

Note: in the case of global_substitute and substitute_first, a call to matched_string is only valid within the subst argument, not after global_substitute or substitute_first returns.

The user must make sure that the parameter s is the same string that was passed to the matching or searching function.

val match_beginning : unit -> int

match_beginning() returns the position of the first character of the substring that was matched by the last call to a matching or searching function (see Str.matched_string for details).

val match_end : unit -> int

match_end() returns the position of the character following the last character of the substring that was matched by the last call to a matching or searching function (see Str.matched_string for details).

val matched_group : int -> string -> string

matched_group n s returns the substring of s that was matched by the nth group \(...\) of the regular expression that was matched by the last call to a matching or searching function (see Str.matched_string for details). When n is 0, it returns the substring matched by the whole regular expression. The user must make sure that the parameter s is the same string that was passed to the matching or searching function.

  • raises Not_found

    if the nth group of the regular expression was not matched. This can happen with groups inside alternatives \|, options ? or repetitions *. For instance, the empty string will match \(a\)*, but matched_group 1 "" will raise Not_found because the first group itself was not matched.

val group_beginning : int -> int

group_beginning n returns the position of the first character of the substring that was matched by the nth group of the regular expression that was matched by the last call to a matching or searching function (see Str.matched_string for details).

  • raises Not_found

    if the nth group of the regular expression was not matched.

  • raises Invalid_argument

    if there are fewer than n groups in the regular expression.

val group_end : int -> int

group_end n returns the position of the character following the last character of substring that was matched by the nth group of the regular expression that was matched by the last call to a matching or searching function (see Str.matched_string for details).

  • raises Not_found

    if the nth group of the regular expression was not matched.

  • raises Invalid_argument

    if there are fewer than n groups in the regular expression.

Replacement

val global_replace : regexp -> string -> string -> string

global_replace regexp templ s returns a string identical to s, except that all substrings of s that match regexp have been replaced by templ. The replacement template templ can contain \1, \2, etc; these sequences will be replaced by the text matched by the corresponding group in the regular expression. \0 stands for the text matched by the whole regular expression.

val replace_first : regexp -> string -> string -> string

Same as Str.global_replace, except that only the first substring matching the regular expression is replaced.

val global_substitute : regexp -> (string -> string) -> string -> string

global_substitute regexp subst s returns a string identical to s, except that all substrings of s that match regexp have been replaced by the result of function subst. The function subst is called once for each matching substring, and receives s (the whole text) as argument.

val substitute_first : regexp -> (string -> string) -> string -> string

Same as Str.global_substitute, except that only the first substring matching the regular expression is replaced.

val replace_matched : string -> string -> string

replace_matched repl s returns the replacement text repl in which \1, \2, etc. have been replaced by the text matched by the corresponding groups in the regular expression that was matched by the last call to a matching or searching function (see Str.matched_string for details). s must be the same string that was passed to the matching or searching function.

Splitting

val split : regexp -> string -> string list

split r s splits s into substrings, taking as delimiters the substrings that match r, and returns the list of substrings. For instance, split (regexp "[ \t]+") s splits s into blank-separated words. An occurrence of the delimiter at the beginning or at the end of the string is ignored.

val bounded_split : regexp -> string -> int -> string list

Same as Str.split, but splits into at most n substrings, where n is the extra integer parameter.

val split_delim : regexp -> string -> string list

Same as Str.split but occurrences of the delimiter at the beginning and at the end of the string are recognized and returned as empty strings in the result. For instance, split_delim (regexp " ") " abc " returns [""; "abc"; ""], while split with the same arguments returns ["abc"].

val bounded_split_delim : regexp -> string -> int -> string list

Same as Str.bounded_split, but occurrences of the delimiter at the beginning and at the end of the string are recognized and returned as empty strings in the result.

type split_result =
  1. | Text of string
  2. | Delim of string
val full_split : regexp -> string -> split_result list

Same as Str.split_delim, but returns the delimiters as well as the substrings contained between delimiters. The former are tagged Delim in the result list; the latter are tagged Text. For instance, full_split (regexp "[{}]") "{ab}" returns [Delim "{"; Text "ab"; Delim "}"].

val bounded_full_split : regexp -> string -> int -> split_result list

Same as Str.bounded_split_delim, but returns the delimiters as well as the substrings contained between delimiters. The former are tagged Delim in the result list; the latter are tagged Text.

Extracting substrings

val string_before : string -> int -> string

string_before s n returns the substring of all characters of s that precede position n (excluding the character at position n).

val string_after : string -> int -> string

string_after s n returns the substring of all characters of s that follow position n (including the character at position n).

val first_chars : string -> int -> string

first_chars s n returns the first n characters of s. This is the same function as Str.string_before.

val last_chars : string -> int -> string

last_chars s n returns the last n characters of s.

diff --git a/ocaml/Strmatch/Make/argument-1-_/index.html b/ocaml/Strmatch/Make/argument-1-_/index.html new file mode 100644 index 00000000..4f63c86c --- /dev/null +++ b/ocaml/Strmatch/Make/argument-1-_/index.html @@ -0,0 +1,9 @@ + +_ (ocaml.Strmatch.Make._)

Parameter Make._

val string_block_length : Cmm.expression -> Cmm.expression
val transl_switch : + Debuginfo.t -> + Cmm.expression -> + int -> + int -> + (int * Cmm.expression) list -> + Cmm.expression -> + Cmm.expression
diff --git a/ocaml/Strmatch/Make/index.html b/ocaml/Strmatch/Make/index.html new file mode 100644 index 00000000..ee79ae62 --- /dev/null +++ b/ocaml/Strmatch/Make/index.html @@ -0,0 +1,7 @@ + +Make (ocaml.Strmatch.Make)

Module Strmatch.Make

Parameters

module _ : I

Signature

val compile : + Debuginfo.t -> + Cmm.expression -> + Cmm.expression option -> + (string * Cmm.expression) list -> + Cmm.expression
diff --git a/ocaml/Strmatch/index.html b/ocaml/Strmatch/index.html new file mode 100644 index 00000000..0f13913b --- /dev/null +++ b/ocaml/Strmatch/index.html @@ -0,0 +1,2 @@ + +Strmatch (ocaml.Strmatch)

Module Strmatch

module type I = sig ... end
module Make (_ : I) : sig ... end
diff --git a/ocaml/Strmatch/module-type-I/index.html b/ocaml/Strmatch/module-type-I/index.html new file mode 100644 index 00000000..bc3cc666 --- /dev/null +++ b/ocaml/Strmatch/module-type-I/index.html @@ -0,0 +1,9 @@ + +I (ocaml.Strmatch.I)

Module type Strmatch.I

val string_block_length : Cmm.expression -> Cmm.expression
val transl_switch : + Debuginfo.t -> + Cmm.expression -> + int -> + int -> + (int * Cmm.expression) list -> + Cmm.expression -> + Cmm.expression
diff --git a/ocaml/Strongly_connected_components/Make/argument-1-Id/Map/index.html b/ocaml/Strongly_connected_components/Make/argument-1-Id/Map/index.html new file mode 100644 index 00000000..f81ad852 --- /dev/null +++ b/ocaml/Strongly_connected_components/Make/argument-1-Id/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Strongly_connected_components.Make.Id.Map)

Module Id.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Strongly_connected_components/Make/argument-1-Id/Set/index.html b/ocaml/Strongly_connected_components/Make/argument-1-Id/Set/index.html new file mode 100644 index 00000000..62db97c1 --- /dev/null +++ b/ocaml/Strongly_connected_components/Make/argument-1-Id/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Strongly_connected_components.Make.Id.Set)

Module Id.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Strongly_connected_components/Make/argument-1-Id/T/index.html b/ocaml/Strongly_connected_components/Make/argument-1-Id/T/index.html new file mode 100644 index 00000000..4207439b --- /dev/null +++ b/ocaml/Strongly_connected_components/Make/argument-1-Id/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Strongly_connected_components.Make.Id.T)

Module Id.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Strongly_connected_components/Make/argument-1-Id/Tbl/index.html b/ocaml/Strongly_connected_components/Make/argument-1-Id/Tbl/index.html new file mode 100644 index 00000000..4a9f69b0 --- /dev/null +++ b/ocaml/Strongly_connected_components/Make/argument-1-Id/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Strongly_connected_components.Make.Id.Tbl)

Module Id.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Strongly_connected_components/Make/argument-1-Id/index.html b/ocaml/Strongly_connected_components/Make/argument-1-Id/index.html new file mode 100644 index 00000000..4597dca3 --- /dev/null +++ b/ocaml/Strongly_connected_components/Make/argument-1-Id/index.html @@ -0,0 +1,2 @@ + +Id (ocaml.Strongly_connected_components.Make.Id)

Parameter Make.Id

type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
diff --git a/ocaml/Strongly_connected_components/Make/index.html b/ocaml/Strongly_connected_components/Make/index.html new file mode 100644 index 00000000..225e0bea --- /dev/null +++ b/ocaml/Strongly_connected_components/Make/index.html @@ -0,0 +1,4 @@ + +Make (ocaml.Strongly_connected_components.Make)

Module Strongly_connected_components.Make

Parameters

Signature

type directed_graph = Id.Set.t Id.Map.t

If (a -> set) belongs to the map, it means that there are edges from a to every element of set. It is assumed that no edge points to a vertex not represented in the map.

type component =
  1. | Has_loop of Id.t list
  2. | No_loop of Id.t
val connected_components_sorted_from_roots_to_leaf : + directed_graph -> + component array
val component_graph : directed_graph -> (component * int list) array
diff --git a/ocaml/Strongly_connected_components/index.html b/ocaml/Strongly_connected_components/index.html new file mode 100644 index 00000000..99f3cc7d --- /dev/null +++ b/ocaml/Strongly_connected_components/index.html @@ -0,0 +1,2 @@ + +Strongly_connected_components (ocaml.Strongly_connected_components)

Module Strongly_connected_components

Kosaraju's algorithm for strongly connected components.

Warning: this module is unstable and part of compiler-libs.

module type S = sig ... end
module Make (Id : Identifiable.S) : S with module Id := Id
diff --git a/ocaml/Strongly_connected_components/module-type-S/Id/Map/index.html b/ocaml/Strongly_connected_components/module-type-S/Id/Map/index.html new file mode 100644 index 00000000..6255e8d5 --- /dev/null +++ b/ocaml/Strongly_connected_components/module-type-S/Id/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Strongly_connected_components.S.Id.Map)

Module Id.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Strongly_connected_components/module-type-S/Id/Set/index.html b/ocaml/Strongly_connected_components/module-type-S/Id/Set/index.html new file mode 100644 index 00000000..93f5ec70 --- /dev/null +++ b/ocaml/Strongly_connected_components/module-type-S/Id/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Strongly_connected_components.S.Id.Set)

Module Id.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Strongly_connected_components/module-type-S/Id/T/index.html b/ocaml/Strongly_connected_components/module-type-S/Id/T/index.html new file mode 100644 index 00000000..035999e3 --- /dev/null +++ b/ocaml/Strongly_connected_components/module-type-S/Id/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Strongly_connected_components.S.Id.T)

Module Id.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Strongly_connected_components/module-type-S/Id/Tbl/index.html b/ocaml/Strongly_connected_components/module-type-S/Id/Tbl/index.html new file mode 100644 index 00000000..71f7d1fb --- /dev/null +++ b/ocaml/Strongly_connected_components/module-type-S/Id/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Strongly_connected_components.S.Id.Tbl)

Module Id.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Strongly_connected_components/module-type-S/Id/index.html b/ocaml/Strongly_connected_components/module-type-S/Id/index.html new file mode 100644 index 00000000..9d009b2f --- /dev/null +++ b/ocaml/Strongly_connected_components/module-type-S/Id/index.html @@ -0,0 +1,2 @@ + +Id (ocaml.Strongly_connected_components.S.Id)

Module S.Id

type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
diff --git a/ocaml/Strongly_connected_components/module-type-S/index.html b/ocaml/Strongly_connected_components/module-type-S/index.html new file mode 100644 index 00000000..6133d543 --- /dev/null +++ b/ocaml/Strongly_connected_components/module-type-S/index.html @@ -0,0 +1,4 @@ + +S (ocaml.Strongly_connected_components.S)

Module type Strongly_connected_components.S

type directed_graph = Id.Set.t Id.Map.t

If (a -> set) belongs to the map, it means that there are edges from a to every element of set. It is assumed that no edge points to a vertex not represented in the map.

type component =
  1. | Has_loop of Id.t list
  2. | No_loop of Id.t
val connected_components_sorted_from_roots_to_leaf : + directed_graph -> + component array
val component_graph : directed_graph -> (component * int list) array
diff --git a/ocaml/Stypes/index.html b/ocaml/Stypes/index.html new file mode 100644 index 00000000..a7c5a7a2 --- /dev/null +++ b/ocaml/Stypes/index.html @@ -0,0 +1,3 @@ + +Stypes (ocaml.Stypes)

Module Stypes

type annotation =
  1. | Ti_pat : 'k Typedtree.pattern_category + * 'k Typedtree.general_pattern -> annotation
  2. | Ti_expr of Typedtree.expression
  3. | Ti_class of Typedtree.class_expr
  4. | Ti_mod of Typedtree.module_expr
  5. | An_call of Location.t * Annot.call
  6. | An_ident of Location.t * string * Annot.ident
val record : annotation -> unit
val record_phrase : Location.t -> unit
val dump : string option -> unit
val get_location : annotation -> Location.t
val get_info : unit -> annotation list
diff --git a/ocaml/Subst/Lazy/index.html b/ocaml/Subst/Lazy/index.html new file mode 100644 index 00000000..e75e91d1 --- /dev/null +++ b/ocaml/Subst/Lazy/index.html @@ -0,0 +1,18 @@ + +Lazy (ocaml.Subst.Lazy)

Module Subst.Lazy

type module_decl = {
  1. mdl_type : modtype;
  2. mdl_attributes : Parsetree.attributes;
  3. mdl_loc : Location.t;
  4. mdl_uid : Types.Uid.t;
}
and modtype =
  1. | MtyL_ident of Path.t
  2. | MtyL_signature of signature
  3. | MtyL_functor of functor_parameter * modtype
  4. | MtyL_alias of Path.t
and modtype_declaration = {
  1. mtdl_type : modtype option;
  2. mtdl_attributes : Parsetree.attributes;
  3. mtdl_loc : Location.t;
  4. mtdl_uid : Types.Uid.t;
}
and signature
and functor_parameter =
  1. | Unit
  2. | Named of Ident.t option * modtype
val of_module_decl : Types.module_declaration -> module_decl
val of_modtype : Types.module_type -> modtype
val of_signature : Types.signature -> signature
val of_signature_items : signature_item list -> signature
val of_signature_item : Types.signature_item -> signature_item
val module_decl : scoping -> t -> module_decl -> module_decl
val modtype : scoping -> t -> modtype -> modtype
val modtype_decl : scoping -> t -> modtype_declaration -> modtype_declaration
val signature : scoping -> t -> signature -> signature
val signature_item : scoping -> t -> signature_item -> signature_item
val force_module_decl : module_decl -> Types.module_declaration
val force_modtype : modtype -> Types.module_type
val force_signature : signature -> Types.signature
val force_signature_once : signature -> signature_item list
val force_signature_item : signature_item -> Types.signature_item
diff --git a/ocaml/Subst/index.html b/ocaml/Subst/index.html new file mode 100644 index 00000000..88fe0bbe --- /dev/null +++ b/ocaml/Subst/index.html @@ -0,0 +1,30 @@ + +Subst (ocaml.Subst)

Module Subst

type t
val identity : t
val add_type : Ident.t -> Path.t -> t -> t
val add_type_path : Path.t -> Path.t -> t -> t
val add_type_function : + Path.t -> + params:Types.type_expr list -> + body:Types.type_expr -> + t -> + t
val add_module : Ident.t -> Path.t -> t -> t
val add_module_path : Path.t -> Path.t -> t -> t
val add_modtype : Ident.t -> Types.module_type -> t -> t
val add_modtype_path : Path.t -> Types.module_type -> t -> t
val for_saving : t -> t
val reset_for_saving : unit -> unit
val change_locs : t -> Location.t -> t
val module_path : t -> Path.t -> Path.t
val type_path : t -> Path.t -> Path.t
val modtype_path : t -> Path.t -> Path.t
val type_expr : t -> Types.type_expr -> Types.type_expr
val class_type : t -> Types.class_type -> Types.class_type
val value_description : t -> Types.value_description -> Types.value_description
val type_declaration : t -> Types.type_declaration -> Types.type_declaration
val extension_constructor : + t -> + Types.extension_constructor -> + Types.extension_constructor
val class_declaration : t -> Types.class_declaration -> Types.class_declaration
val cltype_declaration : + t -> + Types.class_type_declaration -> + Types.class_type_declaration
type scoping =
  1. | Keep
  2. | Make_local
  3. | Rescope of int
val signature : scoping -> t -> Types.signature -> Types.signature
val signature_item : + scoping -> + t -> + Types.signature_item -> + Types.signature_item
val modtype_declaration : + scoping -> + t -> + Types.modtype_declaration -> + Types.modtype_declaration
val module_declaration : + scoping -> + t -> + Types.module_declaration -> + Types.module_declaration
val compose : t -> t -> t
val ctype_apply_env_empty : + (Types.type_expr list -> + Types.type_expr -> + Types.type_expr list -> + Types.type_expr) + ref
module Lazy : sig ... end
diff --git a/ocaml/Switch/CtxStore/argument-1-A/index.html b/ocaml/Switch/CtxStore/argument-1-A/index.html new file mode 100644 index 00000000..71c71cac --- /dev/null +++ b/ocaml/Switch/CtxStore/argument-1-A/index.html @@ -0,0 +1,2 @@ + +A (ocaml.Switch.CtxStore.A)

Parameter CtxStore.A

include Stored
type t
type key
val compare_key : key -> key -> int
type context
val make_key : context -> t -> key option
diff --git a/ocaml/Switch/CtxStore/index.html b/ocaml/Switch/CtxStore/index.html new file mode 100644 index 00000000..76b88a5b --- /dev/null +++ b/ocaml/Switch/CtxStore/index.html @@ -0,0 +1,2 @@ + +CtxStore (ocaml.Switch.CtxStore)

Module Switch.CtxStore

Parameters

module A : CtxStored

Signature

val mk_store : unit -> (A.t, A.context) t_store
diff --git a/ocaml/Switch/Make/argument-1-Arg/index.html b/ocaml/Switch/Make/argument-1-Arg/index.html new file mode 100644 index 00000000..a0b4193e --- /dev/null +++ b/ocaml/Switch/Make/argument-1-Arg/index.html @@ -0,0 +1,2 @@ + +Arg (ocaml.Switch.Make.Arg)

Parameter Make.Arg

type primitive
val eqint : primitive
val neint : primitive
val leint : primitive
val ltint : primitive
val geint : primitive
val gtint : primitive
type loc
type arg
type test
type act
val bind : arg -> (arg -> act) -> act
val make_const : int -> arg
val make_offset : arg -> int -> arg
val make_prim : primitive -> arg list -> test
val make_isout : arg -> arg -> test
val make_isin : arg -> arg -> test
val make_is_nonzero : arg -> test
val arg_as_test : arg -> test
val make_if : test -> act -> act -> act
val make_switch : loc -> arg -> int array -> act array -> act
val make_catch : act -> int * (act -> act)
val make_exit : int -> act
diff --git a/ocaml/Switch/Make/index.html b/ocaml/Switch/Make/index.html new file mode 100644 index 00000000..0d3e756b --- /dev/null +++ b/ocaml/Switch/Make/index.html @@ -0,0 +1,12 @@ + +Make (ocaml.Switch.Make)

Module Switch.Make

Parameters

module Arg : S

Signature

val zyva : + Arg.loc -> + (int * int) -> + Arg.arg -> + (int * int * int) array -> + (Arg.act, _) t_store -> + Arg.act
val test_sequence : + Arg.arg -> + (int * int * int) array -> + (Arg.act, _) t_store -> + Arg.act
diff --git a/ocaml/Switch/Store/argument-1-A/index.html b/ocaml/Switch/Store/argument-1-A/index.html new file mode 100644 index 00000000..c9d50694 --- /dev/null +++ b/ocaml/Switch/Store/argument-1-A/index.html @@ -0,0 +1,2 @@ + +A (ocaml.Switch.Store.A)

Parameter Store.A

type t
type key
val compare_key : key -> key -> int
val make_key : t -> key option
diff --git a/ocaml/Switch/Store/index.html b/ocaml/Switch/Store/index.html new file mode 100644 index 00000000..d3e4e02b --- /dev/null +++ b/ocaml/Switch/Store/index.html @@ -0,0 +1,2 @@ + +Store (ocaml.Switch.Store)

Module Switch.Store

Parameters

module A : Stored

Signature

val mk_store : unit -> (A.t, unit) t_store
diff --git a/ocaml/Switch/index.html b/ocaml/Switch/index.html new file mode 100644 index 00000000..08ac645a --- /dev/null +++ b/ocaml/Switch/index.html @@ -0,0 +1,2 @@ + +Switch (ocaml.Switch)

Module Switch

type 'a shared =
  1. | Shared of 'a
  2. | Single of 'a
type ('a, 'ctx) t_store = {
  1. act_get : unit -> 'a array;
  2. act_get_shared : unit -> 'a shared array;
  3. act_store : 'ctx -> 'a -> int;
  4. act_store_shared : 'ctx -> 'a -> int;
}
module type Stored = sig ... end
module type CtxStored = sig ... end
module CtxStore (A : CtxStored) : sig ... end
module Store (A : Stored) : sig ... end
module type S = sig ... end
module Make (Arg : S) : sig ... end
diff --git a/ocaml/Switch/module-type-CtxStored/index.html b/ocaml/Switch/module-type-CtxStored/index.html new file mode 100644 index 00000000..46c4f501 --- /dev/null +++ b/ocaml/Switch/module-type-CtxStored/index.html @@ -0,0 +1,2 @@ + +CtxStored (ocaml.Switch.CtxStored)

Module type Switch.CtxStored

include Stored
type t
type key
val compare_key : key -> key -> int
type context
val make_key : context -> t -> key option
diff --git a/ocaml/Switch/module-type-S/index.html b/ocaml/Switch/module-type-S/index.html new file mode 100644 index 00000000..adaa5619 --- /dev/null +++ b/ocaml/Switch/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Switch.S)

Module type Switch.S

type primitive
val eqint : primitive
val neint : primitive
val leint : primitive
val ltint : primitive
val geint : primitive
val gtint : primitive
type loc
type arg
type test
type act
val bind : arg -> (arg -> act) -> act
val make_const : int -> arg
val make_offset : arg -> int -> arg
val make_prim : primitive -> arg list -> test
val make_isout : arg -> arg -> test
val make_isin : arg -> arg -> test
val make_is_nonzero : arg -> test
val arg_as_test : arg -> test
val make_if : test -> act -> act -> act
val make_switch : loc -> arg -> int array -> act array -> act
val make_catch : act -> int * (act -> act)
val make_exit : int -> act
diff --git a/ocaml/Switch/module-type-Stored/index.html b/ocaml/Switch/module-type-Stored/index.html new file mode 100644 index 00000000..7b114e2b --- /dev/null +++ b/ocaml/Switch/module-type-Stored/index.html @@ -0,0 +1,2 @@ + +Stored (ocaml.Switch.Stored)

Module type Switch.Stored

type t
type key
val compare_key : key -> key -> int
val make_key : t -> key option
diff --git a/ocaml/Symbol/Map/index.html b/ocaml/Symbol/Map/index.html new file mode 100644 index 00000000..bfb23439 --- /dev/null +++ b/ocaml/Symbol/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Symbol.Map)

Module Symbol.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Symbol/Set/index.html b/ocaml/Symbol/Set/index.html new file mode 100644 index 00000000..9a253d40 --- /dev/null +++ b/ocaml/Symbol/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Symbol.Set)

Module Symbol.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Symbol/T/index.html b/ocaml/Symbol/T/index.html new file mode 100644 index 00000000..e8ff0578 --- /dev/null +++ b/ocaml/Symbol/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Symbol.T)

Module Symbol.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Symbol/Tbl/index.html b/ocaml/Symbol/Tbl/index.html new file mode 100644 index 00000000..b39317e8 --- /dev/null +++ b/ocaml/Symbol/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Symbol.Tbl)

Module Symbol.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Symbol/index.html b/ocaml/Symbol/index.html new file mode 100644 index 00000000..fe1438a7 --- /dev/null +++ b/ocaml/Symbol/index.html @@ -0,0 +1,2 @@ + +Symbol (ocaml.Symbol)

Module Symbol

A symbol identifies a constant provided by either:

  • another compilation unit; or
  • a top-level module.

* sym_unit is the compilation unit containing the value. * sym_label is the linkage name of the variable.

The label must be globally unique: two compilation units linked in the same program must not share labels.

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val of_variable : Variable.t -> t
val of_global_linkage : Compilation_unit.t -> Linkage_name.t -> t
val import_for_pack : pack:Compilation_unit.t -> t -> t
val compilation_unit : t -> Compilation_unit.t
val label : t -> Linkage_name.t
val print_opt : Stdlib.Format.formatter -> t option -> unit
val compare_lists : t list -> t list -> int
diff --git a/ocaml/Symtable/index.html b/ocaml/Symtable/index.html new file mode 100644 index 00000000..04f927ff --- /dev/null +++ b/ocaml/Symtable/index.html @@ -0,0 +1,5 @@ + +Symtable (ocaml.Symtable)

Module Symtable

val init : unit -> unit
val patch_object : + Misc.LongString.t -> + (Cmo_format.reloc_info * int) list -> + unit
val require_primitive : string -> unit
val initial_global_table : unit -> Stdlib.Obj.t array
val output_global_map : out_channel -> unit
val output_primitive_names : out_channel -> unit
val output_primitive_table : out_channel -> unit
val data_global_map : unit -> Stdlib.Obj.t
val data_primitive_names : unit -> string
val init_toplevel : unit -> (string * Stdlib.Digest.t option) list
val update_global_table : unit -> unit
val get_global_value : Ident.t -> Stdlib.Obj.t
val is_global_defined : Ident.t -> bool
val assign_global_value : Ident.t -> Stdlib.Obj.t -> unit
val get_global_position : Ident.t -> int
val check_global_initialized : (Cmo_format.reloc_info * int) list -> unit
val defined_globals : (Cmo_format.reloc_info * int) list -> Ident.t list
val required_globals : (Cmo_format.reloc_info * int) list -> Ident.t list
type global_map
val empty_global_map : global_map
val current_state : unit -> global_map
val restore_state : global_map -> unit
val hide_additions : global_map -> unit
val filter_global_map : (Ident.t -> bool) -> global_map -> global_map
val iter_global_map : (Ident.t -> int -> unit) -> global_map -> unit
val is_defined_in_global_map : global_map -> Ident.t -> bool
type error =
  1. | Undefined_global of string
  2. | Unavailable_primitive of string
  3. | Wrong_vm of string
  4. | Uninitialized_global of string
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
val reset : unit -> unit
diff --git a/ocaml/Syntaxerr/index.html b/ocaml/Syntaxerr/index.html new file mode 100644 index 00000000..3052137f --- /dev/null +++ b/ocaml/Syntaxerr/index.html @@ -0,0 +1,2 @@ + +Syntaxerr (ocaml.Syntaxerr)

Module Syntaxerr

Auxiliary type for reporting syntax errors

Warning: this module is unstable and part of compiler-libs.

type error =
  1. | Unclosed of Location.t * string * Location.t * string
  2. | Expecting of Location.t * string
  3. | Not_expecting of Location.t * string
  4. | Applicative_path of Location.t
  5. | Variable_in_scope of Location.t * string
  6. | Other of Location.t
  7. | Ill_formed_ast of Location.t * string
  8. | Invalid_package_type of Location.t * string
  9. | Removed_string_set of Location.t
exception Error of error
exception Escape_error
val location_of_error : error -> Location.t
val ill_formed_ast : Location.t -> string -> 'a
diff --git a/ocaml/Tag/Map/index.html b/ocaml/Tag/Map/index.html new file mode 100644 index 00000000..35e0979b --- /dev/null +++ b/ocaml/Tag/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Tag.Map)

Module Tag.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Tag/Set/index.html b/ocaml/Tag/Set/index.html new file mode 100644 index 00000000..0c05184f --- /dev/null +++ b/ocaml/Tag/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Tag.Set)

Module Tag.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Tag/T/index.html b/ocaml/Tag/T/index.html new file mode 100644 index 00000000..c59fe712 --- /dev/null +++ b/ocaml/Tag/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Tag.T)

Module Tag.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Tag/Tbl/index.html b/ocaml/Tag/Tbl/index.html new file mode 100644 index 00000000..434d2430 --- /dev/null +++ b/ocaml/Tag/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Tag.Tbl)

Module Tag.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Tag/index.html b/ocaml/Tag/index.html new file mode 100644 index 00000000..14b3efe9 --- /dev/null +++ b/ocaml/Tag/index.html @@ -0,0 +1,2 @@ + +Tag (ocaml.Tag)

Module Tag

Tags on runtime boxed values.

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create_exn : int -> t
val to_int : t -> int
val zero : t
val object_tag : t
val compare : t -> t -> int
diff --git a/ocaml/Targetint/index.html b/ocaml/Targetint/index.html new file mode 100644 index 00000000..18e1e92d --- /dev/null +++ b/ocaml/Targetint/index.html @@ -0,0 +1,3 @@ + +Targetint (ocaml.Targetint)

Module Targetint

Target processor-native integers.

This module provides operations on the type of signed 32-bit integers (on 32-bit target platforms) or signed 64-bit integers (on 64-bit target platforms). This integer type has exactly the same width as that of a pointer type in the C compiler. All arithmetic operations over are taken modulo 232 or 264 depending on the word size of the target architecture.

Warning: this module is unstable and part of compiler-libs.

type t

The type of target integers.

val zero : t

The target integer 0.

val one : t

The target integer 1.

val minus_one : t

The target integer -1.

val neg : t -> t

Unary negation.

val add : t -> t -> t

Addition.

val sub : t -> t -> t

Subtraction.

val mul : t -> t -> t

Multiplication.

val div : t -> t -> t

Integer division. Raise Division_by_zero if the second argument is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val unsigned_div : t -> t -> t

Same as div, except that arguments and result are interpreted as unsigned integers.

val rem : t -> t -> t

Integer remainder. If y is not zero, the result of Targetint.rem x y satisfies the following properties: Targetint.zero <= Nativeint.rem x y < Targetint.abs y and x = Targetint.add (Targetint.mul (Targetint.div x y) y) + (Targetint.rem x y). If y = 0, Targetint.rem x y raises Division_by_zero.

val unsigned_rem : t -> t -> t

Same as rem, except that arguments and result are interpreted as unsigned integers.

val succ : t -> t

Successor. Targetint.succ x is Targetint.add x Targetint.one.

val pred : t -> t

Predecessor. Targetint.pred x is Targetint.sub x Targetint.one.

val abs : t -> t

abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

val size : int

The size in bits of a target native integer.

val max_int : t

The greatest representable target integer, either 231 - 1 on a 32-bit platform, or 263 - 1 on a 64-bit platform.

val min_int : t

The smallest representable target integer, either -231 on a 32-bit platform, or -263 on a 64-bit platform.

val logand : t -> t -> t

Bitwise logical and.

val logor : t -> t -> t

Bitwise logical or.

val logxor : t -> t -> t

Bitwise logical exclusive or.

val lognot : t -> t

Bitwise logical negation.

val shift_left : t -> int -> t

Targetint.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is 32 on a 32-bit platform and 64 on a 64-bit platform.

val shift_right : t -> int -> t

Targetint.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= bitsize.

val shift_right_logical : t -> int -> t

Targetint.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= bitsize.

val of_int : int -> t

Convert the given integer (type int) to a target integer (type t), module the target word size.

val of_int_exn : int -> t

Convert the given integer (type int) to a target integer (type t). Raises a fatal error if the conversion is not exact.

val to_int : t -> int

Convert the given target integer (type t) to an integer (type int). The high-order bit is lost during the conversion.

val of_float : float -> t

Convert the given floating-point number to a target integer, discarding the fractional part (truncate towards 0). The result of the conversion is undefined if, after truncation, the number is outside the range [Targetint.min_int, Targetint.max_int].

val to_float : t -> float

Convert the given target integer to a floating-point number.

val of_int32 : int32 -> t

Convert the given 32-bit integer (type int32) to a target integer.

val to_int32 : t -> int32

Convert the given target integer to a 32-bit integer (type int32). On 64-bit platforms, the 64-bit native integer is taken modulo 232, i.e. the top 32 bits are lost. On 32-bit platforms, the conversion is exact.

val of_int64 : int64 -> t

Convert the given 64-bit integer (type int64) to a target integer.

val to_int64 : t -> int64

Convert the given target integer to a 64-bit integer (type int64).

val of_string : string -> t

Convert the given string to a target integer. The string is read in decimal (by default) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively. Raise Failure "int_of_string" if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type nativeint.

val to_string : t -> string

Return the string representation of its argument, in decimal.

val compare : t -> t -> int

The comparison function for target integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Targetint to be passed as argument to the functors Set.Make and Map.Make.

val unsigned_compare : t -> t -> int

Same as compare, except that arguments are interpreted as unsigned integers.

val equal : t -> t -> bool

The equal function for target ints.

type repr =
  1. | Int32 of int32
  2. | Int64 of int64
val repr : t -> repr

The concrete representation of a native integer.

val print : Stdlib.Format.formatter -> t -> unit

Print a target integer to a formatter.

diff --git a/ocaml/Tast_iterator/index.html b/ocaml/Tast_iterator/index.html new file mode 100644 index 00000000..37131eeb --- /dev/null +++ b/ocaml/Tast_iterator/index.html @@ -0,0 +1,8 @@ + +Tast_iterator (ocaml.Tast_iterator)

Module Tast_iterator

Allows the implementation of typed tree inspection using open recursion

type iterator = {
  1. attribute : iterator -> Typedtree.attribute -> unit;
  2. attributes : iterator -> Typedtree.attributes -> unit;
  3. binding_op : iterator -> Typedtree.binding_op -> unit;
  4. case : 'k. iterator -> 'k Typedtree.case -> unit;
  5. class_declaration : iterator -> Typedtree.class_declaration -> unit;
  6. class_description : iterator -> Typedtree.class_description -> unit;
  7. class_expr : iterator -> Typedtree.class_expr -> unit;
  8. class_field : iterator -> Typedtree.class_field -> unit;
  9. class_signature : iterator -> Typedtree.class_signature -> unit;
  10. class_structure : iterator -> Typedtree.class_structure -> unit;
  11. class_type : iterator -> Typedtree.class_type -> unit;
  12. class_type_declaration : iterator -> Typedtree.class_type_declaration -> unit;
  13. class_type_field : iterator -> Typedtree.class_type_field -> unit;
  14. env : iterator -> Env.t -> unit;
  15. expr : iterator -> Typedtree.expression -> unit;
  16. extension_constructor : iterator -> Typedtree.extension_constructor -> unit;
  17. location : iterator -> Location.t -> unit;
  18. module_binding : iterator -> Typedtree.module_binding -> unit;
  19. module_coercion : iterator -> Typedtree.module_coercion -> unit;
  20. module_declaration : iterator -> Typedtree.module_declaration -> unit;
  21. module_substitution : iterator -> Typedtree.module_substitution -> unit;
  22. module_expr : iterator -> Typedtree.module_expr -> unit;
  23. module_type : iterator -> Typedtree.module_type -> unit;
  24. module_type_declaration : iterator -> + Typedtree.module_type_declaration -> + unit;
  25. package_type : iterator -> Typedtree.package_type -> unit;
  26. pat : 'k. iterator -> 'k Typedtree.general_pattern -> unit;
  27. row_field : iterator -> Typedtree.row_field -> unit;
  28. object_field : iterator -> Typedtree.object_field -> unit;
  29. open_declaration : iterator -> Typedtree.open_declaration -> unit;
  30. open_description : iterator -> Typedtree.open_description -> unit;
  31. signature : iterator -> Typedtree.signature -> unit;
  32. signature_item : iterator -> Typedtree.signature_item -> unit;
  33. structure : iterator -> Typedtree.structure -> unit;
  34. structure_item : iterator -> Typedtree.structure_item -> unit;
  35. typ : iterator -> Typedtree.core_type -> unit;
  36. type_declaration : iterator -> Typedtree.type_declaration -> unit;
  37. type_declarations : iterator -> + (Asttypes.rec_flag * Typedtree.type_declaration list) -> + unit;
  38. type_extension : iterator -> Typedtree.type_extension -> unit;
  39. type_exception : iterator -> Typedtree.type_exception -> unit;
  40. type_kind : iterator -> Typedtree.type_kind -> unit;
  41. value_binding : iterator -> Typedtree.value_binding -> unit;
  42. value_bindings : iterator -> + (Asttypes.rec_flag * Typedtree.value_binding list) -> + unit;
  43. value_description : iterator -> Typedtree.value_description -> unit;
  44. with_constraint : iterator -> Typedtree.with_constraint -> unit;
}
val default_iterator : iterator
diff --git a/ocaml/Tast_mapper/index.html b/ocaml/Tast_mapper/index.html new file mode 100644 index 00000000..715b2f50 --- /dev/null +++ b/ocaml/Tast_mapper/index.html @@ -0,0 +1,50 @@ + +Tast_mapper (ocaml.Tast_mapper)

Module Tast_mapper

A generic Typedtree mapper

type mapper = {
  1. attribute : mapper -> Typedtree.attribute -> Typedtree.attribute;
  2. attributes : mapper -> Typedtree.attributes -> Typedtree.attributes;
  3. binding_op : mapper -> Typedtree.binding_op -> Typedtree.binding_op;
  4. case : 'k. mapper -> 'k Typedtree.case -> 'k Typedtree.case;
  5. class_declaration : mapper -> + Typedtree.class_declaration -> + Typedtree.class_declaration;
  6. class_description : mapper -> + Typedtree.class_description -> + Typedtree.class_description;
  7. class_expr : mapper -> Typedtree.class_expr -> Typedtree.class_expr;
  8. class_field : mapper -> Typedtree.class_field -> Typedtree.class_field;
  9. class_signature : mapper -> + Typedtree.class_signature -> + Typedtree.class_signature;
  10. class_structure : mapper -> + Typedtree.class_structure -> + Typedtree.class_structure;
  11. class_type : mapper -> Typedtree.class_type -> Typedtree.class_type;
  12. class_type_declaration : mapper -> + Typedtree.class_type_declaration -> + Typedtree.class_type_declaration;
  13. class_type_field : mapper -> + Typedtree.class_type_field -> + Typedtree.class_type_field;
  14. env : mapper -> Env.t -> Env.t;
  15. expr : mapper -> Typedtree.expression -> Typedtree.expression;
  16. extension_constructor : mapper -> + Typedtree.extension_constructor -> + Typedtree.extension_constructor;
  17. location : mapper -> Location.t -> Location.t;
  18. module_binding : mapper -> + Typedtree.module_binding -> + Typedtree.module_binding;
  19. module_coercion : mapper -> + Typedtree.module_coercion -> + Typedtree.module_coercion;
  20. module_declaration : mapper -> + Typedtree.module_declaration -> + Typedtree.module_declaration;
  21. module_substitution : mapper -> + Typedtree.module_substitution -> + Typedtree.module_substitution;
  22. module_expr : mapper -> Typedtree.module_expr -> Typedtree.module_expr;
  23. module_type : mapper -> Typedtree.module_type -> Typedtree.module_type;
  24. module_type_declaration : mapper -> + Typedtree.module_type_declaration -> + Typedtree.module_type_declaration;
  25. package_type : mapper -> Typedtree.package_type -> Typedtree.package_type;
  26. pat : 'k. mapper -> + 'k Typedtree.general_pattern -> + 'k Typedtree.general_pattern;
  27. row_field : mapper -> Typedtree.row_field -> Typedtree.row_field;
  28. object_field : mapper -> Typedtree.object_field -> Typedtree.object_field;
  29. open_declaration : mapper -> + Typedtree.open_declaration -> + Typedtree.open_declaration;
  30. open_description : mapper -> + Typedtree.open_description -> + Typedtree.open_description;
  31. signature : mapper -> Typedtree.signature -> Typedtree.signature;
  32. signature_item : mapper -> + Typedtree.signature_item -> + Typedtree.signature_item;
  33. structure : mapper -> Typedtree.structure -> Typedtree.structure;
  34. structure_item : mapper -> + Typedtree.structure_item -> + Typedtree.structure_item;
  35. typ : mapper -> Typedtree.core_type -> Typedtree.core_type;
  36. type_declaration : mapper -> + Typedtree.type_declaration -> + Typedtree.type_declaration;
  37. type_declarations : mapper -> + (Asttypes.rec_flag * Typedtree.type_declaration list) -> + Asttypes.rec_flag * Typedtree.type_declaration list;
  38. type_extension : mapper -> + Typedtree.type_extension -> + Typedtree.type_extension;
  39. type_exception : mapper -> + Typedtree.type_exception -> + Typedtree.type_exception;
  40. type_kind : mapper -> Typedtree.type_kind -> Typedtree.type_kind;
  41. value_binding : mapper -> Typedtree.value_binding -> Typedtree.value_binding;
  42. value_bindings : mapper -> + (Asttypes.rec_flag * Typedtree.value_binding list) -> + Asttypes.rec_flag * Typedtree.value_binding list;
  43. value_description : mapper -> + Typedtree.value_description -> + Typedtree.value_description;
  44. with_constraint : mapper -> + Typedtree.with_constraint -> + Typedtree.with_constraint;
}
val default : mapper
diff --git a/ocaml/Terminfo/index.html b/ocaml/Terminfo/index.html new file mode 100644 index 00000000..de93ab13 --- /dev/null +++ b/ocaml/Terminfo/index.html @@ -0,0 +1,2 @@ + +Terminfo (ocaml.Terminfo)

Module Terminfo

Basic interface to the terminfo database

Warning: this module is unstable and part of compiler-libs.

type status =
  1. | Uninitialised
  2. | Bad_term
  3. | Good_term
val setup : out_channel -> status
val num_lines : out_channel -> int
val backup : out_channel -> int -> unit
val standout : out_channel -> bool -> unit
val resume : out_channel -> int -> unit
diff --git a/ocaml/Thread/index.html b/ocaml/Thread/index.html new file mode 100644 index 00000000..da66d60d --- /dev/null +++ b/ocaml/Thread/index.html @@ -0,0 +1,7 @@ + +Thread (ocaml.Thread)

Module Thread

Lightweight threads for Posix 1003.1c and Win32.

type t

The type of thread handles.

Thread creation and termination

val create : ('a -> 'b) -> 'a -> t

Thread.create funct arg creates a new thread of control, in which the function application funct arg is executed concurrently with the other threads of the domain. The application of Thread.create returns the handle of the newly created thread. The new thread terminates when the application funct arg returns, either normally or by raising the Thread.Exit exception or by raising any other uncaught exception. In the last case, the uncaught exception is printed on standard error, but not propagated back to the parent thread. Similarly, the result of the application funct arg is discarded and not directly accessible to the parent thread.

See also Domain.spawn if you want parallel execution instead.

val self : unit -> t

Return the handle for the thread currently executing.

val id : t -> int

Return the identifier of the given thread. A thread identifier is an integer that identifies uniquely the thread. It can be used to build data structures indexed by threads.

exception Exit

Exception raised by user code to initiate termination of the current thread. In a thread created by Thread.create funct arg, if the Thread.Exit exception reaches the top of the application funct arg, it has the effect of terminating the current thread silently. In other contexts, there is no implicit handling of the Thread.Exit exception.

val exit : unit -> unit

Raise the Thread.Exit exception. In a thread created by Thread.create, this will cause the thread to terminate prematurely, unless the thread function handles the exception itself. Fun.protect finalizers and catch-all exception handlers will be executed.

To make it clear that an exception is raised and will trigger finalizers and catch-all exception handlers, it is recommended to write raise Thread.Exit instead of Thread.exit ().

  • before 5.0

    A different implementation was used, not based on raising an exception, and not running finalizers and catch-all handlers. The previous implementation had a different behavior when called outside of a thread created by Thread.create.

  • deprecated Use 'raise Thread.Exit' instead.

Suspending threads

val delay : float -> unit

delay d suspends the execution of the calling thread for d seconds. The other program threads continue to run during this time.

val join : t -> unit

join th suspends the execution of the calling thread until the thread th has terminated.

val yield : unit -> unit

Re-schedule the calling thread without suspending it. This function can be used to give scheduling hints, telling the scheduler that now is a good time to switch to other threads.

Waiting for file descriptors or processes

The functions below are leftovers from an earlier, VM-based threading system. The Unix module provides equivalent functionality, in a more general and more standard-conformant manner. It is recommended to use Unix functions directly.

val wait_timed_read : Unix.file_descr -> float -> bool

See Thread.wait_timed_write.

  • deprecated Use Unix.select instead.
val wait_timed_write : Unix.file_descr -> float -> bool

Suspend the execution of the calling thread until at least one character or EOF is available for reading (wait_timed_read) or one character can be written without blocking (wait_timed_write) on the given Unix file descriptor. Wait for at most the amount of time given as second argument (in seconds). Return true if the file descriptor is ready for input/output and false if the timeout expired. The same functionality can be achieved with Unix.select.

  • deprecated Use Unix.select instead.
val select : + Unix.file_descr list -> + Unix.file_descr list -> + Unix.file_descr list -> + float -> + Unix.file_descr list * Unix.file_descr list * Unix.file_descr list

Same function as Unix.select. Suspend the execution of the calling thread until input/output becomes possible on the given Unix file descriptors. The arguments and results have the same meaning as for Unix.select.

  • deprecated Use Unix.select instead.
val wait_pid : int -> int * Unix.process_status

Same function as Unix.waitpid. wait_pid p suspends the execution of the calling thread until the process specified by the process identifier p terminates. Returns the pid of the child caught and its termination status, as per Unix.wait.

  • deprecated Use Unix.waitpid instead.

Management of signals

Signal handling follows the POSIX thread model: signals generated by a thread are delivered to that thread; signals generated externally are delivered to one of the threads that does not block it. Each thread possesses a set of blocked signals, which can be modified using Thread.sigmask. This set is inherited at thread creation time. Per-thread signal masks are supported only by the system thread library under Unix, but not under Win32, nor by the VM thread library.

val sigmask : Unix.sigprocmask_command -> int list -> int list

sigmask cmd sigs changes the set of blocked signals for the calling thread. If cmd is SIG_SETMASK, blocked signals are set to those in the list sigs. If cmd is SIG_BLOCK, the signals in sigs are added to the set of blocked signals. If cmd is SIG_UNBLOCK, the signals in sigs are removed from the set of blocked signals. sigmask returns the set of previously blocked signals for the thread.

val wait_signal : int list -> int

wait_signal sigs suspends the execution of the calling thread until the process receives one of the signals specified in the list sigs. It then returns the number of the signal received. Signal handlers attached to the signals in sigs will not be invoked. The signals sigs are expected to be blocked before calling wait_signal.

Uncaught exceptions

val default_uncaught_exception_handler : exn -> unit

Thread.default_uncaught_exception_handler will print the thread's id, exception and backtrace (if available).

val set_uncaught_exception_handler : (exn -> unit) -> unit

Thread.set_uncaught_exception_handler fn registers fn as the handler for uncaught exceptions.

If the newly set uncaught exception handler raise an exception, default_uncaught_exception_handler will be called.

diff --git a/ocaml/Tmc/index.html b/ocaml/Tmc/index.html new file mode 100644 index 00000000..73418307 --- /dev/null +++ b/ocaml/Tmc/index.html @@ -0,0 +1,23 @@ + +Tmc (ocaml.Tmc)

Module Tmc

Tail-modulo-cons optimization.

Warning: this module is unstable and part of compiler-libs.

TMC (Tail Modulo Cons) is a code transformation that rewrites transformed functions in destination-passing-style, in such a way that certain calls that were not in tail position in the original program become tail-calls in the transformed program.

As a classic example, the following program | + let[@tail_mod_cons] rec map f = function + | [] -> [] + | x :: xs -> + let y = f x in + y :: map f xs + | becomes (expressed in almost-source-form; the translation is in fact at the Lambda-level) | + let rec map f = function + | [] -> [] + | x :: xs -> + let y = f x in + let dst = y :: Placeholder in + map_dps dst 1 f xs; dst + and map_dps dst offset f = function + | [] -> + dst.offset <- [] + | x :: xs -> + let y = f x in + let dst' = y :: Placeholder in + dst.offset <- dst'; + map_dps dst 1 f fx + |

In this example, the expression (y :: map f xs) had a call in non-tail-position, and it gets rewritten into tail-calls. TMC handles all such cases where the continuation of the call (what needs to be done after the return) is a "construction", the creation of a (possibly nested) data block.

The code transformation generates two versions of the input function, the "direct" version with the same type and behavior as the original one (here just map), and the "destination-passing-style" version (here map_dps).

Any call to the original function from outside the let..rec declaration gets transformed into a call into the direct version, which will itself call the destination-passing-style versions on recursive calls that may benefit from it (they are in tail-position modulo constructors).

Because of this inherent code duplication, the transformation may not always improve performance. In this implementation, TMC is opt-in, we only transform functions that the user has annotated with an attribute to request the transformation.

val rewrite : Lambda.lambda -> Lambda.lambda
diff --git a/ocaml/Topcommon/index.html b/ocaml/Topcommon/index.html new file mode 100644 index 00000000..b99395ed --- /dev/null +++ b/ocaml/Topcommon/index.html @@ -0,0 +1,5 @@ + +Topcommon (ocaml.Topcommon)

Module Topcommon

This module provides common implementations for internals of Toploop, for bytecode and native code (see Topeval for the diverging parts of the implementation).

You should not use it directly, refer to the functions in Toploop instead.

type evaluation_outcome =
  1. | Result of Stdlib.Obj.t
  2. | Exception of exn
val backtrace : string option ref
val parse_mod_use_file : + string -> + Stdlib.Lexing.lexbuf -> + Parsetree.toplevel_phrase list
val refill_lexbuf : bytes -> int -> int
diff --git a/ocaml/Topdirs/index.html b/ocaml/Topdirs/index.html new file mode 100644 index 00000000..5113532f --- /dev/null +++ b/ocaml/Topdirs/index.html @@ -0,0 +1,2 @@ + +Topdirs (ocaml.Topdirs)

Module Topdirs

val dir_quit : unit -> unit
val dir_directory : string -> unit
val dir_remove_directory : string -> unit
val dir_cd : string -> unit
val dir_load : Stdlib.Format.formatter -> string -> unit
val dir_use : Stdlib.Format.formatter -> string -> unit
val dir_use_output : Stdlib.Format.formatter -> string -> unit
val dir_install_printer : Stdlib.Format.formatter -> Longident.t -> unit
val dir_remove_printer : Stdlib.Format.formatter -> Longident.t -> unit
val section_general : string
val section_run : string
val section_env : string
val section_print : string
val section_trace : string
val section_options : string
val section_undocumented : string
val load_file : Stdlib.Format.formatter -> string -> bool
  • deprecated
diff --git a/ocaml/Topeval/index.html b/ocaml/Topeval/index.html new file mode 100644 index 00000000..8145e245 --- /dev/null +++ b/ocaml/Topeval/index.html @@ -0,0 +1,2 @@ + +Topeval (ocaml.Topeval)

Module Topeval

This module provides two alternative implementations for internals of Toploop, for bytecode and native code.

You should not use it directly, refer to the functions in Toploop instead.

diff --git a/ocaml/Tophooks/index.html b/ocaml/Tophooks/index.html new file mode 100644 index 00000000..8d2b019e --- /dev/null +++ b/ocaml/Tophooks/index.html @@ -0,0 +1,6 @@ + +Tophooks (ocaml.Tophooks)

Module Tophooks

type lookup_fn = string -> Stdlib.Obj.t option
val lookup : lookup_fn
val load : load_fn
val register_loader : lookup:lookup_fn -> load:load_fn -> unit
diff --git a/ocaml/Toploop/index.html b/ocaml/Toploop/index.html new file mode 100644 index 00000000..05fa89b6 --- /dev/null +++ b/ocaml/Toploop/index.html @@ -0,0 +1,48 @@ + +Toploop (ocaml.Toploop)

Module Toploop

type input =
  1. | Stdin
  2. | File of string
  3. | String of string
val getvalue : string -> Stdlib.Obj.t
val setvalue : string -> Stdlib.Obj.t -> unit
val filename_of_input : input -> string
val set_paths : ?auto_include:Load_path.auto_include_callback -> unit -> unit
val loop : Stdlib.Format.formatter -> unit
val run_script : Stdlib.Format.formatter -> input -> string array -> bool
type directive_fun =
  1. | Directive_none of unit -> unit
  2. | Directive_string of string -> unit
  3. | Directive_int of int -> unit
  4. | Directive_ident of Longident.t -> unit
  5. | Directive_bool of bool -> unit
type directive_info = {
  1. section : string;
  2. doc : string;
}
val add_directive : string -> directive_fun -> directive_info -> unit
val get_directive : string -> directive_fun option
val get_directive_info : string -> directive_info option
val all_directive_names : unit -> string list
val directive_table : (string, directive_fun) Stdlib.Hashtbl.t
  • deprecated
val directive_info_table : (string, directive_info) Stdlib.Hashtbl.t
  • deprecated
val toplevel_env : Env.t ref
val initialize_toplevel_env : unit -> unit
val print_exception_outcome : Stdlib.Format.formatter -> exn -> unit
val execute_phrase : + bool -> + Stdlib.Format.formatter -> + Parsetree.toplevel_phrase -> + bool
val use_input : Stdlib.Format.formatter -> input -> bool
val use_output : Stdlib.Format.formatter -> string -> bool
val use_silently : Stdlib.Format.formatter -> input -> bool
val mod_use_input : Stdlib.Format.formatter -> input -> bool
val use_file : Stdlib.Format.formatter -> string -> bool
val eval_module_path : Env.t -> Path.t -> Stdlib.Obj.t
val eval_value_path : Env.t -> Path.t -> Stdlib.Obj.t
val eval_extension_path : Env.t -> Path.t -> Stdlib.Obj.t
val eval_class_path : Env.t -> Path.t -> Stdlib.Obj.t
val record_backtrace : unit -> unit
val load_file : Stdlib.Format.formatter -> string -> bool
val print_value : + Env.t -> + Stdlib.Obj.t -> + Stdlib.Format.formatter -> + Types.type_expr -> + unit
val print_untyped_exception : Stdlib.Format.formatter -> Stdlib.Obj.t -> unit
type ('a, 'b) gen_printer =
  1. | Zero of 'b
  2. | Succ of 'a -> ('a, 'b) gen_printer
val install_printer : + Path.t -> + Types.type_expr -> + (Stdlib.Format.formatter -> Stdlib.Obj.t -> unit) -> + unit
val install_generic_printer : + Path.t -> + Path.t -> + (int -> + (int -> + Stdlib.Obj.t -> + Outcometree.out_value, + Stdlib.Obj.t -> + Outcometree.out_value) + gen_printer) -> + unit
val install_generic_printer' : + Path.t -> + Path.t -> + (Stdlib.Format.formatter -> + Stdlib.Obj.t -> + unit, + Stdlib.Format.formatter -> + Stdlib.Obj.t -> + unit) + gen_printer -> + unit
val remove_printer : Path.t -> unit
val max_printer_depth : int ref
val max_printer_steps : int ref
val parse_toplevel_phrase : + (Stdlib.Lexing.lexbuf -> Parsetree.toplevel_phrase) ref
val parse_use_file : + (Stdlib.Lexing.lexbuf -> Parsetree.toplevel_phrase list) ref
val print_location : Stdlib.Format.formatter -> Location.t -> unit
val print_error : Stdlib.Format.formatter -> Location.error -> unit
val print_warning : Location.t -> Stdlib.Format.formatter -> Warnings.t -> unit
val input_name : string ref
val print_out_value : + (Stdlib.Format.formatter -> Outcometree.out_value -> unit) ref
val print_out_type : + (Stdlib.Format.formatter -> Outcometree.out_type -> unit) ref
val print_out_class_type : + (Stdlib.Format.formatter -> Outcometree.out_class_type -> unit) ref
val print_out_module_type : + (Stdlib.Format.formatter -> Outcometree.out_module_type -> unit) ref
val print_out_type_extension : + (Stdlib.Format.formatter -> Outcometree.out_type_extension -> unit) ref
val print_out_sig_item : + (Stdlib.Format.formatter -> Outcometree.out_sig_item -> unit) ref
val print_out_signature : + (Stdlib.Format.formatter -> Outcometree.out_sig_item list -> unit) ref
val print_out_phrase : + (Stdlib.Format.formatter -> Outcometree.out_phrase -> unit) ref
val read_interactive_input : (string -> bytes -> int -> int * bool) ref
val toplevel_startup_hook : (unit -> unit) ref
type event = ..
type event +=
  1. | Startup
  2. | After_setup
val add_hook : (event -> unit) -> unit
val run_hooks : event -> unit
val may_trace : bool ref
val override_sys_argv : string array -> unit
diff --git a/ocaml/Topmain/index.html b/ocaml/Topmain/index.html new file mode 100644 index 00000000..7b04381b --- /dev/null +++ b/ocaml/Topmain/index.html @@ -0,0 +1,2 @@ + +Topmain (ocaml.Topmain)

Module Topmain

val main : unit -> int
diff --git a/ocaml/Topprinters/index.html b/ocaml/Topprinters/index.html new file mode 100644 index 00000000..f51a3da8 --- /dev/null +++ b/ocaml/Topprinters/index.html @@ -0,0 +1,2 @@ + +Topprinters (ocaml.Topprinters)

Module Topprinters

type printer_type = Types.type_expr -> Types.type_expr
val printer_type_new : printer_type
val printer_type_old : printer_type
diff --git a/ocaml/Topstart/index.html b/ocaml/Topstart/index.html new file mode 100644 index 00000000..4eb0487a --- /dev/null +++ b/ocaml/Topstart/index.html @@ -0,0 +1,2 @@ + +Topstart (ocaml.Topstart)

Module Topstart

diff --git a/ocaml/Trace/index.html b/ocaml/Trace/index.html new file mode 100644 index 00000000..2d842afb --- /dev/null +++ b/ocaml/Trace/index.html @@ -0,0 +1,10 @@ + +Trace (ocaml.Trace)

Module Trace

type codeptr
type traced_function = {
  1. path : Path.t;
  2. closure : Stdlib.Obj.t;
  3. actual_code : codeptr;
  4. instrumented_fun : codeptr -> Stdlib.Obj.t -> Stdlib.Obj.t -> Stdlib.Obj.t;
}
val traced_functions : traced_function list ref
val is_traced : Stdlib.Obj.t -> Path.t option
val get_code_pointer : Stdlib.Obj.t -> codeptr
val set_code_pointer : Stdlib.Obj.t -> codeptr -> unit
val instrument_closure : + Env.t -> + Longident.t -> + Stdlib.Format.formatter -> + Types.type_expr -> + codeptr -> + Stdlib.Obj.t -> + Stdlib.Obj.t -> + Stdlib.Obj.t
val print_trace : Stdlib.Obj.t -> Stdlib.Obj.t -> Stdlib.Obj.t
diff --git a/ocaml/Translattribute/index.html b/ocaml/Translattribute/index.html new file mode 100644 index 00000000..f43acd38 --- /dev/null +++ b/ocaml/Translattribute/index.html @@ -0,0 +1,31 @@ + +Translattribute (ocaml.Translattribute)

Module Translattribute

val check_attribute : Typedtree.expression -> Parsetree.attribute -> unit
val check_attribute_on_module : + Typedtree.module_expr -> + Parsetree.attribute -> + unit
val add_inline_attribute : + Lambda.lambda -> + Location.t -> + Parsetree.attributes -> + Lambda.lambda
val get_inline_attribute : Parsetree.attributes -> Lambda.inline_attribute
val add_specialise_attribute : + Lambda.lambda -> + Location.t -> + Parsetree.attributes -> + Lambda.lambda
val get_specialise_attribute : + Parsetree.attributes -> + Lambda.specialise_attribute
val add_local_attribute : + Lambda.lambda -> + Location.t -> + Parsetree.attributes -> + Lambda.lambda
val get_local_attribute : Parsetree.attributes -> Lambda.local_attribute
val get_and_remove_inlined_attribute : + Typedtree.expression -> + Lambda.inline_attribute * Typedtree.expression
val get_and_remove_inlined_attribute_on_module : + Typedtree.module_expr -> + Lambda.inline_attribute * Typedtree.module_expr
val get_and_remove_specialised_attribute : + Typedtree.expression -> + Lambda.specialise_attribute * Typedtree.expression
val add_function_attributes : + Lambda.lambda -> + Location.t -> + Parsetree.attributes -> + Lambda.lambda
diff --git a/ocaml/Translclass/index.html b/ocaml/Translclass/index.html new file mode 100644 index 00000000..96c2344d --- /dev/null +++ b/ocaml/Translclass/index.html @@ -0,0 +1,9 @@ + +Translclass (ocaml.Translclass)

Module Translclass

val transl_class : + scopes:Debuginfo.Scoped_location.scopes -> + Ident.t list -> + Ident.t -> + string list -> + Typedtree.class_expr -> + Asttypes.virtual_flag -> + Lambda.lambda
type error =
  1. | Tags of string * string
exception Error of Location.t * error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Translcore/index.html b/ocaml/Translcore/index.html new file mode 100644 index 00000000..54667088 --- /dev/null +++ b/ocaml/Translcore/index.html @@ -0,0 +1,39 @@ + +Translcore (ocaml.Translcore)

Module Translcore

val transl_let : + scopes:Debuginfo.Scoped_location.scopes -> + ?in_structure:bool -> + Asttypes.rec_flag -> + Typedtree.value_binding list -> + Lambda.lambda -> + Lambda.lambda
val transl_extension_constructor : + scopes:Debuginfo.Scoped_location.scopes -> + Env.t -> + Path.t option -> + Typedtree.extension_constructor -> + Lambda.lambda
val transl_scoped_exp : + scopes:Debuginfo.Scoped_location.scopes -> + Typedtree.expression -> + Lambda.lambda
type error =
  1. | Free_super_var
  2. | Unreachable_reached
exception Error of Location.t * error
val report_error : Stdlib.Format.formatter -> error -> unit
val transl_object : + (scopes:Debuginfo.Scoped_location.scopes -> + Ident.t -> + string list -> + Typedtree.class_expr -> + Lambda.lambda) + ref
diff --git a/ocaml/Translmod/index.html b/ocaml/Translmod/index.html new file mode 100644 index 00000000..581073b6 --- /dev/null +++ b/ocaml/Translmod/index.html @@ -0,0 +1,22 @@ + +Translmod (ocaml.Translmod)

Module Translmod

val transl_implementation : + string -> + (Typedtree.structure * Typedtree.module_coercion) -> + Lambda.program
val transl_store_phrases : string -> Typedtree.structure -> int * Lambda.lambda
val transl_store_implementation : + string -> + (Typedtree.structure * Typedtree.module_coercion) -> + Lambda.program
val transl_implementation_flambda : + string -> + (Typedtree.structure * Typedtree.module_coercion) -> + Lambda.program
val transl_toplevel_definition : Typedtree.structure -> Lambda.lambda
val transl_package : + Ident.t option list -> + Ident.t -> + Typedtree.module_coercion -> + Lambda.lambda
val transl_store_package : + Ident.t option list -> + Ident.t -> + Typedtree.module_coercion -> + int * Lambda.lambda
val transl_package_flambda : + Ident.t option list -> + Typedtree.module_coercion -> + int * Lambda.lambda
val toplevel_name : Ident.t -> string
val nat_toplevel_name : Ident.t -> Ident.t * int
val primitive_declarations : Primitive.description list ref
type unsafe_component =
  1. | Unsafe_module_binding
  2. | Unsafe_functor
  3. | Unsafe_non_function
  4. | Unsafe_typext
type unsafe_info =
  1. | Unsafe of {
    1. reason : unsafe_component;
    2. loc : Location.t;
    3. subid : Ident.t;
    }
  2. | Unnamed
type error =
  1. | Circular_dependency of (Ident.t * unsafe_info) list
  2. | Conflicting_inline_attributes
exception Error of Location.t * error
val report_error : Location.t -> error -> Location.error
val reset : unit -> unit
diff --git a/ocaml/Translobj/index.html b/ocaml/Translobj/index.html new file mode 100644 index 00000000..64c1d72c --- /dev/null +++ b/ocaml/Translobj/index.html @@ -0,0 +1,7 @@ + +Translobj (ocaml.Translobj)

Module Translobj

val oo_prim : string -> Lambda.lambda
val meth : Lambda.lambda -> string -> Lambda.lambda * Lambda.lambda list
val reset_labels : unit -> unit
val transl_label_init : (unit -> Lambda.lambda * 'a) -> Lambda.lambda * 'a
val transl_store_label_init : + Ident.t -> + int -> + ('a -> Lambda.lambda) -> + 'a -> + int * Lambda.lambda
val method_ids : Ident.Set.t ref
val oo_wrap : Env.t -> bool -> ('a -> Lambda.lambda) -> 'a -> Lambda.lambda
val oo_add_class : Ident.t -> Env.t * bool
val reset : unit -> unit
diff --git a/ocaml/Translprim/index.html b/ocaml/Translprim/index.html new file mode 100644 index 00000000..14672b8e --- /dev/null +++ b/ocaml/Translprim/index.html @@ -0,0 +1,25 @@ + +Translprim (ocaml.Translprim)

Module Translprim

val add_exception_ident : Ident.t -> unit
val remove_exception_ident : Ident.t -> unit
val clear_used_primitives : unit -> unit
val get_used_primitives : unit -> Path.t list
val check_primitive_arity : Location.t -> Primitive.description -> unit
val transl_primitive : + Lambda.scoped_location -> + Primitive.description -> + Env.t -> + Types.type_expr -> + Path.t option -> + Lambda.lambda
val transl_primitive_application : + Lambda.scoped_location -> + Primitive.description -> + Env.t -> + Types.type_expr -> + Path.t -> + Typedtree.expression option -> + Lambda.lambda list -> + Typedtree.expression list -> + Lambda.lambda
type error =
  1. | Unknown_builtin_primitive of string
  2. | Wrong_arity_builtin_primitive of string
exception Error of Location.t * error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Traverse_for_exported_symbols/index.html b/ocaml/Traverse_for_exported_symbols/index.html new file mode 100644 index 00000000..cf98be42 --- /dev/null +++ b/ocaml/Traverse_for_exported_symbols/index.html @@ -0,0 +1,10 @@ + +Traverse_for_exported_symbols (ocaml.Traverse_for_exported_symbols)

Module Traverse_for_exported_symbols

type symbols_to_export = {
  1. symbols : Symbol.Set.t;
  2. export_ids : Export_id.Set.t;
  3. set_of_closure_ids : Set_of_closures_id.Set.t;
  4. set_of_closure_ids_keep_declaration : Set_of_closures_id.Set.t;
  5. relevant_imported_closure_ids : Closure_id.Set.t;
  6. relevant_local_closure_ids : Closure_id.Set.t;
  7. relevant_imported_vars_within_closure : Var_within_closure.Set.t;
  8. relevant_local_vars_within_closure : Var_within_closure.Set.t;
}
val traverse : + sets_of_closures_map:Flambda.set_of_closures Set_of_closures_id.Map.t -> + closure_id_to_set_of_closures_id:Set_of_closures_id.t Closure_id.Map.t -> + function_declarations_map: + Simple_value_approx.function_declarations Set_of_closures_id.Map.t -> + values:Export_info.descr Export_id.Map.t -> + symbol_id:Export_id.t Symbol.Map.t -> + root_symbol:Symbol.t -> + symbols_to_export

Computes the transitive closure in Symbol.t, Closure_id.t and Set_of_closures_id.t and determines which ones of those should be exported (i.e: included in the cmx files). *

diff --git a/ocaml/Type_immediacy/Violation/index.html b/ocaml/Type_immediacy/Violation/index.html new file mode 100644 index 00000000..de853f75 --- /dev/null +++ b/ocaml/Type_immediacy/Violation/index.html @@ -0,0 +1,2 @@ + +Violation (ocaml.Type_immediacy.Violation)

Module Type_immediacy.Violation

type t =
  1. | Not_always_immediate
  2. | Not_always_immediate_on_64bits
diff --git a/ocaml/Type_immediacy/index.html b/ocaml/Type_immediacy/index.html new file mode 100644 index 00000000..2649e833 --- /dev/null +++ b/ocaml/Type_immediacy/index.html @@ -0,0 +1,2 @@ + +Type_immediacy (ocaml.Type_immediacy)

Module Type_immediacy

Immediacy status of a type

type t =
  1. | Unknown
    (*

    We don't know anything

    *)
  2. | Always
    (*

    We know for sure that values of this type are always immediate

    *)
  3. | Always_on_64bits
    (*

    We know for sure that values of this type are always immediate on 64 bit platforms. For other platforms, we know nothing.

    *)
module Violation : sig ... end
val coerce : t -> as_:t -> (unit, Violation.t) result

coerce t ~as_ returns Ok () iff t can be seen as type immediacy as_. For instance, Always can be seen as Always_on_64bits but the opposite is not true. Return Error _ if the coercion is not possible.

val of_attributes : Parsetree.attributes -> t

Return the immediateness of a type as indicated by the user via attributes

diff --git a/ocaml/Typeclass/index.html b/ocaml/Typeclass/index.html new file mode 100644 index 00000000..100014f1 --- /dev/null +++ b/ocaml/Typeclass/index.html @@ -0,0 +1,25 @@ + +Typeclass (ocaml.Typeclass)

Module Typeclass

type 'a class_info = {
  1. cls_id : Ident.t;
  2. cls_id_loc : string Asttypes.loc;
  3. cls_decl : Types.class_declaration;
  4. cls_ty_id : Ident.t;
  5. cls_ty_decl : Types.class_type_declaration;
  6. cls_obj_id : Ident.t;
  7. cls_obj_abbr : Types.type_declaration;
  8. cls_abbr : Types.type_declaration;
  9. cls_arity : int;
  10. cls_pub_methods : string list;
  11. cls_info : 'a;
}
type class_type_info = {
  1. clsty_ty_id : Ident.t;
  2. clsty_id_loc : string Asttypes.loc;
  3. clsty_ty_decl : Types.class_type_declaration;
  4. clsty_obj_id : Ident.t;
  5. clsty_obj_abbr : Types.type_declaration;
  6. clsty_abbr : Types.type_declaration;
  7. clsty_info : Typedtree.class_type_declaration;
}
val class_declarations : + Env.t -> + Parsetree.class_declaration list -> + Typedtree.class_declaration class_info list * Env.t
val class_descriptions : + Env.t -> + Parsetree.class_description list -> + Typedtree.class_description class_info list * Env.t
val class_type_declarations : + Env.t -> + Parsetree.class_description list -> + class_type_info list * Env.t
val approx_class_declarations : + Env.t -> + Parsetree.class_description list -> + class_type_info list * Env.t
type kind =
  1. | Object
  2. | Class
  3. | Class_type
type error =
  1. | Unconsistent_constraint of Errortrace.unification_error
  2. | Field_type_mismatch of string * string * Errortrace.unification_error
  3. | Unexpected_field of Types.type_expr * string
  4. | Structure_expected of Types.class_type
  5. | Cannot_apply of Types.class_type
  6. | Apply_wrong_label of Asttypes.arg_label
  7. | Pattern_type_clash of Types.type_expr
  8. | Repeated_parameter
  9. | Unbound_class_2 of Longident.t
  10. | Unbound_class_type_2 of Longident.t
  11. | Abbrev_type_clash of Types.type_expr * Types.type_expr * Types.type_expr
  12. | Constructor_type_mismatch of string * Errortrace.unification_error
  13. | Virtual_class of kind * string list * string list
  14. | Undeclared_methods of kind * string list
  15. | Parameter_arity_mismatch of Longident.t * int * int
  16. | Parameter_mismatch of Errortrace.unification_error
  17. | Bad_parameters of Ident.t * Types.type_expr list * Types.type_expr list
  18. | Bad_class_type_parameters of Ident.t + * Types.type_expr list + * Types.type_expr list
  19. | Class_match_failure of Ctype.class_match_failure list
  20. | Unbound_val of string
  21. | Unbound_type_var of Stdlib.Format.formatter -> + unit + * Ctype.closed_class_failure
  22. | Non_generalizable_class of {
    1. id : Ident.t;
    2. clty : Types.class_declaration;
    3. nongen_vars : Types.type_expr list;
    }
  23. | Cannot_coerce_self of Types.type_expr
  24. | Non_collapsable_conjunction of Ident.t + * Types.class_declaration + * Errortrace.unification_error
  25. | Self_clash of Errortrace.unification_error
  26. | Mutability_mismatch of string * Asttypes.mutable_flag
  27. | No_overriding of string * string
  28. | Duplicate of string * string
  29. | Closing_self_type of Types.class_signature
exception Error of Location.t * Env.t * error
exception Error_forward of Location.error
val report_error : Env.t -> Stdlib.Format.formatter -> error -> unit
val type_open_descr : + (?used_slot:bool ref -> + Env.t -> + Parsetree.open_description -> + Typedtree.open_description * Env.t) + ref
diff --git a/ocaml/Typecore/Datatype_kind/index.html b/ocaml/Typecore/Datatype_kind/index.html new file mode 100644 index 00000000..926918bd --- /dev/null +++ b/ocaml/Typecore/Datatype_kind/index.html @@ -0,0 +1,2 @@ + +Datatype_kind (ocaml.Typecore.Datatype_kind)

Module Typecore.Datatype_kind

type t =
  1. | Record
  2. | Variant
val type_name : t -> string
val label_name : t -> string
diff --git a/ocaml/Typecore/index.html b/ocaml/Typecore/index.html new file mode 100644 index 00000000..304f8c66 --- /dev/null +++ b/ocaml/Typecore/index.html @@ -0,0 +1,83 @@ + +Typecore (ocaml.Typecore)

Module Typecore

type type_forcing_context =
  1. | If_conditional
  2. | If_no_else_branch
  3. | While_loop_conditional
  4. | While_loop_body
  5. | For_loop_start_index
  6. | For_loop_stop_index
  7. | For_loop_body
  8. | Assert_condition
  9. | Sequence_left_hand_side
  10. | When_guard
type type_expected = private {
  1. ty : Types.type_expr;
  2. explanation : type_forcing_context option;
}
type pattern_variable = {
  1. pv_id : Ident.t;
  2. pv_type : Types.type_expr;
  3. pv_loc : Location.t;
  4. pv_as_var : bool;
  5. pv_attributes : Typedtree.attributes;
}
val mk_expected : + ?explanation:type_forcing_context -> + Types.type_expr -> + type_expected
val is_nonexpansive : Typedtree.expression -> bool
module Datatype_kind : sig ... end
type wrong_name = {
  1. type_path : Path.t;
  2. kind : Datatype_kind.t;
  3. name : string Asttypes.loc;
  4. valid_names : string list;
}
type wrong_kind_context =
  1. | Pattern
  2. | Expression of type_forcing_context option
type wrong_kind_sort =
  1. | Constructor
  2. | Record
  3. | Boolean
  4. | List
  5. | Unit
type existential_restriction =
  1. | At_toplevel
    (*

    no existential types at the toplevel

    *)
  2. | In_group
    (*

    nor with let ... and ...

    *)
  3. | In_rec
    (*

    or recursive definition

    *)
  4. | With_attributes
    (*

    or let[@any_attribute] = ...

    *)
  5. | In_class_args
    (*

    or in class arguments class c (...) = ...

    *)
  6. | In_class_def
    (*

    or in class c = let ... in ...

    *)
  7. | In_self_pattern
    (*

    or in self pattern

    *)
type module_patterns_restriction =
  1. | Modules_allowed of {
    1. scope : int;
    }
  2. | Modules_rejected
val type_binding : + Env.t -> + Asttypes.rec_flag -> + Parsetree.value_binding list -> + Typedtree.value_binding list * Env.t
val type_expression : Env.t -> Parsetree.expression -> Typedtree.expression
val type_class_arg_pattern : + string -> + Env.t -> + Env.t -> + Asttypes.arg_label -> + Parsetree.pattern -> + Typedtree.pattern + * (Ident.t * Ident.t * Types.type_expr) list + * Env.t + * Env.t
val type_self_pattern : + Env.t -> + Parsetree.pattern -> + Typedtree.pattern * pattern_variable list
val check_partial : + ?lev:int -> + module_patterns_restriction -> + Env.t -> + Types.type_expr -> + Location.t -> + Typedtree.value Typedtree.case list -> + Typedtree.partial
val type_expect : + ?in_function:(Location.t * Types.type_expr) -> + Env.t -> + Parsetree.expression -> + type_expected -> + Typedtree.expression
val option_none : + Env.t -> + Types.type_expr -> + Location.t -> + Typedtree.expression
val extract_option_type : Env.t -> Types.type_expr -> Types.type_expr
val generalizable : int -> Types.type_expr -> bool
val generalize_structure_exp : Typedtree.expression -> unit
val reset_delayed_checks : unit -> unit
val force_delayed_checks : unit -> unit
val name_pattern : string -> Typedtree.pattern list -> Ident.t
val name_cases : string -> Typedtree.value Typedtree.case list -> Ident.t
val self_coercion : (Path.t * Location.t list ref) list ref
type error =
  1. | Constructor_arity_mismatch of Longident.t * int * int
  2. | Label_mismatch of Longident.t * Errortrace.unification_error
  3. | Pattern_type_clash : Errortrace.unification_error + * Parsetree.pattern_desc option -> error
  4. | Or_pattern_type_clash of Ident.t * Errortrace.unification_error
  5. | Multiply_bound_variable of string
  6. | Orpat_vars of Ident.t * Ident.t list
  7. | Expr_type_clash of Errortrace.unification_error + * type_forcing_context option + * Parsetree.expression_desc option
  8. | Apply_non_function of {
    1. funct : Typedtree.expression;
    2. func_ty : Types.type_expr;
    3. res_ty : Types.type_expr;
    4. previous_arg_loc : Location.t;
    5. extra_arg_loc : Location.t;
    }
  9. | Apply_wrong_label of Asttypes.arg_label * Types.type_expr * bool
  10. | Label_multiply_defined of string
  11. | Label_missing of Ident.t list
  12. | Label_not_mutable of Longident.t
  13. | Wrong_name of string * type_expected * wrong_name
  14. | Name_type_mismatch of Datatype_kind.t + * Longident.t + * Path.t * Path.t + * (Path.t * Path.t) list
  15. | Invalid_format of string
  16. | Not_an_object of Types.type_expr * type_forcing_context option
  17. | Undefined_method of Types.type_expr * string * string list option
  18. | Undefined_self_method of string * string list
  19. | Virtual_class of Longident.t
  20. | Private_type of Types.type_expr
  21. | Private_label of Longident.t * Types.type_expr
  22. | Private_constructor of Types.constructor_description * Types.type_expr
  23. | Unbound_instance_variable of string * string list
  24. | Instance_variable_not_mutable of string
  25. | Not_subtype of Errortrace.Subtype.error
  26. | Outside_class
  27. | Value_multiply_overridden of string
  28. | Coercion_failure of Errortrace.expanded_type + * Errortrace.unification_error + * bool
  29. | Not_a_function of Types.type_expr * type_forcing_context option
  30. | Too_many_arguments of Types.type_expr * type_forcing_context option
  31. | Abstract_wrong_label of {
    1. got : Asttypes.arg_label;
    2. expected : Asttypes.arg_label;
    3. expected_type : Types.type_expr;
    4. explanation : type_forcing_context option;
    }
  32. | Scoping_let_module of string * Types.type_expr
  33. | Not_a_polymorphic_variant_type of Longident.t
  34. | Incoherent_label_order
  35. | Less_general of string * Errortrace.unification_error
  36. | Modules_not_allowed
  37. | Cannot_infer_signature
  38. | Not_a_packed_module of Types.type_expr
  39. | Unexpected_existential of existential_restriction * string * string list
  40. | Invalid_interval
  41. | Invalid_for_loop_index
  42. | No_value_clauses
  43. | Exception_pattern_disallowed
  44. | Mixed_value_and_exception_patterns_under_guard
  45. | Inlined_record_escape
  46. | Inlined_record_expected
  47. | Unrefuted_pattern of Typedtree.pattern
  48. | Invalid_extension_constructor_payload
  49. | Not_an_extension_constructor
  50. | Literal_overflow of string
  51. | Unknown_literal of string * char
  52. | Illegal_letrec_pat
  53. | Illegal_letrec_expr
  54. | Illegal_class_expr
  55. | Letop_type_clash of string * Errortrace.unification_error
  56. | Andop_type_clash of string * Errortrace.unification_error
  57. | Bindings_type_clash of Errortrace.unification_error
  58. | Unbound_existential of Ident.t list * Types.type_expr
  59. | Missing_type_constraint
  60. | Wrong_expected_kind of wrong_kind_sort * wrong_kind_context * Types.type_expr
  61. | Expr_not_a_record_type of Types.type_expr
exception Error of Location.t * Env.t * error
exception Error_forward of Location.error
val report_error : loc:Location.t -> Env.t -> error -> Location.error
val type_open : + (?used_slot:bool ref -> + Asttypes.override_flag -> + Env.t -> + Location.t -> + Longident.t Asttypes.loc -> + Path.t * Env.t) + ref
val type_open_decl : + (?used_slot:bool ref -> + Env.t -> + Parsetree.open_declaration -> + Typedtree.open_declaration * Types.signature * Env.t) + ref
val type_object : + (Env.t -> + Location.t -> + Parsetree.class_structure -> + Typedtree.class_structure * string list) + ref
val type_package : + (Env.t -> + Parsetree.module_expr -> + Path.t -> + (Longident.t * Types.type_expr) list -> + Typedtree.module_expr * (Longident.t * Types.type_expr) list) + ref
val check_recursive_bindings : Env.t -> Typedtree.value_binding list -> unit
val check_recursive_class_bindings : + Env.t -> + Ident.t list -> + Typedtree.class_expr list -> + unit
diff --git a/ocaml/Typedecl/index.html b/ocaml/Typedecl/index.html new file mode 100644 index 00000000..5d26cea3 --- /dev/null +++ b/ocaml/Typedecl/index.html @@ -0,0 +1,43 @@ + +Typedecl (ocaml.Typedecl)

Module Typedecl

val transl_type_decl : + Env.t -> + Asttypes.rec_flag -> + Parsetree.type_declaration list -> + Typedtree.type_declaration list * Env.t
val transl_type_exception : + Env.t -> + Parsetree.type_exception -> + Typedtree.type_exception * Env.t
val transl_type_extension : + bool -> + Env.t -> + Location.t -> + Parsetree.type_extension -> + Typedtree.type_extension * Env.t
val transl_with_constraint : + Ident.t -> + ?fixed_row_path:Path.t -> + sig_env:Env.t -> + sig_decl:Types.type_declaration -> + outer_env:Env.t -> + Parsetree.type_declaration -> + Typedtree.type_declaration
val abstract_type_decl : injective:bool -> int -> Types.type_declaration
val approx_type_decl : + Parsetree.type_declaration list -> + (Ident.t * Types.type_declaration) list
val check_recmod_typedecl : + Env.t -> + Location.t -> + Ident.t list -> + Path.t -> + Types.type_declaration -> + unit
val check_coherence : + Env.t -> + Location.t -> + Path.t -> + Types.type_declaration -> + unit
val is_fixed_type : Parsetree.type_declaration -> bool
type native_repr_kind =
  1. | Unboxed
  2. | Untagged
type reaching_type_path = reaching_type_step list
and reaching_type_step =
  1. | Expands_to of Types.type_expr * Types.type_expr
  2. | Contains of Types.type_expr * Types.type_expr
type error =
  1. | Repeated_parameter
  2. | Duplicate_constructor of string
  3. | Too_many_constructors
  4. | Duplicate_label of string
  5. | Recursive_abbrev of string * Env.t * reaching_type_path
  6. | Cycle_in_def of string * Env.t * reaching_type_path
  7. | Definition_mismatch of Types.type_expr + * Env.t + * Includecore.type_mismatch option
  8. | Constraint_failed of Env.t * Errortrace.unification_error
  9. | Inconsistent_constraint of Env.t * Errortrace.unification_error
  10. | Type_clash of Env.t * Errortrace.unification_error
  11. | Non_regular of {
    1. definition : Path.t;
    2. used_as : Types.type_expr;
    3. defined_as : Types.type_expr;
    4. reaching_path : reaching_type_path;
    }
  12. | Null_arity_external
  13. | Missing_native_external
  14. | Unbound_type_var of Types.type_expr * Types.type_declaration
  15. | Cannot_extend_private_type of Path.t
  16. | Not_extensible_type of Path.t
  17. | Extension_mismatch of Path.t * Env.t * Includecore.type_mismatch
  18. | Rebind_wrong_type of Longident.t * Env.t * Errortrace.unification_error
  19. | Rebind_mismatch of Longident.t * Path.t * Path.t
  20. | Rebind_private of Longident.t
  21. | Variance of Typedecl_variance.error
  22. | Unavailable_type_constructor of Path.t
  23. | Unbound_type_var_ext of Types.type_expr * Types.extension_constructor
  24. | Val_in_structure
  25. | Multiple_native_repr_attributes
  26. | Cannot_unbox_or_untag_type of native_repr_kind
  27. | Deep_unbox_or_untag_attribute of native_repr_kind
  28. | Immediacy of Typedecl_immediacy.error
  29. | Separability of Typedecl_separability.error
  30. | Bad_unboxed_attribute of string
  31. | Boxed_and_unboxed
  32. | Nonrec_gadt
  33. | Invalid_private_row_declaration of Types.type_expr
exception Error of Location.t * error
val report_error : Stdlib.Format.formatter -> error -> unit
diff --git a/ocaml/Typedecl_immediacy/index.html b/ocaml/Typedecl_immediacy/index.html new file mode 100644 index 00000000..70f56ba8 --- /dev/null +++ b/ocaml/Typedecl_immediacy/index.html @@ -0,0 +1,5 @@ + +Typedecl_immediacy (ocaml.Typedecl_immediacy)

Module Typedecl_immediacy

type error =
  1. | Bad_immediacy_attribute of Type_immediacy.Violation.t
exception Error of Location.t * error
val update_decls : + Env.t -> + (Ident.t * Typedecl_properties.decl) list -> + (Ident.t * Typedecl_properties.decl) list
diff --git a/ocaml/Typedecl_properties/index.html b/ocaml/Typedecl_properties/index.html new file mode 100644 index 00000000..1c68ce17 --- /dev/null +++ b/ocaml/Typedecl_properties/index.html @@ -0,0 +1,11 @@ + +Typedecl_properties (ocaml.Typedecl_properties)

Module Typedecl_properties

An abstract interface for properties of type definitions, such as variance and immediacy, that are computed by a fixpoint on mutually-recursive type declarations. This interface contains all the operations needed to initialize and run the fixpoint computation, and then (optionally) check that the result is consistent with the declaration or user expectations.

type ('prop, 'req) property = {
  1. eq : 'prop -> 'prop -> bool;
  2. merge : prop:'prop -> new_prop:'prop -> 'prop;
  3. default : decl -> 'prop;
  4. compute : Env.t -> decl -> 'req -> 'prop;
  5. update_decl : decl -> 'prop -> decl;
  6. check : Env.t -> Ident.t -> decl -> 'req -> unit;
}

'prop represents the type of property values (Types.Variance.t, just 'bool' for immediacy, etc).

'req represents the property value required by the author of the declaration, if they gave an expectation: type +'a t = ....

Some properties have no natural notion of user requirement, or their requirement is global, or already stored in type_declaration; they can just use unit as 'req parameter.

val compute_property : + ('prop, 'req) property -> + Env.t -> + (Ident.t * decl) list -> + 'req list -> + (Ident.t * decl) list

compute_property prop env decls req performs a fixpoint computation to determine the final values of a property on a set of mutually-recursive type declarations. The req argument must be a list of the same size as decls, providing the user requirement for each declaration.

val compute_property_noreq : + ('prop, unit) property -> + Env.t -> + (Ident.t * decl) list -> + (Ident.t * decl) list
diff --git a/ocaml/Typedecl_separability/index.html b/ocaml/Typedecl_separability/index.html new file mode 100644 index 00000000..d2b6d731 --- /dev/null +++ b/ocaml/Typedecl_separability/index.html @@ -0,0 +1,7 @@ + +Typedecl_separability (ocaml.Typedecl_separability)

Module Typedecl_separability

The OCaml runtime assumes for type-directed optimizations that all types are "separable". A type is "separable" if either all its inhabitants (the values of this type) are floating-point numbers, or none of them are.

(Note: This assumption is required for the dynamic float array optimization; it is only made if Config.flat_float_array is set, otherwise the code in this module becomes trivial -- see compute_decl.)

This soundness requirement could be broken by type declarations mixing existentials and the "@@unboxed" annotation. Consider the declaration

type any = Any : 'a -> any [@@unboxed]

which corresponds to the existential type "exists a. a". If this type is allowed to be unboxed, then it is inhabited by both float values and non-float values. On the contrary, if unboxing is disallowed, the inhabitants are all blocks with the Any constructors pointing to its parameter: they may point to a float, but they are not floats.

The present module contains a static analysis ensuring that declarations annotated with "@@unboxed" can be safely unboxed. The idea is to check the "separability" (in the above sense) of the argument type that would be unboxed, and reject the unboxed declaration if it would create a non-separable type.

Checking mutually-recursive type declarations is a bit subtle. Consider, for example, the following declarations.

type foo = Foo : 'a t -> foo   [@@unboxed]
+and 'a t = ...

Deciding whether the type foo should be accepted requires inspecting the declaration of 'a t, which may itself refer to foo in turn. In general, the analysis performs a fixpoint computation. It is somewhat similar to what is done for inferring the variance of type parameters.

Our analysis is defined using inference rules for our judgment Def; Gamma |- t : m, in which a type expression t is checked against a "mode" m. This "mode" describes the separability requirement on the type expression (see below for more details). The mode Gamma maps type variables to modes and Def records the "mode signature" of the mutually-recursive type declarations that are being checked.

The "mode signature" of a type with parameters ('a, 'b) t is of the form ('a : m1, 'b : m2) t, where m1 and m2 are modes. Its meaning is the following: a concrete instance (foo, bar) t of the type is separable if foo has mode m1 and bar has mode m2.

type error =
  1. | Non_separable_evar of string option
exception Error of Location.t * error

Exception raised when a type declaration is not separable, or when its separability cannot be established.

type mode = Types.Separability.t =
  1. | Ind
  2. | Sep
  3. | Deepsep
    (*

    The mode Sep ("separable") characterizes types that are indeed separable: either they only contain floating-point values, or none of the values at this type are floating-point values. On a type parameter, it indicates that this parameter must be separable for the whole type definition to be separable. For example, the mode signature for the type declaration type 'a + t = 'a is ('a : Sep) t. For the right-hand side to be separable, the parameter 'a must be separable.

    The mode Ind ("indifferent") characterizes any type -- separable or not. On a type parameter, it indicates that this parameter needs not be separable for the whole type definition to be separable. For example, type 'a t = 'a * bool does not require its parameter 'a to be separable as 'a * bool can never contain float values. Its mode signature is thus ('a : Ind) t.

    Finally, the mode Deepsep ("deeply separable") characterizes types that are separable, and whose type sub-expressions are also separable. This advanced feature is only used in the presence of constraints. For example, type 'a t = 'b constraint 'a = 'b * bool may not be separable even if 'a is (its separately depends on 'b, a fragment of 'a), so its mode signature is ('a : Deepsep) t.

    The different modes are ordered as Ind < Sep < Deepsep (from the least demanding to the most demanding).

    *)
val compute_decl : Env.t -> Types.type_declaration -> mode list

compute_decl env def returns the signature required for the type definition def in the typing environment env -- including signatures for the current recursive block.

The Error exception is raised if no such signature exists -- the definition will always be invalid. This only happens when the definition is marked to be unboxed.

Variant (or record) declarations that are not marked with the "@@unboxed" annotation, including those that contain several variants (or labels), are always separable. In particular, their mode signatures do not require anything of their type parameters, which are marked Ind.

Finally, if Config.flat_float_array is not set, then separability is not required anymore; we just use Ind as the mode of each parameter without any check.

Property interface (see Typedecl_properties). These functions rely on compute_decl and raise the Error exception on error.

val property : (prop, unit) Typedecl_properties.property
val update_decls : + Env.t -> + (Ident.t * Typedecl_properties.decl) list -> + (Ident.t * Typedecl_properties.decl) list
diff --git a/ocaml/Typedecl_unboxed/index.html b/ocaml/Typedecl_unboxed/index.html new file mode 100644 index 00000000..f129c2ae --- /dev/null +++ b/ocaml/Typedecl_unboxed/index.html @@ -0,0 +1,5 @@ + +Typedecl_unboxed (ocaml.Typedecl_unboxed)

Module Typedecl_unboxed

val get_unboxed_type_representation : + Env.t -> + Types.type_expr -> + Types.type_expr option
diff --git a/ocaml/Typedecl_variance/index.html b/ocaml/Typedecl_variance/index.html new file mode 100644 index 00000000..d3d55204 --- /dev/null +++ b/ocaml/Typedecl_variance/index.html @@ -0,0 +1,29 @@ + +Typedecl_variance (ocaml.Typedecl_variance)

Module Typedecl_variance

type surface_variance = bool * bool * bool
val variance_of_params : + (Parsetree.core_type * (Asttypes.variance * Asttypes.injectivity)) list -> + surface_variance list
val variance_of_sdecl : Parsetree.type_declaration -> surface_variance list
type prop = Types.Variance.t list
type req = surface_variance list
type variance_variable_context =
  1. | Type_declaration of Ident.t * Types.type_declaration
  2. | Gadt_constructor of Types.constructor_declaration
  3. | Extension_constructor of Ident.t * Types.extension_constructor
type variance_variable_error =
  1. | No_variable
  2. | Variance_not_reflected
  3. | Variance_not_deducible
type variance_error =
  1. | Variance_not_satisfied of int
  2. | Variance_variable_error of {
    1. error : variance_variable_error;
    2. context : variance_variable_context;
    3. variable : Types.type_expr;
    }
type error =
  1. | Bad_variance of variance_error * surface_variance * surface_variance
  2. | Varying_anonymous
exception Error of Location.t * error
val check_variance_extension : + Env.t -> + Types.type_declaration -> + Typedtree.extension_constructor -> + (req * Location.t) -> + unit
val compute_decl : + Env.t -> + check:Ident.t option -> + Types.type_declaration -> + req -> + prop
val update_decls : + Env.t -> + Parsetree.type_declaration list -> + (Ident.t * Types.type_declaration) list -> + (Ident.t * Types.type_declaration) list
diff --git a/ocaml/Typedtree/index.html b/ocaml/Typedtree/index.html new file mode 100644 index 00000000..bd730471 --- /dev/null +++ b/ocaml/Typedtree/index.html @@ -0,0 +1,81 @@ + +Typedtree (ocaml.Typedtree)

Module Typedtree

Abstract syntax tree after typing

By comparison with Parsetree:

  • Every Longindent.t is accompanied by a resolved Path.t.
type partial =
  1. | Partial
  2. | Total

Extension points

type attribute = Parsetree.attribute
type attributes = attribute list

Core language

type value =
  1. | Value_pattern
type computation =
  1. | Computation_pattern
type _ pattern_category =
  1. | Value : value pattern_category
  2. | Computation : computation pattern_category
type pattern = value general_pattern
and 'k general_pattern = 'k pattern_desc pattern_data
and 'a pattern_data = {
  1. pat_desc : 'a;
  2. pat_loc : Location.t;
  3. pat_extra : (pat_extra * Location.t * attributes) list;
  4. pat_type : Types.type_expr;
  5. pat_env : Env.t;
  6. pat_attributes : attributes;
}
and pat_extra =
  1. | Tpat_constraint of core_type
    (*

    P : T pat_desc = P + ; pat_extra = (Tpat_constraint T, _, _) :: ...

    *)
  2. | Tpat_type of Path.t * Longident.t Asttypes.loc
    (*

    #tconst pat_desc = disjunction + ; pat_extra = (Tpat_type (P, "tconst"), _, _) :: ...

    where disjunction is a Tpat_or _ representing the branches of tconst.

    *)
  3. | Tpat_open of Path.t * Longident.t Asttypes.loc * Env.t
  4. | Tpat_unpack
    (*

    (module P) pat_desc = Tpat_var "P" + ; pat_extra = (Tpat_unpack, _, _) :: ... (module _) pat_desc = Tpat_any + ; pat_extra = (Tpat_unpack, _, _) :: ...

    *)
and 'k pattern_desc =
  1. | Tpat_any : value pattern_desc
    (*

    _

    *)
  2. | Tpat_var : Ident.t * string Asttypes.loc -> value pattern_desc
    (*

    x

    *)
  3. | Tpat_alias : value general_pattern + * Ident.t + * string Asttypes.loc -> value pattern_desc
    (*

    P as a

    *)
  4. | Tpat_constant : Asttypes.constant -> value pattern_desc
    (*

    1, 'a', "true", 1.0, 1l, 1L, 1n

    *)
  5. | Tpat_tuple : value general_pattern list -> value pattern_desc
    (*

    (P1, ..., Pn)

    Invariant: n >= 2

    *)
  6. | Tpat_construct : Longident.t Asttypes.loc + * Types.constructor_description + * value general_pattern list + * (Ident.t Asttypes.loc list * core_type) option -> value pattern_desc
    (*

    C (, None) C P (P, None) C (P1, ..., Pn) (P1; ...; Pn, None) C (P : t) (P, Some (, t)) C (P1, ..., Pn : t) (P1; ...; Pn, Some (, t)) C (type a) (P : t) (P, Some (a, t)) C (type a) (P1, ..., Pn : t) (P1; ...; Pn, Some (a, t))

    *)
  7. | Tpat_variant : Asttypes.label + * value general_pattern option + * Types.row_desc ref -> value pattern_desc
    (*

    `A (None) `A P (Some P)

    See Types.row_desc for an explanation of the last parameter.

    *)
  8. | Tpat_record : (Longident.t Asttypes.loc + * Types.label_description + * value general_pattern) + list + * Asttypes.closed_flag -> value pattern_desc
    (*

    l1=P1; ...; ln=Pn (flag = Closed) l1=P1; ...; ln=Pn; _ (flag = Open)

    Invariant: n > 0

    *)
  9. | Tpat_array : value general_pattern list -> value pattern_desc
    (*

    | P1; ...; Pn |

    *)
  10. | Tpat_lazy : value general_pattern -> value pattern_desc
    (*

    lazy P

    *)
  11. | Tpat_value : tpat_value_argument -> computation pattern_desc
    (*

    P

    Invariant: Tpat_value pattern should not carry pat_attributes or pat_extra metadata coming from user syntax, which must be on the inner pattern node -- to facilitate searching for a certain value pattern constructor with a specific attributed.

    To enforce this restriction, we made the argument of the Tpat_value constructor a private synonym of pattern, requiring you to use the as_computation_pattern function below instead of using the Tpat_value constructor directly.

    *)
  12. | Tpat_exception : value general_pattern -> computation pattern_desc
    (*

    exception P

    *)
  13. | Tpat_or : 'k general_pattern + * 'k general_pattern + * Types.row_desc option -> 'k pattern_desc
    (*

    P1 | P2

    row_desc = Some _ when translating Ppat_type _, None otherwise.

    *)
and tpat_value_argument = private value general_pattern
and expression = {
  1. exp_desc : expression_desc;
  2. exp_loc : Location.t;
  3. exp_extra : (exp_extra * Location.t * attributes) list;
  4. exp_type : Types.type_expr;
  5. exp_env : Env.t;
  6. exp_attributes : attributes;
}
and exp_extra =
  1. | Texp_constraint of core_type
    (*

    E : T

    *)
  2. | Texp_coerce of core_type option * core_type
    (*

    E :> T Texp_coerce (None, T) E : T0 :> T Texp_coerce (Some T0, T)

    *)
  3. | Texp_poly of core_type option
    (*

    Used for method bodies.

    *)
  4. | Texp_newtype of string
    (*

    fun (type t) ->

    *)
and expression_desc =
  1. | Texp_ident of Path.t * Longident.t Asttypes.loc * Types.value_description
    (*

    x M.x

    *)
  2. | Texp_constant of Asttypes.constant
    (*

    1, 'a', "true", 1.0, 1l, 1L, 1n

    *)
  3. | Texp_let of Asttypes.rec_flag * value_binding list * expression
    (*

    let P1 = E1 and ... and Pn = EN in E (flag = Nonrecursive) let rec P1 = E1 and ... and Pn = EN in E (flag = Recursive)

    *)
  4. | Texp_function of {
    1. arg_label : Asttypes.arg_label;
    2. param : Ident.t;
    3. cases : value case list;
    4. partial : partial;
    }
    (*

    Pexp_fun and Pexp_function both translate to Texp_function. See Parsetree for more details.

    param is the identifier that is to be used to name the parameter of the function.

    partial = Partial if the pattern match is partial Total otherwise.

    *)
  5. | Texp_apply of expression * (Asttypes.arg_label * expression option) list
    (*

    E0 ~l1:E1 ... ~ln:En

    The expression can be None if the expression is abstracted over this argument. It currently appears when a label is applied.

    For example: let f x ~y = x + y in f ~y:3

    The resulting typedtree for the application is: Texp_apply (Texp_ident "f/1037", (Nolabel, None); + (Labelled "y", Some (Texp_constant Const_int 3)) + )

    *)
  6. | Texp_match of expression * computation case list * partial
    (*

    match E0 with | P1 -> E1 | P2 | exception P3 -> E2 | exception P4 -> E3

    Texp_match (E0, [(P1, E1); (P2 | exception P3, E2); + (exception P4, E3)], _)

    *)
  7. | Texp_try of expression * value case list
    (*

    try E with P1 -> E1 | ... | PN -> EN

    *)
  8. | Texp_tuple of expression list
    (*

    (E1, ..., EN)

    *)
  9. | Texp_construct of Longident.t Asttypes.loc + * Types.constructor_description + * expression list
    (*

    C C E E C (E1, ..., En) E1;...;En

    *)
  10. | Texp_variant of Asttypes.label * expression option
  11. | Texp_record of {
    1. fields : (Types.label_description * record_label_definition) array;
    2. representation : Types.record_representation;
    3. extended_expression : expression option;
    }
    (*

    l1=P1; ...; ln=Pn (extended_expression = None) E0 with l1=P1; ...; ln=Pn (extended_expression = Some E0)

    Invariant: n > 0

    If the type is l1: t1; l2: t2 , the expression E0 with t2=P2 is represented as Texp_record fields = [| l1, Kept t1; l2 Override P2 |]; representation; + extended_expression = Some E0

    *)
  12. | Texp_field of expression * Longident.t Asttypes.loc * Types.label_description
  13. | Texp_setfield of expression + * Longident.t Asttypes.loc + * Types.label_description + * expression
  14. | Texp_array of expression list
  15. | Texp_ifthenelse of expression * expression * expression option
  16. | Texp_sequence of expression * expression
  17. | Texp_while of expression * expression
  18. | Texp_for of Ident.t + * Parsetree.pattern + * expression + * expression + * Asttypes.direction_flag + * expression
  19. | Texp_send of expression * meth
  20. | Texp_new of Path.t * Longident.t Asttypes.loc * Types.class_declaration
  21. | Texp_instvar of Path.t * Path.t * string Asttypes.loc
  22. | Texp_setinstvar of Path.t * Path.t * string Asttypes.loc * expression
  23. | Texp_override of Path.t * (Ident.t * string Asttypes.loc * expression) list
  24. | Texp_letmodule of Ident.t option + * string option Asttypes.loc + * Types.module_presence + * module_expr + * expression
  25. | Texp_letexception of extension_constructor * expression
  26. | Texp_assert of expression * Location.t
  27. | Texp_lazy of expression
  28. | Texp_object of class_structure * string list
  29. | Texp_pack of module_expr
  30. | Texp_letop of {
    1. let_ : binding_op;
    2. ands : binding_op list;
    3. param : Ident.t;
    4. body : value case;
    5. partial : partial;
    }
  31. | Texp_unreachable
  32. | Texp_extension_constructor of Longident.t Asttypes.loc * Path.t
  33. | Texp_open of open_declaration * expression
    (*

    let open! M in e

    *)
and meth =
  1. | Tmeth_name of string
  2. | Tmeth_val of Ident.t
  3. | Tmeth_ancestor of Ident.t * Path.t
and 'k case = {
  1. c_lhs : 'k general_pattern;
  2. c_guard : expression option;
  3. c_rhs : expression;
}
and record_label_definition =
  1. | Kept of Types.type_expr * Asttypes.mutable_flag
  2. | Overridden of Longident.t Asttypes.loc * expression
and binding_op = {
  1. bop_op_path : Path.t;
  2. bop_op_name : string Asttypes.loc;
  3. bop_op_val : Types.value_description;
  4. bop_op_type : Types.type_expr;
  5. bop_exp : expression;
  6. bop_loc : Location.t;
}
and class_expr = {
  1. cl_desc : class_expr_desc;
  2. cl_loc : Location.t;
  3. cl_type : Types.class_type;
  4. cl_env : Env.t;
  5. cl_attributes : attributes;
}
and class_expr_desc =
  1. | Tcl_ident of Path.t * Longident.t Asttypes.loc * core_type list
  2. | Tcl_structure of class_structure
  3. | Tcl_fun of Asttypes.arg_label + * pattern + * (Ident.t * expression) list + * class_expr + * partial
  4. | Tcl_apply of class_expr * (Asttypes.arg_label * expression option) list
  5. | Tcl_let of Asttypes.rec_flag + * value_binding list + * (Ident.t * expression) list + * class_expr
  6. | Tcl_constraint of class_expr + * class_type option + * string list + * string list + * Types.MethSet.t
  7. | Tcl_open of open_description * class_expr
and class_structure = {
  1. cstr_self : pattern;
  2. cstr_fields : class_field list;
  3. cstr_type : Types.class_signature;
  4. cstr_meths : Ident.t Types.Meths.t;
}
and class_field = {
  1. cf_desc : class_field_desc;
  2. cf_loc : Location.t;
  3. cf_attributes : attributes;
}
and class_field_kind =
  1. | Tcfk_virtual of core_type
  2. | Tcfk_concrete of Asttypes.override_flag * expression
and class_field_desc =
  1. | Tcf_inherit of Asttypes.override_flag + * class_expr + * string option + * (string * Ident.t) list + * (string * Ident.t) list
  2. | Tcf_val of string Asttypes.loc + * Asttypes.mutable_flag + * Ident.t + * class_field_kind + * bool
  3. | Tcf_method of string Asttypes.loc * Asttypes.private_flag * class_field_kind
  4. | Tcf_constraint of core_type * core_type
  5. | Tcf_initializer of expression
  6. | Tcf_attribute of attribute
and module_expr = {
  1. mod_desc : module_expr_desc;
  2. mod_loc : Location.t;
  3. mod_type : Types.module_type;
  4. mod_env : Env.t;
  5. mod_attributes : attributes;
}
and module_type_constraint =
  1. | Tmodtype_implicit
    (*

    The module type constraint has been synthesized during typechecking.

    *)
  2. | Tmodtype_explicit of module_type
    (*

    The module type was in the source file.

    *)

Annotations for Tmod_constraint.

and functor_parameter =
  1. | Unit
  2. | Named of Ident.t option * string option Asttypes.loc * module_type
and module_expr_desc =
  1. | Tmod_ident of Path.t * Longident.t Asttypes.loc
  2. | Tmod_structure of structure
  3. | Tmod_functor of functor_parameter * module_expr
  4. | Tmod_apply of module_expr * module_expr * module_coercion
  5. | Tmod_apply_unit of module_expr
  6. | Tmod_constraint of module_expr + * Types.module_type + * module_type_constraint + * module_coercion
    (*

    ME (constraint = Tmodtype_implicit) (ME : MT) (constraint = Tmodtype_explicit MT)

    *)
  7. | Tmod_unpack of expression * Types.module_type
and structure = {
  1. str_items : structure_item list;
  2. str_type : Types.signature;
  3. str_final_env : Env.t;
}
and structure_item = {
  1. str_desc : structure_item_desc;
  2. str_loc : Location.t;
  3. str_env : Env.t;
}
and structure_item_desc =
  1. | Tstr_eval of expression * attributes
  2. | Tstr_value of Asttypes.rec_flag * value_binding list
  3. | Tstr_primitive of value_description
  4. | Tstr_type of Asttypes.rec_flag * type_declaration list
  5. | Tstr_typext of type_extension
  6. | Tstr_exception of type_exception
  7. | Tstr_module of module_binding
  8. | Tstr_recmodule of module_binding list
  9. | Tstr_modtype of module_type_declaration
  10. | Tstr_open of open_declaration
  11. | Tstr_class of (class_declaration * string list) list
  12. | Tstr_class_type of (Ident.t * string Asttypes.loc * class_type_declaration) + list
  13. | Tstr_include of include_declaration
  14. | Tstr_attribute of attribute
and module_binding = {
  1. mb_id : Ident.t option;
  2. mb_name : string option Asttypes.loc;
  3. mb_presence : Types.module_presence;
  4. mb_expr : module_expr;
  5. mb_attributes : attributes;
  6. mb_loc : Location.t;
}
and value_binding = {
  1. vb_pat : pattern;
  2. vb_expr : expression;
  3. vb_attributes : attributes;
  4. vb_loc : Location.t;
}
and module_coercion =
  1. | Tcoerce_none
  2. | Tcoerce_structure of (int * module_coercion) list + * (Ident.t * int * module_coercion) list
  3. | Tcoerce_functor of module_coercion * module_coercion
  4. | Tcoerce_primitive of primitive_coercion
  5. | Tcoerce_alias of Env.t * Path.t * module_coercion
and module_type = {
  1. mty_desc : module_type_desc;
  2. mty_type : Types.module_type;
  3. mty_env : Env.t;
  4. mty_loc : Location.t;
  5. mty_attributes : attributes;
}
and module_type_desc =
  1. | Tmty_ident of Path.t * Longident.t Asttypes.loc
  2. | Tmty_signature of signature
  3. | Tmty_functor of functor_parameter * module_type
  4. | Tmty_with of module_type + * (Path.t * Longident.t Asttypes.loc * with_constraint) list
  5. | Tmty_typeof of module_expr
  6. | Tmty_alias of Path.t * Longident.t Asttypes.loc
and primitive_coercion = {
  1. pc_desc : Primitive.description;
  2. pc_type : Types.type_expr;
  3. pc_env : Env.t;
  4. pc_loc : Location.t;
}
and signature = {
  1. sig_items : signature_item list;
  2. sig_type : Types.signature;
  3. sig_final_env : Env.t;
}
and signature_item = {
  1. sig_desc : signature_item_desc;
  2. sig_env : Env.t;
  3. sig_loc : Location.t;
}
and signature_item_desc =
  1. | Tsig_value of value_description
  2. | Tsig_type of Asttypes.rec_flag * type_declaration list
  3. | Tsig_typesubst of type_declaration list
  4. | Tsig_typext of type_extension
  5. | Tsig_exception of type_exception
  6. | Tsig_module of module_declaration
  7. | Tsig_modsubst of module_substitution
  8. | Tsig_recmodule of module_declaration list
  9. | Tsig_modtype of module_type_declaration
  10. | Tsig_modtypesubst of module_type_declaration
  11. | Tsig_open of open_description
  12. | Tsig_include of include_description
  13. | Tsig_class of class_description list
  14. | Tsig_class_type of class_type_declaration list
  15. | Tsig_attribute of attribute
and module_declaration = {
  1. md_id : Ident.t option;
  2. md_name : string option Asttypes.loc;
  3. md_presence : Types.module_presence;
  4. md_type : module_type;
  5. md_attributes : attributes;
  6. md_loc : Location.t;
}
and module_substitution = {
  1. ms_id : Ident.t;
  2. ms_name : string Asttypes.loc;
  3. ms_manifest : Path.t;
  4. ms_txt : Longident.t Asttypes.loc;
  5. ms_attributes : attributes;
  6. ms_loc : Location.t;
}
and module_type_declaration = {
  1. mtd_id : Ident.t;
  2. mtd_name : string Asttypes.loc;
  3. mtd_type : module_type option;
  4. mtd_attributes : attributes;
  5. mtd_loc : Location.t;
}
and 'a open_infos = {
  1. open_expr : 'a;
  2. open_bound_items : Types.signature;
  3. open_override : Asttypes.override_flag;
  4. open_env : Env.t;
  5. open_loc : Location.t;
  6. open_attributes : attribute list;
}
and open_description = (Path.t * Longident.t Asttypes.loc) open_infos
and open_declaration = module_expr open_infos
and 'a include_infos = {
  1. incl_mod : 'a;
  2. incl_type : Types.signature;
  3. incl_loc : Location.t;
  4. incl_attributes : attribute list;
}
and include_description = module_type include_infos
and include_declaration = module_expr include_infos
and with_constraint =
  1. | Twith_type of type_declaration
  2. | Twith_module of Path.t * Longident.t Asttypes.loc
  3. | Twith_modtype of module_type
  4. | Twith_typesubst of type_declaration
  5. | Twith_modsubst of Path.t * Longident.t Asttypes.loc
  6. | Twith_modtypesubst of module_type
and core_type = {
  1. mutable ctyp_desc : core_type_desc;
    (*

    mutable because of Typeclass.declare_method

    *)
  2. mutable ctyp_type : Types.type_expr;
    (*

    mutable because of Typeclass.declare_method

    *)
  3. ctyp_env : Env.t;
  4. ctyp_loc : Location.t;
  5. ctyp_attributes : attributes;
}
and core_type_desc =
  1. | Ttyp_any
  2. | Ttyp_var of string
  3. | Ttyp_arrow of Asttypes.arg_label * core_type * core_type
  4. | Ttyp_tuple of core_type list
  5. | Ttyp_constr of Path.t * Longident.t Asttypes.loc * core_type list
  6. | Ttyp_object of object_field list * Asttypes.closed_flag
  7. | Ttyp_class of Path.t * Longident.t Asttypes.loc * core_type list
  8. | Ttyp_alias of core_type * string
  9. | Ttyp_variant of row_field list + * Asttypes.closed_flag + * Asttypes.label list option
  10. | Ttyp_poly of string list * core_type
  11. | Ttyp_package of package_type
and package_type = {
  1. pack_path : Path.t;
  2. pack_fields : (Longident.t Asttypes.loc * core_type) list;
  3. pack_type : Types.module_type;
  4. pack_txt : Longident.t Asttypes.loc;
}
and row_field = {
  1. rf_desc : row_field_desc;
  2. rf_loc : Location.t;
  3. rf_attributes : attributes;
}
and row_field_desc =
  1. | Ttag of string Asttypes.loc * bool * core_type list
  2. | Tinherit of core_type
and object_field = {
  1. of_desc : object_field_desc;
  2. of_loc : Location.t;
  3. of_attributes : attributes;
}
and object_field_desc =
  1. | OTtag of string Asttypes.loc * core_type
  2. | OTinherit of core_type
and value_description = {
  1. val_id : Ident.t;
  2. val_name : string Asttypes.loc;
  3. val_desc : core_type;
  4. val_val : Types.value_description;
  5. val_prim : string list;
  6. val_loc : Location.t;
  7. val_attributes : attributes;
}
and type_declaration = {
  1. typ_id : Ident.t;
  2. typ_name : string Asttypes.loc;
  3. typ_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
  4. typ_type : Types.type_declaration;
  5. typ_cstrs : (core_type * core_type * Location.t) list;
  6. typ_kind : type_kind;
  7. typ_private : Asttypes.private_flag;
  8. typ_manifest : core_type option;
  9. typ_loc : Location.t;
  10. typ_attributes : attributes;
}
and type_kind =
  1. | Ttype_abstract
  2. | Ttype_variant of constructor_declaration list
  3. | Ttype_record of label_declaration list
  4. | Ttype_open
and label_declaration = {
  1. ld_id : Ident.t;
  2. ld_name : string Asttypes.loc;
  3. ld_mutable : Asttypes.mutable_flag;
  4. ld_type : core_type;
  5. ld_loc : Location.t;
  6. ld_attributes : attributes;
}
and constructor_declaration = {
  1. cd_id : Ident.t;
  2. cd_name : string Asttypes.loc;
  3. cd_vars : string Asttypes.loc list;
  4. cd_args : constructor_arguments;
  5. cd_res : core_type option;
  6. cd_loc : Location.t;
  7. cd_attributes : attributes;
}
and constructor_arguments =
  1. | Cstr_tuple of core_type list
  2. | Cstr_record of label_declaration list
and type_extension = {
  1. tyext_path : Path.t;
  2. tyext_txt : Longident.t Asttypes.loc;
  3. tyext_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
  4. tyext_constructors : extension_constructor list;
  5. tyext_private : Asttypes.private_flag;
  6. tyext_loc : Location.t;
  7. tyext_attributes : attributes;
}
and type_exception = {
  1. tyexn_constructor : extension_constructor;
  2. tyexn_loc : Location.t;
  3. tyexn_attributes : attribute list;
}
and extension_constructor = {
  1. ext_id : Ident.t;
  2. ext_name : string Asttypes.loc;
  3. ext_type : Types.extension_constructor;
  4. ext_kind : extension_constructor_kind;
  5. ext_loc : Location.t;
  6. ext_attributes : attributes;
}
and extension_constructor_kind =
  1. | Text_decl of string Asttypes.loc list + * constructor_arguments + * core_type option
  2. | Text_rebind of Path.t * Longident.t Asttypes.loc
and class_type = {
  1. cltyp_desc : class_type_desc;
  2. cltyp_type : Types.class_type;
  3. cltyp_env : Env.t;
  4. cltyp_loc : Location.t;
  5. cltyp_attributes : attributes;
}
and class_type_desc =
  1. | Tcty_constr of Path.t * Longident.t Asttypes.loc * core_type list
  2. | Tcty_signature of class_signature
  3. | Tcty_arrow of Asttypes.arg_label * core_type * class_type
  4. | Tcty_open of open_description * class_type
and class_signature = {
  1. csig_self : core_type;
  2. csig_fields : class_type_field list;
  3. csig_type : Types.class_signature;
}
and class_type_field = {
  1. ctf_desc : class_type_field_desc;
  2. ctf_loc : Location.t;
  3. ctf_attributes : attributes;
}
and class_type_field_desc =
  1. | Tctf_inherit of class_type
  2. | Tctf_val of string * Asttypes.mutable_flag * Asttypes.virtual_flag * core_type
  3. | Tctf_method of string + * Asttypes.private_flag + * Asttypes.virtual_flag + * core_type
  4. | Tctf_constraint of core_type * core_type
  5. | Tctf_attribute of attribute
and class_declaration = class_expr class_infos
and class_description = class_type class_infos
and class_type_declaration = class_type class_infos
and 'a class_infos = {
  1. ci_virt : Asttypes.virtual_flag;
  2. ci_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
  3. ci_id_name : string Asttypes.loc;
  4. ci_id_class : Ident.t;
  5. ci_id_class_type : Ident.t;
  6. ci_id_object : Ident.t;
  7. ci_expr : 'a;
  8. ci_decl : Types.class_declaration;
  9. ci_type_decl : Types.class_type_declaration;
  10. ci_loc : Location.t;
  11. ci_attributes : attributes;
}
type implementation = {
  1. structure : structure;
  2. coercion : module_coercion;
  3. signature : Types.signature;
  4. shape : Shape.t;
}

A typechecked implementation including its module structure, its exported signature, and a coercion of the module against that signature.

If an .mli file is present, the signature will come from that file and be the exported signature of the module.

If there isn't one, the signature will be inferred from the module structure.

val as_computation_pattern : pattern -> computation general_pattern

as_computation_pattern p is a computation pattern with description Tpat_value p, which enforces a correct placement of pat_attributes and pat_extra metadata (on the inner value pattern, rather than on the computation pattern).

val classify_pattern_desc : 'k pattern_desc -> 'k pattern_category
val classify_pattern : 'k general_pattern -> 'k pattern_category
type pattern_action = {
  1. f : 'k. 'k general_pattern -> unit;
}
val shallow_iter_pattern_desc : pattern_action -> 'k pattern_desc -> unit
type pattern_transformation = {
  1. f : 'k. 'k general_pattern -> 'k general_pattern;
}
val shallow_map_pattern_desc : + pattern_transformation -> + 'k pattern_desc -> + 'k pattern_desc
val iter_general_pattern : pattern_action -> 'k general_pattern -> unit
val iter_pattern : (pattern -> unit) -> pattern -> unit
type pattern_predicate = {
  1. f : 'k. 'k general_pattern -> bool;
}
val exists_general_pattern : pattern_predicate -> 'k general_pattern -> bool
val exists_pattern : (pattern -> bool) -> pattern -> bool
val let_bound_idents : value_binding list -> Ident.t list
val let_bound_idents_full : + value_binding list -> + (Ident.t * string Asttypes.loc * Types.type_expr) list
val alpha_pat : + (Ident.t * Ident.t) list -> + 'k general_pattern -> + 'k general_pattern

Alpha conversion of patterns

val mknoloc : 'a -> 'a Asttypes.loc
val mkloc : 'a -> Location.t -> 'a Asttypes.loc
val pat_bound_idents : 'k general_pattern -> Ident.t list
val pat_bound_idents_full : + 'k general_pattern -> + (Ident.t * string Asttypes.loc * Types.type_expr) list
val split_pattern : + computation general_pattern -> + pattern option * pattern option

Splits an or pattern into its value (left) and exception (right) parts.

val exp_is_nominal : expression -> bool

Whether an expression looks nice as the subject of a sentence in a error message.

diff --git a/ocaml/Typemod/Sig_component_kind/index.html b/ocaml/Typemod/Sig_component_kind/index.html new file mode 100644 index 00000000..82ba079a --- /dev/null +++ b/ocaml/Typemod/Sig_component_kind/index.html @@ -0,0 +1,2 @@ + +Sig_component_kind (ocaml.Typemod.Sig_component_kind)

Module Typemod.Sig_component_kind

type t =
  1. | Value
  2. | Type
  3. | Module
  4. | Module_type
  5. | Extension_constructor
  6. | Class
  7. | Class_type
val to_string : t -> string
diff --git a/ocaml/Typemod/Signature_names/index.html b/ocaml/Typemod/Signature_names/index.html new file mode 100644 index 00000000..d28f871e --- /dev/null +++ b/ocaml/Typemod/Signature_names/index.html @@ -0,0 +1,2 @@ + +Signature_names (ocaml.Typemod.Signature_names)

Module Typemod.Signature_names

type t
val simplify : Env.t -> t -> Types.signature -> Types.signature
diff --git a/ocaml/Typemod/index.html b/ocaml/Typemod/index.html new file mode 100644 index 00000000..b3b357bc --- /dev/null +++ b/ocaml/Typemod/index.html @@ -0,0 +1,40 @@ + +Typemod (ocaml.Typemod)

Module Typemod

Type-checking of the module language and typed ast hooks

Warning: this module is unstable and part of compiler-libs.

module Signature_names : sig ... end
val type_implementation : + string -> + string -> + string -> + Env.t -> + Parsetree.structure -> + Typedtree.implementation
val type_interface : Env.t -> Parsetree.signature -> Typedtree.signature
val transl_signature : Env.t -> Parsetree.signature -> Typedtree.signature
val check_nongen_signature : Env.t -> Types.signature -> unit
val modtype_of_package : + Env.t -> + Location.t -> + Path.t -> + (Longident.t * Types.type_expr) list -> + Types.module_type
val path_of_module : Typedtree.module_expr -> Path.t option
val save_signature : + string -> + Typedtree.signature -> + string -> + string -> + Env.t -> + Cmi_format.cmi_infos -> + unit
val package_units : + Env.t -> + string list -> + string -> + string -> + Typedtree.module_coercion
val initial_env : + loc:Location.t -> + initially_opened_module:string option -> + open_implicit_modules:string list -> + Env.t
module Sig_component_kind : sig ... end
type hiding_error =
  1. | Illegal_shadowing of {
    1. shadowed_item_id : Ident.t;
    2. shadowed_item_kind : Sig_component_kind.t;
    3. shadowed_item_loc : Location.t;
    4. shadower_id : Ident.t;
    5. user_id : Ident.t;
    6. user_kind : Sig_component_kind.t;
    7. user_loc : Location.t;
    }
  2. | Appears_in_signature of {
    1. opened_item_id : Ident.t;
    2. opened_item_kind : Sig_component_kind.t;
    3. user_id : Ident.t;
    4. user_kind : Sig_component_kind.t;
    5. user_loc : Location.t;
    }
type error =
  1. | Cannot_apply of Types.module_type
  2. | Not_included of Includemod.explanation
  3. | Cannot_eliminate_dependency of Types.module_type
  4. | Signature_expected
  5. | Structure_expected of Types.module_type
  6. | With_no_component of Longident.t
  7. | With_mismatch of Longident.t * Includemod.explanation
  8. | With_makes_applicative_functor_ill_typed of Longident.t + * Path.t + * Includemod.explanation
  9. | With_changes_module_alias of Longident.t * Ident.t * Path.t
  10. | With_cannot_remove_constrained_type
  11. | Repeated_name of Sig_component_kind.t * string
  12. | Non_generalizable of {
    1. vars : Types.type_expr list;
    2. expression : Types.type_expr;
    }
  13. | Non_generalizable_module of {
    1. vars : Types.type_expr list;
    2. item : Types.value_description;
    3. mty : Types.module_type;
    }
  14. | Implementation_is_required of string
  15. | Interface_not_compiled of string
  16. | Not_allowed_in_functor_body
  17. | Not_a_packed_module of Types.type_expr
  18. | Incomplete_packed_module of Types.type_expr
  19. | Scoping_pack of Longident.t * Types.type_expr
  20. | Recursive_module_require_explicit_type
  21. | Apply_generative
  22. | Cannot_scrape_alias of Path.t
  23. | Cannot_scrape_package_type of Path.t
  24. | Badly_formed_signature of string * Typedecl.error
  25. | Cannot_hide_id of hiding_error
  26. | Invalid_type_subst_rhs
  27. | Unpackable_local_modtype_subst of Path.t
  28. | With_cannot_remove_packed_modtype of Path.t * Types.module_type
exception Error of Location.t * Env.t * error
exception Error_forward of Location.error
val report_error : Env.t -> loc:Location.t -> error -> Location.error
diff --git a/ocaml/Typeopt/index.html b/ocaml/Typeopt/index.html new file mode 100644 index 00000000..0917ce4d --- /dev/null +++ b/ocaml/Typeopt/index.html @@ -0,0 +1,19 @@ + +Typeopt (ocaml.Typeopt)

Module Typeopt

val is_function_type : + Env.t -> + Types.type_expr -> + (Types.type_expr * Types.type_expr) option
val is_base_type : Env.t -> Types.type_expr -> Path.t -> bool
val maybe_pointer_type : + Env.t -> + Types.type_expr -> + Lambda.immediate_or_pointer
val array_type_kind : Env.t -> Types.type_expr -> Lambda.array_kind
val array_pattern_kind : Typedtree.pattern -> Lambda.array_kind
val bigarray_type_kind_and_layout : + Env.t -> + Types.type_expr -> + Lambda.bigarray_kind * Lambda.bigarray_layout
val value_kind : Env.t -> Types.type_expr -> Lambda.value_kind
val function_return_value_kind : Env.t -> Types.type_expr -> Lambda.value_kind
val classify_lazy_argument : + Typedtree.expression -> + [ `Constant_or_function + | `Float_that_cannot_be_shortcut + | `Identifier of [ `Forward_value | `Other ] + | `Other ]
val value_kind_union : + Lambda.value_kind -> + Lambda.value_kind -> + Lambda.value_kind

value_kind_union k1 k2 is a value_kind at least as general as k1 and k2

diff --git a/ocaml/Types/MethSet/index.html b/ocaml/Types/MethSet/index.html new file mode 100644 index 00000000..a6ff5801 --- /dev/null +++ b/ocaml/Types/MethSet/index.html @@ -0,0 +1,3 @@ + +MethSet (ocaml.Types.MethSet)

Module Types.MethSet

Sets

type elt = string

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Types/Meths/index.html b/ocaml/Types/Meths/index.html new file mode 100644 index 00000000..f9dfb269 --- /dev/null +++ b/ocaml/Types/Meths/index.html @@ -0,0 +1,8 @@ + +Meths (ocaml.Types.Meths)

Module Types.Meths

Maps

type key = string

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Types/Separability/index.html b/ocaml/Types/Separability/index.html new file mode 100644 index 00000000..dba1056c --- /dev/null +++ b/ocaml/Types/Separability/index.html @@ -0,0 +1,2 @@ + +Separability (ocaml.Types.Separability)

Module Types.Separability

see Typedecl_separability for an explanation of separability and separability modes.

type t =
  1. | Ind
  2. | Sep
  3. | Deepsep
val eq : t -> t -> bool
val print : Stdlib.Format.formatter -> t -> unit
val rank : t -> int

Modes are ordered from the least to the most demanding: Ind < Sep < Deepsep. 'rank' maps them to integers in an order-respecting way: m1 < m2 <=> rank m1 < rank m2

val compare : t -> t -> int

Compare two mode according to their mode ordering.

val max : t -> t -> t

max_mode m1 m2 returns the most demanding mode. It is used to express the conjunction of two parameter mode constraints.

type signature = t list

The 'separability signature' of a type assigns a mode for each of its parameters. ('a, 'b) t has mode (m1, m2) if (t1, t2) t is separable whenever t1, t2 have mode m1, m2.

val print_signature : Stdlib.Format.formatter -> signature -> unit
val default_signature : arity:int -> signature

The most pessimistic separability for a completely unknown type.

diff --git a/ocaml/Types/TransientTypeOps/index.html b/ocaml/Types/TransientTypeOps/index.html new file mode 100644 index 00000000..91da53ff --- /dev/null +++ b/ocaml/Types/TransientTypeOps/index.html @@ -0,0 +1,2 @@ + +TransientTypeOps (ocaml.Types.TransientTypeOps)

Module Types.TransientTypeOps

Comparisons for functors

val compare : t -> t -> int
val equal : t -> t -> bool
val hash : t -> int
diff --git a/ocaml/Types/Transient_expr/index.html b/ocaml/Types/Transient_expr/index.html new file mode 100644 index 00000000..f2822118 --- /dev/null +++ b/ocaml/Types/Transient_expr/index.html @@ -0,0 +1,2 @@ + +Transient_expr (ocaml.Types.Transient_expr)

Module Types.Transient_expr

Operations on transient_expr

val create : type_desc -> level:int -> scope:int -> id:int -> transient_expr
val set_desc : transient_expr -> type_desc -> unit
val set_level : transient_expr -> int -> unit
val set_scope : transient_expr -> int -> unit
val type_expr : transient_expr -> type_expr
val coerce : type_expr -> transient_expr

Coerce without normalizing with repr

val set_stub_desc : type_expr -> type_desc -> unit

Instantiate a not yet instantiated stub. Fail if already instantiated.

diff --git a/ocaml/Types/VarSet/index.html b/ocaml/Types/VarSet/index.html new file mode 100644 index 00000000..63b7e2ba --- /dev/null +++ b/ocaml/Types/VarSet/index.html @@ -0,0 +1,3 @@ + +VarSet (ocaml.Types.VarSet)

Module Types.VarSet

Sets

type elt = string

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04
val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02
val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
diff --git a/ocaml/Types/Variance/index.html b/ocaml/Types/Variance/index.html new file mode 100644 index 00000000..c17b6a9d --- /dev/null +++ b/ocaml/Types/Variance/index.html @@ -0,0 +1,2 @@ + +Variance (ocaml.Types.Variance)

Module Types.Variance

type t
type f =
  1. | May_pos
  2. | May_neg
  3. | May_weak
  4. | Inj
  5. | Pos
  6. | Neg
  7. | Inv
val null : t
val full : t
val covariant : t
val unknown : t
val union : t -> t -> t
val inter : t -> t -> t
val subset : t -> t -> bool
val eq : t -> t -> bool
val set : f -> t -> t
val set_if : bool -> f -> t -> t
val mem : f -> t -> bool
val conjugate : t -> t
val compose : t -> t -> t
val strengthen : t -> t
val get_upper : t -> bool * bool
val get_lower : t -> bool * bool * bool
val unknown_signature : injective:bool -> arity:int -> t list

The most pessimistic variance for a completely unknown type.

diff --git a/ocaml/Types/Vars/index.html b/ocaml/Types/Vars/index.html new file mode 100644 index 00000000..98e1d69b --- /dev/null +++ b/ocaml/Types/Vars/index.html @@ -0,0 +1,8 @@ + +Vars (ocaml.Types.Vars)

Module Types.Vars

Maps

type key = string

The type of the map keys.

type !+'a t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val of_list : (key * 'a) list -> 'a t

of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

  • since 5.1
val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
diff --git a/ocaml/Types/index.html b/ocaml/Types/index.html new file mode 100644 index 00000000..e21e5035 --- /dev/null +++ b/ocaml/Types/index.html @@ -0,0 +1,37 @@ + +Types (ocaml.Types)

Module Types

Representation of types and declarations

Types defines the representation of types and declarations (that is, the content of module signatures).

CMI files are made of marshalled types.

Asttypes exposes basic definitions shared both by Parsetree and Types.

type type_expr

Type expressions for the core language.

The type_desc variant defines all the possible type expressions one can find in OCaml. type_expr wraps this with some annotations.

The level field tracks the level of polymorphism associated to a type, guiding the generalization algorithm. Put shortly, when referring to a type in a given environment, both the type and the environment have a level. If the type has an higher level, then it can be considered fully polymorphic (type variables will be printed as 'a), otherwise it'll be weakly polymorphic, or non generalized (type variables printed as '_a). See http://okmij.org/ftp/ML/generalization.html for more information.

Note about type_declaration: one should not make the confusion between type_expr and type_declaration.

type_declaration refers specifically to the type construct in OCaml language, where you create and name a new type or type alias.

type_expr is used when you refer to existing types, e.g. when annotating the expected type of a value.

Also, as the type system of OCaml is generative, a type_declaration can have the side-effect of introducing a new type constructor, different from all other known types. Whereas type_expr is a pure construct which allows referring to existing types.

Note on mutability: TBD.

type row_desc
type row_field
type field_kind
type commutable
type type_desc =
  1. | Tvar of string option
    (*

    Tvar (Some "a") ==> 'a or '_a Tvar None ==> _

    *)
  2. | Tarrow of Asttypes.arg_label * type_expr * type_expr * commutable
    (*

    Tarrow (Nolabel, e1, e2, c) ==> e1 -> e2 Tarrow (Labelled "l", e1, e2, c) ==> l:e1 -> e2 Tarrow (Optional "l", e1, e2, c) ==> ?l:e1 -> e2

    See commutable for the last argument.

    *)
  3. | Ttuple of type_expr list
    (*

    Ttuple [t1;...;tn] ==> (t1 * ... * tn)

    *)
  4. | Tconstr of Path.t * type_expr list * abbrev_memo ref
    (*

    Tconstr (`A.B.t', [t1;...;tn], _) ==> (t1,...,tn) A.B.t The last parameter keep tracks of known expansions, see abbrev_memo.

    *)
  5. | Tobject of type_expr * (Path.t * type_expr list) option ref
    (*

    Tobject (`f1:t1;...;fn: tn', `None') ==> < f1: t1; ...; fn: tn > f1, fn are represented as a linked list of types using Tfield and Tnil constructors.

    Tobject (_, `Some (`A.ct', [t1;...;tn]') ==> (t1, ..., tn) A.ct. where A.ct is the type of some class.

    There are also special cases for so-called "class-types", cf. Typeclass and Ctype.set_object_name:

    Tobject (Tfield(_,_,...(Tfield(_,_,rv)...), + Some(`A.#ct`, [rv;t1;...;tn]) ==> (t1, ..., tn) #A.ct Tobject (_, Some(`A.#ct`, [Tnil;t1;...;tn]) ==> (t1, ..., tn) A.ct

    where rv is the hidden row variable.

    *)
  6. | Tfield of string * field_kind * type_expr * type_expr
    (*

    Tfield ("foo", field_public, t, ts) ==> <...; foo : t; ts>

    *)
  7. | Tnil
    (*

    Tnil ==> <...; >

    *)
  8. | Tsubst of type_expr * type_expr option
    (*

    Tsubst is used temporarily to store information in low-level functions manipulating representation of types, such as instantiation or copy. The first argument contains a copy of the original node. The second is available only when the first is the row variable of a polymorphic variant. It then contains a copy of the whole variant. This constructor should not appear outside of these cases.

    *)
  9. | Tvariant of row_desc
    (*

    Representation of polymorphic variants, see row_desc.

    *)
  10. | Tunivar of string option
    (*

    Occurrence of a type variable introduced by a forall quantifier / Tpoly.

    *)
  11. | Tpoly of type_expr * type_expr list
    (*

    Tpoly (ty,tyl) ==> 'a1... 'an. ty, where 'a1 ... 'an are names given to types in tyl and occurrences of those types in ty.

    *)
  12. | Tpackage of Path.t * (Longident.t * type_expr) list
    (*

    Type of a first-class module (a.k.a package).

    *)
and fixed_explanation =
  1. | Univar of type_expr
    (*

    The row type was bound to an univar

    *)
  2. | Fixed_private
    (*

    The row type is private

    *)
  3. | Reified of Path.t
    (*

    The row was reified

    *)
  4. | Rigid
    (*

    The row type was made rigid during constraint verification

    *)
and abbrev_memo =
  1. | Mnil
    (*

    No known abbreviation

    *)
  2. | Mcons of Asttypes.private_flag * Path.t * type_expr * type_expr * abbrev_memo
    (*

    Found one abbreviation. A valid abbreviation should be at least as visible and reachable by the same path. The first expression is the abbreviation and the second the expansion.

    *)

abbrev_memo allows one to keep track of different expansions of a type alias. This is done for performance purposes.

For instance, when defining type 'a pair = 'a * 'a, when one refers to an 'a pair, it is just a shortcut for the 'a * 'a type. This expansion will be stored in the abbrev_memo of the corresponding Tconstr node.

In practice, abbrev_memo behaves like list of expansions with a mutable tail.

Note on marshalling: abbrev_memo must not appear in saved types. Btype, with cleanup_abbrev and memo, takes care of tracking and removing abbreviations.

commutable is a flag appended to every arrow type.

When typing an application, if the type of the functional is known, its type is instantiated with commu_ok arrows, otherwise as commu_var ().

When the type is not known, the application will be used to infer the actual type. This is fragile in presence of labels where there is no principal type.

Two incompatible applications must rely on is_commu_ok arrows, otherwise they will trigger an error.

let f g = g ~a:() ~b:(); g ~b:() ~a:();

Error: This function is applied to arguments in an order different from other calls. This is only allowed when the real type is known.

val is_commu_ok : commutable -> bool
val commu_ok : commutable
val commu_var : unit -> commutable

field_kind indicates the accessibility of a method.

An Fprivate field may become Fpublic or Fabsent during unification, but not the other way round.

The same field_kind is kept shared when copying Tfield nodes so that the copies of the self-type of a class share the same accessibility (see also PR#10539).

type field_kind_view =
  1. | Fprivate
  2. | Fpublic
  3. | Fabsent
val field_kind_repr : field_kind -> field_kind_view
val field_public : field_kind
val field_absent : field_kind
val field_private : unit -> field_kind
val field_kind_internal_repr : field_kind -> field_kind

Getters for type_expr; calls repr before answering a value

val get_desc : type_expr -> type_desc
val get_level : type_expr -> int
val get_scope : type_expr -> int
val get_id : type_expr -> int
type transient_expr = private {
  1. mutable desc : type_desc;
  2. mutable level : int;
  3. mutable scope : int;
  4. id : int;
}

Transient type_expr. Should only be used immediately after Transient_expr.repr

module Transient_expr : sig ... end

Operations on transient_expr

val create_expr : type_desc -> level:int -> scope:int -> id:int -> type_expr

Functions and definitions moved from Btype

val newty3 : level:int -> scope:int -> type_desc -> type_expr

Create a type with a fresh id

val newty2 : level:int -> type_desc -> type_expr

Create a type with a fresh id and no scope

module TransientTypeOps : sig ... end

Comparisons for functors

Comparisons for type_expr; cannot be used for functors

val eq_type : type_expr -> type_expr -> bool
val compare_type : type_expr -> type_expr -> int

Constructor and accessors for row_desc

`X | `Y (row_closed = true) < `X | `Y (row_closed = true) > `X | `Y (row_closed = false) < `X | `Y > `X (row_closed = true)

type t = > `X as 'a (row_more = Tvar a) type t = private > `X (row_more = Tconstr ("t#row", , ref Mnil))

And for:

let f = function `X -> `X -> | `Y -> `X

the type of "f" will be a Tarrow whose lhs will (basically) be:

Tvariant row_fields = [("X", _)]; + row_more = + Tvariant { row_fields = [("Y", _)]; + row_more = + Tvariant { row_fields = []; + row_more = _; + _ ; _

}

; _

}

val create_row : + fields:(Asttypes.label * row_field) list -> + more:type_expr -> + closed:bool -> + fixed:fixed_explanation option -> + name:(Path.t * type_expr list) option -> + row_desc
val row_fields : row_desc -> (Asttypes.label * row_field) list
val row_more : row_desc -> type_expr
val row_closed : row_desc -> bool
val row_fixed : row_desc -> fixed_explanation option
val row_name : row_desc -> (Path.t * type_expr list) option
val set_row_name : row_desc -> (Path.t * type_expr list) option -> row_desc
val get_row_field : Asttypes.label -> row_desc -> row_field
type row_desc_repr =
  1. | Row of {
    1. fields : (Asttypes.label * row_field) list;
    2. more : type_expr;
    3. closed : bool;
    4. fixed : fixed_explanation option;
    5. name : (Path.t * type_expr list) option;
    }

get all fields at once; different from the old row_repr

val row_repr : row_desc -> row_desc_repr
type row_field_view =
  1. | Rpresent of type_expr option
  2. | Reither of bool * type_expr list * bool
  3. | Rabsent

Current contents of a row field

val row_field_repr : row_field -> row_field_view
val rf_present : type_expr option -> row_field
val rf_absent : row_field
val rf_either : + ?use_ext_of:row_field -> + no_arg:bool -> + type_expr list -> + matched:bool -> + row_field
val rf_either_of : type_expr option -> row_field
val eq_row_field_ext : row_field -> row_field -> bool
val changed_row_field_exts : row_field list -> (unit -> unit) -> bool
val match_row_field : + present:(type_expr option -> 'a) -> + absent:(unit -> 'a) -> + either:(bool -> type_expr list -> bool -> row_field option -> 'a) -> + row_field -> + 'a
module Uid = Shape.Uid
module MethSet : Set.S with type elt = string
module VarSet : Set.S with type elt = string
module Meths : Map.S with type key = string
module Vars : Map.S with type key = string
type value_description = {
  1. val_type : type_expr;
  2. val_kind : value_kind;
  3. val_loc : Location.t;
  4. val_attributes : Parsetree.attributes;
  5. val_uid : Uid.t;
}
and value_kind =
  1. | Val_reg
  2. | Val_prim of Primitive.description
  3. | Val_ivar of Asttypes.mutable_flag * string
  4. | Val_self of class_signature * self_meths * Ident.t Vars.t * string
  5. | Val_anc of class_signature * Ident.t Meths.t * string
and self_meths =
  1. | Self_concrete of Ident.t Meths.t
  2. | Self_virtual of Ident.t Meths.t ref
and class_signature = {
  1. csig_self : type_expr;
  2. mutable csig_self_row : type_expr;
  3. mutable csig_vars : (Asttypes.mutable_flag * Asttypes.virtual_flag * type_expr) + Vars.t;
  4. mutable csig_meths : (method_privacy * Asttypes.virtual_flag * type_expr) + Meths.t;
}
and method_privacy =
  1. | Mpublic
  2. | Mprivate of field_kind
module Variance : sig ... end
module Separability : sig ... end

see Typedecl_separability for an explanation of separability and separability modes.

type type_declaration = {
  1. type_params : type_expr list;
  2. type_arity : int;
  3. type_kind : type_decl_kind;
  4. type_private : Asttypes.private_flag;
  5. type_manifest : type_expr option;
  6. type_variance : Variance.t list;
  7. type_separability : Separability.t list;
  8. type_is_newtype : bool;
  9. type_expansion_scope : int;
  10. type_loc : Location.t;
  11. type_attributes : Parsetree.attributes;
  12. type_immediate : Type_immediacy.t;
  13. type_unboxed_default : bool;
  14. type_uid : Uid.t;
}
and ('lbl, 'cstr) type_kind =
  1. | Type_abstract
  2. | Type_record of 'lbl list * record_representation
  3. | Type_variant of 'cstr list * variant_representation
  4. | Type_open
and record_representation =
  1. | Record_regular
  2. | Record_float
  3. | Record_unboxed of bool
  4. | Record_inlined of int
  5. | Record_extension of Path.t
and variant_representation =
  1. | Variant_regular
  2. | Variant_unboxed
and label_declaration = {
  1. ld_id : Ident.t;
  2. ld_mutable : Asttypes.mutable_flag;
  3. ld_type : type_expr;
  4. ld_loc : Location.t;
  5. ld_attributes : Parsetree.attributes;
  6. ld_uid : Uid.t;
}
and constructor_declaration = {
  1. cd_id : Ident.t;
  2. cd_args : constructor_arguments;
  3. cd_res : type_expr option;
  4. cd_loc : Location.t;
  5. cd_attributes : Parsetree.attributes;
  6. cd_uid : Uid.t;
}
and constructor_arguments =
  1. | Cstr_tuple of type_expr list
  2. | Cstr_record of label_declaration list
type extension_constructor = {
  1. ext_type_path : Path.t;
  2. ext_type_params : type_expr list;
  3. ext_args : constructor_arguments;
  4. ext_ret_type : type_expr option;
  5. ext_private : Asttypes.private_flag;
  6. ext_loc : Location.t;
  7. ext_attributes : Parsetree.attributes;
  8. ext_uid : Uid.t;
}
and type_transparence =
  1. | Type_public
  2. | Type_new
  3. | Type_private
type class_type =
  1. | Cty_constr of Path.t * type_expr list * class_type
  2. | Cty_signature of class_signature
  3. | Cty_arrow of Asttypes.arg_label * type_expr * class_type
type class_declaration = {
  1. cty_params : type_expr list;
  2. mutable cty_type : class_type;
  3. cty_path : Path.t;
  4. cty_new : type_expr option;
  5. cty_variance : Variance.t list;
  6. cty_loc : Location.t;
  7. cty_attributes : Parsetree.attributes;
  8. cty_uid : Uid.t;
}
type class_type_declaration = {
  1. clty_params : type_expr list;
  2. clty_type : class_type;
  3. clty_path : Path.t;
  4. clty_hash_type : type_declaration;
  5. clty_variance : Variance.t list;
  6. clty_loc : Location.t;
  7. clty_attributes : Parsetree.attributes;
  8. clty_uid : Uid.t;
}
type visibility =
  1. | Exported
  2. | Hidden
type module_type =
  1. | Mty_ident of Path.t
  2. | Mty_signature of signature
  3. | Mty_functor of functor_parameter * module_type
  4. | Mty_alias of Path.t
and functor_parameter =
  1. | Unit
  2. | Named of Ident.t option * module_type
and module_presence =
  1. | Mp_present
  2. | Mp_absent
and signature = signature_item list
and module_declaration = {
  1. md_type : module_type;
  2. md_attributes : Parsetree.attributes;
  3. md_loc : Location.t;
  4. md_uid : Uid.t;
}
and modtype_declaration = {
  1. mtd_type : module_type option;
  2. mtd_attributes : Parsetree.attributes;
  3. mtd_loc : Location.t;
  4. mtd_uid : Uid.t;
}
and rec_status =
  1. | Trec_not
  2. | Trec_first
  3. | Trec_next
and ext_status =
  1. | Text_first
  2. | Text_next
  3. | Text_exception
val item_visibility : signature_item -> visibility
type constructor_description = {
  1. cstr_name : string;
  2. cstr_res : type_expr;
  3. cstr_existentials : type_expr list;
  4. cstr_args : type_expr list;
  5. cstr_arity : int;
  6. cstr_tag : constructor_tag;
  7. cstr_consts : int;
  8. cstr_nonconsts : int;
  9. cstr_generalized : bool;
  10. cstr_private : Asttypes.private_flag;
  11. cstr_loc : Location.t;
  12. cstr_attributes : Parsetree.attributes;
  13. cstr_inlined : type_declaration option;
  14. cstr_uid : Uid.t;
}
and constructor_tag =
  1. | Cstr_constant of int
  2. | Cstr_block of int
  3. | Cstr_unboxed
  4. | Cstr_extension of Path.t * bool
val equal_tag : constructor_tag -> constructor_tag -> bool
val may_equal_constr : + constructor_description -> + constructor_description -> + bool
type label_description = {
  1. lbl_name : string;
  2. lbl_res : type_expr;
  3. lbl_arg : type_expr;
  4. lbl_mut : Asttypes.mutable_flag;
  5. lbl_pos : int;
  6. lbl_all : label_description array;
  7. lbl_repres : record_representation;
  8. lbl_private : Asttypes.private_flag;
  9. lbl_loc : Location.t;
  10. lbl_attributes : Parsetree.attributes;
  11. lbl_uid : Uid.t;
}
val bound_value_identifiers : signature -> Ident.t list

Extracts the list of "value" identifiers bound by a signature. "Value" identifiers are identifiers for signature components that correspond to a run-time value: values, extensions, modules, classes. Note: manifest primitives do not correspond to a run-time value!

val signature_item_id : signature_item -> Ident.t
type snapshot
val snapshot : unit -> snapshot
val backtrack : cleanup_abbrev:(unit -> unit) -> snapshot -> unit
val undo_first_change_after : snapshot -> unit
val undo_compress : snapshot -> unit

Functions to use when modifying a type (only Ctype?). The old values are logged and reverted on backtracking.

val set_type_desc : type_expr -> type_desc -> unit
val set_level : type_expr -> int -> unit
val set_scope : type_expr -> int -> unit
val set_name : + (Path.t * type_expr list) option ref -> + (Path.t * type_expr list) option -> + unit
val set_univar : type_expr option ref -> type_expr -> unit
val set_commu_ok : commutable -> unit
diff --git a/ocaml/Typetexp/TyVarEnv/index.html b/ocaml/Typetexp/TyVarEnv/index.html new file mode 100644 index 00000000..fc4b8e25 --- /dev/null +++ b/ocaml/Typetexp/TyVarEnv/index.html @@ -0,0 +1,10 @@ + +TyVarEnv (ocaml.Typetexp.TyVarEnv)

Module Typetexp.TyVarEnv

val reset : unit -> unit

removes all type variables from scope

val with_local_scope : (unit -> 'a) -> 'a

Evaluate in a narrowed type-variable scope

type poly_univars
val make_poly_univars : string list -> poly_univars

remember that a list of strings connotes univars; this must always be paired with a check_poly_univars.

val check_poly_univars : + Env.t -> + Location.t -> + poly_univars -> + Types.type_expr list

Verify that the given univars are universally quantified, and return the list of variables. The type in which the univars are used must be generalised

val instance_poly_univars : + Env.t -> + Location.t -> + poly_univars -> + Types.type_expr list

Same as check_poly_univars, but instantiates the resulting type scheme (i.e. variables become Tvar rather than Tunivar)

diff --git a/ocaml/Typetexp/index.html b/ocaml/Typetexp/index.html new file mode 100644 index 00000000..9644d122 --- /dev/null +++ b/ocaml/Typetexp/index.html @@ -0,0 +1,15 @@ + +Typetexp (ocaml.Typetexp)

Module Typetexp

module TyVarEnv : sig ... end
val valid_tyvar_name : string -> bool
val transl_simple_type : + Env.t -> + ?univars:TyVarEnv.poly_univars -> + closed:bool -> + Parsetree.core_type -> + Typedtree.core_type
val transl_simple_type_univars : + Env.t -> + Parsetree.core_type -> + Typedtree.core_type
val transl_simple_type_delayed : + Env.t -> + Parsetree.core_type -> + Typedtree.core_type * Types.type_expr * (unit -> unit)
val transl_type_scheme : Env.t -> Parsetree.core_type -> Typedtree.core_type
val transl_type_param : Env.t -> Parsetree.core_type -> Typedtree.core_type
exception Already_bound
type error =
  1. | Unbound_type_variable of string * string list
  2. | No_type_wildcards
  3. | Undefined_type_constructor of Path.t
  4. | Type_arity_mismatch of Longident.t * int * int
  5. | Bound_type_variable of string
  6. | Recursive_type
  7. | Unbound_row_variable of Longident.t
  8. | Type_mismatch of Errortrace.unification_error
  9. | Alias_type_mismatch of Errortrace.unification_error
  10. | Present_has_conjunction of string
  11. | Present_has_no_type of string
  12. | Constructor_mismatch of Types.type_expr * Types.type_expr
  13. | Not_a_variant of Types.type_expr
  14. | Variant_tags of string * string
  15. | Invalid_variable_name of string
  16. | Cannot_quantify of string * Types.type_expr
  17. | Multiple_constraints_on_type of Longident.t
  18. | Method_mismatch of string * Types.type_expr * Types.type_expr
  19. | Opened_object of Path.t option
  20. | Not_an_object of Types.type_expr
exception Error of Location.t * Env.t * error
val report_error : Env.t -> Stdlib.Format.formatter -> error -> unit
val transl_modtype_longident : + (Location.t -> Env.t -> Longident.t -> Path.t) ref
val transl_modtype : + (Env.t -> Parsetree.module_type -> Typedtree.module_type) ref
diff --git a/ocaml/Un_anf/index.html b/ocaml/Un_anf/index.html new file mode 100644 index 00000000..7a286c92 --- /dev/null +++ b/ocaml/Un_anf/index.html @@ -0,0 +1,6 @@ + +Un_anf (ocaml.Un_anf)

Module Un_anf

val apply : + what:Symbol.t -> + ppf_dump:Stdlib.Format.formatter -> + Clambda.ulambda -> + Clambda.ulambda

Expand ANF-like constructs so that pattern matches in Cmmgen will work correctly.

diff --git a/ocaml/Unbox_closures/index.html b/ocaml/Unbox_closures/index.html new file mode 100644 index 00000000..0a65efb5 --- /dev/null +++ b/ocaml/Unbox_closures/index.html @@ -0,0 +1,11 @@ + +Unbox_closures (ocaml.Unbox_closures)

Module Unbox_closures

Turn free variables of closures into specialised arguments. The aim is to cause the closure to become closed.

val rewrite_set_of_closures : + env:Inline_and_simplify_aux.Env.t -> + duplicate_function: + (env:Inline_and_simplify_aux.Env.t -> + set_of_closures:Flambda.set_of_closures -> + fun_var:Variable.t -> + new_fun_var:Variable.t -> + Flambda.function_declaration * Flambda.specialised_to Variable.Map.t) -> + set_of_closures:Flambda.set_of_closures -> + (Flambda.expr * Inlining_cost.Benefit.t) option
diff --git a/ocaml/Unbox_free_vars_of_closures/index.html b/ocaml/Unbox_free_vars_of_closures/index.html new file mode 100644 index 00000000..e53675d8 --- /dev/null +++ b/ocaml/Unbox_free_vars_of_closures/index.html @@ -0,0 +1,5 @@ + +Unbox_free_vars_of_closures (ocaml.Unbox_free_vars_of_closures)

Module Unbox_free_vars_of_closures

When approximations of free variables of closures indicate that they are closures or blocks, rewrite projections from such blocks to new variables (which become free in the closures), with the defining expressions of the projections lifted out of the corresponding sets of closures.

diff --git a/ocaml/Unbox_specialised_args/index.html b/ocaml/Unbox_specialised_args/index.html new file mode 100644 index 00000000..9fe75035 --- /dev/null +++ b/ocaml/Unbox_specialised_args/index.html @@ -0,0 +1,11 @@ + +Unbox_specialised_args (ocaml.Unbox_specialised_args)

Module Unbox_specialised_args

When approximations of specialised arguments indicate that they are closures or blocks, add more specialised arguments corresponding to the projections from such blocks (with definitions of such projections lifted out), such that the original specialised arguments may later be eliminated.

This in particular enables elimination of closure allocations in examples such as:

let rec map f = function | -> | a::l -> let r = f a in r :: map f l

let g x = map (fun y -> x + y) 1; 2; 3; 4

Here, the specialised version of map initially has a specialised argument f; and upon inlining there will be a projection of x from the closure of f. This pass adds a new specialised argument to carry that projection, at which point the closure of f is redundant.

val rewrite_set_of_closures : + env:Inline_and_simplify_aux.Env.t -> + duplicate_function: + (env:Inline_and_simplify_aux.Env.t -> + set_of_closures:Flambda.set_of_closures -> + fun_var:Variable.t -> + new_fun_var:Variable.t -> + Flambda.function_declaration * Flambda.specialised_to Variable.Map.t) -> + set_of_closures:Flambda.set_of_closures -> + (Flambda.expr * Inlining_cost.Benefit.t) option
diff --git a/ocaml/Unix/LargeFile/index.html b/ocaml/Unix/LargeFile/index.html new file mode 100644 index 00000000..3e928dde --- /dev/null +++ b/ocaml/Unix/LargeFile/index.html @@ -0,0 +1,2 @@ + +LargeFile (ocaml.Unix.LargeFile)

Module Unix.LargeFile

File operations on large files. This sub-module provides 64-bit variants of the functions lseek (for positioning a file descriptor), truncate and ftruncate (for changing the size of a file), and stat, lstat and fstat (for obtaining information on files). These alternate functions represent positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), thus allowing operating on files whose sizes are greater than max_int.

val lseek : file_descr -> int64 -> seek_command -> int64

See lseek.

val truncate : string -> int64 -> unit

See truncate.

val ftruncate : file_descr -> int64 -> unit

See ftruncate.

type stats = {
  1. st_dev : int;
    (*

    Device number

    *)
  2. st_ino : int;
    (*

    Inode number

    *)
  3. st_kind : file_kind;
    (*

    Kind of the file

    *)
  4. st_perm : file_perm;
    (*

    Access rights

    *)
  5. st_uid : int;
    (*

    User id of the owner

    *)
  6. st_gid : int;
    (*

    Group ID of the file's group

    *)
  7. st_rdev : int;
    (*

    Device ID (if special file)

    *)
  8. st_size : int64;
    (*

    Size in bytes

    *)
  9. st_atime : float;
    (*

    Last access time

    *)
  10. st_mtime : float;
    (*

    Last modification time

    *)
  11. st_ctime : float;
    (*

    Last status change time

    *)
}
val stat : string -> stats
val lstat : string -> stats
val fstat : file_descr -> stats
diff --git a/ocaml/Unix/index.html b/ocaml/Unix/index.html new file mode 100644 index 00000000..8ff1f7f4 --- /dev/null +++ b/ocaml/Unix/index.html @@ -0,0 +1,68 @@ + +Unix (ocaml.Unix)

Module Unix

Interface to the Unix system.

To use the labeled version of this module, add module Unix = UnixLabels in your implementation.

Note: all the functions of this module (except error_message and handle_unix_error) are liable to raise the Unix_error exception whenever the underlying system call signals an error.

Error report

type error =
  1. | E2BIG
    (*

    Argument list too long

    *)
  2. | EACCES
    (*

    Permission denied

    *)
  3. | EAGAIN
    (*

    Resource temporarily unavailable; try again

    *)
  4. | EBADF
    (*

    Bad file descriptor

    *)
  5. | EBUSY
    (*

    Resource unavailable

    *)
  6. | ECHILD
    (*

    No child process

    *)
  7. | EDEADLK
    (*

    Resource deadlock would occur

    *)
  8. | EDOM
    (*

    Domain error for math functions, etc.

    *)
  9. | EEXIST
    (*

    File exists

    *)
  10. | EFAULT
    (*

    Bad address

    *)
  11. | EFBIG
    (*

    File too large

    *)
  12. | EINTR
    (*

    Function interrupted by signal

    *)
  13. | EINVAL
    (*

    Invalid argument

    *)
  14. | EIO
    (*

    Hardware I/O error

    *)
  15. | EISDIR
    (*

    Is a directory

    *)
  16. | EMFILE
    (*

    Too many open files by the process

    *)
  17. | ENAMETOOLONG
    (*

    Filename too long

    *)
  18. | ENFILE
    (*

    Too many open files in the system

    *)
  19. | ENODEV
    (*

    No such device

    *)
  20. | ENOENT
    (*

    No such file or directory

    *)
  21. | ENOEXEC
    (*

    Not an executable file

    *)
  22. | ENOLCK
    (*

    No locks available

    *)
  23. | ENOMEM
    (*

    Not enough memory

    *)
  24. | ENOSPC
    (*

    No space left on device

    *)
  25. | ENOSYS
    (*

    Function not supported

    *)
  26. | ENOTDIR
    (*

    Not a directory

    *)
  27. | ENOTEMPTY
    (*

    Directory not empty

    *)
  28. | ENOTTY
    (*

    Inappropriate I/O control operation

    *)
  29. | ENXIO
    (*

    No such device or address

    *)
  30. | EPERM
    (*

    Operation not permitted

    *)
  31. | EPIPE
    (*

    Broken pipe

    *)
  32. | ERANGE
    (*

    Result too large

    *)
  33. | EROFS
    (*

    Read-only file system

    *)
  34. | ESPIPE
    (*

    Invalid seek e.g. on a pipe

    *)
  35. | ESRCH
    (*

    No such process

    *)
  36. | EXDEV
    (*

    Invalid link

    *)
  37. | EWOULDBLOCK
    (*

    Operation would block

    *)
  38. | EINPROGRESS
    (*

    Operation now in progress

    *)
  39. | EALREADY
    (*

    Operation already in progress

    *)
  40. | ENOTSOCK
    (*

    Socket operation on non-socket

    *)
  41. | EDESTADDRREQ
    (*

    Destination address required

    *)
  42. | EMSGSIZE
    (*

    Message too long

    *)
  43. | EPROTOTYPE
    (*

    Protocol wrong type for socket

    *)
  44. | ENOPROTOOPT
    (*

    Protocol not available

    *)
  45. | EPROTONOSUPPORT
    (*

    Protocol not supported

    *)
  46. | ESOCKTNOSUPPORT
    (*

    Socket type not supported

    *)
  47. | EOPNOTSUPP
    (*

    Operation not supported on socket

    *)
  48. | EPFNOSUPPORT
    (*

    Protocol family not supported

    *)
  49. | EAFNOSUPPORT
    (*

    Address family not supported by protocol family

    *)
  50. | EADDRINUSE
    (*

    Address already in use

    *)
  51. | EADDRNOTAVAIL
    (*

    Can't assign requested address

    *)
  52. | ENETDOWN
    (*

    Network is down

    *)
  53. | ENETUNREACH
    (*

    Network is unreachable

    *)
  54. | ENETRESET
    (*

    Network dropped connection on reset

    *)
  55. | ECONNABORTED
    (*

    Software caused connection abort

    *)
  56. | ECONNRESET
    (*

    Connection reset by peer

    *)
  57. | ENOBUFS
    (*

    No buffer space available

    *)
  58. | EISCONN
    (*

    Socket is already connected

    *)
  59. | ENOTCONN
    (*

    Socket is not connected

    *)
  60. | ESHUTDOWN
    (*

    Can't send after socket shutdown

    *)
  61. | ETOOMANYREFS
    (*

    Too many references: can't splice

    *)
  62. | ETIMEDOUT
    (*

    Connection timed out

    *)
  63. | ECONNREFUSED
    (*

    Connection refused

    *)
  64. | EHOSTDOWN
    (*

    Host is down

    *)
  65. | EHOSTUNREACH
    (*

    No route to host

    *)
  66. | ELOOP
    (*

    Too many levels of symbolic links

    *)
  67. | EOVERFLOW
    (*

    File size or position not representable

    *)
  68. | EUNKNOWNERR of int
    (*

    Unknown error

    *)

The type of error codes. Errors defined in the POSIX standard and additional errors from UNIX98 and BSD. All other errors are mapped to EUNKNOWNERR.

exception Unix_error of error * string * string

Raised by the system calls below when an error is encountered. The first component is the error code; the second component is the function name; the third component is the string parameter to the function, if it has one, or the empty string otherwise.

UnixLabels.Unix_error and Unix.Unix_error are the same, and catching one will catch the other.

val error_message : error -> string

Return a string describing the given error code.

val handle_unix_error : ('a -> 'b) -> 'a -> 'b

handle_unix_error f x applies f to x and returns the result. If the exception Unix_error is raised, it prints a message describing the error and exits with code 2.

Access to the process environment

val environment : unit -> string array

Return the process environment, as an array of strings with the format ``variable=value''. The returned array is empty if the process has special privileges.

val unsafe_environment : unit -> string array

Return the process environment, as an array of strings with the format ``variable=value''. Unlike environment, this function returns a populated array even if the process has special privileges. See the documentation for unsafe_getenv for more details.

  • since 4.06 (4.12 in UnixLabels)
val getenv : string -> string

Return the value associated to a variable in the process environment, unless the process has special privileges.

  • raises Not_found

    if the variable is unbound or the process has special privileges.

    This function is identical to Sys.getenv.

val unsafe_getenv : string -> string

Return the value associated to a variable in the process environment.

Unlike getenv, this function returns the value even if the process has special privileges. It is considered unsafe because the programmer of a setuid or setgid program must be careful to avoid using maliciously crafted environment variables in the search path for executables, the locations for temporary files or logs, and the like.

  • raises Not_found

    if the variable is unbound.

  • since 4.06
val putenv : string -> string -> unit

putenv name value sets the value associated to a variable in the process environment. name is the name of the environment variable, and value its new associated value.

Process handling

type process_status =
  1. | WEXITED of int
    (*

    The process terminated normally by exit; the argument is the return code.

    *)
  2. | WSIGNALED of int
    (*

    The process was killed by a signal; the argument is the signal number.

    *)
  3. | WSTOPPED of int
    (*

    The process was stopped by a signal; the argument is the signal number.

    *)

The termination status of a process. See module Sys for the definitions of the standard signal numbers. Note that they are not the numbers used by the OS.

On Windows: only WEXITED is used (as there are no inter-process signals) but with specific return codes to indicate special termination causes. Look for NTSTATUS values in the Windows documentation to decode such error return codes. In particular, STATUS_ACCESS_VIOLATION error code is the 32-bit 0xC0000005: as Int32.of_int 0xC0000005 is -1073741819, WEXITED -1073741819 is the Windows equivalent of WSIGNALED Sys.sigsegv.

type wait_flag =
  1. | WNOHANG
    (*

    Do not block if no child has died yet, but immediately return with a pid equal to 0.

    *)
  2. | WUNTRACED
    (*

    Report also the children that receive stop signals.

    *)

Flags for waitpid.

val execv : string -> string array -> 'a

execv prog args execute the program in file prog, with the arguments args, and the current process environment. These execv* functions never return: on success, the current program is replaced by the new one.

On Windows: the CRT simply spawns a new process and exits the current one. This will have unwanted consequences if e.g. another process is waiting on the current one. Using create_process or one of the open_process_* functions instead is recommended.

val execve : string -> string array -> string array -> 'a

Same as execv, except that the third argument provides the environment to the program executed.

val execvp : string -> string array -> 'a

Same as execv, except that the program is searched in the path.

val execvpe : string -> string array -> string array -> 'a

Same as execve, except that the program is searched in the path.

val fork : unit -> int

Fork a new process. The returned integer is 0 for the child process, the pid of the child process for the parent process.

  • raises Invalid_argument

    on Windows. Use create_process or threads instead.

val wait : unit -> int * process_status

Wait until one of the children processes die, and return its pid and termination status.

  • raises Invalid_argument

    on Windows. Use waitpid instead.

val waitpid : wait_flag list -> int -> int * process_status

Same as wait, but waits for the child process whose pid is given. A pid of -1 means wait for any child. A pid of 0 means wait for any child in the same process group as the current process. Negative pid arguments represent process groups. The list of options indicates whether waitpid should return immediately without waiting, and whether it should report stopped children.

On Windows: can only wait for a given PID, not any child process.

val system : string -> process_status

Execute the given command, wait until it terminates, and return its termination status. The string is interpreted by the shell /bin/sh (or the command interpreter cmd.exe on Windows) and therefore can contain redirections, quotes, variables, etc. To properly quote whitespace and shell special characters occurring in file names or command arguments, the use of Filename.quote_command is recommended. The result WEXITED 127 indicates that the shell couldn't be executed.

val _exit : int -> 'a

Terminate the calling process immediately, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. Unlike Stdlib.exit, Unix._exit performs no finalization whatsoever: functions registered with Stdlib.at_exit are not called, input/output channels are not flushed, and the C run-time system is not finalized either.

The typical use of Unix._exit is after a Unix.fork operation, when the child process runs into a fatal error and must exit. In this case, it is preferable to not perform any finalization action in the child process, as these actions could interfere with similar actions performed by the parent process. For example, output channels should not be flushed by the child process, as the parent process may flush them again later, resulting in duplicate output.

  • since 4.12
val getpid : unit -> int

Return the pid of the process.

val getppid : unit -> int

Return the pid of the parent process.

  • raises Invalid_argument

    on Windows (because it is meaningless)

val nice : int -> int

Change the process priority. The integer argument is added to the ``nice'' value. (Higher values of the ``nice'' value mean lower priorities.) Return the new nice value.

  • raises Invalid_argument

    on Windows

Basic file input/output

type file_descr

The abstract type of file descriptors.

val stdin : file_descr

File descriptor for standard input.

val stdout : file_descr

File descriptor for standard output.

val stderr : file_descr

File descriptor for standard error.

type open_flag =
  1. | O_RDONLY
    (*

    Open for reading

    *)
  2. | O_WRONLY
    (*

    Open for writing

    *)
  3. | O_RDWR
    (*

    Open for reading and writing

    *)
  4. | O_NONBLOCK
    (*

    Open in non-blocking mode

    *)
  5. | O_APPEND
    (*

    Open for append

    *)
  6. | O_CREAT
    (*

    Create if nonexistent

    *)
  7. | O_TRUNC
    (*

    Truncate to 0 length if existing

    *)
  8. | O_EXCL
    (*

    Fail if existing

    *)
  9. | O_NOCTTY
    (*

    Don't make this dev a controlling tty

    *)
  10. | O_DSYNC
    (*

    Writes complete as `Synchronised I/O data integrity completion'

    *)
  11. | O_SYNC
    (*

    Writes complete as `Synchronised I/O file integrity completion'

    *)
  12. | O_RSYNC
    (*

    Reads complete as writes (depending on O_SYNC/O_DSYNC)

    *)
  13. | O_SHARE_DELETE
    (*

    Windows only: allow the file to be deleted while still open

    *)
  14. | O_CLOEXEC
    (*

    Set the close-on-exec flag on the descriptor returned by openfile. See set_close_on_exec for more information.

    *)
  15. | O_KEEPEXEC
    (*

    Clear the close-on-exec flag. This is currently the default.

    *)

The flags to openfile.

type file_perm = int

The type of file access rights, e.g. 0o640 is read and write for user, read for group, none for others

val openfile : string -> open_flag list -> file_perm -> file_descr

Open the named file with the given flags. Third argument is the permissions to give to the file if it is created (see umask). Return a file descriptor on the named file.

val close : file_descr -> unit

Close a file descriptor.

val fsync : file_descr -> unit

Flush file buffers to disk.

  • since 4.08 (4.12 in UnixLabels)
val read : file_descr -> bytes -> int -> int -> int

read fd buf pos len reads len bytes from descriptor fd, storing them in byte sequence buf, starting at position pos in buf. Return the number of bytes actually read.

val write : file_descr -> bytes -> int -> int -> int

write fd buf pos len writes len bytes to descriptor fd, taking them from byte sequence buf, starting at position pos in buff. Return the number of bytes actually written. write repeats the writing operation until all bytes have been written or an error occurs.

val single_write : file_descr -> bytes -> int -> int -> int

Same as write, but attempts to write only once. Thus, if an error occurs, single_write guarantees that no data has been written.

val write_substring : file_descr -> string -> int -> int -> int

Same as write, but take the data from a string instead of a byte sequence.

  • since 4.02
val single_write_substring : file_descr -> string -> int -> int -> int

Same as single_write, but take the data from a string instead of a byte sequence.

  • since 4.02

Interfacing with the standard input/output library

val in_channel_of_descr : file_descr -> in_channel

Create an input channel reading from the given descriptor. The channel is initially in binary mode; use set_binary_mode_in ic false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

On Windows: Stdlib.set_binary_mode_in always fails on channels created with this function.

Beware that input channels are buffered, so more characters may have been read from the descriptor than those accessed using channel functions. Channels also keep a copy of the current position in the file.

Closing the channel ic returned by in_channel_of_descr fd using close_in ic also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

If several channels are created on the same descriptor, one of the channels must be closed, but not the others. Consider for example a descriptor s connected to a socket and two channels ic = in_channel_of_descr s and oc = out_channel_of_descr s. The recommended closing protocol is to perform close_out oc, which flushes buffered output to the socket then closes the socket. The ic channel must not be closed and will be collected by the GC eventually.

val out_channel_of_descr : file_descr -> out_channel

Create an output channel writing on the given descriptor. The channel is initially in binary mode; use set_binary_mode_out oc false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

On Windows: Stdlib.set_binary_mode_out always fails on channels created with this function.

Beware that output channels are buffered, so you may have to call Stdlib.flush to ensure that all data has been sent to the descriptor. Channels also keep a copy of the current position in the file.

Closing the channel oc returned by out_channel_of_descr fd using close_out oc also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

See Unix.in_channel_of_descr for a discussion of the closing protocol when several channels are created on the same descriptor.

val descr_of_in_channel : in_channel -> file_descr

Return the descriptor corresponding to an input channel.

val descr_of_out_channel : out_channel -> file_descr

Return the descriptor corresponding to an output channel.

Seeking and truncating

type seek_command =
  1. | SEEK_SET
    (*

    indicates positions relative to the beginning of the file

    *)
  2. | SEEK_CUR
    (*

    indicates positions relative to the current position

    *)
  3. | SEEK_END
    (*

    indicates positions relative to the end of the file

    *)

Positioning modes for lseek.

val lseek : file_descr -> int -> seek_command -> int

Set the current position for a file descriptor, and return the resulting offset (from the beginning of the file).

val truncate : string -> int -> unit

Truncates the named file to the given size.

val ftruncate : file_descr -> int -> unit

Truncates the file corresponding to the given descriptor to the given size.

File status

type file_kind =
  1. | S_REG
    (*

    Regular file

    *)
  2. | S_DIR
    (*

    Directory

    *)
  3. | S_CHR
    (*

    Character device

    *)
  4. | S_BLK
    (*

    Block device

    *)
  5. | S_LNK
    (*

    Symbolic link

    *)
  6. | S_FIFO
    (*

    Named pipe

    *)
  7. | S_SOCK
    (*

    Socket

    *)
type stats = {
  1. st_dev : int;
    (*

    Device number

    *)
  2. st_ino : int;
    (*

    Inode number

    *)
  3. st_kind : file_kind;
    (*

    Kind of the file

    *)
  4. st_perm : file_perm;
    (*

    Access rights

    *)
  5. st_uid : int;
    (*

    User id of the owner

    *)
  6. st_gid : int;
    (*

    Group ID of the file's group

    *)
  7. st_rdev : int;
    (*

    Device ID (if special file)

    *)
  8. st_size : int;
    (*

    Size in bytes

    *)
  9. st_atime : float;
    (*

    Last access time

    *)
  10. st_mtime : float;
    (*

    Last modification time

    *)
  11. st_ctime : float;
    (*

    Last status change time

    *)
}

The information returned by the stat calls.

val stat : string -> stats

Return the information for the named file.

val lstat : string -> stats

Same as stat, but in case the file is a symbolic link, return the information for the link itself.

val fstat : file_descr -> stats

Return the information for the file associated with the given descriptor.

val isatty : file_descr -> bool

Return true if the given file descriptor refers to a terminal or console window, false otherwise.

File operations on large files

module LargeFile : sig ... end

File operations on large files. This sub-module provides 64-bit variants of the functions lseek (for positioning a file descriptor), truncate and ftruncate (for changing the size of a file), and stat, lstat and fstat (for obtaining information on files). These alternate functions represent positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), thus allowing operating on files whose sizes are greater than max_int.

Mapping files into memory

val map_file : + file_descr -> + ?pos:int64 -> + ('a, 'b) Stdlib.Bigarray.kind -> + 'c Stdlib.Bigarray.layout -> + bool -> + int array -> + ('a, 'b, 'c) Stdlib.Bigarray.Genarray.t

Memory mapping of a file as a Bigarray. map_file fd kind layout shared dims returns a Bigarray of kind kind, layout layout, and dimensions as specified in dims. The data contained in this Bigarray are the contents of the file referred to by the file descriptor fd (as opened previously with openfile, for example). The optional pos parameter is the byte offset in the file of the data being mapped; it defaults to 0 (map from the beginning of the file).

If shared is true, all modifications performed on the array are reflected in the file. This requires that fd be opened with write permissions. If shared is false, modifications performed on the array are done in memory only, using copy-on-write of the modified pages; the underlying file is not affected.

map_file is much more efficient than reading the whole file in a Bigarray, modifying that Bigarray, and writing it afterwards.

To adjust automatically the dimensions of the Bigarray to the actual size of the file, the major dimension (that is, the first dimension for an array with C layout, and the last dimension for an array with Fortran layout) can be given as -1. map_file then determines the major dimension from the size of the file. The file must contain an integral number of sub-arrays as determined by the non-major dimensions, otherwise Failure is raised.

If all dimensions of the Bigarray are given, the file size is matched against the size of the Bigarray. If the file is larger than the Bigarray, only the initial portion of the file is mapped to the Bigarray. If the file is smaller than the big array, the file is automatically grown to the size of the Bigarray. This requires write permissions on fd.

Array accesses are bounds-checked, but the bounds are determined by the initial call to map_file. Therefore, you should make sure no other process modifies the mapped file while you're accessing it, or a SIGBUS signal may be raised. This happens, for instance, if the file is shrunk.

Invalid_argument or Failure may be raised in cases where argument validation fails.

  • since 4.06

Operations on file names

Removes the named file.

If the named file is a directory, raises:

  • EPERM on POSIX compliant system
  • EISDIR on Linux >= 2.1.132
  • EACCESS on Windows
val rename : string -> string -> unit

rename src dst changes the name of a file from src to dst, moving it between directories if needed. If dst already exists, its contents will be replaced with those of src. Depending on the operating system, the metadata (permissions, owner, etc) of dst can either be preserved or be replaced by those of src.

link ?follow src dst creates a hard link named dst to the file named src.

  • parameter follow

    indicates whether a src symlink is followed or a hardlink to src itself will be created. On Unix systems this is done using the linkat(2) function. If ?follow is not provided, then the link(2) function is used whose behaviour is OS-dependent, but more widely available.

  • raises ENOSYS

    On Unix if ~follow:_ is requested, but linkat is unavailable.

  • raises ENOSYS

    On Windows if ~follow:false is requested.

val realpath : string -> string

realpath p is an absolute pathname for p obtained by resolving all extra / characters, relative path segments and symbolic links.

  • since 4.13

File permissions and ownership

type access_permission =
  1. | R_OK
    (*

    Read permission

    *)
  2. | W_OK
    (*

    Write permission

    *)
  3. | X_OK
    (*

    Execution permission

    *)
  4. | F_OK
    (*

    File exists

    *)

Flags for the access call.

val chmod : string -> file_perm -> unit

Change the permissions of the named file.

val fchmod : file_descr -> file_perm -> unit

Change the permissions of an opened file.

  • raises Invalid_argument

    on Windows

val chown : string -> int -> int -> unit

Change the owner uid and owner gid of the named file.

  • raises Invalid_argument

    on Windows

val fchown : file_descr -> int -> int -> unit

Change the owner uid and owner gid of an opened file.

  • raises Invalid_argument

    on Windows

val umask : file_perm -> file_perm

Set the process's file mode creation mask, and return the previous mask.

  • raises Invalid_argument

    on Windows

val access : string -> access_permission list -> unit

Check that the process has the given permissions over the named file.

On Windows: execute permission X_OK cannot be tested, just tests for read permission instead.

Operations on file descriptors

val dup : ?cloexec:bool -> file_descr -> file_descr

Return a new file descriptor referencing the same file as the given descriptor. See set_close_on_exec for documentation on the cloexec optional argument.

val dup2 : ?cloexec:bool -> file_descr -> file_descr -> unit

dup2 src dst duplicates src to dst, closing dst if already opened. See set_close_on_exec for documentation on the cloexec optional argument.

val set_nonblock : file_descr -> unit

Set the ``non-blocking'' flag on the given descriptor. When the non-blocking flag is set, reading on a descriptor on which there is temporarily no data available raises the EAGAIN or EWOULDBLOCK error instead of blocking; writing on a descriptor on which there is temporarily no room for writing also raises EAGAIN or EWOULDBLOCK.

val clear_nonblock : file_descr -> unit

Clear the ``non-blocking'' flag on the given descriptor. See set_nonblock.

val set_close_on_exec : file_descr -> unit

Set the ``close-on-exec'' flag on the given descriptor. A descriptor with the close-on-exec flag is automatically closed when the current process starts another program with one of the exec, create_process and open_process functions.

It is often a security hole to leak file descriptors opened on, say, a private file to an external program: the program, then, gets access to the private file and can do bad things with it. Hence, it is highly recommended to set all file descriptors ``close-on-exec'', except in the very few cases where a file descriptor actually needs to be transmitted to another program.

The best way to set a file descriptor ``close-on-exec'' is to create it in this state. To this end, the openfile function has O_CLOEXEC and O_KEEPEXEC flags to enforce ``close-on-exec'' mode or ``keep-on-exec'' mode, respectively. All other operations in the Unix module that create file descriptors have an optional argument ?cloexec:bool to indicate whether the file descriptor should be created in ``close-on-exec'' mode (by writing ~cloexec:true) or in ``keep-on-exec'' mode (by writing ~cloexec:false). For historical reasons, the default file descriptor creation mode is ``keep-on-exec'', if no cloexec optional argument is given. This is not a safe default, hence it is highly recommended to pass explicit cloexec arguments to operations that create file descriptors.

The cloexec optional arguments and the O_KEEPEXEC flag were introduced in OCaml 4.05. Earlier, the common practice was to create file descriptors in the default, ``keep-on-exec'' mode, then call set_close_on_exec on those freshly-created file descriptors. This is not as safe as creating the file descriptor in ``close-on-exec'' mode because, in multithreaded programs, a window of vulnerability exists between the time when the file descriptor is created and the time set_close_on_exec completes. If another thread spawns another program during this window, the descriptor will leak, as it is still in the ``keep-on-exec'' mode.

Regarding the atomicity guarantees given by ~cloexec:true or by the use of the O_CLOEXEC flag: on all platforms it is guaranteed that a concurrently-executing Caml thread cannot leak the descriptor by starting a new process. On Linux, this guarantee extends to concurrently-executing C threads. As of Feb 2017, other operating systems lack the necessary system calls and still expose a window of vulnerability during which a C thread can see the newly-created file descriptor in ``keep-on-exec'' mode.

val clear_close_on_exec : file_descr -> unit

Clear the ``close-on-exec'' flag on the given descriptor. See set_close_on_exec.

Directories

val mkdir : string -> file_perm -> unit

Create a directory with the given permissions (see umask).

val rmdir : string -> unit

Remove an empty directory.

val chdir : string -> unit

Change the process working directory.

val getcwd : unit -> string

Return the name of the current working directory.

val chroot : string -> unit

Change the process root directory.

  • raises Invalid_argument

    on Windows

type dir_handle

The type of descriptors over opened directories.

val opendir : string -> dir_handle

Open a descriptor on a directory

val readdir : dir_handle -> string

Return the next entry in a directory.

  • raises End_of_file

    when the end of the directory has been reached.

val rewinddir : dir_handle -> unit

Reposition the descriptor to the beginning of the directory

val closedir : dir_handle -> unit

Close a directory descriptor.

Pipes and redirections

val pipe : ?cloexec:bool -> unit -> file_descr * file_descr

Create a pipe. The first component of the result is opened for reading, that's the exit to the pipe. The second component is opened for writing, that's the entrance to the pipe. See set_close_on_exec for documentation on the cloexec optional argument.

val mkfifo : string -> file_perm -> unit

Create a named pipe with the given permissions (see umask).

  • raises Invalid_argument

    on Windows

High-level process and redirection management

val create_process : + string -> + string array -> + file_descr -> + file_descr -> + file_descr -> + int

create_process prog args stdin stdout stderr creates a new process that executes the program in file prog, with arguments args. The pid of the new process is returned immediately; the new process executes concurrently with the current process. The standard input and outputs of the new process are connected to the descriptors stdin, stdout and stderr. Passing e.g. Unix.stdout for stdout prevents the redirection and causes the new process to have the same standard output as the current process. The executable file prog is searched in the path. The new process has the same environment as the current process.

val create_process_env : + string -> + string array -> + string array -> + file_descr -> + file_descr -> + file_descr -> + int

create_process_env prog args env stdin stdout stderr works as create_process, except that the extra argument env specifies the environment passed to the program.

val open_process_in : string -> in_channel

High-level pipe and process management. This function runs the given command in parallel with the program. The standard output of the command is redirected to a pipe, which can be read via the returned input channel. The command is interpreted by the shell /bin/sh (or cmd.exe on Windows), cf. system. The Filename.quote_command function can be used to quote the command and its arguments as appropriate for the shell being used. If the command does not need to be run through the shell, open_process_args_in can be used as a more robust and more efficient alternative to open_process_in.

val open_process_out : string -> out_channel

Same as open_process_in, but redirect the standard input of the command to a pipe. Data written to the returned output channel is sent to the standard input of the command. Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization. If the command does not need to be run through the shell, open_process_args_out can be used instead of open_process_out.

val open_process : string -> in_channel * out_channel

Same as open_process_out, but redirects both the standard input and standard output of the command to pipes connected to the two returned channels. The input channel is connected to the output of the command, and the output channel to the input of the command. If the command does not need to be run through the shell, open_process_args can be used instead of open_process.

val open_process_full : + string -> + string array -> + in_channel * out_channel * in_channel

Similar to open_process, but the second argument specifies the environment passed to the command. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the command. If the command does not need to be run through the shell, open_process_args_full can be used instead of open_process_full.

val open_process_args : string -> string array -> in_channel * out_channel

open_process_args prog args runs the program prog with arguments args. Note that the first argument is by convention the filename of the program being executed, just like Sys.argv.(0). The new process executes concurrently with the current process. The standard input and output of the new process are redirected to pipes, which can be respectively read and written via the returned channels. The input channel is connected to the output of the program, and the output channel to the input of the program.

Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization.

The executable file prog is searched for in the path. This behaviour changed in 4.12; previously prog was looked up only in the current directory.

The new process has the same environment as the current process.

  • since 4.08
val open_process_args_in : string -> string array -> in_channel

Same as open_process_args, but redirects only the standard output of the new process.

  • since 4.08
val open_process_args_out : string -> string array -> out_channel

Same as open_process_args, but redirects only the standard input of the new process.

  • since 4.08
val open_process_args_full : + string -> + string array -> + string array -> + in_channel * out_channel * in_channel

Similar to open_process_args, but the third argument specifies the environment passed to the new process. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the program.

  • since 4.08
val process_in_pid : in_channel -> int

Return the pid of a process opened via open_process_in or open_process_args_in.

  • since 4.08 (4.12 in UnixLabels)
val process_out_pid : out_channel -> int

Return the pid of a process opened via open_process_out or open_process_args_out.

  • since 4.08 (4.12 in UnixLabels)
val process_pid : (in_channel * out_channel) -> int

Return the pid of a process opened via open_process or open_process_args.

  • since 4.08 (4.12 in UnixLabels)
val process_full_pid : (in_channel * out_channel * in_channel) -> int

Return the pid of a process opened via open_process_full or open_process_args_full.

  • since 4.08 (4.12 in UnixLabels)
val close_process_in : in_channel -> process_status

Close channels opened by open_process_in, wait for the associated command to terminate, and return its termination status.

val close_process_out : out_channel -> process_status

Close channels opened by open_process_out, wait for the associated command to terminate, and return its termination status.

val close_process : (in_channel * out_channel) -> process_status

Close channels opened by open_process, wait for the associated command to terminate, and return its termination status.

val close_process_full : + (in_channel * out_channel * in_channel) -> + process_status

Close channels opened by open_process_full, wait for the associated command to terminate, and return its termination status.

symlink ?to_dir src dst creates the file dst as a symbolic link to the file src. On Windows, ~to_dir indicates if the symbolic link points to a directory or a file; if omitted, symlink examines src using stat and picks appropriately, if src does not exist then false is assumed (for this reason, it is recommended that the ~to_dir parameter be specified in new code). On Unix, ~to_dir is ignored.

Windows symbolic links are available in Windows Vista onwards. There are some important differences between Windows symlinks and their POSIX counterparts.

Windows symbolic links come in two flavours: directory and regular, which designate whether the symbolic link points to a directory or a file. The type must be correct - a directory symlink which actually points to a file cannot be selected with chdir and a file symlink which actually points to a directory cannot be read or written (note that Cygwin's emulation layer ignores this distinction).

When symbolic links are created to existing targets, this distinction doesn't matter and symlink will automatically create the correct kind of symbolic link. The distinction matters when a symbolic link is created to a non-existent target.

The other caveat is that by default symbolic links are a privileged operation. Administrators will always need to be running elevated (or with UAC disabled) and by default normal user accounts need to be granted the SeCreateSymbolicLinkPrivilege via Local Security Policy (secpol.msc) or via Active Directory.

has_symlink can be used to check that a process is able to create symbolic links.

Returns true if the user is able to create symbolic links. On Windows, this indicates that the user not only has the SeCreateSymbolicLinkPrivilege but is also running elevated, if necessary. On other platforms, this is simply indicates that the symlink system call is available.

  • since 4.03

Read the contents of a symbolic link.

Polling

val select : + file_descr list -> + file_descr list -> + file_descr list -> + float -> + file_descr list * file_descr list * file_descr list

Wait until some input/output operations become possible on some channels. The three list arguments are, respectively, a set of descriptors to check for reading (first argument), for writing (second argument), or for exceptional conditions (third argument). The fourth argument is the maximal timeout, in seconds; a negative fourth argument means no timeout (unbounded wait). The result is composed of three sets of descriptors: those ready for reading (first component), ready for writing (second component), and over which an exceptional condition is pending (third component).

Locking

type lock_command =
  1. | F_ULOCK
    (*

    Unlock a region

    *)
  2. | F_LOCK
    (*

    Lock a region for writing, and block if already locked

    *)
  3. | F_TLOCK
    (*

    Lock a region for writing, or fail if already locked

    *)
  4. | F_TEST
    (*

    Test a region for other process locks

    *)
  5. | F_RLOCK
    (*

    Lock a region for reading, and block if already locked

    *)
  6. | F_TRLOCK
    (*

    Lock a region for reading, or fail if already locked

    *)

Commands for lockf.

val lockf : file_descr -> lock_command -> int -> unit

lockf fd mode len puts a lock on a region of the file opened as fd. The region starts at the current read/write position for fd (as set by lseek), and extends len bytes forward if len is positive, len bytes backwards if len is negative, or to the end of the file if len is zero. A write lock prevents any other process from acquiring a read or write lock on the region. A read lock prevents any other process from acquiring a write lock on the region, but lets other processes acquire read locks on it.

The F_LOCK and F_TLOCK commands attempts to put a write lock on the specified region. The F_RLOCK and F_TRLOCK commands attempts to put a read lock on the specified region. If one or several locks put by another process prevent the current process from acquiring the lock, F_LOCK and F_RLOCK block until these locks are removed, while F_TLOCK and F_TRLOCK fail immediately with an exception. The F_ULOCK removes whatever locks the current process has on the specified region. Finally, the F_TEST command tests whether a write lock can be acquired on the specified region, without actually putting a lock. It returns immediately if successful, or fails otherwise.

What happens when a process tries to lock a region of a file that is already locked by the same process depends on the OS. On POSIX-compliant systems, the second lock operation succeeds and may "promote" the older lock from read lock to write lock. On Windows, the second lock operation will block or fail.

Signals

Note: installation of signal handlers is performed via the functions Sys.signal and Sys.set_signal.

val kill : int -> int -> unit

kill pid signal sends signal number signal to the process with id pid.

On Windows: only the Sys.sigkill signal is emulated.

type sigprocmask_command =
  1. | SIG_SETMASK
  2. | SIG_BLOCK
  3. | SIG_UNBLOCK
val sigprocmask : sigprocmask_command -> int list -> int list

sigprocmask mode sigs changes the set of blocked signals. If mode is SIG_SETMASK, blocked signals are set to those in the list sigs. If mode is SIG_BLOCK, the signals in sigs are added to the set of blocked signals. If mode is SIG_UNBLOCK, the signals in sigs are removed from the set of blocked signals. sigprocmask returns the set of previously blocked signals.

When the systhreads version of the Thread module is loaded, this function redirects to Thread.sigmask. I.e., sigprocmask only changes the mask of the current thread.

  • raises Invalid_argument

    on Windows (no inter-process signals on Windows)

val sigpending : unit -> int list

Return the set of blocked signals that are currently pending.

  • raises Invalid_argument

    on Windows (no inter-process signals on Windows)

val sigsuspend : int list -> unit

sigsuspend sigs atomically sets the blocked signals to sigs and waits for a non-ignored, non-blocked signal to be delivered. On return, the blocked signals are reset to their initial value.

  • raises Invalid_argument

    on Windows (no inter-process signals on Windows)

val pause : unit -> unit

Wait until a non-ignored, non-blocked signal is delivered.

  • raises Invalid_argument

    on Windows (no inter-process signals on Windows)

Time functions

type process_times = {
  1. tms_utime : float;
    (*

    User time for the process

    *)
  2. tms_stime : float;
    (*

    System time for the process

    *)
  3. tms_cutime : float;
    (*

    User time for the children processes

    *)
  4. tms_cstime : float;
    (*

    System time for the children processes

    *)
}

The execution times (CPU times) of a process.

type tm = {
  1. tm_sec : int;
    (*

    Seconds 0..60

    *)
  2. tm_min : int;
    (*

    Minutes 0..59

    *)
  3. tm_hour : int;
    (*

    Hours 0..23

    *)
  4. tm_mday : int;
    (*

    Day of month 1..31

    *)
  5. tm_mon : int;
    (*

    Month of year 0..11

    *)
  6. tm_year : int;
    (*

    Year - 1900

    *)
  7. tm_wday : int;
    (*

    Day of week (Sunday is 0)

    *)
  8. tm_yday : int;
    (*

    Day of year 0..365

    *)
  9. tm_isdst : bool;
    (*

    Daylight time savings in effect

    *)
}

The type representing wallclock time and calendar date.

val time : unit -> float

Return the current time since 00:00:00 GMT, Jan. 1, 1970, in seconds.

val gettimeofday : unit -> float

Same as time, but with resolution better than 1 second.

val gmtime : float -> tm

Convert a time in seconds, as returned by time, into a date and a time. Assumes UTC (Coordinated Universal Time), also known as GMT. To perform the inverse conversion, set the TZ environment variable to "UTC", use mktime, and then restore the original value of TZ.

val localtime : float -> tm

Convert a time in seconds, as returned by time, into a date and a time. Assumes the local time zone. The function performing the inverse conversion is mktime.

val mktime : tm -> float * tm

Convert a date and time, specified by the tm argument, into a time in seconds, as returned by time. The tm_isdst, tm_wday and tm_yday fields of tm are ignored. Also return a normalized copy of the given tm record, with the tm_wday, tm_yday, and tm_isdst fields recomputed from the other fields, and the other fields normalized (so that, e.g., 40 October is changed into 9 November). The tm argument is interpreted in the local time zone.

val alarm : int -> int

Schedule a SIGALRM signal after the given number of seconds.

  • raises Invalid_argument

    on Windows

val sleep : int -> unit

Stop execution for the given number of seconds.

val sleepf : float -> unit

Stop execution for the given number of seconds. Like sleep, but fractions of seconds are supported.

  • since 4.03 (4.12 in UnixLabels)
val times : unit -> process_times

Return the execution times of the process.

On Windows: partially implemented, will not report timings for child processes.

val utimes : string -> float -> float -> unit

Set the last access time (second arg) and last modification time (third arg) for a file. Times are expressed in seconds from 00:00:00 GMT, Jan. 1, 1970. If both times are 0.0, the access and last modification times are both set to the current time.

type interval_timer =
  1. | ITIMER_REAL
    (*

    decrements in real time, and sends the signal SIGALRM when expired.

    *)
  2. | ITIMER_VIRTUAL
    (*

    decrements in process virtual time, and sends SIGVTALRM when expired.

    *)
  3. | ITIMER_PROF
    (*

    (for profiling) decrements both when the process is running and when the system is running on behalf of the process; it sends SIGPROF when expired.

    *)

The three kinds of interval timers.

type interval_timer_status = {
  1. it_interval : float;
    (*

    Period

    *)
  2. it_value : float;
    (*

    Current value of the timer

    *)
}

The type describing the status of an interval timer

Return the current status of the given interval timer.

  • raises Invalid_argument

    on Windows

setitimer t s sets the interval timer t and returns its previous status. The s argument is interpreted as follows: s.it_value, if nonzero, is the time to the next timer expiration; s.it_interval, if nonzero, specifies a value to be used in reloading it_value when the timer expires. Setting s.it_value to zero disables the timer. Setting s.it_interval to zero causes the timer to be disabled after its next expiration.

  • raises Invalid_argument

    on Windows

User id, group id

val getuid : unit -> int

Return the user id of the user executing the process.

On Windows: always returns 1.

val geteuid : unit -> int

Return the effective user id under which the process runs.

On Windows: always returns 1.

val setuid : int -> unit

Set the real user id and effective user id for the process.

  • raises Invalid_argument

    on Windows

val getgid : unit -> int

Return the group id of the user executing the process.

On Windows: always returns 1.

val getegid : unit -> int

Return the effective group id under which the process runs.

On Windows: always returns 1.

val setgid : int -> unit

Set the real group id and effective group id for the process.

  • raises Invalid_argument

    on Windows

val getgroups : unit -> int array

Return the list of groups to which the user executing the process belongs.

On Windows: always returns [|1|].

val setgroups : int array -> unit

setgroups groups sets the supplementary group IDs for the calling process. Appropriate privileges are required.

  • raises Invalid_argument

    on Windows

val initgroups : string -> int -> unit

initgroups user group initializes the group access list by reading the group database /etc/group and using all groups of which user is a member. The additional group group is also added to the list.

  • raises Invalid_argument

    on Windows

type passwd_entry = {
  1. pw_name : string;
  2. pw_passwd : string;
  3. pw_uid : int;
  4. pw_gid : int;
  5. pw_gecos : string;
  6. pw_dir : string;
  7. pw_shell : string;
}

Structure of entries in the passwd database.

type group_entry = {
  1. gr_name : string;
  2. gr_passwd : string;
  3. gr_gid : int;
  4. gr_mem : string array;
}

Structure of entries in the groups database.

val getlogin : unit -> string

Return the login name of the user executing the process.

val getpwnam : string -> passwd_entry

Find an entry in passwd with the given name.

  • raises Not_found

    if no such entry exists, or always on Windows.

val getgrnam : string -> group_entry

Find an entry in group with the given name.

  • raises Not_found

    if no such entry exists, or always on Windows.

val getpwuid : int -> passwd_entry

Find an entry in passwd with the given user id.

  • raises Not_found

    if no such entry exists, or always on Windows.

val getgrgid : int -> group_entry

Find an entry in group with the given group id.

  • raises Not_found

    if no such entry exists, or always on Windows.

Internet addresses

type inet_addr

The abstract type of Internet addresses.

val inet_addr_of_string : string -> inet_addr

Conversion from the printable representation of an Internet address to its internal representation. The argument string consists of 4 numbers separated by periods (XXX.YYY.ZZZ.TTT) for IPv4 addresses, and up to 8 numbers separated by colons for IPv6 addresses.

  • raises Failure

    when given a string that does not match these formats.

val string_of_inet_addr : inet_addr -> string

Return the printable representation of the given Internet address. See inet_addr_of_string for a description of the printable representation.

val inet_addr_any : inet_addr

A special IPv4 address, for use only with bind, representing all the Internet addresses that the host machine possesses.

val inet_addr_loopback : inet_addr

A special IPv4 address representing the host machine (127.0.0.1).

val inet6_addr_any : inet_addr

A special IPv6 address, for use only with bind, representing all the Internet addresses that the host machine possesses.

val inet6_addr_loopback : inet_addr

A special IPv6 address representing the host machine (::1).

val is_inet6_addr : inet_addr -> bool

Whether the given inet_addr is an IPv6 address.

  • since 4.12

Sockets

type socket_domain =
  1. | PF_UNIX
    (*

    Unix domain

    *)
  2. | PF_INET
    (*

    Internet domain (IPv4)

    *)
  3. | PF_INET6
    (*

    Internet domain (IPv6)

    *)

The type of socket domains. Not all platforms support IPv6 sockets (type PF_INET6).

On Windows: PF_UNIX supported since 4.14.0 on Windows 10 1803 and later.

type socket_type =
  1. | SOCK_STREAM
    (*

    Stream socket

    *)
  2. | SOCK_DGRAM
    (*

    Datagram socket

    *)
  3. | SOCK_RAW
    (*

    Raw socket

    *)
  4. | SOCK_SEQPACKET
    (*

    Sequenced packets socket

    *)

The type of socket kinds, specifying the semantics of communications. SOCK_SEQPACKET is included for completeness, but is rarely supported by the OS, and needs system calls that are not available in this library.

type sockaddr =
  1. | ADDR_UNIX of string
  2. | ADDR_INET of inet_addr * int

The type of socket addresses. ADDR_UNIX name is a socket address in the Unix domain; name is a file name in the file system. ADDR_INET(addr,port) is a socket address in the Internet domain; addr is the Internet address of the machine, and port is the port number.

val socket : ?cloexec:bool -> socket_domain -> socket_type -> int -> file_descr

Create a new socket in the given domain, and with the given kind. The third argument is the protocol type; 0 selects the default protocol for that kind of sockets. See set_close_on_exec for documentation on the cloexec optional argument.

val domain_of_sockaddr : sockaddr -> socket_domain

Return the socket domain adequate for the given socket address.

val socketpair : + ?cloexec:bool -> + socket_domain -> + socket_type -> + int -> + file_descr * file_descr

Create a pair of unnamed sockets, connected together. See set_close_on_exec for documentation on the cloexec optional argument.

val accept : ?cloexec:bool -> file_descr -> file_descr * sockaddr

Accept connections on the given socket. The returned descriptor is a socket connected to the client; the returned address is the address of the connecting client. See set_close_on_exec for documentation on the cloexec optional argument.

val bind : file_descr -> sockaddr -> unit

Bind a socket to an address.

val connect : file_descr -> sockaddr -> unit

Connect a socket to an address.

val listen : file_descr -> int -> unit

Set up a socket for receiving connection requests. The integer argument is the maximal number of pending requests.

type shutdown_command =
  1. | SHUTDOWN_RECEIVE
    (*

    Close for receiving

    *)
  2. | SHUTDOWN_SEND
    (*

    Close for sending

    *)
  3. | SHUTDOWN_ALL
    (*

    Close both

    *)

The type of commands for shutdown.

val shutdown : file_descr -> shutdown_command -> unit

Shutdown a socket connection. SHUTDOWN_SEND as second argument causes reads on the other end of the connection to return an end-of-file condition. SHUTDOWN_RECEIVE causes writes on the other end of the connection to return a closed pipe condition (SIGPIPE signal).

val getsockname : file_descr -> sockaddr

Return the address of the given socket.

val getpeername : file_descr -> sockaddr

Return the address of the host connected to the given socket.

type msg_flag =
  1. | MSG_OOB
  2. | MSG_DONTROUTE
  3. | MSG_PEEK

The flags for recv, recvfrom, send and sendto.

val recv : file_descr -> bytes -> int -> int -> msg_flag list -> int

Receive data from a connected socket.

val recvfrom : + file_descr -> + bytes -> + int -> + int -> + msg_flag list -> + int * sockaddr

Receive data from an unconnected socket.

val send : file_descr -> bytes -> int -> int -> msg_flag list -> int

Send data over a connected socket.

val send_substring : file_descr -> string -> int -> int -> msg_flag list -> int

Same as send, but take the data from a string instead of a byte sequence.

  • since 4.02
val sendto : + file_descr -> + bytes -> + int -> + int -> + msg_flag list -> + sockaddr -> + int

Send data over an unconnected socket.

val sendto_substring : + file_descr -> + string -> + int -> + int -> + msg_flag list -> + sockaddr -> + int

Same as sendto, but take the data from a string instead of a byte sequence.

  • since 4.02

Socket options

type socket_bool_option =
  1. | SO_DEBUG
    (*

    Record debugging information

    *)
  2. | SO_BROADCAST
    (*

    Permit sending of broadcast messages

    *)
  3. | SO_REUSEADDR
    (*

    Allow reuse of local addresses for bind

    *)
  4. | SO_KEEPALIVE
    (*

    Keep connection active

    *)
  5. | SO_DONTROUTE
    (*

    Bypass the standard routing algorithms

    *)
  6. | SO_OOBINLINE
    (*

    Leave out-of-band data in line

    *)
  7. | SO_ACCEPTCONN
    (*

    Report whether socket listening is enabled

    *)
  8. | TCP_NODELAY
    (*

    Control the Nagle algorithm for TCP sockets

    *)
  9. | IPV6_ONLY
    (*

    Forbid binding an IPv6 socket to an IPv4 address

    *)
  10. | SO_REUSEPORT
    (*

    Allow reuse of address and port bindings

    *)

The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

type socket_int_option =
  1. | SO_SNDBUF
    (*

    Size of send buffer

    *)
  2. | SO_RCVBUF
    (*

    Size of received buffer

    *)
  3. | SO_ERROR
    (*

    Deprecated. Use getsockopt_error instead.

    • deprecated Use Unix.getsockopt_error instead.
    *)
  4. | SO_TYPE
    (*

    Report the socket type

    *)
  5. | SO_RCVLOWAT
    (*

    Minimum number of bytes to process for input operations

    *)
  6. | SO_SNDLOWAT
    (*

    Minimum number of bytes to process for output operations

    *)

The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

type socket_optint_option =
  1. | SO_LINGER
    (*

    Whether to linger on closed connections that have data present, and for how long (in seconds)

    *)

The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

type socket_float_option =
  1. | SO_RCVTIMEO
    (*

    Timeout for input operations

    *)
  2. | SO_SNDTIMEO
    (*

    Timeout for output operations

    *)

The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

val getsockopt : file_descr -> socket_bool_option -> bool

Return the current status of a boolean-valued option in the given socket.

val setsockopt : file_descr -> socket_bool_option -> bool -> unit

Set or clear a boolean-valued option in the given socket.

val getsockopt_int : file_descr -> socket_int_option -> int

Same as getsockopt for an integer-valued socket option.

val setsockopt_int : file_descr -> socket_int_option -> int -> unit

Same as setsockopt for an integer-valued socket option.

val getsockopt_optint : file_descr -> socket_optint_option -> int option

Same as getsockopt for a socket option whose value is an int option.

val setsockopt_optint : + file_descr -> + socket_optint_option -> + int option -> + unit

Same as setsockopt for a socket option whose value is an int option.

val getsockopt_float : file_descr -> socket_float_option -> float

Same as getsockopt for a socket option whose value is a floating-point number.

val setsockopt_float : file_descr -> socket_float_option -> float -> unit

Same as setsockopt for a socket option whose value is a floating-point number.

val getsockopt_error : file_descr -> error option

Return the error condition associated with the given socket, and clear it.

High-level network connection functions

val open_connection : sockaddr -> in_channel * out_channel

Connect to a server at the given address. Return a pair of buffered channels connected to the server. Remember to call Stdlib.flush on the output channel at the right times to ensure correct synchronization.

The two channels returned by open_connection share a descriptor to a socket. Therefore, when the connection is over, you should call Stdlib.close_out on the output channel, which will also close the underlying socket. Do not call Stdlib.close_in on the input channel; it will be collected by the GC eventually.

val shutdown_connection : in_channel -> unit

``Shut down'' a connection established with open_connection; that is, transmit an end-of-file condition to the server reading on the other side of the connection. This does not close the socket and the channels used by the connection. See Unix.open_connection for how to close them once the connection is over.

val establish_server : (in_channel -> out_channel -> unit) -> sockaddr -> unit

Establish a server on the given address. The function given as first argument is called for each connection with two buffered channels connected to the client. A new process is created for each connection. The function establish_server never returns normally.

The two channels given to the function share a descriptor to a socket. The function does not need to close the channels, since this occurs automatically when the function returns. If the function prefers explicit closing, it should close the output channel using Stdlib.close_out and leave the input channel unclosed, for reasons explained in Unix.in_channel_of_descr.

  • raises Invalid_argument

    on Windows. Use threads instead.

Host and protocol databases

type host_entry = {
  1. h_name : string;
  2. h_aliases : string array;
  3. h_addrtype : socket_domain;
  4. h_addr_list : inet_addr array;
}

Structure of entries in the hosts database.

type protocol_entry = {
  1. p_name : string;
  2. p_aliases : string array;
  3. p_proto : int;
}

Structure of entries in the protocols database.

type service_entry = {
  1. s_name : string;
  2. s_aliases : string array;
  3. s_port : int;
  4. s_proto : string;
}

Structure of entries in the services database.

val gethostname : unit -> string

Return the name of the local host.

val gethostbyname : string -> host_entry

Find an entry in hosts with the given name.

  • raises Not_found

    if no such entry exists.

val gethostbyaddr : inet_addr -> host_entry

Find an entry in hosts with the given address.

  • raises Not_found

    if no such entry exists.

val getprotobyname : string -> protocol_entry

Find an entry in protocols with the given name.

  • raises Not_found

    if no such entry exists.

val getprotobynumber : int -> protocol_entry

Find an entry in protocols with the given protocol number.

  • raises Not_found

    if no such entry exists.

val getservbyname : string -> string -> service_entry

Find an entry in services with the given name.

  • raises Not_found

    if no such entry exists.

val getservbyport : int -> string -> service_entry

Find an entry in services with the given service number.

  • raises Not_found

    if no such entry exists.

type addr_info = {
  1. ai_family : socket_domain;
    (*

    Socket domain

    *)
  2. ai_socktype : socket_type;
    (*

    Socket type

    *)
  3. ai_protocol : int;
    (*

    Socket protocol number

    *)
  4. ai_addr : sockaddr;
    (*

    Address

    *)
  5. ai_canonname : string;
    (*

    Canonical host name

    *)
}

Address information returned by getaddrinfo.

type getaddrinfo_option =
  1. | AI_FAMILY of socket_domain
    (*

    Impose the given socket domain

    *)
  2. | AI_SOCKTYPE of socket_type
    (*

    Impose the given socket type

    *)
  3. | AI_PROTOCOL of int
    (*

    Impose the given protocol

    *)
  4. | AI_NUMERICHOST
    (*

    Do not call name resolver, expect numeric IP address

    *)
  5. | AI_CANONNAME
    (*

    Fill the ai_canonname field of the result

    *)
  6. | AI_PASSIVE
    (*

    Set address to ``any'' address for use with bind

    *)

Options to getaddrinfo.

val getaddrinfo : string -> string -> getaddrinfo_option list -> addr_info list

getaddrinfo host service opts returns a list of addr_info records describing socket parameters and addresses suitable for communicating with the given host and service. The empty list is returned if the host or service names are unknown, or the constraints expressed in opts cannot be satisfied.

host is either a host name or the string representation of an IP address. host can be given as the empty string; in this case, the ``any'' address or the ``loopback'' address are used, depending whether opts contains AI_PASSIVE. service is either a service name or the string representation of a port number. service can be given as the empty string; in this case, the port field of the returned addresses is set to 0. opts is a possibly empty list of options that allows the caller to force a particular socket domain (e.g. IPv6 only or IPv4 only) or a particular socket type (e.g. TCP only or UDP only).

type name_info = {
  1. ni_hostname : string;
    (*

    Name or IP address of host

    *)
  2. ni_service : string;
    (*

    Name of service or port number

    *)
}

Host and service information returned by getnameinfo.

type getnameinfo_option =
  1. | NI_NOFQDN
    (*

    Do not qualify local host names

    *)
  2. | NI_NUMERICHOST
    (*

    Always return host as IP address

    *)
  3. | NI_NAMEREQD
    (*

    Fail if host name cannot be determined

    *)
  4. | NI_NUMERICSERV
    (*

    Always return service as port number

    *)
  5. | NI_DGRAM
    (*

    Consider the service as UDP-based instead of the default TCP

    *)

Options to getnameinfo.

val getnameinfo : sockaddr -> getnameinfo_option list -> name_info

getnameinfo addr opts returns the host name and service name corresponding to the socket address addr. opts is a possibly empty list of options that governs how these names are obtained.

  • raises Not_found

    if an error occurs.

Terminal interface

The following functions implement the POSIX standard terminal interface. They provide control over asynchronous communication ports and pseudo-terminals. Refer to the termios man page for a complete description.

type terminal_io = {
  1. mutable c_ignbrk : bool;
    (*

    Ignore the break condition.

    *)
  2. mutable c_brkint : bool;
    (*

    Signal interrupt on break condition.

    *)
  3. mutable c_ignpar : bool;
    (*

    Ignore characters with parity errors.

    *)
  4. mutable c_parmrk : bool;
    (*

    Mark parity errors.

    *)
  5. mutable c_inpck : bool;
    (*

    Enable parity check on input.

    *)
  6. mutable c_istrip : bool;
    (*

    Strip 8th bit on input characters.

    *)
  7. mutable c_inlcr : bool;
    (*

    Map NL to CR on input.

    *)
  8. mutable c_igncr : bool;
    (*

    Ignore CR on input.

    *)
  9. mutable c_icrnl : bool;
    (*

    Map CR to NL on input.

    *)
  10. mutable c_ixon : bool;
    (*

    Recognize XON/XOFF characters on input.

    *)
  11. mutable c_ixoff : bool;
    (*

    Emit XON/XOFF chars to control input flow.

    *)
  12. mutable c_opost : bool;
    (*

    Enable output processing.

    *)
  13. mutable c_obaud : int;
    (*

    Output baud rate (0 means close connection).

    *)
  14. mutable c_ibaud : int;
    (*

    Input baud rate.

    *)
  15. mutable c_csize : int;
    (*

    Number of bits per character (5-8).

    *)
  16. mutable c_cstopb : int;
    (*

    Number of stop bits (1-2).

    *)
  17. mutable c_cread : bool;
    (*

    Reception is enabled.

    *)
  18. mutable c_parenb : bool;
    (*

    Enable parity generation and detection.

    *)
  19. mutable c_parodd : bool;
    (*

    Specify odd parity instead of even.

    *)
  20. mutable c_hupcl : bool;
    (*

    Hang up on last close.

    *)
  21. mutable c_clocal : bool;
    (*

    Ignore modem status lines.

    *)
  22. mutable c_isig : bool;
    (*

    Generate signal on INTR, QUIT, SUSP.

    *)
  23. mutable c_icanon : bool;
    (*

    Enable canonical processing (line buffering and editing)

    *)
  24. mutable c_noflsh : bool;
    (*

    Disable flush after INTR, QUIT, SUSP.

    *)
  25. mutable c_echo : bool;
    (*

    Echo input characters.

    *)
  26. mutable c_echoe : bool;
    (*

    Echo ERASE (to erase previous character).

    *)
  27. mutable c_echok : bool;
    (*

    Echo KILL (to erase the current line).

    *)
  28. mutable c_echonl : bool;
    (*

    Echo NL even if c_echo is not set.

    *)
  29. mutable c_vintr : char;
    (*

    Interrupt character (usually ctrl-C).

    *)
  30. mutable c_vquit : char;
    (*

    Quit character (usually ctrl-\).

    *)
  31. mutable c_verase : char;
    (*

    Erase character (usually DEL or ctrl-H).

    *)
  32. mutable c_vkill : char;
    (*

    Kill line character (usually ctrl-U).

    *)
  33. mutable c_veof : char;
    (*

    End-of-file character (usually ctrl-D).

    *)
  34. mutable c_veol : char;
    (*

    Alternate end-of-line char. (usually none).

    *)
  35. mutable c_vmin : int;
    (*

    Minimum number of characters to read before the read request is satisfied.

    *)
  36. mutable c_vtime : int;
    (*

    Maximum read wait (in 0.1s units).

    *)
  37. mutable c_vstart : char;
    (*

    Start character (usually ctrl-Q).

    *)
  38. mutable c_vstop : char;
    (*

    Stop character (usually ctrl-S).

    *)
}
val tcgetattr : file_descr -> terminal_io

Return the status of the terminal referred to by the given file descriptor.

  • raises Invalid_argument

    on Windows

type setattr_when =
  1. | TCSANOW
  2. | TCSADRAIN
  3. | TCSAFLUSH
val tcsetattr : file_descr -> setattr_when -> terminal_io -> unit

Set the status of the terminal referred to by the given file descriptor. The second argument indicates when the status change takes place: immediately (TCSANOW), when all pending output has been transmitted (TCSADRAIN), or after flushing all input that has been received but not read (TCSAFLUSH). TCSADRAIN is recommended when changing the output parameters; TCSAFLUSH, when changing the input parameters.

  • raises Invalid_argument

    on Windows

val tcsendbreak : file_descr -> int -> unit

Send a break condition on the given file descriptor. The second argument is the duration of the break, in 0.1s units; 0 means standard duration (0.25s).

  • raises Invalid_argument

    on Windows

val tcdrain : file_descr -> unit

Waits until all output written on the given file descriptor has been transmitted.

  • raises Invalid_argument

    on Windows

type flush_queue =
  1. | TCIFLUSH
  2. | TCOFLUSH
  3. | TCIOFLUSH
val tcflush : file_descr -> flush_queue -> unit

Discard data written on the given file descriptor but not yet transmitted, or data received but not yet read, depending on the second argument: TCIFLUSH flushes data received but not read, TCOFLUSH flushes data written but not transmitted, and TCIOFLUSH flushes both.

  • raises Invalid_argument

    on Windows

type flow_action =
  1. | TCOOFF
  2. | TCOON
  3. | TCIOFF
  4. | TCION
val tcflow : file_descr -> flow_action -> unit

Suspend or restart reception or transmission of data on the given file descriptor, depending on the second argument: TCOOFF suspends output, TCOON restarts output, TCIOFF transmits a STOP character to suspend input, and TCION transmits a START character to restart input.

  • raises Invalid_argument

    on Windows

val setsid : unit -> int

Put the calling process in a new session and detach it from its controlling terminal.

  • raises Invalid_argument

    on Windows

diff --git a/ocaml/UnixLabels/LargeFile/index.html b/ocaml/UnixLabels/LargeFile/index.html new file mode 100644 index 00000000..6f67959f --- /dev/null +++ b/ocaml/UnixLabels/LargeFile/index.html @@ -0,0 +1,2 @@ + +LargeFile (ocaml.UnixLabels.LargeFile)

Module UnixLabels.LargeFile

File operations on large files. This sub-module provides 64-bit variants of the functions lseek (for positioning a file descriptor), truncate and ftruncate (for changing the size of a file), and stat, lstat and fstat (for obtaining information on files). These alternate functions represent positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), thus allowing operating on files whose sizes are greater than max_int.

val lseek : file_descr -> int64 -> mode:seek_command -> int64

See lseek.

val truncate : string -> len:int64 -> unit

See truncate.

val ftruncate : file_descr -> len:int64 -> unit

See ftruncate.

type stats = Unix.LargeFile.stats = {
  1. st_dev : int;
    (*

    Device number

    *)
  2. st_ino : int;
    (*

    Inode number

    *)
  3. st_kind : file_kind;
    (*

    Kind of the file

    *)
  4. st_perm : file_perm;
    (*

    Access rights

    *)
  5. st_uid : int;
    (*

    User id of the owner

    *)
  6. st_gid : int;
    (*

    Group ID of the file's group

    *)
  7. st_rdev : int;
    (*

    Device ID (if special file)

    *)
  8. st_size : int64;
    (*

    Size in bytes

    *)
  9. st_atime : float;
    (*

    Last access time

    *)
  10. st_mtime : float;
    (*

    Last modification time

    *)
  11. st_ctime : float;
    (*

    Last status change time

    *)
}
val stat : string -> stats
val lstat : string -> stats
val fstat : file_descr -> stats
diff --git a/ocaml/UnixLabels/index.html b/ocaml/UnixLabels/index.html new file mode 100644 index 00000000..b7d0e59a --- /dev/null +++ b/ocaml/UnixLabels/index.html @@ -0,0 +1,99 @@ + +UnixLabels (ocaml.UnixLabels)

Module UnixLabels

Interface to the Unix system.

To use the labeled version of this module, add module Unix = UnixLabels in your implementation.

Note: all the functions of this module (except error_message and handle_unix_error) are liable to raise the Unix_error exception whenever the underlying system call signals an error.

Error report

type error = Unix.error =
  1. | E2BIG
    (*

    Argument list too long

    *)
  2. | EACCES
    (*

    Permission denied

    *)
  3. | EAGAIN
    (*

    Resource temporarily unavailable; try again

    *)
  4. | EBADF
    (*

    Bad file descriptor

    *)
  5. | EBUSY
    (*

    Resource unavailable

    *)
  6. | ECHILD
    (*

    No child process

    *)
  7. | EDEADLK
    (*

    Resource deadlock would occur

    *)
  8. | EDOM
    (*

    Domain error for math functions, etc.

    *)
  9. | EEXIST
    (*

    File exists

    *)
  10. | EFAULT
    (*

    Bad address

    *)
  11. | EFBIG
    (*

    File too large

    *)
  12. | EINTR
    (*

    Function interrupted by signal

    *)
  13. | EINVAL
    (*

    Invalid argument

    *)
  14. | EIO
    (*

    Hardware I/O error

    *)
  15. | EISDIR
    (*

    Is a directory

    *)
  16. | EMFILE
    (*

    Too many open files by the process

    *)
  17. | ENAMETOOLONG
    (*

    Filename too long

    *)
  18. | ENFILE
    (*

    Too many open files in the system

    *)
  19. | ENODEV
    (*

    No such device

    *)
  20. | ENOENT
    (*

    No such file or directory

    *)
  21. | ENOEXEC
    (*

    Not an executable file

    *)
  22. | ENOLCK
    (*

    No locks available

    *)
  23. | ENOMEM
    (*

    Not enough memory

    *)
  24. | ENOSPC
    (*

    No space left on device

    *)
  25. | ENOSYS
    (*

    Function not supported

    *)
  26. | ENOTDIR
    (*

    Not a directory

    *)
  27. | ENOTEMPTY
    (*

    Directory not empty

    *)
  28. | ENOTTY
    (*

    Inappropriate I/O control operation

    *)
  29. | ENXIO
    (*

    No such device or address

    *)
  30. | EPERM
    (*

    Operation not permitted

    *)
  31. | EPIPE
    (*

    Broken pipe

    *)
  32. | ERANGE
    (*

    Result too large

    *)
  33. | EROFS
    (*

    Read-only file system

    *)
  34. | ESPIPE
    (*

    Invalid seek e.g. on a pipe

    *)
  35. | ESRCH
    (*

    No such process

    *)
  36. | EXDEV
    (*

    Invalid link

    *)
  37. | EWOULDBLOCK
    (*

    Operation would block

    *)
  38. | EINPROGRESS
    (*

    Operation now in progress

    *)
  39. | EALREADY
    (*

    Operation already in progress

    *)
  40. | ENOTSOCK
    (*

    Socket operation on non-socket

    *)
  41. | EDESTADDRREQ
    (*

    Destination address required

    *)
  42. | EMSGSIZE
    (*

    Message too long

    *)
  43. | EPROTOTYPE
    (*

    Protocol wrong type for socket

    *)
  44. | ENOPROTOOPT
    (*

    Protocol not available

    *)
  45. | EPROTONOSUPPORT
    (*

    Protocol not supported

    *)
  46. | ESOCKTNOSUPPORT
    (*

    Socket type not supported

    *)
  47. | EOPNOTSUPP
    (*

    Operation not supported on socket

    *)
  48. | EPFNOSUPPORT
    (*

    Protocol family not supported

    *)
  49. | EAFNOSUPPORT
    (*

    Address family not supported by protocol family

    *)
  50. | EADDRINUSE
    (*

    Address already in use

    *)
  51. | EADDRNOTAVAIL
    (*

    Can't assign requested address

    *)
  52. | ENETDOWN
    (*

    Network is down

    *)
  53. | ENETUNREACH
    (*

    Network is unreachable

    *)
  54. | ENETRESET
    (*

    Network dropped connection on reset

    *)
  55. | ECONNABORTED
    (*

    Software caused connection abort

    *)
  56. | ECONNRESET
    (*

    Connection reset by peer

    *)
  57. | ENOBUFS
    (*

    No buffer space available

    *)
  58. | EISCONN
    (*

    Socket is already connected

    *)
  59. | ENOTCONN
    (*

    Socket is not connected

    *)
  60. | ESHUTDOWN
    (*

    Can't send after socket shutdown

    *)
  61. | ETOOMANYREFS
    (*

    Too many references: can't splice

    *)
  62. | ETIMEDOUT
    (*

    Connection timed out

    *)
  63. | ECONNREFUSED
    (*

    Connection refused

    *)
  64. | EHOSTDOWN
    (*

    Host is down

    *)
  65. | EHOSTUNREACH
    (*

    No route to host

    *)
  66. | ELOOP
    (*

    Too many levels of symbolic links

    *)
  67. | EOVERFLOW
    (*

    File size or position not representable

    *)
  68. | EUNKNOWNERR of int
    (*

    Unknown error

    *)

The type of error codes. Errors defined in the POSIX standard and additional errors from UNIX98 and BSD. All other errors are mapped to EUNKNOWNERR.

exception Unix_error of error * string * string

Raised by the system calls below when an error is encountered. The first component is the error code; the second component is the function name; the third component is the string parameter to the function, if it has one, or the empty string otherwise.

UnixLabels.Unix_error and Unix.Unix_error are the same, and catching one will catch the other.

val error_message : error -> string

Return a string describing the given error code.

val handle_unix_error : ('a -> 'b) -> 'a -> 'b

handle_unix_error f x applies f to x and returns the result. If the exception Unix_error is raised, it prints a message describing the error and exits with code 2.

Access to the process environment

val environment : unit -> string array

Return the process environment, as an array of strings with the format ``variable=value''. The returned array is empty if the process has special privileges.

val unsafe_environment : unit -> string array

Return the process environment, as an array of strings with the format ``variable=value''. Unlike environment, this function returns a populated array even if the process has special privileges. See the documentation for unsafe_getenv for more details.

  • since 4.12
val getenv : string -> string

Return the value associated to a variable in the process environment, unless the process has special privileges.

  • raises Not_found

    if the variable is unbound or the process has special privileges.

    This function is identical to Sys.getenv.

val unsafe_getenv : string -> string

Return the value associated to a variable in the process environment.

Unlike getenv, this function returns the value even if the process has special privileges. It is considered unsafe because the programmer of a setuid or setgid program must be careful to avoid using maliciously crafted environment variables in the search path for executables, the locations for temporary files or logs, and the like.

  • raises Not_found

    if the variable is unbound.

  • since 4.06
val putenv : string -> string -> unit

putenv name value sets the value associated to a variable in the process environment. name is the name of the environment variable, and value its new associated value.

Process handling

type process_status = Unix.process_status =
  1. | WEXITED of int
    (*

    The process terminated normally by exit; the argument is the return code.

    *)
  2. | WSIGNALED of int
    (*

    The process was killed by a signal; the argument is the signal number.

    *)
  3. | WSTOPPED of int
    (*

    The process was stopped by a signal; the argument is the signal number.

    *)

The termination status of a process. See module Sys for the definitions of the standard signal numbers. Note that they are not the numbers used by the OS.

On Windows: only WEXITED is used (as there are no inter-process signals) but with specific return codes to indicate special termination causes. Look for NTSTATUS values in the Windows documentation to decode such error return codes. In particular, STATUS_ACCESS_VIOLATION error code is the 32-bit 0xC0000005: as Int32.of_int 0xC0000005 is -1073741819, WEXITED -1073741819 is the Windows equivalent of WSIGNALED Sys.sigsegv.

type wait_flag = Unix.wait_flag =
  1. | WNOHANG
    (*

    Do not block if no child has died yet, but immediately return with a pid equal to 0.

    *)
  2. | WUNTRACED
    (*

    Report also the children that receive stop signals.

    *)

Flags for waitpid.

val execv : prog:string -> args:string array -> 'a

execv ~prog ~args execute the program in file prog, with the arguments args, and the current process environment. These execv* functions never return: on success, the current program is replaced by the new one.

On Windows: the CRT simply spawns a new process and exits the current one. This will have unwanted consequences if e.g. another process is waiting on the current one. Using create_process or one of the open_process_* functions instead is recommended.

val execve : prog:string -> args:string array -> env:string array -> 'a

Same as execv, except that the third argument provides the environment to the program executed.

val execvp : prog:string -> args:string array -> 'a

Same as execv, except that the program is searched in the path.

val execvpe : prog:string -> args:string array -> env:string array -> 'a

Same as execve, except that the program is searched in the path.

val fork : unit -> int

Fork a new process. The returned integer is 0 for the child process, the pid of the child process for the parent process.

  • raises Invalid_argument

    on Windows. Use create_process or threads instead.

val wait : unit -> int * process_status

Wait until one of the children processes die, and return its pid and termination status.

  • raises Invalid_argument

    on Windows. Use waitpid instead.

val waitpid : mode:wait_flag list -> int -> int * process_status

Same as wait, but waits for the child process whose pid is given. A pid of -1 means wait for any child. A pid of 0 means wait for any child in the same process group as the current process. Negative pid arguments represent process groups. The list of options indicates whether waitpid should return immediately without waiting, and whether it should report stopped children.

On Windows: can only wait for a given PID, not any child process.

val system : string -> process_status

Execute the given command, wait until it terminates, and return its termination status. The string is interpreted by the shell /bin/sh (or the command interpreter cmd.exe on Windows) and therefore can contain redirections, quotes, variables, etc. To properly quote whitespace and shell special characters occurring in file names or command arguments, the use of Filename.quote_command is recommended. The result WEXITED 127 indicates that the shell couldn't be executed.

val _exit : int -> 'a

Terminate the calling process immediately, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. Unlike Stdlib.exit, Unix._exit performs no finalization whatsoever: functions registered with Stdlib.at_exit are not called, input/output channels are not flushed, and the C run-time system is not finalized either.

The typical use of Unix._exit is after a Unix.fork operation, when the child process runs into a fatal error and must exit. In this case, it is preferable to not perform any finalization action in the child process, as these actions could interfere with similar actions performed by the parent process. For example, output channels should not be flushed by the child process, as the parent process may flush them again later, resulting in duplicate output.

  • since 4.12
val getpid : unit -> int

Return the pid of the process.

val getppid : unit -> int

Return the pid of the parent process.

  • raises Invalid_argument

    on Windows (because it is meaningless)

val nice : int -> int

Change the process priority. The integer argument is added to the ``nice'' value. (Higher values of the ``nice'' value mean lower priorities.) Return the new nice value.

  • raises Invalid_argument

    on Windows

Basic file input/output

type file_descr = Unix.file_descr

The abstract type of file descriptors.

val stdin : file_descr

File descriptor for standard input.

val stdout : file_descr

File descriptor for standard output.

val stderr : file_descr

File descriptor for standard error.

type open_flag = Unix.open_flag =
  1. | O_RDONLY
    (*

    Open for reading

    *)
  2. | O_WRONLY
    (*

    Open for writing

    *)
  3. | O_RDWR
    (*

    Open for reading and writing

    *)
  4. | O_NONBLOCK
    (*

    Open in non-blocking mode

    *)
  5. | O_APPEND
    (*

    Open for append

    *)
  6. | O_CREAT
    (*

    Create if nonexistent

    *)
  7. | O_TRUNC
    (*

    Truncate to 0 length if existing

    *)
  8. | O_EXCL
    (*

    Fail if existing

    *)
  9. | O_NOCTTY
    (*

    Don't make this dev a controlling tty

    *)
  10. | O_DSYNC
    (*

    Writes complete as `Synchronised I/O data integrity completion'

    *)
  11. | O_SYNC
    (*

    Writes complete as `Synchronised I/O file integrity completion'

    *)
  12. | O_RSYNC
    (*

    Reads complete as writes (depending on O_SYNC/O_DSYNC)

    *)
  13. | O_SHARE_DELETE
    (*

    Windows only: allow the file to be deleted while still open

    *)
  14. | O_CLOEXEC
    (*

    Set the close-on-exec flag on the descriptor returned by openfile. See set_close_on_exec for more information.

    *)
  15. | O_KEEPEXEC
    (*

    Clear the close-on-exec flag. This is currently the default.

    *)

The flags to openfile.

type file_perm = int

The type of file access rights, e.g. 0o640 is read and write for user, read for group, none for others

val openfile : string -> mode:open_flag list -> perm:file_perm -> file_descr

Open the named file with the given flags. Third argument is the permissions to give to the file if it is created (see umask). Return a file descriptor on the named file.

val close : file_descr -> unit

Close a file descriptor.

val fsync : file_descr -> unit

Flush file buffers to disk.

  • since 4.12
val read : file_descr -> buf:bytes -> pos:int -> len:int -> int

read fd ~buf ~pos ~len reads len bytes from descriptor fd, storing them in byte sequence buf, starting at position pos in buf. Return the number of bytes actually read.

val write : file_descr -> buf:bytes -> pos:int -> len:int -> int

write fd ~buf ~pos ~len writes len bytes to descriptor fd, taking them from byte sequence buf, starting at position pos in buff. Return the number of bytes actually written. write repeats the writing operation until all bytes have been written or an error occurs.

val single_write : file_descr -> buf:bytes -> pos:int -> len:int -> int

Same as write, but attempts to write only once. Thus, if an error occurs, single_write guarantees that no data has been written.

val write_substring : file_descr -> buf:string -> pos:int -> len:int -> int

Same as write, but take the data from a string instead of a byte sequence.

  • since 4.02
val single_write_substring : + file_descr -> + buf:string -> + pos:int -> + len:int -> + int

Same as single_write, but take the data from a string instead of a byte sequence.

  • since 4.02

Interfacing with the standard input/output library

val in_channel_of_descr : file_descr -> in_channel

Create an input channel reading from the given descriptor. The channel is initially in binary mode; use set_binary_mode_in ic false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

On Windows: Stdlib.set_binary_mode_in always fails on channels created with this function.

Beware that input channels are buffered, so more characters may have been read from the descriptor than those accessed using channel functions. Channels also keep a copy of the current position in the file.

Closing the channel ic returned by in_channel_of_descr fd using close_in ic also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

If several channels are created on the same descriptor, one of the channels must be closed, but not the others. Consider for example a descriptor s connected to a socket and two channels ic = in_channel_of_descr s and oc = out_channel_of_descr s. The recommended closing protocol is to perform close_out oc, which flushes buffered output to the socket then closes the socket. The ic channel must not be closed and will be collected by the GC eventually.

val out_channel_of_descr : file_descr -> out_channel

Create an output channel writing on the given descriptor. The channel is initially in binary mode; use set_binary_mode_out oc false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

On Windows: Stdlib.set_binary_mode_out always fails on channels created with this function.

Beware that output channels are buffered, so you may have to call Stdlib.flush to ensure that all data has been sent to the descriptor. Channels also keep a copy of the current position in the file.

Closing the channel oc returned by out_channel_of_descr fd using close_out oc also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

See Unix.in_channel_of_descr for a discussion of the closing protocol when several channels are created on the same descriptor.

val descr_of_in_channel : in_channel -> file_descr

Return the descriptor corresponding to an input channel.

val descr_of_out_channel : out_channel -> file_descr

Return the descriptor corresponding to an output channel.

Seeking and truncating

type seek_command = Unix.seek_command =
  1. | SEEK_SET
    (*

    indicates positions relative to the beginning of the file

    *)
  2. | SEEK_CUR
    (*

    indicates positions relative to the current position

    *)
  3. | SEEK_END
    (*

    indicates positions relative to the end of the file

    *)

Positioning modes for lseek.

val lseek : file_descr -> int -> mode:seek_command -> int

Set the current position for a file descriptor, and return the resulting offset (from the beginning of the file).

val truncate : string -> len:int -> unit

Truncates the named file to the given size.

val ftruncate : file_descr -> len:int -> unit

Truncates the file corresponding to the given descriptor to the given size.

File status

type file_kind = Unix.file_kind =
  1. | S_REG
    (*

    Regular file

    *)
  2. | S_DIR
    (*

    Directory

    *)
  3. | S_CHR
    (*

    Character device

    *)
  4. | S_BLK
    (*

    Block device

    *)
  5. | S_LNK
    (*

    Symbolic link

    *)
  6. | S_FIFO
    (*

    Named pipe

    *)
  7. | S_SOCK
    (*

    Socket

    *)
type stats = Unix.stats = {
  1. st_dev : int;
    (*

    Device number

    *)
  2. st_ino : int;
    (*

    Inode number

    *)
  3. st_kind : file_kind;
    (*

    Kind of the file

    *)
  4. st_perm : file_perm;
    (*

    Access rights

    *)
  5. st_uid : int;
    (*

    User id of the owner

    *)
  6. st_gid : int;
    (*

    Group ID of the file's group

    *)
  7. st_rdev : int;
    (*

    Device ID (if special file)

    *)
  8. st_size : int;
    (*

    Size in bytes

    *)
  9. st_atime : float;
    (*

    Last access time

    *)
  10. st_mtime : float;
    (*

    Last modification time

    *)
  11. st_ctime : float;
    (*

    Last status change time

    *)
}

The information returned by the stat calls.

val stat : string -> stats

Return the information for the named file.

val lstat : string -> stats

Same as stat, but in case the file is a symbolic link, return the information for the link itself.

val fstat : file_descr -> stats

Return the information for the file associated with the given descriptor.

val isatty : file_descr -> bool

Return true if the given file descriptor refers to a terminal or console window, false otherwise.

File operations on large files

module LargeFile : sig ... end

File operations on large files. This sub-module provides 64-bit variants of the functions lseek (for positioning a file descriptor), truncate and ftruncate (for changing the size of a file), and stat, lstat and fstat (for obtaining information on files). These alternate functions represent positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), thus allowing operating on files whose sizes are greater than max_int.

Mapping files into memory

val map_file : + file_descr -> + ?pos:int64 -> + kind:('a, 'b) Stdlib.Bigarray.kind -> + layout:'c Stdlib.Bigarray.layout -> + shared:bool -> + dims:int array -> + ('a, 'b, 'c) Stdlib.Bigarray.Genarray.t

Memory mapping of a file as a Bigarray. map_file fd ~kind ~layout ~shared ~dims returns a Bigarray of kind kind, layout layout, and dimensions as specified in dims. The data contained in this Bigarray are the contents of the file referred to by the file descriptor fd (as opened previously with openfile, for example). The optional pos parameter is the byte offset in the file of the data being mapped; it defaults to 0 (map from the beginning of the file).

If shared is true, all modifications performed on the array are reflected in the file. This requires that fd be opened with write permissions. If shared is false, modifications performed on the array are done in memory only, using copy-on-write of the modified pages; the underlying file is not affected.

map_file is much more efficient than reading the whole file in a Bigarray, modifying that Bigarray, and writing it afterwards.

To adjust automatically the dimensions of the Bigarray to the actual size of the file, the major dimension (that is, the first dimension for an array with C layout, and the last dimension for an array with Fortran layout) can be given as -1. map_file then determines the major dimension from the size of the file. The file must contain an integral number of sub-arrays as determined by the non-major dimensions, otherwise Failure is raised.

If all dimensions of the Bigarray are given, the file size is matched against the size of the Bigarray. If the file is larger than the Bigarray, only the initial portion of the file is mapped to the Bigarray. If the file is smaller than the big array, the file is automatically grown to the size of the Bigarray. This requires write permissions on fd.

Array accesses are bounds-checked, but the bounds are determined by the initial call to map_file. Therefore, you should make sure no other process modifies the mapped file while you're accessing it, or a SIGBUS signal may be raised. This happens, for instance, if the file is shrunk.

Invalid_argument or Failure may be raised in cases where argument validation fails.

  • since 4.06

Operations on file names

Removes the named file.

If the named file is a directory, raises:

  • EPERM on POSIX compliant system
  • EISDIR on Linux >= 2.1.132
  • EACCESS on Windows
val rename : src:string -> dst:string -> unit

rename ~src ~dst changes the name of a file from src to dst, moving it between directories if needed. If dst already exists, its contents will be replaced with those of src. Depending on the operating system, the metadata (permissions, owner, etc) of dst can either be preserved or be replaced by those of src.

link ?follow ~src ~dst creates a hard link named dst to the file named src.

  • parameter follow

    indicates whether a src symlink is followed or a hardlink to src itself will be created. On Unix systems this is done using the linkat(2) function. If ?follow is not provided, then the link(2) function is used whose behaviour is OS-dependent, but more widely available.

  • raises ENOSYS

    On Unix if ~follow:_ is requested, but linkat is unavailable.

  • raises ENOSYS

    On Windows if ~follow:false is requested.

val realpath : string -> string

realpath p is an absolute pathname for p obtained by resolving all extra / characters, relative path segments and symbolic links.

  • since 4.13

File permissions and ownership

type access_permission = Unix.access_permission =
  1. | R_OK
    (*

    Read permission

    *)
  2. | W_OK
    (*

    Write permission

    *)
  3. | X_OK
    (*

    Execution permission

    *)
  4. | F_OK
    (*

    File exists

    *)

Flags for the access call.

val chmod : string -> perm:file_perm -> unit

Change the permissions of the named file.

val fchmod : file_descr -> perm:file_perm -> unit

Change the permissions of an opened file.

  • raises Invalid_argument

    on Windows

val chown : string -> uid:int -> gid:int -> unit

Change the owner uid and owner gid of the named file.

  • raises Invalid_argument

    on Windows

val fchown : file_descr -> uid:int -> gid:int -> unit

Change the owner uid and owner gid of an opened file.

  • raises Invalid_argument

    on Windows

val umask : file_perm -> file_perm

Set the process's file mode creation mask, and return the previous mask.

  • raises Invalid_argument

    on Windows

val access : string -> perm:access_permission list -> unit

Check that the process has the given permissions over the named file.

On Windows: execute permission X_OK cannot be tested, just tests for read permission instead.

Operations on file descriptors

val dup : ?cloexec:bool -> file_descr -> file_descr

Return a new file descriptor referencing the same file as the given descriptor. See set_close_on_exec for documentation on the cloexec optional argument.

val dup2 : ?cloexec:bool -> src:file_descr -> dst:file_descr -> unit

dup2 ~src ~dst duplicates src to dst, closing dst if already opened. See set_close_on_exec for documentation on the cloexec optional argument.

val set_nonblock : file_descr -> unit

Set the ``non-blocking'' flag on the given descriptor. When the non-blocking flag is set, reading on a descriptor on which there is temporarily no data available raises the EAGAIN or EWOULDBLOCK error instead of blocking; writing on a descriptor on which there is temporarily no room for writing also raises EAGAIN or EWOULDBLOCK.

val clear_nonblock : file_descr -> unit

Clear the ``non-blocking'' flag on the given descriptor. See set_nonblock.

val set_close_on_exec : file_descr -> unit

Set the ``close-on-exec'' flag on the given descriptor. A descriptor with the close-on-exec flag is automatically closed when the current process starts another program with one of the exec, create_process and open_process functions.

It is often a security hole to leak file descriptors opened on, say, a private file to an external program: the program, then, gets access to the private file and can do bad things with it. Hence, it is highly recommended to set all file descriptors ``close-on-exec'', except in the very few cases where a file descriptor actually needs to be transmitted to another program.

The best way to set a file descriptor ``close-on-exec'' is to create it in this state. To this end, the openfile function has O_CLOEXEC and O_KEEPEXEC flags to enforce ``close-on-exec'' mode or ``keep-on-exec'' mode, respectively. All other operations in the Unix module that create file descriptors have an optional argument ?cloexec:bool to indicate whether the file descriptor should be created in ``close-on-exec'' mode (by writing ~cloexec:true) or in ``keep-on-exec'' mode (by writing ~cloexec:false). For historical reasons, the default file descriptor creation mode is ``keep-on-exec'', if no cloexec optional argument is given. This is not a safe default, hence it is highly recommended to pass explicit cloexec arguments to operations that create file descriptors.

The cloexec optional arguments and the O_KEEPEXEC flag were introduced in OCaml 4.05. Earlier, the common practice was to create file descriptors in the default, ``keep-on-exec'' mode, then call set_close_on_exec on those freshly-created file descriptors. This is not as safe as creating the file descriptor in ``close-on-exec'' mode because, in multithreaded programs, a window of vulnerability exists between the time when the file descriptor is created and the time set_close_on_exec completes. If another thread spawns another program during this window, the descriptor will leak, as it is still in the ``keep-on-exec'' mode.

Regarding the atomicity guarantees given by ~cloexec:true or by the use of the O_CLOEXEC flag: on all platforms it is guaranteed that a concurrently-executing Caml thread cannot leak the descriptor by starting a new process. On Linux, this guarantee extends to concurrently-executing C threads. As of Feb 2017, other operating systems lack the necessary system calls and still expose a window of vulnerability during which a C thread can see the newly-created file descriptor in ``keep-on-exec'' mode.

val clear_close_on_exec : file_descr -> unit

Clear the ``close-on-exec'' flag on the given descriptor. See set_close_on_exec.

Directories

val mkdir : string -> perm:file_perm -> unit

Create a directory with the given permissions (see umask).

val rmdir : string -> unit

Remove an empty directory.

val chdir : string -> unit

Change the process working directory.

val getcwd : unit -> string

Return the name of the current working directory.

val chroot : string -> unit

Change the process root directory.

  • raises Invalid_argument

    on Windows

type dir_handle = Unix.dir_handle

The type of descriptors over opened directories.

val opendir : string -> dir_handle

Open a descriptor on a directory

val readdir : dir_handle -> string

Return the next entry in a directory.

  • raises End_of_file

    when the end of the directory has been reached.

val rewinddir : dir_handle -> unit

Reposition the descriptor to the beginning of the directory

val closedir : dir_handle -> unit

Close a directory descriptor.

Pipes and redirections

val pipe : ?cloexec:bool -> unit -> file_descr * file_descr

Create a pipe. The first component of the result is opened for reading, that's the exit to the pipe. The second component is opened for writing, that's the entrance to the pipe. See set_close_on_exec for documentation on the cloexec optional argument.

val mkfifo : string -> perm:file_perm -> unit

Create a named pipe with the given permissions (see umask).

  • raises Invalid_argument

    on Windows

High-level process and redirection management

val create_process : + prog:string -> + args:string array -> + stdin:file_descr -> + stdout:file_descr -> + stderr:file_descr -> + int

create_process ~prog ~args ~stdin ~stdout ~stderr creates a new process that executes the program in file prog, with arguments args. The pid of the new process is returned immediately; the new process executes concurrently with the current process. The standard input and outputs of the new process are connected to the descriptors stdin, stdout and stderr. Passing e.g. Unix.stdout for stdout prevents the redirection and causes the new process to have the same standard output as the current process. The executable file prog is searched in the path. The new process has the same environment as the current process.

val create_process_env : + prog:string -> + args:string array -> + env:string array -> + stdin:file_descr -> + stdout:file_descr -> + stderr:file_descr -> + int

create_process_env ~prog ~args ~env ~stdin ~stdout ~stderr works as create_process, except that the extra argument env specifies the environment passed to the program.

val open_process_in : string -> in_channel

High-level pipe and process management. This function runs the given command in parallel with the program. The standard output of the command is redirected to a pipe, which can be read via the returned input channel. The command is interpreted by the shell /bin/sh (or cmd.exe on Windows), cf. system. The Filename.quote_command function can be used to quote the command and its arguments as appropriate for the shell being used. If the command does not need to be run through the shell, open_process_args_in can be used as a more robust and more efficient alternative to open_process_in.

val open_process_out : string -> out_channel

Same as open_process_in, but redirect the standard input of the command to a pipe. Data written to the returned output channel is sent to the standard input of the command. Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization. If the command does not need to be run through the shell, open_process_args_out can be used instead of open_process_out.

val open_process : string -> in_channel * out_channel

Same as open_process_out, but redirects both the standard input and standard output of the command to pipes connected to the two returned channels. The input channel is connected to the output of the command, and the output channel to the input of the command. If the command does not need to be run through the shell, open_process_args can be used instead of open_process.

val open_process_full : + string -> + env:string array -> + in_channel * out_channel * in_channel

Similar to open_process, but the second argument specifies the environment passed to the command. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the command. If the command does not need to be run through the shell, open_process_args_full can be used instead of open_process_full.

val open_process_args : string -> string array -> in_channel * out_channel

open_process_args prog args runs the program prog with arguments args. Note that the first argument is by convention the filename of the program being executed, just like Sys.argv.(0). The new process executes concurrently with the current process. The standard input and output of the new process are redirected to pipes, which can be respectively read and written via the returned channels. The input channel is connected to the output of the program, and the output channel to the input of the program.

Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization.

The executable file prog is searched for in the path. This behaviour changed in 4.12; previously prog was looked up only in the current directory.

The new process has the same environment as the current process.

  • since 4.08
val open_process_args_in : string -> string array -> in_channel

Same as open_process_args, but redirects only the standard output of the new process.

  • since 4.08
val open_process_args_out : string -> string array -> out_channel

Same as open_process_args, but redirects only the standard input of the new process.

  • since 4.08
val open_process_args_full : + string -> + string array -> + string array -> + in_channel * out_channel * in_channel

Similar to open_process_args, but the third argument specifies the environment passed to the new process. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the program.

  • since 4.08
val process_in_pid : in_channel -> int

Return the pid of a process opened via open_process_in or open_process_args_in.

  • since 4.12
val process_out_pid : out_channel -> int

Return the pid of a process opened via open_process_out or open_process_args_out.

  • since 4.12
val process_pid : (in_channel * out_channel) -> int

Return the pid of a process opened via open_process or open_process_args.

  • since 4.12
val process_full_pid : (in_channel * out_channel * in_channel) -> int

Return the pid of a process opened via open_process_full or open_process_args_full.

  • since 4.12
val close_process_in : in_channel -> process_status

Close channels opened by open_process_in, wait for the associated command to terminate, and return its termination status.

val close_process_out : out_channel -> process_status

Close channels opened by open_process_out, wait for the associated command to terminate, and return its termination status.

val close_process : (in_channel * out_channel) -> process_status

Close channels opened by open_process, wait for the associated command to terminate, and return its termination status.

val close_process_full : + (in_channel * out_channel * in_channel) -> + process_status

Close channels opened by open_process_full, wait for the associated command to terminate, and return its termination status.

symlink ?to_dir ~src ~dst creates the file dst as a symbolic link to the file src. On Windows, ~to_dir indicates if the symbolic link points to a directory or a file; if omitted, symlink examines src using stat and picks appropriately, if src does not exist then false is assumed (for this reason, it is recommended that the ~to_dir parameter be specified in new code). On Unix, ~to_dir is ignored.

Windows symbolic links are available in Windows Vista onwards. There are some important differences between Windows symlinks and their POSIX counterparts.

Windows symbolic links come in two flavours: directory and regular, which designate whether the symbolic link points to a directory or a file. The type must be correct - a directory symlink which actually points to a file cannot be selected with chdir and a file symlink which actually points to a directory cannot be read or written (note that Cygwin's emulation layer ignores this distinction).

When symbolic links are created to existing targets, this distinction doesn't matter and symlink will automatically create the correct kind of symbolic link. The distinction matters when a symbolic link is created to a non-existent target.

The other caveat is that by default symbolic links are a privileged operation. Administrators will always need to be running elevated (or with UAC disabled) and by default normal user accounts need to be granted the SeCreateSymbolicLinkPrivilege via Local Security Policy (secpol.msc) or via Active Directory.

has_symlink can be used to check that a process is able to create symbolic links.

Returns true if the user is able to create symbolic links. On Windows, this indicates that the user not only has the SeCreateSymbolicLinkPrivilege but is also running elevated, if necessary. On other platforms, this is simply indicates that the symlink system call is available.

  • since 4.03

Read the contents of a symbolic link.

Polling

val select : + read:file_descr list -> + write:file_descr list -> + except:file_descr list -> + timeout:float -> + file_descr list * file_descr list * file_descr list

Wait until some input/output operations become possible on some channels. The three list arguments are, respectively, a set of descriptors to check for reading (first argument), for writing (second argument), or for exceptional conditions (third argument). The fourth argument is the maximal timeout, in seconds; a negative fourth argument means no timeout (unbounded wait). The result is composed of three sets of descriptors: those ready for reading (first component), ready for writing (second component), and over which an exceptional condition is pending (third component).

Locking

type lock_command = Unix.lock_command =
  1. | F_ULOCK
    (*

    Unlock a region

    *)
  2. | F_LOCK
    (*

    Lock a region for writing, and block if already locked

    *)
  3. | F_TLOCK
    (*

    Lock a region for writing, or fail if already locked

    *)
  4. | F_TEST
    (*

    Test a region for other process locks

    *)
  5. | F_RLOCK
    (*

    Lock a region for reading, and block if already locked

    *)
  6. | F_TRLOCK
    (*

    Lock a region for reading, or fail if already locked

    *)

Commands for lockf.

val lockf : file_descr -> mode:lock_command -> len:int -> unit

lockf fd ~mode ~len puts a lock on a region of the file opened as fd. The region starts at the current read/write position for fd (as set by lseek), and extends len bytes forward if len is positive, len bytes backwards if len is negative, or to the end of the file if len is zero. A write lock prevents any other process from acquiring a read or write lock on the region. A read lock prevents any other process from acquiring a write lock on the region, but lets other processes acquire read locks on it.

The F_LOCK and F_TLOCK commands attempts to put a write lock on the specified region. The F_RLOCK and F_TRLOCK commands attempts to put a read lock on the specified region. If one or several locks put by another process prevent the current process from acquiring the lock, F_LOCK and F_RLOCK block until these locks are removed, while F_TLOCK and F_TRLOCK fail immediately with an exception. The F_ULOCK removes whatever locks the current process has on the specified region. Finally, the F_TEST command tests whether a write lock can be acquired on the specified region, without actually putting a lock. It returns immediately if successful, or fails otherwise.

What happens when a process tries to lock a region of a file that is already locked by the same process depends on the OS. On POSIX-compliant systems, the second lock operation succeeds and may "promote" the older lock from read lock to write lock. On Windows, the second lock operation will block or fail.

Signals

Note: installation of signal handlers is performed via the functions Sys.signal and Sys.set_signal.

val kill : pid:int -> signal:int -> unit

kill ~pid ~signal sends signal number signal to the process with id pid.

On Windows: only the Sys.sigkill signal is emulated.

type sigprocmask_command = Unix.sigprocmask_command =
  1. | SIG_SETMASK
  2. | SIG_BLOCK
  3. | SIG_UNBLOCK
val sigprocmask : mode:sigprocmask_command -> int list -> int list

sigprocmask ~mode sigs changes the set of blocked signals. If mode is SIG_SETMASK, blocked signals are set to those in the list sigs. If mode is SIG_BLOCK, the signals in sigs are added to the set of blocked signals. If mode is SIG_UNBLOCK, the signals in sigs are removed from the set of blocked signals. sigprocmask returns the set of previously blocked signals.

When the systhreads version of the Thread module is loaded, this function redirects to Thread.sigmask. I.e., sigprocmask only changes the mask of the current thread.

  • raises Invalid_argument

    on Windows (no inter-process signals on Windows)

val sigpending : unit -> int list

Return the set of blocked signals that are currently pending.

  • raises Invalid_argument

    on Windows (no inter-process signals on Windows)

val sigsuspend : int list -> unit

sigsuspend sigs atomically sets the blocked signals to sigs and waits for a non-ignored, non-blocked signal to be delivered. On return, the blocked signals are reset to their initial value.

  • raises Invalid_argument

    on Windows (no inter-process signals on Windows)

val pause : unit -> unit

Wait until a non-ignored, non-blocked signal is delivered.

  • raises Invalid_argument

    on Windows (no inter-process signals on Windows)

Time functions

type process_times = Unix.process_times = {
  1. tms_utime : float;
    (*

    User time for the process

    *)
  2. tms_stime : float;
    (*

    System time for the process

    *)
  3. tms_cutime : float;
    (*

    User time for the children processes

    *)
  4. tms_cstime : float;
    (*

    System time for the children processes

    *)
}

The execution times (CPU times) of a process.

type tm = Unix.tm = {
  1. tm_sec : int;
    (*

    Seconds 0..60

    *)
  2. tm_min : int;
    (*

    Minutes 0..59

    *)
  3. tm_hour : int;
    (*

    Hours 0..23

    *)
  4. tm_mday : int;
    (*

    Day of month 1..31

    *)
  5. tm_mon : int;
    (*

    Month of year 0..11

    *)
  6. tm_year : int;
    (*

    Year - 1900

    *)
  7. tm_wday : int;
    (*

    Day of week (Sunday is 0)

    *)
  8. tm_yday : int;
    (*

    Day of year 0..365

    *)
  9. tm_isdst : bool;
    (*

    Daylight time savings in effect

    *)
}

The type representing wallclock time and calendar date.

val time : unit -> float

Return the current time since 00:00:00 GMT, Jan. 1, 1970, in seconds.

val gettimeofday : unit -> float

Same as time, but with resolution better than 1 second.

val gmtime : float -> tm

Convert a time in seconds, as returned by time, into a date and a time. Assumes UTC (Coordinated Universal Time), also known as GMT. To perform the inverse conversion, set the TZ environment variable to "UTC", use mktime, and then restore the original value of TZ.

val localtime : float -> tm

Convert a time in seconds, as returned by time, into a date and a time. Assumes the local time zone. The function performing the inverse conversion is mktime.

val mktime : tm -> float * tm

Convert a date and time, specified by the tm argument, into a time in seconds, as returned by time. The tm_isdst, tm_wday and tm_yday fields of tm are ignored. Also return a normalized copy of the given tm record, with the tm_wday, tm_yday, and tm_isdst fields recomputed from the other fields, and the other fields normalized (so that, e.g., 40 October is changed into 9 November). The tm argument is interpreted in the local time zone.

val alarm : int -> int

Schedule a SIGALRM signal after the given number of seconds.

  • raises Invalid_argument

    on Windows

val sleep : int -> unit

Stop execution for the given number of seconds.

val sleepf : float -> unit

Stop execution for the given number of seconds. Like sleep, but fractions of seconds are supported.

  • since 4.12
val times : unit -> process_times

Return the execution times of the process.

On Windows: partially implemented, will not report timings for child processes.

val utimes : string -> access:float -> modif:float -> unit

Set the last access time (second arg) and last modification time (third arg) for a file. Times are expressed in seconds from 00:00:00 GMT, Jan. 1, 1970. If both times are 0.0, the access and last modification times are both set to the current time.

type interval_timer = Unix.interval_timer =
  1. | ITIMER_REAL
    (*

    decrements in real time, and sends the signal SIGALRM when expired.

    *)
  2. | ITIMER_VIRTUAL
    (*

    decrements in process virtual time, and sends SIGVTALRM when expired.

    *)
  3. | ITIMER_PROF
    (*

    (for profiling) decrements both when the process is running and when the system is running on behalf of the process; it sends SIGPROF when expired.

    *)

The three kinds of interval timers.

type interval_timer_status = Unix.interval_timer_status = {
  1. it_interval : float;
    (*

    Period

    *)
  2. it_value : float;
    (*

    Current value of the timer

    *)
}

The type describing the status of an interval timer

Return the current status of the given interval timer.

  • raises Invalid_argument

    on Windows

setitimer t s sets the interval timer t and returns its previous status. The s argument is interpreted as follows: s.it_value, if nonzero, is the time to the next timer expiration; s.it_interval, if nonzero, specifies a value to be used in reloading it_value when the timer expires. Setting s.it_value to zero disables the timer. Setting s.it_interval to zero causes the timer to be disabled after its next expiration.

  • raises Invalid_argument

    on Windows

User id, group id

val getuid : unit -> int

Return the user id of the user executing the process.

On Windows: always returns 1.

val geteuid : unit -> int

Return the effective user id under which the process runs.

On Windows: always returns 1.

val setuid : int -> unit

Set the real user id and effective user id for the process.

  • raises Invalid_argument

    on Windows

val getgid : unit -> int

Return the group id of the user executing the process.

On Windows: always returns 1.

val getegid : unit -> int

Return the effective group id under which the process runs.

On Windows: always returns 1.

val setgid : int -> unit

Set the real group id and effective group id for the process.

  • raises Invalid_argument

    on Windows

val getgroups : unit -> int array

Return the list of groups to which the user executing the process belongs.

On Windows: always returns [|1|].

val setgroups : int array -> unit

setgroups groups sets the supplementary group IDs for the calling process. Appropriate privileges are required.

  • raises Invalid_argument

    on Windows

val initgroups : string -> int -> unit

initgroups user group initializes the group access list by reading the group database /etc/group and using all groups of which user is a member. The additional group group is also added to the list.

  • raises Invalid_argument

    on Windows

type passwd_entry = Unix.passwd_entry = {
  1. pw_name : string;
  2. pw_passwd : string;
  3. pw_uid : int;
  4. pw_gid : int;
  5. pw_gecos : string;
  6. pw_dir : string;
  7. pw_shell : string;
}

Structure of entries in the passwd database.

type group_entry = Unix.group_entry = {
  1. gr_name : string;
  2. gr_passwd : string;
  3. gr_gid : int;
  4. gr_mem : string array;
}

Structure of entries in the groups database.

val getlogin : unit -> string

Return the login name of the user executing the process.

val getpwnam : string -> passwd_entry

Find an entry in passwd with the given name.

  • raises Not_found

    if no such entry exists, or always on Windows.

val getgrnam : string -> group_entry

Find an entry in group with the given name.

  • raises Not_found

    if no such entry exists, or always on Windows.

val getpwuid : int -> passwd_entry

Find an entry in passwd with the given user id.

  • raises Not_found

    if no such entry exists, or always on Windows.

val getgrgid : int -> group_entry

Find an entry in group with the given group id.

  • raises Not_found

    if no such entry exists, or always on Windows.

Internet addresses

type inet_addr = Unix.inet_addr

The abstract type of Internet addresses.

val inet_addr_of_string : string -> inet_addr

Conversion from the printable representation of an Internet address to its internal representation. The argument string consists of 4 numbers separated by periods (XXX.YYY.ZZZ.TTT) for IPv4 addresses, and up to 8 numbers separated by colons for IPv6 addresses.

  • raises Failure

    when given a string that does not match these formats.

val string_of_inet_addr : inet_addr -> string

Return the printable representation of the given Internet address. See inet_addr_of_string for a description of the printable representation.

val inet_addr_any : inet_addr

A special IPv4 address, for use only with bind, representing all the Internet addresses that the host machine possesses.

val inet_addr_loopback : inet_addr

A special IPv4 address representing the host machine (127.0.0.1).

val inet6_addr_any : inet_addr

A special IPv6 address, for use only with bind, representing all the Internet addresses that the host machine possesses.

val inet6_addr_loopback : inet_addr

A special IPv6 address representing the host machine (::1).

val is_inet6_addr : inet_addr -> bool

Whether the given inet_addr is an IPv6 address.

  • since 4.12

Sockets

type socket_domain = Unix.socket_domain =
  1. | PF_UNIX
    (*

    Unix domain

    *)
  2. | PF_INET
    (*

    Internet domain (IPv4)

    *)
  3. | PF_INET6
    (*

    Internet domain (IPv6)

    *)

The type of socket domains. Not all platforms support IPv6 sockets (type PF_INET6).

On Windows: PF_UNIX supported since 4.14.0 on Windows 10 1803 and later.

type socket_type = Unix.socket_type =
  1. | SOCK_STREAM
    (*

    Stream socket

    *)
  2. | SOCK_DGRAM
    (*

    Datagram socket

    *)
  3. | SOCK_RAW
    (*

    Raw socket

    *)
  4. | SOCK_SEQPACKET
    (*

    Sequenced packets socket

    *)

The type of socket kinds, specifying the semantics of communications. SOCK_SEQPACKET is included for completeness, but is rarely supported by the OS, and needs system calls that are not available in this library.

type sockaddr = Unix.sockaddr =
  1. | ADDR_UNIX of string
  2. | ADDR_INET of inet_addr * int

The type of socket addresses. ADDR_UNIX name is a socket address in the Unix domain; name is a file name in the file system. ADDR_INET(addr,port) is a socket address in the Internet domain; addr is the Internet address of the machine, and port is the port number.

val socket : + ?cloexec:bool -> + domain:socket_domain -> + kind:socket_type -> + protocol:int -> + file_descr

Create a new socket in the given domain, and with the given kind. The third argument is the protocol type; 0 selects the default protocol for that kind of sockets. See set_close_on_exec for documentation on the cloexec optional argument.

val domain_of_sockaddr : sockaddr -> socket_domain

Return the socket domain adequate for the given socket address.

val socketpair : + ?cloexec:bool -> + domain:socket_domain -> + kind:socket_type -> + protocol:int -> + file_descr * file_descr

Create a pair of unnamed sockets, connected together. See set_close_on_exec for documentation on the cloexec optional argument.

val accept : ?cloexec:bool -> file_descr -> file_descr * sockaddr

Accept connections on the given socket. The returned descriptor is a socket connected to the client; the returned address is the address of the connecting client. See set_close_on_exec for documentation on the cloexec optional argument.

val bind : file_descr -> addr:sockaddr -> unit

Bind a socket to an address.

val connect : file_descr -> addr:sockaddr -> unit

Connect a socket to an address.

val listen : file_descr -> max:int -> unit

Set up a socket for receiving connection requests. The integer argument is the maximal number of pending requests.

type shutdown_command = Unix.shutdown_command =
  1. | SHUTDOWN_RECEIVE
    (*

    Close for receiving

    *)
  2. | SHUTDOWN_SEND
    (*

    Close for sending

    *)
  3. | SHUTDOWN_ALL
    (*

    Close both

    *)

The type of commands for shutdown.

val shutdown : file_descr -> mode:shutdown_command -> unit

Shutdown a socket connection. SHUTDOWN_SEND as second argument causes reads on the other end of the connection to return an end-of-file condition. SHUTDOWN_RECEIVE causes writes on the other end of the connection to return a closed pipe condition (SIGPIPE signal).

val getsockname : file_descr -> sockaddr

Return the address of the given socket.

val getpeername : file_descr -> sockaddr

Return the address of the host connected to the given socket.

type msg_flag = Unix.msg_flag =
  1. | MSG_OOB
  2. | MSG_DONTROUTE
  3. | MSG_PEEK

The flags for recv, recvfrom, send and sendto.

val recv : + file_descr -> + buf:bytes -> + pos:int -> + len:int -> + mode:msg_flag list -> + int

Receive data from a connected socket.

val recvfrom : + file_descr -> + buf:bytes -> + pos:int -> + len:int -> + mode:msg_flag list -> + int * sockaddr

Receive data from an unconnected socket.

val send : + file_descr -> + buf:bytes -> + pos:int -> + len:int -> + mode:msg_flag list -> + int

Send data over a connected socket.

val send_substring : + file_descr -> + buf:string -> + pos:int -> + len:int -> + mode:msg_flag list -> + int

Same as send, but take the data from a string instead of a byte sequence.

  • since 4.02
val sendto : + file_descr -> + buf:bytes -> + pos:int -> + len:int -> + mode:msg_flag list -> + addr:sockaddr -> + int

Send data over an unconnected socket.

val sendto_substring : + file_descr -> + buf:string -> + pos:int -> + len:int -> + mode:msg_flag list -> + sockaddr -> + int

Same as sendto, but take the data from a string instead of a byte sequence.

  • since 4.02

Socket options

type socket_bool_option = Unix.socket_bool_option =
  1. | SO_DEBUG
    (*

    Record debugging information

    *)
  2. | SO_BROADCAST
    (*

    Permit sending of broadcast messages

    *)
  3. | SO_REUSEADDR
    (*

    Allow reuse of local addresses for bind

    *)
  4. | SO_KEEPALIVE
    (*

    Keep connection active

    *)
  5. | SO_DONTROUTE
    (*

    Bypass the standard routing algorithms

    *)
  6. | SO_OOBINLINE
    (*

    Leave out-of-band data in line

    *)
  7. | SO_ACCEPTCONN
    (*

    Report whether socket listening is enabled

    *)
  8. | TCP_NODELAY
    (*

    Control the Nagle algorithm for TCP sockets

    *)
  9. | IPV6_ONLY
    (*

    Forbid binding an IPv6 socket to an IPv4 address

    *)
  10. | SO_REUSEPORT
    (*

    Allow reuse of address and port bindings

    *)

The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

type socket_int_option = Unix.socket_int_option =
  1. | SO_SNDBUF
    (*

    Size of send buffer

    *)
  2. | SO_RCVBUF
    (*

    Size of received buffer

    *)
  3. | SO_ERROR
    (*

    Deprecated. Use getsockopt_error instead.

    • deprecated Use Unix.getsockopt_error instead.
    *)
  4. | SO_TYPE
    (*

    Report the socket type

    *)
  5. | SO_RCVLOWAT
    (*

    Minimum number of bytes to process for input operations

    *)
  6. | SO_SNDLOWAT
    (*

    Minimum number of bytes to process for output operations

    *)

The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

type socket_optint_option = Unix.socket_optint_option =
  1. | SO_LINGER
    (*

    Whether to linger on closed connections that have data present, and for how long (in seconds)

    *)

The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

type socket_float_option = Unix.socket_float_option =
  1. | SO_RCVTIMEO
    (*

    Timeout for input operations

    *)
  2. | SO_SNDTIMEO
    (*

    Timeout for output operations

    *)

The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

val getsockopt : file_descr -> socket_bool_option -> bool

Return the current status of a boolean-valued option in the given socket.

val setsockopt : file_descr -> socket_bool_option -> bool -> unit

Set or clear a boolean-valued option in the given socket.

val getsockopt_int : file_descr -> socket_int_option -> int

Same as getsockopt for an integer-valued socket option.

val setsockopt_int : file_descr -> socket_int_option -> int -> unit

Same as setsockopt for an integer-valued socket option.

val getsockopt_optint : file_descr -> socket_optint_option -> int option

Same as getsockopt for a socket option whose value is an int option.

val setsockopt_optint : + file_descr -> + socket_optint_option -> + int option -> + unit

Same as setsockopt for a socket option whose value is an int option.

val getsockopt_float : file_descr -> socket_float_option -> float

Same as getsockopt for a socket option whose value is a floating-point number.

val setsockopt_float : file_descr -> socket_float_option -> float -> unit

Same as setsockopt for a socket option whose value is a floating-point number.

val getsockopt_error : file_descr -> error option

Return the error condition associated with the given socket, and clear it.

High-level network connection functions

val open_connection : sockaddr -> in_channel * out_channel

Connect to a server at the given address. Return a pair of buffered channels connected to the server. Remember to call Stdlib.flush on the output channel at the right times to ensure correct synchronization.

The two channels returned by open_connection share a descriptor to a socket. Therefore, when the connection is over, you should call Stdlib.close_out on the output channel, which will also close the underlying socket. Do not call Stdlib.close_in on the input channel; it will be collected by the GC eventually.

val shutdown_connection : in_channel -> unit

``Shut down'' a connection established with open_connection; that is, transmit an end-of-file condition to the server reading on the other side of the connection. This does not close the socket and the channels used by the connection. See Unix.open_connection for how to close them once the connection is over.

val establish_server : + (in_channel -> out_channel -> unit) -> + addr:sockaddr -> + unit

Establish a server on the given address. The function given as first argument is called for each connection with two buffered channels connected to the client. A new process is created for each connection. The function establish_server never returns normally.

The two channels given to the function share a descriptor to a socket. The function does not need to close the channels, since this occurs automatically when the function returns. If the function prefers explicit closing, it should close the output channel using Stdlib.close_out and leave the input channel unclosed, for reasons explained in Unix.in_channel_of_descr.

  • raises Invalid_argument

    on Windows. Use threads instead.

Host and protocol databases

type host_entry = Unix.host_entry = {
  1. h_name : string;
  2. h_aliases : string array;
  3. h_addrtype : socket_domain;
  4. h_addr_list : inet_addr array;
}

Structure of entries in the hosts database.

type protocol_entry = Unix.protocol_entry = {
  1. p_name : string;
  2. p_aliases : string array;
  3. p_proto : int;
}

Structure of entries in the protocols database.

type service_entry = Unix.service_entry = {
  1. s_name : string;
  2. s_aliases : string array;
  3. s_port : int;
  4. s_proto : string;
}

Structure of entries in the services database.

val gethostname : unit -> string

Return the name of the local host.

val gethostbyname : string -> host_entry

Find an entry in hosts with the given name.

  • raises Not_found

    if no such entry exists.

val gethostbyaddr : inet_addr -> host_entry

Find an entry in hosts with the given address.

  • raises Not_found

    if no such entry exists.

val getprotobyname : string -> protocol_entry

Find an entry in protocols with the given name.

  • raises Not_found

    if no such entry exists.

val getprotobynumber : int -> protocol_entry

Find an entry in protocols with the given protocol number.

  • raises Not_found

    if no such entry exists.

val getservbyname : string -> protocol:string -> service_entry

Find an entry in services with the given name.

  • raises Not_found

    if no such entry exists.

val getservbyport : int -> protocol:string -> service_entry

Find an entry in services with the given service number.

  • raises Not_found

    if no such entry exists.

type addr_info = Unix.addr_info = {
  1. ai_family : socket_domain;
    (*

    Socket domain

    *)
  2. ai_socktype : socket_type;
    (*

    Socket type

    *)
  3. ai_protocol : int;
    (*

    Socket protocol number

    *)
  4. ai_addr : sockaddr;
    (*

    Address

    *)
  5. ai_canonname : string;
    (*

    Canonical host name

    *)
}

Address information returned by getaddrinfo.

type getaddrinfo_option = Unix.getaddrinfo_option =
  1. | AI_FAMILY of socket_domain
    (*

    Impose the given socket domain

    *)
  2. | AI_SOCKTYPE of socket_type
    (*

    Impose the given socket type

    *)
  3. | AI_PROTOCOL of int
    (*

    Impose the given protocol

    *)
  4. | AI_NUMERICHOST
    (*

    Do not call name resolver, expect numeric IP address

    *)
  5. | AI_CANONNAME
    (*

    Fill the ai_canonname field of the result

    *)
  6. | AI_PASSIVE
    (*

    Set address to ``any'' address for use with bind

    *)

Options to getaddrinfo.

val getaddrinfo : string -> string -> getaddrinfo_option list -> addr_info list

getaddrinfo host service opts returns a list of addr_info records describing socket parameters and addresses suitable for communicating with the given host and service. The empty list is returned if the host or service names are unknown, or the constraints expressed in opts cannot be satisfied.

host is either a host name or the string representation of an IP address. host can be given as the empty string; in this case, the ``any'' address or the ``loopback'' address are used, depending whether opts contains AI_PASSIVE. service is either a service name or the string representation of a port number. service can be given as the empty string; in this case, the port field of the returned addresses is set to 0. opts is a possibly empty list of options that allows the caller to force a particular socket domain (e.g. IPv6 only or IPv4 only) or a particular socket type (e.g. TCP only or UDP only).

type name_info = Unix.name_info = {
  1. ni_hostname : string;
    (*

    Name or IP address of host

    *)
  2. ni_service : string;
    (*

    Name of service or port number

    *)
}

Host and service information returned by getnameinfo.

type getnameinfo_option = Unix.getnameinfo_option =
  1. | NI_NOFQDN
    (*

    Do not qualify local host names

    *)
  2. | NI_NUMERICHOST
    (*

    Always return host as IP address

    *)
  3. | NI_NAMEREQD
    (*

    Fail if host name cannot be determined

    *)
  4. | NI_NUMERICSERV
    (*

    Always return service as port number

    *)
  5. | NI_DGRAM
    (*

    Consider the service as UDP-based instead of the default TCP

    *)

Options to getnameinfo.

val getnameinfo : sockaddr -> getnameinfo_option list -> name_info

getnameinfo addr opts returns the host name and service name corresponding to the socket address addr. opts is a possibly empty list of options that governs how these names are obtained.

  • raises Not_found

    if an error occurs.

Terminal interface

The following functions implement the POSIX standard terminal interface. They provide control over asynchronous communication ports and pseudo-terminals. Refer to the termios man page for a complete description.

type terminal_io = Unix.terminal_io = {
  1. mutable c_ignbrk : bool;
    (*

    Ignore the break condition.

    *)
  2. mutable c_brkint : bool;
    (*

    Signal interrupt on break condition.

    *)
  3. mutable c_ignpar : bool;
    (*

    Ignore characters with parity errors.

    *)
  4. mutable c_parmrk : bool;
    (*

    Mark parity errors.

    *)
  5. mutable c_inpck : bool;
    (*

    Enable parity check on input.

    *)
  6. mutable c_istrip : bool;
    (*

    Strip 8th bit on input characters.

    *)
  7. mutable c_inlcr : bool;
    (*

    Map NL to CR on input.

    *)
  8. mutable c_igncr : bool;
    (*

    Ignore CR on input.

    *)
  9. mutable c_icrnl : bool;
    (*

    Map CR to NL on input.

    *)
  10. mutable c_ixon : bool;
    (*

    Recognize XON/XOFF characters on input.

    *)
  11. mutable c_ixoff : bool;
    (*

    Emit XON/XOFF chars to control input flow.

    *)
  12. mutable c_opost : bool;
    (*

    Enable output processing.

    *)
  13. mutable c_obaud : int;
    (*

    Output baud rate (0 means close connection).

    *)
  14. mutable c_ibaud : int;
    (*

    Input baud rate.

    *)
  15. mutable c_csize : int;
    (*

    Number of bits per character (5-8).

    *)
  16. mutable c_cstopb : int;
    (*

    Number of stop bits (1-2).

    *)
  17. mutable c_cread : bool;
    (*

    Reception is enabled.

    *)
  18. mutable c_parenb : bool;
    (*

    Enable parity generation and detection.

    *)
  19. mutable c_parodd : bool;
    (*

    Specify odd parity instead of even.

    *)
  20. mutable c_hupcl : bool;
    (*

    Hang up on last close.

    *)
  21. mutable c_clocal : bool;
    (*

    Ignore modem status lines.

    *)
  22. mutable c_isig : bool;
    (*

    Generate signal on INTR, QUIT, SUSP.

    *)
  23. mutable c_icanon : bool;
    (*

    Enable canonical processing (line buffering and editing)

    *)
  24. mutable c_noflsh : bool;
    (*

    Disable flush after INTR, QUIT, SUSP.

    *)
  25. mutable c_echo : bool;
    (*

    Echo input characters.

    *)
  26. mutable c_echoe : bool;
    (*

    Echo ERASE (to erase previous character).

    *)
  27. mutable c_echok : bool;
    (*

    Echo KILL (to erase the current line).

    *)
  28. mutable c_echonl : bool;
    (*

    Echo NL even if c_echo is not set.

    *)
  29. mutable c_vintr : char;
    (*

    Interrupt character (usually ctrl-C).

    *)
  30. mutable c_vquit : char;
    (*

    Quit character (usually ctrl-\).

    *)
  31. mutable c_verase : char;
    (*

    Erase character (usually DEL or ctrl-H).

    *)
  32. mutable c_vkill : char;
    (*

    Kill line character (usually ctrl-U).

    *)
  33. mutable c_veof : char;
    (*

    End-of-file character (usually ctrl-D).

    *)
  34. mutable c_veol : char;
    (*

    Alternate end-of-line char. (usually none).

    *)
  35. mutable c_vmin : int;
    (*

    Minimum number of characters to read before the read request is satisfied.

    *)
  36. mutable c_vtime : int;
    (*

    Maximum read wait (in 0.1s units).

    *)
  37. mutable c_vstart : char;
    (*

    Start character (usually ctrl-Q).

    *)
  38. mutable c_vstop : char;
    (*

    Stop character (usually ctrl-S).

    *)
}
val tcgetattr : file_descr -> terminal_io

Return the status of the terminal referred to by the given file descriptor.

  • raises Invalid_argument

    on Windows

type setattr_when = Unix.setattr_when =
  1. | TCSANOW
  2. | TCSADRAIN
  3. | TCSAFLUSH
val tcsetattr : file_descr -> mode:setattr_when -> terminal_io -> unit

Set the status of the terminal referred to by the given file descriptor. The second argument indicates when the status change takes place: immediately (TCSANOW), when all pending output has been transmitted (TCSADRAIN), or after flushing all input that has been received but not read (TCSAFLUSH). TCSADRAIN is recommended when changing the output parameters; TCSAFLUSH, when changing the input parameters.

  • raises Invalid_argument

    on Windows

val tcsendbreak : file_descr -> duration:int -> unit

Send a break condition on the given file descriptor. The second argument is the duration of the break, in 0.1s units; 0 means standard duration (0.25s).

  • raises Invalid_argument

    on Windows

val tcdrain : file_descr -> unit

Waits until all output written on the given file descriptor has been transmitted.

  • raises Invalid_argument

    on Windows

type flush_queue = Unix.flush_queue =
  1. | TCIFLUSH
  2. | TCOFLUSH
  3. | TCIOFLUSH
val tcflush : file_descr -> mode:flush_queue -> unit

Discard data written on the given file descriptor but not yet transmitted, or data received but not yet read, depending on the second argument: TCIFLUSH flushes data received but not read, TCOFLUSH flushes data written but not transmitted, and TCIOFLUSH flushes both.

  • raises Invalid_argument

    on Windows

type flow_action = Unix.flow_action =
  1. | TCOOFF
  2. | TCOON
  3. | TCIOFF
  4. | TCION
val tcflow : file_descr -> mode:flow_action -> unit

Suspend or restart reception or transmission of data on the given file descriptor, depending on the second argument: TCOOFF suspends output, TCOON restarts output, TCIOFF transmits a STOP character to suspend input, and TCION transmits a START character to restart input.

  • raises Invalid_argument

    on Windows

val setsid : unit -> int

Put the calling process in a new session and detach it from its controlling terminal.

  • raises Invalid_argument

    on Windows

diff --git a/ocaml/Untypeast/index.html b/ocaml/Untypeast/index.html new file mode 100644 index 00000000..74e394f5 --- /dev/null +++ b/ocaml/Untypeast/index.html @@ -0,0 +1,65 @@ + +Untypeast (ocaml.Untypeast)

Module Untypeast

val lident_of_path : Path.t -> Longident.t
type mapper = {
  1. attribute : mapper -> Typedtree.attribute -> Parsetree.attribute;
  2. attributes : mapper -> Typedtree.attribute list -> Parsetree.attribute list;
  3. binding_op : mapper -> + Typedtree.binding_op -> + Typedtree.pattern -> + Parsetree.binding_op;
  4. case : 'k. mapper -> 'k Typedtree.case -> Parsetree.case;
  5. class_declaration : mapper -> + Typedtree.class_declaration -> + Parsetree.class_declaration;
  6. class_description : mapper -> + Typedtree.class_description -> + Parsetree.class_description;
  7. class_expr : mapper -> Typedtree.class_expr -> Parsetree.class_expr;
  8. class_field : mapper -> Typedtree.class_field -> Parsetree.class_field;
  9. class_signature : mapper -> + Typedtree.class_signature -> + Parsetree.class_signature;
  10. class_structure : mapper -> + Typedtree.class_structure -> + Parsetree.class_structure;
  11. class_type : mapper -> Typedtree.class_type -> Parsetree.class_type;
  12. class_type_declaration : mapper -> + Typedtree.class_type_declaration -> + Parsetree.class_type_declaration;
  13. class_type_field : mapper -> + Typedtree.class_type_field -> + Parsetree.class_type_field;
  14. constructor_declaration : mapper -> + Typedtree.constructor_declaration -> + Parsetree.constructor_declaration;
  15. expr : mapper -> Typedtree.expression -> Parsetree.expression;
  16. extension_constructor : mapper -> + Typedtree.extension_constructor -> + Parsetree.extension_constructor;
  17. include_declaration : mapper -> + Typedtree.include_declaration -> + Parsetree.include_declaration;
  18. include_description : mapper -> + Typedtree.include_description -> + Parsetree.include_description;
  19. label_declaration : mapper -> + Typedtree.label_declaration -> + Parsetree.label_declaration;
  20. location : mapper -> Location.t -> Location.t;
  21. module_binding : mapper -> + Typedtree.module_binding -> + Parsetree.module_binding;
  22. module_declaration : mapper -> + Typedtree.module_declaration -> + Parsetree.module_declaration;
  23. module_substitution : mapper -> + Typedtree.module_substitution -> + Parsetree.module_substitution;
  24. module_expr : mapper -> Typedtree.module_expr -> Parsetree.module_expr;
  25. module_type : mapper -> Typedtree.module_type -> Parsetree.module_type;
  26. module_type_declaration : mapper -> + Typedtree.module_type_declaration -> + Parsetree.module_type_declaration;
  27. package_type : mapper -> Typedtree.package_type -> Parsetree.package_type;
  28. open_declaration : mapper -> + Typedtree.open_declaration -> + Parsetree.open_declaration;
  29. open_description : mapper -> + Typedtree.open_description -> + Parsetree.open_description;
  30. pat : 'k. mapper -> 'k Typedtree.general_pattern -> Parsetree.pattern;
  31. row_field : mapper -> Typedtree.row_field -> Parsetree.row_field;
  32. object_field : mapper -> Typedtree.object_field -> Parsetree.object_field;
  33. signature : mapper -> Typedtree.signature -> Parsetree.signature;
  34. signature_item : mapper -> + Typedtree.signature_item -> + Parsetree.signature_item;
  35. structure : mapper -> Typedtree.structure -> Parsetree.structure;
  36. structure_item : mapper -> + Typedtree.structure_item -> + Parsetree.structure_item;
  37. typ : mapper -> Typedtree.core_type -> Parsetree.core_type;
  38. type_declaration : mapper -> + Typedtree.type_declaration -> + Parsetree.type_declaration;
  39. type_extension : mapper -> + Typedtree.type_extension -> + Parsetree.type_extension;
  40. type_exception : mapper -> + Typedtree.type_exception -> + Parsetree.type_exception;
  41. type_kind : mapper -> Typedtree.type_kind -> Parsetree.type_kind;
  42. value_binding : mapper -> Typedtree.value_binding -> Parsetree.value_binding;
  43. value_description : mapper -> + Typedtree.value_description -> + Parsetree.value_description;
  44. with_constraint : mapper -> + (Path.t * Longident.t Location.loc * Typedtree.with_constraint) -> + Parsetree.with_constraint;
}
val default_mapper : mapper
val untype_structure : + ?mapper:mapper -> + Typedtree.structure -> + Parsetree.structure
val untype_signature : + ?mapper:mapper -> + Typedtree.signature -> + Parsetree.signature
val untype_expression : + ?mapper:mapper -> + Typedtree.expression -> + Parsetree.expression
val untype_pattern : + ?mapper:mapper -> + _ Typedtree.general_pattern -> + Parsetree.pattern
diff --git a/ocaml/Var_within_closure/Map/index.html b/ocaml/Var_within_closure/Map/index.html new file mode 100644 index 00000000..1ccf31bf --- /dev/null +++ b/ocaml/Var_within_closure/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Var_within_closure.Map)

Module Var_within_closure.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Var_within_closure/Set/index.html b/ocaml/Var_within_closure/Set/index.html new file mode 100644 index 00000000..e0841e0a --- /dev/null +++ b/ocaml/Var_within_closure/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Var_within_closure.Set)

Module Var_within_closure.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Var_within_closure/T/index.html b/ocaml/Var_within_closure/T/index.html new file mode 100644 index 00000000..2dd5ec49 --- /dev/null +++ b/ocaml/Var_within_closure/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Var_within_closure.T)

Module Var_within_closure.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Var_within_closure/Tbl/index.html b/ocaml/Var_within_closure/Tbl/index.html new file mode 100644 index 00000000..13a11b75 --- /dev/null +++ b/ocaml/Var_within_closure/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Var_within_closure.Tbl)

Module Var_within_closure.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Var_within_closure/index.html b/ocaml/Var_within_closure/index.html new file mode 100644 index 00000000..225d0f56 --- /dev/null +++ b/ocaml/Var_within_closure/index.html @@ -0,0 +1,2 @@ + +Var_within_closure (ocaml.Var_within_closure)

Module Var_within_closure

An identifier, unique across the whole program, that identifies a particular variable within a particular closure. Only Project_var, and not Var, nodes are tagged with these identifiers.

include module type of Closure_element
include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val wrap : Variable.t -> t
val unwrap : t -> Variable.t
val wrap_map : 'a Variable.Map.t -> 'a Map.t
val unwrap_set : Set.t -> Variable.Set.t
val in_compilation_unit : t -> Compilation_unit.t -> bool
val get_compilation_unit : t -> Compilation_unit.t
val unique_name : t -> string
val output_full : out_channel -> t -> unit
diff --git a/ocaml/Variable/Map/index.html b/ocaml/Variable/Map/index.html new file mode 100644 index 00000000..56b2e183 --- /dev/null +++ b/ocaml/Variable/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Variable.Map)

Module Variable.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Variable/Pair/Map/index.html b/ocaml/Variable/Pair/Map/index.html new file mode 100644 index 00000000..c13e5ce0 --- /dev/null +++ b/ocaml/Variable/Pair/Map/index.html @@ -0,0 +1,17 @@ + +Map (ocaml.Variable.Pair.Map)

Module Pair.Map

include Map.S with type key = T.t and type 'a t = 'a Map.Make(T).t

Maps

type key = T.t

The type of the map keys.

type 'a t = 'a Stdlib.Map.Make(T).t

The type of maps from type key to type 'a.

val empty : 'a t

The empty map.

val add : key -> 'a -> 'a t -> 'a t

add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

  • before 4.03

    Physical equality was not ensured.

val add_to_list : key -> 'a -> 'a list t -> 'a list t

add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

  • since 5.1
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

  • since 4.06
val singleton : key -> 'a -> 'a t

singleton x y returns the one-element map that contains a binding y for x.

  • since 3.12
val remove : key -> 'a t -> 'a t

remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

  • before 4.03

    Physical equality was not ensured.

val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12

Bindings

val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05

Searching

val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

  • since 4.05

Traversing

val iter : (key -> 'a -> unit) -> 'a t -> unit

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

Transforming

val map : ('a -> 'b) -> 'a t -> 'b t

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
+  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
+  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12

Predicates and comparisons

val is_empty : 'a t -> bool

Test whether a map is empty or not.

val mem : key -> 'a t -> bool

mem x m returns true if m contains a binding for x, and false otherwise.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12

Converting

val to_list : 'a t -> (key * 'a) list

to_list m is bindings m.

  • since 5.1
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + ?eq:('a -> 'a -> bool) -> + ?print:(Stdlib.Format.formatter -> 'a -> unit) -> + 'a t -> + 'a t -> + 'a t

disjoint_union m1 m2 contains all bindings from m1 and m2. If some binding is present in both and the associated value is not equal, a Fatal_error is raised

val union_right : 'a t -> 'a t -> 'a t

union_right m1 m2 contains all bindings from m1 and m2. If some binding is present in both, the one from m2 is taken

val union_left : 'a t -> 'a t -> 'a t

union_left m1 m2 = union_right m2 m1

val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t
val rename : key t -> key -> key
val map_keys : (key -> key) -> 'a t -> 'a t
val keys : 'a t -> Stdlib.Set.Make(T).t
val data : 'a t -> 'a list
val of_set : (key -> 'a) -> Stdlib.Set.Make(T).t -> 'a t
val transpose_keys_and_data : key t -> key t
val transpose_keys_and_data_set : key t -> Stdlib.Set.Make(T).t t
val print : + (Stdlib.Format.formatter -> 'a -> unit) -> + Stdlib.Format.formatter -> + 'a t -> + unit
diff --git a/ocaml/Variable/Pair/Set/index.html b/ocaml/Variable/Pair/Set/index.html new file mode 100644 index 00000000..8aedcae1 --- /dev/null +++ b/ocaml/Variable/Pair/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Variable.Pair.Set)

Module Pair.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Variable/Pair/T/index.html b/ocaml/Variable/Pair/T/index.html new file mode 100644 index 00000000..edc539ef --- /dev/null +++ b/ocaml/Variable/Pair/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Variable.Pair.T)

Module Pair.T

type t = pair
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Variable/Pair/Tbl/index.html b/ocaml/Variable/Pair/Tbl/index.html new file mode 100644 index 00000000..52554ca0 --- /dev/null +++ b/ocaml/Variable/Pair/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Variable.Pair.Tbl)

Module Pair.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Variable/Pair/index.html b/ocaml/Variable/Pair/index.html new file mode 100644 index 00000000..e29fa0d2 --- /dev/null +++ b/ocaml/Variable/Pair/index.html @@ -0,0 +1,2 @@ + +Pair (ocaml.Variable.Pair)

Module Variable.Pair

module T : Identifiable.Thing with type t = pair
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
diff --git a/ocaml/Variable/Set/index.html b/ocaml/Variable/Set/index.html new file mode 100644 index 00000000..42d78e44 --- /dev/null +++ b/ocaml/Variable/Set/index.html @@ -0,0 +1,2 @@ + +Set (ocaml.Variable.Set)

Module Variable.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t

Sets

type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val cardinal : t -> int

Return the number of elements of a set.

Elements

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05

Searching

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Traversing

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

Transforming

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

Predicates and comparisons

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

Converting

val to_list : t -> elt list

to_list s is elements s.

  • since 5.1
val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
diff --git a/ocaml/Variable/T/index.html b/ocaml/Variable/T/index.html new file mode 100644 index 00000000..7879e18f --- /dev/null +++ b/ocaml/Variable/T/index.html @@ -0,0 +1,2 @@ + +T (ocaml.Variable.T)

Module Variable.T

type t = t
include Hashtbl.HashedType with type t := t
val equal : t -> t -> bool

The equality predicate used to compare keys.

val hash : t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := t
val compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
diff --git a/ocaml/Variable/Tbl/index.html b/ocaml/Variable/Tbl/index.html new file mode 100644 index 00000000..ecf6ca7c --- /dev/null +++ b/ocaml/Variable/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (ocaml.Variable.Tbl)

Module Variable.Tbl

include Hashtbl.S with type key = T.t and type 'a t = 'a Hashtbl.Make(T).t
type key = T.t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
  • since 4.00
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
  • since 4.05
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
  • since 4.03
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
  • since 4.00
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
  • since 4.07
val to_seq_keys : _ t -> key Stdlib.Seq.t
  • since 4.07
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
  • since 4.07
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
  • since 4.07
val to_list : 'a t -> (T.t * 'a) list
val of_list : (T.t * 'a) list -> 'a t
val to_map : 'a t -> 'a Stdlib.Map.Make(T).t
val of_map : 'a Stdlib.Map.Make(T).t -> 'a t
val memoize : 'a t -> (key -> 'a) -> key -> 'a
val map : 'a t -> ('a -> 'b) -> 'b t
diff --git a/ocaml/Variable/index.html b/ocaml/Variable/index.html new file mode 100644 index 00000000..b27ea568 --- /dev/null +++ b/ocaml/Variable/index.html @@ -0,0 +1,5 @@ + +Variable (ocaml.Variable)

Module Variable

Variable.t is the equivalent of a non-persistent Ident.t in the Flambda tree. It wraps an Ident.t together with its source compilation_unit. As such, it is unique within a whole program, not just one compilation unit.

Introducing a new type helps in tracing the source of identifiers when debugging the inliner. It also avoids Ident renaming when importing cmx files.

include Identifiable.S
type t
module T : Identifiable.Thing with type t = t
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val compare : T.t -> T.t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set : Identifiable.Set with module T := T
module Map : Identifiable.Map with module T := T
module Tbl : Identifiable.Tbl with module T := T
val create : + ?current_compilation_unit:Compilation_unit.t -> + Internal_variable_names.t -> + t
val create_with_same_name_as_ident : Ident.t -> t
val rename : ?current_compilation_unit:Compilation_unit.t -> t -> t
val in_compilation_unit : t -> Compilation_unit.t -> bool
val name : t -> string
val unique_name : t -> string
val get_compilation_unit : t -> Compilation_unit.t
val print_list : Stdlib.Format.formatter -> t list -> unit
val print_opt : Stdlib.Format.formatter -> t option -> unit
val debug_when_stamp_matches : t -> stamp:int -> f:(unit -> unit) -> unit

If the given variable has the given stamp, call the user-supplied function. For debugging purposes only.

type pair = t * t
module Pair : Identifiable.S with type t := pair
val compare_lists : t list -> t list -> int
val output_full : out_channel -> t -> unit

Unlike output, output_full includes the compilation unit.

diff --git a/ocaml/Warnings/index.html b/ocaml/Warnings/index.html new file mode 100644 index 00000000..4eec6186 --- /dev/null +++ b/ocaml/Warnings/index.html @@ -0,0 +1,2 @@ + +Warnings (ocaml.Warnings)

Module Warnings

Warning definitions

Warning: this module is unstable and part of compiler-libs.

type loc = {
  1. loc_start : Stdlib.Lexing.position;
  2. loc_end : Stdlib.Lexing.position;
  3. loc_ghost : bool;
}
val ghost_loc_in_file : string -> loc

Return an empty ghost range located in a given file

type field_usage_warning =
  1. | Unused
  2. | Not_read
  3. | Not_mutated
type constructor_usage_warning =
  1. | Unused
  2. | Not_constructed
  3. | Only_exported_private
type t =
  1. | Comment_start
  2. | Comment_not_end
  3. | Fragile_match of string
  4. | Ignored_partial_application
  5. | Labels_omitted of string list
  6. | Method_override of string list
  7. | Partial_match of string
  8. | Missing_record_field_pattern of string
  9. | Non_unit_statement
  10. | Redundant_case
  11. | Redundant_subpat
  12. | Instance_variable_override of string list
  13. | Illegal_backslash
  14. | Implicit_public_methods of string list
  15. | Unerasable_optional_argument
  16. | Undeclared_virtual_method of string
  17. | Not_principal of string
  18. | Non_principal_labels of string
  19. | Ignored_extra_argument
  20. | Nonreturning_statement
  21. | Preprocessor of string
  22. | Useless_record_with
  23. | Bad_module_name of string
  24. | All_clauses_guarded
  25. | Unused_var of string
  26. | Unused_var_strict of string
  27. | Wildcard_arg_to_constant_constr
  28. | Eol_in_string
  29. | Duplicate_definitions of string * string * string * string
  30. | Unused_value_declaration of string
  31. | Unused_open of string
  32. | Unused_type_declaration of string
  33. | Unused_for_index of string
  34. | Unused_ancestor of string
  35. | Unused_constructor of string * constructor_usage_warning
  36. | Unused_extension of string * bool * constructor_usage_warning
  37. | Unused_rec_flag
  38. | Name_out_of_scope of string * string list * bool
  39. | Ambiguous_name of string list * string list * bool * string
  40. | Disambiguated_name of string
  41. | Nonoptional_label of string
  42. | Open_shadow_identifier of string * string
  43. | Open_shadow_label_constructor of string * string
  44. | Bad_env_variable of string * string
  45. | Attribute_payload of string * string
  46. | Eliminated_optional_arguments of string list
  47. | No_cmi_file of string * string option
  48. | Unexpected_docstring of bool
  49. | Wrong_tailcall_expectation of bool
  50. | Fragile_literal_pattern
  51. | Misplaced_attribute of string
  52. | Duplicated_attribute of string
  53. | Inlining_impossible of string
  54. | Unreachable_case
  55. | Ambiguous_var_in_pattern_guard of string list
  56. | No_cmx_file of string
  57. | Flambda_assignment_to_non_mutable_value
  58. | Unused_module of string
  59. | Unboxable_type_in_prim_decl of string
  60. | Constraint_on_gadt
  61. | Erroneous_printed_signature of string
  62. | Unsafe_array_syntax_without_parsing
  63. | Redefining_unit of string
  64. | Unused_open_bang of string
  65. | Unused_functor_parameter of string
  66. | Match_on_mutable_state_prevent_uncurry
  67. | Unused_field of string * field_usage_warning
  68. | Missing_mli
  69. | Unused_tmc_attribute
  70. | Tmc_breaks_tailcall
  71. | Generative_application_expects_unit
type alert = {
  1. kind : string;
  2. message : string;
  3. def : loc;
  4. use : loc;
}
val parse_options : bool -> string -> alert option
val parse_alert_option : string -> unit

Disable/enable alerts based on the parameter to the -alert command-line option. Raises Arg.Bad if the string is not a valid specification.

val without_warnings : (unit -> 'a) -> 'a

Run the thunk with all warnings and alerts disabled.

val is_active : t -> bool
val is_error : t -> bool
val defaults_w : string
val defaults_warn_error : string
type reporting_information = {
  1. id : string;
  2. message : string;
  3. is_error : bool;
  4. sub_locs : (loc * string) list;
}
val report : t -> [ `Active of reporting_information | `Inactive ]
val report_alert : alert -> [ `Active of reporting_information | `Inactive ]
exception Errors
val check_fatal : unit -> unit
val reset_fatal : unit -> unit
val help_warnings : unit -> unit
type state
val backup : unit -> state
val restore : state -> unit
val with_state : state -> (unit -> 'a) -> 'a
val mk_lazy : (unit -> 'a) -> 'a Stdlib.Lazy.t

Like Lazy.of_fun, but the function is applied with the warning/alert settings at the time mk_lazy is called.

type description = {
  1. number : int;
  2. names : string list;
  3. description : string;
  4. since : Stdlib.Sys.ocaml_release_info option;
}
val descriptions : description list
diff --git a/ocaml/X86_ast/index.html b/ocaml/X86_ast/index.html new file mode 100644 index 00000000..a5c3ce49 --- /dev/null +++ b/ocaml/X86_ast/index.html @@ -0,0 +1,2 @@ + +X86_ast (ocaml.X86_ast)

Module X86_ast

Structured representation of Intel assembly language (32 and 64 bit).

type condition =
  1. | L
  2. | GE
  3. | LE
  4. | G
  5. | B
  6. | AE
  7. | BE
  8. | A
  9. | E
  10. | NE
  11. | O
  12. | NO
  13. | S
  14. | NS
  15. | P
  16. | NP
type float_condition =
  1. | EQf
  2. | LTf
  3. | LEf
  4. | UNORDf
  5. | NEQf
  6. | NLTf
  7. | NLEf
  8. | ORDf
type rounding =
  1. | RoundUp
  2. | RoundDown
  3. | RoundNearest
  4. | RoundTruncate
type constant =
  1. | Const of int64
  2. | ConstThis
  3. | ConstLabel of string
  4. | ConstAdd of constant * constant
  5. | ConstSub of constant * constant
type data_type =
  1. | NONE
  2. | REAL4
  3. | REAL8
  4. | BYTE
  5. | WORD
  6. | DWORD
  7. | QWORD
  8. | OWORD
  9. | NEAR
  10. | PROC
type reg64 =
  1. | RAX
  2. | RBX
  3. | RCX
  4. | RDX
  5. | RSP
  6. | RBP
  7. | RSI
  8. | RDI
  9. | R8
  10. | R9
  11. | R10
  12. | R11
  13. | R12
  14. | R13
  15. | R14
  16. | R15
type reg8h =
  1. | AH
  2. | BH
  3. | CH
  4. | DH
type registerf =
  1. | XMM of int
  2. | TOS
  3. | ST of int
type arch =
  1. | X64
  2. | X86
type addr = {
  1. arch : arch;
  2. typ : data_type;
  3. idx : reg64;
  4. scale : int;
  5. base : reg64 option;
  6. sym : string option;
  7. displ : int;
}

Addressing modes: displ + sym + base + idx * scale (if scale = 0, idx is ignored and base must be None)

type arg =
  1. | Imm of int64
    (*

    Operand is an immediate constant integer

    *)
  2. | Sym of string
    (*

    Address of a symbol (absolute address except for call/jmp target where it is interpreted as a relative displacement

    *)
  3. | Reg8L of reg64
  4. | Reg8H of reg8h
  5. | Reg16 of reg64
  6. | Reg32 of reg64
  7. | Reg64 of reg64
  8. | Regf of registerf
  9. | Mem of addr
  10. | Mem64_RIP of data_type * string * int
type instruction =
  1. | ADD of arg * arg
  2. | ADDSD of arg * arg
  3. | AND of arg * arg
  4. | ANDPD of arg * arg
  5. | BSWAP of arg
  6. | CALL of arg
  7. | CDQ
  8. | CMOV of condition * arg * arg
  9. | CMP of arg * arg
  10. | CMPSD of float_condition * arg * arg
  11. | COMISD of arg * arg
  12. | CQO
  13. | CVTSD2SI of arg * arg
  14. | CVTSD2SS of arg * arg
  15. | CVTSI2SD of arg * arg
  16. | CVTSS2SD of arg * arg
  17. | CVTTSD2SI of arg * arg
  18. | DEC of arg
  19. | DIVSD of arg * arg
  20. | FABS
  21. | FADD of arg
  22. | FADDP of arg * arg
  23. | FCHS
  24. | FCOMP of arg
  25. | FCOMPP
  26. | FCOS
  27. | FDIV of arg
  28. | FDIVP of arg * arg
  29. | FDIVR of arg
  30. | FDIVRP of arg * arg
  31. | FILD of arg
  32. | FISTP of arg
  33. | FLD of arg
  34. | FLD1
  35. | FLDCW of arg
  36. | FLDLG2
  37. | FLDLN2
  38. | FLDZ
  39. | FMUL of arg
  40. | FMULP of arg * arg
  41. | FNSTCW of arg
  42. | FNSTSW of arg
  43. | FPATAN
  44. | FPTAN
  45. | FSIN
  46. | FSQRT
  47. | FSTP of arg
  48. | FSUB of arg
  49. | FSUBP of arg * arg
  50. | FSUBR of arg
  51. | FSUBRP of arg * arg
  52. | FXCH of arg
  53. | FYL2X
  54. | HLT
  55. | IDIV of arg
  56. | IMUL of arg * arg option
  57. | INC of arg
  58. | J of condition * arg
  59. | JMP of arg
  60. | LEA of arg * arg
  61. | LEAVE
  62. | MOV of arg * arg
  63. | MOVAPD of arg * arg
  64. | MOVD of arg * arg
  65. | MOVLPD of arg * arg
  66. | MOVSD of arg * arg
  67. | MOVSS of arg * arg
  68. | MOVSX of arg * arg
  69. | MOVSXD of arg * arg
  70. | MOVZX of arg * arg
  71. | MULSD of arg * arg
  72. | NEG of arg
  73. | NOP
  74. | OR of arg * arg
  75. | POP of arg
  76. | PUSH of arg
  77. | RET
  78. | ROUNDSD of rounding * arg * arg
  79. | SAL of arg * arg
  80. | SAR of arg * arg
  81. | SET of condition * arg
  82. | SHR of arg * arg
  83. | SQRTSD of arg * arg
  84. | SUB of arg * arg
  85. | SUBSD of arg * arg
  86. | TEST of arg * arg
  87. | UCOMISD of arg * arg
  88. | XCHG of arg * arg
  89. | XOR of arg * arg
  90. | XORPD of arg * arg
type asm_line =
  1. | Ins of instruction
  2. | Align of bool * int
  3. | Byte of constant
  4. | Bytes of string
  5. | Comment of string
  6. | Global of string
  7. | Long of constant
  8. | NewLabel of string * data_type
  9. | Quad of constant
  10. | Section of string list * string option * string list
  11. | Space of int
  12. | Word of constant
  13. | External of string * data_type
  14. | Mode386
  15. | Model of string
  16. | Cfi_adjust_cfa_offset of int
  17. | Cfi_endproc
  18. | Cfi_startproc
  19. | Cfi_remember_state
  20. | Cfi_restore_state
  21. | Cfi_def_cfa_register of string
  22. | Cfi_def_cfa_offset of int
  23. | File of int * string
  24. | Indirect_symbol of string
  25. | Loc of int * int * int
  26. | Private_extern of string
  27. | Set of string * constant
  28. | Size of string * constant
  29. | Type of string * string
type asm_program = asm_line list
diff --git a/ocaml/X86_dsl/D/index.html b/ocaml/X86_dsl/D/index.html new file mode 100644 index 00000000..0bd3ab97 --- /dev/null +++ b/ocaml/X86_dsl/D/index.html @@ -0,0 +1,2 @@ + +D (ocaml.X86_dsl.D)

Module X86_dsl.D

Directives

val align : int -> unit
val byte : X86_ast.constant -> unit
val bytes : string -> unit
val cfi_adjust_cfa_offset : int -> unit
val cfi_endproc : unit -> unit
val cfi_startproc : unit -> unit
val cfi_remember_state : unit -> unit
val cfi_restore_state : unit -> unit
val cfi_def_cfa_register : string -> unit
val cfi_def_cfa_offset : int -> unit
val comment : string -> unit
val data : unit -> unit
val extrn : string -> X86_ast.data_type -> unit
val file : file_num:int -> file_name:string -> unit
val global : string -> unit
val indirect_symbol : string -> unit
val label : ?typ:X86_ast.data_type -> string -> unit
val loc : file_num:int -> line:int -> col:int -> unit
val long : X86_ast.constant -> unit
val mode386 : unit -> unit
val model : string -> unit
val private_extern : string -> unit
val qword : X86_ast.constant -> unit
val section : string list -> string option -> string list -> unit
val setvar : (string * X86_ast.constant) -> unit
val size : string -> X86_ast.constant -> unit
val space : int -> unit
val text : unit -> unit
val type_ : string -> string -> unit
val word : X86_ast.constant -> unit
diff --git a/ocaml/X86_dsl/I/index.html b/ocaml/X86_dsl/I/index.html new file mode 100644 index 00000000..d42b42db --- /dev/null +++ b/ocaml/X86_dsl/I/index.html @@ -0,0 +1,2 @@ + +I (ocaml.X86_dsl.I)

Module X86_dsl.I

val add : X86_ast.arg -> X86_ast.arg -> unit
val addsd : X86_ast.arg -> X86_ast.arg -> unit
val and_ : X86_ast.arg -> X86_ast.arg -> unit
val andpd : X86_ast.arg -> X86_ast.arg -> unit
val bswap : X86_ast.arg -> unit
val call : X86_ast.arg -> unit
val cdq : unit -> unit
val cmp : X86_ast.arg -> X86_ast.arg -> unit
val comisd : X86_ast.arg -> X86_ast.arg -> unit
val cqo : unit -> unit
val cvtsd2ss : X86_ast.arg -> X86_ast.arg -> unit
val cvtsi2sd : X86_ast.arg -> X86_ast.arg -> unit
val cvtss2sd : X86_ast.arg -> X86_ast.arg -> unit
val cvttsd2si : X86_ast.arg -> X86_ast.arg -> unit
val dec : X86_ast.arg -> unit
val divsd : X86_ast.arg -> X86_ast.arg -> unit
val fabs : unit -> unit
val fadd : X86_ast.arg -> unit
val faddp : X86_ast.arg -> X86_ast.arg -> unit
val fchs : unit -> unit
val fcomp : X86_ast.arg -> unit
val fcompp : unit -> unit
val fcos : unit -> unit
val fdiv : X86_ast.arg -> unit
val fdivp : X86_ast.arg -> X86_ast.arg -> unit
val fdivr : X86_ast.arg -> unit
val fdivrp : X86_ast.arg -> X86_ast.arg -> unit
val fild : X86_ast.arg -> unit
val fistp : X86_ast.arg -> unit
val fld1 : unit -> unit
val fld : X86_ast.arg -> unit
val fldcw : X86_ast.arg -> unit
val fldlg2 : unit -> unit
val fldln2 : unit -> unit
val fldz : unit -> unit
val fmul : X86_ast.arg -> unit
val fmulp : X86_ast.arg -> X86_ast.arg -> unit
val fnstcw : X86_ast.arg -> unit
val fnstsw : X86_ast.arg -> unit
val fpatan : unit -> unit
val fptan : unit -> unit
val fsin : unit -> unit
val fsqrt : unit -> unit
val fstp : X86_ast.arg -> unit
val fsub : X86_ast.arg -> unit
val fsubp : X86_ast.arg -> X86_ast.arg -> unit
val fsubr : X86_ast.arg -> unit
val fsubrp : X86_ast.arg -> X86_ast.arg -> unit
val fxch : X86_ast.arg -> unit
val fyl2x : unit -> unit
val hlt : unit -> unit
val idiv : X86_ast.arg -> unit
val imul : X86_ast.arg -> X86_ast.arg option -> unit
val inc : X86_ast.arg -> unit
val j : X86_ast.condition -> X86_ast.arg -> unit
val ja : X86_ast.arg -> unit
val jae : X86_ast.arg -> unit
val jb : X86_ast.arg -> unit
val jbe : X86_ast.arg -> unit
val je : X86_ast.arg -> unit
val jg : X86_ast.arg -> unit
val jmp : X86_ast.arg -> unit
val jne : X86_ast.arg -> unit
val jp : X86_ast.arg -> unit
val lea : X86_ast.arg -> X86_ast.arg -> unit
val mov : X86_ast.arg -> X86_ast.arg -> unit
val movapd : X86_ast.arg -> X86_ast.arg -> unit
val movd : X86_ast.arg -> X86_ast.arg -> unit
val movsd : X86_ast.arg -> X86_ast.arg -> unit
val movss : X86_ast.arg -> X86_ast.arg -> unit
val movsx : X86_ast.arg -> X86_ast.arg -> unit
val movsxd : X86_ast.arg -> X86_ast.arg -> unit
val movzx : X86_ast.arg -> X86_ast.arg -> unit
val mulsd : X86_ast.arg -> X86_ast.arg -> unit
val neg : X86_ast.arg -> unit
val nop : unit -> unit
val or_ : X86_ast.arg -> X86_ast.arg -> unit
val pop : X86_ast.arg -> unit
val push : X86_ast.arg -> unit
val ret : unit -> unit
val sal : X86_ast.arg -> X86_ast.arg -> unit
val sar : X86_ast.arg -> X86_ast.arg -> unit
val set : X86_ast.condition -> X86_ast.arg -> unit
val shr : X86_ast.arg -> X86_ast.arg -> unit
val sqrtsd : X86_ast.arg -> X86_ast.arg -> unit
val sub : X86_ast.arg -> X86_ast.arg -> unit
val subsd : X86_ast.arg -> X86_ast.arg -> unit
val test : X86_ast.arg -> X86_ast.arg -> unit
val ucomisd : X86_ast.arg -> X86_ast.arg -> unit
val xchg : X86_ast.arg -> X86_ast.arg -> unit
val xor : X86_ast.arg -> X86_ast.arg -> unit
val xorpd : X86_ast.arg -> X86_ast.arg -> unit
diff --git a/ocaml/X86_dsl/index.html b/ocaml/X86_dsl/index.html new file mode 100644 index 00000000..cafe3013 --- /dev/null +++ b/ocaml/X86_dsl/index.html @@ -0,0 +1,16 @@ + +X86_dsl (ocaml.X86_dsl)

Module X86_dsl

Helpers for Intel code generators

val sym : string -> X86_ast.arg
val nat : nativeint -> X86_ast.arg
val int : int -> X86_ast.arg
val const_32 : int32 -> X86_ast.constant
val const_nat : nativeint -> X86_ast.constant
val const : int -> X86_ast.constant
val al : X86_ast.arg
val ah : X86_ast.arg
val cl : X86_ast.arg
val ax : X86_ast.arg
val rax : X86_ast.arg
val rbx : X86_ast.arg
val rdx : X86_ast.arg
val r10 : X86_ast.arg
val r11 : X86_ast.arg
val r12 : X86_ast.arg
val r13 : X86_ast.arg
val r14 : X86_ast.arg
val r15 : X86_ast.arg
val rsp : X86_ast.arg
val rbp : X86_ast.arg
val xmm15 : X86_ast.arg
val eax : X86_ast.arg
val ebx : X86_ast.arg
val ecx : X86_ast.arg
val edx : X86_ast.arg
val ebp : X86_ast.arg
val esp : X86_ast.arg
val st0 : X86_ast.arg
val st1 : X86_ast.arg
val mem32 : + X86_ast.data_type -> + ?scale:int -> + ?base:X86_ast.reg64 -> + ?sym:string -> + int -> + X86_ast.reg64 -> + X86_ast.arg
val mem64 : + X86_ast.data_type -> + ?scale:int -> + ?base:X86_ast.reg64 -> + ?sym:string -> + int -> + X86_ast.reg64 -> + X86_ast.arg
val mem64_rip : X86_ast.data_type -> ?ofs:int -> string -> X86_ast.arg
module D : sig ... end

Directives

module I : sig ... end
diff --git a/ocaml/X86_gas/index.html b/ocaml/X86_gas/index.html new file mode 100644 index 00000000..11989fec --- /dev/null +++ b/ocaml/X86_gas/index.html @@ -0,0 +1,2 @@ + +X86_gas (ocaml.X86_gas)

Module X86_gas

Emit assembly instructions for gas.

val generate_asm : out_channel -> X86_ast.asm_line list -> unit
diff --git a/ocaml/X86_masm/index.html b/ocaml/X86_masm/index.html new file mode 100644 index 00000000..89b3e764 --- /dev/null +++ b/ocaml/X86_masm/index.html @@ -0,0 +1,2 @@ + +X86_masm (ocaml.X86_masm)

Module X86_masm

Emit assembly instructions for MASM (Intel syntax).

val generate_asm : out_channel -> X86_ast.asm_line list -> unit
diff --git a/ocaml/X86_proc/index.html b/ocaml/X86_proc/index.html new file mode 100644 index 00000000..eee7a07d --- /dev/null +++ b/ocaml/X86_proc/index.html @@ -0,0 +1,7 @@ + +X86_proc (ocaml.X86_proc)

Module X86_proc

Definitions shared between the 32 and 64 bit Intel backends.

Helpers for textual emitters

val string_of_reg8l : X86_ast.reg64 -> string
val string_of_reg8h : X86_ast.reg8h -> string
val string_of_reg16 : X86_ast.reg64 -> string
val string_of_reg32 : X86_ast.reg64 -> string
val string_of_reg64 : X86_ast.reg64 -> string
val string_of_registerf : X86_ast.registerf -> string
val string_of_string_literal : string -> string
val string_of_condition : X86_ast.condition -> string
val string_of_float_condition : X86_ast.float_condition -> string
val string_of_symbol : string -> string -> string
val string_of_rounding : X86_ast.rounding -> string
val buf_bytes_directive : Stdlib.Buffer.t -> string -> string -> unit

Buffer of assembly code

val emit : X86_ast.instruction -> unit
val directive : X86_ast.asm_line -> unit
val reset_asm_code : unit -> unit

Code emission

val generate_code : (X86_ast.asm_line list -> unit) option -> unit

Post-process the stream of instructions. Dump it (using the provided syntax emitter) in a file (if provided) and compile it with an internal assembler (if registered through register_internal_assembler).

val assemble_file : string -> string -> int

Generate an object file corresponding to the last call to generate_code. An internal assembler is used if available (and the input file is ignored). Otherwise, the source asm file with an external assembler.

System detection

type system =
  1. | S_macosx
  2. | S_gnu
  3. | S_cygwin
  4. | S_solaris
  5. | S_win32
  6. | S_linux_elf
  7. | S_bsd_elf
  8. | S_beos
  9. | S_mingw
  10. | S_win64
  11. | S_linux
  12. | S_mingw64
  13. | S_freebsd
  14. | S_netbsd
  15. | S_openbsd
  16. | S_unknown
val system : system
val masm : bool
val windows : bool
val use_plt : bool

Whether calls need to go via the PLT.

Support for plumbing a binary code emitter

val register_internal_assembler : + (X86_ast.asm_program -> string -> unit) -> + unit
val with_internal_assembler : + (X86_ast.asm_program -> string -> unit) -> + (unit -> 'a) -> + 'a
diff --git a/ocaml/_doc-dir/Changes b/ocaml/_doc-dir/Changes new file mode 100644 index 00000000..61509659 --- /dev/null +++ b/ocaml/_doc-dir/Changes @@ -0,0 +1,13681 @@ +OCaml 5.1.1 (8 December 2023) +---------------------------- + +### Standard library: + +* #12562, #12734, #12783: Remove the `Marshal.Compression` flag to the + `Marshal.to_*` functions introduced in 5.1 by #12006, as it cannot + be implemented without risking to link -lzstd with all + ocamlopt-generated executables. The compilers are still able to use + ZSTD compression for compilation artefacts. + (Xavier Leroy and David Allsopp, report by Kate Deplaix, review by + Nicolás Ojeda Bär, Kate Deplaix, and Damien Doligez). + +### Bug fixes: + +- #11800, #12707: fix an assertion race condition in `install_backup_thread` + (Jan Midtgaard, review by Gabriel Scherer) + +- #12318: GC: simplify the meaning of custom_minor_max_size: blocks with + out-of-heap memory above this limit are now allocated directly in + the major heap. + (Damien Doligez, report by Stephen Dolan, review by Gabriel Scherer) + +- #12439: Finalize and collect dead custom blocks during minor collection + (Damien Doligez, review by Xavier Leroy, Gabriel Scherer and KC + Sivaramakrishnan) + +- #12486, #12535: Fix delivery of unhandled effect exceptions on amd64 with + --enable-frame-pointers + (Miod Vallat, report by Jan Midtgaard, review by Gabriel Scherer) + +- #12581, #12609: Fix error on uses of packed modules outside their pack + to correctly handle nested packs + (Vincent Laviron, report by Javier Chávarri, review by Pierre Chambart) + +- #12590, #12595: Move `caml_collect_gc_stats_sample` in + `caml_empty_minor_heap_promote` before barrier arrival. + (B. Szilvasy, review by Gabriel Scherer) + +- #12623, fix the computation of variance composition + (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer) + +- #12645, #12649 fix error messages for cyclic type definitions in presence of + the `-short-paths` flag. + (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer) + +- #12712, #12742: fix an assertion boundary case in `caml_reset_young_limit` + (Jan Midtgaard, review by Guillaume Munch-Maccagnoni) + +- #12713, #12715: disable common subexpression elimination for atomic loads + (Gabriel Scherer and Vincent Laviron, + review by Vincent Laviron, KC Sivaramakrishnan and Xavier Leroy, + report by Vesa Karvonen and Carine Morel) + +- #12757: Fix ocamlnat (native toplevel) by registering frametables correctly + (Stephen Dolan, Nick Barnes and Mark Shinwell, + review by Vincent Laviron and Sébastien Hinderer) + +- #12791: `extern` is applied to definitions of `caml_builtin_cprim` + and `caml_names_of_builtin_cprim` when linking bytecode '-custom' + executables with a C++ linker. + (Shayne Fletcher, review by Antonin Décimo and Xavier Leroy) + + +OCaml 5.1.0 (14 September 2023) +------------------------------- + +### Restored backends + +- #11418, #11708: RISC-V multicore support. + (Nicolás Ojeda Bär, review by KC Sivaramakrishnan) + +- #11712, #12258, #12261: s390x / IBM Z multicore support: + OCaml & C stack separation; dynamic stack size checks; fiber and + effects support. + (Aleksei Nikiforov, with help from Vincent Laviron and Xavier Leroy, + additional suggestions by Luc Maranget, + review by the same and KC Sivaramakrishnan) + +- #11642: Restore Cygwin port. Add GC messages for address space reservations + when OCAMLRUNPARAM option v includes 0x1000. + (David Allsopp, review by Xavier Leroy, Guillaume Munch-Maccagnoni + and Gabriel Scherer) + +### Standard library: + +- #12006, #12064: Add `Marshal.Compression` flag to `Marshal.to_*` functions. + When this flag is explicitly set, marshaled data is compressed using ZSTD. + On some practical examples, the marshalled output became three times smaller + at no noticeable cost on the marshalling time. + (Xavier Leroy, review by Edwin Török and Gabriel Scherer, fix by Damien + Doligez) + +- #10464: Add List.is_empty. + (Craig Ferguson, review by David Allsopp) + +- #11848: Add `List.find_mapi`, + `List.find_index: ('a -> bool) -> 'a list -> int option`, + `Seq.find_mapi`, `Seq.find_index`, `Array.find_mapi`, `Array.find_index`, + `Float.Array.find_opt`, `Float.Array.find_index`, `Float.Array.find_map`, + `Float.Array.find_mapi`. + (Sima Kinsart, review by Daniel Bünzli and Nicolás Ojeda Bär) + +- #11410: Add Set.to_list, Map.to_list, Map.of_list, + `Map.add_to_list: key -> 'a -> 'a list t -> 'a list t`. + (Daniel Bünzli, review by Nicolás Ojeda Bär and Gabriel Scherer) + +- #11836, #11837: Add `Array.map_inplace`, `Array.mapi_inplace`, + `Float.Array.mapi_inplace` and `Float.Array.mapi_inplace`. + (Léo Andrès, review by Gabriel Scherer, KC Sivaramakrishnan and + Nicolás Ojeda Bär) + +- #10967: Add Filename.temp_dir. + (David Turner, review by Anil Madhavapeddy, Valentin Gatien-Baron, Nicolás + Ojeda Bär, Gabriel Scherer, and Daniel Bünzli) + +- #11246: Add "hash" and "seeded_hash" functions to Bool, Int, Char, Float, + Int32, Int64, and Nativeint. + (Nicolás Ojeda Bär, review by Xavier Leroy and Gabriel Scherer) + +- #11488: Add `Mutex.protect: Mutex.t -> (unit -> 'a) -> 'a` + for resource-safe critical sections protected by a mutex. + (Simon Cruanes, review by Gabriel Scherer, Xavier Leroy, + Guillaume Munch-Maccagnoni) + +- #11581: Add type equality witness + `type (_, _) eq = Equal: ('a, 'a) eq` + in a new module Stdlib.Type. + (Nicolás Ojeda Bär, review by Daniel Bünzli, Jacques Garrigue, Florian + Angeletti, Alain Frisch, Gabriel Scherer, Jeremy Yallop and Xavier Leroy) + +- #11843: Add `In_channel.input_lines` and `In_channel.fold_lines`. + (Xavier Leroy, review by Nicolás Ojeda Bär and Wiktor Kuchta). + +- #11856, #11859: Using TRMC, the following `Stdlib` functions are now + tail-recursive: + Stdlib.(@), List.append, + List.concat_map. + (Jeremy Yallop, review by Daniel Bünzli, Anil Madhavapeddy, Nicolás Ojeda Bär, + Gabriel Scherer, and Bannerets) + +- #11362, #11402: Using TRMC, the following `Stdlib` functions are now + tail-recursive: + List.map, List.mapi, List.map2, + List.filter, List.filteri, List.filter_map, + List.init, + List.of_seq. + (Nicolás Ojeda Bär, review by Xavier Leroy and Gabriel Scherer) + + +- #11878, #11965: Prevent seek_in from marking buffer data as valid after + closing the channel. This could lead to inputting uninitialized bytes. + (Samuel Hym, review by Xavier Leroy and Olivier Nicole) + +- #11128: Add In_channel.isatty, Out_channel.isatty. + (Nicolás Ojeda Bär, review by Gabriel Scherer and Florian Angeletti) + +- #10859: Add `Format.pp_print_iter` and `Format.pp_print_array`. + (Léo Andrès and Daniel Bünzli, review by David Allsopp and Hugo Heuzard) + +- #10789: Add `Stack.drop` + (Léo Andrès, review by Gabriel Scherer) + +* #10899: Change Stdlib.nan from signaling NaN to quiet NaN. + (Greta Yorsh, review by Xavier Leroy, Guillaume Melquiond and + Gabriel Scherer) + +- #11026, #11667, #11858: Rename the type of the accumulator + of fold functions to 'acc: + fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc + fold_right : ('a -> 'acc -> 'acc) -> 'a list -> 'acc -> 'acc + fold_left_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> 'acc * 'b list + ... + (Valentin Gatien-Baron and Francois Berenger, + review by Gabriel Scherer and Nicolás Ojeda Bär) + +- #11354: Hashtbl.find_all is now tail-recursive. + (Fermín Reig, review by Gabriel Scherer) + +- #11500: Make Hashtbl.mem non-allocating. + (Simmo Saan, review by Nicolás Ojeda Bär) + +- #11412: Add Sys.is_regular_file + (Xavier Leroy, review by Anil Madhavapeddy, Nicolás Ojeda Bär, David Allsopp) + +- #11322, #11329: serialization functions Random.State.{of,to}_binary_string + between Random.State.t and string + (Gabriel Scherer, report by Yotam Barnoy, + review by Daniel Bünzli, Damien Doligez, Hugo Heuzard and Xavier Leroy) + +- #11830: Add Type.Id with + `val provably_equal : 'a Type.Id.t -> 'b Type.Id.t -> ('a, 'b) Type.eq option` + (Daniel Bünzli, review by Jeremy Yallop, Gabriel Scherer, Wiktor Kuchta, + Nicolás Ojeda Bär) + +- #12184, #12320: Sys.rename Windows fixes on directory corner cases. + (Jan Midtgaard, review by Anil Madhavapeddy) + +* #11565: Enable -strict-formats by default. Some incorrect format + specifications (for `printf`) where silently ignored and now fail. + Those new failures occur at compile-time, except if you use advanced + format features like `%(...%)` that parse format strings dynamically. + Pass -no-strict-formats to revert to the previous lenient behavior. + (Nicolás Ojeda Bär, review by David Allsopp) + +### Installation size + + Specific efforts have been made during this release to reduce the filesystem +size of installed artifacts of the compiler distribution. +The installation size of 5.1 is 272 MiB compared to 521 MiB for 5.0. +Some of those changes will benefit all OCaml packages. + +- ocaml/RFCs#23, #12006: use compressed marshaled format from #12006 for .cmi, + .cmt, .cmti files, and for debug info in .cmo and .cma files, resulting in + major reduction in size. + (Xavier Leroy, review by Edwin Török and Gabriel Scherer, + RFC by Simon Cruanes) + +- #11981: Reduce size of OCaml installations by removing debugging information + from installed bytecode executables. It is no longer possible to + run ocamldebug over these installed bytecode executables, nor to get + exception backtraces for them. + (Xavier Leroy, review by David Allsopp, report by Fabrice Le Fessant) + +* #11993: install only bytecode executables for the `ocamlmklib`, `ocamlcmt`, + `ocamlprof`, `ocamlcp`, `ocamloptp`, and `ocamlmktop` tools, but no + native-code executables. A tool like `ocamlmklib` for example is now + installed directly to `$BINDIR/ocamlmklib`; `ocamlmklib.byte` and + `ocamlmklib.opt` are no longer installed to `$BINDIR`. + (Xavier Leroy, review by Gabriel Scherer) + +### Runtime system: + +- #11589, #11903: Modify the GC pacing code to make sure the GC keeps + up with allocations in the presence of idle domains. + (Damien Doligez and Stephen Dolan, report by Florian Angeletti, + review by KC Sivaramakrishnan and Sadiq Jaffer) + +- #11743: Speed up weak array operations + (KC Sivaramakrishnan, review by François Bobot and Sadiq Jaffer) + +- #12131: Simplify implementation of weak hash sets, fixing a + performance regression. (Nick Barnes, review by François Bobot, + Alain Frisch and Damien Doligez). + +- #11474, #11998, #12065: Add support for user-defined events in the runtime + event tracing system. + (Lucas Pluvinage, review by Sadiq Jaffer, Guillaume Munch-Maccagnoni, + Enguerrand Decorne, Gabriel Scherer and Anil Madhavapeddy) + +- #11827, #12249: Restore prefetching for GC marking + (Fabrice Buoro and Stephen Dolan, review by Gabriel Scherer and Sadiq Jaffer) + +- #11144: Restore frame-pointers support for amd64 + (Fabrice Buoro, review by Frederic Bour and KC Sivaramakrishnan) + +- #11935: Load frametables of dynlink'd modules in batch + (Stephen Dolan, review by David Allsopp and Guillaume Munch-Maccagnoni) + +- #11284, #12525: Use compression of entries scheme when pruning mark stack. + Can decrease memory usage for some workloads, otherwise should be + unobservable. + (Tom Kelly, review by Sabine Schmaltz, Sadiq Jaffer and Damien Doligez) + +* #11865, #11868, #11876: Clarify that the operations of a custom + block must never access the OCaml runtime. The previous + documentation only mentioned the main illicit usages. In particular, + since OCaml 5.0, it is no longer safe to call + `caml_remove_global_root` or `caml_remove_generational_global_root` + from within the C finalizer of a custom block, or within the + finalization function passed to `caml_alloc_final`. As a workaround, + such a finalization operation can be registered with `Gc.finalize` + instead, which guarantees to run the finalizer at a safe point. + (Report by Timothy Bourke, discussion by Yotam Barnoy, Timothy + Bourke, Sadiq Jaffer, Xavier Leroy, Guillaume Munch-Maccagnoni, and + Gabriel Scherer) + +- #12130: Fix multicore crashes with weak hash sets. Fixes #11934. + (Nick Barnes, review by François Bobot) + +- #12099: Add ocamlrund option, -events, to produce a trace of + debug events during bytecode interpretation. Fixes #12098. + (Richard L Ford, review by Gabriel Scherer) + +- #12001: Fix book keeping for last finalisers during the minor cycle + (KC Sivaramakrishnan and Enguerrand Decorne, report by Guillaume Bury + and Vincent Laviron, review by Sadiq Jaffer and KC Sivaramakrishnan) + +- #11919: New runtime events counters for major heap stats and minor heap + resizing. + (Sadiq Jaffer, review by Gabriel Scherer and David Allsopp) + +- #11287, #11872, #11955: Clean up reserved header bits (once used for + Spacetime profiling). + (Nick Barnes, review by Gabriel Scherer and Damien Doligez) + +- #11750: Decouple major slice from minor GC. + (KC Sivaramakrishnan, review by Sadiq Jaffer, Guillaume Munch-Maccagnoni and + Damien Doligez) + +- #11796: protect lazy computation of code fragment digest by a mutex. + This makes the thread sanitizer happier, and avoids duplicating + the hashing work. + (Gabriel Scherer, review by Xavier Leroy, report by Olivier Nicole) + +- #11137: new `Unsafe_store_tag(val, new_tag)` macro to stop using + `Tag_val(val)` as lvalue. + (Gabriel Scherer, review by Xavier Leroy, Guillaume Munch-Maccagnoni + and Nicolás Ojeda Bär) + +- #11880: Restore the correct sigmask in systhreads. + (Christiano Haesbaert, review by Guillaume Munch-Maccagnoni and + Sébastien Hinderer) + +- #11881: Fix thread-unsafety of registration of operations for "custom" + values. + (Guillaume Munch-Maccagnoni, review by Gabriel Scherer and KC + Sivaramakrishnan) + +- #11980: fix quadratic behavior in natdynlink by using a STW section + for frame-descriptor updates. + (Gabriel Scherer, review by Sadiq Jaffer, report by André Maroneze + for Frama-C and Guillaume Melquiond for Coq) + +- #12121: unrooted implementations of caml_callback*_exn + (Gabriel Scherer, review by KC Sivaramakrishnan and Xavier Leroy) + +- #3921, #12039, #12128: poll for signals in long-running polymorphic + comparisons. + (B. Szilvasy, Gabriel Scherer and Xavier Leroy, review by + Stefan Muenzel, Guillaume Munch-Maccagnoni and Damien Doligez) + +- #12231: Support MinGW-w64 11.0 winpthreads library, where the macro + to set up to get flexdll working changed + (David Allsopp and Samuel Hym, light review by Xavier Leroy) + +- #12491, #12493, #12500, #12754: Do not change GC pace when creating + sub-arrays of bigarrays + (Xavier Leroy, report by Ido Yariv, analysis by Gabriel Scherer, + review by Gabriel Scherer and Fabrice Buoro) + +### Language features: + +* #11694: Add short syntax for generative functor types `() -> ...` + (Jeremy Yallop, review by Gabriel Scherer, Nicolás Ojeda Bär, + Jacques Garrigue) + + +* #11457: Remove old polymorphic variant syntax. + With ``type t = [ `A | `B ]``, one could use the syntax `#t` in types, + where it means the same thing as `[< t]`, and in patterns, where it means + ``(`A | `B)``. The use of `#t` in types for polymorphic variants + was deprecated since 2001, and is now removed. The syntax remains available + in patterns, or for objects -- when `t` is a class type. + (Stefan Muenzel, review by Gabriel Scherer and Jacques Garrigue) + +* #11984: Add dedicated syntax for generative functor application. + Previously, OCaml did not distinguish between `F ()` and + `F (struct end)`, even though the latter looks applicative. Instead, + the decision between generative and applicative functor application + was made based on the type of `F`. With this patch, we now distinguish + these two application forms; writing `F (struct end)` for a generative + functor leads to new warning 73. + (Frederic Bour and Richard Eisenberg, review by Florian Angeletti) + + +- #9975, #11365: Make empty types (`type t = |`) immediate. + (Antal Spector-Zabusky, review by Gabriel Scherer) + +### Type system: + +* #6941, #11187, #12483: prohibit using classes through recursive modules + inheriting or including a class belonging to a mutually-recursive module + would previous behave incorrectly, and now results in a clean error. + (Leo White, review by Gabriel Scherer and Florian Angeletti) + +* #12189, #12211: anonymous row variables in explicitly polymorphic type + annotation, e.g. `'a. [< X of 'a ] -> 'a`, are now implicitly + universally quantified (in other words, the example above is now read + as `'a 'r. ([< X of 'a ] as 'r) -> 'a`). + (Florian Angeletti and Gabriel Scherer, review by Jacques Garrigue) + +### Code generation and optimizations: + +- #11967: Remove traces of Obj.truncate, which allows some mutable + loads to become immutable. + (Nick Barnes, review by Vincent Laviron and KC Sivaramakrishnan) + +- #9945, #10883: Turn boolean-result float comparisons into primitive operations + Uses the architecture's elementary operations for float comparisons, + when available, rather than branching and then setting the return value. + (Stefan Muenzel, review by Stephen Dolan, Alain Frisch and Vincent Laviron) + +- #8998, #11321, #11430: change mangling of OCaml long identifiers + from `camlModule__name_NNN` to `camlModule.name_NNN`. The previous + mangling schema, using `__`, was ambiguous. + (Xavier Leroy, report by sliquister and Michael Bacarella, + review by Gabriel Scherer) + +- #10834: The -safer-matching option disables type-based optimizations of + pattern-matching compilation. This allows to produce a match failure if + a pattern-matching was wrongly assumed to be exhaustive. Since the + exhaustiveness check for GADTs has had bugs in the past, it may be + useful if you need extra security with GADTs. + (Jacques Garrigue, review by Gabriel Scherer) + +- #11102: Speed up register allocation by permanently spilling registers + (Stephen Dolan, review by Xavier Leroy) + +- #11383: Restrict the local function optimisation to forbid moving code + inside a sub-function + (Vincent Laviron, review by Gabriel Scherer) + +- #11686: Better spilling heuristic for the Linear Scan allocator for more + efficient stack usage. + (Nicolás Ojeda Bär, Gabriel Scherer, Alain Frisch, review by Gabriel Scherer, + Alain Frisch and Nathanaëlle Courant) + +- #11904: Remove arm, i386 native-code backends that were already + disabled at configuration time. + (Nicolás Ojeda Bär, review by Stephen Dolan, Anil Madhavapeddy, and Xavier + Leroy) + +- #11134: Optimise 'include struct' in more cases + (Stephen Dolan, review by Leo White and Vincent Laviron) + +### Other libraries: + +- #11374: Remove pointer cast to a type with stricter alignment requirements + in Windows implementation of Unix.gettimeofday. Windows implementations of + caml_unix_map_file, caml_unix_lseek and caml_unix_lseek_64 now release the + runtime lock. Windows implementation of caml_unix_lockf modernised and + simplified. Where possible, 64 bit integers are used instead of LARGE_INTEGER + structs. + (David Allsopp, review by Jonah Beckford and Xavier Leroy) + +- #11475: Make Unix terminal interface bindings domain-safe + (Olivier Nicole and Xavier Leroy, review by Xavier Leroy) + +- #11775: Unix.write on a non-blocking socket under Windows will return normally + if the write blocks after some data has already been written (as otherwise + there is no way of knowing how much data has been written before + blocking). The same behaviour was already present under Unix. + (Nicolás Ojeda Bär, review by David Allsopp) + +* #11991: Unix on Windows: map ERROR_TOO_MANY_LINKS to EMLINK. + (Nicolás Ojeda Bär) + +- #12067: Document Windows specific meanings of `Unix.process_status` + type + (Samuel Hym, review by David Allsopp) + +- #12072: Document and test that Sys.rename works over directories too + (Jan Midtgaard, review by Anil Madhavapeddy and Xavier Leroy) + +### Tools: + +- #11889, #11978: ocamldoc: handle injectivity annotations and wildcards in type + parameters. + (Florian Angeletti, report by Wiktor Kuchta, review by Jules Aguillon) + +- #11787: Fix GDB scripts to work with OCaml 5's heap layout. (Nick + Barnes) + +- #11772: fix ocamlyacc's handling of raw string literals + (Demi Marie Obenour) + +- #9290: Add a directive to switch off debugging in toplevel. + This allows to see optimized bytecode with -dlambda. + (Jacques Garrigue, review by Gabriel Scherer) + +- #11166: ocamllex: the union of two character sets "cset1 | cset2" can now be + used in any context where a character set is expected. + (Nicolás Ojeda Bär, Martin Jambon, review by Sébastien Hinderer) + +- #11718: ocamlyacc: OCaml-style comments are now supported, in addition to + the C-style comments already supported. The syntax is the same as that used + in OCaml code. + (Demi Marie Obenour, review by Damien Doligez) + +- #11728: ocamlyacc: generate line directives for %type declarations + (Demi Marie Obenour, review by Damien Doligez) + +- #11773: ocamlyacc: Do not allow quoted literals (such as 'a' or "bc") + in a token name or %type declaration. Previously such literals were + accepted by ocamlyacc, but produced malformed OCaml that was rejected + by the compiler. + (Demi Marie Obenour, review by Gabriel Scherer) + +- #11774: ocamlyacc: fail if there is an I/O error + (Demi Marie Obenour, review by Gabriel Scherer) + +- #11973: Add support for postfixed mingw host triplets + (Romain Beauxis) + +- #12165: ocamldoc, use standard doctype to avoid quirk mode. + (Florian Angeletti, review by Gabriel Scherer) + +### Manual and documentation: + +- #11476: Add examples in documentation of Hashtbl, Queue, Atomic, Format + (Simon Cruanes, review by Yotam Barnoy, Gabriel Scherer, Daniel Bünzli, + Ulugbek Abdullaev, and Nicolás Ojeda Bär) + +- #11883, #11884: Update documentation for In_channel and Out_channel + with examples and sections to group related functions. + (Kiran Gopinathan, review by Daniel Bünzli and Xavier Leroy) + + +- #12095, #12097: Put the sample code of the user's manual and reference + documentation of the standard library under the CC0 1.0 Universal + (CC0 1.0) Public Domain Dedication license. + +- #11892: Document the semantic differences of Unix.exec* between Unix and + Windows. + (Boris Yakobowski, review by Daniel Bünzli, Gabriel Scherer and Nicolás Ojeda + Bär) + +- #9430, #11291: Document the general desugaring rules for binding operators. + (Gabriel Scherer, review by Nicolás Ojeda Bär) + +- #11481: Fix the type of Unix.umask to Unix.file_perm -> Unix.file_perm + (Favonia, review by Sébastien Hinderer) + +- #11514: Document ocamltest builtin variables and actions + (Olivier Nicole, review by Sébastien Hinderer) + +- #11676: Fix missing since annotation in the `Sys` and `Format` modules + (Github user Bukolab99, review by Florian Angeletti) + +- #12028: Update format documentation to make it clearer that + `pp_print_newline` flushes its newline + (Florian Angeletti, review by Gabriel Scherer) + +- #12201: in the tutorial on modules, replace priority queue example by + a simpler example based on FIFO queues. + (Xavier Leroy, review by Anil Madhavapeddy and Nicolás Ojeda Bär). + +- #12352: Fix a typo in the documentation of Arg.write_arg + (Christophe Raffalli, review by Florian Angeletti) + +- #7179, #11894: correct the description of CAMLreturn and CAMLreturn0 in + the Interfacing C page and memory.h file. + (Dong An, review by Guillaume Munch-Maccagnoni and Olivier Nicole ) + +### Compiler user-interface and warnings: + +- #10647: Show hints for the "undefined global" error in the toplevel + (Wiktor Kuchta, review by Gabriel Scherer) + +- #12116: Don't suggest to insert a semicolon when the type is not unit + (Jules Aguillon, review by Florian Angeletti) + +- #11679: Improve the error message about too many arguments to a function + (Jules Aguillon, review by Gabriel Scherer and Florian Angeletti) + +- #10009: Improve the error reported by mismatched struct/sig and =/: in module + and module type bindings. + (Jules Aguillon, review by Gabriel Scherer) + +- #11530: Include kinds in kind mismatch error message. + "Error: This variant or record definition does not match that of type M.t + The original is abstract, but this is a record". + (Leonhard Markert, review by Gabriel Scherer and Florian Angeletti) + +- #11646: Add colors to error message hints. + (Christiana Anthony, review by Florian Angeletti) + +- #11235, #11864: usage warnings for constructors and fields can now be disabled + on field-by-field or constructor-by-constructor basis + (Florian Angeletti, review by Gabriel Scherer) + +- #11888: Improve the error message when type variables cannot be deduced from + the type parameters: + Before: + "Error: In this definition, a type variable cannot be deduced + from the type parameters." + After: + "Error: In the GADT constructor + T : 'a -> 'a s t + the type variable 'a cannot be deduced from the type parameters." + (Stefan Muenzel, review by Florian Angeletti and Gabriel Scherer) + + +- #10818: Preserve integer literal formatting in type hint. + (Leonhard Markert, review by Gabriel Scherer and Florian Angeletti) + +- #11338: Turn some partial application warnings into hints. + (Leo White, review by Stephen Dolan) + +- #10931: Improve warning 14 (illegal backslash) with a better explanation + of the causes and how to fix it. + (David Allsopp, Florian Angeletti, Lucas De Angelis, Gabriel Scherer, + review by Nicolás Ojeda Bär, Florian Angeletti, David Allsopp and + Gabriel Scherer) + +- #10911: Improve the location reported by parenthesized assert expressions + (Fabian Hemmer, review by Gabriel Scherer) + +- #1391, #7645, #3922: Add an early error when compiling different + modules with mismatching -for-pack + (Pierre Chambart and Vincent Laviron, review by Mark Shinwell) + +- #11297: Report "unclosed" error when "done" is missing in a "do .. done" + construct. + (Nicolás Ojeda Bär, review by Gabriel Scherer) + +- #11635, #5461, #10564: turn warning 31 (Module_linked_twice) into a hard error + for ocamlc — this was already an error with ocamlopt. + (Hugo Heuzard, review by Valentin Gatien-Baron and Gabriel Scherer) + +- #11653: Add the -no-absname option to ocamlc, ocamlopt and ocamldep. + (Abiola Abdulsalam, review by Sébastien Hinderer and Florian Angeletti) + +- #11696: Add the -no-g option to ocamlc and ocamlopt. + (Abiola Abdulsalam, review by Sébastien Hinderer, Nicolás Ojeda Bär and + Florian Angeletti) + +- #11722: clearer error messages on non-well-founded type definitions + (Gabriel Scherer, review by Jacques Garrigue) + +- #11819: make the `native_compiler` and `native_dynlink` configuration + variables available through ocamlc -config. + (Sébastien Hinderer, review by Gabriel Scherer and David Allsopp) + +- #8602, #11863: Add -stop-after lambda flag option + (Douglas Smith and Dmitrii Kosarev, review by Gabriel Scherer) + +- #11910: Simplify naming convention for shadowed or ephemeral identifiers in + error messages (eg: `Illegal shadowing of included type t/2 by t`) + (Florian Angeletti, review by Jules Aguillon) + +- #12024: insert a blank line between separate compiler messages + (Gabriel Scherer, review by Florian Angeletti, report by David Wong) + +- #12088, #9265, #11949: ocamldebug: fix confusing repeating behavior + on blank lines within source scripts + (Damien Doligez, review by Gabriel Scherer, report by Gaëtan Gilbert) + +- #12107: use aliases to mark weak row variables: `_[< ... ]`, `< _..>`, `_#ct` + are now rendered as `[< ...] as '_weak1`, `< .. > as '_weak1`, + and `#ct as '_weak1`. + (Florian Angeletti, suggestion by Stefan Muenzel, review by Gabriel Scherer) + +- #12051: Improve the error messages when type variables cannot be generalized + (Stefan Muenzel, review by Florian Angeletti) + +* #12094: Trigger warning 5 (ignored-partial-application) when the scrutinee of + a pattern matching is of arrow type and all cases match wildcard or exception + patterns. + (Nicolás Ojeda Bär, review by Gabriel Scherer) + +### Internal/compiler-libs changes: + +- #11018, #11869: Clean up Types.Variance, adding a description of + the lattice used, and defining explicitly composition. + (Jacques Garrigue, review by Gabriel Scherer and Jeremy Yallop) + +- #11536: Introduce wrapper functions for level management + ([Ctype.with_level], etc) and for type variable scoping + ([Typetexp.with_local_type_variable_scope]). + The older API ([Ctype.(begin_def,end_def)], [Typetexp.(narrow,widen)], etc.) + is now removed. + (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer) + +- #11601, #11612, #11628, #11613, #11623, #12120 : Clean up some + global state handling in emitcode, bytepackager, bytegen, + bytesections, spill. + (Hugo Heuzard, Stefan Muenzel, review by Vincent Laviron, Gabriel Scherer + and Nathanaëlle Courant) + +- #12119, #12188, #12191: mirror type constraints on value binding in the + parsetree: + the constraint `typ` in `let pat : typ = exp` is now directly stored + in the value binding node in the parsetree. + (Florian Angeletti, review by Richard Eisenberg) + +- #11912: Refactoring handling of scoped type variables + (Richard Eisenberg, review by Gabriel Scherer and Florian Angeletti) + + +- #11691, #11706: use __asm__ instead of asm for strict ISO C conformance + (Xavier Leroy, report by Gregg Reynolds , review by Sadiq Jaffer) + +- #11764: add prototypes to old-style C function definitions and declarations + (Antonin Décimo, review by Xavier Leroy) + +- #11693: Remove use of C99 Variable Length Arrays (VLAs) in the runtime. + (David Allsopp, review by Xavier Leroy, Guillaume Munch-Maccagnoni, + Stefan Muenzel and Gabriel Scherer) + +- #12138: Generalise interface for BUILD_PATH_PREFIX_MAP mapping. + Absolute paths are now rewritten too. + (Richard L Ford, suggestions and review by Gabriel Scherer) + +- #10512: explain the compilation strategy for switches on constructors + (Gabriel Scherer, review by Vincent Laviron) + +- #11990: Improve comments and macros around frame descriptors. + (Nick Barnes, review by Gabriel Scherer) + +- #11847, #11849, #11851, #11898: small refactorings in the type checker + (Gabriel Scherer, review by Nicolás Ojeda Bär) + +- #11027: Separate typing counter-examples from type_pat into retype_pat; + type_pat is no longer in CPS. + (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer) + +- #11286, #11515: disambiguate identifiers by using how recently they have + been bound in the current environment + (Florian Angeletti, review by Gabriel Scherer) + +- #11364: Allow `make -C testsuite promote` to take `TEST` and `LIST` variables + (Antal Spector-Zabusky, review by Gabriel Scherer and David Allsopp) + +- #11446: document switch compilation (lambda/switch.ml) + (Gabriel Scherer, review by Luc Maranget and Vincent Laviron) + +- #11568: Encode inline record types in Path.t + (Leo White and Hyunggyu Jang, review by Gabriel Scherer) + +- #11569: Remove hash type encoding + (Hyunggyu Jang, review by Gabriel Scherer and Florian Angeletti) + +- #11627: use return values instead of globals for linear scan intervals + (Stefan Muenzel, review by Nicolás Ojeda Bär) + +- #11634: Dll.open_dll now properly handles opening for execution while already + opened for checking + (Hugo Heuzard, review by Nicolás Ojeda Bär) + +* #11745, #12358: Debugger and toplevels: embed printer types rather than + reading their representations from topdirs.cmi at runtime. + This change also removes the ocamlmktop initialization module introduced + in #11382 which was no longer useful. + This change breaks toplevel scripts relying on the visibility of `Topdirs` + in the initial toplevel environment without loading `topfind`. + Since the opam default `.ocamlinit` file loads `topfind`, it is expected + that only scripts run with `ocaml -noinit` are affected. + For those scripts, accessing `Topdirs` now requires the `compiler-libs` + directory to be added to the toplevel search path with + ``` + #directory "+compiler-libs";; + ```` + as was already the case for the other modules in the toplevel interface + library. + (Sébastien Hinderer, review by Florian Angeletti, Nicolás Ojeda Bär and + Gabriel Scherer) + +- #11615: remove global variables form asmcomp/linearize.ml + (Stefan Muenzel, review by Nicolás Ojeda Bär + +- #10856: Add location, attribute(s) visitors to Tast_mapper/Tast_iterator + (Yan Dong, review by Nicolás Ojeda Bär and Gabriel Scherer) + +- #11763, #11759, #11861: Enable stricter C compilation warnings, use + strict prototypes on primitives. + (Antonin Décimo, review by Xavier Leroy, David Allsopp and Sébastien + Hinderer) + +- #11933: Use the correct machtype when reading the code pointer from closures + (Nathanaëlle Courant, review by Gabriel Scherer and Vincent Laviron) + +- #11972: refactor runtime/frame_descriptors.c + in preparation for quadratic-time fix + (Gabriel Scherer, review by Enguerrand Decorne) + +- #11997: translate structured constants into their Obj.t representation + at compile time rather than link time. Changes the way dumpobj prints + these constants because their representation becomes untyped. + (Sébastien Hinderer, review by Xavier Leroy, Nicolás Ojeda Bär and + Hugo Heuzard) + +- #12011: remove Ctype.reified_var_counter + (Takafumi Saikawa and Jacques Garrigue, review by Gabriel Scherer) + +- #12012: move calls to Typetexp.TyVarEnv.reset inside with_local_level etc. + (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer) + +- #12034: a logarithmic algorithm to find the next free variable + (Gabriel Scherer, review by Stefan Muenzel) + +- #12092: remove Lev_module_definition from lambda + (Nick Roberts, review by Gabriel Scherer) + +- #12117: Remove arity-interrupting elaboration of module unpacks + (Nick Roberts, review by Richard Eisenberg and Jacques Garrigue) + +- #12118: stop storing names of predefined exceptions in the + cu_required_globals field of compilation unit descriptors. + (Sébastien Hinderer, review by Vincent Laviron) + +- #12125: Add Misc.print_see_manual and modify [@manual_ref] to accept + lists for simpler printing of manual references + (Stefan Muenzel, review by Florian Angeletti) + +- #12509: Use strict prototypes on primitives when generating a standalone + bytecode executable (`ocamlc -custom`). + (Antonin Décimo, review by Xavier Leroy) + +### Build system: + +- #11844: Reduce verbosity of `make` logs by printing program invocations in + shorthand (eg `OCAMLC foo.cmo`). Setting `V=1` recovers the old style (with + full command-lines). + (Xavier Leroy, Nicolás Ojeda Bär, review by Sébastien Hinderer) + + +- #11590: Allow installing to a destination path containing spaces. + (Élie Brami, review by Sébastien Hinderer and David Allsopp) + +- #11243, #11248, #11268, #11420, #11675: merge the sub-makefiles into + the root Makefile. + (Sébastien Hinderer, review by David Allsopp and Florian Angeletti) + +- #11828: Compile otherlibs/ C stubs in two version for native and bytecode + (Olivier Nicole, review by Sébastien Hinderer and Xavier Leroy) + +- #12265: Stop adding -lexecinfo to cclibs (leftover debugging code from the + multicore project). Harden the feature probe for -lm in configure so -lm is + only added if strictly necessary. configure.ac now correctly propagates + library flags for the Windows ports, allowing Windows OCaml to be configured + with ZSTD support. + (David Allsopp, review by Sébastien Hinderer) + +- #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 + so that code sections remain readable, as needed for closure marshaling. + (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and + Sébastien Hinderer) + +### Bug fixes: + +- #12062: fix runtime events consumer: when events are dropped they shouldn't be + parsed. (Lucas Pluvinage) + +- #12132: Fix overcounting of minor collections in GC stats. + (Damien Doligez, review by Gabriel Scherer) + +- #12017: Re-register finaliser only after calling user alarm in Gc.create_alarm + (Fabrice Buoro, report by Sam Goldman, review by Guillaume Munch-Maccagnoni) + +- #11887, #11893: Code duplication in pattern-matching compilation + (Vincent Laviron, report par Greta Yorsh, review by Luc Maranget and + Gabriel Scherer) + +- #10664, #11600: Unsoundness in the typing of polymorphic methods + involving polymorphic variants + (Jacques Garrigue, report by Mike Shulman, review by Gabriel Scherer) + +- #11302, #11412: `ocamlc` and `ocamlopt` should not remove generated files + when they are not regular files. + (Xavier Leroy, report by Thierry Martinez, review by + Anil Madhavapeddy, Nicolás Ojeda Bär, David Allsopp) + +- #10348, #10560, #11561: Expand GADT equations lazily during unification to + avoid ambiguity + (Jacques Garrigue, review by Leo White) + +- #11436: Fix wrong stack backtrace for out-of-bound exceptions raised + by leaf functions. + (Tom Kelly and Xavier Leroy, review by Mark Shinwell) + +- #11450, #12018: Fix erroneous functor error messages that were too eager to + cast `struct end` functor arguments as unit modules in `F(struct end)`. + (Florian Angetti, review by Gabriel Scherer) + +- #11643: Add missing test declaration to float_compare test, so that it will + run. + (Stefan Muenzel, review by David Allsopp) + +- #11630: Use correct location when reporting record labels with non-existent + paths. + (Nicolás Ojeda Bär, report by Jason Gross, review by Gabriel Scherer) + +- #11727: Ensure push_defaults can push past module patterns, fixing an + currying optimisation accidentally disabled by #10340. + (Stephen Dolan, review by Gabriel Scherer) + +- #11771: Use a more relaxed mode for unification in Ctype.subst + (Leo White, review by Jacques Garrigue and Gabriel Scherer) + +- #11803, #11808: on x86, the destination of an integer comparison must be + a register, it cannot be a stack slot. + (Vincent Laviron, review by Xavier Leroy, report by + Emilio Jesús Gallego Arias) + +- #11809: Protect Parmatch.pats_of_type from missing cmis + (Jacques Garrigue, review by Stephen Dolan and Gabriel Scherer) + +- #11824: Fix a crash when calling `ocamlrun -b` + (Florian Angeletti, review by Sébastien Hinderer) + +- #11815: Marshalling continuations raises invalid argument exception. + (Jérôme Vouillon, review by Nicolás Ojeda Bär, Stephen Dolan and + Hugo Heuzard) + +- #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64). + Reserve the shadow store for the ABI in the c_stack_link struct instead of + explictly when calling C functions. This simultaneously reduces the number of + stack pointer manipulations and also fixes a bug when calling noalloc + functions where the shadow store was not being reserved. + (David Allsopp, report by Vesa Karvonen, review by Xavier Leroy and + KC Sivaramakrishnan) + +- #11850: When stopping before the `emit` phase (using `-stop-after`), an empty + temporary assembly file is no longer left in the file system. + (Nicolás Ojeda Bär, review by Gabriel Scherer and Xavier Leroy) + +- #11866: Fix the result of `caml_read_directory()` on non-existent paths. + (Andrei Paskevich and Charlène Gros, review by David Allsopp and + Nicolás Ojeda Bär) + +- #11879: Bugfix for Ctype.nondep_type + (Stephen Dolan, review by Gabriel Scherer) + +- #12004: Don't ignore function attributes on lambdas with locally abstract + types. + (Chris Casinghino, review by Gabriel Scherer) + +- #12037: Fix some data races by using volatile when necessary + (Fabrice Buoro and Olivier Nicole, review by Guillaume Munch-Maccagnoni, + Gabriel Scherer and Luc Maranget) + +- #12046: Flush stderr when tracing the parser + (Hugo Heuzard, review by David Allsopp and Nicolás Ojeda Bär) + +- #12061, #12063: don't add inconsistent equalities when computing + high-level error messages for functor applications and inclusions. + (Florian Angeletti, review by Gabriel Scherer) + +- #12075: auto-detect whether `ar` support @FILE arguments at + configure-time to avoid using this feature with toolchains + that do not support it (eg FreeBSD/Darwin). + (Nicolás Ojeda Bär, review by Xavier Leroy, David Allsop, Javier + Chávarri, Anil Madhavapeddy) + +- #12103, 12104: fix a concurrency memory-safety bug in Buffer + (Gabriel Scherer, review by Florian Angeletti, report by Samuel Hym) + +- #12112: Fix caml_callback{2,3}_exn when used with effect handlers. + (Lucas Pluvinage, review by Gabriel Scherer, David Allsopp and Xavier Leroy) + +- #12134: Use ghost location for nodes created when handling defaults in + optional arguments. + (Paul-Elliot Anglès d'Auriac, review by Gabriel Scherer) + +- #12153: Fix segfault in bytecode programs involving recursive value + definitions of values of size 0 + (Vincent Laviron, Xavier Leroy, Gabriel Scherer, + review by Xavier Leroy, report by Nick Roberts) + +- #12162: Fix miscompilation on amd64 backends involving integer overflows + (Vincent Laviron and Greta Yorsh, review by Stefan Muenzel) + +- #12170: fix pthread_geaffinity_np configure check for android + (David Allsopp, review by Sébastien Hinderer) + +- #12178: Fix runtime events consumer poll function returning an invalid value + instead of an OCaml integer value. (Lucas Pluvinage) + +- #12252: Fix shared library build error on RISC-V. + (Edwin Török, review by Nicolás Ojeda Bär and Xavier Leroy) + +- #12255, #12256: Handle large signal numbers correctly (Nick Barnes, + review by David Allsopp). + +- #12277: ARM64, fix a potential assembler error for very large functions by + emitting stack reallocation code before the body of the function. + (Xavier Leroy, review by KC Sivaramakrishnan) + +- #12253, #12342: Fix infinite loop in signal handling. + (Guillaume Munch-Maccagnoni, report by Thomas Leonard, review by + KC Sivaramakrishnan and Sadiq Jaffer) + +- #12445: missing GC root registrations in runtime/io.c + (Gabriel Scherer, review by Xavier Leroy and Jeremy Yallop) + +- #12481, #12505: Fix incorrect initialization of array expressions + `[|e1;...;eN|]` when `N` is large enough to require major heap allocation. + (Xavier Leroy, report by Andrey Popp, analysis by KC Sivaramakrishnan + and Vincent Laviron, review by Gabriel Scherer) + +- #11150, #11207, #11936: Avoid recomputation in Typedecl.check_wellfounded + (Jacques Garrigue, report by Boris Yakobowski, review by Gabriel Scherer) + +- #11186, #11188: Fix composition of coercions with aliases + (Vincent Laviron, report and review by Leo White) + +- #12486: Fix delivery of unhandled effect exceptions on s390x + (Miod Vallat, report by Jan Midtgaard, review by Vincent Laviron and Xavier + Leroy) + +OCaml 5.0.0 (15 December 2022) +------------------------------ + +- #10831: Multicore OCaml + (Enguerrand Decorne, Stephen Dolan, Tom Kelly, Sadiq Jaffer, + Anil Madhavapeddy, Sudha Parimala, KC Sivaramakrishnan, + Leo White, the Tarides multicore team, + review by Florian Angeletti, Damien Doligez, Xavier Leroy, + Guillaume Munch-Maccagnoni, Olivier Nicole, Nicolás Ojeda Bär, + Gabriel Scherer, the OCaml core development team, and many + other valued reviewers.) + +### Language features: + +### Runtime system: + +- #11400: Runtime events counters fixes + Fixes mismatch between OCaml and C APIs, removes events from 4.x that + are not present in the 5.0 GC and adds some missing probes. + (Sadiq Jaffer, review by Gabriel Scherer, Florian Angeletti) + +- #11368: Runtime events buffer size OCAMLRUNPARAMS fix + The runtime events buffer size can now be set via the 'e' OCAMLRUNPARAM. + This is previously mistakenly enabled/disabled tracing instead. + (Sadiq Jaffer, review by KC Sivaramakrishnan, David Allsopp, Damien Doligez) + +- #11308: Add environment variable to preserve runtime_events after exit + If the environment variable OCAML_RUNTIME_EVENTS_PRESERVE exists then the + runtime will not remove the runtime events ring buffers at exit. This + makes tracing very short running programs more reliable. + (Sadiq Jaffer, review by KC Sivaramakrishnan) + +- #10964: Ring-buffer based runtime tracing (runtime_events) + Runtime_events is a very low overhead runtime tracing system designed for + continuous monitoring of OCaml applications. + (Sadiq Jaffer, review by Anil Madhavapeddy, Enguerrand Decorne, + Richard Warburton, Gabriel Scherer, Sabine Schmaltz, Florian Angeletti, + Patrick Ferris, Tom Kelly) + +* #10723: do not use `-flat-namespace` linking for macOS. + (Carlo Cabrera, review by Damien Doligez) + +* #10863, #10933: Remove support for old, unprefixed C runtime function names + such as `alloc`. The new names prefixed with `caml_` must be used instead, + such as `caml_alloc`. Consequently, it is no longer needed to define + `CAML_NAME_SPACE` to avoid bringing unprefixed names into scope: this is now + the default behavior. + (Nicolás Ojeda Bär, review by Xavier Leroy) + +- #10902: Do not register empty code fragments in natdynlink. + (David Allsopp, review by Xavier Leroy and Damien Doligez) + +- #10965: `caml_fatal_error_hook`, GC timing hooks, and + `caml_scan_roots_hook` are now atomic variables. Restore GC timing + hooks in multicore. + (Guillaume Munch-Maccagnoni, review by Enguerrand Decorne, Xavier + Leroy, Gabriel Scherer, and KC Sivaramakrishnan) + +- #11209: Add a public and thread-safe timing hook running at domain + termination, after this domain has stopped running any OCaml code: + `caml_domain_terminated_hook`. This can be useful for implementing + domain-local state in C. + (Guillaume Munch-Maccagnoni, review by Xavier Leroy and Gabriel + Scherer) + +- #10875, #11731: Add option to allocate fiber stacks and sigaltstacks with + mmap(MAP_STACK) instead of malloc. This is exposed via a configure + --enable-mmap-map-stack option, and is enabled by default on OpenBSD where + it is mandatory. + (Anil Madhavapeddy, review by Gabriel Scherer, Tom Kelly, + Michael Hendricks and KC Sivaramakrishnan). + +- #10950: Do not use mmap to allocate Caml_state. + In order to reduce virtual memory usage, we dynamically allocate + the domain_state structure. + (Enguerrand Decorne, KC Sivaramakrishnan and Tom Kelly, + review by Anil Madhavapeddy and Gabriel Scherer) + +- #11010: Use strerror_r for reentrant error string conversion. + (Anil Madhavapeddy and Xavier Leroy, review by same and Edwin Török) + +- #11002, #11066, #11086: Do not use Begin_roots/End_roots macros in + the runtime system. Also fix a missing root registration in the + implementation of Unix.write on Windows. + (Nicolás Ojeda Bär, Daniel Bünzli and Antonin Décimo, + review by Xavier Leroy and David Allsopp) + +- #11022: Track GC work for all managed bigarray allocations + (Stephen Dolan, report by Andrew Hunter, review by Damien Doligez) + +- #10802: Use 4.12 value macros and helpers in C code + (Antonin Décimo, review by Gabriel Scherer) + +- #11105: Fix handling of fiber stack cache with multiple domains + (Jon Ludlam, KC Sivaramakrishnan and Tom Kelly) + +- #11054: Respect user provided maximum stack space + Make sure the stack we initially request is sized accordingly to + the user provided settings. tmc/stack_space is also updated by + this PR in order to account for this change. + (Enguerrand Decorne, report by Jon Ludlam, + review by Tom Kelly, KC Sivaramakrishnan and Gabriel Scherer) + +- #11238: Increase the default limit for the stack size to 128 Mi words, + i.e. 1 Gib for 64-bit platforms and 512 Mib for 32-bit platforms. + (Xavier Leroy, review by Sébastien Hinderer) + +* #11295: An ISO C 2011 compliant compiler, including full support for atomic + types, is now required to build the OCaml runtime system. + (Xavier Leroy, review by David Allsopp and Sébastien Hinderer) + +- #10915, #11039, #11057, #11095, #11190: Implement quality treatment for + asynchronous actions in multicore. Reimplement the old behaviour of + `caml_process_pending*` for multicore. + (Guillaume Munch-Maccagnoni, review by Sadiq Jaffer and Gabriel Scherer) + +- #11303: Ensure that GC is not invoked from bounds check failures + (Stephen Dolan, review by Sadiq Jaffer and Xavier Leroy) + +- #11304: Fix data race on Windows file descriptors + (Olivier Nicole and Xavier Leroy, review by Xavier Leroy, David Allsopp, + and Sadiq Jaffer) + +* #11337: pass 'flags' metadata to root scanners, to optimize stack + scanning in the bytecode interpreter. + Changes the interface of user-provided root-scanning hooks. + (Gabriel Scherer, review by Xavier Leroy, + Guillaume Munch-Maccagnoni, Sadiq Jaffer and Tom Kelly) + +* #11255: in the C interface, `&Field(v, i)` now has type `volatile value *` + instead of `value *` in OCaml 4. This makes the memory model + for mixed OCaml/C code better defined, but can cause warnings or type + errors in user C code. + (KC Sivaramakrishnan, review by Xavier Leroy, Gabriel Scherer and + Guillaume Munch-Maccagnoni, additional discussions with Stephen + Dolan and Luc Maranget) + +- #5299, #4787, #11138, #11272, #11506: To help debugging, `Caml_state` + now dynamically checks that the domain lock is held, and fails + otherwise (with a fatal error at most entry points of the C API, or + systematically in debug mode). A new variable `Caml_state_opt` is + introduced, and is `NULL` when the domain lock is not held. This + allows to test from C code if the current thread holds the lock of + its domain. + (Guillaume Munch-Maccagnoni, review by Florian Angeletti, Damien + Doligez, Sadiq Jaffer, Xavier Leroy, and Gabriel Scherer) + +- #11223: The serialization format of custom blocks changed in 4.08, + but the deserializer would still support the pre-4.08 format. OCaml + 5.x removed support for this old format; provide a clear error message + in this case. + (Hugo Heuzard, review by Gabriel Scherer) + +- #11504, #11522: Use static allocation in `caml_make_float_vect` in + no-flat-float-array mode, it's more efficient and avoids a a race condition + (Xavier Leroy, report by Guillaume Munch-Maccagnoni, review by David Allsopp) + +- #11652: Fix benign off-by-one error in Windows implementation of caml_mem_map. + (David Allsopp, review by Gabriel Scherer) + +- #11669, #11704: Fix construction of Effect.Unhandled exceptions in the + bytecode interpreter. + (David Allsopp and Xavier Leroy, report by Samuel Hym, review by Xavier Leroy + and Gabriel Scherer) + +### Code generation and optimizations: + +- #10972: ARM64 multicore support: OCaml & C stack separation; + dynamic stack size checks; fiber and effects support. + (Tom Kelly and Xavier Leroy, review by KC Sivaramakrishnan, Xavier Leroy + Guillaume Munch-Maccagnoni, Eduardo Rafael, Stephen Dolan and + Gabriel Scherer) + +* #10845 Emit frametable size on amd64 BSD (OpenBSD, FreeBSD, NetBSD) systems + (emitted for Linux in #8805) + (Hannes Mehnert, review by Nicolás Ojeda Bär) + +### Standard library: + +- #10742: Use LXM as the pseudo-random number generator for module Random. + Add `Random.State.split` and `Random.split` to "split" a PRNG off + another PRNG. + (Xavier Leroy, review by Gabriel Scherer and Hugo Heuzard) + +* #10867, #11345: Remove deprecated values: Array.create, Array.make_float, + Array.create_matrix, Bytes.uppercase, Bytes.lowercase, Bytes.capitalize, + Bytes.uncapitalize, Char.lowercase, Char.uppercase, Filename.temp_dir_name, + Int32.format, Int64.format, Nativeint.format, Format.bprintf, Format.kprintf, + Format.set_all_formatter_output_functions, + Format.get_all_formatter_output_functions, + Format.pp_set_all_formatter_output_functions, + Format.pp_get_all_formatter_output_functions, Format.pp_open_tag, + Format.pp_close_tag, Format.open_tag, Format.close_tag, + Format.formatter_tag_functions, Format.pp_set_formatter_tag_functions, + Format.pp_get_formatter_tag_functions, Format.set_formatter_tag_functions, + Format.get_formatter_tag_functions, Gc (mutability of the fields of type + Gc.control), Lazy.lazy_from_fun, Lazy.lazy_from_val, Lazy.lazy_is_val, + Obj.set_tag, Obj.truncate, Obj.final_tag, Obj.extension_constructor, + Obj.extension_name, Obj.extension_id, Scanf.stdib, Scanf.fscanf, + Scanf.kfscanf, Stdlib.( & ), Stdlib.( or ), String.set, String.copy, + String.fill, String.unsafe_set, String.unsafe_fill, String.uppercase, + String.lowercase, String.capitalize, String.uncapitalize, Thread.kill, + Thread.wait_write, Thread.wait_read, the whole ThreadUnix module, the + infix operator (.[]<-). + (Nicolás Ojeda Bär, review by Damien Doligez) + +* #10896: Remove Stream, Genlex and Pervasives. Also remove legacy standalone + bigarray library (the Bigarray module is now part of the standard library). + (Nicolás Ojeda Bär, review by Kate Deplaix and Anil Madhavapeddy) + +- #10921: Use getentropy, when available, to seed the generator during + `Random.self_init` + (Michael Hendricks, review by Gabriel Scherer, Xavier Leroy, and + Anil Madhavapeddy) + +* #10924: Add deprecated attribute to Printexc.catch, Printf.kprintf and + Unix.SO_ERROR. + (Nicolás Ojeda Bär, review by Damien Doligez) + +- #10986: Add Scanf.sscanf_opt, Scanf.bscanf_opt and Scanf.scanf_opt. + (Nicolás Ojeda Bär, review by Florian Angeletti and Gabriel Scherer) + +* #11157: Rename "hash" in the "Hashtbl.SeededHashedType" signature to + "seeded_hash". This allows defining both seeded and unseeded hash functions in + the same module. + (Nicolás Ojeda Bär, review by Gabriel Scherer and Xavier Leroy) + +- #8878: Add String.hash and String.seeded_hash. + (Tom Kelly, review by Alain Frisch and Nicolás Ojeda Bär) + +- #11279, #11585, #11742: ensure that the unsafe Buffer code + remains memory-safe in concurrent settings. + Unsynchronized access to Buffer is a programming error and may + result in wrong behavior, but it should preserve memory-safety. + (Florian Angeletti and Gabriel Scherer, review by Gabriel Scherer + and Vincent Laviron, report by David Allsopp) + + +### Other libraries: + +* #9071, #9100, #10935: Reimplement `Thread.exit()` as raising the + exception `Thread.Exit`, and mark `Thread.exit` as deprecated. + The new implementation changes the behavior compared with + the OCaml 4 implementation. For example, the new implementation + causes `Fun.finally` finalizers to be run and catch-all exception + handlers to prevent termination. + (Jacques-Henri Jourdan and Xavier Leroy, review by Damien Doligez, + Guillaume Munch-Maccagnoni, Gabriel Scherer, and Enguerrand Decorne) + +- #11034: Dynlink library, add a global lock to make dynlinking + thread-safe. + (Florian Angeletti, review by Gabriel Scherer) + +- #11087: deprecate Thread.wait_timed_read, Thread.wait_timed_write, + Thread.select, Thread.wait_pid. The same functionality is available in the + Unix module. + (Nicolás Ojeda Bär, review by Anil Madhavapeddy) + +- #11309, #11424, #11427, #11545: Add Domain.recommended_domain_count. + (Christiano Haesbaert, Konstantin Belousov, review by David Allsopp, + KC Sivaramakrishnan, Gabriel Scherer, Nicolas Ojeda Bar) + +- #11461, #11466: Fix gethostbyaddr for IPv6 arguments and make it domain-safe + (Olivier Nicole, Nicolás Ojeda Bär, David Allsopp and Xavier Leroy, + review by the same) + +- #11479: Make Unix.symlink domain-safe on Windows + (Olivier Nicole, review by Xavier Leroy and David Allsopp) + +### Tools: + +* #11004: Litmus tests for checking the implementation of the + memory model. + (Luc Maranget, review by Gabriel Scherer and Xavier Leroy) + +- #11024: Handle alerts in ocamldoc. + The alert `[@@alert deprecated]` is handled specifically and it's no longer + needed to duplicate the deprecated annotation (the alert for the compiler and + the tag for the documentation). Every other alerts also appear in the + documentation. + (Jules Aguillon, review by Florian Angeletti) + +- #11065: Port the bytecode debugger to 5.0, adding support for effect handlers. + (Damien Doligez and @fabbing, review by @fabbing and Xavier Leroy) + +- #11079: Add the -nobanners option to dumpobj. + (Sébastien Hinderer, review by Gabriel Scherer and Vincent Laviron) + +- #11100: Fix ocamltest to make sure failed tests are not counted as + "unexpected error". + (Damien Doligez, review by Sébastien Hinderer) + +- #11245: Merge the common code of ocamlcp and ocamloptp into a single module. + (David Allsopp, review by Sébastien Hinderer) + +- #11382: OCamlmktop use a new initialization module "OCamlmktop_init" to + preserve backward-compatibility with user-module provided modules that install + toplevel printers. + (Florian Angeletti, review by Gabriel Scherer and David Allsopp) + +### Manual and documentation: + +- #11058: runtime/HACKING.adoc tips on debugging the runtime + (Gabriel Scherer, review by Enguerrand Decorne and Nicolás Ojeda Bär) + +- #11093: Add an effect handlers tutorial + (KC Sivaramakrishnan, review by François Pottier, Gabriel Scherer, François + Bobot and Wiktor Kuchta) + +- #11192: Better documentation for condition variables. + (François Pottier, review by Luc Maranget, Xavier Leroy, and Wiktor Kuchta) + +- #11093: Add tutorials on parallelism features and the relaxed memory model + (KC Sivaramakrishnan, review by Damien Doligez, Anil Madhavapeddy, Gabriel + Scherer, Thomas Leonard, Tom Ridge, Xavier Leroy, Luc Maranget, Fabrice + Buoro, Olivier Nicole, Guillaume Munch-Maccagnoni, Jacques-Henri Jourdan) + +- #11640, #11647: Add missing options to the man pages: + flambda commonly-used options, and negative options (`-no-rectypes`, ... ). + (Amandine Nangah, review by David Allsopp, Florian Angeletti, + Sébastien Hinderer, and Vincent Laviron) + +- #11676: Fix missing since annotation in the `Sys` and `Format` modules + (Github user Bukolab99, review by Florian Angeletti) + +- #11813: Make new multicore chapters easier to discover, and emphasize impact + on C bindings. + (Edwin Török, review by KC Sivaramakrishnan, and Florian Angeletti) + +### Compiler user-interface and warnings: + +- #9140, #11131: New command-line flag -nocwd to not include implicit + the current directory to the load path. + (Thomas Roglin, review by Gabriel Scherer and Nicolás Ojeda Bär) + +- #11089: Add 'since ' information to compiler warnings. + (André Maroneze, review by Florian Angeletti and Gabriel Scherer) + +- #10909: Disable warning 59 (assignment to immutable blocks) unless flambda + invariant checks are enabled. + (Vincent Laviron, review by Gabriel Scherer) + +- #10981, #11276: Implement a -cmi-file option for ocamlc and ocamlopt. + (Sébastien Hinderer, review by Damien Doligez, Daniel Bünzli and + Florian Angeletti) + +* #11049: Stop padding 1-digit compiler minor version numbers. + (So for instance OCaml 5.0 rather than 5.00) + (Sébastien Hinderer, review by David Allsopp, Florian Angeletti and + Xavier Leroy) + +- #11184, #11670: Stop calling ranlib on created / installed libraries + (Sébastien Hinderer and Xavier Leroy, review by the same) + +- #11253: Deprecate `ocaml script` and `ocamlnat` script where `script` has no + extension and is an implicit basename. + (David Allsopp, review by Florian Angeletti and Sébastien Hinderer) + +### Internal/compiler-libs changes: + +- #10878, #10909: restore flambda after the Multicore merge. + (Vincent Laviron, review by Gabriel Scherer and Xavier Leroy) + +- #10864, #10888: restore afl-fuzz mode for sequential programs. + (Jan Midtgaard, review by Xavier Leroy and Gabriel Scherer) + +- #11008, #11047: rework GC statistics in the Multicore runtime + (Gabriel Scherer, review by Enguerrand Decorne) + +- #11058: basic debugging documentation in runtime/HACKING.adoc + (Gabriel Scherer, review by Enguerrand Decorne and Nicolás Ojeda Bär) + +- #11199: Stop installing topdirs.cmi twice. The toplevel now reads topdirs.cmi + from +compiler-libs, as the debugger does. + (David Allsopp, review by Sébastien Hinderer) + +- #11007, #11399: META files for the stdlib, compiler-libs and other libraries + (unix, dynlink, str, runtime_events, threads, ocamldoc) are now installed + along with the compiler. + (David Allsopp, Florian Angeletti, Nicolás Ojeda Bär and Sébastien Hinderer, + review by Daniel Bünzli, Kate Deplaix, Anil Madhavapeddy and Gabriel Scherer) + +### Build system: + +* #10893: Remove configuration options --disable-force-safe-string and + DEFAULT_STRING=unsafe as well as --enable-force-safe-string and + DEFAULT_STRING=safe which are now the default unconditionally. + (Kate Deplaix, review by Gabriel Scherer and David Allsopp) + +- #11092: Build native-code compilers on OpenBSD/aarch64. + (Christopher Zimmermann, review by Anil Madhavapeddy) + +- #11126: Build system: make it possible to choose which ocamldep + (and flags) to use when computing dependencies for the compiler. + Add a -no-slash option to ocamldep to let users override -slash. + (Sébastien Hinderer, review by David Allsopp) + +- #11147: Factorize the stdlib-related compilation flags. Make it + possible to control them consistently through the STDLIBFLAGS + build variable. Make sure ocamldoc and ocamllex get compiled and + linked with debugging information (-g). + (Sébastien Hinderer, review by Gabriel Scherer) + +- #11149: Make the bootstrap process reproducible on systems with non-big-endian + floating point. If the boot/ artefacts are up-to-date, this means that running + make bootstrap on any platform should not change the images in boot/ and paves + the way for automated testing that the bootstrap is repeatable. + (David Allsopp, review by Damien Doligez and Sébastien Hinderer) + +- #11160: otherlibs: merge win32unix into unix. + (Sébastien Hinderer, review by David Allsopp, Nicolás Ojeda Bär, + Xavier Leroy, Vincent Laviron and Antonin Décimo) + +* #11198, #11298: Install the Dynlink, Str and Unix libraries to individual + subdirectories of LIBDIR. The compiler, debugger and toplevel automatically + add `-I +lib` if required, but display an alert. + (David Allsopp, review by Florian Angeletti, Nicolás Ojeda Bär, + Valentin Gatien-Baron and Sébastien Hinderer) + +- #11200: Install ocamlprof's Profiling runtime module to a +profiling, + removing it from the default namespace. + (David Allsopp, review by Sébastien Hinderer) + +- #11294: Switch minimum required autoconf to 2.71. + (David Allsopp, review by Xavier Leroy) + +- #11370, #11373: Don't pass CFLAGS to flexlink during configure. + (David Allsopp, report by William Hu, review by Xavier Leroy and + Sébastien Hinderer) + +- #11487: Thwart FMA test optimization during configure + (William Hu, review by David Allsopp and Sébastien Hinderer) + +- #11097: Build native-code compilers on NetBSD/aarch64 + (Kate Deplaix, review by Anil Madhavapeddy) + +### Bug fixes: + +- #10768, #11340: Fix typechecking regression when combining first class + modules and GADTs. + (Jacques Garrigue, report by François Thiré, review by Matthew Ryan) + +- #10790: don't drop variance and injectivity annotations when pretty printing + `with` constraints (for example, `with type +!'a t = ...`). + (Florian Angeletti, report by Luke Maurer, review by Matthew Ryan and + Gabriel Scherer) + +- #11167: Fix memory leak from signal stack. + (Antoni Żewierżejew, review by Gabriel Scherer and Enguerrand Decorne) + +- #11112: harden -use-runtime against spaces or quotes in the provided path + (Gabriel Scherer, report by Brahima Dibassi, review by David Allsopp) + +- #11068, #11070: Fix typo in function name given in Unix_error exception for + Unix.readlink on Windows. + (David Allsopp, report by Xia Li-yao) + +- #10807: Don't duplicate standard handles in the child process + spawned by win32unix Unix.create_process if the handles were already + inheritable. Fix broken signalling of EOF on standard handles if + they were already inheritable. + (Antonin Décimo, review by Xavier Leroy and Nicolás Ojeda Bär) + +- #10868: Fix off-by-1 bug when initializing frame hashtables + (Jonah Beckford, review by Tom Kelly, Nicolás Ojeda Bär and + KC Sivaramakrishnan) + +- #11077: Make dumpobj compatible with absence of naked pointer support + (Olivier Nicole and Jan Midtgaard, review by Gabriel Scherer) + +- #11111: fix fork() usage in ocamltest C code. + When calling fork() from C code with the Multicore runtime active, + one needs to call caml_atfork_hook() on the forked child before it + can use the OCaml runtime. + (Gabriel Scherer, review by Xavier Leroy, report by Brahima Dibassi) + +- #10809: Use the WSA_FLAG_NO_HANDLE_INHERIT on Windows when creating + sockets with WSASocket if the cloexec (non-inheritable) parameter is + true. Fixes a race condition where a child process could inherit the + socket and deadlock the parent. + (Antonin Décimo, review by Xavier Leroy) + +- #11194, #11609: Fix inconsistent type variable names in "unbound type var" + messages + (Ulysse Gérard and Florian Angeletti, review Florian Angeletti and + Gabriel Scherer) + +- #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when + calling virtual methods introduced by constraining the self type from within + the class definition. + (Nicolás Ojeda Bär, review by Leo White) + +- #11263, #11267: caml/misc.h: check whether `_MSC_VER` is defined before using + it to ensure that the headers can always be used in code which turns on + -Wundef (or equivalent). + (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and + Sébastien Hinderer) + +- #11289, #11405: fix some leaks on systhread termination + (Fabrice Buoro, Enguerrand Decorne, Gabriel Scherer, + review by Xavier Leroy and Florian Angeletti, report by Romain Beauxis) + +- #11314, #11416: fix non-informative error message for module inclusion + (Florian Angeletti, report by Thierry Martinez, review by Gabriel Scherer) + +- #11358, #11379: Refactor the initialization of bytecode threading, + This avoids a "dangling pointer" warning of GCC 12.1. + (Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer) + +- #11387, module type with constraints no longer crash the compiler in presence + of both shadowing warnings and the `-bin-annot` compiler flag. + (Florian Angeletti, report by Christophe Raffalli, review by Gabriel Scherer) + +- #11392, #11392: assertion failure with -rectypes and external definitions + (Gabriel Scherer, review by Florian Angeletti, report by Dmitrii Kosarev) + +- #11417: Fix regression allowing virtual methods in non-virtual classes. + (Leo White, review by Florian Angeletti) + +- #11468: Fix regression from #10186 (OCaml 4.13) detecting IPv6 on Windows for + mingw-w64 i686 port. + (David Allsopp, review by Xavier Leroy and Sébastien Hinderer) + +- #11482, #11542: Fix random crash in large closure allocation + (Damien Doligez, report by Thierry Martinez and Vincent Laviron, review by + Xavier Leroy) + +- #11508, #11509: make Bytes.escaped domain-safe + (Christiano Haesbaert and Gabriel Scherer, + review by Xavier Leroy, + report by Jan Midtgaard and Tom Kelly) + +- #11516, #11524: Fix the `deprecated_mutable` attribute. + (Chris Casinghino, review by Nicolás Ojeda Bär and Florian Angeletti) + +- #11576: Fix bug in Bigarray.Genarray.init in the the case of zero-dimensional + arrays. + (Nicolás Ojeda Bär, Jeremy Yallop, report by Masayuki Takeda, review by Jeremy + Yallop and Florian Angeletti) + +- #11587: Prevent integer comparison from being used on pointers + (Vincent Laviron, review by Gabriel Scherer) + +- #11622: Prevent stack overflow when printing a constructor or record + mismatch error involving recursive types. + (Florian Angeletti, review by Gabriel Scherer) + +- #11662, #11673: fix a memory leak when using Dynlink, + the bug was only present in development version of OCaml 5. + (Stephen Dolan, report by Andre Maroneze, review by Gabriel Scherer) + +- #11732: Ensure that types from packed modules are always generalised + (Stephen Dolan and Leo White, review by Jacques Garrigue) + +- #11737: Fix segfault condition in Unix.stat under Windows in the presence of + multiple threads. + (Marc Lasson, Nicolás Ojeda Bär, review by Gabriel Scherer and David Allsopp) + +- #11776: Extend environment with functor parameters in `strengthen_lazy`. + (Chris Casinghino and Luke Maurer, review by Gabriel Scherer) + +- #11533, #11534: follow synonyms again in #show_module_type + (this had stopped working in 4.14.0) + (Gabriel Scherer, review by Jacques Garrigue and Florian Angeletti, + report by Yaron Minsky) + +OCaml 4.14.0 (28 March 2022) +---------------------------- + +### Language features: + +- #10462: Add attribute to produce a compiler error for polls. + (Sadiq Jaffer, review by Mark Shinwell, Stephen Dolan + and Guillaume Munch-Maccagnoni) + +- #10437: Allow explicit binders for type variables. + (Stephen Dolan, review by Leo White) + +- #10441: Remove unnecessary parentheses surrounding immediate objects. + Allow 'object ... end # f', 'f object ... end', etc. + (Yan Dong, review by Nicolás Ojeda Bär, Florian Angeletti and Gabriel Scherer) + +- #181, #9760, #10740: opt-in tail-modulo-cons (TMC) transformation + let[@tail_mod_cons] rec map f li = ... + (Frédéric Bour, Gabriel Scherer, Basile Clément, + review by Basile Clément and Pierre Chambart, + tested by Konstantin Romanov) + +### Runtime system: + +* #9391, #9424: Fix failed assertion in runtime due to ephemerons *set_* and + *blit_* function during Mark phase + (François Bobot, reported by Stephen Dolan, reviewed by Damien Doligez) + +- #10195, #10680: Speed up GC by prefetching during marking + (Stephen Dolan, review by Xavier Leroy, Guillaume Munch-Maccagnoni, + Jacques-Henri Jourdan, Damien Doligez and Leo White) + +- #10549: Stack overflow detection and naked pointers checking for ARM64 + (Xavier Leroy, review by Stephen Dolan) + +* #10675: Emit deprecation warnings when old C runtime function names + are used. This will break C stub code that uses these old names and + treats warnings as errors. The workaround is to use the new names. + (Xavier Leroy and David Allsopp, review by Sébastien Hinderer and + Damien Doligez) + +- #10698, #10726: Free the alternate signal stack when the main OCaml + code or an OCaml thread stops + (Xavier Leroy, review by David Allsopp and Damien Doligez) + +- #10730, 10731: Fix bug in `Obj.reachable_words` causing a slowdown when called + multiple time (Alain Frisch, report by ygrek, review by Xavier Leroy) + +- #10926: Rename the two internal Windows Unicode functions with `caml_` prefix + instead of `win_`. + (David Allsopp, review by Kate Deplaix, Damien Doligez and Xavier Leroy) + +### Code generation and optimizations: + +- #10578: Increase the number of integer registers used for + parameter passing on PowerPC (16 registers) and on s390x (8 registers). + (Xavier Leroy, review by Mark Shinwell) + +- #10591, #10615: Tune the heuristic for CSE of integer constants + so as to avoid excessive CSE on compiler-generated constants + and long register allocation times. + (Xavier Leroy, report by Edwin Török, review by Nicolás Ojeda Bär) + +- #10595: Tail calls with up to 64 arguments are guaranteed to be compiled + as tail calls. To this end, memory locations in the domain state + are used for passing arguments that do not fit in registers. + (Xavier Leroy, review by Vincent Laviron) + +- #10681: Enforce boolean conditions for the native backend + (Vincent Laviron, review by Gabriel Scherer) + +- #10719: Ensure that build_apply respects Lambda.max_arity + (Stephen Dolan, review by Xavier Leroy) + +- #10728: Ensure that functions are evaluated after their arguments + (Stephen Dolan, review by Mark Shinwell) + +- #10732: Ensure right-to-left evaluation of arguments in cmm_helpers + (Greta Yorsh, review by Xavier Leroy) + +### Standard library: + +* #10710: Add UTF tools, codecs and validations to the Uchar, Bytes and + String modules. + (Daniel Bünzli, review by Florian Angeletti, Nicolás Ojeda Bär, Alain + Frisch and Gabriel Scherer) + +* #10622: Annotate `Uchar.t` with immediate attribute + (Hongbo Zhang, reivew by Gabriel Scherer and Nicolás Ojeda Bär) + +* #7812, #10475: `Filename.chop_suffix name suff` now checks that `suff` + is actually a suffix of `name` and raises Invalid_argument otherwise. + (Xavier Leroy, report by whitequark, review by David Allsopp) + +* #10482: mark the Stream and Genlex modules as deprecated, in preparation + for a future removal. These modules (without deprecation alert) + are now provided by the camlp-streams library. + (Xavier Leroy, review by Nicolás Ojeda Bär) + +- #10526: add Random.bits32, Random.bits64, Random.nativebits + (Xavier Leroy, review by Gabriel Scherer and François Bobot) + +* #10568: remove Obj.marshal and Obj.unmarshal + (these functions have been deprecated for a while and are superseded + by the functions from module Marshal) + (François Pottier, review by Gabriel Scherer and Kate Deplaix) + +- #10545: Add In_channel and Out_channel modules. + (Nicolás Ojeda Bär, review by Daniel Bünzli, Simon Cruanes, Gabriel Scherer, + Guillaume Munch-Maccagnoni, Alain Frisch and Xavier Leroy) + +- #10538: add Out_channel.set_buffered and Out_channel.is_buffered to control + the buffering mode of output channels. + (Nicolás Ojeda Bär, review by John Whitington, Daniel Bünzli, David Allsopp + and Xavier Leroy) + +* #10583, #10998: Add over 40 new functions in Seq. + (François Pottier and Simon Cruanes, review by Nicolás Ojeda Bär, + Daniel Bünzli, Naëla Courant, Craig Ferguson, Wiktor Kuchta, + Xavier Leroy, Guillaume Munch-Maccagnoni, Raphaël Proust, Gabriel Scherer + and Thierry Martinez) + +- #10596, #10978: Add with_open_bin, with_open_text and with_open_gen to + In_channel and Out_channel. Also, add In_channel.input_all. + (Nicolás Ojeda Bär, review by Daniel Bünzli, Jérémie Dimino, Damien Doligez + and Xavier Leroy) + +- #10658: add detailed information about the current version of OCaml + to the Sys module of the standard library. + (Sébastien Hinderer, review by Damien Doligez, Gabriel Scherer, David + Allsopp, Nicolás Ojeda Bär, Vincent Laviron) + +- #10642: On Windows, Sys.remove and Unix.unlink now remove symlinks + to directories instead of raising EACCES. Introduce + caml/winsupport.h to hold more common code between the runtime, + lib-sys, and win32unix. + (Antonin Décimo, review by David Allsopp and Xavier Leroy) + +- #10737: add new ephemeron API for forward compatibility with Multicore + OCaml. + (Damien Doligez, review by Stephen Dolan) + +- #10786: The implementation of Complex.norm now uses Float.hypot. + (Christophe Troestler, review by David Allsopp and Xavier Leroy) + +### Other libraries: + +- #10192: Add support for Unix domain sockets on Windows and use them + to emulate Unix.socketpair (only available on Windows 1803+) + (Antonin Décimo, review by David Allsopp) + +- #10469: Add Thread.set_uncaught_exception_handler and + Thread.default_uncaught_exception_handler. + (Enguerrand Decorne, review by David Allsopp) + +- #10697: Bindings of dup and dup2 in win32unix now correctly call + WSADuplicateSocket on sockets instead of DuplicateHandle. + (Antonin Décimo, review by Xavier Leroy and Nicolás Ojeda Bär) + +* #10926, #11336: Ensure all C functions in the Unix library are prefixed with + `caml_`. + (David Allsopp, review by Kate Deplaix, Damien Doligez and Xavier Leroy) + +- #10951: Introduce the Thread.Exit exception as an alternative way to + terminate threads prematurely. This alternative way will become + the standard way in 5.0. + (Xavier Leroy, review by Florian Angeletti) + +### Tools: + +- #9701: Release bytecode only after collecting backtrace information + for exceptions, same for dynamic loaded code compiled from toplevel on + ocamlnat. + (Renato Alencar, reported by Krzysztof Leśniak, reviewed by Gabriel Scherer) + +- #10839: Fix regression of #show when printing class type + (Élie Brami, review by Florian Angeletti) + +- #3959, #7202, #10476: ocaml, in script mode, directive errors + (`#use "missing_file";;`) use stderr and exit with an error. + (Florian Angeletti, review by Gabriel Scherer) + +- #10438: add a new toplevel cli argument `-e

Package ocaml

Stdlib

Threads

  • Event First-class synchronous communication.
  • Thread Lightweight threads for Posix 1003.1c and Win32.

Compiler libs

Package info

changes-files
license-files
readme-files
diff --git a/odoc.css b/odoc.css new file mode 100644 index 00000000..c23517ba --- /dev/null +++ b/odoc.css @@ -0,0 +1,1393 @@ +@charset "UTF-8"; +/* Copyright (c) 2016 The odoc contributors. All rights reserved. + Distributed under the ISC license, see terms at the end of the file. + odoc 2.4.1 */ + +/* Fonts */ +/* noticia-text-regular - latin */ +@font-face { + font-family: 'Noticia Text'; + font-style: normal; + font-weight: 400; + src: url('fonts/noticia-text-v15-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* noticia-text-italic - latin */ +@font-face { + font-family: 'Noticia Text'; + font-style: italic; + font-weight: 400; + src: url('fonts/noticia-text-v15-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* noticia-text-700 - latin */ +@font-face { + font-family: 'Noticia Text'; + font-style: normal; + font-weight: 700; + src: url('fonts/noticia-text-v15-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-mono-regular - latin */ +@font-face { + font-family: 'Fira Mono'; + font-style: normal; + font-weight: 400; + src: url('fonts/fira-mono-v14-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-mono-500 - latin */ +@font-face { + font-family: 'Fira Mono'; + font-style: normal; + font-weight: 500; + src: url('fonts/fira-mono-v14-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-regular - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: normal; + font-weight: 400; + src: url('fonts/fira-sans-v17-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-italic - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: italic; + font-weight: 400; + src: url('fonts/fira-sans-v17-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-500 - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: normal; + font-weight: 500; + src: url('fonts/fira-sans-v17-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-500italic - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: italic; + font-weight: 500; + src: url('fonts/fira-sans-v17-latin-500italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-700 - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: normal; + font-weight: 700; + src: url('fonts/fira-sans-v17-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-700italic - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: italic; + font-weight: 700; + src: url('fonts/fira-sans-v17-latin-700italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + + +:root, +.light:root { + + scroll-padding-top: calc(var(--search-bar-height) + var(--search-padding-top) + 1em); + + --main-background: #FFFFFF; + + --color: #333333; + --link-color: #2C94BD; + --source-color: grey; + --anchor-hover: #555; + --anchor-color: #d5d5d5; + --xref-shadow: #cc6666; + --header-shadow: #ddd; + --by-name-version-color: #aaa; + --by-name-nav-link-color: #222; + --target-background: rgba(187, 239, 253, 0.3); + --target-shadow: rgba(187, 239, 253, 0.8); + --pre-border-color: #eee; + --code-background: #f6f8fa; + + --li-code-background: #f6f8fa; + --li-code-color: #0d2b3e; + --toc-color: #1F2D3D; + --toc-before-color: #777; + --toc-background: #f6f8fa; + --toc-background-emph: #ecf0f5; + --toc-list-border: #ccc; + + --spec-summary-border-color: #5c9cf5; + --spec-label-color: green; + --spec-summary-background: var(--code-background); + --spec-summary-hover-background: #ebeff2; + --spec-details-after-background: rgba(0, 4, 15, 0.05); + --spec-details-after-shadow: rgba(204, 204, 204, 0.53); + + --search-results-border: #bbb; + --search-results-shadow: #bbb; + + --search-snake: #82aaff; + +} + +.dark:root { + --main-background: #202020; + --code-background: #222; + --line-numbers-background: rgba(0, 0, 0, 0.125); + --navbar-background: #202020; + + --color: #bebebe; + --dirname-color: #666; + --underline-color: #444; + --visited-color: #002800; + --visited-number-color: #252; + --unvisited-color: #380000; + --unvisited-number-color: #622; + --somevisited-color: #303000; + --highlight-color: #303e3f; + --line-number-color: rgba(230, 230, 230, 0.3); + --unvisited-margin-color: #622; + --border: #333; + --navbar-border: #333; + --code-color: #ccc; + + --li-code-background: #373737; + --li-code-color: #999; + --toc-color: #777; + --toc-background: #252525; + --toc-background-emph: #2a2a2a; + + --hljs-link: #999; + --hljs-keyword: #cda869; + --hljs-regexp: #f9ee98; + --hljs-title: #dcdcaa; + --hljs-type: #ac885b; + --hljs-meta: #82aaff; + --hljs-variable: #cf6a4c; + + --spec-label-color: lightgreen; + + --search-results-border: #505050; + --search-results-shadow: #404040; + +} + +@media (prefers-color-scheme: dark) { + :root { + --main-background: #202020; + --code-background: #333; + --line-numbers-background: rgba(0, 0, 0, 0.125); + --navbar-background: #202020; + + --meter-unvisited-color: #622; + --meter-visited-color: #252; + --meter-separator-color: black; + + --color: #bebebe; + --dirname-color: #666; + --underline-color: #444; + --visited-color: #002800; + --visited-number-color: #252; + --unvisited-color: #380000; + --unvisited-number-color: #622; + --somevisited-color: #303000; + --highlight-color: #303e3f; + --line-number-color: rgba(230, 230, 230, 0.3); + --unvisited-margin-color: #622; + --border: #333; + --navbar-border: #333; + --code-color: #ccc; + --by-name-nav-link-color: var(--color); + + --li-code-background: #373737; + --li-code-color: #999; + --toc-color: #777; + --toc-before-color: #777; + --toc-background: #252525; + --toc-background-emph: #2a2a2a; + --toc-list-border: #ccc; + --spec-summary-hover-background: #ebeff2; + --spec-details-after-background: rgba(0, 4, 15, 0.05); + --spec-details-after-shadow: rgba(204, 204, 204, 0.53); + + --hljs-link: #999; + --hljs-keyword: #cda869; + --hljs-regexp: #f9ee98; + --hljs-title: #dcdcaa; + --hljs-type: #ac885b; + --hljs-meta: #82aaff; + --hljs-variable: #cf6a4c; + + --spec-label-color: lightgreen; + + --search-results-border: #505050; + --search-results-shadow: #404040; + + } +} + +/* Reset a few things. */ + +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { + padding: 0; + border: 0; + font: inherit; + vertical-align: baseline; + +} + +table { + border-collapse: collapse; + border-spacing: 0; +} + +*, *:before, *:after { + box-sizing: border-box; +} + +html { + font-size: 15px; + scroll-behavior: smooth; +} + +body { + text-align: left; + background: #FFFFFF; + color: var(--color); + background-color: var(--main-background); + font-family: "Noticia Text", Georgia, serif; + line-height: 1.5; +} + +body { + margin-left: auto; + margin-right: auto; + padding: 0 4ex; +} + +body.odoc { + max-width: 132ex; + display: grid; + grid-template-columns: min-content 1fr; + column-gap: 4ex; + row-gap: 2ex; +} + +body.odoc-src { + margin-right: calc(10vw + 20ex); +} + +.odoc-content { + grid-row: 4; + grid-column: 2; +} + +.odoc-preamble > *:first-child { + /* This make the first thing in the preamble align with the sidebar */ + padding-top: 0; + margin-top: 0; +} + +header { + margin-bottom: 30px; +} + +header.odoc-preamble { + grid-column: 2; + grid-row: 3; +} + +nav { + font-family: "Fira Sans", sans-serif; +} + +nav.odoc-nav { + grid-column: 2; + grid-row: 2; +} + +/* Basic markup elements */ + +b, strong { + font-weight: bold; +} + +i { + font-style: italic; +} + +em, i em.odd{ + font-style: italic; +} + +em.odd, i em { + font-style: normal; +} + +sup { + vertical-align: super; +} + +sub { + vertical-align: sub; +} + +sup, sub { + font-size: 12px; + line-height: 0; + margin-left: 0.2ex; +} + +ul, ol { + list-style-position: outside +} + +ul>li { + margin-left: 22px; +} + +ol>li { + margin-left: 27.2px; +} + +li>*:first-child { + margin-top: 0 +} + +/* Text alignements, this should be forbidden. */ + +.left { + text-align: left; +} + +.right { + text-align: right; +} + +.center { + text-align: center; +} + +/* Links and anchors */ + +a { + text-decoration: none; + color: var(--link-color); +} + +.odoc-src pre a { + color: inherit; +} + +a:hover { + box-shadow: 0 1px 0 0 var(--link-color); +} + +/* Linked highlight */ +*:target { + background-color: var(--target-background) !important; + box-shadow: 0 0px 0 1px var(--target-shadow) !important; + border-radius: 1px; +} + +*:hover > a.anchor { + visibility: visible; +} + +a.anchor:before { + content: "#"; +} + +a.anchor:hover { + box-shadow: none; + text-decoration: none; + color: var(--anchor-hover); +} + +a.anchor { + visibility: hidden; + position: absolute; + /* top: 0px; */ + /* margin-left: -3ex; */ + margin-left: -1.3em; + font-weight: normal; + font-style: normal; + padding-right: 0.4em; + padding-left: 0.4em; + /* To remain selectable */ + color: var(--anchor-color); +} + +.spec > a.anchor { + margin-left: -2.3em; + padding-right: 0.9em; +} + +.xref-unresolved { + color: #2C94BD; +} +.xref-unresolved:hover { + box-shadow: 0 1px 0 0 var(--xref-shadow); +} + +/* Source links float inside preformated text or headings. */ +a.source_link { + float: right; + color: var(--source-color); + font-family: "Fira Sans", sans-serif; + font-size: initial; +} + +/* Section and document divisions. + Until at least 4.03 many of the modules of the stdlib start at .h7, + we restart the sequence there like h2 */ + +h1, h2, h3, h4, h5, h6, .h7, .h8, .h9, .h10 { + font-family: "Fira Sans", sans-serif; + font-weight: 400; + padding-top: 0.1em; + line-height: 1.2; + overflow-wrap: break-word; +} + +.odoc-preamble h1 { + margin-top: 10px; +} + +h1 { + font-weight: 500; + font-size: 2.441em; +} + +h1 { + font-weight: 500; + font-size: 1.953em; + box-shadow: 0 1px 0 0 var(--header-shadow); +} + +h2 { + font-size: 1.563em; +} + +h3 { + font-size: 1.25em; +} + +small, .font_small { + font-size: 0.8em; +} + +h1 code, h1 tt { + font-size: inherit; + font-weight: inherit; +} + +h2 code, h2 tt { + font-size: inherit; + font-weight: inherit; +} + +h3 code, h3 tt { + font-size: inherit; + font-weight: inherit; +} + +h3 code, h3 tt { + font-size: inherit; + font-weight: inherit; +} + +h4 { + font-size: 1.12em; +} + +/* Comment delimiters, hidden but accessible to screen readers and + selected for copy/pasting */ + +/* Taken from bootstrap */ +/* See also https://stackoverflow.com/a/27769435/4220738 */ +.comment-delim { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + +/* Preformatted and code */ + +tt, code, pre { + font-family: "Fira Mono", monospace; + font-weight: 400; +} + +.odoc pre { + padding: 0.1em; + border: 1px solid var(--pre-border-color); + border-radius: 5px; + overflow-x: auto; +} + +.odoc p code, +.odoc li code { + background-color: var(--li-code-background); + color: var(--li-code-color); + border-radius: 3px; + padding: 0 0.3ex; +} + +p a > code, li a > code { + color: var(--link-color); +} + +.odoc code { + white-space: pre-wrap; +} + +/* Code blocks (e.g. Examples) */ + +.odoc pre code { + font-size: 0.893rem; +} + +/* Code lexemes */ + +.keyword { + font-weight: 500; +} + +.arrow { white-space: nowrap } + +/* Module member specification */ + +.spec { + background-color: var(--spec-summary-background); + border-radius: 3px; + border-left: 4px solid var(--spec-summary-border-color); + border-right: 5px solid transparent; + padding: 0.35em 0.5em; +} + +.spec .label, .spec .optlabel { + color: var(--spec-label-color); +} + +li:not(:last-child) > .def-doc { + margin-bottom: 15px; +} + +/* Spacing between items */ +div.odoc-spec,.odoc-include { + margin-bottom: 2em; +} + +.spec.type .variant p, .spec.type .record p { + margin: 5px; +} + +.spec.type .variant, .spec.type .record { + margin-left: 2ch; +} + +.spec.type li.variant, .spec.type li.record { + list-style: none; +} + +.spec.type .record > code, .spec.type .variant > code { + min-width: 40%; +} + +.spec.type > ol { + margin-top: 0; + margin-bottom: 0; +} + +.spec.type .record > .def-doc, .spec.type .variant > .def-doc { + min-width:50%; + padding: 0.25em 0.5em; + margin-left: 10%; + border-radius: 3px; + background: var(--main-background); + box-shadow: 1px 1px 2px lightgrey; +} + +div.def { + margin-top: 0; + text-indent: -2ex; + padding-left: 2ex; +} + +div.def-doc>*:first-child { + margin-top: 0; +} + +/* Collapsible inlined include and module */ + +.odoc-include details { + position: relative; +} + +.odoc-include.shadowed-include { + display: none; +} + +.odoc-include details:after { + z-index: -100; + display: block; + content: " "; + position: absolute; + border-radius: 0 1ex 1ex 0; + right: -20px; + top: 1px; + bottom: 1px; + width: 15px; + background: var(--spec-details-after-background, rgba(0, 4, 15, 0.05)); + box-shadow: 0 0px 0 1px var(--spec-details-after-shadow, rgba(204, 204, 204, 0.53)); +} + +.odoc-include summary { + position: relative; + margin-bottom: 1em; + cursor: pointer; + outline: none; +} + +.odoc-include summary:hover { + background-color: var(--spec-summary-hover-background); +} + +/* FIXME: Does not work in Firefox. */ +.odoc-include summary::-webkit-details-marker { + color: #888; + transform: scaleX(-1); + position: absolute; + top: calc(50% - 5px); + height: 11px; + right: -29px; +} + +/* Records and variants FIXME */ + +div.def table { + text-indent: 0em; + padding: 0; + margin-left: -2ex; +} + +td.def { + padding-left: 2ex; +} + +td.def-doc *:first-child { + margin-top: 0em; +} + +/* Lists of @tags */ + +.at-tags { list-style-type: none; margin-left: -3ex; } +.at-tags li { padding-left: 3ex; text-indent: -3ex; } +.at-tags .at-tag { text-transform: capitalize } + +/* Alert emoji */ + +.alert::before, .deprecated::before { + content: '⚠️ '; +} + +/* Lists of modules */ + +.modules { list-style-type: none; margin-left: -3ex; } +.modules li { padding-left: 3ex; text-indent: -3ex; margin-top: 5px } +.modules .synopsis { padding-left: 1ch; } + +/* Odig package index */ + +.packages { list-style-type: none; margin-left: -3ex; } +.packages li { padding-left: 3ex; text-indent: -3ex } +.packages li a.anchor { padding-right: 0.5ch; padding-left: 3ch; } +.packages .version { font-size: 10px; color: var(--by-name-version-color); } +.packages .synopsis { padding-left: 1ch } + +.by-name nav a { + text-transform: uppercase; + font-size: 18px; + margin-right: 1ex; + color: var(--by-name-nav-link-color,); + display: inline-block; +} + +.by-tag nav a { + margin-right: 1ex; + color: var(--by-name-nav-link-color); + display: inline-block; +} + +.by-tag ol { list-style-type: none; } +.by-tag ol.tags li { margin-left: 1ch; display: inline-block } +.by-tag td:first-child { text-transform: uppercase; } + +/* Odig package page */ + +.package nav { + display: inline; + font-size: 14px; + font-weight: normal; +} + +.package .version { + font-size: 14px; +} + +.package.info { + margin: 0; +} + +.package.info td:first-child { + font-style: italic; + padding-right: 2ex; +} + +.package.info ul { + list-style-type: none; + display: inline; + margin: 0; +} + +.package.info li { + display: inline-block; + margin: 0; + margin-right: 1ex; +} + +#info-authors li, #info-maintainers li { + display: block; +} + +/* Sidebar and TOC */ + +.odoc-toc:before { + display: block; + content: "Contents"; + text-transform: uppercase; + font-size: 1em; + margin: 1.414em 0 0.5em; + font-weight: 500; + color: var(--toc-before-color); + line-height: 1.2; +} + +/* When a search bar is present, we need the sticky sidebar to be a bit lower, + so `top` is higher */ + +.odoc-search + * + .odoc-toc { + --toc-top: calc(var(--search-bar-height) + var(--search-padding-top) + 20px); + max-height: calc(100vh - 2 * var(--toc-top)); + top: var(--toc-top) +} + +.odoc-toc { + --toc-top: 20px; + width: 28ex; + background: var(--toc-background); + overflow: auto; + color: var(--toc-color); + padding-left: 2ex; + padding-right: 2ex; + grid-row-start: 3; + grid-row-end: 5; + grid-column: 1; + height: fit-content; + border: solid 1px var(--border); + border-radius: 5px; + position:sticky; + max-height: calc(100vh - 2 * var(--toc-top)); + top: var(--toc-top) +} + +.odoc-toc ul li a { + font-family: "Fira Sans", sans-serif; + font-size: 0.95em; + color: var(--color); + font-weight: 400; + line-height: 1.2em; + display: block; +} + +.odoc-sidebar ul li a:hover { + box-shadow: none; + text-decoration: underline; +} + +:root { + --search-bar-height: 25px; + --search-padding-top: 1rem; +} + +.odoc-search { + position: sticky; + top: 0; + background: var(--main-background); + /* This amounts to fit-content when the search is not active, but when you + have the search results displayed, you do not want the height of the search + container to change. */ + height: calc(var(--search-bar-height) + var(--search-padding-top)); + width: 100%; + padding-top: var(--search-padding-top); + z-index: 1; + grid-row: 1; + grid-column-start: 1; + grid-column-end: 3; +} + + +.odoc-search .search-inner { + width: 100%; + position: relative; + left: 0; + display: grid; + /* The second column is for the search snake, which has 0 width */ + grid-template-columns: 1fr 0fr; + grid-row-gap: 1rem; + /* The second row is for the search results. It has a width, but only */ + grid-template-rows: min-content 0px; + background: transparent; +} + +.odoc-search .search-bar { + position: relative; + z-index: 2; + font-size: 1em; + transition: font-size 0.3s; + box-shadow: 0px 0px 0.2rem 0.3em var(--main-background); + height: var(--search-bar-height); +} + +.odoc-search:focus-within .search-bar { + font-size: 1.1em; +} + +.odoc-search:not(:focus-within) .search-result { + display: none; +} + +.odoc-search .search-result:empty { + display: none; +} + +.odoc-search .search-result { + grid-row: 2; + background: var(--toc-background); + position: absolute; + left: 0; + right: 0; + border: solid; + border-color: var(--search-results-border); + border-width: 1px; + border-radius: 6px; + box-shadow: 0 3px 10px 2px var(--search-results-shadow), 0 0 3px 4px var(--main-background), 0px -1rem 0px 0px var(--main-background); + /* Works better on smallish screens with this */ + max-height: calc(min(40rem, 50vh)); + overflow-y: auto; +} + +.search-bar { + /* inputs are of fixed size by default, even if you display:block them */ + width: 100%; +} + + +.odoc-search .search-no-result { + color: var(--color); + border-bottom: var(--search-results-border) solid 1px; + background-color: inherit; + outline: 0; + padding: 10px; + padding-right: 0.5rem; +} + +.search-bar-container { + display: flex; + align-items: stretch; + border-bottom: 1rem solid var(--main-background); +} + +.search-snake { + grid-row: 1; + grid-column: 2; + display: flex; + align-items: center; + width: 0; + z-index: 2; + position: relative; + left: 0; + margin-top: 4px; + margin-bottom: 4px; + /* Otherwise the search snake flickers for very fast searches. */ + transition: opacity 0.2s; + opacity: 0; +} + +.search-snake.search-busy { + opacity: 1; +} + +.search-snake:before { + content: " "; + display: block; + aspect-ratio: 1 / 1; + height: 100%; + margin-right: 4px; + border-radius: 50%; + border: 3px solid #aaa; + border-color: var(--search-snake) transparent var(--search-snake) transparent; + animation: search-snake 1.2s linear infinite; + position: absolute; + right: 0; +} + +@keyframes search-snake { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} + +:root { + --kind-font-size-factor: 0.8; +} + +.odoc-search .search-entry { + color: var(--color); + display: grid; + /* Possible kinds are the following : + "doc" "type" "mod" "exn" "class" "meth" "cons" "sig" "cons" "field" "val" + and "ext". + As the longest is 5 characters (and the font monospace), we give 5 + character size to the column. However the font used for kind is a little + smaller, so we adjust by this factor. + */ + grid-template-columns: [kinds] calc(var(--kind-font-size-factor) * 5ch) [titles] 1fr; + column-gap: 0.5rem; + border-bottom: var(--search-results-border) solid 1px; + background-color: inherit; + outline: 0; + padding: 0.4rem 0.4rem 0.7rem 0.7rem; +} +.odoc-search .search-entry p { + margin: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.odoc-search .search-entry:focus-visible { + box-shadow: none; + background-color: var(--target-background); +} + +.odoc-search .search-entry:hover { + box-shadow: none; + background-color: var(--toc-background-emph); +} + +.odoc-search .search-entry .entry-kind { + grid-row: 1/2; + grid-column: 1/2; + line-height: 1.4rem; + font-size: calc(var(--kind-font-size-factor) * 1em); + font-weight: bold; + text-align: right; + position: relative; + bottom: 0; +} + +.odoc-search .search-entry pre { + border: none; + margin: 0; +} + +.odoc-search .search-entry pre code { + font-size: 1em; + background-color: var(--li-code-background); + color: var(--li-code-color); + border-radius: 3px; + padding: 0 0.3ex; +} + +.odoc-search .search-entry .entry-title { + width: 100%; + display: block; + grid-column: 2/2; + grid-row: 1/2; + align-self: end; + line-height: 1.4rem; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.odoc-search .entry-name { + font-weight: bold; +} + +.odoc-search .prefix-name { + font-weight: bold; +} + +.odoc-search .search-entry .prefix-name { + opacity: 0.7; +} + +.odoc-search .entry-rhs { + white-space: nowrap; +} + +.odoc-search .search-entry .entry-content { + flex-grow: 1; + flex-shrink: 1; + min-width: 0; +} + +.odoc-search .search-entry .entry-comment { + max-height: 1.5em; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 0.95em; + grid-row: 2/2; + grid-column: 2/2; +} + +.odoc-search .search-entry .entry-comment ul { + white-space: nowrap; + display: inline; +} + +.odoc-search .search-entry .entry-comment li { + display: inline; + white-space: nowrap; +} + +.odoc-search .search-entry .entry-comment ul>li::before { + content: '•'; +} + +.odoc-search .search-entry .entry-comment div { + display: inline; + white-space: nowrap; +} + +.odoc-search .search-entry .entry-comment p { + display: inline; + white-space: nowrap; +} + +.odoc-search .search-entry .entry-comment code { + display: inline; + white-space: nowrap; +} + +/* First level titles */ + +.odoc-toc>ul>li>a { + font-weight: 500; +} + +.odoc-toc li ul { + margin: 0px; + padding-top: 0.25em; +} + +.odoc-toc ul { + list-style-type: none; +} + +.odoc-toc ul li { + padding: 0.25em 0; +} + +.odoc-toc>ul>li { + margin-bottom: 0.3em; +} + +.odoc-toc ul li li { + border-left: 1px solid var(--toc-list-border); + margin-left: 5px; + padding-left: 12px; +} + +/* Tables */ + +.odoc-table { + margin: 1em; +} + +.odoc-table td, +.odoc-table th { + padding-left: 0.5em; + padding-right: 0.5em; + border: 1px solid black; +} + +.odoc-table th { + font-weight: bold; +} + +/* Mobile adjustements. */ + +@media only screen and (max-width: 110ex) { + body { + margin: 2em; + padding: 0; + } + + body.odoc { + display: block; + } + + .odoc-toc { + position: static; + width: auto; + min-width: unset; + max-width: unset; + border: none; + padding: 0.2em 1em; + border-radius: 5px; + margin-bottom: 2em; + } +} + +/* Print adjustements. */ + +@media print { + body { + color: black; + background: white; + } + + body nav:first-child { + visibility: hidden; + } +} + +/* Source code. */ + +.source_container { + display: flex; +} + +.source_line_column { + padding-right: 0.5em; + text-align: right; + background: #eee8d5; +} + +.source_line { + padding: 0 1em; +} + +.source_code { + flex-grow: 1; + background: #fdf6e3; + padding: 0 0.3em; + color: #657b83; +} + +/* Source directories */ + +.odoc-directory::before { + content: "📁"; + margin: 0.3em; + font-size: 1.3em; +} + +.odoc-file::before { + content: "📄"; + margin: 0.3em; + font-size: 1.3em; +} + +.odoc-folder-list { + list-style: none; +} + +/* Syntax highlighting (based on github-gist) */ + +.hljs { + display: block; + background: var(--code-background); + padding: 0.5em; + color: var(--color); + overflow-x: auto; +} + +.hljs-comment, +.hljs-meta { + color: #969896; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-strong, +.hljs-emphasis, +.hljs-quote { + color: #df5000; +} + +.hljs-keyword, +.hljs-selector-tag { + color: #a71d5d; +} + +.hljs-type, +.hljs-class .hljs-title { + color: #458; + font-weight: 500; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute { + color: #0086b3; +} + +.hljs-section, +.hljs-name { + color: #63a35c; +} + +.hljs-tag { + color: #333333; +} + +.hljs-attr, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #795da3; +} + +.hljs-addition { + color: #55a532; + background-color: #eaffea; +} + +.hljs-deletion { + color: #bd2c00; + background-color: #ffecec; +} + +.hljs-link { + text-decoration: underline; +} + +.VAL, +.TYPE, +.LET, +.REC, +.IN, +.OPEN, +.NONREC, +.MODULE, +.METHOD, +.LETOP, +.INHERIT, +.INCLUDE, +.FUNCTOR, +.EXTERNAL, +.CONSTRAINT, +.ASSERT, +.AND, +.END, +.CLASS, +.STRUCT, +.SIG { + color: #859900; + ; +} + +.WITH, +.WHILE, +.WHEN, +.VIRTUAL, +.TRY, +.TO, +.THEN, +.PRIVATE, +.OF, +.NEW, +.MUTABLE, +.MATCH, +.LAZY, +.IF, +.FUNCTION, +.FUN, +.FOR, +.EXCEPTION, +.ELSE, +.TO, +.DOWNTO, +.DO, +.DONE, +.BEGIN, +.AS { + color: #cb4b16; +} + +.TRUE, +.FALSE { + color: #b58900; +} + +.failwith, +.INT, +.SEMISEMI, +.LIDENT { + color: #2aa198; +} + +.STRING, +.CHAR, +.UIDENT { + color: #b58900; +} + +.DOCSTRING { + color: #268bd2; +} + +.COMMENT { + color: #93a1a1; +} + +/*--------------------------------------------------------------------------- + Copyright (c) 2016 The odoc contributors + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + ---------------------------------------------------------------------------*/ \ No newline at end of file diff --git a/odoc_search.js b/odoc_search.js new file mode 100644 index 00000000..0dc659d2 --- /dev/null +++ b/odoc_search.js @@ -0,0 +1,66 @@ +/* The browsers interpretation of the CORS origin policy prevents to run + webworkers from javascript files fetched from the file:// protocol. This hack + is to workaround this restriction. */ +function createWebWorker() { + var searchs = search_urls.map((search_url) => { + let parts = document.location.href.split("/"); + parts[parts.length - 1] = search_url; + return '"' + parts.join("/") + '"'; + }); + blobContents = ["importScripts(" + searchs.join(",") + ");"]; + var blob = new Blob(blobContents, { type: "application/javascript" }); + var blobUrl = URL.createObjectURL(blob); + + var worker = new Worker(blobUrl); + URL.revokeObjectURL(blobUrl); + + return worker; +} + +var worker; +var waiting = 0; + +function wait() { + waiting = waiting + 1; + document.querySelector(".search-snake").classList.add("search-busy"); +} + +function stop_waiting() { + if (waiting > 0) waiting = waiting - 1; + else waiting = 0; + if (waiting == 0) { + document.querySelector(".search-snake").classList.remove("search-busy"); + } +} + +document.querySelector(".search-bar").addEventListener("focus", (ev) => { + if (typeof worker == "undefined") { + worker = createWebWorker(); + worker.onmessage = (e) => { + stop_waiting(); + let results = e.data; + let search_results = document.querySelector(".search-result"); + search_results.innerHTML = ""; + let f = (entry) => { + let search_result = document.createElement("a"); + search_result.classList.add("search-entry"); + search_result.href = base_url + entry.url; + search_result.innerHTML = entry.html; + search_results.appendChild(search_result); + }; + results.forEach(f); + let search_request = document.querySelector(".search-bar").value; + if (results.length == 0 && search_request != "") { + let no_result = document.createElement("div"); + no_result.classList.add("search-no-result"); + no_result.innerText = "No result..."; + search_results.appendChild(no_result); + } + }; + } +}); + +document.querySelector(".search-bar").addEventListener("input", (ev) => { + wait(); + worker.postMessage(ev.target.value); +}); diff --git a/tiny_httpd/Tiny_httpd/index.html b/tiny_httpd/Tiny_httpd/index.html new file mode 100644 index 00000000..6f065ab5 --- /dev/null +++ b/tiny_httpd/Tiny_httpd/index.html @@ -0,0 +1,104 @@ + +Tiny_httpd (tiny_httpd.Tiny_httpd)

Module Tiny_httpd

Tiny Http Server

This library implements a very simple, basic HTTP/1.1 server using blocking IOs and threads. Basic routing based on Scanf is provided for convenience, so that several handlers can be registered.

It is possible to use a thread pool, see create's argument new_thread.

The echo example (see src/examples/echo.ml) demonstrates some of the features by declaring a few endpoints, including one for uploading files:

module S = Tiny_httpd
+
+let () =
+  let server = S.create () in
+
+  (* say hello *)
+  S.add_route_handler ~meth:`GET server
+    S.Route.(exact "hello" @/ string @/ return)
+    (fun name _req -> S.Response.make_string (Ok ("hello " ^name ^"!\n")));
+
+  (* echo request *)
+  S.add_route_handler server
+    S.Route.(exact "echo" @/ return)
+    (fun req -> S.Response.make_string
+        (Ok (Format.asprintf "echo:@ %a@." S.Request.pp req)));
+
+  (* file upload *)
+  S.add_route_handler ~meth:`PUT server
+    S.Route.(exact "upload" @/ string_urlencoded @/ return)
+    (fun path req ->
+        try
+          let oc = open_out @@ "/tmp/" ^ path in
+          output_string oc req.S.Request.body;
+          flush oc;
+          S.Response.make_string (Ok "uploaded file")
+        with e ->
+          S.Response.fail ~code:500 "couldn't upload file: %s"
+            (Printexc.to_string e)
+      );
+
+  (* run the server *)
+  Printf.printf "listening on http://%s:%d\n%!" (S.addr server) (S.port server);
+  match S.run server with
+  | Ok () -> ()
+  | Error e -> raise e

It is then possible to query it using curl:

$ dune exec src/examples/echo.exe &
+listening on http://127.0.0.1:8080
+
+# the path "hello/name" greets you.
+$ curl -X GET http://localhost:8080/hello/quadrarotaphile
+hello quadrarotaphile!
+
+# the path "echo" just prints the request.
+$ curl -X GET http://localhost:8080/echo --data "howdy y'all"
+echo:
+{meth=GET;
+ headers=Host: localhost:8080
+         User-Agent: curl/7.66.0
+         Accept: */*
+         Content-Length: 10
+         Content-Type: application/x-www-form-urlencoded;
+ path="/echo"; body="howdy y'all"}

Tiny buffer implementation

These buffers are used to avoid allocating too many byte arrays when processing streams and parsing requests.

module Buf = Tiny_httpd_buf

Generic byte streams

module Byte_stream = Tiny_httpd_stream

IO Abstraction

module IO = Tiny_httpd_io

Logging

module Log = Tiny_httpd_log

Main Server Type

type buf = Tiny_httpd_buf.t
type byte_stream = Tiny_httpd_stream.t
HTTP Methods
Headers

Headers are metadata associated with a request or response.

module Headers = Tiny_httpd_server.Headers
Requests

Requests are sent by a client, e.g. a web browser or cURL. From the point of view of the server, they're inputs.

module Request = Tiny_httpd_server.Request
Response Codes
module Response_code = Tiny_httpd_server.Response_code
Responses

Responses are what a http server, such as Tiny_httpd, send back to the client to answer a Request.t

module Response = Tiny_httpd_server.Response
Routing

Basic type-safe routing of handlers based on URL paths. This is optional, it is possible to only define the root handler with something like Routes.

  • since 0.6
Middlewares

A middleware can be inserted in a handler to modify or observe its behavior.

  • since 0.11
module Middleware = Tiny_httpd_server.Middleware
Main Server type

A HTTP server. See create for more details.

val create : + ?masksigpipe:bool -> + ?max_connections:int -> + ?timeout:float -> + ?buf_size:int -> + ?get_time_s:(unit -> float) -> + ?new_thread:((unit -> unit) -> unit) -> + ?addr:string -> + ?port:int -> + ?sock:Unix.file_descr -> + ?middlewares:([ `Encoding | `Stage of int ] * Middleware.t) list -> + unit -> + t

Create a new webserver using UNIX abstractions.

The server will not do anything until run is called on it. Before starting the server, one can use add_path_handler and set_top_handler to specify how to handle incoming requests.

  • parameter masksigpipe

    if true, block the signal Sys.sigpipe which otherwise tends to kill client threads when they try to write on broken sockets. Default: true.

  • parameter buf_size

    size for buffers (since 0.11)

  • parameter new_thread

    a function used to spawn a new thread to handle a new client connection. By default it is Thread.create but one could use a thread pool instead. See for example this use of moonpool.

  • parameter max_connections

    maximum number of simultaneous connections.

  • parameter timeout

    connection is closed if the socket does not do read or write for the amount of second. Default: 0.0 which means no timeout. timeout is not recommended when using proxy.

  • parameter addr

    address (IPv4 or IPv6) to listen on. Default "127.0.0.1".

  • parameter port

    to listen on. Default 8080.

  • parameter sock

    an existing socket given to the server to listen on, e.g. by systemd on Linux (or launchd on macOS). If passed in, this socket will be used instead of the addr and port. If not passed in, those will be used. This parameter exists since 0.10.

  • parameter get_time_s

    obtain the current timestamp in seconds. This parameter exists since 0.11.

module type IO_BACKEND = Tiny_httpd_server.IO_BACKEND

A backend that provides IO operations, network operations, etc.

val create_from : + ?buf_size:int -> + ?middlewares:([ `Encoding | `Stage of int ] * Middleware.t) list -> + backend:(module IO_BACKEND) -> + unit -> + t

Create a new webserver using provided backend.

The server will not do anything until run is called on it. Before starting the server, one can use add_path_handler and set_top_handler to specify how to handle incoming requests.

  • parameter buf_size

    size for buffers (since 0.11)

  • since 0.14
val addr : t -> string

Address on which the server listens.

val is_ipv6 : t -> bool

is_ipv6 server returns true iff the address of the server is an IPv6 address.

  • since 0.3
val port : t -> int

Port on which the server listens. Note that this might be different than the port initially given if the port was 0 (meaning that the OS picks a port for us).

val active_connections : t -> int

Number of currently active connections.

val add_decode_request_cb : + t -> + (unit Request.t -> (unit Request.t * (byte_stream -> byte_stream)) option) -> + unit

Add a callback for every request. The callback can provide a stream transformer and a new request (with modified headers, typically). A possible use is to handle decompression by looking for a Transfer-Encoding header and returning a stream transformer that decompresses on the fly.

val add_encode_response_cb : + t -> + (unit Request.t -> Response.t -> Response.t option) -> + unit

Add a callback for every request/response pair. Similarly to add_encode_response_cb the callback can return a new response, for example to compress it. The callback is given the query with only its headers, as well as the current response.

val add_middleware : + stage:[ `Encoding | `Stage of int ] -> + t -> + Middleware.t -> + unit

Add a middleware to every request/response pair.

  • parameter stage

    specify when middleware applies. Encoding comes first (outermost layer), then stages in increasing order.

  • raises Invalid_argument

    if stage is `Stage n where n < 1

  • since 0.11
Request handlers
val set_top_handler : t -> (byte_stream Request.t -> Response.t) -> unit

Setup a handler called by default.

This handler is called with any request not accepted by any handler installed via add_path_handler. If no top handler is installed, unhandled paths will return a 404 not found

This used to take a string Request.t but it now takes a byte_stream Request.t since 0.14 . Use Request.read_body_full to read the body into a string if needed.

val add_route_handler : + ?accept:(unit Request.t -> (unit, Response_code.t * string) result) -> + ?middlewares:Middleware.t list -> + ?meth:Meth.t -> + t -> + ('a, string Request.t -> Response.t) Route.t -> + 'a -> + unit

add_route_handler server Route.(exact "path" @/ string @/ int @/ return) f calls f "foo" 42 request when a request with path "path/foo/42/" is received.

Note that the handlers are called in the reverse order of their addition, so the last registered handler can override previously registered ones.

  • parameter meth

    if provided, only accept requests with the given method. Typically one could react to `GET or `PUT.

  • parameter accept

    should return Ok() if the given request (before its body is read) should be accepted, Error (code,message) if it's to be rejected (e.g. because its content is too big, or for some permission error). See the http_of_dir program for an example of how to use accept to filter uploads that are too large before the upload even starts. The default always returns Ok(), i.e. it accepts all requests.

  • since 0.6
val add_route_handler_stream : + ?accept:(unit Request.t -> (unit, Response_code.t * string) result) -> + ?middlewares:Middleware.t list -> + ?meth:Meth.t -> + t -> + ('a, byte_stream Request.t -> Response.t) Route.t -> + 'a -> + unit

Similar to add_route_handler, but where the body of the request is a stream of bytes that has not been read yet. This is useful when one wants to stream the body directly into a parser, json decoder (such as Jsonm) or into a file.

  • since 0.6
Server-sent events

EXPERIMENTAL: this API is not stable yet.

module type SERVER_SENT_GENERATOR = Tiny_httpd_server.SERVER_SENT_GENERATOR

A server-side function to generate of Server-sent events.

type server_sent_generator = (module SERVER_SENT_GENERATOR)

Server-sent event generator. This generates events that are forwarded to the client (e.g. the browser).

  • since 0.9
val add_route_server_sent_handler : + ?accept:(unit Request.t -> (unit, Response_code.t * string) result) -> + t -> + ('a, string Request.t -> server_sent_generator -> unit) Route.t -> + 'a -> + unit

Add a handler on an endpoint, that serves server-sent events.

The callback is given a generator that can be used to send events as it pleases. The connection is always closed by the client, and the accepted method is always GET. This will set the header "content-type" to "text/event-stream" automatically and reply with a 200 immediately. See server_sent_generator for more details.

This handler stays on the original thread (it is synchronous).

  • since 0.9
Upgrade handlers

These handlers upgrade the connection to another protocol.

  • since NEXT_RELEASE
module type UPGRADE_HANDLER = Tiny_httpd_server.UPGRADE_HANDLER

Handler that upgrades to another protocol.

type upgrade_handler = (module UPGRADE_HANDLER)
  • since NEXT_RELEASE
val add_upgrade_handler : + ?accept:(unit Request.t -> (unit, Response_code.t * string) result) -> + ?middlewares:Middleware.t list -> + t -> + ('a, upgrade_handler) Route.t -> + 'a -> + unit
Run the server
val running : t -> bool

Is the server running?

  • since 0.14
val stop : t -> unit

Ask the server to stop. This might not have an immediate effect as run might currently be waiting on IO.

val run : ?after_init:(unit -> unit) -> t -> (unit, exn) result

Run the main loop of the server, listening on a socket described at the server's creation time, using new_thread to start a thread for each new client.

This returns Ok () if the server exits gracefully, or Error e if it exits with an error.

  • parameter after_init

    is called after the server starts listening. since 0.13 .

val run_exn : ?after_init:(unit -> unit) -> t -> unit

run_exn s is like run s but re-raises an exception if the server exits with an error.

  • since 0.14

Utils

module Util = Tiny_httpd_util

Resource pool

module Pool = Tiny_httpd_pool

Static directory serving

module Dir = Tiny_httpd_dir
module Html = Tiny_httpd_html
diff --git a/tiny_httpd/Tiny_httpd_atomic_/index.html b/tiny_httpd/Tiny_httpd_atomic_/index.html new file mode 100644 index 00000000..791bed86 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_atomic_/index.html @@ -0,0 +1,64 @@ + +Tiny_httpd_atomic_ (tiny_httpd.Tiny_httpd_atomic_)

Module Tiny_httpd_atomic_

include module type of struct include Stdlib.Atomic end
type !'a t = 'a Stdlib.Atomic.t

An atomic (mutable) reference to a value of type 'a.

val make : 'a -> 'a t

Create an atomic reference.

val get : 'a t -> 'a

Get the current value of the atomic reference.

val set : 'a t -> 'a -> unit

Set a new value for the atomic reference.

val exchange : 'a t -> 'a -> 'a

Set a new value for the atomic reference, and return the current value.

val compare_and_set : 'a t -> 'a -> 'a -> bool

compare_and_set r seen v sets the new value of r to v only if its current value is physically equal to seen -- the comparison and the set occur atomically. Returns true if the comparison succeeded (so the set happened) and false otherwise.

val fetch_and_add : int t -> int -> int

fetch_and_add r n atomically increments the value of r by n, and returns the current value (before the increment).

val incr : int t -> unit

incr r atomically increments the value of r by 1.

val decr : int t -> unit

decr r atomically decrements the value of r by 1.

Examples

Basic Thread Coordination

A basic use case is to have global counters that are updated in a thread-safe way, for example to keep some sorts of metrics over IOs performed by the program. Another basic use case is to coordinate the termination of threads in a given program, for example when one thread finds an answer, or when the program is shut down by the user.

Here, for example, we're going to try to find a number whose hash satisfies a basic property. To do that, we'll run multiple threads which will try random numbers until they find one that works.

Of course the output below is a sample run and will change every time the program is run.

(* use for termination *)
+let stop_all_threads = Atomic.make false
+
+(* total number of individual attempts to find a number *)
+let num_attempts = Atomic.make 0
+
+(* find a number that satisfies [p], by... trying random numbers
+   until one fits. *)
+let find_number_where (p:int -> bool) =
+  let rand = Random.State.make_self_init() in
+  while not (Atomic.get stop_all_threads) do
+
+    let n = Random.State.full_int rand max_int in
+    ignore (Atomic.fetch_and_add num_attempts 1 : int);
+
+    if p (Hashtbl.hash n) then (
+      Printf.printf "found %d (hash=%d)\n%!" n (Hashtbl.hash n);
+      Atomic.set stop_all_threads true; (* signal all threads to stop *)
+    )
+  done;;
+
+
+(* run multiple domains to search for a [n] where [hash n <= 100] *)
+let () =
+  let criterion n = n <= 100 in
+  let threads =
+    Array.init 8
+      (fun _ -> Domain.spawn (fun () -> find_number_where criterion))
+  in
+  Array.iter Domain.join threads;
+  Printf.printf "total number of attempts: %d\n%!"
+    (Atomic.get num_attempts) ;;
+
+- : unit = ()
+found 1651745641680046833 (hash=33)
+total number of attempts: 30230350

Treiber Stack

Another example is a basic Treiber stack (a thread-safe stack) that can be safely shared between threads.

Note how both push and pop are recursive, because they attempt to swap the new stack (with one more, or one fewer, element) with the old stack. This is optimistic concurrency: each iteration of, say, push stack x gets the old stack l, and hopes that by the time it tries to replace l with x::l, nobody else has had time to modify the list. If the compare_and_set fails it means we were too optimistic, and must try again.

type 'a stack = 'a list Atomic.t
+
+let rec push (stack: _ stack) elt : unit =
+  let cur = Atomic.get stack in
+  let success = Atomic.compare_and_set stack cur (elt :: cur) in
+  if not success then
+    push stack elt
+
+let rec pop (stack: _ stack) : _ option =
+  let cur = Atomic.get stack in
+  match cur with
+  | [] -> None
+  | x :: tail ->
+    let success = Atomic.compare_and_set stack cur tail in
+    if success then Some x
+    else pop stack
+
+# let st = Atomic.make []
+# push st 1
+- : unit = ()
+# push st 2
+- : unit = ()
+# pop st
+- : int option = Some 2
+# pop st
+- : int option = Some 1
+# pop st
+- : int option = None
diff --git a/tiny_httpd/Tiny_httpd_buf/index.html b/tiny_httpd/Tiny_httpd_buf/index.html new file mode 100644 index 00000000..ab9271b9 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_buf/index.html @@ -0,0 +1,2 @@ + +Tiny_httpd_buf (tiny_httpd.Tiny_httpd_buf)

Module Tiny_httpd_buf

Simple buffer.

These buffers are used to avoid allocating too many byte arrays when processing streams and parsing requests.

  • since 0.12
type t
val size : t -> int
val clear : t -> unit
val create : ?size:int -> unit -> t
val contents : t -> string
val clear_and_zero : t -> unit

Clear the buffer and zero out its storage.

  • since 0.15
val bytes_slice : t -> bytes

Access underlying slice of bytes.

  • since 0.5
val contents_and_clear : t -> string

Get contents of the buffer and clear it.

  • since 0.5
val add_char : t -> char -> unit

Add a single char.

  • since 0.14
val add_bytes : t -> bytes -> int -> int -> unit

Append given bytes slice to the buffer.

  • since 0.5
val add_string : t -> string -> unit

Add string.

  • since 0.14
val add_buffer : t -> Stdlib.Buffer.t -> unit

Append bytes from buffer.

  • since 0.14
diff --git a/tiny_httpd/Tiny_httpd_dir/Embedded_fs/index.html b/tiny_httpd/Tiny_httpd_dir/Embedded_fs/index.html new file mode 100644 index 00000000..c97f0cb2 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_dir/Embedded_fs/index.html @@ -0,0 +1,2 @@ + +Embedded_fs (tiny_httpd.Tiny_httpd_dir.Embedded_fs)

Module Tiny_httpd_dir.Embedded_fs

An embedded file system, as a list of files with (relative) paths. This is useful in combination with the "tiny-httpd-mkfs" tool, which embeds the files it's given into a OCaml module.

  • since 0.12
type t

The pseudo-filesystem

val create : ?mtime:float -> unit -> t
val add_file : ?mtime:float -> t -> path:string -> string -> unit

Add file to the virtual file system.

  • raises Invalid_argument

    if the path contains '..' or if it tries to make a directory out of an existing path that is a file.

val to_vfs : t -> (module VFS)
diff --git a/tiny_httpd/Tiny_httpd_dir/index.html b/tiny_httpd/Tiny_httpd_dir/index.html new file mode 100644 index 00000000..6370ec20 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_dir/index.html @@ -0,0 +1,25 @@ + +Tiny_httpd_dir (tiny_httpd.Tiny_httpd_dir)

Module Tiny_httpd_dir

Serving static content from directories

This module provides the same functionality as the "http_of_dir" tool. It exposes a directory (and its subdirectories), with the optional ability to delete or upload files.

  • since 0.11
type dir_behavior =
  1. | Index
    (*

    Redirect to index.html if present, else fails.

    *)
  2. | Lists
    (*

    Lists content of directory. Be careful of security implications.

    *)
  3. | Index_or_lists
    (*

    Redirect to index.html if present and lists content otherwise. This is useful for tilde ("~") directories and other per-user behavior, but be mindful of security implications

    *)
  4. | Forbidden
    (*

    Forbid access to directory. This is suited for serving assets, for example.

    *)

behavior of static directory.

This controls what happens when the user requests the path to a directory rather than a file.

type hidden

Type used to prevent users from building a config directly. Use default_config or config instead.

type config = {
  1. mutable download : bool;
    (*

    Is downloading files allowed?

    *)
  2. mutable dir_behavior : dir_behavior;
    (*

    Behavior when serving a directory and not a file

    *)
  3. mutable delete : bool;
    (*

    Is deleting a file allowed? (with method DELETE)

    *)
  4. mutable upload : bool;
    (*

    Is uploading a file allowed? (with method PUT)

    *)
  5. mutable max_upload_size : int;
    (*

    If upload is true, this is the maximum size in bytes for uploaded files.

    *)
  6. _rest : hidden;
    (*

    Just ignore this field.

    *)
}

configuration for static file handlers. This might get more fields over time.

val default_config : unit -> config

default configuration: + { download=true + ; dir_behavior=Forbidden + ; delete=false + ; upload=false + ; max_upload_size = 10 * 1024 * 1024 + }

val config : + ?download:bool -> + ?dir_behavior:dir_behavior -> + ?delete:bool -> + ?upload:bool -> + ?max_upload_size:int -> + unit -> + config

Build a config from default_config.

  • since 0.12
val add_dir_path : + config:config -> + dir:string -> + prefix:string -> + Tiny_httpd_server.t -> + unit

add_dirpath ~config ~dir ~prefix server adds route handle to the server to serve static files in dir when url starts with prefix, using the given configuration config.

module type VFS = sig ... end

Virtual file system.

val vfs_of_dir : string -> (module VFS)

vfs_of_dir dir makes a virtual file system that reads from the disk.

  • since 0.12
val add_vfs : + config:config -> + vfs:(module VFS) -> + prefix:string -> + Tiny_httpd_server.t -> + unit

Similar to add_dir_path but using a virtual file system instead.

  • since 0.12
module Embedded_fs : sig ... end

An embedded file system, as a list of files with (relative) paths. This is useful in combination with the "tiny-httpd-mkfs" tool, which embeds the files it's given into a OCaml module.

diff --git a/tiny_httpd/Tiny_httpd_dir/module-type-VFS/index.html b/tiny_httpd/Tiny_httpd_dir/module-type-VFS/index.html new file mode 100644 index 00000000..1099e3e2 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_dir/module-type-VFS/index.html @@ -0,0 +1,2 @@ + +VFS (tiny_httpd.Tiny_httpd_dir.VFS)

Module type Tiny_httpd_dir.VFS

Virtual file system.

This is used to emulate a file system from pure OCaml functions and data, e.g. for resources bundled inside the web server.

  • since 0.12
val descr : string

Description of the VFS

val is_directory : string -> bool
val contains : string -> bool

file_exists vfs path returns true if path points to a file or directory inside vfs.

val list_dir : string -> string array

List directory. This only returns basenames, the files need to be put in the directory path using Filename.concat.

val delete : string -> unit

Delete path

val create : string -> (bytes -> int -> int -> unit) * (unit -> unit)

Create a file and obtain a pair write, close

val read_file_content : string -> Tiny_httpd_stream.t

Read content of a file

val file_size : string -> int option

File size, e.g. using "stat"

val file_mtime : string -> float option

File modification time, e.g. using "stat"

diff --git a/tiny_httpd/Tiny_httpd_html/index.html b/tiny_httpd/Tiny_httpd_html/index.html new file mode 100644 index 00000000..603ac911 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_html/index.html @@ -0,0 +1,2 @@ + +Tiny_httpd_html (tiny_httpd.Tiny_httpd_html)

Module Tiny_httpd_html

HTML combinators.

This module provides combinators to produce html. It doesn't enforce the well-formedness of the html, unlike Tyxml, but it's simple and should be reasonably efficient.

  • since 0.12
module IO = Tiny_httpd_io

Output for HTML combinators.

type attribute = string * string

An attribute, i.e. a key/value pair

type elt = Out.t -> unit

A html element. It is represented by its output function, so we can directly print it.

type void = ?if_:bool -> attribute list -> elt

Element without children.

type nary = ?if_:bool -> attribute list -> elt list -> elt

Element with children, represented as a list.

  • parameter if_

    if false, do not print anything (default true)

type sub_elt = [
  1. | `E of elt
  2. | `L of elt list
  3. | `S of elt Stdlib.Seq.t
  4. | `Nil
]

A chunk of sub-elements, possibly empty.

type nary' = ?if_:bool -> attribute list -> sub_elt list -> elt

Element with children, represented as a list of sub_elt to be flattened

  • parameter if_

    if false, do not print anything (default true)

val sub_e : elt -> sub_elt

Sub-element with a single element inside.

val sub_l : elt list -> sub_elt

Sub-element with a list of items inside.

val sub_seq : elt Stdlib.Seq.t -> sub_elt

Sub-element with a sequence (Seq.t) of items inside.

val seq_of_array : 'a array -> 'b Stdlib.Seq.t

Helper to build a Seq.t from an array.

val sub_empty : sub_elt

Sub-element with nothing inside. Useful in conditionals, when one decides not to emit a sub-element at all.

val txt : string -> elt

Emit a string value, which will be escaped.

val txtf : ('a, Stdlib.Format.formatter, unit, Out.t -> unit) format4 -> 'b

Formatted version of txt

val raw_html : string -> elt

Emit raw HTML. Caution, this can lead to injection vulnerabilities, never use with text that comes from untrusted users.

val area : void

tag "area", see mdn

val base : void

tag "base", see mdn

val br : void

tag "br", see mdn

val col : void

tag "col", see mdn

val embed : void

tag "embed", see mdn

val hr : void

tag "hr", see mdn

val img : void

tag "img", see mdn

val input : void

tag "input", see mdn

tag "link", see mdn

val menuitem : void

tag "menuitem", see mdn

val meta : void

tag "meta", see mdn

val param : void

tag "param", see mdn

val source : void

tag "source", see mdn

val track : void

tag "track", see mdn

val wbr : void

tag "wbr", see mdn

val a : nary

tag "a", see mdn

val a' : nary'

tag "a", see mdn

val abbr : nary

tag "abbr", see mdn

val abbr' : nary'

tag "abbr", see mdn

val address : nary

tag "address", see mdn

val address' : nary'

tag "address", see mdn

val article : nary

tag "article", see mdn

val article' : nary'

tag "article", see mdn

val aside : nary

tag "aside", see mdn

val aside' : nary'

tag "aside", see mdn

val audio : nary

tag "audio", see mdn

val audio' : nary'

tag "audio", see mdn

val b : nary

tag "b", see mdn

val b' : nary'

tag "b", see mdn

val bdi : nary

tag "bdi", see mdn

val bdi' : nary'

tag "bdi", see mdn

val bdo : nary

tag "bdo", see mdn

val bdo' : nary'

tag "bdo", see mdn

val blockquote : nary

tag "blockquote", see mdn

val blockquote' : nary'

tag "blockquote", see mdn

val body : nary

tag "body", see mdn

val body' : nary'

tag "body", see mdn

val button : nary

tag "button", see mdn

val button' : nary'

tag "button", see mdn

val canvas : nary

tag "canvas", see mdn

val canvas' : nary'

tag "canvas", see mdn

val caption : nary

tag "caption", see mdn

val caption' : nary'

tag "caption", see mdn

val cite : nary

tag "cite", see mdn

val cite' : nary'

tag "cite", see mdn

val code : nary

tag "code", see mdn

val code' : nary'

tag "code", see mdn

val colgroup : nary

tag "colgroup", see mdn

val colgroup' : nary'

tag "colgroup", see mdn

val data : nary

tag "data", see mdn

val data' : nary'

tag "data", see mdn

val datalist : nary

tag "datalist", see mdn

val datalist' : nary'

tag "datalist", see mdn

val dd : nary

tag "dd", see mdn

val dd' : nary'

tag "dd", see mdn

val del : nary

tag "del", see mdn

val del' : nary'

tag "del", see mdn

val details : nary

tag "details", see mdn

val details' : nary'

tag "details", see mdn

val dfn : nary

tag "dfn", see mdn

val dfn' : nary'

tag "dfn", see mdn

val dialog : nary

tag "dialog", see mdn

val dialog' : nary'

tag "dialog", see mdn

val div : nary

tag "div", see mdn

val div' : nary'

tag "div", see mdn

val dl : nary

tag "dl", see mdn

val dl' : nary'

tag "dl", see mdn

val dt : nary

tag "dt", see mdn

val dt' : nary'

tag "dt", see mdn

val em : nary

tag "em", see mdn

val em' : nary'

tag "em", see mdn

val fieldset : nary

tag "fieldset", see mdn

val fieldset' : nary'

tag "fieldset", see mdn

val figcaption : nary

tag "figcaption", see mdn

val figcaption' : nary'

tag "figcaption", see mdn

val figure : nary

tag "figure", see mdn

val figure' : nary'

tag "figure", see mdn

tag "footer", see mdn

val footer' : nary'

tag "footer", see mdn

val form : nary

tag "form", see mdn

val form' : nary'

tag "form", see mdn

val h1 : nary

tag "h1", see mdn

val h1' : nary'

tag "h1", see mdn

val h2 : nary

tag "h2", see mdn

val h2' : nary'

tag "h2", see mdn

val h3 : nary

tag "h3", see mdn

val h3' : nary'

tag "h3", see mdn

val h4 : nary

tag "h4", see mdn

val h4' : nary'

tag "h4", see mdn

val h5 : nary

tag "h5", see mdn

val h5' : nary'

tag "h5", see mdn

val h6 : nary

tag "h6", see mdn

val h6' : nary'

tag "h6", see mdn

val head : nary

tag "head", see mdn

val head' : nary'

tag "head", see mdn

val header : nary

tag "header", see mdn

val header' : nary'

tag "header", see mdn

val hgroup : nary

tag "hgroup", see mdn

val hgroup' : nary'

tag "hgroup", see mdn

val html : nary

tag "html", see mdn

val html' : nary'

tag "html", see mdn

val i : nary

tag "i", see mdn

val i' : nary'

tag "i", see mdn

val iframe : nary

tag "iframe", see mdn

val iframe' : nary'

tag "iframe", see mdn

val ins : nary

tag "ins", see mdn

val ins' : nary'

tag "ins", see mdn

val kbd : nary

tag "kbd", see mdn

val kbd' : nary'

tag "kbd", see mdn

val label : nary

tag "label", see mdn

val label' : nary'

tag "label", see mdn

val legend : nary

tag "legend", see mdn

val legend' : nary'

tag "legend", see mdn

val li : nary

tag "li", see mdn

val li' : nary'

tag "li", see mdn

val main : nary

tag "main", see mdn

val main' : nary'

tag "main", see mdn

val map : nary

tag "map", see mdn

val map' : nary'

tag "map", see mdn

val mark : nary

tag "mark", see mdn

val mark' : nary'

tag "mark", see mdn

val math : nary

tag "math", see mdn

val math' : nary'

tag "math", see mdn

val menu : nary

tag "menu", see mdn

val menu' : nary'

tag "menu", see mdn

val meter : nary

tag "meter", see mdn

val meter' : nary'

tag "meter", see mdn

val nav : nary

tag "nav", see mdn

val nav' : nary'

tag "nav", see mdn

val noscript : nary

tag "noscript", see mdn

val noscript' : nary'

tag "noscript", see mdn

val object_ : nary

tag "object", see mdn

val object_' : nary'

tag "object", see mdn

val ol : nary

tag "ol", see mdn

val ol' : nary'

tag "ol", see mdn

val optgroup : nary

tag "optgroup", see mdn

val optgroup' : nary'

tag "optgroup", see mdn

val option : nary

tag "option", see mdn

val option' : nary'

tag "option", see mdn

val output : nary

tag "output", see mdn

val output' : nary'

tag "output", see mdn

val p : nary

tag "p", see mdn

val p' : nary'

tag "p", see mdn

val picture : nary

tag "picture", see mdn

val picture' : nary'

tag "picture", see mdn

val pre : nary

tag "pre", see mdn

val pre' : nary'

tag "pre", see mdn

val progress : nary

tag "progress", see mdn

val progress' : nary'

tag "progress", see mdn

val q : nary

tag "q", see mdn

val q' : nary'

tag "q", see mdn

val rb : nary

tag "rb", see mdn

val rb' : nary'

tag "rb", see mdn

val rp : nary

tag "rp", see mdn

val rp' : nary'

tag "rp", see mdn

val rt : nary

tag "rt", see mdn

val rt' : nary'

tag "rt", see mdn

val rtc : nary

tag "rtc", see mdn

val rtc' : nary'

tag "rtc", see mdn

val ruby : nary

tag "ruby", see mdn

val ruby' : nary'

tag "ruby", see mdn

val s : nary

tag "s", see mdn

val s' : nary'

tag "s", see mdn

val samp : nary

tag "samp", see mdn

val samp' : nary'

tag "samp", see mdn

val script : nary

tag "script", see mdn

val script' : nary'

tag "script", see mdn

val section : nary

tag "section", see mdn

val section' : nary'

tag "section", see mdn

val select : nary

tag "select", see mdn

val select' : nary'

tag "select", see mdn

val slot : nary

tag "slot", see mdn

val slot' : nary'

tag "slot", see mdn

val small : nary

tag "small", see mdn

val small' : nary'

tag "small", see mdn

val span : nary

tag "span", see mdn

val span' : nary'

tag "span", see mdn

val strong : nary

tag "strong", see mdn

val strong' : nary'

tag "strong", see mdn

val style : nary

tag "style", see mdn

val style' : nary'

tag "style", see mdn

val sub : nary

tag "sub", see mdn

val sub' : nary'

tag "sub", see mdn

val summary : nary

tag "summary", see mdn

val summary' : nary'

tag "summary", see mdn

val sup : nary

tag "sup", see mdn

val sup' : nary'

tag "sup", see mdn

val svg : nary

tag "svg", see mdn

val svg' : nary'

tag "svg", see mdn

val table : nary

tag "table", see mdn

val table' : nary'

tag "table", see mdn

val tbody : nary

tag "tbody", see mdn

val tbody' : nary'

tag "tbody", see mdn

val td : nary

tag "td", see mdn

val td' : nary'

tag "td", see mdn

val template : nary

tag "template", see mdn

val template' : nary'

tag "template", see mdn

val textarea : nary

tag "textarea", see mdn

val textarea' : nary'

tag "textarea", see mdn

val tfoot : nary

tag "tfoot", see mdn

val tfoot' : nary'

tag "tfoot", see mdn

val th : nary

tag "th", see mdn

val th' : nary'

tag "th", see mdn

val thead : nary

tag "thead", see mdn

val thead' : nary'

tag "thead", see mdn

val time : nary

tag "time", see mdn

val time' : nary'

tag "time", see mdn

val title : nary

tag "title", see mdn

val title' : nary'

tag "title", see mdn

val tr : nary

tag "tr", see mdn

val tr' : nary'

tag "tr", see mdn

val u : nary

tag "u", see mdn

val u' : nary'

tag "u", see mdn

val ul : nary

tag "ul", see mdn

val ul' : nary'

tag "ul", see mdn

val var : nary

tag "var", see mdn

val var' : nary'

tag "var", see mdn

val video : nary

tag "video", see mdn

val video' : nary'

tag "video", see mdn

Attributes.

val to_output : ?top:bool -> elt -> IO.Output.t -> unit

Write an HTML element to this output.

  • parameter top

    if true, add DOCTYPE at the beginning. The top element should then be a "html" tag.

  • since 0.14
val to_string : ?top:bool -> elt -> string

Convert a HTML element to a string.

  • parameter top

    if true, add DOCTYPE at the beginning. The top element should then be a "html" tag.

val to_string_l : elt list -> string

Convert a list of HTML elements to a string. This is designed for fragments of HTML that are to be injected inside a bigger context, as it's invalid to have multiple elements at the toplevel of a HTML document.

val to_string_top : elt -> string
val to_out_channel_top : elt -> IO.Output.t -> unit

Write a toplevel element to an output channel.

  • since 0.14
val to_writer : ?top:bool -> elt -> IO.Writer.t

Produce a streaming writer from this HTML element.

  • parameter top

    if true, add a DOCTYPE. See to_out_channel.

  • since 0.14
val to_stream : elt -> Tiny_httpd_stream.t

Convert a HTML element to a stream. This might just convert it to a string first, do not assume it to be more efficient.

diff --git a/tiny_httpd/Tiny_httpd_html_/A/index.html b/tiny_httpd/Tiny_httpd_html_/A/index.html new file mode 100644 index 00000000..8ee4720a --- /dev/null +++ b/tiny_httpd/Tiny_httpd_html_/A/index.html @@ -0,0 +1,2 @@ + +A (tiny_httpd.Tiny_httpd_html_.A)

Module Tiny_httpd_html_.A

Attributes.

This module contains combinator for the standard attributes. One can also just use a pair of strings.

type t = string -> attribute

Attribute builder

val accept : t

Attribute "accept".

val accept_charset : t

Attribute "accept-charset".

val accesskey : t

Attribute "accesskey".

val action : t

Attribute "action".

val align : t

Attribute "align".

val allow : t

Attribute "allow".

val alt : t

Attribute "alt".

val async : t

Attribute "async".

val autocapitalize : t

Attribute "autocapitalize".

val autocomplete : t

Attribute "autocomplete".

val autofocus : t

Attribute "autofocus".

val autoplay : t

Attribute "autoplay".

val buffered : t

Attribute "buffered".

val capture : t

Attribute "capture".

val challenge : t

Attribute "challenge".

val charset : t

Attribute "charset".

val checked : t

Attribute "checked".

val cite : t

Attribute "cite".

val class_ : t

Attribute "class".

val code : t

Attribute "code".

val codebase : t

Attribute "codebase".

val cols : t

Attribute "cols".

val colspan : t

Attribute "colspan".

val content : t

Attribute "content".

val contenteditable : t

Attribute "contenteditable".

val contextmenu : t

Attribute "contextmenu".

val controls : t

Attribute "controls".

val coords : t

Attribute "coords".

val crossorigin : t

Attribute "crossorigin".

val csp : t

Attribute "csp".

val data : t

Attribute "data".

val data_star : t

Attribute "data-*".

val datetime : t

Attribute "datetime".

val decoding : t

Attribute "decoding".

val default : t

Attribute "default".

val defer : t

Attribute "defer".

val dir : t

Attribute "dir".

val dirname : t

Attribute "dirname".

val disabled : t

Attribute "disabled".

val download : t

Attribute "download".

val draggable : t

Attribute "draggable".

val enctype : t

Attribute "enctype".

val enterkeyhint : t

Attribute "enterkeyhint".

val for_ : t

Attribute "for".

val form : t

Attribute "form".

val formaction : t

Attribute "formaction".

val formenctype : t

Attribute "formenctype".

val formmethod : t

Attribute "formmethod".

val formnovalidate : t

Attribute "formnovalidate".

val formtarget : t

Attribute "formtarget".

val headers : t

Attribute "headers".

val hidden : t

Attribute "hidden".

val high : t

Attribute "high".

val href : t

Attribute "href".

val hreflang : t

Attribute "hreflang".

val http_equiv : t

Attribute "http-equiv".

val icon : t

Attribute "icon".

val id : t

Attribute "id".

val importance : t

Attribute "importance".

val integrity : t

Attribute "integrity".

val ismap : t

Attribute "ismap".

val itemprop : t

Attribute "itemprop".

val keytype : t

Attribute "keytype".

val kind : t

Attribute "kind".

val label : t

Attribute "label".

val lang : t

Attribute "lang".

val language : t

Attribute "language".

val list : t

Attribute "list".

val loop : t

Attribute "loop".

val low : t

Attribute "low".

val manifest : t

Attribute "manifest".

val max : t

Attribute "max".

val maxlength : t

Attribute "maxlength".

val minlength : t

Attribute "minlength".

val media : t

Attribute "media".

val method_ : t

Attribute "method".

val min : t

Attribute "min".

val multiple : t

Attribute "multiple".

val muted : t

Attribute "muted".

val name : t

Attribute "name".

val novalidate : t

Attribute "novalidate".

val open_ : t

Attribute "open".

val optimum : t

Attribute "optimum".

val pattern : t

Attribute "pattern".

val ping : t

Attribute "ping".

val placeholder : t

Attribute "placeholder".

val poster : t

Attribute "poster".

val preload : t

Attribute "preload".

val radiogroup : t

Attribute "radiogroup".

val readonly : t

Attribute "readonly".

val referrerpolicy : t

Attribute "referrerpolicy".

val rel : t

Attribute "rel".

val required : t

Attribute "required".

val reversed : t

Attribute "reversed".

val rows : t

Attribute "rows".

val rowspan : t

Attribute "rowspan".

val sandbox : t

Attribute "sandbox".

val scope : t

Attribute "scope".

val scoped : t

Attribute "scoped".

val selected : t

Attribute "selected".

val shape : t

Attribute "shape".

val size : t

Attribute "size".

val sizes : t

Attribute "sizes".

val slot : t

Attribute "slot".

val span : t

Attribute "span".

val spellcheck : t

Attribute "spellcheck".

val src : t

Attribute "src".

val srcdoc : t

Attribute "srcdoc".

val srclang : t

Attribute "srclang".

val srcset : t

Attribute "srcset".

val start : t

Attribute "start".

val step : t

Attribute "step".

val style : t

Attribute "style".

val summary : t

Attribute "summary".

val tabindex : t

Attribute "tabindex".

val target : t

Attribute "target".

val title : t

Attribute "title".

val translate : t

Attribute "translate".

val text : t

Attribute "Text".

val type_ : t

Attribute "type".

val usemap : t

Attribute "usemap".

val value : t

Attribute "value".

val width : t

Attribute "width".

val wrap : t

Attribute "wrap".

diff --git a/tiny_httpd/Tiny_httpd_html_/Out/index.html b/tiny_httpd/Tiny_httpd_html_/Out/index.html new file mode 100644 index 00000000..7d32dec1 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_html_/Out/index.html @@ -0,0 +1,2 @@ + +Out (tiny_httpd.Tiny_httpd_html_.Out)

Module Tiny_httpd_html_.Out

Output for HTML combinators.

This output type is used to produce a string reasonably efficiently from a tree of combinators.

NOTE: this is experimental and an unstable API.

  • since 0.12
type t
val create_of_buffer : Stdlib.Buffer.t -> t
val create_of_out : Tiny_httpd_io.Output.t -> t
val flush : t -> unit
val add_char : t -> char -> unit
val add_string : t -> string -> unit
val add_format_nl : t -> unit
val with_no_format_nl : t -> (unit -> 'a) -> 'a
diff --git a/tiny_httpd/Tiny_httpd_html_/index.html b/tiny_httpd/Tiny_httpd_html_/index.html new file mode 100644 index 00000000..c077b957 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_html_/index.html @@ -0,0 +1,2 @@ + +Tiny_httpd_html_ (tiny_httpd.Tiny_httpd_html_)

Module Tiny_httpd_html_

module Out : sig ... end

Output for HTML combinators.

type attribute = string * string

An attribute, i.e. a key/value pair

type elt = Out.t -> unit

A html element. It is represented by its output function, so we can directly print it.

type void = ?if_:bool -> attribute list -> elt

Element without children.

type nary = ?if_:bool -> attribute list -> elt list -> elt

Element with children, represented as a list.

  • parameter if_

    if false, do not print anything (default true)

type sub_elt = [
  1. | `E of elt
  2. | `L of elt list
  3. | `S of elt Stdlib.Seq.t
  4. | `Nil
]

A chunk of sub-elements, possibly empty.

type nary' = ?if_:bool -> attribute list -> sub_elt list -> elt

Element with children, represented as a list of sub_elt to be flattened

  • parameter if_

    if false, do not print anything (default true)

val sub_e : elt -> sub_elt

Sub-element with a single element inside.

val sub_l : elt list -> sub_elt

Sub-element with a list of items inside.

val sub_seq : elt Stdlib.Seq.t -> sub_elt

Sub-element with a sequence (Seq.t) of items inside.

val seq_of_array : 'a array -> 'b Stdlib.Seq.t

Helper to build a Seq.t from an array.

val sub_empty : sub_elt

Sub-element with nothing inside. Useful in conditionals, when one decides not to emit a sub-element at all.

val txt : string -> elt

Emit a string value, which will be escaped.

val txtf : ('a, Stdlib.Format.formatter, unit, Out.t -> unit) format4 -> 'b

Formatted version of txt

val raw_html : string -> elt

Emit raw HTML. Caution, this can lead to injection vulnerabilities, never use with text that comes from untrusted users.

val area : void

tag "area", see mdn

val base : void

tag "base", see mdn

val br : void

tag "br", see mdn

val col : void

tag "col", see mdn

val embed : void

tag "embed", see mdn

val hr : void

tag "hr", see mdn

val img : void

tag "img", see mdn

val input : void

tag "input", see mdn

tag "link", see mdn

val menuitem : void

tag "menuitem", see mdn

val meta : void

tag "meta", see mdn

val param : void

tag "param", see mdn

val source : void

tag "source", see mdn

val track : void

tag "track", see mdn

val wbr : void

tag "wbr", see mdn

val a : nary

tag "a", see mdn

val a' : nary'

tag "a", see mdn

val abbr : nary

tag "abbr", see mdn

val abbr' : nary'

tag "abbr", see mdn

val address : nary

tag "address", see mdn

val address' : nary'

tag "address", see mdn

val article : nary

tag "article", see mdn

val article' : nary'

tag "article", see mdn

val aside : nary

tag "aside", see mdn

val aside' : nary'

tag "aside", see mdn

val audio : nary

tag "audio", see mdn

val audio' : nary'

tag "audio", see mdn

val b : nary

tag "b", see mdn

val b' : nary'

tag "b", see mdn

val bdi : nary

tag "bdi", see mdn

val bdi' : nary'

tag "bdi", see mdn

val bdo : nary

tag "bdo", see mdn

val bdo' : nary'

tag "bdo", see mdn

val blockquote : nary

tag "blockquote", see mdn

val blockquote' : nary'

tag "blockquote", see mdn

val body : nary

tag "body", see mdn

val body' : nary'

tag "body", see mdn

val button : nary

tag "button", see mdn

val button' : nary'

tag "button", see mdn

val canvas : nary

tag "canvas", see mdn

val canvas' : nary'

tag "canvas", see mdn

val caption : nary

tag "caption", see mdn

val caption' : nary'

tag "caption", see mdn

val cite : nary

tag "cite", see mdn

val cite' : nary'

tag "cite", see mdn

val code : nary

tag "code", see mdn

val code' : nary'

tag "code", see mdn

val colgroup : nary

tag "colgroup", see mdn

val colgroup' : nary'

tag "colgroup", see mdn

val data : nary

tag "data", see mdn

val data' : nary'

tag "data", see mdn

val datalist : nary

tag "datalist", see mdn

val datalist' : nary'

tag "datalist", see mdn

val dd : nary

tag "dd", see mdn

val dd' : nary'

tag "dd", see mdn

val del : nary

tag "del", see mdn

val del' : nary'

tag "del", see mdn

val details : nary

tag "details", see mdn

val details' : nary'

tag "details", see mdn

val dfn : nary

tag "dfn", see mdn

val dfn' : nary'

tag "dfn", see mdn

val dialog : nary

tag "dialog", see mdn

val dialog' : nary'

tag "dialog", see mdn

val div : nary

tag "div", see mdn

val div' : nary'

tag "div", see mdn

val dl : nary

tag "dl", see mdn

val dl' : nary'

tag "dl", see mdn

val dt : nary

tag "dt", see mdn

val dt' : nary'

tag "dt", see mdn

val em : nary

tag "em", see mdn

val em' : nary'

tag "em", see mdn

val fieldset : nary

tag "fieldset", see mdn

val fieldset' : nary'

tag "fieldset", see mdn

val figcaption : nary

tag "figcaption", see mdn

val figcaption' : nary'

tag "figcaption", see mdn

val figure : nary

tag "figure", see mdn

val figure' : nary'

tag "figure", see mdn

tag "footer", see mdn

val footer' : nary'

tag "footer", see mdn

val form : nary

tag "form", see mdn

val form' : nary'

tag "form", see mdn

val h1 : nary

tag "h1", see mdn

val h1' : nary'

tag "h1", see mdn

val h2 : nary

tag "h2", see mdn

val h2' : nary'

tag "h2", see mdn

val h3 : nary

tag "h3", see mdn

val h3' : nary'

tag "h3", see mdn

val h4 : nary

tag "h4", see mdn

val h4' : nary'

tag "h4", see mdn

val h5 : nary

tag "h5", see mdn

val h5' : nary'

tag "h5", see mdn

val h6 : nary

tag "h6", see mdn

val h6' : nary'

tag "h6", see mdn

val head : nary

tag "head", see mdn

val head' : nary'

tag "head", see mdn

val header : nary

tag "header", see mdn

val header' : nary'

tag "header", see mdn

val hgroup : nary

tag "hgroup", see mdn

val hgroup' : nary'

tag "hgroup", see mdn

val html : nary

tag "html", see mdn

val html' : nary'

tag "html", see mdn

val i : nary

tag "i", see mdn

val i' : nary'

tag "i", see mdn

val iframe : nary

tag "iframe", see mdn

val iframe' : nary'

tag "iframe", see mdn

val ins : nary

tag "ins", see mdn

val ins' : nary'

tag "ins", see mdn

val kbd : nary

tag "kbd", see mdn

val kbd' : nary'

tag "kbd", see mdn

val label : nary

tag "label", see mdn

val label' : nary'

tag "label", see mdn

val legend : nary

tag "legend", see mdn

val legend' : nary'

tag "legend", see mdn

val li : nary

tag "li", see mdn

val li' : nary'

tag "li", see mdn

val main : nary

tag "main", see mdn

val main' : nary'

tag "main", see mdn

val map : nary

tag "map", see mdn

val map' : nary'

tag "map", see mdn

val mark : nary

tag "mark", see mdn

val mark' : nary'

tag "mark", see mdn

val math : nary

tag "math", see mdn

val math' : nary'

tag "math", see mdn

val menu : nary

tag "menu", see mdn

val menu' : nary'

tag "menu", see mdn

val meter : nary

tag "meter", see mdn

val meter' : nary'

tag "meter", see mdn

val nav : nary

tag "nav", see mdn

val nav' : nary'

tag "nav", see mdn

val noscript : nary

tag "noscript", see mdn

val noscript' : nary'

tag "noscript", see mdn

val object_ : nary

tag "object", see mdn

val object_' : nary'

tag "object", see mdn

val ol : nary

tag "ol", see mdn

val ol' : nary'

tag "ol", see mdn

val optgroup : nary

tag "optgroup", see mdn

val optgroup' : nary'

tag "optgroup", see mdn

val option : nary

tag "option", see mdn

val option' : nary'

tag "option", see mdn

val output : nary

tag "output", see mdn

val output' : nary'

tag "output", see mdn

val p : nary

tag "p", see mdn

val p' : nary'

tag "p", see mdn

val picture : nary

tag "picture", see mdn

val picture' : nary'

tag "picture", see mdn

val pre : nary

tag "pre", see mdn

val pre' : nary'

tag "pre", see mdn

val progress : nary

tag "progress", see mdn

val progress' : nary'

tag "progress", see mdn

val q : nary

tag "q", see mdn

val q' : nary'

tag "q", see mdn

val rb : nary

tag "rb", see mdn

val rb' : nary'

tag "rb", see mdn

val rp : nary

tag "rp", see mdn

val rp' : nary'

tag "rp", see mdn

val rt : nary

tag "rt", see mdn

val rt' : nary'

tag "rt", see mdn

val rtc : nary

tag "rtc", see mdn

val rtc' : nary'

tag "rtc", see mdn

val ruby : nary

tag "ruby", see mdn

val ruby' : nary'

tag "ruby", see mdn

val s : nary

tag "s", see mdn

val s' : nary'

tag "s", see mdn

val samp : nary

tag "samp", see mdn

val samp' : nary'

tag "samp", see mdn

val script : nary

tag "script", see mdn

val script' : nary'

tag "script", see mdn

val section : nary

tag "section", see mdn

val section' : nary'

tag "section", see mdn

val select : nary

tag "select", see mdn

val select' : nary'

tag "select", see mdn

val slot : nary

tag "slot", see mdn

val slot' : nary'

tag "slot", see mdn

val small : nary

tag "small", see mdn

val small' : nary'

tag "small", see mdn

val span : nary

tag "span", see mdn

val span' : nary'

tag "span", see mdn

val strong : nary

tag "strong", see mdn

val strong' : nary'

tag "strong", see mdn

val style : nary

tag "style", see mdn

val style' : nary'

tag "style", see mdn

val sub : nary

tag "sub", see mdn

val sub' : nary'

tag "sub", see mdn

val summary : nary

tag "summary", see mdn

val summary' : nary'

tag "summary", see mdn

val sup : nary

tag "sup", see mdn

val sup' : nary'

tag "sup", see mdn

val svg : nary

tag "svg", see mdn

val svg' : nary'

tag "svg", see mdn

val table : nary

tag "table", see mdn

val table' : nary'

tag "table", see mdn

val tbody : nary

tag "tbody", see mdn

val tbody' : nary'

tag "tbody", see mdn

val td : nary

tag "td", see mdn

val td' : nary'

tag "td", see mdn

val template : nary

tag "template", see mdn

val template' : nary'

tag "template", see mdn

val textarea : nary

tag "textarea", see mdn

val textarea' : nary'

tag "textarea", see mdn

val tfoot : nary

tag "tfoot", see mdn

val tfoot' : nary'

tag "tfoot", see mdn

val th : nary

tag "th", see mdn

val th' : nary'

tag "th", see mdn

val thead : nary

tag "thead", see mdn

val thead' : nary'

tag "thead", see mdn

val time : nary

tag "time", see mdn

val time' : nary'

tag "time", see mdn

val title : nary

tag "title", see mdn

val title' : nary'

tag "title", see mdn

val tr : nary

tag "tr", see mdn

val tr' : nary'

tag "tr", see mdn

val u : nary

tag "u", see mdn

val u' : nary'

tag "u", see mdn

val ul : nary

tag "ul", see mdn

val ul' : nary'

tag "ul", see mdn

val var : nary

tag "var", see mdn

val var' : nary'

tag "var", see mdn

val video : nary

tag "video", see mdn

val video' : nary'

tag "video", see mdn

module A : sig ... end

Attributes.

diff --git a/tiny_httpd/Tiny_httpd_io/Input/index.html b/tiny_httpd/Tiny_httpd_io/Input/index.html new file mode 100644 index 00000000..e1303293 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_io/Input/index.html @@ -0,0 +1,2 @@ + +Input (tiny_httpd.Tiny_httpd_io.Input)

Module Tiny_httpd_io.Input

Input channel (byte source)

type t = {
  1. input : bytes -> int -> int -> int;
    (*

    Read into the slice. Returns 0 only if the channel is closed.

    *)
  2. close : unit -> unit;
    (*

    Close the input. Must be idempotent.

    *)
}

An input channel, i.e an incoming stream of bytes.

This can be a string, an int_channel, an Unix.file_descr, a decompression wrapper around another input channel, etc.

val of_in_channel : ?close_noerr:bool -> in_channel -> t
val of_unix_fd : ?close_noerr:bool -> Unix.file_descr -> t
val of_slice : bytes -> int -> int -> t
val input : t -> bytes -> int -> int -> int

Read into the given slice.

  • returns

    the number of bytes read, 0 means end of input.

val really_input : t -> bytes -> int -> int -> unit

Read exactly len bytes.

  • raises End_of_file

    if the input did not contain enough data.

val close : t -> unit

Close the channel.

val append : t -> t -> t
diff --git a/tiny_httpd/Tiny_httpd_io/Output/index.html b/tiny_httpd/Tiny_httpd_io/Output/index.html new file mode 100644 index 00000000..c0e31c32 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_io/Output/index.html @@ -0,0 +1,2 @@ + +Output (tiny_httpd.Tiny_httpd_io.Output)

Module Tiny_httpd_io.Output

Output channel (byte sink)

type t = {
  1. output_char : char -> unit;
    (*

    Output a single char

    *)
  2. output : bytes -> int -> int -> unit;
    (*

    Output slice

    *)
  3. flush : unit -> unit;
    (*

    Flush underlying buffer

    *)
  4. close : unit -> unit;
    (*

    Close the output. Must be idempotent.

    *)
}

An output channel, ie. a place into which we can write bytes.

This can be a Buffer.t, an out_channel, a Unix.file_descr, etc.

val of_out_channel : ?close_noerr:bool -> out_channel -> t

of_out_channel oc wraps the channel into a Output.t.

  • parameter close_noerr

    if true, then closing the result uses close_out_noerr instead of close_out to close oc

val of_buffer : Stdlib.Buffer.t -> t

of_buffer buf is an output channel that writes directly into buf. flush and close have no effect.

val output_char : t -> char -> unit

Output the buffer slice into this channel

val output : t -> bytes -> int -> int -> unit

Output the buffer slice into this channel

val output_string : t -> string -> unit
val close : t -> unit

Close the channel.

val flush : t -> unit

Flush (ie. force write) any buffered bytes.

val output_buf : t -> Buf.t -> unit
val chunk_encoding : ?buf:Buf.t -> close_rec:bool -> t -> t

chunk_encoding oc makes a new channel that outputs its content into oc in chunk encoding form.

  • parameter close_rec

    if true, closing the result will also close oc

  • parameter buf

    a buffer used to accumulate data into chunks. Chunks are emitted when buf's size gets over a certain threshold, or when flush is called.

diff --git a/tiny_httpd/Tiny_httpd_io/TCP_server/index.html b/tiny_httpd/Tiny_httpd_io/TCP_server/index.html new file mode 100644 index 00000000..b4264f51 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_io/TCP_server/index.html @@ -0,0 +1,2 @@ + +TCP_server (tiny_httpd.Tiny_httpd_io.TCP_server)

Module Tiny_httpd_io.TCP_server

A TCP server abstraction.

type conn_handler = {
  1. handle : client_addr:Unix.sockaddr -> Input.t -> Output.t -> unit;
    (*

    Handle client connection

    *)
}
type t = {
  1. endpoint : unit -> string * int;
    (*

    Endpoint we listen on. This can only be called from within serve.

    *)
  2. active_connections : unit -> int;
    (*

    Number of connections currently active

    *)
  3. running : unit -> bool;
    (*

    Is the server currently running?

    *)
  4. stop : unit -> unit;
    (*

    Ask the server to stop. This might not take effect immediately, and is idempotent. After this server.running() must return false.

    *)
}

A running TCP server.

This contains some functions that provide information about the running server, including whether it's active (as opposed to stopped), a function to stop it, and statistics about the number of connections.

type builder = {
  1. serve : after_init:(t -> unit) -> handle:conn_handler -> unit -> unit;
    (*

    Blocking call to listen for incoming connections and handle them. Uses the connection handler handle to handle individual client connections in individual threads/fibers/tasks.

    • parameter after_init

      is called once with the server after the server has started.

    *)
}

A TCP server builder implementation.

Calling builder.serve ~after_init ~handle () starts a new TCP server on an unspecified endpoint (most likely coming from the function returning this builder) and returns the running server.

diff --git a/tiny_httpd/Tiny_httpd_io/Writer/index.html b/tiny_httpd/Tiny_httpd_io/Writer/index.html new file mode 100644 index 00000000..5d0b2145 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_io/Writer/index.html @@ -0,0 +1,2 @@ + +Writer (tiny_httpd.Tiny_httpd_io.Writer)

Module Tiny_httpd_io.Writer

A writer abstraction.

type t = {
  1. write : Output.t -> unit;
}

Writer.

A writer is a push-based stream of bytes. Give it an output channel and it will write the bytes in it.

This is useful for responses: an http endpoint can return a writer as its response's body; the writer is given access to the connection to the client and can write into it as if it were a regular out_channel, including controlling calls to flush. Tiny_httpd will convert these writes into valid HTTP chunks.

  • since 0.14
val make : write:(Output.t -> unit) -> unit -> t
val write : Output.t -> t -> unit

Write into the channel.

val empty : t

Empty writer, will output 0 bytes.

val of_string : string -> t

A writer that just emits the bytes from the given string.

diff --git a/tiny_httpd/Tiny_httpd_io/index.html b/tiny_httpd/Tiny_httpd_io/index.html new file mode 100644 index 00000000..81b8f98f --- /dev/null +++ b/tiny_httpd/Tiny_httpd_io/index.html @@ -0,0 +1,2 @@ + +Tiny_httpd_io (tiny_httpd.Tiny_httpd_io)

Module Tiny_httpd_io

IO abstraction.

We abstract IO so we can support classic unix blocking IOs with threads, and modern async IO with Eio.

NOTE: experimental.

  • since 0.14
module Buf = Tiny_httpd_buf
module Input : sig ... end

Input channel (byte source)

module Output : sig ... end

Output channel (byte sink)

module Writer : sig ... end

A writer abstraction.

module TCP_server : sig ... end

A TCP server abstraction.

diff --git a/tiny_httpd/Tiny_httpd_log/index.html b/tiny_httpd/Tiny_httpd_log/index.html new file mode 100644 index 00000000..22c65b87 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_log/index.html @@ -0,0 +1,8 @@ + +Tiny_httpd_log (tiny_httpd.Tiny_httpd_log)

Module Tiny_httpd_log

Logging for tiny_httpd

val info : + ((('a, Stdlib.Format.formatter, unit, unit) format4 -> 'a) -> unit) -> + unit
val debug : + ((('a, Stdlib.Format.formatter, unit, unit) format4 -> 'a) -> unit) -> + unit
val error : + ((('a, Stdlib.Format.formatter, unit, unit) format4 -> 'a) -> unit) -> + unit
val setup : debug:bool -> unit -> unit

Setup and enable logging. This should only ever be used in executables, not libraries.

  • parameter debug

    if true, set logging to debug (otherwise info)

val dummy : bool
diff --git a/tiny_httpd/Tiny_httpd_pool/index.html b/tiny_httpd/Tiny_httpd_pool/index.html new file mode 100644 index 00000000..b43e9812 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_pool/index.html @@ -0,0 +1,7 @@ + +Tiny_httpd_pool (tiny_httpd.Tiny_httpd_pool)

Module Tiny_httpd_pool

Resource pool.

This pool is used for buffers. It can be used for other resources but do note that it assumes resources are still reasonably cheap to produce and discard, and will never block waiting for a resource — it's not a good pool for DB connections.

  • since 0.14.
type 'a t

Pool of values of type 'a

val create : + ?clear:('a -> unit) -> + mk_item:(unit -> 'a) -> + ?max_size:int -> + unit -> + 'a t

Create a new pool.

  • parameter mk_item

    produce a new item in case the pool is empty

  • parameter max_size

    maximum number of item in the pool before we start dropping resources on the floor. This controls resource consumption.

  • parameter clear

    a function called on items before recycling them.

val with_resource : 'a t -> ('a -> 'b) -> 'b

with_resource pool f runs f x with x a resource; when f fails or returns, x is returned to the pool for future reuse.

diff --git a/tiny_httpd/Tiny_httpd_prometheus/Counter/index.html b/tiny_httpd/Tiny_httpd_prometheus/Counter/index.html new file mode 100644 index 00000000..d2ed833c --- /dev/null +++ b/tiny_httpd/Tiny_httpd_prometheus/Counter/index.html @@ -0,0 +1,2 @@ + +Counter (tiny_httpd.Tiny_httpd_prometheus.Counter)

Module Tiny_httpd_prometheus.Counter

Counters

type t

A counter, monotonically increasing

val create : Registry.t -> ?tags:tags -> ?descr:string -> string -> t
val incr : t -> unit
val incr_by : t -> int -> unit
val incr_to : t -> int -> unit

Increment to the given number. If it's lower than the current value this does nothing

diff --git a/tiny_httpd/Tiny_httpd_prometheus/GC_metrics/index.html b/tiny_httpd/Tiny_httpd_prometheus/GC_metrics/index.html new file mode 100644 index 00000000..6224a2bb --- /dev/null +++ b/tiny_httpd/Tiny_httpd_prometheus/GC_metrics/index.html @@ -0,0 +1,2 @@ + +GC_metrics (tiny_httpd.Tiny_httpd_prometheus.GC_metrics)

Module Tiny_httpd_prometheus.GC_metrics

type t
val create : Registry.t -> t
val update : t -> unit
val create_and_update_before_emit : Registry.t -> unit

create_and_update_before_emit reg creates new GC metrics, adds them to the registry, and uses Registry.on_will_emit to update the metrics every time the registry is polled.

diff --git a/tiny_httpd/Tiny_httpd_prometheus/Gauge/index.html b/tiny_httpd/Tiny_httpd_prometheus/Gauge/index.html new file mode 100644 index 00000000..c3c44223 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_prometheus/Gauge/index.html @@ -0,0 +1,2 @@ + +Gauge (tiny_httpd.Tiny_httpd_prometheus.Gauge)

Module Tiny_httpd_prometheus.Gauge

Gauges

type t

A gauge, taking arbitrary values

val create : Registry.t -> ?tags:tags -> ?descr:string -> string -> t
val set : t -> int -> unit
val incr : t -> unit
val incr_by : t -> int -> unit
val decr : t -> unit
val decr_by : t -> int -> unit
diff --git a/tiny_httpd/Tiny_httpd_prometheus/Histogram/index.html b/tiny_httpd/Tiny_httpd_prometheus/Histogram/index.html new file mode 100644 index 00000000..4bdbff47 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_prometheus/Histogram/index.html @@ -0,0 +1,8 @@ + +Histogram (tiny_httpd.Tiny_httpd_prometheus.Histogram)

Module Tiny_httpd_prometheus.Histogram

type t

Histogram

val create : + Registry.t -> + ?tags:tags -> + ?descr:string -> + buckets:float list -> + string -> + t
val add : t -> float -> unit
diff --git a/tiny_httpd/Tiny_httpd_prometheus/Registry/index.html b/tiny_httpd/Tiny_httpd_prometheus/Registry/index.html new file mode 100644 index 00000000..5902349b --- /dev/null +++ b/tiny_httpd/Tiny_httpd_prometheus/Registry/index.html @@ -0,0 +1,2 @@ + +Registry (tiny_httpd.Tiny_httpd_prometheus.Registry)

Module Tiny_httpd_prometheus.Registry

Registry for metrics.

type t

The registry contains a group of metrics

val create : unit -> t
val on_will_emit : t -> (unit -> unit) -> unit

on_will_emit registry f calls f() every time emit buf registry is called (before the metrics start being emitted). This is useful to update some metrics on demand.

val emit : Stdlib.Buffer.t -> t -> unit

Write metrics into the given buffer. The buffer will be cleared first thing.

val emit_str : t -> string
diff --git a/tiny_httpd/Tiny_httpd_prometheus/index.html b/tiny_httpd/Tiny_httpd_prometheus/index.html new file mode 100644 index 00000000..a318c0e8 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_prometheus/index.html @@ -0,0 +1,2 @@ + +Tiny_httpd_prometheus (tiny_httpd.Tiny_httpd_prometheus)

Module Tiny_httpd_prometheus

Expose metrics over HTTP in the prometheus format

type tags = (string * string) list
module Registry : sig ... end

Registry for metrics.

val global : Registry.t
module Counter : sig ... end

Counters

module Gauge : sig ... end

Gauges

module Histogram : sig ... end
val http_middleware : Registry.t -> Tiny_httpd.Middleware.t

Middleware to get basic metrics about HTTP requests

val add_route_to_server : Tiny_httpd.t -> Registry.t -> unit

Add a "/metrics" route to the server

val instrument_server : Tiny_httpd.t -> Registry.t -> unit

Add middleware and route

module GC_metrics : sig ... end
diff --git a/tiny_httpd/Tiny_httpd_prometheus__/index.html b/tiny_httpd/Tiny_httpd_prometheus__/index.html new file mode 100644 index 00000000..c86ffcff --- /dev/null +++ b/tiny_httpd/Tiny_httpd_prometheus__/index.html @@ -0,0 +1,2 @@ + +Tiny_httpd_prometheus__ (tiny_httpd.Tiny_httpd_prometheus__)

Module Tiny_httpd_prometheus__

This module is hidden.

diff --git a/tiny_httpd/Tiny_httpd_server/Headers/index.html b/tiny_httpd/Tiny_httpd_server/Headers/index.html new file mode 100644 index 00000000..2d1dbba0 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/Headers/index.html @@ -0,0 +1,2 @@ + +Headers (tiny_httpd.Tiny_httpd_server.Headers)

Module Tiny_httpd_server.Headers

type t = (string * string) list

The header files of a request or response.

Neither the key nor the value can contain '\r' or '\n'. See https://tools.ietf.org/html/rfc7230#section-3.2

val empty : t

Empty list of headers.

  • since 0.5
val get : ?f:(string -> string) -> string -> t -> string option

get k headers looks for the header field with key k.

  • parameter f

    if provided, will transform the value before it is returned.

val set : string -> string -> t -> t

set k v headers sets the key k to value v. It erases any previous entry for k

val remove : string -> t -> t

Remove the key from the headers, if present.

val contains : string -> t -> bool

Is there a header with the given key?

val pp : Stdlib.Format.formatter -> t -> unit

Pretty print the headers.

diff --git a/tiny_httpd/Tiny_httpd_server/Meth/index.html b/tiny_httpd/Tiny_httpd_server/Meth/index.html new file mode 100644 index 00000000..d99fa09f --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/Meth/index.html @@ -0,0 +1,2 @@ + +Meth (tiny_httpd.Tiny_httpd_server.Meth)

Module Tiny_httpd_server.Meth

type t = [
  1. | `GET
  2. | `PUT
  3. | `POST
  4. | `HEAD
  5. | `DELETE
  6. | `OPTIONS
]

A HTTP method. For now we only handle a subset of these.

See https://tools.ietf.org/html/rfc7231#section-4

val pp : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
diff --git a/tiny_httpd/Tiny_httpd_server/Middleware/index.html b/tiny_httpd/Tiny_httpd_server/Middleware/index.html new file mode 100644 index 00000000..9235ec5f --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/Middleware/index.html @@ -0,0 +1,2 @@ + +Middleware (tiny_httpd.Tiny_httpd_server.Middleware)

Module Tiny_httpd_server.Middleware

type handler = byte_stream Request.t -> resp:(Response.t -> unit) -> unit

Handlers are functions returning a response to a request. The response can be delayed, hence the use of a continuation as the resp parameter.

type t = handler -> handler

A middleware is a handler transformation.

It takes the existing handler h, and returns a new one which, given a query, modify it or log it before passing it to h, or fail. It can also log or modify or drop the response.

val nil : t

Trivial middleware that does nothing.

diff --git a/tiny_httpd/Tiny_httpd_server/Request/index.html b/tiny_httpd/Tiny_httpd_server/Request/index.html new file mode 100644 index 00000000..60d386c5 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/Request/index.html @@ -0,0 +1,6 @@ + +Request (tiny_httpd.Tiny_httpd_server.Request)

Module Tiny_httpd_server.Request

type 'body t = private {
  1. meth : Meth.t;
    (*

    HTTP method for this request.

    *)
  2. host : string;
    (*

    Host header, mandatory. It can also be found in headers.

    *)
  3. client_addr : Unix.sockaddr;
    (*

    Client address. Available since 0.14.

    *)
  4. headers : Headers.t;
    (*

    List of headers.

    *)
  5. http_version : int * int;
    (*

    HTTP version. This should be either 1, 0 or 1, 1.

    *)
  6. path : string;
    (*

    Full path of the requested URL.

    *)
  7. path_components : string list;
    (*

    Components of the path of the requested URL.

    *)
  8. query : (string * string) list;
    (*

    Query part of the requested URL.

    *)
  9. body : 'body;
    (*

    Body of the request.

    *)
  10. start_time : float;
    (*

    Obtained via get_time_s in create

    • since 0.11
    *)
}

A request with method, path, host, headers, and a body, sent by a client.

The body is polymorphic because the request goes through several transformations. First it has no body, as only the request and headers are read; then it has a stream body; then the body might be entirely read as a string via read_body_full.

  • since 0.6 The field [query] was added and contains the query parameters in ["?foo=bar,x=y"]
  • since 0.6 The field [path_components] is the part of the path that precedes [query] and is split on ["/"].
  • since 0.11 the type is a private alias
  • since 0.11 the field [start_time] was added
val pp : Stdlib.Format.formatter -> string t -> unit

Pretty print the request and its body. The exact format of this printing is not specified.

val pp_ : Stdlib.Format.formatter -> _ t -> unit

Pretty print the request without its body. The exact format of this printing is not specified.

val headers : _ t -> Headers.t

List of headers of the request, including "Host".

val get_header : ?f:(string -> string) -> _ t -> string -> string option

get_header req h looks up header h in req. It returns None if the header is not present. This is case insensitive and should be used rather than looking up h verbatim in headers.

val get_header_int : _ t -> string -> int option

Same as get_header but also performs a string to integer conversion.

val set_header : string -> string -> 'a t -> 'a t

set_header k v req sets k: v in the request req's headers.

val update_headers : (Headers.t -> Headers.t) -> 'a t -> 'a t

Modify headers using the given function.

  • since 0.11
val set_body : 'a -> _ t -> 'a t

set_body b req returns a new query whose body is b.

  • since 0.11
val host : _ t -> string

Host field of the request. It also appears in the headers.

val client_addr : _ t -> Unix.sockaddr

Client address of the request.

  • since 0.16
val meth : _ t -> Meth.t

Method for the request.

val path : _ t -> string

Request path.

val query : _ t -> (string * string) list

Decode the query part of the path field.

  • since 0.4
val body : 'b t -> 'b

Request body, possibly empty.

val start_time : _ t -> float

time stamp (from Unix.gettimeofday) after parsing the first line of the request

  • since 0.11
val limit_body_size : max_size:int -> byte_stream t -> byte_stream t

Limit the body size to max_size bytes, or return a 413 error.

  • since 0.3
val read_body_full : + ?buf:Tiny_httpd_buf.t -> + ?buf_size:int -> + byte_stream t -> + string t

Read the whole body into a string. Potentially blocking.

  • parameter buf_size

    initial size of underlying buffer (since 0.11)

  • parameter buf

    the initial buffer (since 0.14)

diff --git a/tiny_httpd/Tiny_httpd_server/Response/index.html b/tiny_httpd/Tiny_httpd_server/Response/index.html new file mode 100644 index 00000000..db3fcf8e --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/Response/index.html @@ -0,0 +1,26 @@ + +Response (tiny_httpd.Tiny_httpd_server.Response)

Module Tiny_httpd_server.Response

type body = [
  1. | `String of string
  2. | `Stream of byte_stream
  3. | `Writer of Tiny_httpd_io.Writer.t
  4. | `Void
]

Body of a response, either as a simple string, or a stream of bytes, or nothing (for server-sent events notably).

  • `String str replies with a body set to this string, and a known content-length.
  • `Stream str replies with a body made from this string, using chunked encoding.
  • `Void replies with no body.
  • `Writer w replies with a body created by the writer w, using a chunked encoding. It is available since 0.14.
type t = private {
  1. code : Response_code.t;
    (*

    HTTP response code. See Response_code.

    *)
  2. headers : Headers.t;
    (*

    Headers of the reply. Some will be set by Tiny_httpd automatically.

    *)
  3. body : body;
    (*

    Body of the response. Can be empty.

    *)
}

A response to send back to a client.

val set_body : body -> t -> t

Set the body of the response.

  • since 0.11
val set_header : string -> string -> t -> t

Set a header.

  • since 0.11
val update_headers : (Headers.t -> Headers.t) -> t -> t

Modify headers.

  • since 0.11
val set_headers : Headers.t -> t -> t

Set all headers.

  • since 0.11
val set_code : Response_code.t -> t -> t

Set the response code.

  • since 0.11
val make_raw : ?headers:Headers.t -> code:Response_code.t -> string -> t

Make a response from its raw components, with a string body. Use "" to not send a body at all.

val make_raw_stream : + ?headers:Headers.t -> + code:Response_code.t -> + byte_stream -> + t

Same as make_raw but with a stream body. The body will be sent with the chunked transfer-encoding.

val make_void : ?headers:Headers.t -> code:int -> unit -> t

Return a response without a body at all.

  • since 0.13
val make : + ?headers:Headers.t -> + ?code:int -> + (body, Response_code.t * string) result -> + t

make r turns a result into a response.

  • make (Ok body) replies with 200 and the body.
  • make (Error (code,msg)) replies with the given error code and message as body.
val make_string : + ?headers:Headers.t -> + ?code:int -> + (string, Response_code.t * string) result -> + t

Same as make but with a string body.

val make_writer : + ?headers:Headers.t -> + ?code:int -> + (Tiny_httpd_io.Writer.t, Response_code.t * string) result -> + t

Same as make but with a writer body.

val make_stream : + ?headers:Headers.t -> + ?code:int -> + (byte_stream, Response_code.t * string) result -> + t

Same as make but with a stream body.

val fail : + ?headers:Headers.t -> + code:int -> + ('a, unit, string, t) format4 -> + 'a

Make the current request fail with the given code and message. Example: fail ~code:404 "oh noes, %s not found" "waldo".

val fail_raise : code:int -> ('a, unit, string, 'b) format4 -> 'a

Similar to fail but raises an exception that exits the current handler. This should not be used outside of a (path) handler. Example: fail_raise ~code:404 "oh noes, %s not found" "waldo"; never_executed()

val pp : Stdlib.Format.formatter -> t -> unit

Pretty print the response. The exact format is not specified.

diff --git a/tiny_httpd/Tiny_httpd_server/Response_code/index.html b/tiny_httpd/Tiny_httpd_server/Response_code/index.html new file mode 100644 index 00000000..a3ec9933 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/Response_code/index.html @@ -0,0 +1,2 @@ + +Response_code (tiny_httpd.Tiny_httpd_server.Response_code)

Module Tiny_httpd_server.Response_code

type t = int

A standard HTTP code.

https://tools.ietf.org/html/rfc7231#section-6

val ok : t

The code 200

val not_found : t

The code 404

val descr : t -> string

A description of some of the error codes. NOTE: this is not complete (yet).

val is_success : t -> bool

is_success code is true iff code is in the 2xx or 3xx range.

  • since NEXT_RELEASE
diff --git a/tiny_httpd/Tiny_httpd_server/Route/index.html b/tiny_httpd/Tiny_httpd_server/Route/index.html new file mode 100644 index 00000000..0f85cfb6 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/Route/index.html @@ -0,0 +1,2 @@ + +Route (tiny_httpd.Tiny_httpd_server.Route)

Module Tiny_httpd_server.Route

type ('a, 'b) comp

An atomic component of a path

type ('a, 'b) t

A route, composed of path components

val int : (int -> 'a, 'a) comp

Matches an integer.

val string : (string -> 'a, 'a) comp

Matches a string not containing '/' and binds it as is.

val string_urlencoded : (string -> 'a, 'a) comp

Matches a URL-encoded string, and decodes it.

val exact : string -> ('a, 'a) comp

exact "s" matches "s" and nothing else.

val return : ('a, 'a) t

Matches the empty path.

val rest_of_path : (string -> 'a, 'a) t

Matches a string, even containing '/'. This will match the entirety of the remaining route.

  • since 0.7
val rest_of_path_urlencoded : (string -> 'a, 'a) t

Matches a string, even containing '/', an URL-decode it. This will match the entirety of the remaining route.

  • since 0.7
val (@/) : ('a, 'b) comp -> ('b, 'c) t -> ('a, 'c) t

comp / route matches "foo/bar/…" iff comp matches "foo", and route matches "bar/…".

val exact_path : string -> ('a, 'b) t -> ('a, 'b) t

exact_path "foo/bar/..." r is equivalent to exact "foo" @/ exact "bar" @/ ... @/ r

  • since 0.11 *
val pp : Stdlib.Format.formatter -> (_, _) t -> unit

Print the route.

  • since 0.7
val to_string : (_, _) t -> string

Print the route.

  • since 0.7
diff --git a/tiny_httpd/Tiny_httpd_server/index.html b/tiny_httpd/Tiny_httpd_server/index.html new file mode 100644 index 00000000..f10c2a9b --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/index.html @@ -0,0 +1,54 @@ + +Tiny_httpd_server (tiny_httpd.Tiny_httpd_server)

Module Tiny_httpd_server

HTTP server.

This module implements a very simple, basic HTTP/1.1 server using blocking IOs and threads.

It is possible to use a thread pool, see create's argument new_thread.

  • since 0.13
type buf = Tiny_httpd_buf.t
type byte_stream = Tiny_httpd_stream.t

HTTP Methods

module Meth : sig ... end

Headers

Headers are metadata associated with a request or response.

module Headers : sig ... end

Requests

Requests are sent by a client, e.g. a web browser or cURL. From the point of view of the server, they're inputs.

module Request : sig ... end

Response Codes

module Response_code : sig ... end

Responses

Responses are what a http server, such as Tiny_httpd, send back to the client to answer a Request.t

module Response : sig ... end

Routing

Basic type-safe routing of handlers based on URL paths. This is optional, it is possible to only define the root handler with something like Routes.

  • since 0.6
module Route : sig ... end

Middlewares

A middleware can be inserted in a handler to modify or observe its behavior.

  • since 0.11
module Middleware : sig ... end

Main Server type

type t

A HTTP server. See create for more details.

val create : + ?masksigpipe:bool -> + ?max_connections:int -> + ?timeout:float -> + ?buf_size:int -> + ?get_time_s:(unit -> float) -> + ?new_thread:((unit -> unit) -> unit) -> + ?addr:string -> + ?port:int -> + ?sock:Unix.file_descr -> + ?middlewares:([ `Encoding | `Stage of int ] * Middleware.t) list -> + unit -> + t

Create a new webserver using UNIX abstractions.

The server will not do anything until run is called on it. Before starting the server, one can use add_path_handler and set_top_handler to specify how to handle incoming requests.

  • parameter masksigpipe

    if true, block the signal Sys.sigpipe which otherwise tends to kill client threads when they try to write on broken sockets. Default: true.

  • parameter buf_size

    size for buffers (since 0.11)

  • parameter new_thread

    a function used to spawn a new thread to handle a new client connection. By default it is Thread.create but one could use a thread pool instead. See for example this use of moonpool.

  • parameter max_connections

    maximum number of simultaneous connections.

  • parameter timeout

    connection is closed if the socket does not do read or write for the amount of second. Default: 0.0 which means no timeout. timeout is not recommended when using proxy.

  • parameter addr

    address (IPv4 or IPv6) to listen on. Default "127.0.0.1".

  • parameter port

    to listen on. Default 8080.

  • parameter sock

    an existing socket given to the server to listen on, e.g. by systemd on Linux (or launchd on macOS). If passed in, this socket will be used instead of the addr and port. If not passed in, those will be used. This parameter exists since 0.10.

  • parameter get_time_s

    obtain the current timestamp in seconds. This parameter exists since 0.11.

module type IO_BACKEND = sig ... end

A backend that provides IO operations, network operations, etc.

val create_from : + ?buf_size:int -> + ?middlewares:([ `Encoding | `Stage of int ] * Middleware.t) list -> + backend:(module IO_BACKEND) -> + unit -> + t

Create a new webserver using provided backend.

The server will not do anything until run is called on it. Before starting the server, one can use add_path_handler and set_top_handler to specify how to handle incoming requests.

  • parameter buf_size

    size for buffers (since 0.11)

  • since 0.14
val addr : t -> string

Address on which the server listens.

val is_ipv6 : t -> bool

is_ipv6 server returns true iff the address of the server is an IPv6 address.

  • since 0.3
val port : t -> int

Port on which the server listens. Note that this might be different than the port initially given if the port was 0 (meaning that the OS picks a port for us).

val active_connections : t -> int

Number of currently active connections.

val add_decode_request_cb : + t -> + (unit Request.t -> (unit Request.t * (byte_stream -> byte_stream)) option) -> + unit

Add a callback for every request. The callback can provide a stream transformer and a new request (with modified headers, typically). A possible use is to handle decompression by looking for a Transfer-Encoding header and returning a stream transformer that decompresses on the fly.

val add_encode_response_cb : + t -> + (unit Request.t -> Response.t -> Response.t option) -> + unit

Add a callback for every request/response pair. Similarly to add_encode_response_cb the callback can return a new response, for example to compress it. The callback is given the query with only its headers, as well as the current response.

val add_middleware : + stage:[ `Encoding | `Stage of int ] -> + t -> + Middleware.t -> + unit

Add a middleware to every request/response pair.

  • parameter stage

    specify when middleware applies. Encoding comes first (outermost layer), then stages in increasing order.

  • raises Invalid_argument

    if stage is `Stage n where n < 1

  • since 0.11

Request handlers

val set_top_handler : t -> (byte_stream Request.t -> Response.t) -> unit

Setup a handler called by default.

This handler is called with any request not accepted by any handler installed via add_path_handler. If no top handler is installed, unhandled paths will return a 404 not found

This used to take a string Request.t but it now takes a byte_stream Request.t since 0.14 . Use Request.read_body_full to read the body into a string if needed.

val add_route_handler : + ?accept:(unit Request.t -> (unit, Response_code.t * string) result) -> + ?middlewares:Middleware.t list -> + ?meth:Meth.t -> + t -> + ('a, string Request.t -> Response.t) Route.t -> + 'a -> + unit

add_route_handler server Route.(exact "path" @/ string @/ int @/ return) f calls f "foo" 42 request when a request with path "path/foo/42/" is received.

Note that the handlers are called in the reverse order of their addition, so the last registered handler can override previously registered ones.

  • parameter meth

    if provided, only accept requests with the given method. Typically one could react to `GET or `PUT.

  • parameter accept

    should return Ok() if the given request (before its body is read) should be accepted, Error (code,message) if it's to be rejected (e.g. because its content is too big, or for some permission error). See the http_of_dir program for an example of how to use accept to filter uploads that are too large before the upload even starts. The default always returns Ok(), i.e. it accepts all requests.

  • since 0.6
val add_route_handler_stream : + ?accept:(unit Request.t -> (unit, Response_code.t * string) result) -> + ?middlewares:Middleware.t list -> + ?meth:Meth.t -> + t -> + ('a, byte_stream Request.t -> Response.t) Route.t -> + 'a -> + unit

Similar to add_route_handler, but where the body of the request is a stream of bytes that has not been read yet. This is useful when one wants to stream the body directly into a parser, json decoder (such as Jsonm) or into a file.

  • since 0.6

Server-sent events

EXPERIMENTAL: this API is not stable yet.

module type SERVER_SENT_GENERATOR = sig ... end

A server-side function to generate of Server-sent events.

type server_sent_generator = (module SERVER_SENT_GENERATOR)

Server-sent event generator. This generates events that are forwarded to the client (e.g. the browser).

  • since 0.9
val add_route_server_sent_handler : + ?accept:(unit Request.t -> (unit, Response_code.t * string) result) -> + t -> + ('a, string Request.t -> server_sent_generator -> unit) Route.t -> + 'a -> + unit

Add a handler on an endpoint, that serves server-sent events.

The callback is given a generator that can be used to send events as it pleases. The connection is always closed by the client, and the accepted method is always GET. This will set the header "content-type" to "text/event-stream" automatically and reply with a 200 immediately. See server_sent_generator for more details.

This handler stays on the original thread (it is synchronous).

  • since 0.9

Upgrade handlers

These handlers upgrade the connection to another protocol.

  • since NEXT_RELEASE
module type UPGRADE_HANDLER = sig ... end

Handler that upgrades to another protocol.

type upgrade_handler = (module UPGRADE_HANDLER)
  • since NEXT_RELEASE
val add_upgrade_handler : + ?accept:(unit Request.t -> (unit, Response_code.t * string) result) -> + ?middlewares:Middleware.t list -> + t -> + ('a, upgrade_handler) Route.t -> + 'a -> + unit

Run the server

val running : t -> bool

Is the server running?

  • since 0.14
val stop : t -> unit

Ask the server to stop. This might not have an immediate effect as run might currently be waiting on IO.

val run : ?after_init:(unit -> unit) -> t -> (unit, exn) result

Run the main loop of the server, listening on a socket described at the server's creation time, using new_thread to start a thread for each new client.

This returns Ok () if the server exits gracefully, or Error e if it exits with an error.

  • parameter after_init

    is called after the server starts listening. since 0.13 .

val run_exn : ?after_init:(unit -> unit) -> t -> unit

run_exn s is like run s but re-raises an exception if the server exits with an error.

  • since 0.14
diff --git a/tiny_httpd/Tiny_httpd_server/module-type-IO_BACKEND/index.html b/tiny_httpd/Tiny_httpd_server/module-type-IO_BACKEND/index.html new file mode 100644 index 00000000..a93bf59c --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/module-type-IO_BACKEND/index.html @@ -0,0 +1,2 @@ + +IO_BACKEND (tiny_httpd.Tiny_httpd_server.IO_BACKEND)

Module type Tiny_httpd_server.IO_BACKEND

A backend that provides IO operations, network operations, etc.

This is used to decouple tiny_httpd from the scheduler/IO library used to actually open a TCP server and talk to clients. The classic way is based on Unix and blocking IOs, but it's also possible to use an OCaml 5 library using effects and non blocking IOs.

val init_addr : unit -> string

Initial TCP address

val init_port : unit -> int

Initial port

val get_time_s : unit -> float

Obtain the current timestamp in seconds.

val tcp_server : unit -> Tiny_httpd_io.TCP_server.builder

TCP server builder, to create servers that can listen on a port and handle clients.

diff --git a/tiny_httpd/Tiny_httpd_server/module-type-SERVER_SENT_GENERATOR/index.html b/tiny_httpd/Tiny_httpd_server/module-type-SERVER_SENT_GENERATOR/index.html new file mode 100644 index 00000000..41f4e20b --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/module-type-SERVER_SENT_GENERATOR/index.html @@ -0,0 +1,8 @@ + +SERVER_SENT_GENERATOR (tiny_httpd.Tiny_httpd_server.SERVER_SENT_GENERATOR)

Module type Tiny_httpd_server.SERVER_SENT_GENERATOR

A server-side function to generate of Server-sent events.

See the w3c page and this blog post.

  • since 0.9
val set_headers : Headers.t -> unit

Set headers of the response. This is not mandatory but if used at all, it must be called before any call to send_event (once events are sent the response is already sent too).

val send_event : + ?event:string -> + ?id:string -> + ?retry:string -> + data:string -> + unit -> + unit

Send an event from the server. If data is a multiline string, it will be sent on separate "data:" lines.

val close : unit -> unit

Close connection.

  • since 0.11
diff --git a/tiny_httpd/Tiny_httpd_server/module-type-UPGRADE_HANDLER/index.html b/tiny_httpd/Tiny_httpd_server/module-type-UPGRADE_HANDLER/index.html new file mode 100644 index 00000000..142a1e8f --- /dev/null +++ b/tiny_httpd/Tiny_httpd_server/module-type-UPGRADE_HANDLER/index.html @@ -0,0 +1,7 @@ + +UPGRADE_HANDLER (tiny_httpd.Tiny_httpd_server.UPGRADE_HANDLER)

Module type Tiny_httpd_server.UPGRADE_HANDLER

Handler that upgrades to another protocol.

  • since NEXT_RELEASE
type handshake_state

Some specific state returned after handshake

val name : string

Name in the "upgrade" header

val handshake : unit Request.t -> (Headers.t * handshake_state, string) result

Perform the handshake and upgrade the connection. The returned code is 101 alongside these headers. In case the handshake fails, this only returns Error log_msg. The connection is closed without further ado.

val handle_connection : + Unix.sockaddr -> + handshake_state -> + Tiny_httpd_io.Input.t -> + Tiny_httpd_io.Output.t -> + unit

Take control of the connection and take it from ther.e

diff --git a/tiny_httpd/Tiny_httpd_stream/index.html b/tiny_httpd/Tiny_httpd_stream/index.html new file mode 100644 index 00000000..d935611b --- /dev/null +++ b/tiny_httpd/Tiny_httpd_stream/index.html @@ -0,0 +1,29 @@ + +Tiny_httpd_stream (tiny_httpd.Tiny_httpd_stream)

Module Tiny_httpd_stream

Byte streams.

Streams are used to represent a series of bytes that can arrive progressively. For example, an uploaded file will be sent as a series of chunks.

These used to live in Tiny_httpd but are now in their own module.

  • since 0.12
type hidden

Type used to make t unbuildable via a record literal. Use make instead.

type t = {
  1. mutable bs : bytes;
    (*

    The bytes

    *)
  2. mutable off : int;
    (*

    Beginning of valid slice in bs

    *)
  3. mutable len : int;
    (*

    Length of valid slice in bs. If len = 0 after a call to fill, then the stream is finished.

    *)
  4. fill_buf : unit -> unit;
    (*

    See the current slice of the internal buffer as bytes, i, len, where the slice is bytes[i] .. [bytes[i+len-1]]. Can block to refill the buffer if there is currently no content. If len=0 then there is no more data.

    *)
  5. consume : int -> unit;
    (*

    Consume n bytes from the buffer. This should only be called with n <= len.

    *)
  6. close : unit -> unit;
    (*

    Close the stream.

    *)
  7. _rest : hidden;
    (*

    Use make to build a stream.

    *)
}

A buffered stream, with a view into the current buffer (or refill if empty), and a function to consume n bytes.

The point of this type is that it gives the caller access to its internal buffer (bs, with the slice off,len). This is convenient for things like line reading where one needs to peek ahead.

Some core invariant for this type of stream are:

  • off,len delimits a valid slice in bs (indices: off, off+1, … off+len-1)
  • if fill_buf() was just called, then either len=0 which indicates the end of stream; or len>0 and the slice contains some data.

To actually move forward in the stream, you can call consume n to consume n bytes (where n <= len). If len gets to 0, calling fill_buf() is required, so it can try to obtain a new slice.

To emulate a classic OCaml reader with a read: bytes -> int -> int -> int function, the simplest is:

let read (self:t) buf offset max_len : int =
+  self.fill_buf();
+  let len = min max_len self.len in
+  if len > 0 then (
+    Bytes.blit self.bs self.off buf offset len;
+    self.consume len;
+  );
+  len
val close : t -> unit

Close stream

val empty : t

Stream with 0 bytes inside

val of_input : ?buf_size:int -> Tiny_httpd_io.Input.t -> t

Make a buffered stream from the given channel.

  • since 0.14
val of_chan : ?buf_size:int -> in_channel -> t

Make a buffered stream from the given channel.

val of_chan_close_noerr : ?buf_size:int -> in_channel -> t

Same as of_chan but the close method will never fail.

val of_fd : ?buf_size:int -> Unix.file_descr -> t

Make a buffered stream from the given file descriptor.

val of_fd_close_noerr : ?buf_size:int -> Unix.file_descr -> t

Same as of_fd but the close method will never fail.

val of_bytes : ?i:int -> ?len:int -> bytes -> t

A stream that just returns the slice of bytes starting from i and of length len.

val of_string : string -> t
val iter : (bytes -> int -> int -> unit) -> t -> unit

Iterate on the chunks of the stream

  • since 0.3
val to_chan : out_channel -> t -> unit

Write the stream to the channel.

  • since 0.3
val to_chan' : Tiny_httpd_io.Output.t -> t -> unit

Write to the IO channel.

  • since 0.14
val to_writer : t -> Tiny_httpd_io.Writer.t

Turn this stream into a writer.

  • since 0.14
val make : + ?bs:bytes -> + ?close:(t -> unit) -> + consume:(t -> int -> unit) -> + fill:(t -> unit) -> + unit -> + t

make ~fill () creates a byte stream.

  • parameter fill

    is used to refill the buffer, and is called initially.

  • parameter close

    optional closing.

  • parameter init_size

    size of the buffer.

val with_file : ?buf_size:int -> string -> (t -> 'a) -> 'a

Open a file with given name, and obtain an input stream on its content. When the function returns, the stream (and file) are closed.

val read_line : ?buf:Tiny_httpd_buf.t -> t -> string

Read a line from the stream.

  • parameter buf

    a buffer to (re)use. Its content will be cleared.

val read_all : ?buf:Tiny_httpd_buf.t -> t -> string

Read the whole stream into a string.

  • parameter buf

    a buffer to (re)use. Its content will be cleared.

val limit_size_to : + close_rec:bool -> + max_size:int -> + too_big:(int -> unit) -> + t -> + t
val read_chunked : ?buf:Tiny_httpd_buf.t -> fail:(string -> exn) -> t -> t

Convert a stream into a stream of byte chunks using the chunked encoding. The size of chunks is not specified.

  • parameter buf

    buffer used for intermediate storage.

  • parameter fail

    used to build an exception if reading fails.

val read_exactly : + close_rec:bool -> + size:int -> + too_short:(int -> unit) -> + t -> + t

read_exactly ~size bs returns a new stream that reads exactly size bytes from bs, and then closes.

  • parameter close_rec

    if true, closing the resulting stream also closes bs

  • parameter too_short

    is called if bs closes with still n bytes remaining

val output_chunked : ?buf:Tiny_httpd_buf.t -> out_channel -> t -> unit

Write the stream into the channel, using the chunked encoding.

  • parameter buf

    optional buffer for chunking (since 0.14)

val output_chunked' : + ?buf:Tiny_httpd_buf.t -> + Tiny_httpd_io.Output.t -> + t -> + unit

Write the stream into the channel, using the chunked encoding.

  • since 0.14
diff --git a/tiny_httpd/Tiny_httpd_util/index.html b/tiny_httpd/Tiny_httpd_util/index.html new file mode 100644 index 00000000..20d80fad --- /dev/null +++ b/tiny_httpd/Tiny_httpd_util/index.html @@ -0,0 +1,2 @@ + +Tiny_httpd_util (tiny_httpd.Tiny_httpd_util)

Module Tiny_httpd_util

Some utils for writing web servers

  • since 0.2
val percent_encode : ?skip:(char -> bool) -> string -> string

Encode the string into a valid path following https://tools.ietf.org/html/rfc3986#section-2.1

  • parameter skip

    if provided, allows to preserve some characters, e.g. '/' in a path.

val percent_decode : string -> string option

Inverse operation of percent_encode. Can fail since some strings are not valid percent encodings.

val split_query : string -> string * string

Split a path between the path and the query

  • since 0.5
val split_on_slash : string -> string list

Split a string on '/', remove the trailing '/' if any.

  • since 0.6
val get_non_query_path : string -> string

get the part of the path that is not the query parameters.

  • since 0.5
val get_query : string -> string

Obtain the query part of a path.

  • since 0.4
val parse_query : string -> ((string * string) list, string) result

Parse a query as a list of '&' or ';' separated key=value pairs. The order might not be preserved.

  • since 0.3
val show_sockaddr : Unix.sockaddr -> string

Simple printer for socket addresses.

  • since NEXT_RELEASE
diff --git a/tiny_httpd/Tiny_httpd_ws/index.html b/tiny_httpd/Tiny_httpd_ws/index.html new file mode 100644 index 00000000..a38e7e84 --- /dev/null +++ b/tiny_httpd/Tiny_httpd_ws/index.html @@ -0,0 +1,9 @@ + +Tiny_httpd_ws (tiny_httpd.Tiny_httpd_ws)

Module Tiny_httpd_ws

module IO = Tiny_httpd_io
type handler = Unix.sockaddr -> IO.Input.t -> IO.Output.t -> unit

Websocket handler

Upgrade a byte stream to the websocket framing protocol.

val add_route_handler : + ?accept:(unit Tiny_httpd_server.Request.t -> (unit, int * string) result) -> + ?accept_ws_protocol:(string -> bool) -> + Tiny_httpd_server.t -> + (Tiny_httpd_server.upgrade_handler, Tiny_httpd_server.upgrade_handler) + Tiny_httpd_server.Route.t -> + handler -> + unit

Add a route handler for a websocket endpoint.

  • parameter accept_ws_protocol

    decides whether this endpoint accepts the websocket protocol sent by the client. Default accepts everything.

diff --git a/tiny_httpd/Tiny_httpd_ws__/index.html b/tiny_httpd/Tiny_httpd_ws__/index.html new file mode 100644 index 00000000..48aab70a --- /dev/null +++ b/tiny_httpd/Tiny_httpd_ws__/index.html @@ -0,0 +1,2 @@ + +Tiny_httpd_ws__ (tiny_httpd.Tiny_httpd_ws__)

Module Tiny_httpd_ws__

This module is hidden.

diff --git a/tiny_httpd/_doc-dir/CHANGES.md b/tiny_httpd/_doc-dir/CHANGES.md new file mode 100644 index 00000000..bde9a5ab --- /dev/null +++ b/tiny_httpd/_doc-dir/CHANGES.md @@ -0,0 +1,157 @@ + +## 0.16 + +- feat: add `Request.client_addr` accessor +- feat: add `tiny_httpd.prometheus`, a simple sub-library + to expose [prometheus](https://prometheus.io) metrics over HTTP. +- feat: add optional dependency on `logs` + +## 0.15 + +- fix: do not block in `accept`, enabling more graceful shutdown +- improve help message for tiny-httpd-vfs-pack +- security: zero out buffers from pool before reusing them + +## 0.14 + +- breaking: `set_top_handler` takes a stream request, for more generality + +- Don't let client handling threads handle SIGINT/SIGHUP +- improve termination behavior (wait for threads to terminate when shutting down server) +- Preserve client address down to Request.t +- add `Tiny_httpd_io` module, abstraction over IOs (output/input) as better IO channels + than the stdlib's +- add `Tiny_httpd_html.to_writer` +- add `IO.Writer.t`, a push based stream. +- add `Server.run_exn` +- add `Tiny_httpd_pool` +- server: add `IO_BACKEND` abstraction; implement a unix version of it + +- perf: use TCP_NODELAY for client sockets +- perf: use a resource pool to recycle buffers, improves memory consumption and GC pressure + +## 0.13 + +- feat: `Server.run` takes `?after_init` parameter +- remove dep on ounit2 and qtest +- expose `Response.make_void` +- Add OPTIONS method +- use ocamlformat on the code + +- fix: SSE requires no body +- fix: get addr/port from the current socket +- fix: missing closing crlf in chunked streams +- fix: module Html was not exposed +- fix: close stream after Response.output +- fix(tiny-httpd-vfs-pack): allow redirections when fetching resources + +## 0.12 + +- add dep on `seq` +- add a `Html` module with combinators to produce html +- add `Tiny_httpd_dir.VFS` to emulate file systems +- add a small program, `tiny-httpd-vfs-pack`, to pack directories and files + (local or behind a URL) into a OCaml module using `VFS` +- show small example of socket activation + +## 0.11 + +- breaking: remove deprecated path handlers based on scanf +- breaking: more getter/setters for request/response, change signatures, + make request/response private aliases + +- fix: release semaphore in case of exception in accept + +- feat: add a notion of Middleware +- feat: add `?middlewares` param to `create` +- feat: add `?get_time_s` param to `create` +- feat: close connection if response's headers contains connection +- feat: store `start_time` in request +- feat: implement connection timeout using socket options + Default is `max_keep_alive = -1.0` which preserves the original behaviour. +- feat: in server-sent-events, add a `close()` function + +- refactor(zip): compression is now a middleware +- perf: pass `buf_size` in many places, set default `buf_size` to 16kb +- example: update `echo` to provide a /stats/ endpoint using a middleware + +## 0.10 + +- feat: allow socket activation by passing a raw unix socket to `create` +- fix: `Unix.accept` may raise an exception + (typicall Unix.EINTR, even with sigpipe blocked ?), + prevent the server from stopping + +## 0.9 + +- support handlers that stream server-sent events to client + +## 0.8 + +- bump to ocaml 4.04 +- Validate header key's character set (#15) +- perf: simpler parsing of headers + +- fix: workaround for css/js in `http_of_dir` (#16) +- fix(urlencode): encode non ascii chars + +## 0.7 + +- feat: add `rest_of_path_urlencoded` and rename `rest` to `rest_of_path` +- feat: `http_of_dir`: redirect to index.html if present +- fix: `http_of_dir`: do not url-encode '/' in paths +- feat: add `Route.rest` to match the rest of the path +- feat: printing routes + +## 0.6 + +- feat: add `Route.t` construct, deprecate scanf, add more structured path +- feat: use chunked encoding for large string responses, in addition to streams +- refactor(echo): simplify code, use gzip aggressively +- accept http1.0 + +- fix: do not output a `content-length` for a chunked response +- fix: set `transfer-encoding` header when returning a chunked stream +- fix(zip): handle case where camlzip consumes 0 bytes +- feat(zip): also compress string responses if they're big +- add more debug msg + +## 0.5 + +- new `tiny_httpd_camlzip` library for handling `deflate` compression +- feat: expose `Headers.empty` +- fix: use the non-query path for routing +- feat(util): add some query related utils + +## 0.4 + +- easy accessor to the query parameters in path +- fix: header field names are case insensitive +- doc: add note on jemalloc in the readme +- log error when closing client socket + +## 0.3 + +- feat(http_of_dir): use `file` to guess mime type of file +- feat: allow handlers to take streams +- feat(bin): disable uploading by default +- feat: add `Tiny_httpd_util.parse_query` for query decoding +- feat(bin): set charset to utf8 +- feat: autodetect ipv6 address +- feat: support ipv6 address + +- fix: missing crlf between chunks +- fix: read_all must return rather than blocking when done +- fix: proper amortized O(1) push in Buf.push +- fix: `%X` for percent_encode; use `percent_decode` in `parse_query` + +## 0.2 + +- feat(bin): count number of hidden files +- feat(bin): use `details` for hiding hidden files by default +- fix: improved percent encoding of paths +- feat: add percent encoding/decoding +- feat(bin): better human-size display +- feat: in http_of_dir, sort entries and display their size +- fix(http_of_dir): handle bad symlinks +- improve docs and opam, tidy up for 0.1 diff --git a/tiny_httpd/_doc-dir/README.md b/tiny_httpd/_doc-dir/README.md new file mode 100644 index 00000000..0dbc50ff --- /dev/null +++ b/tiny_httpd/_doc-dir/README.md @@ -0,0 +1,194 @@ +# Tiny_httpd [![build](https://github.com/c-cube/tiny_httpd/workflows/build/badge.svg)](https://github.com/c-cube/tiny_httpd/actions) + +Minimal HTTP server using good old threads, with stream abstractions, +simple routing, URL encoding/decoding, static asset serving, +and optional compression with camlzip. +It also supports [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) +([w3c](https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation)) + +Free from all forms of `ppx`, async monads, etc. 🙃 + +**Note**: it can be useful to add the `jemalloc` opam package for long running +server, as it does a good job at controlling memory usage. + +The basic echo server from `src/examples/echo.ml`: + +```ocaml + +module S = Tiny_httpd + +let () = + let server = S.create () in + (* say hello *) + S.add_route_handler ~meth:`GET server + S.Route.(exact "hello" @/ string @/ return) + (fun name _req -> S.Response.make_string (Ok ("hello " ^name ^"!\n"))); + (* echo request *) + S.add_route_handler server + S.Route.(exact "echo" @/ return) + (fun req -> S.Response.make_string (Ok (Format.asprintf "echo:@ %a@." S.Request.pp req))); + Printf.printf "listening on http://%s:%d\n%!" (S.addr server) (S.port server); + match S.run server with + | Ok () -> () + | Error e -> raise e +``` + +```sh +$ dune exec src/examples/echo.exe & +listening on http://127.0.0.1:8080 + +# the path "hello/name" greets you. +$ curl -X GET http://localhost:8080/hello/quadrarotaphile +hello quadrarotaphile! + +# the path "echo" just prints the request. +$ curl -X GET http://localhost:8080/echo --data "howdy y'all" +echo: +{meth=GET; + headers=Host: localhost:8080 + User-Agent: curl/7.66.0 + Accept: */* + Content-Length: 10 + Content-Type: application/x-www-form-urlencoded; + path="/echo"; body="howdy y'all"} + +``` + +## `http_of_dir` + +Similar to `python -m http.server`, a simple program `http_of_dir` is provided. +It serves files from the current directory. + +```sh +$ http_of_dir . -p 8080 & +$ curl -X GET http://localhost:8080 +... + +... + +``` + +## Static assets and files + +The program `http_of_dir` relies on the module `Tiny_httpd_dir`, which +can serve directories, as well as _virtual file systems_. + +In 'examples/dune', we produce an OCaml module `vfs.ml` using +the program `tiny-httpd-vfs-pack`. This module contains a VFS (virtual file +system) which can be served as if it were an actual directory. + +The dune rule: + +```lisp +(rule + (targets vfs.ml) + (deps (source_tree files) (:out test_output.txt.expected)) + (enabled_if (= %{system} "linux")) + (action (run ../src/bin/vfs_pack.exe -o %{targets} + --mirror=files/ + --file=test_out.txt,%{out} + --url=example_dot_com,http://example.com))) +``` + +The code to serve the VFS from `vfs.ml` is as follows: + +```ocaml + … + Tiny_httpd_dir.add_vfs server + ~config:(Tiny_httpd_dir.config ~download:true + ~dir_behavior:Tiny_httpd_dir.Index_or_lists ()) + ~vfs:Vfs.vfs ~prefix:"vfs"; + … +``` + +it allows downloading the files, and listing directories. +If a directory contains `index.html` then this will be served +instead of listing the content. + +## Steaming response body + +Tiny_httpd provides multiple ways of returning a body in a response. +The response body type is: + +```ocaml +type body = + [ `String of string + | `Stream of byte_stream + | `Writer of Tiny_httpd_io.Writer.t + | `Void ] +``` + +The simplest way is to return, say, `` `String "hello" ``. The response +will have a set content-length header and its body is just the string. +Some responses don't have a body at all, which is where `` `Void `` is useful. + +The `` `Stream _ `` case is more advanced and really only intended for experts. + +The `` `Writer w `` is new, and is intended as an easy way to write the +body in a streaming fashion. See 'examples/writer.ml' to see a full example. +Typically the idea is to create the body with `Tiny_httpd_io.Writer.make ~write ()` +where `write` will be called with an output channel (the connection to the client), +and can write whatever it wants to this channel. Once the `write` function returns +the body has been fully sent and the next request can be processed. + +## Socket activation + +Since version 0.10, socket activation is supported indirectly, by allowing a +socket to be explicitly passed in to the `create` function: + +```ocaml +module S = Tiny_httpd + +let not_found _ _ = S.Response.fail ~code:404 "Not Found\n" + +let () = + (* Module [Daemon] is from the [ocaml-systemd] package *) + let server = match Daemon.listen_fds () with + (* If no socket passed in, assume server was started explicitly i.e. without + socket activation *) + | [] -> S.create () + + (* If a socket passed in e.g. by systemd, listen on that *) + | sock :: _ -> S.create ~sock () + in + S.add_route_handler server S.Route.rest_of_path not_found; + Printf.printf "Listening on http://%s:%d\n%!" (S.addr server) (S.port server); + match S.run server with + | Ok () -> () + | Error e -> raise e +``` + +On Linux, this requires the +[ocaml-systemd](https://github.com/juergenhoetzel/ocaml-systemd) package: + +``` +opam install ocaml-systemd +``` + +Tip: in the `dune` file, the package name should be `systemd`. + +In case you're not familiar with socket activation, Lennart Poettering's +[blog post](http://0pointer.de/blog/projects/socket-activation.html) explains it +well. + +## Why? + +Why not? If you just want a super basic local server (perhaps for exposing +data from a local demon, like Cups or Syncthing do), no need for a ton of +dependencies or high scalability libraries. + +Use cases might include: + +- serve content directly from a static blog generator; +- provide a web UI to some tool (like CUPS and syncthing do); +- implement a basic monitoring page for a service; +- provide a simple json API for a service, on top of http; +- use `http_of_dir` to serve odoc-generated docs or some assets directory. + +## Documentation + +See https://c-cube.github.io/tiny_httpd + +## License + +MIT. diff --git a/tiny_httpd/index.html b/tiny_httpd/index.html new file mode 100644 index 00000000..d36658c4 --- /dev/null +++ b/tiny_httpd/index.html @@ -0,0 +1,2 @@ + +index (tiny_httpd.index)

Package tiny_httpd

Package info

changes-files
readme-files
diff --git a/tiny_httpd_camlzip/Tiny_httpd_camlzip/index.html b/tiny_httpd_camlzip/Tiny_httpd_camlzip/index.html new file mode 100644 index 00000000..f6d493d2 --- /dev/null +++ b/tiny_httpd_camlzip/Tiny_httpd_camlzip/index.html @@ -0,0 +1,6 @@ + +Tiny_httpd_camlzip (tiny_httpd_camlzip.Tiny_httpd_camlzip)

Module Tiny_httpd_camlzip

Middleware for compression.

This uses camlzip to provide deflate compression/decompression. If installed, the middleware will compress responses' bodies when they are streams or fixed-size above a given limit (but it will not compress small, fixed-size bodies).

val middleware : + ?compress_above:int -> + ?buf_size:int -> + unit -> + Tiny_httpd_server.Middleware.t

Middleware responsible for deflate compression/decompression.

  • parameter compress_above

    threshold, in bytes, above which a response body that has a known content-length is compressed. Stream bodies are always compressed.

  • parameter buf_size

    size of the underlying buffer for compression/decompression

  • since 0.11
val setup : ?compress_above:int -> ?buf_size:int -> Tiny_httpd_server.t -> unit

Install middleware for tiny_httpd to be able to encode/decode compressed streams

  • parameter compress_above

    threshold above with string responses are compressed

  • parameter buf_size

    size of the underlying buffer for compression/decompression

diff --git a/tiny_httpd_camlzip/_doc-dir/CHANGES.md b/tiny_httpd_camlzip/_doc-dir/CHANGES.md new file mode 100644 index 00000000..bde9a5ab --- /dev/null +++ b/tiny_httpd_camlzip/_doc-dir/CHANGES.md @@ -0,0 +1,157 @@ + +## 0.16 + +- feat: add `Request.client_addr` accessor +- feat: add `tiny_httpd.prometheus`, a simple sub-library + to expose [prometheus](https://prometheus.io) metrics over HTTP. +- feat: add optional dependency on `logs` + +## 0.15 + +- fix: do not block in `accept`, enabling more graceful shutdown +- improve help message for tiny-httpd-vfs-pack +- security: zero out buffers from pool before reusing them + +## 0.14 + +- breaking: `set_top_handler` takes a stream request, for more generality + +- Don't let client handling threads handle SIGINT/SIGHUP +- improve termination behavior (wait for threads to terminate when shutting down server) +- Preserve client address down to Request.t +- add `Tiny_httpd_io` module, abstraction over IOs (output/input) as better IO channels + than the stdlib's +- add `Tiny_httpd_html.to_writer` +- add `IO.Writer.t`, a push based stream. +- add `Server.run_exn` +- add `Tiny_httpd_pool` +- server: add `IO_BACKEND` abstraction; implement a unix version of it + +- perf: use TCP_NODELAY for client sockets +- perf: use a resource pool to recycle buffers, improves memory consumption and GC pressure + +## 0.13 + +- feat: `Server.run` takes `?after_init` parameter +- remove dep on ounit2 and qtest +- expose `Response.make_void` +- Add OPTIONS method +- use ocamlformat on the code + +- fix: SSE requires no body +- fix: get addr/port from the current socket +- fix: missing closing crlf in chunked streams +- fix: module Html was not exposed +- fix: close stream after Response.output +- fix(tiny-httpd-vfs-pack): allow redirections when fetching resources + +## 0.12 + +- add dep on `seq` +- add a `Html` module with combinators to produce html +- add `Tiny_httpd_dir.VFS` to emulate file systems +- add a small program, `tiny-httpd-vfs-pack`, to pack directories and files + (local or behind a URL) into a OCaml module using `VFS` +- show small example of socket activation + +## 0.11 + +- breaking: remove deprecated path handlers based on scanf +- breaking: more getter/setters for request/response, change signatures, + make request/response private aliases + +- fix: release semaphore in case of exception in accept + +- feat: add a notion of Middleware +- feat: add `?middlewares` param to `create` +- feat: add `?get_time_s` param to `create` +- feat: close connection if response's headers contains connection +- feat: store `start_time` in request +- feat: implement connection timeout using socket options + Default is `max_keep_alive = -1.0` which preserves the original behaviour. +- feat: in server-sent-events, add a `close()` function + +- refactor(zip): compression is now a middleware +- perf: pass `buf_size` in many places, set default `buf_size` to 16kb +- example: update `echo` to provide a /stats/ endpoint using a middleware + +## 0.10 + +- feat: allow socket activation by passing a raw unix socket to `create` +- fix: `Unix.accept` may raise an exception + (typicall Unix.EINTR, even with sigpipe blocked ?), + prevent the server from stopping + +## 0.9 + +- support handlers that stream server-sent events to client + +## 0.8 + +- bump to ocaml 4.04 +- Validate header key's character set (#15) +- perf: simpler parsing of headers + +- fix: workaround for css/js in `http_of_dir` (#16) +- fix(urlencode): encode non ascii chars + +## 0.7 + +- feat: add `rest_of_path_urlencoded` and rename `rest` to `rest_of_path` +- feat: `http_of_dir`: redirect to index.html if present +- fix: `http_of_dir`: do not url-encode '/' in paths +- feat: add `Route.rest` to match the rest of the path +- feat: printing routes + +## 0.6 + +- feat: add `Route.t` construct, deprecate scanf, add more structured path +- feat: use chunked encoding for large string responses, in addition to streams +- refactor(echo): simplify code, use gzip aggressively +- accept http1.0 + +- fix: do not output a `content-length` for a chunked response +- fix: set `transfer-encoding` header when returning a chunked stream +- fix(zip): handle case where camlzip consumes 0 bytes +- feat(zip): also compress string responses if they're big +- add more debug msg + +## 0.5 + +- new `tiny_httpd_camlzip` library for handling `deflate` compression +- feat: expose `Headers.empty` +- fix: use the non-query path for routing +- feat(util): add some query related utils + +## 0.4 + +- easy accessor to the query parameters in path +- fix: header field names are case insensitive +- doc: add note on jemalloc in the readme +- log error when closing client socket + +## 0.3 + +- feat(http_of_dir): use `file` to guess mime type of file +- feat: allow handlers to take streams +- feat(bin): disable uploading by default +- feat: add `Tiny_httpd_util.parse_query` for query decoding +- feat(bin): set charset to utf8 +- feat: autodetect ipv6 address +- feat: support ipv6 address + +- fix: missing crlf between chunks +- fix: read_all must return rather than blocking when done +- fix: proper amortized O(1) push in Buf.push +- fix: `%X` for percent_encode; use `percent_decode` in `parse_query` + +## 0.2 + +- feat(bin): count number of hidden files +- feat(bin): use `details` for hiding hidden files by default +- fix: improved percent encoding of paths +- feat: add percent encoding/decoding +- feat(bin): better human-size display +- feat: in http_of_dir, sort entries and display their size +- fix(http_of_dir): handle bad symlinks +- improve docs and opam, tidy up for 0.1 diff --git a/tiny_httpd_camlzip/_doc-dir/README.md b/tiny_httpd_camlzip/_doc-dir/README.md new file mode 100644 index 00000000..0dbc50ff --- /dev/null +++ b/tiny_httpd_camlzip/_doc-dir/README.md @@ -0,0 +1,194 @@ +# Tiny_httpd [![build](https://github.com/c-cube/tiny_httpd/workflows/build/badge.svg)](https://github.com/c-cube/tiny_httpd/actions) + +Minimal HTTP server using good old threads, with stream abstractions, +simple routing, URL encoding/decoding, static asset serving, +and optional compression with camlzip. +It also supports [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) +([w3c](https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation)) + +Free from all forms of `ppx`, async monads, etc. 🙃 + +**Note**: it can be useful to add the `jemalloc` opam package for long running +server, as it does a good job at controlling memory usage. + +The basic echo server from `src/examples/echo.ml`: + +```ocaml + +module S = Tiny_httpd + +let () = + let server = S.create () in + (* say hello *) + S.add_route_handler ~meth:`GET server + S.Route.(exact "hello" @/ string @/ return) + (fun name _req -> S.Response.make_string (Ok ("hello " ^name ^"!\n"))); + (* echo request *) + S.add_route_handler server + S.Route.(exact "echo" @/ return) + (fun req -> S.Response.make_string (Ok (Format.asprintf "echo:@ %a@." S.Request.pp req))); + Printf.printf "listening on http://%s:%d\n%!" (S.addr server) (S.port server); + match S.run server with + | Ok () -> () + | Error e -> raise e +``` + +```sh +$ dune exec src/examples/echo.exe & +listening on http://127.0.0.1:8080 + +# the path "hello/name" greets you. +$ curl -X GET http://localhost:8080/hello/quadrarotaphile +hello quadrarotaphile! + +# the path "echo" just prints the request. +$ curl -X GET http://localhost:8080/echo --data "howdy y'all" +echo: +{meth=GET; + headers=Host: localhost:8080 + User-Agent: curl/7.66.0 + Accept: */* + Content-Length: 10 + Content-Type: application/x-www-form-urlencoded; + path="/echo"; body="howdy y'all"} + +``` + +## `http_of_dir` + +Similar to `python -m http.server`, a simple program `http_of_dir` is provided. +It serves files from the current directory. + +```sh +$ http_of_dir . -p 8080 & +$ curl -X GET http://localhost:8080 +... + +... + +``` + +## Static assets and files + +The program `http_of_dir` relies on the module `Tiny_httpd_dir`, which +can serve directories, as well as _virtual file systems_. + +In 'examples/dune', we produce an OCaml module `vfs.ml` using +the program `tiny-httpd-vfs-pack`. This module contains a VFS (virtual file +system) which can be served as if it were an actual directory. + +The dune rule: + +```lisp +(rule + (targets vfs.ml) + (deps (source_tree files) (:out test_output.txt.expected)) + (enabled_if (= %{system} "linux")) + (action (run ../src/bin/vfs_pack.exe -o %{targets} + --mirror=files/ + --file=test_out.txt,%{out} + --url=example_dot_com,http://example.com))) +``` + +The code to serve the VFS from `vfs.ml` is as follows: + +```ocaml + … + Tiny_httpd_dir.add_vfs server + ~config:(Tiny_httpd_dir.config ~download:true + ~dir_behavior:Tiny_httpd_dir.Index_or_lists ()) + ~vfs:Vfs.vfs ~prefix:"vfs"; + … +``` + +it allows downloading the files, and listing directories. +If a directory contains `index.html` then this will be served +instead of listing the content. + +## Steaming response body + +Tiny_httpd provides multiple ways of returning a body in a response. +The response body type is: + +```ocaml +type body = + [ `String of string + | `Stream of byte_stream + | `Writer of Tiny_httpd_io.Writer.t + | `Void ] +``` + +The simplest way is to return, say, `` `String "hello" ``. The response +will have a set content-length header and its body is just the string. +Some responses don't have a body at all, which is where `` `Void `` is useful. + +The `` `Stream _ `` case is more advanced and really only intended for experts. + +The `` `Writer w `` is new, and is intended as an easy way to write the +body in a streaming fashion. See 'examples/writer.ml' to see a full example. +Typically the idea is to create the body with `Tiny_httpd_io.Writer.make ~write ()` +where `write` will be called with an output channel (the connection to the client), +and can write whatever it wants to this channel. Once the `write` function returns +the body has been fully sent and the next request can be processed. + +## Socket activation + +Since version 0.10, socket activation is supported indirectly, by allowing a +socket to be explicitly passed in to the `create` function: + +```ocaml +module S = Tiny_httpd + +let not_found _ _ = S.Response.fail ~code:404 "Not Found\n" + +let () = + (* Module [Daemon] is from the [ocaml-systemd] package *) + let server = match Daemon.listen_fds () with + (* If no socket passed in, assume server was started explicitly i.e. without + socket activation *) + | [] -> S.create () + + (* If a socket passed in e.g. by systemd, listen on that *) + | sock :: _ -> S.create ~sock () + in + S.add_route_handler server S.Route.rest_of_path not_found; + Printf.printf "Listening on http://%s:%d\n%!" (S.addr server) (S.port server); + match S.run server with + | Ok () -> () + | Error e -> raise e +``` + +On Linux, this requires the +[ocaml-systemd](https://github.com/juergenhoetzel/ocaml-systemd) package: + +``` +opam install ocaml-systemd +``` + +Tip: in the `dune` file, the package name should be `systemd`. + +In case you're not familiar with socket activation, Lennart Poettering's +[blog post](http://0pointer.de/blog/projects/socket-activation.html) explains it +well. + +## Why? + +Why not? If you just want a super basic local server (perhaps for exposing +data from a local demon, like Cups or Syncthing do), no need for a ton of +dependencies or high scalability libraries. + +Use cases might include: + +- serve content directly from a static blog generator; +- provide a web UI to some tool (like CUPS and syncthing do); +- implement a basic monitoring page for a service; +- provide a simple json API for a service, on top of http; +- use `http_of_dir` to serve odoc-generated docs or some assets directory. + +## Documentation + +See https://c-cube.github.io/tiny_httpd + +## License + +MIT. diff --git a/tiny_httpd_camlzip/index.html b/tiny_httpd_camlzip/index.html new file mode 100644 index 00000000..d5a0e3af --- /dev/null +++ b/tiny_httpd_camlzip/index.html @@ -0,0 +1,2 @@ + +index (tiny_httpd_camlzip.index)

Package tiny_httpd_camlzip

Package info

changes-files
readme-files