File Type
|
Output File
|
Reg
|
Reginit.ini
|
Bib
|
Ce.bib
|
Db
|
InitObj.db
|
Dat
|
InitObj.dat
|
Nls
|
nlssrc.txt
|
1. The most basic conditional expression is the IF <environmentvariable> statement that you may see in many of the sample BSPs. The syntax is:
IF <EnvironmentVariable> [!]
… some settings…
ENDIF
Where EnvironmentVariable is a an environment variable set on your development system and the ‘!’ is the not character. This conditional allows you to check to see if an environment variable is defined, or not defined.This explains why setting an environment variable equal to zero (0) is not the same thing as clearing the variable. If you set the variable to zero, it is still defined. If you clear the variable, it is no longer defined and can be checked by this conditional. So:
Set BSP_MYVAR=
Is not the same as
Set BSP_MYVAR=0
Example:
IF BSP_DRIVERSUPPORT
IF BSP_MYDRIVER
[HKEY_LOCAL_MACHINE/Drivers/Builtin/MyDriver]
“dll”=”MyDriver.dll”
“Index”=dword:1
ENDIF
ENDIF
Which includes the registry settings for MyDriver when BSP_DRIVERSUPPORT and BSP_MYDRIVER are defined.
2. Fmerge was enhanced in Windows CE 4.0 to support new conditional expressions which are much more powerful. The enhanced conditional expressions add support for value comparison and else statements. The new syntax is:
#if ExpressionList
#elif ExpressionList#else
#endif
Where ExpressionList can include “==”, “!=”, “||” and “&&” operators. So now we can simplify the previous example:
#if defined BSP_DRIVERSUPPORT && defined BSP_MYDRIVER
[HKEY_LOCAL_MACHINE/Drivers/Builtin/MyDriver]
“dll”=”MyDriver.dll”
“Index”=dword:1
#endif
Note the use of defined to check to see if a variable is defined.
This conditional also allows us to check for a value of variable, which allows us to do things like only include a registry setting if we are building a debug build of the OS:
#if “$(WINCEDEBUG)”==”debug”
[HKEY_LOCAL_MACHINE/Drivers/Builtin/MyDriver]
“dll”=”MyDriver.dll”
“Index”=dword:1
#endif