missing NULL terminator in set_config_x
[geda-gaf.git] / docs / wiki / geda-pcb_register_actions_explained.html
blob2aeb4da28e13f4f1f2cf32878e200f363229f857
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html>
4 <head>
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" />
10 </head>
11 <body>
13 <p>
14 <strong>REGISTER_ACTIONS - REGISTER_FLAGS - REGISTER_ATTRIBUTES</strong>
15 </p>
17 <p>
18 Every action file must register its actions in the HID.
19 The action file will have an
20 </p>
21 <pre class="code c"><span class="co2">#include &quot;hid.h&quot;</span></pre>
23 <p>
24 which define the REGISTER_* macros.
25 Then somewhere in the file you add:
26 </p>
27 <pre class="code">REGISTER_ACTIONS(exampledo_action_list)</pre>
29 <p>
30 This will be expanded by the preprocessor into:
31 </p>
32 <pre class="code c"><span class="kw4">void</span> register_exampledo_action_list<span class="br0">&#40;</span><span class="br0">&#41;</span>
33 <span class="br0">&#123;</span> hid_register_actions<span class="br0">&#40;</span>exampledo_action_list<span class="sy0">,</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span></pre>
35 <p>
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:
38 </p>
39 <pre class="code">REGISTER_ACTION(exampledo_action_list)</pre>
41 <p>
42 In the file <em><strong>main.c</strong></em> around the <em class="u">main</em> functions we find the instruction:
43 </p>
44 <pre class="code c"><span class="co2">#include &quot;dolists.h&quot;</span></pre>
46 <p>
47 And soon after that we find
48 </p>
49 <pre class="code c"><span class="co2">#include &quot;core_lists.h&quot;</span></pre>
51 <p>
52 Because <em><strong>dolists.h</strong></em> redefines the REGISTER_* macros, the macros in <em><strong>core_lists.h</strong></em>
53 </p>
54 <pre class="code">REGISTER_ACTIONS(exampledo_action_list)</pre>
56 <p>
57 will be expanded by the preprocessor into:
58 </p>
59 <pre class="code c">external <span class="kw4">void</span> register_exampledo_action_list<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
60 register_exampledo_action_list<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
62 <p>
63 And therefore it will call all functions to register the actions at the beginning of the main function.
64 </p>
66 <h3 class="sectionedit1" id="options">Options</h3>
67 <div class="level3">
68 <div class="table sectionedit2"><table class="inline">
69 <tr class="row0">
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>
71 </tr>
72 <tr class="row1">
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">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span>
75 <span class="br0">&#123;</span><span class="st0">&quot;style&quot;</span><span class="sy0">,</span> FlagCurrentStyle<span class="sy0">,</span> NULL<span class="br0">&#125;</span><span class="sy0">,</span>
76 <span class="br0">&#123;</span><span class="st0">&quot;grid&quot;</span><span class="sy0">,</span> FlagGrid<span class="sy0">,</span> NULL<span class="br0">&#125;</span><span class="sy0">,</span></pre>
78 <p>
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.
81 </p>
82 </td>
83 </tr>
84 <tr class="row2">
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>
88 </tr>
89 </table></div>
90 <!-- EDIT2 TABLE [1377-2232] -->
91 </div>
92 <!-- EDIT1 SECTION "Options" [1358-] --></body>
93 </html>