RubyInline 3.6.1 → 3.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Rakefile +1 -1
- data/inline.rb +4 -3
- data/test_inline.rb +46 -0
- metadata +2 -2
data/History.txt
CHANGED
data/Rakefile
CHANGED
@@ -6,9 +6,9 @@ require 'hoe'
|
|
6
6
|
require './inline.rb'
|
7
7
|
|
8
8
|
Hoe.new("RubyInline", Inline::VERSION) do |p|
|
9
|
-
p.rubyforge_name = "rubyinline"
|
10
9
|
p.summary = "Multi-language extension coding within ruby."
|
11
10
|
p.description = p.paragraphs_of("README.txt", 3).join
|
11
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join
|
12
12
|
p.clean_globs << File.expand_path("~/.ruby_inline")
|
13
13
|
|
14
14
|
p.spec_extras[:requirements] = "A POSIX environment and a compiler for your language."
|
data/inline.rb
CHANGED
@@ -51,7 +51,7 @@ class CompilationError < RuntimeError; end
|
|
51
51
|
# the current namespace.
|
52
52
|
|
53
53
|
module Inline
|
54
|
-
VERSION = '3.6.
|
54
|
+
VERSION = '3.6.2'
|
55
55
|
|
56
56
|
WINDOZE = /win32/ =~ RUBY_PLATFORM
|
57
57
|
DEV_NULL = (WINDOZE ? 'nul' : '/dev/null')
|
@@ -131,9 +131,10 @@ module Inline
|
|
131
131
|
|
132
132
|
def strip_comments(src)
|
133
133
|
# strip c-comments
|
134
|
-
src = src.gsub(
|
134
|
+
src = src.gsub(%r%\s*/\*.*?\*/%m, '')
|
135
135
|
# strip cpp-comments
|
136
|
-
src.gsub
|
136
|
+
src = src.gsub(%r%^\s*//.*?\n%, '')
|
137
|
+
src = src.gsub(%r%[ \t]*//[^\n]*%, '')
|
137
138
|
src
|
138
139
|
end
|
139
140
|
|
data/test_inline.rb
CHANGED
@@ -392,6 +392,7 @@ return INT2FIX(42)}"
|
|
392
392
|
expected = "static VALUE add(VALUE self, VALUE _x, VALUE _y) {
|
393
393
|
int x = FIX2INT(_x);
|
394
394
|
int y = FIX2INT(_y);
|
395
|
+
|
395
396
|
return INT2FIX(x+y);
|
396
397
|
}
|
397
398
|
"
|
@@ -413,6 +414,7 @@ add(int x, int y) { // add two numbers
|
|
413
414
|
static VALUE add(VALUE self, VALUE _x, VALUE _y) {
|
414
415
|
int x = FIX2INT(_x);
|
415
416
|
int y = FIX2INT(_y);
|
417
|
+
|
416
418
|
return INT2FIX(x+y);
|
417
419
|
}
|
418
420
|
"
|
@@ -432,6 +434,7 @@ add(int x, int y) { // add two numbers
|
|
432
434
|
static VALUE add(VALUE self, VALUE _x, VALUE _y) {
|
433
435
|
int x = FIX2INT(_x);
|
434
436
|
int y = FIX2INT(_y);
|
437
|
+
|
435
438
|
return INT2FIX(x+y);
|
436
439
|
}
|
437
440
|
"
|
@@ -536,6 +539,49 @@ puts(s); return rb_str_new2(s)}"
|
|
536
539
|
end
|
537
540
|
end
|
538
541
|
|
542
|
+
def util_strip_comments(input)
|
543
|
+
expect = 'line 1
|
544
|
+
|
545
|
+
#if 0
|
546
|
+
line 2
|
547
|
+
#endif
|
548
|
+
line 3
|
549
|
+
|
550
|
+
'
|
551
|
+
|
552
|
+
assert_equal expect, @builder.strip_comments(input)
|
553
|
+
end
|
554
|
+
|
555
|
+
def test_strip_comments_cpp
|
556
|
+
input = 'line 1
|
557
|
+
|
558
|
+
#if 0
|
559
|
+
line 2
|
560
|
+
#endif
|
561
|
+
// 1 comment
|
562
|
+
// 2 comment
|
563
|
+
line 3 // trailing comment
|
564
|
+
|
565
|
+
'
|
566
|
+
util_strip_comments(input)
|
567
|
+
end
|
568
|
+
|
569
|
+
def test_strip_comments_c
|
570
|
+
input = 'line 1
|
571
|
+
|
572
|
+
#if 0
|
573
|
+
line 2
|
574
|
+
#endif
|
575
|
+
/*
|
576
|
+
* 1 comment
|
577
|
+
* 2 comment
|
578
|
+
*/
|
579
|
+
line 3 /* trailing comment */
|
580
|
+
|
581
|
+
'
|
582
|
+
util_strip_comments(input)
|
583
|
+
end
|
584
|
+
|
539
585
|
def test_load
|
540
586
|
# totally tested by test_build
|
541
587
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: RubyInline
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 3.6.
|
7
|
-
date: 2006-10-
|
6
|
+
version: 3.6.2
|
7
|
+
date: 2006-10-12 00:00:00 -07:00
|
8
8
|
summary: Multi-language extension coding within ruby.
|
9
9
|
require_paths:
|
10
10
|
- .
|