Original Article Date: March 26, 2004
When MicroStation is launched it processes a variety of configuration files which contain very specific instructions. These instructions contain bits of code referred to as preprocessor directives which control the way in which MicroStation processes these files. This article will give you a bit of a tour to help you understand what's going on behind the scenes.
Preprocessor directives begin with a % and you can find may excellent examples in the msconfig.cfg file. NOTE: Opening and looking at this most important configuration files is one thing...editing it is something quite different and could very easily cause MicroStation to not load at all. Use extreme caution when handling this file. %include [filename or variable] The %include processor tells MicroStation to process the file or variable specified. For example,in mslocal.cfg you'll find a line instructing MicroStation to go and process msconfig.cfg as shown below.
%if expression This statement will execute additional lines of code until it reaches an %endif, only when the expression is true. The available expressions are:
For example: %if defined (file or variable) If the variable is true, then continue executing additional lines of code.
For example: %if exists (file or variable) If the file or variable exists, then continue processing.
%else This directive indicates that MicroStation should continue executing code when the last %if is false. %elif expression In this case, MicroStation should execute the following lines of code if the previous %if was false and the expression is true. %endif This is the end of a conditional block. All sections of code that begin with %if will end with an %endif:
%error string This fun command will print the message as specified in the string and then exit MicroStation. %undef variable name This directive will undefine and delete the configuration variable specified by variable name. To keep the variable defined with a translation of NULL, use variable name = [space] %level value This specifies the level of processing and many examples of this can be found in msconfig.cfg %lock variable name This very powerful directive will lock down the named configuration variable with its current value. For example, the following snippet is from the delivered civil.pcf file and clearly illustrates MS_DESIGNSEED getting defined and then getting locked.
AskInga Article #198