12#include "misc_check_py.h"
14#define OT_SETUP_hdl AllRtSetup_NULL; \
15 MK_OBJ hdl = MK_ERROR_PRINT;
16#define OT_SETUP_hdl_static __attribute__((unused)) MK_RT mkrt = MkRT; \
17 __attribute__((unused)) MK_ERR hdl = &MkERROR;
20#define MqCleanupTmpl()
136#define IdentE_FromInt_doc "MqIdentE IdentE_FromInt(value:int32)"
137#define SlaveE_FromInt_doc "MqSlaveE SlaveE_FromInt(value:int32)"
138#define StartE_FromInt_doc "MqStartE StartE_FromInt(value:int32)"
139#define StatusIsEF_FromInt_doc "MqStatusIsEF StatusIsEF_FromInt(value:int32)"
140#define WaitOnEventE_FromInt_doc "MqWaitOnEventE WaitOnEventE_FromInt(value:int32)"
143#define IdentE_ToInt_doc "int32 IdentE_ToInt(value:MqIdentE)"
144#define IdentE_ToString_doc "string IdentE_ToString(value:MqIdentE)"
145#define SlaveE_ToInt_doc "int32 SlaveE_ToInt(value:MqSlaveE)"
146#define SlaveE_ToString_doc "string SlaveE_ToString(value:MqSlaveE)"
147#define StartE_ToInt_doc "int32 StartE_ToInt(value:MqStartE)"
148#define StartE_ToString_doc "string StartE_ToString(value:MqStartE)"
149#define StatusIsEF_ToInt_doc "int32 StatusIsEF_ToInt(value:MqStatusIsEF)"
150#define StatusIsEF_ToString_doc "string StatusIsEF_ToString(value:MqStatusIsEF)"
151#define WaitOnEventE_ToInt_doc "int32 WaitOnEventE_ToInt(value:MqWaitOnEventE)"
152#define WaitOnEventE_ToString_doc "string WaitOnEventE_ToString(value:MqWaitOnEventE)"
155#define Help_doc "string Help(tool:string)"
156#define HelpMsgque_doc "string HelpMsgque()"
159#define InitGetArg0_doc "MkBufferListC InitGetArg0()"
160#define InitResetArg0_doc "MkBufferListC InitResetArg0()"
161#define InitSetArg0_doc "InitSetArg0(?bfl:MkBufferListC...=None?)"
164#define Cleanup_doc "Cleanup()"
165#define Setup_doc "Setup()"
169#define Debug_doc "Debug(prefix:str, ?obj:object?"
183 if ((*skipP) >= objc) {
589static PyMethodDef
NS(sMqMsgqueMethods)[] = {
601 {
"IdentE_ToInt" , (PyCFunction)
NS(MqMsgque_IdentE_ToInt) , METH_O ,
IdentE_ToInt_doc },
603 {
"SlaveE_ToInt" , (PyCFunction)
NS(MqMsgque_SlaveE_ToInt) , METH_O ,
SlaveE_ToInt_doc },
605 {
"StartE_ToInt" , (PyCFunction)
NS(MqMsgque_StartE_ToInt) , METH_O ,
StartE_ToInt_doc },
613 {
"Help" , (PyCFunction)
NS(MqMsgque_Help) , METH_O ,
Help_doc },
614 {
"HelpMsgque" , (PyCFunction)
NS(MqMsgque_HelpMsgque) , METH_NOARGS ,
HelpMsgque_doc },
617 {
"InitGetArg0" , (PyCFunction)
NS(MqMsgque_InitGetArg0) , METH_NOARGS ,
InitGetArg0_doc },
618 {
"InitResetArg0" , (PyCFunction)
NS(MqMsgque_InitResetArg0) , METH_NOARGS ,
InitResetArg0_doc },
619 {
"InitSetArg0" , (PyCFunction)
NS(MqMsgque_InitSetArg0) , METH_VARARGS ,
InitSetArg0_doc },
622 {
"Cleanup" , (PyCFunction)
NS(MqMsgque_Cleanup) , METH_NOARGS ,
Cleanup_doc },
623 {
"Setup" , (PyCFunction)
NS(MqMsgque_Setup) , METH_NOARGS ,
Setup_doc },
633 {NULL, NULL, 0, NULL}
651 PyGILState_STATE gilstate;
653 gilstate = PyGILState_Ensure();
654 Py_BEGIN_ALLOW_THREADS
658 ret = (*save_MqSysServerThreadF)(
MK_RT_CALL context, argP, name, thread_status, idP);
662 PyGILState_Release(gilstate);
688}
NS(sMqMsgqueStateS);
691NS(sMqMsgqueGetState)(PyObject *module)
693 void *state = PyModule_GetState(module);
694 assert(state != NULL);
695 return (
NS(sMqMsgqueStateS)*)state;
699#define myTrace2(col,str) mk_dbg_color_ln(col,"%s module<%p> refCnty<%zd>",str,module,Py_REFCNT(module));
700#define myTrace(str) myTrace2(MK_COLOR_ORANGE,str)
702#define myTrace2(col,str)
707NS(sMqMsgqueTraverse)(PyObject *module, visitproc visit,
void *arg)
732NS(sMqMsgqueClear)(PyObject *module)
757NS(sMqMsgqueFree)(
void *module)
760 NS(sMqMsgqueStateS) *state =
NS(sMqMsgqueGetState)(module);
761 NS(sMqMsgqueClear)((PyObject *)module);
762 if (state && state->mkrt) {
763 state->mkrt->mkThreadData.ptr = NULL;
769NS(sMqMsgqueExec)(PyObject *module)
777 NS(sMqMsgqueStateS) *state =
NS(sMqMsgqueGetState)(module);
780 PyObject *mainM = PyImport_AddModule(
"__main__");
797 "from enum import IntEnum, IntFlag\n"
801 "class MqIdentE(IntEnum):\n"
805 "class MqSlaveE(IntEnum):\n"
813 "class MqStartE(IntEnum):\n"
819 "class MqStatusIsEF(IntFlag):\n"
826 "class MqWaitOnEventE(IntEnum):\n"
835 PyObject *myD, *mainD, *tmpO;
836 mainD = PyModule_GetDict(mainM);
837 myD = PyModule_GetDict(module);
838 tmpO = PyRun_String(enumCode, Py_file_input, mainD, myD);
844 MqIdentE_lngO = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,
"MqIdentE"));
845 MqSlaveE_lngO = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,
"MqSlaveE"));
846 MqStartE_lngO = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,
"MqStartE"));
847 MqStatusIsEF_lngO = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,
"MqStatusIsEF"));
848 MqWaitOnEventE_lngO = (PyTypeObject*) Py_NewRef(PyDict_GetItemString(myD,
"MqWaitOnEventE"));
857 if (strcmp(PyModule_GetName(mainM),
"__main__") == 0) {
865 if (
MqInitGetArg0() == NULL && Py_GetProgramName() != NULL) {
866 char *py = Py_EncodeLocale(Py_GetProgramName(),NULL);
868 PyObject *sysO = PyImport_ImportModule(
"sys");
870 PyObject *argvO = PyObject_GetAttrString(sysO,
"argv");
872 PyObject *itmO = PyList_GetItem(argvO, 0);
895 {Py_mod_exec,
NS(sMqMsgqueExec)},
896 {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
900static PyModuleDef
NS(sMqMsgqueDef) = {
901 PyModuleDef_HEAD_INIT,
902 .m_name =
"pymqmsgque",
903 .m_doc =
"python language binding for 'theLink'",
904 .m_size =
sizeof(
NS(sMqMsgqueStateS)),
905 .m_methods =
NS(sMqMsgqueMethods),
906 .m_slots =
NS(sMqMsgqueDefSlots),
907 .m_traverse =
NS(sMqMsgqueTraverse),
908 .m_clear =
NS(sMqMsgqueClear),
909 .m_free =
NS(sMqMsgqueFree),
923 return PyModuleDef_Init(&
NS(sMqMsgqueDef));
#define LngErrorCheckN(PROC)
#define OT_SETUP_VARARGS(min, max, d)
#define OT_SETUP_NOARG(d)
#define OT_SETUP_ONEARG(d)
#define OtErrorCheckLng(PROC)
#define OT_CHECK_NI4(val)
#define OT_retObj_SET_Error
#define OT_CHECK_REQUIRED(val)
#define OT_retObj_SET_None
#define OT_retObj_SET_I32(nat)
#define OT_LNG_NAME_FROM_CLASS(cls)
#define OT_retObj_SET_BFL(nat)
#define OT_retObj_SET_STR(nat)
#define OT_CHECK_OPTIONAL(val)
#define OT_LNG_OBJV(skip)
#define OT_retObj_SET(val)
#define MkErrorC_Check(mng, PROC)
#define OT_CHECK_STRN(val)
#define StartE_ToString_doc
#define WaitOnEventE_ToInt_doc
static typeof(MqLal.MqSysServerThreadCB) save_MqSysServerThreadF
#define WaitOnEventE_ToString_doc
#define IdentE_ToString_doc
#define SlaveE_ToString_doc
#define StatusIsEF_FromInt_doc
#define StatusIsEF_ToString_doc
#define StatusIsEF_ToInt_doc
#define OT_SETUP_hdl_static
#define myTrace2(col, str)
#define InitResetArg0_doc
#define IdentE_FromInt_doc
PyMODINIT_FUNC LibMqMsgque(void)
#define SlaveE_FromInt_doc
#define WaitOnEventE_FromInt_doc
#define StartE_FromInt_doc
#define MqStatusIsEF_lngO
#define MqContextC_MK_NULL
#define MqWaitOnEventE_lngO
#define OT_NEW_Mq_enum_OBJ(typ, val)
#define MqFactoryC_MK_NULL
#define MkBufferListCreateTLS_T(name, num)
static MK_I32 MqStartE_ToInt(enum MqStartE value)
return the MqStartE as integer …
static MK_I32 MqIdentE_ToInt(enum MqIdentE value)
return the MqIdentE as integer …
MK_STRN MqWaitOnEventE_ToString(enum MqWaitOnEventE value)
return the MqWaitOnEventE as string …
static MK_I32 MqStatusIsEF_ToInt(enum MqStatusIsEF value)
return the MqStatusIsEF as integer …
enum MkErrorE MqStartE_FromInt(MK_I32 const value, enum MqStartE *value_out)
return the MqStartE from integer …
enum MkErrorE MqIdentE_FromInt(MK_I32 const value, enum MqIdentE *value_out)
return the MqIdentE from integer …
MqWaitOnEventE
wait for an event? …
MqSlaveE
predefined slave-id for well known slaves …
MK_STRN MqStatusIsEF_ToString(enum MqStatusIsEF value)
return the MqStatusIsEF as string …
enum MkErrorE MqSlaveE_FromInt(MK_I32 const value, enum MqSlaveE *value_out)
return the MqSlaveE from integer …
MqIdentE
identify the application using prefix (default) or factory …
MK_STRN MqSlaveE_ToString(enum MqSlaveE value)
return the MqSlaveE as string …
MqStartE
User preferences on HOWTO start a new entity.
MqStatusIsEF
Information about how the context was created.
MK_STRN MqIdentE_ToString(enum MqIdentE value)
return the MqIdentE as string …
MK_STRN MqStartE_ToString(enum MqStartE value)
return the MqStartE as string …
enum MkErrorE MqStatusIsEF_FromInt(MK_I32 const value, enum MqStatusIsEF *value_out)
return the MqStatusIsEF from integer …
static MK_I32 MqWaitOnEventE_ToInt(enum MqWaitOnEventE value)
return the MqWaitOnEventE as integer …
static MK_I32 MqSlaveE_ToInt(enum MqSlaveE value)
return the MqSlaveE as integer …
enum MkErrorE MqWaitOnEventE_FromInt(MK_I32 const value, enum MqWaitOnEventE *value_out)
return the MqWaitOnEventE from integer …
MK_STR MqHelp(MK_STRN tool)
write pymqmsgque specific user-help to stderr
MK_STR MqHelpMsgque(void)
return a page with the usage of all pymqmsgque specific options
MK_BFL MqInitGetArg0(void)
get the process startup-prefix argument
MK_BFL MqInitResetArg0(void)
Reset the process-startup-prefix argument to an empty list …
void MqInitSetArg0VA(MK_STRN arg0,...)
set the process startup-prefix to a args
void MqInitSetArg0(MK_BAC bfl)
set the process startup-prefix argument to bfl
void MqSetup(void)
setup pymqmsgque internal memory …
struct MqLalS MqLal
Language Abstraction Layer in duty.
#define WrongNumArgs(...)
#define OT_CHECK_ENUM(ename, val)
#define OT_CHECK_BAC(val)
#define WrongTypeOfArgError(exp, got)
MQ_EXTERN enum MkErrorE MK_DECL MQ CheckConstructor(OT_Check_ARGS, MK_CBP *)
PUBLIC data structure for the pymqmsgque-specific-data
MqSysServerThreadF MqSysServerThreadCB
thread server create syscall with pymqmsgque error plugin
data used to initialize a new created thread …