private void EmitTriggerStateChange(CodeWriter writer, IEnumerable <Trigger> triggers) { writer.AppendComment(); writer.AppendComment("state transition"); foreach (var t in triggers) { if (t.PreCondition.Type == GateType.Fixed) { continue; } var c = _gc.ConvertToGate(0, t.PreCondition); EmitIfHeader(c); EmitEnterBlock(); writer.AppendComment("transition " + t); foreach (var x in t.Transitions) { EmitVariableAssignment(x.Variable, x.SinglePostStateIndex); } EmitLeaveBlock(); } }
public void Dump() { var sb = new CodeWriter(); sb.AppendLine("state machine dump"); foreach (var e in _events.Values) { sb.AppendComment(); sb.AppendComment("event " + e.Name); foreach (var t in e.Triggers) { sb.AppendLine("TRIGGER " + t.Name + " WHEN"); sb.AppendLine(" BEFORE [" + t.PreCondition + "] AFTER [" + t.PostCondition + "]"); } } foreach (var t in Guards) { sb.AppendLine("GUARD " + t.Name + " " + t.Type + " WHEN "); if (t.Type == GuardType.TRANSITION) { sb.AppendLine(" BEFORE [" + t.PreCondition + "]"); sb.AppendLine(" AFTER [" + t.PostCondition + "]"); } else if (t.Type == GuardType.ENTER) { sb.AppendLine(" AFTER [" + t.PostCondition + "]"); } else if (t.Type == GuardType.LEAVE) { sb.AppendLine(" BEFORE [" + t.PreCondition + "]"); } } // sb.AppendLine("matrix:\n" + _matrix); Trace("{0}", sb); }
private void EmitTriggerStateChange(CodeWriter writer, IEnumerable<Trigger> triggers) { writer.AppendComment(); writer.AppendComment("state transition"); foreach (var t in triggers) { if(t.PreCondition.Type == GateType.Fixed) { continue; } var c = _gc.ConvertToGate(0, t.PreCondition); EmitIfHeader(c); EmitEnterBlock(); writer.AppendComment("transition " + t); foreach (var x in t.Transitions) { EmitVariableAssignment(x.Variable, x.SinglePostStateIndex); } EmitLeaveBlock(); } }
private void EmitCodeLabels(int stage) { _writer.AppendComment(); _writer.AppendComment("stage " + stage + " conditions"); _gc.Emit(this, stage); }