diff options
Diffstat (limited to 'lib/evendoors')
-rw-r--r-- | lib/evendoors/board.rb | 2 | ||||
-rw-r--r-- | lib/evendoors/door.rb | 2 | ||||
-rw-r--r-- | lib/evendoors/room.rb | 17 | ||||
-rw-r--r-- | lib/evendoors/space.rb | 3 | ||||
-rw-r--r-- | lib/evendoors/twirl.rb | 5 |
5 files changed, 16 insertions, 13 deletions
diff --git a/lib/evendoors/board.rb b/lib/evendoors/board.rb index 24b028a..3cc2240 100644 --- a/lib/evendoors/board.rb +++ b/lib/evendoors/board.rb @@ -23,7 +23,7 @@ module EvenDoors @saved = p receive_p p if not @saved.nil? - puts "#{path} didn't give that particle back #{p}" if EvenDoors::Twirl.debug + puts "#{path} didn't give that particle back #{p}" if EvenDoors::Twirl.debug_errors puts "\t#{p.data EvenDoors::ERROR_FIELD}" if p.action==EvenDoors::ACT_ERROR release_p @saved @saved = nil diff --git a/lib/evendoors/door.rb b/lib/evendoors/door.rb index c87bfcd..6118a27 100644 --- a/lib/evendoors/door.rb +++ b/lib/evendoors/door.rb @@ -28,7 +28,7 @@ module EvenDoors @saved = p receive_p p if not @saved.nil? - puts "#{path} didn't give that particle back #{p}" if EvenDoors::Twirl.debug + puts "#{path} didn't give that particle back #{p}" if EvenDoors::Twirl.debug_errors puts "\t#{p.data EvenDoors::ERROR_FIELD}" if p.action==EvenDoors::ACT_ERROR release_p @saved @saved = nil diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb index 729e66c..71c8971 100644 --- a/lib/evendoors/room.rb +++ b/lib/evendoors/room.rb @@ -28,21 +28,22 @@ module EvenDoors end # def start! - puts " * start #{path}" if EvenDoors::Twirl.debug + puts " * start #{path}" if EvenDoors::Twirl.debug_routing @spots.values.each do |spot| spot.start! if spot.respond_to? :start! end end # def stop! - puts " * stop #{path}" if EvenDoors::Twirl.debug + puts " * stop #{path}" if EvenDoors::Twirl.debug_routing @spots.values.each do |spot| spot.stop! if spot.respond_to? :stop! end end # def space - ( @parent.nil? ? self : @parent.space ) + return @space if @space + @space = ( @parent.nil? ? self : @parent.space ) end # def try_links p - puts " -> try_links ..." if EvenDoors::Twirl.debug + puts " -> try_links ..." if EvenDoors::Twirl.debug_routing links = @links[p.src.name] return false if links.nil? pending_link = nil @@ -86,7 +87,7 @@ module EvenDoors end # def send_p p - puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if EvenDoors::Twirl.debug + puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if EvenDoors::Twirl.debug_routing if p.src.nil? # do not route orphan particles !! p.error! EvenDoors::ERROR_ROUTE_NS, space @@ -103,12 +104,12 @@ module EvenDoors else p.error! EvenDoors::ERROR_ROUTE_NDNL end - puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug + puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug_routing EvenDoors::Twirl.send_p p end # def send_sys_p p - puts " * send_sys_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if EvenDoors::Twirl.debug + puts " * send_sys_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if EvenDoors::Twirl.debug_routing if p.next_dst p.split_dst! if p.door @@ -121,7 +122,7 @@ module EvenDoors else p.error! EvenDoors::ERROR_ROUTE_SND end - puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug + puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug_routing EvenDoors::Twirl.send_sys_p p end # diff --git a/lib/evendoors/space.rb b/lib/evendoors/space.rb index 22b9910..da13065 100644 --- a/lib/evendoors/space.rb +++ b/lib/evendoors/space.rb @@ -8,7 +8,8 @@ module EvenDoors # def initialize n, args={} super n, nil - EvenDoors::Twirl.debug = args[:debug] || false + EvenDoors::Twirl.debug_errors = args[:debug_errors] || false + EvenDoors::Twirl.debug_routing = args[:debug_routing] || false end # def twirl! diff --git a/lib/evendoors/twirl.rb b/lib/evendoors/twirl.rb index 1ddf490..cb01618 100644 --- a/lib/evendoors/twirl.rb +++ b/lib/evendoors/twirl.rb @@ -6,7 +6,8 @@ module EvenDoors # class Twirl # - @debug = false + @debug_routing = false + @debug_errors = false @pool = {} # per particle class free list @sys_fifo = [] # system particles fifo list @app_fifo = [] # application particles fifo list @@ -15,7 +16,7 @@ module EvenDoors # class << self # - attr_accessor :debug, :run + attr_accessor :run, :debug_routing, :debug_errors # def release_p p # hope there is no circular loop |