crun 0.0.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.
- data/CHANGELOG.rdoc +3 -0
- data/LICENSE +20 -0
- data/README.rdoc +183 -0
- data/bin/crun +225 -0
- data/doc/Array.html +202 -0
- data/doc/Crun.html +186 -0
- data/doc/CrunMod.html +186 -0
- data/doc/_index.html +115 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.CHANGELOG.html +79 -0
- data/doc/file.README.html +260 -0
- data/doc/file_list.html +63 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +260 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +75 -0
- data/doc/top-level-namespace.html +282 -0
- data/examples/crun_conf.rb +2 -0
- data/examples/greeting.c +47 -0
- data/examples/hello.c +6 -0
- data/examples/sizeof.c +9 -0
- data/lib/version.rb +6 -0
- metadata +102 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: CHANGELOG
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!file.CHANGELOG.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
<span class="title">File: CHANGELOG</span>
|
36
|
+
|
37
|
+
|
38
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">
|
42
|
+
|
43
|
+
<a class="full_list_link" id="class_list_link"
|
44
|
+
href="class_list.html">
|
45
|
+
Class List
|
46
|
+
</a>
|
47
|
+
|
48
|
+
<a class="full_list_link" id="method_list_link"
|
49
|
+
href="method_list.html">
|
50
|
+
Method List
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<a class="full_list_link" id="file_list_link"
|
54
|
+
href="file_list.html">
|
55
|
+
File List
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><div id='filecontents'>
|
65
|
+
<h1 id="label-Version+history">Version history</h1>
|
66
|
+
<dl class="rdoc-list label-list"><dt>0.0.1
|
67
|
+
<dd>
|
68
|
+
<p>Initial version.</p>
|
69
|
+
</dd></dl>
|
70
|
+
</div></div>
|
71
|
+
|
72
|
+
<div id="footer">
|
73
|
+
Generated on Sun Dec 25 20:31:45 2016 by
|
74
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
75
|
+
0.8.7.6 (ruby-2.3.1).
|
76
|
+
</div>
|
77
|
+
|
78
|
+
</body>
|
79
|
+
</html>
|
@@ -0,0 +1,260 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!file.README.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
<span class="title">File: README</span>
|
36
|
+
|
37
|
+
|
38
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">
|
42
|
+
|
43
|
+
<a class="full_list_link" id="class_list_link"
|
44
|
+
href="class_list.html">
|
45
|
+
Class List
|
46
|
+
</a>
|
47
|
+
|
48
|
+
<a class="full_list_link" id="method_list_link"
|
49
|
+
href="method_list.html">
|
50
|
+
Method List
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<a class="full_list_link" id="file_list_link"
|
54
|
+
href="file_list.html">
|
55
|
+
File List
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><div id='filecontents'>
|
65
|
+
<h1 id="label-Crun">Crun</h1>
|
66
|
+
<ul><li>
|
67
|
+
<p>Introduction</p>
|
68
|
+
</li><li>
|
69
|
+
<p>Example runs</p>
|
70
|
+
</li><li>
|
71
|
+
<p>Options</p>
|
72
|
+
</li><li>
|
73
|
+
<p>Issues</p>
|
74
|
+
</li></ul>
|
75
|
+
|
76
|
+
<h1 id="label-Introduction">Introduction</h1>
|
77
|
+
|
78
|
+
<p>Crun is an utility for compiling and running C-programs straight from C
|
79
|
+
source files. Crun supports compile-run and compile-debug flows.</p>
|
80
|
+
|
81
|
+
<p>You can embed custom compile options into the main c-file, if you need, for
|
82
|
+
example, an external library for the program. You can also control the
|
83
|
+
command line parameters passed to the program through Crun.</p>
|
84
|
+
|
85
|
+
<p>Crun is usually used with one c-file, i.e. the main file. However program
|
86
|
+
can be split into multiple files, but main has to be first in the list of
|
87
|
+
files. Crun is targeted for small C-programs, so it is not typical to have
|
88
|
+
multiple files.</p>
|
89
|
+
|
90
|
+
<p>User of Crun is most probably trying out some basic C-features or maybe
|
91
|
+
prototyping with some algorithm.</p>
|
92
|
+
|
93
|
+
<h1 id="label-Example+runs">Example runs</h1>
|
94
|
+
|
95
|
+
<p>In order to run “Hello World” example with Crun, you need to have the C
|
96
|
+
source file with “Hello World” program in it. This is available in the
|
97
|
+
“examples” directory for you.</p>
|
98
|
+
|
99
|
+
<p>“hello.c” content:</p>
|
100
|
+
|
101
|
+
<pre class="code ruby"><code class="ruby">#include <stdio.h>
|
102
|
+
int main( int argc, char** argv )
|
103
|
+
{
|
104
|
+
printf( "Hello World!\n" );
|
105
|
+
return 0;
|
106
|
+
}</code></pre>
|
107
|
+
|
108
|
+
<p>You can execute compile-run flow by:</p>
|
109
|
+
|
110
|
+
<pre class="code ruby"><code class="ruby">shell> crun -f examples/hello.c</code></pre>
|
111
|
+
|
112
|
+
<p>The output from program is:</p>
|
113
|
+
|
114
|
+
<pre class="code ruby"><code class="ruby"><span class='const'>Hello</span> <span class='id identifier rubyid_World!'>World!</span>
|
115
|
+
</code></pre>
|
116
|
+
|
117
|
+
<p>You can execute compile-debug flow by:</p>
|
118
|
+
|
119
|
+
<pre class="code ruby"><code class="ruby">shell> crun -f examples/hello.c -d</code></pre>
|
120
|
+
|
121
|
+
<p>Program is compiled and gdb is started so that the program stops at “main”
|
122
|
+
(i.e. default behavior).</p>
|
123
|
+
|
124
|
+
<p>Check available command line interface, CLI, options for Crun:</p>
|
125
|
+
|
126
|
+
<pre class="code ruby"><code class="ruby">shell> crun -h</code></pre>
|
127
|
+
|
128
|
+
<h1 id="label-Options">Options</h1>
|
129
|
+
|
130
|
+
<p>You can specify options for Crun in multiple ways. Typically CLI is used to
|
131
|
+
control Crun, but if the program uses static compilation options, those
|
132
|
+
live most naturally in the source file itself.</p>
|
133
|
+
|
134
|
+
<p>Options are stored to a hash called “@crun”. Each option name is a key in
|
135
|
+
the hash, and the option values are Arrays.</p>
|
136
|
+
|
137
|
+
<p>For example the entry:</p>
|
138
|
+
|
139
|
+
<pre class="code ruby"><code class="ruby"><span class='ivar'>@crun</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>progopts</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
140
|
+
</code></pre>
|
141
|
+
|
142
|
+
<p>specify the command line parameters given to the program compiled and run
|
143
|
+
by Crun.</p>
|
144
|
+
|
145
|
+
<p>Here is the complete list of options that control Crun:</p>
|
146
|
+
<dl class="rdoc-list label-list"><dt> compopts
|
147
|
+
<dd>
|
148
|
+
<p>Array of user's compilation options. E.g. “-l lm” to include the math
|
149
|
+
lib. Default is: [].</p>
|
150
|
+
</dd><dt> progopts
|
151
|
+
<dd>
|
152
|
+
<p>Array of command line parameters for the program run. E.g. [“-c 12”].
|
153
|
+
Default is: [].</p>
|
154
|
+
</dd><dt> stopopts
|
155
|
+
<dd>
|
156
|
+
<p>Array of breakpoints for the debugger. E.g. [“add”] defines that the
|
157
|
+
debugger stops at “add” function. Default is: [“main”].</p>
|
158
|
+
</dd><dt> compprog
|
159
|
+
<dd>
|
160
|
+
<p>Array including the compiler name and base options. This options array
|
161
|
+
should only have one entry, but in theory you could have multiple entries.
|
162
|
+
The entries are concatenated with SPACE. The compiler command has to have
|
163
|
+
same command line parameters as “gcc”. Default is: [“gcc”, “-Wall”,
|
164
|
+
“-std=c11”].</p>
|
165
|
+
</dd><dt> dbugprog
|
166
|
+
<dd>
|
167
|
+
<p>Array including the debugger name and base options. This options array
|
168
|
+
should only have one entry, but in theory you could have multiple entries.
|
169
|
+
The entries are concatenated with SPACE. The debugger command has to have
|
170
|
+
same command line parameters as “gdb”. Default is: [“gdb”, “–nx”].</p>
|
171
|
+
</dd><dt> crunopts
|
172
|
+
<dd>
|
173
|
+
<p>Array of compiler options managed by Crun. User don't have to control
|
174
|
+
this option. Default is: [].</p>
|
175
|
+
</dd></dl>
|
176
|
+
|
177
|
+
<p>Crun sets Options to default values and then applies the user overrides
|
178
|
+
from various sources, given below.</p>
|
179
|
+
|
180
|
+
<p>User can embed the options to the C source file. This is the recommended
|
181
|
+
way because this way the settings will follow the code. Additional
|
182
|
+
compilation options and CLI options for the compiled program would be given
|
183
|
+
as:</p>
|
184
|
+
|
185
|
+
<pre class="code ruby"><code class="ruby"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>*
|
186
|
+
* Options for crun:
|
187
|
+
* -crun-compopts:=-O2
|
188
|
+
* crun-compopts:+-lm
|
189
|
+
* crun-progopts:=-c 12
|
190
|
+
*</span><span class='regexp_end'>/</span></span></code></pre>
|
191
|
+
|
192
|
+
<p>The syntax is “crun-<option>”. If there is no space before “crun”,
|
193
|
+
the setting is not used, i.e. first “compopts” is neglected above.</p>
|
194
|
+
|
195
|
+
<p>User can specify static overrides in “$HOME/.crun” file and/or in
|
196
|
+
“./.crun”. In addition to these predefined files, user can use the “-c”
|
197
|
+
Crun CLI option to read in option overrides.</p>
|
198
|
+
|
199
|
+
<p>For example if the program is always run with “-c 10” command line options,
|
200
|
+
you use this in “.crun”:</p>
|
201
|
+
|
202
|
+
<pre class="code ruby"><code class="ruby"><span class='ivar'>@crun</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>progopts</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-c 10</span><span class='tstring_end'>"</span></span> <span class='rbracket'>]</span>
|
203
|
+
</code></pre>
|
204
|
+
|
205
|
+
<p>An alternative way to achieve the same thing is to use Crun CLI and use the
|
206
|
+
-o option:</p>
|
207
|
+
|
208
|
+
<pre class="code ruby"><code class="ruby">shell> crun -o "progopts:=-c 10" ...</code></pre>
|
209
|
+
|
210
|
+
<p>This sets the list of program options to “-c 10”. “:=” syntax means setting
|
211
|
+
the Array of options. If you need to add to existing list of options, you
|
212
|
+
should do:</p>
|
213
|
+
|
214
|
+
<pre class="code ruby"><code class="ruby">shell> crun -o "progopts:+-c 10" ...</code></pre>
|
215
|
+
|
216
|
+
<p>Thus “:+” is the syntax for appending more options to existing list.</p>
|
217
|
+
|
218
|
+
<p>The simplest way to pass 'progopts' to target program is using the
|
219
|
+
“-p” CLI option. However user must be aware of the shell option parsing,
|
220
|
+
since it is very easy to miss the target program and actually pass the
|
221
|
+
option to Crun.</p>
|
222
|
+
|
223
|
+
<p>If you want to pass '-' based option to target program:</p>
|
224
|
+
|
225
|
+
<pre class="code ruby"><code class="ruby">shell> crun -p "\-c 10" ...</code></pre>
|
226
|
+
|
227
|
+
<p>The backslash before “-c” will ensure that “-c” does not become an option
|
228
|
+
for Crun.</p>
|
229
|
+
|
230
|
+
<p>Summary of option setting from first to last:</p>
|
231
|
+
<ul><li>
|
232
|
+
<p>Defaults (from crun program).</p>
|
233
|
+
</li><li>
|
234
|
+
<p>“.crun” from home directory.</p>
|
235
|
+
</li><li>
|
236
|
+
<p>“.crun” from current directory.</p>
|
237
|
+
</li><li>
|
238
|
+
<p>“-c” options from files.</p>
|
239
|
+
</li><li>
|
240
|
+
<p>“-o” options from Crun CLI.</p>
|
241
|
+
</li><li>
|
242
|
+
<p>“-p” options for program (only).</p>
|
243
|
+
</li><li>
|
244
|
+
<p>Options embedded to C source file (main file).</p>
|
245
|
+
</li></ul>
|
246
|
+
|
247
|
+
<h1 id="label-Issues">Issues</h1>
|
248
|
+
|
249
|
+
<p>If you take C source input from STDIN, you can't use the debug option.
|
250
|
+
Only compile-run flow is possible.</p>
|
251
|
+
</div></div>
|
252
|
+
|
253
|
+
<div id="footer">
|
254
|
+
Generated on Sun Dec 25 20:31:45 2016 by
|
255
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
256
|
+
0.8.7.6 (ruby-2.3.1).
|
257
|
+
</div>
|
258
|
+
|
259
|
+
</body>
|
260
|
+
</html>
|
data/doc/file_list.html
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<title>File List</title>
|
19
|
+
<base id="base_target" target="_parent" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<script type="text/javascript" charset="utf-8">
|
23
|
+
var hasFrames = false;
|
24
|
+
try {
|
25
|
+
hasFrames = window.top.frames.main ? true : false;
|
26
|
+
} catch (e) { }
|
27
|
+
if (hasFrames) {
|
28
|
+
document.getElementById('base_target').target = 'main';
|
29
|
+
document.body.className = 'frames';
|
30
|
+
}
|
31
|
+
</script>
|
32
|
+
<div id="content">
|
33
|
+
<h1 id="full_list_header">File List</h1>
|
34
|
+
<div id="nav">
|
35
|
+
|
36
|
+
<span><a target="_self" href="class_list.html">
|
37
|
+
Classes
|
38
|
+
</a></span>
|
39
|
+
|
40
|
+
<span><a target="_self" href="method_list.html">
|
41
|
+
Methods
|
42
|
+
</a></span>
|
43
|
+
|
44
|
+
<span><a target="_self" href="file_list.html">
|
45
|
+
Files
|
46
|
+
</a></span>
|
47
|
+
|
48
|
+
</div>
|
49
|
+
<div id="search">Search: <input type="text" /></div>
|
50
|
+
|
51
|
+
<ul id="full_list" class="file">
|
52
|
+
|
53
|
+
|
54
|
+
<li class="r1"><span class="object_link"><a href="index.html" title="README">README</a></a></li>
|
55
|
+
|
56
|
+
|
57
|
+
<li class="r2"><span class="object_link"><a href="file.CHANGELOG.html" title="CHANGELOG">CHANGELOG</a></a></li>
|
58
|
+
|
59
|
+
|
60
|
+
</ul>
|
61
|
+
</div>
|
62
|
+
</body>
|
63
|
+
</html>
|
data/doc/frames.html
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
+
<title>Documentation by YARD 0.8.7.6</title>
|
8
|
+
</head>
|
9
|
+
<script type="text/javascript" charset="utf-8">
|
10
|
+
window.onload = function() {
|
11
|
+
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
12
|
+
var name = match ? match[1] : 'index.html';
|
13
|
+
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
14
|
+
document.writeln('<frameset cols="20%,*">' +
|
15
|
+
'<frame name="list" src="class_list.html" />' +
|
16
|
+
'<frame name="main" src="' + escape(name) + '" />' +
|
17
|
+
'</frameset>');
|
18
|
+
}
|
19
|
+
</script>
|
20
|
+
<noscript>
|
21
|
+
<frameset cols="20%,*">
|
22
|
+
<frame name="list" src="class_list.html" />
|
23
|
+
<frame name="main" src="index.html" />
|
24
|
+
</frameset>
|
25
|
+
</noscript>
|
26
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,260 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!file.README.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
<span class="title">File: README</span>
|
36
|
+
|
37
|
+
|
38
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">
|
42
|
+
|
43
|
+
<a class="full_list_link" id="class_list_link"
|
44
|
+
href="class_list.html">
|
45
|
+
Class List
|
46
|
+
</a>
|
47
|
+
|
48
|
+
<a class="full_list_link" id="method_list_link"
|
49
|
+
href="method_list.html">
|
50
|
+
Method List
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<a class="full_list_link" id="file_list_link"
|
54
|
+
href="file_list.html">
|
55
|
+
File List
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><div id='filecontents'>
|
65
|
+
<h1 id="label-Crun">Crun</h1>
|
66
|
+
<ul><li>
|
67
|
+
<p>Introduction</p>
|
68
|
+
</li><li>
|
69
|
+
<p>Example runs</p>
|
70
|
+
</li><li>
|
71
|
+
<p>Options</p>
|
72
|
+
</li><li>
|
73
|
+
<p>Issues</p>
|
74
|
+
</li></ul>
|
75
|
+
|
76
|
+
<h1 id="label-Introduction">Introduction</h1>
|
77
|
+
|
78
|
+
<p>Crun is an utility for compiling and running C-programs straight from C
|
79
|
+
source files. Crun supports compile-run and compile-debug flows.</p>
|
80
|
+
|
81
|
+
<p>You can embed custom compile options into the main c-file, if you need, for
|
82
|
+
example, an external library for the program. You can also control the
|
83
|
+
command line parameters passed to the program through Crun.</p>
|
84
|
+
|
85
|
+
<p>Crun is usually used with one c-file, i.e. the main file. However program
|
86
|
+
can be split into multiple files, but main has to be first in the list of
|
87
|
+
files. Crun is targeted for small C-programs, so it is not typical to have
|
88
|
+
multiple files.</p>
|
89
|
+
|
90
|
+
<p>User of Crun is most probably trying out some basic C-features or maybe
|
91
|
+
prototyping with some algorithm.</p>
|
92
|
+
|
93
|
+
<h1 id="label-Example+runs">Example runs</h1>
|
94
|
+
|
95
|
+
<p>In order to run “Hello World” example with Crun, you need to have the C
|
96
|
+
source file with “Hello World” program in it. This is available in the
|
97
|
+
“examples” directory for you.</p>
|
98
|
+
|
99
|
+
<p>“hello.c” content:</p>
|
100
|
+
|
101
|
+
<pre class="code ruby"><code class="ruby">#include <stdio.h>
|
102
|
+
int main( int argc, char** argv )
|
103
|
+
{
|
104
|
+
printf( "Hello World!\n" );
|
105
|
+
return 0;
|
106
|
+
}</code></pre>
|
107
|
+
|
108
|
+
<p>You can execute compile-run flow by:</p>
|
109
|
+
|
110
|
+
<pre class="code ruby"><code class="ruby">shell> crun -f examples/hello.c</code></pre>
|
111
|
+
|
112
|
+
<p>The output from program is:</p>
|
113
|
+
|
114
|
+
<pre class="code ruby"><code class="ruby"><span class='const'>Hello</span> <span class='id identifier rubyid_World!'>World!</span>
|
115
|
+
</code></pre>
|
116
|
+
|
117
|
+
<p>You can execute compile-debug flow by:</p>
|
118
|
+
|
119
|
+
<pre class="code ruby"><code class="ruby">shell> crun -f examples/hello.c -d</code></pre>
|
120
|
+
|
121
|
+
<p>Program is compiled and gdb is started so that the program stops at “main”
|
122
|
+
(i.e. default behavior).</p>
|
123
|
+
|
124
|
+
<p>Check available command line interface, CLI, options for Crun:</p>
|
125
|
+
|
126
|
+
<pre class="code ruby"><code class="ruby">shell> crun -h</code></pre>
|
127
|
+
|
128
|
+
<h1 id="label-Options">Options</h1>
|
129
|
+
|
130
|
+
<p>You can specify options for Crun in multiple ways. Typically CLI is used to
|
131
|
+
control Crun, but if the program uses static compilation options, those
|
132
|
+
live most naturally in the source file itself.</p>
|
133
|
+
|
134
|
+
<p>Options are stored to a hash called “@crun”. Each option name is a key in
|
135
|
+
the hash, and the option values are Arrays.</p>
|
136
|
+
|
137
|
+
<p>For example the entry:</p>
|
138
|
+
|
139
|
+
<pre class="code ruby"><code class="ruby"><span class='ivar'>@crun</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>progopts</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
140
|
+
</code></pre>
|
141
|
+
|
142
|
+
<p>specify the command line parameters given to the program compiled and run
|
143
|
+
by Crun.</p>
|
144
|
+
|
145
|
+
<p>Here is the complete list of options that control Crun:</p>
|
146
|
+
<dl class="rdoc-list label-list"><dt> compopts
|
147
|
+
<dd>
|
148
|
+
<p>Array of user's compilation options. E.g. “-l lm” to include the math
|
149
|
+
lib. Default is: [].</p>
|
150
|
+
</dd><dt> progopts
|
151
|
+
<dd>
|
152
|
+
<p>Array of command line parameters for the program run. E.g. [“-c 12”].
|
153
|
+
Default is: [].</p>
|
154
|
+
</dd><dt> stopopts
|
155
|
+
<dd>
|
156
|
+
<p>Array of breakpoints for the debugger. E.g. [“add”] defines that the
|
157
|
+
debugger stops at “add” function. Default is: [“main”].</p>
|
158
|
+
</dd><dt> compprog
|
159
|
+
<dd>
|
160
|
+
<p>Array including the compiler name and base options. This options array
|
161
|
+
should only have one entry, but in theory you could have multiple entries.
|
162
|
+
The entries are concatenated with SPACE. The compiler command has to have
|
163
|
+
same command line parameters as “gcc”. Default is: [“gcc”, “-Wall”,
|
164
|
+
“-std=c11”].</p>
|
165
|
+
</dd><dt> dbugprog
|
166
|
+
<dd>
|
167
|
+
<p>Array including the debugger name and base options. This options array
|
168
|
+
should only have one entry, but in theory you could have multiple entries.
|
169
|
+
The entries are concatenated with SPACE. The debugger command has to have
|
170
|
+
same command line parameters as “gdb”. Default is: [“gdb”, “–nx”].</p>
|
171
|
+
</dd><dt> crunopts
|
172
|
+
<dd>
|
173
|
+
<p>Array of compiler options managed by Crun. User don't have to control
|
174
|
+
this option. Default is: [].</p>
|
175
|
+
</dd></dl>
|
176
|
+
|
177
|
+
<p>Crun sets Options to default values and then applies the user overrides
|
178
|
+
from various sources, given below.</p>
|
179
|
+
|
180
|
+
<p>User can embed the options to the C source file. This is the recommended
|
181
|
+
way because this way the settings will follow the code. Additional
|
182
|
+
compilation options and CLI options for the compiled program would be given
|
183
|
+
as:</p>
|
184
|
+
|
185
|
+
<pre class="code ruby"><code class="ruby"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>*
|
186
|
+
* Options for crun:
|
187
|
+
* -crun-compopts:=-O2
|
188
|
+
* crun-compopts:+-lm
|
189
|
+
* crun-progopts:=-c 12
|
190
|
+
*</span><span class='regexp_end'>/</span></span></code></pre>
|
191
|
+
|
192
|
+
<p>The syntax is “crun-<option>”. If there is no space before “crun”,
|
193
|
+
the setting is not used, i.e. first “compopts” is neglected above.</p>
|
194
|
+
|
195
|
+
<p>User can specify static overrides in “$HOME/.crun” file and/or in
|
196
|
+
“./.crun”. In addition to these predefined files, user can use the “-c”
|
197
|
+
Crun CLI option to read in option overrides.</p>
|
198
|
+
|
199
|
+
<p>For example if the program is always run with “-c 10” command line options,
|
200
|
+
you use this in “.crun”:</p>
|
201
|
+
|
202
|
+
<pre class="code ruby"><code class="ruby"><span class='ivar'>@crun</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>progopts</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-c 10</span><span class='tstring_end'>"</span></span> <span class='rbracket'>]</span>
|
203
|
+
</code></pre>
|
204
|
+
|
205
|
+
<p>An alternative way to achieve the same thing is to use Crun CLI and use the
|
206
|
+
-o option:</p>
|
207
|
+
|
208
|
+
<pre class="code ruby"><code class="ruby">shell> crun -o "progopts:=-c 10" ...</code></pre>
|
209
|
+
|
210
|
+
<p>This sets the list of program options to “-c 10”. “:=” syntax means setting
|
211
|
+
the Array of options. If you need to add to existing list of options, you
|
212
|
+
should do:</p>
|
213
|
+
|
214
|
+
<pre class="code ruby"><code class="ruby">shell> crun -o "progopts:+-c 10" ...</code></pre>
|
215
|
+
|
216
|
+
<p>Thus “:+” is the syntax for appending more options to existing list.</p>
|
217
|
+
|
218
|
+
<p>The simplest way to pass 'progopts' to target program is using the
|
219
|
+
“-p” CLI option. However user must be aware of the shell option parsing,
|
220
|
+
since it is very easy to miss the target program and actually pass the
|
221
|
+
option to Crun.</p>
|
222
|
+
|
223
|
+
<p>If you want to pass '-' based option to target program:</p>
|
224
|
+
|
225
|
+
<pre class="code ruby"><code class="ruby">shell> crun -p "\-c 10" ...</code></pre>
|
226
|
+
|
227
|
+
<p>The backslash before “-c” will ensure that “-c” does not become an option
|
228
|
+
for Crun.</p>
|
229
|
+
|
230
|
+
<p>Summary of option setting from first to last:</p>
|
231
|
+
<ul><li>
|
232
|
+
<p>Defaults (from crun program).</p>
|
233
|
+
</li><li>
|
234
|
+
<p>“.crun” from home directory.</p>
|
235
|
+
</li><li>
|
236
|
+
<p>“.crun” from current directory.</p>
|
237
|
+
</li><li>
|
238
|
+
<p>“-c” options from files.</p>
|
239
|
+
</li><li>
|
240
|
+
<p>“-o” options from Crun CLI.</p>
|
241
|
+
</li><li>
|
242
|
+
<p>“-p” options for program (only).</p>
|
243
|
+
</li><li>
|
244
|
+
<p>Options embedded to C source file (main file).</p>
|
245
|
+
</li></ul>
|
246
|
+
|
247
|
+
<h1 id="label-Issues">Issues</h1>
|
248
|
+
|
249
|
+
<p>If you take C source input from STDIN, you can't use the debug option.
|
250
|
+
Only compile-run flow is possible.</p>
|
251
|
+
</div></div>
|
252
|
+
|
253
|
+
<div id="footer">
|
254
|
+
Generated on Sun Dec 25 20:31:45 2016 by
|
255
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
256
|
+
0.8.7.6 (ruby-2.3.1).
|
257
|
+
</div>
|
258
|
+
|
259
|
+
</body>
|
260
|
+
</html>
|