This module demonstrates the features of XDOC on the declarations
of an XDC module. View the source text of this .xdc file for details
on how to use these examples.
| enum Example.ATypedEnum |
 |
Example typed enumeration
| XDCscript usage |
meta-domain |
values of type Example.ATypedEnum
const Example.LOOP;
const Example.PRINT;
typedef Int Example_ATypedEnum;
enum {
Example_LOOP,
Example_PRINT
} ;
VALUES
LOOP
example "typed" enum value documentation
DETAILS
This declaration defines a new type named ATypedEnum which is
an alias of Int and two constants of type ATypedEnum.
Unlike ordinary C enums, where the compiler is free to choose an
arbitrary type for enums, this declaration ensures that the new
type is of a specific named type (in this case, Int).
| enum Example.AnEnum |
 |
Example enum documentation
| XDCscript usage |
meta-domain |
values of type Example.AnEnum
const Example.AVALUE;
typedef enum Example_AnEnum {
Example_AVALUE
} Example_AnEnum;
VALUES
AVALUE
example enum value documentation
| struct Example.ACmd |
 |
Example "tagged union" documentation
| XDCscript usage |
meta-domain |
var obj = new Example.ACmd;
typedef struct Example_ACmd {
union {
struct {
Int count;
} loop;
struct {
String msg;
} print;
} args;
} Example_ACmd;
FIELDS
args
example structure field documentation
DETAILS
This structure illustrates the "tagged union" pattern: one
field of the structure indicates how to interpret the rest of the
structure.
| struct Example.AStruct |
 |
Example structure declaration
| XDCscript usage |
meta-domain |
var obj = new Example.AStruct;
obj.aField = Int ...
typedef struct Example_AStruct {
Int aField;
} Example_AStruct;
FIELDS
aField
example field documentation
| union Example.AUnion |
 |
Example union documentation
| XDCscript usage |
meta-domain |
var obj = new Example.AUnion;
obj.aString = String ...
typedef union Example_AUnion {
String aString;
Int anInt;
} Example_AUnion;
FIELDS
aString
example union field documentation
| config Example.u // module-wide |
 |
Example statically initialized union documentation
| XDCscript usage |
meta-domain |
aString: 'hello',
anInt: 1234
};
| metaonly config Example.common$ // module-wide |
 |
Common module configuration parameters
| XDCscript usage |
meta-domain |
DETAILS
All modules have this configuration parameter. Its name
contains the '$' character to ensure it does not conflict with
configuration parameters declared by the module. This allows
new configuration parameters to be added in the future without
any chance of breaking existing modules.
| Example.aFunction( ) // module-wide |
 |
Example function documentation
Void Example_aFunction( Int aParam );
ARGUMENTS
aParam
example function parameter documentation
| module-wide built-ins |
 |
// Get this module's unique id
Bool Example_Module_startupDone( );
// Test if this module has completed startup
// The heap from which this module allocates memory
Bool Example_Module_hasMask( );
// Test whether this module has a diagnostics mask
Bits16 Example_Module_getMask( );
// Returns the diagnostics mask for this module
Void Example_Module_setMask( Bits16 mask );
// Set the diagnostics mask for this module