*-----------------------------------------------------------------------------
*  Python
*-----------------------------------------------------------------------------
*  Module description
*
*
*-----------------------------------------------------------------------------

#define /s    KL_mode_synchronous                      K +0
#define /s    KL_mode_asynchronous                     K +1
#define /s    KL_memory_1_MB                           K +1
#define /s    KL_memory_5_MB                           K +5
#define /s    KL_memory_10_MB                          K +10
#define /s    KL_memory_15_MB                          K +15
#define /s    KL_python_process_active                 K +0
#define /s    KL_python_process_not_active             K +2
#define /s    KL_terminate_python_process              K +0
#define /s    KL_kill_python_process                   K +1

#define /s    KS_PY_TNC_mail_path                      S"PLC:\\PYTHON\\TNC_Mail.py"
#define /s    KS_PY_masks_path                         S"PLC:\\PYTHON\\PyMasks.py"

#define /s    ML_TNC_mail_initialized                  M
#define /s    ML_python_masks_initialized              M

#define /s    BL_identifier_TNC_mail                   B
#define /s    BL_identifier_python_masks               B
#define /s    BL_submit_ident_monitor                  B

#define /s    DL_error_TNC_mail                        D
#define /s    DL_error_python_masks                    D

#define /s    DL_exit_TNC_mail                         D
#define /s    DL_exit_python_masks                     D



#include Mac_Lib.inc

GLOBAL Python

;----------------------------
LBL Python
;----------------------------

#if CFG_TNC_Mail = "active"
  LN     ML_TNC_mail_initialized
  O      MG_SK_TNC_mail_display
  IFT
    RPLY   BL_identifier_TNC_mail
    ==     K+0
    IFT
      SUBM   TNC_mail_submit
      =      BL_identifier_TNC_mail
      ==     K+0
      S      PN_error_submit_spawn_queue_full
    ENDI
  ENDI
#endif

#if CFG_python_masks = "active"
  LN     ML_python_masks_initialized
  AN     PN_error_python_masks
  IFT
    RPLY   BL_identifier_python_masks
    ==     K+0
    IFT
      SUBM   Python_masks_submit
      =      BL_identifier_python_masks
      ==     K+0
      S      PN_error_submit_spawn_queue_full
    ENDI
  ENDI

  L      ML_python_masks_initialized
  A      MG_pulse_1_min
  IFT
    RPLY   BL_submit_ident_monitor
    ==     K+0
    IFT
      SUBM   Process_monitor
      =      BL_submit_ident_monitor
      ==     K+0
      S      PN_error_submit_spawn_queue_full
    ENDI
  ENDI
#endif


EM

#if CFG_TNC_Mail = "active"
;----------------------------
LBL TNC_mail_submit

  PS     S"TNC_mail"                   ;process name
  CM     9297                          ;Status of a Python instance
  PLW
  ==     KL_python_process_active
  IFF
    PS     KL_mode_asynchronous        ;Mode
    PS     KL_memory_10_MB             ;Speichergröße
    PS     KS_PY_TNC_mail_path         ;Script Name Python
    PS     S"TNC_mail"                 ;process name
    L      ML_TNC_mail_initialized
    IFT
      PS     S"None"                   ;Parameter
    ELSE
      PS     S"INIT"                   ;Parameter
    ENDI
    CM     9295                        ;Start python process
    PL     DL_error_TNC_mail           ;Fehlercode
    PL     DL_exit_TNC_mail            ;Exit-Code Python

    M_display_module_error

    LN     ML_TNC_mail_initialized
    S      ML_TNC_mail_initialized
  ENDI

EM
#endif

#if CFG_python_masks = "active"
;----------------------------
LBL Python_masks_submit

  PS     S"PY_MASKS"                   ;process name
  CM     9297                          ;Status of a Python instance
  PLW
  ==     KL_python_process_active
  IFF
    PS     KL_mode_asynchronous        ;Mode
    PS     KL_memory_10_MB             ;Speichergröße
    PS     KS_PY_masks_path            ;Script Name Python
    PS     S"PY_MASKS"                 ;process name
    PS     S""                         ;Parameter
    CM     9295                        ;Start python process
    PL     DL_error_python_masks       ;Fehlercode
    PL     DL_exit_python_masks        ;Exit-Code Python

    M_display_module_error

    LN     ML_python_masks_initialized
    S      ML_python_masks_initialized
  ENDI

EM
#endif

;----------------------------
LBL Process_monitor
  PS     S"PY_MASKS"
  CM     9297
  PLW
  ==     KL_python_process_not_active
  IFT
    L      MG_marker_one
    R      ML_python_masks_initialized
    S      PN_error_python_masks
  ENDI
EM
