Module: RedShift
- Includes:
- Math
- Defined in:
- lib/redshift/meta.rb,
lib/redshift/port.rb,
lib/redshift/queue.rb,
lib/redshift/world.rb,
lib/redshift/syntax.rb,
lib/redshift/redshift.rb,
lib/redshift/component.rb,
lib/redshift/target/c/library.rb,
lib/redshift/target/c/flow-gen.rb,
lib/redshift/target/c/flow-gen.rb,
lib/redshift/target/c/flow/rk4.rb,
lib/redshift/target/c/flow/expr.rb,
lib/redshift/target/c/flow/expr.rb,
lib/redshift/target/c/flow/expr.rb,
lib/redshift/target/c/world-gen.rb,
lib/redshift/target/c/flow/delay.rb,
lib/redshift/target/c/flow/euler.rb,
lib/redshift/target/c/component-gen.rb,
lib/redshift/target/c/flow/algebraic.rb,
lib/redshift/target/c/flow/derivative.rb
Defined Under Namespace
Modules: AugmentedException, FlowSyntax, Shell, TransitionSyntax Classes: AlgebraicAssignmentError, AlgebraicFlow, AlreadyStarted, CexprGuard, CircularDefinitionError, Component, ConstnessError, DelayFlow, DerivativeFlow, EulerDifferentialFlow, Expr, Flow, Library, LinkTypeError, NilLinkError, NoValueError, Queue, RK4DifferentialFlow, RedShiftError, ResetExpr, SimultaneousQueueEntries, State, StrictnessError, SyntaxError, Transition, TransitionError, UnconnectedInputError, VarTypeError, World, XArray, ZenoError
Constant Summary collapse
- ZENO_UNLIMITED =
Set zeno_level to this to turn off zeno checking.
-1- VERSION =
'1.3.21'- Infinity =
Math::Infinity
- Always =
Transition.new :name => :Always, :guard => nil
- Enter =
The asymmetry between these two states is that components in Enter are active in the continuous and discrete updates. Components in Exit do not evolve.
Component::Enter
- Exit =
Component::Exit
- HAVE_DEFINE_METHOD =
Module.private_instance_methods.include?("define_method")
Class Method Summary collapse
- .do_library_calls ⇒ Object
- .library ⇒ Object
- .require_target ⇒ Object
-
.with_library(&block) ⇒ Object
Defer a block until just after the library ruby code is loaded, but before commit.
-
.worlds(world_class = World) ⇒ Object
Returns a list of all worlds (instances of RedShift::World and subclasses), or just those descending from
world_class.
Instance Method Summary collapse
Class Method Details
.do_library_calls ⇒ Object
86 87 88 89 90 |
# File 'lib/redshift/redshift.rb', line 86 def RedShift.do_library_calls @library_calls.each do |block| block[library] end end |
.library ⇒ Object
6 7 8 |
# File 'lib/redshift/target/c/library.rb', line 6 def RedShift.library @clib ||= Library.new($REDSHIFT_CLIB_NAME) end |
.require_target ⇒ Object
92 93 94 |
# File 'lib/redshift/redshift.rb', line 92 def RedShift.require_target require $REDSHIFT_TARGET end |
.with_library(&block) ⇒ Object
Defer a block until just after the library ruby code is loaded, but before commit. Necessary for defining inline C functions or shadow_attrs. Note that a whole require statement could be placed inside the with_library block.
82 83 84 |
# File 'lib/redshift/redshift.rb', line 82 def RedShift.with_library(&block) # :yields: library @library_calls << block end |
.worlds(world_class = World) ⇒ Object
Returns a list of all worlds (instances of RedShift::World and subclasses), or just those descending from world_class. Not very efficient, since it uses ObjectSpace.each_object, but useful in irb.
58 59 60 61 62 |
# File 'lib/redshift/redshift.rb', line 58 def self.worlds(world_class = World) worlds = [] ObjectSpace.each_object(world_class) {|w| worlds << w} worlds end |
Instance Method Details
#debug(setting = true, &block) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/redshift/redshift.rb', line 40 def debug setting = true, &block if block begin save_setting = $REDSHIFT_DEBUG $REDSHIFT_DEBUG = setting block.call ensure $REDSHIFT_DEBUG = save_setting end else $REDSHIFT_DEBUG = setting end end |