theLink 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - py - rb - jv - cc
Loading...
Searching...
No Matches
MqFactoryC_py.c File Reference

MqFactoryC_py.c - 28 Oct 2024 - aotto1968. More...

#include "LibMqMsgque_private_py.h"
+ Include dependency graph for MqFactoryC_py.c:

Go to the source code of this file.

Macros

#define META_FILE_NAME   "MqFactoryC_py.c"
 
#define OT_CLASS   (&NS(MqFactoryCR))
 
#define OT_CLASS_NAME   "MqFactoryC"
 
#define OT_LNG2META(O)
 
#define OT_retObj_CONSTR(mng)
 
#define OT_SETUP_hdl   OT_SETUP_hdl_tmpl(MqFactoryC)
 
#define OT_SETUP_hdl__null_allow   OT_SETUP_hdl_tmpl__null_allow(MqFactoryC)
 
#define OT_SETUP_hdl_constr
 
#define OT_SETUP_hdl_destr   OT_SETUP_hdl_tmpl__null_allow(MqFactoryC)
 
#define OT_SETUP_hdl_static
 
#define OT_SETUP_hdl_static_constr   OT_SETUP_hdl_static
 
#define SetupRtFromObj_X(hdl)
 
#define SetupRtFromObj_XN(hdl)
 
#define MqFactoryCTT   MQ(MqMsgqueThreadState).MqFactoryCTT
 
#define ClassInit
 
#define SetupRtFromObj_XN(hdl)
 
#define OT_SETUP_hdl
 
#define OT_SETUP_hdl_constr
 
#define OT_SETUP_hdl_static
 
#define OT_SETUP_hdl_static_constr
 
#define OT_retObj_RETURN
 
#define Add_doc   "MqFactoryC MqFactoryC.Add(constructor:class, ?ident:string=\"MK_NULL\"?)"
 
#define new_doc   "MqFactoryC MqFactoryC.new(constructor:class, ?ident:string=\"MK_NULL\"?)"
 
#define Get_doc   "MqFactoryC MqFactoryC.Get(?ident:string=\"\"?)"
 
#define GetCalled_doc   "MqFactoryC MqFactoryC.GetCalled(?ident:string=\"\"?)"
 
#define GetCalledL_doc   "MqFactoryC MqFactoryC.GetCalledL(largs:MkBufferListC)"
 
#define GetNull_doc   "MqFactoryC MqFactoryC.GetNull()"
 
#define HandleResolve_doc   "MqFactoryC MqFactoryC.HandleResolve(netHdl:MK_HDL)"
 
#define Instances_doc   "MqFactoryC MqFactoryC.Instances()"
 
#define DefaultIdent_doc   "string MqFactoryC.DefaultIdent()"
 
#define InitialIdent_doc   "string MqFactoryC.InitialIdent()"
 
#define LogAll_doc   "MqFactoryC.LogAll(?callfunc:string=\"MK_NULL\"?)"
 
#define Dup2_doc   "MqFactoryC fct.Dup2(ident:string) (const)"
 
#define Default_doc   "MqFactoryC fct.Default()"
 
#define Initial_doc   "MqFactoryC fct.Initial()"
 
#define Next_doc   "MqFactoryC fct.Next()"
 
#define Prev_doc   "MqFactoryC fct.Prev()"
 
#define New_doc   "MqContextC fct.New()"
 
#define GetOriginalIdent_doc   "string fct.GetOriginalIdent() (const)"
 
#define HandleGet_doc   "MK_HDL fct.HandleGet()"
 
#define Log_doc   "fct.Log(?fmtobj:MkObjectC=None?, ?debug:int32=0?, ?callfunc:string=\"MK_NULL\"?, ?lvl:int32=0?) (const)"
 

Functions

OT_LNG_T py_mqmsgque_MqFactoryC_CTOR (MK_RT mkrt, OT_LNG_CLASS_T type, MQ_FCT hdl)
 
static MK_PTR py_mqmsgque_MqFactoryC_selfCreate (MK_RT mkrt, MK_OBJ const obj, MK_PTR const env)
 
static void py_mqmsgque_MqFactoryC_selfDelete (MK_RT mkrt, MK_PTR self, MK_PTR const env)
 
static void py_mqmsgque_MqFactoryC_selfUnlink (MK_RT mkrt, MK_PTR self, MK_PTR const env)
 
static enum MkErrorE py_mqmsgque_sFactoryCTor (MQ_CALLBACK_FACTORY_CTOR_ARGS)
 
static void py_mqmsgque_sFactoryDTor (MK_RT mkrt, MQ_CTX context, bool doFactoryDelete, MQ_FCT const data)
 
static void py_mqmsgque_sFactoryDataFree (MK_RT mkrt, MK_PTR *dataP)
 
static void py_mqmsgque_sFactoryDataCopy (MK_RT mkrt, MK_PTR *dataP)
 
static OT_ProcRet py_mqmsgque_MqFactoryC_HandleResolve (OtClass_ARGS)
  Python: [static] MqFactoryC MqFactoryC.HandleResolve(netHdl:MK_HDL) C-API
Handle-Resolve-Slot - return a MqFactoryC from netHdl or None if invalid…
 
static OT_ProcRet py_mqmsgque_MqFactoryC_Next (MqFactoryC_ARGS)
  Python: MqFactoryC fct.Next() C-API
get next instance from linked-list of MqFactoryS type
 
static OT_ProcRet py_mqmsgque_MqFactoryC_Prev (MqFactoryC_ARGS)
  Python: MqFactoryC fct.Prev() C-API
get previous instance from linked-list of MqFactoryS type
 
static OT_ProcRet py_mqmsgque_MqFactoryC_Instances (OtClass_ARGS)
  Python: [static] MqFactoryC MqFactoryC.Instances() C-API
get head-instance from linked-list of MqFactoryS type …
 
static OT_ProcRet py_mqmsgque_MqFactoryC_GetNull (OtClass_ARGS)
  Python: [static] MqFactoryC MqFactoryC.GetNull() C-API
Null-Slot - return a MqFactoryC typed NULL instance …
 
static OT_ProcRet py_mqmsgque_MqFactoryC_Get (OtClass_ARGS)
  Python: [static] MqFactoryC MqFactoryC.Get(?ident:string=""?) C-API
return the MqFactoryC
 
static OT_ProcRet py_mqmsgque_MqFactoryC_GetCalled (OtClass_ARGS)
  Python: [static] MqFactoryC MqFactoryC.GetCalled(?ident:string=""?) C-API
returns the MqFactoryC identified by ident
 
static OT_ProcRet py_mqmsgque_MqFactoryC_GetCalledL (OtClass_ARGS)
  Python: [static] MqFactoryC MqFactoryC.GetCalledL(largs:MkBufferListC) C-API
returns the MqFactoryC identified as first argument in the largs MkBufferListC
 
static OT_ProcRet py_mqmsgque_MqFactoryC_GetOriginalIdent (MqFactoryC_ARGS)
  Python: string fct.GetOriginalIdent() C-API
helper function to return MqFactoryS::originalIdent
 
static OT_ProcRet py_mqmsgque_MqFactoryC_Default (MqFactoryC_ARGS)
  Python: MqFactoryC fct.Default() C-API
set the default-attribute to the factory
 
static OT_ProcRet py_mqmsgque_MqFactoryC_Initial (MqFactoryC_ARGS)
  Python: MqFactoryC fct.Initial() C-API
set the initial-attribut to fct
 
static OT_ProcRet py_mqmsgque_MqFactoryC_New (MqFactoryC_ARGS)
  Python: MqContextC fct.New() C-API
create a new MqContextC from a MqFactoryC
 
static OT_ProcRet py_mqmsgque_MqFactoryC_DefaultIdent (OtClass_ARGS)
  Python: [static] string MqFactoryC.DefaultIdent() C-API
return the factory-identifier of the default MqFactoryC
 
static OT_ProcRet py_mqmsgque_MqFactoryC_InitialIdent (OtClass_ARGS)
  Python: [static] string MqFactoryC.InitialIdent() C-API
return the factory-identifier of the initial MqFactoryC
 
static OT_ProcRet py_mqmsgque_MqFactoryC_LogAll (OtClass_ARGS)
  Python: [static] MqFactoryC.LogAll(?callfunc:string="MK_NULL"?) C-API
log all "factories" to stderr
 
static OT_ProcRet py_mqmsgque_MqFactoryC_Dup2 (MqFactoryC_ARGS)
  Python: [constructor] MqFactoryC fct.Dup2(ident:string) C-API
create a duplicate of the singleton object MqFactoryC using a new factory-identifer
 
static OT_ProcRet py_mqmsgque_MqFactoryC_Add (OtClass_ARGS)
  Python: [constructor,static] MqFactoryC MqFactoryC.Add(constructor:class, ?ident:string="MK_NULL"?) C-API
add a new MqFactoryC identified by factory-identifier and defined by factory-constructor
 
static OT_ProcRet py_mqmsgque_MqFactoryC_new (CONSTR_ARGS)
  Python: [constructor,static] MqFactoryC MqFactoryC.new(constructor:class, ?ident:string="MK_NULL"?) C-API
add a new MqFactoryC identified by factory-identifier and defined by factory-constructor
 
static PyObject * py_mqmsgque_sMqFactoryC_Str (MqFactoryC_Obj *self)
 
int py_mqmsgque_pMqFactoryC_Setup (MQ_RT_ARGS OT_LNG_T m)
 
int py_mqmsgque_pMqFactoryC_Init (MQ_RT_ARGS OT_LNG_T m)
 

Variables

static PyMethodDef py_mqmsgque_MqFactoryC_Methods []
 
OT_CLASS_TYPE_REF py_mqmsgque_MqFactoryCR
 

Detailed Description

MqFactoryC_py.c - 28 Oct 2024 - aotto1968.

Version
4e6c32f3af53681cacea88a16b83548bfa0ad66f
Date
Mon Oct 28 23:08:55 2024 +0100
Author
aotto1968 aotto.nosp@m.1968.nosp@m.@t-on.nosp@m.line.nosp@m..de

Definition in file MqFactoryC_py.c.

Macro Definition Documentation

◆ Add_doc

#define Add_doc   "MqFactoryC MqFactoryC.Add(constructor:class, ?ident:string=\"MK_NULL\"?)"

doc definition

Definition at line 129 of file MqFactoryC_py.c.

◆ ClassInit

#define ClassInit
Value:
/* if not already done, initialize NEW MQ type */ \
\
/* protect against double call */ \
if (MqFactoryCTT->selfCreate == NS(MqFactoryC_selfCreate)) return MK_OK; \
\
/* add "selfCreate" and "selfDelete" feature to the MQ-Class */ \
MqFactoryCTT->selfCreate = NS(MqFactoryC_selfCreate); \
MqFactoryCTT->selfDelete = NS(MqFactoryC_selfDelete); \
MqFactoryCTT->selfUnlink = NS(MqFactoryC_selfUnlink); \
\
if (!PyType_HasFeature(OT_CLASS,Py_TPFLAGS_READY)) { \
NS(MqFactoryCR).tp_base = OT_MqFactoryC_base; \
LngErrorCheck (PyType_Ready(OT_CLASS)); \
} \
LngErrorCheck(PyModule_AddObjectRef(m, "MqFactoryC", (PyObject *)OT_CLASS)); \
\
/* define the "NULL" object */ \
MqFactoryC_MK_NULL = Py_NewRef(MK(AtomCreate) (MK_RT_CALL OT_CLASS, NULL /*obj*/, false));
#define OT_CLASS
#define MqFactoryCTT
MK_OK
#define MK_RT_CALL
#define MqFactorySTT
instance-type as MkTypeS-class-type (cast from MqFactoryST into MkTypeS) …
data used to define a factory

Definition at line 68 of file MqFactoryC_py.c.

68#define ClassInit \
69 /* if not already done, initialize NEW MQ type */ \
70 if (MqFactoryCTT == NULL) MqFactoryCTT = MqFactorySTT; \
71 \
72 /* protect against double call */ \
73 if (MqFactoryCTT->selfCreate == NS(MqFactoryC_selfCreate)) return MK_OK; \
74 \
75 /* add "selfCreate" and "selfDelete" feature to the MQ-Class */ \
76 MqFactoryCTT->selfCreate = NS(MqFactoryC_selfCreate); \
77 MqFactoryCTT->selfDelete = NS(MqFactoryC_selfDelete); \
78 MqFactoryCTT->selfUnlink = NS(MqFactoryC_selfUnlink); \
79 \
80 if (!PyType_HasFeature(OT_CLASS,Py_TPFLAGS_READY)) { \
81 NS(MqFactoryCR).tp_base = OT_MqFactoryC_base; \
82 LngErrorCheck (PyType_Ready(OT_CLASS)); \
83 } \
84 LngErrorCheck(PyModule_AddObjectRef(m, "MqFactoryC", (PyObject *)OT_CLASS)); \
85 \
86 /* define the "NULL" object */ \
87 MqFactoryC_MK_NULL = Py_NewRef(MK(AtomCreate) (MK_RT_CALL OT_CLASS, NULL /*obj*/, false));

◆ Default_doc

#define Default_doc   "MqFactoryC fct.Default()"

Definition at line 149 of file MqFactoryC_py.c.

◆ DefaultIdent_doc

#define DefaultIdent_doc   "string MqFactoryC.DefaultIdent()"

Definition at line 141 of file MqFactoryC_py.c.

◆ Dup2_doc

#define Dup2_doc   "MqFactoryC fct.Dup2(ident:string) (const)"

Definition at line 146 of file MqFactoryC_py.c.

◆ Get_doc

#define Get_doc   "MqFactoryC MqFactoryC.Get(?ident:string=\"\"?)"

Definition at line 133 of file MqFactoryC_py.c.

◆ GetCalled_doc

#define GetCalled_doc   "MqFactoryC MqFactoryC.GetCalled(?ident:string=\"\"?)"

Definition at line 134 of file MqFactoryC_py.c.

◆ GetCalledL_doc

#define GetCalledL_doc   "MqFactoryC MqFactoryC.GetCalledL(largs:MkBufferListC)"

Definition at line 135 of file MqFactoryC_py.c.

◆ GetNull_doc

#define GetNull_doc   "MqFactoryC MqFactoryC.GetNull()"

Definition at line 136 of file MqFactoryC_py.c.

◆ GetOriginalIdent_doc

#define GetOriginalIdent_doc   "string fct.GetOriginalIdent() (const)"

Definition at line 158 of file MqFactoryC_py.c.

◆ HandleGet_doc

#define HandleGet_doc   "MK_HDL fct.HandleGet()"

Definition at line 159 of file MqFactoryC_py.c.

◆ HandleResolve_doc

#define HandleResolve_doc   "MqFactoryC MqFactoryC.HandleResolve(netHdl:MK_HDL)"

Definition at line 137 of file MqFactoryC_py.c.

◆ Initial_doc

#define Initial_doc   "MqFactoryC fct.Initial()"

Definition at line 150 of file MqFactoryC_py.c.

◆ InitialIdent_doc

#define InitialIdent_doc   "string MqFactoryC.InitialIdent()"

Definition at line 142 of file MqFactoryC_py.c.

◆ Instances_doc

#define Instances_doc   "MqFactoryC MqFactoryC.Instances()"

Definition at line 138 of file MqFactoryC_py.c.

◆ Log_doc

#define Log_doc   "fct.Log(?fmtobj:MkObjectC=None?, ?debug:int32=0?, ?callfunc:string=\"MK_NULL\"?, ?lvl:int32=0?) (const)"

Definition at line 160 of file MqFactoryC_py.c.

◆ LogAll_doc

#define LogAll_doc   "MqFactoryC.LogAll(?callfunc:string=\"MK_NULL\"?)"

Definition at line 143 of file MqFactoryC_py.c.

◆ META_FILE_NAME

#define META_FILE_NAME   "MqFactoryC_py.c"

Definition at line 14 of file MqFactoryC_py.c.

◆ MqFactoryCTT

#define MqFactoryCTT   MQ(MqMsgqueThreadState).MqFactoryCTT

Definition at line 43 of file MqFactoryC_py.c.

◆ New_doc

#define New_doc   "MqContextC fct.New()"

Definition at line 155 of file MqFactoryC_py.c.

◆ new_doc

#define new_doc   "MqFactoryC MqFactoryC.new(constructor:class, ?ident:string=\"MK_NULL\"?)"

Definition at line 130 of file MqFactoryC_py.c.

◆ Next_doc

#define Next_doc   "MqFactoryC fct.Next()"

Definition at line 151 of file MqFactoryC_py.c.

◆ OT_CLASS

#define OT_CLASS   (&NS(MqFactoryCR))

Definition at line 19 of file MqFactoryC_py.c.

◆ OT_CLASS_NAME

#define OT_CLASS_NAME   "MqFactoryC"

Definition at line 20 of file MqFactoryC_py.c.

◆ OT_LNG2META

#define OT_LNG2META ( O)
Value:
MqFct(VAL2MNG(O))
MQ_FCT MqFct(MK_MNG mng)
cast a unknown-object into an MqFactoryS pointer or NULL if not possible

Definition at line 22 of file MqFactoryC_py.c.

◆ OT_retObj_CONSTR

#define OT_retObj_CONSTR ( mng)
Value:
OT_retObj_SET(NS(MqFactoryC_CTOR)(MK_RT_CALL (PyTypeObject*)class,mng))

Definition at line 24 of file MqFactoryC_py.c.

◆ OT_retObj_RETURN

#define OT_retObj_RETURN
Value:
if (is_constr_hard) { \
/* BUG-FIX */ \
/* the factory is always global and has NO link to an external variable… */ \
/* need "Py_INCREF" to keep the factory alive */ \
/* test: Nhi1Exec server.py */ \
Py_INCREF (retObj); \
} \
return ((PyObject*)retObj);

Definition at line 110 of file MqFactoryC_py.c.

110#define OT_retObj_RETURN \
111if (is_constr_hard) { \
112 /* BUG-FIX */ \
113 /* the factory is always global and has NO link to an external variable… */ \
114 /* need "Py_INCREF" to keep the factory alive */ \
115 /* test: Nhi1Exec server.py */ \
116 Py_INCREF (retObj); \
117} \
118 return ((PyObject*)retObj);

◆ OT_SETUP_hdl [1/2]

#define OT_SETUP_hdl   OT_SETUP_hdl_tmpl(MqFactoryC)

Definition at line 26 of file MqFactoryC_py.c.

◆ OT_SETUP_hdl [2/2]

#define OT_SETUP_hdl
Value:
OT_SETUP_hdl_tmpl(MqFactoryC) \
bool is_constr_hard = false;

Definition at line 26 of file MqFactoryC_py.c.

◆ OT_SETUP_hdl__null_allow

#define OT_SETUP_hdl__null_allow   OT_SETUP_hdl_tmpl__null_allow(MqFactoryC)

Definition at line 27 of file MqFactoryC_py.c.

◆ OT_SETUP_hdl_constr [1/2]

#define OT_SETUP_hdl_constr
Value:
MQ_FCT hdl = (MQ_FCT) &MkERROR;
#define AllRtSetup_NULL
#define MkERROR
#define MK_RT_UNUSED
struct MqFactoryS * MQ_FCT
class-shortcut for struct MqFactoryS *, all shortcut using the XX_YYY syntax (only for public API) …

Definition at line 28 of file MqFactoryC_py.c.

28#define OT_SETUP_hdl_constr MK_RT_UNUSED AllRtSetup_NULL; \
29 MQ_FCT hdl = (MQ_FCT) &MkERROR;

◆ OT_SETUP_hdl_constr [2/2]

#define OT_SETUP_hdl_constr
Value:
__attribute__((unused)) MK_TYP hdl = MqFactoryC##_TT; \
bool is_constr_hard = true;

Definition at line 28 of file MqFactoryC_py.c.

28#define OT_SETUP_hdl_constr MK_RT_UNUSED AllRtSetup_NULL; \
29 MQ_FCT hdl = (MQ_FCT) &MkERROR;

◆ OT_SETUP_hdl_destr

#define OT_SETUP_hdl_destr   OT_SETUP_hdl_tmpl__null_allow(MqFactoryC)

Definition at line 30 of file MqFactoryC_py.c.

◆ OT_SETUP_hdl_static [1/2]

#define OT_SETUP_hdl_static
Value:
__attribute__((unused)) MK_TYP hdl = MqFactoryC##_TT;

Definition at line 31 of file MqFactoryC_py.c.

31#define OT_SETUP_hdl_static MK_RT_UNUSED AllRtSetup_NULL; \
32 __attribute__((unused)) MK_TYP hdl = MqFactoryC##_TT;

◆ OT_SETUP_hdl_static [2/2]

#define OT_SETUP_hdl_static
Value:
__attribute__((unused)) MK_TYP hdl = MqFactoryC##_TT; \
bool is_constr_hard = false;

Definition at line 31 of file MqFactoryC_py.c.

31#define OT_SETUP_hdl_static MK_RT_UNUSED AllRtSetup_NULL; \
32 __attribute__((unused)) MK_TYP hdl = MqFactoryC##_TT;

◆ OT_SETUP_hdl_static_constr [1/2]

#define OT_SETUP_hdl_static_constr   OT_SETUP_hdl_static

Definition at line 34 of file MqFactoryC_py.c.

◆ OT_SETUP_hdl_static_constr [2/2]

#define OT_SETUP_hdl_static_constr
Value:
__attribute__((unused)) MK_TYP hdl = MqFactoryC##_TT; \
bool is_constr_hard = true;

Definition at line 34 of file MqFactoryC_py.c.

◆ Prev_doc

#define Prev_doc   "MqFactoryC fct.Prev()"

Definition at line 152 of file MqFactoryC_py.c.

◆ SetupRtFromObj_X

#define SetupRtFromObj_X ( hdl)
Value:
#define AllRtSetup_X(x)

Definition at line 37 of file MqFactoryC_py.c.

◆ SetupRtFromObj_XN [1/2]

#define SetupRtFromObj_XN ( hdl)
Value:
#define AllRtSetup_XN(x)

Definition at line 38 of file MqFactoryC_py.c.

◆ SetupRtFromObj_XN [2/2]

#define SetupRtFromObj_XN ( hdl)
Value:

Definition at line 38 of file MqFactoryC_py.c.

Function Documentation

◆ py_mqmsgque_MqFactoryC_CTOR()

OT_LNG_T py_mqmsgque_MqFactoryC_CTOR ( MK_RT mkrt,
OT_LNG_CLASS_T type,
MQ_FCT hdl )
inline

Definition at line 47 of file MqFactoryC_py.c.

47 {
48 return MK(AtomCreate)(MK_RT_CALL type,MqFactoryC_X2obj(hdl),true);
49}
#define MqFactoryC_X2obj(x)

◆ py_mqmsgque_MqFactoryC_selfCreate()

static MK_PTR py_mqmsgque_MqFactoryC_selfCreate ( MK_RT mkrt,
MK_OBJ const obj,
MK_PTR const env )
static

Definition at line 54 of file MqFactoryC_py.c.

54 {
55 return MK(AtomCreate) (MK_RT_CALL OT_CLASS,obj,true);
56}

◆ py_mqmsgque_MqFactoryC_selfDelete()

static void py_mqmsgque_MqFactoryC_selfDelete ( MK_RT mkrt,
MK_PTR self,
MK_PTR const env )
static

Definition at line 58 of file MqFactoryC_py.c.

58 {
59 OT_OBJECT_DELETE_HARD(OT_SELF);
60}

◆ py_mqmsgque_MqFactoryC_selfUnlink()

static void py_mqmsgque_MqFactoryC_selfUnlink ( MK_RT mkrt,
MK_PTR self,
MK_PTR const env )
static

Definition at line 62 of file MqFactoryC_py.c.

62 {
63 MkObjectC_Obj *selfO = (MkObjectC_Obj*) self;
64 selfO->hdl = NULL;
65}

◆ py_mqmsgque_pMqFactoryC_Init()

int py_mqmsgque_pMqFactoryC_Init ( MQ_RT_ARGS OT_LNG_T m)

Definition at line 828 of file MqFactoryC_py.c.

829{
831 MqFactoryCTT->noSelf = true;
832
833 return 0;
834error:
835 return -1;
836}
#define ClassInit
#define error

◆ py_mqmsgque_pMqFactoryC_Setup()

int py_mqmsgque_pMqFactoryC_Setup ( MQ_RT_ARGS OT_LNG_T m)

Public API

Definition at line 789 of file MqFactoryC_py.c.

790{
791 if (!strcmp(MqFactoryDefaultIdent(), "libmqmsgque")) {
792 if ( MqFactoryDefault(
795 NS(sFactoryCTor), (MK_PTR)&NS(MqContextCR), NULL, NULL,
796 NS(sFactoryDTor), NULL, NULL, NULL,
797 "pymqmsgque"
798 )
799 )
800 ) == NULL
801 )
802 {
803 PyErr_SetString(PyExc_RuntimeError, "MqFactoryS exception");
804 goto error;
805 }
806 }
807
808 return 0;
809error:
810 return -1;
811}
#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)
set the default-attribute to the factory …
MQ_EXTERN MQ_FCT MqFactoryInitial(MQ_FCT const fct)
set the initial-attribut to fct …
#define MqFactoryAdd(...)
PUBLIC data structure for the pymqmsgque-specific-data

◆ py_mqmsgque_sFactoryCTor()

static enum MkErrorE py_mqmsgque_sFactoryCTor ( MQ_CALLBACK_FACTORY_CTOR_ARGS )
static

Helper definition

Definition at line 171 of file MqFactoryC_py.c.

172{
173 MQ_CTX mqctx = NULL;
174 enum MkErrorE ret = MK_OK;
175 PyObject* argsO=NULL, *resultO=NULL;
176 PyObject* typeO = fct->fct_ctor.data;
177 PyObject* tmplO = (tmpl ? MkOBJ_R(tmpl).self : NULL);
178
179//printXV(tmpl, "PYTH: Factory[%s] -> %s\n", MqFactoryGetOriginalIdent(fct), MqLogFactoryE(create))
180 if (create == MQ_FACTORY_NEW_THREAD) {
181#if 0
182 ret = MkErrorSetC_1E("internal error: MQ_FACTORY_NEW_THREAD not supported");
183 goto error;
184#else
185
186 static PyInterpreterConfig config = {
187 .use_main_obmalloc = 0,
188 .allow_fork = 0,
189 .allow_exec = 0,
190 .allow_threads = 1,
191 .allow_daemon_threads = 0,
192 .check_multi_interp_extensions = 1,
193 .gil = PyInterpreterConfig_OWN_GIL,
194 };
195
196 PyThreadState *tstate = NULL;
197 PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);
198 MK_RT_REF.threadData = tstate;
199
200mk_debug_color(MK_COLOR_YELLOW,"MQ_FACTORY_NEW_THREAD -> thread<%p>", tstate);
201
202 if (PyStatus_Exception(status)) {
203 return MkErrorSetC_3_NULL(status.err_msg, status.func, 300+status.exitcode);
204 }
205
206 Py_XINCREF(typeO);
207 Py_XINCREF(tmplO);
208
209 // mark new interpreter as "MQ_STARTUP_IS_THREAD"
210 PyObject *mainM = PyImport_AddModule("__main__");
211 PyObject *strO = PyUnicode_FromString("MQ_STARTUP_IS_THREAD");
212 PyObject_SetAttrString(mainM,"__name__", strO);
213 Py_CLEAR(strO);
214
215 // source initial script
217 FILE *FH = fopen(fn, "r");
218 PyObject * mD = PyModule_GetDict(mainM);
219 PyObject *retO = PyRun_FileEx(FH,fn,Py_file_input,mD,mD,true);
220 if (retO == NULL) {
221 ret = MkErrorSetC_1E("MQ_FACTORY_NEW_THREAD failed");
222 //PyGILState_Release(gilstate);
223 goto error3;
224 }
225 Py_CLEAR(retO);
226
227 // type is from the "wrong" interpreter → try to figure out the right one
228 PyObject* QualNameO = PyType_GetQualName((PyTypeObject*)typeO);
229 if (QualNameO == NULL) goto error2;
230
231 Py_CLEAR(typeO);
232 typeO = PyObject_GetAttr(mainM,QualNameO);
233 Py_CLEAR(QualNameO);
234
235 if (typeO == NULL) goto error2;
236
237 // need a NEW template class because the OLD class has a TYPE in the WRONG interpreter.
238 Py_CLEAR(tmplO);
239 tmplO = MK(AtomCreate)(MK_RT_CALL (PyTypeObject*)typeO,MkOBJ(tmpl),false);
240
241 goto cont;
242
243 error2:
244 ret = MkErrorSetC_1E("internal error: unable to resolve type");
245 error3:
246 goto error;
247 cont:
248#endif
249 } else {
250
251 Py_XINCREF(typeO);
252 Py_XINCREF(tmplO);
253 }
254
255 // get typeO from "parent"
257 Py_CLEAR(typeO);
258 typeO = Py_NewRef(Py_TYPE(tmplO));
259 }
260
261 // setup argsO
262 if (create & MQ_FACTORY_NEW_INIT) {
263 argsO = PyTuple_New(0);
264 } else {
265 argsO = PyTuple_New(1);
266 PyTuple_SET_ITEM(argsO, 0, tmplO);
267 Py_INCREF(tmplO);
268 }
269
270 if (typeO == NULL) {
271 PyErr_SetString(PyExc_RuntimeError,"internal error: factory object constructor is 'NULL'");
272 goto error;
273 } else {
274 // call constructor
275 resultO = PyObject_Call(typeO, argsO, NULL);
276 check_NULL(resultO) goto error;
277 }
278
279 // right typeO?
280 if (!PyObject_IsInstance(resultO, (PyObject*) &NS(MqContextCR))) goto error;
281 mqctx = VAL2CTX(resultO);
282
283 // check for MQ error
284 MkErrorCheck(MkErrorGetCode_0E());
285
286 // copy and initialize "setup" data
287 if (create & (MQ_FACTORY_NEW_CHILD)) {
288 // !Attention!. the ctxId would be set later… in MqLinkCreate…
289 MqSetupDup(mqctx, tmpl);
290 }
291
292 // a MQ_FACTORY_NEW_FILTER has "MkOBJ_R(mqctx).self" as ONLY reference… incr "refCnt"
293 // related to "NS(sFactoryDTor)→MQ_FACTORY_NEW_INIT→Py_XINCREF"
294 if (create & MQ_FACTORY_NEW_FILTER) {
295 Py_XINCREF(resultO);
296 }
297
298 *contextP = mqctx;
299
300end:
301//printTxt("OK")
302 // not used anymore because "Py_INCREF(self)" in "MqContextC_New" was deleted
303 //Py_CLEAR(resultO);
304 Py_CLEAR(argsO);
305 Py_CLEAR(tmplO);
306 Py_CLEAR(typeO);
307//printXLngObj(mqctx,resultO)
308
309 return ret;
310
311error:
312//printTxt("ERROR")
313 Py_CLEAR(resultO);
314 *contextP = NULL;
315 OT_ERROR_LNG_2_MQ(MK_ERROR_DEFAULT);
316 ret = MkErrorStack_0E();
317 goto end;
318}
#define mqctx
#define MkErrorGetCode_0E()
#define MkErrorStack_0E()
#define MkErrorSetC_3_NULL(...)
#define MkErrorSetC_1E(message)
#define MK_ERROR_DEFAULT
MkErrorE
const MK_STRB * MK_STRN
#define MkOBJ(x)
#define MkOBJ_R(x)
#define MK_RT_REF
#define MqSetupDup(...)
@ MQ_FACTORY_NEW_FILTER
create object as a filter
@ MQ_FACTORY_NEW_THREAD
create object as a thread
@ MQ_FACTORY_NEW_INIT
initial object, nothing else is known
@ MQ_FACTORY_NEW_SLAVE
create object as a slave of an other object
@ MQ_FACTORY_NEW_CHILD
create object as a child of an other object
MQ_EXTERN MK_BFL MqInitGetArg0(void)
get the process startup-prefix argument
MK_BUF * data
union MkBufferU first
struct MkBufferS::@5 storage
MK_STRN C

◆ py_mqmsgque_sFactoryDataCopy()

static void py_mqmsgque_sFactoryDataCopy ( MK_RT mkrt,
MK_PTR * dataP )
static

Definition at line 348 of file MqFactoryC_py.c.

351 {
352 PyObject *arg = *dataP;
353 Py_INCREF(arg);
354}

◆ py_mqmsgque_sFactoryDataFree()

static void py_mqmsgque_sFactoryDataFree ( MK_RT mkrt,
MK_PTR * dataP )
static

Definition at line 339 of file MqFactoryC_py.c.

342 {
343 if (_Py_IsFinalizing()) return;
344 Py_CLEAR(*dataP);
345}

◆ py_mqmsgque_sFactoryDTor()

static void py_mqmsgque_sFactoryDTor ( MK_RT mkrt,
MQ_CTX context,
bool doFactoryDelete,
MQ_FCT const data )
static

Definition at line 321 of file MqFactoryC_py.c.

326 {
327
328 // related to "NS(sFactoryCTor)→MQ_FACTORY_NEW_INIT→Py_XINCREF"
329 if (doFactoryDelete && context->setup.factoryCall == MQ_FACTORY_NEW_FILTER) {
330 OT_LNG_T selfO = OT_SELF_X(context);
331 Py_CLEAR (selfO);
332 }
333
334 // do a 'hard'-delete if 'Py_CLEAR' does NOT call the destructor
335 MqContextDelete (context);
336}
#define MqContextDelete(x)
struct MqSetupS setup
the setup data is used to link the object with the user application
enum MqFactoryE factoryCall
an object is created by an factory but using a different call-style

◆ py_mqmsgque_sMqFactoryC_Str()

static PyObject * py_mqmsgque_sMqFactoryC_Str ( MqFactoryC_Obj * self)
static

Definition at line 776 of file MqFactoryC_py.c.

776 {
777 MkRtSetup_X(self->hdl);
778 return STRN2VAL(MkSysPrintF("MqFactoryC[%s]", self->hdl ? self->hdl->originalIdent : NULL));
779}
#define MkSysPrintF(...)
#define MkRtSetup_X(x)

Variable Documentation

◆ py_mqmsgque_MqFactoryC_Methods

PyMethodDef py_mqmsgque_MqFactoryC_Methods[]
static

Object definition

Definition at line 731 of file MqFactoryC_py.c.

731 {
732 // BEGIN-CLASS - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
733
734 // doc-key: MqFactoryC,MqFactory,sCc
735 { "Add" , (PyCFunction) NS(MqFactoryC_Add) , METH_VARARGS|METH_CLASS , Add_doc },
736
737 // doc-key: MqFactoryC,MqFactory,sc_
738 { "Get" , (PyCFunction) NS(MqFactoryC_Get) , METH_VARARGS|METH_CLASS , Get_doc },
739 { "GetCalled" , (PyCFunction) NS(MqFactoryC_GetCalled) , METH_VARARGS|METH_CLASS , GetCalled_doc },
740 { "GetCalledL" , (PyCFunction) NS(MqFactoryC_GetCalledL) , METH_O|METH_CLASS , GetCalledL_doc },
741 { "GetNull" , (PyCFunction) NS(MqFactoryC_GetNull) , METH_NOARGS|METH_CLASS , GetNull_doc },
742 { "HandleResolve" , (PyCFunction) NS(MqFactoryC_HandleResolve) , METH_O|METH_CLASS , HandleResolve_doc },
743 { "Instances" , (PyCFunction) NS(MqFactoryC_Instances) , METH_NOARGS|METH_CLASS , Instances_doc },
744
745 // doc-key: MqFactoryC,MqFactory,sm_
746 { "DefaultIdent" , (PyCFunction) NS(MqFactoryC_DefaultIdent) , METH_NOARGS|METH_CLASS , DefaultIdent_doc },
747 { "InitialIdent" , (PyCFunction) NS(MqFactoryC_InitialIdent) , METH_NOARGS|METH_CLASS , InitialIdent_doc },
748 { "LogAll" , (PyCFunction) NS(MqFactoryC_LogAll) , METH_VARARGS|METH_CLASS , LogAll_doc },
749
750 // END-CLASS - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
751
752 // BEGIN-OBJ - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
753
754 // doc-key: MqFactoryC,MqFactory,oCx
755 { "Dup2" , (PyCFunction) NS(MqFactoryC_Dup2) , METH_O , Dup2_doc },
756
757 // doc-key: MqFactoryC,MqFactory,oc_
758 { "Default" , (PyCFunction) NS(MqFactoryC_Default) , METH_NOARGS , Default_doc },
759 { "Initial" , (PyCFunction) NS(MqFactoryC_Initial) , METH_NOARGS , Initial_doc },
760 { "Next" , (PyCFunction) NS(MqFactoryC_Next) , METH_NOARGS , Next_doc },
761 { "Prev" , (PyCFunction) NS(MqFactoryC_Prev) , METH_NOARGS , Prev_doc },
762
763 // doc-key: MqFactoryC,MqFactory,oco
764 { "New" , (PyCFunction) NS(MqFactoryC_New) , METH_NOARGS , New_doc },
765
766 // doc-key: MqFactoryC,MqFactory,om_
767 { "GetOriginalIdent" , (PyCFunction) NS(MqFactoryC_GetOriginalIdent) , METH_NOARGS , GetOriginalIdent_doc },
768 // skip class-overload: MqFactoryHandleGet → HandleGet, NS(MqFactoryC_HandleGet)
769 // skip class-overload: MqFactoryLog → Log, NS(MqFactoryC_Log)
770
771 // END-OBJ - created by 'py_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
772
773 {NULL, NULL, 0, NULL} /* Sentinel */
774};
#define Instances_doc
#define Initial_doc
#define GetOriginalIdent_doc
#define New_doc
#define Get_doc
#define LogAll_doc
#define GetNull_doc
#define Next_doc
#define HandleResolve_doc
#define GetCalledL_doc
#define DefaultIdent_doc
#define Prev_doc
#define InitialIdent_doc
#define GetCalled_doc
#define Dup2_doc
#define Add_doc
#define Default_doc

◆ py_mqmsgque_MqFactoryCR

OT_CLASS_TYPE_REF py_mqmsgque_MqFactoryCR
Initial value:
= {
PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "pymqmsgque.MqFactoryC",
.tp_doc = "PyMqMsgque MqFactoryC Type",
.tp_itemsize = sizeof(MqFactoryC_Obj),
.tp_itemsize = 0,
.tp_new = (newfunc) py_mqmsgque_MqFactoryC_new ,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_base = NULL,
.tp_str = (reprfunc) py_mqmsgque_sMqFactoryC_Str
}
static PyMethodDef py_mqmsgque_MqFactoryC_Methods[]
static PyObject * py_mqmsgque_sMqFactoryC_Str(MqFactoryC_Obj *self)
static OT_ProcRet py_mqmsgque_MqFactoryC_new(CONSTR_ARGS)
Python: [constructor,static] MqFactoryC MqFactoryC.new(constructor:class, ?ident:string="MK_NULL"?...

Definition at line 814 of file MqFactoryC_py.c.

814 {
815 PyVarObject_HEAD_INIT(NULL, 0)
816 .tp_name = "pymqmsgque.MqFactoryC",
817 .tp_doc = "PyMqMsgque MqFactoryC Type",
818 .tp_itemsize = sizeof(MqFactoryC_Obj),
819 .tp_itemsize = 0,
820 .tp_new = (newfunc) NS(MqFactoryC_new),
821 .tp_methods = NS(MqFactoryC_Methods),
822 .tp_flags = Py_TPFLAGS_DEFAULT,
823 .tp_base = NULL,
824 .tp_str = (reprfunc) NS(sMqFactoryC_Str)
825};