theKernel 10.0
Loading...
Searching...
No Matches
MkRuntimeC_tcl.c
Go to the documentation of this file.
1
9/* LABEL-START */
10
11#define META_FILE_NAME "MkRuntimeC_tcl.c"
12
14
15#define OT_CLASS NS(MkRuntimeC)
16#define OT_CLASS_NAME "MkRuntimeC"
17
18#define OBJECT2RT(O) MkAssertCastM(MkRuntimeC,(Tcl_ObjectGetMetadata(O, &MK(AtomMeta))))
19
20// TCL class
22
23// META class
25MkThreadLocal OT_OBJ_T MK(MkRuntimeC_MK_NULL) = NULL;
26
27// META: ObjNew feature: selfCreate will be called from "ObjNew->MkSelfNew" if MkObj need a SELF pointer
28static MK_PTR NS(MkRuntimeC_selfCreate) (MK_RT_ARGS MK_OBJ const obj, MK_PTR const env) {
29 OT_ENV_T interp = env;
30 return MK(AtomCreate) (MK_RT_CALL interp,obj,OT_CLASS,NULL,NULL);
31}
32// META: is called when the META object is destroyed and SELF does NOT belongs to the META.
33static void NS(MkRuntimeC_selfDelete) (MK_RT_ARGS MK_PTR selfP, MK_PTR const env) {
34 OT_SELF_T selfO = selfP;
35 OT_ENV_T interp = env;
36 MK(AtomDeleteHard) (MK_RT_CALL interp, selfO);
37}
38// META: is called when the META object is destroyed and SELF does NOT belong to the META.
39static void NS(MkRuntimeC_selfUnlink) (MK_RT_ARGS MK_PTR selfP, MK_PTR const env) {
40 OT_SELF_T selfO = selfP;
41 OT_ENV_T interp = env;
42 MK(AtomUnlink) (MK_RT_CALL interp, selfO);
43}
44
45// ATTENTION: TCL has no "Unlink" because the "Tcl_ObjectSetMetadata(selfO,&MK(AtomMeta),NULL);" call
46// also the destructor
47
48#define OT_SETUP_hdl_static_constr_pre
49#define OT_SETUP_hdl_static_constr \
50 OT_SETUP_hdl_static_constr_pre; \
51 OT_SETUP_hdl_static
52
53#define OT_SETUP_hdl_static \
54 int __skip=Tcl_ObjectContextSkippedArgs(objCtx); \
55 AllRtSetup_NULL; \
56 __attribute__((unused)) OT_SELF_T selfO = Tcl_ObjectContextObject(objCtx); \
57 __attribute__((unused)) MK_TYP hdl = MkRuntimeC##_TT;
58
59#define OT_SETUP_hdl SetupHdlFromMetaData_2(RT,MK_RT);
60#define OT_SETUP_hdl__null_allow SetupHdlFromMetaData__null_allow_2(RT,MK_RT);
61#define OT_SETUP_hdl_destr SetupHdlFromMetaData__null_allow_2(RT,MK_RT);
62
63#define OT_SETUP_hdl_constr_pre
64#define OT_SETUP_hdl_constr \
65 OT_SETUP_hdl_constr_pre; \
66 int __skip=Tcl_ObjectContextSkippedArgs(objCtx); \
67 AllRtSetup_NULL; \
68 MK_RT_UNUSED OT_SELF_T selfO = Tcl_ObjectContextObject(objCtx); \
69 MK_RT hdl = (MK_RT) &MkERROR;
70
71#if !defined(SetupRtFromHdl_XN)
72 #define SetupRtFromHdl_XN(hdl) AllRtSetup_XN(hdl)
73 #define SetupRtFromHdl_X(hdl) AllRtSetup_X(hdl)
74#endif
75
76// initialize the TCL and MO class specific object
77#define ClassInit \
78 /* if not already done, initialize NEW MQ type */ \
79 if (MkRuntimeCTT == NULL) MkRuntimeCTT = MkRuntimeSTT; \
80 \
81 /* protect against double call */ \
82 if (MkRuntimeCTT->selfCreate == NS(MkRuntimeC_selfCreate)) return MK_OK; \
83 \
84 /* add "selfCreate" and "selfDelete" feature to the MQ-Class */ \
85 MkRuntimeCTT->selfCreate = NS(MkRuntimeC_selfCreate); \
86 MkRuntimeCTT->selfDelete = NS(MkRuntimeC_selfDelete); \
87 MkRuntimeCTT->selfUnlink = NS(MkRuntimeC_selfUnlink); \
88 \
89 /* create the TCL-class */ \
90 OT_SELF_T classO = MK(ClassDef)(interp,ns,MkRuntimeCTT); \
91 check_NULL(classO) goto error; \
92 OT_CLASS = Tcl_GetObjectAsClass(classO); \
93 \
94 /* create the TCL static Methods */ \
95 static MkThreadLocal OtUnknownS NS(sClassUnknown) = {OT_UNKNOWN_CLASS}; \
96 check_LNG(MK(UnknownSetup) (interp,classO,NS(sOtClassDef),&NS(sClassUnknown))) goto error; \
97 \
98 /* create the TCL instance Methods */ \
99 static MkThreadLocal OtUnknownS NS(sInstanceUnknown) = {OT_UNKNOWN_INSTANCE}; \
100 check_LNG(MK(UnknownSetup) (interp,classO,NS(sInstanceDef),&NS(sInstanceUnknown))) goto error; \
101 \
102 /* define the "NULL" object */ \
103 MK(MkRuntimeC_MK_NULL) = Tcl_GetObjectName(interp, \
104 MK(AtomCreate) (MK_RT_CALL interp, NULL /*obj*/, OT_CLASS, "MK_NULL" /*name*/, "::tclmkkernel::MkRuntimeC" /*ns*/) \
105 ); \
106 Tcl_IncrRefCount(MK(MkRuntimeC_MK_NULL));
107
108#define VER TCL_OO_METHOD_VERSION_CURRENT
109
110/* LABEL-END */
111
112// BEGIN-DOC - created by 'tcl_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
113
114// doc-key: MkRuntimeC,MkRuntime,sm_,func
115#define DebugGet_doc "int32 [MkRuntimeC DebugGet]"
116#define DebugSet_doc "MkRuntimeC DebugSet dbg:int32"
117#define ErrorGetCode_doc "MkErrorE [MkRuntimeC ErrorGetCode]"
118#define IsSilentGet_doc "bool [MkRuntimeC IsSilentGet]"
119#define IsSilentSet_doc "MkRuntimeC IsSilentSet silent:bool"
120#define Log0_doc "MkRuntimeC Log0 ?fmtobj:MkObjectC=\"MK_NULL\"? ?debug:int32=0? ?callfunc:string=\"MK_NULL\"? ?lvl:int32=0? (const)"
121#define LogTargetGet_doc "string [MkRuntimeC LogTargetGet]"
122#define LogTargetReset_doc "MkRuntimeC LogTargetReset"
123#define LogTargetSet_doc "MkRuntimeC LogTargetSet logTgt:string"
124#define NoDecoSet_doc "MkRuntimeC NoDecoSet noDeco:bool"
125
126// END-DOC - created by 'tcl_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
127
128/*****************************************************************************/
129/* */
130/* O B J E C T */
131/* */
132/*****************************************************************************/
133
134// BEGIN-MkRuntimeC - created by 'tcl_MqC.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
135
139
140// doc-key: MkRuntimeC,MkRuntimeC-Config,sm_
141
143static OT_ProcRet NS(MkRuntimeC_DebugGet) (OtClass_ARGS) {
148 goto end;
149 error:
151 end:
153}
154
156static OT_ProcRet NS(MkRuntimeC_DebugSet) (OtClass_ARGS) {
159 MK_I32 dbg = 0;
162 MkRuntimeDebugSet (dbg);
164 goto end;
165 error:
167 end:
169}
170
172static OT_ProcRet NS(MkRuntimeC_ErrorGetCode) (OtClass_ARGS) {
177 goto end;
178 error:
180 end:
182}
183
185static OT_ProcRet NS(MkRuntimeC_IsSilentGet) (OtClass_ARGS) {
190 goto end;
191 error:
193 end:
195}
196
198static OT_ProcRet NS(MkRuntimeC_IsSilentSet) (OtClass_ARGS) {
201 MK_BOOL silent = 0;
204 MkRuntimeIsSilentSet (silent);
206 goto end;
207 error:
209 end:
211}
212
214static OT_ProcRet NS(MkRuntimeC_LogTargetGet) (OtClass_ARGS) {
219 goto end;
220 error:
222 end:
224}
225
239
241static OT_ProcRet NS(MkRuntimeC_LogTargetSet) (OtClass_ARGS) {
244 MK_STRN logTgt = 0;
249 goto end;
250 error:
252 end:
254}
255
257static OT_ProcRet NS(MkRuntimeC_NoDecoSet) (OtClass_ARGS) {
260 MK_BOOL noDeco = 0;
263 MkRuntimeNoDecoSet (noDeco);
265 goto end;
266 error:
268 end:
270}
271
273// MkRuntimeC_Config_TCL_API
274
278
279// doc-key: MkRuntimeC,MkRuntimeC-Info,sm_
280
282static OT_ProcRet NS(MkRuntimeC_Log0) (OtClass_ARGS) {
285 MK_OBJN fmtobj = NULL;
287 MK_DBG debug = 0;
289 MK_STRN callfunc = NULL;
291 MK_I32 lvl = 0;
294 if (debug > MkRuntimeDebugGet()) {
296 goto end;
297 }
298 if (MkSysStringIsNULL(callfunc)) {callfunc = OT_GET_CALL_PROC;}
299 MkRuntimeLog0 (fmtobj, debug, callfunc, lvl);
301 goto end;
302 error:
304 end:
307}
308
310// MkRuntimeC_Info_TCL_API
311
312// END-MkRuntimeC - created by 'tcl_MqC.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
313
319
320const static Tcl_MethodType NS(sOtClassDef)[] = {
321// BEGIN-CLASS - created by 'tcl_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
322
323// doc-key: MkRuntimeC,MkRuntime,sm_
324 {VER, "DebugGet" , NS(MkRuntimeC_DebugGet) , NULL, NULL},
325 {VER, "DebugSet" , NS(MkRuntimeC_DebugSet) , NULL, NULL},
326 {VER, "ErrorGetCode" , NS(MkRuntimeC_ErrorGetCode) , NULL, NULL},
327 {VER, "IsSilentGet" , NS(MkRuntimeC_IsSilentGet) , NULL, NULL},
328 {VER, "IsSilentSet" , NS(MkRuntimeC_IsSilentSet) , NULL, NULL},
329 {VER, "Log0" , NS(MkRuntimeC_Log0) , NULL, NULL},
330 {VER, "LogTargetGet" , NS(MkRuntimeC_LogTargetGet) , NULL, NULL},
331 {VER, "LogTargetReset" , NS(MkRuntimeC_LogTargetReset) , NULL, NULL},
332 {VER, "LogTargetSet" , NS(MkRuntimeC_LogTargetSet) , NULL, NULL},
333 {VER, "NoDecoSet" , NS(MkRuntimeC_NoDecoSet) , NULL, NULL},
334
335// END-CLASS - created by 'tcl_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
336 {0, NULL, NULL, NULL}
337};
338
339// ---------------------------------------------------------------------------------------
340
341const static Tcl_MethodType NS(sInstanceDef)[] = {
342// BEGIN-OBJ - created by 'tcl_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
343
344// → no data
345
346// END-OBJ - created by 'tcl_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
347 {0, NULL, NULL, NULL, NULL}
348};
349
355
361
362int NS(pMkRuntimeC_Init) ( MK_RT_ARGS OT_ENV_T interp, OT_NS_T ns )
363{
365
366 return TCL_OK;
367error:
368 return TCL_ERROR;
369}
tag: nhi1-release-250425
#define OtClass_ARGS
#define OT_CHECK_bool(val)
#define MK(n)
#define OT_SETUP_VARARGS(min, max, d)
#define OT_retObj_SET_BOL(nat)
#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_FRAME_CLEANUP
#define OT_CHECK_REQUIRED(val)
#define OT_retObj_SET_None
#define OT_retObj_SET_I32(nat)
#define NS(n)
#define OT_retObj_RETURN
#define OT_GET_CALL_PROC
#define OT_retObj_SET_STR(nat)
#define OT_NEW_Mk_enum_OBJ(typ, val)
Tcl_Object OT_SELF_T
#define OT_CHECK_OPTIONAL(val)
#define OT_retObj_SET(val)
#define OT_CHECK_NOARGS
#define MkErrorC_Check(mng, PROC)
#define OT_ProcRet
Tcl_Interp * OT_ENV_T
Tcl_Obj * OT_OBJ_T
#define OT_CHECK_STRN(val)
#define ErrorGetCode_doc
#define Log0_doc
static __thread MK_TYP MkRuntimeCTT
#define IsSilentGet_doc
#define IsSilentSet_doc
#define NoDecoSet_doc
#define VER
#define LogTargetReset_doc
#define OT_CLASS
#define OT_SETUP_hdl_static
#define DebugGet_doc
#define DebugSet_doc
#define LogTargetGet_doc
#define ClassInit
#define LogTargetSet_doc
#define MK_ERROR_FORMAT
#define MK_NULL_YES
flag, allow NULL
MK_PTRB * MK_PTR
generic pointer data-type
const MK_STRB * MK_STRN
constant string pointer data-type
bool MK_BOOL
real bool data-type
signed int MK_I32
4 byte integer data-type
int MK_DBG
debug-level data-type …
static bool MkSysStringIsNULL(MK_STRN str)
test if string is NULL or EMPTY …
#define MkRuntimeLogTargetReset()
#define MkRuntimeErrorGetCode()
static void MkRuntimeDebugSet(MK_I32 dbg)
set the MkRuntimeS::debug value …
static bool MkRuntimeIsSilentGet(void)
get the MkRuntimeS::isSilent value …
#define MkRuntimeLogTargetSet(...)
#define MkRuntimeNoDecoSet(...)
static MK_I32 MkRuntimeDebugGet(void)
get the MkRuntimeS::debug value …
#define MkRuntimeIsSilentSet(...)
static MK_STRN MkRuntimeLogTargetGet(void)
get the MkLogDataS::logNAME value …
#define MkRuntimeLog0(...)
#define MkThreadLocal
#define MK_RT_CALL
#define MK_RT_ARGS
#define OT_CHECK_OBJN(val, nullB)
object header …
MkTypeS - class known as typ or type is used as class-base for a Managed-Object-Technology (MOT) type...