private void genCTask(ProcessSubcomponent ps, ThreadSubcomponent thread) {
    String threadName = thread.getComponentImplementation().getQualifiedName();
    threadName = GenerationUtilsC.getGenerationCIdentifier(threadName);
    _mainCCode.addOutputNewline("/*** Task " + threadName + " ***/");
    _mainCCode.addOutputNewline("extern void *" + threadName + "_Job(void);");
    _mainCCode.addOutputNewline("");

    _mainHCode.addOutputNewline("DeclareTask(" + thread.getName() + ");");
    _mainCCode.addOutputNewline("");

    _mainCCode.addOutputNewline("TASK(" + thread.getName() + ")");
    _mainCCode.addOutputNewline("{");
    _mainCCode.incrementIndent();

    _mainCCode.addOutputNewline(threadName + "_Job();");

    _mainCCode.decrementIndent();
    _mainCCode.addOutputNewline("}");
    _mainCCode.addOutputNewline("");
  }
  /** Méthode appelée après le parcours de l'AST via les methodes process. */
  public void close() {

    String msg = "Hooks generation";
    _LOGGER.trace(msg);

    _mainCCode.addOutputNewline("void StartupHook(void)");
    _mainCCode.addOutputNewline("{");
    _mainCCode.incrementIndent();
    for (Subprogram subprogram : _startupHook.getCalls()) {
      _mainCCode.addOutput(subprogram.getName());
      _mainCCode.addOutput("(");

      for (String parameter : subprogram.getParameters()) _mainCCode.addOutput(parameter);

      _mainCCode.addOutputNewline(");");
    }
    _mainCCode.decrementIndent();
    _mainCCode.addOutputNewline("}");
    _mainCCode.addOutputNewline("");

    _mainCCode.addOutputNewline("void ShutdownHook(StatusType ercd)");
    _mainCCode.addOutputNewline("{");
    _mainCCode.incrementIndent();
    for (Subprogram subprogram : _shutdownHook.getCalls()) {
      _mainCCode.addOutput(subprogram.getName());
      _mainCCode.addOutput("(");

      for (String parameter : subprogram.getParameters()) _mainCCode.addOutput(parameter);

      _mainCCode.addOutputNewline(");");
    }
    _mainCCode.decrementIndent();
    _mainCCode.addOutputNewline("}");
    _mainCCode.addOutputNewline("");

    _mainHCode.addOutputNewline("DeclareCounter(" + oil.getCpu().getCounter().getName() + ");");
    _mainCCode.addOutputNewline("");

    /* LEJOS OSEK hook to be invoked from an ISR in category 2 */
    _mainCCode.addOutputNewline("void user_1ms_isr_type2(void)");
    _mainCCode.addOutputNewline("{");
    _mainCCode.incrementIndent();
    _mainCCode.addOutputNewline("StatusType ercd;");

    _mainCCode.addOutputNewline(
        "ercd = SignalCounter("
            + oil.getCpu().getCounter().getName()
            + "); /* Increment OSEK Alarm Counter */");
    _mainCCode.addOutputNewline("if(ercd != E_OK)");
    _mainCCode.addOutputNewline("{");
    _mainCCode.incrementIndent();
    _mainCCode.addOutputNewline("ShutdownOS(ercd);");
    _mainCCode.addOutputNewline("}");
    _mainCCode.incrementIndent();
    _mainCCode.addOutputNewline("}");
    _mainCCode.incrementIndent();

    // Generate OIL
    oil.generateOil(_oilCode);

    _mainHCode.addOutputNewline("#include \"gtypes.h\"");
    _mainHCode.addOutputNewline("#endif");
  }