weel 1.99.45 → 1.99.46
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/weel.rb +38 -22
- data/weel.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b267f01fd4b59aec270e7f438bfe10ff98da0f0
|
4
|
+
data.tar.gz: 51661c098b1efdd8aa69de6c1ea2abcbcca79587
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ce546f2803ba8b2b117e67d3674f6b3f14f1fd2ba775c3af41e7020cf99efad252ef4a80277870344293d2078dce6b6a2063dbb86c022f80ff2308df013c32f
|
7
|
+
data.tar.gz: a7d3617a1ed7f6a3903a05b1a2a21ab53a7dbd6a2bf02d31de5070867004711b02030ef19da1547f33376bfc4a7118c201e7a5c07fc1c2d1a6d9ef207f0913fe
|
data/lib/weel.rb
CHANGED
@@ -331,7 +331,7 @@ class WEEL
|
|
331
331
|
|
332
332
|
hw, pos = __weel_sim_start(:parallel) if __weel_sim
|
333
333
|
|
334
|
-
|
334
|
+
__weel_protect_yield &Proc.new
|
335
335
|
|
336
336
|
Thread.current[:branch_wait_count] = (type.is_a?(Hash) && type.size == 1 && type[:wait] != nil && (type[:wait].is_a?(Integer) && type[:wait] > 0) ? type[:wait] : Thread.current[:branches].size)
|
337
337
|
1.upto Thread.current[:branches].size do
|
@@ -400,13 +400,7 @@ class WEEL
|
|
400
400
|
handlerwrapper.simulate(:parallel_branch,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos)
|
401
401
|
end
|
402
402
|
|
403
|
-
|
404
|
-
yield(*local)
|
405
|
-
rescue => err
|
406
|
-
self.__weel_state = :stopping
|
407
|
-
@__weel_handlerwrapper::inform_syntax_error(@__weel_handlerwrapper_args,err,nil)
|
408
|
-
Thread.pass
|
409
|
-
end
|
403
|
+
__weel_protect_yield *local, &Proc.new
|
410
404
|
|
411
405
|
__weel_sim_stop(:parallel_branch,handlerwrapper,current_branch_sim_pos) if __weel_sim
|
412
406
|
|
@@ -441,7 +435,7 @@ class WEEL
|
|
441
435
|
Thread.current[:alternative_executed] << false
|
442
436
|
Thread.current[:alternative_mode] << mode
|
443
437
|
hw, pos = __weel_sim_start(:choose,:mode => Thread.current[:alternative_mode].last) if __weel_sim
|
444
|
-
|
438
|
+
__weel_protect_yield &Proc.new
|
445
439
|
__weel_sim_stop(:choose,hw,pos,:mode => Thread.current[:alternative_mode].last) if __weel_sim
|
446
440
|
Thread.current[:alternative_executed].pop
|
447
441
|
Thread.current[:alternative_mode].pop
|
@@ -458,18 +452,17 @@ class WEEL
|
|
458
452
|
Thread.current[:mutex].synchronize do
|
459
453
|
return if Thread.current[:alternative_mode] == :exclusive && Thread.current[:alternative_executed][-1] = true
|
460
454
|
if condition.is_a?(String) && !__weel_sim
|
461
|
-
|
462
|
-
condition = handlerwrapper.test_condition(ReadStructure.new(@__weel_data,@__weel_endpoints),condition)
|
455
|
+
condition = __weel_eval_condition(condition)
|
463
456
|
end
|
464
457
|
Thread.current[:alternative_executed][-1] = true if condition
|
465
458
|
end
|
466
|
-
|
459
|
+
__weel_protect_yield(&Proc.new) if __weel_is_in_search_mode || __weel_sim || condition
|
467
460
|
__weel_sim_stop(:alternative,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => condition.is_a?(String) ? condition : nil)) if __weel_sim
|
468
461
|
end # }}}
|
469
462
|
def otherwise(args={}) # {{{
|
470
463
|
return if self.__weel_state == :stopping || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
471
464
|
hw, pos = __weel_sim_start(:otherwise,args.merge(:mode => Thread.current[:alternative_mode].last)) if __weel_sim
|
472
|
-
|
465
|
+
__weel_protect_yield(&Proc.new) if __weel_is_in_search_mode || __weel_sim || !Thread.current[:alternative_executed].last
|
473
466
|
__weel_sim_stop(:otherwise,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last)) if __weel_sim
|
474
467
|
end # }}}
|
475
468
|
|
@@ -483,7 +476,7 @@ class WEEL
|
|
483
476
|
@__weel_critical_sections[id] = semaphore if id
|
484
477
|
end
|
485
478
|
semaphore.synchronize do
|
486
|
-
|
479
|
+
__weel_protect_yield &Proc.new
|
487
480
|
end
|
488
481
|
end # }}}
|
489
482
|
|
@@ -495,7 +488,7 @@ class WEEL
|
|
495
488
|
return if self.__weel_state == :stopping || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
496
489
|
if __weel_is_in_search_mode
|
497
490
|
catch :escape do
|
498
|
-
|
491
|
+
__weel_protect_yield &Proc.new
|
499
492
|
end
|
500
493
|
return if __weel_is_in_search_mode
|
501
494
|
end
|
@@ -503,22 +496,21 @@ class WEEL
|
|
503
496
|
cond = condition[0].is_a?(Proc) ? true : condition[0]
|
504
497
|
hw, pos = __weel_sim_start(:loop,args.merge(:testing=>condition[1],:condition=>cond))
|
505
498
|
catch :escape do
|
506
|
-
|
499
|
+
__weel_protect_yield &Proc.new
|
507
500
|
end
|
508
501
|
__weel_sim_stop(:loop,hw,pos,args.merge(:testing=>condition[1],:condition=>cond))
|
509
502
|
return
|
510
503
|
end
|
511
|
-
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args unless condition[0].is_a?(Proc)
|
512
504
|
catch :escape do
|
513
505
|
case condition[1]
|
514
506
|
when :pre_test
|
515
|
-
while (condition[0]
|
516
|
-
|
507
|
+
while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped
|
508
|
+
__weel_protect_yield &Proc.new
|
517
509
|
end
|
518
510
|
when :post_test
|
519
511
|
begin
|
520
|
-
|
521
|
-
end while (condition[0]
|
512
|
+
__weel_protect_yield &Proc.new
|
513
|
+
end while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped
|
522
514
|
end
|
523
515
|
end
|
524
516
|
end # }}}
|
@@ -543,6 +535,28 @@ class WEEL
|
|
543
535
|
end # }}}
|
544
536
|
|
545
537
|
private
|
538
|
+
def __weel_protect_yield(*local)
|
539
|
+
begin
|
540
|
+
yield(*local) if block_given?
|
541
|
+
rescue => err
|
542
|
+
self.__weel_state = :stopping
|
543
|
+
@__weel_handlerwrapper::inform_syntax_error(@__weel_handlerwrapper_args,Exception.new("DSL error. I don't want to tell you where and why."),nil)
|
544
|
+
nil
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
def __weel_eval_condition(condition)
|
549
|
+
begin
|
550
|
+
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args unless condition.is_a?(Proc)
|
551
|
+
condition.is_a?(Proc) ? condition.call : handlerwrapper.test_condition(ReadStructure.new(@__weel_data,@__weel_endpoints),condition)
|
552
|
+
rescue => err
|
553
|
+
# if you access $! here, BOOOM
|
554
|
+
self.__weel_state = :stopping
|
555
|
+
@__weel_handlerwrapper::inform_syntax_error(@__weel_handlerwrapper_args,Exception.new("Condition error. I don't want to tell you where and why."),nil)
|
556
|
+
nil
|
557
|
+
end
|
558
|
+
end
|
559
|
+
|
546
560
|
def __weel_activity(position, type, endpoints, parameters, finalize, update=nil)# {{{
|
547
561
|
position = __weel_position_test position
|
548
562
|
begin
|
@@ -904,7 +918,7 @@ public
|
|
904
918
|
end
|
905
919
|
rescue Exception => err
|
906
920
|
@dslr.__weel_state = :stopping
|
907
|
-
@dslr.__weel_handlerwrapper::inform_syntax_error(@dslr.__weel_handlerwrapper_args,
|
921
|
+
@dslr.__weel_handlerwrapper::inform_syntax_error(@dslr.__weel_handlerwrapper_args,Exception.new("DSL error. I don't want to tell you where and why."),code)
|
908
922
|
end
|
909
923
|
if @dslr.__weel_state == :running
|
910
924
|
@dslr.__weel_state = :finished
|
@@ -937,6 +951,8 @@ public
|
|
937
951
|
begin
|
938
952
|
__weel_control_flow(:running)
|
939
953
|
rescue => e
|
954
|
+
puts e.message
|
955
|
+
puts e.backtrace
|
940
956
|
handlerwrapper::inform_handlerwrapper_error handlerwrapper_args, e
|
941
957
|
end
|
942
958
|
end
|
data/weel.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.99.
|
4
|
+
version: 1.99.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|