diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-08 16:41:28 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-08 16:41:28 +0200 |
commit | 23c3790d2397f343071c7481a91533a7b846a39f (patch) | |
tree | e1a6f7592a77aea280ad21b576aaa6aa07c00803 | |
parent | eafe8dd42c8e71d0ece51d4e14600e481029a239 (diff) | |
download | edoors-ruby-23c3790d2397f343071c7481a91533a7b846a39f.zip edoors-ruby-23c3790d2397f343071c7481a91533a7b846a39f.tar.gz |
Room, Twirl
p.door->p.dst, p.dst_done!->p.dst_routed!,
use p.door instead of p.split_dst! return value
-rw-r--r-- | lib/evendoors/room.rb | 37 | ||||
-rw-r--r-- | lib/evendoors/twirl.rb | 4 |
2 files changed, 21 insertions, 20 deletions
diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb index f619f10..3c7ebc6 100644 --- a/lib/evendoors/room.rb +++ b/lib/evendoors/room.rb @@ -74,53 +74,54 @@ module EvenDoors (not pending_link.nil?) end # - def route_p p, door_name - if door_name.empty? + def route_p p + if p.door.empty? p.error! EvenDoors::ERROR_ROUTE_NDN elsif p.room.nil? or p.room==path - if door = @spots[door_name] - p.dst_done! door + if door = @spots[p.door] + p.dst_routed! door else p.error! EvenDoors::ERROR_ROUTE_RRWD end elsif @parent - @parent.route_p p, door_name + @parent.route_p p else p.error! EvenDoors::ERROR_ROUTE_TRWR end end # def send_p p - if d = p.dst - puts " * send #{d.to_str} ..." if EvenDoors::Twirl.debug - route_p p, p.split_dst! - puts " -> #{p.door.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug + if p.next_dst + puts " * send #{p.next_dst.to_str} ..." if EvenDoors::Twirl.debug + p.split_dst! + route_p p + puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug EvenDoors::Twirl.send_p p elsif not try_links p p.error! EvenDoors::ERROR_ROUTE_NDNL - puts " -> #{p.door.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug + puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug EvenDoors::Twirl.send_p p end end # def send_sys_p p - if d = p.dst - puts " * send_sys #{d.to_str} ..." if EvenDoors::Twirl.debug - door_name = p.split_dst! - if door_name.empty? + if p.next_dst + puts " * send_sys #{p.next_dst.to_str} ..." if EvenDoors::Twirl.debug + p.split_dst! + if p.door.empty? if p.action.nil? p.error! EvenDoors::ERROR_ROUTE_SNDNA else - p.dst_done! space + p.dst_routed! space end else - route_p p, door_name + route_p p end - puts " -> #{p.door.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug + puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug EvenDoors::Twirl.send_sys_p p else p.error! EvenDoors::ERROR_ROUTE_SND - puts " -> #{p.door.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug + puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if EvenDoors::Twirl.debug EvenDoors::Twirl.send_sys_p p end end diff --git a/lib/evendoors/twirl.rb b/lib/evendoors/twirl.rb index 9f38bf6..b3eca89 100644 --- a/lib/evendoors/twirl.rb +++ b/lib/evendoors/twirl.rb @@ -46,11 +46,11 @@ module EvenDoors while @run and (@sys_fifo.length>0 or @app_fifo.length>0) while @run and @sys_fifo.length>0 p = @sys_fifo.shift - p.door.process_sys_p p + p.dst.process_sys_p p end while @run and @app_fifo.length>0 p = @app_fifo.shift - p.door.process_p p + p.dst.process_p p break end end |