Running the SOM Compiler
The syntax of the command for running the SOM Compiler takes the forms:
sc [-options] files
somc[-options] files
The "files" specified in the sc or somc command denote one
or more files containing the IDL class definitions to be compiled. If no
extension is specified, .idl is assumed. By default, the <filestem>
of the .idl file determines the filestem of each emitted file. Otherwise,
a "filestem" modifier can be defined in the .idl file to specify another
name (see "Modifier statements" discussed earlier).
Selected "-options" can be specified individually, as a string of
option characters, or as a combination of both. Any option that takes an
argument either must be specified individually or must appear as the final
option in a string of option characters. Available options and their purposes
are as follows:
- C
n
Sets the maximum allowable
size for a simple comment in the .idl file (default: 32767). This is only
needed for very large single comments.
-D name[=def]
Defines name as in a #define directive.
The default def is 1. This option is the same as the -D option for
the C compiler. Note: This option can be used to define __PRIVATE__ so
that the SOM Compiler will also compile any methods and attributes that
have been defined as private using the directive #ifdef__PRIVATE__;
however, the -p option does the same thing more easily. When a class contains
private methods or attributes, both the implementation bindings and the
usage bindings to be #included in the implementation should be generated
using either the -p or -D_PRIVATE_ option.
-E
variable=value
Sets an environment variable.
(See the previous topic for a discussion of the available environment variables:
SMADDSTAR, SMEMIT, SMINCLUDE, SMTMP, SMKNOWNEXTS, and SOMIR.)
-I
dir
When looking for #included files, looks
first in dir, then in the standard directories (same as the C compiler -I
option).
-S n
Sets
the total allowable amount of unique string space used in the IDL specification
for names and passthru lines (default: 32767). This is only needed for very
large .idl files.
-U name
Removes
any initial definition (via a #define preprocessor directive) of symbol
name.
-V
Displays
version information about the SOM Compiler.
-c
Turns off comment processing. This allows comments
to appear anywhere within an IDL specification (rather than in restricted
places), and it causes comments not to be transferred to the output files
that the SOM Compiler produces.
-d directory
Specifies a directory where all output files
should be placed. If the -d option is not used, all output files are placed
in the same directory as the input file.
-h or -?
Produces a listing of this option list. (This option
is typically used in an sc or somc command that does not include
a .idl file name)
-i filename
Specifies
the name of the class definition file. Use this option to override the built-in
assumption that the input file will have a .idl extension. Any filename
supplied with the -i option is used exactly as it is specified.
-m
name[=value]
Adds a global modifier.
(See the following Note on the -m options, which explains how to
convert any "-m name" modifier to an environment variable.)
Note: All command-line -m modifier options can be specified
in the environment by changing them to UPPERCASE and prepending " SM"
to them. For example, if you want to always set the options "-mnotc" and
"-maddstar", set corresponding environment variables as follows:
- On OS/2:
set SMNOTC=1
set SMADDSTAR=1
- On AIX:
export SMNOTC=1
export SMADDSTAR=1
The currently supported global modifiers for the -m name[=value]
option are as follows:
addprefixes
Adds 'functionprefixes' to the method
procedure prototypes during an incremental update of the implementation
template file. This option applies only when rerunning the c or xc
emitter on an IDL file that previously did not specify a functionprefix.
A class implementor who later decides to use prefixes should add a line
in the 'implementation' section of the .idl file containing the specification:
functionprefix = prefix
(as described earlier in the topic "Modifier statements") and then rerun
the c or xc emitter using the -maddprefixes option. The method procedure
prototypes in the implementation file will then be updated so that each
method name includes the assigned prefix. (This option does not support
changes to existing prefix names, nor does it apply for OIDL files.)
addstar
This option causes all interface references
to have a '*' added to them for the C bindings. See the earlier section
entitled "Object types" for further details.
comment=comment
string
where comment string can be either
of the designations: "/*" or "//". This option indicates that comments
marked in the designated manner in the .idl file are to be completely ignored
by the SOM Compiler and will not be included in the output files.
Note: Comments on lines beginning with "//#" are always ignored by the
SOM Compiler.
corba
This
option directs the SOM Compiler to compile the input definition according
to strict CORBA-defined IDL syntax. This means, for example, that comments
may appear anywhere and that pointers are not allowed. When the -mcorba
option is used, parts of a .idl file surrounded by #ifdef__SOMIDL__
and #endif directives are ignored. This option can be used to
determine whether all nonstandard constructs (those specific to SOM IDL)
are properly protected by #ifdef__SOMIDL__ and #endif directives.
csc
This option
forces the OIDL compiler to be run. This is required only if you want to
compile an OIDL file that does not have an extension of .csc or .sc.
emitappend
This option causes emitted files to be appended
at the end of existing files of the same name.
noaccessors
This option turns off the automatic creation
of OperationDef entries in the Interface Repository for attribute accessors
(that is, for an attribute's _set and _get methods).
noaddstar
This option ensures that interface references
will not have a "*" added to them for the C bindings. This is the default
setting; it is the opposite of the -m compiler option addstar.
noint
This option
directs the SOM Compiler not to warn about the portability problems of using
int's in the source.
nolock
This
option causes the Interface Repository Emitter emitir
(see Chapter 7, "Interface Repository Framework") to leave the IR unlocked
when updates are made to it. This can improve performance on networked file
systems. By not locking the IR, however, there is the risk of multiple processes
attempting to write to the same IR, with unpredictable results. This option
should only be used when you know that only one process is updating an IR
at once.
nopp
This
option directs the SOM Compiler not to run the SOM preprocessor on the .idl
input file.
noqualifytypes
This
option prevents the use od C-scoped names in emitter output, and is used
in conjunction with the .hh emitter.
notc
This
option directs the SOM Compiler not to create TypeCode information when
emitting IDL files that contain some undeclared types. This option is only
used when compiling converted .csc files (that is, OIDL files originally)
that have not had typing information added.
nouseshort
This option directs the SOM Compiler not to
generate short forms for type names in the .h and .xh public header files.
This can be useful to save disk space.
pbl
This
option tells the SOM Compiler that, in declarations containing a linkage
specifier, the "*" will appear before the linkage specifier. This is required
when using any C++ compiler (Watcom is a known example) that cannot handle
declarations in the default format where the "*" follows the linkage specifier.
A default example is the declaration:
typedef void (SOMLINK * somTD_SOMObject_somFree)
(SOMObject *somSelf);
Under the -mpbl option of the SOM Compiler command, the same example
would be declared as:
typedef void (* SOMLINK somTD_SOMObject_somFree)
(SOMObject *somSelf);
pp=preprocessor
This
option directs the SOM Compiler to use the specified preprocessor as the
SOM preprocessor, rather than the default "somcpp". Any standard C/C++ preprocessor
can be used as a preprocessor for IDL specifications.
tcconsts
This option directs the SOM Compiler to generate
TypeCode constants in the h and .xh public header files. Please refer to
the Interface Repository (described in Chapter 7) for more details.
- p
Causes the "private" sections of the
IDL file to be included in the compilation (that is, sections preceded by
#ifdef __PRIVATE__ that contain private methods and attributes). Note: If
-p is used, it must be applied for both the implementation bindings
(.ih or .xih file) and the usage bindings (.h or .xh file) to be #included
in the implementation.
-r
Checks
that all names specified in the release order statement are valid method
names (default: FALSE).
-s string
Substitutes
string in place of the contents of the SMEMIT environment
variable for the duration of the current sc command. This determines
which emitters will be run and, hence, which output files will be produced.
(If a list of values is given, on OS/2 only the list must be enclosed
in double quotes.)
The -s
option is a convenient way to override the SMEMIT environment variable.
In OS/2 for example, the command:
> SC -s"h;c" EXAMPLE
is equivalent to the following sequence of commands:
> SET OLDSMEMIT=%SMEMIT%
> SET SMEMIT=H;C
> SC EXAMPLE
> SET SMEMIT=%OLDSMEMIT%
Similarly, in AIX the command:
> sc -sh";"c example
is equivalent to the following sequence of commands:
> export OLDSMEMIT=$SMEMIT
> export SMEMIT=h";"c
> sc example
> export SMEMIT=$OLDSMEMIT
-u
Updates the Interface
Repository (default: no update). With this option, the Interface Repository
will be updated even if the ir emitter is not explicitly requested
in the SMEMIT environment variable or the -s option.
-v
Uses verbose mode to display informational messages
(default: FALSE). This option is primarily intended for debugging purposes
and for writers of emitters.
-w
Suppresses
warning messages (default: FALSE).
The following sample commands illustrate various options for the sc command
or similarly with somc):
sc -sc hello.idl
Generates file "hello.c".
sc
-hV
Generates a help message and displays the version
of the SOM Compiler currently available.
sc -vsh";"ih
hello.idl
Generates "hello.h" and "hello.ih" with
informational messages.
sc -sxc -doutdir hello.idl
Generates "hello.xc" in directory "outdir".
[Back: Environment variables affecting the SOM Compiler]
[Next: The 'pdl' Facility]