mucgly 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/README.rdoc +32 -20
- data/doc/Mucgly.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.CHANGELOG.html +6 -2
- data/doc/file.README.html +32 -20
- data/doc/index.html +32 -20
- data/doc/top-level-namespace.html +1 -1
- data/ext/mucgly/mucgly.c +98 -96
- data/lib/version.rb +1 -1
- data/test/golden/test_basic.txt +11 -2
- data/test/golden/test_file_ctrl.txt +9 -0
- data/test/golden/test_redirect.txt +2 -0
- data/test/result/test_basic.txt +11 -2
- data/test/result/test_file_ctrl.txt +9 -0
- data/test/result/test_redirect.txt +2 -0
- data/test/test_basic.rx.txt +11 -2
- data/test/test_file_ctrl.rx.txt +10 -0
- data/test/test_mucgly.rb +22 -5
- data/test/test_skip.txt +4 -0
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dfea2d4d0a44528b05456bbd1704cbbd449a232
|
4
|
+
data.tar.gz: e663a7a7e3815a9dc63b9564730ae738b51a9e87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18654eba88520a6ffed3f834a28916caa5e17df680e4f90b359794f34e199d162d11fdeb25cccf337cf5be3ff8431fa364254fcbf9dac20e76b82be8b4a32b17
|
7
|
+
data.tar.gz: 013cd857f5d0c5003d86cc2d2f82ea42dea9642ec0c3f2b8a05277b0f3ce974e05e586b1ee5cf542d8c8ab42c514661ba65c2c3ad1773ebc558e63f3094c1417
|
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
== Introduction
|
4
4
|
|
5
5
|
Mucgly is a macro expander for inline macros that exist in the middle
|
6
|
-
of body text.
|
7
|
-
|
6
|
+
of body text. Mucgly is useful for code generation and all kinds of
|
7
|
+
templating systems. The macros are expected to be mostly regular Ruby
|
8
|
+
code, but a few special commands are also available.
|
8
9
|
|
9
10
|
A very simple example:
|
10
11
|
Adding 1 + 3 results to: -<.1+3>-
|
@@ -19,7 +20,7 @@ syntax and the rest is pure Ruby code. The special character (command)
|
|
19
20
|
"." is used to print the Ruby code evaluation value to current output
|
20
21
|
file (stream).
|
21
22
|
|
22
|
-
Sample session to execute the example
|
23
|
+
Sample session to execute the above example interactively:
|
23
24
|
shell> mucgly
|
24
25
|
Adding 1 + 3 results to: -<.1+3>-
|
25
26
|
Adding 1 + 3 results to: 4
|
@@ -27,7 +28,8 @@ Sample session to execute the example above:
|
|
27
28
|
shell>
|
28
29
|
|
29
30
|
|
30
|
-
Ruby code is always executed in the Ruby interpreters "<main>" scope
|
31
|
+
Ruby code is always executed in the Ruby interpreters "<main>" scope,
|
32
|
+
i.e. Execution Environment.
|
31
33
|
|
32
34
|
Previous example with multiple macros:
|
33
35
|
-<@a = 1>--<@b = 3>-\
|
@@ -44,7 +46,14 @@ The macro on the second line refers to settings from previous
|
|
44
46
|
macros. Instance variables has to be used to share data between macro
|
45
47
|
calls (due to "<main>" evaluation). Local variables are not persistent
|
46
48
|
enough. Mucgly module method, "Mucgly.write", is used to write out the
|
47
|
-
calculation result. Mucgly module is
|
49
|
+
calculation result. Mucgly module is part of Mucgly.
|
50
|
+
|
51
|
+
Typically Mucgly is executed in batch mode, e.g:
|
52
|
+
mucgly -f foo.rx.txt -f bar.rx.txt -g .rx
|
53
|
+
|
54
|
+
For all command line options, see:
|
55
|
+
mucgly -h
|
56
|
+
|
48
57
|
|
49
58
|
|
50
59
|
== Features
|
@@ -79,6 +88,8 @@ calculation result. Mucgly module is defined within Mucgly utility.
|
|
79
88
|
|
80
89
|
* Document formatting.
|
81
90
|
|
91
|
+
* Template generation.
|
92
|
+
|
82
93
|
* Etc.
|
83
94
|
|
84
95
|
|
@@ -128,8 +139,8 @@ default hook values can be used for nested macros (if desired).
|
|
128
139
|
== Special commands
|
129
140
|
|
130
141
|
In addition to regular Ruby code the macros are allowed to include so
|
131
|
-
called Special Commands. These commands start with
|
132
|
-
|
142
|
+
called Special Commands. These commands start with ":" or with "."
|
143
|
+
character.
|
133
144
|
|
134
145
|
|
135
146
|
=== Named commands
|
@@ -137,17 +148,17 @@ or with ".".
|
|
137
148
|
Example for named command:
|
138
149
|
...
|
139
150
|
-<:hook [ ]>-\
|
140
|
-
|
151
|
+
...
|
141
152
|
|
142
|
-
|
143
|
-
that hooks are changed only for the current input
|
144
|
-
an included input file changes hooks, the includer file still
|
145
|
-
original hooks.
|
153
|
+
This example would change the hookbeg and hookend to "[" and "]"
|
154
|
+
respectively. Note that hooks are changed only for the current input
|
155
|
+
file. If an included input file changes hooks, the includer file still
|
156
|
+
uses the original hooks.
|
146
157
|
|
147
|
-
One special command is allowed per macro and it can't be mixed
|
148
|
-
Ruby code. Command name is separated by ":" in the beginning
|
149
|
-
space (" ") in the end. The rest of the macro is taken as
|
150
|
-
the command.
|
158
|
+
One special command is allowed per macro and it can't be mixed with
|
159
|
+
normal Ruby code. Command name is separated by ":" in the beginning
|
160
|
+
and by space (" ") in the end. The rest of the macro is taken as
|
161
|
+
argument to the command.
|
151
162
|
|
152
163
|
List of ":" style special commands:
|
153
164
|
|
@@ -194,10 +205,11 @@ is same as ":comment ".
|
|
194
205
|
=== Multipass
|
195
206
|
|
196
207
|
If the macro starts with "#" character, the macro is not excuted. The
|
197
|
-
macro content is output with "#" removed from the output,
|
198
|
-
the current macro hooks. If 3 passes are needed, then
|
199
|
-
placed to the initial macro file. Multipass macro files
|
200
|
-
by (shell) piping the output of
|
208
|
+
macro content is output with one "#" removed from the output,
|
209
|
+
surrounded with the current macro hooks. If 3 passes are needed, then
|
210
|
+
"##" can be placed to the initial macro file. Multipass macro files
|
211
|
+
are processes by (shell) piping the output of one Mucgly process to
|
212
|
+
another.
|
201
213
|
|
202
214
|
Multipass can be used for example to create a Table Of Contents. First
|
203
215
|
pass collects information about document content and second pass will
|
data/doc/Mucgly.html
CHANGED
@@ -92,7 +92,7 @@
|
|
92
92
|
<dt id="VERSION-constant" class="">VERSION =
|
93
93
|
|
94
94
|
</dt>
|
95
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.1.
|
95
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.1.1</span><span class='tstring_end'>"</span></span></pre></dd>
|
96
96
|
|
97
97
|
</dl>
|
98
98
|
|
@@ -177,7 +177,7 @@
|
|
177
177
|
</div>
|
178
178
|
|
179
179
|
<div id="footer">
|
180
|
-
Generated on
|
180
|
+
Generated on Sun Apr 5 20:11:53 2015 by
|
181
181
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
182
182
|
0.8.7.6 (ruby-2.1.2).
|
183
183
|
</div>
|
data/doc/_index.html
CHANGED
@@ -104,7 +104,7 @@
|
|
104
104
|
</div>
|
105
105
|
|
106
106
|
<div id="footer">
|
107
|
-
Generated on
|
107
|
+
Generated on Sun Apr 5 20:11:53 2015 by
|
108
108
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
109
109
|
0.8.7.6 (ruby-2.1.2).
|
110
110
|
</div>
|
data/doc/file.CHANGELOG.html
CHANGED
@@ -63,7 +63,11 @@
|
|
63
63
|
|
64
64
|
<div id="content"><div id='filecontents'>
|
65
65
|
<h1 id="label-Version+history">Version history</h1>
|
66
|
-
<dl class="rdoc-list label-list"><dt>0.1.
|
66
|
+
<dl class="rdoc-list label-list"><dt>0.1.1
|
67
|
+
<dd>
|
68
|
+
<p>Documentation updates. Tiny code cleanups. Better test coverage for Mugcly
|
69
|
+
module.</p>
|
70
|
+
</dd><dt>0.1.0
|
67
71
|
<dd>
|
68
72
|
<p>C-based implementation. 100 times faster than older versions. Multiple
|
69
73
|
command line interface and internal cmd changes. Not fully backwards
|
@@ -81,7 +85,7 @@ compatible with older versions.</p>
|
|
81
85
|
</div></div>
|
82
86
|
|
83
87
|
<div id="footer">
|
84
|
-
Generated on
|
88
|
+
Generated on Sun Apr 5 20:11:53 2015 by
|
85
89
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
86
90
|
0.8.7.6 (ruby-2.1.2).
|
87
91
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -67,8 +67,9 @@
|
|
67
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.
|
71
|
-
|
70
|
+
body text. Mucgly is useful for code generation and all kinds of templating
|
71
|
+
systems. The macros are expected to be mostly regular Ruby code, but a few
|
72
|
+
special commands are also available.</p>
|
72
73
|
|
73
74
|
<p>A very simple example:</p>
|
74
75
|
|
@@ -84,7 +85,7 @@ is mostly regular Ruby code. The first character is special syntax and the
|
|
84
85
|
rest is pure Ruby code. The special character (command) “.” is used to
|
85
86
|
print the Ruby code evaluation value to current output file (stream).</p>
|
86
87
|
|
87
|
-
<p>Sample session to execute the example
|
88
|
+
<p>Sample session to execute the above example interactively:</p>
|
88
89
|
|
89
90
|
<pre class="code ruby"><code class="ruby">shell> mucgly
|
90
91
|
Adding 1 + 3 results to: -<.1+3>-
|
@@ -92,7 +93,8 @@ Adding 1 + 3 results to: 4
|
|
92
93
|
<Ctrl-D>
|
93
94
|
shell></code></pre>
|
94
95
|
|
95
|
-
<p>Ruby code is always executed in the Ruby interpreters “<main>” scope
|
96
|
+
<p>Ruby code is always executed in the Ruby interpreters “<main>” scope,
|
97
|
+
i.e. Execution Environment.</p>
|
96
98
|
|
97
99
|
<p>Previous example with multiple macros:</p>
|
98
100
|
|
@@ -110,7 +112,15 @@ the first line outputs nothing.</p>
|
|
110
112
|
Instance variables has to be used to share data between macro calls (due to
|
111
113
|
“<main>” evaluation). Local variables are not persistent enough.
|
112
114
|
Mucgly module method, “Mucgly.write”, is used to write out the calculation
|
113
|
-
result. Mucgly module is
|
115
|
+
result. Mucgly module is part of Mucgly.</p>
|
116
|
+
|
117
|
+
<p>Typically Mucgly is executed in batch mode, e.g:</p>
|
118
|
+
|
119
|
+
<pre class="code ruby"><code class="ruby">mucgly -f foo.rx.txt -f bar.rx.txt -g .rx</code></pre>
|
120
|
+
|
121
|
+
<p>For all command line options, see:</p>
|
122
|
+
|
123
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_mucgly'>mucgly</span> <span class='op'>-</span><span class='id identifier rubyid_h'>h</span></code></pre>
|
114
124
|
|
115
125
|
<h2 id="label-Features">Features</h2>
|
116
126
|
<ul><li>
|
@@ -143,6 +153,8 @@ command line.</p>
|
|
143
153
|
</li><li>
|
144
154
|
<p>Document formatting.</p>
|
145
155
|
</li><li>
|
156
|
+
<p>Template generation.</p>
|
157
|
+
</li><li>
|
146
158
|
<p>Etc.</p>
|
147
159
|
</li></ul>
|
148
160
|
|
@@ -189,25 +201,25 @@ be used for nested macros (if desired).</p>
|
|
189
201
|
<h2 id="label-Special+commands">Special commands</h2>
|
190
202
|
|
191
203
|
<p>In addition to regular Ruby code the macros are allowed to include so
|
192
|
-
called Special Commands. These commands start with
|
193
|
-
|
204
|
+
called Special Commands. These commands start with “:” or with “.”
|
205
|
+
character.</p>
|
194
206
|
|
195
207
|
<h3 id="label-Named+commands">Named commands</h3>
|
196
208
|
|
197
209
|
<p>Example for named command:</p>
|
198
210
|
|
199
|
-
<pre class="code ruby"><code class="ruby"
|
200
|
-
|
211
|
+
<pre class="code ruby"><code class="ruby">...
|
212
|
+
-<:hook [ ]>-\
|
201
213
|
...</code></pre>
|
202
214
|
|
203
|
-
<p>
|
204
|
-
hooks are changed only for the current input file.
|
205
|
-
included input file changes hooks, the includer file still uses the
|
215
|
+
<p>This example would change the hookbeg and hookend to “[” and “]”
|
216
|
+
respectively. Note that hooks are changed only for the current input file.
|
217
|
+
If an included input file changes hooks, the includer file still uses the
|
206
218
|
original hooks.</p>
|
207
219
|
|
208
|
-
<p>One special command is allowed per macro and it can't be mixed
|
209
|
-
Ruby code. Command name is separated by “:” in the beginning and by
|
210
|
-
(“ ”) in the end. The rest of the macro is taken as argument to the
|
220
|
+
<p>One special command is allowed per macro and it can't be mixed with
|
221
|
+
normal Ruby code. Command name is separated by “:” in the beginning and by
|
222
|
+
space (“ ”) in the end. The rest of the macro is taken as argument to the
|
211
223
|
command.</p>
|
212
224
|
|
213
225
|
<p>List of “:” style special commands:</p>
|
@@ -263,10 +275,10 @@ same as “:comment ”.</p>
|
|
263
275
|
<h3 id="label-Multipass">Multipass</h3>
|
264
276
|
|
265
277
|
<p>If the macro starts with “#” character, the macro is not excuted. The macro
|
266
|
-
content is output with “#” removed from the output,
|
267
|
-
macro hooks. If 3 passes are needed, then “##” can be placed to the
|
268
|
-
macro file. Multipass macro files are processes by (shell) piping
|
269
|
-
output of Mucgly to another
|
278
|
+
content is output with one “#” removed from the output, surrounded with the
|
279
|
+
current macro hooks. If 3 passes are needed, then “##” can be placed to the
|
280
|
+
initial macro file. Multipass macro files are processes by (shell) piping
|
281
|
+
the output of one Mucgly process to another.</p>
|
270
282
|
|
271
283
|
<p>Multipass can be used for example to create a Table Of Contents. First pass
|
272
284
|
collects information about document content and second pass will insert the
|
@@ -404,7 +416,7 @@ GEM executable (i.e. same command line options).</p>
|
|
404
416
|
</div></div>
|
405
417
|
|
406
418
|
<div id="footer">
|
407
|
-
Generated on
|
419
|
+
Generated on Sun Apr 5 20:11:53 2015 by
|
408
420
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
409
421
|
0.8.7.6 (ruby-2.1.2).
|
410
422
|
</div>
|
data/doc/index.html
CHANGED
@@ -67,8 +67,9 @@
|
|
67
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.
|
71
|
-
|
70
|
+
body text. Mucgly is useful for code generation and all kinds of templating
|
71
|
+
systems. The macros are expected to be mostly regular Ruby code, but a few
|
72
|
+
special commands are also available.</p>
|
72
73
|
|
73
74
|
<p>A very simple example:</p>
|
74
75
|
|
@@ -84,7 +85,7 @@ is mostly regular Ruby code. The first character is special syntax and the
|
|
84
85
|
rest is pure Ruby code. The special character (command) “.” is used to
|
85
86
|
print the Ruby code evaluation value to current output file (stream).</p>
|
86
87
|
|
87
|
-
<p>Sample session to execute the example
|
88
|
+
<p>Sample session to execute the above example interactively:</p>
|
88
89
|
|
89
90
|
<pre class="code ruby"><code class="ruby">shell> mucgly
|
90
91
|
Adding 1 + 3 results to: -<.1+3>-
|
@@ -92,7 +93,8 @@ Adding 1 + 3 results to: 4
|
|
92
93
|
<Ctrl-D>
|
93
94
|
shell></code></pre>
|
94
95
|
|
95
|
-
<p>Ruby code is always executed in the Ruby interpreters “<main>” scope
|
96
|
+
<p>Ruby code is always executed in the Ruby interpreters “<main>” scope,
|
97
|
+
i.e. Execution Environment.</p>
|
96
98
|
|
97
99
|
<p>Previous example with multiple macros:</p>
|
98
100
|
|
@@ -110,7 +112,15 @@ the first line outputs nothing.</p>
|
|
110
112
|
Instance variables has to be used to share data between macro calls (due to
|
111
113
|
“<main>” evaluation). Local variables are not persistent enough.
|
112
114
|
Mucgly module method, “Mucgly.write”, is used to write out the calculation
|
113
|
-
result. Mucgly module is
|
115
|
+
result. Mucgly module is part of Mucgly.</p>
|
116
|
+
|
117
|
+
<p>Typically Mucgly is executed in batch mode, e.g:</p>
|
118
|
+
|
119
|
+
<pre class="code ruby"><code class="ruby">mucgly -f foo.rx.txt -f bar.rx.txt -g .rx</code></pre>
|
120
|
+
|
121
|
+
<p>For all command line options, see:</p>
|
122
|
+
|
123
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_mucgly'>mucgly</span> <span class='op'>-</span><span class='id identifier rubyid_h'>h</span></code></pre>
|
114
124
|
|
115
125
|
<h2 id="label-Features">Features</h2>
|
116
126
|
<ul><li>
|
@@ -143,6 +153,8 @@ command line.</p>
|
|
143
153
|
</li><li>
|
144
154
|
<p>Document formatting.</p>
|
145
155
|
</li><li>
|
156
|
+
<p>Template generation.</p>
|
157
|
+
</li><li>
|
146
158
|
<p>Etc.</p>
|
147
159
|
</li></ul>
|
148
160
|
|
@@ -189,25 +201,25 @@ be used for nested macros (if desired).</p>
|
|
189
201
|
<h2 id="label-Special+commands">Special commands</h2>
|
190
202
|
|
191
203
|
<p>In addition to regular Ruby code the macros are allowed to include so
|
192
|
-
called Special Commands. These commands start with
|
193
|
-
|
204
|
+
called Special Commands. These commands start with “:” or with “.”
|
205
|
+
character.</p>
|
194
206
|
|
195
207
|
<h3 id="label-Named+commands">Named commands</h3>
|
196
208
|
|
197
209
|
<p>Example for named command:</p>
|
198
210
|
|
199
|
-
<pre class="code ruby"><code class="ruby"
|
200
|
-
|
211
|
+
<pre class="code ruby"><code class="ruby">...
|
212
|
+
-<:hook [ ]>-\
|
201
213
|
...</code></pre>
|
202
214
|
|
203
|
-
<p>
|
204
|
-
hooks are changed only for the current input file.
|
205
|
-
included input file changes hooks, the includer file still uses the
|
215
|
+
<p>This example would change the hookbeg and hookend to “[” and “]”
|
216
|
+
respectively. Note that hooks are changed only for the current input file.
|
217
|
+
If an included input file changes hooks, the includer file still uses the
|
206
218
|
original hooks.</p>
|
207
219
|
|
208
|
-
<p>One special command is allowed per macro and it can't be mixed
|
209
|
-
Ruby code. Command name is separated by “:” in the beginning and by
|
210
|
-
(“ ”) in the end. The rest of the macro is taken as argument to the
|
220
|
+
<p>One special command is allowed per macro and it can't be mixed with
|
221
|
+
normal Ruby code. Command name is separated by “:” in the beginning and by
|
222
|
+
space (“ ”) in the end. The rest of the macro is taken as argument to the
|
211
223
|
command.</p>
|
212
224
|
|
213
225
|
<p>List of “:” style special commands:</p>
|
@@ -263,10 +275,10 @@ same as “:comment ”.</p>
|
|
263
275
|
<h3 id="label-Multipass">Multipass</h3>
|
264
276
|
|
265
277
|
<p>If the macro starts with “#” character, the macro is not excuted. The macro
|
266
|
-
content is output with “#” removed from the output,
|
267
|
-
macro hooks. If 3 passes are needed, then “##” can be placed to the
|
268
|
-
macro file. Multipass macro files are processes by (shell) piping
|
269
|
-
output of Mucgly to another
|
278
|
+
content is output with one “#” removed from the output, surrounded with the
|
279
|
+
current macro hooks. If 3 passes are needed, then “##” can be placed to the
|
280
|
+
initial macro file. Multipass macro files are processes by (shell) piping
|
281
|
+
the output of one Mucgly process to another.</p>
|
270
282
|
|
271
283
|
<p>Multipass can be used for example to create a Table Of Contents. First pass
|
272
284
|
collects information about document content and second pass will insert the
|
@@ -404,7 +416,7 @@ GEM executable (i.e. same command line options).</p>
|
|
404
416
|
</div></div>
|
405
417
|
|
406
418
|
<div id="footer">
|
407
|
-
Generated on
|
419
|
+
Generated on Sun Apr 5 20:11:53 2015 by
|
408
420
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
409
421
|
0.8.7.6 (ruby-2.1.2).
|
410
422
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Sun Apr 5 20:11:53 2015 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.6 (ruby-2.1.2).
|
109
109
|
</div>
|
data/ext/mucgly/mucgly.c
CHANGED
@@ -21,7 +21,7 @@ void mucgly_main( int argc, char** argv );
|
|
21
21
|
/* Enable the define is input char based debugging is required. Set
|
22
22
|
GDB breakpoint at mucgly_debug. */
|
23
23
|
void mucgly_debug( void ) {}
|
24
|
-
#if
|
24
|
+
#if 0
|
25
25
|
# define DEBUG_CHAR '~'
|
26
26
|
#endif
|
27
27
|
|
@@ -38,8 +38,8 @@ void mucgly_debug( void ) {}
|
|
38
38
|
* parsing.
|
39
39
|
*
|
40
40
|
* Pstate contains Filestack. Filestack is a stack of input files. The
|
41
|
-
* input file stack grows when the "lower" level files
|
42
|
-
* include
|
41
|
+
* input file stack grows when the "lower" level files perform
|
42
|
+
* include commands.
|
43
43
|
*
|
44
44
|
* Filestack contains Stackfiles. Stackfile presents the read status
|
45
45
|
* of an input file. It contains character position information for
|
@@ -65,7 +65,7 @@ void mucgly_debug( void ) {}
|
|
65
65
|
struct stackfile_s {
|
66
66
|
|
67
67
|
gchar* filename; /**< Filename. */
|
68
|
-
FILE* fh; /**<
|
68
|
+
FILE* fh; /**< IO stream handle. */
|
69
69
|
GString* buf; /**< Put-back buffer (oldest-is-last). */
|
70
70
|
|
71
71
|
int lineno; /**< Line number (0->). */
|
@@ -137,7 +137,7 @@ struct pstate_s {
|
|
137
137
|
|
138
138
|
GList* output; /**< Stack of output streams. */
|
139
139
|
|
140
|
-
gboolean flush;
|
140
|
+
gboolean flush; /**< Flush out-stream immediately. */
|
141
141
|
};
|
142
142
|
typedef struct pstate_s pstate_t;
|
143
143
|
|
@@ -149,9 +149,11 @@ typedef enum hook_e { hook_none, hook_end, hook_beg, hook_esc } hook_t;
|
|
149
149
|
/** Current filestack from pstate_t (for convenience). */
|
150
150
|
#define ps_has_file(ps) ((stackfile_t*)(ps)->fs->file)
|
151
151
|
|
152
|
+
|
152
153
|
/** Current stackfile from pstate_t (for convenience). */
|
153
154
|
#define ps_topfile(ps) ((stackfile_t*)(ps)->fs->file->data)
|
154
155
|
|
156
|
+
|
155
157
|
/** Current stackfile from filestack_t (for convenience). */
|
156
158
|
#define fs_topfile(fs) ((stackfile_t*)(fs)->file->data)
|
157
159
|
|
@@ -185,7 +187,7 @@ void sf_set_hook( stackfile_t* sf, hook_t hook, char* value );
|
|
185
187
|
* ------------------------------------------------------------ */
|
186
188
|
|
187
189
|
|
188
|
-
/**
|
190
|
+
/**
|
189
191
|
* Compare two strings upto length of str1.
|
190
192
|
*
|
191
193
|
* @param str1 String 1.
|
@@ -204,8 +206,8 @@ int len_str_cmp( char* str1, char* str2 )
|
|
204
206
|
}
|
205
207
|
|
206
208
|
|
207
|
-
/**
|
208
|
-
* Common
|
209
|
+
/**
|
210
|
+
* Common routine for user info message output.
|
209
211
|
*
|
210
212
|
* @param sf Currently processed file (or NULL).
|
211
213
|
* @param infotype Severity type.
|
@@ -251,7 +253,7 @@ void mucgly_user_info( stackfile_t* sf, char* infotype, char* format, va_list ap
|
|
251
253
|
}
|
252
254
|
|
253
255
|
|
254
|
-
/**
|
256
|
+
/**
|
255
257
|
* Report warning to user (no exit).
|
256
258
|
*
|
257
259
|
* @param sf Current input file.
|
@@ -266,7 +268,7 @@ void mucgly_warn( stackfile_t* sf, char* format, ... )
|
|
266
268
|
}
|
267
269
|
|
268
270
|
|
269
|
-
/**
|
271
|
+
/**
|
270
272
|
* Report error to user (and exit).
|
271
273
|
*
|
272
274
|
* @param sf Current input file.
|
@@ -282,7 +284,7 @@ void mucgly_error( stackfile_t* sf, char* format, ... )
|
|
282
284
|
}
|
283
285
|
|
284
286
|
|
285
|
-
/**
|
287
|
+
/**
|
286
288
|
* Report fatal error to user (and exit).
|
287
289
|
*
|
288
290
|
* @param sf Current input file.
|
@@ -298,7 +300,7 @@ void mucgly_fatal( stackfile_t* sf, char* format, ... )
|
|
298
300
|
}
|
299
301
|
|
300
302
|
|
301
|
-
/**
|
303
|
+
/**
|
302
304
|
* Create new Stackfile.
|
303
305
|
*
|
304
306
|
* @param filename Filename (NULL for stdin).
|
@@ -369,7 +371,7 @@ stackfile_t* sf_new( gchar* filename, stackfile_t* inherit )
|
|
369
371
|
}
|
370
372
|
|
371
373
|
|
372
|
-
/**
|
374
|
+
/**
|
373
375
|
* Store macro start info.
|
374
376
|
*
|
375
377
|
* @param sf Stackfile.
|
@@ -382,7 +384,7 @@ void sf_mark_macro( stackfile_t* sf )
|
|
382
384
|
}
|
383
385
|
|
384
386
|
|
385
|
-
/**
|
387
|
+
/**
|
386
388
|
* Reset macro start info.
|
387
389
|
*
|
388
390
|
* @param sf Stackfile.
|
@@ -393,7 +395,7 @@ void sf_unmark_macro( stackfile_t* sf )
|
|
393
395
|
}
|
394
396
|
|
395
397
|
|
396
|
-
/**
|
398
|
+
/**
|
397
399
|
* Free Stackfile and close the file stream.
|
398
400
|
*
|
399
401
|
* @param sf Stackfile.
|
@@ -417,7 +419,7 @@ void sf_rem( stackfile_t* sf )
|
|
417
419
|
}
|
418
420
|
|
419
421
|
|
420
|
-
/**
|
422
|
+
/**
|
421
423
|
* Get char from Stackfile.
|
422
424
|
*
|
423
425
|
* @param sf Stackfile.
|
@@ -477,7 +479,7 @@ int sf_get( stackfile_t* sf )
|
|
477
479
|
}
|
478
480
|
|
479
481
|
|
480
|
-
/**
|
482
|
+
/**
|
481
483
|
* Put char back to Stackfile.
|
482
484
|
*
|
483
485
|
* @param sf Stackfile.
|
@@ -505,7 +507,7 @@ gboolean sf_put( stackfile_t* sf, char c )
|
|
505
507
|
}
|
506
508
|
|
507
509
|
|
508
|
-
/**
|
510
|
+
/**
|
509
511
|
* Set hook value.
|
510
512
|
*
|
511
513
|
* @param sf Stackfile.
|
@@ -545,7 +547,7 @@ void sf_set_hook( stackfile_t* sf, hook_t hook, char* value )
|
|
545
547
|
}
|
546
548
|
|
547
549
|
|
548
|
-
/**
|
550
|
+
/**
|
549
551
|
* Create new Filestack.
|
550
552
|
*
|
551
553
|
* @return Filestack.
|
@@ -560,7 +562,7 @@ filestack_t* fs_new( void )
|
|
560
562
|
}
|
561
563
|
|
562
564
|
|
563
|
-
/**
|
565
|
+
/**
|
564
566
|
* Free Filestack and close all Stackfiles.
|
565
567
|
*
|
566
568
|
* @param fs Filestack.
|
@@ -583,7 +585,7 @@ filestack_t* fs_rem( filestack_t* fs )
|
|
583
585
|
}
|
584
586
|
|
585
587
|
|
586
|
-
/**
|
588
|
+
/**
|
587
589
|
* Push file on top of Filestack.
|
588
590
|
*
|
589
591
|
* @param fs Filestack.
|
@@ -608,7 +610,7 @@ void fs_push_file( filestack_t* fs, gchar* filename )
|
|
608
610
|
}
|
609
611
|
|
610
612
|
|
611
|
-
/**
|
613
|
+
/**
|
612
614
|
* Pop file from top of Filestack. File is closed.
|
613
615
|
*
|
614
616
|
* @param fs Filestack.
|
@@ -629,7 +631,7 @@ void fs_pop_file( filestack_t* fs )
|
|
629
631
|
}
|
630
632
|
|
631
633
|
|
632
|
-
/**
|
634
|
+
/**
|
633
635
|
* Get char from (through) Filestack (i.e. top file).
|
634
636
|
*
|
635
637
|
* @param fs Filestack.
|
@@ -662,7 +664,7 @@ int fs_get( filestack_t* fs )
|
|
662
664
|
}
|
663
665
|
|
664
666
|
|
665
|
-
/**
|
667
|
+
/**
|
666
668
|
* Put back char.
|
667
669
|
*
|
668
670
|
* @param fs Filestack.
|
@@ -677,7 +679,7 @@ gboolean fs_put( filestack_t* fs, char c )
|
|
677
679
|
}
|
678
680
|
|
679
681
|
|
680
|
-
/**
|
682
|
+
/**
|
681
683
|
* Get n chars from Filestack. If ret is non-null, use that for
|
682
684
|
* storage.
|
683
685
|
*
|
@@ -727,7 +729,7 @@ GString* fs_get_n( filestack_t* fs, int n, GString* ret )
|
|
727
729
|
}
|
728
730
|
|
729
731
|
|
730
|
-
/**
|
732
|
+
/**
|
731
733
|
* Put chars in str back to Filestack. If n is 0, then use strlen to
|
732
734
|
* get the count.
|
733
735
|
*
|
@@ -753,7 +755,7 @@ gboolean fs_put_n( filestack_t* fs, gchar* str, int n )
|
|
753
755
|
}
|
754
756
|
|
755
757
|
|
756
|
-
/**
|
758
|
+
/**
|
757
759
|
* Create new Outfile. If filename is NULL, then stream is stdout.
|
758
760
|
*
|
759
761
|
* @param filename File name (or NULL for stdout).
|
@@ -800,7 +802,7 @@ outfile_t* outfile_new( gchar* filename )
|
|
800
802
|
}
|
801
803
|
|
802
804
|
|
803
|
-
/**
|
805
|
+
/**
|
804
806
|
* Free Outfile and close output stream if non-stdout.
|
805
807
|
*
|
806
808
|
* @param of Outfile.
|
@@ -815,7 +817,7 @@ void outfile_rem( outfile_t* of )
|
|
815
817
|
}
|
816
818
|
|
817
819
|
|
818
|
-
/**
|
820
|
+
/**
|
819
821
|
* Create Pstate. Create input file stack and output file
|
820
822
|
* stack. Initialize parsing state.
|
821
823
|
*
|
@@ -850,7 +852,7 @@ pstate_t* ps_new( gchar* outfile )
|
|
850
852
|
}
|
851
853
|
|
852
854
|
|
853
|
-
/**
|
855
|
+
/**
|
854
856
|
* Free Pstate. Close all input and output files.
|
855
857
|
*
|
856
858
|
* @param ps Pstate.
|
@@ -871,7 +873,7 @@ void ps_rem( pstate_t* ps )
|
|
871
873
|
}
|
872
874
|
|
873
875
|
|
874
|
-
/**
|
876
|
+
/**
|
875
877
|
* Fast check for current input char being first char of any of the
|
876
878
|
* hooks.
|
877
879
|
*
|
@@ -895,7 +897,7 @@ gboolean ps_check_hook( pstate_t* ps, int c )
|
|
895
897
|
}
|
896
898
|
|
897
899
|
|
898
|
-
/**
|
900
|
+
/**
|
899
901
|
* Check if input has the match string coming next. Erase the matched
|
900
902
|
* string if erase is true and input is matched.
|
901
903
|
*
|
@@ -928,7 +930,7 @@ gboolean ps_check( pstate_t* ps, gchar* match, gboolean erase )
|
|
928
930
|
}
|
929
931
|
|
930
932
|
|
931
|
-
/**
|
933
|
+
/**
|
932
934
|
* Check input for hookesc.
|
933
935
|
*
|
934
936
|
* @param ps Pstate.
|
@@ -944,7 +946,7 @@ gboolean ps_check_hookesc( pstate_t* ps )
|
|
944
946
|
}
|
945
947
|
|
946
948
|
|
947
|
-
/**
|
949
|
+
/**
|
948
950
|
* Check input for hookbeg.
|
949
951
|
*
|
950
952
|
* @param ps Pstate.
|
@@ -960,7 +962,7 @@ gboolean ps_check_hookbeg( pstate_t* ps )
|
|
960
962
|
}
|
961
963
|
|
962
964
|
|
963
|
-
/**
|
965
|
+
/**
|
964
966
|
* Check input for hookend.
|
965
967
|
*
|
966
968
|
* @param ps Pstate.
|
@@ -976,7 +978,7 @@ gboolean ps_check_hookend( pstate_t* ps )
|
|
976
978
|
}
|
977
979
|
|
978
980
|
|
979
|
-
/**
|
981
|
+
/**
|
980
982
|
* Get char (through Filestack).
|
981
983
|
*
|
982
984
|
* @param ps Pstate.
|
@@ -989,7 +991,7 @@ int ps_in( pstate_t* ps )
|
|
989
991
|
}
|
990
992
|
|
991
993
|
|
992
|
-
/**
|
994
|
+
/**
|
993
995
|
* Output char to current output stream.
|
994
996
|
*
|
995
997
|
* @param ps Pstate.
|
@@ -1008,7 +1010,7 @@ void ps_out( pstate_t* ps, int c )
|
|
1008
1010
|
}
|
1009
1011
|
|
1010
1012
|
|
1011
|
-
/**
|
1013
|
+
/**
|
1012
1014
|
* Output chars with ps_out.
|
1013
1015
|
*
|
1014
1016
|
* @param ps Pstate.
|
@@ -1028,7 +1030,7 @@ void ps_out_str( pstate_t* ps, gchar* str )
|
|
1028
1030
|
}
|
1029
1031
|
|
1030
1032
|
|
1031
|
-
/**
|
1033
|
+
/**
|
1032
1034
|
* Push new output stream on top of output file stack.
|
1033
1035
|
*
|
1034
1036
|
* @param ps Pstate.
|
@@ -1041,7 +1043,7 @@ void ps_push_file( pstate_t* ps, gchar* filename )
|
|
1041
1043
|
}
|
1042
1044
|
|
1043
1045
|
|
1044
|
-
/**
|
1046
|
+
/**
|
1045
1047
|
* Pop file from output file stack. Close the stream.
|
1046
1048
|
*
|
1047
1049
|
* @param ps Pstate.
|
@@ -1056,7 +1058,7 @@ void ps_pop_file( pstate_t* ps )
|
|
1056
1058
|
}
|
1057
1059
|
|
1058
1060
|
|
1059
|
-
/**
|
1061
|
+
/**
|
1060
1062
|
* Return current Stackfile (input stream).
|
1061
1063
|
*
|
1062
1064
|
* @param ps Pstate.
|
@@ -1074,7 +1076,7 @@ stackfile_t* ps_current_file( pstate_t* ps )
|
|
1074
1076
|
}
|
1075
1077
|
|
1076
1078
|
|
1077
|
-
/**
|
1079
|
+
/**
|
1078
1080
|
* Initialize macro content collection.
|
1079
1081
|
*
|
1080
1082
|
* @param ps Pstate.
|
@@ -1085,7 +1087,7 @@ void ps_start_collect( pstate_t* ps )
|
|
1085
1087
|
}
|
1086
1088
|
|
1087
1089
|
|
1088
|
-
/**
|
1090
|
+
/**
|
1089
1091
|
* Add content to macro.
|
1090
1092
|
*
|
1091
1093
|
* @param ps Pstate.
|
@@ -1097,7 +1099,7 @@ void ps_collect( pstate_t* ps, int c )
|
|
1097
1099
|
}
|
1098
1100
|
|
1099
1101
|
|
1100
|
-
/**
|
1102
|
+
/**
|
1101
1103
|
* Get current macro content.
|
1102
1104
|
*
|
1103
1105
|
* @param ps Pstate.
|
@@ -1110,7 +1112,7 @@ char* ps_get_macro( pstate_t* ps )
|
|
1110
1112
|
}
|
1111
1113
|
|
1112
1114
|
|
1113
|
-
/**
|
1115
|
+
/**
|
1114
1116
|
* Evaluate str as Ruby code and convert result to string. Conversion
|
1115
1117
|
* is performed if execution was successful and conversion was
|
1116
1118
|
* requested.
|
@@ -1165,7 +1167,7 @@ gchar* ps_eval_ruby_str( pstate_t* ps, gchar* str, gboolean to_str, char* ctxt )
|
|
1165
1167
|
}
|
1166
1168
|
|
1167
1169
|
|
1168
|
-
/**
|
1170
|
+
/**
|
1169
1171
|
* Load file Ruby intepreter.
|
1170
1172
|
*
|
1171
1173
|
* @param filename Source file.
|
@@ -1181,7 +1183,7 @@ void ps_load_ruby_file( pstate_t* ps, gchar* filename )
|
|
1181
1183
|
}
|
1182
1184
|
|
1183
1185
|
|
1184
|
-
/**
|
1186
|
+
/**
|
1185
1187
|
* Execute Mucgly command/macro.
|
1186
1188
|
*
|
1187
1189
|
* @param ps Pstate.
|
@@ -1313,7 +1315,7 @@ gboolean ps_eval_cmd( pstate_t* ps )
|
|
1313
1315
|
}
|
1314
1316
|
|
1315
1317
|
|
1316
|
-
|
1318
|
+
/** Convenience macro for non-hook processing. */
|
1317
1319
|
#define NON_HOOK_SEQ { \
|
1318
1320
|
/* Non-hook input. */ \
|
1319
1321
|
if ( ps->in_macro ) \
|
@@ -1334,7 +1336,7 @@ gboolean ps_eval_cmd( pstate_t* ps )
|
|
1334
1336
|
}
|
1335
1337
|
|
1336
1338
|
|
1337
|
-
/**
|
1339
|
+
/**
|
1338
1340
|
* Process input file (or stack of files).
|
1339
1341
|
*
|
1340
1342
|
* @param ps Pstate.
|
@@ -1543,7 +1545,7 @@ void ps_process_file( pstate_t* ps, gchar* infile, gchar* outfile )
|
|
1543
1545
|
* ------------------------------------------------------------ */
|
1544
1546
|
|
1545
1547
|
|
1546
|
-
/**
|
1548
|
+
/**
|
1547
1549
|
* Mucgly.write method. Write output current output without NL.
|
1548
1550
|
*
|
1549
1551
|
* @param obj Not used.
|
@@ -1568,7 +1570,7 @@ VALUE mucgly_write( VALUE obj, VALUE rstr )
|
|
1568
1570
|
}
|
1569
1571
|
|
1570
1572
|
|
1571
|
-
/**
|
1573
|
+
/**
|
1572
1574
|
* Mucgly.puts method. Write output current output with NL.
|
1573
1575
|
*
|
1574
1576
|
* @param obj Not used.
|
@@ -1595,7 +1597,7 @@ VALUE mucgly_puts( VALUE obj, VALUE rstr )
|
|
1595
1597
|
}
|
1596
1598
|
|
1597
1599
|
|
1598
|
-
/**
|
1600
|
+
/**
|
1599
1601
|
* Mucgly.hookbeg method. Get hookbeg.
|
1600
1602
|
*
|
1601
1603
|
* @param obj Not used.
|
@@ -1608,7 +1610,7 @@ VALUE mucgly_hookbeg( VALUE obj )
|
|
1608
1610
|
}
|
1609
1611
|
|
1610
1612
|
|
1611
|
-
/**
|
1613
|
+
/**
|
1612
1614
|
* Mucgly.hookend method. Get hookend.
|
1613
1615
|
*
|
1614
1616
|
* @param obj Not used.
|
@@ -1621,7 +1623,7 @@ VALUE mucgly_hookend( VALUE obj )
|
|
1621
1623
|
}
|
1622
1624
|
|
1623
1625
|
|
1624
|
-
/**
|
1626
|
+
/**
|
1625
1627
|
* Mucgly.hookesc method. Get hookesc.
|
1626
1628
|
*
|
1627
1629
|
* @param obj Not used.
|
@@ -1634,7 +1636,7 @@ VALUE mucgly_hookesc( VALUE obj )
|
|
1634
1636
|
}
|
1635
1637
|
|
1636
1638
|
|
1637
|
-
/**
|
1639
|
+
/**
|
1638
1640
|
* Mucgly.sethookbeg method. Set hookbeg.
|
1639
1641
|
*
|
1640
1642
|
* @param obj Not used.
|
@@ -1651,7 +1653,7 @@ VALUE mucgly_sethookbeg( VALUE obj, VALUE rstr )
|
|
1651
1653
|
}
|
1652
1654
|
|
1653
1655
|
|
1654
|
-
/**
|
1656
|
+
/**
|
1655
1657
|
* Mucgly.sethookend method. Set hookend.
|
1656
1658
|
*
|
1657
1659
|
* @param obj Not used.
|
@@ -1668,7 +1670,7 @@ VALUE mucgly_sethookend( VALUE obj, VALUE rstr )
|
|
1668
1670
|
}
|
1669
1671
|
|
1670
1672
|
|
1671
|
-
/**
|
1673
|
+
/**
|
1672
1674
|
* Mucgly.sethookesc method. Set hookesc.
|
1673
1675
|
*
|
1674
1676
|
* @param obj Not used.
|
@@ -1685,7 +1687,7 @@ VALUE mucgly_sethookesc( VALUE obj, VALUE rstr )
|
|
1685
1687
|
}
|
1686
1688
|
|
1687
1689
|
|
1688
|
-
/**
|
1690
|
+
/**
|
1689
1691
|
* Mucgly.ifilename method. Gets current input file name.
|
1690
1692
|
*
|
1691
1693
|
* @param obj Not used.
|
@@ -1698,7 +1700,7 @@ VALUE mucgly_ifilename( VALUE obj )
|
|
1698
1700
|
}
|
1699
1701
|
|
1700
1702
|
|
1701
|
-
/**
|
1703
|
+
/**
|
1702
1704
|
* Mucgly.ilinenumber method. Gets current input file line.
|
1703
1705
|
*
|
1704
1706
|
* @param obj Not used.
|
@@ -1711,7 +1713,7 @@ VALUE mucgly_ilinenumber( VALUE obj )
|
|
1711
1713
|
}
|
1712
1714
|
|
1713
1715
|
|
1714
|
-
/**
|
1716
|
+
/**
|
1715
1717
|
* Mucgly.ofilename method. Gets current output file name.
|
1716
1718
|
*
|
1717
1719
|
* @param obj Not used.
|
@@ -1726,7 +1728,7 @@ VALUE mucgly_ofilename( VALUE obj )
|
|
1726
1728
|
}
|
1727
1729
|
|
1728
1730
|
|
1729
|
-
/**
|
1731
|
+
/**
|
1730
1732
|
* Mucgly.olinenumber method. Gets current output file line.
|
1731
1733
|
*
|
1732
1734
|
* @param obj Not used.
|
@@ -1741,7 +1743,7 @@ VALUE mucgly_olinenumber( VALUE obj )
|
|
1741
1743
|
}
|
1742
1744
|
|
1743
1745
|
|
1744
|
-
/**
|
1746
|
+
/**
|
1745
1747
|
* Mucgly.pushinput method. Push new input stream.
|
1746
1748
|
*
|
1747
1749
|
* @param obj Not used.
|
@@ -1759,7 +1761,7 @@ VALUE mucgly_pushinput( VALUE obj, VALUE rstr )
|
|
1759
1761
|
}
|
1760
1762
|
|
1761
1763
|
|
1762
|
-
/**
|
1764
|
+
/**
|
1763
1765
|
* Mucgly.closeinput method. Pop input stream and close file stream.
|
1764
1766
|
*
|
1765
1767
|
* @param obj Not used.
|
@@ -1773,7 +1775,7 @@ VALUE mucgly_closeinput( VALUE obj )
|
|
1773
1775
|
}
|
1774
1776
|
|
1775
1777
|
|
1776
|
-
/**
|
1778
|
+
/**
|
1777
1779
|
* Mucgly.pushoutput method. Push new output stream.
|
1778
1780
|
*
|
1779
1781
|
* @param obj Not used.
|
@@ -1791,7 +1793,7 @@ VALUE mucgly_pushoutput( VALUE obj, VALUE rstr )
|
|
1791
1793
|
}
|
1792
1794
|
|
1793
1795
|
|
1794
|
-
/**
|
1796
|
+
/**
|
1795
1797
|
* Mucgly.closeoutput method. Pop output stream and close file stream.
|
1796
1798
|
*
|
1797
1799
|
* @param obj Not used.
|
@@ -1806,7 +1808,7 @@ VALUE mucgly_closeoutput( VALUE obj )
|
|
1806
1808
|
|
1807
1809
|
|
1808
1810
|
#ifdef MUCGLY_LIB
|
1809
|
-
/**
|
1811
|
+
/**
|
1810
1812
|
* Call mucgly C-side entry point. Convert Ruby ARGV array to C-array
|
1811
1813
|
* for C-side command line arg parsing.
|
1812
1814
|
*
|
@@ -1835,7 +1837,7 @@ VALUE mucgly_run_mucgly( VALUE obj, VALUE cli )
|
|
1835
1837
|
#endif
|
1836
1838
|
|
1837
1839
|
|
1838
|
-
/**
|
1840
|
+
/**
|
1839
1841
|
* Create Mucgly Ruby module and register all methods to it.
|
1840
1842
|
*
|
1841
1843
|
*/
|
@@ -1869,7 +1871,7 @@ void Init_mucgly( void )
|
|
1869
1871
|
}
|
1870
1872
|
|
1871
1873
|
|
1872
|
-
/**
|
1874
|
+
/**
|
1873
1875
|
* Generate outfile name from infile by removing the outfile_tag from
|
1874
1876
|
* infile name.
|
1875
1877
|
*
|
@@ -1941,30 +1943,30 @@ void mucgly_main( int argc, char** argv )
|
|
1941
1943
|
|
1942
1944
|
GOptionEntry opts_table[] =
|
1943
1945
|
{
|
1944
|
-
{ "files", 'f', 0, G_OPTION_ARG_FILENAME_ARRAY,
|
1945
|
-
|
1946
|
-
{ "configs", 'c', 0, G_OPTION_ARG_FILENAME_ARRAY,
|
1947
|
-
|
1948
|
-
{ "output", 'o', 0, G_OPTION_ARG_FILENAME,
|
1949
|
-
|
1950
|
-
{ "genout", 'g', 0, G_OPTION_ARG_STRING,
|
1951
|
-
|
1952
|
-
{ "cli_cmds", 'l', 0, G_OPTION_ARG_STRING_ARRAY,
|
1953
|
-
|
1954
|
-
{ "beg_sep", 'b', 0, G_OPTION_ARG_STRING,
|
1955
|
-
|
1956
|
-
{ "end_sep", 'e', 0, G_OPTION_ARG_STRING,
|
1957
|
-
|
1958
|
-
{ "esc_sep", 's', 0, G_OPTION_ARG_STRING,
|
1959
|
-
|
1960
|
-
{ "all_sep", 'a', 0, G_OPTION_ARG_STRING,
|
1961
|
-
|
1962
|
-
{ "module", 'm', 0, G_OPTION_ARG_NONE,
|
1963
|
-
|
1964
|
-
{ "interact", 'i', 0, G_OPTION_ARG_NONE,
|
1965
|
-
|
1966
|
-
{ "no_init", 'n', 0, G_OPTION_ARG_NONE,
|
1967
|
-
|
1946
|
+
{ "files", 'f', 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_files,
|
1947
|
+
"Input file(s) (default: stdin).", NULL },
|
1948
|
+
{ "configs", 'c', 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_configs,
|
1949
|
+
"Ruby configuration file(s).", NULL },
|
1950
|
+
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &opt_output,
|
1951
|
+
"Output file(s) (default: stdout).", NULL },
|
1952
|
+
{ "genout", 'g', 0, G_OPTION_ARG_STRING, &opt_genout,
|
1953
|
+
"Generate output file names (remove arg from input filename).", NULL },
|
1954
|
+
{ "cli_cmds", 'l', 0, G_OPTION_ARG_STRING_ARRAY, &opt_cli_cmds,
|
1955
|
+
"Command line configuration(s).", NULL },
|
1956
|
+
{ "beg_sep", 'b', 0, G_OPTION_ARG_STRING, &opt_beg_sep,
|
1957
|
+
"Set hookbeg separator (default: '-<').", NULL },
|
1958
|
+
{ "end_sep", 'e', 0, G_OPTION_ARG_STRING, &opt_end_sep,
|
1959
|
+
"Set hookend separator (default: '>-').", NULL },
|
1960
|
+
{ "esc_sep", 's', 0, G_OPTION_ARG_STRING, &opt_esc_sep,
|
1961
|
+
"Set hookesc separator (default: '\\').", NULL },
|
1962
|
+
{ "all_sep", 'a', 0, G_OPTION_ARG_STRING, &opt_all_sep,
|
1963
|
+
"Set all separators.", NULL },
|
1964
|
+
{ "module", 'm', 0, G_OPTION_ARG_NONE, &opt_module,
|
1965
|
+
"Include Mucgly module at startup.", NULL },
|
1966
|
+
{ "interact", 'i', 0, G_OPTION_ARG_NONE, &opt_interact,
|
1967
|
+
"Flush output for convenient interaction.", NULL },
|
1968
|
+
{ "no_init", 'n', 0, G_OPTION_ARG_NONE, &opt_no_init,
|
1969
|
+
"No init file (skip MUCGLY env var).", NULL },
|
1968
1970
|
{ NULL }
|
1969
1971
|
};
|
1970
1972
|
|
@@ -1997,9 +1999,7 @@ void mucgly_main( int argc, char** argv )
|
|
1997
1999
|
"MUCGLY env set, but the file \"%s\" does not exist!",
|
1998
2000
|
init );
|
1999
2001
|
else
|
2000
|
-
|
2001
|
-
ps_load_ruby_file( ps, init );
|
2002
|
-
}
|
2002
|
+
ps_load_ruby_file( ps, init );
|
2003
2003
|
}
|
2004
2004
|
}
|
2005
2005
|
|
@@ -2051,8 +2051,10 @@ void mucgly_main( int argc, char** argv )
|
|
2051
2051
|
|
2052
2052
|
|
2053
2053
|
if ( opt_interact )
|
2054
|
+
/* Flush output immediately in interactive mode. */
|
2054
2055
|
ps->flush = TRUE;
|
2055
2056
|
|
2057
|
+
|
2056
2058
|
/* Process input files. */
|
2057
2059
|
if ( opt_files )
|
2058
2060
|
{
|
@@ -2080,7 +2082,7 @@ void mucgly_main( int argc, char** argv )
|
|
2080
2082
|
|
2081
2083
|
|
2082
2084
|
#ifndef MUCGLY_LIB
|
2083
|
-
/**
|
2085
|
+
/**
|
2084
2086
|
* C-top entry point.
|
2085
2087
|
*
|
2086
2088
|
* @param argc Cli arg count.
|