theKernel 10.0
Loading...
Searching...
No Matches
LibMkKernel_mk.h
Go to the documentation of this file.
1
9/* LABEL-NO */
10
11#ifndef KERNEL_MK_H
12#define KERNEL_MK_H
13
14// MARK_D ################################################################
15// -----------------------------------------------------------------------
16// documentation order
35
52
59
73
87
100
111
118
135
144
145// =========================================================================================
146// Config: configure definitions
147
148// define: META_HAS_THREAD
149// source: nhi1_config.h - set with the "configure" script
150// default: depend on how the LNG and libmkkernel was compiled
151// definition: 1. if defined the T)hread L)ocal S)torage is used.
152// 2. the "runtime" command-line-artgumen "mkrt" as FIRST parameter is set
153// 3. if "libmkkernel" was compiled with META_HAS_THREAD this have to be set as well.
154
155#ifndef META_HAS_THREAD
156 #error "META_HAS_THREAD was NOT defined, require 1 or 0, forget to include 'theKernel/c/compiler.mk' ?"
157#endif
158
159// =========================================================================================
160// Makefile: CPPFLAGS definitions
161
162// define: META_IGNORE_EXTERN
163// source: Makefile
164// default: not set
165// definition: If the source-code is direct used in an external library (example: C++)
166// (without dynamic linking) and this library should *not* export
167// the symbol's of libmsgque then the flag META_IGNORE_EXTERN have
168// to be set
169
170// define: META_COMPILE_AS_CC
171// source: Makefile, CPPFLAGS=-DMETA_COMPILE_AS_CC
172// target: "C" main header file like 'kernel_mk.h'
173// default: only set by "ccXXX" to compile "C" code as "C++" code with "namespace" support
174// definition: The preprocessor flag "META_COMPILE_AS_CC" is ONLY used together with the C++ compiler.
175// If the "META_COMPILE_AS_CC" flag is set, the C-code is not compiled into an independent library,
176// but translated directly into the C++ library together with the additional C++ code as C++ code in
177// the "libmkkernel" namespace. The difference is that the C code is additionally validated as "C++"
178// syntax and supports the C++ calling convention. Without "META_COMPILE_AS_CC" the C code is
179// compiled with "extern C" in the C++ compiler.
180//
181// The following changes are done:
182// 1. libmkkernel -> compile the code into "namespace libmkkernel"
183// 2. libmqmsgque -> compile the code into "namespace libmqmsgque"
184// 3. liblcconfig -> compile the code into "namespace liblcconfig"
185// 4. libsq3lite -> compile the code into "namespace libsq3lite"
186
187// =========================================================================================
188// Header: build control
189
190// define: MK_C_BUILD_DLL
191// source: Makefile
192// target: api-header and kernel_mk.h
193// default: set at build of the 'libmkkernel' library but NOT set for other libraries
194// definition: this define has two porpose:
195// 1. set the MK_EXTERN and MK_EXTERN_DATA to export of definition
196// 2. use the private definition of partly public struct's
197
198// =========================================================================================
199// Header: api definition
200
201// define: META_TIMEOUT_REF
202// source: api-header or Makefile
203// default: 900sec
204// definition: base timeout value - all other timeout will be calulated relative to this timeout
205
206#define META_TIMEOUT_REF 900 //< reference value for timeout… default: 15 min
207
208// define: META_HDL_USE__NONNULL__GCC_ATTRIBUTE
209// source: api-header or Makefile
210// target: api-header, check_mk.h
211// default: do NOT use "nonnull" attribute
212
213#define META_HDL_USE__NONNULL__GCC_ATTRIBUTE 0
214
215// define: META_ATTRIBUTE_SANITIZE
216// source: api-header or Makefile
217// target: msgque_mq.h
218// default: __attribute__((no_sanitize("address")))
219// definition: The C2GO compiler does NOT understand the 'no_sanitize("address")' attribute
220// -> use "-DMETA_ATTRIBUTE_SANITIZE=" at "env-build.sh: CGO_CFLAGS" to ignore it
221// The "sanitize" is set at "configure" with the "NHI1_SANITIZE" makefile definition and env-Variable
222#if !defined(META_ATTRIBUTE_SANITIZE)
223# define META_ATTRIBUTE_SANITIZE __attribute__((no_sanitize("address")))
224#endif
225
226// define: META_LOG_CLICKS
227// target: libmkkernel internal, logging additional clicks-timestamp
228// default: not set = no clicks-timestamp
229// action: add clicks-timestamp to output
230// definition: libmkkernel is using an verbose logging prefix to help debbugging
231// multi-thread/proc software - with META_LOG_CLICKS an additional
232// column with "clicks" data is added
233// attention: debug_mk.h also needs the "META_LOG_CLICKS", but is usually loaded before msgque_mq.h
234
235//#if !defined(META_LOG_CLICKS)
236// #define META_LOG_CLICKS
237//#endif
238
239// define: META_PERF_DEBUG
240// target: libmkkernel internal, disable some inline to create better code for callgrind
241// default: not set = no performance debugging
242// action: add performance debugging features
243// definition: inline code is embedded into calling code, this is faster BUT make it impossible
244// to analyse a single inlined function for performance optimization
245
246//#define META_PERF_DEBUG
247
248// define: META_DISABLE_LOG
249// target: command-line definition for compiling
250// default: not set = show logging based on MkDLogC and MkDLogV
251// action: hide logging macros
252// definition: logging is done using so called logging-macros. if META_DISABLE_LOG is defined the logging-macros
253// will dissappear.
254
255//#define META_DISABLE_LOG
256
257// define: META_DOXYGEN_USE_C_PRIVAT
258// target: the doxygen configuration files.
259// default: yes=1 - on compillation, no=0 on documentation if NOT defined as 1
260// action: add / hide code and documentation
261// definition: use/hide private code/documentation from doxygen docu and compilation
262// the private code/documentation is only use in "C" compiling and documantation,
263// use this switch to hide this code/documentation from non "C" languages
264
265#ifndef META_DOXYGEN_USE_C_PRIVAT
266# ifdef META_DOXYGEN_SHOULD_SKIP_THIS
267# define META_DOXYGEN_USE_C_PRIVAT 0
268# else
269# define META_DOXYGEN_USE_C_PRIVAT 1
270# endif
271#endif
272
273// define: META_STATIC
274// target: build and target, library and executable
275// default: not set -> do NOT force static linking
276// action: build (static) internal and external library
277// definition: ...
278
279#ifdef META_STATIC
280# undef MK_C_BUILD_DLL
281# define MK_C_BUILD_DLL
282# undef META_IGNORE_EXTERN
283# define META_IGNORE_EXTERN
284#endif
285
286/* ############################################################### */
287/* ### MARK_U ### */
288/* ### DEBUGGING ### */
289/* ### ### */
290/* ############################################################### */
291
292#define META_DEBUG_ALL -1 /* The C standard guarantees that assigning -1 sets all bits. */
293#define META_DEBUG_DEFAULT (1<<1)
294#define META_DEBUG_CACHE (1<<2)
295#define META_DEBUG_TYPE (1<<3)
296 // define: META_DEBUG_TYPE
297 // target: meta library with type support
298 // default: depend on META_DEBUG -> add simple type debug code
299 // action: add extra type debug code
300 // definition: META_DEBUG == 0 -> NO debug
301 // META_DEBUG != 0 -> ADD debug but invisible
302 // META_DEBUG == META_DEBUG_TYPE -> ADD debug AND add extra logging, (only for a type debugging session)
303#define META_DEBUG_SOCKET (1<<4)
304#define META_DEBUG_EVENT (1<<5)
305#define META_DEBUG_MEM (1<<6)
306 // define: META_DEBUG_MEM
307 // target: libmkkernel internal, cache_mq.c etc
308 // default: not set = use the cache
309 // action: disable reuse of memory
310 // definition: libmkkernel is using the CACHE to reuse a deleted instance and memory.
311 // To debug the memory this "reuse" is a problem.
312#define META_DEBUG_REFCOUNT (1<<7)
313#define META_DEBUG_ERROR (1<<8)
314
315// set META_DEBUG
316//#undef META_DEBUG
317//#define META_DEBUG META_DEBUG_TYPE
318
319#if META_DEBUG & META_DEBUG_TYPE
320# define META_DEBUG_TYPE__printV(...) printV(__VA_ARGS__)
321#else
322# define META_DEBUG_TYPE__printV(...)
323#endif
324
326#if META_DEBUG & META_DEBUG_ERROR
327# define META_DEBUG_ERROR_check() META_DEBUG_ERROR_checkO(NULL)
328# define META_DEBUG_ERROR_checkX(x) META_DEBUG_ERROR_checkO(MkOBJ(x))
329# define META_DEBUG_ERROR_checkO(o) if (MkErrorCheckE_0E()) MkDbgError_RT(MK_RT_CALL o, __func__);
330#else
331# define META_DEBUG_ERROR_check()
332# define META_DEBUG_ERROR_checkX(x)
333# define META_DEBUG_ERROR_checkO(o)
334#endif
335
336#if !defined(PARSE_C_HEADER_TO_META) && META_DEBUG
337# include "debug_mk.h"
338#endif
339
342#if defined(META_DISABLE_LOG)
343 # define MkDCheck(_debug)
344 # define MkDLogC(x,_debug,str)
345 # define MkDLogV(x,_debug,printfmt,...)
346 # define MkDProtect(_debug) if (MK_RT_REF.debug < _debug) return
347 # define MkDProtect2(_debug,_call) if (MK_RT_REF.debug < _debug) return
348#else
349
350 # define MkDDInit const MK_I32 __dbg = MK_RT_REF.debug
351 # define MkDDInitNum(n) const MK_I32 __dbg = n
352
356# define MkDCheck(_debug) if (unlikely(MK_RT_REF.debug >= _debug))
357# define MkDDCheck(_debug) if (unlikely(__dbg >= _debug))
359
365# define MkDLogC_O(fmtobj,_debug,str) \
366 if (unlikely(MK_RT_REF.debug >= _debug)) MkLogC(fmtobj,str,_debug,__func__)
367
368# define MkDLogC(x,_debug,str) MkDLogC_O(MkOBJ(x),_debug,str)
369
370# define MkDDLogC(x,_debug,str) \
371 if (unlikely(__dbg >= _debug)) MkLogC_4X(x,str,_debug,__func__)
373
380# define MkDLogV_O(fmtobj,_debug,printfmt,...) \
381 if (unlikely(MK_RT_REF.debug >= _debug)) MkLogV(fmtobj,__func__,_debug,printfmt,__VA_ARGS__)
382
383# define MkDLogV(x,_debug,printfmt,...) MkDLogV_O(MkOBJ(x),_debug,printfmt,__VA_ARGS__)
384
385# define MkDDLogV(fmtobj,_debug,printfmt,...) \
386 if (unlikely(__dbg >= _debug)) MkLogV_4M(fmtobj,__func__,_debug,printfmt,__VA_ARGS__)
388
389 # define MkDProtect(_debug) if (MK_RT_REF.debug < _debug) { \
390 MkLogV_2(fmtobj,MK_COLOR_ORANGE "Warning: ignore call to '%s' with '%d'" MK_COLOR_RESET "\n", __func__, debug); \
391 printSTACK_1(fmtobj); \
392 return; \
393 }
394 # define MkDProtect2(_debug,_call) if (MK_RT_REF.debug < _debug) { \
395 MkLogV_2(fmtobj,MK_COLOR_ORANGE "Warning: ignore call to '%s' from '%s' with '%d'" \
396 MK_COLOR_RESET "\n", __func__, _call, debug); \
397 printSTACK_1(fmtobj); \
398 return; \
399 }
400#endif
402// MkObjectC_Log_C_API
403
404/*****************************************************************************/
405/* */
406/* add feature - used to compile 'libmkkernel' library itself */
407/* */
408/*****************************************************************************/
409
410// DOKU: MkObjectS->selfRefCount
411#define META_USE_SELF_REFCOUNT
412
413/* ############################################################### */
414/* ### ### */
415/* ### PARSER ### */
416/* ### ### */
417/* ############################################################### */
418
419// META_P
423
424// [__parser__]
425#ifndef __has_parser__
426
432
434# define __parser__(...)
436# define __parser__define__(...)
438
440# define __parser__push__(...)
442# define __parser__pop__
443
445// END: local attributes
446
452
454# define __parser__global__(...)
456# define __parser__global__define__(...)
460# define __parser__global__push__(...)
462# define __parser__global__pop__
463
465// END: global attributes
466
467#else
468# include "parser_mk.h"
469#endif
470// END: !__has_parser__
471// [__parser__]
472
474// MkKernel_Parser_C_API
475
476/* ############################################################### */
477/* ### ### */
478/* ### START ### */
479/* ### ### */
480/* ############################################################### */
481
485
486// =========================================================================
489
490__parser__(library=MkKernel@internal@Mk);
491
492// GLOBAL: all "fmtobj" arguments become attribute "formatter"
493__parser__global__(formatter=fmtobj);
495#define MK_PARSER_fmtobj MK_OBJN fmtobj __parser__(default=NULL)
496
497// GLOBAL: all "macros" become hide
498__parser__global__(hide-rx=^Mk\w+_T$);
499
501// END: global __parser__ definition
502
505#if defined(_MSC_VER)
506
507 // Visual C++ Express-Edition
508
509 # define __attribute__(dummy)
510 # define __func__ __FUNCTION__
511 # define MK_CLRCALL __clrcall
512 # define MK_STDCALL __stdcall
513 # define MK_CDECL __cdecl
514
515 // helper
516 # ifndef PARSE_C_HEADER_TO_META
517 # define mk_inline static inline
518 # endif
519 //# define bool int
520 # define mk_unlink _unlink
521 # define mk_snprintf _snprintf
522
523 # define MK_ATTR_HOT ???
524 # define MK_ATTR_COLD ???
525
526#else // !_MSC_VER
527
528 // GCC
529
530 # define MK_CLRCALL
531 # define MK_STDCALL
532 # define MK_CDECL
533
534 // helper
535 # ifndef PARSE_C_HEADER_TO_META
536 # define mk_inline static inline
537 # endif
538 # define mk_unlink unlink
539 # define mk_snprintf snprintf
540
541 # define MK_ATTR_HOT __attribute__((hot))
542 # define MK_ATTR_COLD __attribute__((cold))
543
544#endif // _MSC_VER
545
546#if defined(_MANAGED)
547 # define MK_DECL MK_CLRCALL
548#elif defined(META_COMPILE_AS_CC)
549 # define MK_DECL MK_STDCALL
550#else
551 # define MK_DECL MK_CDECL
552#endif
553
554/* BEGIN_MK_C_DECLS should be used at the beginning of your declarations,
555 so that C++ compilers don't mangle their names. Use END_MK_C_DECLS at
556 the end of C declarations. */
557
558#undef BEGIN_MK_C_DECLS
559#undef END_MK_C_DECLS
560#if defined(META_COMPILE_AS_CC)
561# define BEGIN_MK_C_DECLS namespace libmkkernel {
562# define END_MK_C_DECLS }
563#elif defined(__cplusplus)
564# define BEGIN_MK_C_DECLS extern "C" {
565# define END_MK_C_DECLS }
566#else
567# define BEGIN_MK_C_DECLS /* empty */
568# define END_MK_C_DECLS /* empty */
569#endif
570
571/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
572 a mechanism by which the user can annotate likely branch directions and
573 expect the blocks to be reordered appropriately. Define __builtin_expect
574 to nothing for earlier compilers. */
575
576#if defined(_MSC_VER) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
577 #define likely(x) !!(x)
578 #define unlikely(x) !!(x)
579 #else
580 #define likely(x) __builtin_expect((x),1)
581 #define unlikely(x) __builtin_expect((x),0)
582#endif
583
584#ifndef PARSE_C_HEADER_TO_META
585 # ifndef _MSC_VER
586 # include <inttypes.h>
587 # endif
588 # ifdef __CYGWIN__
589 # include <windef.h>
590 # endif
591 # include <stdarg.h>
592 # include <string.h>
593 # include <stdio.h>
594 # include <time.h>
595 # ifndef _MSC_VER
596 # include <unistd.h>
597 # include <stdbool.h>
598 # endif
599#endif
600
601#if defined(_WIN32) && !defined(__CYGWIN__)
602 # ifndef PARSE_C_HEADER_TO_META
603 # include <winsock2.h>
604 # endif
605
607 # define mk_timeval timeval
608
610 struct mk_timezone {
611 int tz_minuteswest;
612 int tz_dsttime;
613 };
614
615#else
616 # define mk_timeval timeval
617 # define mk_timezone timezone
618 struct mk_timeval;
619 struct mk_timezone;
620#endif
621
623#define MK_UNUSED __attribute__((unused))
625#define MK_NO_RETURN __attribute__((noreturn))
626#define MK_UNREACHABLE __builtin_unreachable()
627// https://stackoverflow.com/questions/20110291/use-cases-of-the-gcc-artificial-function-attribute
628#define MK_ARTIFICIAL __attribute__((__artificial__))
629// used for "pseudo" function declarartion (to support tags-file magic)
630#define MK_DEPRECATED __attribute__ ((deprecated))
631// disable optimization to get better code for debugging
632#define MK_OPTIMIZE_0 __attribute__((optimize("O0")))
633
634#ifndef PARSE_C_HEADER_TO_META
635 # include <assert.h>
636#endif
637
639// END: native compiler definition
640
642// END: MkKernel_Compiler_C_API
643
644// Namespace for the 'ccmkkernel' API …
646
647// ==============================================================================================
650
652typedef void* MK_MACRO_TYP;
653
659
692__parser__(ignore)
693#define MK_NULL NULL
694
696#define MK_NULL_YES true
697
699#define MK_NULL_NO false
700
704__parser__(ignore)
705#define MK_NULL_STR "MK_NULL"
706
710__parser__(ignore)
711#define MK_NULL_STR_LEN strlen(MK_NULL_STR)
712
720__parser__(ignore)
721mk_inline bool MK_NULL_STR_CHECK(char const * const __str, const long int __len) {
722 return ((__str) ? ( (__len) == MK_NULL_STR_LEN && strcmp((__str),MK_NULL_STR)==0 ) : true);
723}
724
726__parser__(ignore)
727mk_inline bool MK_NULL_STR_CHECK_1(char const * const __str) {
728 return ((__str) ? strcmp((__str),MK_NULL_STR)==0 : true);
729}
730
732__parser__(ignore)
733mk_inline bool MK_NULL_STR_OR_EMPTY_CHECK_1(char const * const __str) {
734 return ((__str) ? (__str)[0] == '\0' || strcmp((__str),MK_NULL_STR)==0 : true);
735}
736
738// name: MK_NULL
739
741// MkKernel_Compiler_C_API
742
743// ==============================================================================================
887#if META_HAS_THREAD
890 # define MkThreadLocal __thread
891 # define MK_RT_SHIFT 1
892 # define MK_RT_ARGS_ONLY MK_RT mkrt
893 # define MK_RT_ARGS MK_RT_ARGS_ONLY,
894 # define MK_RT_CALL_ONLY mkrt
895 # define MK_RT_CALL MK_RT_CALL_ONLY,
896 # define MK_RT_CALL_O(o) MkRT_O(o),
897 # define MK_RT_CALL_X(x) MkRT_X(x),
898 # define MK_RT_CALL_NULL_ONLY MkRT
899 # define MK_RT_CALL_NULL MK_RT_CALL_NULL_ONLY,
900 # define MK_RT_NULL NULL,
901 # define MK_RT_PTR mkrt
902 # define MK_RT_REF (*mkrt)
903 # define MK_RT_REF_NULL (MkRuntimeRLS)
904 # define MK_RT_UNUSED MK_UNUSED
905 # define MK_RT_CALL_RT(ptr) ptr,
906 # define MK_PARSER_RT_ONLY MK_RT_ARGS_ONLY __parser__(internal,default=N#RUNTIME)
907 # define MK_PARSER_RT MK_PARSER_RT_ONLY,
909#else
912 # define MkThreadLocal
913 # define MK_RT_SHIFT 0
914 # define MK_RT_ARGS_ONLY void
915 # define MK_RT_ARGS
916 # define MK_RT_CALL_ONLY
917 # define MK_RT_CALL
918 # define MK_RT_CALL_O(o)
919 # define MK_RT_CALL_X(x)
920 # define MK_RT_CALL_NULL_ONLY
921 # define MK_RT_CALL_NULL
922 # define MK_RT_NULL
923 # define MK_RT_PTR (&MkRuntimeRLS)
924 # define MK_RT_REF (MkRuntimeRLS)
925 # define MK_RT_REF_NULL (MkRuntimeRLS)
926 # define MK_RT_UNUSED
927 # define MK_RT_CALL_RT(ptr)
928 # define MK_PARSER_RT_ONLY void
929 # define MK_PARSER_RT
931#endif
932
933# define MK_RT_ATTR_FORMAT_1 __attribute__((format (printf, 1+MK_RT_SHIFT, 2+MK_RT_SHIFT)));
934# define MK_RT_ATTR_FORMAT_2 __attribute__((format (printf, 2+MK_RT_SHIFT, 3+MK_RT_SHIFT)))
935# define MK_RT_ATTR_FORMAT_4 __attribute__((format (printf, 4+MK_RT_SHIFT, 5+MK_RT_SHIFT)))
936
937// nonnull for runtime yesORno? → problem is C# (and propably go), because runtime is a C feature and getting a nonnull C Pointer
938// for every API call in C# is expensive. solution? → allow NULL and resolve the mkrt pointer in C
939# define __MK_ATTR_RT_RUNTIME // empty
940
941#if META_HDL_USE__NONNULL__GCC_ATTRIBUTE == 1
942 // with "nonnull" on HDL the assert disable itself
943 # define __MK_ATTR_RT_INSTANCE __attribute__((nonnull(1+MK_RT_SHIFT)))
944 # define __MK_ATTR_INSTANCE __attribute__((nonnull(1)))
945 # define MK_INSTANCE_HDL(x)
946#else
947 # define __MK_ATTR_RT_INSTANCE
948 # define __MK_ATTR_INSTANCE
949 # define MK_INSTANCE_HDL(x) assert(x!=NULL)
950#endif
951
952// ".h" file
953#define MK_ATTR_INSTANCE __MK_ATTR_INSTANCE
954#define MK_ATTR_RT_INSTANCE __MK_ATTR_RT_RUNTIME __MK_ATTR_RT_INSTANCE
955#define MK_ATTR_STATIC __parser__(static)
956#define MK_ATTR_RT_STATIC __MK_ATTR_RT_RUNTIME __parser__(static) // in func: MQ_STATIC_RT
957
958// ".c" file
959#define MK_INSTANCE_RT_X(x) MK_INSTANCE_HDL(x); MkRtSetup_XN_RT(x); META_DEBUG_ERROR_checkX(x)
960#define MK_INSTANCE_RT_X_NULL(x) MkRtSetup_X_RT(x); META_DEBUG_ERROR_checkX(x)
961#define MK_INSTANCE_RT_O(o) MK_INSTANCE_HDL(o); MkRtSetup_ON_RT(o); META_DEBUG_ERROR_checkO(o)
962#define MK_INSTANCE_RT_O_NULL(o) MkRtSetup_O_RT(o); META_DEBUG_ERROR_checkO(o)
963#define MK_DESTRUCTOR_RT_X(c,x) MK_INSTANCE_HDL(x); \
964 if (!MkCheckNN(c,x)) return; /* do NOT delete an invalid pointer */ \
965 MkRtSetup_XN_RT(x); META_DEBUG_ERROR_check()
966#define MK_STATIC_RT MkRtSetup_NULL_RT; META_DEBUG_ERROR_check()
967
968// example: probably future enhancement on class/method definition
969// #define MK_INLINE_RT_STATIC(func,...) mk_inline MK_ATTR_RT_STATIC func##_RT (MK_PARSER_RT __VA_ARGS__)
970
972// MkRuntimeC_Interface_C_API
973
974// MARK_O
975#ifndef PARSE_C_HEADER_TO_META
976 # include "gen/kernel_overload_mk.h"
977#endif
978
1045/*****************************************************************************/
1046/* */
1047/* compiler and os definition */
1048/* */
1049/*****************************************************************************/
1050
1053
1054// on windows using the 'native' compiler 'cl.exe' we have to define some missing symbols
1055#if defined(_MSC_VER) && defined(_DLL)
1056 # undef PIC
1057 # define PIC
1058 # undef DLL_EXPORT
1059 # define DLL_EXPORT
1060#endif
1061
1062#ifdef META_IS_WINDOWS
1063 # define META_DIR_SEPARATOR '\\'
1064 # define META_EOL "\r\n"
1065#else
1066 # define META_DIR_SEPARATOR '/'
1067 # define META_EOL "\n"
1068#endif
1069
1070// BEGIN-HEADER - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1071
1072// If the source of libmkkernel is direct used in an external library
1073// (without dynamic linking) and this library should *not* export
1074// the symbol's of libmkkernel then the flag META_IGNORE_EXTERN have
1075// to be set
1076#undef MK_EXTERN
1077#if defined(META_IGNORE_EXTERN)
1078# define MK_EXTERN
1079#elif defined(PIC)
1080 // does we build a DLL ?
1081# if defined(DLL_EXPORT)
1082 // does we build the libmkkernel library ?
1083# if defined(MK_C_BUILD_DLL)
1084# define MK_EXTERN __declspec(dllexport)
1085# else
1086# define MK_EXTERN __declspec(dllimport)
1087# endif
1088# else
1089 // no DLL - architecture specific extern specifier
1090# define MK_EXTERN __attribute__ ((visibility("default")))
1091# endif
1092#else
1094# define MK_EXTERN
1095#endif
1096
1097// external data lookup
1098#undef MK_EXTERN_DATA
1099#if defined(META_PRIVATE)
1100# define MK_EXTERN_DATA extern
1101#elif defined(META_IGNORE_EXTERN)
1102# define MK_EXTERN_DATA extern
1103#elif defined(PIC)
1104 // does we build a DLL ?
1105# if defined(DLL_EXPORT)
1106 // does we build the libmkkernel library ?
1107# if defined(MK_C_BUILD_DLL)
1108# define MK_EXTERN_DATA __declspec(dllexport)
1109# else
1110# define MK_EXTERN_DATA __declspec(dllimport)
1111# endif
1112# else
1113 // no DLL - architecture specific extern specifier
1114# define MK_EXTERN_DATA __attribute__ ((visibility("default"))) extern
1115# endif
1116#else
1117# define MK_EXTERN_DATA extern
1118#endif
1119
1120// END-HEADER - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1121
1123#define MK_CPPXSTR(s) MK_CPPSTR(s)
1125#define MK_CPPSTR(s) #s
1127#define MK_CONCAT(a,b) a ## b
1128#define MK_CONCAT2(a,b) MK_CONCAT(a,b)
1129#define MK_CONCAT3(a,b,c) a ## b ## c
1130
1132#ifdef HAVE_STPCPY
1133 #define mk_append_fix_str(t,s) t=stpcpy(t,s)
1134#else
1135 #define mk_append_fix_str(t,s) t=strcpy(t,s)+sizeof(s)-1
1136#endif
1137
1139#define mk_bit_compare(t,f) (t&f)==f
1140
1142// MkKernel_Compiler_C_API
1143
1144/* MARK_T ********************************************************************/
1145/* */
1146/* types/generic */
1147/* */
1148/*****************************************************************************/
1149
1153
1154struct MkErrorS;
1155struct MkBufferListS;
1156struct MkBufferS;
1157union MkBufferU;
1158struct MkObjectS;
1159struct MkAllocS;
1160struct MkTypeS;
1161struct MkTypeDefS;
1162
1164#define MK_ALFA '@'
1166#define MK_ALFA_STR ((MkStringR){1,"@"})
1167
1168// ----------------------------------------------------------------------------------
1169
1172
1174__parser__(type=ME_NB1_MK_BOL:"1 byte 'boolean' data-type")
1175typedef unsigned char MK_BOL;
1176
1177// hint: bool into printf %B → https://stackoverflow.com/questions/17307275/what-is-the-printf-format-specifier-for-bool
1179__parser__(type=ME_NB0_MK_BOOL:"'boolean' data-type":primary)
1180typedef bool MK_BOOL;
1181#define bool2str(_bool) (_bool?"true":"false")
1182
1184
1185// ----------------------------------------------------------------------------------
1186
1189
1191__parser__(type=ME_NI1_MK_I8:"1 byte 'byte' data-type")
1192typedef signed char MK_I8;
1194__parser__(type=ME_NI2_MK_I16:"2 byte 'short integer' data-type":primary:int16_t)
1195typedef signed short int MK_I16;
1197__parser__(type=ME_NI4_MK_I32:"4 byte 'integer' data-type":primary:int32_t)
1198typedef signed int MK_I32;
1200#if defined(_MSC_VER)
1201 typedef __int64 MK_I64;
1202 typedef long MK_SIZE;
1203#else
1204 __parser__(type=ME_NI8_MK_I64:"8 byte 'wide integer' data-type":primary:int64_t)
1205 typedef signed long long MK_I64;
1206#endif
1208__parser__(type=ME_NIL_MK_LONG:"4/8 byte 'long' data-type":primary)
1209// TODO → make MK_LONG network save
1210typedef long MK_LONG;
1211
1213
1214// ----------------------------------------------------------------------------------
1215
1218
1219__parser__(type=ME_NU1_MK_U8:"1 byte 'unsigned byte' data-type":primary:uint8_t)
1220typedef unsigned char MK_U8;
1221__parser__(type=ME_NU2_MK_U16:"2 byte 'unsigned short' data-type":primary:uint16_t)
1222typedef unsigned short MK_U16;
1223__parser__(type=ME_NU4_MK_U32:"4 byte 'unsigned integer' data-type":primary:uint32_t)
1224typedef unsigned int MK_U32;
1225__parser__(type=ME_NU8_MK_U64:"8 byte 'unsigned wide' data-type":primary:uint64_t)
1226typedef unsigned long long MK_U64;
1227//__parser__(type=ME_NUX_MK_UXN:"min 8 byte 'unsigned long long' data-type":primary)
1228//typedef unsigned long long MK_UXN;
1229__parser__(type=ME_NUL_MK_ULN:"8 byte 'unsigned long' data-type":primary)
1230typedef unsigned long MK_ULN;
1232
1233// ----------------------------------------------------------------------------------
1234
1237
1239__parser__(type=ME_NF4_MK_FLT:"4 byte 'float' data-type":primary)
1240typedef float MK_FLT;
1242__parser__(type=ME_NF8_MK_DBL:"8 byte 'double' data-type":primary)
1243typedef double MK_DBL;
1244
1246
1247// ----------------------------------------------------------------------------------
1248
1252
1263__parser__(type=ME_NIH_MK_HDL:"handle data-type")
1264// also change: MqHigh_jv.c=jint
1265typedef int32_t MK_HDL;
1266#define MK_HDL_REF_S3(__prefix) __prefix ## NI4
1267#define MK_HDL_REF_S1(__prefix) __prefix ## I32
1268#define MK_HDLT MK_I32T
1269
1270// OLD: internal \b hdl used in uplevel-programming-language-shell to store a pointer:
1271// OLD: \li \e java uses \b jlong equal to \RMKNS{LONG}
1272// OLD: \li \e csharp uses \b IntPtr equal to \RMKNS{PTR}
1273// OLD: typedef MK_PTRB *MK_HDL;
1274
1276
1277// ----------------------------------------------------------------------------------
1278
1281
1282__parser__(type=ME_NIL_MK_SIZE:"long byte 'size' datay-type")
1283// choose "long" because it have to fit a pointer-diff (eg: ptr1-ptr2) without cast
1284typedef long MK_SIZE;
1286__parser__(type=ME_RUA_MkBufferAtomU:"atomic native data buffer type")
1287typedef union MkBufferAtomU MK_ATO;
1291__parser__(type=ME_NI4_MK_NUM)
1292typedef int32_t MK_NUM;
1293#define MK_FORMAT_N "%i"
1294
1296__parser__(type=ME_NI4_MK_DBG:"debug-level data-type")
1297typedef int MK_DBG;
1298
1357__parser__(type=ME_NU4_MK_SIG)
1358typedef unsigned int MK_SIG;
1359
1361
1362// ----------------------------------------------------------------------------------
1363
1367__parser__(type=ME_NIL_MK_TIME_T:"time [sec] data-type")
1368typedef time_t MK_TIME_T;
1369#define MK_FORMAT_TIME "%li"
1370#define MK_TIME ((MK_TIME_T)time(NULL))
1371#define MK_TIME_MAX (365*24*60*60)
1373
1374// ----------------------------------------------------------------------------------
1375
1378
1379// attention: "google go" can not uses nested typedef's -> use "#define" for the basic types
1380
1382__parser__(type=ME_PVB_MK_PTRB:"pointer type data-type")
1383typedef void MK_PTRB;
1384
1386__parser__(type=ME_PVX_MK_PTR:"generic pointer data-type":primary)
1389__parser__(type=ME_PVN_MK_PTRN:"const generic pointer data-type":primary)
1390typedef const MK_PTRB *MK_PTRN;
1392__parser__(type=ME_PCX_MK_CCP:"class constructor/destructor data type")
1395__parser__(type=ME_PAX_MK_CBP:"generic pointer to call-back data")
1398__parser__(type=ME_CXC_MK_MNG:"managed object pointer; datatype will be checked at runtime")
1401__parser__(type=ME_CXN_MK_MNGN:"const - a managed object pointer; datatype will be checked at runtime")
1402typedef const MK_PTRB *MK_MNGN;
1404__parser__(type=ME_PEX_MK_EXP:"target language exception-class-object")
1405typedef MK_PTRB const *MK_EXP;
1407__parser__(type=ME_CXC_MkExceptionC:"target language library-exception-class-object")
1409
1411
1412// ----------------------------------------------------------------------------------
1413
1416
1418__parser__(type=ME_PLB_MK_LSTB:"list type data-type")
1419typedef unsigned char MK_LSTB;
1420
1422__parser__(type=ME_PLX_MK_LST:"list pointer data-type")
1424
1426
1427// ----------------------------------------------------------------------------------
1428
1431
1433__parser__(type=ME_PBB_MK_BINB:"byte-array type data-type")
1434typedef unsigned char MK_BINB;
1435
1437__parser__(type=ME_PBX_MK_BIN:"byte-array pointer data-type":primary)
1439
1441__parser__(type=ME_PBN_MK_BINN:"const byte-array pointer data-type":primary)
1442typedef MK_BINB const *MK_BINN;
1443
1445
1446// ----------------------------------------------------------------------------------
1447
1450
1452__parser__(type=ME_PSB_MK_STRB:"string type data-type")
1453typedef char MK_STRB;
1454
1456__parser__(type=ME_PSX_MK_STR:"string pointer data-type":primary)
1458
1460__parser__(type=ME_PSN_MK_STRN:"constant string pointer data-type":primary)
1461typedef const MK_STRB *MK_STRN;
1462
1464__parser__(type=ME_ASN_MK_STRN_A:"ARRAY of MK_STRN")
1465typedef struct {
1468} MK_STRN_A;
1469
1470__parser__(ignore)
1471MK_UNUSED const static MK_STRN_A MK_STRN_A_NULL = (MK_STRN_A) {0,0};
1472
1474__parser__(type=ME_PFX_MK_FST:"constant 'printf' format string")
1475typedef MK_STRB const *MK_FST;
1476
1478
1479// ----------------------------------------------------------------------------------
1480
1483__parser__(type=ME_PVX_MK_NAT_OBJECT:"target language object pointer")
1484typedef void* MK_NAT_OBJECT;
1485__parser__(type=ME_PVX_MK_NAT_LIST:"target language list pointer")
1486typedef void* MK_NAT_LIST;
1488
1489// ----------------------------------------------------------------------------------
1490
1492// MkKernel_Type_C_API
1493
1494/* MARK_C ********************************************************************/
1495/* */
1496/* class types */
1497/* */
1498/*****************************************************************************/
1499
1500// BEGIN-ShortDef - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1501
1505 __parser__(type=ME_CCC_MkObjectC:"MkObjectC class handle":primary)
1506 typedef struct MkObjectS * MK_OBJ;
1508 __parser__(type=ME_CCN_MkObjectC:"const - MkObjectC class handle":primary)
1509 typedef const struct MkObjectS * MK_OBJN;
1511 __parser__(ignore)
1512 typedef struct MkObjectS MK_OBJR;
1514// MkObjectC_Class_C_API
1515
1519 __parser__(type=ME_CCC_MkBufferC:"MkBufferC class handle":primary)
1520 typedef struct MkBufferS * MK_BUF;
1522 __parser__(type=ME_CCN_MkBufferC:"const - MkBufferC class handle":primary)
1523 typedef const struct MkBufferS * MK_BUFN;
1525 __parser__(ignore)
1526 typedef struct MkBufferS MK_BUFR;
1528// MkBufferC_Class_C_API
1529
1533 __parser__(type=ME_CCC_MkBufferStreamC:"MkBufferStreamC class handle":primary)
1534 typedef struct MkBufferStreamS * MK_BUS;
1536 __parser__(type=ME_CCN_MkBufferStreamC:"const - MkBufferStreamC class handle":primary)
1537 typedef const struct MkBufferStreamS * MK_BUSN;
1539 __parser__(ignore)
1540 typedef struct MkBufferStreamS MK_BUSR;
1542// MkBufferStreamC_Class_C_API
1543
1547 __parser__(type=ME_CCC_MkBufferListC:"MkBufferListC class handle":primary)
1548 typedef struct MkBufferListS * MK_BFL;
1550 __parser__(type=ME_CCN_MkBufferListC:"const - MkBufferListC class handle":primary)
1551 typedef const struct MkBufferListS * MK_BFLN;
1553 __parser__(ignore)
1554 typedef struct MkBufferListS MK_BFLR;
1556// MkBufferListC_Class_C_API
1557
1561 __parser__(type=ME_CCC_MkLogFileC:"MkLogFileC class handle":primary)
1562 typedef struct MkLogFileS * MK_LFL;
1564 __parser__(type=ME_CCN_MkLogFileC:"const - MkLogFileC class handle":primary)
1565 typedef const struct MkLogFileS * MK_LFLN;
1567 __parser__(ignore)
1568 typedef struct MkLogFileS MK_LFLR;
1570// MkLogFileC_Class_C_API
1571
1575 __parser__(type=ME_CCC_MkErrorC:"MqErrorC class handle":primary)
1576 typedef struct MkErrorS * MK_ERR;
1578 __parser__(type=ME_CCN_MkErrorC:"const - MqErrorC class handle":primary)
1579 typedef const struct MkErrorS * MK_ERRN;
1581 __parser__(ignore)
1582 typedef struct MkErrorS MK_ERRR;
1584// MkErrorC_Class_C_API
1585
1589 __parser__(internal,type=ME_CCC_MkExtensionC:"abstract class for the extension technology":internal)
1590 typedef struct MkExtensionS * MK_EXT;
1592 __parser__(internal,type=ME_CCN_MkExtensionC:"const - abstract class for the extension technology":internal)
1593 typedef const struct MkExtensionS * MK_EXTN;
1595 __parser__(ignore)
1596 typedef struct MkExtensionS MK_EXTR;
1598// MkExtensionC_Class_C_API
1599
1603 __parser__(internal,type=ME_CCC_MkErrExtC:"final class for the MkErrorS extention technology":internal)
1604 typedef struct MkErrExtS * MK_ERREXT;
1606 __parser__(internal,type=ME_CCN_MkErrExtC:"const - final class for the MkErrorS extention technology":internal)
1607 typedef const struct MkErrExtS * MK_ERREXTN;
1609 __parser__(ignore)
1610 typedef struct MkErrExtS MK_ERREXTR;
1612// MkErrExtC_Class_C_API
1613
1617 __parser__(internal,type=ME_CCC_MkRtExtC:"final class for the MkRuntimeS extention technology":internal)
1618 typedef struct MkRtExtS * MK_RTEXT;
1620 __parser__(internal,type=ME_CCN_MkRtExtC:"const - final class for the MkRuntimeS extention technology":internal)
1621 typedef const struct MkRtExtS * MK_RTEXTN;
1623 __parser__(ignore)
1624 typedef struct MkRtExtS MK_RTEXTR;
1626// MkRtExtC_Class_C_API
1627
1631 __parser__(type=ME_CCC_MkRuntimeC:"runtime singleton class object":primary)
1632 typedef struct MkRuntimeS * MK_RT;
1634 __parser__(type=ME_CCN_MkRuntimeC:"const - runtime singleton class object":primary)
1635 typedef const struct MkRuntimeS * MK_RTN;
1637 __parser__(ignore)
1638 typedef struct MkRuntimeS MK_RTR;
1640// MkRuntimeC_Class_C_API
1641
1645 __parser__(internal,type=ME_CCC_MkTypeC:"a managed object class type !base! pointer":internal)
1646 typedef struct MkTypeS * MK_TYP;
1648 __parser__(internal,type=ME_CCN_MkTypeC:"const - a managed object class type !base! pointer":internal)
1649 typedef const struct MkTypeS * MK_TYPN;
1651 __parser__(ignore)
1652 typedef struct MkTypeS MK_TYPR;
1654// MkTypeC_Class_C_API
1655
1656// END-ShortDef - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1657
1660__parser__(type=ME_CXC_MK_BAC:"a list of 'buffer' as last argument in function")
1661typedef struct MkBufferListS *MK_BAC;
1662
1665__parser__(type=ME_CXN_MK_BAC:"const - a list of 'buffer' as last argument in function")
1666typedef const struct MkBufferListS *MK_BACN;
1667
1668// --------------------------------------------------------------------
1669// binary
1670
1676
1677__parser__push__(hide);
1678
1682__parser__(reference)
1683typedef struct {
1686} MkBinaryR;
1687
1691 return (MkBinaryR) {size, data};
1692}
1693
1697 return bin.data == NULL;
1698}
1699
1703 if (start>bin.size)
1704 return (const MkBinaryR) {0, NULL};
1705 else
1706 return (const MkBinaryR) {start+wide>bin.size?bin.size-start:wide, bin.data+start};
1707}
1708
1711mk_inline MkBinaryR MkBinaryDup_RT ( MK_PARSER_RT const MkBinaryR bin );
1712
1715mk_inline void MkBinaryLog_RT ( MK_PARSER_RT const MkBinaryR bin );
1716
1720 return bin.data;
1721}
1722
1726 return bin.size;
1727}
1728
1730
1732// MkKernel_Binary_C_API
1733
1739
1740__parser__push__(hide);
1741
1745// [MkStringR]
1746__parser__(reference)
1747typedef struct {
1750} MkStringR;
1751// [MkStringR]
1752
1755mk_inline void MkStringLog_RT ( MK_PARSER_RT MkStringR const str, MK_STRN func ) ;
1756
1760 return (MkStringR) {(len>0?len:(str?(MK_NUM)strlen(str):0)), str};
1761}
1762
1766 return (MkStringR) {str?(MK_NUM)strlen(str):0, str};
1767}
1768
1779 if (len < 0) len = strR.len;
1780 if (start > strR.len) {
1781 return MkStringCreate(0,NULL);
1782 } else if ((start+len) > strR.len) {
1783 return MkStringCreate(strR.len-start,strR.ptr+start);
1784 } else {
1785 return MkStringCreate(len,strR.ptr+start);
1786 }
1787}
1788
1791mk_inline void MkStringSplit ( MkStringR strR, MK_NUM *len_out, MK_STRN *str_out ) {
1792 assert(len_out != NULL);
1793 assert(str_out != NULL);
1794 *len_out = strR.len; *str_out = strR.ptr;
1795}
1796
1799mk_inline MkStringR MkStringDup_RT ( MK_PARSER_RT MkStringR const str );
1800
1804 return str.ptr;
1805}
1806
1810 return str.len;
1811}
1812
1821 return ((strR.ptr) && (strR.len) == MK_NULL_STR_LEN && strcmp((strR.ptr),MK_NULL_STR)==0);
1822}
1823
1825
1827// - MkKernel_String_C_API
1828
1829/*****************************************************************************/
1830/* */
1831/* enum definitions */
1832/* */
1833/*****************************************************************************/
1834
1837
1838__parser__push__(doc-group=Enum);
1839
1842
1849// [MkErrorE]
1855// [MkErrorE]
1856
1857// BEGIN-MkErrorE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1858
1861__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc,return-type-default-no)
1862MK_EXTERN MK_STRN MK_DECL MkErrorE_ToString ( enum MkErrorE value ) MK_ATTR_STATIC ;
1863
1866__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc,return-type-default-no)
1868mk_inline MK_I32 MkErrorE_ToInt ( enum MkErrorE value ) {
1869 return (MK_I32) value;
1870}
1871
1874__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
1875MK_EXTERN enum MkErrorE MkErrorE_FromInt ( MK_I32 const value, enum MkErrorE * value_out ) MK_ATTR_STATIC ;
1876
1877// END-MkErrorE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1878
1879// additional attribute for MkErrorE_FromInt - this function return TWO errors 1) return and 2) the value_out
1880__parser__global__(MkErrorE_FromInt:error-ignore=2);
1881
1883// MkErrorE
1884
1887
1894// [MkTimeoutE]
1895__parser__(enum-accept-integer=long)
1917// [MkTimeoutE]
1918
1919// BEGIN-MkTimeoutE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1920
1923__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc,return-type-default-no)
1924MK_EXTERN MK_STRN MK_DECL MkTimeoutE_ToString ( enum MkTimeoutE value ) MK_ATTR_STATIC ;
1925
1928__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc,return-type-default-no)
1930mk_inline MK_I32 MkTimeoutE_ToInt ( enum MkTimeoutE value ) {
1931 return (MK_I32) value;
1932}
1933
1936__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
1937MK_EXTERN enum MkErrorE MkTimeoutE_FromInt ( MK_I32 const value, enum MkTimeoutE * value_out ) MK_ATTR_STATIC ;
1938
1939// END-MkTimeoutE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1940
1942
1945
1947__parser__(internal)
1949 MK_NO = 0,
1951};
1952
1953// BEGIN-MkBoolE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1954
1957__parser__(internal,no-rpc,prefix=EnumFunc,return-type-default-no)
1958MK_EXTERN MK_STRN MK_DECL MkBoolE_ToString ( enum MkBoolE value ) MK_ATTR_STATIC ;
1959
1962__parser__(internal,no-rpc,prefix=EnumFunc,return-type-default-no)
1964mk_inline MK_I32 MkBoolE_ToInt ( enum MkBoolE value ) {
1965 return (MK_I32) value;
1966}
1967
1970__parser__(internal,no-rpc,prefix=EnumFunc)
1971MK_EXTERN enum MkErrorE MkBoolE_FromInt ( MK_I32 const value, enum MkBoolE * value_out ) MK_ATTR_STATIC ;
1972
1973// END-MkBoolE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1974
1976
1979
1984// [MkNativeIsE]
1985__parser__(internal)
1992// [MkNativeIsE]
1993
1994// BEGIN-MkNativeIsE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
1995
1998__parser__(internal,no-rpc,prefix=EnumFunc,return-type-default-no)
1999MK_EXTERN MK_STRN MK_DECL MkNativeIsE_ToString ( enum MkNativeIsE value ) MK_ATTR_STATIC ;
2000
2003__parser__(internal,no-rpc,prefix=EnumFunc,return-type-default-no)
2005mk_inline MK_I32 MkNativeIsE_ToInt ( enum MkNativeIsE value ) {
2006 return (MK_I32) value;
2007}
2008
2011__parser__(internal,no-rpc,prefix=EnumFunc)
2012MK_EXTERN enum MkErrorE MkNativeIsE_FromInt ( MK_I32 const value, enum MkNativeIsE * value_out ) MK_ATTR_STATIC ;
2013
2014// END-MkNativeIsE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
2015
2017// MkNativeIsE
2018
2021
2023#define MK_TYPE_IS_1_I8E (1<<0)
2024
2026#define MK_TYPE_IS_2_I8E (1<<1)
2027
2029#define MK_TYPE_IS_4_I8E (1<<2)
2030
2032#define MK_TYPE_IS_8_I8E (1<<3)
2033
2035#define MK_TYPE_IS_NATIVE ( MK_TYPE_IS_1_I8E | MK_TYPE_IS_2_I8E | \
2036 MK_TYPE_IS_4_I8E | MK_TYPE_IS_8_I8E )
2037
2039#define MK_TYPE_SHIFT 4
2040
2048// [MkTypeE]
2061// [MkTypeE]
2062
2063// BEGIN-MkTypeE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
2064
2067__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc,return-type-default-no)
2068MK_EXTERN MK_STRN MK_DECL MkTypeE_ToString ( enum MkTypeE value ) MK_ATTR_STATIC ;
2069
2072__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc,return-type-default-no)
2074mk_inline MK_I32 MkTypeE_ToInt ( enum MkTypeE value ) {
2075 return (MK_I32) value;
2076}
2077
2080__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
2081MK_EXTERN enum MkErrorE MkTypeE_FromInt ( MK_I32 const value, enum MkTypeE * value_out ) MK_ATTR_STATIC ;
2082
2083// END-MkTypeE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
2084
2086// MkTypeE
2087
2089
2091// MkKernel_Enum_C_API
2092
2150
2152__parser__(ignore)
2161 MK_BINB B[8];
2162 MK_BINB B8[8];
2163 MK_BINB B4[4];
2164 MK_BINB B2[2];
2165 MK_BINB B1[1];
2166
2167#if defined(__cplusplus)
2168 MkBufferAtomU() : I64(0L) {};
2169 MkBufferAtomU(MK_I8 val) : I8(val) {};
2170 MkBufferAtomU(MK_BOL val) : BOL(val) {};
2171 MkBufferAtomU(MK_I16 val) : I16(val) {};
2172 MkBufferAtomU(MK_I32 val) : I32(val) {};
2173 MkBufferAtomU(MK_I64 val) : I64(val) {};
2174 MkBufferAtomU(MK_FLT val) : FLT(val) {};
2175 MkBufferAtomU(MK_DBL val) : DBL(val) {};
2176#endif
2177};
2178
2187__parser__(ignore)
2195
2198#define MkType_O MK_BOL
2199#define MkType_Y MK_I8
2200#define MkType_S MK_I16
2201#define MkType_I MK_I32
2202#define MkType_W MK_I64
2203#define MkType_F MK_FLT
2204#define MkType_D MK_DBL
2205#define MkType_C MK_STRN
2206#define MkType_B MK_BIN
2207#define MkType_U MK_BUF
2208#define MkType_L MK_BFL
2210
2212// MkKernel_PrimitiveType_C_API
2213
2233
2234
2235// =============================================================================================
2236
2239
2241typedef uintptr_t MK_IDNT;
2242
2243// also: theKernel/cs/libmkkernel.cs
2245__parser__(hide)
2251
2252// BEGIN-MkIdSE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
2253
2256__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc,return-type-default-no)
2257MK_EXTERN MK_STRN MK_DECL MkIdSE_ToString ( enum MkIdSE value ) MK_ATTR_STATIC ;
2258
2261__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc,return-type-default-no)
2263mk_inline MK_I32 MkIdSE_ToInt ( enum MkIdSE value ) {
2264 return (MK_I32) value;
2265}
2266
2269__parser__(doc-group=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
2270MK_EXTERN enum MkErrorE MkIdSE_FromInt ( MK_I32 const value, enum MkIdSE * value_out ) MK_ATTR_STATIC ;
2271
2272// END-MkIdSE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
2273
2274// also: theKernel/cs/libmkkernel.cs
2281__parser__(hide)
2288
2290
2291/*****************************************************************************/
2292/* */
2293/* cache */
2294/* */
2295/*****************************************************************************/
2296
2300
2301__parser__(ignore)
2302typedef MK_PTR ( *MkCacheCF) ( MK_RT_ARGS MK_PTR const);
2303__parser__(ignore)
2304typedef void ( *MkCacheDF) ( MK_RT_ARGS MK_PTR * const);
2305
2307__parser__(ignore)
2309 #define MkCacheItemS_signature 0x44196912
2311 bool doFree;
2315};
2316
2324__parser__(ignore)
2341
2343// MkKernel_Cache_C_API
2344
2347__parser__(flags=public-internal)
2348typedef void ( MK_DECL *MkMarkF ) ( MK_RT_ARGS MK_PTR data );
2349
2350/*****************************************************************************/
2351/* */
2352/* create / delete */
2353/* */
2354/*****************************************************************************/
2355
2425__parser__push__(no-rpc,template-overload,doc-group=libmkkernel,doc-index=Setup,prefix=Setup);
2426
2439#ifndef META_COMPILE_AS_CC
2440__attribute__ ((constructor(200)))
2441#endif
2442__parser__(no-inline)
2443MK_EXTERN void MK_DECL MkSetup (void) MK_ATTR_STATIC ;
2444
2447
2459#ifndef META_COMPILE_AS_CC
2460__attribute__ ((destructor(200)))
2461#endif
2462__parser__(no-inline)
2463MK_EXTERN void MK_DECL MkCleanup (void) MK_ATTR_STATIC ;
2464
2466__parser__(ignore)
2467MK_EXTERN_DATA bool MkCleanupActive;
2468
2469__parser__(internal)
2470MK_EXTERN bool MK_DECL MkHasThread (void);
2471
2472__parser__(internal)
2473MK_EXTERN bool MK_DECL MkHasFork (void);
2474
2476
2478
2479/* ####################################################################### */
2480/* ### ### */
2481/* ### S Y S T E M - A P I ### */
2482/* ### ### */
2483/* ####################################################################### */
2484
2485// MkObjectC_Sys_C_API: hide all ^MkSys
2486__parser__global__(hide-rx=^MkSys);
2487// MkObjectC_Sys_C_API: default class for MkSys is MkObjectC
2488__parser__global__(prefix2class:MkSys=MkObjectC);
2489
2502
2503__parser__push__(internal); // \{ internal
2504
2508typedef MK_PTR (*MkSysCallocF) (size_t, size_t) __attribute__ ((alloc_size (1, 2)));
2509
2513typedef MK_PTR (*MkSysMallocF) (size_t) __attribute__ ((alloc_size (1)));
2514
2518typedef MK_STR (*MkSysStrDupF) (MK_STRN);
2519
2523typedef MK_STR (*MkSysStrNCpyF) (char*,const char*,size_t);
2524
2528typedef MK_STR (*MkSysStrNDupF) (MK_STRN, size_t) __attribute__ ((alloc_size (2)));
2529
2533typedef MK_PTR (*MkSysReallocF) (MK_PTR, size_t);
2534
2538typedef void (*MkSysFreeF) (MK_PTR);
2539
2544typedef pid_t (*MkSysForkF) (void);
2545
2549typedef enum MkErrorE (*MkSysWaitF) (
2550 MK_OBJN const fmtobj,
2551 MK_IDNT const id
2552);
2553
2564typedef int (*MkSysExitF) (
2566 int isThread,
2567 int num
2568);
2569
2570/*
2574typedef void (*MkSysAbortF) (
2575 MK_RT_ARGS
2576 int isThread,
2577 int num
2578) MK_NO_RETURN;
2579*/
2580
2582__parser__(ignore)
2583struct MkLalS {
2605
2614 enum MkErrorE (*SysUSleep) (
2615 MK_OBJN const obj,
2616 unsigned int const usec
2617 );
2626 enum MkErrorE (*SysSleep) (
2627 MK_OBJN const obj,
2628 unsigned int const sec
2629 );
2642 enum MkErrorE (*SysDaemonize) (
2644 MK_OBJN const obj,
2645 MK_STRN pidfile
2646 );
2649
2659 void (*SysAbort) (
2660 void
2661 ) MK_NO_RETURN;
2662
2663 enum MkErrorE (*SysIgnorSIGCHLD) (
2665 MK_OBJ const obj
2666 );
2667
2668 enum MkErrorE (*SysAllowSIGCHLD) (
2670 MK_OBJ const obj
2671 );
2672};
2673
2675__parser__(ignore)
2677
2684__attribute__ ((alloc_size (2, 3)))
2685__parser__(internal)
2688 size_t const nmemb,
2689 size_t const size
2690);
2691
2697__attribute__ ((alloc_size (2)))
2698__parser__(internal)
2701 size_t const size
2702);
2703
2711 MK_STRN const str
2712);
2713
2720__parser__(internal)
2723 MK_STRN const str,
2724 MK_SIZE const len
2725);
2726
2734MK_EXTERN enum MkErrorE MK_DECL MkSysStrNCpy (
2736 MK_STR const to,
2737 MK_STRN const from,
2738 MK_SIZE const len
2739);
2740
2741
2748__attribute__ ((alloc_size (3)))
2749__parser__(internal)
2752 MK_PTR const buf,
2753 size_t const size
2754);
2755
2765__parser__(internal)
2766MK_EXTERN MK_PTR MK_DECL MkSysReCalloc (
2768 MK_PTR const buf,
2769 MK_NUM const oldnum,
2770 MK_NUM const addnum,
2771 size_t const size
2772);
2773
2780__parser__(internal)
2783 MK_PTRN const blck,
2784 size_t const size
2785);
2786
2792__parser__(internal)
2793MK_EXTERN MK_STRN_A MK_DECL MkSysStringArrayDup (
2795 MK_STRN_A const strA
2796);
2797
2802__parser__(internal) void MkSysFree (MK_PTR pointer);
2803#define MkSysFree(pointer) \
2804 do { \
2805 if ( likely((pointer) != (NULL)) ) { \
2806 (*MkLal.SysFree)((MK_PTR)pointer); \
2807 (pointer) = (NULL); \
2808 } \
2809 } while (0)
2810
2811__parser__(internal) void MkSysFreeNonNull (MK_PTR pointer);
2812#define MkSysFreeNonNull(pointer) (*MkLal.SysFree)((MK_PTR)pointer)
2813
2819 MK_PTR data
2820);
2821
2845 MK_I32 const debug __parser__(default=0),
2846 MK_STRN const callfunc __parser__(default=F#FUNC),
2847 MK_I32 const lvl __parser__(default=0),
2848 MK_I32 skip __parser__(default=0),
2849 MK_I32 const num __parser__(default=-1)
2851
2859MK_EXTERN void MK_DECL MkSysPrintProcessMemoryMap_RT (
2862 MK_I32 const debug __parser__(default=0),
2863 MK_STRN const callfunc __parser__(default=F#FUNC),
2864 MK_I32 const lvl __parser__(default=0)
2866
2871 MK_I32 const debug __parser__(default=0),
2872 MK_STRN const callfunc __parser__(default=F#FUNC),
2873 MK_I32 const lvl __parser__(default=0),
2874 MK_I32 skip __parser__(default=0),
2875 MK_I32 const num __parser__(default=-1)
2877
2882__parser__(internal)
2883mk_inline enum MkErrorE MkSysWaitForProcess (
2885 MK_IDNT const id
2886) {
2887 return (*MkLal.MkSysWaitForProcessCB)(fmtobj, id);
2888};
2889
2894__parser__(internal)
2895mk_inline enum MkErrorE MkSysWaitForThread (
2897 MK_IDNT const id
2898) {
2899 return (*MkLal.MkSysWaitForThreadCB)(fmtobj, id);
2900};
2901
2906__parser__(internal)
2907mk_inline enum MkErrorE MkSysUSleep (
2909 useconds_t const usec
2910) {
2911 return (*MkLal.SysUSleep)(fmtobj, usec);
2912};
2913
2920 MK_I32 const sec
2921) {
2922 return (*MkLal.SysSleep)(fmtobj, (unsigned int)sec);
2923};
2924
2941 int isThread,
2942 int num
2943) {
2944 if (*MkLal.MkSysExitCB) {
2945 return (*MkLal.MkSysExitCB)(MK_RT_CALL isThread,num);
2946 } else {
2947 return num;
2948 }
2950
2965// [MkSysBasename-example]
2968 MK_STRN const pathName,
2969 bool const includeExtension
2971// [MkSysBasename-example]
2972
2987 MK_STRN const pathName
2989
3003 MK_STRN const format,
3004 ...
3006
3013__parser__(internal)
3014MK_EXTERN enum MkErrorE MK_DECL MkSysGetTimeOfDay (
3016 struct mk_timeval * tv_out,
3017 struct mk_timezone * tz_out
3018);
3019
3021__parser__(internal,macro) bool MkSysStringSetNULL_R (MK_STRN const str);
3022#define MkSysStringSetNULL_R(_str) _str[0] = '\0'
3023
3025__parser__(internal,macro) bool MkSysStringSet_R (MK_STRN const str, MK_STRN const other);
3026#define MkSysStringSet_R(_str,_val) strcpy(_str,_val)
3027
3029__parser__(internal,macro) bool MkSysStringIsNULL_R (MK_STRN const str);
3030#define MkSysStringIsNULL_R(_str) (_str[0] == '\0')
3031
3034 return (str == NULL || MkSysStringIsNULL_R(str));
3035};
3036
3039 return (str != NULL && *str != '\0');
3040};
3041
3043__parser__(internal,macro) bool MkSysStringIsEQUAL (MK_STRN const str, MK_STRN const other);
3044#define MkSysStringIsEQUAL(_str,_other) (strcmp(_str,_other) == 0)
3045
3047__parser__(internal,macro) bool MkSysStringIsLenEQUAL (MK_STRN const str, MK_STRN const other, MK_SIZE const len);
3048#define MkSysStringIsLenEQUAL(_str,_other,_len) (strncmp(_str,_other,(size_t)_len) == 0)
3049
3052 return MkSysStringIsNULL(str) ? NULL : str;
3053};
3054
3057 return str == NULL ? "" : str;
3058};
3059
3060__parser__pop__; // internal \}
3061
3101__parser__(keep,doc-no)
3103 MK_STRN key,
3104 MK_NUM length __parser__(default=-1)
3106
3108__parser__(keep,doc-no)
3110 MK_STRN key,
3111 MK_NUM length __parser__(default=-1)
3113
3120__parser__(keep,doc-no)
3123 MK_I32 pid,
3124 MK_I32 signal
3126
3132__parser__(keep,doc-no)
3133MK_EXTERN enum MkErrorE MK_DECL MkSysGetPid (
3135 MK_I32 * pid_out
3137
3138__parser__(ignore)
3139typedef enum MkSysPipeHandlerE {
3141 MK_PIPE_IGNORE = 1
3142} MkSysPipeHandlerE;
3143
3146__parser__(ignore)
3147MK_EXTERN void MK_DECL MkSysPipeHandler (
3148 MkSysPipeHandlerE keepPipe
3150
3152// MkObjectC_Sys_C_API
3153
3236/* ####################################################################### */
3237/* ### ### */
3238/* ### O B J E C T - A P I ### */
3239/* ### ### */
3240/* ####################################################################### */
3241
3275__parser__global__(hide-rx=^Mk\w+Check\M);
3276__parser__global__(hide-rx=^MkObj[A-Z]);
3277__parser__global__(prefix2class:MkObj=MkObjectC);
3278
3281
3282 // TODO !! IMPORTANT INFO ABOUT CHECK !!
3283 // "MqCtxCheck(context)..." check of "context" create "MkDisasterEvent" after "fDecrSelf" etc…
3284 // Problem in PERL (and propably other too) after "fDecrSelf" the "context" becomes INVALID.
3285 // There are TWO phases of INVALID:
3286 // 1. INVALID but still readable -> "MqCtxCheck" works
3287 // 2. INVALID but NOT readable -> "MqCtxCheck" create "MkDisasterEvent"
3288 // It seems that "2." becomes more likely as "context" becomes bigger. "context" becomes bigger
3289 // if more prealloc space is used in "context". seems that if all references to ACTIVE memory is
3290 // gone an entire memory-page becomes "2." -> with other words:
3291 // -> It is not guaranteed that the "MqCtxCheck" technology will work.
3292
3293#define __MkCheckTO(t,o) (((*o).signature & (*t).objmask) == (*t).objsig)
3294#define _MkCheckTO(t,o) ((o) && __MkCheckTO((t),(o)))
3295#define __MkCheckO(cls,o) (((*o).signature & cls##_MASK) == cls##_SIGNATURE)
3296#define _MkCheckO(cls,o) ((o) && __MkCheckO(cls,(o)))
3297#define __MkCheckX(cls,x) __MkCheckO(cls,(cls##_X2obj(x)))
3298#define _MkCheckX(cls,x) ((x) && __MkCheckO(cls,(cls##_X2obj(x))))
3299#define __MkCheckM(cls,m) __MkCheckO(cls,((MK_OBJ)(m)))
3300#define _MkCheckM(cls,m) ((m) && __MkCheckM(cls,m))
3301
3302#define MkCheckNN(cls,x) __MkCheckO(cls,(cls##_X2obj(x)))
3303
3304#ifdef __SANITIZE_ADDRESS__
3305 //#define MkSanitizeCheck(_root,_m) _root##_Check(_m)
3306 #define MkSanitizeCheck(_root,_m) _MkCheckM(_root,_m)
3307 #define MkSanitizeCheckO(_root,_o) _MkCheckO(_root,_o)
3308#else
3309 #define MkSanitizeCheck(_root,_m) _MkCheckM(_root,_m)
3310 #define MkSanitizeCheckO(_root,_o) _MkCheckO(_root,_o)
3311#endif
3312
3315#define MkAssertO(cls,o) assert(o==NULL?true:__MkCheckO(cls,o)) // NULL == true
3316#define MkAssertX(cls,x) assert(x==NULL?true:__MkCheckX(cls,o)) // NULL == true
3318
3320#ifdef NDEBUG
3321# define MkAssertCastM(cls,m) ((cls##_type)(m))
3322#else
3323# define MkAssertCastM(cls,m) ((cls##_type)(({MK_OBJ o=(MK_OBJ)(m);MkAssertO(cls,o);o;})))
3324#endif
3325
3326#define toTT(_type) (MkTYP(_type))
3327
3329
3331#define MK_NULL_SIGNATURE 0
3332
3351
3352#define MkDbgObjInstancesO_2(o,c) \
3353do { \
3354 if (o) { \
3355 mk_dbg_color_ln(c,"MkDbgObjInstances: %s[%p] prev<%p>, next<%p>, var<" #o ">", \
3356 (o)->type->type_name, o, (o)->obj_protect.prev, (o)->obj_protect.next); \
3357 } else { \
3358 mk_dbg_color_ln(c,"MkDbgObjInstances: %s[NULL] var<" #o ">", "unknown"); \
3359 } \
3360} while (0)
3361#define MkDbgObjInstancesX_2(x,c) MkDbgObjInstancesO_2(MkOBJ(x),c)
3362#define MkDbgObjInstancesX(x) MkDbgObjInstancesX_2(x,MK_COLOR_CYAN)
3363#define MkDbgObjInstancesO(o) MkDbgObjInstancesO_2(o,MK_COLOR_CYAN)
3364
3365#if META_DEBUG & META_DEBUG_REFCOUNT
3366
3367 __attribute__ ((visibility("default"))) void
3368 MkDbgDeepWriter(void* mng,const char* ident, const char* func, const char* fmt,...);
3369
3370#else
3371
3372 #define MkDbgDeepWriter(...)
3373
3374#endif
3375
3376#define MkDbgDeepX_4(m,ident,func,fmt,...) MkDbgDeepWriter(m, ident, func, fmt, __VA_ARGS__)
3377#define MkDbgDeepX_3(m,ident,fmt,...) MkDbgDeepX_4(m,ident,__func__,fmt,__VA_ARGS__)
3378#define MkDbgDeepX_2(m,ident) MkDbgDeepX_4(m,ident,__func__,NULL,NULL)
3379
3396
3398 //bool onDelete;
3399
3404
3409
3410#if defined(META_USE_SELF_REFCOUNT)
3420#endif
3421
3424
3427
3430 struct MkObjectProtectS obj_protect;
3431
3432 // attention !!
3433 // an additional "attribute" have to be initialized in: MkObjInit
3434 // also update : theKernel/cs/libmkkernel.cs
3435};
3436
3437// BEGIN-MkObjectS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
3438
3442 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
3443
3444// Signature --------------------------------------------------------------
3447
3448 #define MkObjectC_SIGNATURE (0x59B3u<<16)
3449 #define MkObjectC_MASK (((1u<<16)-1)<<16)
3450
3452
3453// CompileTimeCast --------------------------------------------------------------
3456
3457 #define MkObjectC_X2obj(x) (x)
3458
3460
3461// TypeDef --------------------------------------------------------------
3464
3466 __parser__(ignore) typedef struct MkObjectS MkObjectCR;
3468 __parser__(ignore) typedef const struct MkObjectS MkObjectCNR;
3470 #define MkObjectC_T (&MK_RT_REF._MkObjectC_T)
3472 #define MkObjectC_TT (MkTYP(MkObjectC_T))
3474 #define MkObjectST MkObjectC_T
3476 #define MkObjectSTT (MkTYP(MkObjectST))
3478 #define MkObjectC_type MK_OBJ
3480 #define MkObjectCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
3482 #define MkObjectCTT_X(instance) (MkOBJ_R(instance).type)
3484 #define MkObjectCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
3486 #define MkObjectC_NS MK
3488 #define MkObjectCTT MkObjectCTT
3490 #define MkObjectCT ( (struct MkTypeDefS *) MkObjectCTT )
3491
3493
3494// TypeCheck --------------------------------------------------------------
3497
3498 #pragma GCC diagnostic push
3499 #pragma GCC diagnostic ignored "-Wattributes"
3500
3503 __parser__(class=MkObjectC,static,hide)
3506 return MkSanitizeCheck(MkObjectC,mng);
3507 }
3508
3511 __parser__(class=MkObjectC,static,hide)
3514 return MkSanitizeCheckO(MkObjectC,obj);
3515 }
3516
3517 #pragma GCC diagnostic pop
3518 #define MkObjectC_Check(mng) MkObjCheck(mng)
3519
3521
3522// RunTimeCast --------------------------------------------------------------
3525
3527 __parser__(class=MkObjectC,hide,static)
3528 META_ATTRIBUTE_SANITIZE
3531 return (MkObjCheck(mng) ? (MK_OBJ)mng : NULL);
3532 }
3533
3535 __parser__(class=MkObjectC,hide,static)
3536 META_ATTRIBUTE_SANITIZE
3539 return (MkObjCheck(mng) ? (MK_OBJN)mng : NULL);
3540 }
3541
3543 #define MkObjRaise(_obj) if (!_MkCheckX(MkObjectC,_obj)) { \
3544 MkErrorSetC_1E("'MkObjectC' hdl is NULL"); \
3545 goto error ; \
3546 }
3547
3549 #define MkOBJ_R(x) (*(x)).super.obj
3551 #define MkOBJ(x) (&MkOBJ_R(x))
3552
3554
3557// MkObjectC_Class_Define_C_API
3558
3559// END-MkObjectS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
3560
3561// =========================================================================
3562// OVERLOAD
3563
3566
3569__parser__push__(doc-group=_ignore_,doc-index=Class,doc-name=Export,class=MkObjectC,no-rpc);
3570
3578
3581 return ((MK_HDL)obj->signature);
3582}
3583
3584#define MkObjectHandleGetOfType_1X(x) MkObjectHandleGetOfType(MkOBJ(x))
3585
3591 MK_OBJ const obj __parser__(null-allowed)
3593
3602 MK_OBJ const obj __parser__(null-allowed)
3604
3606
3609
3610// =========================================================================
3611// BEGIN-MkObjectS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
3612
3615
3618
3619__parser__push__(doc-group=_ignore_,doc-index=Class,doc-name=Export,class=MkObjectC);
3620
3638 MK_OBJ const obj __parser__(null-allowed)
3640
3641#define MkObjectHandleGet_1X(x) MkObjectHandleGet(x?MkOBJ(x):NULL)
3642
3653 MK_HDL const netHdl
3655
3665#define MkObjectHandleResolve_e(netHdl) ({ \
3666 MK_HDL tmpHdl=netHdl; \
3667 MK_OBJ tmp; \
3668 if (tmpHdl==0) { \
3669 tmp=NULL; \
3670 } else { \
3671 tmp=MkObjectHandleResolve(tmpHdl); \
3672 if (tmp==NULL) { \
3673 MkErrorSetC_1_NULL("ERROR: 'MkObjectC' handle is 'NULL'"); \
3674 goto error; \
3675 }; \
3676 }; \
3677 tmp; \
3678})
3679
3684 MK_HDL const netHdl
3685);
3686
3691 MK_OBJ const netObj
3692);
3693
3695
3697// Class export & import
3698
3702 __parser__(doc-group=_ignore_,doc-index=Class,doc-name=Misc,class=MkObjectC,null-return-allow)
3705 return (MK_OBJ)MK_NULL;
3706 }
3708// MkObjectC - Misc - function
3709
3711// MkObjectC_Class_C_API
3712
3713// END-MkObjectS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
3714
3717typedef MK_OBJ (*MkConstructorF) ( MK_RT_ARGS MK_TYP type, MK_PTR nat, MK_PTR lnk);
3718typedef void (*MkDestructorF) ( MK_RT_ARGS MK_OBJ const obj);
3719typedef MK_OBJ (*MkDupF) ( MK_RT_ARGS MK_OBJN const obj);
3720typedef MK_OBJ (*MkDup2F) ( MK_RT_ARGS MK_OBJN const obj, MK_STRN const ident);
3721typedef MK_OBJ (*MkMergeF) ( MK_RT_ARGS MK_OBJ const obj);
3722typedef MK_OBJ (*MkCopyF) ( MK_RT_ARGS MK_OBJ const obj, MK_OBJN const src);
3723typedef MK_OBJ (*MkResetF) ( MK_RT_ARGS MK_OBJ const obj);
3724__parser__(flags=public-internal)
3725typedef MK_PTR (*MkSelfCreateF) ( MK_RT_ARGS MK_OBJ const obj, MK_PTR const env);
3726__parser__(flags=public-internal)
3727typedef void (*MkSelfDeleteF) ( MK_RT_ARGS MK_PTR self, MK_PTR const env);
3728__parser__(flags=public-internal)
3729typedef void (*MkSelfUnlinkF) ( MK_RT_ARGS MK_PTR self, MK_PTR const env);
3730typedef void (*MkLogF) ( MK_RT_ARGS MK_OBJN const obj, MK_OBJN fmt, MK_DBG const debug,
3731 MK_STRN const callfunc, MK_I32 const lvl);
3732typedef MK_STRN (*MkToStringF) ( MK_RT_ARGS MK_OBJN const obj);
3733typedef MK_PTR (*MkAllocCreateFLT) ( MK_RT_ARGS MK_TYP const type);
3734typedef void (*MkAllocDeleteF) ( MK_RT_ARGS MK_TYP const type, MK_PTR ptr);
3735typedef void (*MkTypeInitF) ( MK_RT_ARGS MK_TYP const type);
3736typedef bool (*MkLogFormatF) ( MK_RT_ARGS char* header, MK_SIZE const headerSize, MK_OBJN const obj,
3737 MK_STRN const caller, MK_I32 const debug, MK_STRN const fmt);
3739
3751__parser__(ignore)
3757
3758
3760// MkObjectC_C_API
3761
3762/* ####################################################################### */
3763/* ### ### */
3764/* ### T Y P E - A P I ### */
3765/* ### ### */
3766/* ####################################################################### */
3767
3905#define MkDbgTyp2(t,c) \
3906 mk_dbg_color_ln(c,"MkDbgTyp[%-32s]: typ<ID=%-2d,P=%-14p,RT=%p> type_class<%s:%p>, " #t, \
3907 MK_TRIM_LEFT(32,(t)->type_name), (t)->type_id, t, MkRT_X(t), \
3908 (t)->type_class->type_name, (t)->type_class)
3909#define MkDbgTyp(t) MkDbgTyp2(t,MK_COLOR_LIGHT_CYAN)
3910#define MkDbgTypListAll2(t,c) do { \
3911 MK_OBJ o; \
3912 MkRuntimeLogBufferPush(); \
3913 DL_FOREACH2((t)->type_class->instancesR,o,obj_protect.next) { \
3914 MkDbgTyp2(MkTyp(o),c); \
3915 } \
3916 MkRuntimeLogBufferPop(); \
3917} while (0)
3918#define MkDbgTypListAll(t) MkDbgTypListAll2(t,MK_COLOR_GREEN)
3919
3920#define MkDbgTypInstances_2(t,c) \
3921do { \
3922 MK_TYP _typ = (t); \
3923 if (_typ) { \
3924 mk_dbg_start_2(c,"MkDbgTypInstances: %s[%p] ", _typ->type_name, _typ); \
3925 int max=5; \
3926 for (MK_OBJ obj=MkTypeInstances(_typ); obj; obj=MkObjectNext(obj)) { \
3927 mk_dbg_next_2(c,"%p,",obj); \
3928 max--; \
3929 if(max==0) { \
3930 mk_dbg_next_2(MK_COLOR_RED,"%s", "break"); \
3931 break; \
3932 } \
3933 } \
3934 mk_dbg_end(); \
3935 } else { \
3936 mk_dbg_color_ln(c,"MkDbgTypInstances: %s[%p] ", #t, _typ); \
3937 } \
3938} while (0)
3939
3940#define MkDbgTypInstances(t) MkDbgTypInstances_2(t,MK_COLOR_CYAN)
3941
3942
3944__parser__(internal)
3945struct MkTypeS {
3946 // BEGIN-MkTypeS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
3947
3948 union {
3949 struct MkObjectS obj; // instance-base MkObjectS
3950 } super;
3951
3952 // END-MkTypeS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
3953
3954 // instance attributes
3955 #define MkTypeS_name_size 32
3959 bool noSelf;
3961 size_t objsize;
3962 size_t typsize;
3963
3966
3967 // slots
3981
3983
3984 struct MkAllocDefS objalloc;
3993};
3994
3995// BEGIN-MkTypeS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
3996
4000 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
4001
4002// Signature --------------------------------------------------------------
4005
4006 #define MkTypeC_SIGNATURE (MkObjectC_SIGNATURE ^ (11u<<10))
4007 #define MkTypeC_MASK (((1u<<22)-1)<<10)
4008
4010
4011// CompileTimeCast --------------------------------------------------------------
4014
4015 #define MkTypeC_X2typ(x) (x)
4016 #define MkTypeC_X2obj(x) MkOBJ(x)
4017
4019
4020// TypeDef --------------------------------------------------------------
4023
4025 __parser__(ignore) typedef struct MkTypeS MkTypeCR;
4027 __parser__(ignore) typedef const struct MkTypeS MkTypeCNR;
4029 #define MkTypeSTT (&MK_RT_REF._MkTypeC_TT)
4031 #define MkTypeC_TT (&MK_RT_REF._MkTypeC_TT)
4033 #define MkTypeC_type MK_TYP
4035 #define MkTypeCT_X(instance) ( (struct MkTypeS *) (MkOBJ_R(instance).type) )
4037 #define MkTypeCTT_X(instance) (MkOBJ_R(instance).type)
4039 #define MkTypeCT_TT(typ) ( (struct MkTypeS *) (typ) )
4041 #define MkTypeC_NS MK
4043 #define MkTypeCTT MkTypeCTT
4045 #define MkTypeCT ( (struct MkTypeS *) MkTypeCTT )
4046
4048
4049// TypeCheck --------------------------------------------------------------
4052
4053 #pragma GCC diagnostic push
4054 #pragma GCC diagnostic ignored "-Wattributes"
4055
4058 __parser__(class=MkTypeC,static,ignore)
4061 return MkSanitizeCheck(MkTypeC,mng);
4062 }
4063
4066 __parser__(class=MkTypeC,static,ignore)
4069 return MkSanitizeCheckO(MkTypeC,obj);
4070 }
4071
4072 #pragma GCC diagnostic pop
4073 #define MkTypeC_Check(mng) MkTypCheck(mng)
4074
4076
4079// MkTypeC_Class_Define_C_API
4080
4081// END-MkTypeS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
4082
4084__parser__(class=MkObjectC,internal,static)
4085mk_inline MK_TYP MkTyp(const MK_MNG mng) {
4086 if (!MkObjCheck(mng)) return NULL;
4087 MK_OBJ obj = (MK_OBJ) mng;
4088 if (MkTypCheck(obj)) return (MK_TYP)obj;
4089 MK_TYP typ = obj->type;
4090 if (MkTypCheck(typ)) return typ;
4091 return NULL;
4092}
4093
4095__parser__(ignore)
4096mk_inline MK_TYPN MkTypN(const MK_MNGN mng) {
4097 if (!MkObjCheck(mng)) return NULL;
4098 MK_OBJ obj = (MK_OBJ) mng;
4099 if (MkTypCheck(obj)) return (MK_TYPN)obj;
4100 MK_TYPN typ = obj->type;
4101 if (MkTypCheck(typ)) return typ;
4102 return NULL;
4103}
4104
4106#define MkTYP_R(x) (*(x)).super.typ
4108#define MkTYP(x) (&MkTYP_R(x))
4110#define MkTYP_O(o) (*o).type
4112#define MkTYP_X(x) MkOBJ_R(x).type
4113
4119__parser__(ignore)
4121 // BEGIN-MkTypeDefS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
4122
4123 union {
4124 struct MkObjectS obj; // instance-base MkObjectS
4125 struct MkTypeS typ; // instance-base MkTypeS
4126 } super;
4127
4128 // END-MkTypeDefS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
4129};
4130
4131// BEGIN-MkTypeDefS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
4132
4136 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
4137
4138// Signature --------------------------------------------------------------
4141
4142 #define MkTypeDefC_SIGNATURE (MkTypeC_SIGNATURE ^ (1u<<6))
4143 #define MkTypeDefC_MASK (((1u<<26)-1)<<6)
4144
4146
4147// CompileTimeCast --------------------------------------------------------------
4150
4151 #define MkTypeDefC_X2typ(x) MkTYP(x)
4152 #define MkTypeDefC_X2obj(x) MkOBJ(x)
4153
4155
4156// TypeDef --------------------------------------------------------------
4159
4161 __parser__(ignore) typedef struct MkTypeDefS MkTypeDefCR;
4163 __parser__(ignore) typedef const struct MkTypeDefS MkTypeDefCNR;
4165 #define MkTypeDefSTT (&MK_RT_REF._MkTypeDefC_TT)
4167 #define MkTypeDefC_TT (&MK_RT_REF._MkTypeDefC_TT)
4169 #define MkTypeDefCT_X(instance) ( (struct MkTypeS *) (MkOBJ_R(instance).type) )
4171 #define MkTypeDefCTT_X(instance) (MkOBJ_R(instance).type)
4173 #define MkTypeDefCT_TT(typ) ( (struct MkTypeS *) (typ) )
4175 #define MkTypeDefC_NS MK
4177 #define MkTypeDefCTT MkTypeDefCTT
4179 #define MkTypeDefCT ( (struct MkTypeS *) MkTypeDefCTT )
4180
4182
4185// MkTypeDefC_Class_Define_C_API
4186
4187// END-MkTypeDefS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
4188
4190__parser__(internal)
4191MK_EXTERN MK_PTR MK_DECL MkTypeSlotResolveP(MK_RT_ARGS MK_TYPN const type, size_t const offset, bool const force);
4192
4207#define MkTypeSlotResolve(_tt,fptr,force) ({ \
4208 MK_TYP tt = (_tt) ; /* _tt my be long */ \
4209 tt == NULL ? NULL : /* type not valid */ \
4210 !force && tt->fptr == (MK_PTR) 0x1 ? NULL : /* already resolved, NOT found */ \
4211 tt->fptr > (typeof(tt->fptr)) 0x1 ? tt->fptr : /* already resolved, NOT NULL, found */ \
4212 tt == MkTypeSTT ? NULL : /* already at the ROOT of the type */ \
4213 (typeof(tt->fptr)) MkTypeSlotResolveP(MK_RT_CALL tt, offsetof(struct MkTypeS, fptr), force); \
4214}) \
4215
4216#define MkTypeSlotCall(_tt,fptr,...) do { \
4217 typeof((_tt)->fptr) slot = MkTypeSlotResolve((_tt),fptr,false); \
4218 if (slot) (*slot)(MK_RT_CALL __VA_ARGS__); \
4219} while (false)
4220
4222// MkTypeC_C_API
4223
4224
4225// #######################################################################
4226// -----------------------------------------------------------------------
4232
4233__parser__push__(doc-group=TOR);
4234
4245#if defined(META_USE_SELF_REFCOUNT)
4246 // [MkObjInit2]
4247 #define MkObjInit2(rtmkV,rtExtV,sigV,typeV,refCountV,isLocalV) \
4248 (struct MkObjectS) { \
4249 .signature = sigV, \
4250 .refCount = refCountV, \
4251 .self = NULL, \
4252 .type = typeV, \
4253 .env = NULL, \
4254 .selfCreated = false, \
4255 .selfRefCount = 0, \
4256 .objRt = rtmkV, \
4257 .objRtExt = rtExtV, \
4258 .obj_protect = { \
4259 .isLocal = isLocalV, \
4260 .prev = NULL, \
4261 .next = NULL, \
4262 }, \
4263 }
4264 // [MkObjInit2]
4265#else
4266 #define MkObjInit2(rtmkV,rtExtV,sigV,typeV,refCountV,isLocalV) \
4267 (struct MkObjectS) { \
4268 .signature = sigV, \
4269 .refCount = refCountV, \
4270 .self = NULL, \
4271 .type = typeV, \
4272 .env = NULL, \
4273 .selfCreated = false, \
4274 .objRt = rtmkV, \
4275 .objRtExt = rtExtV, \
4276 .obj_protect = { \
4277 .isLocal = isLocalV, \
4278 .prev = NULL, \
4279 .next = NULL, \
4280 }, \
4281 }
4282#endif
4283
4284#define MkObjInit(rtmkV,rtExtV,cls,refCountV,isLocalV) \
4285 MkObjInit2(rtmkV,rtExtV,cls##_SIGNATURE,cls##_TT,refCountV,isLocalV)
4286
4287// [MkObjInitFromType]
4288#define MkObjInitFromType(typeV,isLocalV) \
4289 MkObjInit2(MK_RT_PTR, NULL, (*typeV).objsig, typeV, 0, isLocalV)
4290// [MkObjInitFromType]
4291
4292#define MkObjInitFromInstance(instV) \
4293 MkObjInit2(MK_RT_PTR, NULL, MkOBJ_R(instV).type->objsig, MkOBJ_R(instV).type, 0, false)
4294
4308__parser__(constructor)
4311 MK_OBJ const srcobj
4313
4325 MK_OBJ const srcmng,
4326 MK_STRN const ident
4328
4344__parser__(constructor)
4345MK_EXTERN MK_OBJ MK_DECL MkObjMerge_RT (
4347 MK_OBJ const obj
4349
4356__parser__(constructor)
4357MK_EXTERN MK_OBJ MK_DECL MkObjCreate_RT (
4359 MK_TYP type __parser__(internal,default=NULL),
4360 MK_PTR nat,
4361 MK_PTR lnk
4363
4364// *******************************************************************************
4365// PUBLIC object API
4366// *******************************************************************************
4367
4386__parser__(destructor,keep-destr)
4387MK_EXTERN void MK_DECL MkObjectDelete_RT (
4389 MK_OBJ obj
4391
4392#define MkObjectDelete_NULL(obj) MkObjectDeleteToNull(MkObjectDelete_RT,MK,obj)
4393#define MkObjectDelete_NULL_X(x) MkObjectDeleteToNull_X(MkObjectDelete_RT,MK,x)
4394#define MkObjectDelete_1X(x) MkObjectDeleteToNull_X(MkObjectDelete_RT,MK,x)
4395
4396#define MkObjectDeleteToNull(fct,NS,x) if (x) { fct (NS##_RT_CALL x); (x) = NULL ; }
4397#define MkObjectDeleteToNull_X(fct,NS,x) if (x) { fct (NS##_RT_CALL MkOBJ(x)); (x) = NULL ; }
4398
4414__parser__(destructor,lng-destr,lng-dispose)
4415MK_EXTERN void MK_DECL MkObjectDispose_RT (
4417 MK_OBJ obj
4419
4420#define MkObjectDispose_NULL(obj) MkObjectDeleteToNull(MkObjectDispose_RT,MK,obj)
4421#define MkObjectDispose_NULL_X(x) MkObjectDeleteToNull_X(MkObjectDispose_RT,MK,x)
4422#define MkObjectDispose_1X(x) MkObjectDispose(MkOBJ(x))
4423
4425#define MkObjectDeleteCallF_CHECK do { \
4426 assert (__data__ != NULL); \
4427} while (0)
4428
4429// [MkObjectDeleteCallF]
4431#define MkObjectDeleteCallF_ARGS \
4432 MK_RT_ARGS \
4433 MK_OBJN const obj __parser__(internal), \
4434 MK_STRN const typeName, \
4435 MK_HDL const typeHdl, \
4436 MK_HDL const objHdl, \
4437 MK_CBP const __data__ \
4438
4439#define MkObjectDeleteCallF_CALL MK_RT_CALL obj, __data__
4440
4485__parser__(flags=public-internal)
4486typedef enum MkErrorE ( MK_DECL *MkObjectDeleteCallF) ( MkObjectDeleteCallF_ARGS ) ;
4487
4489#define MkObjectDeleteFreeF_ARGS MK_RT_ARGS MK_CBP *dataP __parser__(inout)
4490
4491__parser__(flags=public-internal)
4492typedef void ( MK_DECL *MkObjectDeleteFreeF) ( MkObjectDeleteFreeF_ARGS ) ;
4493
4526__parser__(class=MkObjectC,callback-name=ObjectDelete,callback-null)
4527MK_EXTERN enum MkErrorE MK_DECL MkObjectDeleteCallbackSetup_RT (
4529 MK_STRN ident ,
4530 MkObjectDeleteCallF fCall __parser__(callback-call),
4531 MK_CBP callback __parser__(callback-data),
4532 MkObjectDeleteFreeF fFree __parser__(callback-free),
4533 MK_STRN filter __parser__(default=NULL)
4535// [MkObjectDeleteCallF]
4536
4540__parser__(class=MkObjectC)
4541MK_EXTERN void MK_DECL MkObjectDeleteCallbackCleanup_RT (
4543 MK_STRN ident
4545
4546__parser__pop__; // TOR
4547
4549// MkObjectC_TOR_C_API
4550
4551/* ####################################################################### */
4552/* ### ### */
4553/* ### O B J - A P I ### */
4554/* ### ### */
4555/* ####################################################################### */
4556
4571// ***********************************************************************************************
4572
4573
4581 MK_OBJ const tgtmng,
4582 MK_OBJN const srcmng
4584
4588MK_EXTERN MK_OBJ MK_DECL MkObjReset_RT (
4590 MK_OBJ const obj
4592
4593// ****************************************************************************************************
4594
4599
4600__parser__global__(hide-rx=^MkRef);
4601__parser__global__(pattern2prefix:MkRef=MkObj);
4602
4604#define MkRefLOCK 999999
4605
4608__parser__(static)
4610mk_inline void MkRefIncr ( MK_OBJ obj ) {
4611 if (obj) ++(*obj).refCount;
4612}
4613
4614#define MkRefIncr_1X(x) MkRefIncr(MkOBJ(x))
4615#define MkRefIncr_1M(m) MkRefIncr(MkObj(m))
4616
4630#define MkRefIncr_FX(x) MkRefIncr(MkOBJ(x))
4631
4640__parser__(static)
4641MK_EXTERN void MkRefDecr_RT (
4643 MK_OBJ obj
4645
4649#define MkRefDecr_O(o) do { MkRefDecr_RT(MK_RT_CALL o); o=NULL; } while (0)
4653#define MkRefDecr_X(x) do { MkRefDecr_RT(MK_RT_CALL MkOBJ(x)); x=NULL; } while (0)
4655#define MkRefDecr_X_NULL(x) do { MkRefDecr_RT(MK_RT_NULL MkOBJ(x)); x=NULL; } while (0)
4660#define MkRefDecr_M(m) do { MkRefDecr_RT(MK_RT_CALL MkObj(m)); m=NULL; } while (0)
4662#define MkRefDecr_M_NULL(m) do { MkRefDecr_RT(MK_RT_NULL MkObj(m)); m=NULL; } while (0)
4663
4665#define MkRefDecr_FX(x) do { --(MkOBJ_R(x).refCount); } while(0)
4666
4675mk_inline void MkRefIncrSelf( MK_OBJ const obj, MK_PTR const self, MK_PTR const env) {
4676 MK_INSTANCE_HDL(obj);
4677 obj->refCount++;
4678 obj->self = (obj->type->noSelf ? NULL : self);
4679 obj->env = env;
4680}
4681
4682#define MkRefIncrSelf_2X(x,s) MkRefIncrSelf(MkOBJ(x),s)
4683
4700 MK_OBJ const obj
4702
4707// 2. \b unlink the \e SELF from \e META using the \RMkRefDecrWithoutSelf call
4719 MK_OBJ const obj
4721
4726__parser__(keep,doc-no)
4729 MK_INSTANCE_HDL(obj);
4730 return (*obj).refCount;
4731}
4732
4733#define MkRefGet_1X(x) MkRefGet(MkOBJ(x))
4734
4739 MK_INSTANCE_HDL(obj);
4740 return (*obj).refCount=MkRefLOCK;
4741}
4742#define MkRefLock_1X(x) MkRefLock(MkOBJ(x))
4743
4748mk_inline bool MkRefIsLocked ( MK_OBJ const obj ) {
4749 MK_INSTANCE_HDL(obj);
4750 return (*obj).refCount >= MkRefLOCK;
4751}
4752#define MkRefIsLocked_1X(x) MkRefIsLocked(MkOBJ(x))
4753
4755#define MkRefSet(target,source) ({ \
4756 if (target != source) { \
4757 typeof(target) targetSave=target; \
4758 target = source;\
4759 MkRefDecr_X(targetSave);\
4760 MkRefIncr_1X(target);\
4761 } \
4762 target;\
4763})
4764
4767
4768#define MkRefCidN_NULL() MkRefCidN_RT(MK_RT_CALL_NULL_ONLY)
4769
4771// MkRef…
4772
4773// *******************************************************************************
4774
4775__parser__global__(hide-rx=^MkSelf);
4776__parser__global__(pattern2prefix:MkSelf=MkObj);
4777
4780
4781typedef void (*MkSelfIncrF) ( MK_RT_ARGS MK_PTR self, MK_PTR const env);
4782typedef void (*MkSelfDecrF) ( MK_RT_ARGS MK_PTR self, MK_PTR const env);
4783
4789mk_inline void MK_DECL MkSelfSet ( MK_OBJ const obj, MK_PTR const self, MK_PTR const env ) {
4790 MK_INSTANCE_HDL(obj);
4791 obj->env = env;
4792 obj->self = (obj->type->noSelf ? NULL : self);
4793}
4794
4795#define MkSelfSet_3X(x,self,env) MkSelfSet(MkOBJ(x),self,env)
4796
4802 // BUG FIX - 1 mar 2023: remove nonnull on obj because C# require this
4803 return obj ? obj->self : NULL;
4804}
4805
4806#define MkSelfGet_1X(x) MkSelfGet(MkOBJ(x))
4807
4832mk_inline enum MkErrorE MK_DECL MkSelfNew_RT (
4834 MK_OBJ obj __parser__(null-allowed),
4835 MK_PTR *self_out,
4836 MK_PTR const env
4837);
4838
4839#define MkSelfNew_3X(x,self_out,env) MkSelfNew(MkOBJ(x),self_out,env)
4840
4852 MK_OBJ const obj,
4853 MK_PTR const env
4854);
4855
4856#define MkSelfCreate_2X(x,env) MkSelfCreate(MkOBJ(x),env)
4857
4866__parser__(static)
4867MK_EXTERN bool MK_DECL MkSelfDelete_RT (
4869 MK_OBJ const obj
4871
4872#define MkSelfDelete_1X(x) MkSelfDelete_RT(MK_RT_CALL MkOBJ(x))
4873
4890__parser__(static)
4891MK_EXTERN bool MK_DECL MkSelfDeleteForce_RT (
4893 MK_OBJ obj
4895
4896#define MkSelfDeleteForce_1X(x) MkSelfDeleteForce(MkOBJ(x))
4897
4915__parser__(static)
4916MK_EXTERN void MK_DECL MkSelfUnlink_RT (
4918 MK_OBJ obj
4920
4921#define MkSelfUnlink_1X(x) MkSelfUnlink(MkOBJ(x))
4922
4926 MK_INSTANCE_HDL(obj);
4927 return obj->self != NULL;
4928}
4929
4930#define MkSelfExists_1X(x) MkSelExists(MkOBJ(x))
4931
4933
4934// addtogroup MkObjectC_Obj_C_API
4936
4937// ****************************************************************************************************
4938
4941
4942//__parser__global__(hide-rx=^MkType);
4943//__parser__global__(prefix2attribute=MkType@internal);
4944//__parser__global__(prefix2attribute=MkType@class=MkTypeC);
4945
4946__parser__push__(internal,class=MkTypeC); // \{ internal
4947
4951__parser__push__(doc-group=TOR);
4952
5039__parser__(macro)
5040MK_TYP MkTypeCreate ( MK_MACRO_TYP const clsV, MK_MACRO_TYP const basicV, MK_STRN const identV);
5041// [MkTypeCreate]
5042#define MkTypeCreate(clsV, basicV, identV) ({ \
5043 assert(!MkSysStringIsNULL(identV)); \
5044 MK_TYP ret = MkTypeDup2(basicV ## _TT,identV); \
5045 ret->objsig = clsV ## _SIGNATURE; \
5046 ret->objmask = clsV ## _MASK; \
5047 ret->objsize = sizeof(clsV##R); \
5048 ret->type_base = basicV ## _TT; \
5049 ret->type_class = ret; \
5050 ret ; \
5051})
5052// [MkTypeCreate]
5053
5073 MK_TYPN const typ,
5074 MK_STRN const ident
5076
5089 MK_TYPN const typ
5091
5102 MK_TYPN const typ
5104
5110 MK_TYP const typ
5112
5115 MK_TYP const typ
5116) {
5117 assert(typ != NULL);
5118 assert(typ->type_class != NULL);
5119 MK_OBJ ret = typ->type_class->instancesR;
5120 // BUG FIX 2 mar 2025
5121 // test: Nhi1Exec int.test --dev-testing --lang-cc --valgrind-server
5122 // analyse: after "Delete" the "prev/next" is NOT proper set if "type" from "Instances->Next"
5123 // and "type" from "ret->type->instances" are NOT in sync
5124 // Fix: pMkTypeDup2 take "sourceTyp->instances"
5125 if (ret) assert(ret->type->type_class == typ->type_class);
5126 return ret;
5127}
5128
5131#define MkTypeForeachInstancesSave(typ) DL_FOREACH_SAFE2((typ)->type_class->instancesR,obj,tmp,obj_protect.next)
5132
5136 MK_INSTANCE_HDL(typ);
5137 return (MK_TYP)MkTypeC_X2obj(typ)->obj_protect.next;
5138}
5139
5141
5142// MkTypeC_C_TOR_C_API
5148
5159__parser__(const,class-overload=MkObjectLog)
5160MK_EXTERN void MK_DECL MkTypeLog_RT (
5162 MK_TYPN const typ ,
5164 MK_DBG const debug __parser__(default=0),
5165 MK_STRN const callfunc __parser__(default=F#FUNC),
5166 MK_I32 const lvl __parser__(default=0)
5168
5169#define MkTypeLog_2Lvl(t,l,...) MkTypeLog_RT(MK_RT_CALL (t), __VA_ARGS__, (l)
5170
5171
5178#if META_DEBUG & META_DEBUG_TYPE
5179 #define MkTypeLoop(_cls, _var) \
5180 bool _var##_firstB = true; \
5181 _cls##_type _var##_first = (_cls##_type)_cls##_TT->type_class->instancesR; \
5182 for ( \
5183 _cls##_type _var = _var##_first; \
5184 ({ if (!_var##_firstB && _var == _var##_first) { \
5185 MkPanicV_2M(_var,"[MkTypeLoop] INTERNAL ERROR: found 'circle' in 'MkTypeC=%s'", _var->type_name); \
5186 } ; _var##_firstB = false; _var; }); \
5187 _var = (_cls##_type)_cls##_X2obj(_var)->obj_protect.next \
5188 )
5189#else
5190 #define MkTypeLoop(_cls, _var) \
5191 for (_cls##_type _var = (_cls##_type)_cls##_TT->type_class->instancesR; _var != NULL; \
5192 _var = (_cls##_type)_cls##_X2obj(_var)->obj_protect.next)
5193#endif
5194
5196
5197__parser__pop__; // \}
5198// internal
5199
5200// addtogroup MkTypeC_C_API
5202
5206
5208__parser__(internal,doc-group=Misc)
5209MK_EXTERN MK_BFL MK_DECL MkKernelGetTypeList_RT (
5212
5214
5215// ##################################################################################
5220
5228MK_EXTERN MK_STRN const MK_DECL MkObjectToName_RT (
5230 MK_OBJN const obj __parser__(null-allowed)
5232
5233#define MkObjectToName_1X(x) MkObjectToName(MkOBJ(x))
5234
5251 MK_OBJN const obj
5253
5254//2021.03.01 ao → #define MkObjectToNameOfType(o) MkObjectToNameOfType((MK_OBJ)(o))
5255#define MkObjectToNameOfType_1X(x) MkObjectToNameOfType(MkOBJ(x))
5256
5267__parser__(template-overload,template-in-c)
5268MK_EXTERN MK_STRN MK_DECL MkObjectToNameOfClass_RT (
5270 MK_OBJ const obj
5272
5273#define MkObjectToNameOfClass_1X(x) MkObjectToNameOfClass_RT(MK_RT_CALL MkOBJ(x))
5274
5287 MK_OBJN const inst __parser__(null-allowed)
5289
5290#define MkObjectToString_1X(x) MkObjectToString(x?MkOBJ(x):NULL)
5291#define MkObjectToString_1M(m) MkObjectToString(m?MkObjN(m):NULL)
5292
5296 MK_OBJ const obj __parser__(null-allowed)
5297) {
5298 return (obj == MK_NULL);
5299}
5300
5302// MkObjectC_Misc_C_API
5303
5304// #######################################################################
5305// -----------------------------------------------------------------------
5331
5332/* ####################################################################### */
5333/* ### ### */
5334/* ### L O G - A P I ### */
5335/* ### ### */
5336/* ####################################################################### */
5337
5351
5352__parser__push__(doc-group=Log);
5353
5369__parser__(no-type-extension)
5370MK_EXTERN void MK_DECL MkLogC_RT (
5373 MK_STRN const message ,
5374 MK_DBG const debug __parser__(default=0),
5375 MK_STRN const callfunc __parser__(default=F#FUNC)
5377
5378#define MkLogC_4X(x,message,debug,callfunc) MkLogC(MkOBJ(x),message,debug,callfunc)
5379#define MkLogC_3X(x,message,debug) MkLogC_3(MkOBJ(x),message,debug)
5380#define MkLogC_2X(x,message) MkLogC_2(MkOBJ(x),message)
5381#define MkLogW(x,callfunc,_debug,message) MkLogC(MkOBJ(x),message,_debug,callfunc)
5382
5392__parser__(ignore)
5393MK_EXTERN void MK_DECL MkDbgV_RT (
5396 MK_STRN const callfunc __parser__(default=F#FUNC),
5397 FILE *FH,
5398 MK_FST const printfmt,
5399 ...
5401
5402#define MkDbgV_2X(x,printfmt,...) MkDbgV_RT(MK_RT_CALL MkOBJ(x),__func__,stderr,printfmt,__VA_ARGS__)
5403#define MkDbgV_2O(o,printfmt,...) MkDbgV_RT(MK_RT_CALL o ,__func__,stderr,printfmt,__VA_ARGS__)
5404
5417 MK_STRN const callfunc __parser__(default=F#FUNC),
5418 MK_DBG debug __parser__(default=0),
5419 MK_FST const printfmt,
5420 ...
5422
5423#define MkLogV_lvl(x,debug,printfmt,...) MkLogV(MkOBJ(x),__func__,debug,printfmt,__VA_ARGS__)
5424
5425#define MkLogV_4M(x,callfunc,debug,printfmt,...) MkLogV(MkObjN(x),callfunc,debug,printfmt,__VA_ARGS__)
5426#define MkLogV_4X(x,callfunc,debug,printfmt,...) MkLogV(MkOBJ(x),callfunc,debug,printfmt,__VA_ARGS__)
5427#define MkLogV_3X(x,callfunc,printfmt,...) MkLogV_3(MkOBJ(x),callfunc,printfmt,__VA_ARGS__)
5428#define MkLogV_2X(x,printfmt,...) MkLogV_2(MkOBJ(x),printfmt,__VA_ARGS__)
5429
5443 MK_STRN const callfunc __parser__(default=F#FUNC),
5444 MK_DBG debug __parser__(default=0),
5445 MK_FST const printfmt,
5446 va_list var_list
5448
5449#define MkLogVL_5X(fmtobj,callfunc,debug,printfmt,var_list) \
5450 MkLogVL(MkOBJ(fmtobj),callfunc,debug,printfmt,var_list)
5451
5461 MK_STRN const callfunc __parser__(default=F#FUNC),
5462 MkBinaryR const data
5464
5465#define MkLogHEX_4X(fmtobj,callfunc,data,len) MkLogHEX_RT(MkOBJ(fmtobj),callfunc,data,len)
5466
5477__parser__(const)
5478MK_EXTERN void MK_DECL MkObjectLogShort_RT (
5480 MK_OBJN const obj ,
5482 MK_DBG const debug __parser__(default=0),
5483 MK_STRN const callfunc __parser__(default=F#FUNC),
5484 MK_I32 const lvl __parser__(default=0)
5486
5487#define MkObjectLogShort_1X(x) MkObjectLogShort(MkOBJ(x),NULL,0,__func__,0)
5488#define MkObjectLogShort_2Lvl(o,l) MkObjectLogShort(o,NULL,0,__func__,l)
5489
5500__parser__(const)
5501MK_EXTERN void MK_DECL MkObjectLogLong_RT (
5503 MK_OBJN const obj ,
5505 MK_DBG const debug __parser__(default=0),
5506 MK_STRN const callfunc __parser__(default=F#FUNC),
5507 MK_I32 const lvl __parser__(default=0)
5509
5510#define MkObjectLogLong_1X(x) MkObjectLogLong(MkOBJ(x),NULL,0,__func__,0)
5511#define MkObjectLogLong_1M(m) MkObjectLogLong(MkObj(m),NULL,0,__func__,0)
5512
5523__parser__(const)
5524MK_EXTERN void MK_DECL MkObjectLogType_RT (
5526 MK_OBJN const obj ,
5528 MK_DBG const debug __parser__(default=0),
5529 MK_STRN const callfunc __parser__(default=F#FUNC),
5530 MK_I32 const lvl __parser__(default=0)
5532
5533#define MkObjectLogLong_1X(x) MkObjectLogLong(MkOBJ(x),NULL,0,__func__,0)
5534#define MkObjectLogLong_1M(m) MkObjectLogLong(MkObj(m),NULL,0,__func__,0)
5535
5614 MK_OBJN const obj ,
5616 MK_DBG const debug __parser__(default=0),
5617 MK_STRN const callfunc __parser__(default=F#FUNC),
5618 MK_I32 const lvl __parser__(default=0)
5620
5621#define MkObjectLog_1X(x) MkObjectLog(MkOBJ(x),NULL,0,__func__,0)
5622#define MkObjectLog_2Lvl(o,l) MkObjectLog(o,NULL,0,__func__,l)
5623
5625
5627// MkObjectC_Log_C_API
5628
5629/* ####################################################################### */
5630/* ### ### */
5631/* ### D B G - A P I ### */
5632/* ### ### */
5633/* ####################################################################### */
5634
5642
5643__parser__global__(prefix2class:MkDbg=MkObjectC);
5644
5648__parser__(no-type-extension)
5649MK_EXTERN void MK_DECL MkDbgL_RT (
5652 MK_STRN const message ,
5653 MK_DBG const debug __parser__(default=0),
5654 MK_STRN const callfunc __parser__(default=F#FUNC),
5655 MK_I32 const lvl __parser__(default=0)
5657
5658#define MkDbgL_2M(x,message) MkDbgL(MkObj(x),message,0,__func__,-1)
5659
5663__parser__(no-type-extension,template-overload)
5664MK_EXTERN enum MkErrorE MK_DECL MkDbgDump_RT (
5666 MK_OBJN const obj,
5667 MK_STRN const message __parser__(default=S#"var"),
5668 MK_STRN const callfunc __parser__(default=F#FUNC)
5670
5671#define MkDbgDump_2M(x,message) MkDbgDump_2(MkObj(x),message)
5672
5676 MK_STRN const message ,
5677 MK_DBG const debug __parser__(default=0),
5678 MK_STRN const callfunc __parser__(default=F#FUNC),
5679 MK_I32 const lvl __parser__(default=0)
5681
5683MK_EXTERN void MK_DECL MkDbgSTACK_RT (
5686 MK_I32 const skip __parser__(default=0),
5687 MK_I32 const num __parser__(default=-1),
5688 MK_STRN const callfunc __parser__(default=F#FUNC)
5690
5691#define MkDbgSTACK_3X(x,num,callfunc) MkDbgSTACK_3(MkOBJ(x),num,callfunc)
5692
5700__parser__(no-type-extension)
5701MK_EXTERN void MK_DECL MkDbgO_RT (
5703 MK_OBJN const obj,
5704 MK_STRN const callfunc __parser__(default=F#FUNC)
5706
5707#define MkDbgO_2X(x,callfunc) MkDbgO(MkObj(x),callfunc)
5708#define MkDbgO_1X(x) MkDbgO_2X(x,__func__)
5709#define MkDbgO_1O(x) MkDbgO(x,__func__)
5710
5712__parser__(no-type-extension)
5713MK_EXTERN void MK_DECL MkDbgLogC_RT (
5715 MK_OBJN const obj,
5716 MK_STRN const callfunc __parser__(default=F#FUNC)
5718
5720#define MkDbgLogC_2X(x,callfunc) MkDbgLogC_2(MkOBJ(x),callfunc)
5721
5723// MkObjectC_Dbg_C_API
5724
5725/* MARK_B ################################################################ */
5726/* ### ### */
5727/* ### B U F F E R - A P I ### */
5728/* ### ### */
5729/* ####################################################################### */
5730
5755
5757#define MkBufferS_ils_size (0)
5758
5782// [MkBufferS_example]
5784 // BEGIN-MkBufferS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
5785
5786 union {
5787 struct MkObjectS obj; // instance-base MkObjectS
5788 } super;
5789
5790 // END-MkBufferS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
5791
5792 // instance attributes
5793 struct {
5796 } var;
5797 // instance storage
5798 struct {
5799 union MkBufferU first;
5802 } storage;
5809};
5810
5811// BEGIN-MkBufferS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
5812
5816 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
5817
5818// Signature --------------------------------------------------------------
5821
5822 #define MkBufferC_SIGNATURE (MkObjectC_SIGNATURE ^ (1u<<10))
5823 #define MkBufferC_MASK (((1u<<22)-1)<<10)
5824
5826
5827// CompileTimeCast --------------------------------------------------------------
5830
5831 #define MkBufferC_X2buf(x) (x)
5832 #define MkBufferC_X2obj(x) MkOBJ(x)
5833
5835
5836// TypeDef --------------------------------------------------------------
5839
5841 __parser__(ignore) typedef struct MkBufferS MkBufferCR;
5843 __parser__(ignore) typedef const struct MkBufferS MkBufferCNR;
5845 #define MkBufferC_T (&MK_RT_REF._MkBufferC_T)
5847 #define MkBufferC_TT (MkTYP(MkBufferC_T))
5849 #define MkBufferST MkBufferC_T
5851 #define MkBufferSTT (MkTYP(MkBufferST))
5853 #define MkBufferC_type MK_BUF
5855 #define MkBufferCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
5857 #define MkBufferCTT_X(instance) (MkOBJ_R(instance).type)
5859 #define MkBufferCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
5861 #define MkBufferC_NS MK
5863 #define MkBufferCTT MkBufferCTT
5865 #define MkBufferCT ( (struct MkTypeDefS *) MkBufferCTT )
5866
5868
5869// TypeCheck --------------------------------------------------------------
5872
5873 #pragma GCC diagnostic push
5874 #pragma GCC diagnostic ignored "-Wattributes"
5875
5878 __parser__(class=MkBufferC,static,hide)
5881 return MkSanitizeCheck(MkBufferC,mng);
5882 }
5883
5886 __parser__(class=MkBufferC,static,hide)
5889 return MkSanitizeCheckO(MkBufferC,obj);
5890 }
5891
5892 #pragma GCC diagnostic pop
5893 #define MkBufferC_Check(mng) MkBufCheck(mng)
5894
5896
5897// RunTimeCast --------------------------------------------------------------
5900
5902 __parser__(class=MkBufferC,hide,static)
5903 META_ATTRIBUTE_SANITIZE
5906 return (MkBufCheck(mng) ? (MK_BUF)mng : NULL);
5907 }
5908
5910 __parser__(class=MkBufferC,hide,static)
5911 META_ATTRIBUTE_SANITIZE
5914 return (MkBufCheck(mng) ? (MK_BUFN)mng : NULL);
5915 }
5916
5918 #define MkBufRaise(_buf) if (!_MkCheckX(MkBufferC,_buf)) { \
5919 MkErrorSetC_1E("'MkBufferC' hdl is NULL"); \
5920 goto error ; \
5921 }
5922
5924 #define MkBUF_R(x) (*(x)).super.buf
5926 #define MkBUF(x) (&MkBUF_R(x))
5927
5929
5932// MkBufferC_Class_Define_C_API
5933
5934// END-MkBufferS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
5935// [MkBufferS_example]
5936
5938// MkBufferC_C_API
5939
5940// =========================================================================
5941// BEGIN-MkBufferS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
5942
5945
5948
5949__parser__push__(doc-group=_ignore_,doc-index=Class,doc-name=Export,class=MkBufferC);
5950
5966__parser__(class-overload=MkObjectHandleGet)
5970 MK_BUF const buf __parser__(null-allowed)
5971) {
5972 return MkObjectHandleGet(buf?MkOBJ(buf):NULL);
5973}
5974
5983__parser__(flags=new)
5985mk_inline MK_BUF MkBufferHandleResolve_RT (
5987 MK_HDL const netHdl
5988) {
5989 return MkBuf(MkObjectHandleResolve(netHdl));
5990}
5991
6001#define MkBufferHandleResolve_e(netHdl) ({ \
6002 MK_HDL tmpHdl=netHdl; \
6003 MK_BUF tmp; \
6004 if (tmpHdl==0) { \
6005 tmp=NULL; \
6006 } else { \
6007 tmp=MkBufferHandleResolve(tmpHdl); \
6008 if (tmp==NULL) { \
6009 MkErrorSetC_1_NULL("ERROR: 'MkBufferC' handle is 'NULL'"); \
6010 goto error; \
6011 }; \
6012 }; \
6013 tmp; \
6014})
6015
6017
6019// Class export & import
6020
6024 __parser__(flags=new,doc-group=_ignore_,doc-index=Class,doc-name=Misc,class=MkBufferC,null-return-allow)
6027 return (MK_BUF)MK_NULL;
6028 }
6030// MkBufferC - Misc - function
6031
6033// MkBufferC_Class_C_API
6034
6035// END-MkBufferS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6036
6037// #######################################################################
6038// -----------------------------------------------------------------------
6050
6052#define MkBuffer64S_ils_size (64)
6053
6057__parser__(ignore)
6059 // BEGIN-MkBuffer64S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6060
6061 union {
6062 struct MkObjectS obj; // instance-base MkObjectS
6063 struct MkBufferS buf; // instance-base MkBufferS
6064 } super;
6065
6066 // END-MkBuffer64S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6067
6068 // instance attributes
6070};
6071
6072// BEGIN-MkBuffer64S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6073
6077 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
6078
6079// Signature --------------------------------------------------------------
6082
6083 #define MkBuffer64C_SIGNATURE (MkBufferC_SIGNATURE ^ (1u<<6))
6084 #define MkBuffer64C_MASK (((1u<<26)-1)<<6)
6085
6087
6088// CompileTimeCast --------------------------------------------------------------
6091
6092 #define MkBuffer64C_X2buf(x) MkBUF(x)
6093 #define MkBuffer64C_X2obj(x) MkOBJ(x)
6094
6096
6097// TypeDef --------------------------------------------------------------
6100
6102 __parser__(ignore) typedef struct MkBuffer64S MkBuffer64CR;
6104 __parser__(ignore) typedef const struct MkBuffer64S MkBuffer64CNR;
6106 #define MkBuffer64C_T (&MK_RT_REF._MkBuffer64C_T)
6108 #define MkBuffer64C_TT (MkTYP(MkBuffer64C_T))
6110 #define MkBuffer64ST MkBuffer64C_T
6112 #define MkBuffer64STT (MkTYP(MkBuffer64ST))
6114 #define MkBuffer64CT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
6116 #define MkBuffer64CTT_X(instance) (MkOBJ_R(instance).type)
6118 #define MkBuffer64CT_TT(typ) ( (struct MkTypeDefS *) (typ) )
6120 #define MkBuffer64C_NS MK
6122 #define MkBuffer64CTT MkBuffer64CTT
6124 #define MkBuffer64CT ( (struct MkTypeDefS *) MkBuffer64CTT )
6125
6127
6130// MkBuffer64C_Class_Define_C_API
6131
6132// END-MkBuffer64S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6133
6135// MkBuffer64C_C_API
6136
6137// #######################################################################
6138// -----------------------------------------------------------------------
6144
6146#define MkBuffer256S_ils_size (256)
6147
6151__parser__(ignore)
6153 // BEGIN-MkBuffer256S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6154
6155 union {
6156 struct MkObjectS obj; // instance-base MkObjectS
6157 struct MkBufferS buf; // instance-base MkBufferS
6158 } super;
6159
6160 // END-MkBuffer256S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6161
6162 // instance attributes
6164};
6165
6166// BEGIN-MkBuffer256S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6167
6171 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
6172
6173// Signature --------------------------------------------------------------
6176
6177 #define MkBuffer256C_SIGNATURE (MkBufferC_SIGNATURE ^ (2u<<6))
6178 #define MkBuffer256C_MASK (((1u<<26)-1)<<6)
6179
6181
6182// CompileTimeCast --------------------------------------------------------------
6185
6186 #define MkBuffer256C_X2buf(x) MkBUF(x)
6187 #define MkBuffer256C_X2obj(x) MkOBJ(x)
6188
6190
6191// TypeDef --------------------------------------------------------------
6194
6196 __parser__(ignore) typedef struct MkBuffer256S MkBuffer256CR;
6198 __parser__(ignore) typedef const struct MkBuffer256S MkBuffer256CNR;
6200 #define MkBuffer256C_T (&MK_RT_REF._MkBuffer256C_T)
6202 #define MkBuffer256C_TT (MkTYP(MkBuffer256C_T))
6204 #define MkBuffer256ST MkBuffer256C_T
6206 #define MkBuffer256STT (MkTYP(MkBuffer256ST))
6208 #define MkBuffer256CT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
6210 #define MkBuffer256CTT_X(instance) (MkOBJ_R(instance).type)
6212 #define MkBuffer256CT_TT(typ) ( (struct MkTypeDefS *) (typ) )
6214 #define MkBuffer256C_NS MK
6216 #define MkBuffer256CTT MkBuffer256CTT
6218 #define MkBuffer256CT ( (struct MkTypeDefS *) MkBuffer256CTT )
6219
6221
6224// MkBuffer256C_Class_Define_C_API
6225
6226// END-MkBuffer256S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6227
6229// MkBuffer256C_C_API
6230
6231// #######################################################################
6232// -----------------------------------------------------------------------
6238
6240#define MkBuffer1024S_ils_size (1024)
6241
6245__parser__(ignore)
6247 // BEGIN-MkBuffer1024S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6248
6249 union {
6250 struct MkObjectS obj; // instance-base MkObjectS
6251 struct MkBufferS buf; // instance-base MkBufferS
6252 } super;
6253
6254 // END-MkBuffer1024S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6255
6256 // instance attributes
6258};
6259
6260// BEGIN-MkBuffer1024S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6261
6265 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
6266
6267// Signature --------------------------------------------------------------
6270
6271 #define MkBuffer1024C_SIGNATURE (MkBufferC_SIGNATURE ^ (3u<<6))
6272 #define MkBuffer1024C_MASK (((1u<<26)-1)<<6)
6273
6275
6276// CompileTimeCast --------------------------------------------------------------
6279
6280 #define MkBuffer1024C_X2buf(x) MkBUF(x)
6281 #define MkBuffer1024C_X2obj(x) MkOBJ(x)
6282
6284
6285// TypeDef --------------------------------------------------------------
6288
6292 __parser__(ignore) typedef const struct MkBuffer1024S MkBuffer1024CNR;
6294 #define MkBuffer1024C_T (&MK_RT_REF._MkBuffer1024C_T)
6296 #define MkBuffer1024C_TT (MkTYP(MkBuffer1024C_T))
6298 #define MkBuffer1024ST MkBuffer1024C_T
6300 #define MkBuffer1024STT (MkTYP(MkBuffer1024ST))
6302 #define MkBuffer1024CT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
6304 #define MkBuffer1024CTT_X(instance) (MkOBJ_R(instance).type)
6306 #define MkBuffer1024CT_TT(typ) ( (struct MkTypeDefS *) (typ) )
6308 #define MkBuffer1024C_NS MK
6310 #define MkBuffer1024CTT MkBuffer1024CTT
6312 #define MkBuffer1024CT ( (struct MkTypeDefS *) MkBuffer1024CTT )
6313
6315
6318// MkBuffer1024C_Class_Define_C_API
6319
6320// END-MkBuffer1024S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
6321
6323// MkBuffer1024C_C_API
6324
6325#ifndef __has_parser__
6326
6336#define MkBuf2XXXfast(buf) (*(buf)->storage.first.A)
6337
6338#define MkBuf2BOLfast(buf) MkBuf2XXXfast(buf).BOL
6339#define MkBuf2I8fast(buf) MkBuf2XXXfast(buf).I8
6340#define MkBuf2I16fast(buf) MkBuf2XXXfast(buf).I16
6341#define MkBuf2I32fast(buf) MkBuf2XXXfast(buf).I32
6342#define MkBuf2I64fast(buf) MkBuf2XXXfast(buf).I64
6343#define MkBuf2FLTfast(buf) MkBuf2XXXfast(buf).FLT
6344#define MkBuf2DBLfast(buf) MkBuf2XXXfast(buf).DBL
6346
6353#define MkBuf2XXX(xxx,len,buf) ({MK_##xxx __tmp; memcpy(&__tmp,buf->storage.first.B,len); __tmp;})
6354
6355#define MkBuf2BOL(buf) MkBuf2XXX(BOL,1,buf)
6356#define MkBuf2I8(buf) MkBuf2XXX(I8,1,buf)
6357#define MkBuf2I16(buf) MkBuf2XXX(I16,2,buf)
6358#define MkBuf2I32(buf) MkBuf2XXX(I32,4,buf)
6359#define MkBuf2I64(buf) MkBuf2XXX(I64,8,buf)
6360#define MkBuf2FLT(buf) MkBuf2XXX(FLT,4,buf)
6361#define MkBuf2DBL(buf) MkBuf2XXX(DBL,8,buf)
6362
6363#define MkBuf2Ptr(len,ptr,buf) memcpy((void*)ptr,buf->storage.first.B,len)
6364#define MkBuf2BOL_P(ptr,buf) MkBuf2Ptr(1,ptr,buf)
6365#define MkBuf2I8_P(ptr,buf) MkBuf2Ptr(1,ptr,buf)
6366#define MkBuf2I16_P(ptr,buf) MkBuf2Ptr(2,ptr,buf)
6367#define MkBuf2I32_P(ptr,buf) MkBuf2Ptr(4,ptr,buf)
6368#define MkBuf2I64_P(ptr,buf) MkBuf2Ptr(8,ptr,buf)
6369#define MkBuf2FLT_P(ptr,buf) MkBuf2Ptr(4,ptr,buf)
6370#define MkBuf2DBL_P(ptr,buf) MkBuf2Ptr(8,ptr,buf)
6371
6372#define MkBuf2Ptr_A(l,a,b) memcpy(a.B##l,b->storage.first.B,l)
6373#define MkBuf2BOL_A(ato,buf) MkBuf2Ptr_A(1,ato,buf)
6374#define MkBuf2I8_A(ato,buf) MkBuf2Ptr_A(1,ato,buf)
6375#define MkBuf2I16_A(ato,buf) MkBuf2Ptr_A(2,ato,buf)
6376#define MkBuf2I32_A(ato,buf) MkBuf2Ptr_A(4,ato,buf)
6377#define MkBuf2I64_A(ato,buf) MkBuf2Ptr_A(8,ato,buf)
6378#define MkBuf2FLT_A(ato,buf) MkBuf2Ptr_A(4,ato,buf)
6379#define MkBuf2DBL_A(ato,buf) MkBuf2Ptr_A(8,ato,buf)
6380
6382// MkBuf2TT
6383
6384#endif // !__has_parser__
6385
6386__parser__push__(hide,overload-c-no);
6387
6401
6405 MK_STRN const str,
6406 MK_NUM const length,
6407 MK_BOL *val_out
6409
6410#define MkString2O(s,l,r) MkString2BOL_RT(MK_RT_CALL s,l,r)
6411
6414 MK_STRN const str,
6415 MK_NUM const length,
6416 MK_I8 *val_out
6418
6419#define MkString2Y(s,l,r) MkString2I8_RT(MK_RT_CALL s,l,r)
6420
6423 MK_STRN const str,
6424 MK_NUM const length,
6425 MK_I16 *val_out
6427
6428#define MkString2S(s,l,r) MkString2I16_RT(MK_RT_CALL s,l,r)
6429
6432 MK_STRN const str,
6433 MK_NUM const length,
6434 MK_U16 *val_out
6436
6437#define MkString2US(s,l,r) MkString2U16_RT(MK_RT_CALL s,l,r)
6438
6441 MK_STRN const str,
6442 MK_NUM const length,
6443 MK_I32 *val_out
6445
6446#define MkString2I(s,l,r) MkString2I32_RT(MK_RT_CALL s,l,r)
6447
6450 MK_STRN const str,
6451 MK_NUM const length,
6452 MK_U32 *val_out
6454
6455#define MkString2UI(s,l,r) MkString2U32_RT(MK_RT_CALL s,l,r)
6456
6459 MK_STRN const str,
6460 MK_NUM const length,
6461 MK_I64 *val_out
6463
6464#define MkString2W(s,l,r) MkString2I64_RT(MK_RT_CALL s,l,r)
6465
6466/*
6467MK_EXTERN enum MkErrorE MK_DECL MkString2LLG_RT (
6468 MK_PARSER_RT
6469 MK_STRN const str,
6470 MK_NUM const length,
6471 MK_LLG *val_out
6472) MK_ATTR_RT_STATIC;
6473
6474#define MkString2X(s,l,r) MkString2LLG_RT(MK_RT_CALL s,l,r)
6475*/
6476
6479 MK_STRN const str,
6480 MK_NUM const length,
6481 MK_FLT *val_out
6483
6484#define MkString2F(s,l,r) MkString2FLT_RT(MK_RT_CALL s,l,r)
6485
6488 MK_STRN const str,
6489 MK_NUM const length,
6490 MK_DBL *val_out
6492
6493#define MkString2D(s,l,r) MkString2DBL_RT(MK_RT_CALL s,l,r)
6494
6497 MK_STRN const str,
6498 MK_NUM const length,
6499 MK_LONG *val_out
6501
6504 MK_STRN const str,
6505 MK_NUM const length,
6506 MK_BOOL *val_out
6508
6509__parser__(internal)
6510MK_EXTERN enum MkErrorE MK_DECL MkString2ATO_RT (
6512 MK_STRN const str,
6513 MK_NUM const length,
6514 enum MkTypeE type,
6515 MK_ATO *val_out
6517
6518MK_EXTERN enum MkErrorE MK_DECL MkString2HDL_RT (
6520 MK_STRN const str,
6521 MK_NUM const length,
6522 MK_HDL *val_out
6524
6526
6528// MkString2TT
6530// MkBufferC_C_API
6531
6532// #######################################################################
6533// -----------------------------------------------------------------------
6538
6539__parser__push__(doc-group=TOR);
6540
6553// [MkBufferCreate]
6554__parser__(constructor,lng-constr)
6555MK_EXTERN MK_BUF MK_DECL MkBufferCreate_RT (
6557 MK_TYP type __parser__(internal,default=NULL),
6558 MK_NUM const size __parser__(default=0)
6560// [MkBufferCreate]
6561
6563__parser__(constructor,doc-sort=ils0)
6564MK_EXTERN MK_BUF MK_DECL MkBufferCreate64_RT (
6566 MK_NUM const size __parser__(default=0)
6568
6570__parser__(constructor,doc-sort=ils1)
6571MK_EXTERN MK_BUF MK_DECL MkBufferCreate256_RT (
6573 MK_NUM const size __parser__(default=0)
6575
6577__parser__(constructor,doc-sort=ils2)
6578MK_EXTERN MK_BUF MK_DECL MkBufferCreate1024_RT (
6580 MK_NUM const size __parser__(default=0)
6582
6583__parser__(constructor,macro,doc-sort=tmpl0)
6597// [MkBufferCreateTLS_T]
6598#define MkBufferCreateTLS_T(cls,name,size) \
6599 static MkThreadLocal cls##R name##R = {0}; \
6600 MK_BUF name = MkBUF(&name##R); \
6601 if (unlikely(!__MkCheckX(cls,&name##R))) { \
6602 MkBufferInit(name,cls##_TT,size); \
6603 MkRefIncr_1X(name); \
6604 } else if (MkBUF_R(&name##R).var.cursize) { \
6605 MkBufferReset(name); \
6606 }
6607// [MkBufferCreateTLS_T]
6608
6609__parser__(constructor,macro,doc-sort=tmpl1)
6617// [MkBufferCreateTLS_inout_T]
6618#define MkBufferCreateTLS_inout_T(cls,name,inout) \
6619 static MkThreadLocal struct MkBufferS __hidden_##name##R = {0}; \
6620 MK_BUF name = *inout != NULL ? *inout : &__hidden_##name##R; \
6621 if (likely(!__MkCheckX(MkBufferC,name))) { \
6622 MkBufferInit(name,cls##_TT,0); \
6623 MkRefIncr_1X(name); \
6624 } else if (name->var.cursize) { \
6625 MkBufferReset(name); \
6626 } \
6627// [MkBufferCreateTLS_inout_T]
6628
6629__parser__(constructor,macro,doc-sort=tmpl2)
6644// [MkBufferCreateLOCAL_T]
6645#define MkBufferCreateLOCAL_T(cls,name,size) \
6646 cls##R name##R = {0}; \
6647 struct MkBufferS * const name = MkBUF(&name##R); \
6648 MkBufferInit(name,cls##_TT,size)
6649// [MkBufferCreateLOCAL_T]
6650
6659__parser__(constructor)
6660MK_EXTERN MK_BUF MK_DECL MkBufferCreateI8_RT (
6662 MK_I8 const val
6664
6667__parser__(constructor)
6668MK_EXTERN MK_BUF MK_DECL MkBufferCreateBOL_RT (
6670 MK_BOL const val
6672
6675__parser__(constructor)
6676MK_EXTERN MK_BUF MK_DECL MkBufferCreateI16_RT (
6678 MK_I16 const val
6680
6683__parser__(constructor)
6684MK_EXTERN MK_BUF MK_DECL MkBufferCreateI32_RT (
6686 MK_I32 const val
6688
6691__parser__(constructor)
6692MK_EXTERN MK_BUF MK_DECL MkBufferCreateFLT_RT (
6694 MK_FLT const val
6696
6699__parser__(constructor)
6700MK_EXTERN MK_BUF MK_DECL MkBufferCreateI64_RT (
6702 MK_I64 const val
6704
6707__parser__(constructor)
6708MK_EXTERN MK_BUF MK_DECL MkBufferCreateDBL_RT (
6710 MK_DBL const val
6712
6715__parser__(constructor)
6716MK_EXTERN MK_BUF MK_DECL MkBufferCreateSTR_RT (
6718 MK_STRN const val
6720
6723__parser__(constructor)
6724MK_EXTERN MK_BUF MK_DECL MkBufferCreateBIN_RT (
6726 MkBinaryR const val
6728
6741__parser__(doc-sort=b0)
6742MK_EXTERN MK_BUF MK_DECL MkBufferCreateTLS_RT (
6744 MK_STRN const tlsName ,
6745 bool const resetB __parser__(default=true)
6747
6750__parser__(constructor,static,doc-sort=b1)
6751MK_EXTERN MK_BUF MK_DECL MkBufferCreateBUF_RT (
6753 MK_BUFN const val
6755
6776__parser__(internal)
6777MK_EXTERN void MK_DECL MkBufferFree_RT (
6779 MK_BUF const buf
6781
6786// [MkBufferInit]
6787__parser__(internal)
6788MK_EXTERN void MK_DECL MkBufferInit_RT (
6790 MK_BUF const buf,
6791 MK_TYP type __parser__(internal,default=NULL),
6792 MK_NUM const size __parser__(default=0)
6794// [MkBufferInit]
6795
6801__parser__(destructor)
6802MK_EXTERN void MK_DECL MkBufferDelete_RT (
6804 MK_BUF const buf
6806
6816__parser__(constructor)
6817MK_EXTERN MK_BUF MK_DECL MkBufferDup_RT (
6819 MK_BUFN const buf
6821
6837__parser__(constructor)
6838MK_EXTERN MK_BUF MK_DECL MkBufferMerge_RT (
6840 MK_BUF const buf
6842
6843__parser__pop__; // TOR
6844
6846// MkBufferC_TOR_C_API
6847
6848// #######################################################################
6849// -----------------------------------------------------------------------
6854
6855__parser__global__(prefix2doc:MkBufferGet=Get);
6856
6868MK_EXTERN enum MkErrorE MK_DECL MkBufferGetI8_RT (
6870 MK_BUFN const buf,
6871 MK_I8 * const val_out
6873
6876MK_EXTERN enum MkErrorE MK_DECL MkBufferGetBOL_RT (
6878 MK_BUFN const buf,
6879 MK_BOL * const val_out
6881
6884MK_EXTERN enum MkErrorE MK_DECL MkBufferGetI16_RT (
6886 MK_BUFN const buf,
6887 MK_I16 * const val_out
6889
6892__parser__(internal)
6893MK_EXTERN enum MkErrorE MK_DECL MkBufferGetU16_RT (
6895 MK_BUFN const buf,
6896 MK_U16 * const val_out
6898
6901MK_EXTERN enum MkErrorE MK_DECL MkBufferGetI32_RT (
6903 MK_BUFN const buf,
6904 MK_I32 * const val_out
6906
6909__parser__(internal)
6910MK_EXTERN enum MkErrorE MK_DECL MkBufferGetU32_RT (
6912 MK_BUFN const buf,
6913 MK_U32 * const val_out
6915
6918MK_EXTERN enum MkErrorE MK_DECL MkBufferGetFLT_RT (
6920 MK_BUFN const buf,
6921 MK_FLT * const val_out
6923
6926MK_EXTERN enum MkErrorE MK_DECL MkBufferGetI64_RT (
6928 MK_BUFN const buf,
6929 MK_I64 * const val_out
6931
6932/*
6935__parser__(internal)
6936MK_EXTERN enum MkErrorE MK_DECL MkBufferGetLL_RT (
6937 MK_PARSER_RT
6938 MK_BUFN const buf,
6939 MK_LLG * const val_out
6940) MK_ATTR_RT_INSTANCE;
6941
6942#define MkBufferGetLLG(b,o) MkBufferGetLL(b,o)
6943*/
6944
6947MK_EXTERN enum MkErrorE MK_DECL MkBufferGetDBL_RT (
6949 MK_BUFN const buf,
6950 MK_DBL * const val_out
6952
6957MK_EXTERN enum MkErrorE MK_DECL MkBufferGetBIN_RT (
6959 MK_BUFN const buf,
6960 MkBinaryR * const val_out
6962
6966// [__parser__out__]
6967MK_EXTERN enum MkErrorE MK_DECL MkBufferGetSTR_RT (
6969 MK_BUFN const buf,
6970 MK_STRN * const val_out
6972// [__parser__out__]
6973
6978MK_EXTERN enum MkErrorE MK_DECL MkBufferGetStringR_RT (
6980 MK_BUFN const buf,
6981 MkStringR * const val_out
6983
6987MK_EXTERN enum MkErrorE MK_DECL MkBufferGetBUF_RT (
6989 MK_BUF const buf,
6990 MK_BUF * const val_out
6992
7002__parser__(no-static)
7003MK_EXTERN enum MkErrorE MK_DECL MkBufferGetBFL_RT (
7005 MK_BUFN const buf,
7006 MK_BFL * const val_inout
7008
7011__parser__(internal)
7012MK_EXTERN enum MkErrorE MK_DECL MkBufferGetLONG_RT (
7014 MK_BUFN const buf,
7015 MK_LONG * const val_out
7017
7020__parser__(internal)
7021MK_EXTERN enum MkErrorE MK_DECL MkBufferGetBOOL_RT (
7023 MK_BUFN const buf,
7024 MK_BOOL * const val_out
7026
7028// MkBufferC_Get_C_API
7029
7030
7031// #######################################################################
7032// -----------------------------------------------------------------------
7037
7038__parser__global__(prefix2doc:MkBufferSet=Set);
7039
7049MK_EXTERN MK_BUF MK_DECL MkBufferSetI8_RT (
7051 MK_BUF const buf,
7052 MK_I8 const val
7054
7057MK_EXTERN MK_BUF MK_DECL MkBufferSetBOL_RT (
7059 MK_BUF const buf,
7060 MK_BOL const val
7062
7065MK_EXTERN MK_BUF MK_DECL MkBufferSetI16_RT (
7067 MK_BUF const buf,
7068 MK_I16 const val
7070
7073MK_EXTERN MK_BUF MK_DECL MkBufferSetI32_RT (
7075 MK_BUF const buf,
7076 MK_I32 const val
7078
7081MK_EXTERN MK_BUF MK_DECL MkBufferSetFLT_RT (
7083 MK_BUF const buf,
7084 MK_FLT const val
7086
7089MK_EXTERN MK_BUF MK_DECL MkBufferSetI64_RT (
7091 MK_BUF const buf,
7092 MK_I64 const val
7094
7097MK_EXTERN MK_BUF MK_DECL MkBufferSetDBL_RT (
7099 MK_BUF const buf,
7100 MK_DBL const val
7102
7105MK_EXTERN MK_BUF MK_DECL MkBufferSetSTR_RT (
7107 MK_BUF const buf,
7108 MK_STRN const val
7110
7113MK_EXTERN MK_BUF MK_DECL MkBufferSetBIN_RT (
7115 MK_BUF const buf,
7116 MkBinaryR const val
7118
7121MK_EXTERN MK_BUF MK_DECL MkBufferSetBUF_RT (
7123 MK_BUF const buf,
7124 MK_BUFN const val
7126
7131MK_EXTERN MK_BUF MK_DECL MkBufferSetVL_RT (
7133 MK_BUF const buf,
7134 MK_FST const val,
7135 va_list var_list
7137
7141MK_EXTERN MK_BUF MK_DECL MkBufferSetV_RT (
7143 MK_BUF const buf,
7144 MK_FST const val,
7145 ...
7147
7150MK_EXTERN MK_BUF MK_DECL MkBufferSetBinaryR_RT (
7152 MK_BUF const buf,
7153 MkBinaryR const val
7155
7158MK_EXTERN MK_BUF MK_DECL MkBufferSetStringR_RT (
7160 MK_BUF const buf,
7161 MkStringR const val
7163
7165// MkBufferC_Set_C_API
7166
7167// #######################################################################
7168// -----------------------------------------------------------------------
7173
7174__parser__push__(doc-group=Info);
7175
7179__parser__(no-rpc)
7180MK_EXTERN MK_STRB MK_DECL MkBufferGetType1_RT (
7182 MK_BUFN const buf
7184
7188MK_EXTERN enum MkTypeE MK_DECL MkBufferGetType2_RT (
7190 MK_BUFN const buf
7192
7196MK_EXTERN MK_STRN MK_DECL MkBufferGetType3_RT (
7198 MK_BUFN const buf
7200
7206MK_EXTERN bool MK_DECL MkBufferIsLocal_RT (
7208 MK_BUFN const buf
7210
7221__parser__(const,class-overload=MkObjectLog)
7222MK_EXTERN void MK_DECL MkBufferLog_RT (
7224 MK_BUFN const buf ,
7226 MK_DBG const debug __parser__(default=0),
7227 MK_STRN const callfunc __parser__(default=F#FUNC),
7228 MK_I32 const lvl __parser__(default=0)
7230
7238__parser__(internal)
7239MK_EXTERN void MK_DECL MkBufferLogSS_RT (
7241 MK_BUFN const buf,
7242 MK_STRN const varname __parser__(default=S#"buf"),
7244 MK_STRN const callfunc __parser__(default=F#FUNC)
7246
7256 MK_BUFN const buf,
7257 MK_STRN const varname __parser__(default=S#"buf"),
7259 MK_STRN const callfunc __parser__(default=F#FUNC)
7261
7262#define MkBufferLogS_2V(buf,fmt) MkBufferLogS_3(buf,#fmt,MkOBJ(fmt))
7263
7265
7267// MkBufferC_Info_C_API
7268
7269
7270// #######################################################################
7271// -----------------------------------------------------------------------
7276
7289 MK_BUFN const buf1,
7290 MK_BUFN const buf2
7292
7302 MK_BUF const buf, // TODO: special case update buffer should be default return
7303 enum MkTypeE const typ
7305
7307__parser__(class-overload=MkObjectToString)
7311 MK_BUFN const inst
7313
7324 MK_BUF const buf,
7325 MK_NUM const size
7327
7337 MK_BUF const buf,
7338 MK_NUM const size
7340
7348 MK_BUF const buf
7350
7360 MK_BUF const buf
7362
7369__parser__(const)
7370MK_EXTERN MK_BUF MK_DECL MkBufferCopy_RT (
7372 MK_BUF const buf,
7373 MK_BUFN const srce
7375
7388__parser__(no-static)
7389MK_EXTERN MK_BUF MK_DECL MkBufferTemp_RT (
7391 MK_BUFN const buf
7393
7395// MkBufferC_Misc_C_API
7396
7397
7398// #######################################################################
7399// -----------------------------------------------------------------------
7404
7405__parser__push__(doc-group=Access);
7406
7415__parser__(no-type-extension)
7416MK_EXTERN MK_BUF MK_DECL MkBufferAppendC_RT (
7418 MK_BUF const buf,
7419 MK_STRN const val
7421
7430__parser__(no-type-extension)
7431MK_EXTERN MK_BUF MK_DECL MkBufferAppendStringR_RT (
7433 MK_BUF const buf,
7434 MkStringR const val
7436
7444MK_EXTERN MK_I32 MK_DECL MkBufferAppendVL_RT (
7446 MK_BUF const buf,
7447 MK_FST const printfmt,
7448 va_list var_list
7450
7457MK_EXTERN MK_I32 MK_DECL MkBufferAppendV_RT (
7459 MK_BUF const buf,
7460 MK_FST const printfmt,
7461 ...
7463
7471MK_EXTERN MK_NUM MK_DECL MkBufferPush_RT (
7473 MK_BUF const buf,
7474 MK_STRN const val
7476
7484MK_EXTERN MK_NUM MK_DECL MkBufferPop_RT (
7486 MK_BUF const buf,
7487 MK_STRN const val
7489
7491__parser__(template-required,no-rpc,keep,no-static)
7492MK_EXTERN enum MkErrorE MK_DECL MkBufferToObject_RT (
7494 MK_BUF const buf,
7495 MK_NAT_OBJECT * obj_out
7497
7499
7501// MkBufferC_Access_C_API
7502
7503/* MARK_S ################################################################ */
7504/* ### ### */
7505/* ### B U F F E R - S T R E A M - A P I ### */
7506/* ### ### */
7507/* ####################################################################### */
7508
7524
7543
7544struct MkBufferStreamSaveS;
7545
7547#define MkBufferStreamS_ils_size (0)
7548
7576// [MkBufferStreamS_example]
7578 // BEGIN-MkBufferStreamS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7579
7580 union {
7581 struct MkObjectS obj; // instance-base MkObjectS
7582 struct MkBufferS buf; // instance-base MkBufferS
7583 } super;
7584
7585 // END-MkBufferStreamS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7586
7587 // instance attributes
7588 struct {
7589 MK_NUM numItems; // the number of items in the package
7590 MK_I32 undo; // \e undo last operation: read=+1 < no=0 < write=-1)
7591 // \note The \e endian_is_wrong attribute is required if a \RMkBufferStreamC is send to
7592 // an other host. The \e sender-endian is part of the \e package-header and the \e reader is using
7593 // the information from the \e package-header to setup the \e endian_is_wrong attribute.
7594 // \li \b false (0) if the endian is the \b same as the local endian.
7595 // \li \b true (1) if the endian is \b not the same as the local endian.
7596 // If \e endian_is_wrong is \b true the package header transform the native-binary-package-data
7597 // to the local endian as part of the \RDocMqA{ReadTT} and \RDocNsA{BufferStreamReadTT} methods.
7598 // The transformation of native data is \b only done if required, just \e routing of a package
7599 // does \b not require a transformation.
7600 bool endian_is_wrong; // the value: \e TRUE if endian of storage != \c MK_ENDIAN_MY
7601 } var; // variable part of the \e instance-data
7602 struct {
7608 union MkBufferU cur;
7609 } storage; // storage part of the \e instance-data
7610
7611 // BUG FIX don't put busRef into "var" -> the pMkBusReadL_END will "overwrite" the data including the
7612 // "self" pointer
7613 struct MkBuffer64S busRef; // pBusReadNextWord will fill this
7614
7615 struct MkCacheS saveCache; // cache to support recursion in LST sub-package
7616 struct MkBufferStreamSaveS * busWriteSave; // if \b not NULL than an active LST-WRITE is ongoing
7617 struct MkBufferStreamSaveS * busReadSave; // if \b not NULL than an active LST-READ is ongoing
7618
7619 MK_BINB ils_data[MkBufferStreamS_ils_size]; // \e ILS storage
7620};
7621// [MkBufferStreamS_example]
7622
7623// BEGIN-MkBufferStreamS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7624
7628 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
7629
7630// Signature --------------------------------------------------------------
7633
7634 #define MkBufferStreamC_SIGNATURE (MkBufferC_SIGNATURE ^ (4u<<6))
7635 #define MkBufferStreamC_MASK (((1u<<26)-1)<<6)
7636
7638
7639// CompileTimeCast --------------------------------------------------------------
7642
7643 #define MkBufferStreamC_X2bus(x) (x)
7644 #define MkBufferStreamC_X2buf(x) MkBUF(x)
7645 #define MkBufferStreamC_X2obj(x) MkOBJ(x)
7646
7648
7649// TypeDef --------------------------------------------------------------
7652
7656 __parser__(ignore) typedef const struct MkBufferStreamS MkBufferStreamCNR;
7658 #define MkBufferStreamC_T (&MK_RT_REF._MkBufferStreamC_T)
7660 #define MkBufferStreamC_TT (MkTYP(MkBufferStreamC_T))
7662 #define MkBufferStreamST MkBufferStreamC_T
7664 #define MkBufferStreamSTT (MkTYP(MkBufferStreamST))
7666 #define MkBufferStreamC_type MK_BUS
7668 #define MkBufferStreamCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
7670 #define MkBufferStreamCTT_X(instance) (MkOBJ_R(instance).type)
7672 #define MkBufferStreamCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
7674 #define MkBufferStreamC_NS MK
7676 #define MkBufferStreamCTT MkBufferStreamCTT
7678 #define MkBufferStreamCT ( (struct MkTypeDefS *) MkBufferStreamCTT )
7679
7681
7682// TypeCheck --------------------------------------------------------------
7685
7686 #pragma GCC diagnostic push
7687 #pragma GCC diagnostic ignored "-Wattributes"
7688
7691 __parser__(class=MkBufferStreamC,static,hide)
7694 return MkSanitizeCheck(MkBufferStreamC,mng);
7695 }
7696
7699 __parser__(class=MkBufferStreamC,static,hide)
7702 return MkSanitizeCheckO(MkBufferStreamC,obj);
7703 }
7704
7705 #pragma GCC diagnostic pop
7706 #define MkBufferStreamC_Check(mng) MkBusCheck(mng)
7707
7709
7710// RunTimeCast --------------------------------------------------------------
7713
7715 __parser__(class=MkBufferStreamC,hide,static)
7716 META_ATTRIBUTE_SANITIZE
7719 return (MkBusCheck(mng) ? (MK_BUS)mng : NULL);
7720 }
7721
7723 __parser__(class=MkBufferStreamC,hide,static)
7724 META_ATTRIBUTE_SANITIZE
7727 return (MkBusCheck(mng) ? (MK_BUSN)mng : NULL);
7728 }
7729
7731 #define MkBusRaise(_bus) if (!_MkCheckX(MkBufferStreamC,_bus)) { \
7732 MkErrorSetC_1E("'MkBufferStreamC' hdl is NULL"); \
7733 goto error ; \
7734 }
7735
7737 #define MkBUS_R(x) (*(x)).super.bus
7739 #define MkBUS(x) (&MkBUS_R(x))
7740
7742
7745// MkBufferStreamC_Class_Define_C_API
7746
7747// END-MkBufferStreamS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7748
7749// =========================================================================
7750// BEGIN-MkBufferStreamS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7751
7754
7757
7758__parser__push__(doc-group=_ignore_,doc-index=Class,doc-name=Export,class=MkBufferStreamC);
7759
7775__parser__(class-overload=MkObjectHandleGet)
7779 MK_BUS const bus __parser__(null-allowed)
7780) {
7781 return MkObjectHandleGet(bus?MkOBJ(bus):NULL);
7782}
7783
7792__parser__(flags=new)
7794mk_inline MK_BUS MkBufferStreamHandleResolve_RT (
7796 MK_HDL const netHdl
7797) {
7798 return MkBus(MkObjectHandleResolve(netHdl));
7799}
7800
7810#define MkBufferStreamHandleResolve_e(netHdl) ({ \
7811 MK_HDL tmpHdl=netHdl; \
7812 MK_BUS tmp; \
7813 if (tmpHdl==0) { \
7814 tmp=NULL; \
7815 } else { \
7816 tmp=MkBufferStreamHandleResolve(tmpHdl); \
7817 if (tmp==NULL) { \
7818 MkErrorSetC_1_NULL("ERROR: 'MkBufferStreamC' handle is 'NULL'"); \
7819 goto error; \
7820 }; \
7821 }; \
7822 tmp; \
7823})
7824
7826
7828// Class export & import
7829
7833 __parser__(flags=new,doc-group=_ignore_,doc-index=Class,doc-name=Misc,class=MkBufferStreamC,null-return-allow)
7836 return (MK_BUS)MK_NULL;
7837 }
7839// MkBufferStreamC - Misc - function
7840
7842// MkBufferStreamC_Class_C_API
7843
7844// END-MkBufferStreamS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7845
7846// #######################################################################
7847// -----------------------------------------------------------------------
7853
7855#define MkBufferStream64_ils_size (64)
7856
7860__parser__(ignore)
7862 // BEGIN-MkBufferStream64S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7863
7864 union {
7865 struct MkObjectS obj; // instance-base MkObjectS
7866 struct MkBufferS buf; // instance-base MkBufferS
7867 struct MkBufferStreamS bus; // instance-base MkBufferStreamS
7868 } super;
7869
7870 // END-MkBufferStream64S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7871
7872 // instance attributes
7874};
7875
7876// BEGIN-MkBufferStream64S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7877
7881 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
7882
7883// Signature --------------------------------------------------------------
7886
7887 #define MkBufferStream64C_SIGNATURE (MkBufferStreamC_SIGNATURE ^ (3u<<3))
7888 #define MkBufferStream64C_MASK (((1u<<29)-1)<<3)
7889
7891
7892// CompileTimeCast --------------------------------------------------------------
7895
7896 #define MkBufferStream64C_X2bus(x) MkBUS(x)
7897 #define MkBufferStream64C_X2buf(x) MkBUF(x)
7898 #define MkBufferStream64C_X2obj(x) MkOBJ(x)
7899
7901
7902// TypeDef --------------------------------------------------------------
7905
7911 #define MkBufferStream64C_T (&MK_RT_REF._MkBufferStream64C_T)
7913 #define MkBufferStream64C_TT (MkTYP(MkBufferStream64C_T))
7915 #define MkBufferStream64ST MkBufferStream64C_T
7917 #define MkBufferStream64STT (MkTYP(MkBufferStream64ST))
7919 #define MkBufferStream64CT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
7921 #define MkBufferStream64CTT_X(instance) (MkOBJ_R(instance).type)
7923 #define MkBufferStream64CT_TT(typ) ( (struct MkTypeDefS *) (typ) )
7925 #define MkBufferStream64C_NS MK
7927 #define MkBufferStream64CTT MkBufferStream64CTT
7929 #define MkBufferStream64CT ( (struct MkTypeDefS *) MkBufferStream64CTT )
7930
7932
7935// MkBufferStream64C_Class_Define_C_API
7936
7937// END-MkBufferStream64S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7938
7940
7941// #######################################################################
7942// -----------------------------------------------------------------------
7948
7950#define MkBufferStream256S_ils_size (256)
7951
7955__parser__(ignore)
7957 // BEGIN-MkBufferStream256S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7958
7959 union {
7960 struct MkObjectS obj; // instance-base MkObjectS
7961 struct MkBufferS buf; // instance-base MkBufferS
7962 struct MkBufferStreamS bus; // instance-base MkBufferStreamS
7963 } super;
7964
7965 // END-MkBufferStream256S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7966
7967 // instance attributes
7969};
7970
7971// BEGIN-MkBufferStream256S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
7972
7976 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
7977
7978// Signature --------------------------------------------------------------
7981
7982 #define MkBufferStream256C_SIGNATURE (MkBufferStreamC_SIGNATURE ^ (2u<<3))
7983 #define MkBufferStream256C_MASK (((1u<<29)-1)<<3)
7984
7986
7987// CompileTimeCast --------------------------------------------------------------
7990
7991 #define MkBufferStream256C_X2bus(x) MkBUS(x)
7992 #define MkBufferStream256C_X2buf(x) MkBUF(x)
7993 #define MkBufferStream256C_X2obj(x) MkOBJ(x)
7994
7996
7997// TypeDef --------------------------------------------------------------
8000
8006 #define MkBufferStream256C_T (&MK_RT_REF._MkBufferStream256C_T)
8008 #define MkBufferStream256C_TT (MkTYP(MkBufferStream256C_T))
8010 #define MkBufferStream256ST MkBufferStream256C_T
8012 #define MkBufferStream256STT (MkTYP(MkBufferStream256ST))
8014 #define MkBufferStream256CT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
8016 #define MkBufferStream256CTT_X(instance) (MkOBJ_R(instance).type)
8018 #define MkBufferStream256CT_TT(typ) ( (struct MkTypeDefS *) (typ) )
8020 #define MkBufferStream256C_NS MK
8022 #define MkBufferStream256CTT MkBufferStream256CTT
8024 #define MkBufferStream256CT ( (struct MkTypeDefS *) MkBufferStream256CTT )
8025
8027
8030// MkBufferStream256C_Class_Define_C_API
8031
8032// END-MkBufferStream256S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
8033
8035
8036// #######################################################################
8037// -----------------------------------------------------------------------
8043
8045#define MkBufferStream1024_ils_size (1024)
8046
8050__parser__(ignore)
8052 // BEGIN-MkBufferStream1024S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
8053
8054 union {
8055 struct MkObjectS obj; // instance-base MkObjectS
8056 struct MkBufferS buf; // instance-base MkBufferS
8057 struct MkBufferStreamS bus; // instance-base MkBufferStreamS
8058 } super;
8059
8060 // END-MkBufferStream1024S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
8061
8062 // instance attributes
8064};
8065
8066// BEGIN-MkBufferStream1024S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
8067
8071 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
8072
8073// Signature --------------------------------------------------------------
8076
8077 #define MkBufferStream1024C_SIGNATURE (MkBufferStreamC_SIGNATURE ^ (4u<<3))
8078 #define MkBufferStream1024C_MASK (((1u<<29)-1)<<3)
8079
8081
8082// CompileTimeCast --------------------------------------------------------------
8085
8086 #define MkBufferStream1024C_X2bus(x) MkBUS(x)
8087 #define MkBufferStream1024C_X2buf(x) MkBUF(x)
8088 #define MkBufferStream1024C_X2obj(x) MkOBJ(x)
8089
8091
8092// TypeDef --------------------------------------------------------------
8095
8101 #define MkBufferStream1024C_T (&MK_RT_REF._MkBufferStream1024C_T)
8103 #define MkBufferStream1024C_TT (MkTYP(MkBufferStream1024C_T))
8105 #define MkBufferStream1024ST MkBufferStream1024C_T
8107 #define MkBufferStream1024STT (MkTYP(MkBufferStream1024ST))
8109 #define MkBufferStream1024CT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
8111 #define MkBufferStream1024CTT_X(instance) (MkOBJ_R(instance).type)
8113 #define MkBufferStream1024CT_TT(typ) ( (struct MkTypeDefS *) (typ) )
8115 #define MkBufferStream1024C_NS MK
8117 #define MkBufferStream1024CTT MkBufferStream1024CTT
8119 #define MkBufferStream1024CT ( (struct MkTypeDefS *) MkBufferStream1024CTT )
8120
8122
8125// MkBufferStream1024C_Class_Define_C_API
8126
8127// END-MkBufferStream1024S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
8128
8130
8131// #######################################################################
8132// -----------------------------------------------------------------------
8138
8140#define MkBufferStream16384S_ils_size (16384)
8141
8145__parser__(ignore)
8147 // BEGIN-MkBufferStream16384S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
8148
8149 union {
8150 struct MkObjectS obj; // instance-base MkObjectS
8151 struct MkBufferS buf; // instance-base MkBufferS
8152 struct MkBufferStreamS bus; // instance-base MkBufferStreamS
8153 } super;
8154
8155 // END-MkBufferStream16384S-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
8156
8157 // instance attributes
8159};
8160
8161// BEGIN-MkBufferStream16384S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
8162
8166 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
8167
8168// Signature --------------------------------------------------------------
8171
8172 #define MkBufferStream16384C_SIGNATURE (MkBufferStreamC_SIGNATURE ^ (1u<<3))
8173 #define MkBufferStream16384C_MASK (((1u<<29)-1)<<3)
8174
8176
8177// CompileTimeCast --------------------------------------------------------------
8180
8181 #define MkBufferStream16384C_X2bus(x) MkBUS(x)
8182 #define MkBufferStream16384C_X2buf(x) MkBUF(x)
8183 #define MkBufferStream16384C_X2obj(x) MkOBJ(x)
8184
8186
8187// TypeDef --------------------------------------------------------------
8190
8196 #define MkBufferStream16384C_T (&MK_RT_REF._MkBufferStream16384C_T)
8198 #define MkBufferStream16384C_TT (MkTYP(MkBufferStream16384C_T))
8200 #define MkBufferStream16384ST MkBufferStream16384C_T
8202 #define MkBufferStream16384STT (MkTYP(MkBufferStream16384ST))
8204 #define MkBufferStream16384CT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
8206 #define MkBufferStream16384CTT_X(instance) (MkOBJ_R(instance).type)
8208 #define MkBufferStream16384CT_TT(typ) ( (struct MkTypeDefS *) (typ) )
8210 #define MkBufferStream16384C_NS MK
8212 #define MkBufferStream16384CTT MkBufferStream16384CTT
8214 #define MkBufferStream16384CT ( (struct MkTypeDefS *) MkBufferStream16384CTT )
8215
8217
8220// MkBufferStream16384C_Class_Define_C_API
8221
8222// END-MkBufferStream16384S-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
8223
8225__parser__(ignore)
8227
8229
8230/* ####################################################################### */
8231/* ### ### */
8232/* ### BufferStream - T O R - Api ### */
8233/* ### ### */
8234/* ####################################################################### */
8235
8242__parser__push__(doc-group=TOR);
8243
8252__parser__(constructor,lng-constr)
8253MK_EXTERN MK_BUS MK_DECL MkBufferStreamCreate_RT (
8255 MK_TYP type __parser__(internal,default=NULL),
8256 MK_NUM const size __parser__(default=0)
8258
8259#define MkBufferStreamCreate_1(size) MkBufferStreamCreate(NULL,size)
8260
8262__parser__(constructor)
8263MK_EXTERN MK_BUS MK_DECL MkBufferStreamCreate64_RT (
8265 MK_NUM const size __parser__(default=0)
8267
8269__parser__(constructor)
8270MK_EXTERN MK_BUS MK_DECL MkBufferStreamCreate256_RT (
8272 MK_NUM const size __parser__(default=0)
8274
8276__parser__(constructor)
8277MK_EXTERN MK_BUS MK_DECL MkBufferStreamCreate1024_RT (
8279 MK_NUM const size __parser__(default=0)
8281
8283__parser__(constructor)
8284MK_EXTERN MK_BUS MK_DECL MkBufferStreamCreate16384_RT (
8286 MK_NUM const size __parser__(default=0)
8288
8303MK_EXTERN MK_BUS MK_DECL MkBufferStreamCreateTLS_RT (
8305 MK_STRN const tlsName ,
8306 bool const resetB __parser__(default=true)
8308
8309__parser__(constructor,macro)
8320// [MkBufferStreamCreateLOCAL_T]
8321#define MkBufferStreamCreateLOCAL_T(cls,name,size) \
8322 cls##R name##R = {0}; \
8323 struct MkBufferStreamS * const name = cls##_X2bus(&name##R); \
8324 MkBufferStreamInit(name,cls##_TT,size)
8325// [MkBufferStreamCreateLOCAL_T]
8326
8327__parser__(constructor,macro)
8336// [MkBufferStreamCreateSTATIC_T]
8337#define MkBufferStreamCreateSTATIC_T(cls,name) \
8338 static cls##R name##R = {0}; \
8339 struct MkBufferStreamS * const name = cls##_X2bus(&name##R); \
8340 if (__MkCheckX(cls,&name##R)) { \
8341 MkBufferStreamReset(name); \
8342 } else { \
8343 MkBufferStreamInit(name,cls##TT,0); \
8344 } \
8345// [MkBufferStreamCreateSTATIC_T]
8346
8347__parser__(constructor,macro)
8356// [MkBufferStreamCreateTLS_T]
8357#define MkBufferStreamCreateTLS_T(cls,name) \
8358 static MkThreadLocal cls##R name##R = {0}; \
8359 struct MkBufferStreamS * const name = cls##_X2bus(&name##R); \
8360 if (__MkCheckX(cls,&name##R)) { \
8361 MkBufferStreamReset(name); \
8362 } else { \
8363 MkBufferStreamInit(name,cls##_TT,0); \
8364 } \
8365// [MkBufferStreamCreateTLS_T]
8366
8397__parser__(internal)
8398MK_EXTERN void MK_DECL MkBufferStreamFree_RT (
8400 MK_BUS const bus
8402
8406__parser__(internal)
8407MK_EXTERN void MK_DECL MkBufferStreamInit_RT (
8409 MK_BUS const bus,
8410 MK_TYP type __parser__(internal,default=NULL),
8411 MK_NUM const size __parser__(default=0)
8413
8419__parser__(destructor)
8420MK_EXTERN void MK_DECL MkBufferStreamDelete_RT (
8422 MK_BUS const bus
8424
8440__parser__(constructor)
8441MK_EXTERN MK_BUS MK_DECL MkBufferStreamMerge_RT (
8443 MK_BUS const bus
8445
8453__parser__(constructor)
8454MK_EXTERN MK_BUS MK_DECL MkBufferStreamDup_RT (
8456 MK_BUSN const src
8458
8460
8462// MkBufferStreamC_TOR_C_API
8463
8464/* ####################################################################### */
8465/* ### ### */
8466/* ### BufferStream - M I S C - Api ### */
8467/* ### ### */
8468/* ####################################################################### */
8469
8475
8476__parser__push__(doc-group=Misc);
8477
8484__parser__(const)
8485MK_EXTERN MK_BUS MK_DECL MkBufferStreamCopy_RT (
8487 MK_BUS const bus,
8488 MK_BUSN const src
8490
8497MK_EXTERN MK_BUS MK_DECL MkBufferStreamReset_RT (
8499 MK_BUS const bus
8501
8510MK_EXTERN void MK_DECL MkBufferStreamResetFull_RT (
8512 MK_BUS const bus
8514
8515__parser__(internal)
8516MK_EXTERN void MK_DECL MkBufferStreamLogS_RT (
8518 MK_BUS const bus ,
8519 MK_OBJ fmtobj __parser__(default=NULL),
8520 MK_STRN const callfunc __parser__(default=F#FUNC)
8522
8531// [MkBufferStreamLog_RT]
8532__parser__(const,class-overload=MkObjectLog)
8533MK_EXTERN void MK_DECL MkBufferStreamLog_RT (
8535 MK_BUS const bus ,
8537 MK_DBG const debug __parser__(default=0),
8538 MK_STRN const callfunc __parser__(default=F#FUNC),
8539 MK_I32 const lvl __parser__(default=0)
8541
8542#define MkBufferStreamLog_5F(bus,fmt,...) MkBufferStreamLog(bus,MkObj(fmt),__VA_ARGS__)
8543#define MkBufferStreamLog_2F(bus,fmt) MkBufferStreamLog_5F(bus,fmt,0,__func__,0)
8544#define MkBufferStreamLog_3F(bus,fmt,pfx) MkBufferStreamLog_5F(bus,fmt,0,pfx,0)
8545// [MkBufferStreamLog_RT]
8546
8550 MK_BUS const bus
8552
8554__parser__(class-overload=MkObjectToString)
8555MK_EXTERN MK_STRN MK_DECL MkBufferStreamToString_RT (
8557 MK_BUSN const inst
8559
8566MK_EXTERN MK_BFL MK_DECL MkBufferStreamToBFL_RT (
8568 MK_BUSN const bus
8570
8571__parser__pop__; // Misc
8572
8574// MkBufferStreamC_Misc_C_API
8575
8576/* ####################################################################### */
8577/* ### ### */
8578/* ### BufferStream - W R I T E - Api ### */
8579/* ### ### */
8580/* ####################################################################### */
8581
8592__parser__push__(doc-group=Write);
8593
8603MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteI8_RT (
8605 MK_BUS const bus,
8606 MK_I8 const val
8608
8611MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteBOL_RT (
8613 MK_BUS const bus,
8614 MK_BOL const val
8616
8619MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteI32_RT (
8621 MK_BUS const bus,
8622 MK_I32 const val
8624
8627MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteFLT_RT (
8629 MK_BUS const bus,
8630 MK_FLT const val
8632
8635MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteI64_RT (
8637 MK_BUS const bus,
8638 MK_I64 const val
8640
8643MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteDBL_RT (
8645 MK_BUS const bus,
8646 MK_DBL const val
8648
8652MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteSTR_RT (
8654 MK_BUS const bus,
8655 MK_STRN const val,
8656 MK_NUM const len __parser__(default=-1)
8658
8661MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteBIN_RT (
8663 MK_BUS const bus,
8664 MkBinaryR const val
8666
8669MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteBUF_RT (
8671 MK_BUS const bus,
8672 MK_BUFN const val
8674
8678MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteHDL_RT (
8680 MK_BUS const bus,
8681 MK_I32 const val
8683
8695MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteLONG_RT (
8697 MK_BUS const bus,
8698 MK_LONG const val
8700
8702MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteVL_RT (
8704 MK_BUS const bus,
8705 MK_STRN const fmt,
8706 va_list ap
8708
8710MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteV_RT (
8712 MK_BUS const bus,
8713 MK_STRN const fmt,
8714 ...
8716
8731MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteBFL_RT (
8733 MK_BUS const bus,
8734 MK_BFLN const bfl
8736
8755MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteL_FLAT_RT (
8757 MK_BUS const bus,
8758 MK_BFL const bfl
8760
8762MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteL_START_RT (
8764 MK_BUS const bus
8766
8768MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteL_END_RT (
8770 MK_BUS const bus
8772
8782MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamWriteBUS_FLAT_RT (
8784 MK_BUS const bus,
8785 MK_BUSN const add
8787
8788__parser__pop__; // Write
8789
8791// MkBufferStreamC_Write_C_API
8792
8793/* ####################################################################### */
8794/* ### ### */
8795/* ### BufferStream - R E A D - Api ### */
8796/* ### ### */
8797/* ####################################################################### */
8798
8808__parser__push__(doc-group=Read);
8809
8816MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadL_START_RT (
8818 MK_BUS const bus,
8819 MK_BUF buf __parser__(default=NULL)
8821
8823MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadL_END_RT (
8825 MK_BUS const bus
8827
8836MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadALL_RT (
8838 MK_BUS const bus,
8839 MK_BFL * const val_inout
8841
8861MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadBFL_RT (
8863 MK_BUS const bus,
8864 MK_BFL * const val_out
8866
8867__parser__(ignore)
8868MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadLIST_RT (
8870 MK_BUS const bus,
8871 MK_NAT_LIST * const val_out
8873
8874__parser__(ignore)
8875MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadNEXT_RT (
8877 MK_BUS const bus,
8878 MK_NAT_OBJECT * const val_out
8880
8892MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadLONG_RT (
8894 MK_BUS const bus,
8895 MK_LONG * const val_out
8897
8898// *******
8899
8913MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadI8_RT (
8915 MK_BUS const bus,
8916 MK_I8 * const val_out
8918
8921MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadBOL_RT (
8923 MK_BUS const bus,
8924 MK_BOL * const val_out
8926
8929MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadI32_RT (
8931 MK_BUS const bus,
8932 MK_I32 * const val_out
8934
8937MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadFLT_RT (
8939 MK_BUS const bus,
8940 MK_FLT * const val_out
8942
8945MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadI64_RT (
8947 MK_BUS const bus,
8948 MK_I64 * const val_out
8950
8953MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadDBL_RT (
8955 MK_BUS const bus,
8956 MK_DBL * const val_out
8958
8961MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadSTR_RT (
8963 MK_BUS const bus,
8964 MK_STRN * const val_out
8966
8971MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadBIN_RT (
8973 MK_BUS const bus,
8974 MkBinaryR * const val_out
8976
8979MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadBUF_RT (
8981 MK_BUS const bus,
8982 MK_BUF*const val_out
8984
8990MK_EXTERN bool MK_DECL MkBufferStreamReadItemExists_RT (
8992 MK_BUSN const bus
8994
9000MK_EXTERN enum MkTypeE MK_DECL MkBufferStreamReadGetNextType_RT (
9002 MK_BUSN const bus
9004
9010MK_EXTERN MK_NUM MK_DECL MkBufferStreamReadGetNumItems_RT (
9012 MK_BUSN const bus
9014
9023MK_EXTERN enum MkErrorE MK_DECL MkBufferStreamReadUndo_RT (
9025 MK_BUS const bus
9027
9028__parser__pop__; // Read
9029
9031// MkBufferStreamC_Read_C_API
9032
9034// MkBufferStreamC_C_API
9035
9036/* MARK_L ################################################################ */
9037/* ### ### */
9038/* ### B U F F E R - L I S T - A P I ### */
9039/* ### ### */
9040/* ####################################################################### */
9041
9043#include "MkBufferListC_def_mk.h"
9045
9046/* ####################################################################### */
9047/* ### ### */
9048/* ### L O G - F I L E - A P I ### */
9049/* ### ### */
9050/* ####################################################################### */
9051
9072
9073#define MkDbgLogData(d) \
9074 MkDbgV_2O(MK_ERROR_FORMAT,MK_COLOR_LIGHT_CYAN "FROM=%s -> TO=%s [%d]" MK_COLOR_RESET "\n", \
9075 MK_RT_REF.log.logNAME, (d), MK_RT_REF.log.logREF);
9076
9078__parser__(ignore)
9079typedef struct MkLogDataS {
9080
9081 #if defined(__cplusplus)
9082 #define MkLogDataEA(e) MkLogDataS::e
9083 #else
9084 #define MkLogDataEA(e) e
9085 #endif
9086
9087 enum MkLogDataE {
9088 MkLogDataE_UNDEF,
9089 MkLogDataE_STDERR,
9090 MkLogDataE_STDOUT,
9091 MkLogDataE_BUFFER,
9092 MkLogDataE_FILE
9093 } logWHAT;
9095 FILE *logFILE;
9097 #define MkLogDataS_LogNAME_size 256
9100 bool logLOCK;
9102 char *logBUF;
9104 size_t logSIZE;
9106 int logREF;
9108
9110struct MkLogFileS {
9111 // BEGIN-MkLogFileS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9113 union {
9114 struct MkObjectS obj; // instance-base MkObjectS
9115 } super;
9117 // END-MkLogFileS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9119 // object body
9120 MkLogDataS logData;
9122
9123// BEGIN-MkLogFileS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9128 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
9130// Signature --------------------------------------------------------------
9133
9134 #define MkLogFileC_SIGNATURE (MkObjectC_SIGNATURE ^ (3u<<10))
9135 #define MkLogFileC_MASK (((1u<<22)-1)<<10)
9136
9138
9139// CompileTimeCast --------------------------------------------------------------
9142
9143 #define MkLogFileC_X2lfl(x) (x)
9144 #define MkLogFileC_X2obj(x) MkOBJ(x)
9145
9147
9148// TypeDef --------------------------------------------------------------
9151
9153 __parser__(ignore) typedef struct MkLogFileS MkLogFileCR;
9155 __parser__(ignore) typedef const struct MkLogFileS MkLogFileCNR;
9157 #define MkLogFileC_T (&MK_RT_REF._MkLogFileC_T)
9159 #define MkLogFileC_TT (MkTYP(MkLogFileC_T))
9161 #define MkLogFileST MkLogFileC_T
9163 #define MkLogFileSTT (MkTYP(MkLogFileST))
9165 #define MkLogFileC_type MK_LFL
9167 #define MkLogFileCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
9169 #define MkLogFileCTT_X(instance) (MkOBJ_R(instance).type)
9171 #define MkLogFileCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
9173 #define MkLogFileC_NS MK
9175 #define MkLogFileCTT MkLogFileCTT
9177 #define MkLogFileCT ( (struct MkTypeDefS *) MkLogFileCTT )
9178
9180
9181// TypeCheck --------------------------------------------------------------
9184
9185 #pragma GCC diagnostic push
9186 #pragma GCC diagnostic ignored "-Wattributes"
9190 __parser__(class=MkLogFileC,static,hide)
9192 mk_inline bool MkLflCheck (MK_MNGN mng) {
9193 return MkSanitizeCheck(MkLogFileC,mng);
9194 }
9195
9198 __parser__(class=MkLogFileC,static,hide)
9200 mk_inline bool MkLflCheckO (MK_OBJN obj) {
9201 return MkSanitizeCheckO(MkLogFileC,obj);
9202 }
9203
9204 #pragma GCC diagnostic pop
9205 #define MkLogFileC_Check(mng) MkLflCheck(mng)
9208
9209// RunTimeCast --------------------------------------------------------------
9212
9214 __parser__(class=MkLogFileC,hide,static)
9215 META_ATTRIBUTE_SANITIZE
9217 mk_inline MK_LFL MkLfl(MK_MNG mng) {
9218 return (MkLflCheck(mng) ? (MK_LFL)mng : NULL);
9220
9222 __parser__(class=MkLogFileC,hide,static)
9223 META_ATTRIBUTE_SANITIZE
9225 mk_inline MK_LFLN MkLflN(MK_MNGN mng) {
9226 return (MkLflCheck(mng) ? (MK_LFLN)mng : NULL);
9227 }
9228
9230 #define MkLflRaise(_lfl) if (!_MkCheckX(MkLogFileC,_lfl)) { \
9231 MkErrorSetC_1E("'MkLogFileC' hdl is NULL"); \
9232 goto error ; \
9233 }
9234
9236 #define MkLFL_R(x) (*(x)).super.lfl
9238 #define MkLFL(x) (&MkLFL_R(x))
9241
9244// MkLogFileC_Class_Define_C_API
9245
9246// END-MkLogFileS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9247
9248// =========================================================================
9249// BEGIN-MkLogFileS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9253
9256
9257__parser__push__(doc-group=_ignore_,doc-index=Class,doc-name=Export,class=MkLogFileC);
9258
9274__parser__(class-overload=MkObjectHandleGet)
9276mk_inline MK_HDL MK_DECL MkLogFileHandleGet_RT (
9278 MK_LFL const lfl __parser__(null-allowed)
9279) {
9280 return MkObjectHandleGet(lfl?MkOBJ(lfl):NULL);
9281}
9282
9291__parser__(flags=new)
9293mk_inline MK_LFL MkLogFileHandleResolve_RT (
9295 MK_HDL const netHdl
9296) {
9297 return MkLfl(MkObjectHandleResolve(netHdl));
9298}
9299
9309#define MkLogFileHandleResolve_e(netHdl) ({ \
9310 MK_HDL tmpHdl=netHdl; \
9311 MK_LFL tmp; \
9312 if (tmpHdl==0) { \
9313 tmp=NULL; \
9314 } else { \
9315 tmp=MkLogFileHandleResolve(tmpHdl); \
9316 if (tmp==NULL) { \
9317 MkErrorSetC_1_NULL("ERROR: 'MkLogFileC' handle is 'NULL'"); \
9318 goto error; \
9319 }; \
9320 }; \
9321 tmp; \
9322})
9325
9327// Class export & import
9328
9332 __parser__(flags=new,doc-group=_ignore_,doc-index=Class,doc-name=Misc,class=MkLogFileC,null-return-allow)
9334 mk_inline MK_LFL MkLogFileGetNull ( void ) {
9335 return (MK_LFL)MK_NULL;
9336 }
9338// MkLogFileC - Misc - function
9339
9341// MkLogFileC_Class_C_API
9342
9343// END-MkLogFileS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9344
9345// #######################################################################
9346// -----------------------------------------------------------------------
9352
9353__parser__push__(doc-group=TOR,class=MkLogFileC);
9354
9365__parser__(constructor,lng-constr)
9370 MK_STRN const file,
9371 MK_LFL * lfh_out
9373
9379__parser__(destructor)
9382 MK_LFL lfh
9384
9385__parser__pop__; // TOR
9386
9388// MkLogFileC_TOR_C_API
9389
9390// #######################################################################
9391// -----------------------------------------------------------------------
9396
9397__parser__push__(doc-group=Write);
9398
9409 MK_LFLN lfl __parser__(null-allowed),
9410 MK_FST printfmt,
9411 va_list var_list
9413
9423 MK_LFLN lfl __parser__(null-allowed),
9424 MK_FST printfmt,
9425 ...
9427
9434__parser__(no-type-extension)
9436MkLogFileWriteC_RT (
9438 MK_LFLN lfl __parser__(null-allowed),
9439 MK_STRN text
9441
9449MkLogFileGetFile_RT (
9451 MK_LFLN lfl,
9452 MK_STRN *file_out
9454
9455__parser__pop__; // Write
9456
9458// MkLogFileC_Write_C_API
9459
9461// MkLogFileC_C_API
9462
9463/* MARK_X ################################################################ */
9464/* ### ### */
9465/* ### E X T E N S I O N - A P I ### */
9466/* ### ### */
9467/* ####################################################################### */
9468
9476
9477#define MkDbgMkExt2(c,x) mk_dbg_color_ln(c,"MkExtensionS: ptr<%p>, next<%p>, prev<%p>", (x), (x)->next, (x)->prev)
9478#define MkDbgMkExt(x) MkDbgMkExt2(MK_COLOR_CYAN,x)
9479
9480__parser__push__(doc-group=_ignore_);
9481
9482__parser__(internal)
9484typedef struct MkExtensionS {
9485 // BEGIN-MkExtensionS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9486
9487 union {
9488 struct MkObjectS obj; // instance-base MkObjectS
9489 } super;
9490
9491 // END-MkExtensionS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9493 // instance attributes
9494 struct MkExtensionS *next, *prev;
9495} MkExtensionS;
9496
9497// BEGIN-MkExtensionS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9502 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
9504// Signature --------------------------------------------------------------
9507
9508 #define MkExtensionC_SIGNATURE (MkObjectC_SIGNATURE ^ (9u<<10))
9509 #define MkExtensionC_MASK (((1u<<22)-1)<<10)
9510
9512
9513// CompileTimeCast --------------------------------------------------------------
9516
9517 #define MkExtensionC_X2ext(x) (x)
9518 #define MkExtensionC_X2obj(x) MkOBJ(x)
9519
9521
9522// TypeDef --------------------------------------------------------------
9525
9527 __parser__(ignore) typedef struct MkExtensionS MkExtensionCR;
9529 __parser__(ignore) typedef const struct MkExtensionS MkExtensionCNR;
9531 #define MkExtensionC_T (&MK_RT_REF._MkExtensionC_T)
9533 #define MkExtensionC_TT (MkTYP(MkExtensionC_T))
9535 #define MkExtensionST MkExtensionC_T
9537 #define MkExtensionSTT (MkTYP(MkExtensionST))
9539 #define MkExtensionC_type MK_EXT
9541 #define MkExtensionCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
9543 #define MkExtensionCTT_X(instance) (MkOBJ_R(instance).type)
9545 #define MkExtensionCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
9547 #define MkExtensionC_NS MK
9549 #define MkExtensionCTT MkExtensionCTT
9551 #define MkExtensionCT ( (struct MkTypeDefS *) MkExtensionCTT )
9552
9554
9555// TypeCheck --------------------------------------------------------------
9558
9559 #pragma GCC diagnostic push
9560 #pragma GCC diagnostic ignored "-Wattributes"
9564 __parser__(class=MkExtensionC,static,ignore)
9566 mk_inline bool MkExtCheck (MK_MNGN mng) {
9567 return MkSanitizeCheck(MkExtensionC,mng);
9568 }
9569
9572 __parser__(class=MkExtensionC,static,ignore)
9574 mk_inline bool MkExtCheckO (MK_OBJN obj) {
9575 return MkSanitizeCheckO(MkExtensionC,obj);
9576 }
9577
9578 #pragma GCC diagnostic pop
9579 #define MkExtensionC_Check(mng) MkExtCheck(mng)
9582
9583// RunTimeCast --------------------------------------------------------------
9586
9588 __parser__(class=MkExtensionC,ignore,static)
9589 META_ATTRIBUTE_SANITIZE
9591 mk_inline MK_EXT MkExt(MK_MNG mng) {
9592 return (MkExtCheck(mng) ? (MK_EXT)mng : NULL);
9594
9596 __parser__(class=MkExtensionC,ignore,static)
9597 META_ATTRIBUTE_SANITIZE
9599 mk_inline MK_EXTN MkExtN(MK_MNGN mng) {
9600 return (MkExtCheck(mng) ? (MK_EXTN)mng : NULL);
9601 }
9602
9604 #define MkExtRaise(_ext) if (!_MkCheckX(MkExtensionC,_ext)) { \
9605 MkErrorSetC_1E("'MkExtensionC' hdl is NULL"); \
9606 goto error ; \
9607 }
9608
9610 #define MkEXT_R(x) (*(x)).super.ext
9612 #define MkEXT(x) (&MkEXT_R(x))
9615
9618// MkExtensionC_Class_Define_C_API
9619
9620// END-MkExtensionS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9621
9625#define MkExtension_size 64
9627__parser__(internal)
9628MK_EXTERN bool MK_DECL MkExtensionDeleteAll_RT (
9630 MK_EXT head
9632
9634__parser__(internal)
9635MK_EXTERN MK_EXT MK_DECL MkExtensionAdd_RT (
9637 MK_EXT head,
9638 MK_EXT add
9640
9642__parser__(internal)
9643MK_EXTERN MK_EXT MK_DECL MkExtensionDel_RT (
9645 MK_EXT head,
9646 MK_EXT del
9648
9650//__parser__(internal)
9651//MK_EXTERN MK_EXT MK_DECL MkExtensionSearch (MK_EXT head, MK_TYP typ);
9652*/
9653
9654__parser__pop__; // __parser__push__(doc-group=_ignore_);
9655
9657// MkExtensionC_C_API
9658
9659/* MARK_E ################################################################ */
9660/* ### ### */
9661/* ### E R R O R - A P I ### */
9662/* ### ### */
9663/* ####################################################################### */
9664
9692
9693#define MkDbgErr_2(err,col) \
9694 mk_dbg_color_ln(col,"MkDbgErr[%p]: check<%d>, mkrt<%s>, isLocal<%d>, format_of_error<%p>", \
9695 err, MkErrCheck(err), MkDbgRtChkX(err), MkOBJ(err)->obj_protect.isLocal, err->format_of_error)
9696#define MkDbgErr(err) MkDbgErr_2(err,MK_COLOR_WHITE)
9697
9698#if META_DEBUG & META_DEBUG_ERROR
9699__parser__(ignore)
9700MK_EXTERN void MK_DECL MkDbgError_RT (
9703 MK_STRN const callfunc __parser__(default=F#FUNC)
9705#endif
9706
9710struct MkErrorS {
9711 // BEGIN-MkErrorS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9712
9713 union {
9714 struct MkObjectS obj; // instance-base MkObjectS
9715 } super;
9716
9717 // END-MkErrorS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9718
9719 // instance attributes
9720 enum MkErrorE code;
9721 struct MkBuffer1024S text;
9722 MK_I32 num;
9723 bool append;
9724 bool noRaise;
9725
9726 MK_OBJN format_of_error;
9727 MK_MNGN source_of_error;
9729 MK_ERREXT mkErrExt;
9730};
9731
9732// BEGIN-MkErrorS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9733
9737 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
9739// Signature --------------------------------------------------------------
9742
9743 #define MkErrorC_SIGNATURE (MkObjectC_SIGNATURE ^ (4u<<10))
9744 #define MkErrorC_MASK (((1u<<22)-1)<<10)
9745
9747
9748// CompileTimeCast --------------------------------------------------------------
9751
9752 #define MkErrorC_X2err(x) (x)
9753 #define MkErrorC_X2obj(x) MkOBJ(x)
9754
9756
9757// TypeDef --------------------------------------------------------------
9760
9762 __parser__(ignore) typedef struct MkErrorS MkErrorCR;
9764 __parser__(ignore) typedef const struct MkErrorS MkErrorCNR;
9766 #define MkErrorC_T (&MK_RT_REF._MkErrorC_T)
9768 #define MkErrorC_TT (MkTYP(MkErrorC_T))
9770 #define MkErrorST MkErrorC_T
9772 #define MkErrorSTT (MkTYP(MkErrorST))
9774 #define MkErrorC_type MK_ERR
9776 #define MkErrorCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
9778 #define MkErrorCTT_X(instance) (MkOBJ_R(instance).type)
9780 #define MkErrorCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
9782 #define MkErrorC_NS MK
9784 #define MkErrorCTT MkErrorCTT
9786 #define MkErrorCT ( (struct MkTypeDefS *) MkErrorCTT )
9787
9789
9790// TypeCheck --------------------------------------------------------------
9793
9794 #pragma GCC diagnostic push
9795 #pragma GCC diagnostic ignored "-Wattributes"
9799 __parser__(class=MkErrorC,static,hide)
9801 mk_inline bool MkErrCheck (MK_MNGN mng) {
9802 return MkSanitizeCheck(MkErrorC,mng);
9803 }
9804
9807 __parser__(class=MkErrorC,static,hide)
9809 mk_inline bool MkErrCheckO (MK_OBJN obj) {
9810 return MkSanitizeCheckO(MkErrorC,obj);
9811 }
9812
9813 #pragma GCC diagnostic pop
9814
9816
9817// RunTimeCast --------------------------------------------------------------
9820
9822 __parser__(class=MkErrorC,hide,static)
9823 META_ATTRIBUTE_SANITIZE
9825 mk_inline MK_ERR MkErr(MK_MNG mng) {
9826 return (MkErrCheck(mng) ? (MK_ERR)mng : NULL);
9827 }
9828
9830 __parser__(class=MkErrorC,hide,static)
9831 META_ATTRIBUTE_SANITIZE
9833 mk_inline MK_ERRN MkErrN(MK_MNGN mng) {
9834 return (MkErrCheck(mng) ? (MK_ERRN)mng : NULL);
9835 }
9836
9838 #define MkErrRaise(_err) if (!_MkCheckX(MkErrorC,_err)) { \
9839 MkErrorSetC_1E("'MkErrorC' hdl is NULL"); \
9840 goto error ; \
9841 }
9842
9844 #define MkERR_R(x) (*(x)).super.err
9846 #define MkERR(x) (&MkERR_R(x))
9849
9852// MkErrorC_Class_Define_C_API
9853
9854// END-MkErrorS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9855
9857// MkErrorC_C_API
9859// =========================================================================
9860// BEGIN-MkErrorS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9861
9864
9867
9868__parser__push__(doc-group=_ignore_,doc-index=Class,doc-name=Export,class=MkErrorC);
9869
9885__parser__(class-overload=MkObjectHandleGet)
9887mk_inline MK_HDL MK_DECL MkErrorHandleGet_RT (
9889 MK_ERR const err __parser__(null-allowed)
9890) {
9891 return MkObjectHandleGet(err?MkOBJ(err):NULL);
9892}
9893
9902__parser__(flags=new)
9904mk_inline MK_ERR MkErrorHandleResolve_RT (
9906 MK_HDL const netHdl
9907) {
9908 return MkErr(MkObjectHandleResolve(netHdl));
9909}
9910
9920#define MkErrorHandleResolve_e(netHdl) ({ \
9921 MK_HDL tmpHdl=netHdl; \
9922 MK_ERR tmp; \
9923 if (tmpHdl==0) { \
9924 tmp=NULL; \
9925 } else { \
9926 tmp=MkErrorHandleResolve(tmpHdl); \
9927 if (tmp==NULL) { \
9928 MkErrorSetC_1_NULL("ERROR: 'MkErrorC' handle is 'NULL'"); \
9929 goto error; \
9930 }; \
9931 }; \
9932 tmp; \
9933})
9936
9938// Class export & import
9939
9943 __parser__(flags=new,doc-group=_ignore_,doc-index=Class,doc-name=Misc,class=MkErrorC,null-return-allow)
9945 mk_inline MK_ERR MkErrorGetNull ( void ) {
9946 return (MK_ERR)MK_NULL;
9947 }
9949// MkErrorC - Misc - function
9950
9952// MkErrorC_Class_C_API
9953
9954// END-MkErrorS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
9955
9956// #######################################################################
9957// -----------------------------------------------------------------------
9964
9965#define MK_ERREXT_ARGS MK_RT_ARGS MK_ERR const mkerr, MK_ERREXT const errext
9966#define MK_ERREXT_CALL MK_RT_CALL err, errext
9967
9968#define MK_ERREXT_ARGS_N MK_RT_ARGS MK_ERRN const mkerr, MK_ERREXT const errext
9969#define MK_ERREXT_CALL_N MK_RT_CALL err, errext
9970
9971__parser__(ignore)
9972typedef bool (*MkErrorAppendFLT) (MK_ERREXT_ARGS, MK_OBJN const fmtobj);
9973
9974__parser__(ignore)
9975typedef void (*MkErrorResetF) (MK_ERREXT_ARGS, MK_OBJN const fmtobj);
9976
9977__parser__(ignore)
9978typedef bool (*MkErrorResetOnExitF) (MK_ERREXT_ARGS, MK_OBJN const fmtobj);
9981__parser__(ignore)
9982typedef void (*MkErrorPanikF) (MK_ERREXT_ARGS_N, MK_OBJN const errobj, MK_STRN const prefix,
9983 MK_I32 const errnum, MK_STRN const fmt, va_list ap);
9984
9985__parser__(ignore)
9986typedef void (*MkErrorLogF) (MK_ERREXT_ARGS_N, MK_OBJN const, MK_DBG const, MK_STRN const,
9987 MK_I32 const, MK_STRN const, MK_OBJ const);
9988
9990typedef MK_OBJN (*MkErrorFormatOfF) (MK_ERREXT_ARGS_N, int const dummy);
9991
9993typedef void (*MkErrorSetRF) (MK_ERREXT_ARGS, MK_MNGN const errctx, MK_OBJN const fmtobj);
9994
9995__parser__(ignore)
9996typedef void (*MkErrorSetEF) (MK_ERREXT_ARGS, MK_ERREXT const newerr, MK_OBJN const fmtobj);
9997
9998__parser__(ignore)
9999typedef bool (*MkErrorSetVLF) (MK_ERREXT_ARGS, MK_OBJN const fmtobj, MK_STRN const);
10001__parser__(ignore)
10002typedef void (*MkErrorInit) (MK_ERREXT_ARGS, MK_OBJN const fmtobj);
10003
10005__parser__(ignore)
10006struct MkErrExtS {
10007 // BEGIN-MkErrExtS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10008
10009 union {
10010 struct MkObjectS obj; // instance-base MkObjectS
10011 struct MkExtensionS ext; // instance-base MkExtensionS
10012 } super;
10014 // END-MkErrExtS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10015
10016 MK_ERR mkerrhead;
10017
10019 MkErrorAppendFLT fErrorAppend;
10022 MkErrorResetF fErrorReset;
10023
10025 MkErrorResetOnExitF fErrorResetOnExit;
10028 MkErrorPanikF fErrorPanik;
10029
10031 MkErrorLogF fErrorLog;
10032
10034 MkErrorFormatOfF fErrorFormatOf;
10035
10037 MkErrorSetRF fErrorSetR;
10038
10040 MkErrorSetEF fErrorSetE;
10041
10043 MkErrorSetVLF fErrorSetVL;
10044
10046 MkErrorInit fErrorInit;
10047};
10049// BEGIN-MkErrExtS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10050
10054 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
10055
10056// Signature --------------------------------------------------------------
10059
10060 #define MkErrExtC_SIGNATURE (MkExtensionC_SIGNATURE ^ (1u<<6))
10061 #define MkErrExtC_MASK (((1u<<26)-1)<<6)
10062
10064
10065// CompileTimeCast --------------------------------------------------------------
10068
10069 #define MkErrExtC_X2errext(x) (x)
10070 #define MkErrExtC_X2ext(x) MkEXT(x)
10071 #define MkErrExtC_X2obj(x) MkOBJ(x)
10072
10075// TypeDef --------------------------------------------------------------
10078
10080 __parser__(ignore) typedef struct MkErrExtS MkErrExtCR;
10082 __parser__(ignore) typedef const struct MkErrExtS MkErrExtCNR;
10084 #define MkErrExtC_T (&MK_RT_REF._MkErrExtC_T)
10086 #define MkErrExtC_TT (MkTYP(MkErrExtC_T))
10088 #define MkErrExtST MkErrExtC_T
10090 #define MkErrExtSTT (MkTYP(MkErrExtST))
10092 #define MkErrExtC_type MK_ERREXT
10094 #define MkErrExtCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
10096 #define MkErrExtCTT_X(instance) (MkOBJ_R(instance).type)
10098 #define MkErrExtCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
10100 #define MkErrExtC_NS MK
10102 #define MkErrExtCTT MkErrExtCTT
10104 #define MkErrExtCT ( (struct MkTypeDefS *) MkErrExtCTT )
10105
10107
10108// TypeCheck --------------------------------------------------------------
10111
10112 #pragma GCC diagnostic push
10113 #pragma GCC diagnostic ignored "-Wattributes"
10117 __parser__(class=MkErrExtC,static,ignore)
10119 mk_inline bool MkErrExtCheck (MK_MNGN mng) {
10120 return MkSanitizeCheck(MkErrExtC,mng);
10121 }
10122
10125 __parser__(class=MkErrExtC,static,ignore)
10127 mk_inline bool MkErrExtCheckO (MK_OBJN obj) {
10128 return MkSanitizeCheckO(MkErrExtC,obj);
10129 }
10130
10131 #pragma GCC diagnostic pop
10132 #define MkErrExtC_Check(mng) MkErrExtCheck(mng)
10135
10136// RunTimeCast --------------------------------------------------------------
10139
10141 __parser__(class=MkErrExtC,ignore,static)
10142 META_ATTRIBUTE_SANITIZE
10144 mk_inline MK_ERREXT MkErrExt(MK_MNG mng) {
10145 return (MkErrExtCheck(mng) ? (MK_ERREXT)mng : NULL);
10147
10149 __parser__(class=MkErrExtC,ignore,static)
10150 META_ATTRIBUTE_SANITIZE
10152 mk_inline MK_ERREXTN MkErrExtN(MK_MNGN mng) {
10153 return (MkErrExtCheck(mng) ? (MK_ERREXTN)mng : NULL);
10154 }
10155
10157 #define MkErrExtRaise(_errext) if (!_MkCheckX(MkErrExtC,_errext)) { \
10158 MkErrorSetC_1E("'MkErrExtC' hdl is NULL"); \
10159 goto error ; \
10160 }
10161
10163 #define MkERREXT_R(x) (*(x)).super.errext
10165 #define MkERREXT(x) (&MkERREXT_R(x))
10168
10171// MkErrExtC_Class_Define_C_API
10172
10173// END-MkErrExtS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10174
10175#define MkErrExtAdd(_mkerrR,add) do { \
10176 (_mkerrR).mkErrExt = (typeof((_mkerrR).mkErrExt)) MkExtensionAdd(MkEXT((_mkerrR).mkErrExt),MkEXT(add)); \
10177 /* printV("MkErrExtAdd = %p, mkrt=%p", &(_mkerrR).mkErrExt, MK_RT_PTR); */ \
10178 MkERREXT_R(add).mkerrhead = &(_mkerrR); \
10179} while (0) \
10180
10181#define MkErrExtDel(_mkerrR,del) do { \
10182 /* printV("MkErrExtDel = %p, mkrt=%p", &(_mkerrR).mkErrExt, MK_RT_PTR); */ \
10183 (_mkerrR).mkErrExt = (typeof((_mkerrR).mkErrExt)) MkExtensionDel(MkEXT((_mkerrR).mkErrExt),MkEXT(del)); \
10184 MkERREXT_R(del).mkerrhead = NULL; \
10185} while (0) \
10186
10188// MkErrExtC_C_API
10190// #######################################################################
10191// -----------------------------------------------------------------------
10199
10201__parser__(ignore)
10202struct MkErrorPanicS {
10203 // BEGIN-MkErrorPanicS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10204
10205 union {
10206 struct MkObjectS obj; // instance-base MkObjectS
10207 } super;
10208
10209 // END-MkErrorPanicS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10210};
10211
10212// BEGIN-MkErrorPanicS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10213
10217 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
10218
10219// Signature --------------------------------------------------------------
10222
10223 #define MkErrorPanicC_SIGNATURE (MkObjectC_SIGNATURE ^ (7u<<10))
10224 #define MkErrorPanicC_MASK (((1u<<22)-1)<<10)
10225
10227
10228// CompileTimeCast --------------------------------------------------------------
10231
10232 #define MkErrorPanicC_X2obj(x) MkOBJ(x)
10233
10235
10236// TypeDef --------------------------------------------------------------
10239
10241 __parser__(ignore) typedef struct MkErrorPanicS MkErrorPanicCR;
10243 __parser__(ignore) typedef const struct MkErrorPanicS MkErrorPanicCNR;
10245 #define MkErrorPanicC_T (&MK_RT_REF._MkErrorPanicC_T)
10247 #define MkErrorPanicC_TT (MkTYP(MkErrorPanicC_T))
10249 #define MkErrorPanicST MkErrorPanicC_T
10251 #define MkErrorPanicSTT (MkTYP(MkErrorPanicST))
10253 #define MkErrorPanicCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
10255 #define MkErrorPanicCTT_X(instance) (MkOBJ_R(instance).type)
10257 #define MkErrorPanicCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
10259 #define MkErrorPanicC_NS MK
10261 #define MkErrorPanicCTT MkErrorPanicCTT
10263 #define MkErrorPanicCT ( (struct MkTypeDefS *) MkErrorPanicCTT )
10264
10266
10269// MkErrorPanicC_Class_Define_C_API
10270
10271// END-MkErrorPanicS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10272
10274// MkErrorPanicC_C_API
10276// #######################################################################
10277// -----------------------------------------------------------------------
10285
10287__parser__(ignore)
10288struct MkErrorExitS {
10289 // BEGIN-MkErrorExitS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10290
10291 union {
10292 struct MkObjectS obj; // instance-base MkObjectS
10293 } super;
10294
10295 // END-MkErrorExitS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10296};
10297
10298// BEGIN-MkErrorExitS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10299
10303 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
10304
10305// Signature --------------------------------------------------------------
10308
10309 #define MkErrorExitC_SIGNATURE (MkObjectC_SIGNATURE ^ (8u<<10))
10310 #define MkErrorExitC_MASK (((1u<<22)-1)<<10)
10311
10313
10314// CompileTimeCast --------------------------------------------------------------
10317
10318 #define MkErrorExitC_X2obj(x) MkOBJ(x)
10319
10321
10322// TypeDef --------------------------------------------------------------
10325
10327 __parser__(ignore) typedef struct MkErrorExitS MkErrorExitCR;
10329 __parser__(ignore) typedef const struct MkErrorExitS MkErrorExitCNR;
10331 #define MkErrorExitC_T (&MK_RT_REF._MkErrorExitC_T)
10333 #define MkErrorExitC_TT (MkTYP(MkErrorExitC_T))
10335 #define MkErrorExitST MkErrorExitC_T
10337 #define MkErrorExitSTT (MkTYP(MkErrorExitST))
10339 #define MkErrorExitCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
10341 #define MkErrorExitCTT_X(instance) (MkOBJ_R(instance).type)
10343 #define MkErrorExitCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
10345 #define MkErrorExitC_NS MK
10347 #define MkErrorExitCTT MkErrorExitCTT
10349 #define MkErrorExitCT ( (struct MkTypeDefS *) MkErrorExitCTT )
10350
10352
10355// MkErrorExitC_Class_Define_C_API
10356
10357// END-MkErrorExitS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10358
10360// MkErrorExitC_C_API
10362// #######################################################################
10363// -----------------------------------------------------------------------
10371
10373__parser__(ignore)
10374struct MkErrorIgnoreS {
10375 // BEGIN-MkErrorIgnoreS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10376
10377 union {
10378 struct MkObjectS obj; // instance-base MkObjectS
10379 } super;
10380
10381 // END-MkErrorIgnoreS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10382};
10383
10384// BEGIN-MkErrorIgnoreS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10385
10389 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
10390
10391// Signature --------------------------------------------------------------
10394
10395 #define MkErrorIgnoreC_SIGNATURE (MkObjectC_SIGNATURE ^ (5u<<10))
10396 #define MkErrorIgnoreC_MASK (((1u<<22)-1)<<10)
10397
10399
10400// CompileTimeCast --------------------------------------------------------------
10403
10404 #define MkErrorIgnoreC_X2obj(x) MkOBJ(x)
10405
10407
10408// TypeDef --------------------------------------------------------------
10411
10413 __parser__(ignore) typedef struct MkErrorIgnoreS MkErrorIgnoreCR;
10415 __parser__(ignore) typedef const struct MkErrorIgnoreS MkErrorIgnoreCNR;
10417 #define MkErrorIgnoreC_T (&MK_RT_REF._MkErrorIgnoreC_T)
10419 #define MkErrorIgnoreC_TT (MkTYP(MkErrorIgnoreC_T))
10421 #define MkErrorIgnoreST MkErrorIgnoreC_T
10423 #define MkErrorIgnoreSTT (MkTYP(MkErrorIgnoreST))
10425 #define MkErrorIgnoreCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
10427 #define MkErrorIgnoreCTT_X(instance) (MkOBJ_R(instance).type)
10429 #define MkErrorIgnoreCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
10431 #define MkErrorIgnoreC_NS MK
10433 #define MkErrorIgnoreCTT MkErrorIgnoreCTT
10435 #define MkErrorIgnoreCT ( (struct MkTypeDefS *) MkErrorIgnoreCTT )
10436
10438
10441// MkErrorIgnoreC_Class_Define_C_API
10442
10443// END-MkErrorIgnoreS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10444
10446// MkErrorIgnoreC_C_API
10448// #######################################################################
10449// -----------------------------------------------------------------------
10456
10459__parser__(ignore)
10460struct MkErrorPrintS {
10461 // BEGIN-MkErrorPrintS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10462
10463 union {
10464 struct MkObjectS obj; // instance-base MkObjectS
10465 } super;
10466
10467 // END-MkErrorPrintS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10468};
10469
10470// BEGIN-MkErrorPrintS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10471
10475 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
10476
10477// Signature --------------------------------------------------------------
10480
10481 #define MkErrorPrintC_SIGNATURE (MkObjectC_SIGNATURE ^ (6u<<10))
10482 #define MkErrorPrintC_MASK (((1u<<22)-1)<<10)
10483
10485
10486// CompileTimeCast --------------------------------------------------------------
10489
10490 #define MkErrorPrintC_X2obj(x) MkOBJ(x)
10491
10493
10494// TypeDef --------------------------------------------------------------
10497
10499 __parser__(ignore) typedef struct MkErrorPrintS MkErrorPrintCR;
10501 __parser__(ignore) typedef const struct MkErrorPrintS MkErrorPrintCNR;
10503 #define MkErrorPrintC_T (&MK_RT_REF._MkErrorPrintC_T)
10505 #define MkErrorPrintC_TT (MkTYP(MkErrorPrintC_T))
10507 #define MkErrorPrintST MkErrorPrintC_T
10509 #define MkErrorPrintSTT (MkTYP(MkErrorPrintST))
10511 #define MkErrorPrintCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
10513 #define MkErrorPrintCTT_X(instance) (MkOBJ_R(instance).type)
10515 #define MkErrorPrintCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
10517 #define MkErrorPrintC_NS MK
10519 #define MkErrorPrintCTT MkErrorPrintCTT
10521 #define MkErrorPrintCT ( (struct MkTypeDefS *) MkErrorPrintCTT )
10522
10524
10527// MkErrorPrintC_Class_Define_C_API
10528
10529// END-MkErrorPrintS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10530
10532//MkErrorPrintC_C_API
10534// #######################################################################
10535// -----------------------------------------------------------------------
10542
10549__parser__(ignore)
10550struct MkErrorDefaultS {
10551 // BEGIN-MkErrorDefaultS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10552
10553 union {
10554 struct MkObjectS obj; // instance-base MkObjectS
10555 struct MkErrorS err; // instance-base MkErrorS
10556 } super;
10557
10558 // END-MkErrorDefaultS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10559};
10560
10561// BEGIN-MkErrorDefaultS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10562
10566 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
10567
10568// Signature --------------------------------------------------------------
10571
10572 #define MkErrorDefaultC_SIGNATURE (MkErrorC_SIGNATURE ^ (1u<<6))
10573 #define MkErrorDefaultC_MASK (((1u<<26)-1)<<6)
10574
10576
10577// CompileTimeCast --------------------------------------------------------------
10580
10581 #define MkErrorDefaultC_X2err(x) MkERR(x)
10582 #define MkErrorDefaultC_X2obj(x) MkOBJ(x)
10583
10585
10586// TypeDef --------------------------------------------------------------
10589
10591 __parser__(ignore) typedef struct MkErrorDefaultS MkErrorDefaultCR;
10593 __parser__(ignore) typedef const struct MkErrorDefaultS MkErrorDefaultCNR;
10595 #define MkErrorDefaultC_T (&MK_RT_REF._MkErrorDefaultC_T)
10597 #define MkErrorDefaultC_TT (MkTYP(MkErrorDefaultC_T))
10599 #define MkErrorDefaultST MkErrorDefaultC_T
10601 #define MkErrorDefaultSTT (MkTYP(MkErrorDefaultST))
10603 #define MkErrorDefaultCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
10605 #define MkErrorDefaultCTT_X(instance) (MkOBJ_R(instance).type)
10607 #define MkErrorDefaultCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
10609 #define MkErrorDefaultC_NS MK
10611 #define MkErrorDefaultCTT MkErrorDefaultCTT
10613 #define MkErrorDefaultCT ( (struct MkTypeDefS *) MkErrorDefaultCTT )
10614
10616
10619// MkErrorDefaultC_Class_Define_C_API
10620
10621// END-MkErrorDefaultS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
10622
10624// MkErrorDefaultC_C_API
10626// #######################################################################
10627// -----------------------------------------------------------------------
10632
10633__parser__push__(doc-group=System,class=MkErrorC);
10634
10638#define MkERROR_R(r) ((*r).error_mk)
10639#define MkERROR MkERROR_R(&MK_RT_REF)
10640#define MkERROR_RT MkERROR_R(&MK_RT_REF)
10641#define MkERROR_O(o) MkERROR_R(MkRT_O(o))
10642#define MkERROR_X(x) MkERROR_R(MkRT_X(x))
10643#define MkERROR_XN(x) MkERROR_R(MkRT_XN(x))
10644#define MkERROR_NULL MkERROR_R(&MkRuntimeRLS)
10646
10650
10652#define MK_ERROR_DEFAULT_R(r) MkOBJ(&(*r).error_mk)
10653#define MK_ERROR_DEFAULT MK_ERROR_DEFAULT_R(&MK_RT_REF)
10654#define MK_ERROR_DEFAULT_X(x) MK_ERROR_DEFAULT_R(MkRT_X(x))
10655#define MK_ERROR_DEFAULT_NULL MK_ERROR_DEFAULT_R(&MkRuntimeRLS)
10663mk_inline MK_ERR MkErrorDEFAULT_RT ( MK_PARSER_RT_ONLY );
10664
10666// END: MkErrorDEFAULT
10671
10672#define MK_ERROR_PANIC_R(r) MkOBJ(&(*r).error_panic)
10673#define MK_ERROR_PANIC MK_ERROR_PANIC_R(&MK_RT_REF)
10674#define MK_ERROR_PANIC_X(x) MK_ERROR_PANIC_R(MkRT_X(x))
10676#define MK_ERROR_PANIC_NULL MK_ERROR_PANIC_R(&MkRuntimeRLS)
10677
10693__parser__(hide)
10694mk_inline MK_ERR MkErrorPANIC_RT ( MK_PARSER_RT_ONLY );
10695
10697// END: MkErrorPanik
10698
10702
10703#define MK_ERROR_EXIT_R(r) MkOBJ(&(*r).error_exit)
10704#define MK_ERROR_EXIT MK_ERROR_EXIT_R(&MK_RT_REF)
10705#define MK_ERROR_EXIT_X(x) MK_ERROR_EXIT_R(MkRT_X(x))
10707#define MK_ERROR_EXIT_NULL MK_ERROR_EXIT_R(&MkRuntimeRLS)
10708
10724__parser__(hide)
10725mk_inline MK_ERR MkErrorEXIT_RT ( MK_PARSER_RT_ONLY );
10726
10728// END: MkErrorExit
10729
10733
10734#define MK_ERROR_IGNORE_R(r) MkOBJ(&(*r).error_ignore)
10735#define MK_ERROR_IGNORE MK_ERROR_IGNORE_R(&MK_RT_REF)
10736#define MK_ERROR_IGNORE_X(x) MK_ERROR_IGNORE_R(MkRT_X(x))
10737#define MK_ERROR_IGNORE_XN(x) MK_ERROR_IGNORE_R(MkRT_XN(x))
10739#define MK_ERROR_IGNORE_NULL MK_ERROR_IGNORE_R(&MkRuntimeRLS)
10740
10765mk_inline MK_ERR MkErrorIGNORE_RT ( MK_PARSER_RT_ONLY );
10766
10768// MkErrorIgnore
10769
10773
10774#define MK_ERROR_PRINT_R(r) MkOBJ(&(*r).error_print)
10775#define MK_ERROR_PRINT MK_ERROR_PRINT_R(&MK_RT_REF)
10776#define MK_ERROR_PRINT_X(x) MK_ERROR_PRINT_R(MkRT_X(x))
10778#define MK_ERROR_PRINT_NULL MK_ERROR_PRINT_R(&MkRuntimeRLS)
10779
10793mk_inline MK_ERR MkErrorPRINT_RT ( MK_PARSER_RT_ONLY );
10794
10796// MkErrorPrintln
10797
10801
10802#define MK_ERROR_FORMAT_R(r) ((*r).error_mk.format_of_error ? (*r).error_mk.format_of_error : \
10803 MkObjN((*r).error_mk.source_of_error) ? MkObjN((*r).error_mk.source_of_error) : \
10804 MK_ERROR_DEFAULT_R(r))
10805#define MK_ERROR_FORMAT MK_ERROR_FORMAT_R(&MK_RT_REF)
10806#define MK_ERROR_FORMAT_X(x) MK_ERROR_FORMAT_R(MkRT_X(x))
10808#define MK_ERROR_FORMAT_NULL MK_ERROR_FORMAT_R(&MkRuntimeRLS)
10809
10827MK_EXTERN MK_ERR MK_DECL MkErrorFORMAT (
10830
10831#define MkErrorFORMAT_1M(m) MkErrorFORMAT(MkObjN(m))
10832#define MkErrorFORMAT_1X(x) MkErrorFORMAT(MkOBJ(x))
10833#define MkErrorFORMAT_1O(o) MkErrorFORMAT(o)
10834
10836__parser__(internal)
10837MK_EXTERN MK_ERR MK_DECL MkErrorFORMAT_EO (
10840
10842
10844
10846// END: MkErrorC_System_C_API
10848// #######################################################################
10849// -----------------------------------------------------------------------
10854
10855__parser__push__(doc-group=TOR);
10856
10862__parser__(destructor)
10863MK_EXTERN void MK_DECL MkErrorDelete_RT (
10865 MK_ERR err
10867
10875__parser__(constructor)
10876MK_EXTERN MK_ERR MK_DECL MkErrorDup_RT (
10878 MK_ERRN const srce
10880
10886 MK_ERR dest,
10887 MK_ERRN const srce
10889
10891
10893// MkErrorC_TOR_C_API
10894
10895// #######################################################################
10896// -----------------------------------------------------------------------
10901
10902__parser__push__(doc-group=Get);
10903
10905__parser__(error-ignore,inline=MkErrorGetCodeI)
10907 MK_ERRN const err
10909
10911#define MkErrorGetCodeI(e) ((*e).code)
10913#define MkErrorGetCodeE_NULL() (MkERROR_NULL.code)
10915#define MkErrorGetCode_O(o) (MkERROR_O(o).code)
10916
10920 MK_ERRN const err
10922
10924#define MkErrorGetTextI(e) (MkBUF_R(&(*e).text).storage.first.C)
10928MK_EXTERN MK_SIZE MK_DECL MkErrorGetSize (
10929 MK_ERRN const err
10931
10933#define MkErrorGetSizeI(e) ((MK_SIZE)MkBUF_R(&(*e).text).var.cursize)
10934
10938 MK_ERRN const err
10940
10942#define MkErrorGetNumI(e) ((*e).num)
10943
10945
10947// MkErrorC_Get_C_API
10948
10949/*****************************************************************************/
10950/* */
10951/* error set */
10952/* */
10953/*****************************************************************************/
10954
10955// #######################################################################
10956// -----------------------------------------------------------------------
10962
10963__parser__push__(doc-group=Signal);
10964
10966MK_EXTERN void MK_DECL MkErrorSetCONTINUE_RT (
10968 MK_ERR const err
10970
10971#define MkErrorSetCONTINUE_0E() MkErrorSetCONTINUE(&MkERROR)
10972
10992MK_EXTERN enum MkErrorE MK_DECL MkErrorSetEXIT_RT (
10994 MK_ERR const err,
10995 MK_STRN const callfunc __parser__(default=F#FUNC)
10997
11004MK_EXTERN enum MkErrorE MK_DECL MkErrorSetSOCKET_RT (
11006 MK_ERR const err,
11007 MK_STRN const detail __parser__(default=S#"UNKNOWN"),
11008 MK_STRN const callfunc __parser__(default=F#FUNC)
11010
11024 MK_ERR const err,
11025 MK_STRN const detail __parser__(default=S#"UNKNOWN"),
11026 MK_STRN const callfunc __parser__(default=F#FUNC)
11028
11032 MK_ERR const err,
11033 enum MkErrorE code
11035
11038 MK_ERRN const err
11040
11043 MK_ERRN const err
11045
11047MK_EXTERN bool MK_DECL MkErrorIsTIMEOUT (
11048 MK_ERRN const err
11050
11076MK_EXTERN bool MK_DECL MkErrorIsEXIT (
11077 MK_ERR const err
11079
11080__parser__pop__; // Signal
11081
11083// MkErrorC_Signal_C_API
11084
11085/*****************************************************************************/
11086/* */
11087/* error_is/check */
11088/* */
11089/*****************************************************************************/
11098
11100#define MkErrorCheckI(err) ((err) >= MK_ERROR)
11104#define MkErrorCheckE_0E() (MkErrorCheckI(MkErrorGetCode_0E()))
11105#define MkErrorCheckE_NULL() (MkErrorCheckI(MkErrorGetCodeE_NULL()))
11106#define MkErrorCheckE_O(o) (MkErrorCheckI(MkErrorGetCode_O(o)))
11107#define MkErrorCheckE_X(x) MkErrorCheckE_O(MkOBJ(x))
11108#define MkErrorCheckE_E(e) (MkErrorCheckI((e)->code))
11111#define MkErrorCheck(err) if (MkErrorCheckI(err)) goto error
11113#define MkErrorE_Check(err) if (MkErrorCheckI(err)) goto error
11115#define MkErrorCheck_0E() if (MkErrorCheckE_0E()) goto error
11117#define MkErrorBreak(err) if (MkErrorCheckI(err)) break
11119#define MkContinueCheck(err) switch (err) { \
11120case MK_OK: break; case MK_CONTINUE: goto cont; case MK_ERROR: goto error;\
11124#define MkErrorSwitch(PROC) switch (PROC) {\
11125case MK_OK: break; case MK_ERROR: goto error; case MK_CONTINUE: return MK_CONTINUE;\
11126}
11128/*
11129OLD and unused
11130
11132#define MkErrorReturnAppend(PROC) \
11133if (MkErrorCheckI(PROC)) { \
11134 return MkErrorStack_0E (); \
11135} else if (MkErrorCheckE_0E()) { \
11136 return MkErrorReset_0E (); \
11137} else { \
11138 return MkERROR.code; \
11139}
11140*/
11142#define MkErrorReturn_2X(mngx,PROC) switch (PROC) {\
11143case MK_OK: return MK_OK; case MK_CONTINUE: return MK_CONTINUE; default: return MkErrorStack_1X (mngx);\
11144};
11146#define MkErrorReturn_1(PROC) switch (PROC) {\
11147case MK_OK: return MK_OK; case MK_CONTINUE: return MK_CONTINUE; default: return MkErrorStack_0E ();\
11148};
11150#define MkErrorReturn(PROC) MkErrorReturn_2X(META_CONTEXT_S,PROC)
11152#define check_MkErrorE(PROC) if (MkErrorCheckI(PROC))
11153
11155#define MkErrorReturnLabel(mng) \
11156 return MK_OK; \
11157error: \
11158 return MkErrorStack_1M(mng);
11159
11161// MkErrorCheck...
11162
11163// #######################################################################
11164// -----------------------------------------------------------------------
11171
11172__parser__global__(prefix2class:MkPanic=MkErrorC);
11173__parser__push__(doc-group=Raise);
11174
11185MK_EXTERN void MK_DECL MkPanicVL_RT (
11188 MK_STRN const callfunc __parser__(default=F#FUNC),
11189 MK_I32 const errnum __parser__(default=-1),
11190 MK_FST const printfmt,
11191 va_list var_list
11192) MK_ATTR_RT_INSTANCE __attribute__((noreturn));
11193
11194#define MkPanicVL_5M(errobj,callfunc,errnum,printfmt,var_list) \
11195 MkPanicVL(MkObj(errobj),callfunc,errnum,printfmt,var_list)
11196
11206MK_EXTERN void MK_DECL MkPanicV_RT (
11209 MK_STRN const callfunc __parser__(default=F#FUNC),
11210 MK_I32 const errnum __parser__(default=-1),
11211 MK_FST const printfmt,
11212 ...
11213) MK_ATTR_RT_INSTANCE MK_RT_ATTR_FORMAT_4 __attribute__((noreturn));
11214
11215#define MkPanicV_4M(errobj,callfunc,errnum,printfmt,...) \
11216 MkPanicV(MkObj(errobj),callfunc,errnum,printfmt,__VA_ARGS__)
11217
11218#define MkPanicV_2M(x,printfmt,...) \
11219 MkPanicV_2(MkObj(x),printfmt,__VA_ARGS__)
11230__parser__(no-type-extension,no-rpc)
11234 MK_STRN const callfunc __parser__(default=F#FUNC),
11235 MK_I32 const errnum __parser__(default=-1),
11236 MK_STRN const message
11237) MK_ATTR_RT_INSTANCE __attribute__ ((noreturn));
11238
11239#define MkPanicC_4M(errobj,callfunc,errnum,message) \
11240 MkPanicC(MkObj(errobj),callfunc,errnum,message)
11241
11242#define MkPanicC_2M(x,message) MkPanicC_2(MkObj(x),message)
11243
11251__parser__(no-rpc)
11252MK_EXTERN void MK_DECL MkPanicDEFAULT_RT (
11255 MK_STRN const callfunc __parser__(default=F#FUNC)
11257
11258#define MkPanicDEFAULT_2M(errobj,...) MkPanicDEFAULT(MkObj(errobj),__VA_ARGS__)
11259#define MkPanicDEFAULT_1M(x) MkPanicDEFAULT_1(MkObj(x))
11260
11265#define MkPanicSYS(mngx) do { \
11266 MkLogC_2X(mngx,"internal ERROR, please contact your local support\n"); \
11267 MkDisasterSignal(-1); \
11268} while (0)
11269
11275__parser__(internal,overload-c-no)
11277 MK_I32 signal __parser__(default=-1) // NO signal
11278) __attribute__ ((noreturn));
11286MK_EXTERN void MK_DECL MkErrorAppendVL_RT (
11288 MK_ERR const err,
11289 MK_FST const printfmt,
11290 va_list var_list
11292
11298__parser__(no-type-extension)
11299MK_EXTERN void MK_DECL MkErrorAppendV_RT (
11301 MK_ERR const err,
11302 MK_FST const printfmt,
11303 ...
11305
11311__parser__(no-type-extension)
11312MK_EXTERN void MK_DECL MkErrorAppendC_RT (
11314 MK_ERR const err,
11315 MK_STRN const message
11317
11336__parser__(doc-group=Raise)
11337MK_EXTERN MK_ERR MK_DECL MkErrorNoRaise_RT (
11339 MK_ERR const err
11341
11362__parser__(internal)
11363MK_EXTERN enum MkErrorE MK_DECL MkErrorSetR_RT (
11365 MK_ERR const err,
11366 MK_STRN const message,
11367 enum MkErrorE const errcode __parser__(default=F#MK_ERROR),
11368 MK_I32 const errnum __parser__(default=-1),
11369 MK_MNG const errctx __parser__(default=NULL)
11371
11380__parser__(hide)
11383 MK_ERR const err,
11384 MK_ERR const newerr
11386
11398__parser__(no-type-extension)
11401 MK_ERR err,
11402 MK_STRN const message,
11403 MK_STRN const callfunc __parser__(default=F#FUNC),
11404 MK_I32 const errnum __parser__(default=-1)
11406
11407#define MkErrorSetC_1XS(message) MkErrorSetC_4M(META_CONTEXT_S,message,__func__,-1)
11408#define MkErrorSetC_2E_E(caller,message) MkErrorCheck(MkErrorSetC_2E(message,caller))
11409
11410#define MkErrorSetC_4_NULL(...) MkErrorSetC_RT(MK_RT_NULL __VA_ARGS__)
11411#define MkErrorSetC_3_NULL(...) MkErrorSetC_4_NULL(&MkERROR_NULL,__VA_ARGS__)
11412#define MkErrorSetC_2_NULL(msg,pfx) MkErrorSetC_3_NULL(msg,pfx,-1)
11413#define MkErrorSetC_1_NULL(msg) MkErrorSetC_3_NULL(msg,__func__,-1)
11414
11415#define MkErrorSetC_4M_NULL(m,...) MkErrorSetC_4_NULL(MkErrorFORMAT_1M(m),__VA_ARGS__)
11416#define MkErrorSetC_3M_NULL(m,msg,pfx) MkErrorSetC_4M_NULL(m,msg,pfx,-1)
11417#define MkErrorSetC_2M_NULL(m,msg) MkErrorSetC_4M_NULL(m,msg,__func__,-1)
11418
11432__parser__(no-type-extension)
11435 MK_ERR err,
11436 MK_STRN const callfunc __parser__(default=F#FUNC),
11437 MK_I32 const errnum __parser__(default=-1),
11438 MK_FST const printfmt,
11439 va_list var_list
11441
11454__parser__(no-type-extension)
11457 MK_ERR err,
11458 MK_STRN const callfunc __parser__(default=F#FUNC),
11459 MK_I32 const errnum __parser__(default=-1),
11460 MK_FST const printfmt,
11461 ...
11463
11464#define MkErrorSetV_4EO_NULL(o,...) MkErrorSetV_NULL(MkErrorFORMAT_EO(o), __VA_ARGS__)
11465#define MkErrorSetV_4M_NULL(m,...) MkErrorSetV_NULL(MkErrorFORMAT_1M(m),__VA_ARGS__)
11466#define MkErrorSetV_2M_NULL(m,...) MkErrorSetV_4M_NULL(m,__func__,-1,__VA_ARGS__)
11467#define MkErrorSetV_2X(x,...) MkErrorSetV(MkErrorFORMAT_1X(x),__func__,-1,__VA_ARGS__)
11468
11469#define MkErrorSetV_1_NULL(printfmt,...) \
11470 MkErrorSetV_NULL(&MkERROR_NULL,__func__,-1,printfmt,__VA_ARGS__)
11471
11472#define MkErrorSetV_1XS(printfmt,...) \
11473 MkErrorSetV_4M(META_CONTEXT_S,__func__,-1,printfmt,__VA_ARGS__)
11474
11475#define MkErrorSetV_2E_E(caller,printfmt,...) \
11476 MkErrorCheck(MkErrorSetV_2E(caller,printfmt,__VA_ARGS__))
11477
11478#define MkErrorSet_ObjectIsNullError(m,printfmt,...) \
11479 MkErrorSetV_4M(m,"ObjectIsNullError",-1,printfmt,__VA_ARGS__)
11481#define MkErrorSysO(obj,cmd) \
11482 MkErrorSetV_4EO_NULL (obj, __func__, errno, \
11483 "can not '%s' -> ERR<%s>", MK_CPPXSTR(cmd), strerror (errno))
11484
11485__parser__pop__; // Raise
11488// MkErrorC_Raise_C_API
11490// #######################################################################
11491// -----------------------------------------------------------------------
11496
11497__parser__push__(doc-group=Misc);
11498
11517MK_EXTERN void MK_DECL MkErrorCleanup_RT (
11519 MK_ERR const err,
11520 MK_STRN const callfunc __parser__(default=F#FUNC),
11521 MK_I32 const callline __parser__(default=F#LINE)
11523
11533 MK_ERR const err,
11534 MK_STRN const msg __parser__(default=S#""),
11535 MK_STRN const callfunc __parser__(default=F#FUNC),
11536 MK_I32 const callline __parser__(default=F#LINE)
11538
11539#define MkErrorPrintln_0() MkErrorPrintln_0E()
11540
11551__parser__(const,class-overload=MkObjectLog)
11554 MK_ERRN const err ,
11556 MK_DBG const debug __parser__(default=0),
11557 MK_STRN const callfunc __parser__(default=F#FUNC),
11558 MK_I32 const lvl __parser__(default=0)
11560
11561#define MkErrorLog_1EF_NULL(fmt) MkErrorLog(&MkERROR_NULL,fmt,0,__func__,0)
11562#define MkErrorLog_1EF(fmt) MkErrorLog_4E(fmt,0,__func__,0)
11563
11581__parser__(no-rpc,template-overload)
11582MK_EXTERN MK_ERR MK_DECL MkErrorCatch_RT (
11584 MK_ERR const err,
11585 MK_EXP const exception __parser__(default=NULL,has-reference),
11586 MK_STRN const callfunc __parser__(default=F#FUNC)
11588
11614__parser__(no-rpc,template-overload)
11615MK_EXTERN MK_ERR MK_DECL MkObjectErrorCatch_RT (
11617 MK_OBJN const obj,
11618 MK_EXP const exception __parser__(default=NULL,has-reference),
11619 MK_STRN const callfunc __parser__(default=F#FUNC)
11621
11623#define MkObjectErrorCatch_3X(x,...) MkObjectErrorCatch(MkOBJ(x),__VA_ARGS__)
11624
11632__parser__(doc-group=Raise)
11633MK_EXTERN enum MkErrorE MK_DECL MkErrorRaise_RT (
11635 MK_ERRN const err
11646// [MkErrorReset-example]
11649 MK_ERR const err,
11650 MK_STRN const callfunc __parser__(default=F#FUNC),
11651 MK_I32 const callline __parser__(default=F#LINE),
11652 bool const force __parser__(default=B#false)
11654
11655#define MkErrorReset_0M() MkErrorReset_4M(NULL,__func__,__LINE__,0);
11656#define MkErrorResetFORCE_1(m) MkErrorReset_4M(m,__func__,__LINE__,1);
11657#define MkErrorResetFORCE_0() MkErrorReset_4M(NULL,__func__,__LINE__,1);
11658
11659#define MkErrorReset_4X(x,...) MkErrorReset(MkErrorFORMAT_1X(x),__VA_ARGS__)
11660#define MkErrorReset_1X(x) MkErrorReset_4X(x,__func__,__LINE__,0)
11661// [MkErrorReset-example]
11662
11671MK_DECL MkErrorStackFormat_RT (
11673 MK_ERR const err,
11674 MK_STRN callfunc __parser__(default=F#FUNC),
11675 MK_STRN callfile __parser__(default=F#FILE),
11676 MK_I32 const callline __parser__(default=F#LINE)
11678
11687__parser__(error-ignore,no-rpc)
11688MK_EXTERN enum MkErrorE
11689MK_DECL MkErrorStack_RT (
11691 MK_ERR const err __parser__(default=NULL),
11692 MK_STRN const callfunc __parser__(default=F#FUNC),
11693 MK_STRN const callfile __parser__(default=F#FILE),
11694 MK_I32 const callline __parser__(default=F#LINE)
11696
11697#define MkErrorStack_1M_Check(m) (MkErrorCheckE_0E() ? MkErrorStack_1M(m) : MkErrorGetCode_0E())
11698#define MkErrorStack_0E_Check() (MkErrorCheckE_0E() ? MkErrorStack_0E() : MkErrorGetCode_0E())
11699
11700#define MkErrorStack_4X(x,...) MkErrorStack_RT(MK_RT_CALL MkErrorFORMAT_1X(x),__VA_ARGS__)
11701#define MkErrorStack_3X(...) MkErrorStack_4X(__VA_ARGS__,__LINE__)
11702#define MkErrorStack_2X(...) MkErrorStack_4X(__VA_ARGS__,__FILE__,__LINE__)
11703#define MkErrorStack_1X(...) MkErrorStack_4X(__VA_ARGS__,__func__,__FILE__,__LINE__)
11704
11705#define MkErrorStack_0_NULL() MkErrorStack_NULL(&MkERROR_NULL,__func__,__FILE__,__LINE__)
11706
11707#define MkErrorStack_4X_NULL(x,...) MkErrorStack_NULL(MkErrorFORMAT_1X(x),__VA_ARGS__)
11708#define MkErrorStack_3X_NULL(...) MkErrorStack_4X_NULL(__VA_ARGS__,__LINE__)
11709#define MkErrorStack_2X_NULL(...) MkErrorStack_4X_NULL(__VA_ARGS__,__FILE__,__LINE__)
11710#define MkErrorStack_1X_NULL(...) MkErrorStack_4X_NULL(__VA_ARGS__,__func__,__FILE__,__LINE__)
11712#define MkErrorStack_NUM 50
11713#define MkErrorStack_STR "50"
11718MK_DECL MkErrorToString_RT (
11720 MK_ERRN const inst
11726// MkErrorC_Misc_C_API
11728// #######################################################################
11729// -----------------------------------------------------------------------
11755
11766__parser__(class=MkExceptionC,ignore)
11767bool MkExceptionCheck (MK_EXP exception);
11768
11774__parser__(class=MkExceptionC,ignore)
11775void MkExceptionRaise (
11776 MK_MNG const expobj,
11777 MK_STRN const callfunc,
11778 MK_I32 const callline
11779) ;
11780
11788__parser__(class=MkExceptionC,ignore)
11789MK_ERR MkExceptionCatch (
11790 MK_MNG const expobj,
11791 MK_EXP const exception,
11792 MK_STRN const callfunc
11793) ;
11794
11796// MkException_C_API
11797
11798// #######################################################################
11799// -----------------------------------------------------------------------
11805
11807__parser__(ignore)
11808struct MkRtExtS {
11809 // BEGIN-MkRtExtS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
11810
11811 union {
11812 struct MkObjectS obj; // instance-base MkObjectS
11813 struct MkExtensionS ext; // instance-base MkExtensionS
11814 } super;
11815
11816 // END-MkRtExtS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
11817
11818 MK_RT mkrtHead;
11819};
11820
11821// BEGIN-MkRtExtS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
11826 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
11828// Signature --------------------------------------------------------------
11831
11832 #define MkRtExtC_SIGNATURE (MkExtensionC_SIGNATURE ^ (2u<<6))
11833 #define MkRtExtC_MASK (((1u<<26)-1)<<6)
11834
11836
11837// CompileTimeCast --------------------------------------------------------------
11840
11841 #define MkRtExtC_X2rtext(x) (x)
11842 #define MkRtExtC_X2ext(x) MkEXT(x)
11843 #define MkRtExtC_X2obj(x) MkOBJ(x)
11844
11847// TypeDef --------------------------------------------------------------
11850
11852 __parser__(ignore) typedef struct MkRtExtS MkRtExtCR;
11854 __parser__(ignore) typedef const struct MkRtExtS MkRtExtCNR;
11856 #define MkRtExtC_T (&MK_RT_REF._MkRtExtC_T)
11858 #define MkRtExtC_TT (MkTYP(MkRtExtC_T))
11860 #define MkRtExtST MkRtExtC_T
11862 #define MkRtExtSTT (MkTYP(MkRtExtST))
11864 #define MkRtExtC_type MK_RTEXT
11866 #define MkRtExtCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
11868 #define MkRtExtCTT_X(instance) (MkOBJ_R(instance).type)
11870 #define MkRtExtCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
11872 #define MkRtExtC_NS MK
11874 #define MkRtExtCTT MkRtExtCTT
11876 #define MkRtExtCT ( (struct MkTypeDefS *) MkRtExtCTT )
11877
11879
11880// TypeCheck --------------------------------------------------------------
11883
11884 #pragma GCC diagnostic push
11885 #pragma GCC diagnostic ignored "-Wattributes"
11889 __parser__(class=MkRtExtC,static,ignore)
11891 mk_inline bool MkRtExtCheck (MK_MNGN mng) {
11892 return MkSanitizeCheck(MkRtExtC,mng);
11893 }
11894
11897 __parser__(class=MkRtExtC,static,ignore)
11899 mk_inline bool MkRtExtCheckO (MK_OBJN obj) {
11900 return MkSanitizeCheckO(MkRtExtC,obj);
11901 }
11902
11903 #pragma GCC diagnostic pop
11904 #define MkRtExtC_Check(mng) MkRtExtCheck(mng)
11907
11908// RunTimeCast --------------------------------------------------------------
11911
11913 __parser__(class=MkRtExtC,ignore,static)
11914 META_ATTRIBUTE_SANITIZE
11916 mk_inline MK_RTEXT MkRtExt(MK_MNG mng) {
11917 return (MkRtExtCheck(mng) ? (MK_RTEXT)mng : NULL);
11919
11921 __parser__(class=MkRtExtC,ignore,static)
11922 META_ATTRIBUTE_SANITIZE
11924 mk_inline MK_RTEXTN MkRtExtN(MK_MNGN mng) {
11925 return (MkRtExtCheck(mng) ? (MK_RTEXTN)mng : NULL);
11926 }
11927
11929 #define MkRtExtRaise(_rtext) if (!_MkCheckX(MkRtExtC,_rtext)) { \
11930 MkErrorSetC_1E("'MkRtExtC' hdl is NULL"); \
11931 goto error ; \
11932 }
11933
11935 #define MkRTEXT_R(x) (*(x)).super.rtext
11937 #define MkRTEXT(x) (&MkRTEXT_R(x))
11940
11943// MkRtExtC_Class_Define_C_API
11944
11945// END-MkRtExtS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
11946
11947#define MkRtExtAdd(_mkrtR,add,id) do { \
11948 (_mkrtR).mkRtExt = (typeof((_mkrtR).mkRtExt)) MkExtensionAdd(MkEXT((_mkrtR).mkRtExt),MkEXT(add)); \
11949 MkRTEXT_R(add).mkrtHead = &(_mkrtR); \
11950 (_mkrtR).mkRtExtAry[id] = MkRTEXT(add); \
11951} while (0) \
11952
11953#define MkRtExtDel(_mkrtR,del,id) do { \
11954 (_mkrtR).mkRtExt = (typeof((_mkrtR).mkRtExt)) MkExtensionDel(MkEXT((_mkrtR).mkRtExt),MkEXT(del)); \
11955 MkRTEXT_R(del).mkrtHead = NULL; \
11956 (_mkrtR).mkRtExtAry[id] = NULL; \
11957} while (0) \
11958
11960// MkRtExtC_C_API
11962// #######################################################################
11963// -----------------------------------------------------------------------
11964//
11965// \addtogroup MqExceptionC_C_API
11966// \{
11967// \brief target-language class to 'set' and 'raise' an error …
11968//
11969// \}
11970// MqExceptionC_C_API
11971
11972/* MARK_R ################################################################ */
11973/* ### ### */
11974/* ### R U N T I M E - A P I ### */
11975/* ### ### */
11976/* ####################################################################### */
11977
11978__parser__global__(prefix2class:MkRuntime=MkRuntimeC);
11979
12026#define MkDbgRt_1(c) mk_dbg_color_ln(c,"mkrt<%p>, MkRT<%p>", mkrt, MkRT)
12027#define MkDbgRt() MkDbgRt_1(MK_COLOR_PURPLE)
12028#define MkDbgRtChkX(x) (MkRT_X(x)==MkRT?"ok":"wrong")
12029
12030__parser__(ignore)
12031typedef struct MkThreadDataS {
12032 MK_STRB name[32];
12033 MK_PTR ptr;
12035
12038
12039#pragma GCC diagnostic push
12040#pragma GCC diagnostic ignored "-Wlto-type-mismatch"
12042#if defined(MK_C_BUILD_DLL)
12043
12044 #define META_SECTION_DEFINE
12045 #include "MkRuntimeS_mk.h"
12046 #undef META_SECTION_DEFINE
12048#else
12049
12051struct MkRuntimeS {
12052
12053 // ======================================================================================
12054 // PUBLIC variables -> sync with MkRuntimeS_mk.h !!
12055
12056 // !!! sync with MkRuntimeS_mk.h
12057
12068
12069 // BEGIN-MkRuntimeS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
12070
12071 union {
12072 struct MkObjectS obj; // instance-base MkObjectS
12073 } super;
12074
12075 // END-MkRuntimeS-super - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
12076
12078 struct MkErrorS error_mk;
12079
12081 struct MkErrorPanicS error_panic;
12082
12084 struct MkErrorPanicS error_exit;
12085
12087 struct MkErrorIgnoreS error_ignore;
12088
12090 struct MkErrorPrintS error_print;
12091
12096
12101 bool isSilent;
12102
12104 bool noDeco;
12105
12112 MK_I32 debug;
12113
12116
12120 struct MkBuffer64S tbuf;
12121
12123 MkThreadDataS mkThreadData;
12124
12126 MK_RTEXT mkRtExt;
12128 MK_RTEXT mkRtExtAry[MkExtension_size];
12131 MkSelfIncrF fSelfIncr;
12132
12134 MkSelfDecrF fSelfDecr;
12135
12145 bool MkSelfIncrOnCacheB;
12146
12147 // ======================================================================================
12148 // TYPES
12149
12150 // BEGIN-rtDef - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
12151
12152 struct MkTypeDefS _MkObjectC_T ;
12153 struct MkTypeDefS _MkBufferC_T ;
12154 struct MkTypeDefS _MkBuffer64C_T ;
12155 struct MkTypeDefS _MkBuffer256C_T ;
12156 struct MkTypeDefS _MkBuffer1024C_T ;
12157 struct MkTypeDefS _MkBufferStreamC_T ;
12158 struct MkTypeDefS _MkBufferStream16384C_T ;
12159 struct MkTypeDefS _MkBufferStream256C_T ;
12160 struct MkTypeDefS _MkBufferStream64C_T ;
12161 struct MkTypeDefS _MkBufferStream1024C_T ;
12162 struct MkTypeDefS _MkBufferListC_T ;
12163 struct MkTypeDefS _MkLogFileC_T ;
12164 struct MkTypeDefS _MkErrorC_T ;
12165 struct MkTypeDefS _MkErrorDefaultC_T ;
12166 struct MkTypeDefS _MkErrorIgnoreC_T ;
12167 struct MkTypeDefS _MkErrorPrintC_T ;
12168 struct MkTypeDefS _MkErrorPanicC_T ;
12169 struct MkTypeDefS _MkErrorExitC_T ;
12170 struct MkTypeDefS _MkExtensionC_T ;
12171 struct MkTypeDefS _MkErrExtC_T ;
12172 struct MkTypeDefS _MkRtExtC_T ;
12173 struct MkTypeDefS _MkRuntimeC_T ;
12174 struct MkTypeS _MkTypeC_TT ;
12175 struct MkTypeS _MkTypeDefC_TT ;
12177 // END-rtDef - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
12179 // offset calculated by "Nhi1InternalSize"
12180 MK_BINB private_variables[12986];
12183#endif
12185#pragma GCC diagnostic pop
12187// BEGIN-MkRuntimeS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
12192 __parser__push__(prefix=Class, doc-group=Define, doc-index=Class);
12193
12194// Signature --------------------------------------------------------------
12197
12198 #define MkRuntimeC_SIGNATURE (MkObjectC_SIGNATURE ^ (10u<<10))
12199 #define MkRuntimeC_MASK (((1u<<22)-1)<<10)
12200
12202
12203// CompileTimeCast --------------------------------------------------------------
12206
12207 #define MkRuntimeC_X2rt(x) (x)
12208 #define MkRuntimeC_X2obj(x) MkOBJ(x)
12209
12211
12212// TypeDef --------------------------------------------------------------
12215
12217 __parser__(ignore) typedef struct MkRuntimeS MkRuntimeCR;
12219 __parser__(ignore) typedef const struct MkRuntimeS MkRuntimeCNR;
12221 #define MkRuntimeC_T (&MK_RT_REF._MkRuntimeC_T)
12223 #define MkRuntimeC_TT (MkTYP(MkRuntimeC_T))
12225 #define MkRuntimeST MkRuntimeC_T
12227 #define MkRuntimeSTT (MkTYP(MkRuntimeST))
12229 #define MkRuntimeC_type MK_RT
12231 #define MkRuntimeCT_X(instance) ( (struct MkTypeDefS *) (MkOBJ_R(instance).type) )
12233 #define MkRuntimeCTT_X(instance) (MkOBJ_R(instance).type)
12235 #define MkRuntimeCT_TT(typ) ( (struct MkTypeDefS *) (typ) )
12237 #define MkRuntimeC_NS MK
12239 #define MkRuntimeCTT MkRuntimeCTT
12241 #define MkRuntimeCT ( (struct MkTypeDefS *) MkRuntimeCTT )
12242
12244
12245// TypeCheck --------------------------------------------------------------
12248
12249 #pragma GCC diagnostic push
12250 #pragma GCC diagnostic ignored "-Wattributes"
12254 __parser__(class=MkRuntimeC,static,hide)
12256 mk_inline bool MkRtCheck (MK_MNGN mng) {
12257 return MkSanitizeCheck(MkRuntimeC,mng);
12258 }
12259
12262 __parser__(class=MkRuntimeC,static,hide)
12264 mk_inline bool MkRtCheckO (MK_OBJN obj) {
12265 return MkSanitizeCheckO(MkRuntimeC,obj);
12266 }
12267
12268 #pragma GCC diagnostic pop
12269 #define MkRuntimeC_Check(mng) MkRtCheck(mng)
12272
12273// RunTimeCast --------------------------------------------------------------
12276
12278 __parser__(class=MkRuntimeC,hide,static)
12279 META_ATTRIBUTE_SANITIZE
12281 mk_inline MK_RT MkRt(MK_MNG mng) {
12282 return (MkRtCheck(mng) ? (MK_RT)mng : NULL);
12284
12286 __parser__(class=MkRuntimeC,hide,static)
12287 META_ATTRIBUTE_SANITIZE
12289 mk_inline MK_RTN MkRtN(MK_MNGN mng) {
12290 return (MkRtCheck(mng) ? (MK_RTN)mng : NULL);
12291 }
12292
12294 #define MkRtRaise(_rt) if (!_MkCheckX(MkRuntimeC,_rt)) { \
12295 MkErrorSetC_1E("'MkRuntimeC' hdl is NULL"); \
12296 goto error ; \
12297 }
12298
12300
12303// MkRuntimeC_Class_Define_C_API
12304
12305// END-MkRuntimeS-Definition - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
12306
12308// MkRuntime_C_API
12309
12310// =========================================================================
12311// BEGIN-MkRuntimeS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
12312
12315
12318
12319__parser__push__(doc-group=_ignore_,doc-index=Class,doc-name=Export,class=MkRuntimeC);
12320
12336__parser__(class-overload=MkObjectHandleGet)
12338mk_inline MK_HDL MK_DECL MkRuntimeHandleGet_RT (
12340 MK_RT const rt __parser__(null-allowed)
12341) {
12342 return MkObjectHandleGet(rt?MkOBJ(rt):NULL);
12343}
12344
12353__parser__(flags=new)
12355mk_inline MK_RT MkRuntimeHandleResolve_RT (
12357 MK_HDL const netHdl
12358) {
12359 return MkRt(MkObjectHandleResolve(netHdl));
12360}
12361
12371#define MkRuntimeHandleResolve_e(netHdl) ({ \
12372 MK_HDL tmpHdl=netHdl; \
12373 MK_RT tmp; \
12374 if (tmpHdl==0) { \
12375 tmp=NULL; \
12376 } else { \
12377 tmp=MkRuntimeHandleResolve(tmpHdl); \
12378 if (tmp==NULL) { \
12379 MkErrorSetC_1_NULL("ERROR: 'MkRuntimeC' handle is 'NULL'"); \
12380 goto error; \
12381 }; \
12382 }; \
12383 tmp; \
12384})
12387
12389// Class export & import
12390
12394 __parser__(flags=new,doc-group=_ignore_,doc-index=Class,doc-name=Misc,class=MkRuntimeC,null-return-allow)
12396 mk_inline MK_RT MkRuntimeGetNull ( void ) {
12397 return (MK_RT)MK_NULL;
12398 }
12400// MkRuntimeC - Misc - function
12401
12403// MkRuntimeC_Class_C_API
12404
12405// END-MkRuntimeS-Export - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
12406
12409__parser__global__(MkRuntimeGetNull:hide);
12411// #######################################################################
12412// -----------------------------------------------------------------------
12416
12419
12420#define MkRT (&MkRuntimeRLS)
12421#define MkRT_R (MkRuntimeRLS)
12422
12423#if META_HAS_THREAD
12424 #define MkRT_O(o) ((o) && (*o).objRt ? (*o).objRt : MkRuntimeGet())
12425 #define MkRT_X(x) ((x) && MkOBJ_R(x).objRt ? MkOBJ_R(x).objRt : MkRuntimeGet())
12426 #define MkRT_ONN(o) ((*o).objRt)
12427 #define MkRT_ON(o) ( (*o).objRt ? (*o).objRt : MkRuntimeGet())
12428 #define MkRT_XN(x) ( MkOBJ_R(x).objRt ? MkOBJ_R(x).objRt : MkRuntimeGet())
12429#else
12430 #define MkRT_O(o) MkRT
12431 #define MkRT_X(x) MkRT
12432 #define MkRT_ONN(o) MkRT
12433 #define MkRT_ON(o) MkRT
12434 #define MkRT_XN(x) MkRT
12435#endif
12436
12437#if META_HAS_THREAD
12438 #define MkRtSetup_O(o) MK_RT_UNUSED MK_RT const mkrt = MkRT_O(o)
12439 #define MkRtSetup_X(x) MK_RT_UNUSED MK_RT const mkrt = MkRT_X(x)
12440 #define MkRtSetup_XN(x) MK_RT_UNUSED MK_RT const mkrt = MkRT_XN(x)
12441 #define MkRtSetup_ON(o) MK_RT_UNUSED MK_RT const mkrt = MkRT_ON(o)
12442 #define MkRtSetup_NULL MK_RT_UNUSED MK_RT const mkrt = MkRuntimeGet()
12443 #define MkRtSetup_RT(r) MK_RT_UNUSED MK_RT const mkrt = r
12444 #define MkRtSetupFromRtExt(rtx) MK_RT_UNUSED MK_RT const mkrt = MkRTEXT_R(rtx).mkrtHead
12445
12446// check "rt" on NULL if available as argument (MK_RT_ARGS).
12447 #define MkRtSetup_O_RT(o) if (mkrt == NULL) mkrt = MkRT_O(o)
12448 #define MkRtSetup_ON_RT(o) if (mkrt == NULL) mkrt = MkRT_ON(o)
12449 #define MkRtSetup_X_RT(x) if (mkrt == NULL) mkrt = MkRT_X(x)
12450 #define MkRtSetup_XN_RT(x) if (mkrt == NULL) mkrt = MkRT_XN(x)
12451 #define MkRtSetup_NULL_RT if (mkrt == NULL) mkrt = MkRuntimeGet()
12453 #define AllRtSetup_O(o) MkRtSetup_O(o)
12454 #define AllRtSetup_ON(o) MkRtSetup_ON(o)
12455 #define AllRtSetup_X(x) MkRtSetup_X(x)
12456 #define AllRtSetup_XN(x) MkRtSetup_XN(x)
12457 #define AllRtSetup_NULL MkRtSetup_NULL
12458#else
12459 #define MkRtSetup_O(o)
12460 #define MkRtSetup_X(x)
12461 #define MkRtSetup_XN(x)
12462 #define MkRtSetup_ON(o)
12463 #define MkRtSetup_NULL
12464 #define MkRtSetup_RT(r)
12466 #define MkRtSetup_O_RT(o)
12467 #define MkRtSetup_X_RT(x)
12468 #define MkRtSetup_XN_RT(x)
12469 #define MkRtSetup_ON_RT(o)
12470 #define MkRtSetup_NULL_RT
12472 #define AllRtSetup_O(o)
12473 #define AllRtSetup_ON(o)
12474 #define AllRtSetup_X(x)
12475 #define AllRtSetup_XN(x)
12476 #define AllRtSetup_NULL
12477#endif
12478
12480
12486typedef void ( MK_DECL *MkRuntimeInitF) ( MK_RT_ARGS_ONLY );
12487
12536__parser__(ignore)
12537typedef struct MkRuntimeCallbackS {
12538 MkRuntimeInitF cb ;
12539
12540 MK_RT setupRT ;
12541
12542 #define MkRuntimeCallbackS_ident_size 30
12543 MK_STRB ident[MkRuntimeCallbackS_ident_size+1];
12544
12545 // private
12546 size_t rtId_plus_1 ;
12547
12548 // CDL list
12549 struct MkRuntimeCallbackS *prev ;
12550 struct MkRuntimeCallbackS *next ;
12621__parser__(ignore)
12624 MkRuntimeCallbackS * cbdata,
12625 MkRuntimeInitF rt_callback,
12626 MK_STRN ident
12627);
12628
12631__parser__(ignore)
12634 MkRuntimeCallbackS * cbdata
12635);
12638// - MkRuntimeCallback
12639
12641__parser__(ignore)
12644
12651__parser__(ignore)
12653
12659__parser__(ignore)
12661
12663MK_ATTR_STATIC __parser__(hide,doc-group=Config)
12665{
12666 return __MkCheckX(MkRuntimeC,&MkRuntimeRLS) ? MkRT : MkRuntimeSetup( MkRT );
12667}
12668
12670MK_ATTR_STATIC __parser__(hide,doc-group=Config)
12671mk_inline MK_RT MkRuntimeGetFromObj (
12672 MK_OBJ obj __parser__(null-allowed)
12673) {
12674 return MkRT_O(obj);
12675}
12676
12678// - MkRuntimeC_Interface_C_API
12679
12680// #######################################################################
12681// -----------------------------------------------------------------------
12691
12692__parser__push__(doc-group=Config);
12693
12696mk_inline bool MkRuntimeIsSilentGet ( void ) {
12697 return MkRuntimeRLS.isSilent;
12698}
12699
12702mk_inline void MkRuntimeIsSilentSet_RT ( MK_PARSER_RT bool silent );
12703
12706mk_inline void MkRuntimeNoDecoSet_RT ( MK_PARSER_RT bool noDeco );
12707
12711 return MkRuntimeRLS.debug;
12712}
12713
12716mk_inline void MkRuntimeDebugSet ( MK_I32 dbg ) {
12717 MkRuntimeRLS.debug = dbg;
12718}
12719
12727
12733MK_EXTERN enum MkErrorE MK_DECL MkRuntimeLogTargetSet_RT (
12735 MK_STRN logTgt
12736) ;
12737
12742MK_EXTERN enum MkErrorE MK_DECL MkRuntimeLogTargetReset_RT (
12744) ;
12745
12747MK_EXTERN MkLogDataS MK_DECL MkRuntimeLogTargetPush_RT (
12749 MK_STRN logTgt
12750) ;
12751
12752#define MkRuntimeLogBufferPush() MkLogDataS saveLogTarget = MkRuntimeLogTargetPush_RT(MK_RT_CALL "BUFFER")
12753//#define MkRuntimeLogBufferPush()
12754
12756MK_EXTERN void MK_DECL MkRuntimeLogTargetPop_RT (
12758 MkLogDataS logOld
12759) ;
12760
12761#define MkRuntimeLogBufferPop() MkRuntimeLogTargetPop_RT(MK_RT_CALL saveLogTarget)
12762//#define MkRuntimeLogBufferPop()
12763
12765__parser__(hide)
12766MK_EXTERN void MK_DECL MkRuntimeSetCID (MK_OBJ const cid) MK_ATTR_STATIC ;
12767
12769MK_ATTR_RT_STATIC __parser__(error-ignore)
12770mk_inline enum MkErrorE MkRuntimeErrorGetCode_RT (
12772) {
12774 return MkERROR_RT.code;
12776
12778
12780// - MkRuntimeC_Config_C_API
12781
12782// #######################################################################
12783// -----------------------------------------------------------------------
12788
12789__parser__push__(doc-group=Info);
12790
12800__parser__(const)
12801MK_EXTERN void MK_DECL MkRuntimeLog0_RT (
12804 MK_DBG const debug __parser__(default=0),
12805 MK_STRN const callfunc __parser__(default=F#FUNC),
12806 MK_I32 const lvl __parser__(default=0)
12808
12810
12812// - MkRuntimeC_Config_C_API
12813
12814/* ####################################################################### */
12815/* ### ### */
12816/* ### P A C K A G E - A P I ### */
12817/* ### ### */
12818/* ####################################################################### */
12819
12875// #######################################################################
12876// -----------------------------------------------------------------------
13042#ifndef MK_EMBEDDED
13044 #define MK_EMBEDDED(type,call,...) ({ \
13045 type ret = (type) 0; \
13046 if (MkErrorCheckI(call (__VA_ARGS__,&ret))) goto error; \
13047 ret; \
13048 })
13049#endif
13050
13051#ifndef MK_EMBEDDED_REF
13053 #define MK_EMBEDDED_REF(type,call,...) ({ \
13054 type ret = {0}; \
13055 if (MkErrorCheckI(call (__VA_ARGS__,&ret))) goto error; \
13056 ret; \
13057 })
13058#endif
13059
13061// MkKernel_Overload_C_API
13062
13063/*****************************************************************************/
13064/* */
13065/* doc functions */
13066/* */
13067/*****************************************************************************/
13068
13069// -----------------------------------------------------------------------
13084
13085// -----------------------------------------------------------------------
13086// BEGIN-Class-Doc-Order - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
13087
13088// external
13094
13095// external
13101
13102// internal
13109
13110// external
13116
13117// internal
13124
13125// external
13131
13132// external
13138
13139// internal
13146
13147// external
13153
13154// internal
13161
13162// END-Class-Doc-Order - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
13163
13164/*****************************************************************************/
13165/* */
13166/* inline functions */
13167/* */
13168/*****************************************************************************/
13169
13170// BEGIN-Class-Introspection - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
13171
13176
13177__parser__push__(doc-name=Introspection,doc-index=Class,class=MkBufferListC,no-rpc,null-return-allow,flags=new);
13178
13182mk_inline MK_BFL MkBufferListInstances_RT( MK_PARSER_RT_ONLY ) {
13184 return (MK_BFL)MkTypeInstances(MkBufferListC_TT);
13185}
13186
13189mk_inline MK_BFL MkBufferListNext(MK_BFL const bfl) {
13190 MK_INSTANCE_HDL(bfl);
13191 return (MK_BFL)MkBufferListC_X2obj(bfl)->obj_protect.next;
13192}
13193
13197 MK_INSTANCE_HDL(bfl);
13198 return (MK_BFL)MkBufferListC_X2obj(bfl)->obj_protect.prev;
13199}
13200
13202
13205// MkBufferListC_Class_C_API
13206
13211
13212__parser__push__(doc-name=Introspection,doc-index=Class,class=MkBufferC,no-rpc,null-return-allow,flags=new);
13213
13217mk_inline MK_BUF MkBufferInstances_RT( MK_PARSER_RT_ONLY ) {
13219 return (MK_BUF)MkTypeInstances(MkBufferC_TT);
13220}
13221
13224mk_inline MK_BUF MkBufferNext(MK_BUF const buf) {
13225 MK_INSTANCE_HDL(buf);
13226 return (MK_BUF)MkBufferC_X2obj(buf)->obj_protect.next;
13227}
13228
13232 MK_INSTANCE_HDL(buf);
13233 return (MK_BUF)MkBufferC_X2obj(buf)->obj_protect.prev;
13234}
13235
13237
13240// MkBufferC_Class_C_API
13241
13246
13247__parser__push__(doc-name=Introspection,doc-index=Class,class=MkBufferStreamC,no-rpc,null-return-allow,flags=new);
13248
13252mk_inline MK_BUS MkBufferStreamInstances_RT( MK_PARSER_RT_ONLY ) {
13254 return (MK_BUS)MkTypeInstances(MkBufferStreamC_TT);
13255}
13256
13259mk_inline MK_BUS MkBufferStreamNext(MK_BUS const bus) {
13260 MK_INSTANCE_HDL(bus);
13261 return (MK_BUS)MkBufferStreamC_X2obj(bus)->obj_protect.next;
13262}
13263
13267 MK_INSTANCE_HDL(bus);
13268 return (MK_BUS)MkBufferStreamC_X2obj(bus)->obj_protect.prev;
13269}
13270
13272
13275// MkBufferStreamC_Class_C_API
13276
13281
13282__parser__push__(doc-name=Introspection,doc-index=Class,class=MkErrorC,no-rpc,null-return-allow,flags=new);
13283
13287mk_inline MK_ERR MkErrorInstances_RT( MK_PARSER_RT_ONLY ) {
13289 return (MK_ERR)MkTypeInstances(MkErrorC_TT);
13290}
13291
13294mk_inline MK_ERR MkErrorNext(MK_ERR const err) {
13295 MK_INSTANCE_HDL(err);
13296 return (MK_ERR)MkErrorC_X2obj(err)->obj_protect.next;
13297}
13298
13302 MK_INSTANCE_HDL(err);
13303 return (MK_ERR)MkErrorC_X2obj(err)->obj_protect.prev;
13304}
13305
13307
13310// MkErrorC_Class_C_API
13311
13316
13317__parser__push__(doc-name=Introspection,doc-index=Class,class=MkLogFileC,no-rpc,null-return-allow,flags=new);
13318
13322mk_inline MK_LFL MkLogFileInstances_RT( MK_PARSER_RT_ONLY ) {
13324 return (MK_LFL)MkTypeInstances(MkLogFileC_TT);
13325}
13326
13329mk_inline MK_LFL MkLogFileNext(MK_LFL const lfl) {
13330 MK_INSTANCE_HDL(lfl);
13331 return (MK_LFL)MkLogFileC_X2obj(lfl)->obj_protect.next;
13332}
13333
13337 MK_INSTANCE_HDL(lfl);
13338 return (MK_LFL)MkLogFileC_X2obj(lfl)->obj_protect.prev;
13339}
13340
13342
13345// MkLogFileC_Class_C_API
13346
13351
13352__parser__push__(doc-name=Introspection,doc-index=Class,class=MkObjectC,no-rpc,null-return-allow);
13353
13357mk_inline MK_OBJ MkObjectInstances_RT( MK_PARSER_RT_ONLY ) {
13359 return (MK_OBJ)MkTypeInstances(MkObjectC_TT);
13360}
13361
13364mk_inline MK_OBJ MkObjectNext(MK_OBJ const obj) {
13365 MK_INSTANCE_HDL(obj);
13366 return (MK_OBJ)MkObjectC_X2obj(obj)->obj_protect.next;
13367}
13368
13372 MK_INSTANCE_HDL(obj);
13373 return (MK_OBJ)MkObjectC_X2obj(obj)->obj_protect.prev;
13374}
13375
13377
13380// MkObjectC_Class_C_API
13381
13386
13387__parser__push__(doc-name=Introspection,doc-index=Class,class=MkRuntimeC,no-rpc,null-return-allow,flags=new);
13388
13392mk_inline MK_RT MkRuntimeInstances_RT( MK_PARSER_RT_ONLY ) {
13394 return (MK_RT)MkTypeInstances(MkRuntimeC_TT);
13395}
13396
13399mk_inline MK_RT MkRuntimeNext(MK_RT const rt) {
13400 MK_INSTANCE_HDL(rt);
13401 return (MK_RT)MkRuntimeC_X2obj(rt)->obj_protect.next;
13402}
13403
13407 MK_INSTANCE_HDL(rt);
13408 return (MK_RT)MkRuntimeC_X2obj(rt)->obj_protect.prev;
13409}
13410
13412
13415// MkRuntimeC_Class_C_API
13416
13417// END-Class-Introspection - created by 'c_Class.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
13418
13420__parser__global__(MkRuntimeNext:hide);
13421__parser__global__(MkRuntimePrev:hide);
13422
13425__parser__(internal)
13427 // TODO replace loop by hash
13428 MkTypeLoop(MkTypeC,typ) {
13429 if ((*typ).objsig == typeSIG) return MkTypeInstances(typ);
13430 }
13431 return NULL;
13432}
13433
13434/*
13435mk_inline MK_SIG MkObjectRpcHdlGet(MK_OBJ obj) {
13436 return (*obj).rpcHdl;
13437}
13438*/
13439
13440// =============================================================================================================
13441
13447 return &MkERROR;
13448}
13449
13452mk_inline MK_ERR MkErrorEXIT_RT ( MK_PARSER_RT_ONLY ) {
13455 return &MkERROR;
13456}
13457
13463 return &MkERROR;
13464}
13465
13471 return &MkERROR;
13472}
13473
13479 return &MkERROR;
13480}
13481
13486 MK_OBJ obj,
13487 MK_PTR *self_out,
13488 MK_PTR const env
13489) {
13490 assert(self_out != NULL);
13491
13492 if (obj == NULL) {
13493 *self_out = NULL;
13494 return MK_OK;
13495 }
13496 MkRtSetup_ON_RT(obj);
13497
13498 enum MkErrorE ret = MK_OK;
13499 MK_PTR self = MkSelfGet(obj);
13500 if (self != NULL) {
13501 if (MkRefGet(obj) <= 0) {
13502 MkErrorSetV_2M(obj, "RefCount Error: object '%s' has 'self' but 'refCout <= 0", obj->type->type_name);
13503 goto error;
13504 } else {
13505 ret = MK_CONTINUE;
13506 if (MK_RT_REF.MkSelfIncrOnCacheB && MK_RT_REF.fSelfIncr) (*MK_RT_REF.fSelfIncr)(MK_RT_CALL self, env);
13507 goto end;
13508 }
13509 }
13510 self = MkSelfCreate(obj, env);
13511 if (self == NULL) {
13512 MkErrorSetV_2M(obj, "Error: '%s->SelfCreate' return a NULL pointer", obj->type->type_name);
13513 goto error;
13514 }
13515end:
13516 *self_out = self;
13517 return ret;
13518error:
13519 *self_out = NULL;
13520 return MK_ERROR;
13521}
13522
13525
13537 MK_OBJ const obj
13538) {
13539 MK_INSTANCE_RT_O(obj);
13540 return MkErrorFORMAT_1O(obj);
13541}
13542
13543#define MkObjectToError_1X(obj) MkObjectToError(MkOBJ(obj))
13544
13546// MkObjectC_Misc_C_API
13547
13550
13552mk_inline MkBinaryR MkBinaryDup_RT ( MK_PARSER_RT const MkBinaryR bin ) {
13554 return MkBinaryCreate(bin.size,(MK_BIN)MkSysMemDup(MK_ERROR_PANIC,bin.data,(size_t)bin.size));
13555}
13556
13558mk_inline void MkBinaryLog_RT ( MK_PARSER_RT const MkBinaryR bin ) {
13560 MkLogV(MK_ERROR_FORMAT,__func__,0,"MkBinaryR: size=%li, data=%p\n", bin.size, bin.data);
13561}
13562
13564
13567
13569mk_inline MkStringR MkStringDup_RT ( MK_PARSER_RT MkStringR const str ) {
13571 return MkStringCreate(str.len,(MK_STRN)MkSysMemDup(MK_ERROR_PANIC,str.ptr,(size_t)str.len));
13573
13576mk_inline void MkStringLog_RT ( MK_PARSER_RT MkStringR const str, MK_STRN func ) {
13578 MkLogV(MK_ERROR_FORMAT,func,0,"MkStringR: len=%i -> %.*s\n", str.len, str.len, str.ptr);
13579}
13580
13582
13585mk_inline void MkRuntimeIsSilentSet_RT ( MK_PARSER_RT bool silent ) {
13587 MkDCheck(1) {
13589 MkLogC(MK_ERROR_FORMAT, "Attention: set 'silient'\n", 1, __func__);
13592 }
13593 MkRuntimeRLS.isSilent = silent;
13594};
13595
13598mk_inline void MkRuntimeNoDecoSet_RT ( MK_PARSER_RT bool noDeco ) {
13600 MkRuntimeRLS.noDeco = noDeco;
13601};
13602
13603// end c++ save definition
13605// END: BEGIN_MK_C_DECLS
13606
13607#endif // KERNEL_MK_H
13608
13609// vim:nowrap
#define MkLogDataS_LogNAME_size
append to logFILE, valid values are: stderr, stdout or a filename (default: stderr)
#define MkCacheS_MkCacheItemS_size
#define MkCacheS_name_size
#define META_TIMEOUT_REF
#define MkTypeS_name_size
#define MkRuntimeCallbackS_ident_size
#define MkBuffer1024S_ils_size
1024 bytes I)instance L)ocal S)torage - the memory that adds the final-class to the abstract-class.
#define MkBuffer256S_ils_size
256 bytes I)instance L)ocal S)torage - the memory that adds the final-class to the abstract-class.
#define MkBuffer64S_ils_size
64 bytes I)instance L)ocal S)torage - the memory that adds the final-class to the abstract-class.
enum MkErrorE MkString2U16_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_U16 *val_out)
enum MkErrorE MkString2LONG_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_LONG *val_out)
enum MkErrorE MkString2I64_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I64 *val_out)
enum MkErrorE MkString2DBL_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_DBL *val_out)
#define MkBufferS_ils_size
64 bytes I)instance L)ocal S)torage - the memory that adds the final-class to the abstract-class.
enum MkErrorE MkString2BOOL_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_BOOL *val_out)
enum MkErrorE MkString2BOL_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_BOL *val_out)
convert a string into a native
enum MkErrorE MkString2I16_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I16 *val_out)
enum MkErrorE MkString2I8_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I8 *val_out)
enum MkErrorE MkString2I32_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I32 *val_out)
enum MkErrorE MkString2FLT_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_FLT *val_out)
enum MkErrorE MkString2U32_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_U32 *val_out)
struct MkBufferS * MK_BUF
class-shortcut for struct MkBufferS *, all shortcut using the XX_YYY syntax (only for public API) …
static MK_BUF MkBufferGetNull(void)
Null-Slot - return a MkBufferC typed NULL instance …
static MK_HDL MkBufferHandleGet_RT(MK_RT mkrt, MK_BUF const buf)
Handle-Get-Slot - returns a export-hdl to the MkBufferC useable for external storage
static MK_BUF MkBufferPrev(MK_BUF const buf)
get previous instance from linked-list of MkBufferS type
static MK_BUF MkBufferNext(MK_BUF const buf)
get next instance from linked-list of MkBufferS type
static MK_BUF MkBuf(MK_MNG mng)
cast a unknown-object into an MkBufferS pointer or NULL if not possible
#define MkBufferC_X2obj(x)
static bool MkBufCheckO(MK_OBJN obj)
check MkBufferS -> libmkkernel::MkObjectS::signature …
static bool MkBufCheck(MK_MNGN mng)
check MkBufferS -> libmkkernel::MkObjectS::signature …
#define MkBufferC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …
void MkBufferLogS_RT(MK_RT mkrt, MK_BUFN const buf, MK_STRN const varname, MK_OBJN fmtobj, MK_STRN const callfunc)
log the short MkBufferC object data to the MkLogFileC (default: stderr) …
MK_I32 MkBufferCmp_RT(MK_RT mkrt, MK_BUFN const buf1, MK_BUFN const buf2)
compare TWO MkBufferC objects like strcmp do it for strings …
MK_STRN MkBufferToString_RT(MK_RT mkrt, MK_BUFN const inst)
String-Slot - returns the string representation of the inst …
enum MkErrorE MkBufferCastTo_RT(MK_RT mkrt, MK_BUF const buf, enum MkTypeE const typ)
change the type of an MkBufferC to type …
MK_BUF MkBufferSizeAdd_RT(MK_RT mkrt, MK_BUF const buf, MK_NUM const size)
add size storage to the buf …
void MkBufferResetFull_RT(MK_RT mkrt, MK_BUF const buf)
reset a MkBufferC to the length zero and free allocated storage…
MK_BUF MkBufferReset_RT(MK_RT mkrt, MK_BUF const buf)
reset a MkBufferC to the length zero …
MK_BUF MkBufferSizeNew_RT(MK_RT mkrt, MK_BUF const buf, MK_NUM const size)
alloc min size storage to the buf …
#define MkBufferCreateLOCAL_T(cls, name, size)
create an new MkBufferC object as L)ocal S)torage…
#define MkBufferCreateTLS_inout_T(cls, name, inout)
Constructs a MkBufferC instance as T)hread L)ocal S)torage OR reuse inout if possible…
#define MkBufferCreateTLS_T(cls, name, size)
create an new MkBufferC object as T)hread L)ocal S)torage…
struct MkBufferListS * MK_BFL
class-shortcut for struct MkBufferListS *, all shortcut using the XX_YYY syntax (only for public API)...
static MK_BFL MkBufferListPrev(MK_BFL const bfl)
get previous instance from linked-list of MkBufferListS type
static MK_BFL MkBufferListNext(MK_BFL const bfl)
get next instance from linked-list of MkBufferListS type
#define MkBufferListC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …
#define MkBufferListC_X2obj(x)
#define MkBufferStream1024_ils_size
1024 bytes I)instance L)ocal S)torage - the memory that adds the final-class to the abstract-class.
#define MkBufferStream16384S_ils_size
16384 bytes I)instance L)ocal S)torage - the memory that adds the final-class to the abstract-class.
#define MkBufferStream256S_ils_size
256 bytes I)instance L)ocal S)torage - the memory that adds the final-class to the abstract-class.
#define MkBufferStream64_ils_size
64 bytes I)instance L)ocal S)torage - the memory that adds the final-class to the abstract-class.
#define MkBufferStreamS_ils_size
64 bytes I)instance L)ocal S)torage - the memory that adds the final-class to the abstract-class.
static MK_HDL MkBufferStreamHandleGet_RT(MK_RT mkrt, MK_BUS const bus)
Handle-Get-Slot - returns a export-hdl to the MkBufferStreamC useable for external storage
static MK_BUS MkBufferStreamPrev(MK_BUS const bus)
get previous instance from linked-list of MkBufferStreamS type
struct MkBufferStreamS * MK_BUS
class-shortcut for struct MkBufferStreamS *, all shortcut using the XX_YYY syntax (only for public AP...
static MK_BUS MkBufferStreamNext(MK_BUS const bus)
get next instance from linked-list of MkBufferStreamS type
static MK_BUS MkBufferStreamGetNull(void)
Null-Slot - return a MkBufferStreamC typed NULL instance …
static MK_BUS MkBus(MK_MNG mng)
cast a unknown-object into an MkBufferStreamS pointer or NULL if not possible
#define MkBufferStreamC_X2obj(x)
static bool MkBusCheck(MK_MNGN mng)
check MkBufferStreamS -> libmkkernel::MkObjectS::signature …
#define MkBufferStreamC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …
static bool MkBusCheckO(MK_OBJN obj)
check MkBufferStreamS -> libmkkernel::MkObjectS::signature …
void MkBufferStreamPosToStart_RT(MK_RT mkrt, MK_BUS const bus)
set the current-access-position to the start of MkBufferStreamC …
#define MkBufferStreamCreateSTATIC_T(cls, name)
Constructs a MkBufferStreamC instance as S)tatic S)torage …
#define MkBufferStreamCreateTLS_T(cls, name)
Constructs a MkBufferStreamC instance as T)hread L)ocal S)torage …
#define MkBufferStreamCreateLOCAL_T(cls, name, size)
Constructs a MkBufferStreamC instance as L)ocal S)torage …
bool(* MkErrorSetVLF)(MK_ERREXT_ARGS, MK_OBJN const fmtobj, MK_STRN const)
void(* MkErrorPanikF)(MK_ERREXT_ARGS_N, MK_OBJN const errobj, MK_STRN const prefix, MK_I32 const errnum, MK_STRN const fmt, va_list ap)
MK_OBJN const errobj because of MK_ERROR_FORMAT value.
void(* MkErrorResetF)(MK_ERREXT_ARGS, MK_OBJN const fmtobj)
bool(* MkErrorAppendFLT)(MK_ERREXT_ARGS, MK_OBJN const fmtobj)
void(* MkErrorSetRF)(MK_ERREXT_ARGS, MK_MNGN const errctx, MK_OBJN const fmtobj)
#define MK_ERREXT_ARGS
MK_OBJN(* MkErrorFormatOfF)(MK_ERREXT_ARGS_N, int const dummy)
void(* MkErrorSetEF)(MK_ERREXT_ARGS, MK_ERREXT const newerr, MK_OBJN const fmtobj)
void(* MkErrorLogF)(MK_ERREXT_ARGS_N, MK_OBJN const, MK_DBG const, MK_STRN const, MK_I32 const, MK_STRN const, MK_OBJ const)
void(* MkErrorInit)(MK_ERREXT_ARGS, MK_OBJN const fmtobj)
bool(* MkErrorResetOnExitF)(MK_ERREXT_ARGS, MK_OBJN const fmtobj)
#define MK_ERREXT_ARGS_N
const struct MkErrExtS * MK_ERREXTN
class-shortcut for const struct MkErrExtS *, all const shortcut using the XX_YYYC syntax (only for pu...
static bool MkErrExtCheckO(MK_OBJN obj)
check MkErrExtS -> libmkkernel::MkObjectS::signature …
static bool MkErrExtCheck(MK_MNGN mng)
check MkErrExtS -> libmkkernel::MkObjectS::signature …
static MK_ERR MkErrorNext(MK_ERR const err)
get next instance from linked-list of MkErrorS type
struct MkErrorS * MK_ERR
class-shortcut for struct MkErrorS *, all shortcut using the XX_YYY syntax (only for public API) …
static MK_ERR MkErrorPrev(MK_ERR const err)
get previous instance from linked-list of MkErrorS type
#define MkErrorC_X2obj(x)
static bool MkErrCheckO(MK_OBJN obj)
check MkErrorS -> libmkkernel::MkObjectS::signature …
static MK_ERR MkErr(MK_MNG mng)
cast a unknown-object into an MkErrorS pointer or NULL if not possible
#define MkErrorC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …
static bool MkErrCheck(MK_MNGN mng)
check MkErrorS -> libmkkernel::MkObjectS::signature …
enum MkErrorE MkErrorGetCode(MK_ERRN const err)
get the value of MkErrorS::code …
#define MkErrorGetSizeI(e)
get the error-message-size from the exception-object …
#define MkErrorGetCodeI(e)
get the value of MkErrorS::code …
MK_STRN MkErrorGetText(MK_ERRN const err)
get the MkErrorS::text …
#define MkErrorGetTextI(e)
get the MkErrorS::text …
#define MkErrorGetNumI(e)
get the MkErrorS::num. The number can be used as exit-code …
MK_I32 MkErrorGetNum(MK_ERRN const err)
get the MkErrorS::num. The number can be used as exit-code …
enum MkErrorE MkErrorReset_RT(MK_RT mkrt, MK_ERR const err, MK_STRN const callfunc, MK_I32 const callline, bool const force)
This function clears the err and resets to libmkkernel::MK_OK …
void MkErrorPrintln_RT(MK_RT mkrt, MK_ERR const err, MK_STRN const msg, MK_STRN const callfunc, MK_I32 const callline)
print the default-error to the MkLogFileC (default: stderr) and clear the error afterwards …
void MkErrorLog_RT(MK_RT mkrt, MK_ERRN const err, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
log the error to MkLogFileC (default: stderr) …
void MkPanicC_RT(MK_RT mkrt, MK_OBJN fmtobj, MK_STRN const callfunc, MK_I32 const errnum, MK_STRN const message)
do a panic with string as argument …
enum MkErrorE MkErrorSetV_RT(MK_RT mkrt, MK_ERR err, MK_STRN const callfunc, MK_I32 const errnum, MK_FST const printfmt,...)
set the MkErrorS object using a format string argument list and raise an error …
void MkDisasterSignal(MK_I32 signal)
called if something get REALLY wrong …
enum MkErrorE MkErrorSetE_RT(MK_RT mkrt, MK_ERR const err, MK_ERR const newerr)
set the MkErrorC from a MkErrorC copy and raise an error …
enum MkErrorE MkErrorSetVL_RT(MK_RT mkrt, MK_ERR err, MK_STRN const callfunc, MK_I32 const errnum, MK_FST const printfmt, va_list var_list)
'set' and 'raise' the MkErrorC using a vararg-list message …
#define MkErrorSetV_2M(err, printfmt,...)
enum MkErrorE MkErrorSetC_RT(MK_RT mkrt, MK_ERR err, MK_STRN const message, MK_STRN const callfunc, MK_I32 const errnum)
'set' and 'raise' the MkErrorC using a string-message and a errnum-number …
bool MkErrorIsSOCKET(MK_ERRN const err)
check on SOCKET-DOWN error …
void MkErrorSetCode_RT(MK_RT mkrt, MK_ERR const err, enum MkErrorE code)
set the MkErrorS::code value …
enum MkErrorE MkErrorSetABORT_RT(MK_RT mkrt, MK_ERR const err, MK_STRN const detail, MK_STRN const callfunc)
send the ABORT signal to the calling stack…
bool MkErrorIsABORT(MK_ERRN const err)
check on ABORT signal …
#define MkERROR
#define MK_ERROR_PRINT
static MK_ERR MkErrorPRINT_RT(MK_RT mkrt)
ignore-system-error - print the next error into MkLogFileC …
#define MK_ERROR_DEFAULT
#define MK_ERROR_EXIT
static MK_ERR MkErrorIGNORE_RT(MK_RT mkrt)
ignore-system-error - ignore the next error …
#define MkErrorFORMAT_1O(o)
#define MkERROR_RT
#define MK_ERROR_PANIC
static MK_ERR MkErrorPANIC_RT(MK_RT mkrt)
panic-system-error - panic on next error …
#define MK_ERROR_IGNORE
#define MK_ERROR_FORMAT
static MK_ERR MkErrorDEFAULT_RT(MK_RT mkrt)
default-system-error - default-error …
void MkErrorCopy_RT(MK_RT mkrt, MK_ERR dest, MK_ERRN const srce)
Copy-Constructor - sync an existing MkErrorC instance with the values from an existing MkErrorC insta...
struct MkErrorExitS MkErrorExitCR
instance-struct-reference same as struct MkErrorExitS, useable in a class-macro as: class##R …
const struct MkErrorExitS MkErrorExitCNR
const instance-struct-reference same as const struct MkErrorExitS, useable in a class-macro as: class...
const struct MkErrorIgnoreS MkErrorIgnoreCNR
const instance-struct-reference same as const struct MkErrorIgnoreS, useable in a class-macro as: cla...
struct MkErrorIgnoreS MkErrorIgnoreCR
instance-struct-reference same as struct MkErrorIgnoreS, useable in a class-macro as: class##R …
const struct MkErrorPanicS MkErrorPanicCNR
const instance-struct-reference same as const struct MkErrorPanicS, useable in a class-macro as: clas...
struct MkErrorPanicS MkErrorPanicCR
instance-struct-reference same as struct MkErrorPanicS, useable in a class-macro as: class##R …
const struct MkErrorPrintS MkErrorPrintCNR
const instance-struct-reference same as const struct MkErrorPrintS, useable in a class-macro as: clas...
struct MkErrorPrintS MkErrorPrintCR
instance-struct-reference same as struct MkErrorPrintS, useable in a class-macro as: class##R …
struct libmkkernel::MkExtensionS MkExtensionS
Base class for the extension technologie …
#define MkExtension_size
maximum number of runtime-extensions useable in a theKernel software.
const struct MkExtensionS * MK_EXTN
class-shortcut for const struct MkExtensionS *, all const shortcut using the XX_YYYC syntax (only for...
static bool MkExtCheck(MK_MNGN mng)
check MkExtensionS -> libmkkernel::MkObjectS::signature …
static bool MkExtCheckO(MK_OBJN obj)
check MkExtensionS -> libmkkernel::MkObjectS::signature …
static MkBinaryR MkBinaryCreate(MK_SIZE size, MK_BINN data)
create a binary from data and size ...
static const MkBinaryR MkBinaryCreateSlice(const MkBinaryR bin, MK_SIZE start, MK_SIZE wide)
create a binary slice ...
static bool MkBinaryIsNull(const MkBinaryR bin)
check if binary is NULL ...
static MkBinaryR MkBinaryDup_RT(MK_RT mkrt, const MkBinaryR bin)
create a binary as duplicate from an already existsing MkBinaryR ...
static MK_SIZE MkBinaryGetSize(const MkBinaryR bin)
get size from the binary ...
static MK_BINN MkBinaryGetData(const MkBinaryR bin)
get data pointer from the binary ...
MK_PTR(* MkCacheCF)(MK_RT mkrt, MK_PTR const)
void(* MkCacheDF)(MK_RT mkrt, MK_PTR *const)
#define BEGIN_MK_C_DECLS
#define MK_NULL_STR
the string "MK_NULL" value as MK_NULL_STR …
#define MK_PARSER_fmtobj
use param_fmtobj for documentation
#define MK_NO_RETURN
dosable "MK_NO_RETURN" because C# require "return" from "MqExit" for thread-pool support
#define MK_DECL
#define mk_inline
#define MK_EXTERN_DATA
#define MK_EXTERN
static library
#define END_MK_C_DECLS
#define mk_timeval
#define MK_ATTR_HOT
#define MK_UNUSED
mark unnused variables and functions
#define mk_timezone
#define MK_NULL
The Programming-Language-Micro-Kernel (PLMK) NULL value as MK_NULL in C++ …
void * MK_MACRO_TYP
helper-type used to declare a prototype for a macro
#define MK_NULL_STR_LEN
the integer strlen("MK_NULL") value as MK_NULL_STR_LEN …
#define MK_TYPE_IS_1_I8E
the type is native and has a size of 1 byte …
MkTypeE
basic data-types supported by Programming-Language-Micro-Kernel (PLMK) …
MkTimeoutE
Predefined Timeout values …
#define MK_TYPE_IS_2_I8E
the type is native and has a size of 2 bytes …
MkNativeIsE
define if data is string or little or big endian …
#define MK_TYPE_SHIFT
FIXED: type is only 8bit -> 4 bit=15 for type and 4 bit for flag …
MkBoolE
the internal boolean …
#define MK_TYPE_IS_8_I8E
the type is native and has a size of 8 bytes …
MkErrorE
collection for the different error-codes …
#define MK_TYPE_IS_4_I8E
the type is native and has a size of 4 bytes …
@ MK_I8T
Y: 1 byte 'byte' type.
@ MK_I16T
S: 2 byte 'short' type.
@ MK_FLTT
F: 4 byte 'float' type.
@ MK_DBLT
D: 8 byte 'double' type.
@ MK_STRT
C: X byte 'string' type (e.g. with a \0 at the end)
@ MK_TIMEOUT_NORMAL
normal timeout in sec (90 sec) …
@ MK_TIMEOUT_DEFAULT
request the default timeout value …
@ MK_TIMEOUT_SOCKET
shorter timeout in sec (10 sec) … This TIMEOUT is used for socket connection with 'connect'
@ MK_TIMEOUT_SHORT
short timeout in sec (20 sec) …
@ MK_TIMEOUT_INIT
maximum timeout in sec (900 sec) …
@ MK_TIMEOUT_VERYSHORT
very short timeout in sec (5 sec) …
@ MK_TIMEOUT_MAX
request the maximum possible (infinite) timeout value …
@ MK_TIMEOUT_USER
request the user defined timeout value from the –timeout configuration value …
@ MK_TIMEOUT_LONG
long timeout in sec (180 sec) …
@ MK_NATIVE_IS_LITTLE
L = using if the binary protocoll, data in little-edian.
@ MK_NATIVE_IS_BIG
B = using if the binary protocoll, data in big-endian.
@ MK_NATIVE_IS_INITIAL
0 = initial value
@ MK_NATIVE_IS_STRING
S = using of the string protocol.
@ MK_YES
boolean YES
@ MK_NO
boolean NO
@ MK_CONTINUE
(transient) raise an continue-event, the calling-function must handle this.
@ MK_OK
(persistent) everything is OK.
@ MK_ERROR
(persistent) raise an error-event, the calling-fucntion is interrupted.
#define __parser__global__(...)
parser: apply an attribute to a dunction in global scope …
#define __parser__pop__
parser: stop apply a list of local attributes to a block of code …
#define __parser__push__(...)
parser: start apply a list of local attributes to a block of code …
#define __parser__(...)
parser: apply an attribute to an object in local scope …
static MkStringR MkStringCreate(MK_NUM len, MK_STRN str)
create a str from ptr and len ...
static bool MkStringIsNULL(MkStringR const strR)
check if strR is MK_NULL_STR return true or false …
static MK_NUM MkStringGetSize(MkStringR const str)
get len from the string ...
static MkStringR MkStringDup_RT(MK_RT mkrt, MkStringR const str)
create a string as duplicate from an already existsing MkBinaryR ...
static MkStringR MkStringCreate_1(MK_STRN str)
create a str from ptr use MK_NULL as end-of-string ...
static MK_STRN MkStringGetData(MkStringR const str)
get ptr pointer from the string ...
static void MkStringLog_RT(MK_RT mkrt, MkStringR const str, MK_STRN func)
log the string ...
static MkStringR MkStringSlice(MkStringR strR, MK_NUM start, MK_NUM len)
create a slice of strR start at start with max len bytes …
static void MkStringSplit(MkStringR strR, MK_NUM *len_out, MK_STRN *str_out)
split a str into ptr and len …
const MK_PTRB * MK_PTRN
const generic pointer data-type
unsigned long long MK_U64
double MK_DBL
8 byte double data-type
unsigned char MK_U8
MK_PTRB * MK_MNG
managed object pointer, datatype will be checked at runtime
unsigned char MK_LSTB
list type data-type
unsigned char MK_BINB
byte-array type data-type
unsigned char MK_BOL
1 byte boolean data-type
signed char MK_I8
1 byte byte data-type
MK_PTRB * MK_CBP
generic pointer to call-back data
unsigned long MK_ULN
float MK_FLT
4 byte float data-type
signed long long MK_I64
8 byte wide integer data-type
MK_PTRB * MK_MXP
MkExceptionC object pointer.
MK_BINB const * MK_BINN
const byte-array pointer data-type
long MK_LONG
4/8 byte long data-type
MK_BINB * MK_BIN
byte-array pointer data-type with binary encoding (MK_BINN)
MK_LSTB * MK_LST
list pointer data-type
MK_STRB const * MK_FST
const format string pointer data-type
bool MK_BOOL
real bool data-type
int32_t MK_HDL
4 byte int handle data-type
MK_PTRB * MK_CCP
class constructor/destructor data type
int32_t MK_NUM
array size data-type ('num' items in array …
char MK_STRB
string type data-type
signed short int MK_I16
2 byte short data-type
int MK_DBG
debug-level data-type …
unsigned int MK_U32
signed int MK_I32
4 byte integer data-type
MK_STRB * MK_STR
string pointer data-type with UTF8 ecoding (MK_STR)
unsigned int MK_SIG
signature datatype
MK_PTRB * MK_PTR
generic pointer data-type
unsigned short MK_U16
const MK_PTRB * MK_MNGN
const - a managed object pointer, datatype will be checked at runtime
MK_PTRB const * MK_EXP
exception object pointer
const MK_STRB * MK_STRN
constant string pointer data-type
void MK_PTRB
pointer type data-type
struct MkLogFileS * MK_LFL
class-shortcut for struct MkLogFileS *, all shortcut using the XX_YYY syntax (only for public API) …
static MK_LFL MkLogFilePrev(MK_LFL const lfl)
get previous instance from linked-list of MkLogFileS type
static MK_LFL MkLogFileNext(MK_LFL const lfl)
get next instance from linked-list of MkLogFileS type
const struct MkLogFileS * MK_LFLN
class-shortcut for const struct MkLogFileS *, all const shortcut using the XX_YYYC syntax (only for p...
static bool MkLflCheckO(MK_OBJN obj)
check MkLogFileS -> libmkkernel::MkObjectS::signature …
#define MkLogFileC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …
#define MkLogFileC_X2obj(x)
static MK_LFL MkLfl(MK_MNG mng)
cast a unknown-object into an MkLogFileS pointer or NULL if not possible
static bool MkLflCheck(MK_MNGN mng)
check MkLogFileS -> libmkkernel::MkObjectS::signature …
enum MkErrorE MkLogFileOpen_RT(MK_RT mkrt, MK_OBJN fmtobj, MK_STRN const file, MK_LFL *lfh_out)
open the log-file in append mode …
void MkLogFileClose_RT(MK_RT mkrt, MK_LFL lfh)
Destructor - delete a MkLogFileC instance …
enum MkErrorE MkLogFileWriteVL_RT(MK_RT mkrt, MK_LFLN lfl, MK_FST printfmt, va_list var_list)
write to log-file …
enum MkErrorE MkLogFileWriteV_RT(MK_RT mkrt, MK_LFLN lfl, MK_FST printfmt,...)
write to log-file …
void(* MkLogF)(MK_RT mkrt, MK_OBJN const obj, MK_OBJN fmt, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
MK_STRN(* MkToStringF)(MK_RT mkrt, MK_OBJN const obj)
MK_OBJ(* MkResetF)(MK_RT mkrt, MK_OBJ const obj)
void(* MkDestructorF)(MK_RT mkrt, MK_OBJ const obj)
MK_PTR(* MkAllocCreateFLT)(MK_RT mkrt, MK_TYP const type)
void(* MkSelfDeleteF)(MK_RT mkrt, MK_PTR self, MK_PTR const env)
#define __MkCheckX(cls, x)
MK_OBJ(* MkCopyF)(MK_RT mkrt, MK_OBJ const obj, MK_OBJN const src)
void(* MkSelfUnlinkF)(MK_RT mkrt, MK_PTR self, MK_PTR const env)
void(* MkTypeInitF)(MK_RT mkrt, MK_TYP const type)
MK_OBJ(* MkDup2F)(MK_RT mkrt, MK_OBJN const obj, MK_STRN const ident)
#define MkSanitizeCheck(_root, _m)
MK_PTR(* MkSelfCreateF)(MK_RT mkrt, MK_OBJ const obj, MK_PTR const env)
bool(* MkLogFormatF)(MK_RT mkrt, char *header, MK_SIZE const headerSize, MK_OBJN const obj, MK_STRN const caller, MK_I32 const debug, MK_STRN const fmt)
MK_OBJ(* MkMergeF)(MK_RT mkrt, MK_OBJ const obj)
#define MkDbgDeepWriter(...)
void(* MkAllocDeleteF)(MK_RT mkrt, MK_TYP const type, MK_PTR ptr)
MK_OBJ(* MkDupF)(MK_RT mkrt, MK_OBJN const obj)
MK_OBJ(* MkConstructorF)(MK_RT mkrt, MK_TYP type, MK_PTR nat, MK_PTR lnk)
#define MkSanitizeCheckO(_root, _o)
MK_OBJ MkObjectHandleResolve_RT(MK_RT mkrt, MK_HDL const netHdl)
Handle-Resolve-Slot - return a MkObjectC from netHdl or MK_NULL if invalid…
static MK_OBJ MkObjectPrev(MK_OBJ const obj)
get previous instance from linked-list of MkObjectS type
bool MkObjectHandleExists(MK_OBJ const obj)
check if obj has already a handle defined…
#define MkObjectHandleResolve(...)
#define MkObjectHandleGet(...)
const struct MkObjectS * MK_OBJN
class-shortcut for const struct MkObjectS *, all const shortcut using the XX_YYYC syntax (only for pu...
static MK_HDL MkObjectHandleGetOfType(MK_OBJ const obj)
Export-Slot - returns typeHdl of the obj .
void MkObjectHandleDeleteByNetHdl_RT(MK_RT mkrt, MK_HDL const netHdl)
Handle-Delete-Slot - delete a netHdl from handle-storage …
static MK_OBJ MkObjectGetNull(void)
Null-Slot - return a MkObjectC typed NULL instance …
MK_HDL MkObjectHandleGetOr0(MK_OBJ const obj)
return export-hdl or 0 in not created…
void MkObjectHandleDelete_RT(MK_RT mkrt, MK_OBJ const netObj)
Handle-Delete-Slot - delete a netObj from handle-storage …
static MK_OBJ MkObjectNext(MK_OBJ const obj)
get next instance from linked-list of MkObjectS type
MK_HDL MkObjectHandleGet_RT(MK_RT mkrt, MK_OBJ const obj)
Handle-Get-Slot - returns a export-hdl to the MkObjectC useable for external storage
struct MkObjectS * MK_OBJ
class-shortcut for struct MkObjectS *, all shortcut using the XX_YYY syntax (only for public API) …
#define MkObjectC_X2obj(x)
static bool MkObjCheck(MK_MNGN mng)
check MkObjectS -> libmkkernel::MkObjectS::signature …
#define MkOBJ(x)
cast a known-object into an MkObjectS pointer
static bool MkObjCheckO(MK_OBJN obj)
check MkObjectS -> libmkkernel::MkObjectS::signature …
#define MkObjectC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …
void MkDbgM_RT(MK_RT mkrt, MK_STRN const message, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
debug: write a static-marker to the MkLogFileC (default: stderr) …
#define MkDCheck(_debug)
#define MkObjectLog(...)
void MkLogHEX_RT(MK_RT mkrt, MK_OBJN fmtobj, MK_STRN const callfunc, MkBinaryR const data)
log binaray data as HEX into the MkLogFileC (default: stderr) …
void MkLogVL_RT(MK_RT mkrt, MK_OBJN fmtobj, MK_STRN const callfunc, MK_DBG debug, MK_FST const printfmt, va_list var_list)
write a vprintf style logging-message to MkLogFileC using the internal format …
void MkObjectLog_RT(MK_RT mkrt, MK_OBJN const obj, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
Log-Slot - log a summary of an object to the MkLogFileC (default: stderr) target …
void MkLogV_RT(MK_RT mkrt, MK_OBJN fmtobj, MK_STRN const callfunc, MK_DBG debug, MK_FST const printfmt,...)
write a printf style logging-message to MkLogFileC (default: stderr) using the internal format …
#define MkLogC(...)
#define MkLogV(...)
static bool MkObjectIsNull(MK_OBJ const obj)
ckeck if the object is MK_NULL
MK_STRN MkObjectToString_RT(MK_RT mkrt, MK_OBJN const inst)
String-Slot - returns the string representation of the inst …
static MK_ERR MkObjectToError_RT(MK_RT mkrt, MK_OBJ const obj)
Error-Slot - return an error-object pre initialized with obj data.
#define MkObjectToString(...)
MK_STRN MkObjectToNameOfType_RT(MK_RT mkrt, MK_OBJN const obj)
Type-Slot - returns the LibMkKernel-Type-Name of the obj as a string
static MK_PTR MkSelfGet(MK_OBJ const obj)
get the MkObjectS::self value
void(* MkSelfIncrF)(MK_RT mkrt, MK_PTR self, MK_PTR const env)
static void MkSelfSet(MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
set the MkObjectS::self value
#define MkSelfCreate(...)
void(* MkSelfDecrF)(MK_RT mkrt, MK_PTR self, MK_PTR const env)
static void MkRefIncrSelf(MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
ATOMIC operation -> link self with reference-count.
MK_NUM MkRefCidN_RT(MK_RT mkrt)
return the reference-count-recursion-level
static MK_I32 MkRefGet(MK_OBJ const obj)
get the reference-count
#define MkRefLOCK
unchangeable reference
MK_PTR MkSelfCreate_RT(MK_RT mkrt, MK_OBJ const obj, MK_PTR const env)
create the MkObjectS::self value
static bool MkRefIsLocked(MK_OBJ const obj)
check if object is locked
static bool MkSelfExists(MK_OBJN obj)
Check if the MkObjectS::self exists …
static MK_I32 MkRefLock(MK_OBJ const obj)
lock the object
MK_OBJ MkRefDecrWithUnlinkSelf_RT(MK_RT mkrt, MK_OBJ const obj)
ATOMIC operation -> unlink self from META und decr-ref-count in META.
MK_OBJ MkRefDecrWithoutSelf_RT(MK_RT mkrt, MK_OBJ const obj)
ATOMIC operation -> unlink self with reference-count.
static MK_ATTR_HOT enum MkErrorE MkSelfNew_RT(MK_RT mkrt, MK_OBJ obj, MK_PTR *self_out, MK_PTR const env)
return the self pointer for a given obj …
void MkSysFreeP(MK_PTR data)
free syscall with ccmkkernel error plugin
static enum MkErrorE MkSysSleep(MK_OBJN fmtobj, MK_I32 const sec)
sleep syscall with ccmkkernel error plugin
static int MkSysExit_RT(MK_RT mkrt, int isThread, int num)
exit syscall with ccmkkernel error plugin
MK_PTR(* MkSysCallocF)(size_t, size_t)
calloc syscall …
MK_PTR(* MkSysMallocF)(size_t)
malloc syscall …
#define MkSysPrintStackTrace_2(fmtobj, debug)
#define MkSysStringIsLenEQUAL(_str, _other, _len)
MK_STR(* MkSysStrNCpyF)(char *, const char *, size_t)
strdup strncpy …
MkIdSE
signal type of the MkIdS data val …
static MK_STRN MkSysStringGetNoNULL(MK_STRN str)
get string "" or VALUE …
MK_STR MkSysBasename_RT(MK_RT mkrt, MK_STRN const pathName, bool const includeExtension)
basename syscall with ccmkkernel error plugin
enum MkErrorE(* MkSysWaitF)(MK_OBJN const fmtobj, MK_IDNT const id)
wait for process to finish syscall with ccmkkernel error plugin
MK_STR MkSysDirname_RT(MK_RT mkrt, MK_STRN const pathName)
dirname syscall with ccmkkernel error plugin
uintptr_t MK_IDNT
process or thread identifier …
int(* MkSysExitF)(MK_RT mkrt, int isThread, int num)
static bool MkSysStringIsNULL(MK_STRN str)
test if string is NULL or EMPTY …
MK_STRN MkSysGetTrace_RT(MK_RT mkrt, MK_OBJN fmtobj, MK_I32 const debug, MK_STRN const callfunc, MK_I32 const lvl, MK_I32 skip, MK_I32 const num)
same as MkSysPrintStackTrace but return a string…
#define MkSysFree(pointer)
pid_t(* MkSysForkF)(void)
fork syscall …
#define MkSysStringSetNULL_R(_str)
MK_STR(* MkSysStrNDupF)(MK_STRN, size_t)
strndup syscall …
MK_STR(* MkSysStrDupF)(MK_STRN)
strdup syscall …
struct MkLalS MkLal
Language Abstraction Layer in duty.
#define MkSysStringIsNULL_R(_str)
#define MkSysStringSet_R(_str, _val)
#define MkSysStringIsEQUAL(_str, _other)
void MkSysPrintStackTrace_RT(MK_RT mkrt, MK_OBJN fmtobj, MK_I32 const debug, MK_STRN const callfunc, MK_I32 const lvl, MK_I32 skip, MK_I32 const num)
backtrace syscall with ccmkkernel error plugin
static bool MkSysStringIsNotNULL(MK_STRN str)
test if string is NOT NULL or EMPTY …
#define MkSysFreeNonNull(pointer)
void(* MkSysFreeF)(MK_PTR)
free syscall …
MK_STR MkSysPrintF_RT(MK_RT mkrt, MK_STRN const format,...)
sprintf syscall with ccmkkernel error plugin
MK_PTR(* MkSysReallocF)(MK_PTR, size_t)
realloc syscall …
MK_PTR MkSysMemDup(MK_OBJN fmtobj, MK_PTRN const blck, size_t const size)
memdup syscall with ccmkkernel error plugin
static MK_STRN MkSysStringGet(MK_STRN str)
get string NULL or VALUE …
@ MK_ID_UNUSED
empty struct
@ MK_ID_PROCESS
val has a process handle
@ MK_ID_THREAD
val has a thread handle
#define MkObjectDeleteCallF_ARGS
the libmkkernel::MkObjectDeleteCallF arguments with default names
#define MkObjectDeleteFreeF_ARGS
the libmkkernel::MkObjectDeleteFreeF arguments with default names
const struct MkRtExtS * MK_RTEXTN
class-shortcut for const struct MkRtExtS *, all const shortcut using the XX_YYYC syntax (only for pub...
static bool MkRtExtCheck(MK_MNGN mng)
check MkRtExtS -> libmkkernel::MkObjectS::signature …
static bool MkRtExtCheckO(MK_OBJN obj)
check MkRtExtS -> libmkkernel::MkObjectS::signature …
struct libmkkernel::MkThreadDataS MkThreadDataS
bool MkRuntimeSysPipeHandlerUse
block SIGPIPE ignore handlern default=true, Java require this
#define MkRuntimeHandleResolve(...)
#define MkRuntimeHandleGet(...)
const struct MkRuntimeS * MK_RTN
class-shortcut for const struct MkRuntimeS *, all const shortcut using the XX_YYYC syntax (only for p...
static MK_RT MkRuntimeNext(MK_RT const rt)
get next instance from linked-list of MkRuntimeS type
#define MkRuntimeInstances()
static MK_RT MkRuntimePrev(MK_RT const rt)
get previous instance from linked-list of MkRuntimeS type
struct MkRuntimeS * MK_RT
class-shortcut for struct MkRuntimeS *, all shortcut using the XX_YYY syntax (only for public API) …
#define MkRuntimeC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …
static bool MkRtCheck(MK_MNGN mng)
check MkRuntimeS -> libmkkernel::MkObjectS::signature …
static MK_RT MkRt(MK_MNG mng)
cast a unknown-object into an MkRuntimeS pointer or NULL if not possible
#define MkRuntimeC_X2obj(x)
static bool MkRtCheckO(MK_OBJN obj)
check MkRuntimeS -> libmkkernel::MkObjectS::signature …
static void MkRuntimeIsSilentSet_RT(MK_RT mkrt, bool silent)
set the MkRuntimeS::isSilent value …
static bool MkRuntimeIsSilentGet(void)
get the MkRuntimeS::isSilent value …
#define MkRuntimeLogBufferPush()
static void MkRuntimeNoDecoSet_RT(MK_RT mkrt, bool noDeco)
set the MkRuntimeS::noDeco value …
#define MkRuntimeLogBufferPop()
static MK_STRN MkRuntimeLogTargetGet(void)
get the MkLogDataS::logNAME value …
static MK_I32 MkRuntimeDebugGet(void)
get the MkRuntimeS::debug value …
static MK_RT MkRuntimeGet(void)
return a initialized MkRuntimeRLS …
#define MkRT
#define MkRtSetup_ON_RT(o)
#define MK_ATTR_STATIC
#define MK_ATTR_RT_INSTANCE
#define MK_ATTR_INSTANCE
MK_RT MkRuntimeSetup(MK_RT const mkrt)
initialize MkRuntimeRLS …
#define MkThreadLocal
#define MK_RT_ATTR_FORMAT_4
size_t MkRuntimeCallbackAdd(MK_RT mkrt, MkRuntimeCallbackS *cbdata, MkRuntimeInitF rt_callback, MK_STRN ident)
add a callback to the runtime …
void MkRuntimeCleanup(MK_RT mkrt)
cleanup MkRuntimeRLS …
#define MK_INSTANCE_RT_O(o)
#define MK_PARSER_RT
#define MK_RT_ATTR_FORMAT_1
#define MK_RT_ATTR_FORMAT_2
#define MK_RT_CALL
#define MK_PARSER_RT_ONLY
#define MK_ATTR_RT_STATIC
void MkRuntimeCallbackDel(MK_RT mkrt, MkRuntimeCallbackS *cbdata)
delete a callback from the runtime …
#define MK_RT_ARGS
__thread struct MkRuntimeS MkRuntimeRLS
RLS …
#define MK_STATIC_RT
#define MK_RT_ARGS_ONLY
#define MK_INSTANCE_HDL(x)
#define MK_RT_REF
#define MkRT_O(o)
#define MkTypeC_X2obj(x)
static bool MkTypCheckO(MK_OBJN obj)
check MkTypeS -> libmkkernel::MkObjectS::signature …
static bool MkTypCheck(MK_MNGN mng)
check MkTypeS -> libmkkernel::MkObjectS::signature …
#define MkTypeLoop(_cls, _var)
MK_TYP MkTypeResolve_RT(MK_RT mkrt, MK_TYPN const typ)
resolve a new type
static MK_OBJ MkTypeInstances(MK_TYP const typ)
access the instance attribute of the type…
MK_TYP MkTypeDup2_RT(MK_RT mkrt, MK_TYPN const typ, MK_STRN const ident)
duplicate typ to create a lightweight-type …
MK_OBJ MkTypeAlloc_RT(MK_RT mkrt, MK_TYPN const typ)
alloc instance-memory for MkTypeS …
#define MkTypeCreate(clsV, basicV, identV)
void MkTypeDelete_RT(MK_RT mkrt, MK_TYP const typ)
delete a type object
static MK_TYPN MkTypeNextN(MK_TYPN const typ)
get next instance from linked-list of MkObjectS type
static MK_OBJ MkObjectInstancesOfType_RT(MK_RT mkrt, MK_SIG typeSIG)
return the head-instance from a specific type defined by signature typeSIG …
array of libmkkernel::MK_STRN values …
define the storage-allocator function
MK_PTR alloc_data
data use for alloc_createF and alloc_deleteF
MkAllocCreateFLT alloc_createF
"calloc" the memory of the object
MkAllocDeleteF alloc_deleteF
"free" the memory of the object
binary data default format …
MK_BINN data
pointer to the binary data
MK_SIZE size
size of the data pointer
the final class of MkBufferS with 1024 byte ILS-Size …
the final class of MkBufferS with 256 byte ILS-Size …
the final class of MkBufferS with 64 byte ILS-Size …
The CLASS used to store a list of MkBufferS items into a flat array…
instance storage predefined
MK_NUM size
size of the MkBufferS::ils_data
MK_NUM offset
offset from start of MkBufferS to the start of MkBufferS::ils_data
The ABSTRACT-CLASS used to store a native-type-data-item defined by PRIMITIVE TYPE …
MK_NUM cursize
currently used size (always: cursize < size)
bool doBufferFree
should the data be freed? -> example: pBufferRefInit
MK_NUM size
the size of the data-segment
enum MkTypeE type
type of the item stored into the data-segment
the final class of MkBufferStreamS with 1024 byte ILS-Size …
the final class of MkBufferStreamS with 16384 byte ILS-Size …
the final class of MkBufferStreamS with 256 byte ILS-Size …
the final class of MkBufferStreamS with 64 byte ILS-Size …
The ABSTRACT-CLASS MkBufferStreamS is used for package-based serialized IO …
struct MkBufferStreamSaveS * busReadSave
struct MkBufferStreamSaveS * busWriteSave
a linked-list to opearate a storage of data items
MK_SIG signature
check if item is valid or not
struct MkCacheItemS * prev
link to the prev item
struct MkCacheItemS * next
link to the next item
bool doFree
should the item be freed?
MK_PTR data
data to cache
This is an circel storage of a linked-list connected with a "lock" at libmkkernel::MkCacheS …
struct MkCacheItemS * used
used cache items
MkCacheDF deleteF
function to delete 'data'
struct MkCacheItemS * free_last
free last cache item
MK_NUM num
MIN num items in cache.
MkCacheCF createF
function to create 'data'
MK_PTR createD
additional create data item
struct MkCacheItemS * free_first
free first cache item
MK_RT runtime
link to the runtime
extension-slot for MkErrorS …
signal-slot for ignore on error …
signal-slot for panic on error …
signal-slot for print on error …
The data-type to store and handle the error-condition …
MK_OBJN format_of_error
used to format the error-message and as input for source_of_error
Base class for the extension technologie …
data type for process/thread identification …
bool setByExtern
vales of val was set by extern source
bool ioIsPipe
startet in PIPE mode: client @ server @ ... and NOT in server --thread|spawn|fork
MK_IDNT val
process or thread handle
enum MkIdSE type
signal type of val data
Interface between ccmkkernel and the Operating-System …
MkSysWaitF MkSysWaitForThreadCB
wait for process to finish syscall with ccmkkernel error plugin
MkSysCallocF SysCalloc
calloc syscall …
MkSysWaitF MkSysWaitForProcessCB
wait for process to finish syscall with ccmkkernel error plugin
MkSysFreeF SysFree
free syscall …
MkSysReallocF SysRealloc
realloc syscall …
MkSysStrNDupF SysStrNDup
strndup syscall …
MkSysStrDupF SysStrDup
strdup syscall …
MkSysStrNCpyF SysStrNCpy
strdup strncpy …
enum MkErrorE(* SysSleep)(MK_OBJN const obj, unsigned int const sec)
sleep syscall with ccmkkernel error plugin
MkSysForkF SysFork
fork syscall …
MkSysMallocF SysMalloc
malloc syscall …
enum MkErrorE(* SysUSleep)(MK_OBJN const obj, unsigned int const usec)
usleep syscall with ccmkkernel error plugin
struct to hold the mkrt-logging-data …
char logNAME[MkLogDataS_LogNAME_size]
define a MkLogFileC object …
the protect is used to "protect" data set by pAllocCreate if the new object is later initialized with...
bool isLocal
has the object a local reference? - has been created by TLS or MkBufferCreateREF ?...
MK_TYP type
link to the object type
MK_RTEXT objRtExt
link to the kernel-runtime-extension the instance was created in …
MK_I32 selfRefCount
Delete the MkObjectS::self at the same MkObjectS::refCount as was created …
MK_I32 refCount
is THIS object in use?
MK_SIG signature
should be the SIGNATURE
MK_PTR self
link between the managed object and the object in the target-programming-language
MK_RT objRt
link to the kernel-runtime the instance was created in …
MK_PTR env
link to the object "runtime", set by selfCreate …
bool selfCreated
if the self was created by selfCreate than it is an INTERNAL object …
MK_HDL netHdl
if not-null the object was exported with MkObjectHandleGet
bool deleteCallbackCalled
Activate if object is on delete.
MkRtExtS - extend the MkRuntimeC with a library specific feature …
keep callback related data …
The MkRuntimeS provide a per-thread environment for ccmkkernel …
bool isSilent
write (false) or don't write (true) any message to MkLogFileC (default: stderr) (default: false) …
MK_I32 debug
set the debug-level of the context … Valid values are 0 <= debug-level <= 9 using 0 for no-debug and ...
MkLogDataS log
struct to hold the mkrt-logging-data …
bool noDeco
do not use decoration to generate log messages (default: use decoration) …
string data default format …
MK_NUM len
len of the string data
MK_STRN ptr
pointer to the string data
super-class-base, the MkTypeS using the super-macro-syntax for all non specific types …
MkTypeS - class known as typ or type is used as class-base for a Managed-Object-Technology (MOT) type...
MkLogF log
"log" object data to MkLogFileC (default: stderr)
MkSelfCreateF selfCreate
"create" the "self" pointer
bool noSelf
do NOT use the self feature -> used by MqFactoryS
MK_I32 delCbCnt
number of callback registered for this type
size_t typsize
the size of the this type self, used in MkTypeDup2
MkDestructorF destructor
delete an object
MK_SIG objmask
type-instance: mask to filter out the valid part of the signatur
MK_I32 type_id
default "0" but "MkFactoryTypeAdd" need more
MkLogFormatF fLogFormat
format the log message of an object, used in "sLogVL_O"
MkDupF dup
"dup" constructor
MkMergeF merge
"merge" constructor
MkSelfUnlinkF selfUnlink
"unlink" the "self" pointer from META-Kernel
MkSelfDeleteF selfDelete
"delete" the "self" pointer
MkDup2F dup2
"dup" constructor with "ident" initialisation
MK_TYP type_class
point to the instancesR linked list of the class-type
MkTypeInitF type_init
initializer for new type
size_t objsize
the size of the new object created with this type, used in malloc
MkResetF reset
"reset" the object to the "initial" state
MkToStringF toString
get the string representation
MK_SIG objsig
type-instance: signature as unsinged integer (32bit)
MkConstructorF constructor
create an object
MK_TYP type_base
base type
union used to set or modify native data from an MkBufferS object …
MK_BOL BOL
1 byte boolean data
MK_DBL DBL
8 byte double data
MK_I32 I32
4 byte integer data
MK_I16 I16
2 byte short data
MK_I64 I64
8 byte integer data
MK_FLT FLT
4 byte float data
MK_I8 I8
1 byte byte data
a union for all data items supported by MkBufferS …
MK_ATO * A
atom for native data-types
MK_BIN B
arbitrary byte-array data
MK_LST L
list object type data
MK_STR S
C string like data (e.g. with a \0 at the end)
MK_STRN C
const C string like data (e.g. with a \0 at the end)