theKernel 10.0
Loading...
Searching...
No Matches
MkRuntimeC_rb.c
Go to the documentation of this file.
1
9/* LABEL-START */
10#define META_FILE_NAME "MkRuntimeC_rb.c"
11
13
14#define OT_CLASS NS(MkRuntimeC)
15#define OT_CLASS_NAME "MkRuntimeC"
16
17#define OT_LNG2META(O) MkRt(VAL2MNG(O))
18
20
21// new Class type object
22static MK_TYP MkRuntimeCTT = NULL;
24
25// GS marker in "Data_Wrap_Struct"
26static void NS(sMark) (MK_PTR);
27
28// ruby datatype of the wrapped struct
29static rb_data_type_t NS(MkRuntimeC_T) = {
30 "MkRuntimeC",
31 {
32 NS(sMark),
33 MK(AtomDeleteSoft),
34 0, /* dsize */
35 0, /* reserved[1] */
36 },
37 NULL, /* parent */
38 NULL, /* data */
39 RUBY_TYPED_FREE_IMMEDIATELY
40};
41
42// >>THIS<< is a Phase-1-CONSTRUCTOR: a constructor which create the SELF object
43// A Phase-2-CONSTRUCTOR is a constructor which configure an already existing object
44// DO: create a new SELF and link this SELF with the MQ-Object "mng"
45// clazz is the toplevel "subclass" or "MkRuntimeC"
46mk_inline OT_OBJ_T NS(LNG_CONSTR) (OT_CLS_T clazz, MK_MNG mng, int objc, VALUE* objv) {
47 return MK(AtomObjCrt)(clazz,&NS(MkRuntimeC_T),mng,objc,objv);
48}
49// MQ: ObjNew feature: called to return a new or an already existing RUBY-SELF-Object
50// -> moved to: msgque_rb.h
51// OT_OBJ_T NS(MkRuntimeC_ObjNew) (MK_RT hdl) {
52// return MK(AtomObjNew) (MkRuntimeC_X2obj(hdl));
53// }
54// MQ: ObjNew feature: selfCreate will be called from "ObjNew->MkSelfNew" if MkObj need a SELF pointer
55static MK_PTR NS(MkRuntimeC_selfCreate) (MK_RT_ARGS MK_OBJ obj, MK_PTR envP) {
56 OT_OBJ_T self = NS(LNG_CONSTR) (OT_CLASS, obj, 0, NULL);
57 return VAL2PTR(self);
58}
59// MQ: called on instance-destruction for a "selfCreate" instance → goal: destroy the SELF
60static void NS(MkRuntimeC_selfDelete) (MK_RT_ARGS MK_PTR ptr, MK_PTR envP) {
62}
63// MQ: called to destroy link from SELF to META
64static void NS(MkRuntimeC_selfUnlink) (MK_RT_ARGS MK_PTR ptr, MK_PTR envP) {
65 OT_OBJ_T self = PTR2VAL(ptr);
66 RDATA(self)->data = NULL;
67}
68// initialize the RUBY and MO class specific object
69#define S_INIT NS(sInit)(MK_RT_CALL_ONLY)
70static void NS(sInit)(MK_RT_ARGS_ONLY) {
71
72 // add "selfCreate" and "selfDelete" feature to the MQ-MkRuntimeC-Type
73 MkRuntimeCTT->selfCreate = NS(MkRuntimeC_selfCreate);
74 MkRuntimeCTT->selfDelete = NS(MkRuntimeC_selfDelete);
75 MkRuntimeCTT->selfUnlink = NS(MkRuntimeC_selfUnlink);
76
77 // create the RUBY class
78 OT_CLASS = rb_define_class_under(OT_PKG, "MkRuntimeC", MK_BASE_CLASS);
79 rb_undef_alloc_func(OT_CLASS);
80
81 /* define the "NULL" object */
82 VALUE nullO = TypedData_Wrap_Struct (OT_CLASS, &NS(MkRuntimeC_T), MK_NULL);
83 NS(MkRuntimeC_MK_NULL) = nullO;
85}
86
87#define OT_SETUP_hdl OT_SETUP_hdl_tmpl(MkRuntimeC);
88#define OT_SETUP_hdl__null_allow OT_SETUP_hdl_tmpl__null_allow(MkRuntimeC);
89#define OT_SETUP_hdl_constr AllRtSetup_NULL; \
90 OT_OBJ_T clazz = self; \
91 MkRuntimeC_type hdl = (MkRuntimeC_type) &MkERROR;
92#define OT_SETUP_hdl_destr OT_SETUP_hdl_tmpl__null_allow(MkRuntimeC);
93#define OT_SETUP_hdl_static AllRtSetup_NULL; \
94 __attribute__((unused)) MK_TYP hdl = MkRuntimeC##_TT;
95#define OT_SETUP_hdl_static_constr OT_SETUP_hdl_static
96
97#if !defined(SetupRtFromObj_X)
98 #define SetupRtFromObj_X(hdl) AllRtSetup_X(hdl)
99 #define SetupRtFromObj_XN(hdl) AllRtSetup_XN(hdl)
100#endif
101
102/* LABEL-END */
103
104// BEGIN-DOC - created by 'rb_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
105
106// doc-key: MkRuntimeC,MkRuntime,sm_,func
107#define DebugGet_doc "int32 MkRuntimeC.DebugGet()"
108#define DebugSet_doc "MkRuntimeC.DebugSet(dbg:int32)"
109#define ErrorGetCode_doc "MkErrorE MkRuntimeC.ErrorGetCode()"
110#define IsSilentGet_doc "bool MkRuntimeC.IsSilentGet()"
111#define IsSilentSet_doc "MkRuntimeC.IsSilentSet(silent:bool)"
112#define Log0_doc "MkRuntimeC.Log0(?fmtobj:MkObjectC=nil?, ?debug:int32=0?, ?callfunc:string=\"MK_NULL\"?, ?lvl:int32=0?) (const)"
113#define LogTargetGet_doc "string MkRuntimeC.LogTargetGet()"
114#define LogTargetReset_doc "MkRuntimeC.LogTargetReset()"
115#define LogTargetSet_doc "MkRuntimeC.LogTargetSet(logTgt:string)"
116#define NoDecoSet_doc "MkRuntimeC.NoDecoSet(noDeco:bool)"
117
118// END-DOC - created by 'rb_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
119
120// ---------------------------------------------------------------------------------------
121
127
128// ---------------------------------------------------------------------------------------
129
130// BEGIN-MkRuntimeC - created by 'rb_MqC.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
131
135
136// doc-key: MkRuntimeC,MkRuntimeC-Config,sm_
137
139static OT_ProcRet NS(MkRuntimeC_DebugGet) (OtClass_ARGS) {
144 end: MK_UNUSED /* LONG JUMP on error */
146}
147
149static OT_ProcRet NS(MkRuntimeC_DebugSet) (OtClass_ARGS) {
152 MK_I32 dbg = 0;
155 MkRuntimeDebugSet (dbg);
157 end: MK_UNUSED /* LONG JUMP on error */
159}
160
162static OT_ProcRet NS(MkRuntimeC_ErrorGetCode) (OtClass_ARGS) {
167 end: MK_UNUSED /* LONG JUMP on error */
169}
170
172static OT_ProcRet NS(MkRuntimeC_IsSilentGet) (OtClass_ARGS) {
177 end: MK_UNUSED /* LONG JUMP on error */
179}
180
182static OT_ProcRet NS(MkRuntimeC_IsSilentSet) (OtClass_ARGS) {
185 MK_BOOL silent = 0;
188 MkRuntimeIsSilentSet (silent);
190 end: MK_UNUSED /* LONG JUMP on error */
192}
193
195static OT_ProcRet NS(MkRuntimeC_LogTargetGet) (OtClass_ARGS) {
200 end: MK_UNUSED /* LONG JUMP on error */
202}
203
214
216static OT_ProcRet NS(MkRuntimeC_LogTargetSet) (OtClass_ARGS) {
219 MK_STRN logTgt = 0;
224 end: MK_UNUSED /* LONG JUMP on error */
226}
227
229static OT_ProcRet NS(MkRuntimeC_NoDecoSet) (OtClass_ARGS) {
232 MK_BOOL noDeco = 0;
235 MkRuntimeNoDecoSet (noDeco);
237 end: MK_UNUSED /* LONG JUMP on error */
239}
240
242// MkRuntimeC_Config_RB_API
243
247
248// doc-key: MkRuntimeC,MkRuntimeC-Info,sm_
249
251static OT_ProcRet NS(MkRuntimeC_Log0) (OtClass_ARGS) {
254 MK_OBJN fmtobj = NULL;
256 MK_DBG debug = 0;
258 MK_STRN callfunc = NULL;
260 MK_I32 lvl = 0;
263 if (debug > MkRuntimeDebugGet()) {
265 goto end;
266 }
267 if (MkSysStringIsNULL(callfunc)) {callfunc = OT_GET_CALL_PROC;}
268 MkRuntimeLog0 (fmtobj, debug, callfunc, lvl);
270 end: MK_UNUSED /* LONG JUMP on error */
273}
274
276// MkRuntimeC_Info_RB_API
277
278// END-MkRuntimeC - created by 'rb_MqC.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
279
280/*****************************************************************************/
281/* */
282/* public */
283/* */
284/*****************************************************************************/
285
286void NS(sMark) (MK_PTR ptr) {
287}
288
289void MK(MkRuntimeC_Init) (MK_RT_ARGS_ONLY) {
290
291 // init type
293 S_INIT;
294
295// BEGIN-CLASS - created by 'rb_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
296
297// doc-key: MkRuntimeC,MkRuntime,sm_
298OT_METH_O ( MkRuntimeC, DebugGet, MkRuntimeC_DebugGet )
299OT_METH_S ( MkRuntimeC, DebugGet, MkRuntimeC_DebugGet )
300OT_METH_O ( MkRuntimeC, DebugSet, MkRuntimeC_DebugSet )
301OT_METH_S ( MkRuntimeC, DebugSet, MkRuntimeC_DebugSet )
302OT_METH_O ( MkRuntimeC, ErrorGetCode, MkRuntimeC_ErrorGetCode )
303OT_METH_S ( MkRuntimeC, ErrorGetCode, MkRuntimeC_ErrorGetCode )
304OT_METH_O ( MkRuntimeC, IsSilentGet, MkRuntimeC_IsSilentGet )
305OT_METH_S ( MkRuntimeC, IsSilentGet, MkRuntimeC_IsSilentGet )
306OT_METH_O ( MkRuntimeC, IsSilentSet, MkRuntimeC_IsSilentSet )
307OT_METH_S ( MkRuntimeC, IsSilentSet, MkRuntimeC_IsSilentSet )
308OT_METH_O ( MkRuntimeC, Log0, MkRuntimeC_Log0 )
309OT_METH_S ( MkRuntimeC, Log0, MkRuntimeC_Log0 )
310OT_METH_O ( MkRuntimeC, LogTargetGet, MkRuntimeC_LogTargetGet )
311OT_METH_S ( MkRuntimeC, LogTargetGet, MkRuntimeC_LogTargetGet )
312OT_METH_O ( MkRuntimeC, LogTargetReset, MkRuntimeC_LogTargetReset )
313OT_METH_S ( MkRuntimeC, LogTargetReset, MkRuntimeC_LogTargetReset )
314OT_METH_O ( MkRuntimeC, LogTargetSet, MkRuntimeC_LogTargetSet )
315OT_METH_S ( MkRuntimeC, LogTargetSet, MkRuntimeC_LogTargetSet )
316OT_METH_O ( MkRuntimeC, NoDecoSet, MkRuntimeC_NoDecoSet )
317OT_METH_S ( MkRuntimeC, NoDecoSet, MkRuntimeC_NoDecoSet )
318
319// END-CLASS - created by 'rb_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
320
321// BEGIN-OBJ - created by 'rb_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
322
323// → no data
324
325// END-OBJ - created by 'rb_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
326
327}
tag: nhi1-release-250425
#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)
#define OT_NEW_Mk_enum_OBJ(typ, i)
#define PTR2VAL(nat)
#define OT_CHECK_NI4(val)
#define OT_PKG
#define OT_METH_S(c, s, f)
#define MK_BASE_CLASS
#define OT_CLS_T
#define OT_FRAME_CLEANUP
#define OT_CHECK_REQUIRED(val)
#define OT_retObj_SET_None
#define OT_retObj_SET_I32(nat)
#define OT_METH_O(c, s, f)
#define INCR_REF(valP)
#define OT_OBJ_T
#define NS(n)
#define MkRuntimeC_MK_NULL
#define OT_retObj_RETURN
#define OT_GET_CALL_PROC
#define OT_OBJECT_DELETE_HARD(obj)
#define OT_retObj_SET_STR(nat)
#define OT_CHECK_OPTIONAL(val)
#define OT_retObj_SET(val)
#define VAL2PTR(val)
#define OT_CHECK_NOARGS
#define MkErrorC_Check(mng, PROC)
#define OT_ProcRet
#define OtClass_ARGS
#define OT_CHECK_STRN(val)
#define ErrorGetCode_doc
#define Log0_doc
#define IsSilentGet_doc
#define IsSilentSet_doc
#define NoDecoSet_doc
static MK_TYP MkRuntimeCTT
#define LogTargetReset_doc
#define OT_CLASS
#define OT_SETUP_hdl_static
#define DebugGet_doc
#define S_INIT
#define DebugSet_doc
#define LogTargetGet_doc
#define LogTargetSet_doc
#define MK_ERROR_FORMAT
#define mk_inline
#define MK_NULL_YES
flag, allow NULL
#define MK_UNUSED
mark unnused variables and functions
#define MK_NULL
The Programming-Language-Micro-Kernel (PLMK) NULL value as nil in Ruby …
MK_PTRB * MK_PTR
generic pointer data-type
const MK_STRB * MK_STRN
constant string pointer data-type
MK_PTRB * MK_MNG
managed object pointer, datatype will be checked at runtime
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 MkRuntimeC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …
#define MkRuntimeC_T
class as MkTypeDefS-class-type, useable in a class-macro as: class##_T …
#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 MK_RT_ARGS
#define MK_RT_ARGS_ONLY
#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...
MkSelfUnlinkF selfUnlink
"unlink" the "self" pointer from META-Kernel
MkSelfDeleteF selfDelete
"delete" the "self" pointer
MkSelfCreateF selfCreate
"create" the "self" pointer