Using the Slice Compilers
Ice provides a separate Slice compiler for each language mapping, as shown below:
Language | Compiler |
---|---|
C++ | |
C# | |
Java | |
JavaScript | |
MATLAB | slice2matlab |
Objective-C | |
PHP | |
Python | |
Ruby |
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
.
Each compiler always predefines the__<compiler name in upper case>__
macro when compiling Slice file. For example, slice2cpp predefines__SLICE2CPP__
.
-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
, which must already exist.
-d, --debug
Print debug information showing the operation of the Slice parser.
--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