module xdc.tools.cdoc.Example |
|
|
XDOC markup language examples for modules and interfaces
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.
#include <xdc/tools/cdoc/Example.h>
Functions |
Void | |
Functions common to all target modules |
|
|
Typedefs |
typedef struct | |
typedef enum | |
typedef struct | |
typedef Int | |
typedef union | |
Constants |
| |
enum Example_ATypedEnum |
|
Example typed enumeration
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
typedef enum Example_AnEnum {
Example_AVALUE
} Example_AnEnum;
VALUES
AVALUE
example enum value documentation
struct Example_ACmd |
|
Example "tagged union" documentation
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
typedef struct Example_AStruct {
Int aField;
} Example_AStruct;
FIELDS
aField
example field documentation
union Example_AUnion |
|
Example union documentation
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
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
var Example = xdc.useModule('xdc.tools.cdoc.Example');
module-wide constants & types
module-wide config parameters
aString: 'hello',
anInt: 1234
};
enum Example.ATypedEnum |
|
Example typed enumeration
XDCscript usage |
meta-domain |
values of type Example.ATypedEnum
const Example.LOOP;
const 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).
C SYNOPSIS
enum Example.AnEnum |
|
Example enum documentation
XDCscript usage |
meta-domain |
values of type Example.AnEnum
const Example.AVALUE;
VALUES
AVALUE
example enum value documentation
C SYNOPSIS
struct Example.ACmd |
|
Example "tagged union" documentation
XDCscript usage |
meta-domain |
var obj = new 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.
C SYNOPSIS
struct Example.AStruct |
|
Example structure declaration
XDCscript usage |
meta-domain |
var obj = new Example.AStruct;
obj.aField = Int ...
FIELDS
aField
example field documentation
C SYNOPSIS
union Example.AUnion |
|
Example union documentation
XDCscript usage |
meta-domain |
var obj = new Example.AUnion;
obj.aString = String ...
FIELDS
aString
example union field documentation
C SYNOPSIS
config Example.u // module-wide |
|
Example statically initialized union documentation
XDCscript usage |
meta-domain |
aString: 'hello',
anInt: 1234
};
C SYNOPSIS
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.
generated on Thu, 27 Sep 2012 23:21:13 GMT