RubyInlineWithoutZenTest 3.12.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/History.txt +470 -0
- data/LICENSE.txt +22 -0
- data/Manifest.txt +12 -0
- data/README.md +29 -0
- data/README.txt +138 -0
- data/Rakefile +17 -0
- data/demo/fastmath.rb +27 -0
- data/demo/hello.rb +13 -0
- data/example.rb +86 -0
- data/example2.rb +33 -0
- data/lib/inline/mapping.rb +119 -0
- data/lib/inline/version.rb +3 -0
- data/lib/inline.rb +902 -0
- data/rubyinlinewithoutzentest.gemspec +39 -0
- data/test/test_inline.rb +1059 -0
- data/tutorial/example1.rb +63 -0
- data/tutorial/example2.rb +96 -0
- metadata +127 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/History.txt
ADDED
@@ -0,0 +1,470 @@
|
|
1
|
+
=== 3.12.2 / 2013-04-18
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Added #prefix code to MD5 calculation to force rebuilds on non-signature changes.
|
6
|
+
* Separated out #prefix code from #src.
|
7
|
+
|
8
|
+
=== 3.12.1 / 2013-02-14
|
9
|
+
|
10
|
+
* 2 bug fixes:
|
11
|
+
|
12
|
+
* Fixes for maglev to find headers in the correct location.
|
13
|
+
* Fixes for tests, mostly for maglev.
|
14
|
+
|
15
|
+
=== 3.12.0 / 2012-12-18
|
16
|
+
|
17
|
+
* 1 major enhancement:
|
18
|
+
|
19
|
+
* map_ruby_const prefixes c-vars with 'c' (eg Name -> cName).
|
20
|
+
|
21
|
+
* 1 minor enhancement:
|
22
|
+
|
23
|
+
* Added #add_id to make interning symbols in C clean and easy
|
24
|
+
|
25
|
+
=== 3.11.4 / 2012-11-23
|
26
|
+
|
27
|
+
* 1 minor enhancement:
|
28
|
+
|
29
|
+
* Improve windows compatibility (MinGW). (luislavena)
|
30
|
+
|
31
|
+
=== 3.11.3 / 2012-07-05
|
32
|
+
|
33
|
+
* 1 bug fix:
|
34
|
+
|
35
|
+
* Fixes for non-mingw windoze builds. (imperator)
|
36
|
+
|
37
|
+
=== 3.11.2 / 2012-02-22
|
38
|
+
|
39
|
+
* 1 bug fix:
|
40
|
+
|
41
|
+
* Added terrible hack to fix mingw's embedded make macros in rbconfig. (rdp)
|
42
|
+
|
43
|
+
=== 3.11.1 / 2012-01-25
|
44
|
+
|
45
|
+
* 1 bug fix:
|
46
|
+
|
47
|
+
* Use Ruby's LDFLAGS config variable. (maharg)
|
48
|
+
|
49
|
+
=== 3.11.0 / 2011-09-27
|
50
|
+
|
51
|
+
* 1 major enhancement:
|
52
|
+
|
53
|
+
* Removed Module#options
|
54
|
+
|
55
|
+
=== 3.10.1 / 2011-09-13
|
56
|
+
|
57
|
+
* 1 bug fix:
|
58
|
+
|
59
|
+
* Fix crap_for_windoze to use RbConfig for RUBY_SO_NAME. (jasonrickman)
|
60
|
+
|
61
|
+
=== 3.10.0 / 2011-08-30
|
62
|
+
|
63
|
+
* 2 minor enhancements:
|
64
|
+
|
65
|
+
* Added engined/versioned subdir to .ruby_inline to help with multiple-ruby usage. (valodzka)
|
66
|
+
* Extended file/module naming to avoid hash collisions. (apohllo)
|
67
|
+
|
68
|
+
* 2 bug fixes:
|
69
|
+
|
70
|
+
* Fixed examples for 1.9 compatibility.
|
71
|
+
* Use RbConfig instead of Config. (apohllo)
|
72
|
+
|
73
|
+
=== 3.9.0 / 2011-02-18
|
74
|
+
|
75
|
+
* 1 minor enhancement:
|
76
|
+
|
77
|
+
* Added arity override option for all C builder methods.
|
78
|
+
|
79
|
+
=== 3.8.6 / 2010-09-03
|
80
|
+
|
81
|
+
* 1 bug fix:
|
82
|
+
|
83
|
+
* Had to fix the ZenTest dependency to work with the whole 4.x series
|
84
|
+
|
85
|
+
=== 3.8.5 / 2010-09-01
|
86
|
+
|
87
|
+
* 1 bug fix:
|
88
|
+
|
89
|
+
* Added DLDFLAGS to compiler flags to fix OSX linking on 1.9.2
|
90
|
+
|
91
|
+
=== 3.8.4 / 2009-12-09
|
92
|
+
|
93
|
+
* 1 bug fix:
|
94
|
+
|
95
|
+
* Clean up example.rb and force removal of ~/.ruby_inline
|
96
|
+
|
97
|
+
=== 3.8.3 / 2009-08-07
|
98
|
+
|
99
|
+
* 1 minor enhancement:
|
100
|
+
|
101
|
+
* Added Inline::C#add_static to make consts cleaner
|
102
|
+
|
103
|
+
=== 3.8.2 / 2009-06-23
|
104
|
+
|
105
|
+
* 1 bug fix:
|
106
|
+
|
107
|
+
* ruby 1.9 expands __FILE__ and broke my tests
|
108
|
+
|
109
|
+
=== 3.8.1 / 2008-10-24
|
110
|
+
|
111
|
+
* 1 minor enhancement
|
112
|
+
|
113
|
+
* Inline registers all classes for hoe's INLINE=1 packaging feature.
|
114
|
+
|
115
|
+
=== 3.8.0 / 2008-10-22
|
116
|
+
|
117
|
+
* 8 minor enhancements:
|
118
|
+
|
119
|
+
* Inline::C now uses ZenTestMapping to automatically map C functions to ruby
|
120
|
+
names.
|
121
|
+
* Inline::C#map_c_const can now map to a ruby constant name.
|
122
|
+
* Added accessors for members of Data_Wrap_Structs. See Inline::C#accessor.
|
123
|
+
* Added long long, unsigned long long, off_t types to built-in type map.
|
124
|
+
* Added #alias_type_converter and #remove_type_converter.
|
125
|
+
* Consider MinGW (mingw) as valid Windows platform.
|
126
|
+
* Properly fallback to all the environment options under Windows. #22511.
|
127
|
+
* Properly join path under OS with drive letters. #22292.
|
128
|
+
|
129
|
+
* 1 bug fixes:
|
130
|
+
|
131
|
+
* Inline::C now uses rb_define_alloc_func().
|
132
|
+
|
133
|
+
=== 3.7.0 / 2008-06-09
|
134
|
+
|
135
|
+
* 1 major enhancements:
|
136
|
+
|
137
|
+
* Removed inline_package in favor of hoe's packaging.
|
138
|
+
|
139
|
+
* 2 minor enhancements:
|
140
|
+
|
141
|
+
* Switched from warn/exit to abort to fix buffering for error messages.
|
142
|
+
* Improved some error messages.
|
143
|
+
|
144
|
+
* 2 bug fixes:
|
145
|
+
|
146
|
+
* Fixes for rubinius.
|
147
|
+
* Fixes for 1.9.
|
148
|
+
|
149
|
+
=== 3.6.7 / 2008-03-20
|
150
|
+
|
151
|
+
* 3 minor enhancements:
|
152
|
+
|
153
|
+
* Added ability to work entirely without .ruby_inline dir. Thanks Kevin Clark!
|
154
|
+
* Updated history, readme, and rakefile for new hoe abilities.
|
155
|
+
* Cleaned up some really ugly schlock. Man, compiling sucks!
|
156
|
+
|
157
|
+
* 2 bug fixes:
|
158
|
+
|
159
|
+
* Fixes for 1.9.
|
160
|
+
* Add -I for platform-specific header dir (for ruby/config.h).
|
161
|
+
|
162
|
+
=== 3.6.6 / 2007-12-27
|
163
|
+
|
164
|
+
* 1 minor enhancement:
|
165
|
+
|
166
|
+
* Enhanced windows support thanks to Luis Lavena.
|
167
|
+
|
168
|
+
=== 3.6.5 / 2007-11-08
|
169
|
+
|
170
|
+
* 1 minor enhancement:
|
171
|
+
|
172
|
+
* Quick fix for OSX 10.5 native ruby (should be fixed in 10.5.2).
|
173
|
+
|
174
|
+
=== 3.6.4 / 2007-08-20
|
175
|
+
|
176
|
+
* 1 minor enhancement:
|
177
|
+
|
178
|
+
* Added ability to include ruby.h last. Thanks to Luc Heinrich.
|
179
|
+
|
180
|
+
=== 3.6.3 / 2007-04-27
|
181
|
+
|
182
|
+
* 7 minor enhancements:
|
183
|
+
|
184
|
+
* Added map_ruby_const and map_c_const to C builder.
|
185
|
+
* Converted example.rb to a real benchmark setup.
|
186
|
+
* Improved error messages.
|
187
|
+
* Added options hash for all C builder methods.
|
188
|
+
* Options hash can take optional :method_name param to have ruby name diff from c.
|
189
|
+
* Converted to a more traditional setup. Now I can heckle!
|
190
|
+
* Cleaned up ruby.h search.
|
191
|
+
|
192
|
+
* 2 bug fixes:
|
193
|
+
|
194
|
+
* Added CCDLFLAGS. _Should_ pick up -fPIC on misconfigured 64 bit machines.
|
195
|
+
* Broke up all warnings so progress report was cleaner.
|
196
|
+
|
197
|
+
=== 3.6.2 / 2006-10-12
|
198
|
+
|
199
|
+
* 2 bug fixes:
|
200
|
+
|
201
|
+
* comment stripper much more sane to fix problems on certain linux distros
|
202
|
+
* fixed a nit with older C compilers.
|
203
|
+
|
204
|
+
=== 3.6.1 / 2006-10-11
|
205
|
+
|
206
|
+
* 1 minor enhancement
|
207
|
+
|
208
|
+
* Hoe'd the Rakefile. :P
|
209
|
+
|
210
|
+
* 2 bug fixes
|
211
|
+
|
212
|
+
* Removed VALUE from @types because it is now in @@type_map.
|
213
|
+
* Tweak added for mingw32.
|
214
|
+
|
215
|
+
=== 3.6.0 / 2005-11-30 (omg I suck: actual release: 2006-09-15)
|
216
|
+
|
217
|
+
* 6 minor enhancements
|
218
|
+
|
219
|
+
* C builder can now be used directly for other foreign language glue.
|
220
|
+
* Pretty much all (c) functions are plain argument style, not argc/argv.
|
221
|
+
* Added Nathaniel and Dan's patches for windows support.
|
222
|
+
* Added VALUE as a default known type.
|
223
|
+
* Improved testing under $DEBUG.
|
224
|
+
* Deprecated $INLINE_FLAGS and $INLINE_LIBS are dead.
|
225
|
+
|
226
|
+
* 3 bug fixes
|
227
|
+
|
228
|
+
* Fixed a number of issues wrt testing.
|
229
|
+
* Cleaned up and cached certain calculations.
|
230
|
+
* Some windows compiler fixes went in, but MS compiler is a PITA still.
|
231
|
+
|
232
|
+
=== 3.5.0 / 2005-10-15
|
233
|
+
|
234
|
+
* 4 minor enhancements
|
235
|
+
|
236
|
+
* Switched to install for Makefile.
|
237
|
+
* Lots of minor cleanup.
|
238
|
+
* Added add_to_init to extend init methods. Great hack!
|
239
|
+
* Added 2 demo files used in the rubyconf 2005 presentation.
|
240
|
+
|
241
|
+
* 1 bug fix
|
242
|
+
|
243
|
+
* Fixed example in README.txt. OOPS!
|
244
|
+
|
245
|
+
=== 3.4.0 / 2005-07-13
|
246
|
+
|
247
|
+
* 2 minor enhancement
|
248
|
+
|
249
|
+
* Changed inline to take the language and a hash of options.
|
250
|
+
* Still backwards compatible, for now, and emits a warning.
|
251
|
+
* Options are available via the builder passed to your block.
|
252
|
+
|
253
|
+
* 2 bug fixes
|
254
|
+
|
255
|
+
* Modified caller discovery, yet again, due to changes in ruby 1.8.3.
|
256
|
+
* More compatible and clean with non-gems systems.
|
257
|
+
|
258
|
+
=== 3.3.2 / 2005-05-19
|
259
|
+
|
260
|
+
* 4 bug fixes
|
261
|
+
|
262
|
+
* Fixed a line number issue when using c_raw w/ multi-line signatures.
|
263
|
+
* Inline can now be invoked multiple times per class.
|
264
|
+
* Filled out rdoc.
|
265
|
+
* Fixed some old tests.
|
266
|
+
|
267
|
+
=== 3.3.1 / 2005-05-03
|
268
|
+
|
269
|
+
* 3 bug fixes
|
270
|
+
|
271
|
+
* Fixed a bug w/ unit tests involving caching of rootdir.
|
272
|
+
* Added a minor tweak to the file discovery when called through eval.
|
273
|
+
* Moved the packaging code into inline.rb in order to get rubygems wrapped scripts to work again (wrapper was breaking due to __FILE__ != $0).
|
274
|
+
|
275
|
+
=== 3.3.0 / 2005-04-22
|
276
|
+
|
277
|
+
* 2 minor enhancement
|
278
|
+
|
279
|
+
* Added inline_package, which helps you package inlined code into gems.
|
280
|
+
* inline_package also generates a Rakefile for you if you need it.
|
281
|
+
* inline.rb now (only) loads packaged code when present.
|
282
|
+
|
283
|
+
=== 3.2.1 / 2005-04-19
|
284
|
+
|
285
|
+
* 2 bug fixes
|
286
|
+
|
287
|
+
* Added double to typemap. Thanks Phil Tomson!
|
288
|
+
* Added a minor hack to get cygwin to work right--lemme know pls.
|
289
|
+
|
290
|
+
=== 3.2.0 / 2004-11-27
|
291
|
+
|
292
|
+
* 8 minor enhancements
|
293
|
+
|
294
|
+
* Gemified
|
295
|
+
* Added #line preprocessor directives to make debugging inside your ruby file practical.
|
296
|
+
* Added uninstall rule to Makefile
|
297
|
+
* Inline::C now generates classes directly instead of included modules.
|
298
|
+
* Better execeptions are thrown on error.
|
299
|
+
* Incorporated a bunch of changes from Jonathan Paisley:
|
300
|
+
* Generation of inline'd class methods. (c_singleton and c_raw_singleton)
|
301
|
+
* Fixed problems with nested module/classes.
|
302
|
+
* Inline can now extend the same class multiple times.
|
303
|
+
|
304
|
+
* 2 bug fixes
|
305
|
+
|
306
|
+
* Smarter require/instantiation to accomodate other languages better.
|
307
|
+
* Fixed a logic error where running good code, then bad, then bad again ran the original good code.
|
308
|
+
|
309
|
+
=== 3.1.0 / 2004-09-24
|
310
|
+
|
311
|
+
* 2 minor enhancement
|
312
|
+
|
313
|
+
* Extended API of Inline::C with prefix(code).
|
314
|
+
* Documented all public API.
|
315
|
+
|
316
|
+
* 2 bug fixes
|
317
|
+
|
318
|
+
* Cleaned a lot of code and tests.
|
319
|
+
* Removed nearly all tags.
|
320
|
+
|
321
|
+
=== 3.0.1 / 2004-02-24
|
322
|
+
|
323
|
+
* 2 bug fixes
|
324
|
+
|
325
|
+
* I let references to ZenTestUnit slip through the release. Removed.
|
326
|
+
* Converted History.txt to ZenWeb format.
|
327
|
+
|
328
|
+
=== 3.0.0 / 2003-12-23
|
329
|
+
|
330
|
+
* 3 major enhancements
|
331
|
+
|
332
|
+
* Complete rewrite with new design.
|
333
|
+
* Multiple language support, works with C/C++ out of the box.
|
334
|
+
* Multiple functions per compilation unit, now allowing entire classes to be defined and linked in one unit.
|
335
|
+
|
336
|
+
* Notes:
|
337
|
+
|
338
|
+
* I still need to write much better/complete documentation.
|
339
|
+
|
340
|
+
=== 2.2.0 / 2003-01-25
|
341
|
+
|
342
|
+
* 1 minor enhancements
|
343
|
+
|
344
|
+
* Touch all generated files to avoid unnecessary diffs.
|
345
|
+
|
346
|
+
* 1 bug fixes
|
347
|
+
|
348
|
+
* Added good profiling example in tutorial/*.
|
349
|
+
* Added profiling strategy in README.txt.
|
350
|
+
|
351
|
+
* Notes:
|
352
|
+
|
353
|
+
* Paired with Doug Beaver <snarly@beaver.net>
|
354
|
+
|
355
|
+
=== 2.1.1 / 2002-12-27
|
356
|
+
|
357
|
+
* 2 bug fixes
|
358
|
+
|
359
|
+
* Fixed a bug in inline.rb where it was comparing against inline.rb, not the caller.
|
360
|
+
* Tweaked example.rb to take the number of iterations as an option.
|
361
|
+
|
362
|
+
=== 2.1.0 / 2002-12-17
|
363
|
+
|
364
|
+
* 2 minor enhancements
|
365
|
+
|
366
|
+
* Added inline_c_raw to replace Inline.inline.
|
367
|
+
* Removed module Inline as a whole. This gets rid of some
|
368
|
+
* major version incompatibilities, tons of duplicate code, and
|
369
|
+
* just seems to make things happier.
|
370
|
+
|
371
|
+
* 4 bug fixes
|
372
|
+
|
373
|
+
* Added a fix from Michael Scholz to fix the use of $0 for file test.
|
374
|
+
* Added private and public declarations since we are invading
|
375
|
+
* class Module.
|
376
|
+
* Fixed tests... oops!
|
377
|
+
* Lots of clean up...
|
378
|
+
|
379
|
+
* Notes:
|
380
|
+
|
381
|
+
* Reviewed by Doug Beaver <snarly@beaver.net>
|
382
|
+
|
383
|
+
=== 2.0.0 / 2002-12-12
|
384
|
+
|
385
|
+
* 2 bug fixes
|
386
|
+
|
387
|
+
* Minor fix to get working on MacOS X (.so vs .bundle).
|
388
|
+
* Downgraded typemap to be compatible with 1.6.x.
|
389
|
+
|
390
|
+
* Notes:
|
391
|
+
|
392
|
+
* Paired w/ Doug Beaver <snarly@beaver.net>
|
393
|
+
|
394
|
+
=== 2.0.0 beta / 2002-11-22
|
395
|
+
|
396
|
+
* 1 major enhancements
|
397
|
+
|
398
|
+
* Added inline_c, a "compile-time" version of inline. Massively enhanced, this version has a limited form of C function parsing.
|
399
|
+
|
400
|
+
* 2 minor enhancements
|
401
|
+
|
402
|
+
* Deprecated Inline#inline for Module#inline_c. To be removed by 2.1.0.
|
403
|
+
* Extended example.rb to include a fully written inlined C function.
|
404
|
+
|
405
|
+
* 3 bug fixes
|
406
|
+
|
407
|
+
* Updated README.txt and improved some of the documentation.
|
408
|
+
* Added test and clean rules to Makefile.
|
409
|
+
* Removed the copious warnings if running ruby < 1.7.2.
|
410
|
+
|
411
|
+
* Notes:
|
412
|
+
|
413
|
+
* Paired w/ Doug Beaver <snarly@beaver.net>
|
414
|
+
|
415
|
+
=== 1.1.0 / 2002-11-01
|
416
|
+
|
417
|
+
* 2 minor enhancements
|
418
|
+
|
419
|
+
* Aliased methods are now inlined as well. 250x faster.
|
420
|
+
* ONLY on ruby 1.7*. Warns on ruby < 1.7.
|
421
|
+
* Added a makefile to automate running of all different benchmarks.
|
422
|
+
|
423
|
+
* 1 bug fixes
|
424
|
+
|
425
|
+
* Improved example to include an aliased method testcase.
|
426
|
+
|
427
|
+
=== 1.0.7 / 2002-09-22
|
428
|
+
|
429
|
+
* 1 minor enhancements
|
430
|
+
|
431
|
+
* Only compiles the generated code if it was different from the previous version.
|
432
|
+
|
433
|
+
* 1 bug fixes
|
434
|
+
|
435
|
+
* Improved security: Checks group and global write on home directory.
|
436
|
+
|
437
|
+
=== 1.0.6 / 2002-09-18
|
438
|
+
|
439
|
+
* 1 minor enhancements
|
440
|
+
|
441
|
+
* Added a prelude argument for header and datatype declarations.
|
442
|
+
|
443
|
+
* 3 bug fixes
|
444
|
+
|
445
|
+
* Only output stuff if invoked verbose (ie 'ruby -v ./example.rb').
|
446
|
+
* Added some compatibility code for windows.
|
447
|
+
* Declared requirement on POSIX system.
|
448
|
+
|
449
|
+
=== 1.0.5 / 2002-09-11
|
450
|
+
|
451
|
+
* 2 bug fixes
|
452
|
+
|
453
|
+
* Improved security model for UNIX. Still not sure about windoze.
|
454
|
+
* Fixed History.txt to be accurate, gave example in README.
|
455
|
+
|
456
|
+
=== 1.0.4 / 2002-09-10
|
457
|
+
|
458
|
+
* 1 major enhancements
|
459
|
+
|
460
|
+
* Released to sourceforge!
|
461
|
+
|
462
|
+
* 1 bug fixes
|
463
|
+
|
464
|
+
* A number of very minor bug fixes from IRC sessions w/ others.
|
465
|
+
|
466
|
+
=== 1.0.0 / 2002-09-05
|
467
|
+
|
468
|
+
* 1 major enhancements
|
469
|
+
|
470
|
+
* Birthday!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Paul Kmiec
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Rubyinline
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'rubyinline'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install rubyinline
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/README.txt
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
= Ruby Inline
|
2
|
+
|
3
|
+
rdoc :: http://docs.seattlerb.org/RubyInline/
|
4
|
+
home :: http://www.zenspider.com/ZSS/Products/RubyInline/
|
5
|
+
code :: https://github.com/seattlerb/rubyinline
|
6
|
+
|
7
|
+
== DESCRIPTION:
|
8
|
+
|
9
|
+
Inline allows you to write foreign code within your ruby code. It
|
10
|
+
automatically determines if the code in question has changed and
|
11
|
+
builds it only when necessary. The extensions are then automatically
|
12
|
+
loaded into the class/module that defines it.
|
13
|
+
|
14
|
+
You can even write extra builders that will allow you to write inlined
|
15
|
+
code in any language. Use Inline::C as a template and look at
|
16
|
+
Module#inline for the required API.
|
17
|
+
|
18
|
+
== PACKAGING:
|
19
|
+
|
20
|
+
To package your binaries into a gem, use hoe's INLINE and
|
21
|
+
FORCE_PLATFORM env vars.
|
22
|
+
|
23
|
+
Example:
|
24
|
+
|
25
|
+
rake package INLINE=1
|
26
|
+
|
27
|
+
or:
|
28
|
+
|
29
|
+
rake package INLINE=1 FORCE_PLATFORM=mswin32
|
30
|
+
|
31
|
+
See hoe for more details.
|
32
|
+
|
33
|
+
== FEATURES/PROBLEMS:
|
34
|
+
|
35
|
+
* Quick and easy inlining of your C or C++ code embedded in your ruby script.
|
36
|
+
* Extendable to work with other languages.
|
37
|
+
* Automatic conversion between ruby and C basic types
|
38
|
+
* char, unsigned, unsigned int, char *, int, long, unsigned long
|
39
|
+
* inline_c_raw exists for when the automatic conversion isn't sufficient.
|
40
|
+
* Only recompiles if the inlined code has changed.
|
41
|
+
* Pretends to be secure.
|
42
|
+
* Only requires standard ruby libraries, nothing extra to download.
|
43
|
+
|
44
|
+
== SYNOPSIS:
|
45
|
+
|
46
|
+
require "inline"
|
47
|
+
class MyTest
|
48
|
+
inline do |builder|
|
49
|
+
builder.c "
|
50
|
+
long factorial(int max) {
|
51
|
+
int i=max, result=1;
|
52
|
+
while (i >= 2) { result *= i--; }
|
53
|
+
return result;
|
54
|
+
}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
t = MyTest.new()
|
58
|
+
factorial_5 = t.factorial(5)
|
59
|
+
|
60
|
+
== SYNOPSIS (C++):
|
61
|
+
|
62
|
+
require 'inline'
|
63
|
+
class MyTest
|
64
|
+
inline(:C) do |builder|
|
65
|
+
builder.include '<iostream>'
|
66
|
+
builder.add_compile_flags '-x c++', '-lstdc++'
|
67
|
+
builder.c '
|
68
|
+
void hello(int i) {
|
69
|
+
while (i-- > 0) {
|
70
|
+
std::cout << "hello" << std::endl;
|
71
|
+
}
|
72
|
+
}'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
t = MyTest.new()
|
76
|
+
t.hello(3)
|
77
|
+
|
78
|
+
== (PSEUDO)BENCHMARKS:
|
79
|
+
|
80
|
+
> make bench
|
81
|
+
|
82
|
+
Running native
|
83
|
+
Type = Native , Iter = 1000000, T = 28.70058100 sec, 0.00002870 sec / iter
|
84
|
+
Running primer - preloads the compiler and stuff
|
85
|
+
With full builds
|
86
|
+
Type = Inline C , Iter = 1000000, T = 7.55118600 sec, 0.00000755 sec / iter
|
87
|
+
Type = InlineRaw, Iter = 1000000, T = 7.54488300 sec, 0.00000754 sec / iter
|
88
|
+
Type = Alias , Iter = 1000000, T = 7.53243100 sec, 0.00000753 sec / iter
|
89
|
+
Without builds
|
90
|
+
Type = Inline C , Iter = 1000000, T = 7.59543300 sec, 0.00000760 sec / iter
|
91
|
+
Type = InlineRaw, Iter = 1000000, T = 7.54097200 sec, 0.00000754 sec / iter
|
92
|
+
Type = Alias , Iter = 1000000, T = 7.53654000 sec, 0.00000754 sec / iter
|
93
|
+
|
94
|
+
== PROFILING STRATEGY:
|
95
|
+
|
96
|
+
0) Always keep a log of your progress and changes.
|
97
|
+
1) Run code with 'time' and large dataset.
|
98
|
+
2) Run code with '-rprofile' and smaller dataset, large enough to get good #s.
|
99
|
+
3) Examine profile output and translate 1 bottleneck to C.
|
100
|
+
4) Run new code with 'time' and large dataset. Repeat 2-3 if unsatisfied.
|
101
|
+
5) Run final code with 'time' and compare to the first run.
|
102
|
+
|
103
|
+
== REQUIREMENTS:
|
104
|
+
|
105
|
+
* Ruby - 1.8.2 has been used on FreeBSD 4.6+ and MacOSX.
|
106
|
+
* POSIX compliant system (ie pretty much any UNIX, or Cygwin on MS platforms).
|
107
|
+
* A C/C++ compiler (the same one that compiled your ruby interpreter).
|
108
|
+
* test::unit for running tests ( http://testunit.talbott.ws/ ).
|
109
|
+
|
110
|
+
== INSTALL:
|
111
|
+
|
112
|
+
* make test (optional)
|
113
|
+
* make install
|
114
|
+
|
115
|
+
== LICENSE:
|
116
|
+
|
117
|
+
(The MIT License)
|
118
|
+
|
119
|
+
Copyright (c) Ryan Davis, seattle.rb
|
120
|
+
|
121
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
122
|
+
a copy of this software and associated documentation files (the
|
123
|
+
"Software"), to deal in the Software without restriction, including
|
124
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
125
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
126
|
+
permit persons to whom the Software is furnished to do so, subject to
|
127
|
+
the following conditions:
|
128
|
+
|
129
|
+
The above copyright notice and this permission notice shall be
|
130
|
+
included in all copies or substantial portions of the Software.
|
131
|
+
|
132
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
133
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
134
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
135
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
136
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
137
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
138
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
|
11
|
+
require "bundler/gem_tasks"
|
12
|
+
|
13
|
+
task :test do
|
14
|
+
system('echo "Just run: ruby -Ilib ./test/test_inline.rb"')
|
15
|
+
end
|
16
|
+
|
17
|
+
task :default => :test
|