Skip to content

Commit 8f439ce

Browse files
Add 'examples declaration to halcompile and start using it.
Several HAL components already have examples, but these are not placed in standardized manual page sections. Adjust layout of eoffset_per_angle.comp, moveoff.comp and ohmic.comp. Also update component documentation to mention this new declaration.
1 parent bbbe84b commit 8f439ce

5 files changed

Lines changed: 22 additions & 8 deletions

File tree

docs/src/hal/comp.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Declarations include:
125125
* 'option OPT (VALUE);'
126126
* 'variable CTYPE STARREDNAME ([SIZE]);'
127127
* 'description DOC;'
128+
* 'examples DOC;'
128129
* 'notes DOC;'
129130
* 'see_also DOC;'
130131
* 'license LICENSE;'

src/hal/components/eoffset_per_angle.comp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ One of the four built-in functions is specified by the \\fBfnum\\fR pin:
2727
\\fB3\\fR: f3 square wave
2828

2929
Unsupported \\fBfnum\\fR values default to use function f0.
30+
""";
3031

31-
\\fBNOTES:\\fR
32-
32+
notes """
3333
\\fBradius-ref\\fR:
3434
The computed offsets are based on the \\fBradius-ref\\fR pin
3535
value. This pin may be set to a constant radius value or
@@ -43,15 +43,15 @@ and velocity limits. The allocations for coordinate \\fBL\\fR
4343
are typically controlled by an ini file setting:
4444
\\fB[AXIS_L]OFFSET_AV_RATIO\\fR.
4545

46-
\\fBNOTES\\fR:
4746
If unsupported parameters are supplied to a function (for instance
4847
a polygon with fewer than three sides), the current offset
4948
will be returned to zero (respecting velocity and acceleration
5049
constraints). After correcting the offending parameter, the
5150
\\fBenable-in\\fR pin must be toggled to resume offset
5251
computations.
52+
""";
5353

54-
\\fBEXAMPLE:\\fR
54+
examples """
5555
An example simulation configuration is provided at:
5656
\\fBconfigs/sim/axis/external_offsets/opa.ini\\fR. A
5757
simulated XZC machine uses the \\fBC\\fR coordinate angle to

src/hal/components/moveoff.comp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,13 @@ Use of the names= option for naming is \\fBrequired\\fR for compatibility
8484
with the gui provided as scripts/moveoff_gui:
8585
loadrt moveoff names=\\fBmv\\fR personality=number_of_joints
8686

87-
\\fBman moveoff_gui\\fR for more information
87+
""";
88+
89+
see_also """
90+
\\fBmoveoff_gui\\fR(1)
91+
""";
8892

89-
.SH EXAMPLES
93+
examples """
9094
Example simulator configs that demonstrate the moveoff component and a simple gui
9195
(scripts/moveoff_gui) are located in configs/sim/axis/moveoff. The axis gui is
9296
used for the demonstrations and the configs can be adapted for other guis like

src/hal/components/ohmic.comp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ In this case, the circuit will remain protected by the THCAD's ability to tolera
2525
.br
2626
It is optional that power to the Ohmic sensing circuit be disconnected unless probing is in progress ut this adds additional complexity.
2727
.br
28+
""";
2829

29-
30-
\\fBEXAMPLE:\\fR
30+
examples """
3131
.br
3232
THCAD5 card using a 1/32 frequency setting and a voltage divider internal to the plasma cutter with range extended
3333
to 24.5 volts with a 390K external resistor as per the manual. Additional information and wiring diagram is contained in the Plasma Primer in the main Linuxcnc documents.

src/hal/utils/halcompile.g

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ parser Hal:
4747
| "see_also" String ";" {{ see_also(String) }}
4848
| "notes" String ";" {{ notes(String) }}
4949
| "description" String ";" {{ description(String) }}
50+
| "examples" String ";" {{ examples(String) }}
5051
| "license" String ";" {{ license(String) }}
5152
| "author" String ";" {{ author(String) }}
5253
| "include" Header ";" {{ include(Header) }}
@@ -178,6 +179,9 @@ def comp(name, doc):
178179
def description(doc):
179180
docs.append(('descr', doc));
180181

182+
def examples(doc):
183+
docs.append(('examples', doc));
184+
181185
def license(doc):
182186
docs.append(('license', doc));
183187

@@ -1017,6 +1021,11 @@ def document(filename, outfilename):
10171021
else:
10181022
lead = ".br\n.ns\n.TP"
10191023

1024+
doc = finddoc('examples')
1025+
if doc and doc[1]:
1026+
print(".SH EXAMPLES\n", file=f)
1027+
print("%s" % doc[1], file=f)
1028+
10201029
doc = finddoc('see_also')
10211030
if doc and doc[1]:
10221031
print(".SH SEE ALSO\n", file=f)

0 commit comments

Comments
 (0)