mucgly 0.0.2 → 0.1.0

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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.rdoc +8 -0
  3. data/LICENSE +1 -1
  4. data/README.rdoc +160 -130
  5. data/bin/mucgly +4 -217
  6. data/doc/Mucgly.html +24 -82
  7. data/doc/_index.html +5 -153
  8. data/doc/class_list.html +7 -2
  9. data/doc/css/style.css +2 -1
  10. data/doc/file.CHANGELOG.html +16 -8
  11. data/doc/file.README.html +210 -187
  12. data/doc/file_list.html +6 -1
  13. data/doc/frames.html +5 -7
  14. data/doc/index.html +210 -187
  15. data/doc/js/app.js +7 -2
  16. data/doc/js/full_list.js +9 -6
  17. data/doc/method_list.html +7 -686
  18. data/doc/top-level-namespace.html +5 -5
  19. data/ext/mucgly/extconf.rb +11 -0
  20. data/ext/mucgly/mucgly.c +2095 -0
  21. data/lib/version.rb +6 -0
  22. data/test/golden/test_basic.txt +18 -0
  23. data/test/golden/test_specials_cli.txt +11 -0
  24. data/test/golden/test_specials_cmd.txt +36 -0
  25. data/test/result/test_basic.txt +18 -0
  26. data/test/result/test_specials_cli.txt +11 -0
  27. data/test/result/test_specials_cmd.txt +36 -0
  28. data/test/result/test_specials_cmd2.txt +1 -0
  29. data/test/test_basic.rx.txt +10 -6
  30. data/test/test_mucgly.rb +4 -6
  31. data/test/test_specials_cli.rx.txt +4 -4
  32. data/test/test_specials_cmd.rx.txt +5 -5
  33. metadata +45 -63
  34. data/Rakefile +0 -29
  35. data/doc/EasyFile/InOut.html +0 -2097
  36. data/doc/EasyFile/Read.html +0 -1334
  37. data/doc/EasyFile/ReadStack.html +0 -461
  38. data/doc/EasyFile/Stacked.html +0 -411
  39. data/doc/EasyFile/String.html +0 -570
  40. data/doc/EasyFile/Write.html +0 -1084
  41. data/doc/EasyFile/WriteStack.html +0 -305
  42. data/doc/EasyFile.html +0 -155
  43. data/doc/Mucgly/Env.html +0 -1675
  44. data/doc/Mucgly/MucglyFile/ParseState.html +0 -1662
  45. data/doc/Mucgly/MucglyFile/Token.html +0 -529
  46. data/doc/Mucgly/MucglyFile.html +0 -545
  47. data/doc/Mucgly/Separators.html +0 -521
  48. data/lib/easyfile.rb +0 -720
  49. data/lib/mucgly.rb +0 -627
  50. data/test/test_multi.rx.txt +0 -4
data/doc/frames.html CHANGED
@@ -4,18 +4,16 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Documentation by YARD 0.8.6.1</title>
7
+ <title>Documentation by YARD 0.8.7.6</title>
8
8
  </head>
9
9
  <script type="text/javascript" charset="utf-8">
10
10
  window.onload = function() {
11
- var match = window.location.hash.match(/^#!(.+)/);
12
- var name = 'index.html';
13
- if (match) {
14
- name = unescape(match[1]);
15
- }
11
+ var match = unescape(window.location.hash).match(/^#!(.+)/);
12
+ var name = match ? match[1] : 'index.html';
13
+ name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
16
14
  document.writeln('<frameset cols="20%,*">' +
17
15
  '<frame name="list" src="class_list.html" />' +
18
- '<frame name="main" src="' + name + '" />' +
16
+ '<frame name="main" src="' + escape(name) + '" />' +
19
17
  '</frameset>');
20
18
  }
21
19
  </script>
data/doc/index.html CHANGED
@@ -2,11 +2,11 @@
2
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
4
  <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.6.1
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
@@ -17,7 +17,7 @@
17
17
  <script type="text/javascript" charset="utf-8">
18
18
  hasFrames = window.top.frames.main ? true : false;
19
19
  relpath = '';
20
- framesUrl = "frames.html#!" + escape(window.location.href);
20
+ framesUrl = "frames.html#!file.README.html";
21
21
  </script>
22
22
 
23
23
 
@@ -62,273 +62,289 @@
62
62
  <iframe id="search_frame"></iframe>
63
63
 
64
64
  <div id="content"><div id='filecontents'>
65
- <h1>Mucgly</h1>
65
+ <h1 id="label-Mucgly">Mucgly</h1>
66
66
 
67
- <h2>Introduction</h2>
67
+ <h2 id="label-Introduction">Introduction</h2>
68
68
 
69
69
  <p>Mucgly is a macro expander for inline macros that exist in the middle of
70
- body text. The macros are mostly regular Ruby code, but a few special
71
- commands is also provided.</p>
70
+ body text. The macros are expected to be mostly regular Ruby code, but a
71
+ few special commands are also available.</p>
72
72
 
73
73
  <p>A very simple example:</p>
74
74
 
75
- <pre class="code ruby"><code class="ruby">Adding 1 + 3 results: -&lt;write (1+3).to_s&gt;-</code></pre>
75
+ <pre class="code ruby"><code class="ruby">Adding 1 + 3 results to: -&lt;.1+3&gt;-</code></pre>
76
76
 
77
77
  <p>After macro expansion the results is:</p>
78
78
 
79
- <pre class="code ruby"><code class="ruby">Adding 1 + 3 results: 4</code></pre>
79
+ <pre class="code ruby"><code class="ruby">Adding 1 + 3 results to: 4</code></pre>
80
80
 
81
- <p>By default macro starts with "-&lt;" and ends with "&gt;-". These limiters
82
- are called hooks, hookbeg and hookend respectively. The code between hooks
83
- is regular Ruby code. The "write" call writes to selected IO stream.</p>
81
+ <p>By default macro starts with “-&lt;” and ends with “&gt;-”. These limiters
82
+ are called hooks, hookbeg and hookend, respectively. The code between hooks
83
+ is mostly regular Ruby code. The first character is special syntax and the
84
+ rest is pure Ruby code. The special character (command) “.” is used to
85
+ print the Ruby code evaluation value to current output file (stream).</p>
84
86
 
85
- <p>Ruby code is executed within a class instance reserved for this purpose.
86
- The instance is called the Execution Environment. It enables values from
87
- one macro to be visible in others.</p>
87
+ <p>Sample session to execute the example above:</p>
88
88
 
89
- <p>Previous example with multiple macros:</p>
90
-
91
- <pre class="code ruby"><code class="ruby">-&lt;@a = 1&gt;--&lt;@b = 3&gt;-\
92
- Adding 1 + 3 results: -&lt;write (@a+@b).to_s&gt;-</code></pre>
89
+ <pre class="code ruby"><code class="ruby">shell&gt; mucgly
90
+ Adding 1 + 3 results to: -&lt;.1+3&gt;-
91
+ Adding 1 + 3 results to: 4
92
+ &lt;Ctrl-D&gt;
93
+ shell&gt;</code></pre>
93
94
 
94
- <p>Result is exactly the same as in the previous execution. The first macro
95
- "-&lt;@a = 1&gt;-" produces no output, it just sets the variable "@a" to
96
- "1". Second macro is similar. The default "escape" character is "\". When
97
- placed before newline character, it "eats" the newline and nothing is
98
- output. Thus the first line outputs nothing.</p>
95
+ <p>Ruby code is always executed in the Ruby interpreters “&lt;main&gt;” scope.</p>
99
96
 
100
- <p>The second line refers to settings from previous macros. Instance variables
101
- has to be used to maintain the data between macro calls (due to instance
102
- evaluation).</p>
97
+ <p>Previous example with multiple macros:</p>
103
98
 
104
- <h2>Features</h2>
99
+ <pre class="code ruby"><code class="ruby">-&lt;@a = 1&gt;--&lt;@b = 3&gt;-\
100
+ Adding 1 + 3 results to: -&lt;Mucgly.write(@a+@b)&gt;-</code></pre>
101
+
102
+ <p>Result is exactly the same as in the previous execution, but the Ruby code
103
+ is distributed into multiple segments. The first macro “-&lt;@a = 1&gt;-”
104
+ produces no output, it just sets the variable “@a” to “1”. Second macro is
105
+ similar. The default “escape” character (hookesc) is “\”. When placed
106
+ before newline character, it “eats” the newline and nothing is output. Thus
107
+ the first line outputs nothing.</p>
108
+
109
+ <p>The macro on the second line refers to settings from previous macros.
110
+ Instance variables has to be used to share data between macro calls (due to
111
+ “&lt;main&gt;” evaluation). Local variables are not persistent enough.
112
+ Mucgly module method, “Mucgly.write”, is used to write out the calculation
113
+ result. Mucgly module is defined within Mucgly utility.</p>
114
+
115
+ <h2 id="label-Features">Features</h2>
105
116
  <ul><li>
106
117
  <p>User settable hooks to define macro boundaries. Can be set from command
107
- line, configuration files, or from macro file.</p>
118
+ line, configuration files, or from macro input file.</p>
108
119
  </li><li>
109
120
  <p>Multiple sources for configuration: default config, environment variable,
110
121
  command line.</p>
111
122
  </li><li>
112
- <p>Multiple passes for macro file.</p>
113
- </li><li>
114
- <p>Convention based output file naming.</p>
123
+ <p>Multipass support.</p>
115
124
  </li><li>
116
125
  <p>Multiple convenience functions for macros to use.</p>
117
126
  </li><li>
118
- <p>Macro file introspection: line number, file name</p>
127
+ <p>Macro file introspection: line number, file name.</p>
119
128
  </li><li>
120
- <p>Output stream de-muxing.</p>
129
+ <p>Output stream redirection (de-muxing).</p>
121
130
  </li><li>
122
- <p>Many special commands: include, source, etc...</p>
131
+ <p>Many special commands: include, source, etc…</p>
132
+ </li><li>
133
+ <p>Fast C-language based macro file processing.</p>
123
134
  </li></ul>
124
135
 
125
- <h2>Applications</h2>
136
+ <h2 id="label-Applications">Applications</h2>
126
137
  <ul><li>
127
138
  <p>Replacement for M4 macro processor.</p>
128
139
  </li><li>
129
- <p>Code generation.</p>
140
+ <p>Ruby pre-processor.</p>
141
+ </li><li>
142
+ <p>General purpose code generation.</p>
130
143
  </li><li>
131
144
  <p>Document formatting.</p>
132
145
  </li><li>
133
146
  <p>Etc.</p>
134
147
  </li></ul>
135
148
 
136
- <h2>Special characters</h2>
149
+ <h2 id="label-Special+characters">Special characters</h2>
137
150
 
138
- <h3>Hooks</h3>
151
+ <h3 id="label-Hooks">Hooks</h3>
139
152
 
140
- <p>Hooks start and end the macro definition. By default hookbeg is "-&lt;" and
141
- hookend is "&gt;-". These values are not easily conflicting with the macro
142
- file body text.</p>
153
+ <p>Hooks start and end the macro definition. By default hookbeg is “-&lt;” and
154
+ hookend is “&gt;-”. These values are not easily conflicting with typical
155
+ macro file body text.</p>
143
156
 
144
- <p>If literal hook string is required, the escape character should be place
145
- before the hook. For example "-&lt;" will produce literal "-&lt;" to the
146
- output.</p>
157
+ <p>If literal hook string is required in the output, the hookesc sequence
158
+ should be place before the hook. For example “\-&lt;” will produce literal
159
+ “-&lt;” to the output. “\” is the default hookesc value.</p>
147
160
 
148
161
  <p>User can set the hooks to whatever string value desired. The hooks can also
149
162
  have the same value. However nested macros are not possible then. Hooks can
150
- also be the same as the escape character, but this makes usage somewhat
163
+ also be the same as the escape sequence, but this makes usage somewhat
151
164
  complicated.</p>
152
165
 
153
- <h3>Escape</h3>
166
+ <h3 id="label-Escape">Escape</h3>
154
167
 
155
- <p>Default escape character is "\". It can be used to escape hooks, cancel
156
- space (" ") output, and cancel newline ("\n") output.</p>
168
+ <p>Default hookesc (escape sequence) is “\”. It can be used to escape hooks,
169
+ cancel space ( ) output, and cancel newline (“\n) output.</p>
157
170
 
158
- <p>User can set the escape character to any character. Only single character
159
- value is accepted.</p>
171
+ <p>User can set the escape sequence to any character(s).</p>
160
172
 
161
- <h3>Multipass</h3>
173
+ <h3 id="label-Single+char+hooks+and+escape">Single char hooks and escape</h3>
162
174
 
163
- <p>If the macro starts with "#" character, the macro is not expanded. One "#"
164
- character is removed and the rest of the macro is output as it is. Each
165
- pass will remove one "#" character and when all are removed, the macro is
166
- evaluated. Usually two passes are enough and one "#" character is used to
167
- save a macro to the later pass.</p>
175
+ <p>If all hooks are single character (including hookesc) and have the same
176
+ value, there are some additional rules that are used to identify macro
177
+ boundaries and escapes. Let&#39;s assume that the selected hook char is “|”
178
+ (vertical bar).</p>
168
179
 
169
- <p>Multipass can be used for example to create a Table Of Contents. First pass
170
- collects information about document content and second pass will insert the
171
- Table Of Contents.</p>
180
+ <p>Escape is detected if “| ”, “|\n”, or “||” is seen in the input, when
181
+ outside macro. Escape is detected within macro if “||” is seen in input.</p>
172
182
 
173
- <p>Example, with functions (insert_toc, header...) defined elsewhere:</p>
183
+ <p>Hookbeg is detected at “|” if outside macro. Hookend is detected at “|” if
184
+ inside macro. Thus if literal “|” is needed inside macro, then “||” must be
185
+ used. Also expressing multilevel macros (macro in macro) is not possible,
186
+ since hookbeg is never detected within macro. The default hook values can
187
+ be used for nested macros (if desired).</p>
174
188
 
175
- <pre class="code ruby"><code class="ruby">-&lt;#insert_toc&gt;-
176
- -&lt;header(1, &quot;My header 1&quot;)&gt;-
177
- Paragraph1
178
- -&lt;header(2, &quot;My header 1.1&quot;)&gt;-
179
- Paragraph2
180
- -&lt;header(1, &quot;My header 2&quot;)&gt;-
181
- Paragraph3</code></pre>
182
-
183
- <h2>Special commands</h2>
189
+ <h2 id="label-Special+commands">Special commands</h2>
184
190
 
185
191
  <p>In addition to regular Ruby code the macros are allowed to include so
186
- called Special Commands. These commands start with the ":" characters and
187
- with ".".</p>
192
+ called Special Commands. These commands start with the “:” characters or
193
+ with “.”.</p>
194
+
195
+ <h3 id="label-Named+commands">Named commands</h3>
188
196
 
189
- <p>Example:</p>
197
+ <p>Example for named command:</p>
190
198
 
191
- <pre class="code ruby"><code class="ruby">...
192
- -&lt;:hook [ ]-&gt;\
199
+ <pre class="code ruby"><code class="ruby"> ...
200
+ -&lt;:hook [ ]&gt;-\
193
201
  ...</code></pre>
194
202
 
195
- <p>Would change the hookbeg and hookend to "[" and "]" respectively. One
196
- special command is allowed per macro and it can't be mixed normal Ruby
197
- code. Command name is separated by ":" in the beginning and by space (" ")
198
- in the end. The rest of the macro is taken as argument to the macro. Note
199
- that a command without an argument has to end with space as well.</p>
203
+ <p>Would change the hookbeg and hookend to [ and ] respectively. Note that
204
+ hooks are changed only for the current input file. If for example an
205
+ included input file changes hooks, the includer file still uses the
206
+ original hooks.</p>
200
207
 
201
- <p>List of ":" style special commands:</p>
202
- <dl class="rdoc-list"><dt>include</dt>
208
+ <p>One special command is allowed per macro and it can&#39;t be mixed normal
209
+ Ruby code. Command name is separated by “:” in the beginning and by space
210
+ (“ ”) in the end. The rest of the macro is taken as argument to the
211
+ command.</p>
212
+
213
+ <p>List of “:” style special commands:</p>
214
+ <dl class="rdoc-list label-list"><dt>include
203
215
  <dd>
204
216
  <p>Include reverts the input stream to the file given in the argument. Command
205
- can be used to multiplex multiple files into one, for example.</p>
206
- </dd><dt>output</dt>
207
- <dd>
208
- <p>Select a new output file. Use with "close" command, when the new output
209
- file is ready.</p>
210
- </dd><dt>comment</dt>
217
+ can be used for example to multiplex multiple files into one (example:
218
+ “-&lt;:include input.txt&gt;-” ).</p>
219
+ </dd><dt>comment
211
220
  <dd>
212
221
  <p>Comment is used to add comments into the macro file. No output is produced
213
222
  from comment macros.</p>
214
- </dd><dt>source</dt>
223
+ </dd><dt>source
215
224
  <dd>
216
225
  <p>Source reads a plain Ruby file into the Execution Environment.</p>
217
- </dd><dt>hook</dt>
226
+ </dd><dt>hook
218
227
  <dd>
219
- <p>Sets both hookbeg and hookend to values separated by space. The new hook
220
- values are valid immediately after the enclosing macro.</p>
221
- </dd><dt>hookbeg</dt>
228
+ <p>Sets both hookbeg and hookend to values separated by space. Without space
229
+ hookbeg and hookend are set to same value.</p>
230
+ </dd><dt>hookbeg
222
231
  <dd>
223
232
  <p>Sets hookbeg.</p>
224
- </dd><dt>hookend</dt>
233
+ </dd><dt>hookend
225
234
  <dd>
226
235
  <p>Sets hookend.</p>
227
- </dd><dt>escape</dt>
236
+ </dd><dt>hookesc
237
+ <dd>
238
+ <p>Sets escape sequence.</p>
239
+ </dd><dt>hookall
228
240
  <dd>
229
- <p>Sets escape character.</p>
230
- </dd><dt>exit</dt>
241
+ <p>Sets hookbeg, hookend, and hookesc to same value.</p>
242
+ </dd><dt>exit
231
243
  <dd>
232
- <p>Aborts the macro file.</p>
244
+ <p>Aborts the macro processing (file).</p>
233
245
  </dd></dl>
234
246
 
235
- <p>Variable value reference command starts with "." and is followed by the
236
- (instance) variable name.</p>
247
+ <h3 id="label-Quick+commands">Quick commands</h3>
248
+
249
+ <p>Special write command starts with “.” and is followed by the Ruby value.</p>
237
250
 
238
251
  <p>For example:</p>
239
252
 
240
- <pre class="code ruby"><code class="ruby">... -&lt;.my_name&gt;- ...</code></pre>
253
+ <pre class="code ruby"><code class="ruby">... -&lt;.@my_name&gt;- ...</code></pre>
241
254
 
242
- <p>Would write out the value of the "@my_name" variable, thus it is equal to
255
+ <p>Would write out the value of the “@my_name variable, thus it is equal to
243
256
  writing:</p>
244
257
 
245
- <pre class="code ruby"><code class="ruby">... -&lt;write @my_name&gt;- ...</code></pre>
258
+ <pre class="code ruby"><code class="ruby">... -&lt;Mucgly.write @my_name&gt;- ...</code></pre>
246
259
 
247
- <h2>API methods</h2>
260
+ <p>The special character “/” can also be used for comment macro, i.e. “/” is
261
+ same as “:comment ”.</p>
248
262
 
249
- <p>API methods are instance methods of the Execution Environment, i.e. they
250
- are predefined and visible for the macro code. These methods are organized
251
- into two categories: Published and Hidden.</p>
263
+ <h3 id="label-Multipass">Multipass</h3>
252
264
 
253
- <h3>Published methods</h3>
265
+ <p>If the macro starts with “#” character, the macro is not excuted. The macro
266
+ content is output with “#” removed from the output, including the current
267
+ macro hooks. If 3 passes are needed, then “##” can be placed to the initial
268
+ macro file. Multipass macro files are processes by (shell) piping the
269
+ output of Mucgly to another Mucgly process.</p>
254
270
 
255
- <p>Published methods are the most commonly used methods in macros. These are:</p>
256
- <dl class="rdoc-list"><dt>write</dt>
257
- <dd>
258
- <p>Writes string into selected output IO.</p>
259
- </dd><dt>puts</dt>
260
- <dd>
261
- <p>Writes string (+newline) into selected output IO.</p>
262
- </dd><dt>source</dt>
263
- <dd>
264
- <p>Sources a plain Ruby file.</p>
265
- </dd></dl>
271
+ <p>Multipass can be used for example to create a Table Of Contents. First pass
272
+ collects information about document content and second pass will insert the
273
+ Table Of Contents for a document.</p>
266
274
 
267
- <h3>Hidden methods</h3>
275
+ <p>Example, with functions (insert_toc, header…) defined elsewhere:</p>
268
276
 
269
- <p>Hidded methods start with underscore ("_"). The naming is used to prevent
270
- poluting the Execution Environment's namespace.</p>
271
- <dl class="rdoc-list"><dt>_processFilePair</dt>
277
+ <pre class="code ruby"><code class="ruby">-&lt;#insert_toc&gt;-
278
+ -&lt;header(1, &quot;My header 1&quot;)&gt;-
279
+ Paragraph1
280
+ -&lt;header(2, &quot;My header 1.1&quot;)&gt;-
281
+ Paragraph2
282
+ -&lt;header(1, &quot;My header 2&quot;)&gt;-
283
+ Paragraph3</code></pre>
284
+
285
+ <h2 id="label-Mucgly+module+methods">Mucgly module methods</h2>
286
+
287
+ <p>Ruby Mucgly module includes methods that are used to interact with Mucgly
288
+ program internals.</p>
289
+
290
+ <p>Methods “write”, “puts” produce output to current output file stream.
291
+ Hook-commands change the current hook values.</p>
292
+
293
+ <p>Complete list of Mucgly module methods:</p>
294
+ <dl class="rdoc-list label-list"><dt>write
272
295
  <dd>
273
- <p>Process a pair of files. First half is input file and second is output
274
- file. File pair argument is an Array of two ([&lt;fileI&gt;,
275
- &lt;fileO&gt;]).</p>
276
- </dd><dt>_processFilePairs</dt>
296
+ <p>Write string to current output file without newline.</p>
297
+ </dd><dt>puts
277
298
  <dd>
278
- <p>Uses "_processFilePair" to process a list of file pairs.</p>
279
- </dd><dt>_openInput</dt>
299
+ <p>Write string to current output file with newline.</p>
300
+ </dd><dt>hookbeg
280
301
  <dd>
281
- <p>Sets input stream to given file. When this file is closed, the input stream
282
- is reverted to the original file.</p>
283
- </dd><dt>_openOutput</dt>
302
+ <p>Get hookbeg value.</p>
303
+ </dd><dt>hookend
284
304
  <dd>
285
- <p>Sets output stream to given file. When this file is closed, the input
286
- stream is reverted to the original file.</p>
287
- </dd><dt>_openString</dt>
305
+ <p>Get hookend value.</p>
306
+ </dd><dt>hookesc
288
307
  <dd>
289
- <p>Open a StringIO file for output.</p>
290
- </dd><dt>_pushInput</dt>
308
+ <p>Get hookesc value.</p>
309
+ </dd><dt>sethookbeg
291
310
  <dd>
292
- <p>Makes given file as top input stream. When this stream is closed, the input
293
- stream is reverted to the original file.</p>
294
- </dd><dt>_pushOutput</dt>
311
+ <p>Set hookbeg value.</p>
312
+ </dd><dt>sethookend
295
313
  <dd>
296
- <p>Makes given file as top output stream. When this stream is closed, the
297
- output stream is reverted to the original file.</p>
298
- </dd><dt>_closeInput</dt>
314
+ <p>Set hookend value.</p>
315
+ </dd><dt>sethookesc
299
316
  <dd>
300
- <p>Close input stream.</p>
301
- </dd><dt>_closeOutput</dt>
317
+ <p>Set hookesc value.</p>
318
+ </dd><dt>ifilename
302
319
  <dd>
303
- <p>Close output stream.</p>
304
- </dd><dt>_ofilename</dt>
320
+ <p>Input file name as String.</p>
321
+ </dd><dt>ilinenumber
322
+ <dd>
323
+ <p>Input file line number.</p>
324
+ </dd><dt>ofilename
305
325
  <dd>
306
326
  <p>Output file name as String.</p>
307
- </dd><dt>_olinenumber</dt>
327
+ </dd><dt>olinenumber
308
328
  <dd>
309
329
  <p>Output file line number.</p>
310
- </dd><dt>_ifilename</dt>
311
- <dd>
312
- <p>Input file name as String.</p>
313
- </dd><dt>_ilinenumber</dt>
330
+ </dd><dt>pushinput
314
331
  <dd>
315
- <p>Input file line number.</p>
316
- </dd><dt>_eval</dt>
332
+ <p>Makes given file as current input stream. When this stream is runs out
333
+ (EOF) or is closed (with closeinput), the input stream is reverted to
334
+ previous input file.</p>
335
+ </dd><dt>closeinput
317
336
  <dd>
318
- <p>Perform instance_eval on the given argument.</p>
319
- </dd><dt>_inIO</dt>
337
+ <p>Close output stream (before EOF is encountered).</p>
338
+ </dd><dt>pushoutput
320
339
  <dd>
321
- <p>Handle to input stream (get/set).</p>
322
- </dd><dt>_outIO</dt>
340
+ <p>Makes given file as top output stream. When this stream is closed (with
341
+ closeoutput), the output stream is reverted to previous output file.</p>
342
+ </dd><dt>closeoutput
323
343
  <dd>
324
- <p>Handle to output stream (get/set).</p>
325
- </dd><dt>_separators</dt>
326
- <dd>
327
- <p>Handle to Separators object. Separotors object includes the "escapeChar",
328
- "hookBegChars", and "hookEndChars" setter and getter methods.</p>
344
+ <p>Close output stream.</p>
329
345
  </dd></dl>
330
346
 
331
- <h2>Command line interface</h2>
347
+ <h2 id="label-Command+line+interface">Command line interface</h2>
332
348
 
333
349
  <p>Please execute:</p>
334
350
 
@@ -336,54 +352,61 @@ output stream is reverted to the original file.</p>
336
352
 
337
353
  <p>for an overview of the command line options.</p>
338
354
 
339
- <h3>Input and Output files</h3>
355
+ <h3 id="label-Input+and+Output+files">Input and Output files</h3>
340
356
 
341
- <p>Input files can be listed to "-i" option. The default input stream for
357
+ <p>Input files can be listed to “-f” option. The default input stream for
342
358
  Mucgly is STDIN.</p>
343
359
 
344
- <p>Output files can be listed to "-o" option. The default output stream for
360
+ <p>Output file can be defined with “-o option. The default output stream for
345
361
  Mucgly is STDOUT.</p>
346
362
 
347
- <p>If "-o" option is given without arguments and the input file list includes
348
- ".rx" in each name, the output file list is created by extracting ".rx"
349
- from each input file name.</p>
363
+ <p>If “-g” option is given, the output file list is created by extracting “-g”
364
+ option argument value from each input file name.</p>
350
365
 
351
366
  <p>For example with:</p>
352
367
 
353
- <pre class="code ruby"><code class="ruby">mucgly -i foo.rx.txt bar.rx.txt -o</code></pre>
368
+ <pre class="code ruby"><code class="ruby">mucgly -f foo.rx.txt -f bar.rx.txt -g .rx</code></pre>
354
369
 
355
370
  <p>Two files, foo.txt and bar.txt, would be created. This holds true unless
356
371
  the output streams are manipulated with macro commands.</p>
357
372
 
358
- <p>If the number of input and output files match, then they are used in pairs.</p>
359
-
360
- <h2>Configuration</h2>
373
+ <h2 id="label-Configuration">Configuration</h2>
361
374
 
362
- <p>Mucgly checks for the existance of the "MUCGLY" environment variable. If
375
+ <p>Mucgly checks for the existance of the MUCGLY environment variable. If
363
376
  the variable exists, the file in variable value is read in as plain Ruby.</p>
364
377
 
365
- <p>User configuration is searched from the users home directory:</p>
378
+ <p>Configuration files can also be given on command line using the “-c”
379
+ option. These settings can be used to override the settings above.</p>
366
380
 
367
- <pre class="code ruby"><code class="ruby">$HOME/.mucgly</code></pre>
381
+ <p>Additionally plain Ruby code can be given straight on the command line with
382
+ “-l” option.</p>
368
383
 
369
- <p>It is read as plain Ruby file if it exists.</p>
384
+ <h2 id="label-More+information">More information</h2>
370
385
 
371
- <p>Configuration files can also be given on command line using the "-c"
372
- option. These settings can be used to override the settings above.</p>
386
+ <p>Check out the “test” directory within installation for detailed examples
387
+ about macro usage.</p>
373
388
 
374
- <p>Additionally plain Ruby code can be given straight on the command line with
375
- "-l" option.</p>
389
+ <h2 id="label-Non-GEM+installation">Non-GEM installation</h2>
390
+
391
+ <p>By default Mucgly is distributed as GEM. However Mucgly is by nature a
392
+ C-program. It can be compliled as “normal” C-program that just uses Ruby
393
+ Interpreter for evaluating Ruby macro content.</p>
394
+
395
+ <p>If Mucgly is used in C-main mode, it runs slightly faster, and with smaller
396
+ memory footprint.</p>
397
+
398
+ <p>Example compilation command (use in Mucgly GEM directory root):</p>
376
399
 
377
- <h2>More information</h2>
400
+ <pre class="code ruby"><code class="ruby">gcc `pkg-config --cflags --libs glib-2.0` `pkg-config --cflags --libs ruby-2.1` -O2 -std=c11 -o mucgly ext/mucgly/mucgly.c</code></pre>
378
401
 
379
- <p>Check out the "test" directory within installation for detailed examples
380
- about usage.</p>
402
+ <p>Executable file “mucgly” is created, which can be used the same way as the
403
+ GEM executable (i.e. same command line options).</p>
381
404
  </div></div>
382
405
 
383
406
  <div id="footer">
384
- Generated on Wed Jan 15 19:44:10 2014 by
407
+ Generated on Fri Feb 27 16:43:23 2015 by
385
408
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
386
- 0.8.6.1 (ruby-1.9.3).
409
+ 0.8.7.6 (ruby-2.1.2).
387
410
  </div>
388
411
 
389
412
  </body>
data/doc/js/app.js CHANGED
@@ -78,7 +78,12 @@ function framesInit() {
78
78
  if (hasFrames) {
79
79
  document.body.className = 'frames';
80
80
  $('#menu .noframes a').attr('href', document.location);
81
- window.top.document.title = $('html head title').text();
81
+ try {
82
+ window.top.document.title = $('html head title').text();
83
+ } catch(error) {
84
+ // some browsers will not allow this when serving from file://
85
+ // but we don't want to stop the world.
86
+ }
82
87
  }
83
88
  else {
84
89
  $('#menu .noframes a').text('frames').attr('href', framesUrl);
@@ -211,4 +216,4 @@ $(linkSummaries);
211
216
  $(keyboardShortcuts);
212
217
  $(summaryToggle);
213
218
  $(fixOutsideWorldLinks);
214
- $(generateTOC);
219
+ $(generateTOC);
data/doc/js/full_list.js CHANGED
@@ -111,11 +111,11 @@ clicked = null;
111
111
  function linkList() {
112
112
  $('#full_list li, #full_list li a:last').click(function(evt) {
113
113
  if ($(this).hasClass('toggle')) return true;
114
- if ($(this).find('.object_link a').length === 0) {
115
- $(this).children('a.toggle').click();
116
- return false;
117
- }
118
114
  if (this.tagName.toLowerCase() == "li") {
115
+ if ($(this).find('.object_link a').length === 0) {
116
+ $(this).children('a.toggle').click();
117
+ return false;
118
+ }
119
119
  var toggle = $(this).children('a.toggle');
120
120
  if (toggle.size() > 0 && evt.pageX < toggle.offset().left) {
121
121
  toggle.click();
@@ -123,9 +123,12 @@ function linkList() {
123
123
  }
124
124
  }
125
125
  if (clicked) clicked.removeClass('clicked');
126
- var win = window.top.frames.main ? window.top.frames.main : window.parent;
126
+ var win;
127
+ try {
128
+ win = window.top.frames.main ? window.top.frames.main : window.parent;
129
+ } catch (e) { win = window.parent; }
127
130
  if (this.tagName.toLowerCase() == "a") {
128
- clicked = $(this).parent('li').addClass('clicked');
131
+ clicked = $(this).parents('li').addClass('clicked');
129
132
  win.location = this.href;
130
133
  }
131
134
  else {