Skip to content

Commit

Permalink
Premier jet des pages de man
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@391 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
xavierleroy committed Nov 2, 1995
1 parent fb8ca52 commit bf27eef
Show file tree
Hide file tree
Showing 9 changed files with 934 additions and 0 deletions.
233 changes: 233 additions & 0 deletions man/cslc.m
@@ -0,0 +1,233 @@
.TH CSLC 1

.SH NAME
cslc \- The Caml Special Light bytecode compiler


.SH SYNOPSIS
.B cslc
[
.B \-aciv
]
[
.BI \-cclib \ libname
]
[
.BI \-ccopt \ option
]
[
.B \-custom
]
[
.B \-unsafe
]
[
.BI \-o \ exec-file
]
[
.BI \-I \ lib-dir
]
.I filename ...

.SH DESCRIPTION

The Caml Special Light bytecode compiler
.BR cslc (1)
compiles Caml source files to bytecode object files and link
these object files to produce standalone bytecode executable files.
These executable files are then run by the bytecode interpreter
.BR cslrun (1).

The
.BR cslc (1)
command has a command-line interface similar to the one of
most C compilers. It accepts several types of arguments:

Arguments ending in .mli are taken to be source files for
compilation unit interfaces. Interfaces specify the names exported by
compilation units: they declare value names with their types, define
public data types, declare abstract data types, and so on. From the
file
.IR x \&.mli,
the
.BR cslc (1)
compiler produces a compiled interface
in the file
.IR x \&.cmi.

Arguments ending in .ml are taken to be source files for compilation
unit implementations. Implementations provide definitions for the
names exported by the unit, and also contain expressions to be
evaluated for their side-effects. From the file
.IR x \&.ml,
the
.BR cslc (1)
compiler produces compiled object bytecode in the file
.IR x \&.cmo.

If the interface file
.IR x \&.mli
exists, the implementation
.IR x \&.ml
is checked against the corresponding compiled interface
.IR x \&.cmi,
which is assumed to exist. If no interface
.IR x \&.mli
is provided, the compilation of
.IR x \&.ml
produces a compiled interface file
.IR x \&.cmi
in addition to the compiled object code file
.IR x \&.cmo.
The file
.IR x \&.cmi
produced
corresponds to an interface that exports everything that is defined in
the implementation
.IR x \&.ml.

Arguments ending in .cmo are taken to be compiled object bytecode. These
files are linked together, along with the object files obtained
by compiling .ml arguments (if any), and the Caml Light standard
library, to produce a standalone executable program. The order in
which .cmo and.ml arguments are presented on the command line is
relevant: compilation units are initialized in that order at
run-time, and it is a link-time error to use a component of a unit
before having initialized it. Hence, a given
.IR x \&.cmo
file must come before all .cmo files that refer to the unit
.IR x .

Arguments ending in .cma are taken to be libraries of object bytecode.
A library of object bytecode packs in a single file a set of object
bytecode files (.cmo files). Libraries are built with
.B cslc \-a
(see the description of the
.B \-a
option below). The object files
contained in the library are linked as regular .cmo files (see above), in the order specified when the .cma file was built. The only difference is that if an object file
contained in a library is not referenced anywhere in the program, then
it is not linked in.

Arguments ending in .c are passed to the C compiler, which generates a .o object file. This object file is linked with the program if the
.B \-custom
flag is set (see the description of
.B \-custom
below).

Arguments ending in .o or.a are assumed to be C object files and
libraries. They are passed to the C linker when linking in
.B \-custom
mode (see the description of
.B \-custom
below).

.SH OPTIONS

The following command-line options are recognized by
.BR cslc (1).

.TP
.B \-a
Build a library (.cma file) with the object files (.cmo files) given on the command line, instead of linking them into an executable
file. The name of the library can be set with the
.B \-o
option. The default name is
.BR library.cma .

.TP
.B \-c
Compile only. Suppress the linking phase of the
compilation. Source code files are turned into compiled files, but no
executable file is produced. This option is useful to
compile modules separately.

.TP
.BI \-cclib\ -l libname
Pass the
.BI \-l libname
option to the C linker when linking in
``custom runtime'' mode (see the
.B \-custom
option). This causes the
given C library to be linked with the program.

.TP
.B \-ccopt
Pass the given option to the C compiler and linker, when linking in
``custom runtime'' mode (see the
.B \-custom
option). For instance,
.B -ccopt -L
.I dir
causes the C linker to search for C libraries in
directory
.IR dir .

.TP
.B \-custom
Link in ``custom runtime'' mode. In the default linking mode, the
linker produces bytecode that is intended to be executed with the
shared runtime system,
.BR cslrun (1).
In the custom runtime mode, the
linker produces an output file that contains both the runtime system
and the bytecode for the program. The resulting file is larger, but it
can be executed directly, even if the
.BR cslrun (1)
command is not
installed. Moreover, the ``custom runtime'' mode enables linking Caml
code with user-defined C functions.

.TP
.B \-i
Cause the compiler to print all defined names (with their inferred
types or their definitions) when compiling an implementation (.ml
file). This can be useful to check the types inferred by the
compiler. Also, since the output follows the syntax of interfaces, it
can help in writing an explicit interface (.mli file) for a file: just
redirect the standard output of the compiler to a .mli file, and edit
that file to remove all declarations of unexported names.

.TP
.BI \-I directory
Add the given directory to the list of directories searched for
compiled interface files (.cmi) and compiled object code files
(.cmo). By default, the current directory is searched first, then the
standard library directory. Directories added with
.B -I
are searched
after the current directory, in the order in which they were given on
the command line, but before the standard library directory.

.TP
.BI \-o \ exec-file
Specify the name of the output file produced by the linker. The
default output name is
.BR a.out ,
in keeping with the Unix tradition. If the
.B \-a
option is given, specify the name of the library produced.

.TP
.B \-v
Print the version number of the compiler.

.TP
.B \-unsafe
Turn bound checking off on array and string accesses (the
.B v.(i)
and
.B s.[i]
constructs). Programs compiled with
.B \-unsafe
are therefore
slightly faster, but unsafe: anything can happen if the program
accesses an array or string outside of its bounds.

.SH SEE ALSO
.BR csltop (1),
.BR cslrun (1).
.br
.I The Caml Special Light user's manual,
chapter "Batch compilation".
88 changes: 88 additions & 0 deletions man/cslcp.m
@@ -0,0 +1,88 @@
.TH CSLCP 1

.SH NAME
cslcp \- The Caml Special Light profiling compiler

.SH SYNOPSIS
.B cslcp
[
.I cslc options
]
[
.BI \-p \ flags
]
.I filename ...

.SH DESCRIPTION
The
.B cslcp
script is a front-end to
.BR cslc (1)
that instruments the source code, adding code to record how many times
functions are called, branches of conditionals are taken, ...
Execution of instrumented code produces an execution profile in the
file cslprof.dump, which can be read using
.BR cslprof (1).

.B cslcp
accepts the same arguments and options as
.BR cslc (1).

.SH OPTIONS

In addition to the
.BR cslc (1)
options,
.B cslcp
accepts the following option controlling the amount of profiling
information:

.TP
.BR \-p \ letters
The letters following
.B -p
indicate which parts of the program should be profiled:

.TP
.B a
all options
.TP
.B f
function calls : a count point is set at the beginning of function bodies
.TP
.B i
if... then... else: count points are set in
both "then" branch and "else" branch
.TP
.B l
while, for loops: a count point is set at the beginning of
the loop body
.TP
.B m
"match" branches: a count point is set at the beginning of the
body of each branch
.TP
.B t
try...with branches: a count point is set at the
beginning of the body of each branch

For instance, compiling with
.B cslcp \-pfilm
profiles function calls, if... then... else..., loops, and pattern
matching.

Calling
.BR cslcp (1)
without the
.B \-p
option defaults to
.B \-p fm
meaning
that only function calls and pattern matching are profiled.

.SH SEE ALSO
.BR cslc (1),
.BR cslprof (1).
.br
.I The Caml Special Light user's manual,
chapter "Profiling".
64 changes: 64 additions & 0 deletions man/csldep.m
@@ -0,0 +1,64 @@
.TH CSLDEP 1

.SH NAME
csldep \- Dependency generator for Caml Special Light

.SH SYNOPSIS
.B csldep
[
.BI \-I \ lib-dir
]
.I filename ...

.SH DESCRIPTION

The
.BR csldep (1)
command scans a set of Caml Special Light source files
(.ml and .mli files) for references to external compilation units,
and outputs dependency lines in a format suitable for the
.BR make (1)
utility. This ensures that make will compile the source files in the
correct order, and recompile those files that need to when a source
file is modified.

The typical usage is:
.P
csldep
.I options
*.mli *.ml > .depend
.P
where .depend is the file that should contain the
dependencies.

Dependencies are generated both for compiling with the bytecode
compiler
.BR cslc (1)
and with the native-code compiler
.BR cslopt (1).

.SH OPTIONS

The following command-line option is recognized by
.BR csldep (1).

.TP
.BI \-I \ directory
Add the given directory to the list of directories searched for
source files. If a source file foo.ml mentions an external
compilation unit Bar, a dependency on that unit's interface
bar.cmi is generated only if the source for bar is found in the
current directory or in one of the directories specified with
.BR -I .
Otherwise, Bar is assumed to be a module form the standard library,
and no dependencies are generated. For programs that span multiple
directories, it is recommended to pass
.BR csldep (1)
the same -I options that are passed to the compiler.

.SH SEE ALSO
.BR cslc (1),
.BR cslopt (1).
.br
.I The Caml Special Light user's manual,
chapter "Dependency generator".

0 comments on commit bf27eef

Please sign in to comment.