theLink 10.0
Loading...
Searching...
No Matches
LibMqMsgque_tcl.c
Go to the documentation of this file.
1
9/* LABEL-NO */
10
11#define META_FILE_NAME "MqMsgque_tcl.c"
12#define VER TCL_OO_METHOD_VERSION_CURRENT
13
15
16#undef OtClass_ARGS
17#define OtClass_ARGS OBJCMD_ARGS
18
19#define OT_SETUP_hdl_static \
20 int __skip=1;\
21 /* printAry2("cmd",objc,objv); */ \
22 __attribute__((unused)) MK_RT mkrt = MkRT; \
23 __attribute__((unused)) MK_ERR hdl = &MkERROR;
24
25/* LABEL-END */
26
27#include <limits.h>
28#include <float.h>
29
30#include "mk_check_tcl.h"
31
32#define MqSetupTmpl()
33#define MqCleanupTmpl()
34
35#define META_CONTEXT_S hdl
36
37// MARK_D ################################################################
38// -----------------------------------------------------------------------
39// documentation order
40
49
62
87
96
105
113
122
130
131// --------------------------------------------------------------------------------
132
133typedef int (
135) (
136 OT_ENV_T interp,
137 int objc,
138 OT_OBJ_T const * objv
139);
140
142 const char *key;
144};
145
146MkThreadLocal bool NS(inMain) = false;
147
148// --------------------------------------------------------------------------------
149
150// BEGIN-DOC - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
151
152// doc-key: MqMsgque,EnumFunc,sco,func
153#define IdentE_FromInt_doc "MqIdentE [MqMsgque IdentE_FromInt value:int32]"
154#define SlaveE_FromInt_doc "MqSlaveE [MqMsgque SlaveE_FromInt value:int32]"
155#define StartE_FromInt_doc "MqStartE [MqMsgque StartE_FromInt value:int32]"
156#define StatusIsEF_FromInt_doc "MqStatusIsEF [MqMsgque StatusIsEF_FromInt value:int32]"
157#define WaitOnEventE_FromInt_doc "MqWaitOnEventE [MqMsgque WaitOnEventE_FromInt value:int32]"
158
159// doc-key: MqMsgque,EnumFunc,sm_,func
160#define IdentE_ToInt_doc "int32 [MqMsgque IdentE_ToInt value:MqIdentE]"
161#define IdentE_ToString_doc "string [MqMsgque IdentE_ToString value:MqIdentE]"
162#define SlaveE_ToInt_doc "int32 [MqMsgque SlaveE_ToInt value:MqSlaveE]"
163#define SlaveE_ToString_doc "string [MqMsgque SlaveE_ToString value:MqSlaveE]"
164#define StartE_ToInt_doc "int32 [MqMsgque StartE_ToInt value:MqStartE]"
165#define StartE_ToString_doc "string [MqMsgque StartE_ToString value:MqStartE]"
166#define StatusIsEF_ToInt_doc "int32 [MqMsgque StatusIsEF_ToInt value:MqStatusIsEF]"
167#define StatusIsEF_ToString_doc "string [MqMsgque StatusIsEF_ToString value:MqStatusIsEF]"
168#define WaitOnEventE_ToInt_doc "int32 [MqMsgque WaitOnEventE_ToInt value:MqWaitOnEventE]"
169#define WaitOnEventE_ToString_doc "string [MqMsgque WaitOnEventE_ToString value:MqWaitOnEventE]"
170
171// doc-key: MqMsgque,MqHelp,sm_,func
172#define Help_doc "string [MqMsgque Help tool:string]"
173#define HelpMsgque_doc "string [MqMsgque HelpMsgque]"
174
175// doc-key: MqMsgque,MqInit,sm_,func
176#define InitGetArg0_doc "MkBufferListC [MqMsgque InitGetArg0]"
177#define InitResetArg0_doc "MkBufferListC [MqMsgque InitResetArg0]"
178#define InitSetArg0_doc "MqMsgque InitSetArg0 ?bfl:MkBufferListC...=\"MK_NULL\"?"
179
180// doc-key: MqMsgque,MqMain,sm_,func
181#define Main_doc "MqMsgque Main code:..."
182
183// doc-key: MqMsgque,Setup,sm_,func
184#define Cleanup_doc "MqMsgque Cleanup"
185#define Setup_doc "MqMsgque Setup"
186
187// END-DOC - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
188
189/*****************************************************************************/
190/* */
191/* enum */
192/* */
193/*****************************************************************************/
194
262// ===============================================================================================
263
264// BEGIN-Enum-ToString - created by 'tcl_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
265
270
272{
273 OT_OBJ_T tmpO = Tcl_NewObj();
274 if (mk_bit_compare(type,MQ_FACTORY_NEW_INIT )) ot_enum_append(tmpO,"INIT" ) ;
275 if (mk_bit_compare(type,MQ_FACTORY_NEW_CHILD )) ot_enum_append(tmpO,"CHILD" ) ;
276 if (mk_bit_compare(type,MQ_FACTORY_NEW_SLAVE )) ot_enum_append(tmpO,"SLAVE" ) ;
277 if (mk_bit_compare(type,MQ_FACTORY_NEW_FORK )) ot_enum_append(tmpO,"FORK" ) ;
278 if (mk_bit_compare(type,MQ_FACTORY_NEW_THREAD)) ot_enum_append(tmpO,"THREAD") ;
279 if (mk_bit_compare(type,MQ_FACTORY_NEW_FILTER)) ot_enum_append(tmpO,"FILTER") ;
280 return tmpO;
281}
282
284{
285 switch (type) {
286 case MQ_HANDSHAKE_START : return ot_fixstrobj("START") ;
287 case MQ_HANDSHAKE_OK : return ot_fixstrobj("OK" ) ;
288 case MQ_HANDSHAKE_ERROR : return ot_fixstrobj("ERROR") ;
289 }
290 return ot_fixstrobj("NOTHING");
291}
292
294{
295 switch (type) {
296 case MQ_IDENT_PREFIX : return ot_fixstrobj("PREFIX" ) ;
297 case MQ_IDENT_FACTORY : return ot_fixstrobj("FACTORY") ;
298 }
299 return ot_fixstrobj("NOTHING");
300}
301
303{
304 switch (type) {
305 case MQ_IO_PIPE : return ot_fixstrobj("PIPE") ;
306 case MQ_IO_UDS : return ot_fixstrobj("UDS" ) ;
307 case MQ_IO_TCP : return ot_fixstrobj("TCP" ) ;
308 case MQ_IO_INIT : return ot_fixstrobj("INIT") ;
309 case MQ_IO_LOOP : return ot_fixstrobj("LOOP") ;
310 }
311 return ot_fixstrobj("NOTHING");
312}
313
315{
316 switch (type) {
317 case MQ_SLAVE_LOOPBACK : return ot_fixstrobj("LOOPBACK") ;
318 case MQ_SLAVE_FILTER : return ot_fixstrobj("FILTER" ) ;
319 case MQ_SLAVE_USER : return ot_fixstrobj("USER" ) ;
320 case MQ_SLAVE_MAX : return ot_fixstrobj("MAX" ) ;
321 }
322 return ot_fixstrobj("NOTHING");
323}
324
326{
327 switch (type) {
328 case MQ_START_DEFAULT : return ot_fixstrobj("DEFAULT") ;
329 case MQ_START_FORK : return ot_fixstrobj("FORK" ) ;
330 case MQ_START_THREAD : return ot_fixstrobj("THREAD" ) ;
331 case MQ_START_SPAWN : return ot_fixstrobj("SPAWN" ) ;
332 }
333 return ot_fixstrobj("NOTHING");
334}
335
337{
338 if (type == MQ_STATUS_IS_INITIAL) {
339 return ot_fixstrobj("INITIAL");
340 } else {
341 OT_OBJ_T tmpO = Tcl_NewObj();
342 if (mk_bit_compare(type,MQ_STATUS_IS_DUP )) ot_enum_append(tmpO,"DUP" ) ;
343 if (mk_bit_compare(type,MQ_STATUS_IS_THREAD )) ot_enum_append(tmpO,"THREAD" ) ;
344 if (mk_bit_compare(type,MQ_STATUS_IS_FORK )) ot_enum_append(tmpO,"FORK" ) ;
345 if (mk_bit_compare(type,MQ_STATUS_IS_SPAWN )) ot_enum_append(tmpO,"SPAWN" ) ;
346 return tmpO;
347 }
348}
349
351{
352 switch (type) {
353 case MQ_TRANS_TYPE_WAIT : return ot_fixstrobj("WAIT" ) ;
354 case MQ_TRANS_TYPE_SUB : return ot_fixstrobj("SUB" ) ;
355 case MQ_TRANS_TYPE_CB : return ot_fixstrobj("CB" ) ;
356 case MQ_TRANS_TYPE_TRANS : return ot_fixstrobj("TRANS") ;
357 case MQ_TRANS_TYPE_NO : return ot_fixstrobj("NO" ) ;
358 }
359 return ot_fixstrobj("NOTHING");
360}
361
363{
364 switch (type) {
365 case MQ_WAIT_NO : return ot_fixstrobj("NO" ) ;
366 case MQ_WAIT_ONCE : return ot_fixstrobj("ONCE" ) ;
367 case MQ_WAIT_OWN : return ot_fixstrobj("OWN" ) ;
368 case MQ_WAIT_FOREVER : return ot_fixstrobj("FOREVER") ;
369 }
370 return ot_fixstrobj("NOTHING");
371}
374
375// END-Enum-ToString - created by 'tcl_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
376
377// BEGIN-enum - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
378
383
384int MQ(Get_MqIdentE_FromObj) (MK_RT_ARGS OT_ENV_T interp, OT_OBJ_T enumE, enum MqIdentE *ret) {
385 const static struct LookupEnumE keys[] = {
386 { "PREFIX" , MQ_IDENT_PREFIX },
387 { "FACTORY" , MQ_IDENT_FACTORY },
388 { "IDENT_PREFIX" , MQ_IDENT_PREFIX },
389 { "IDENT_FACTORY" , MQ_IDENT_FACTORY },
390 { "MQ_IDENT_PREFIX" , MQ_IDENT_PREFIX },
391 { "MQ_IDENT_FACTORY" , MQ_IDENT_FACTORY },
392 { NULL , 0 },
393 };
394
395 int index;
396 OtErrorCheckLng (Tcl_GetIndexFromObjStruct (interp, enumE, &keys,
397 sizeof(struct LookupClassS), "enum", TCL_EXACT, &index));
398 *ret = keys[index].val;
399 return TCL_OK;
400}
401
402int MQ(Get_MqSlaveE_FromObj) (MK_RT_ARGS OT_ENV_T interp, OT_OBJ_T enumE, enum MqSlaveE *ret) {
403 const static struct LookupEnumE keys[] = {
404 { "MAX" , MQ_SLAVE_MAX },
405 { "USER" , MQ_SLAVE_USER },
406 { "OTHER" , MQ_SLAVE_OTHER },
407 { "MASTER" , MQ_SLAVE_MASTER },
408 { "FILTER" , MQ_SLAVE_FILTER },
409 { "LOOPBACK" , MQ_SLAVE_LOOPBACK },
410 { "SLAVE_MAX" , MQ_SLAVE_MAX },
411 { "SLAVE_USER" , MQ_SLAVE_USER },
412 { "SLAVE_OTHER" , MQ_SLAVE_OTHER },
413 { "SLAVE_FILTER" , MQ_SLAVE_FILTER },
414 { "SLAVE_MASTER" , MQ_SLAVE_MASTER },
415 { "MQ_SLAVE_MAX" , MQ_SLAVE_MAX },
416 { "MQ_SLAVE_USER" , MQ_SLAVE_USER },
417 { "MQ_SLAVE_OTHER" , MQ_SLAVE_OTHER },
418 { "SLAVE_LOOPBACK" , MQ_SLAVE_LOOPBACK },
419 { "MQ_SLAVE_FILTER" , MQ_SLAVE_FILTER },
420 { "MQ_SLAVE_MASTER" , MQ_SLAVE_MASTER },
421 { "MQ_SLAVE_LOOPBACK" , MQ_SLAVE_LOOPBACK },
422 { NULL , 0 },
423 };
424
425 int index;
426 OtErrorCheckLng (Tcl_GetIndexFromObjStruct (interp, enumE, &keys,
427 sizeof(struct LookupClassS), "enum", TCL_EXACT, &index));
428 *ret = keys[index].val;
429 return TCL_OK;
430}
431
432int MQ(Get_MqStartE_FromObj) (MK_RT_ARGS OT_ENV_T interp, OT_OBJ_T enumE, enum MqStartE *ret) {
433 const static struct LookupEnumE keys[] = {
434 { "FORK" , MQ_START_FORK },
435 { "SPAWN" , MQ_START_SPAWN },
436 { "THREAD" , MQ_START_THREAD },
437 { "DEFAULT" , MQ_START_DEFAULT },
438 { "START_FORK" , MQ_START_FORK },
439 { "START_SPAWN" , MQ_START_SPAWN },
440 { "START_THREAD" , MQ_START_THREAD },
441 { "MQ_START_FORK" , MQ_START_FORK },
442 { "START_DEFAULT" , MQ_START_DEFAULT },
443 { "MQ_START_SPAWN" , MQ_START_SPAWN },
444 { "MQ_START_THREAD" , MQ_START_THREAD },
445 { "MQ_START_DEFAULT" , MQ_START_DEFAULT },
446 { NULL , 0 },
447 };
448
449 int index;
450 OtErrorCheckLng (Tcl_GetIndexFromObjStruct (interp, enumE, &keys,
451 sizeof(struct LookupClassS), "enum", TCL_EXACT, &index));
452 *ret = keys[index].val;
453 return TCL_OK;
454}
455
456int MQ(Get_MqStatusIsEF_FromObj) (MK_RT_ARGS OT_ENV_T interp, OT_OBJ_T enumE, enum MqStatusIsEF *ret) {
457 const static struct LookupEnumE keys[] = {
458 { "DUP" , MQ_STATUS_IS_DUP },
459 { "FORK" , MQ_STATUS_IS_FORK },
460 { "SPAWN" , MQ_STATUS_IS_SPAWN },
461 { "THREAD" , MQ_STATUS_IS_THREAD },
462 { "IS_DUP" , MQ_STATUS_IS_DUP },
463 { "INITIAL" , MQ_STATUS_IS_INITIAL },
464 { "IS_FORK" , MQ_STATUS_IS_FORK },
465 { "IS_SPAWN" , MQ_STATUS_IS_SPAWN },
466 { "IS_THREAD" , MQ_STATUS_IS_THREAD },
467 { "IS_INITIAL" , MQ_STATUS_IS_INITIAL },
468 { "STATUS_IS_DUP" , MQ_STATUS_IS_DUP },
469 { "STATUS_IS_FORK" , MQ_STATUS_IS_FORK },
470 { "STATUS_IS_SPAWN" , MQ_STATUS_IS_SPAWN },
471 { "MQ_STATUS_IS_DUP" , MQ_STATUS_IS_DUP },
472 { "STATUS_IS_THREAD" , MQ_STATUS_IS_THREAD },
473 { "STATUS_IS_INITIAL" , MQ_STATUS_IS_INITIAL },
474 { "MQ_STATUS_IS_FORK" , MQ_STATUS_IS_FORK },
475 { "MQ_STATUS_IS_SPAWN" , MQ_STATUS_IS_SPAWN },
476 { "MQ_STATUS_IS_THREAD" , MQ_STATUS_IS_THREAD },
477 { "MQ_STATUS_IS_INITIAL" , MQ_STATUS_IS_INITIAL },
478 { NULL , 0 },
479 };
480
481 int index;
482 OtErrorCheckLng(MK(EnumFlagWorker)(MK_RT_CALL interp,keys,enumE,&index));
483 *ret = (enum MqStatusIsEF) index;
484 return TCL_OK;
485}
486
487int MQ(Get_MqWaitOnEventE_FromObj) (MK_RT_ARGS OT_ENV_T interp, OT_OBJ_T enumE, enum MqWaitOnEventE *ret) {
488 const static struct LookupEnumE keys[] = {
489 { "NO" , MQ_WAIT_NO },
490 { "OWN" , MQ_WAIT_OWN },
491 { "ONCE" , MQ_WAIT_ONCE },
492 { "FOREVER" , MQ_WAIT_FOREVER },
493 { "WAIT_NO" , MQ_WAIT_NO },
494 { "WAIT_OWN" , MQ_WAIT_OWN },
495 { "WAIT_ONCE" , MQ_WAIT_ONCE },
496 { "MQ_WAIT_NO" , MQ_WAIT_NO },
497 { "MQ_WAIT_OWN" , MQ_WAIT_OWN },
498 { "WAIT_FOREVER" , MQ_WAIT_FOREVER },
499 { "MQ_WAIT_ONCE" , MQ_WAIT_ONCE },
500 { "MQ_WAIT_FOREVER" , MQ_WAIT_FOREVER },
501 { NULL , 0 },
502 };
503
504 int index;
505 OtErrorCheckLng (Tcl_GetIndexFromObjStruct (interp, enumE, &keys,
506 sizeof(struct LookupClassS), "enum", TCL_EXACT, &index));
507 *ret = keys[index].val;
508 return TCL_OK;
509}
512
513// END-enum - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
514
515/*****************************************************************************/
516/* */
517/* Check */
518/* */
519/*****************************************************************************/
520
522
524{
525 if ((*skipP) >= objc) {
526 WrongNumArgs(hdl,(*skipP), objc, -999, +999, arg);
527 goto error;
528 }
529 OT_OBJ_T objV = OT_LNG_OBJV((*skipP)++);
530
531 OT_SELF_T classO = Tcl_GetObjectFromObj(interp,objV);
532 check_NULL(classO) {
533 return MkErrorSetC_2M(hdl,Tcl_GetStringResult (interp));
534 }
535 OT_CLS_T classC = Tcl_GetObjectAsClass(classO);
536 check_NULL(classC) {
537 WrongTypeOfArgError("Class",MK(GetTypeFromObj)(OT_Prefix_CALL objV,NULL));
538 }
539
540 *constrP = objV;
541 OT_REF_INCR(objV);
542
543 return MK_OK;
544error:
545 return OT_ERROR_STACK;
546}
547
548/*****************************************************************************/
549/* */
550/* subcommands */
551/* */
552/*****************************************************************************/
553
556static int NS(Support_Class_Cmd) (OtClass_ARGS)
557{
559 int index;
560
561 OT_OBJ_T Obj = NULL;
562
563 static const char *constant[] = {
564 "thread", "fork", NULL
565 };
566 enum constants {
567 THREAD, FORK,
568 };
569
570 WNA(1,1,"(thread|fork)")
571
572 // get the Index
573 OtErrorCheckLng (Tcl_GetIndexFromObj (interp, objv[__skip], constant, "configuration", 0, &index));
574
575 // do the work
576 switch ((enum constants) index) {
577 case THREAD:
578#if META_HAS_THREAD
579 Obj = Tcl_NewBooleanObj (1);
580#else
581 Obj = Tcl_NewBooleanObj (0);
582#endif
583 break;
584 case FORK:
585#if defined(HAVE_FORK)
586 Obj = Tcl_NewBooleanObj (1);
587#else
588 Obj = Tcl_NewBooleanObj (0);
589#endif
590 break;
591 }
592
593 Tcl_SetObjResult (interp, Obj);
594 return TCL_OK;
595}
596
599
601static OT_ProcRet NS(MqMsgque_Main) (OtClass_ARGS)
602{
604 WNA(1,1,"code")
605
606 if (Tcl_GetVar2Ex(interp,"MQ_STARTUP_IS_THREAD",NULL,TCL_GLOBAL_ONLY) == NULL) {
607 NS(inMain) = true;
608 int ret = Tcl_EvalObjEx (interp, objv[__skip], TCL_EVAL_GLOBAL);
609 NS(inMain) = false;
610 OtErrorCheckLng (ret);
611 }
612 return TCL_OK;
613}
614
616
617// BEGIN-MqMsgque - created by 'tcl_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
618
622
623// doc-key: MqMsgque,MqMsgque-Enum,sco
624
626static OT_ProcRet NS(MqMsgque_IdentE_FromInt) (OtClass_ARGS) {
629 MK_I32 value = 0;
632 enum MqIdentE value_out;
634 OT_retObj_SET(OT_NEW_Mq_enum_OBJ(IdentE,value_out));
635 goto end;
636 error:
638 end:
640}
641
643static OT_ProcRet NS(MqMsgque_SlaveE_FromInt) (OtClass_ARGS) {
646 MK_I32 value = 0;
649 enum MqSlaveE value_out;
651 OT_retObj_SET(OT_NEW_Mq_enum_OBJ(SlaveE,value_out));
652 goto end;
653 error:
655 end:
657}
658
660static OT_ProcRet NS(MqMsgque_StartE_FromInt) (OtClass_ARGS) {
663 MK_I32 value = 0;
666 enum MqStartE value_out;
668 OT_retObj_SET(OT_NEW_Mq_enum_OBJ(StartE,value_out));
669 goto end;
670 error:
672 end:
674}
675
677static OT_ProcRet NS(MqMsgque_StatusIsEF_FromInt) (OtClass_ARGS) {
680 MK_I32 value = 0;
683 enum MqStatusIsEF value_out;
685 OT_retObj_SET(OT_NEW_Mq_enum_OBJ(StatusIsEF,value_out));
686 goto end;
687 error:
689 end:
691}
692
694static OT_ProcRet NS(MqMsgque_WaitOnEventE_FromInt) (OtClass_ARGS) {
697 MK_I32 value = 0;
700 enum MqWaitOnEventE value_out;
702 OT_retObj_SET(OT_NEW_Mq_enum_OBJ(WaitOnEventE,value_out));
703 goto end;
704 error:
706 end:
708}
709
710// doc-key: MqMsgque,MqMsgque-Enum,sm_
711
713static OT_ProcRet NS(MqMsgque_IdentE_ToInt) (OtClass_ARGS) {
716 enum MqIdentE value = 0;
720 goto end;
721 error:
723 end:
725}
726
728static OT_ProcRet NS(MqMsgque_IdentE_ToString) (OtClass_ARGS) {
731 enum MqIdentE value = 0;
735 goto end;
736 error:
738 end:
740}
741
743static OT_ProcRet NS(MqMsgque_SlaveE_ToInt) (OtClass_ARGS) {
746 enum MqSlaveE value = 0;
750 goto end;
751 error:
753 end:
755}
756
758static OT_ProcRet NS(MqMsgque_SlaveE_ToString) (OtClass_ARGS) {
761 enum MqSlaveE value = 0;
765 goto end;
766 error:
768 end:
770}
771
773static OT_ProcRet NS(MqMsgque_StartE_ToInt) (OtClass_ARGS) {
776 enum MqStartE value = 0;
780 goto end;
781 error:
783 end:
785}
786
788static OT_ProcRet NS(MqMsgque_StartE_ToString) (OtClass_ARGS) {
791 enum MqStartE value = 0;
795 goto end;
796 error:
798 end:
800}
801
803static OT_ProcRet NS(MqMsgque_StatusIsEF_ToInt) (OtClass_ARGS) {
806 enum MqStatusIsEF value = 0;
810 goto end;
811 error:
813 end:
815}
816
818static OT_ProcRet NS(MqMsgque_StatusIsEF_ToString) (OtClass_ARGS) {
821 enum MqStatusIsEF value = 0;
825 goto end;
826 error:
828 end:
830}
831
833static OT_ProcRet NS(MqMsgque_WaitOnEventE_ToInt) (OtClass_ARGS) {
836 enum MqWaitOnEventE value = 0;
840 goto end;
841 error:
843 end:
845}
846
848static OT_ProcRet NS(MqMsgque_WaitOnEventE_ToString) (OtClass_ARGS) {
851 enum MqWaitOnEventE value = 0;
855 goto end;
856 error:
858 end:
860}
861
863// MqMsgque_Enum_TCL_API
864
868
869// doc-key: MqMsgque,MqMsgque-Help,sm_
870
872static OT_ProcRet NS(MqMsgque_Help) (OtClass_ARGS) {
875 MK_STRN tool = 0;
879 goto end;
880 error:
882 end:
884}
885
887static OT_ProcRet NS(MqMsgque_HelpMsgque) (OtClass_ARGS) {
892 goto end;
893 error:
895 end:
897}
898
900// MqMsgque_Help_TCL_API
901
905
906// doc-key: MqMsgque,MqMsgque-Init,sm_
907
909static OT_ProcRet NS(MqMsgque_InitGetArg0) (OtClass_ARGS) {
914 goto end;
915 error:
917 end:
919}
920
922static OT_ProcRet NS(MqMsgque_InitResetArg0) (OtClass_ARGS) {
927 goto end;
928 error:
930 end:
932}
933
935static OT_ProcRet NS(MqMsgque_InitSetArg0) (OtClass_ARGS) {
941 MqInitSetArg0 (bfl);
943 goto end;
944 error:
946 end:
948}
949
951// MqMsgque_Init_TCL_API
952
956
957// doc-key: MqMsgque,MqMsgque-Main,sm_
958
960static OT_ProcRet NS(MqMsgque_Main) (OtClass_ARGS) ; // skip template-required
961
963// MqMsgque_Main_TCL_API
964
968
969// doc-key: MqMsgque,MqMsgque-Setup,sm_
970
972static OT_ProcRet NS(MqMsgque_Cleanup) (OtClass_ARGS) {
976 MqCleanupTmpl ();
978 goto end;
979 error:
981 end:
983}
984
986static OT_ProcRet NS(MqMsgque_Setup) (OtClass_ARGS) {
990 MqSetupTmpl ();
992 goto end;
993 error:
995 end:
997}
998
1000// MqMsgque_Setup_TCL_API
1001
1002// END-MqMsgque - created by 'tcl_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
1003
1004
1005// ---------------------------------------------------------------------------------------
1006
1007__attribute__((unused)) const static OtObjProcDefS NS(sOtClassDef)[] = {
1008 {VER, "support" , NS(Support_Class_Cmd) , NULL, NULL},
1009// BEGIN-CLASS - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
1010
1011// doc-key: MqMsgque,EnumFunc,sco
1012 {VER, "IdentE_FromInt" , NS(MqMsgque_IdentE_FromInt) , NULL, NULL},
1013 {VER, "SlaveE_FromInt" , NS(MqMsgque_SlaveE_FromInt) , NULL, NULL},
1014 {VER, "StartE_FromInt" , NS(MqMsgque_StartE_FromInt) , NULL, NULL},
1015 {VER, "StatusIsEF_FromInt" , NS(MqMsgque_StatusIsEF_FromInt) , NULL, NULL},
1016 {VER, "WaitOnEventE_FromInt", NS(MqMsgque_WaitOnEventE_FromInt) , NULL, NULL},
1017
1018// doc-key: MqMsgque,EnumFunc,sm_
1019 {VER, "IdentE_ToInt" , NS(MqMsgque_IdentE_ToInt) , NULL, NULL},
1020 {VER, "IdentE_ToString" , NS(MqMsgque_IdentE_ToString) , NULL, NULL},
1021 {VER, "SlaveE_ToInt" , NS(MqMsgque_SlaveE_ToInt) , NULL, NULL},
1022 {VER, "SlaveE_ToString" , NS(MqMsgque_SlaveE_ToString) , NULL, NULL},
1023 {VER, "StartE_ToInt" , NS(MqMsgque_StartE_ToInt) , NULL, NULL},
1024 {VER, "StartE_ToString" , NS(MqMsgque_StartE_ToString) , NULL, NULL},
1025 {VER, "StatusIsEF_ToInt" , NS(MqMsgque_StatusIsEF_ToInt) , NULL, NULL},
1026 {VER, "StatusIsEF_ToString" , NS(MqMsgque_StatusIsEF_ToString) , NULL, NULL},
1027 {VER, "WaitOnEventE_ToInt" , NS(MqMsgque_WaitOnEventE_ToInt) , NULL, NULL},
1028 {VER, "WaitOnEventE_ToString", NS(MqMsgque_WaitOnEventE_ToString) , NULL, NULL},
1029
1030// doc-key: MqMsgque,MqHelp,sm_
1031 {VER, "Help" , NS(MqMsgque_Help) , NULL, NULL},
1032 {VER, "HelpMsgque" , NS(MqMsgque_HelpMsgque) , NULL, NULL},
1033
1034// doc-key: MqMsgque,MqInit,sm_
1035 {VER, "InitGetArg0" , NS(MqMsgque_InitGetArg0) , NULL, NULL},
1036 {VER, "InitResetArg0" , NS(MqMsgque_InitResetArg0) , NULL, NULL},
1037 {VER, "InitSetArg0" , NS(MqMsgque_InitSetArg0) , NULL, NULL},
1038
1039// doc-key: MqMsgque,MqMain,sm_
1040 {VER, "Main" , NS(MqMsgque_Main) , NULL, NULL},
1041
1042// doc-key: MqMsgque,Setup,sm_
1043 {VER, "Cleanup" , NS(MqMsgque_Cleanup) , NULL, NULL},
1044 {VER, "Setup" , NS(MqMsgque_Setup) , NULL, NULL},
1045
1046// END-CLASS - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
1047 {0, NULL, NULL, NULL, NULL}
1048};
1049
1050// ---------------------------------------------------------------------------------------
1051// not used.
1052
1053__attribute__((unused)) const static OtObjProcDefS NS(sInstanceDef)[] = {
1054// BEGIN-OBJ - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
1055
1056// → no data
1057
1058// END-OBJ - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
1059 {0, NULL, NULL, NULL, NULL}
1060};
1061
1062// ---------------------------------------------------------------------------------------
1063
1071OT_TCL_EXTERN int
1073 OT_ENV_T interp
1074)
1075{
1076 // check for the right tcl version
1077 if (Tcl_InitStubs (interp, "8.6", true) == NULL) {
1078 return TCL_ERROR;
1079 }
1080 if (Tcl_OOInitStubs (interp) == NULL) {
1081 return TCL_ERROR;
1082 }
1083
1084 // setup libmqmsgque
1085 MqSetup();
1087
1088 // announce my package
1089 OtErrorCheckLng (Tcl_PkgProvide (interp, "tclmqmsgque", META_VERSION));
1090
1091 // pkg_mkIndex hack → only "Tcl_PkgProvide" is required
1092 if (Tcl_GetVar(interp,"::tcl::newPkgs", TCL_GLOBAL_ONLY) != NULL) return TCL_OK;
1093
1094 // dependency.
1095 MK_STRN ver = Tcl_PkgRequire(interp, "tclmkkernel", META_VERSION, 1);
1096 check_NULL(ver) return TCL_ERROR;
1097
1098 // toplevel namespace
1099 OT_NS_T ns = Tcl_CreateNamespace (interp, "tclmqmsgque", NULL, NULL);
1100 check_NULL(ns) return TCL_ERROR;
1101
1102 // add PACKAGE commands
1103 OtErrorCheckLng( MK(FillNamespace) (interp,ns,MQ(sOtClassDef),NULL));
1104
1105 // BEGIN-CLASS-call-init - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
1106
1107 OtErrorCheckLng( NS(pMqFactoryC_Init) (MK_RT_CALL interp, ns)) ;
1108 OtErrorCheckLng( NS(pMqContextC_Init) (MK_RT_CALL interp, ns)) ;
1109 OtErrorCheckLng( NS(pMqDumpC_Init) (MK_RT_CALL interp, ns)) ;
1110
1111 // END-CLASS-call-init - created by 'tcl_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
1112
1113 // init NULL object… on EVERY thread
1114 NS(inMain) = false;
1115
1116 // every new thread source the script
1117 // "package require tclmqmsgque" is calling "Tclmsgque_Init"
1118 // → check if we on "thread" : NULL=initial, POINTER=thread
1119 OT_OBJ_T MQ_STARTUP_IS_THREAD = Tcl_GetVar2Ex(interp,"MQ_STARTUP_IS_THREAD",NULL,TCL_GLOBAL_ONLY);
1120
1121 // export namespace
1122 OtErrorCheckLng( Tcl_Export( interp, ns, "Mq*C", false ) ) ;
1123
1124 // only ONCE on INITIAL setup
1125 if (MQ_STARTUP_IS_THREAD == NULL) {
1126
1127 // setup MkInitGetArg0
1128 if (MqInitGetArg0() == NULL && Tcl_GetNameOfExecutable() != NULL) {
1129 Tcl_Eval(interp, "dict get [info frame 1] file");
1130 MqInitSetArg0VA(Tcl_GetNameOfExecutable(), Tcl_GetStringResult(interp), NULL);
1131 }
1132
1133 // create the default-factory
1134 OtErrorCheckLng (NS(MqFactoryC_Setup) (MK_RT_CALL interp));
1135 }
1136
1137/*
1138 // add both "thread" and "proc" exit-handler to get rid of:
1139 // -> Tcl_AsyncDelete: async handler deleted by the wrong thread
1140 // test: Nhi1Exec error.test --testing -match "error-1b2-*" --only-tcl --com-uds --start-thread
1141 // ERR4 delete app wit "exit 1" only PROC exit-handler is called
1142 //Tcl_CreateThreadExitHandler(sThreadExit,interp);
1143 Tcl_CreateExitHandler(sProcExit, interp);
1144 printV("create TLS-ipt=%p, ARG-itp=%p\n", MK_RT_REF.mkThreadData, interp);
1145*/
1146
1147 return TCL_OK;
1148}
1149
1150OT_TCL_EXTERN int
1152 OT_ENV_T interp,
1153 int flags
1154)
1155{
1156 MkCleanup();
1157
1158 return TCL_OK;
1159}
#define check_NULL(code)
#define MK(n)
#define OT_SETUP_VARARGS(min, max, d)
#define OT_SETUP_NOARG(d)
#define OT_SETUP_ONEARG(d)
Tcl_Class OT_CLS_T
Tcl_Namespace * OT_NS_T
#define OT_CHECK_NI4(val)
#define OT_retObj_SET_Error
#define ot_enum_append(_o, _s)
#define OT_CHECK_REQUIRED(val)
#define OT_retObj_SET_None
#define OT_retObj_SET_I32(nat)
#define OT_LNG_OBJV(__skip)
#define OT_Prefix_CALL
#define OT_Check_ARGS
#define WNA(min, max, txt)
#define OT_retObj_SET_BFL(nat)
#define OT_CHECK_ENUM(ename, val)
#define ot_fixstrobj(_s)
#define OT_retObj_RETURN
#define OT_retObj_SET_STR(nat)
Tcl_Object OT_SELF_T
#define OT_CHECK_OPTIONAL(val)
#define OT_TCL_EXTERN
#define OT_retObj_SET(val)
#define OT_REF_INCR(_obj)
#define OT_CHECK_NOARGS
#define OtErrorCheckLng(cmd)
#define MkErrorC_Check(mng, PROC)
#define OT_ProcRet
Tcl_Interp * OT_ENV_T
Tcl_Obj * OT_OBJ_T
#define OT_CHECK_STRN(val)
tag: nhi1-release-250425
#define MqCleanupTmpl()
#define StartE_ToString_doc
OT_TCL_EXTERN int Tclmqmsgque_Init(OT_ENV_T interp)
initialize the tclmqmsgque package
#define WaitOnEventE_ToInt_doc
#define WaitOnEventE_ToString_doc
#define IdentE_ToInt_doc
#define IdentE_ToString_doc
#define InitGetArg0_doc
#define SlaveE_ToString_doc
#define StatusIsEF_FromInt_doc
#define StatusIsEF_ToString_doc
#define MqSetupTmpl()
#define VER
#define StatusIsEF_ToInt_doc
#define HelpMsgque_doc
#define Help_doc
#define OT_SETUP_hdl_static
int(* LookupObjSF)(OT_ENV_T interp, int objc, OT_OBJ_T const *objv)
#define InitSetArg0_doc
#define InitResetArg0_doc
OT_TCL_EXTERN int Tclmqmsgque_Unload(OT_ENV_T interp, int flags)
#define StartE_ToInt_doc
#define Cleanup_doc
#define IdentE_FromInt_doc
#define SlaveE_ToInt_doc
#define SlaveE_FromInt_doc
#define Setup_doc
#define WaitOnEventE_FromInt_doc
#define OtClass_ARGS
#define StartE_FromInt_doc
#define OT_NEW_Mq_enum_OBJ(typ, val)
#define MQ(n)
#define NS(n)
#define error
Definition high_lng.h:339
#define MkBufferListCreateTLS_T(name, num)
#define MkErrorSetC_2M(err, message)
#define MK_ERROR_FORMAT
#define mk_bit_compare(t, f)
MkErrorE
MK_OK
void MkCleanup(void)
const MK_STRB * MK_STRN
MK_PTRB * MK_CCP
signed int MK_I32
#define MkThreadLocal
#define MK_RT_CALL
#define MK_RT_ARGS
#define MkRtSetup_NULL
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 …
MqFactoryE
the factory is called to create an object for ...
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 MqIoComE_ToString(enum MqIoComE value)
return the MqIoComE as string …
MK_STRN MqFactoryE_ToString(enum MqFactoryE value)
return the MqFactoryE as string …
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 …
MqHandShakeE
the hand-shake of a service-call …
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 …
MqIoComE
what kind of socket interface to use? …
static MK_I32 MqWaitOnEventE_ToInt(enum MqWaitOnEventE value)
return the MqWaitOnEventE as integer …
MqTransTypeE
the type of the transaction …
static MK_I32 MqSlaveE_ToInt(enum MqSlaveE value)
return the MqSlaveE as integer …
MK_STRN MqHandShakeE_ToString(enum MqHandShakeE value)
return the MqHandShakeE as string …
enum MkErrorE MqWaitOnEventE_FromInt(MK_I32 const value, enum MqWaitOnEventE *value_out)
return the MqWaitOnEventE from integer …
MK_STRN MqTransTypeE_ToString(enum MqTransTypeE value)
return the MqTransTypeE as string …
@ 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
@ MQ_WAIT_ONCE
Wait maximum timeout seconds for one new event, doesn't matter which context the event belongs to or ...
@ MQ_WAIT_OWN
Wait maximum timeout seconds for one new event that belongs to the current context or raise an timeou...
@ MQ_WAIT_NO
Check for one event but do not wait …
@ MQ_WAIT_FOREVER
Wait maximum timeout seconds for an event or raise an timeout-error …
@ MQ_SLAVE_OTHER
internal: on the master-ctx get the slave-ctx and on the slave-ctx get the master-ctx
@ MQ_SLAVE_FILTER
internal: the filter-slave-id, (on a master get the filter-slave)
@ MQ_SLAVE_USER
internal: start of user-defined-slave-id
@ MQ_SLAVE_MASTER
internal: the master-slave-id, (on a slave get the master)
@ MQ_SLAVE_LOOPBACK
internal: the loopback-slave-id, (call my own services)
@ MQ_SLAVE_MAX
internal: the maximum slave-id …
@ MQ_IDENT_FACTORY
value from MqFactoryS::originalIdent
@ MQ_IDENT_PREFIX
value from MqConfigS::dispPrefix
@ MQ_START_SPAWN
create entity as spawn process
@ MQ_START_DEFAULT
use application-context default entity creation
@ MQ_START_THREAD
create entity as thread
@ MQ_START_FORK
create entity as fork
@ MQ_STATUS_IS_FORK
context is created as a fork
@ MQ_STATUS_IS_DUP
context is created as a duplicate of an other context
@ MQ_STATUS_IS_THREAD
context is created as a thread
@ MQ_STATUS_IS_INITIAL
context is the first context
@ MQ_STATUS_IS_SPAWN
context is created as a spawn
@ MQ_HANDSHAKE_OK
direction: server -> client
@ MQ_HANDSHAKE_START
direction: client -> server
@ MQ_HANDSHAKE_ERROR
direction: server -> client
@ MQ_IO_UDS
using a uds socket
@ MQ_IO_LOOP
using pipe socket as stdin and stdout
@ MQ_IO_PIPE
using a pipe socket (most internal usage)
@ MQ_IO_INIT
using stdin and stdout
@ MQ_IO_TCP
using a tcp socket
@ MQ_TRANS_TYPE_WAIT
'W' = MqSendEND_AND_WAIT
@ MQ_TRANS_TYPE_SUB
'S' = MqSendEND_AND_SUB
@ MQ_TRANS_TYPE_CB
'C' = MqSendEND_AND_CALLBACK
@ MQ_TRANS_TYPE_NO
'N' = MqSendEND
@ MQ_TRANS_TYPE_TRANS
'T' = MqSendEND_AND_TRANSACTION
MK_STR MqHelp(MK_STRN tool)
write tclmqmsgque specific user-help to stderr
MK_STR MqHelpMsgque(void)
return a page with the usage of all tclmqmsgque 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 tclmqmsgque internal memory …
#define OT_ERROR_STACK
#define WrongNumArgs(...)
#define OT_CHECK_BAC(val)
#define WrongTypeOfArgError(exp, got)
tag: nhi1-release-250425
MQ_EXTERN enum MkErrorE MK_DECL MQ CheckConstructor(OT_Check_ARGS, MK_CBP *)
const char * key
LookupObjSF keyF