weel 1.99.45 → 1.99.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weel.rb +38 -22
  3. data/weel.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06d57eac9eb689932f63b2593786953aa933e35e
4
- data.tar.gz: cec4065be69a5ca463baad015f218f4d89f56b88
3
+ metadata.gz: 1b267f01fd4b59aec270e7f438bfe10ff98da0f0
4
+ data.tar.gz: 51661c098b1efdd8aa69de6c1ea2abcbcca79587
5
5
  SHA512:
6
- metadata.gz: 9fb2c1c43348383e42f6f1fcc3beb72dd397a840a6c8f167e9d1cee902703a4f642b9c1c08bb77d08b9f20513ed1e788ce37a86532e95d898f1cf88ab3e59792
7
- data.tar.gz: a74e8b19b3b337b6005170c85b35373d7236fb0bb630d1ababcae458e4ccb94d2e31529e41db052de2732cc08bf805502382c074f64beb387a03d2b9a607c472
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
- yield
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
- begin
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
- yield
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
- handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args
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
- yield if __weel_is_in_search_mode || __weel_sim || condition
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
- yield if __weel_is_in_search_mode || __weel_sim || !Thread.current[:alternative_executed].last
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
- yield
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
- yield
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
- yield
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].is_a?(Proc) ? condition[0].call : handlerwrapper.test_condition(ReadStructure.new(@__weel_data,@__weel_endpoints),condition[0])) && self.__weel_state != :stopping && self.__weel_state != :stopped
516
- yield
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
- yield
521
- end while (condition[0].is_a?(Proc) ? condition[0].call : handlerwrapper.test_condition(ReadStructure.new(@__weel_data,@__weel_endpoints),condition[0])) && self.__weel_state != :stopping && self.__weel_state != :stopped
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,err,code)
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "weel"
3
- s.version = "1.99.45"
3
+ s.version = "1.99.46"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Preliminary release of the Workflow Execution Engine Library (WEEL)"
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.45
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-11-22 00:00:00.000000000 Z
12
+ date: 2016-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit