mucgly 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.rdoc +8 -0
- data/LICENSE +1 -1
- data/README.rdoc +160 -130
- data/bin/mucgly +4 -217
- data/doc/Mucgly.html +24 -82
- data/doc/_index.html +5 -153
- data/doc/class_list.html +7 -2
- data/doc/css/style.css +2 -1
- data/doc/file.CHANGELOG.html +16 -8
- data/doc/file.README.html +210 -187
- data/doc/file_list.html +6 -1
- data/doc/frames.html +5 -7
- data/doc/index.html +210 -187
- data/doc/js/app.js +7 -2
- data/doc/js/full_list.js +9 -6
- data/doc/method_list.html +7 -686
- data/doc/top-level-namespace.html +5 -5
- data/ext/mucgly/extconf.rb +11 -0
- data/ext/mucgly/mucgly.c +2095 -0
- data/lib/version.rb +6 -0
- data/test/golden/test_basic.txt +18 -0
- data/test/golden/test_specials_cli.txt +11 -0
- data/test/golden/test_specials_cmd.txt +36 -0
- data/test/result/test_basic.txt +18 -0
- data/test/result/test_specials_cli.txt +11 -0
- data/test/result/test_specials_cmd.txt +36 -0
- data/test/result/test_specials_cmd2.txt +1 -0
- data/test/test_basic.rx.txt +10 -6
- data/test/test_mucgly.rb +4 -6
- data/test/test_specials_cli.rx.txt +4 -4
- data/test/test_specials_cmd.rx.txt +5 -5
- metadata +45 -63
- data/Rakefile +0 -29
- data/doc/EasyFile/InOut.html +0 -2097
- data/doc/EasyFile/Read.html +0 -1334
- data/doc/EasyFile/ReadStack.html +0 -461
- data/doc/EasyFile/Stacked.html +0 -411
- data/doc/EasyFile/String.html +0 -570
- data/doc/EasyFile/Write.html +0 -1084
- data/doc/EasyFile/WriteStack.html +0 -305
- data/doc/EasyFile.html +0 -155
- data/doc/Mucgly/Env.html +0 -1675
- data/doc/Mucgly/MucglyFile/ParseState.html +0 -1662
- data/doc/Mucgly/MucglyFile/Token.html +0 -529
- data/doc/Mucgly/MucglyFile.html +0 -545
- data/doc/Mucgly/Separators.html +0 -521
- data/lib/easyfile.rb +0 -720
- data/lib/mucgly.rb +0 -627
- data/test/test_multi.rx.txt +0 -4
data/doc/file.CHANGELOG.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=
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
6
|
<title>
|
7
7
|
File: CHANGELOG
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.6
|
9
|
+
— 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#!
|
20
|
+
framesUrl = "frames.html#!file.CHANGELOG.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -62,20 +62,28 @@
|
|
62
62
|
<iframe id="search_frame"></iframe>
|
63
63
|
|
64
64
|
<div id="content"><div id='filecontents'>
|
65
|
-
<h1>Version history</h1>
|
66
|
-
<dl class="rdoc-list"><dt>0.0
|
65
|
+
<h1 id="label-Version+history">Version history</h1>
|
66
|
+
<dl class="rdoc-list label-list"><dt>0.1.0
|
67
|
+
<dd>
|
68
|
+
<p>C-based implementation. 100 times faster than older versions. Multiple
|
69
|
+
command line interface and internal cmd changes. Not fully backwards
|
70
|
+
compatible with older versions.</p>
|
71
|
+
</dd><dt>0.0.3
|
72
|
+
<dd>
|
73
|
+
<p>Usage typo fix (hookend). Added version method.</p>
|
74
|
+
</dd><dt>0.0.2
|
67
75
|
<dd>
|
68
76
|
<p>Dependency to Como for Gem.</p>
|
69
|
-
</dd><dt>0.0.1
|
77
|
+
</dd><dt>0.0.1
|
70
78
|
<dd>
|
71
79
|
<p>Initial version.</p>
|
72
80
|
</dd></dl>
|
73
81
|
</div></div>
|
74
82
|
|
75
83
|
<div id="footer">
|
76
|
-
Generated on
|
84
|
+
Generated on Fri Feb 27 16:43:23 2015 by
|
77
85
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
78
|
-
0.8.6
|
86
|
+
0.8.7.6 (ruby-2.1.2).
|
79
87
|
</div>
|
80
88
|
|
81
89
|
</body>
|
data/doc/file.README.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=
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.6
|
9
|
+
— 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#!
|
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
|
71
|
-
commands
|
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: -<
|
75
|
+
<pre class="code ruby"><code class="ruby">Adding 1 + 3 results to: -<.1+3>-</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
|
82
|
-
are called hooks, hookbeg and hookend respectively. The code between hooks
|
83
|
-
is regular Ruby code. The
|
81
|
+
<p>By default macro starts with “-<” and ends with “>-”. 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>
|
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
|
-
<
|
90
|
-
|
91
|
-
|
92
|
-
|
89
|
+
<pre class="code ruby"><code class="ruby">shell> mucgly
|
90
|
+
Adding 1 + 3 results to: -<.1+3>-
|
91
|
+
Adding 1 + 3 results to: 4
|
92
|
+
<Ctrl-D>
|
93
|
+
shell></code></pre>
|
93
94
|
|
94
|
-
<p>
|
95
|
-
"-<@a = 1>-" 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 “<main>” scope.</p>
|
99
96
|
|
100
|
-
<p>
|
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
|
-
<
|
99
|
+
<pre class="code ruby"><code class="ruby">-<@a = 1>--<@b = 3>-\
|
100
|
+
Adding 1 + 3 results to: -<Mucgly.write(@a+@b)>-</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 “-<@a = 1>-”
|
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
|
+
“<main>” 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>
|
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
|
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
|
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>
|
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
|
141
|
-
hookend is
|
142
|
-
file body text.</p>
|
153
|
+
<p>Hooks start and end the macro definition. By default hookbeg is “-<” and
|
154
|
+
hookend is “>-”. These values are not easily conflicting with typical
|
155
|
+
macro file body text.</p>
|
143
156
|
|
144
|
-
<p>If literal hook string is required
|
145
|
-
before the hook. For example
|
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 “\-<” will produce literal
|
159
|
+
“-<” 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
|
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
|
156
|
-
space (
|
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
|
159
|
-
value is accepted.</p>
|
171
|
+
<p>User can set the escape sequence to any character(s).</p>
|
160
172
|
|
161
|
-
<h3>
|
173
|
+
<h3 id="label-Single+char+hooks+and+escape">Single char hooks and escape</h3>
|
162
174
|
|
163
|
-
<p>If
|
164
|
-
|
165
|
-
|
166
|
-
|
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's assume that the selected hook char is “|”
|
178
|
+
(vertical bar).</p>
|
168
179
|
|
169
|
-
<p>
|
170
|
-
|
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>
|
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
|
-
<
|
176
|
-
-<header(1, "My header 1")>-
|
177
|
-
Paragraph1
|
178
|
-
-<header(2, "My header 1.1")>-
|
179
|
-
Paragraph2
|
180
|
-
-<header(1, "My header 2")>-
|
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
|
187
|
-
with
|
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
|
-
-<:hook [ ]
|
199
|
+
<pre class="code ruby"><code class="ruby"> ...
|
200
|
+
-<:hook [ ]>-\
|
193
201
|
...</code></pre>
|
194
202
|
|
195
|
-
<p>Would change the hookbeg and hookend to
|
196
|
-
|
197
|
-
|
198
|
-
|
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>
|
202
|
-
|
208
|
+
<p>One special command is allowed per macro and it can'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
|
206
|
-
|
207
|
-
|
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
|
+
“-<:include input.txt>-” ).</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
|
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
|
226
|
+
</dd><dt>hook
|
218
227
|
<dd>
|
219
|
-
<p>Sets both hookbeg and hookend to values separated by space.
|
220
|
-
|
221
|
-
</dd><dt>hookbeg
|
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
|
233
|
+
</dd><dt>hookend
|
225
234
|
<dd>
|
226
235
|
<p>Sets hookend.</p>
|
227
|
-
</dd><dt>
|
236
|
+
</dd><dt>hookesc
|
237
|
+
<dd>
|
238
|
+
<p>Sets escape sequence.</p>
|
239
|
+
</dd><dt>hookall
|
228
240
|
<dd>
|
229
|
-
<p>Sets
|
230
|
-
</dd><dt>exit
|
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
|
-
<
|
236
|
-
|
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">... -<
|
253
|
+
<pre class="code ruby"><code class="ruby">... -<.@my_name>- ...</code></pre>
|
241
254
|
|
242
|
-
<p>Would write out the value of the
|
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">... -<write @my_name>- ...</code></pre>
|
258
|
+
<pre class="code ruby"><code class="ruby">... -<Mucgly.write @my_name>- ...</code></pre>
|
246
259
|
|
247
|
-
<
|
260
|
+
<p>The special character “/” can also be used for comment macro, i.e. “/” is
|
261
|
+
same as “:comment ”.</p>
|
248
262
|
|
249
|
-
<
|
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
|
-
<
|
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>
|
256
|
-
|
257
|
-
|
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
|
-
<
|
275
|
+
<p>Example, with functions (insert_toc, header…) defined elsewhere:</p>
|
268
276
|
|
269
|
-
<
|
270
|
-
|
271
|
-
|
277
|
+
<pre class="code ruby"><code class="ruby">-<#insert_toc>-
|
278
|
+
-<header(1, "My header 1")>-
|
279
|
+
Paragraph1
|
280
|
+
-<header(2, "My header 1.1")>-
|
281
|
+
Paragraph2
|
282
|
+
-<header(1, "My header 2")>-
|
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>
|
274
|
-
|
275
|
-
<fileO>]).</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>
|
279
|
-
</dd><dt>
|
299
|
+
<p>Write string to current output file with newline.</p>
|
300
|
+
</dd><dt>hookbeg
|
280
301
|
<dd>
|
281
|
-
<p>
|
282
|
-
|
283
|
-
</dd><dt>_openOutput</dt>
|
302
|
+
<p>Get hookbeg value.</p>
|
303
|
+
</dd><dt>hookend
|
284
304
|
<dd>
|
285
|
-
<p>
|
286
|
-
|
287
|
-
</dd><dt>_openString</dt>
|
305
|
+
<p>Get hookend value.</p>
|
306
|
+
</dd><dt>hookesc
|
288
307
|
<dd>
|
289
|
-
<p>
|
290
|
-
</dd><dt>
|
308
|
+
<p>Get hookesc value.</p>
|
309
|
+
</dd><dt>sethookbeg
|
291
310
|
<dd>
|
292
|
-
<p>
|
293
|
-
|
294
|
-
</dd><dt>_pushOutput</dt>
|
311
|
+
<p>Set hookbeg value.</p>
|
312
|
+
</dd><dt>sethookend
|
295
313
|
<dd>
|
296
|
-
<p>
|
297
|
-
|
298
|
-
</dd><dt>_closeInput</dt>
|
314
|
+
<p>Set hookend value.</p>
|
315
|
+
</dd><dt>sethookesc
|
299
316
|
<dd>
|
300
|
-
<p>
|
301
|
-
</dd><dt>
|
317
|
+
<p>Set hookesc value.</p>
|
318
|
+
</dd><dt>ifilename
|
302
319
|
<dd>
|
303
|
-
<p>
|
304
|
-
</dd><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>
|
327
|
+
</dd><dt>olinenumber
|
308
328
|
<dd>
|
309
329
|
<p>Output file line number.</p>
|
310
|
-
</dd><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>
|
316
|
-
|
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>
|
319
|
-
</dd><dt>
|
337
|
+
<p>Close output stream (before EOF is encountered).</p>
|
338
|
+
</dd><dt>pushoutput
|
320
339
|
<dd>
|
321
|
-
<p>
|
322
|
-
|
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>
|
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
|
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
|
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
|
348
|
-
|
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 -
|
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
|
-
<
|
359
|
-
|
360
|
-
<h2>Configuration</h2>
|
373
|
+
<h2 id="label-Configuration">Configuration</h2>
|
361
374
|
|
362
|
-
<p>Mucgly checks for the existance of the
|
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>
|
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
|
-
<
|
381
|
+
<p>Additionally plain Ruby code can be given straight on the command line with
|
382
|
+
“-l” option.</p>
|
368
383
|
|
369
|
-
<
|
384
|
+
<h2 id="label-More+information">More information</h2>
|
370
385
|
|
371
|
-
<p>
|
372
|
-
|
386
|
+
<p>Check out the “test” directory within installation for detailed examples
|
387
|
+
about macro usage.</p>
|
373
388
|
|
374
|
-
<
|
375
|
-
|
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
|
-
<
|
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>
|
380
|
-
|
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
|
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
|
409
|
+
0.8.7.6 (ruby-2.1.2).
|
387
410
|
</div>
|
388
411
|
|
389
412
|
</body>
|
data/doc/file_list.html
CHANGED
@@ -15,11 +15,16 @@
|
|
15
15
|
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
16
|
|
17
17
|
|
18
|
+
<title>File List</title>
|
18
19
|
<base id="base_target" target="_parent" />
|
19
20
|
</head>
|
20
21
|
<body>
|
21
22
|
<script type="text/javascript" charset="utf-8">
|
22
|
-
|
23
|
+
var hasFrames = false;
|
24
|
+
try {
|
25
|
+
hasFrames = window.top.frames.main ? true : false;
|
26
|
+
} catch (e) { }
|
27
|
+
if (hasFrames) {
|
23
28
|
document.getElementById('base_target').target = 'main';
|
24
29
|
document.body.className = 'frames';
|
25
30
|
}
|