theLink 10.0
Loading...
Searching...
No Matches
MqFactoryC_atl.c File Reference

tag: nhi1-release-250425 More...

+ Include dependency graph for MqFactoryC_atl.c:

Go to the source code of this file.

Macros

#define META_FILE_NAME   "MqFactoryC_atl.c"
 
#define OT_CLASS   amqrt->AtlMqFactoryC
 
#define OT_NULL   amqrt->AtlMqFactoryC_MK_NULL
 
#define OT_CLASS_NAME   "MqFactoryC"
 
#define SELF2HDL(O)
 
#define OT_SETUP_hdl   SetupHdlFromMetaData_2(MQ_FCT)
 
#define OT_SETUP_hdl__null_allow   SetupHdlFromMetaData__null_allow_2(MQ_FCT)
 
#define OT_SETUP_hdl_destr   SetupHdlFromMetaData__null_allow_2(MQ_FCT)
 
#define OT_SETUP_hdl_constr   SetupHdlConstr(MqFactoryC)
 
#define OT_SETUP_hdl_static_constr   OT_SETUP_hdl_static
 
#define OT_SETUP_hdl_static   SetupHdlStatic(MqFactoryC)
 
#define OT_retObj_CONSTR(x)
 
#define ClassInit
 
#define META_CONTEXT_S   mqctx
 
#define OT_SETUP_hdl_constr
 
#define OT_SETUP_hdl_static_constr
 
#define Add_doc   "MqFactoryC [MqFactoryC::Add constructor:class ?ident:string=\"MK_NULL\"?]"
 
#define CTOR_doc   "MqFactoryC [MqFactoryC::CTOR 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 [MqFactoryC::Dup2 $fct ident:string] (const)"
 
#define Default_doc   "MqFactoryC [MqFactoryC::Default $fct]"
 
#define Initial_doc   "MqFactoryC [MqFactoryC::Initial $fct]"
 
#define Next_doc   "MqFactoryC [MqFactoryC::Next $fct]"
 
#define Prev_doc   "MqFactoryC [MqFactoryC::Prev $fct]"
 
#define New_doc   "MqContextC [MqFactoryC::New $fct]"
 
#define GetOriginalIdent_doc   "string [MqFactoryC::GetOriginalIdent $fct] (const)"
 

Functions

static MK_PTR atlmqmsgque_MqFactoryC_selfCreate (MK_RT mkrt, MK_OBJ const obj, MK_PTR const env)
 
static void atlmqmsgque_MqFactoryC_selfDelete (MK_RT mkrt, MK_PTR selfP, MK_PTR const env)
 
static void atlmqmsgque_MqFactoryC_selfUnlink (MK_RT mkrt, MK_PTR selfP, MK_PTR const env)
 
static void atlmqmsgque_sFactoryDataFree (MK_RT mkrt, MK_PTR *dataP)
 
static void atlmqmsgque_sFactoryDataCopy (MK_RT mkrt, MK_PTR *dataP)
 
static enum MkErrorE atlmqmsgque_sFactoryCTor (MQ_CALLBACK_FACTORY_CTOR_ARGS)
 
static OT_ProcRet atlmqmsgque_MqFactoryC_HandleResolve (OtClass_ARGS)
  Atl: (static) MqFactoryC [MqFactoryC::HandleResolve netHdl:MK_HDL] C-API
Handle-Resolve-Slot - return a MqFactoryC from netHdl or "MK_NULL" if invalid…
 
MK_DEPRECATED static MK_UNUSED OT_ProcRet atlmqmsgque_MqFactoryC_HandleGet (MqFactoryC_ARGS)
 
static OT_ProcRet atlmqmsgque_MqFactoryC_Next (MqFactoryC_ARGS)
  Atl: MqFactoryC [MqFactoryC::Next $fct] C-API
get next instance from linked-list of MqFactoryS type
 
static OT_ProcRet atlmqmsgque_MqFactoryC_Prev (MqFactoryC_ARGS)
  Atl: MqFactoryC [MqFactoryC::Prev $fct] C-API
get previous instance from linked-list of MqFactoryS type
 
static OT_ProcRet atlmqmsgque_MqFactoryC_Instances (OtClass_ARGS)
  Atl: (static) MqFactoryC [MqFactoryC::Instances] C-API
get head-instance from linked-list of MqFactoryS type …
 
static OT_ProcRet atlmqmsgque_MqFactoryC_GetNull (OtClass_ARGS)
  Atl: (static) MqFactoryC [MqFactoryC::GetNull] C-API
Null-Slot - return a MqFactoryC typed NULL instance …
 
static OT_ProcRet atlmqmsgque_MqFactoryC_Get (OtClass_ARGS)
  Atl: (static) MqFactoryC [MqFactoryC::Get ?ident:string=""?] C-API
return the MqFactoryC
 
static OT_ProcRet atlmqmsgque_MqFactoryC_GetCalled (OtClass_ARGS)
  Atl: (static) MqFactoryC [MqFactoryC::GetCalled ?ident:string=""?] C-API
returns the MqFactoryC identified by ident
 
static OT_ProcRet atlmqmsgque_MqFactoryC_GetCalledL (OtClass_ARGS)
  Atl: (static) MqFactoryC [MqFactoryC::GetCalledL largs:MkBufferListC] C-API
returns the MqFactoryC identified as first argument in the largs MkBufferListC
 
static OT_ProcRet atlmqmsgque_MqFactoryC_GetOriginalIdent (MqFactoryC_ARGS)
  Atl: string [MqFactoryC::GetOriginalIdent $fct] C-API
helper function to return MqFactoryS::originalIdent
 
static OT_ProcRet atlmqmsgque_MqFactoryC_Default (MqFactoryC_ARGS)
  Atl: MqFactoryC [MqFactoryC::Default $fct] C-API
set the default-attribute to the factory
 
static OT_ProcRet atlmqmsgque_MqFactoryC_Initial (MqFactoryC_ARGS)
  Atl: MqFactoryC [MqFactoryC::Initial $fct] C-API
set the initial-attribut to fct
 
static OT_ProcRet atlmqmsgque_MqFactoryC_New (MqFactoryC_ARGS)
  Atl: MqContextC [MqFactoryC::New $fct] C-API
create a new MqContextC from a MqFactoryC
 
MK_DEPRECATED static MK_UNUSED OT_ProcRet atlmqmsgque_MqFactoryC_Log (MqFactoryC_ARGS)
 
static OT_ProcRet atlmqmsgque_MqFactoryC_DefaultIdent (OtClass_ARGS)
  Atl: (static) string [MqFactoryC::DefaultIdent] C-API
return the factory-identifier of the default MqFactoryC
 
static OT_ProcRet atlmqmsgque_MqFactoryC_InitialIdent (OtClass_ARGS)
  Atl: (static) string [MqFactoryC::InitialIdent] C-API
return the factory-identifier of the initial MqFactoryC
 
static OT_ProcRet atlmqmsgque_MqFactoryC_LogAll (OtClass_ARGS)
  Atl: (static) MqFactoryC::LogAll ?callfunc:string="MK_NULL"? C-API
log all "factories" to stderr
 
static OT_ProcRet atlmqmsgque_MqFactoryC_Dup2 (MqFactoryC_ARGS)
  Atl: (constructor) MqFactoryC [MqFactoryC::Dup2 $fct ident:string] C-API
create a duplicate of the singleton object MqFactoryC using a new factory-identifer
 
static OT_ProcRet atlmqmsgque_MqFactoryC_Add (OtClass_ARGS)
  Atl: (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 atlmqmsgque_MqFactoryC_CTOR (CONSTR_ARGS)
  Atl: (constructor,static) MqFactoryC [MqFactoryC::CTOR constructor:class ?ident:string="MK_NULL"?] C-API
Add a new MqFactoryC identified by factory-identifier and defined by factory-constructor
 
int atlmqmsgque_MqFactoryC_Setup (MK_RT mkrt, Tcl_Interp *interp)
 
int atlmqmsgque_pMqFactoryC_Init (OT_MQ_ARGS OT_NS_T ns)
 

Variables

__thread bool atlmqmsgque_inMain
 
static char msg []
 
static const OtObjProcDefS atlmqmsgque_sOtClassDef []
 
static const OtObjProcDefS atlmqmsgque_sInstanceDef []
 

Detailed Description

tag: nhi1-release-250425

Definition in file MqFactoryC_atl.c.

Macro Definition Documentation

◆ Add_doc

#define Add_doc   "MqFactoryC [MqFactoryC::Add constructor:class ?ident:string=\"MK_NULL\"?]"

doc definition

Definition at line 154 of file MqFactoryC_atl.c.

◆ ClassInit

#define ClassInit

Definition at line 59 of file MqFactoryC_atl.c.

59#define ClassInit \
60 /* if not already done, initialize NEW META type */ \
61 if (MqFactoryCTT == NULL) MqFactoryCTT = MqFactorySTT; \
62 \
63 /* protect against double call */ \
64 if (MqFactoryCTT->selfCreate == NS(MqFactoryC_selfCreate)) return MK_OK; \
65 \
66 /* add "selfCreate" and "selfDelete" feature to the META-Class */ \
67 MqFactoryCTT->selfCreate = NS(MqFactoryC_selfCreate); \
68 MqFactoryCTT->selfDelete = NS(MqFactoryC_selfDelete); \
69 MqFactoryCTT->selfUnlink = NS(MqFactoryC_selfUnlink); \
70 \
71 /* create the ATL-class */ \
72 OT_CLASS = AltClassDef(MqFactoryCTT,&amqrt->AtlMqFactoryC_NS); \
73 if (OT_CLASS == NULL) goto error; \
74 OT_REF_INCR(OT_CLASS); \
75 \
76 /* create the ATL static Methods */ \
77 check_LNG(AtlUnknownSetup (NS(sOtClassDef),amqrt)) goto error; \
78 \
79 /* create the ATL instance Methods */ \
80 check_LNG(AtlUnknownSetup (NS(sInstanceDef),amqrt)) goto error; \
81 \
82 /* after class was modified, recompile the class */ \
83 RL_init(2, recompile, RL_T(0,RecompileN)); RL_O(1,OT_CLASS) ; \
84 int retI = RL_EvalEx(0); \
85 if (retI != TCL_OK) return retI; \
86 \
87 /* define the "NULL" object */ \
88 OT_NULL = AtomCreateNULL(OT_CLASS, "::MqFactoryC::MK_NULL", (MK_PTR)amqrt); \
89 if (OT_NULL == NULL) goto error; \
90 OT_REF_INCR(OT_NULL);

◆ CTOR_doc

#define CTOR_doc   "MqFactoryC [MqFactoryC::CTOR constructor:class ?ident:string=\"MK_NULL\"?]"

Definition at line 155 of file MqFactoryC_atl.c.

◆ Default_doc

#define Default_doc   "MqFactoryC [MqFactoryC::Default $fct]"

Definition at line 174 of file MqFactoryC_atl.c.

◆ DefaultIdent_doc

#define DefaultIdent_doc   "string [MqFactoryC::DefaultIdent]"

Definition at line 166 of file MqFactoryC_atl.c.

◆ Dup2_doc

#define Dup2_doc   "MqFactoryC [MqFactoryC::Dup2 $fct ident:string] (const)"

Definition at line 171 of file MqFactoryC_atl.c.

◆ Get_doc

#define Get_doc   "MqFactoryC [MqFactoryC::Get ?ident:string=\"\"?]"

Definition at line 158 of file MqFactoryC_atl.c.

◆ GetCalled_doc

#define GetCalled_doc   "MqFactoryC [MqFactoryC::GetCalled ?ident:string=\"\"?]"

Definition at line 159 of file MqFactoryC_atl.c.

◆ GetCalledL_doc

#define GetCalledL_doc   "MqFactoryC [MqFactoryC::GetCalledL largs:MkBufferListC]"

Definition at line 160 of file MqFactoryC_atl.c.

◆ GetNull_doc

#define GetNull_doc   "MqFactoryC [MqFactoryC::GetNull]"

Definition at line 161 of file MqFactoryC_atl.c.

◆ GetOriginalIdent_doc

#define GetOriginalIdent_doc   "string [MqFactoryC::GetOriginalIdent $fct] (const)"

Definition at line 183 of file MqFactoryC_atl.c.

◆ HandleResolve_doc

#define HandleResolve_doc   "MqFactoryC [MqFactoryC::HandleResolve netHdl:MK_HDL]"

Definition at line 162 of file MqFactoryC_atl.c.

◆ Initial_doc

#define Initial_doc   "MqFactoryC [MqFactoryC::Initial $fct]"

Definition at line 175 of file MqFactoryC_atl.c.

◆ InitialIdent_doc

#define InitialIdent_doc   "string [MqFactoryC::InitialIdent]"

Definition at line 167 of file MqFactoryC_atl.c.

◆ Instances_doc

#define Instances_doc   "MqFactoryC [MqFactoryC::Instances]"

Definition at line 163 of file MqFactoryC_atl.c.

◆ LogAll_doc

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

Definition at line 168 of file MqFactoryC_atl.c.

◆ META_CONTEXT_S

#define META_CONTEXT_S   mqctx

Definition at line 94 of file MqFactoryC_atl.c.

◆ META_FILE_NAME

#define META_FILE_NAME   "MqFactoryC_atl.c"

Definition at line 13 of file MqFactoryC_atl.c.

◆ New_doc

#define New_doc   "MqContextC [MqFactoryC::New $fct]"

Definition at line 180 of file MqFactoryC_atl.c.

◆ Next_doc

#define Next_doc   "MqFactoryC [MqFactoryC::Next $fct]"

Definition at line 176 of file MqFactoryC_atl.c.

◆ OT_CLASS

#define OT_CLASS   amqrt->AtlMqFactoryC

Definition at line 17 of file MqFactoryC_atl.c.

◆ OT_CLASS_NAME

#define OT_CLASS_NAME   "MqFactoryC"

Definition at line 19 of file MqFactoryC_atl.c.

◆ OT_NULL

#define OT_NULL   amqrt->AtlMqFactoryC_MK_NULL

Definition at line 18 of file MqFactoryC_atl.c.

◆ OT_retObj_CONSTR

#define OT_retObj_CONSTR ( x)
Value:
#define OT_SELF
#define AtomInit(...)
#define OT_retObj_SET(val)
#define MqFactoryC_X2obj(x)

Definition at line 56 of file MqFactoryC_atl.c.

◆ OT_SETUP_hdl

#define OT_SETUP_hdl   SetupHdlFromMetaData_2(MQ_FCT)

Definition at line 49 of file MqFactoryC_atl.c.

◆ OT_SETUP_hdl__null_allow

#define OT_SETUP_hdl__null_allow   SetupHdlFromMetaData__null_allow_2(MQ_FCT)

Definition at line 50 of file MqFactoryC_atl.c.

◆ OT_SETUP_hdl_constr [1/2]

#define OT_SETUP_hdl_constr   SetupHdlConstr(MqFactoryC)

Definition at line 52 of file MqFactoryC_atl.c.

◆ OT_SETUP_hdl_constr [2/2]

#define OT_SETUP_hdl_constr
Value:
if (NS(inMain) == false) { \
Tcl_SetResult(interp,msg,TCL_STATIC); \
return TCL_ERROR; \
} \
SetupHdlConstr(MqFactoryC)
#define NS(n)
static char msg[]

Definition at line 52 of file MqFactoryC_atl.c.

◆ OT_SETUP_hdl_destr

#define OT_SETUP_hdl_destr   SetupHdlFromMetaData__null_allow_2(MQ_FCT)

Definition at line 51 of file MqFactoryC_atl.c.

◆ OT_SETUP_hdl_static

#define OT_SETUP_hdl_static   SetupHdlStatic(MqFactoryC)

Definition at line 54 of file MqFactoryC_atl.c.

◆ OT_SETUP_hdl_static_constr [1/2]

#define OT_SETUP_hdl_static_constr   OT_SETUP_hdl_static

Definition at line 53 of file MqFactoryC_atl.c.

◆ OT_SETUP_hdl_static_constr [2/2]

#define OT_SETUP_hdl_static_constr
Value:
if (NS(inMain) == false) { \
Tcl_SetResult(interp,msg,TCL_STATIC); \
return TCL_ERROR; \
} \
SetupHdlStatic(MqFactoryC)

Definition at line 53 of file MqFactoryC_atl.c.

◆ Prev_doc

#define Prev_doc   "MqFactoryC [MqFactoryC::Prev $fct]"

Definition at line 177 of file MqFactoryC_atl.c.

◆ SELF2HDL

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

Definition at line 21 of file MqFactoryC_atl.c.

Function Documentation

◆ atlmqmsgque_MqFactoryC_selfCreate()

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

Definition at line 30 of file MqFactoryC_atl.c.

30 {
31 SETUP_amqrt(env);
32 return AtomMake(obj,OT_CLASS,NULL,NULL,env);
33}
#define AtomMake(...)
#define SETUP_amqrt(r)
#define OT_CLASS
MK_OBJ const obj
Definition high_lng.h:136

◆ atlmqmsgque_MqFactoryC_selfDelete()

static void atlmqmsgque_MqFactoryC_selfDelete ( MK_RT mkrt,
MK_PTR selfP,
MK_PTR const env )
static

Definition at line 36 of file MqFactoryC_atl.c.

36 {
37 OT_SELF_T selfO = selfP;
38 SETUP_amqrt(env);
39 MK(AtomDeleteHard) (OT_MK_CALL selfO);
40}
#define MK(n)
MOX_OBJ_T OT_SELF_T
#define OT_MK_CALL

◆ atlmqmsgque_MqFactoryC_selfUnlink()

static void atlmqmsgque_MqFactoryC_selfUnlink ( MK_RT mkrt,
MK_PTR selfP,
MK_PTR const env )
static

Definition at line 43 of file MqFactoryC_atl.c.

43 {
44 OT_SELF_T selfO = selfP;
45 SETUP_amqrt(env);
46 return MK(AtomUnlink) (OT_MK_CALL selfO);
47}

◆ atlmqmsgque_MqFactoryC_Setup()

int atlmqmsgque_MqFactoryC_Setup ( MK_RT mkrt,
Tcl_Interp * interp )

Public API

Definition at line 803 of file MqFactoryC_atl.c.

804{
805 if (!strcmp(MqFactoryDefaultIdent(), "libmqmsgque")) {
806 if ( MqFactoryDefault(
809 NS(sFactoryCTor), NULL, NULL, NULL, NULL, NULL, NULL, NULL, "atlmqmsgque"
810 )
811 )
812 ) == NULL
813 )
814 {
815 Tcl_SetResult(interp,"MqFactoryS exception",TCL_STATIC);
816 return TCL_ERROR;
817 }
818 }
819 return TCL_OK;
820}
#define MK_ERROR_FORMAT
#define MqFactoryInitial(...)
#define MqFactoryDefaultIdent()
#define MqFactoryDefault(...)
#define MqFactoryAdd(...)

◆ atlmqmsgque_pMqFactoryC_Init()

int atlmqmsgque_pMqFactoryC_Init ( OT_MQ_ARGS OT_NS_T ns)

Definition at line 822 of file MqFactoryC_atl.c.

823{
826
827 return TCL_OK;
828error:
829 return TCL_ERROR;
830}
#define ClassInit
#define error
Definition high_lng.h:339
#define MQ_STATIC_RT

◆ atlmqmsgque_sFactoryCTor()

static enum MkErrorE atlmqmsgque_sFactoryCTor ( MQ_CALLBACK_FACTORY_CTOR_ARGS )
static

Helper definition

Definition at line 202 of file MqFactoryC_atl.c.

203{
204//printTxt("11111111111111111111111111111111111111111111111111111111111111111111111111111111111")
205//colorYELLOW("mkrt<%p>, mqrt<%p>, amkrc<%p>, amqrc<%p>", mkrt, mqrt, &amkrtR, &amqrt);
206
207//printSTACK_0()
208//MkObjLog(fct);
209
210 MQ_CTX mqctx = NULL;
211 OT_SELF_T retO = NULL;
212 OT_CLS_T clsO = NULL, clsTO = NULL;
213 OT_OBJ_T tmplO = tmpl ? META2VAL_X(tmpl) : NULL;
214 OT_MQ_RT_T amqrt = &amqrtR;
215 OT_MK_RT_T amkrt = &amkrtR;
216 OT_ENV_T interp = NULL;
217
218//#define CALLGRIND_DEBUG
219
220 if (create == MQ_FACTORY_NEW_THREAD) {
221//printTxt("222222222222222222222222222222222222222222222222222222")
222#ifdef CALLGRIND_DEBUG
223printTxt("start CALLGRIND_ZERO_STATS")
224printSTACK_0()
225CALLGRIND_ZERO_STATS;
226#endif
227 interp = Tcl_CreateInterp();
228 // tmpl→MK_ERROR_DEFAULT 25.11.2019 aotto
229 check_LNG(Tcl_Init(interp)) {
230 return MkErrorSetV_1E ("[ThreadCreateError] Tcl_Init : %s", Tcl_GetStringResult(interp));
231 }
232 // mark new interpreter as "MQ_STARTUP_IS_THREAD"
233 Tcl_SetVar (interp, "MQ_STARTUP_IS_THREAD", "yes", TCL_GLOBAL_ONLY);
234 // source initial script
235 check_LNG(Tcl_EvalFile(interp, MqInitGetArg0()->data[1]->storage.first.C)) {
236 return MkErrorSetV_1E ("[ThreadCreateError] Tcl_EvalFile : %s", Tcl_GetStringResult(interp));
237 }
238 // set script
239 check_NULL(AtlInfoScript(MqInitGetArg0()->data[1]->storage.first.C)) {
240 return MkErrorSetV_1E ("[ThreadCreateError] AtlInfoScript : %s", Tcl_GetStringResult(interp));
241 }
242#ifdef CALLGRIND_DEBUG
243CALLGRIND_DUMP_STATS_AT("tcl_thread_startup");
244printTxt("end CALLGRIND_ZERO_STATS")
245#endif
246 }
247 if (interp == NULL) interp = amqrt->interp;
248 MOX_RT_T moxrt = amkrt->moxrt;
249
250//colorBLUE("mkrt<%p>, mqrt<%p>, amkrt<%p>, amqrt<%p>", mkrt, mqrt, amkrt, amqrt);
251//colorWHITE("interp<%p>, amqrt->interp<%p>, amkrt->interp<%p>", interp, amqrt->interp, amkrt->interp);
252
253 Tcl_ResetResult(interp);
254
255 // reflection -> "child" use the same "Tcl_Class" as tmpl=parent
257 clsTO = MoxMy__CLASS__N(tmplO);
258 if (clsTO == NULL) {
259 MkErrorSetV_1E("FactoryError: the template '%s' is no instance", VAL2STR(tmplO));
260 goto error;
261 }
262 } else {
263 clsTO = fct->fct_ctor.data ? fct->fct_ctor.data : MqContextC_lngO;
264 }
265
266 // security check of the Tcl_Class pointer
267 if (clsTO == NULL) {
268 MkErrorSetC_1E("FactoryError: unable to find Constructor");
269 goto error;
270 }
271
272 // on a NEW interpreter the class also have to be resolved new
273 if (create & (MQ_FACTORY_NEW_THREAD)) {
274 // always assume that 'clsTO' is from OTHER thread
275 // attention: this code create an ATL-CLASS-OBJECT with AtlClassDefGetNN
276 // SIDE EFFECT: register a "AtlClassDefT" into the namespace
277 OT_NS_T clsNs = Tcl_FindNamespace(interp,VAL2STR(clsTO),NULL,TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
278 if (clsNs == NULL) goto error;
279 clsO = AtlGetClassFrmNsPtr(clsNs,TCL_LEAVE_ERR_MSG);
280 if (clsO == NULL) goto error;
281 } else {
282 clsO = clsTO;
283 }
284
285 // Call Factory -> Contructor
286 int lobjc=0;
287 OT_OBJ_T lobjv[1];
288
289 // 2. add "self"
290 // MQ_FACTORY_NEW_THREAD get a NEW "interp" and "tmpl->obj.self" is only defined
291 // on the original interp -> no "tmpl" possible -> missing "MqConfigDup"
293 ;
294 } else {
295 lobjv[lobjc++] = tmplO;
296 }
297
298 // 3. evaluate the script
299 check_LNG(MoxCreate3N(clsO, NULL, NULL, lobjc, lobjv)) {
301 goto error;
302 }
303 retO = Tcl_GetObjResult(interp);
304 OT_REF_INCR(retO);
305
306 // 4. get context
307 mqctx = MqCtx(VAL2MNG(retO));
308 if (mqctx == NULL) {
309 MkErrorSetV_1E("Factory return '%s', this is not a MqContextC type", VAL2STR(retO));
310 goto error;
311 }
312
313//printLV("222 → <%p>\n", mqctx->setup.Event.data)
314
315 // 5. check for MQ error
316 MkErrorCheck_0E();
317
318 // 6. do the missing "MqConfigDup" from "2"
319 // BUGFIX: without MQ_FACTORY_NEW_CHILD the OT_CONSTRUCTOR_POST prefix will NOT cleanup
321 MqConfigDup(mqctx, tmpl);
322 }
323
324 // 7. copy and initialize "setup" data
325 // "MQ_FACTORY_NEW_THREAD|MQ_FACTORY_NEW_FORK" is only used to support NON factory startup
327//MkObjLog(tmpl);
328 MqSetupDup(mqctx, tmpl);
329 }
330
331 // tcl-special: default event handler has !no! data and calling just the
332 // tcl-event-update function. CHILD does not need to call it too
333 if (create & MQ_FACTORY_NEW_CHILD && mqctx->setup.Event.data == NULL) {
334 mqctx->setup.Event.fCall = NULL;
335 }
336
337//printLV("333 → <%p>\n", mqctx->setup.Event.data)
338//printXV(mqctx,"333 → MqLinkGetTargetIdent = %s\n", MqLinkGetTargetIdent(mqctx))
339 *contextP = mqctx;
340 Ot_DecrRefCount(retO);
341 return MK_OK;
342
343error:
344 *contextP = NULL;
345 if (retO) {
346 MoxDestroyN(retO);
347 OT_REF_DECR(retO);
348 }
349 return MkErrorStack_0E();
350}
__thread OT_MK_RT_S amkrtR
#define check_NULL(code)
#define AtlInfoScript(s)
MOX_ENV_T OT_ENV_T
MOX_NS_T OT_NS_T
static void Ot_DecrRefCount(OT_OBJ_T tclO)
MOX_CLS_T OT_CLS_T
#define META2VAL_X(x)
#define VAL2STR(val)
#define check_LNG(code)
#define OT_ERROR_LNG_2_META(m)
#define OT_REF_DECR(_obj)
#define OT_REF_INCR(_obj)
#define AtlGetClassFrmNsPtr(nsP, flg)
MOX_OBJ_T OT_OBJ_T
__thread OT_MQ_RT_S amqrtR
#define MqContextC_lngO
#define mqctx
Definition MqCall_atl.c:13
#define MkErrorStack_0E()
#define MkErrorSetC_1E(message)
#define MkErrorSetV_1E(printfmt,...)
MK_OK
static MQ_CTX MqCtx(MK_MNG mng)
cast a unknown-object into an MqContextS pointer or NULL if not possible
#define MqSetupDup(...)
#define MqConfigDup(...)
@ MQ_FACTORY_NEW_FILTER
create object as a filter
@ MQ_FACTORY_NEW_FORK
create object as a fork process
@ 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
MK_BFL MqInitGetArg0(void)
get the process startup-prefix argument
PUBLIC data structure for the atlmqmsgque-specific-data
OT_ENV_T interp

◆ atlmqmsgque_sFactoryDataCopy()

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

Definition at line 140 of file MqFactoryC_atl.c.

141{
142 *dataP = OT_OBJ_COPY(*dataP);
143}
#define OT_OBJ_COPY(o)

◆ atlmqmsgque_sFactoryDataFree()

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

Definition at line 131 of file MqFactoryC_atl.c.

132{
133 return;
134 SETUP_amkrt(NULL);
135printP(interp)
136 if (interp == NULL || Tcl_InterpDeleted(interp)) return;
137 OT_REF_DECR_AND_NULL(*dataP); // OT_REF_INCR in: CheckConstructor
138}
#define SETUP_amkrt(r)
#define OT_REF_DECR_AND_NULL(_obj)

Variable Documentation

◆ atlmqmsgque_inMain

__thread bool atlmqmsgque_inMain
extern

private

Definition at line 147 of file LibMqMsgque_atl.c.

◆ atlmqmsgque_sInstanceDef

const OtObjProcDefS atlmqmsgque_sInstanceDef[]
static
Initial value:
= {
{ "::MqFactoryC::MqFactoryC" , atlmqmsgque_MqFactoryC_CTOR },
{ "::MqFactoryC::Dup2" , atlmqmsgque_MqFactoryC_Dup2 },
{ "::MqFactoryC::Default" , atlmqmsgque_MqFactoryC_Default },
{ "::MqFactoryC::Initial" , atlmqmsgque_MqFactoryC_Initial },
{ "::MqFactoryC::Next" , atlmqmsgque_MqFactoryC_Next },
{ "::MqFactoryC::Prev" , atlmqmsgque_MqFactoryC_Prev },
{ "::MqFactoryC::New" , atlmqmsgque_MqFactoryC_New },
{ "::MqFactoryC::GetOriginalIdent" , atlmqmsgque_MqFactoryC_GetOriginalIdent },
{ NULL }
}
static OT_ProcRet atlmqmsgque_MqFactoryC_Prev(MqFactoryC_ARGS)
Atl: MqFactoryC [MqFactoryC::Prev $fct] → C-API get previous instance from linked-list of MqFac...
static OT_ProcRet atlmqmsgque_MqFactoryC_Next(MqFactoryC_ARGS)
Atl: MqFactoryC [MqFactoryC::Next $fct] → C-API get next instance from linked-list of MqFactory...
static OT_ProcRet atlmqmsgque_MqFactoryC_GetOriginalIdent(MqFactoryC_ARGS)
Atl: string [MqFactoryC::GetOriginalIdent $fct] → C-API helper function to return MqFactoryS::o...
static OT_ProcRet atlmqmsgque_MqFactoryC_Default(MqFactoryC_ARGS)
Atl: MqFactoryC [MqFactoryC::Default $fct] → C-API set the default-attribute to the factory …
static OT_ProcRet atlmqmsgque_MqFactoryC_Initial(MqFactoryC_ARGS)
Atl: MqFactoryC [MqFactoryC::Initial $fct] → C-API set the initial-attribut to fct …
static OT_ProcRet atlmqmsgque_MqFactoryC_New(MqFactoryC_ARGS)
Atl: MqContextC [MqFactoryC::New $fct] → C-API create a new MqContextC from a MqFactoryC …
static OT_ProcRet atlmqmsgque_MqFactoryC_Dup2(MqFactoryC_ARGS)
Atl: (constructor) MqFactoryC [MqFactoryC::Dup2 $fct ident:string] → C-API create a duplicate of...
static OT_ProcRet atlmqmsgque_MqFactoryC_CTOR(CONSTR_ARGS)
Atl: (constructor,static) MqFactoryC [MqFactoryC::CTOR constructor:class ?ident:string="MK_NULL"?...

Definition at line 769 of file MqFactoryC_atl.c.

769 {
770 // BEGIN-OBJ - created by 'atl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
771
772 // doc-key: MqFactoryC,MqFactory,oC_
773 { "::MqFactoryC::MqFactoryC" , NS(MqFactoryC_CTOR) },
774
775 // doc-key: MqFactoryC,MqFactory,oCx
776 { "::MqFactoryC::Dup2" , NS(MqFactoryC_Dup2) },
777
778 // doc-key: MqFactoryC,MqFactory,oc_
779 { "::MqFactoryC::Default" , NS(MqFactoryC_Default) },
780 { "::MqFactoryC::Initial" , NS(MqFactoryC_Initial) },
781 { "::MqFactoryC::Next" , NS(MqFactoryC_Next) },
782 { "::MqFactoryC::Prev" , NS(MqFactoryC_Prev) },
783
784 // doc-key: MqFactoryC,MqFactory,oco
785 { "::MqFactoryC::New" , NS(MqFactoryC_New) },
786
787 // doc-key: MqFactoryC,MqFactory,om_
788 { "::MqFactoryC::GetOriginalIdent" , NS(MqFactoryC_GetOriginalIdent) },
789 // skip class-overload: HandleGet → MkObjectHandleGet
790 // skip class-overload: Log → MkObjectLog
791
792 // END-OBJ - created by 'atl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
793 { NULL }
794};

◆ atlmqmsgque_sOtClassDef

const OtObjProcDefS atlmqmsgque_sOtClassDef[]
static
Initial value:
= {
{ "::MqFactoryC::Add" , atlmqmsgque_MqFactoryC_Add },
{ "::MqFactoryC::Get" , atlmqmsgque_MqFactoryC_Get },
{ "::MqFactoryC::GetCalled" , atlmqmsgque_MqFactoryC_GetCalled },
{ "::MqFactoryC::GetCalledL" , atlmqmsgque_MqFactoryC_GetCalledL },
{ "::MqFactoryC::GetNull" , atlmqmsgque_MqFactoryC_GetNull },
{ "::MqFactoryC::HandleResolve" , atlmqmsgque_MqFactoryC_HandleResolve },
{ "::MqFactoryC::Instances" , atlmqmsgque_MqFactoryC_Instances },
{ "::MqFactoryC::DefaultIdent" , atlmqmsgque_MqFactoryC_DefaultIdent },
{ "::MqFactoryC::InitialIdent" , atlmqmsgque_MqFactoryC_InitialIdent },
{ "::MqFactoryC::LogAll" , atlmqmsgque_MqFactoryC_LogAll },
{ NULL }
}
static OT_ProcRet atlmqmsgque_MqFactoryC_GetNull(OtClass_ARGS)
Atl: (static) MqFactoryC [MqFactoryC::GetNull] → C-API Null-Slot - return a MqFactoryC typed NUL...
static OT_ProcRet atlmqmsgque_MqFactoryC_Instances(OtClass_ARGS)
Atl: (static) MqFactoryC [MqFactoryC::Instances] → C-API get head-instance from linked-list of M...
static OT_ProcRet atlmqmsgque_MqFactoryC_HandleResolve(OtClass_ARGS)
Atl: (static) MqFactoryC [MqFactoryC::HandleResolve netHdl:MK_HDL] → C-API Handle-Resolve-Slot -...
static OT_ProcRet atlmqmsgque_MqFactoryC_GetCalledL(OtClass_ARGS)
Atl: (static) MqFactoryC [MqFactoryC::GetCalledL largs:MkBufferListC] → C-API returns the MqFact...
static OT_ProcRet atlmqmsgque_MqFactoryC_Get(OtClass_ARGS)
Atl: (static) MqFactoryC [MqFactoryC::Get ?ident:string=""?] → C-API return the MqFactoryC
static OT_ProcRet atlmqmsgque_MqFactoryC_GetCalled(OtClass_ARGS)
Atl: (static) MqFactoryC [MqFactoryC::GetCalled ?ident:string=""?] → C-API returns the MqFactory...
static OT_ProcRet atlmqmsgque_MqFactoryC_DefaultIdent(OtClass_ARGS)
Atl: (static) string [MqFactoryC::DefaultIdent] → C-API return the factory-identifier of the def...
static OT_ProcRet atlmqmsgque_MqFactoryC_InitialIdent(OtClass_ARGS)
Atl: (static) string [MqFactoryC::InitialIdent] → C-API return the factory-identifier of the ini...
static OT_ProcRet atlmqmsgque_MqFactoryC_LogAll(OtClass_ARGS)
Atl: (static) MqFactoryC::LogAll ?callfunc:string="MK_NULL"? → C-API log all "factories" to stde...
static OT_ProcRet atlmqmsgque_MqFactoryC_Add(OtClass_ARGS)
Atl: (constructor,static) MqFactoryC [MqFactoryC::Add constructor:class ?ident:string="MK_NULL"?...

Definition at line 744 of file MqFactoryC_atl.c.

744 {
745 // BEGIN-CLASS - created by 'atl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
746
747 // doc-key: MqFactoryC,MqFactory,sCc
748 { "::MqFactoryC::Add" , NS(MqFactoryC_Add) },
749
750 // doc-key: MqFactoryC,MqFactory,sc_
751 { "::MqFactoryC::Get" , NS(MqFactoryC_Get) },
752 { "::MqFactoryC::GetCalled" , NS(MqFactoryC_GetCalled) },
753 { "::MqFactoryC::GetCalledL" , NS(MqFactoryC_GetCalledL) },
754 { "::MqFactoryC::GetNull" , NS(MqFactoryC_GetNull) },
755 { "::MqFactoryC::HandleResolve" , NS(MqFactoryC_HandleResolve) },
756 { "::MqFactoryC::Instances" , NS(MqFactoryC_Instances) },
757
758 // doc-key: MqFactoryC,MqFactory,sm_
759 { "::MqFactoryC::DefaultIdent" , NS(MqFactoryC_DefaultIdent) },
760 { "::MqFactoryC::InitialIdent" , NS(MqFactoryC_InitialIdent) },
761 { "::MqFactoryC::LogAll" , NS(MqFactoryC_LogAll) },
762
763 // END-CLASS - created by 'atl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
764 { NULL }
765};

◆ msg

char msg[]
static
Initial value:
= "ERROR: a 'MqFactoryC' command was called OUTSIDE"
" of the 'atlmqmsgque::Main'-proc.\n"
"\n"
"Description: a 'atlmqmsgque SERVER' listen on a port and start for every incoming connetion\n"
"a sub-server. If a thread sub-server was choosen... with the '--thread' commandline-option...\n"
"a new thread is created. To setup a new thread the INITIAL tcl-file is RE-READ again and\n"
"PROCS and VARIABLES are initialized. The NEW thread has it's own 'Main'-proc and so... the\n"
"original 'Main'-proc is skipped. If a 'factory' command is used OUTSIDE of the 'Main'-proc...\n"
"the initial 'Factory' will be created TWICE. The creation of multiple 'Factory' objects...\n"
"with the SAME name... is an ERROR."

Definition at line 104 of file MqFactoryC_atl.c.