1 2 3 4 5 6 7 8 9 10 11
12 package xdc.tools.cdoc;
13
14 /*!
15 * ======== Example ========
16 * XDOC markup language examples for modules and interfaces
17 *
18 * This module demonstrates the features of XDOC on the declarations
19 * of an XDC module. View the source text of this .xdc file for details
20 * on how to use these examples.
21 */
22 module Example {
23 /*!
24 * ======== AStruct ========
25 * Example structure declaration
26 *
27 * @field(aField) example field documentation
28 */
29 struct AStruct {
30 Int aField;
31 };
32
33 /*!
34 * ======== aFunction ========
35 * Example function documentation
36 *
37 * @param(aParam) example function parameter documentation
38 */
39 Void aFunction(Int aParam);
40
41 /*!
42 * ======== AnEnum ========
43 * Example enum documentation
44 *
45 * @value(AVALUE) example enum value documentation
46 */
47 enum AnEnum {
48 AVALUE
49 };
50 /*!
51 * ======== AUnion ========
52 * Example union documentation
53 *
54 * @field(aString) example union field documentation
55 */
56 union AUnion {
57 String aString;
58 Int anInt;
59 };
60
61 /*!
62 * ======== u ========
63 * Example statically initialized union documentation
64 */
65 config AUnion u = {aString: 'hello', anInt: 1234};
66
67 /*!
68 * ======== ATypedEnum ========
69 * Example typed enumeration
70 *
71 * This declaration defines a new type named ATypedEnum which is
72 * an alias of Int and two constants of type ATypedEnum.
73 *
74 * Unlike ordinary C enums, where the compiler is free to choose an
75 * arbitrary type for enums, this declaration ensures that the new
76 * type is of a specific named type (in this case, Int).
77 *
78 * @value(LOOP) example "typed" enum value documentation
79 */
80 enum ATypedEnum : Int {
81 LOOP = 6,
82 PRINT = 28
83 };
84
85 /*!
86 * ======== ACmd ========
87 * Example "tagged union" documentation
88 *
89 * This structure illustrates the "tagged union" pattern: one
90 * field of the structure indicates how to interpret the rest of the
91 * structure.
92 *
93 * @field(args) example structure field documentation
94 */
95 struct ACmd {
96 ATypedEnum cmdId;
97 union {
98 struct {
99 Int count;
100 } loop;
101
102 struct {
103 String msg;
104 } print;
105 } args;
106 };
107
108 }
109 110 111
112