theKernel 10.0
Loading...
Searching...
No Matches
MkLogFileC_py.c
Go to the documentation of this file.
1
9/* LABEL-START */
10
11#define META_FILE_NAME "MkLogFileC_py.c"
12
14
15// PY class
16#define OT_CLASS (&NS(MkLogFileCR))
17#define OT_CLASS_NAME "MkLogFileC"
18
19#define OT_LNG2META(O) MkLfl(VAL2MNG(O))
20
21#define OT_retObj_CONSTR(mng) OT_retObj_SET(NS(MkLogFileC_CTOR)(MK_RT_CALL (PyTypeObject*)class,mng))
22
23#define OT_SETUP_hdl OT_SETUP_hdl_tmpl(MkLogFileC)
24#define OT_SETUP_hdl__null_allow OT_SETUP_hdl_tmpl__null_allow(MkLogFileC)
25#define OT_SETUP_hdl_constr MK_RT_UNUSED AllRtSetup_NULL; \
26 MK_LFL hdl = (MK_LFL) OT_CLASS;
27#define OT_SETUP_hdl_destr OT_SETUP_hdl_tmpl__null_allow(MkLogFileC)
28#define OT_SETUP_hdl_static MK_RT_UNUSED AllRtSetup_NULL; \
29 __attribute__((unused)) MK_TYP hdl = MkLogFileC##_TT;
30
31#define OT_SETUP_hdl_static_constr OT_SETUP_hdl_static
32
33#if !defined(SetupRtFromObj_X)
34 #define SetupRtFromObj_X(hdl) AllRtSetup_X(hdl)
35 #define SetupRtFromObj_XN(hdl) AllRtSetup_XN(hdl)
36#endif
37
38// MO class
39#undef MkLogFileCTT
40#define MkLogFileCTT MK(MkKernelThreadState).MkLogFileCTT
41/* MkLogFileC_MK_NULL defined in LibMkKernel_py.h */
42
43__attribute__((unused)) mk_inline
44OT_OBJ_T NS(MkLogFileC_CTOR) (MK_RT_ARGS OT_CLS_T type, MK_LFL hdl) {
45 return MK(AtomCreate)(MK_RT_CALL type,MkLogFileC_X2obj(hdl));
46}
47
48// helper: mk_dbg_color_ln(MK_COLOR_YELLOW,"hdl<%p>, self<%p>", obj, self);
49
50// META: ObjNew feature: selfCreate will be called from "ObjNew->MkSelfNew" if MkObj need a SELF pointer
51static MK_PTR NS(MkLogFileC_selfCreate) (MK_RT_ARGS MK_OBJ const obj, MK_PTR const env) {
52 return MK(AtomCreate) (MK_RT_CALL OT_CLASS,obj);
53}
54// META: called if MkObj must be destroyed and if the SELF is still alive → goal: destroy the SELF
55static void NS(MkLogFileC_selfDelete) (MK_RT_ARGS MK_PTR self, MK_PTR const env) {
56 MK(AtomDeleteHard) (MK_RT_CALL OT_SELF);
57}
58// META: called to destroy link from SELF to META
59static void NS(MkLogFileC_selfUnlink) (MK_RT_ARGS MK_PTR self, MK_PTR const env) {
60 MkObjectC_Obj *selfO = (MkObjectC_Obj*) self;
61 selfO->hdl = NULL;
62}
63
64// initialize the PY and MO class specific object
65#define ClassInit \
66 /* if not already done, initialize NEW META type */ \
67 if (MkLogFileCTT == NULL) MkLogFileCTT = MkLogFileSTT; \
68 \
69 /* protect against double call */ \
70 if (MkLogFileCTT->selfCreate == NS(MkLogFileC_selfCreate)) return MK_OK; \
71 \
72 /* add "selfCreate" and "selfDelete" feature to the META-Class */ \
73 MkLogFileCTT->selfCreate = NS(MkLogFileC_selfCreate); \
74 MkLogFileCTT->selfDelete = NS(MkLogFileC_selfDelete); \
75 MkLogFileCTT->selfUnlink = NS(MkLogFileC_selfUnlink); \
76 \
77 if (!PyType_HasFeature(OT_CLASS,Py_TPFLAGS_READY)) { \
78 NS(MkLogFileCR).tp_base = MkLogFileC_base; \
79 OtErrorCheckLng (PyType_Ready(OT_CLASS)); \
80 } \
81 OtErrorCheckLng(PyModule_AddObjectRef(m, "MkLogFileC", (PyObject *)OT_CLASS)); \
82 \
83 /* define the "NULL" object */ \
84 MkLogFileC_MK_NULL = Py_NewRef(MK(AtomCreate) (MK_RT_CALL OT_CLASS, NULL /*obj*/));
85
86/* LABEL-END */
87
88#define META_CONTEXT_S hdl->error
89
95
96// BEGIN-DOC - created by 'py_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
97
98// doc-key: MkLogFileC,MkLogFile,sCo,func
99#define Open_doc "MkLogFileC MkLogFileC.Open(fmtobj:MkObjectC, file:string)"
100#define new_doc "MkLogFileC MkLogFileC.new(fmtobj:MkObjectC, file:string)"
101
102// doc-key: MkLogFileC,MkLogFile,sc_,func
103#define GetNull_doc "MkLogFileC MkLogFileC.GetNull()"
104#define HandleResolve_doc "MkLogFileC MkLogFileC.HandleResolve(netHdl:MK_HDL)"
105#define Instances_doc "MkLogFileC MkLogFileC.Instances()"
106
107// doc-key: MkLogFileC,MkLogFile,oc_,func
108#define Next_doc "MkLogFileC lfl.Next()"
109#define Prev_doc "MkLogFileC lfl.Prev()"
110
111// doc-key: MkLogFileC,MkLogFile,om_,func
112// skip class-overload: HandleGet → MkObjectHandleGet
113#define WriteC_doc "lfl.WriteC(text:string) (const)"
114
115// doc-key: MkLogFileC,MkLogFile,omo,func
116#define GetFile_doc "string lfl.GetFile() (const)"
117
118// END-DOC - created by 'py_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
119
125
128
129// vim: Marker(s)
130// BEGIN-MkLogFileC - created by 'py_MqC.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
131
135
136// doc-key: MkLogFileC,MkLogFileC-Class-Export,sc_
137
139static OT_ProcRet NS(MkLogFileC_HandleResolve) (OtClass_ARGS) {
142 MK_HDL netHdl = 0;
145 MK_LFL retVal = MkLogFileHandleResolve (netHdl);
146 OT_retObj_SET_LFL(retVal);
147 goto end;
148 error:
150 end:
152}
153
154// doc-key: MkLogFileC,MkLogFileC-Class-Export,om_
155
156// skip on class-overload: MkLogFileHandleGet → MkObjectHandleGet
158static OT_ProcRet NS(MkLogFileC_HandleGet) (MkLogFileC_ARGS) {OT_ERROR_LNG_RETURN;}
159
161// MkLogFileC_Class_PY_API
162
166
167// doc-key: MkLogFileC,MkLogFileC-Class-Introspection,oc_
168
170static OT_ProcRet NS(MkLogFileC_Next) (MkLogFileC_ARGS) {
174 MK_LFL retVal = MkLogFileNext (hdl);
175 OT_retObj_SET_LFL(retVal);
176 goto end;
177 error:
179 end:
181}
182
184static OT_ProcRet NS(MkLogFileC_Prev) (MkLogFileC_ARGS) {
188 MK_LFL retVal = MkLogFilePrev (hdl);
189 OT_retObj_SET_LFL(retVal);
190 goto end;
191 error:
193 end:
195}
196
197// doc-key: MkLogFileC,MkLogFileC-Class-Introspection,sc_
198
200static OT_ProcRet NS(MkLogFileC_Instances) (OtClass_ARGS) {
204 MK_LFL retVal = MkLogFileInstances ();
205 OT_retObj_SET_LFL(retVal);
206 goto end;
207 error:
209 end:
211}
212
214// MkLogFileC_Class_PY_API
215
219
220// doc-key: MkLogFileC,MkLogFileC-Class-Misc,sc_
221
223static OT_ProcRet NS(MkLogFileC_GetNull) (OtClass_ARGS) {
227 MK_LFL retVal = MkLogFileGetNull ();
228 OT_retObj_SET_LFL(retVal);
229 goto end;
230 error:
232 end:
234}
235
237// MkLogFileC_Class_PY_API
238
242
243// doc-key: MkLogFileC,MkLogFileC-TOR,sCo
244
246static OT_ProcRet NS(MkLogFileC_Open) (OtClass_ARGS) {
249 MK_OBJN fmtobj = NULL;
251 MK_STRN file = 0;
254 MK_LFL lfh_out;
255 MkErrorC_Check(fmtobj,MkLogFileOpen (fmtobj, file, &lfh_out));
256 OT_CONSTRUCTOR_POST(lfh_out)
257 OT_retObj_SET_LFL(lfh_out);
258 goto end;
259 error:
261 end:
263}
264
266static OT_ProcRet NS(MkLogFileC_new) (CONSTR_ARGS) {
269 MK_OBJN fmtobj = NULL;
271 MK_STRN file = 0;
273 MK_LFL lfh_out;
274 MkErrorC_Check(fmtobj,MkLogFileOpen (fmtobj, file, &lfh_out));
275 OT_CONSTRUCTOR_POST(lfh_out)
276 OT_retObj_CONSTR(lfh_out);
277 goto end;
278 error:
280 end:
282}
283
285// MkLogFileC_TOR_PY_API
286
290
291// doc-key: MkLogFileC,MkLogFileC-Write,om_
292
294static OT_ProcRet NS(MkLogFileC_WriteC) (MkLogFileC_ARGS) {
297 MK_STRN text = 0;
300 MkErrorC_Check(hdl,MkLogFileWriteC (hdl, text));
302 goto end;
303 error:
305 end:
307}
308
309// doc-key: MkLogFileC,MkLogFileC-Write,omo
310
312static OT_ProcRet NS(MkLogFileC_GetFile) (MkLogFileC_ARGS) {
316 MK_STRN file_out;
317 MkErrorC_Check(hdl,MkLogFileGetFile (hdl, &file_out));
318 OT_retObj_SET_STR(file_out);
319 goto end;
320 error:
322 end:
324}
325
327// MkLogFileC_Write_PY_API
328
329// END-MkLogFileC - created by 'py_MqC.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
330
332
338
339static PyMethodDef NS(MkLogFileC_Methods)[] = {
340
341 // BEGIN-CLASS - created by 'py_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
342
343 // doc-key: MkLogFileC,MkLogFile,sCo
344 { "Open" , (PyCFunction) NS(MkLogFileC_Open) , METH_VARARGS|METH_CLASS , Open_doc },
345
346 // doc-key: MkLogFileC,MkLogFile,sc_
347 { "GetNull" , (PyCFunction) NS(MkLogFileC_GetNull) , METH_NOARGS|METH_CLASS , GetNull_doc },
348 { "HandleResolve" , (PyCFunction) NS(MkLogFileC_HandleResolve) , METH_O|METH_CLASS , HandleResolve_doc },
349 { "Instances" , (PyCFunction) NS(MkLogFileC_Instances) , METH_NOARGS|METH_CLASS , Instances_doc },
350
351 // END-CLASS - created by 'py_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
352
353 // BEGIN-OBJ - created by 'py_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
354
355 // doc-key: MkLogFileC,MkLogFile,oc_
356 { "Next" , (PyCFunction) NS(MkLogFileC_Next) , METH_NOARGS , Next_doc },
357 { "Prev" , (PyCFunction) NS(MkLogFileC_Prev) , METH_NOARGS , Prev_doc },
358
359 // doc-key: MkLogFileC,MkLogFile,om_
360 // skip class-overload: MkLogFileHandleGet → HandleGet, NS(MkLogFileC_HandleGet)
361 { "WriteC" , (PyCFunction) NS(MkLogFileC_WriteC) , METH_O , WriteC_doc },
362
363 // doc-key: MkLogFileC,MkLogFile,omo
364 { "GetFile" , (PyCFunction) NS(MkLogFileC_GetFile) , METH_NOARGS , GetFile_doc },
365
366 // END-OBJ - created by 'py_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
367
368 {NULL, NULL, 0, NULL} /* Sentinel */
369};
370
376
378 PyVarObject_HEAD_INIT(NULL, 0)
379 .tp_name = "pymkkernel.MkLogFileC",
380 .tp_doc = "PyMkKernel MkLogFileC Type",
381 .tp_basicsize = sizeof(MkLogFileC_Obj),
382 .tp_itemsize = 0,
383 .tp_new = NS(MkLogFileC_new),
384 .tp_methods = NS(MkLogFileC_Methods),
385 .tp_flags = Py_TPFLAGS_DEFAULT,
386 .tp_base = NULL
387 };
388
389int NS(pMkLogFileC_Init) ( MK_RT_ARGS PyObject* m)
390{
391
393
394 return 0;
395error:
396 return -1;
397}
398
399// vim: nowrap
tag: nhi1-release-250425
#define OT_SELF
#define MK(n)
#define OT_SETUP_VARARGS(min, max, d)
#define OT_SETUP_NOARG(d)
#define OT_SETUP_ONEARG(d)
#define OT_retObj_SET_LFL(nat)
#define OT_ERROR_LNG_RETURN
#define OT_retObj_SET_Error
struct MkLogFileC_Obj MkLogFileC_Obj
#define OT_CONSTRUCTOR_POST(x)
#define MkLogFileC_ARGS
#define OT_CHECK_REQUIRED(val)
#define OT_retObj_SET_None
PyTypeObject * OT_CLS_T
#define NS(n)
#define OT_SETUP_CONSTRUCTOR_ARGS(...)
#define OT_retObj_RETURN
PyObject * OT_OBJ_T
#define OT_retObj_SET_STR(nat)
#define OT_CLASS_TYPE_REF
#define OT_CHECK_OPTIONAL(val)
#define OT_CHECK_NOARGS
#define MkErrorC_Check(mng, PROC)
#define OT_ProcRet
#define CONSTR_ARGS
#define OtClass_ARGS
#define OT_CHECK_STRN(val)
#define Instances_doc
#define OT_SETUP_hdl_static_constr
#define OT_SETUP_hdl
#define OT_retObj_CONSTR(mng)
#define GetFile_doc
#define GetNull_doc
#define WriteC_doc
#define Next_doc
#define HandleResolve_doc
#define Prev_doc
#define OT_CLASS
#define OT_SETUP_hdl_static
#define OT_SETUP_hdl_constr
#define OT_SETUP_hdl__null_allow
#define new_doc
#define ClassInit
#define Open_doc
#define mk_inline
#define MK_NULL_YES
flag, allow NULL
#define MK_UNUSED
mark unnused variables and functions
#define MK_DEPRECATED
MK_PTRB * MK_PTR
generic pointer data-type
const MK_STRB * MK_STRN
constant string pointer data-type
int32_t MK_HDL
4 byte int handle data-type
#define MkLogFileHandleResolve(...)
static MK_LFL MkLogFilePrev(MK_LFL const lfl)
get previous instance from linked-list of MkLogFileS type
#define MkLogFileInstances()
static MK_LFL MkLogFileNext(MK_LFL const lfl)
get next instance from linked-list of MkLogFileS type
static MK_LFL MkLogFileGetNull(void)
Null-Slot - return a MkLogFileC typed NULL instance …
#define MkLogFileC_X2obj(x)
#define MkLogFileOpen(...)
#define MkLogFileGetFile(...)
#define MkLogFileWriteC(...)
#define MK_RT_CALL
#define MK_RT_ARGS
#define OT_CHECK_NIH(val)
#define OT_CHECK_OBJN(val, nullB)
define a MkLogFileC object …
PyObject_HEAD MK_OBJ hdl
object header …