summaryrefslogtreecommitdiff
path: root/api_docgen
diff options
context:
space:
mode:
authoroctachron <octa@polychoron.fr>2020-11-19 18:00:43 +0100
committeroctachron <octa@polychoron.fr>2020-12-02 09:41:12 +0100
commit886d27cf16a14550f6bf4997c5828fffa8b4f05d (patch)
tree024a7ab483277032ccf3738e412b17ae6b172007 /api_docgen
parentdec1d1ee79f883928a92f60c422d6cbfc1b120b7 (diff)
downloadocaml-886d27cf16a14550f6bf4997c5828fffa8b4f05d.tar.gz
Move doc to api_docgen and restore installation
Diffstat (limited to 'api_docgen')
-rw-r--r--api_docgen/Compiler_libs.pre.mld6
-rw-r--r--api_docgen/Makefile161
-rw-r--r--api_docgen/Makefile.docfiles59
-rw-r--r--api_docgen/Ocaml_operators.mld100
-rw-r--r--api_docgen/alldoc.tex34
5 files changed, 360 insertions, 0 deletions
diff --git a/api_docgen/Compiler_libs.pre.mld b/api_docgen/Compiler_libs.pre.mld
new file mode 100644
index 0000000000..9c479b7870
--- /dev/null
+++ b/api_docgen/Compiler_libs.pre.mld
@@ -0,0 +1,6 @@
+{1 Warning}
+ This library is part of the internal OCaml compiler API, and is
+not the language standard library.
+ There are no compatibility guarantees between releases, so code written
+against these modules must be willing to depend on specific OCaml compiler
+versions.
diff --git a/api_docgen/Makefile b/api_docgen/Makefile
new file mode 100644
index 0000000000..3ebda76394
--- /dev/null
+++ b/api_docgen/Makefile
@@ -0,0 +1,161 @@
+#**************************************************************************
+#* *
+#* OCaml *
+#* *
+#* Florian Angeletti, projet Cambium, Inria Paris *
+#* *
+#* Copyright 2020 Institut National de Recherche en Informatique et *
+#* en Automatique. *
+#* *
+#* All rights reserved. This file is distributed under the terms of *
+#* the GNU Lesser General Public License version 2.1, with the *
+#* special exception on linking described in the file LICENSE. *
+#* *
+#**************************************************************************
+ROOTDIR = ..
+
+include $(ROOTDIR)/stdlib/StdlibModules
+include $(ROOTDIR)/Makefile.common
+include $(ROOTDIR)/Makefile.best_binaries
+include $(ROOTDIR)/ocamldoc/Makefile.best_ocamldoc
+include Makefile.docfiles
+
+DOC_COMPILERLIBS_DIRS= $(addprefix $(ROOTDIR)/, \
+parsing utils typing bytecomp driver file_formats lambda\
+)
+
+DOC_STDLIB_DIRS = $(addprefix $(ROOTDIR)/, stdlib \
+ otherlibs/str \
+ otherlibs/$(UNIXLIB) otherlibs/dynlink \
+ otherlibs/systhreads\
+)
+
+DOC_STDLIB_INCLUDES=$(addprefix -I , $(DOC_STDLIB_DIRS))
+
+DOC_ALL_INCLUDES = \
+ $(DOC_STDLIB_INCLUDES) \
+ $(addprefix -I ,$(DOC_COMPILERLIBS_DIRS))
+
+ALL_MAN= $(ALL_DOC:%=man/%.3o)
+ALL_LATEX= $(ALL_DOC:%=latex/%.tex)
+
+all: html pdf man
+.PHONY:all
+.SUFFIXES:
+
+.PHONY: setup
+setup:
+ $(MKDIR) build build/libref build/compilerlibref
+ $(MKDIR) html html/libref html/compilerlibref
+ $(MKDIR) man
+ $(MKDIR) latex
+ $(MKDIR) texi
+
+pdf: latex/alldoc.pdf | setup
+latex: | setup
+man: | setup
+html: | setup
+latex/alldoc.pdf: latex/stdlib_input.tex latex/compilerlibs_input.tex
+
+Compiler_libs.mld: Compiler_libs.pre.mld
+ cp $< $@ && echo "{!modules:$(compilerlibref_C)}" >> $@
+
+vpath %.mli $(ROOTDIR)/stdlib $(DOC_COMPILERLIBS_DIRS) $(DOC_STDLIB_DIRS)
+
+man: man/Stdlib.3o
+html: html/libref/Stdlib.html html/compilerlibref/Compiler_libs.html
+latex: latex/Stdlib.tex
+
+LD_PATH := "$(SRC)/otherlibs/unix/:$(SRC)/otherlibs/str/"
+SET_LD_PATH = CAML_LD_LIBRARY_PATH=$(LD_PATH)
+
+
+$(libref:%=build/libref/%.odoc):build/libref/%.odoc:%.mli
+ $(OCAMLDOC_RUN) -nostdlib -hide Stdlib -lib Stdlib \
+ -pp \
+"$(AWK) -v ocamldoc=true -f $(ROOTDIR)/stdlib/expand_module_aliases.awk" \
+ $(DOC_STDLIB_INCLUDES) $< -dump $@
+
+$(compilerlibref:%=build/compilerlibref/%.odoc):\
+build/compilerlibref/%.odoc:%.mli
+ $(OCAMLDOC_RUN) -nostdlib -hide Stdlib -lib Stdlib \
+ $(DOC_ALL_INCLUDES) $< -dump $@
+
+$(compilerlibref_TEXT:%=build/compilerlibref/%.odoc):\
+build/compilerlibref/%.odoc:%.mld
+ $(OCAMLDOC_RUN) $(DOC_ALL_INCLUDES) -text $< -dump $@
+
+$(libref_TEXT:%=build/libref/%.odoc):build/libref/%.odoc:%.mld
+ $(OCAMLDOC_RUN) $(DOC_STDLIB_INCLUDES) -text $< -dump $@
+
+ALL_COMPILED_DOC=$(ALL_DOC:%=build/%.odoc)
+man/Stdlib.3o: $(ALL_COMPILED_DOC)
+ $(MKDIR) man
+ $(OCAMLDOC_RUN) -man -d man -man-mini \
+ -nostdlib -hide Stdlib -lib Stdlib -t "OCaml library" \
+ $(addprefix -load , $(ALL_COMPILED_DOC))
+
+html/libref/Stdlib.html: $(ALL_LIBREF:%=build/%.odoc)
+ $(MKDIR) -p html/libref
+ $(OCAMLDOC_RUN) -html -d html/libref \
+ -charset="utf8" \
+ -nostdlib -hide Stdlib -lib Stdlib -t "OCaml library" \
+ $(addprefix -load , $(ALL_LIBREF:%=build/%.odoc))
+
+html/compilerlibref/Compiler_libs.html: $(ALL_COMPILERLIBREF:%=build/%.odoc)
+ $(MKDIR) -p html/compilerlibref
+ $(OCAMLDOC_RUN) -html -d html/compilerlibref \
+ -nostdlib -hide Stdlib -t "OCaml compiler library" \
+ -charset="utf8" \
+ -intro Compiler_libs.mld \
+ $(addprefix -load , $(ALL_COMPILERLIBREF:%=build/%.odoc))
+
+texi/stdlib.texi: $(ALL_COMPILED_DOC)
+ $(MKDIR) texi
+ $(OCAMLDOC_RUN) -texi -o $@ \
+ -nostdlib -hide Stdlib -lib Stdlib -t "OCaml library" \
+ $(addprefix -load , $(ALL_COMPILED_DOC))
+
+latex/Stdlib.tex: $(ALL_COMPILED_DOC)
+ $(MKDIR) latex
+ $(OCAMLDOC_RUN) -latex -o latex/all.tex \
+ -hide Stdlib -lib Stdlib $(DOC_ALL_INCLUDES) \
+ -sepfiles \
+ -latextitle "1,subsection*" \
+ -latextitle "2,subsubsection*" \
+ -latex-type-prefix "TYP" \
+ -latex-module-prefix "" \
+ -latex-module-type-prefix "" \
+ -latex-value-prefix "" \
+ -nostdlib -hide Stdlib -lib Stdlib -t "OCaml library" \
+ $(addprefix -load , $(ALL_COMPILED_DOC))
+
+latex/alldoc.pdf: latex/Stdlib.tex latex/alldoc.tex
+ cd latex && TEXINPUTS=$${TEXINPUTS}:$(ROOTDIR)/ocamldoc pdflatex alldoc
+ cd latex && TEXINPUTS=$${TEXINPUTS}:$(ROOTDIR)/ocamldoc pdflatex alldoc
+latex/alldoc.tex:alldoc.tex
+ cp $< $@
+
+stdlib_INPUT=$(foreach module,\
+$(filter-out stdlib.mli camlinternal%,$(stdlib_UNPREFIXED)),\
+\\input{$(call capitalize,$(module)).tex}\
+)
+latex/stdlib_input.tex:
+ echo $(stdlib_INPUT)> $@
+
+compilerlibs_INPUT=$(foreach module,\
+$(filter-out camlinternal%,$(compilerlibref)),\
+\\input{$(call capitalize,$(module)).tex})
+latex/compilerlibs_input.tex:
+ echo $(compilerlibs_INPUT)> $@
+
+INSTALL_MANODIR=$(INSTALL_MANDIR)/man3
+.PHONY:install
+install:
+ $(MKDIR) "$(INSTALL_MANODIR)"
+ if test -d man; then \
+ $(INSTALL_DATA) man/* "$(INSTALL_MANODIR)"; \
+ else : ; fi
+
+clean:
+ rm -rf build man html latex texi Compiler_libs.mld
diff --git a/api_docgen/Makefile.docfiles b/api_docgen/Makefile.docfiles
new file mode 100644
index 0000000000..4be71fb909
--- /dev/null
+++ b/api_docgen/Makefile.docfiles
@@ -0,0 +1,59 @@
+#**************************************************************************
+#* *
+#* OCaml *
+#* *
+#* Florian Angeletti, projet Cambium, Inria Paris *
+#* *
+#* Copyright 2020 Institut National de Recherche en Informatique et *
+#* en Automatique. *
+#* *
+#* All rights reserved. This file is distributed under the terms of *
+#* the GNU Lesser General Public License version 2.1, with the *
+#* special exception on linking described in the file LICENSE. *
+#* *
+#**************************************************************************
+
+define capitalize
+$(shell echo $(1) | sed "s/\<./\U&/g")
+endef
+
+
+str_MLIS := str.mli
+unix_MLIS := unix.mli unixLabels.mli
+dynlink_MLIS := dynlink.mli
+thread_MLIS := \
+ thread.mli condition.mli mutex.mli event.mli \
+ threadUnix.mli semaphore.mli
+
+STDLIB=$(filter-out stdlib__pervasives, $(STDLIB_MODULES))
+
+stdlib_UNPREFIXED=$(STDLIB:stdlib__%=%)
+libref= \
+ $(stdlib_UNPREFIXED) \
+ $(str_MLIS:%.mli=%) \
+ $(unix_MLIS:%.mli=%) \
+ $(dynlink_MLIS:%.mli=%) \
+ $(thread_MLIS:%.mli=%)
+libref_EXTRA=stdlib__pervasives
+libref_TEXT=Ocaml_operators
+libref_C=$(call capitalize,$(libref) $(libref_EXTRA))
+
+PARSING_MLIS := $(filter-out camlinternal%, \
+ $(notdir $(wildcard $(ROOTDIR)/parsing/*.mli))\
+)
+UTILS_MLIS := $(notdir $(wildcard $(ROOTDIR)/utils/*.mli))
+DRIVER_MLIS := pparse.mli
+
+compilerlibref_MLIS=\
+ $(PARSING_MLIS) \
+ $(UTILS_MLIS) \
+ $(DRIVER_MLIS)
+compilerlibref=$(compilerlibref_MLIS:%.mli=%)
+compilerlibref_TEXT=Compiler_libs
+compilerlibref_C=$(call capitalize,$(compilerlibref))
+
+ALL_LIBREF= $(libref_TEXT:%=libref/%) $(libref:%=libref/%)
+ALL_COMPILERLIBREF= \
+ $(compilerlibref_TEXT:%=compilerlibref/%) \
+ $(compilerlibref:%=compilerlibref/%)
+ALL_DOC= $(ALL_LIBREF) $(ALL_COMPILERLIBREF)
diff --git a/api_docgen/Ocaml_operators.mld b/api_docgen/Ocaml_operators.mld
new file mode 100644
index 0000000000..5ea79a3ec4
--- /dev/null
+++ b/api_docgen/Ocaml_operators.mld
@@ -0,0 +1,100 @@
+Precedence level and associativity of operators
+
+The following table lists the precedence level of all operator classes
+from the highest to the lowest precedence. A few other syntactic constructions
+are also listed as references.
+
+{%latex:
+%
+% Note: the tables below should be kept in sync with the one in
+% manual/manual/refman/expr.etex .
+%
+\begin{tabular}{cc}
+\hline
+Operator class & Associativity \\
+\hline
+$!\ldots$ $\tilde{}\ldots$ & -- \\
+$.\cdots()$ $.\cdots[]$ $.\cdots$\textbraceleft\textbraceright& -- \\
+\#\ldots & left \\
+function application & left \\
+- -. & -- \\
+$**\ldots$ lsl lsr asr & right \\
+$*\ldots$ /\ldots \%\ldots mod land lor lxor & left \\
++\ldots -\ldots & left \\
+:: & right \\
+@\ldots \textasciicircum\ldots & right \\
+=\ldots <\ldots >\ldots |\ldots \&\ldots \$\ldots != & left \\
+\& \&\& & right \\
+or || & right \\
+, & -- \\
+<- := & right \\
+if & -- \\
+; & right \\
+\hline
+\end{tabular}
+%}
+
+{%html:
+<table align=center border=1>
+<thead><tr><th>Operator class</th><th>Associativity </th></tr></thead>
+<tr><td><code class=code>!&#X2026 ~&#X2026</code> </td><td>&#X2013</td></tr>
+<tr><td><code class=code>.&#X2026() .&#X2026[] .&#X2026{} </code>
+ </td><td>&#X2013</td></tr>
+<tr><td><code class=code>#&#X2026</code> </td><td> left </td></tr>
+<tr><td><code class=code>function application</code> </td><td> left </td></tr>
+<tr><td><code class=code>- -.</code> </td><td>&#X2013</td></tr>
+<tr><td><code class=code>**&#X2026 lsl lsr asr </code></td><td> right </td></tr>
+<tr><td><code class=code>*&#X2026 /&#X2026 %&#X2026 mod land lor lxor</code>
+ </td><td> left </td></tr>
+<tr><td><code class=code>+&#X2026 -&#X2026</code> </td><td> left </td></tr>
+<tr><td><code class=code>::</code> </td><td> right </td></tr>
+<tr><td><code class=code>@&#X2026 ^&#X2026 </td><td> right </td></tr>
+<tr><td><code class=code>=&#X2026 &lt;&#X2026
+>&#X2026 |&#X2026 &amp;&#X2026 $&#X2026 !=</code> </td><td> left </td></tr>
+<tr><td><code class=code>&amp; &amp;&amp;</code> </td><td> right </td></tr>
+<tr><td><code class=code>or || </code> </td><td> right </td></tr>
+<tr><td><code class=code>,</code> </td><td>&#X2013</td></tr>
+<tr><td><code class=code><- :=</code> </td><td> right </td></tr>
+<tr><td><code class=code>if</code> </td><td>&#X2013</td></tr>
+<tr><td><code class=code>;</code> </td><td> right </td></tr>
+</table>
+%}
+
+{%man:
+.IP Associativity
+Operator class
+.IP -
+!.. ~..
+.IP -
+\&.() .[] .{}
+.IP left
+#..
+.IP left
+function application
+.IP -
+- -.
+.IP right
+**.. lsl lsr asr
+.IP left
+*.. /.. %.. mod land lor lxor
+.IP left
++.. -..
+.IP right
+::
+.IP right
+@.. ^..
+.IP left
+=.. <.. >.. |.. &.. $.. !=
+.IP right
+& &&
+.IP right
+or ||
+.IP -
+,
+.IP right
+<- :=
+.IP -
+if
+.IP right
+;
+%}
diff --git a/api_docgen/alldoc.tex b/api_docgen/alldoc.tex
new file mode 100644
index 0000000000..0092b53203
--- /dev/null
+++ b/api_docgen/alldoc.tex
@@ -0,0 +1,34 @@
+\documentclass{book}
+
+\usepackage[colorlinks=true]{hyperref}
+\usepackage{color}
+\usepackage{lmodern}
+\usepackage[T1]{fontenc}
+\usepackage[strings]{underscore}
+
+\usepackage{ocamldoc}
+
+\newcommand{\docitem}[2]{\input{#2}}
+\begin{document}
+\chapter{Stdlib}
+\docitem{libref}{Stdlib.tex}
+\input{stdlib_input}
+\docitem{libref}{OCaml_operators.tex}
+\chapter{Dynlink}
+\docitem{libref}{Dynlink.tex}
+\chapter{Str}
+\docitem{libref}{Str.tex}
+\chapter{Thread}
+\docitem{libref}{Condition.tex}
+\docitem{libref}{Event.tex}
+\docitem{libref}{Mutex.tex}
+\docitem{libref}{Thread.tex}
+\docitem{libref}{ThreadUnix.tex}
+\docitem{libref}{Semaphore.tex}
+\chapter{Unix}
+\docitem{libref}{UnixLabels.tex}
+\docitem{libref}{Unix.tex}
+\chapter{Compilerlibs}
+\docitem{compilerlibref}{Compiler_libs.tex}
+\input{compilerlibs_input.tex}
+\end{document}