Loading...
Searching...
No Matches
LibMqMsgque_py.c File Reference

LibMqMsgque_py.c - 02 Sep 2024 - aotto1968. More...

#include "LibMqMsgque_py.h"
#include "misc_check_py.h"
#include "tmpl/mq_misc_check_lng.h"
+ Include dependency graph for LibMqMsgque_py.c:

Go to the source code of this file.

Data Structures

struct  py_mqmsgque_sMqMsgqueStateS
 

Macros

#define OT_SETUP_hdl
 
#define OT_SETUP_hdl_static
 
#define MqSetupTmpl()
 
#define MqCleanupTmpl()
 
#define IdentE_FromInt_doc   "MqIdentE IdentE_FromInt(value:int32)"
 
#define SlaveE_FromInt_doc   "MqSlaveE SlaveE_FromInt(value:int32)"
 
#define StartE_FromInt_doc   "MqStartE StartE_FromInt(value:int32)"
 
#define StatusIsEF_FromInt_doc   "MqStatusIsEF StatusIsEF_FromInt(value:int32)"
 
#define WaitOnEventE_FromInt_doc   "MqWaitOnEventE WaitOnEventE_FromInt(value:int32)"
 
#define IdentE_ToInt_doc   "int32 IdentE_ToInt(value:MqIdentE)"
 
#define IdentE_ToString_doc   "string IdentE_ToString(value:MqIdentE)"
 
#define SlaveE_ToInt_doc   "int32 SlaveE_ToInt(value:MqSlaveE)"
 
#define SlaveE_ToString_doc   "string SlaveE_ToString(value:MqSlaveE)"
 
#define StartE_ToInt_doc   "int32 StartE_ToInt(value:MqStartE)"
 
#define StartE_ToString_doc   "string StartE_ToString(value:MqStartE)"
 
#define StatusIsEF_ToInt_doc   "int32 StatusIsEF_ToInt(value:MqStatusIsEF)"
 
#define StatusIsEF_ToString_doc   "string StatusIsEF_ToString(value:MqStatusIsEF)"
 
#define WaitOnEventE_ToInt_doc   "int32 WaitOnEventE_ToInt(value:MqWaitOnEventE)"
 
#define WaitOnEventE_ToString_doc   "string WaitOnEventE_ToString(value:MqWaitOnEventE)"
 
#define Help_doc   "string Help(tool:string)"
 
#define HelpMsgque_doc   "string HelpMsgque()"
 
#define InitGetArg0_doc   "MkBufferListC InitGetArg0()"
 
#define InitResetArg0_doc   "MkBufferListC InitResetArg0()"
 
#define InitSetArg0_doc   "InitSetArg0(?bfl:MkBufferListC...=None?)"
 
#define Cleanup_doc   "Cleanup()"
 
#define Setup_doc   "Setup()"
 
#define Debug_doc   "Debug(prefix:str, ?obj:object?"
 
#define myTrace2(col, str)
 
#define myTrace(str)
 

Functions

int py_mqmsgque_pMqDumpC_Init (MQ_RT const mqrt, OT_LNG_T)
 
int py_mqmsgque_pMqContextC_Init (MQ_RT const mqrt, OT_LNG_T)
 
int py_mqmsgque_pMqFactoryC_Init (MQ_RT const mqrt, OT_LNG_T)
 
int py_mqmsgque_pMqFactoryC_Setup (MQ_RT const mqrt, OT_LNG_T)
 
enum MkErrorE py_mqmsgque_CheckConstructor (OT_Check_ARGS, MK_CCP *retP)
 
static OT_ProcRet py_mqmsgque_MqMsgque_IdentE_FromInt (OtClass_ARGS)
  Python: [static] MqIdentE IdentE_FromInt(value:int32) C-API
return the MqIdentE from integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_SlaveE_FromInt (OtClass_ARGS)
  Python: [static] MqSlaveE SlaveE_FromInt(value:int32) C-API
return the MqSlaveE from integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_StartE_FromInt (OtClass_ARGS)
  Python: [static] MqStartE StartE_FromInt(value:int32) C-API
return the MqStartE from integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_StatusIsEF_FromInt (OtClass_ARGS)
  Python: [static] MqStatusIsEF StatusIsEF_FromInt(value:int32) C-API
return the MqStatusIsEF from integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_WaitOnEventE_FromInt (OtClass_ARGS)
  Python: [static] MqWaitOnEventE WaitOnEventE_FromInt(value:int32) C-API
return the MqWaitOnEventE from integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_IdentE_ToInt (OtClass_ARGS)
  Python: [static] int32 IdentE_ToInt(value:MqIdentE) C-API
return the MqIdentE as integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_IdentE_ToString (OtClass_ARGS)
  Python: [static] string IdentE_ToString(value:MqIdentE) C-API
return the MqIdentE as string …
 
static OT_ProcRet py_mqmsgque_MqMsgque_SlaveE_ToInt (OtClass_ARGS)
  Python: [static] int32 SlaveE_ToInt(value:MqSlaveE) C-API
return the MqSlaveE as integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_SlaveE_ToString (OtClass_ARGS)
  Python: [static] string SlaveE_ToString(value:MqSlaveE) C-API
return the MqSlaveE as string …
 
static OT_ProcRet py_mqmsgque_MqMsgque_StartE_ToInt (OtClass_ARGS)
  Python: [static] int32 StartE_ToInt(value:MqStartE) C-API
return the MqStartE as integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_StartE_ToString (OtClass_ARGS)
  Python: [static] string StartE_ToString(value:MqStartE) C-API
return the MqStartE as string …
 
static OT_ProcRet py_mqmsgque_MqMsgque_StatusIsEF_ToInt (OtClass_ARGS)
  Python: [static] int32 StatusIsEF_ToInt(value:MqStatusIsEF) C-API
return the MqStatusIsEF as integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_StatusIsEF_ToString (OtClass_ARGS)
  Python: [static] string StatusIsEF_ToString(value:MqStatusIsEF) C-API
return the MqStatusIsEF as string …
 
static OT_ProcRet py_mqmsgque_MqMsgque_WaitOnEventE_ToInt (OtClass_ARGS)
  Python: [static] int32 WaitOnEventE_ToInt(value:MqWaitOnEventE) C-API
return the MqWaitOnEventE as integer …
 
static OT_ProcRet py_mqmsgque_MqMsgque_WaitOnEventE_ToString (OtClass_ARGS)
  Python: [static] string WaitOnEventE_ToString(value:MqWaitOnEventE) C-API
return the MqWaitOnEventE as string …
 
static OT_ProcRet py_mqmsgque_MqMsgque_Help (OtClass_ARGS)
  Python: [static] string Help(tool:string) C-API
write pymqmsgque specific user-help to stderr
 
static OT_ProcRet py_mqmsgque_MqMsgque_HelpMsgque (OtClass_ARGS)
  Python: [static] string HelpMsgque() C-API
return a page with the usage of all pymqmsgque specific options
 
static OT_ProcRet py_mqmsgque_MqMsgque_InitGetArg0 (OtClass_ARGS)
  Python: [static] MkBufferListC InitGetArg0() C-API
get the process startup-prefix argument
 
static OT_ProcRet py_mqmsgque_MqMsgque_InitResetArg0 (OtClass_ARGS)
  Python: [static] MkBufferListC InitResetArg0() C-API
Reset the process-startup-prefix argument to an empty list …
 
static OT_ProcRet py_mqmsgque_MqMsgque_InitSetArg0 (OtClass_ARGS)
  Python: [static] InitSetArg0(?bfl:MkBufferListC...=None?) C-API
set the process startup-prefix argument to bfl
 
static OT_ProcRet py_mqmsgque_MqMsgque_Cleanup (OtClass_ARGS)
  Python: [static] Cleanup() C-API
cleanup pymqmsgque internal memory …
 
static OT_ProcRet py_mqmsgque_MqMsgque_Setup (OtClass_ARGS)
  Python: [static] Setup() C-API
setup pymqmsgque internal memory …
 
static typeof (MqLal.SysServerThread) save_SysServerThread
 
static MK_UNUSED enum MkErrorE py_mqmsgque_PyServerThread (MK_RT const mkrt, MQ_CTX const context, struct MqSysServerThreadMainS *const argP, MK_STRN name, int thread_status, struct MkIdS *idP)
 
static MK_UNUSED py_mqmsgque_sMqMsgqueStateSpy_mqmsgque_sMqMsgqueGetState (PyObject *module)
 
static MK_UNUSED int py_mqmsgque_sMqMsgqueTraverse (PyObject *module, visitproc visit, void *arg)
 
static MK_UNUSED int py_mqmsgque_sMqMsgqueClear (PyObject *module)
 
static void py_mqmsgque_sMqMsgqueFree (void *module)
 
static int py_mqmsgque_sMqMsgqueExec (PyObject *module)
 
PyMODINIT_FUNC PyInit_pymqmsgque (void)
 

Variables

static PyMethodDef py_mqmsgque_sMqMsgqueMethods []
 
static MK_UNUSED int num = 0
 
MkThreadLocal MqMsgqueThreadStateS py_mqmsgque_MqMsgqueThreadState = {0}
 
static MK_UNUSED PyModuleDef_Slot py_mqmsgque_sMqMsgqueDefSlots []
 
static PyModuleDef py_mqmsgque_sMqMsgqueDef
 

Detailed Description

LibMqMsgque_py.c - 02 Sep 2024 - aotto1968.

Version
da57c4217ee2f4cc968feed995e6defee7f5b374
Date
Mon Sep 2 08:50:15 2024 +0200
Author
aotto1968 aotto.nosp@m.1968.nosp@m.@t-on.nosp@m.line.nosp@m..de

Definition in file LibMqMsgque_py.c.

Macro Definition Documentation

◆ Cleanup_doc

#define Cleanup_doc   "Cleanup()"

Definition at line 175 of file LibMqMsgque_py.c.

◆ Debug_doc

#define Debug_doc   "Debug(prefix:str, ?obj:object?"

Definition at line 180 of file LibMqMsgque_py.c.

◆ Help_doc

#define Help_doc   "string Help(tool:string)"

Definition at line 166 of file LibMqMsgque_py.c.

◆ HelpMsgque_doc

#define HelpMsgque_doc   "string HelpMsgque()"

Definition at line 167 of file LibMqMsgque_py.c.

◆ IdentE_FromInt_doc

#define IdentE_FromInt_doc   "MqIdentE IdentE_FromInt(value:int32)"

doc definition

Definition at line 147 of file LibMqMsgque_py.c.

◆ IdentE_ToInt_doc

#define IdentE_ToInt_doc   "int32 IdentE_ToInt(value:MqIdentE)"

Definition at line 154 of file LibMqMsgque_py.c.

◆ IdentE_ToString_doc

#define IdentE_ToString_doc   "string IdentE_ToString(value:MqIdentE)"

Definition at line 155 of file LibMqMsgque_py.c.

◆ InitGetArg0_doc

#define InitGetArg0_doc   "MkBufferListC InitGetArg0()"

Definition at line 170 of file LibMqMsgque_py.c.

◆ InitResetArg0_doc

#define InitResetArg0_doc   "MkBufferListC InitResetArg0()"

Definition at line 171 of file LibMqMsgque_py.c.

◆ InitSetArg0_doc

#define InitSetArg0_doc   "InitSetArg0(?bfl:MkBufferListC...=None?)"

Definition at line 172 of file LibMqMsgque_py.c.

◆ MqCleanupTmpl

#define MqCleanupTmpl ( )

Definition at line 23 of file LibMqMsgque_py.c.

◆ MqSetupTmpl

#define MqSetupTmpl ( )

Definition at line 22 of file LibMqMsgque_py.c.

◆ myTrace

#define myTrace ( str)

Definition at line 714 of file LibMqMsgque_py.c.

◆ myTrace2

#define myTrace2 ( col,
str )

Definition at line 713 of file LibMqMsgque_py.c.

◆ OT_SETUP_hdl

#define OT_SETUP_hdl
Value:
#define MqRtSetup_NULL
#define MK_ERROR_PRINT

Definition at line 17 of file LibMqMsgque_py.c.

17#define OT_SETUP_hdl MqRtSetup_NULL; \
18 MK_OBJ hdl = MK_ERROR_PRINT;

◆ OT_SETUP_hdl_static

#define OT_SETUP_hdl_static
Value:
__attribute__((unused)) MK_RT mkrt = MkRT; \
__attribute__((unused)) MK_ERR hdl = &MkERROR;
#define MkERROR
#define MkRT

Definition at line 19 of file LibMqMsgque_py.c.

19#define OT_SETUP_hdl_static __attribute__((unused)) MK_RT mkrt = MkRT; \
20 __attribute__((unused)) MK_ERR hdl = &MkERROR;

◆ Setup_doc

#define Setup_doc   "Setup()"

Definition at line 176 of file LibMqMsgque_py.c.

◆ SlaveE_FromInt_doc

#define SlaveE_FromInt_doc   "MqSlaveE SlaveE_FromInt(value:int32)"

Definition at line 148 of file LibMqMsgque_py.c.

◆ SlaveE_ToInt_doc

#define SlaveE_ToInt_doc   "int32 SlaveE_ToInt(value:MqSlaveE)"

Definition at line 156 of file LibMqMsgque_py.c.

◆ SlaveE_ToString_doc

#define SlaveE_ToString_doc   "string SlaveE_ToString(value:MqSlaveE)"

Definition at line 157 of file LibMqMsgque_py.c.

◆ StartE_FromInt_doc

#define StartE_FromInt_doc   "MqStartE StartE_FromInt(value:int32)"

Definition at line 149 of file LibMqMsgque_py.c.

◆ StartE_ToInt_doc

#define StartE_ToInt_doc   "int32 StartE_ToInt(value:MqStartE)"

Definition at line 158 of file LibMqMsgque_py.c.

◆ StartE_ToString_doc

#define StartE_ToString_doc   "string StartE_ToString(value:MqStartE)"

Definition at line 159 of file LibMqMsgque_py.c.

◆ StatusIsEF_FromInt_doc

#define StatusIsEF_FromInt_doc   "MqStatusIsEF StatusIsEF_FromInt(value:int32)"

Definition at line 150 of file LibMqMsgque_py.c.

◆ StatusIsEF_ToInt_doc

#define StatusIsEF_ToInt_doc   "int32 StatusIsEF_ToInt(value:MqStatusIsEF)"

Definition at line 160 of file LibMqMsgque_py.c.

◆ StatusIsEF_ToString_doc

#define StatusIsEF_ToString_doc   "string StatusIsEF_ToString(value:MqStatusIsEF)"

Definition at line 161 of file LibMqMsgque_py.c.

◆ WaitOnEventE_FromInt_doc

#define WaitOnEventE_FromInt_doc   "MqWaitOnEventE WaitOnEventE_FromInt(value:int32)"

Definition at line 151 of file LibMqMsgque_py.c.

◆ WaitOnEventE_ToInt_doc

#define WaitOnEventE_ToInt_doc   "int32 WaitOnEventE_ToInt(value:MqWaitOnEventE)"

Definition at line 162 of file LibMqMsgque_py.c.

◆ WaitOnEventE_ToString_doc

#define WaitOnEventE_ToString_doc   "string WaitOnEventE_ToString(value:MqWaitOnEventE)"

Definition at line 163 of file LibMqMsgque_py.c.

Function Documentation

◆ py_mqmsgque_CheckConstructor()

enum MkErrorE py_mqmsgque_CheckConstructor ( OT_Check_ARGS ,
MK_CCP * retP )

Definition at line 190 of file LibMqMsgque_py.c.

193 {
194 if ((*skipP) >= objc) {
195 WrongNumArgs(hdl,(*skipP), objc, -999, +999, arg);
196 goto error;
197 }
198 PyObject *objV = OT_LNG_OBJV((*skipP)++);
199 if (PyObject_IsSubclass(objV,(OT_LNG_T)&NS(MqContextCR)) == 1) {
200 Py_INCREF(objV);
201 *retP = (MK_CCP)objV;
202 } else if (PyObject_IsSubclass(objV,(OT_LNG_T)&MK(MkObjectCR)) == 1) {
203 WrongTypeOfArgError(OT_LNG_NAME_FROM_CLASS(&NS(MqContextCR)), OT_LNG_NAME_FROM_CLASS((OT_LNG_CLASS_T)objV));
204 } else {
205 WrongTypeOfArgError(OT_LNG_NAME_FROM_CLASS(&NS(MqContextCR)), OT_LNG_TYPE_STRING(objV));
206 }
207 return MK_OK;
208error:
209 return OT_ERROR_STACK;
210}
#define error
MK_OK
MK_PTRB * MK_CCP
PUBLIC data structure for the pymqmsgque-specific-data

◆ py_mqmsgque_pMqContextC_Init()

int py_mqmsgque_pMqContextC_Init ( MQ_RT const mqrt,
OT_LNG_T m )

Definition at line 3976 of file MqContextC_py.c.

3976 {
3977
3978 // define type
3979 MqContextCTT = MkTypeDup2(MqContextC_TT,"pymqmsgque_MqContextC");
3980 MqContextCT->fIncrSelf = NS(sIncrSelf);
3981 MqContextCT->fDecrSelf = NS(sDecrSelf);
3982// >> replaced by os_fork
3983// MqContextCT->fParentBeforeFork = NS(sParentBeforeFork);
3984// MqContextCT->fParentAfterFork = NS(sParentAfterFork);
3985// MqContextCT->fChildAfterFork = NS(sChildAfterFork);
3986 MqContextCT->fProcessExit = NS(sProcessExit);
3987 MqContextCT->fThreadExit = NS(sThreadExit);
3988 //MqContextCT->ignoreDisasterSetup = true;
3989 MqContextCT->ignoreThread = true;
3990
3991 ClassInit
3992
3993 return 0;
3994error:
3995 return -1;
3996}
#define MqContextCTT
#define ClassInit
#define MkTypeDup2(...)
#define MqContextCT
class as MqCtxTypeS-class-type for MqContextC in the Target-Programming-Language (TPL) …
#define MqContextC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …

◆ py_mqmsgque_pMqDumpC_Init()

int py_mqmsgque_pMqDumpC_Init ( MQ_RT const mqrt,
OT_LNG_T m )

Public API

Definition at line 470 of file MqDumpC_py.c.

470 {
471
473
474 return 0;
475error:
476 return -1;
477}
#define ClassInit
Definition MqDumpC_py.c:61

◆ py_mqmsgque_pMqFactoryC_Init()

int py_mqmsgque_pMqFactoryC_Init ( MQ_RT const mqrt,
OT_LNG_T m )

Definition at line 844 of file MqFactoryC_py.c.

845{
847 MqFactoryCTT->noSelf = true;
848
849 return 0;
850error:
851 return -1;
852}
#define MqFactoryCTT
#define ClassInit

◆ py_mqmsgque_pMqFactoryC_Setup()

int py_mqmsgque_pMqFactoryC_Setup ( MQ_RT const mqrt,
OT_LNG_T m )

Public API

Definition at line 805 of file MqFactoryC_py.c.

806{
807 if (!strcmp(MqFactoryDefaultIdent(), "libmqmsgque")) {
808 if ( MqFactoryDefault(
811 NS(sFactoryCTor), (MK_PTR)&NS(MqContextCR), NULL, NULL,
812 NS(sFactoryDTor), NULL, NULL, NULL,
813 "pymqmsgque"
814 )
815 )
816 ) == NULL
817 )
818 {
819 PyErr_SetString(PyExc_RuntimeError, "MqFactoryS exception");
820 goto error;
821 }
822 }
823
824 return 0;
825error:
826 return -1;
827}
#define MK_ERROR_FORMAT
MK_PTRB * MK_PTR
MQ_EXTERN MK_STRN MqFactoryDefaultIdent(void)
return the factory-identifier of the default MqFactoryC
MQ_EXTERN MQ_FCT MqFactoryDefault(MQ_FCT const fct) MK_ATTR_HDL
set the default-attribute to the factory …
MQ_EXTERN MQ_FCT MqFactoryInitial(MQ_FCT const fct) MK_ATTR_HDL
set the initial-attribut to fct …
#define MqFactoryAdd(...)

◆ py_mqmsgque_PyServerThread()

static MK_UNUSED enum MkErrorE py_mqmsgque_PyServerThread ( MK_RT const mkrt,
MQ_CTX const context,
struct MqSysServerThreadMainS *const argP,
MK_STRN name,
int thread_status,
struct MkIdS * idP )
static

Definition at line 653 of file LibMqMsgque_py.c.

660 {
661 enum MkErrorE ret;
662 PyGILState_STATE gilstate;
663
664 gilstate = PyGILState_Ensure();
665 Py_BEGIN_ALLOW_THREADS
666
667//num++;
668//printV("START num<%d>, ts<%p>, gil<%o>",num,_save,gilstate);
669 ret = (*save_SysServerThread)(MK_RT_CALL context, argP, name, thread_status, idP);
670//printV("END num<%d>, ts<%p>, gil<%o>",num,_save,gilstate);
671
672 Py_END_ALLOW_THREADS
673 PyGILState_Release(gilstate);
674
675 return ret;
676}
MkErrorE
#define MK_RT_CALL

◆ py_mqmsgque_sMqMsgqueClear()

static MK_UNUSED int py_mqmsgque_sMqMsgqueClear ( PyObject * module)
static

Definition at line 743 of file LibMqMsgque_py.c.

744{
745myTrace("CLEAR")
746
747 // BEGIN-EnumClear - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
748
749 Py_CLEAR(OT_MqIdentE);
750 Py_CLEAR(OT_MqSlaveE);
751 Py_CLEAR(OT_MqStartE);
752 Py_CLEAR(OT_MqStatusIsEF);
753 Py_CLEAR(OT_MqWaitOnEventE);
754
755 // END-EnumClear - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
756 // BEGIN-ClassClear - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
757
758 Py_CLEAR(MqDumpC_MK_NULL);
759 Py_CLEAR(MqContextC_MK_NULL);
760 Py_CLEAR(MqFactoryC_MK_NULL);
761
762 // END-ClassClear - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
763
764 return 0;
765}
#define myTrace(str)
#define MqContextC_MK_NULL
#define MqDumpC_MK_NULL
Definition MqDumpC_py.c:40
#define MqFactoryC_MK_NULL

◆ py_mqmsgque_sMqMsgqueExec()

static int py_mqmsgque_sMqMsgqueExec ( PyObject * module)
static

Definition at line 780 of file LibMqMsgque_py.c.

781{
782myTrace2(MK_BLUE,"START")
783//printV("#1 PyThreadState_Get<%p>", PyThreadState_Get())
784
785 MqSetup();
787
788 NS(sMqMsgqueStateS) *state = NS(sMqMsgqueGetState)(module);
789 state->mkrt = MK_RT_PTR;
790
791// MK_RT_REF.threadData = PyThreadState_Get();
792
793 PyObject *mainM = PyImport_AddModule("__main__");
794
795 PyObject *mkM;
796 LngErrorCheckN(mkM = PyImport_ImportModule("pymkkernel"));
797 LngErrorCheck(PyObject_SetAttrString(mainM,"pymkkernel",mkM));
798 Py_CLEAR(mkM);
799
800 // BEGIN-CLASS-DEF - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
801
802 LngErrorCheck( NS(pMqDumpC_Init) (MQ_RT_CALL module) ) ;
803 LngErrorCheck( NS(pMqContextC_Init) (MQ_RT_CALL module) ) ;
804 LngErrorCheck( NS(pMqFactoryC_Init) (MQ_RT_CALL module) ) ;
805
806 // END-CLASS-DEF - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
807
808 // init ENUM
809 MK_STR enumCode =
810 "from enum import IntEnum, IntFlag\n"
811
812 // BEGIN-EnumCode - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
813
814 "class MqIdentE(IntEnum):\n"
815 " PREFIX = 0\n"
816 " FACTORY = 1\n"
817
818 "class MqSlaveE(IntEnum):\n"
819 " LOOPBACK = 0\n"
820 " FILTER = 1\n"
821 " MASTER = 1\n"
822 " OTHER = 1\n"
823 " USER = 10\n"
824 " MAX = 1024\n"
825
826 "class MqStartE(IntEnum):\n"
827 " DEFAULT = 0\n"
828 " FORK = 1\n"
829 " THREAD = 2\n"
830 " SPAWN = 3\n"
831
832 "class MqStatusIsEF(IntFlag):\n"
833 " INITIAL = 0\n"
834 " DUP = 1\n"
835 " THREAD = 2\n"
836 " FORK = 4\n"
837 " SPAWN = 8\n"
838
839 "class MqWaitOnEventE(IntEnum):\n"
840 " NO = 0\n"
841 " ONCE = 1\n"
842 " OWN = 2\n"
843 " FOREVER = 3\n"
844
845 // END-EnumCode - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
846 ;
847
848 PyObject *myD, *mainD, *tmpO;
849 mainD = PyModule_GetDict(mainM);
850 myD = PyModule_GetDict(module);
851 tmpO = PyRun_String(enumCode, Py_file_input, mainD, myD);
852 LngErrorCheckN(tmpO);
853 Py_CLEAR(tmpO);
854
855 // BEGIN-EnumSet - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
856
857 OT_MqIdentE = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,"MqIdentE"));
858 OT_MqSlaveE = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,"MqSlaveE"));
859 OT_MqStartE = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,"MqStartE"));
860 OT_MqStatusIsEF = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,"MqStatusIsEF"));
861 OT_MqWaitOnEventE = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,"MqWaitOnEventE"));
862
863 // END-EnumSet - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
864
865 // every new thread source the script
866 // "from pymqmsgque import" is calling "PyInit_pymqmsgque"
867 // → check if we on "thread" : __name__=__main__
868
869 // only ONCE on INITIAL setup
870 if (strcmp(PyModule_GetName(mainM),"__main__") == 0) {
871
872 // set the thread startup
873 //save_SysServerThread = MqLal.SysServerThread;
874 //MqLal.SysServerThread = NS(PyServerThread);
875 //MkLal.SysExit = NS(PyExit);
876
877 // init libmqmsgque global data
878 if (MqInitGetArg0() == NULL && Py_GetProgramName() != NULL) {
879 char *py = Py_EncodeLocale(Py_GetProgramName(),NULL);
880
881 PyObject *sysO = PyImport_ImportModule("sys");
882 LngErrorCheckN(sysO);
883 PyObject *argvO = PyObject_GetAttrString(sysO, "argv");
884 LngErrorCheckN(argvO);
885 PyObject *itmO = PyList_GetItem(argvO, 0);
886 LngErrorCheckN(itmO);
887
888 MqInitSetArg0VA(py, PyUnicode_AsUTF8(itmO), NULL);
889
890 Py_CLEAR(argvO);
891 Py_CLEAR(sysO);
892 PyMem_Free(py);
893 }
894
895 // create the default-factory
896 LngErrorCheck (NS(pMqFactoryC_Setup) (MQ_RT_CALL module));
897 }
898
899 //PyErr_SetString(PyExc_RuntimeError,"this is a test");
900
901//mk_debug_color(MK_BLUE,"END module<%p>",module);
902 return 0;
903error:
904 return -1;
905}
#define myTrace2(col, str)
MK_STRB * MK_STR
#define MK_RT_PTR
MqWaitOnEventE
wait for an event? …
MqSlaveE
predefined slave-id for well known slaves …
MqIdentE
identify the application using prefix (default) or factory …
MqStartE
User preferences on HOWTO start a new entity.
MqStatusIsEF
Information about how the context was created.
MQ_EXTERN MK_BFL MqInitGetArg0(void)
get the process startup-prefix argument
MQ_EXTERN void MqInitSetArg0VA(MK_STRN arg0,...)
set the process startup-prefix to a args
MQ_EXTERN void MqSetup(void)
setup pymqmsgque internal memory …
#define MQ_RT_CALL

◆ py_mqmsgque_sMqMsgqueFree()

static void py_mqmsgque_sMqMsgqueFree ( void * module)
static

Definition at line 768 of file LibMqMsgque_py.c.

769{
770myTrace("FREE")
771 NS(sMqMsgqueStateS) *state = NS(sMqMsgqueGetState)(module);
772 NS(sMqMsgqueClear)((PyObject *)module);
773 if (state && state->mkrt) {
774 state->mkrt->threadData = NULL;
775 state->mkrt=NULL;
776 }
777}

◆ py_mqmsgque_sMqMsgqueGetState()

static MK_UNUSED py_mqmsgque_sMqMsgqueStateS * py_mqmsgque_sMqMsgqueGetState ( PyObject * module)
inlinestatic

Definition at line 702 of file LibMqMsgque_py.c.

703{
704 void *state = PyModule_GetState(module);
705 assert(state != NULL);
706 return (NS(sMqMsgqueStateS)*)state;
707}

◆ py_mqmsgque_sMqMsgqueTraverse()

static MK_UNUSED int py_mqmsgque_sMqMsgqueTraverse ( PyObject * module,
visitproc visit,
void * arg )
static

Definition at line 718 of file LibMqMsgque_py.c.

719{
720myTrace("TRAVERSE")
721
722 // BEGIN-EnumTraverse - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
723
724 Py_VISIT(OT_MqIdentE);
725 Py_VISIT(OT_MqSlaveE);
726 Py_VISIT(OT_MqStartE);
727 Py_VISIT(OT_MqStatusIsEF);
728 Py_VISIT(OT_MqWaitOnEventE);
729
730 // END-EnumTraverse - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
731 // BEGIN-ClassTraverse - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
732
733 Py_VISIT(MqDumpC_MK_NULL);
734 Py_VISIT(MqContextC_MK_NULL);
735 Py_VISIT(MqFactoryC_MK_NULL);
736
737 // END-ClassTraverse - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
738
739 return 0;
740}

◆ PyInit_pymqmsgque()

PyMODINIT_FUNC PyInit_pymqmsgque ( void )

Public API

Definition at line 933 of file LibMqMsgque_py.c.

934{
935 // Multi-phase initialization
936 return PyModuleDef_Init(&NS(sMqMsgqueDef));
937}

◆ typeof()

static typeof ( MqLal. SysServerThread)
static

Variable Documentation

◆ num

MK_UNUSED int num = 0
static

Definition at line 651 of file LibMqMsgque_py.c.

◆ py_mqmsgque_MqMsgqueThreadState

MkThreadLocal MqMsgqueThreadStateS py_mqmsgque_MqMsgqueThreadState = {0}

Definition at line 695 of file LibMqMsgque_py.c.

695{0};

◆ py_mqmsgque_sMqMsgqueDef

PyModuleDef py_mqmsgque_sMqMsgqueDef
static
Initial value:
= {
PyModuleDef_HEAD_INIT,
.m_name = "pymqmsgque",
.m_doc = "python language binding 'MqMsgque'",
.m_size = sizeof( py_mqmsgque_sMqMsgqueStateS ),
}
static MK_UNUSED int py_mqmsgque_sMqMsgqueClear(PyObject *module)
static MK_UNUSED int py_mqmsgque_sMqMsgqueTraverse(PyObject *module, visitproc visit, void *arg)
static void py_mqmsgque_sMqMsgqueFree(void *module)
static PyMethodDef py_mqmsgque_sMqMsgqueMethods[]
static MK_UNUSED PyModuleDef_Slot py_mqmsgque_sMqMsgqueDefSlots[]

Definition at line 913 of file LibMqMsgque_py.c.

913 {
914 PyModuleDef_HEAD_INIT,
915 .m_name = "pymqmsgque",
916 .m_doc = "python language binding 'MqMsgque'",
917 .m_size = sizeof(NS(sMqMsgqueStateS)),
918 .m_methods = NS(sMqMsgqueMethods),
919 .m_slots = NS(sMqMsgqueDefSlots),
920 .m_traverse = NS(sMqMsgqueTraverse), // garbage collection
921 .m_clear = NS(sMqMsgqueClear),
922 .m_free = NS(sMqMsgqueFree),
923};

◆ py_mqmsgque_sMqMsgqueDefSlots

MK_UNUSED PyModuleDef_Slot py_mqmsgque_sMqMsgqueDefSlots[]
static
Initial value:
= {
{Py_mod_exec, py_mqmsgque_sMqMsgqueExec },
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
}
static int py_mqmsgque_sMqMsgqueExec(PyObject *module)

Definition at line 907 of file LibMqMsgque_py.c.

907 {
908 {Py_mod_exec, NS(sMqMsgqueExec)},
909 {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
910 {0, NULL}
911};

◆ py_mqmsgque_sMqMsgqueMethods

PyMethodDef py_mqmsgque_sMqMsgqueMethods[]
static

Type definition

Definition at line 600 of file LibMqMsgque_py.c.

600 {
601
602 // BEGIN-CLASS - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
603
604 // doc-key: MqMsgque,EnumFunc,sco
605 { "IdentE_FromInt" , (PyCFunction) NS(MqMsgque_IdentE_FromInt) , METH_O , IdentE_FromInt_doc },
606 { "SlaveE_FromInt" , (PyCFunction) NS(MqMsgque_SlaveE_FromInt) , METH_O , SlaveE_FromInt_doc },
607 { "StartE_FromInt" , (PyCFunction) NS(MqMsgque_StartE_FromInt) , METH_O , StartE_FromInt_doc },
608 { "StatusIsEF_FromInt" , (PyCFunction) NS(MqMsgque_StatusIsEF_FromInt) , METH_O , StatusIsEF_FromInt_doc },
609 { "WaitOnEventE_FromInt" , (PyCFunction) NS(MqMsgque_WaitOnEventE_FromInt) , METH_O , WaitOnEventE_FromInt_doc },
610
611 // doc-key: MqMsgque,EnumFunc,sm_
612 { "IdentE_ToInt" , (PyCFunction) NS(MqMsgque_IdentE_ToInt) , METH_O , IdentE_ToInt_doc },
613 { "IdentE_ToString" , (PyCFunction) NS(MqMsgque_IdentE_ToString) , METH_O , IdentE_ToString_doc },
614 { "SlaveE_ToInt" , (PyCFunction) NS(MqMsgque_SlaveE_ToInt) , METH_O , SlaveE_ToInt_doc },
615 { "SlaveE_ToString" , (PyCFunction) NS(MqMsgque_SlaveE_ToString) , METH_O , SlaveE_ToString_doc },
616 { "StartE_ToInt" , (PyCFunction) NS(MqMsgque_StartE_ToInt) , METH_O , StartE_ToInt_doc },
617 { "StartE_ToString" , (PyCFunction) NS(MqMsgque_StartE_ToString) , METH_O , StartE_ToString_doc },
618 { "StatusIsEF_ToInt" , (PyCFunction) NS(MqMsgque_StatusIsEF_ToInt) , METH_O , StatusIsEF_ToInt_doc },
619 { "StatusIsEF_ToString" , (PyCFunction) NS(MqMsgque_StatusIsEF_ToString) , METH_O , StatusIsEF_ToString_doc },
620 { "WaitOnEventE_ToInt" , (PyCFunction) NS(MqMsgque_WaitOnEventE_ToInt) , METH_O , WaitOnEventE_ToInt_doc },
621 { "WaitOnEventE_ToString" , (PyCFunction) NS(MqMsgque_WaitOnEventE_ToString) , METH_O , WaitOnEventE_ToString_doc },
622
623 // doc-key: MqMsgque,MqHelp,sm_
624 { "Help" , (PyCFunction) NS(MqMsgque_Help) , METH_O , Help_doc },
625 { "HelpMsgque" , (PyCFunction) NS(MqMsgque_HelpMsgque) , METH_NOARGS , HelpMsgque_doc },
626
627 // doc-key: MqMsgque,MqInit,sm_
628 { "InitGetArg0" , (PyCFunction) NS(MqMsgque_InitGetArg0) , METH_NOARGS , InitGetArg0_doc },
629 { "InitResetArg0" , (PyCFunction) NS(MqMsgque_InitResetArg0) , METH_NOARGS , InitResetArg0_doc },
630 { "InitSetArg0" , (PyCFunction) NS(MqMsgque_InitSetArg0) , METH_VARARGS , InitSetArg0_doc },
631
632 // doc-key: MqMsgque,Setup,sm_
633 { "Cleanup" , (PyCFunction) NS(MqMsgque_Cleanup) , METH_NOARGS , Cleanup_doc },
634 { "Setup" , (PyCFunction) NS(MqMsgque_Setup) , METH_NOARGS , Setup_doc },
635
636 // END-CLASS - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
637
638 // BEGIN-OBJ - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
639
640// → no data
641
642 // END-OBJ - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
643
644 {NULL, NULL, 0, NULL} /* Sentinel */
645};
#define StartE_ToString_doc
#define WaitOnEventE_ToInt_doc
#define WaitOnEventE_ToString_doc
#define IdentE_ToInt_doc
#define IdentE_ToString_doc
#define InitGetArg0_doc
#define SlaveE_ToString_doc
#define StatusIsEF_FromInt_doc
#define StatusIsEF_ToString_doc
#define StatusIsEF_ToInt_doc
#define HelpMsgque_doc
#define Help_doc
#define InitSetArg0_doc
#define InitResetArg0_doc
#define StartE_ToInt_doc
#define Cleanup_doc
#define IdentE_FromInt_doc
#define SlaveE_ToInt_doc
#define SlaveE_FromInt_doc
#define Setup_doc
#define WaitOnEventE_FromInt_doc
#define StartE_FromInt_doc