Maptitude GISDK Help |
You can add user-defined compilation flags to your resource files to control which lines in the file are processed by the resource compiler. User-defined compilation flags are useful in the following type of circumstances:
Here is a sample GISDK macro that loops over each state and does some processing on it. This GISDK macro includes a debugging message that lets you know which state you are on.
Macro "loop over states"
vw = "States"
SetLayer(vw)
// Start the loop by finding the first state...
rec = GetFirstRecord(vw + "|", )
while rec <> null do
//
// ... do some processing here ...
//
// Here's the debugging message...
>X ShowMessage("Finished with " + vw.Name)
rec = GetNextRecord(vw + "|", , )
end
endMacro
If this resource is compiled with the X compilation flag, the debugging message will be included in the compiled resource, and the name of each state will be displayed as it is processed. If this resource is compiled without the X compilation flag, the debugging message will be excluded from the compiled resource.
You can create up to 26 user-defined compilation flags, one for each letter of the alphabet. In a resource file, you can mark lines for conditional compilation by using the < character (to exclude) or > (to include) character in column 1 of the file, followed immediately by one or more compilation flags.
Here are some examples:
Macro "extremely silly macro" |
>A |
ShowMessage("The A flag was used") |
>B |
ShowMessage("The B flag was used") |
>AB |
ShowMessage("A, B, or both A and B were used") |
<A |
ShowMessage("The A flag was not used") |
<B |
ShowMessage("The B flag was not used") |
<AB |
ShowMessage("Neither the A nor the B flag was used") |
endMacro |
|
You can also have a combination of inclusion and exclusion:
Macro "another silly macro" |
|
>A<B |
ShowMessage("The A flag was used and the B flag was not used") |
>AB<C |
ShowMessage("A, B, or both A and B were used but C was not") |
>A<BC |
ShowMessage("A was used but neither B nor C was used") |
endMacro |
|
To compile a resource file using custom compilation flags, follow the instructions below:
Compilation method |
How to use flags |
GISDK toolbox |
Type the flags in the Flags box in the toolbar |
Stand-alone compiler |
Use the -d switch in the command line (e.g., rscc -dABC...) |
Pass a string containing the flags as the third argument |
Here is another example. This menu (from a custom application) includes menu items that have conditional compilation flags. Different combinations of flags can produce four different versions of the finished application.
Menu "Main Menu" |
|
Menuitem "File" |
menu "file menu" |
>A Menuitem "Make Maps" |
menu "map menu" |
>B Menuitem "Use Database" |
menu "data menu" |
endMenu |
|
menu "file menu"
Menutem "Open..."
Menuitem "Close..."
Separator
>B Menuitem "Import Data..."
>B Menuitem "Export Data...
>B Separator
>A Menuitem "Print Map..."
>A Separator
Menuitem "Exit"
endMenu
Menu "map menu"
Menuitem "Region 1"
Menuitem "Region 2"
Menuitem "Region 3"
Menuitem "Region 4"
endMenu
Menu "data menu"
Menuitem "Use 1995 Data"
Menuitem "Use 1994 Data"
Menuitem "Use 1993 Data"
Menuitem "Use 1992 Data"
endMenu
As shown in the table below, various combinations of user-defined flags result in different menu systems, providing different capabilities for different users:
Flags |
Capabilities |
None |
The simplest system, for an untrained user (e.g., clerical or upper management) |
A |
A version that includes commands for map production |
B |
A version that includes commands for database management |
AB |
The system administrator version, providing all functions |
For this particular application, you could even automate production of all four versions of the custom application using a batch file like this one:
rscc -c -u basic_ui @resource.lst
rscc -c -dA -u map_ui @resource.lst
rscc -c -dB -u data_ui @resource.lst
rscc -c -dAB -u sysad_ui @resource.lst
©2025 Caliper Corporation | www.caliper.com |