source: specdomain/src/specdomain/test/test_doc.rst @ 936

Last change on this file since 936 was 936, checked in by jemian, 11 years ago

refs #8, directives and roles are working at some level, ready to learn how to document SPEC macro source files

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision URL Header
File size: 3.4 KB
Line 
1.. $Id: test_doc.rst 936 2012-06-15 19:58:34Z jemian $
2
3===============
4Acceptance Test
5===============
6
7If all links are valid, test is done successfully.
8
9
10Directives
11==========
12
13A *directive* can be used to define the anchor point of a reference.
14Index entries will point back to the *directive*.  If the item
15defined in the directive is not obtained from the source code,
16then define it here, like these.  All of these directives should
17have entries in an Index.
18
19SPEC 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   
44SPEC cdef macro definitions
45++++++++++++++++++++++++++++++++
46
47.. TODO: pull this subsection once this part is made to work
48
49There are several different signatures for SPEC's ``cdef`` macro definition.
50Here 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
59SPEC Variables
60^^^^^^^^^^^^^^
61
62These 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
78Variables in Directives
79+++++++++++++++++++++++
80
81global variable declaration:
82
83.. spec:global:: A[]
84
85   ``A[]`` contains the values of all motors
86
87local variable declaration: 
88
89.. spec:local:: i
90
91   ``i`` is a local loop counter
92
93array variable declaration:
94
95        tba
96
97Variables in Roles
98+++++++++++++++++++++++
99
100* global variable declaration: :spec:global:`A[]`
101* local variable declaration:  :spec:local:`i`
102* array variable declaration:
103
104Python example
105^^^^^^^^^^^^^^
106
107.. py:function:: python_function(t = None)
108
109   :param t: time_t object or None (defaults to ``now()``)
110   :type  t: str
111
112
113Roles
114=====
115
116A *role* refers to a *directive* (makes a link to a *directive* defined elsewhere).
117Each of these items should produce a valid link.  Additionally, every call to a
118*role* should produce an index entry.
119
120SPEC Macros
121^^^^^^^^^^^
122
123* macro definition: :spec:def:`def_macro`
124* function definition: :spec:def:`def_function(arguments)`
125* runtime-defined macro definition: :spec:rdef:`rdef_macro`
126* chained macro definition: :spec:cdef:`cdef("cdef_macro", "content", "cdef_part", flags)`
127
128SPEC Variables
129^^^^^^^^^^^^^^
130
131* global variable declaration:
132* local variable declaration:
133* array variable declaration:
134
135Python example
136^^^^^^^^^^^^^^
137
138See the python method :py:func:`python_function()` (defined above)
Note: See TracBrowser for help on using the repository browser.