netlinx-compile 1.0.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +122 -0
- data/doc/NetLinx.html +130 -151
- data/doc/NetLinx/Compile.html +130 -148
- data/doc/NetLinx/Compile/Extension.html +128 -145
- data/doc/NetLinx/Compile/Extension/AXS.html +218 -154
- data/doc/NetLinx/Compile/ExtensionDiscovery.html +524 -321
- data/doc/NetLinx/Compile/ExtensionHandler.html +755 -396
- data/doc/NetLinx/Compile/Script.html +431 -282
- data/doc/NetLinx/Compiler.html +496 -285
- data/doc/NetLinx/CompilerResult.html +1250 -498
- data/doc/NetLinx/NoCompilerError.html +142 -155
- data/doc/NetLinx/Rake.html +115 -0
- data/doc/NetLinx/Rake/Compile.html +358 -0
- data/doc/NetLinx/SourceFile.html +702 -423
- data/doc/_index.html +234 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +156 -0
- data/doc/file.license.html +70 -0
- data/doc/file_list.html +61 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +156 -103
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -18
- data/doc/method_list.html +339 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/netlinx-compile.rb +11 -1
- data/lib/netlinx/compile/extension_discovery.rb +4 -2
- data/lib/netlinx/compile/extension_handler.rb +23 -25
- data/lib/netlinx/compile/script.rb +4 -3
- data/lib/netlinx/compiler.rb +45 -21
- data/lib/netlinx/compiler_result.rb +16 -17
- data/lib/netlinx/rake/compile.rb +4 -0
- data/lib/netlinx/rake/compile/compile.rb +34 -0
- data/lib/netlinx/source_file.rb +20 -14
- data/lib/test/netlinx/compilable.rb +13 -48
- data/lib/test/netlinx/compile/discoverable.rb +3 -14
- data/lib/test/netlinx/compile/invokable.rb +3 -15
- data/license.txt +1 -1
- metadata +114 -74
- data/README.txt +0 -2
- data/doc/Test.html +0 -147
- data/doc/Test/NetLinx.html +0 -147
- data/doc/Test/NetLinx/Compilable.html +0 -148
- data/doc/Test/NetLinx/Compile.html +0 -146
- data/doc/Test/NetLinx/Compile/Discoverable.html +0 -148
- data/doc/Test/NetLinx/Compile/Invokable.html +0 -149
- data/doc/created.rid +0 -12
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/js/darkfish.js +0 -155
- data/doc/js/navigation.js +0 -142
- data/doc/js/search.js +0 -94
- data/doc/js/search_index.js +0 -1
- data/doc/js/searcher.js +0 -228
- data/doc/rdoc.css +0 -595
- data/doc/table_of_contents.html +0 -138
data/doc/NetLinx/Compiler.html
CHANGED
@@ -1,295 +1,506 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<
|
4
|
-
<
|
5
|
-
<meta
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
<
|
16
|
-
|
17
|
-
<script type="text/javascript"
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
<
|
24
|
-
|
25
|
-
<
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
</
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: NetLinx::Compiler
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.25
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "NetLinx::Compiler";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (C)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../NetLinx.html" title="NetLinx (module)">NetLinx</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Compiler</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: NetLinx::Compiler
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">NetLinx::Compiler</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/netlinx/compiler.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>A wrapper class for the AMX NetLinx compiler executable (nlrc.exe).</p>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div class="tags">
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<h2>
|
122
|
+
Instance Method Summary
|
123
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
124
|
+
</h2>
|
125
|
+
|
126
|
+
<ul class="summary">
|
127
|
+
|
128
|
+
<li class="public ">
|
129
|
+
<span class="summary_signature">
|
130
|
+
|
131
|
+
<a href="#compile-instance_method" title="#compile (instance method)">#<strong>compile</strong>(compilable) ⇒ Object </a>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
</span>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<span class="summary_desc"><div class='inline'>
|
146
|
+
<p>Compile the specified object with the NetLinx compiler.</p>
|
147
|
+
</div></span>
|
148
|
+
|
149
|
+
</li>
|
150
|
+
|
151
|
+
|
152
|
+
<li class="public ">
|
153
|
+
<span class="summary_signature">
|
154
|
+
|
155
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(**kwargs) ⇒ Compiler </a>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
</span>
|
160
|
+
|
161
|
+
|
162
|
+
<span class="note title constructor">constructor</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>Checks for the AMX NetLinx compiler (third-party software, nlrc.exe) at the default installation path.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
</ul>
|
179
|
+
|
180
|
+
|
181
|
+
<div id="constructor_details" class="method_details_list">
|
182
|
+
<h2>Constructor Details</h2>
|
183
|
+
|
184
|
+
<div class="method_details first">
|
185
|
+
<h3 class="signature first" id="initialize-instance_method">
|
186
|
+
|
187
|
+
#<strong>initialize</strong>(**kwargs) ⇒ <tt><span class='object_link'><a href="" title="NetLinx::Compiler (class)">Compiler</a></span></tt>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
</h3><div class="docstring">
|
194
|
+
<div class="discussion">
|
195
|
+
|
196
|
+
<p>Checks for the AMX NetLinx compiler (third-party software, nlrc.exe) at the default installation path.</p>
|
197
|
+
|
198
|
+
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
<div class="tags">
|
202
|
+
<p class="tag_title">Parameters:</p>
|
203
|
+
<ul class="param">
|
204
|
+
|
205
|
+
<li>
|
206
|
+
|
207
|
+
<span class='name'>kwargs</span>
|
208
|
+
|
209
|
+
|
210
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
—
|
215
|
+
<div class='inline'>
|
216
|
+
<p>a customizable set of options</p>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
</li>
|
220
|
+
|
221
|
+
</ul>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<p class="tag_title">Options Hash (<tt>**kwargs</tt>):</p>
|
227
|
+
<ul class="option">
|
228
|
+
|
229
|
+
<li>
|
230
|
+
<span class="name">:compiler_exe</span>
|
231
|
+
<span class="type">(<tt>String</tt>)</span>
|
232
|
+
<span class="default">
|
233
|
+
|
234
|
+
— default:
|
235
|
+
<tt>'nlrc.exe'</tt>
|
236
|
+
|
237
|
+
</span>
|
238
|
+
|
239
|
+
</li>
|
240
|
+
|
241
|
+
<li>
|
242
|
+
<span class="name">:compiler_path</span>
|
243
|
+
<span class="type">(<tt>String</tt>)</span>
|
244
|
+
<span class="default">
|
245
|
+
|
246
|
+
</span>
|
247
|
+
|
248
|
+
— <div class='inline'>
|
249
|
+
<p>Recommend a directory to look for the compiler_exe.</p>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
</li>
|
253
|
+
|
254
|
+
<li>
|
255
|
+
<span class="name">:use_wine</span>
|
256
|
+
<span class="type">(<tt>String</tt>)</span>
|
257
|
+
<span class="default">
|
258
|
+
|
259
|
+
— default:
|
260
|
+
<tt>false</tt>
|
261
|
+
|
262
|
+
</span>
|
263
|
+
|
264
|
+
— <div class='inline'>
|
265
|
+
<p>Set to true to force `wine` at the front of the compiler command. This is automatic if nlrc.exe is installed at Wine's default Program Files path.</p>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
</li>
|
269
|
+
|
270
|
+
</ul>
|
271
|
+
|
272
|
+
|
273
|
+
<p class="tag_title">Raises:</p>
|
274
|
+
<ul class="raise">
|
275
|
+
|
276
|
+
<li>
|
277
|
+
|
278
|
+
|
279
|
+
<span class='type'>(<tt><span class='object_link'><a href="NoCompilerError.html" title="NetLinx::NoCompilerError (class)">NetLinx::NoCompilerError</a></span></tt>)</span>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
—
|
284
|
+
<div class='inline'>
|
285
|
+
<p>Compiler not found.</p>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
</li>
|
289
|
+
|
290
|
+
</ul>
|
291
|
+
|
292
|
+
</div><table class="source_code">
|
293
|
+
<tr>
|
294
|
+
<td>
|
295
|
+
<pre class="lines">
|
296
|
+
|
297
|
+
|
298
|
+
21
|
299
|
+
22
|
300
|
+
23
|
301
|
+
24
|
302
|
+
25
|
303
|
+
26
|
304
|
+
27
|
305
|
+
28
|
306
|
+
29
|
307
|
+
30
|
308
|
+
31
|
309
|
+
32
|
310
|
+
33
|
311
|
+
34
|
312
|
+
35
|
313
|
+
36
|
314
|
+
37
|
315
|
+
38
|
316
|
+
39
|
317
|
+
40
|
318
|
+
41
|
319
|
+
42
|
320
|
+
43
|
321
|
+
44
|
322
|
+
45
|
323
|
+
46
|
324
|
+
47
|
325
|
+
48
|
326
|
+
49</pre>
|
327
|
+
</td>
|
328
|
+
<td>
|
329
|
+
<pre class="code"><span class="info file"># File 'lib/netlinx/compiler.rb', line 21</span>
|
330
|
+
|
331
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
|
332
|
+
<span class='ivar'>@compiler_exe</span> <span class='op'>=</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='symbol'>:compiler_exe</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>nlrc.exe</span><span class='tstring_end'>'</span></span>
|
333
|
+
<span class='id identifier rubyid_user_specified_path'>user_specified_path</span> <span class='op'>=</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='symbol'>:compiler_path</span><span class='comma'>,</span> <span class='kw'>nil</span>
|
334
|
+
<span class='ivar'>@use_wine</span> <span class='op'>=</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='symbol'>:use_wine</span><span class='comma'>,</span> <span class='kw'>false</span>
|
46
335
|
|
47
|
-
|
48
|
-
|
49
|
-
<
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
</ul>
|
54
|
-
</nav>
|
55
|
-
|
56
|
-
|
57
|
-
</div>
|
58
|
-
|
59
|
-
<div id="class-metadata">
|
60
|
-
|
61
|
-
<nav id="parent-class-section" class="section">
|
62
|
-
<h3 class="section-header">Parent</h3>
|
63
|
-
|
64
|
-
<p class="link">Object
|
65
|
-
|
66
|
-
</nav>
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
<!-- Method Quickref -->
|
71
|
-
<nav id="method-list-section" class="section">
|
72
|
-
<h3 class="section-header">Methods</h3>
|
73
|
-
|
74
|
-
<ul class="link-list">
|
75
|
-
|
76
|
-
<li ><a href="#method-c-new">::new</a>
|
77
|
-
|
78
|
-
<li ><a href="#method-i-compile">#compile</a>
|
79
|
-
|
80
|
-
</ul>
|
81
|
-
</nav>
|
82
|
-
|
83
|
-
</div>
|
84
|
-
|
85
|
-
<div id="project-metadata">
|
86
|
-
|
87
|
-
<nav id="classindex-section" class="section project-section">
|
88
|
-
<h3 class="section-header">Class and Module Index</h3>
|
89
|
-
|
90
|
-
<ul class="link-list">
|
91
|
-
|
92
|
-
<li><a href="../NetLinx.html">NetLinx</a>
|
93
|
-
|
94
|
-
<li><a href="../NetLinx/Compile.html">NetLinx::Compile</a>
|
95
|
-
|
96
|
-
<li><a href="../NetLinx/Compile/Extension.html">NetLinx::Compile::Extension</a>
|
97
|
-
|
98
|
-
<li><a href="../NetLinx/Compile/Extension/AXS.html">NetLinx::Compile::Extension::AXS</a>
|
99
|
-
|
100
|
-
<li><a href="../NetLinx/Compile/ExtensionDiscovery.html">NetLinx::Compile::ExtensionDiscovery</a>
|
101
|
-
|
102
|
-
<li><a href="../NetLinx/Compile/ExtensionHandler.html">NetLinx::Compile::ExtensionHandler</a>
|
103
|
-
|
104
|
-
<li><a href="../NetLinx/Compile/Script.html">NetLinx::Compile::Script</a>
|
105
|
-
|
106
|
-
<li><a href="../NetLinx/Compiler.html">NetLinx::Compiler</a>
|
107
|
-
|
108
|
-
<li><a href="../NetLinx/CompilerResult.html">NetLinx::CompilerResult</a>
|
109
|
-
|
110
|
-
<li><a href="../NetLinx/NoCompilerError.html">NetLinx::NoCompilerError</a>
|
111
|
-
|
112
|
-
<li><a href="../NetLinx/SourceFile.html">NetLinx::SourceFile</a>
|
113
|
-
|
114
|
-
<li><a href="../Test.html">Test</a>
|
336
|
+
<span class='id identifier rubyid_default_paths'>default_paths</span> <span class='op'>=</span> <span class='lbracket'>[</span>
|
337
|
+
<span class='id identifier rubyid_user_specified_path'>user_specified_path</span><span class='comma'>,</span>
|
338
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>C:\Program Files (x86)\Common Files\AMXShare\COM</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='comment'># 64-bit O/S path
|
339
|
+
</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>C:\Program Files\Common Files\AMXShare\COM</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='comment'># 32-bit O/S path
|
340
|
+
</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>~/.wine/drive_c/Program Files/Common Files/AMXShare/COM</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='comment'># Wine path
|
341
|
+
</span> <span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
|
115
342
|
|
116
|
-
|
343
|
+
<span class='comment'># Check for NetLinx compiler.
|
344
|
+
</span> <span class='id identifier rubyid_default_paths'>default_paths</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
|
345
|
+
<span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='ivar'>@compiler_exe</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
346
|
+
<span class='ivar'>@compiler_path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
|
347
|
+
<span class='kw'>break</span>
|
348
|
+
<span class='kw'>end</span>
|
349
|
+
<span class='kw'>end</span>
|
117
350
|
|
118
|
-
|
351
|
+
<span class='comment'># ---------------------------------------------------------
|
352
|
+
</span> <span class='comment'># TODO: Check if the compiler was added to the system path.
|
353
|
+
</span> <span class='comment'># Execute system(@compiler_exe).
|
354
|
+
</span> <span class='comment'># ---------------------------------------------------------
|
355
|
+
</span>
|
356
|
+
<span class='comment'># Compiler not found.
|
357
|
+
</span> <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../NetLinx.html" title="NetLinx (module)">NetLinx</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NoCompilerError.html" title="NetLinx::NoCompilerError (class)">NoCompilerError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The NetLinx compiler (</span><span class='embexpr_beg'>#{</span><span class='ivar'>@compiler_exe</span><span class='embexpr_end'>}</span><span class='tstring_content'>) could not be found on the system.</span><span class='tstring_end'>"</span></span> \
|
358
|
+
<span class='kw'>unless</span> <span class='ivar'>@compiler_path</span>
|
359
|
+
<span class='kw'>end</span></pre>
|
360
|
+
</td>
|
361
|
+
</tr>
|
362
|
+
</table>
|
363
|
+
</div>
|
364
|
+
|
365
|
+
</div>
|
366
|
+
|
367
|
+
|
368
|
+
<div id="instance_method_details" class="method_details_list">
|
369
|
+
<h2>Instance Method Details</h2>
|
370
|
+
|
371
|
+
|
372
|
+
<div class="method_details first">
|
373
|
+
<h3 class="signature first" id="compile-instance_method">
|
374
|
+
|
375
|
+
#<strong>compile</strong>(compilable) ⇒ <tt>Object</tt>
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
</h3><div class="docstring">
|
382
|
+
<div class="discussion">
|
383
|
+
|
384
|
+
<p>Compile the specified object with the NetLinx compiler.</p>
|
385
|
+
|
386
|
+
|
387
|
+
</div>
|
388
|
+
</div>
|
389
|
+
<div class="tags">
|
390
|
+
|
391
|
+
|
392
|
+
<p class="tag_title">See Also:</p>
|
393
|
+
<ul class="see">
|
394
|
+
|
395
|
+
<li>Test::NetLinx::Compilable.</li>
|
396
|
+
|
397
|
+
</ul>
|
398
|
+
|
399
|
+
</div><table class="source_code">
|
400
|
+
<tr>
|
401
|
+
<td>
|
402
|
+
<pre class="lines">
|
403
|
+
|
404
|
+
|
405
|
+
53
|
406
|
+
54
|
407
|
+
55
|
408
|
+
56
|
409
|
+
57
|
410
|
+
58
|
411
|
+
59
|
412
|
+
60
|
413
|
+
61
|
414
|
+
62
|
415
|
+
63
|
416
|
+
64
|
417
|
+
65
|
418
|
+
66
|
419
|
+
67
|
420
|
+
68
|
421
|
+
69
|
422
|
+
70
|
423
|
+
71
|
424
|
+
72
|
425
|
+
73
|
426
|
+
74
|
427
|
+
75
|
428
|
+
76
|
429
|
+
77
|
430
|
+
78
|
431
|
+
79
|
432
|
+
80
|
433
|
+
81
|
434
|
+
82
|
435
|
+
83
|
436
|
+
84
|
437
|
+
85
|
438
|
+
86
|
439
|
+
87
|
440
|
+
88
|
441
|
+
89
|
442
|
+
90
|
443
|
+
91
|
444
|
+
92</pre>
|
445
|
+
</td>
|
446
|
+
<td>
|
447
|
+
<pre class="code"><span class="info file"># File 'lib/netlinx/compiler.rb', line 53</span>
|
448
|
+
|
449
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_compile'>compile</span><span class='lparen'>(</span><span class='id identifier rubyid_compilable'>compilable</span><span class='rparen'>)</span>
|
450
|
+
<span class='id identifier rubyid_compiler'>compiler</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span> <span class='ivar'>@compiler_exe</span><span class='comma'>,</span> <span class='ivar'>@compiler_path</span>
|
451
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
119
452
|
|
120
|
-
|
121
|
-
|
122
|
-
<
|
123
|
-
|
124
|
-
<li><a href="../Test/NetLinx/Compile/Invokable.html">Test::NetLinx::Compile::Invokable</a>
|
125
|
-
|
126
|
-
</ul>
|
127
|
-
</nav>
|
128
|
-
|
129
|
-
</div>
|
130
|
-
</nav>
|
131
|
-
|
132
|
-
<div id="documentation">
|
133
|
-
<h1 class="class">class NetLinx::Compiler</h1>
|
134
|
-
|
135
|
-
<div id="description" class="description">
|
136
|
-
|
137
|
-
<p>A wrapper class for the AMX <a href="../NetLinx.html">NetLinx</a> compiler
|
138
|
-
executable (nlrc.exe).</p>
|
139
|
-
|
140
|
-
</div><!-- description -->
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
<!-- Methods -->
|
155
|
-
|
156
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
157
|
-
<h3 class="section-header">Public Class Methods</h3>
|
158
|
-
|
159
|
-
|
160
|
-
<div id="method-c-new" class="method-detail ">
|
161
|
-
|
162
|
-
<div class="method-heading">
|
163
|
-
<span class="method-name">new</span><span
|
164
|
-
class="method-args">(**kvargs)</span>
|
165
|
-
|
166
|
-
<span class="method-click-advice">click to toggle source</span>
|
167
|
-
|
168
|
-
</div>
|
169
|
-
|
170
|
-
|
171
|
-
<div class="method-description">
|
172
|
-
|
173
|
-
<p>Checks for the AMX <a href="../NetLinx.html">NetLinx</a> compiler
|
174
|
-
(third-party software, nlrc.exe) at the default installation path. This can
|
175
|
-
be overridden by specifying :compiler_path.</p>
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
<div class="method-source-code" id="new-source">
|
181
|
-
<pre><span class="ruby-comment"># File lib/netlinx/compiler.rb, line 13</span>
|
182
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">kvargs</span>)
|
183
|
-
<span class="ruby-ivar">@compiler_exe</span> = <span class="ruby-string">'nlrc.exe'</span>
|
184
|
-
|
185
|
-
<span class="ruby-ivar">@compiler_path</span> = <span class="ruby-identifier">kvargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:compiler_path</span>,
|
186
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">'C:\Program Files (x86)\Common Files\AMXShare\COM'</span>) <span class="ruby-comment"># 64-bit O/S path</span>
|
187
|
-
|
188
|
-
<span class="ruby-comment"># Check for NetLinx compiler at :compiler_path or the 64-bit O/S path.</span>
|
189
|
-
<span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">'nlrc.exe'</span>, <span class="ruby-ivar">@compiler_path</span>)
|
190
|
-
<span class="ruby-comment"># Compiler not found. Try 32-bit O/S path.</span>
|
191
|
-
<span class="ruby-ivar">@compiler_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">'C:\Program Files\Common Files\AMXShare\COM'</span>)
|
192
|
-
<span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">'nlrc.exe'</span>, <span class="ruby-ivar">@compiler_path</span>)
|
193
|
-
<span class="ruby-comment"># ---------------------------------------------------------</span>
|
194
|
-
<span class="ruby-comment"># TODO: Check if the compiler was added to the system path.</span>
|
195
|
-
<span class="ruby-comment"># Execute system('nlrc').</span>
|
196
|
-
<span class="ruby-comment"># ---------------------------------------------------------</span>
|
197
|
-
|
198
|
-
<span class="ruby-comment"># Compiler not found.</span>
|
199
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NetLinx</span><span class="ruby-operator">::</span><span class="ruby-constant">NoCompilerError</span>, <span class="ruby-string">'The NetLinx compiler (nlrc.exe) could not be found on the system.'</span>
|
200
|
-
<span class="ruby-keyword">end</span>
|
201
|
-
<span class="ruby-keyword">end</span>
|
202
|
-
<span class="ruby-keyword">end</span></pre>
|
203
|
-
</div><!-- new-source -->
|
204
|
-
|
205
|
-
</div>
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
</div><!-- new-method -->
|
211
|
-
|
212
|
-
|
213
|
-
</section><!-- public-class-method-details -->
|
214
|
-
|
215
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
216
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
217
|
-
|
218
|
-
|
219
|
-
<div id="method-i-compile" class="method-detail ">
|
220
|
-
|
221
|
-
<div class="method-heading">
|
222
|
-
<span class="method-name">compile</span><span
|
223
|
-
class="method-args">(compilable)</span>
|
224
|
-
|
225
|
-
<span class="method-click-advice">click to toggle source</span>
|
226
|
-
|
227
|
-
</div>
|
228
|
-
|
229
|
-
|
230
|
-
<div class="method-description">
|
231
|
-
|
232
|
-
<p><a href="Compile.html">Compile</a> the specified object with the <a
|
233
|
-
href="../NetLinx.html">NetLinx</a> compiler. See <a
|
234
|
-
href="../Test/NetLinx/Compilable.html">Test::NetLinx::Compilable</a>.</p>
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
<div class="method-source-code" id="compile-source">
|
240
|
-
<pre><span class="ruby-comment"># File lib/netlinx/compiler.rb, line 37</span>
|
241
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">compilable</span>)
|
242
|
-
<span class="ruby-identifier">compiler</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-ivar">@compiler_exe</span>, <span class="ruby-ivar">@compiler_path</span>
|
243
|
-
<span class="ruby-identifier">result</span> = []
|
244
|
-
|
245
|
-
<span class="ruby-identifier">compilable</span>.<span class="ruby-identifier">compiler_target_files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">target_file</span><span class="ruby-operator">|</span>
|
246
|
-
<span class="ruby-comment"># Construct paths.</span>
|
247
|
-
<span class="ruby-identifier">include_paths</span> = <span class="ruby-node">"-I#{compilable.compiler_include_paths.join ';'}"</span> <span class="ruby-keyword">unless</span>
|
248
|
-
<span class="ruby-identifier">compilable</span>.<span class="ruby-identifier">compiler_include_paths</span>.<span class="ruby-identifier">empty?</span>
|
453
|
+
<span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_target_files'>compiler_target_files</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_target_file'>target_file</span><span class='op'>|</span>
|
454
|
+
<span class='comment'># Construct paths.
|
455
|
+
</span> <span class='id identifier rubyid_include_paths'>include_paths</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-I</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_include_paths'>compiler_include_paths</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>;</span><span class='tstring_end'>'</span></span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span>
|
456
|
+
<span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_include_paths'>compiler_include_paths</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
249
457
|
|
250
|
-
<span class=
|
251
|
-
<span class=
|
458
|
+
<span class='id identifier rubyid_module_paths'>module_paths</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-M</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_module_paths'>compiler_module_paths</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>;</span><span class='tstring_end'>'</span></span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span>
|
459
|
+
<span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_module_paths'>compiler_module_paths</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
252
460
|
|
253
|
-
<span class=
|
254
|
-
<span class=
|
461
|
+
<span class='id identifier rubyid_library_paths'>library_paths</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-L</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_library_paths'>compiler_library_paths</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>;</span><span class='tstring_end'>'</span></span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span>
|
462
|
+
<span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_library_paths'>compiler_library_paths</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
255
463
|
|
256
|
-
<span class=
|
257
|
-
<span class=
|
258
|
-
<span class=
|
259
|
-
<span class=
|
464
|
+
<span class='comment'># Run the NetLinx compiler.
|
465
|
+
</span> <span class='comment'># Note: NLRC.exe v2.1 freaks out if empty arguments ("") are in the command.
|
466
|
+
</span> <span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
467
|
+
<span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>wine </span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='ivar'>@use_wine</span> <span class='kw'>or</span> <span class='id identifier rubyid_compiler'>compiler</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/.wine/</span><span class='tstring_end'>'</span></span>
|
468
|
+
<span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_compiler'>compiler</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_target_file'>target_file</span><span class='embexpr_end'>}</span><span class='tstring_content'>\"</span><span class='tstring_end'>"</span></span>
|
469
|
+
<span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_include_paths'>include_paths</span><span class='embexpr_end'>}</span><span class='tstring_content'>\"</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_include_paths'>include_paths</span>
|
470
|
+
<span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_module_paths'>module_paths</span><span class='embexpr_end'>}</span><span class='tstring_content'>\"</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_module_paths'>module_paths</span>
|
471
|
+
<span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_library_paths'>library_paths</span><span class='embexpr_end'>}</span><span class='tstring_content'>\"</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_library_paths'>library_paths</span>
|
260
472
|
|
261
|
-
<span class=
|
262
|
-
<span class=
|
263
|
-
|
264
|
-
<span class="ruby-identifier">compiler_include_paths</span><span class="ruby-operator">:</span> <span class="ruby-identifier">compilable</span>.<span class="ruby-identifier">compiler_include_paths</span>,
|
265
|
-
<span class="ruby-identifier">compiler_module_paths</span><span class="ruby-operator">:</span> <span class="ruby-identifier">compilable</span>.<span class="ruby-identifier">compiler_module_paths</span>,
|
266
|
-
<span class="ruby-identifier">compiler_library_paths</span><span class="ruby-operator">:</span> <span class="ruby-identifier">compilable</span>.<span class="ruby-identifier">compiler_library_paths</span>,
|
267
|
-
<span class="ruby-identifier">stream</span><span class="ruby-operator">:</span> <span class="ruby-identifier">stream</span>
|
268
|
-
)
|
269
|
-
<span class="ruby-keyword">end</span>
|
270
|
-
|
271
|
-
<span class="ruby-identifier">result</span>
|
272
|
-
<span class="ruby-keyword">end</span></pre>
|
273
|
-
</div><!-- compile-source -->
|
274
|
-
|
275
|
-
</div>
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
</div><!-- compile-method -->
|
281
|
-
|
473
|
+
<span class='id identifier rubyid_io'>io</span> <span class='op'>=</span> <span class='const'>IO</span><span class='period'>.</span><span class='id identifier rubyid_popen'>popen</span> <span class='id identifier rubyid_cmd'>cmd</span>
|
474
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'>=</span> <span class='id identifier rubyid_io'>io</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span>
|
475
|
+
<span class='id identifier rubyid_io'>io</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
282
476
|
|
283
|
-
|
477
|
+
<span class='comment'># Build the result.
|
478
|
+
</span> <span class='id identifier rubyid_result'>result</span> <span class='op'><<</span> <span class='const'><span class='object_link'><a href="../NetLinx.html" title="NetLinx (module)">NetLinx</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CompilerResult.html" title="NetLinx::CompilerResult (class)">CompilerResult</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="CompilerResult.html#initialize-instance_method" title="NetLinx::CompilerResult#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
479
|
+
<span class='label'>compiler_target_files:</span> <span class='lbracket'>[</span><span class='id identifier rubyid_target_file'>target_file</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
480
|
+
<span class='label'>compiler_include_paths:</span> <span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_include_paths'>compiler_include_paths</span><span class='comma'>,</span>
|
481
|
+
<span class='label'>compiler_module_paths:</span> <span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_module_paths'>compiler_module_paths</span><span class='comma'>,</span>
|
482
|
+
<span class='label'>compiler_library_paths:</span> <span class='id identifier rubyid_compilable'>compilable</span><span class='period'>.</span><span class='id identifier rubyid_compiler_library_paths'>compiler_library_paths</span><span class='comma'>,</span>
|
483
|
+
<span class='label'>stream:</span> <span class='id identifier rubyid_stream'>stream</span>
|
484
|
+
<span class='rparen'>)</span>
|
485
|
+
<span class='kw'>end</span>
|
284
486
|
|
285
|
-
|
286
|
-
|
287
|
-
</
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
</
|
295
|
-
|
487
|
+
<span class='id identifier rubyid_result'>result</span>
|
488
|
+
<span class='kw'>end</span></pre>
|
489
|
+
</td>
|
490
|
+
</tr>
|
491
|
+
</table>
|
492
|
+
</div>
|
493
|
+
|
494
|
+
</div>
|
495
|
+
|
496
|
+
</div>
|
497
|
+
|
498
|
+
<div id="footer">
|
499
|
+
Generated on Sat Jul 11 17:29:50 2020 by
|
500
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
501
|
+
0.9.25 (ruby-2.7.1).
|
502
|
+
</div>
|
503
|
+
|
504
|
+
</div>
|
505
|
+
</body>
|
506
|
+
</html>
|