Preprocessor Directives

Preprocessor directives are evaluated in the Livelink source code before being compiled. These directives commonly substitute text or perform a conditional compile. OScript supports the following preprocessor directives:

#define

The #define directive substitutes values for names during compilation. They are defined using the syntax:

	#define Name Value

The Value substitute may be of any data type or function. For example:

	#define ERROR_VALUE5
	#define ERROR_MSG"File Not Found"

or

	#define CONTENTSFile.Read( myFile )

#undef

The #undef directive undefines a #define token. A token is undefined using the syntax:

	#undef identifier

For example:

	#undef ERROR_MSG

#ifdef, #ifndef, #else, #endif

The #ifdef, #ifndef, #else, and #endif directives are used together to determine which parts of a script are compiled. These conditional compilation directives allow for code portions to be either compiled or omitted, depending on the stated conditions. These directives use the syntax:

		#ifdef identifier
			...block of code...  #else
				#ifndef identifier
				...block of code...
			#else
				...block of code
			#endif
		#endif