Using the Slice Compilers
Ice provides a separate Slice compiler for each language mapping, as shown below:
Language | Compiler | Freeze Compiler |
---|---|---|
C++ | slice2freeze | |
Java | slice2freezej | |
JavaScript | ||
C# | ||
Objective-C | ||
Python | ||
Ruby | ||
PHP |
The Slice compilers.
The compilers share a similar command-line syntax:
<compiler-name> [options] file...
Regardless of which compiler you use, a number of command-line options are common to the compilers for any language mapping. (See the appropriate language mapping chapter for options that are specific to a particular language mapping.) The common command-line options are:
-h, --help
Displays a help message.
-v, --version
Displays the compiler version.
-D
NAME
Defines the preprocessor symbolNAME
.
-D
NAME=DEF
Defines the preprocessor symbolNAME
with the valueDEF
.
-U
NAME
Undefines the preprocessor symbolNAME
.
-I
DIR
Add the directoryDIR
to the search path for#include
directives.
-E
Print the preprocessor output onstdout
.
--output-dir
DIR
Place the generated files into directoryDIR
.
-d, --debug
Print debug information showing the operation of the Slice parser.
--ice
Permit use of the reservedIce
prefix in Slice identifiers. This is useful when building Ice itself, or when compiling a Slice file that includes another Slice file with Ice-prefixed identifiers, such asIce/BuiltinSequences.ice
.
--underscore
Permit use of underscores in Slice identifiers.--depend
Print dependency information to standard output by default, or to the file specified by the--depend-file
option. No code is generated when this option is specified. The output includes the complete list of Slice files that the input Slice files depend on through direct or indirect inclusion; this output may include other files depending on the target programming language. The Ice for C++ build system uses the scriptconfig/makedepend.py
to process and include this output inMakefiles
.--depend-xml
Print dependency information in XML format to standard output by default, or to the file specified by the--depend-file
option. No code is generated when this option is specified. The output consists of the complete list of Slice files that the input Slice files depend on through direct or indirect inclusion, and is identical will all Slice compilers.--depend-file FILE
Directs dependency information to the specified file. The output format depends on whether--depend
or--depend-xml
is also specified.--validate
Checks the provided command-line options for correctness, and does not generate any code.
The Slice compilers permit you to compile more than a single source file, so you can compile several Slice definitions at once, for example:
slice2cpp -I. file1.ice file2.ice file3.ice