1 | .. $Id: test_doc.rst 940 2012-06-17 18:48:58Z jemian $ |
---|
2 | |
---|
3 | =============== |
---|
4 | Acceptance Test |
---|
5 | =============== |
---|
6 | |
---|
7 | If all links are valid, test is done successfully. |
---|
8 | |
---|
9 | |
---|
10 | Directives |
---|
11 | ========== |
---|
12 | |
---|
13 | A *directive* can be used to define the anchor point of a reference. |
---|
14 | Index entries will point back to the *directive*. If the item |
---|
15 | defined in the directive is not obtained from the source code, |
---|
16 | then define it here, like these. All of these directives should |
---|
17 | have entries in an Index. |
---|
18 | |
---|
19 | SPEC Macros |
---|
20 | ^^^^^^^^^^^ |
---|
21 | |
---|
22 | .. spec:def:: def_macro content |
---|
23 | |
---|
24 | :param arg: list of arguments is optional |
---|
25 | :type arg: str |
---|
26 | |
---|
27 | This is a standard SPEC macro definition. |
---|
28 | |
---|
29 | .. spec:def:: def_function(arguments) |
---|
30 | |
---|
31 | :param str arguments: named argument(s) to this function |
---|
32 | |
---|
33 | .. spec:rdef:: rdef_macro content |
---|
34 | |
---|
35 | This is a SPEC macro definition with symbols that are evaluated only at run-time. |
---|
36 | |
---|
37 | .. spec:cdef:: cdef("cdef_macro", "content", "cdef_part", flags) |
---|
38 | |
---|
39 | :param str cdef_macro: one-word name (quoted string) for this macro chain |
---|
40 | :param str content: SPEC code to be inserted (typically a single macro) |
---|
41 | :param str cdef_part: name for this part of the chained macro |
---|
42 | :param str flags: see the manual |
---|
43 | |
---|
44 | SPEC cdef macro definitions |
---|
45 | ++++++++++++++++++++++++++++++++ |
---|
46 | |
---|
47 | .. TODO: pull this subsection once this part is made to work |
---|
48 | |
---|
49 | There are several different signatures for SPEC's ``cdef`` macro definition. |
---|
50 | Here are some examples pulled from the ``SPEC.D`` directory. |
---|
51 | |
---|
52 | .. note:: At present, the argument list from ``cdef`` macro definitions |
---|
53 | is not being parsed or handled. This will be fixed in a future revision. |
---|
54 | |
---|
55 | .. literalinclude:: cdef-examples.mac |
---|
56 | :linenos: |
---|
57 | :language: guess |
---|
58 | |
---|
59 | SPEC Variables |
---|
60 | ^^^^^^^^^^^^^^ |
---|
61 | |
---|
62 | These are some representative variable declarations in SPEC macro source files:: |
---|
63 | |
---|
64 | global BCDA_GM[] |
---|
65 | |
---|
66 | global theta[] |
---|
67 | global 2theta[] # this will not be found |
---|
68 | global _motor[] |
---|
69 | |
---|
70 | global kohzu_PV kohzuMV_PV UND_PV Und_Off UNDE_TRACK_ON |
---|
71 | global kohzuStop_PV kohzuMode_PV kohzuMove_PV |
---|
72 | global CCD_OVERHEAD_SECS_MEASURED # measured readout time |
---|
73 | |
---|
74 | global @A_name[] @B_name[] |
---|
75 | unglobal @A_name |
---|
76 | unglobal @B_name |
---|
77 | |
---|
78 | Variables in Directives |
---|
79 | +++++++++++++++++++++++ |
---|
80 | |
---|
81 | global variable declaration: |
---|
82 | |
---|
83 | .. spec:global:: A[] |
---|
84 | |
---|
85 | ``A[]`` contains the values of all motors |
---|
86 | |
---|
87 | local variable declaration: |
---|
88 | |
---|
89 | .. spec:local:: i |
---|
90 | |
---|
91 | ``i`` is a local loop counter |
---|
92 | |
---|
93 | array variable declaration: |
---|
94 | |
---|
95 | tba |
---|
96 | |
---|
97 | Variables in Roles |
---|
98 | +++++++++++++++++++++++ |
---|
99 | |
---|
100 | * global variable declaration: :spec:global:`A[]` |
---|
101 | * local variable declaration: :spec:local:`i` |
---|
102 | * array variable declaration: |
---|
103 | * constant declaration: |
---|
104 | |
---|
105 | Python example |
---|
106 | ^^^^^^^^^^^^^^ |
---|
107 | |
---|
108 | .. py:function:: python_function(t = None) |
---|
109 | |
---|
110 | :param t: time_t object or None (defaults to ``now()``) |
---|
111 | :type t: str |
---|
112 | |
---|
113 | |
---|
114 | Roles |
---|
115 | ===== |
---|
116 | |
---|
117 | A *role* refers to a *directive* (makes a link to a *directive* defined elsewhere). |
---|
118 | Each of these items should produce a valid link. Additionally, every call to a |
---|
119 | *role* should produce an index entry. |
---|
120 | |
---|
121 | SPEC Macros |
---|
122 | ^^^^^^^^^^^ |
---|
123 | |
---|
124 | * macro definition: :spec:def:`def_macro` |
---|
125 | * function definition: :spec:def:`def_function(arguments)` |
---|
126 | * runtime-defined macro definition: :spec:rdef:`rdef_macro` |
---|
127 | * chained macro definition: :spec:cdef:`cdef("cdef_macro", "content", "cdef_part", flags)` |
---|
128 | |
---|
129 | SPEC Variables |
---|
130 | ^^^^^^^^^^^^^^ |
---|
131 | |
---|
132 | The SPEC macro language provides for several types of variable: |
---|
133 | |
---|
134 | * global variables, such as: :spec:global:`A[]` |
---|
135 | * local variable, such as: :spec:local:`i` |
---|
136 | * array variable declaration: |
---|
137 | * constant declaration: |
---|
138 | |
---|
139 | Source code documentation |
---|
140 | ============================ |
---|
141 | |
---|
142 | Python example |
---|
143 | ^^^^^^^^^^^^^^ |
---|
144 | |
---|
145 | See the python method :py:func:`python_function()` (defined above) |
---|
146 | |
---|
147 | .. This should document the Python module supporting the specdomain |
---|
148 | |
---|
149 | :class:`SpecVariableObject` (Python Module) |
---|
150 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
151 | |
---|
152 | .. autoclass:: sphinxcontrib.specdomain.SpecVariableObject |
---|
153 | :members: |
---|
154 | :undoc-members: |
---|
155 | :show-inheritance: |
---|
156 | |
---|
157 | .. automodule:: sphinxcontrib.specdomain |
---|
158 | :members: |
---|
159 | |
---|
160 | |
---|
161 | |
---|
162 | SPEC macro source file |
---|
163 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
164 | |
---|
165 | .. spec:macrofile:: cdef-examples.mac |
---|