theLink 10.0
Loading...
Searching...
No Matches
MqFactoryC_tcl.c
Go to the documentation of this file.
1
9/* LABEL-INIT */
10
11/* LABEL-START */
12
13#define META_FILE_NAME "MqFactoryC_tcl.c"
14
16
17#define OT_CLASS NS(MqFactoryC)
18#define OT_CLASS_NAME "MqFactoryC"
19
20#define OBJECT2FCT(O) MkAssertCastM(MqFactoryC,(Tcl_ObjectGetMetadata(O, &MK(AtomMeta))))
21
22// TCL class
24
25// META class
27MkThreadLocal OT_OBJ_T MQ(MqFactoryC_MK_NULL) = NULL;
28
29// META: ObjNew feature: selfCreate will be called from "ObjNew->MkSelfNew" if MkObj need a SELF pointer
30static MK_PTR NS(MqFactoryC_selfCreate) (MK_RT_ARGS MK_OBJ const obj, MK_PTR const env) {
31 OT_ENV_T interp = env;
32 return MK(AtomCreate) (MK_RT_CALL interp,obj,OT_CLASS,NULL,NULL);
33}
34// META: is called when the META object is destroyed and SELF does NOT belongs to the META.
35static void NS(MqFactoryC_selfDelete) (MK_RT_ARGS MK_PTR selfP, MK_PTR const env) {
36 OT_SELF_T selfO = selfP;
37 OT_ENV_T interp = env;
38 MK(AtomDeleteHard) (MK_RT_CALL interp, selfO);
39}
40// META: is called when the META object is destroyed and SELF does NOT belong to the META.
41static void NS(MqFactoryC_selfUnlink) (MK_RT_ARGS MK_PTR selfP, MK_PTR const env) {
42 OT_SELF_T selfO = selfP;
43 OT_ENV_T interp = env;
44 MK(AtomUnlink) (MK_RT_CALL interp, selfO);
45}
46
47// ATTENTION: TCL has no "Unlink" because the "Tcl_ObjectSetMetadata(selfO,&MK(AtomMeta),NULL);" call
48// also the destructor
49
50#define OT_SETUP_hdl_static_constr_pre
51#define OT_SETUP_hdl_static_constr \
52 OT_SETUP_hdl_static_constr_pre; \
53 OT_SETUP_hdl_static
54
55#define OT_SETUP_hdl_static \
56 int __skip=Tcl_ObjectContextSkippedArgs(objCtx); \
57 AllRtSetup_NULL; \
58 __attribute__((unused)) OT_SELF_T selfO = Tcl_ObjectContextObject(objCtx); \
59 __attribute__((unused)) MK_TYP hdl = MqFactoryC##_TT;
60
61#define OT_SETUP_hdl SetupHdlFromMetaData_2(FCT,MQ_FCT);
62#define OT_SETUP_hdl__null_allow SetupHdlFromMetaData__null_allow_2(FCT,MQ_FCT);
63#define OT_SETUP_hdl_destr SetupHdlFromMetaData__null_allow_2(FCT,MQ_FCT);
64
65#define OT_SETUP_hdl_constr_pre
66#define OT_SETUP_hdl_constr \
67 OT_SETUP_hdl_constr_pre; \
68 int __skip=Tcl_ObjectContextSkippedArgs(objCtx); \
69 AllRtSetup_NULL; \
70 MK_RT_UNUSED OT_SELF_T selfO = Tcl_ObjectContextObject(objCtx); \
71 MQ_FCT hdl = (MQ_FCT) &MkERROR;
72
73#if !defined(SetupRtFromHdl_XN)
74 #define SetupRtFromHdl_XN(hdl) AllRtSetup_XN(hdl)
75 #define SetupRtFromHdl_X(hdl) AllRtSetup_X(hdl)
76#endif
77
78// initialize the TCL and MO class specific object
79#define ClassInit \
80 /* if not already done, initialize NEW MQ type */ \
81 if (MqFactoryCTT == NULL) MqFactoryCTT = MqFactorySTT; \
82 \
83 /* protect against double call */ \
84 if (MqFactoryCTT->selfCreate == NS(MqFactoryC_selfCreate)) return MK_OK; \
85 \
86 /* add "selfCreate" and "selfDelete" feature to the MQ-Class */ \
87 MqFactoryCTT->selfCreate = NS(MqFactoryC_selfCreate); \
88 MqFactoryCTT->selfDelete = NS(MqFactoryC_selfDelete); \
89 MqFactoryCTT->selfUnlink = NS(MqFactoryC_selfUnlink); \
90 \
91 /* create the TCL-class */ \
92 OT_SELF_T classO = MK(ClassDef)(interp,ns,MqFactoryCTT); \
93 check_NULL(classO) goto error; \
94 OT_CLASS = Tcl_GetObjectAsClass(classO); \
95 \
96 /* create the TCL static Methods */ \
97 static MkThreadLocal OtUnknownS NS(sClassUnknown) = {OT_UNKNOWN_CLASS}; \
98 check_LNG(MK(UnknownSetup) (interp,classO,NS(sOtClassDef),&NS(sClassUnknown))) goto error; \
99 \
100 /* create the TCL instance Methods */ \
101 static MkThreadLocal OtUnknownS NS(sInstanceUnknown) = {OT_UNKNOWN_INSTANCE}; \
102 check_LNG(MK(UnknownSetup) (interp,classO,NS(sInstanceDef),&NS(sInstanceUnknown))) goto error; \
103 \
104 /* define the "NULL" object */ \
105 MQ(MqFactoryC_MK_NULL) = Tcl_GetObjectName(interp, \
106 MK(AtomCreate) (MK_RT_CALL interp, NULL /*obj*/, OT_CLASS, "MK_NULL" /*name*/, "::tclmqmsgque::MqFactoryC" /*ns*/) \
107 ); \
108 Tcl_IncrRefCount(MQ(MqFactoryC_MK_NULL));
109
110#define VER TCL_OO_METHOD_VERSION_CURRENT
111
112/* LABEL-END */
113
114#undef META_CONTEXT_S
115#define META_CONTEXT_S mqctx
116
122
123extern MkThreadLocal bool NS(inMain);
124
125static char msg[] = "ERROR: a 'MqFactoryC' command was called OUTSIDE" \
126" of the 'tclmqmsgque::Main'-proc.\n" \
127"\n" \
128"Description: a 'tclmqmsgque SERVER' listen on a port and start for every incoming connetion\n" \
129"a sub-server. If a thread sub-server was choosen... with the '--thread' commandline-option...\n" \
130"a new thread is created. To setup a new thread the INITIAL tcl-file is RE-READ again and\n" \
131"PROCS and VARIABLES are initialized. The NEW thread has it's own 'Main'-proc and so... the\n" \
132"original 'Main'-proc is skipped. If a 'factory' command is used OUTSIDE of the 'Main'-proc...\n" \
133"the initial 'Factory' will be created TWICE. The creation of multiple 'Factory' objects...\n" \
134"with the SAME name... is an ERROR."; \
135
136#undef OT_SETUP_hdl_constr_pre
137#define OT_SETUP_hdl_constr_pre \
138 if (NS(inMain) == false) { \
139 Tcl_SetResult(interp,msg,TCL_STATIC); \
140 return TCL_ERROR; \
141 }
142
143#undef OT_SETUP_hdl_static_constr_pre
144#define OT_SETUP_hdl_static_constr_pre OT_SETUP_hdl_constr_pre
145
146static void NS(sFactoryDataFree) ( MK_RT_ARGS MK_PTR *dataP)
147{
148 assert (dataP != NULL && *dataP != NULL);
150 if (Tcl_InterpDeleted(interp)) return;
151 OT_REF_DECR_AND_NULL(*dataP); // OT_REF_INCR in: CheckConstructor
152}
153
154static void NS(sFactoryDataCopy) ( MK_RT_ARGS MK_PTR *dataP)
155{
156 assert (dataP != NULL && *dataP != NULL);
157 *dataP = OT_OBJ_COPY(*dataP);
158}
159
165
166// BEGIN-DOC - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
167
168// doc-key: MqFactoryC,MqFactory,sCc,func
169#define Add_doc "MqFactoryC [MqFactoryC Add constructor:class ?ident:string=\"MK_NULL\"?]"
170#define CTOR_doc "MqFactoryC [MqFactoryC CTOR constructor:class ?ident:string=\"MK_NULL\"?]"
171
172// doc-key: MqFactoryC,MqFactory,sc_,func
173#define Get_doc "MqFactoryC [MqFactoryC Get ?ident:string=\"\"?]"
174#define GetCalled_doc "MqFactoryC [MqFactoryC GetCalled ?ident:string=\"\"?]"
175#define GetCalledL_doc "MqFactoryC [MqFactoryC GetCalledL largs:MkBufferListC]"
176#define GetNull_doc "MqFactoryC [MqFactoryC GetNull]"
177#define HandleResolve_doc "MqFactoryC [MqFactoryC HandleResolve netHdl:MK_HDL]"
178#define Instances_doc "MqFactoryC [MqFactoryC Instances]"
179
180// doc-key: MqFactoryC,MqFactory,sm_,func
181#define DefaultIdent_doc "string [MqFactoryC DefaultIdent]"
182#define InitialIdent_doc "string [MqFactoryC InitialIdent]"
183#define LogAll_doc "MqFactoryC LogAll ?callfunc:string=\"MK_NULL\"?"
184
185// doc-key: MqFactoryC,MqFactory,oCx,func
186#define Dup2_doc "MqFactoryC [$fct Dup2 ident:string] (const)"
187
188// doc-key: MqFactoryC,MqFactory,oc_,func
189#define Default_doc "MqFactoryC [$fct Default]"
190#define Initial_doc "MqFactoryC [$fct Initial]"
191#define Next_doc "MqFactoryC [$fct Next]"
192#define Prev_doc "MqFactoryC [$fct Prev]"
193
194// doc-key: MqFactoryC,MqFactory,oco,func
195#define New_doc "MqContextC [$fct New]"
196
197// doc-key: MqFactoryC,MqFactory,om_,func
198#define GetOriginalIdent_doc "string [$fct GetOriginalIdent] (const)"
199// skip class-overload: HandleGet → MkObjectHandleGet
200// skip class-overload: Log → MkObjectLog
201
202// END-DOC - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
203
209
210/*
211-> NOT required because Tcl_CreateThread does NOT more than the MQ SysServerThread..
212
213static Tcl_ThreadCreateType
214SysServerThreadMain( ClientData clientData)
215{
216 MqSysServerThreadMain((struct MqSysServerThreadMainS *)clientData);
217 TCL_THREAD_CREATE_RETURN;
218}
219
220static enum MkErrorE SysServerThread (
221 MK_RT_ARGS
222 MQ_CTX const context,
223 struct MqSysServerThreadMainS * const argP,
224 MK_STRN name,
225 int thread_status,
226 struct MkIdS * idP
227)
228{
229 Tcl_ThreadId tid;
230
231 // after a "thread" no "fork" is possible
232 MqContextC_T_X(context)->ignoreFork = true;
233
234 // start thread as "tcl" thread
235 if (Tcl_CreateThread(&tid,SysServerThreadMain, argP, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS) != TCL_OK)
236 {
237 return MkErrorSetV_2M(context, "can not start server '%s'", name);
238 }
239
240 // save tid
241 (*idP).val = (MK_IDNT)tid;
242 (*idP).type = MK_ID_THREAD;
243
244 return MK_OK;
245}
246*/
247
248#include "valgrind/callgrind.h"
249
250static enum MkErrorE NS(sFactoryCTor) ( MQ_CALLBACK_FACTORY_CTOR_ARGS )
251{
252 OT_ENV_T interp = (OT_ENV_T) MK_RT_REF.mkThreadData.ptr;
253
254//printSTACK0()
255//MkObjLog(fct);
256
257 MQ_CTX mqctx = NULL;
258 OT_SELF_T retObject = NULL;
259 OT_CLS_T createC = NULL;
260 OT_OBJ_T tmplObj = tmpl ? META2VAL_X(tmpl) : NULL;
261
262//#define CALLGRIND_DEBUG
263
264 if (create == MQ_FACTORY_NEW_THREAD) {
265#ifdef CALLGRIND_DEBUG
266printTxt("start CALLGRIND_ZERO_STATS")
267printSTACK_0()
268CALLGRIND_ZERO_STATS;
269#endif
270 interp = Tcl_CreateInterp();
271 // tmpl→MK_ERROR_DEFAULT 25.11.2019 aotto
272 check_LNG(Tcl_Init(interp)) {
274 return MK_ERROR;
275 }
276 // mark new interpreter as "MQ_STARTUP_IS_THREAD"
277 Tcl_SetVar (interp, "MQ_STARTUP_IS_THREAD", "yes", TCL_GLOBAL_ONLY);
278 // source initial script
279 check_LNG(Tcl_EvalFile(interp, MqInitGetArg0()->data[1]->storage.first.C)) {
281 return MK_ERROR;
282 }
283 // set script
284 check_NULL(MK(InfoScript)(MK_RT_CALL interp, MqInitGetArg0()->data[1]->storage.first.C)) {
286 return MK_ERROR;
287 }
288#ifdef CALLGRIND_DEBUG
289CALLGRIND_DUMP_STATS_AT("tcl_thread_startup");
290printTxt("end CALLGRIND_ZERO_STATS")
291#endif
292 }
293
294 // reflection -> "child" use the same "OT_CLS_T" as tmpl=parent
296 OT_SELF_T clsO = MK(GetClassObjectFromObj)(MK_RT_CALL interp, tmplObj);
297 if (clsO) createC = Tcl_GetObjectAsClass(clsO);
298 } else {
299
300 // BUG FIX (13.Nov.2020) using a OT_OBJ_T as fct_ctor.data create mustic bugs with single
301 // "createO" return from Tcl_GetObjectFromObj on DIFFERENT threads… This bug only happen
302 // if NO debugging tool is invilved
303
304 if (fct->fct_ctor.data) {
305 OT_OBJ_T createObj = fct->fct_ctor.data;
306 OT_SELF_T createO = Tcl_GetObjectFromObj(interp, createObj);
307
308 if (createO == NULL) {
309 MkErrorSetC_1E(Tcl_GetStringResult(interp));
310 goto error;
311 }
312 createC = Tcl_GetObjectAsClass(createO);
313 } else {
314 createC = NS(MqContextC);
315 }
316//printV("interp=%p, tmplObj=%p, createO=%p, createC=%p\n", interp, tmplObj, createO, createC)
317 }
318
319 // security check of the OT_CLS_T pointer
320 if (createC == NULL) {
321 MkErrorSetC_1E("internal error: Factory as 'NULL' OT_CLS_T");
322 goto error;
323 }
324
325 // Call Factory -> Contructor
326 OT_OBJ_T lobjv[1];
327
328 // 2. add "self"
329 // MQ_FACTORY_NEW_THREAD get a NEW "interp" and "tmpl->obj.self" is only defined
330 // on the original interp -> no "tmpl" possible -> missing "MqConfigDup"
332 lobjv[0] = RG(nullObj);
333 } else {
334 lobjv[0] = tmplObj;
335 }
336
337 // 3. evaluate the script
338 retObject = Tcl_NewObjectInstance(interp, createC, NULL, NULL, 1, lobjv, 0);
339 check_NULL(retObject) {
341 goto error;
342 }
343
344 // 4. get context
345 mqctx = MqCtx(Tcl_ObjectGetMetadata(retObject, &MK(AtomMeta)));
346 if (mqctx == NULL) {
347 MkErrorSetC_1E("Factory return no MqContextC type");
348 goto error;
349 }
350
351//printLV("222 → <%p>\n", mqctx->setup.Event.data)
352
353 // 5. check for MQ error
355
356 // 6. do the missing "MqConfigDup" from "2"
357 // BUGFIX: without MQ_FACTORY_NEW_CHILD the OT_CONSTRUCTOR_POST prefix will NOT cleanup
359 MqConfigDup(mqctx, tmpl);
360 }
361
362 // 7. copy and initialize "setup" data
363 // "MQ_FACTORY_NEW_THREAD|MQ_FACTORY_NEW_FORK" is only used to support NON factory startup
365//MkObjLog(tmpl);
366 MqSetupDup(mqctx, tmpl);
367 }
368
369 // tcl-special: default event handler has !no! data and calling just the
370 // tcl-event-update function. CHILD does not need to call it too
371 if (create & MQ_FACTORY_NEW_CHILD && mqctx->setup.Event.data == NULL) {
372 mqctx->setup.Event.fCall = NULL;
373 }
374
375//printLV("333 → <%p>\n", mqctx->setup.Event.data)
376//printXV(mqctx,"333 → MqLinkGetTargetIdent = %s\n", MqLinkGetTargetIdent(mqctx))
377 *contextP = mqctx;
378 return MK_OK;
379
380error:
381 *contextP = NULL;
382 if (retObject) {
383 Tcl_DeleteCommandFromToken(interp, Tcl_GetObjectCommand(retObject));
384 }
385 return MkErrorStack_0E();
386}
387
388/*
389static void NS(sFactoryDTor) (
390 MK_RT_ARGS
391 MQ_CTX hdl,
392 bool doFactoryCleanup,
393 MQ_FCT fct
394) {
395 if (doFactoryCleanup) {
396 SETUP_interp;
397//colorRED("hdl<%p>",hdl);
398 OT_SELF_T selfO = OT_SELF_X(hdl);
399 if (selfO && OT_OBJECT_DELETE_HARD(selfO)) return;
400 }
401 MqContextDelete(hdl);
402}
403*/
404
410
411// BEGIN-MqFactoryC - created by 'tcl_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
412
416
417// doc-key: MqFactoryC,MqFactoryC-Class-Export,sc_
418
420static OT_ProcRet NS(MqFactoryC_HandleResolve) (OtClass_ARGS) {
423 MK_HDL netHdl = 0;
426 MQ_FCT retVal = MqFactoryHandleResolve (netHdl);
427 OT_retObj_SET_FCT(retVal);
428 goto end;
429 error:
431 end:
433}
434
435// doc-key: MqFactoryC,MqFactoryC-Class-Export,om_
436
437// skip on class-overload: MqFactoryHandleGet → MkObjectHandleGet
439static OT_ProcRet NS(MqFactoryC_HandleGet) (MqFactoryC_ARGS) {OT_ERROR_LNG_RETURN;}
440
442// MqFactoryC_Class_TCL_API
443
447
448// doc-key: MqFactoryC,MqFactoryC-Class-Introspection,oc_
449
451static OT_ProcRet NS(MqFactoryC_Next) (MqFactoryC_ARGS) {
455 MQ_FCT retVal = MqFactoryNext (hdl);
456 OT_retObj_SET_FCT(retVal);
457 goto end;
458 error:
460 end:
462}
463
465static OT_ProcRet NS(MqFactoryC_Prev) (MqFactoryC_ARGS) {
469 MQ_FCT retVal = MqFactoryPrev (hdl);
470 OT_retObj_SET_FCT(retVal);
471 goto end;
472 error:
474 end:
476}
477
478// doc-key: MqFactoryC,MqFactoryC-Class-Introspection,sc_
479
481static OT_ProcRet NS(MqFactoryC_Instances) (OtClass_ARGS) {
485 MQ_FCT retVal = MqFactoryInstances ();
486 OT_retObj_SET_FCT(retVal);
487 goto end;
488 error:
490 end:
492}
493
495// MqFactoryC_Class_TCL_API
496
500
501// doc-key: MqFactoryC,MqFactoryC-Class-Misc,sc_
502
504static OT_ProcRet NS(MqFactoryC_GetNull) (OtClass_ARGS) {
508 MQ_FCT retVal = MqFactoryGetNull ();
509 OT_retObj_SET_FCT(retVal);
510 goto end;
511 error:
513 end:
515}
516
518// MqFactoryC_Class_TCL_API
519
523
524// doc-key: MqFactoryC,MqFactoryC-Get,sc_
525
527static OT_ProcRet NS(MqFactoryC_Get) (OtClass_ARGS) {
530 MK_STRN ident = "";
533 MQ_FCT retVal = MqFactoryGet (ident);
534 OT_retObj_SET_FCT(retVal);
535 goto end;
536 error:
538 end:
540}
541
543static OT_ProcRet NS(MqFactoryC_GetCalled) (OtClass_ARGS) {
546 MK_STRN ident = "";
549 MQ_FCT retVal = MqFactoryGetCalled (ident);
550 OT_retObj_SET_FCT(retVal);
551 goto end;
552 error:
554 end:
556}
557
559static OT_ProcRet NS(MqFactoryC_GetCalledL) (OtClass_ARGS) {
562 MkBufferListCreateTLS_T(largs,10);
565 MQ_FCT retVal = MqFactoryGetCalledL (largs);
566 OT_retObj_SET_FCT(retVal);
567 goto end;
568 error:
570 end:
572}
573
574// doc-key: MqFactoryC,MqFactoryC-Get,om_
575
577static OT_ProcRet NS(MqFactoryC_GetOriginalIdent) (MqFactoryC_ARGS) {
582 goto end;
583 error:
585 end:
587}
588
590// MqFactoryC_Get_TCL_API
591
595
596// doc-key: MqFactoryC,MqFactoryC-Misc,oc_
597
599static OT_ProcRet NS(MqFactoryC_Default) (MqFactoryC_ARGS) {
603 MQ_FCT retVal = MqFactoryDefault (hdl);
604 OT_retObj_SET_FCT(retVal);
605 goto end;
606 error:
608 end:
610}
611
613static OT_ProcRet NS(MqFactoryC_Initial) (MqFactoryC_ARGS) {
617 MQ_FCT retVal = MqFactoryInitial (hdl);
618 OT_retObj_SET_FCT(retVal);
619 goto end;
620 error:
622 end:
624}
625
626// doc-key: MqFactoryC,MqFactoryC-Misc,oco
627
629static OT_ProcRet NS(MqFactoryC_New) (MqFactoryC_ARGS) {
633 MQ_CTX val_out;
634 MkErrorC_Check(hdl,MqFactoryNew (hdl, NULL, &val_out));
635 OT_retObj_SET_CTX(val_out);
636 goto end;
637 error:
639 end:
641}
642
643// doc-key: MqFactoryC,MqFactoryC-Misc,om_
644
645// skip on class-overload: MqFactoryLog → MkObjectLog
648
649// doc-key: MqFactoryC,MqFactoryC-Misc,sm_
650
652static OT_ProcRet NS(MqFactoryC_DefaultIdent) (OtClass_ARGS) {
657 goto end;
658 error:
660 end:
662}
663
665static OT_ProcRet NS(MqFactoryC_InitialIdent) (OtClass_ARGS) {
670 goto end;
671 error:
673 end:
675}
676
678static OT_ProcRet NS(MqFactoryC_LogAll) (OtClass_ARGS) {
681 MK_STRN callfunc = NULL;
684 if (MkSysStringIsNULL(callfunc)) {callfunc = OT_GET_CALL_PROC;}
685 MqFactoryLogAll (callfunc);
687 goto end;
688 error:
690 end:
693}
694
696// MqFactoryC_Misc_TCL_API
697
701
702// doc-key: MqFactoryC,MqFactoryC-TOR,oCx
703
705static OT_ProcRet NS(MqFactoryC_Dup2) (MqFactoryC_ARGS) {
708 MK_STRN ident = 0;
711 MQ_FCT retVal = MqFactoryDup2 (hdl, ident);
712 if (retVal == NULL) {
713 OT_ERROR_CONSTRUCTOR(MqFactoryC);
714 goto error;
715 }
716 OT_retObj_SET_FCT(retVal);
717 goto end;
718 error:
720 end:
722}
723
724// doc-key: MqFactoryC,MqFactoryC-TOR,sCc
725
727static OT_ProcRet NS(MqFactoryC_Add) (OtClass_ARGS) {
730 MK_CCP constructor = 0;
732 MK_STRN ident = NULL;
735 if (MkSysStringIsNULL(ident)) {ident = OT_GET_CONSTR_NAME(constructor);}
736 MQ_FCT retVal = MqFactoryAdd (NULL, NS(sFactoryCTor), constructor, NS(sFactoryDataFree), NS(sFactoryDataCopy), NULL, NULL, NULL, NULL, ident);
737 if (retVal == NULL) {
738 OT_ERROR_CONSTRUCTOR(MqFactoryC);
739 goto error;
740 }
741 OT_CONSTRUCTOR_POST(retVal)
742 OT_retObj_SET_FCT(retVal);
743 goto end;
744 error:
746 end:
748}
749
751static OT_ProcRet NS(MqFactoryC_CTOR) (CONSTR_ARGS) {
754 MK_CCP constructor = 0;
756 MK_STRN ident = NULL;
758 if (MkSysStringIsNULL(ident)) {ident = OT_GET_CONSTR_NAME(constructor);}
759 MQ_FCT retVal = MqFactoryAdd (NULL, NS(sFactoryCTor), constructor, NS(sFactoryDataFree), NS(sFactoryDataCopy), NULL, NULL, NULL, NULL, ident);
760 if (retVal == NULL) {
761 OT_ERROR_CONSTRUCTOR(MqFactoryC);
762 goto error;
763 }
764 OT_CONSTRUCTOR_POST(retVal)
765 OT_retObj_CONSTR(retVal);
766 goto end;
767 error:
769 end:
771}
772
774// MqFactoryC_TOR_TCL_API
775
776// END-MqFactoryC - created by 'tcl_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
777
778// ---------------------------------------------------------------------------------------
779
780static Tcl_MethodType NS(sOtClassDef)[] = {
781// BEGIN-CLASS - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
782
783// doc-key: MqFactoryC,MqFactory,sCc
784 {VER, "Add" , NS(MqFactoryC_Add) , NULL, NULL},
785
786// doc-key: MqFactoryC,MqFactory,sc_
787 {VER, "Get" , NS(MqFactoryC_Get) , NULL, NULL},
788 {VER, "GetCalled" , NS(MqFactoryC_GetCalled) , NULL, NULL},
789 {VER, "GetCalledL" , NS(MqFactoryC_GetCalledL) , NULL, NULL},
790 {VER, "GetNull" , NS(MqFactoryC_GetNull) , NULL, NULL},
791 {VER, "HandleResolve" , NS(MqFactoryC_HandleResolve) , NULL, NULL},
792 {VER, "Instances" , NS(MqFactoryC_Instances) , NULL, NULL},
793
794// doc-key: MqFactoryC,MqFactory,sm_
795 {VER, "DefaultIdent" , NS(MqFactoryC_DefaultIdent) , NULL, NULL},
796 {VER, "InitialIdent" , NS(MqFactoryC_InitialIdent) , NULL, NULL},
797 {VER, "LogAll" , NS(MqFactoryC_LogAll) , NULL, NULL},
798
799// END-CLASS - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
800 {0, NULL, NULL, NULL}
801};
802
803// ---------------------------------------------------------------------------------------
804
805static Tcl_MethodType NS(sInstanceDef)[] = {
806// BEGIN-OBJ - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
807
808// doc-key: MqFactoryC,MqFactory,oC_
809 {VER, "<constructor>" , NS(MqFactoryC_CTOR) , NULL, NULL},
810
811// doc-key: MqFactoryC,MqFactory,oCx
812 {VER, "Dup2" , NS(MqFactoryC_Dup2) , NULL, NULL},
813
814// doc-key: MqFactoryC,MqFactory,oc_
815 {VER, "Default" , NS(MqFactoryC_Default) , NULL, NULL},
816 {VER, "Initial" , NS(MqFactoryC_Initial) , NULL, NULL},
817 {VER, "Next" , NS(MqFactoryC_Next) , NULL, NULL},
818 {VER, "Prev" , NS(MqFactoryC_Prev) , NULL, NULL},
819
820// doc-key: MqFactoryC,MqFactory,oco
821 {VER, "New" , NS(MqFactoryC_New) , NULL, NULL},
822
823// doc-key: MqFactoryC,MqFactory,om_
824 {VER, "GetOriginalIdent" , NS(MqFactoryC_GetOriginalIdent) , NULL, NULL},
825 // skip class-overload: MqFactoryHandleGet → HandleGet, NS(MqFactoryC_HandleGet)
826 // skip class-overload: MqFactoryLog → Log, NS(MqFactoryC_Log)
827
828// END-OBJ - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
829 {0, NULL, NULL, NULL, NULL}
830};
831
837
838int
839NS(MqFactoryC_Setup) (MK_RT_ARGS OT_ENV_T interp)
840{
841 if (!strcmp(MqFactoryDefaultIdent(), "libmqmsgque")) {
842 if ( MqFactoryDefault(
845 NS(sFactoryCTor), NULL, NULL, NULL, NULL, NULL, NULL, NULL, "tclmqmsgque"
846 )
847 )
848 ) == NULL
849 )
850 {
851 Tcl_SetResult(interp,"MqFactoryS exception",TCL_STATIC);
852 return TCL_ERROR;
853 }
854 }
855 return TCL_OK;
856}
857
858int NS(pMqFactoryC_Init) ( MK_RT_ARGS OT_ENV_T interp, OT_NS_T ns)
859{
862
863 return TCL_OK;
864error:
865 return TCL_ERROR;
866}
#define check_NULL(code)
#define MK(n)
#define OT_SETUP_VARARGS(min, max, d)
#define OT_CHECK_NIH(val)
#define OT_SETUP_NOARG(d)
#define OT_SETUP_ONEARG(d)
Tcl_Class OT_CLS_T
#define OT_ERROR_LNG_RETURN
Tcl_Namespace * OT_NS_T
#define OT_retObj_SET_Error
#define OT_FRAME_CLEANUP
#define OT_ERROR_CONSTRUCTOR(class)
#define OT_CHECK_REQUIRED(val)
#define OT_retObj_SET_None
#define META2VAL_X(x)
#define OT_SETUP_CONSTRUCTOR_ARGS(...)
#define OT_retObj_RETURN
#define OT_GET_CALL_PROC
#define check_LNG(code)
#define OT_ERROR_LNG_2_META(m)
#define OT_retObj_SET_STR(nat)
Tcl_Object OT_SELF_T
#define OT_CHECK_OPTIONAL(val)
#define OT_GET_CONSTR_NAME(ctor)
#define OT_OBJ_COPY(o)
#define OT_REF_DECR_AND_NULL(_obj)
#define RG(_key)
#define OT_retObj_CONSTR(x)
#define OT_CHECK_NOARGS
#define MkErrorC_Check(mng, PROC)
#define OT_ProcRet
Tcl_Interp * OT_ENV_T
#define CONSTR_ARGS
Tcl_Obj * OT_OBJ_T
#define OT_CHECK_STRN(val)
#define SETUP_interp
tag: nhi1-release-250425
#define OtClass_ARGS
#define MqFactoryC_ARGS
#define OT_retObj_SET_CTX(nat)
#define MQ(n)
#define NS(n)
#define OT_retObj_SET_FCT(nat)
#define mqctx
Definition MqCall_tcl.c:13
#define OT_CONSTRUCTOR_POST(x)
#define Instances_doc
#define Initial_doc
#define OT_SETUP_hdl_static_constr
#define GetOriginalIdent_doc
#define OT_SETUP_hdl
#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 VER
#define OT_CLASS
#define OT_SETUP_hdl_static
#define OT_SETUP_hdl_constr
#define GetCalled_doc
#define Dup2_doc
static __thread MK_TYP MqFactoryCTT
#define Add_doc
#define CTOR_doc
#define Default_doc
#define ClassInit
static char msg[]
#define error
Definition high_lng.h:339
#define MkBufferListCreateTLS_T(name, num)
#define MkErrorGetCode_0E()
#define MkErrorStack_0E()
#define MkErrorSetC_1E(message)
#define MK_ERROR_DEFAULT
#define MK_ERROR_FORMAT
#define MK_NULL_NO
#define MK_UNUSED
#define MK_DEPRECATED
MkErrorE
MK_ERROR
MK_OK
MK_PTRB * MK_PTR
const MK_STRB * MK_STRN
MK_PTRB * MK_CCP
int32_t MK_HDL
static bool MkSysStringIsNULL(MK_STRN str)
#define MkThreadLocal
#define MK_RT_CALL
#define MK_RT_ARGS
#define MK_RT_REF
static MQ_CTX MqCtx(MK_MNG mng)
cast a unknown-object into an MqContextS pointer or NULL if not possible
#define MqSetupDup(...)
#define MqConfigDup(...)
#define MQ_CALLBACK_FACTORY_CTOR_ARGS
the MqFactoryCTorF arguments with default names
#define MqFactoryInstances()
static MQ_FCT MqFactoryPrev(MQ_FCT const fct)
get previous instance from linked-list of MqFactoryS type
#define MqFactoryHandleResolve(...)
static MQ_FCT MqFactoryGetNull(void)
Null-Slot - return a MqFactoryC typed NULL instance …
static MQ_FCT MqFactoryNext(MQ_FCT const fct)
get next instance from linked-list of MqFactoryS type
#define MqFactoryGetCalledL(...)
#define MqFactoryGet(...)
MK_STRN MqFactoryGetOriginalIdent(MQ_FCTN const fct)
helper function to return MqFactoryS::originalIdent
#define MqFactoryGetCalled(...)
#define MqFactoryLogAll(...)
#define MqFactoryInitial(...)
#define MqFactoryDefaultIdent()
#define MqFactoryNew(...)
#define MqFactoryInitialIdent()
#define MqFactoryDefault(...)
#define MqFactoryDup2(...)
#define MqFactoryAdd(...)
@ 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
#define MQ_STATIC_RT
MK_OBJ const obj
Definition high_lng.h:136
MkErrorCheck(MqSendSTART(mqctx))
#define OT_CHECK_BFLN(val, nullB)
#define OT_CHECK_CONSTRUCTOR(val)
PUBLIC data structure for the tclmqmsgque-specific-data
data used to define a factory