|Top Previous Next|
Here are preprocessor directives supported by Tibbo BASIC and Tibbo C.
Creates a macro, which is the association of the preprocessor identifier with a token string.
TIDE also features "global" preprocessor identifiers. You can inspect them in the Customize Project dialog (File > Project Settings —> Customize (button)).
The dialog shows global identifiers that come directly from platform files. Some identifiers allow you to alter their values. You can also define your own global identifiers.
Like identifiers defined with the #define directive, all these global identifiers can be used in conditional preprocessor constructs described below.
The difference between preprocessor identifiers defined using the #define directive and the global ones is that global identifiers can additionally be used in setting file compilation conditions.
Un-defines (removes) the current definition of the preprocessor identifier.
Conditional compilation construct that checks if the specified preprocessor identifier exists.
#if defined (C only)
This is a more sophisticated version of #ifdef, it allows you to set compound conditions.
Note how the #if defined construct requires parentheses around macro identifiers.
Conditional compilation construct that checks if the specified preprocessor identifier does not exists.
Conditional compilation construct that evaluates an expression involving preprocessor identifiers.
Reminder: some relational and logic operators differ between BASIC and C. What's #if COLOR=RED in BASIC is #if COLOR==RED in C!
#include (C); include (BASIC)
In BASIC, files are included with the include statement, which is technically not a part of the preprocessor.
I am combining this with the C preprocessor directive #include because the two do exactly the same job.
#includeb (C only)
Allows you to include a BASIC header file (.TBH) from a C file.
This is a powerful tool that you can use to avoid having two identical header files with definitions — one for BASIC and a mirror one for C.
The reverse directive for including C headers from BASIC files does not exist.
One special feature of our preprocessor is that preprocessor directives may be included in text resource files.
This is widely used in libraries. For example, the STG (settings) library relies on the settings.xtxt, which is a definition file carrying the list of settings with their names, types, etc.
You typically work with this file through a convenient configurator. If you were to look at the contents of the underlying text file you would see that there are several #define directives in that file.
To make TIDE recognize these directives you need to include that text resource file into your compilation process using the includepp directive.
Prints a message into the output pane (don't forget to put "" around the message string).
Prints a message into the output pane and aborts the compilation (don't forget to put "" around the message string).
#pragma pack (C only)
Possible values are #pragma pack (1), (2), or (4).
Specifying #pragma pack (2) leads to the 16-bit alignment in structures and unions (zero-byte padding is used to achieve proper alignment).
Using #pragma pack (4) will lead to the 32-bit alignment.
The same construct doesn't exist in Tibbo BASIC because the latter uses "safe" structures featuring special headers. "Packing" wouldn't make any sense for such "safe" structures.
Tibbo C default is (1), i.e. no padding of any kind.
With #pragma pack (4), and assuming that tp.x=0x12 and tp.l=0x3456789A the memory structure holding the tp variable will look like this (notice three padding zero bytes):
#pragma message (C only)
Exists for compatibility with other C implementations, the same is achieved with the #message directive.