The rsctype utility compiles structure and union declarations (usually stored in a .mt file) and generates a resource source (.r) file containing structure and union definitions. rcomp compiles the source file and generates the resource file. The built-in functions described in this section can use the resource file.
MDL provides the C expression built-in functions to evaluate expressions at run-time. If the expressions contain references to fields contained in structures or unions, the corresponding structures and unions must be defined in a resource file.
A source program to be processed by rsctype uses C syntax for defining structures and unions. However, it cannot contain declarations that allocate space and it cannot contain executable statements.
The format of an rsctype program is typically as follows:
The syntax for a publishStructures statement, shown in the following example, is identical to the syntax for a function call.
Any number of structure and union names can be included in the list of names.
This is the .mt file for basic.ma:
The larger and more complex the MDL application, the more #includes and additional structures that the .mt file will contain.
rsctype provides built-in macros to be used in conditional compilations. It provides all definitions provided with mcomp. It also defines the type_resource_generator variable.
rsctype, like mcomp, uses the BMAKE_OPT environment variable to obtain arguments. The string specified by BMAKE_OPT is prepended to the command line arguments before the arguments are processed. Any combination of command line arguments can be specified with the BMAKE_OPT environment variable. The options must be separated by blanks.
BMAKE_OPT generally specifies include directories. The following BMAKE_OPT definitions specify two include directories:
The command line syntax for rsctype is as follows:
-flag can be one of the following:
flag | description |
---|---|
-d<name>=<value> | Define name with value as it is defined by a define statement in the source file. This option does not require =value. |
-p | Display preprocessor output. |
-pi | Trace #include statements. |
-v | Verbose: show the compiler's progress. |
-o<filename> | Specify the output filename. If this option is not specified, the output filename is created when .r is appended to the input filename prefix. |
-i<dir> | Add the specified directory to the list of directories searched for include files. The MDL compiler supports up to 40 include directories. |
If only the file prefix is specified for the input filename, rsctype appends .mt to the name.
The type resource entries in basic.mke read:
These call the .mt.r: and .r.rsc rules in mdl.mki, which subsequently call rsctype and rcomp, respectively.