rVM 0.0.14 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -4
- data/bin/rvm +229 -0
- data/lib/rvm.rb +6 -6
- data/lib/rvm/acts_as_rvm_type.rb +26 -3
- data/lib/rvm/classes.rb +9 -15
- data/lib/rvm/classes/block.rb +8 -3
- data/lib/rvm/classes/class.rb +2 -2
- data/lib/rvm/classes/list.rb +1 -1
- data/lib/rvm/classes/null.rb +31 -0
- data/lib/rvm/classes/number.rb +4 -0
- data/lib/rvm/classes/object.rb +1 -1
- data/lib/rvm/classes/string.rb +6 -1
- data/lib/rvm/environment.rb +256 -0
- data/lib/rvm/functions.rb +9 -4
- data/lib/rvm/functions/array.rb +26 -2
- data/lib/rvm/functions/array/append.rb +31 -1
- data/lib/rvm/functions/array/at.rb +29 -1
- data/lib/rvm/functions/array/set_at.rb +29 -0
- data/lib/rvm/functions/association/assoc_get.rb +34 -0
- data/lib/rvm/functions/association/assoc_set.rb +32 -0
- data/lib/rvm/functions/bitwise.rb +3 -0
- data/lib/rvm/functions/bitwise/bitwise_and.rb +41 -0
- data/lib/rvm/functions/bitwise/bitwise_or.rb +41 -0
- data/lib/rvm/functions/bitwise/bitwise_xor.rb +41 -0
- data/lib/rvm/functions/collection/get.rb +37 -4
- data/lib/rvm/functions/collection/set.rb +37 -3
- data/lib/rvm/functions/collection/size.rb +33 -1
- data/lib/rvm/functions/general/cmp.rb +35 -7
- data/lib/rvm/functions/general/eq.rb +29 -0
- data/lib/rvm/functions/general/gt.rb +29 -0
- data/lib/rvm/functions/general/gte.rb +29 -0
- data/lib/rvm/functions/general/lt.rb +29 -0
- data/lib/rvm/functions/general/lte.rb +29 -0
- data/lib/rvm/functions/general/neq.rb +5 -0
- data/lib/rvm/functions/io/print.rb +38 -8
- data/lib/rvm/functions/list/align.rb +25 -1
- data/lib/rvm/functions/list/join.rb +27 -0
- data/lib/rvm/functions/list/map.rb +34 -0
- data/lib/rvm/functions/list/split.rb +31 -0
- data/lib/rvm/functions/logic/and.rb +36 -2
- data/lib/rvm/functions/logic/not.rb +27 -0
- data/lib/rvm/functions/logic/or.rb +32 -2
- data/lib/rvm/functions/math/add.rb +25 -0
- data/lib/rvm/functions/math/cos.rb +39 -0
- data/lib/rvm/functions/math/div.rb +25 -0
- data/lib/rvm/functions/math/mod.rb +41 -0
- data/lib/rvm/functions/math/mul.rb +25 -0
- data/lib/rvm/functions/math/neg.rb +25 -0
- data/lib/rvm/functions/math/power.rb +25 -0
- data/lib/rvm/functions/math/shl.rb +41 -0
- data/lib/rvm/functions/math/shr.rb +41 -0
- data/lib/rvm/functions/math/sin.rb +39 -0
- data/lib/rvm/functions/math/sub.rb +25 -0
- data/lib/rvm/functions/math/tan.rb +39 -0
- data/lib/rvm/functions/rails/print.rb +33 -3
- data/lib/rvm/interpreter.rb +405 -272
- data/lib/rvm/languages.rb +45 -11
- data/lib/rvm/languages/brainfuck.rb +15 -16
- data/lib/rvm/languages/ecma.rb +4 -1257
- data/lib/rvm/languages/ecma/compiler.rb +1353 -0
- data/lib/rvm/languages/ecma/core-math.js +84 -0
- data/lib/rvm/languages/math.rb +9 -16
- data/lib/rvm/languages/math/compiler.rb +9 -9
- data/lib/rvm/languages/math/tokenizer.rb +1 -1
- data/lib/rvm/languages/math/tree.rb +14 -14
- data/lib/rvm/library.rb +26 -18
- data/lib/rvm/optimisation.rb +109 -0
- data/lib/rvm/plugin.rb +109 -45
- data/lib/rvm/rails.rb +79 -54
- data/spec/classes/atom/association_spec.rb +8 -8
- data/spec/classes/atom/block_spec.rb +8 -5
- data/spec/classes/atom/boolean_spec.rb +1 -1
- data/spec/classes/atom/error_spec.rb +1 -1
- data/spec/classes/atom/list_spec.rb +1 -1
- data/spec/classes/atom/number_spec.rb +2 -2
- data/spec/classes/atom/string_spec.rb +1 -1
- data/spec/languages/ecma/ecma_spec.rb +94 -38
- data/spec/languages/ecma/json_spec.rb +4 -4
- data/spec/languages/math/compiler_spec.rb +5 -5
- data/spec/languages/math/tokenizer_spec.rb +1 -1
- data/spec/languages/math/tree_spec.rb +1 -1
- data/spec/{base → rvm}/class_spec.rb +2 -2
- data/spec/{base/interpreter → rvm}/enviroment_spec.rb +19 -9
- data/spec/{base → rvm}/function_spec.rb +2 -2
- data/spec/{functions → rvm/functions}/association/assoc_get_spec.rb +2 -2
- data/spec/{functions → rvm/functions}/association/assoc_set_spec.rb +2 -2
- data/spec/rvm/functions/collection/get_spec.rb +12 -0
- data/spec/rvm/functions/collection/set_spec.rb +10 -0
- data/spec/rvm/functions/collection/size_spec.rb +10 -0
- data/spec/{functions → rvm/functions}/list/split_spec.rb +3 -3
- data/spec/{functions → rvm/functions}/string/ansi_spec.rb +3 -3
- data/spec/{functions → rvm/functions}/string/capstr_spec.rb +3 -3
- data/spec/{functions → rvm/functions}/string/center_spec.rb +3 -3
- data/spec/{functions → rvm/functions}/string/ljust_spec.rb +3 -3
- data/spec/{functions → rvm/functions}/string/regmatch_spec.rb +3 -3
- data/spec/{functions → rvm/functions}/string/rjust_spec.rb +3 -3
- data/spec/{base → rvm}/interpreter/assignment_spec.rb +1 -1
- data/spec/rvm/interpreter/condition_spec.rb +103 -0
- data/spec/{base → rvm}/interpreter/constant_spec.rb +1 -1
- data/spec/rvm/interpreter/core_call_spec.rb +72 -0
- data/spec/{base → rvm}/interpreter/interpreter_spec.rb +1 -1
- data/spec/{base → rvm}/interpreter/parameter_spec.rb +1 -1
- data/spec/rvm/interpreter/sequence_spec.rb +47 -0
- data/spec/{base → rvm}/interpreter/variable_spec.rb +1 -1
- data/spec/{base → rvm}/plugin_spec.rb +2 -2
- metadata +66 -35
- data/lib/rake/helpers/code_statistics.rb +0 -167
- data/spec/base/interpreter/condition_spec.rb +0 -47
- data/spec/base/interpreter/function_call_spec.rb +0 -72
- data/spec/base/interpreter/sequence_spec.rb +0 -20
- data/spec/functions/collection/get_spec.rb +0 -12
- data/spec/functions/collection/set_spec.rb +0 -10
- data/spec/functions/collection/size_spec.rb +0 -10
@@ -1,3 +1,28 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
1
26
|
module RVM
|
2
27
|
module Functions
|
3
28
|
class Add < Function
|
@@ -0,0 +1,39 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
26
|
+
module RVM
|
27
|
+
module Functions
|
28
|
+
class Cos < Function
|
29
|
+
def Cos.execute params, env
|
30
|
+
RVM::Classes[:number].new(Math::cos(params.shift.value))
|
31
|
+
end
|
32
|
+
|
33
|
+
def Cos.signature
|
34
|
+
[:number]
|
35
|
+
end
|
36
|
+
register_for :cos
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,3 +1,28 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
1
26
|
module RVM
|
2
27
|
module Functions
|
3
28
|
class Div < Function
|
@@ -0,0 +1,41 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
26
|
+
module RVM
|
27
|
+
module Functions
|
28
|
+
class Mod < Function
|
29
|
+
def Mod.execute params, env
|
30
|
+
a = params.shift
|
31
|
+
b = params.shift
|
32
|
+
a % b
|
33
|
+
end
|
34
|
+
|
35
|
+
def Mod.signature
|
36
|
+
[:number, :number]
|
37
|
+
end
|
38
|
+
register_for :mod
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,3 +1,28 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
1
26
|
module RVM
|
2
27
|
module Functions
|
3
28
|
class Mul < Function
|
@@ -1,3 +1,28 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
1
26
|
module RVM
|
2
27
|
module Functions
|
3
28
|
class Neg < Function
|
@@ -1,3 +1,28 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
1
26
|
module RVM
|
2
27
|
module Functions
|
3
28
|
class Power < Function
|
@@ -0,0 +1,41 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
26
|
+
module RVM
|
27
|
+
module Functions
|
28
|
+
class Shl < Function
|
29
|
+
def Shl.execute params, env
|
30
|
+
a = params.shift
|
31
|
+
b = params.shift
|
32
|
+
a << b
|
33
|
+
end
|
34
|
+
|
35
|
+
def Shl.signature
|
36
|
+
[:number, :number]
|
37
|
+
end
|
38
|
+
register_for :shl
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
26
|
+
module RVM
|
27
|
+
module Functions
|
28
|
+
class Shr < Function
|
29
|
+
def Shr.execute params, env
|
30
|
+
a = params.shift
|
31
|
+
b = params.shift
|
32
|
+
a >> b
|
33
|
+
end
|
34
|
+
|
35
|
+
def Shr.signature
|
36
|
+
[:number, :number]
|
37
|
+
end
|
38
|
+
register_for :shr
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
26
|
+
module RVM
|
27
|
+
module Functions
|
28
|
+
class Sin < Function
|
29
|
+
def Sin.execute params, env
|
30
|
+
RVM::Classes[:number].new(Math::sin(params.shift.value))
|
31
|
+
end
|
32
|
+
|
33
|
+
def Sin.signature
|
34
|
+
[:number]
|
35
|
+
end
|
36
|
+
register_for :sin
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,3 +1,28 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
1
26
|
module RVM
|
2
27
|
module Functions
|
3
28
|
class Sub < Function
|
@@ -0,0 +1,39 @@
|
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
|
26
|
+
module RVM
|
27
|
+
module Functions
|
28
|
+
class Tan < Function
|
29
|
+
def self.execute params, env
|
30
|
+
RVM::Classes[:number].new(Math::tan(params.shift.value))
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.signature
|
34
|
+
[:number]
|
35
|
+
end
|
36
|
+
register_for :tan
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,6 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
=begin
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2007 Heinz N. 'Licenser' Gies
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Ruby Mush"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
=end
|
24
|
+
|
25
|
+
module RVM #:nodoc:
|
26
|
+
module Functions #:nodoc:
|
27
|
+
# This function is part of the Rails extention for rVM. It does not more
|
28
|
+
# then taking all it's arguments, converting them to a strong by calling
|
29
|
+
# to_s and then concatinates them.
|
30
|
+
#
|
31
|
+
# Then are appended to the :render variable that should be used to return
|
32
|
+
# the output of all print functions in the end.
|
33
|
+
class RailsPrint < RVM::Functions::Function
|
4
34
|
class << self
|
5
35
|
def execute params, env
|
6
36
|
params.each do |p|
|