Example #1
0
 /// <summary>
 /// Creates an if context object.
 /// </summary>
 /// <param name="active">Flag if context is currently active.</param>
 /// <param name="keep">Flag if context is currently true.</param>
 /// <param name="state">State of context to start in.</param>
 public IfContext(bool active, bool keep, IfState state)
 {
     this.active   = active;
     this.keep     = keep;
     this.everKept = keep;
     this.state    = state;
 }
Example #2
0
 /// <summary>
 /// Creates an if context object.
 /// </summary>
 /// <param name="active">Flag if context is currently active.</param>
 /// <param name="keep">Flag if context is currently true.</param>
 /// <param name="state">State of context to start in.</param>
 public IfContext(bool active, bool keep, IfState state)
 {
     this.active = active;
     this.keep = keep;
     this.everKept = keep;
     this.state = state;
 }
Example #3
0
		/// <summary>
		/// Initializes a new instance of the <see cref="IfContext"/> class.
		/// </summary>
		/// <param name="active">if set to <c>true</c> [active].</param>
		/// <param name="keep">if set to <c>true</c> [keep].</param>
		/// <param name="state">The state.</param>
		public IfContext(bool active, bool keep, IfState state)
		{
			m_Active = active;
			m_Keep = keep;
			m_EverKept = keep;
			m_State = state;
		}
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IfContext"/> class.
 /// </summary>
 /// <param name="active">if set to <c>true</c> [active].</param>
 /// <param name="keep">if set to <c>true</c> [keep].</param>
 /// <param name="state">The state.</param>
 public IfContext(bool active, bool keep, IfState state)
 {
     m_Active   = active;
     m_Keep     = keep;
     m_EverKept = keep;
     m_State    = state;
 }
Example #5
0
 /// <summary>
 /// Creates a default if context object, which are used for if's within an inactive preprocessor block
 /// </summary>
 public IfContext()
 {
     this.active   = false;
     this.keep     = false;
     this.everKept = true;
     this.state    = IfState.If;
 }
Example #6
0
 /// <summary>
 /// Creates an if context object.
 /// </summary>
 /// <param name="active">Flag if context is currently active.</param>
 /// <param name="keep">Flag if context is currently true.</param>
 /// <param name="state">State of context to start in.</param>
 public IfContext(bool active, bool keep, IfState state)
 {
     this.Active      = active;
     this.keep        = keep;
     this.WasEverTrue = keep;
     this.IfState     = IfState.If;
 }
Example #7
0
 /// <summary>
 /// Creates a default if context object, which are used for if's within an inactive preprocessor block
 /// </summary>
 public IfContext()
 {
     this.active = false;
     this.keep = false;
     this.everKept = true;
     this.state = IfState.If;
 }
Example #8
0
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            IEnumerator iterator = MeetsCriterion(payload) ?
                                   IfState.Transmit(payload)
                : ElseState.Transmit(payload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
 internal void InitElseIf() {
     Debug.Assert(initElseIfStack == -1);
     elseIfState = (IfState)blockStack.Pop();
     initElseIfStack = blockStack.Count;
     Br(elseIfState.EndIf);
     MarkLabel(elseIfState.ElseBegin);
 }
 void InternalIf(bool negate) {
     IfState ifState = new IfState();
     ifState.EndIf = DefineLabel();
     ifState.ElseBegin = DefineLabel();
     if (negate)
         Brtrue(ifState.ElseBegin);
     else
         Brfalse(ifState.ElseBegin);
     blockStack.Push(ifState);
 }
Example #11
0
 internal void InitElseIf()
 {
     Debug.Assert(_initElseIfStack == -1);
     _elseIfState = (IfState)_blockStack.Pop();
     _initElseIfStack = _blockStack.Count;
     Br(_elseIfState.EndIf);
     MarkLabel(_elseIfState.ElseBegin);
 }
Example #12
0
 private void InternalIf(bool negate)
 {
     IfState state = new IfState();
     state.EndIf = this.DefineLabel();
     state.ElseBegin = this.DefineLabel();
     if (negate)
     {
         this.Brtrue(state.ElseBegin);
     }
     else
     {
         this.Brfalse(state.ElseBegin);
     }
     this.blockStack.Push(state);
 }
Example #13
0
 /// <summary>
 /// If
 /// </summary>
 /// <param name="cmpOp"></param>
 public void If(Cmp cmpOp)
 {
     IfState state = new IfState();
     state.EndIf = this.DefineLabel();
     state.ElseBegin = this.DefineLabel();
     this.ilGen.Emit(this.GetBranchCode(cmpOp), state.ElseBegin);
     this.blockStack.Push(state);
 }
Example #14
0
 /// <summary>Initializes a new instance of the <see cref="If"/> class.</summary>
 internal If(IfState state, ImmutableCollection collection)
 {
     State      = state;
     Collection = collection;
 }
 internal void If(Cmp cmpOp)
 {
     IfState ifState = new IfState();
     ifState.EndIf = DefineLabel();
     ifState.ElseBegin = DefineLabel();
     if (codeGenTrace != CodeGenTrace.None)
         EmitSourceInstruction("Branch if " + GetCmpInverse(cmpOp).ToString() + " to " + ifState.ElseBegin.GetHashCode().ToString(NumberFormatInfo.InvariantInfo));
     ilGen.Emit(GetBranchCode(cmpOp), ifState.ElseBegin);
     blockStack.Push(ifState);
 }
 internal void While(object value1, Cmp cmpOp, object value2)
 {
     IfState ifState = new IfState();
     ifState.EndIf = DefineLabel();
     ifState.ElseBegin = DefineLabel();
     ilGen.MarkLabel(ifState.ElseBegin);
     Load(value1);
     Load(value2);
     if (codeGenTrace != CodeGenTrace.None)
         EmitSourceInstruction("Branch if " + CmpInverse[(int) cmpOp].ToString() + " to " + ifState.ElseBegin.GetHashCode().ToString());
     ilGen.Emit(BranchCode[(int)cmpOp], ifState.EndIf);
     blockStack.Push(ifState);
 }
 internal void If(Cmp cmpOp) {
     IfState ifState = new IfState();
     ifState.EndIf = DefineLabel();
     ifState.ElseBegin = DefineLabel();
     ilGen.Emit(GetBranchCode(cmpOp), ifState.ElseBegin);
     blockStack.Push(ifState);
 }
 internal void If(Cmp cmpOp)
 {
     IfState state = new IfState {
         EndIf = this.DefineLabel(),
         ElseBegin = this.DefineLabel()
     };
     if (this.codeGenTrace != CodeGenTrace.None)
     {
         this.EmitSourceInstruction("Branch if " + this.GetCmpInverse(cmpOp).ToString() + " to " + state.ElseBegin.GetHashCode().ToString(NumberFormatInfo.InvariantInfo));
     }
     this.ilGen.Emit(this.GetBranchCode(cmpOp), state.ElseBegin);
     this.blockStack.Push(state);
 }