fOOrth 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/integration/compile_lib_tests.rb +41 -0
- data/irbt.rb +0 -2
- data/lib/fOOrth/compiler.rb +4 -8
- data/lib/fOOrth/compiler/cast.rb +39 -0
- data/lib/fOOrth/compiler/context/map_name.rb +12 -31
- data/lib/fOOrth/compiler/process.rb +5 -3
- data/lib/fOOrth/core/class.rb +1 -1
- data/lib/fOOrth/debug.rb +0 -2
- data/lib/fOOrth/debug/display_abort.rb +0 -6
- data/lib/fOOrth/library.rb +1 -0
- data/lib/fOOrth/library/array_library.rb +1 -47
- data/lib/fOOrth/library/command_library.rb +35 -60
- data/lib/fOOrth/library/compile_library.rb +27 -7
- data/lib/fOOrth/library/formatting/bullets.rb +121 -0
- data/lib/fOOrth/library/formatting/columns.rb +144 -0
- data/lib/fOOrth/library/hash_library.rb +2 -1
- data/lib/fOOrth/library/introspection/class.rb +84 -0
- data/lib/fOOrth/library/introspection/context.rb +36 -0
- data/lib/fOOrth/library/introspection/object.rb +69 -0
- data/lib/fOOrth/library/introspection/string.rb +28 -0
- data/lib/fOOrth/library/introspection/symbol_map.rb +19 -0
- data/lib/fOOrth/library/introspection/vm.rb +70 -0
- data/lib/fOOrth/library/introspection/word_specs.rb +18 -0
- data/lib/fOOrth/library/introspection_library.rb +78 -0
- data/lib/fOOrth/library/stack_library.rb +2 -4
- data/lib/fOOrth/library/stdio_library.rb +68 -0
- data/lib/fOOrth/library/stubs.rb +11 -7
- data/lib/fOOrth/library/vm_library.rb +1 -5
- data/lib/fOOrth/version.rb +1 -1
- data/tests/core_tests.rb +1 -1
- metadata +13 -4
- data/lib/fOOrth/debug/context_dump.rb +0 -31
- data/lib/fOOrth/debug/vm_dump.rb +0 -27
@@ -15,11 +15,7 @@ module XfOOrth
|
|
15
15
|
|
16
16
|
# [vm] .vm_name ['name']
|
17
17
|
VirtualMachine.create_shared_method('.vm_name', TosSpec, [],
|
18
|
-
&lambda {|vm| vm.push(self.name)
|
19
|
-
|
20
|
-
# [vm] .dump []
|
21
|
-
VirtualMachine.create_shared_method('.dump', TosSpec, [],
|
22
|
-
&lambda {|vm| self.debug_dump; })
|
18
|
+
&lambda {|vm| vm.push(self.name) })
|
23
19
|
|
24
20
|
# Some stack manipulation words.
|
25
21
|
# [a] drop []
|
data/lib/fOOrth/version.rb
CHANGED
data/tests/core_tests.rb
CHANGED
@@ -103,7 +103,7 @@ class CoreTester < Minitest::Test
|
|
103
103
|
symbol = XfOOrth::SymbolMap.map('MyClass')
|
104
104
|
|
105
105
|
assert($FOORTH_GLOBALS[symbol])
|
106
|
-
assert_equal('
|
106
|
+
assert_equal('ClassSpec instance', new_class.foorth_name)
|
107
107
|
assert_equal(XfOOrth::XfOOrth_MyClass, new_class.new_class)
|
108
108
|
assert_equal(XfOOrth::XfOOrth_MyClass, $FOORTH_GLOBALS[symbol].new_class)
|
109
109
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fOOrth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- irbt.rb
|
225
225
|
- lib/fOOrth.rb
|
226
226
|
- lib/fOOrth/compiler.rb
|
227
|
+
- lib/fOOrth/compiler/cast.rb
|
227
228
|
- lib/fOOrth/compiler/context.rb
|
228
229
|
- lib/fOOrth/compiler/context/locals.rb
|
229
230
|
- lib/fOOrth/compiler/context/map_name.rb
|
@@ -256,10 +257,8 @@ files:
|
|
256
257
|
- lib/fOOrth/core/object.rb
|
257
258
|
- lib/fOOrth/core/virtual_machine.rb
|
258
259
|
- lib/fOOrth/debug.rb
|
259
|
-
- lib/fOOrth/debug/context_dump.rb
|
260
260
|
- lib/fOOrth/debug/dbg_puts.rb
|
261
261
|
- lib/fOOrth/debug/display_abort.rb
|
262
|
-
- lib/fOOrth/debug/vm_dump.rb
|
263
262
|
- lib/fOOrth/initialize.rb
|
264
263
|
- lib/fOOrth/interpreter.rb
|
265
264
|
- lib/fOOrth/interpreter/add_to_hash.rb
|
@@ -282,9 +281,19 @@ files:
|
|
282
281
|
- lib/fOOrth/library/duration/make.rb
|
283
282
|
- lib/fOOrth/library/duration_library.rb
|
284
283
|
- lib/fOOrth/library/fiber_library.rb
|
284
|
+
- lib/fOOrth/library/formatting/bullets.rb
|
285
|
+
- lib/fOOrth/library/formatting/columns.rb
|
285
286
|
- lib/fOOrth/library/hash_library.rb
|
286
287
|
- lib/fOOrth/library/in_stream_library.rb
|
287
288
|
- lib/fOOrth/library/integer_library.rb
|
289
|
+
- lib/fOOrth/library/introspection/class.rb
|
290
|
+
- lib/fOOrth/library/introspection/context.rb
|
291
|
+
- lib/fOOrth/library/introspection/object.rb
|
292
|
+
- lib/fOOrth/library/introspection/string.rb
|
293
|
+
- lib/fOOrth/library/introspection/symbol_map.rb
|
294
|
+
- lib/fOOrth/library/introspection/vm.rb
|
295
|
+
- lib/fOOrth/library/introspection/word_specs.rb
|
296
|
+
- lib/fOOrth/library/introspection_library.rb
|
288
297
|
- lib/fOOrth/library/mutex_library.rb
|
289
298
|
- lib/fOOrth/library/numeric_library.rb
|
290
299
|
- lib/fOOrth/library/object_library.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
#* debug/context_dump.rb - Debug support for the compiler context.
|
4
|
-
module XfOOrth
|
5
|
-
|
6
|
-
#* debug/context_dump.rb - Debug support for the compiler context.
|
7
|
-
class Context
|
8
|
-
|
9
|
-
#Dump the context chain to the console for debug.
|
10
|
-
#<br>Parameters
|
11
|
-
#* vm - The current virtual machine for this thread.
|
12
|
-
def debug_dump(vm)
|
13
|
-
puts "\nContext level #{self.depth}"
|
14
|
-
|
15
|
-
@data.each do |key, value|
|
16
|
-
if key == :vm
|
17
|
-
puts "virtual machine => #{value.foorth_name}"
|
18
|
-
else
|
19
|
-
if (name = SymbolMap.unmap(key))
|
20
|
-
key = name.inspect
|
21
|
-
end
|
22
|
-
|
23
|
-
puts "#{key} => #{value}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
(prev = self.previous) && prev.debug_dump(vm)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
data/lib/fOOrth/debug/vm_dump.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
#* debug/vm_dump.rb - Debug support for the virtual machine.
|
4
|
-
module XfOOrth
|
5
|
-
|
6
|
-
#* debug/vm_dump.rb - Debug support for the virtual machine.
|
7
|
-
class VirtualMachine
|
8
|
-
|
9
|
-
#Dump the virtual machine to the console for debug.
|
10
|
-
def debug_dump
|
11
|
-
source = @parser && @parser.source
|
12
|
-
|
13
|
-
puts "\n#{self.foorth_name}" \
|
14
|
-
"\n Ruby = #{self.to_s}" \
|
15
|
-
"\n Stack = #{@data_stack.inspect}" \
|
16
|
-
"\n Nesting = #{@context.depth}" \
|
17
|
-
"\n Quotes = #{@quotes}" \
|
18
|
-
"\n Debug = #{@debug}" \
|
19
|
-
"\n Show = #{@show_stack}" \
|
20
|
-
"\n Force = #{@force}" \
|
21
|
-
"\n Start = #{@start_time}" \
|
22
|
-
"\n Source = #{source && source.source_name}" \
|
23
|
-
"\n Buffer = #{source && source.read_buffer.inspect}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|