1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <link rel=
"stylesheet" media=
"screen" type=
"text/css" href=
"./style.css" />
6 <link rel=
"stylesheet" media=
"screen" type=
"text/css" href=
"./design.css" />
7 <link rel=
"stylesheet" media=
"print" type=
"text/css" href=
"./print.css" />
9 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
14 <strong>REGISTER_ACTIONS - REGISTER_FLAGS - REGISTER_ATTRIBUTES
</strong>
18 Every action file must register its actions in the HID.
19 The action file will have an
21 <pre class=
"code c"><span class=
"co2">#include
"hid.h
"</span></pre>
24 which define the REGISTER_* macros.
25 Then somewhere in the file you add:
27 <pre class=
"code">REGISTER_ACTIONS(exampledo_action_list)
</pre>
30 This will be expanded by the preprocessor into:
32 <pre class=
"code c"><span class=
"kw4">void
</span> register_exampledo_action_list
<span class=
"br0">(</span><span class=
"br0">)</span>
33 <span class=
"br0">{</span> hid_register_actions
<span class=
"br0">(</span>exampledo_action_list
<span class=
"sy0">,
</span><span class=
"nu0">1</span><span class=
"br0">)</span><span class=
"sy0">;
</span> <span class=
"br0">}</span></pre>
36 During the build process the files
<em><strong>core_lists.h
</strong></em> and
<em><strong>gtk_lists.h
</strong></em> are created. These files contain nothing more than a collection of REGISTER_* instructions it found in its source files.
<br/>
37 So
<em><strong>core_lists.h
</strong></em> and
<em><strong>gtk_lists.h
</strong></em> will contain:
39 <pre class=
"code">REGISTER_ACTION(exampledo_action_list)
</pre>
42 In the file
<em><strong>main.c
</strong></em> around the
<em class=
"u">main
</em> functions we find the instruction:
44 <pre class=
"code c"><span class=
"co2">#include
"dolists.h
"</span></pre>
47 And soon after that we find
49 <pre class=
"code c"><span class=
"co2">#include
"core_lists.h
"</span></pre>
52 Because
<em><strong>dolists.h
</strong></em> redefines the REGISTER_* macros, the macros in
<em><strong>core_lists.h
</strong></em>
54 <pre class=
"code">REGISTER_ACTIONS(exampledo_action_list)
</pre>
57 will be expanded by the preprocessor into:
59 <pre class=
"code c">external
<span class=
"kw4">void
</span> register_exampledo_action_list
<span class=
"br0">(</span><span class=
"br0">)</span><span class=
"sy0">;
</span>
60 register_exampledo_action_list
<span class=
"br0">(</span><span class=
"br0">)</span><span class=
"sy0">;
</span></pre>
63 And therefore it will call all functions to register the actions at the beginning of the main function.
66 <h3 class=
"sectionedit1" id=
"options">Options
</h3>
68 <div class=
"table sectionedit2"><table class=
"inline">
70 <td class=
"col0">REGISTER_ACTIONS
</td><td class=
"col1">These actions can be called though the user command window (start with “:” in the PCB program.
</td>
73 <td class=
"col0">REGISTER_FLAGS
</td><td class=
"col1">These flags initiate a functions when set or unset.
<br/>
74 E.g. in file
<em><strong>flags.c
</strong></em> we find
<pre class=
"code c">HID_Flag flags_flag_list
<span class=
"br0">[</span><span class=
"br0">]</span> <span class=
"sy0">=
</span> <span class=
"br0">{</span>
75 <span class=
"br0">{</span><span class=
"st0">"style
"</span><span class=
"sy0">,
</span> FlagCurrentStyle
<span class=
"sy0">,
</span> NULL
<span class=
"br0">}</span><span class=
"sy0">,
</span>
76 <span class=
"br0">{</span><span class=
"st0">"grid
"</span><span class=
"sy0">,
</span> FlagGrid
<span class=
"sy0">,
</span> NULL
<span class=
"br0">}</span><span class=
"sy0">,
</span></pre>
79 The “grid” flags is associated with the menu flag:
<strong>View→enable visible grid
</strong> and makes the connection to the
<code>FlagGrid()
</code> function.
<br/>
80 If you select
<strong>View→enable visible grid
</strong> the function
<code>FlagGrid
</code> will be called.
85 <td class=
"col0">REGISTER_ATTRIBUTES
</td><td class=
"col1">In
<em><strong>main.c
</strong></em> there is a call to this macro:
<code>REGISTER_ATTRIBUTES (main_attribute_list)
</code><br/>
86 The main_attribute_list defines the command-line options.
<br/>
87 Most of the HID also use this macro, to add their command line options as well.
</td>
90 <!-- EDIT2 TABLE [1377-2232] -->
92 <!-- EDIT1 SECTION "Options" [1358-] --></body>