Пример #1
0
  /** Default constructor, initializes reader and writers. */
  public PythonGenerator() {
    super(new MagicDrawReader());

    // Populate list of writer configurations
    addWriter(PythonQuantumStateMachineWriter.class, ModelGroup.class);
    // Check a system property to see if we should generate the execution trace files:
    if (Autocoder.isExecutionTraceOn()) {
      addWriter(PythonExecutionTraceWriter.class, ModelGroup.class);
      if (!Autocoder.signalGenRequested()) {
        addWriter(CStateChartSignalWriter.class, ModelGroup.class);
        addWriter(PythonGuiSignalWriter.class, ModelGroup.class);
      }
    }
  }
Пример #2
0
  /**
   * We override this method to ensure that execution trace is always on for Python generation.
   *
   * @see gov.nasa.jpl.statechart.autocode.AbstractGenerator#generate(java.lang.String[])
   */
  @Override
  public void generate(String[] sources) {
    /* Method is overriden to ensure that GUI trace is turned on.
     */
    boolean priorState = Autocoder.isExecutionTraceOn();
    if (!priorState) { // make sure GUI trace is not disabled
      Autocoder.inst().setNoTrace(false);
    }

    // run code generation
    super.generate(sources);

    if (priorState != Autocoder.isExecutionTraceOn()) { // reinstate
      Autocoder.inst().setNoTrace(priorState);
    }
  }