libmkkernel 9.0
Loading...
Searching...
No Matches
kernel_mk.h
Go to the documentation of this file.
1
12#ifndef KERNEL_MK_H
13#define KERNEL_MK_H
14
15// MARK_D ################################################################
16// -----------------------------------------------------------------------
17// documentation order
35
51
62
77
87
99
107
124
130
131// =========================================================================================
132// Config: configure definitions
133
134// define: META_HAS_THREAD
135// source: msgque_config.h - set with the "configure" script
136// default: depend on how the LNG and libmqmsgque was compiled
137// definition: 1. if defined the T)hread L)ocal S)torage is used.
138// 2. the "runtime" command-line-artgumen "mkrt" as FIRST parameter is set
139// 3. if "libmqmsgque" was compiled with META_HAS_THREAD this have to be set as well.
140
141#ifndef META_HAS_THREAD
142 #error "META_HAS_THREAD was NOT defined, require 1 or 0"
143#endif
144
145// =========================================================================================
146// Makefile: CPPFLAGS definitions
147
148// define: META_IGNORE_EXTERN
149// source: Makefile
150// default: not set
151// definition: If the source-code is direct used in an external library (example: C++)
152// (without dynamic linking) and this library should *not* export
153// the symbol's of libmsgque then the flag META_IGNORE_EXTERN have
154// to be set
155
156// define: META_COMPILE_AS_CC
157// source: Makefile, CPPFLAGS=-DMETA_COMPILE_AS_CC
158// target: "C" main header file like 'kernel_mk.h'
159// default: only set by "ccmqmsgque" to compile "C" code as "C++" code with "namespace" support
160// definition: The preprocessor flag "META_COMPILE_AS_CC" is ONLY used together with the C++ compiler.
161// If the "META_COMPILE_AS_CC" flag is set, the C-code is not compiled into an independent library,
162// but translated directly into the C++ library together with the additional C++ code as C++ code in
163// the "libmkkernel" namespace. The difference is that the C code is additionally validated as "C++"
164// syntax and supports the C++ calling convention. Without "META_COMPILE_AS_CC" the C code is
165// compiled with "extern C" in the C++ compiler.
166//
167// The following changes are done:
168// 1. libmkkernel -> compile the code into "namespace libmkkernel"
169// 2. libmqmsgque -> compile the code into "namespace libmqmsgque"
170// 3. liblcconfig -> compile the code into "namespace liblcconfig"
171
172// =========================================================================================
173// Header: build control
174
175// define: MK_LIB_BUILD_DLL
176// source: Makefile
177// target: api-header and kernel_mk.h
178// default: set at build of the 'libmkkernel' library but NOT set for other libraries
179// definition: this define has two porpose:
180// 1. set the MK_EXTERN and MK_EXTERN_DATA to export of definition
181// 2. use the private definition of partly public struct's
182
183// =========================================================================================
184// Header: api definition
185
186// define: META_TIMEOUT_REF
187// source: api-header or Makefile
188// default: 900sec
189// definition: base timeout value - all other timeout will be calulated relative to this timeout
190
193#ifndef META_TIMEOUT_REF
194# define META_TIMEOUT_REF 900 //< reference value for timeout… default: 15 min
195#endif
197
198// define: META_HDL_USE_NULL_GCC_ATTRIBUTE
199// source: api-header or Makefile
200// target: api-header, check_mk.h
201// default: not set = use internal "check_XXX" macros
202// definition: gcc __attribute__ to assume FIRST argument, the class-object-pointer, is NULL ?
203// 1. set = #define MK_HDL_NONNULL_ATTR_1 __attribute__((nonnull(1)))
204// 2. not set = use internal check_??? macros and raise an ERROR on NULL
205// pattern: Design-Pattern to get a systematic for NULL checks
206// 1. MK_MNG has no MK_HDL_NONNULL_ATTR_1
207// 2. DTOR/CTOR has no MK_HDL_NONNULL_ATTR_1
208// 3. Mk..Log.. has no MK_HDL_NONNULL_ATTR_1
209
210//#define META_HDL_USE_NULL_GCC_ATTRIBUTE 1
211
212#if defined(META_HDL_USE_NULL_GCC_ATTRIBUTE)
213# define MK_HDL_NONNULL_ATTR_1 __attribute__((nonnull(1)))
214# define MK_ATTR_HDL __attribute__((nonnull(1)))
215#else
216# define MK_HDL_NONNULL_ATTR_1
217# define MK_ATTR_HDL
218#endif
219#define MK_ATTR_HDL_CHECK(x) assert(x!=0)
220
221// define: META_ATTRIBUTE_SANITIZE
222// source: api-header or Makefile
223// target: msgque_mq.h
224// default: __attribute__((no_sanitize("address")))
225// definition: The C2GO compiler does NOT understand the 'no_sanitize("address")' attribute
226// -> use "-DMETA_ATTRIBUTE_SANITIZE=" at "env.sh: CGO_CFLAGS" to ignore it
227// The "sanitize" is set at "configure" with the "NHI1_SANITIZE" makefile definition and env-Variable
228#if !defined(META_ATTRIBUTE_SANITIZE)
229# define META_ATTRIBUTE_SANITIZE __attribute__((no_sanitize("address")))
230#endif
231
232// define: META_MEM_DEBUG
233// target: libmqmsgque internal, cache_mq.c etc
234// default: not set = use the cache
235// action: disable reuse of memory
236// definition: libmqmsgque is using the CACHE to reuse a deleted instance and memory.
237// To debug the memory this "reuse" is a problem.
238
239//#define META_MEM_DEBUG
240
241// define: META_LOG_CLICKS
242// target: libmqmsgque internal, logging additional clicks-timestamp
243// default: not set = no clicks-timestamp
244// action: add clicks-timestamp to output
245// definition: libmqmsgque is using an verbose logging prefix to help debbugging
246// multi-thread/proc software - with META_LOG_CLICKS an additional
247// column with "clicks" data is added
248// attention: debug_mk.h also needs the "META_LOG_CLICKS", but is usually loaded before msgque_mq.h
249
250//#if !defined(META_LOG_CLICKS)
251// #define META_LOG_CLICKS
252//#endif
253
254// define: META_PERF_DEBUG
255// target: libmqmsgque internal, disable some inline to create better code for callgrind
256// default: not set = no performance debugging
257// action: add performance debugging features
258// definition: inline code is embedded into calling code, this is faster BUT make it impossible
259// to analyse a single inlined function for performance optimization
260
261//#define META_PERF_DEBUG
262
263// define: META_DISABLE_LOG
264// target: command-line definition for compiling
265// default: not set = show logging based on MkDLogC and MkDLogV
266// action: hide logging macros
267// definition: logging is done using so called logging-macros. if META_DISABLE_LOG is defined the logging-macros
268// will dissappear.
269
270//#define META_DISABLE_LOG
271
272// define: META_DOXYGEN_USE_C_PRIVAT
273// target: the doxygen configuration files.
274// default: yes=1 - on compillation, no=0 on documentation if NOT defined as 1
275// action: add / hide code and documentation
276// definition: ude/hide private code/documentation from doxygen docu and compilation
277// the private code/documentation is only use in "C" compiling and documantation,
278// use this switch to hide this code/documentation from non "C" languages
279
280#ifndef META_DOXYGEN_USE_C_PRIVAT
281# ifdef META_DOXYGEN_SHOULD_SKIP_THIS
282# define META_DOXYGEN_USE_C_PRIVAT 0
283# else
284# define META_DOXYGEN_USE_C_PRIVAT 1
285# endif
286#endif
287
288// define: META_STATIC
289// target: build and target, library and executable
290// default: not set -> do NOT force static linking
291// action: build (static) internal and external library
292// definition: ...
293
294#ifdef META_STATIC
295# undef MK_LIB_BUILD_DLL
296# define MK_LIB_BUILD_DLL
297# undef META_IGNORE_EXTERN
298# define META_IGNORE_EXTERN
299#endif
300
301/*****************************************************************************/
302/* */
303/* add feature - used to compile 'libmqmsgque' library itself */
304/* */
305/*****************************************************************************/
306
307// DOKU: MkObjectS->selfRefCount
308#define META_USE_SELF_REFCOUNT
309
310// MARK_P #####################################################################################################
311// ------------------------------------------------------------------------------------------------------------
312
313#ifndef __has_parser__
314# define __parser__(...)
315# define __parser__define__(...)
316# define __parser__global__define__(...)
317# define __parser__push__(...)
318# define __parser__pop__
319#endif
320
438#define __parser__alias ALIAS
439
450#define __parser__argument yes
451
468#define __parser__arg_type TYPE
469
485#define __parser__arg_name NAME
486
509#define __parser__callback CALLBACK
510
568#define __parser__cast TYPE
569
589#define __parser__class CLASS
590
610#define __parser__const yes
611
634#define __parser__constructor yes
635
674#define __parser__default VALUE
675#define __parser__default_args LIST
676
693#define __parser__destructor yes
694
714#define __parser__doc DOC
715
749#define __parser__doc_index INDEX
750
774#define __parser__doc_no yes
775
813#define __parser__enum_is_flag yes
814
840#define __parser__error_check yes
841
862#define __parser__flags FLAGS
863
883#define __parser__has_reference yes
884
907#define __parser__hide LIST
908
930#define __parser__ignore yes
931
951#define __parser__ignore_error yes
952
988#define __parser__inline INLINE
989
1019#define __parser__internal yes
1020
1049#define __parser__keep yes
1050
1077#define __parser__keep_destr yes
1078
1103#define __parser__keep_original_type yes
1104
1118#define __parser__library NAME@TYPE@NAMESPACE
1119
1142#define __parser__lng_constr yes
1143
1172#define __parser__lng_destr yes
1173
1197#define __parser__lng_dispose yes
1198
1230#define __parser__macro yes
1231
1278#define __parser__no_alias yes
1279
1280/*
1281deprecated
1282#define __parser__no_constructor yes
1283// scope=function : by DEFAULT a CTOR is defined by OBJECT,PREFIX and or CLASS name. It this
1284// DEFAULT behaviour is NOT desired the attribute "no-constructor" is required
1285*/
1286
1287/*
1288deprecated
1289#define __parser__no_reference yes
1290// scope=function : by DEFAULT some target-programming-language (c++) has a REFERENCE type system,
1291// if the attribute "no-reference" is set NO reference-type code for the C-API
1292// function is created.
1293*/
1294
1306#define __parser__no_rpc yes
1307
1348#define __parser__no_static yes
1349
1383#define __parser__no_type_extension yes
1384
1406#define __parser__no_size yes
1407
1408/*
1420#define __parser__null_allow yes
1421*/
1422
1437#define __parser__null_return_allow yes
1438
1457#define __parser__null_return_check yes
1458
1481#define __parser__overload OVERLOAD
1482
1501#define __parser__overload_c_no yes
1502
1503/*
1504depreated
1505#define __parser__package yes
1506// scope=object : add OBJECT to PACKAGE file
1507// usage : __parser__(package=MkKernel) enum MkErrorE { … }
1508*/
1509
1543#define __parser__prefix PREFIX
1544
1574#define __parser__return_type TYPE
1575
1613#define __parser__runtime FUNC-NAME
1614
1636#define __parser__static yes
1637
1666#define __parser__template_require yes
1667
1713#define __parser__template_overload yes
1714
1739#define __parser__type META@DESCRIPTION
1740
1769#define __parser__type_attr LIST
1770
1817#define __parser__wrapper yes
1818
1819
1821#define __parser__refdoc yes
1822#define __parser__reference yes
1823#define __parser__method yes
1824#define __parser__enum_accept_integer int32/int64
1825
1826// MARK_F
1828
1829// MARK_G #####################################################################################################
1830// ------------------------------------------------------------------------------------------------------------
1831//
1845
1867#define __parser__global ATTRIBUTE
1868
1876#define __parser__global__pattern2prefix PATTERN:PREFIX
1877
1885#define __parser__global__prefix2doc PREFIX:DOC
1886
1894#define __parser__global__prefix2class PREFIX:CLASS
1895
1905#define __parser__global__formatter VARIABLE
1906
1907/*
1908deprecated
1916#define __parser__global__prefix2defgroup PREFIX:DEFGROUP
1917*/
1918
1926#define __parser__global__hide REGEXP
1927
1955#define __parser__global__native2class EXTERNAL-STRUCT:INTERNAL-CLASS@HANDEL-NAME
1956
1992#define __parser__global__native2alias NATIVE-PREFIX:WRAPPER-PREFIX
1993
2008#define __parser__global__doc_force CLASS_or_PACKAGE:INDEX:?local?
2009
2010// ATTENTION: because META build and META usage can be complet different
2011// ATTENTION: test META build on "debug" and meta usage und "release" without "build" directory available
2012
2056#define __parser__global__doc_db DIRECTORY
2057
2084#define __parser__global__error_check ERROR_RETURN_ENUM
2085
2087
2088; // finish __parser__ definition
2089
2090// =========================================================================
2091// global __parser__ definition :
2092
2093__parser__(library=MkKernel@libmkkernel@Mk);
2094
2095// GLOBAL: all "fmtobj" arguments become attribute "formatter"
2096__parser__(global=formatter:fmtobj:yes);
2097
2098// GLOBAL: all "macros" become hide
2099__parser__(global=hide:^Mk\w+_T$);
2100
2101/* ####################################################################### */
2102/* ### ### */
2103/* ### Visual C++ Express-Edition ### */
2104/* ### ### */
2105/* ####################################################################### */
2106
2107#if defined(_MSC_VER)
2108
2109# define __attribute__(dummy)
2110# define __func__ __FUNCTION__
2111# define MK_CLRCALL __clrcall
2112# define MK_STDCALL __stdcall
2113# define MK_CDECL __cdecl
2114
2115// helper
2116# ifndef PARSE_C_HEADER_TO_META
2117# define mk_inline static inline
2118# endif
2119//# define bool int
2120# define mk_unlink _unlink
2121# define mk_snprintf _snprintf
2122
2123# define mk_attr_hot ???
2124# define mk_attr_cold ???
2125
2126#else // !_MSC_VER
2127
2128/* ####################################################################### */
2129/* ### ### */
2130/* ### GCC ### */
2131/* ### ### */
2132/* ####################################################################### */
2133
2137
2138# define MK_CLRCALL
2139# define MK_STDCALL
2140# define MK_CDECL
2141
2142// helper
2143# ifndef PARSE_C_HEADER_TO_META
2144# define mk_inline static inline
2145# endif
2146# define mk_unlink unlink
2147# define mk_snprintf snprintf
2148
2149# define mk_attr_hot __attribute__((hot))
2150# define mk_attr_cold __attribute__((cold))
2151
2152#endif // _MSC_VER
2153
2154#if defined(_MANAGED)
2155# define MK_DECL MK_CLRCALL
2156#elif defined(META_COMPILE_AS_CC)
2157# define MK_DECL MK_STDCALL
2158#else
2159# define MK_DECL MK_CDECL
2160#endif
2161
2162/* BEGIN_MK_C_DECLS should be used at the beginning of your declarations,
2163 so that C++ compilers don't mangle their names. Use END_MK_C_DECLS at
2164 the end of C declarations. */
2165
2166#undef BEGIN_MK_C_DECLS
2167#undef END_MK_C_DECLS
2168#if defined(META_COMPILE_AS_CC)
2169# define BEGIN_MK_C_DECLS namespace libmkkernel {
2170# define END_MK_C_DECLS }
2171#elif defined(__cplusplus)
2172# define BEGIN_MK_C_DECLS extern "C" {
2173# define END_MK_C_DECLS }
2174#else
2175# define BEGIN_MK_C_DECLS /* empty */
2176# define END_MK_C_DECLS /* empty */
2177#endif
2178
2179/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
2180 a mechanism by which the user can annotate likely branch directions and
2181 expect the blocks to be reordered appropriately. Define __builtin_expect
2182 to nothing for earlier compilers. */
2183
2184#if defined(_MSC_VER) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
2185#define likely(x) !!(x)
2186#define unlikely(x) !!(x)
2187#else
2188#define likely(x) __builtin_expect((x),1)
2189#define unlikely(x) __builtin_expect((x),0)
2190#endif
2191
2192#ifndef PARSE_C_HEADER_TO_META
2193# ifndef _MSC_VER
2194# include <inttypes.h>
2195# endif
2196# ifdef __CYGWIN__
2197# include <windef.h>
2198# endif
2199# include <stdarg.h>
2200# include <stdio.h>
2201# include <time.h>
2202# include <limits.h>
2203# include <string.h>
2204# ifndef _MSC_VER
2205# include <unistd.h>
2206# include <stdbool.h>
2207# endif
2208#endif
2209
2210#if defined(_WIN32) && !defined(__CYGWIN__)
2211# ifndef PARSE_C_HEADER_TO_META
2212# include <winsock2.h>
2213# endif
2214
2216# define mk_timeval timeval
2217
2219struct mk_timezone {
2220 int tz_minuteswest;
2221 int tz_dsttime;
2222};
2223
2224#else
2225# define mk_timeval timeval
2226# define mk_timezone timezone
2227 struct mk_timeval;
2228 struct mk_timezone;
2229#endif
2230
2232#define MK_UNUSED __attribute__((unused))
2233
2235typedef void* MK_MACRO_TYP;
2236
2238
2239// #if META_DOXYGEN_USE_C_PRIVAT
2361#if META_HAS_THREAD
2362# define MkThreadLocal __thread
2363# define MK_RT_IS_ARG 1
2364# define MK_RT_ARGS_ONLY MK_RT mkrt
2365# define MK_RT_ARGS MK_RT_ARGS_ONLY,
2366# define MK_RT_CALL_ONLY mkrt
2367# define MK_RT_CALL MK_RT_CALL_ONLY,
2368# define MK_RT_CALL_O(o) MkRT_O(o),
2369# define MK_RT_CALL_X(x) MkRT_X(x),
2370# define MK_RT_CALL_NULL_ONLY MkRT
2371# define MK_RT_CALL_NULL MK_RT_CALL_NULL_ONLY,
2372# define MK_RT_NULL NULL,
2373# define MK_RT_PTR mkrt
2374# define MK_RT_REF (*mkrt)
2375# define MK_RT_UNUSED MK_UNUSED
2376# define MK_RT_CALL_RT(ptr) ptr,
2377# define MK_RT_PARSER_ONLY MK_RT_ARGS_ONLY __parser__(internal,default=N#RUNTIME)
2378# define MK_RT_PARSER MK_RT_PARSER_ONLY,
2379# define MK_RT_ATTR_NONNULL_1 __attribute__((nonnull(2)))
2380# define MK_RT_ATTR_NONNULL_2 __attribute__((nonnull(3)))
2381# define MK_RT_ATTR_FORMAT_1 __attribute__((format (printf, 2, 3)))
2382# define MK_RT_ATTR_FORMAT_2 __attribute__((format (printf, 3, 4)))
2383# define MK_RT_ATTR_FORMAT_4 __attribute__((format (printf, 5, 6)))
2384// nonnull for runtime yesORno? → problem is C# (and propably go), because runtime is a C feature and getting a nonnull C Pointer
2385// for every API call in C# is expensive. solution? → allow NULL and resolve the mkrt pointer in C
2386# define MK_RT_ATTR_RUNTIME // mkrt
2387# define MK_RT_ATTR_HDL __attribute__((nonnull(2)))
2388#else
2389# define MkThreadLocal
2390# define MK_RT_IS_ARG 0
2391# define MK_RT_ARGS_ONLY void
2392# define MK_RT_ARGS
2393# define MK_RT_CALL_ONLY
2394# define MK_RT_CALL
2395# define MK_RT_CALL_O(o)
2396# define MK_RT_CALL_X(x)
2397# define MK_RT_CALL_NULL_ONLY
2398# define MK_RT_CALL_NULL
2399# define MK_RT_NULL
2400# define MK_RT_PTR (&MkRuntimeRLS)
2401# define MK_RT_REF MkRuntimeRLS
2402# define MK_RT_UNUSED
2403# define MK_RT_CALL_RT(ptr)
2404# define MK_RT_PARSER_ONLY void
2405# define MK_RT_PARSER
2406# define MK_RT_ATTR_NONNULL_1 __attribute__((nonnull(1)))
2407# define MK_RT_ATTR_NONNULL_2 __attribute__((nonnull(2)))
2408# define MK_RT_ATTR_FORMAT_1 __attribute__((format (printf, 1, 2)));
2409# define MK_RT_ATTR_FORMAT_2 __attribute__((format (printf, 2, 3)))
2410# define MK_RT_ATTR_FORMAT_4 __attribute__((format (printf, 4, 5)))
2411# define MK_RT_ATTR_RUNTIME // mkrt
2412# define MK_RT_ATTR_HDL __attribute__((nonnull(1)))
2413#endif
2414
2415// with "nonnull" on HDL the assert disable itself
2416#ifdef META_HDL_USE_NULL_GCC_ATTRIBUTE
2417# define MK_RT_ATTR_HDL_CHECK(x)
2418#else
2419# undef MK_RT_ATTR_HDL
2420# define MK_RT_ATTR_HDL
2421# define MK_RT_ATTR_HDL_CHECK(x) assert(x!=NULL)
2422#endif
2423
2424#define MK_RT_ATTR_RUNTIME_CHECK_XN(x) MkRtSetup_XN_RT(x)
2425#define MK_RT_ATTR_RUNTIME_CHECK_ON(x) MkRtSetup_ON_RT(x)
2426#define MK_RT_ATTR_NONNULL_1_CHECK(x) assert(x!=NULL)
2427#define MK_RT_ATTR_NONNULL_2_CHECK(x) assert(x!=NULL)
2428
2430
2431// #endif // META_DOXYGEN_USE_C_PRIVAT
2432
2433// MARK_O
2434#ifndef PARSE_C_HEADER_TO_META
2435# include <assert.h>
2436#endif
2437#include "kernel_overload_mk.h"
2438
2441
2508/*****************************************************************************/
2509/* */
2510/* compiler and os definition */
2511/* */
2512/*****************************************************************************/
2513
2516
2517// on windows using the 'native' compiler 'cl.exe' we have to define some missing symbols
2518#if defined(_MSC_VER) && defined(_DLL)
2519# undef PIC
2520# define PIC
2521# undef DLL_EXPORT
2522# define DLL_EXPORT
2523#endif
2524
2525#ifdef META_IS_WINDOWS
2526# define META_DIR_SEPARATOR '\\'
2527# define META_EOL "\r\n"
2528#else
2529# define META_DIR_SEPARATOR '/'
2530# define META_EOL "\n"
2531#endif
2532
2533// BEGIN-HEADER - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
2534
2535// If the source of libmkkernel is direct used in an external library
2536// (without dynamic linking) and this library should *not* export
2537// the symbol's of libmkkernel then the flag META_IGNORE_EXTERN have
2538// to be set
2539#undef MK_EXTERN
2540#if defined(META_IGNORE_EXTERN)
2541# define MK_EXTERN
2542#elif defined(PIC)
2543 // does we build a DLL ?
2544# if defined(DLL_EXPORT)
2545 // does we build the libmqmsgque library ?
2546# if defined(MK_LIB_BUILD_DLL)
2547# define MK_EXTERN __declspec(dllexport)
2548# else
2549# define MK_EXTERN __declspec(dllimport)
2550# endif
2551# else
2552 // no DLL - architecture specific extern specifier
2553# define MK_EXTERN __attribute__ ((visibility("default")))
2554# endif
2555#else
2557# define MK_EXTERN
2558#endif
2559
2560// external data lookup
2561#undef MK_EXTERN_DATA
2562#if defined(META_PRIVATE)
2563# define MK_EXTERN_DATA extern
2564#elif defined(META_IGNORE_EXTERN)
2565# define MK_EXTERN_DATA extern
2566#elif defined(PIC)
2567 // does we build a DLL ?
2568# if defined(DLL_EXPORT)
2569 // does we build the libmqmsgque library ?
2570# if defined(MK_LIB_BUILD_DLL)
2571# define MK_EXTERN_DATA __declspec(dllexport)
2572# else
2573# define MK_EXTERN_DATA __declspec(dllimport)
2574# endif
2575# else
2576 // no DLL - architecture specific extern specifier
2577# define MK_EXTERN_DATA __attribute__ ((visibility("default"))) extern
2578# endif
2579#else
2580# define MK_EXTERN_DATA extern
2581#endif
2582
2583// END-HEADER - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
2584
2586#define MK_CPPXSTR(s) MK_CPPSTR(s)
2588#define MK_CPPSTR(s) #s
2590#define MK_CONCAT(a,b) a ## b
2591#define MK_CONCAT2(a,b) MK_CONCAT(a,b)
2592#define MK_CONCAT3(a,b,c) a ## b ## c
2593
2595#ifdef HAVE_STPCPY
2596 #define mk_append_fix_str(t,s) t=stpcpy(t,s)
2597#else
2598 #define mk_append_fix_str(t,s) t=strcpy(t,s)+sizeof(s)-1
2599#endif
2600
2602#define mk_bit_compare(t,f) (t&f)==f
2603
2605
2606/* MARK_T ********************************************************************/
2607/* */
2608/* types/generic */
2609/* */
2610/*****************************************************************************/
2611
2615
2616struct MkErrorS;
2617struct MkBufferListS;
2618struct MkBufferS;
2619union MkBufferU;
2620struct MkObjectS;
2621struct MkAllocS;
2622struct MkTypeS;
2623struct MkDefTypeS;
2624
2626#define MK_ALFA '@'
2628#define MK_ALFA_STR ((MkStringR){1,"@"})
2629
2631__parser__(type=ME_NB1_MK_BOL:"1 byte 'boolean' data-type")
2632typedef unsigned char MK_BOL;
2633
2635__parser__(type=ME_NI1_MK_BYT:"1 byte 'byte' data-type")
2636typedef signed char MK_BYT;
2638__parser__(type=ME_NI2_MK_SRT:"2 byte 'short integer' data-type":primary)
2639typedef signed short MK_SRT;
2641__parser__(type=ME_NI4_MK_INT:"4 byte 'integer' data-type":primary)
2642typedef signed int MK_INT;
2644__parser__(type=ME_NF4_MK_FLT:"4 byte 'float' data-type":primary)
2645typedef float MK_FLT;
2647#if defined(_MSC_VER)
2648typedef __int64 MK_WID;
2649typedef long MK_SIZE;
2650#else
2651__parser__(type=ME_NI8_MK_WID:"8 byte 'wide integer' data-type":primary)
2652typedef int64_t MK_WID;
2653//typedef long long MK_WID;
2654__parser__(type=ME_NIL_MK_SIZE:"long byte 'size' datay-type")
2655// choose "long" because it have to fit a pointer-diff (eg: ptr1-ptr2) without cast
2656typedef long MK_SIZE;
2657#endif
2659__parser__(type=ME_NIX_MK_LLG:"min 8 byte 'wide integer' data-type":primary)
2660typedef long long MK_LLG;
2662__parser__(type=ME_NF8_MK_DBL:"8 byte 'double' data-type":primary)
2663typedef double MK_DBL;
2665__parser__(type=ME_NIL_MK_LONG:"4/8 byte 'long' data-type":primary)
2666typedef long MK_LONG;
2667// hint: bool into printf %B → https://stackoverflow.com/questions/17307275/what-is-the-printf-format-specifier-for-bool
2669__parser__(type=ME_NB0_MK_BOOL:"'boolean' data-type":primary)
2670typedef bool MK_BOOL;
2671#define bool2str(_bool) (_bool?"true":"false")
2673__parser__(type=ME_RUA_MkBufferAtomU:"atomic native data buffer type")
2674typedef union MkBufferAtomU MK_ATO;
2678__parser__(type=ME_NI4_MK_NUM)
2679typedef int32_t MK_NUM;
2680#define MK_FORMAT_N "%i"
2681
2683__parser__(type=ME_NI4_MK_DBG:"debug-level data-type")
2684typedef int MK_DBG;
2685
2689__parser__(type=ME_NIL_MK_TIME_T:"time [sec] data-type")
2690typedef time_t MK_TIME_T;
2691#define MK_FORMAT_TIME "%li"
2692#define MK_TIME ((MK_TIME_T)time(NULL))
2693#define MK_TIME_MAX (365*24*60*60)
2695
2696// attention: "google go" can not uses nested typedef's -> use "#define" for the basic types
2697
2699__parser__(type=ME_PVB_MK_PTRB:"pointer type data-type")
2700typedef void MK_PTRB;
2702__parser__(type=ME_PSB_MK_STRB:"string type data-type")
2703typedef char MK_STRB;
2705__parser__(type=ME_PBB_MK_BINB:"byte-array type data-type")
2706typedef unsigned char MK_BINB;
2708__parser__(type=ME_PLB_MK_LSTB:"list type data-type")
2709typedef unsigned char MK_LSTB;
2710
2712__parser__(type=ME_PVX_MK_PTR:"generic pointer data-type":primary)
2715__parser__(type=ME_PVN_MK_PTRN:"const generic pointer data-type":primary)
2716typedef const MK_PTRB *MK_PTRN;
2718__parser__(type=ME_PCX_MK_CCP:"class constructor/destructor data type")
2721__parser__(type=ME_PAX_MK_CBP:"generic pointer to call-back data")
2724__parser__(type=ME_PSX_MK_STR:"string pointer data-type":primary)
2727__parser__(type=ME_CXC_MK_MNG:"managed object pointer; datatype will be checked on runtime")
2730__parser__(type=ME_CXN_MK_MNGN:"const - a managed object pointer; datatype will be checked on runtime")
2731typedef const MK_PTRB *MK_MNGN;
2733__parser__(type=ME_PEX_MK_EXP:"target language exception-class-object")
2734typedef MK_PTRB const *MK_EXP;
2736__parser__(type=ME_CXC_MkExceptionC:"target language library-exception-class-object")
2742
2744__parser__(type=ME_PSN_MK_STRN:"constant string pointer data-type":primary)
2745typedef const MK_STRB *MK_STRN;
2747__parser__(type=ME_ASN_MK_STRN_A:"ARRAY of MK_STRN")
2748typedef struct {
2751} MK_STRN_A;
2752__parser__(ignore)
2755__parser__(type=ME_PBX_MK_BIN:"byte-array pointer data-type")
2758__parser__(type=ME_PBN_MK_BINN:"const byte-array pointer data-type")
2759typedef MK_BINB const *MK_BINN;
2761__parser__(type=ME_PLX_MK_LST:"list pointer data-type")
2764__parser__(type=ME_PFX_MK_FST:"constant 'printf' format string")
2765typedef MK_STRB const *MK_FST;
2766
2769__parser__(type=ME_PVX_MK_NAT_OBJECT:"target language object pointer")
2770typedef void* MK_NAT_OBJECT;
2771__parser__(type=ME_PVX_MK_NAT_LIST:"target language list pointer")
2772typedef void* MK_NAT_LIST;
2774
2777__parser__(type=ME_NU8_MK_USW:"8 byte 'unsigned wide' data-type":primary)
2778typedef uint64_t MK_USW;
2779__parser__(type=ME_NU4_MK_USI:"4 byte 'unsigned integer' data-type":primary)
2780typedef unsigned int MK_USI;
2781__parser__(type=ME_NU2_MK_USS:"2 byte 'unsigned short' data-type":primary)
2782typedef unsigned short MK_USS;
2783__parser__(type=ME_NU1_MK_USB:"1 byte 'unsigned byte' data-type":primary)
2784typedef unsigned char MK_USB;
2785__parser__(type=ME_NUX_MK_UXN:"8 byte 'unsigned long long' data-type":primary)
2786typedef unsigned long long MK_UXN;
2787__parser__(type=ME_NUL_MK_ULN:"8 byte 'unsigned long' data-type":primary)
2788typedef unsigned long MK_ULN;
2790
2792__parser__(type=ME_NU4_MK_SIG)
2793typedef unsigned int MK_SIG;
2794
2796
2797// --------------------------------------------------------------------
2798// binary
2799
2805
2806__parser__push__(hide);
2807
2811__parser__(reference)
2812typedef struct {
2815} MkBinaryR;
2816
2819 return (MkBinaryR) {size, data};
2820}
2821
2824 if (start>bin.size)
2825 return (MkBinaryR) {0, NULL};
2826 else
2827 return (MkBinaryR) {start+wide>bin.size?bin.size-start:wide, bin.data+start};
2828}
2829
2832
2835 return bin.data;
2836}
2837
2840 return bin.size;
2841}
2842
2844mk_inline void MkBinaryLog ( MkBinaryR const bin );
2845
2847
2849
2855
2856__parser__push__(hide);
2857
2861__parser__(reference)
2862typedef struct {
2865} MkStringR;
2866
2869 return (MkStringR) {(len>0?len:str?(MK_NUM)strlen(str):0), str};
2870}
2872 return (MkStringR) {str?(MK_NUM)strlen(str):0, str};
2873}
2874
2877
2880 return str.ptr;
2881}
2882
2885 return str.len;
2886}
2887
2889mk_inline void MkStringLog ( MkStringR const str );
2890
2892
2894
2895/* MARK_C ********************************************************************/
2896/* */
2897/* class types */
2898/* */
2899/*****************************************************************************/
2900
2901// BEGIN-ShortDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
2902
2908 __parser__(type=ME_CCC_MkObjectC:"MkObjectC class handle":primary)
2909 typedef struct MkObjectS * MK_OBJ;
2911 __parser__(type=ME_CCN_MkObjectC:"const - MkObjectC class handle":primary)
2912 typedef const struct MkObjectS * MK_OBJN;
2914 __parser__(ignore)
2915 typedef struct MkObjectS MK_OBJR;
2918
2924 __parser__(type=ME_CCC_MkBufferC:"MkBufferC class handle":primary)
2925 typedef struct MkBufferS * MK_BUF;
2927 __parser__(type=ME_CCN_MkBufferC:"const - MkBufferC class handle":primary)
2928 typedef const struct MkBufferS * MK_BUFN;
2930 __parser__(ignore)
2931 typedef struct MkBufferS MK_BUFR;
2934
2940 __parser__(type=ME_CCC_MkBufferStreamC:"MkBufferStreamC class handle":primary)
2941 typedef struct MkBufferStreamS * MK_BUS;
2943 __parser__(type=ME_CCN_MkBufferStreamC:"const - MkBufferStreamC class handle":primary)
2944 typedef const struct MkBufferStreamS * MK_BUSN;
2946 __parser__(ignore)
2947 typedef struct MkBufferStreamS MK_BUSR;
2950
2956 __parser__(type=ME_CCC_MkBufferListC:"MkBufferListC class handle":primary)
2957 typedef struct MkBufferListS * MK_BFL;
2959 __parser__(type=ME_CCN_MkBufferListC:"const - MkBufferListC class handle":primary)
2960 typedef const struct MkBufferListS * MK_BFLN;
2962 __parser__(ignore)
2963 typedef struct MkBufferListS MK_BFLR;
2966
2972 __parser__(type=ME_CCC_MkLogFileC:"MkLogFileC class handle":primary)
2973 typedef struct MkLogFileS * MK_LFL;
2975 __parser__(type=ME_CCN_MkLogFileC:"const - MkLogFileC class handle":primary)
2976 typedef const struct MkLogFileS * MK_LFLN;
2978 __parser__(ignore)
2979 typedef struct MkLogFileS MK_LFLR;
2982
2988 __parser__(type=ME_CCC_MkErrorC:"MqErrorC class handle":primary)
2989 typedef struct MkErrorS * MK_ERR;
2991 __parser__(type=ME_CCN_MkErrorC:"const - MqErrorC class handle":primary)
2992 typedef const struct MkErrorS * MK_ERRN;
2994 __parser__(ignore)
2995 typedef struct MkErrorS MK_ERRR;
2998
3004 __parser__(internal,type=ME_CCC_MkExtensionC:"abstract class for the extension technology":internal)
3005 typedef struct MkExtensionS * MK_EXT;
3007 __parser__(internal,type=ME_CCN_MkExtensionC:"const - abstract class for the extension technology":internal)
3008 typedef const struct MkExtensionS * MK_EXTN;
3010 __parser__(ignore)
3011 typedef struct MkExtensionS MK_EXTR;
3014
3020 __parser__(internal,type=ME_CCC_MkErrExtC:"final class for the MkErrorS extention technology":internal)
3021 typedef struct MkErrExtS * MK_ERREXT;
3023 __parser__(internal,type=ME_CCN_MkErrExtC:"const - final class for the MkErrorS extention technology":internal)
3024 typedef const struct MkErrExtS * MK_ERREXTN;
3026 __parser__(ignore)
3027 typedef struct MkErrExtS MK_ERREXTR;
3030
3036 __parser__(internal,type=ME_CCC_MkRtExtC:"final class for the MkRuntimeS extention technology":internal)
3037 typedef struct MkRtExtS * MK_RTEXT;
3039 __parser__(internal,type=ME_CCN_MkRtExtC:"const - final class for the MkRuntimeS extention technology":internal)
3040 typedef const struct MkRtExtS * MK_RTEXTN;
3042 __parser__(ignore)
3043 typedef struct MkRtExtS MK_RTEXTR;
3046
3052 __parser__(type=ME_CCC_MkRuntimeC:"runtime singleton class object":primary)
3053 typedef struct MkRuntimeS * MK_RT;
3055 __parser__(type=ME_CCN_MkRuntimeC:"const - runtime singleton class object":primary)
3056 typedef const struct MkRuntimeS * MK_RTN;
3058 __parser__(ignore)
3059 typedef struct MkRuntimeS MK_RTR;
3062
3068 __parser__(internal,type=ME_CCC_MkTypeC:"a managed object class type !base! pointer":internal)
3069 typedef struct MkTypeS * MK_TYP;
3071 __parser__(internal,type=ME_CCN_MkTypeC:"const - a managed object class type !base! pointer":internal)
3072 typedef const struct MkTypeS * MK_TYPN;
3074 __parser__(ignore)
3075 typedef struct MkTypeS MK_TYPR;
3078// END-ShortDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3079
3082__parser__(type=ME_CXC_MK_BAC:"a list of 'buffer' as last argument in function")
3083typedef struct MkBufferListS *MK_BAC;
3084
3087__parser__(type=ME_CXN_MK_BAC:"const - a list of 'buffer' as last argument in function")
3088typedef const struct MkBufferListS *MK_BACN;
3089
3090/*****************************************************************************/
3091/* */
3092/* enum definitions */
3093/* */
3094/*****************************************************************************/
3095
3098
3099__parser__push__(doc=Enum);
3100
3103
3110// [MkErrorE]
3116// [MkErrorE]
3117
3118// BEGIN-MkErrorE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3119
3122__parser__(doc=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
3124
3127__parser__(doc=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
3129 return (MK_INT) value;
3130}
3131
3134__parser__(doc=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
3135MK_EXTERN enum MkErrorE MkErrorE_FromInt ( MK_INT const value, enum MkErrorE * value_out );
3136
3137// END-MkErrorE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3138
3139// additional attribute for MkErrorE_FromInt
3140__parser__(global=MkErrorE_FromInt:ignore-error:yes);
3141
3143
3146
3153// [MkTimeoutE]
3154__parser__(enum-accept-integer=long)
3176// [MkTimeoutE]
3177
3178// BEGIN-MkTimeoutE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3179
3182__parser__(doc=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
3184
3187__parser__(doc=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
3189 return (MK_INT) value;
3190}
3191
3194__parser__(doc=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
3195MK_EXTERN enum MkErrorE MkTimeoutE_FromInt ( MK_INT const value, enum MkTimeoutE * value_out );
3196
3197// END-MkTimeoutE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3198
3200
3203
3205__parser__(internal)
3207 MK_NO = 0,
3209};
3210
3211// BEGIN-MkBoolE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3212
3215__parser__(internal,no-rpc)
3217
3220__parser__(internal,no-rpc)
3222 return (MK_INT) value;
3223}
3224
3227__parser__(internal,no-rpc)
3228MK_EXTERN enum MkErrorE MkBoolE_FromInt ( MK_INT const value, enum MkBoolE * value_out );
3229
3230// END-MkBoolE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3231
3233
3236
3238__parser__(internal)
3245
3246// BEGIN-MkNativeIsE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3247
3250__parser__(internal,no-rpc)
3252
3255__parser__(internal,no-rpc)
3257 return (MK_INT) value;
3258}
3259
3262__parser__(internal,no-rpc)
3263MK_EXTERN enum MkErrorE MkNativeIsE_FromInt ( MK_INT const value, enum MkNativeIsE * value_out );
3264
3265// END-MkNativeIsE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3266
3268
3271
3273#define MK_TYPE_IS_1_BYTE (1<<0)
3274
3276#define MK_TYPE_IS_2_BYTE (1<<1)
3277
3279#define MK_TYPE_IS_4_BYTE (1<<2)
3280
3282#define MK_TYPE_IS_8_BYTE (1<<3)
3283
3285#define MK_TYPE_IS_NATIVE ( MK_TYPE_IS_1_BYTE | MK_TYPE_IS_2_BYTE | \
3286 MK_TYPE_IS_4_BYTE | MK_TYPE_IS_8_BYTE )
3287
3289#define MK_TYPE_SHIFT 4
3290
3298// [MkTypeE]
3311// [MkTypeE]
3312
3313// BEGIN-MkTypeE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3314
3317__parser__(doc=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
3319
3322__parser__(doc=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
3324 return (MK_INT) value;
3325}
3326
3329__parser__(doc=Enum,doc-index=_ignore_,class=MkKernel,no-rpc,prefix=EnumFunc)
3330MK_EXTERN enum MkErrorE MkTypeE_FromInt ( MK_INT const value, enum MkTypeE * value_out );
3331
3332// END-MkTypeE - created by 'c_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
3333
3335
3337
3339
3397
3399__parser__(ignore)
3408 MK_BINB B[8];
3409 MK_BINB B8[8];
3410 MK_BINB B4[4];
3411 MK_BINB B2[2];
3412 MK_BINB B1[1];
3413
3414#if defined(__cplusplus)
3415 MkBufferAtomU() : W(0L) {};
3416 MkBufferAtomU(MK_BYT val) : Y(val) {};
3417 MkBufferAtomU(MK_BOL val) : O(val) {};
3418 MkBufferAtomU(MK_SRT val) : S(val) {};
3419 MkBufferAtomU(MK_INT val) : I(val) {};
3420 MkBufferAtomU(MK_FLT val) : F(val) {};
3421 MkBufferAtomU(MK_WID val) : W(val) {};
3422 MkBufferAtomU(MK_DBL val) : D(val) {};
3423#endif
3424};
3425
3434__parser__(ignore)
3442
3445#define MkType_O MK_BOL
3446#define MkType_Y MK_BYT
3447#define MkType_S MK_SRT
3448#define MkType_I MK_INT
3449#define MkType_W MK_WID
3450#define MkType_F MK_FLT
3451#define MkType_D MK_DBL
3452#define MkType_C MK_STRN
3453#define MkType_B MK_BIN
3454#define MkType_U MK_BUF
3455#define MkType_L MK_BFL
3457
3459
3469
3489
3490
3491// =============================================================================================
3492
3495
3497__parser__(ignore)
3498typedef uintptr_t MK_IDNT;
3499
3501__parser__(ignore)
3507
3514__parser__(ignore)
3515struct MkIdS {
3518};
3519
3521
3522/*****************************************************************************/
3523/* */
3524/* cache */
3525/* */
3526/*****************************************************************************/
3527
3531
3532__parser__(ignore)
3533typedef MK_PTR ( *MkCacheCF) ( MK_RT_ARGS MK_PTR const);
3534__parser__(ignore)
3535typedef void ( *MkCacheDF) ( MK_RT_ARGS MK_PTR * const);
3536
3538__parser__(ignore)
3540 #define MkCacheItemS_signature 0x44196912
3542 bool doFree;
3546};
3547
3555__parser__(ignore)
3572
3575__parser__(flags=public-internal)
3577
3579
3580/*****************************************************************************/
3581/* */
3582/* create / delete */
3583/* */
3584/*****************************************************************************/
3585
3655__parser__push__(no-rpc,template-overload,doc=Setup,prefix=Setup);
3656
3662MK_EXTERN void MK_DECL MkSetup (void) __attribute__ ((constructor(200)));
3663
3671MK_EXTERN void MK_DECL MkCleanup (void) __attribute__ ((destructor(200)));
3672
3674__parser__(ignore)
3676
3677__parser__(internal)
3679
3680__parser__(internal)
3682
3684
3686
3687/* ####################################################################### */
3688/* ### ### */
3689/* ### S Y S T E M - A P I ### */
3690/* ### ### */
3691/* ####################################################################### */
3692
3693// MkObjectC_Sys_C_API: hide all ^MkSys
3694__parser__(global=hide:^MkSys);
3695// MkObjectC_Sys_C_API: default class for MkSys is MkObjectC
3696__parser__(global=prefix2class:MkSys:MkObjectC);
3697
3710
3714typedef MK_PTR (*MkSysCallocF) (size_t, size_t) __attribute__ ((alloc_size (1, 2)));
3715
3719typedef MK_PTR (*MkSysMallocF) (size_t) __attribute__ ((alloc_size (1)));
3720
3725
3729typedef MK_STR (*MkSysStrNCpyF) (char*,const char*,size_t);
3730
3734typedef MK_STR (*MkSysStrNDupF) (MK_STRN, size_t) __attribute__ ((alloc_size (2)));
3735
3739typedef MK_PTR (*MkSysReallocF) (MK_PTR, size_t);
3740
3744typedef void (*MkSysFreeF) (MK_PTR);
3745
3750typedef pid_t (*MkSysForkF) (void);
3751
3753__parser__(ignore)
3754struct MkLalS {
3770 MkSysForkF SysFork;
3771
3780 enum MkErrorE (*SysWait) (
3781 MK_OBJ const obj,
3782 const struct MkIdS * idP
3783 );
3792 enum MkErrorE (*SysUSleep) (
3793 MK_OBJ const obj,
3794 unsigned int const usec
3795 );
3804 enum MkErrorE (*SysSleep) (
3805 MK_OBJ const obj,
3806 unsigned int const sec
3807 );
3820 enum MkErrorE (*SysDaemonize) (
3822 MK_OBJ const obj,
3823 MK_STRN pidfile
3824 );
3833 void (*SysExit) (
3834 int isThread,
3835 int num
3836 ) __attribute__((noreturn));
3846 void (*SysAbort) (
3847 void
3848 ) __attribute__((noreturn));
3849
3850 enum MkErrorE (*SysIgnorSIGCHLD) (
3852 MK_OBJ const obj
3853 );
3854
3855 enum MkErrorE (*SysAllowSIGCHLD) (
3857 MK_OBJ const obj
3858 );
3859};
3860
3862__parser__(ignore)
3864
3871__attribute__ ((alloc_size (2, 3)))
3872__parser__(internal)
3874 MK_OBJN const fmtobj,
3875 size_t const nmemb,
3876 size_t const size
3877);
3878
3884__attribute__ ((alloc_size (2)))
3885__parser__(internal)
3887 MK_OBJN const fmtobj,
3888 size_t const size
3889);
3890
3897 MK_OBJ const fmtobj,
3898 MK_STRN const str
3899);
3900
3907__parser__(internal)
3909 MK_OBJ const fmtobj,
3910 MK_STRN const str,
3911 MK_SIZE const len
3912);
3913
3922 MK_OBJ const fmtobj,
3923 MK_STR const to,
3924 MK_STRN const from,
3925 MK_SIZE const len
3926) __attribute__((nonnull(2)));
3927
3928
3935__attribute__ ((alloc_size (3)))
3936__parser__(internal)
3938 MK_OBJ const fmtobj,
3939 MK_PTR const buf,
3940 size_t const size
3941);
3942
3952__parser__(internal)
3954 MK_OBJN const fmtobj,
3955 MK_PTR const buf,
3956 MK_NUM const oldnum,
3957 MK_NUM const addnum,
3958 size_t const size
3959);
3960
3967__parser__(internal)
3969 MK_OBJN const fmtobj,
3970 MK_PTRN const blck,
3971 size_t const size
3972);
3973
3979__parser__(internal)
3981 MK_OBJN const fmtobj,
3982 MK_STRN_A const strA
3983);
3984
3989__parser__(internal) void MkSysFree (MK_PTR pointer);
3990#define MkSysFree(pointer) \
3991 do { \
3992 if ( likely((pointer) != (NULL)) ) { \
3993 (*MkLal.SysFree)((MK_PTR)pointer); \
3994 (pointer) = (NULL); \
3995 } \
3996 } while (0)
3997
3998__parser__(internal) void MkSysFreeNonNull (MK_PTR pointer);
3999#define MkSysFreeNonNull(pointer) (*MkLal.SysFree)((MK_PTR)pointer)
4000
4006 MK_PTR data
4007);
4008
4031 MK_OBJN fmtobj __parser__(default=NULL),
4032 MK_INT skip __parser__(default=0),
4033 MK_INT const num __parser__(default=-1),
4034 MK_INT const debug __parser__(default=0),
4035 MK_STRN const callfunc __parser__(default=F#FUNC),
4036 MK_INT const lvl __parser__(default=0)
4038
4043__parser__(internal)
4045 MK_OBJ const fmtobj,
4046 const struct MkIdS * idP
4047)
4048{
4049 return (*MkLal.SysWait)(fmtobj, idP);
4050};
4051
4056__parser__(internal)
4058 MK_OBJ const fmtobj,
4059 useconds_t const usec
4060)
4061{
4062 return (*MkLal.SysUSleep)(fmtobj, usec);
4063};
4064
4070 MK_OBJ const fmtobj,
4071 MK_INT const sec
4072)
4073{
4074 return (*MkLal.SysSleep)(fmtobj, (unsigned int)sec);
4075};
4076
4080__attribute__((noreturn)) mk_inline void MkSysExit (
4081 int isThread,
4082 int num
4083)
4084{
4085 (*MkLal.SysExit)(isThread,num);
4086};
4087
4102// [MkSysBasename-example]
4105 MK_STRN const pathName,
4106 bool const includeExtension
4108// [MkSysBasename-example]
4109
4124 MK_STRN const pathName
4126
4140 MK_STRN const format,
4141 ...
4143
4150__parser__(internal)
4152 MK_OBJ const fmtobj,
4153 struct mk_timeval * tv_out,
4154 struct mk_timezone * tz_out
4155);
4156
4163__parser__(keep,doc-no)
4165 MK_OBJ const fmtobj,
4166 MK_INT pid,
4167 MK_INT signal
4168);
4169
4175__parser__(keep,doc-no)
4177 MK_OBJ const fmtobj,
4178 MK_INT * pid_out
4179);
4180
4183 return (str == NULL || *str == '\0');
4184};
4185
4188 return (str != NULL && *str != '\0');
4189};
4190
4192__parser__(internal) bool MkSysStringIsEQUAL (MK_STRN str, MK_STRN other);
4193#define MkSysStringIsEQUAL(str,other) (strcmp(str,other) == 0)
4194
4197 return MkSysStringIsNULL(str) ? NULL : str;
4198};
4199
4202 return str == NULL ? "" : str;
4203};
4204
4245 MK_STRN key,
4246 MK_NUM length,
4247 MK_STR hex
4248);
4249
4251
4334/* ####################################################################### */
4335/* ### ### */
4336/* ### O B J E C T - A P I ### */
4337/* ### ### */
4338/* ####################################################################### */
4339
4380__parser__(global=hide:^Mk\w+Check\M);
4381__parser__(global=hide:^MkObj[A-Z]);
4382__parser__(global=prefix2class:MkObj:MkObjectC);
4383
4386
4387 // TODO !! IMPORTANT INFO ABOUT CHECK !!
4388 // "MkCtxCheckI(context)..." check of "context" create "MkDisasterEvent" after "fDecrSelf" etc…
4389 // Problem in PERL (and propably other too) after "fDecrSelf" the "context" becomes INVALID.
4390 // There are TWO phases of INVALID:
4391 // 1. INVALID but still readable -> "MkCtxCheckI" works
4392 // 2. INVALID but NOT readable -> "MkCtxCheckI" create "MkDisasterEvent"
4393 // It seems that "2." becomes more likely as "context" becomes bigger. "context" becomes bigger
4394 // if more prealloc space is used in "context". seems that if all references to ACTIVE memory is
4395 // gone an entire memory-page becomes "2." -> with other words:
4396 // -> It is not guaranteed that the "MkCtxCheckI" technology will work.
4397
4398#define __MkCheckTO(t,o) (((*o).signature & (*t).objmask) == (*t).objsig)
4399#define _MkCheckTO(t,o) ((o) && __MkCheckTO((t),(o)))
4400#define __MkCheckO(cls,o) (((*o).signature & cls##_MASK) == cls##_SIGNATURE)
4401#define __MkCheckX(cls,x) __MkCheckO(cls,(cls##_X2obj(x)))
4402#define _MkCheckX(cls,x) ((x) && __MkCheckO(cls,(cls##_X2obj(x))))
4403#define __MkCheckM(cls,m) __MkCheckO(cls,((MK_OBJ)(m)))
4404#define _MkCheckM(cls,m) ((m) && __MkCheckM(cls,m))
4405
4406#define MkCheckNN(cls,x) __MkCheckO(cls,(cls##_X2obj(x)))
4407
4408#ifdef __SANITIZE_ADDRESS__
4409 //#define MkSanitizeCheck(_root,_m) _root##_Check(_m)
4410 #define MkSanitizeCheck(_root,_m) _MkCheckM(_root,_m)
4411#else
4412 #define MkSanitizeCheck(_root,_m) _MkCheckM(_root,_m)
4413#endif
4414
4415#define toTT(_type) (MkTYP(_type))
4416
4418
4420#define MK_NULL_SIGNATURE 0
4421
4440
4455
4460
4461#if defined(META_USE_SELF_REFCOUNT)
4471#endif
4472
4475
4478
4482
4483 // attention !! an additional "attribute" have to be initialized in:
4484 // > MkObjInit
4485};
4486
4487// BEGIN-MkObjectS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4488
4489// Signature --------------------------------------------------------------
4492
4493 #define MkObjectC_SIGNATURE (0x59B3u<<16)
4494 #define MkObjectC_MASK (((1u<<16)-1)<<16)
4495
4497
4498// Signature --------------------------------------------------------------
4501
4502 #define MkObjectC_X2obj(x) (x)
4503
4505
4506
4507// TypeDef --------------------------------------------------------------
4510
4512 __parser__(ignore) typedef struct MkObjectS MkObjectCR;
4514 __parser__(ignore) typedef const struct MkObjectS MkObjectCNR;
4516 #define MkObjectC_T (&MK_RT_REF._MkObjectC_T)
4518 #define MkObjectC_TT (MkTYP(MkObjectC_T))
4520 #define MkObjectST MkObjectC_T
4522 #define MkObjectSTT (MkTYP(MkObjectST))
4524 #define MkObjectC_type MK_OBJ
4526 #define MkObjectCT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
4528 #define MkObjectCTT_X(instance) (MkOBJ_R(instance).type)
4530 #define MkObjectCT_TT(typ) ( (struct MkDefTypeS *) (typ) )
4532 #define MkObjectC_NS MK
4534 #define MkObjectCTT MkObjectCTT
4536 #define MkObjectCT ( (struct MkDefTypeS *) MkObjectCTT )
4537
4539
4540
4541// TypeCheck --------------------------------------------------------------
4544
4545 #pragma GCC diagnostic push
4546 #pragma GCC diagnostic ignored "-Wattributes"
4547
4550 __parser__(class=MkObjectC,static,hide)
4552 return MkSanitizeCheck(MkObjectC,mng);
4553 }
4554
4555 #pragma GCC diagnostic pop
4556 #define MkObjectC_Check(mng) MkObjCheck(mng)
4557
4559
4560
4561// ObjectCast --------------------------------------------------------------
4565 __parser__push__(prefix=Cast);
4566
4568 __parser__(class=MkObjectC,hide,static)
4569 META_ATTRIBUTE_SANITIZE
4571 return (MkObjCheck(mng) ? (MK_OBJ)mng : NULL);
4572 }
4573
4575 __parser__(ignore)
4576 META_ATTRIBUTE_SANITIZE
4578 return (MkObjCheck(mng) ? (MK_OBJN)mng : NULL);
4579 }
4580
4582 #define MkObjRaise(_obj) if (!_MkCheckX(MkObjectC,_obj)) { \
4583 MkErrorSetC_1E("'MkObjectC' hdl is NULL"); \
4584 goto error ; \
4585 }
4586
4588 #define MkOBJ_R(x) (*(x)).super.obj
4590 #define MkOBJ(x) (&MkOBJ_R(x))
4591
4594
4595// END-MkObjectS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4596
4600typedef void (*MkDestructorF) ( MK_RT_ARGS MK_OBJ const obj);
4601typedef MK_OBJ (*MkDupF) ( MK_RT_ARGS MK_OBJ const obj);
4602typedef MK_OBJ (*MkDup2F) ( MK_RT_ARGS MK_OBJ const obj, MK_STRN const ident);
4603typedef MK_OBJ (*MkMergeF) ( MK_RT_ARGS MK_OBJ const obj);
4604typedef MK_OBJ (*MkCopyF) ( MK_RT_ARGS MK_OBJ const obj, MK_OBJN const src);
4605typedef void (*MkResetF) ( MK_RT_ARGS MK_OBJ const obj);
4606__parser__(flags=public-internal)
4607typedef MK_PTR (*MkSelfCreateF) ( MK_RT_ARGS MK_OBJ const obj, MK_PTR const env);
4608__parser__(flags=public-internal)
4609typedef void (*MkSelfDeleteF) ( MK_RT_ARGS MK_PTR self, MK_PTR const env);
4610__parser__(flags=public-internal)
4611typedef void (*MkSelfUnlinkF) ( MK_RT_ARGS MK_PTR self, MK_PTR const env);
4612typedef void (*MkLogF) ( MK_RT_ARGS MK_OBJN const obj, MK_OBJ fmt, MK_INT const debug,
4613 MK_STRN const prefix, MK_INT const lvl);
4614typedef MK_STRN (*MkToStringF) ( MK_RT_ARGS MK_OBJN const obj);
4616typedef void (*MkAllocDeleteF) ( MK_RT_ARGS MK_TYP const type, MK_PTR ptr);
4617typedef void (*MkTypeInitF) ( MK_RT_ARGS MK_TYP const type);
4618typedef bool (*MkLogFormatF) ( MK_RT_ARGS char* header, MK_SIZE const headerSize, MK_OBJN const obj,
4619 MK_STRN const caller, MK_INT const debug, MK_STRN const fmt);
4621
4633__parser__(ignore)
4639
4744__parser__(ignore)
4745struct MkTypeS {
4746 // BEGIN-MkTypeS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4747 union {
4748 struct MkObjectS obj; // base CLASS \MkObjectS
4749 } super;
4750 // END-MkTypeS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4751
4752 // instance attributes
4753 #define MkTypeS_name_size 32
4757 bool noSelf;
4759 size_t objsize;
4760 size_t typsize;
4761
4764
4765 // slots
4779
4780 struct MkAllocDefS objalloc;
4782};
4783
4784// BEGIN-MkTypeS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4785
4786// Signature --------------------------------------------------------------
4789
4790 #define MkTypeC_SIGNATURE (MkObjectC_SIGNATURE ^ (10u<<10))
4791 #define MkTypeC_MASK (((1u<<22)-1)<<10)
4792
4794
4795// Signature --------------------------------------------------------------
4798
4799 #define MkTypeC_X2typ(x) (x)
4800 #define MkTypeC_X2obj(x) MkOBJ(x)
4801
4803
4804
4805// TypeDef --------------------------------------------------------------
4808
4810 __parser__(ignore) typedef struct MkTypeS MkTypeCR;
4812 __parser__(ignore) typedef const struct MkTypeS MkTypeCNR;
4814 #define MkTypeSTT (&MK_RT_REF._MkTypeC_TT)
4816 #define MkTypeC_TT (&MK_RT_REF._MkTypeC_TT)
4818 #define MkTypeC_type MK_TYP
4820 #define MkTypeCT_X(instance) ( (struct MkTypeS *) (MkOBJ_R(instance).type) )
4822 #define MkTypeCTT_X(instance) (MkOBJ_R(instance).type)
4824 #define MkTypeCT_TT(typ) ( (struct MkTypeS *) (typ) )
4826 #define MkTypeC_NS MK
4828 #define MkTypeCTT MkTypeCTT
4830 #define MkTypeCT ( (struct MkTypeS *) MkTypeCTT )
4831
4833
4834
4835// TypeCheck --------------------------------------------------------------
4838
4839 #pragma GCC diagnostic push
4840 #pragma GCC diagnostic ignored "-Wattributes"
4841
4844 __parser__(class=MkTypeC,static,ignore)
4846 return MkSanitizeCheck(MkTypeC,mng);
4847 }
4848
4849 #pragma GCC diagnostic pop
4850 #define MkTypeC_Check(mng) MkTypCheck(mng)
4851
4853
4854// END-MkTypeS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4855
4857__parser__(class=MkObjectC,internal,static)
4859 if (!MkObjCheck(mng)) return NULL;
4860 MK_OBJ obj = (MK_OBJ) mng;
4861 if (MkTypCheck(obj)) return (MK_TYP)obj;
4862 MK_TYP typ = obj->type;
4863 if (MkTypCheck(typ)) return typ;
4864 return NULL;
4865}
4866
4868__parser__(ignore)
4870 if (!MkObjCheck(mng)) return NULL;
4871 MK_OBJ obj = (MK_OBJ) mng;
4872 if (MkTypCheck(obj)) return (MK_TYPN)obj;
4873 MK_TYPN typ = obj->type;
4874 if (MkTypCheck(typ)) return typ;
4875 return NULL;
4876}
4877
4879#define MkTYP_R(x) (*(x)).super.typ
4881#define MkTYP(x) (&MkTYP_R(x))
4882
4884__parser__(ignore)
4886 // BEGIN-MkDefTypeS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4887 union {
4888 struct MkObjectS obj; // base CLASS \MkObjectS
4889 struct MkTypeS typ; // base CLASS \MkTypeS
4891 // END-MkDefTypeS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4892};
4893
4894// BEGIN-MkDefTypeS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4895
4896// Signature --------------------------------------------------------------
4899
4900 #define MkDefTypeC_SIGNATURE (MkTypeC_SIGNATURE ^ (1u<<6))
4901 #define MkDefTypeC_MASK (((1u<<26)-1)<<6)
4902
4904
4905// Signature --------------------------------------------------------------
4908
4909 #define MkDefTypeC_X2typ(x) MkTYP(x)
4910 #define MkDefTypeC_X2obj(x) MkOBJ(x)
4911
4913
4914
4915// TypeDef --------------------------------------------------------------
4918
4920 __parser__(ignore) typedef struct MkDefTypeS MkDefTypeCR;
4922 __parser__(ignore) typedef const struct MkDefTypeS MkDefTypeCNR;
4924 #define MkDefTypeSTT (&MK_RT_REF._MkDefTypeC_TT)
4926 #define MkDefTypeC_TT (&MK_RT_REF._MkDefTypeC_TT)
4928 #define MkDefTypeCT_X(instance) ( (struct MkTypeS *) (MkOBJ_R(instance).type) )
4930 #define MkDefTypeCTT_X(instance) (MkOBJ_R(instance).type)
4932 #define MkDefTypeCT_TT(typ) ( (struct MkTypeS *) (typ) )
4934 #define MkDefTypeC_NS MK
4936 #define MkDefTypeCTT MkDefTypeCTT
4938 #define MkDefTypeCT ( (struct MkTypeS *) MkDefTypeCTT )
4939
4941
4942// END-MkDefTypeS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
4943
4945__parser__(internal)
4946MK_EXTERN MK_PTR MK_DECL MkTypeSlotResolveP(MK_RT_ARGS MK_TYPN const type, size_t const offset, bool const force);
4947
4962#define MkTypeSlotResolve(tt,fptr,force) ( \
4963 tt == NULL ? NULL : /* type not valid */ \
4964 !force && tt->fptr == (MK_PTR) 0x1 ? NULL : /* already resolved, NOT found */ \
4965 tt->fptr > (typeof(tt->fptr)) 0x1 ? tt->fptr : /* already resolved, found */ \
4966 tt == MkTypeSTT ? NULL : /* already at the ROOT of the type */ \
4967 (typeof(tt->fptr)) MkTypeSlotResolveP(MK_RT_CALL tt, offsetof(struct MkTypeS, fptr), force) \
4968) \
4969
4971
4972
4973// #######################################################################
4974// -----------------------------------------------------------------------
4980
4981__parser__push__(doc=TOR);
4982
4993#if defined(META_USE_SELF_REFCOUNT)
4994 #define MkObjInit2(rtmkV,rtExtV,sigV,typeV,refCountV,isLocalV) \
4995 (struct MkObjectS) { \
4996 .signature = sigV, \
4997 .refCount = refCountV, \
4998 .self = NULL, \
4999 .type = typeV, \
5000 .env = NULL, \
5001 .selfCreated = false, \
5002 .selfRefCount = 0, \
5003 .objRt = rtmkV, \
5004 .objRtExt = rtExtV, \
5005 .obj_protect = { \
5006 .isLocal = isLocalV, \
5007 .prev = NULL, \
5008 .next = NULL, \
5009 }, \
5010 }
5011#else
5012 #define MkObjInit2(rtmkV,rtExtV,sigV,typeV,refCountV,isLocalV) \
5013 (struct MkObjectS) { \
5014 .signature = sigV, \
5015 .refCount = refCountV, \
5016 .self = NULL, \
5017 .type = typeV, \
5018 .env = NULL, \
5019 .selfCreated = false, \
5020 .objRt = rtmkV, \
5021 .objRtExt = rtExtV, \
5022 .obj_protect = { \
5023 .isLocal = isLocalV, \
5024 .prev = NULL, \
5025 .next = NULL, \
5026 }, \
5027 }
5028#endif
5029
5030#define MkObjInit(rtmkV,rtExtV,cls,refCountV,isLocalV) \
5031 MkObjInit2(rtmkV,rtExtV,cls##_SIGNATURE,cls##_TT,refCountV,isLocalV)
5032
5033#define MkObjInitFromType(typeV,isLocalV) \
5034 MkObjInit2(MK_RT_PTR, NULL, (*typeV).objsig, typeV, 0, isLocalV)
5035
5036#define MkObjInitFromInstance(instV) \
5037 MkObjInit2(MK_RT_PTR, NULL, MkOBJ_R(instV).type->objsig, MkOBJ_R(instV).type, 0, false)
5038
5054 MK_OBJ const srcobj
5056
5068 MK_OBJ const srcmng,
5069 MK_STRN const ident
5071
5089 MK_OBJ const obj
5091
5098__parser__(constructor)
5101 MK_TYP type __parser__(internal,default=NULL),
5102 MK_PTR nat,
5103 MK_PTR lnk
5104);
5105
5106// *******************************************************************************
5107// PUBLIC object API
5108// *******************************************************************************
5109
5128__parser__(destructor,keep-destr)
5131 MK_OBJ obj
5133
5134#define MkObjectDelete_NULL(obj) MkObjectDeleteToNull(MkObjectDelete_RT,obj)
5135#define MkObjectDelete_NULL_X(x) MkObjectDeleteToNull_X(MkObjectDelete_RT,x)
5136#define MkObjectDelete_1X(x) MkObjectDeleteToNull_X(MkObjectDelete_RT,x)
5137
5138#define MkObjectDeleteToNull(fct,x) if (x) { fct (MK_RT_CALL x); (x) = NULL ; }
5139#define MkObjectDeleteToNull_X(fct,x) if (x) { fct (MK_RT_CALL MkOBJ(x)); (x) = NULL ; }
5140
5156__parser__(destructor,lng-destr,lng-dispose)
5159 MK_OBJ obj
5161
5162#define MkObjectDispose_NULL(obj) MkObjectDeleteToNull(MkObjectDispose_RT,obj)
5163#define MkObjectDispose_NULL_X(x) MkObjectDeleteToNull_X(MkObjectDispose_RT,x)
5164#define MkObjectDispose_1X(x) MkObjectDispose_RT(MkOBJ(x))
5165
5166__parser__pop__; // TOR
5167
5169
5170/* ####################################################################### */
5171/* ### ### */
5172/* ### O B J - A P I ### */
5173/* ### ### */
5174/* ####################################################################### */
5175
5243// ***********************************************************************************************
5244
5245
5253 MK_OBJ const tgtmng,
5254 MK_OBJN const srcmng
5256
5262 MK_OBJ const obj
5264
5265// ****************************************************************************************************
5266
5271
5272__parser__(global=hide:^MkRef);
5273__parser__(global=pattern2prefix:MkRef:MkObj);
5274
5276#define MkRefLOCK 999999
5277
5280__parser__(static)
5282 if (obj) ++(*obj).refCount;
5283}
5284
5285#define MkRefIncr_1X(x) MkRefIncr(MkOBJ(x))
5286#define MkRefIncr_1M(m) MkRefIncr(MkObj(m))
5287
5301#define MkRefIncr_FX(x) MkRefIncr(MkOBJ(x))
5302
5311__parser__(static)
5314 MK_OBJ obj
5316
5317#define MkRefDecr_O(o) do { MkRefDecr_RT(MK_RT_CALL o); o=NULL; } while (0)
5318#define MkRefDecr_X(x) do { MkRefDecr_RT(MK_RT_CALL MkOBJ(x)); x=NULL; } while (0)
5319#define MkRefDecr_X_NULL(x) do { MkRefDecr_RT(MK_RT_NULL MkOBJ(x)); x=NULL; } while (0)
5320#define MkRefDecr_M(m) do { MkRefDecr_RT(MK_RT_CALL MkObj(m)); m=NULL; } while (0)
5321#define MkRefDecr_M_NULL(m) do { MkRefDecr_RT(MK_RT_NULL MkObj(m)); m=NULL; } while (0)
5322
5324#define MkRefDecr_FX(x) do { --(MkOBJ_R(x).refCount); } while(0)
5325
5334mk_inline void MkRefIncrSelf( MK_OBJ const obj, MK_PTR const self, MK_PTR const env) {
5336 obj->refCount++;
5337 obj->self = self;
5338 obj->env = env;
5339}
5340
5341#define MkRefIncrSelf_2X(x,s) MkRefIncrSelf(MkOBJ(x),s)
5342
5359 MK_OBJ const obj
5361
5362#define MkRefDecrWithoutSelf_NULL(o) MkRefDecrWithoutSelf_RT(MK_RT_NULL o)
5363
5368__parser__(keep,doc-no)
5372 return (*obj).refCount;
5373}
5374
5375#define MkRefGet_1X(x) MkRefGet(MkOBJ(x))
5376
5382 return (*obj).refCount=MkRefLOCK;
5383}
5384#define MkRefLock_1X(x) MkRefLock(MkOBJ(x))
5385
5392 return (*obj).refCount >= MkRefLOCK;
5393}
5394#define MkRefIsLocked_1X(x) MkRefIsLocked(MkOBJ(x))
5395
5397#define MkRefSet(target,source) ({ \
5398 if (target != source) { \
5399 typeof(target) targetSave=target; \
5400 target = source;\
5401 MkRefDecr_X(targetSave);\
5402 MkRefIncr_1X(target);\
5403 } \
5404 target;\
5405})
5406
5409
5410#define MkRefCidN_NULL() MkRefCidN_RT(MK_RT_CALL_NULL_ONLY)
5411
5413
5414// *******************************************************************************
5415
5416__parser__(global=hide:^MkSelf);
5417__parser__(global=pattern2prefix:MkSelf:MkObj);
5418
5421
5427mk_inline void MK_DECL MkSelfSet ( MK_OBJ const obj, MK_PTR const self, MK_PTR const env ) {
5429 obj->env = env;
5430 obj->self = (obj->type->noSelf ? NULL : self);
5431} ;
5432
5433#define MkSelfSet_3X(x,self,env) MkSelfSet(MkOBJ(x),self,env)
5434
5439 // BUF FIX - 1 mar 2023: remove nonnull on obj because C# require this
5440 return obj ? obj->self : NULL;
5441} ;
5442
5443#define MkSelfGet_1X(x) MkSelfGet(MkOBJ(x))
5444
5471 MK_OBJ obj,
5472 MK_PTR *self_out,
5473 MK_PTR const env
5474);
5475
5476#define MkSelfNew_3X(x,self_out,env) MkSelfNew(MkOBJ(x),self_out,env)
5477
5478#define MkSelfNew_NULL(...) MkSelfNew_RT(MK_RT_NULL __VA_ARGS__)
5479
5488__parser__(static)
5491 MK_OBJ const obj,
5492 MK_PTR const env
5494
5495#define MkSelfCreate_2X(x,env) MkSelfCreate(MkOBJ(x),env)
5496
5505__parser__(static)
5508 MK_OBJ const obj
5510
5511#define MkSelfDelete_1X(x) MkSelfDelete_RT(MK_RT_CALL MkOBJ(x))
5512
5529__parser__(static)
5532 MK_OBJ obj
5534
5535#define MkSelfDeleteForce_1X(x) MkSelfDeleteForce(MkOBJ(x))
5536
5553__parser__(static)
5556 MK_OBJ obj
5558
5559#define MkSelfUnlink_1X(x) MkSelfUnlink(MkOBJ(x))
5560
5562
5563// ****************************************************************************************************
5564
5565__parser__(global=pattern2prefix:MkType:MkObj);
5566
5571
5586__parser__(internal,macro)
5587MK_TYP MkTypeCreate ( MK_MACRO_TYP const cls, MK_MACRO_TYP const basic, MK_STRN const ident);
5588#define MkTypeCreate(clsV, basicV, identV) ({ \
5589 MK_TYP ret = MkTypeDup2(basicV ## _TT,identV); \
5590 ret->objsig = clsV ## _SIGNATURE; \
5591 ret->objmask = clsV ## _MASK; \
5592 ret->objsize = sizeof(clsV##R); \
5593 ret ; \
5594})
5595
5609__parser__(internal)
5612 MK_TYPN const typ,
5613 MK_STRN const ident
5615
5626__parser__(internal)
5629 MK_TYPN const typ
5631
5640__parser__(internal)
5643 MK_TYPN const typ
5645
5649__parser__(internal)
5652 MK_TYP const typ
5654
5665__parser__(internal,const,flags=new)
5668 MK_TYPN const typ ,
5669 MK_OBJN fmtobj __parser__(default=NULL),
5670 MK_DBG const debug __parser__(default=0),
5671 MK_STRN const callfunc __parser__(default=F#FUNC),
5672 MK_INT const lvl __parser__(default=0)
5674
5676
5678
5679// ##################################################################################
5684
5694 MK_OBJN const obj
5696
5697#define MkObjectToName_1X(x) MkObjectToName(MkOBJ(x))
5698
5715 MK_OBJN const obj
5717
5718//2021.03.01 ao → #define MkObjectToNameOfType(o) MkObjectToNameOfType((MK_OBJ)(o))
5719#define MkObjectToNameOfType_1X(x) MkObjectToNameOfType(MkOBJ(x))
5720
5731__parser__(template-overload)
5734 MK_OBJ const obj
5736
5737#define MkObjectToNameOfClass_1X(x) MkObjectToNameOfClass_RT(MK_RT_CALL MkOBJ(x))
5738
5750 MK_OBJN const obj
5752
5753#define MkObjectToString_1X(x) MkObjectToString(MkOBJ(x))
5754#define MkObjectToString_1M(m) MkObjectToString(MkObjN(m))
5755
5763__parser__(no-rpc)
5766 return ((MK_LONG)obj);
5767}
5768
5769#define MkObjectToHandle_1X(x) MkObjectToHandle(MkOBJ(x))
5770
5776__parser__(no-rpc)
5778 return MkObj((MK_MNG)exporthdl) ;
5779}
5780
5782
5783// #######################################################################
5784// -----------------------------------------------------------------------
5810
5811/* ####################################################################### */
5812/* ### ### */
5813/* ### L O G - A P I ### */
5814/* ### ### */
5815/* ####################################################################### */
5816
5830
5831__parser__push__(doc=Log);
5832
5848__parser__(no-type-extension)
5851 MK_OBJN fmtobj __parser__(default=NULL),
5852 MK_STRN const message,
5853 MK_DBG const debug __parser__(default=0),
5854 MK_STRN const callfunc __parser__(default=F#FUNC)
5856
5857#define MkLogC_4X(x,message,debug,callfunc) MkLogC(MkOBJ(x),message,debug,callfunc)
5858#define MkLogC_3X(x,message,debug) MkLogC_3(MkOBJ(x),message,debug)
5859#define MkLogC_2X(x,message) MkLogC_2(MkOBJ(x),message)
5860#define MkLogW(x,callfunc,_debug,message) MkLogC(MkOBJ(x),message,_debug,callfunc)
5861
5873 MK_OBJN fmtobj __parser__(default=NULL),
5874 MK_STRN const callfunc __parser__(default=F#FUNC),
5875 MK_DBG debug __parser__(default=0),
5876 MK_FST const printfmt,
5877 ...
5879
5880#define MkLogV_lvl(x,debug,printfmt,...) MkLogV(MkOBJ(x),__func__,debug,printfmt,__VA_ARGS__)
5881
5882#define MkLogV_4M(x,callfunc,debug,printfmt,...) MkLogV(MkObjN(x),callfunc,debug,printfmt,__VA_ARGS__)
5883#define MkLogV_4X(x,callfunc,debug,printfmt,...) MkLogV(MkOBJ(x),callfunc,debug,printfmt,__VA_ARGS__)
5884#define MkLogV_3X(x,callfunc,printfmt,...) MkLogV_3(MkOBJ(x),callfunc,printfmt,__VA_ARGS__)
5885#define MkLogV_2X(x,printfmt,...) MkLogV_2(MkOBJ(x),printfmt,__VA_ARGS__)
5886
5899 MK_OBJN fmtobj __parser__(default=NULL),
5900 MK_STRN const callfunc __parser__(default=F#FUNC),
5901 MK_DBG debug __parser__(default=0),
5902 MK_FST const printfmt,
5903 va_list var_list
5905
5906#define MkLogVL_5X(fmtobj,callfunc,debug,printfmt,var_list) \
5907 MkLogVL(MkOBJ(fmtobj),callfunc,debug,printfmt,var_list)
5908
5909#if defined(META_DISABLE_LOG)
5910# define MkDCheck(_debug)
5911# define MkDLogC(x,_debug,str)
5912# define MkDLogV(x,_debug,printfmt,...)
5913#else
5914
5915 #define MkDDInit const MK_INT __dbg = MK_RT_REF.debug
5916 #define MkDDInitNum(n) const MK_INT __dbg = n
5917
5921# define MkDCheck(_debug) if (unlikely(MK_RT_REF.debug >= _debug))
5922# define MkDDCheck(_debug) if (unlikely(__dbg >= _debug))
5924
5930# define MkDLogC_O(fmtobj,_debug,str) \
5931 if (unlikely(MK_RT_REF.debug >= _debug)) MkLogC(fmtobj,str,_debug,__func__)
5932
5933# define MkDLogC(x,_debug,str) MkDLogC_O(MkOBJ(x),_debug,str)
5934
5935# define MkDDLogC(x,_debug,str) \
5936 if (unlikely(__dbg >= _debug)) MkLogC_4X(x,str,_debug,__func__)
5938
5945# define MkDLogV_O(fmtobj,_debug,printfmt,...) \
5946 if (unlikely(MK_RT_REF.debug >= _debug)) MkLogV(fmtobj,__func__,_debug,printfmt,__VA_ARGS__)
5947
5948# define MkDLogV(x,_debug,printfmt,...) MkDLogV_O(MkOBJ(x),_debug,printfmt,__VA_ARGS__)
5949
5950# define MkDDLogV(fmtobj,_debug,printfmt,...) \
5951 if (unlikely(__dbg >= _debug)) MkLogV_4M(fmtobj,__func__,_debug,printfmt,__VA_ARGS__)
5953
5954#endif
5955
5964 MK_OBJN fmtobj __parser__(default=NULL),
5965 MK_STRN const callfunc __parser__(default=F#FUNC),
5966 MkBinaryR const data
5968
5969#define MkLogHEX_4X(fmtobj,callfunc,data,len) MkLogHEX_RT(MkOBJ(fmtobj),callfunc,data,len)
5970
5981__parser__(const)
5984 MK_OBJN const obj ,
5985 MK_OBJN fmtobj __parser__(default=NULL),
5986 MK_DBG const debug __parser__(default=0),
5987 MK_STRN const callfunc __parser__(default=F#FUNC),
5988 MK_INT const lvl __parser__(default=0)
5990
5991#define MkObjectLogSimple_1X(x) MkObjectLogSimple(MkOBJ(x),NULL,0,__func__,0)
5992
6003__parser__(const)
6006 MK_OBJN const obj,
6007 MK_OBJN fmtobj __parser__(default=NULL),
6008 MK_DBG const debug __parser__(default=0),
6009 MK_STRN const callfunc __parser__(default=F#FUNC),
6010 MK_INT const lvl __parser__(default=0)
6012
6013#define MkObjectLogDetail_1X(x) MkObjectLogDetail(MkOBJ(x),NULL,0,__func__,0)
6014#define MkObjectLogDetail_1M(m) MkObjectLogDetail(MkObj(m),NULL,0,__func__,0)
6015
6032 MK_OBJN const obj,
6033 MK_OBJ fmtobj __parser__(default=NULL),
6034 MK_DBG const debug __parser__(default=0),
6035 MK_STRN const callfunc __parser__(default=F#FUNC),
6036 MK_INT const lvl __parser__(default=0)
6038
6039#define MkObjectLog_1X(x) MkObjectLog(MkOBJ(x),NULL,0,__func__,0)
6040
6042
6044
6045/* ####################################################################### */
6046/* ### ### */
6047/* ### D B G - A P I ### */
6048/* ### ### */
6049/* ####################################################################### */
6050
6058
6059__parser__(global=prefix2class:MkDbg:MkObjectC);
6060
6064__parser__(no-type-extension)
6067 MK_OBJN fmtobj __parser__(default=NULL),
6068 MK_STRN const message,
6069 MK_DBG const debug __parser__(default=0),
6070 MK_STRN const callfunc __parser__(default=F#FUNC),
6071 MK_INT const lvl __parser__(default=0)
6073
6074#define MkDbgL_2M(x,message) MkDbgL(MkObj(x),message,0,__func__,-1)
6075
6079__parser__(no-type-extension,template-overload)
6082 MK_OBJN const obj,
6083 MK_STRN const message __parser__(default=S#"var"),
6084 MK_STRN const callfunc __parser__(default=F#FUNC)
6086
6087#define MkDbgDump_2M(x,message) MkDbgDump_2(MkObj(x),message)
6088
6092 MK_STRN const message ,
6093 MK_DBG const debug __parser__(default=0),
6094 MK_STRN const callfunc __parser__(default=F#FUNC),
6095 MK_INT const lvl __parser__(default=0)
6097
6101 MK_OBJN const fmtobj,
6102 MK_INT const skip __parser__(default=0),
6103 MK_INT const num __parser__(default=-1),
6104 MK_STRN const callfunc __parser__(default=F#FUNC)
6106
6107#define MkDbgSTACK_3X(x,num,callfunc) MkDbgSTACK_3(MkOBJ(x),num,callfunc)
6108
6116__parser__(no-type-extension)
6119 MK_OBJN const obj,
6120 MK_STRN const callfunc __parser__(default=F#FUNC)
6122
6123#define MkDbgO_2X(x,callfunc) MkDbgO(MkOBJ(x),callfunc)
6124#define MkDbgO_1X(x) MkDbgO_2X(x,__func__)
6125
6127__parser__(no-type-extension)
6130 MK_OBJN const obj,
6131 MK_STRN const callfunc __parser__(default=F#FUNC)
6133
6135#define MkDbgLogC_2X(x,callfunc) MkDbgLogC_2(MkOBJ(x),callfunc)
6136
6138
6139/* MARK_B ################################################################ */
6140/* ### ### */
6141/* ### B U F F E R - A P I ### */
6142/* ### ### */
6143/* ####################################################################### */
6144
6169
6193// [MkBufferS_example]
6195 // BEGIN-MkBufferS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6196 union {
6197 struct MkObjectS obj; // base CLASS \MkObjectS
6199 // END-MkBufferS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6200
6201 // instance attributes
6202 struct {
6206 // instance storage
6207 struct {
6217 #define MkBufferS_ils_size 0
6219};
6220
6221// BEGIN-MkBufferS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6222
6223// Signature --------------------------------------------------------------
6226
6227 #define MkBufferC_SIGNATURE (MkObjectC_SIGNATURE ^ (1u<<10))
6228 #define MkBufferC_MASK (((1u<<22)-1)<<10)
6229
6231
6232// Signature --------------------------------------------------------------
6235
6236 #define MkBufferC_X2buf(x) (x)
6237 #define MkBufferC_X2obj(x) MkOBJ(x)
6238
6240
6241
6242// TypeDef --------------------------------------------------------------
6245
6247 __parser__(ignore) typedef struct MkBufferS MkBufferCR;
6249 __parser__(ignore) typedef const struct MkBufferS MkBufferCNR;
6251 #define MkBufferC_T (&MK_RT_REF._MkBufferC_T)
6253 #define MkBufferC_TT (MkTYP(MkBufferC_T))
6255 #define MkBufferST MkBufferC_T
6257 #define MkBufferSTT (MkTYP(MkBufferST))
6259 #define MkBufferC_type MK_BUF
6261 #define MkBufferCT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
6263 #define MkBufferCTT_X(instance) (MkOBJ_R(instance).type)
6265 #define MkBufferCT_TT(typ) ( (struct MkDefTypeS *) (typ) )
6267 #define MkBufferC_NS MK
6269 #define MkBufferCTT MkBufferCTT
6271 #define MkBufferCT ( (struct MkDefTypeS *) MkBufferCTT )
6272
6274
6275
6276// TypeCheck --------------------------------------------------------------
6279
6280 #pragma GCC diagnostic push
6281 #pragma GCC diagnostic ignored "-Wattributes"
6282
6285 __parser__(class=MkBufferC,static,hide)
6287 return MkSanitizeCheck(MkBufferC,mng);
6288 }
6289
6290 #pragma GCC diagnostic pop
6291 #define MkBufferC_Check(mng) MkBufCheck(mng)
6292
6294
6295
6296// ObjectCast --------------------------------------------------------------
6300 __parser__push__(prefix=Cast);
6301
6303 __parser__(class=MkBufferC,hide,static)
6304 META_ATTRIBUTE_SANITIZE
6306 return (MkBufCheck(mng) ? (MK_BUF)mng : NULL);
6307 }
6308
6310 __parser__(ignore)
6311 META_ATTRIBUTE_SANITIZE
6313 return (MkBufCheck(mng) ? (MK_BUFN)mng : NULL);
6314 }
6315
6317 #define MkBufRaise(_buf) if (!_MkCheckX(MkBufferC,_buf)) { \
6318 MkErrorSetC_1E("'MkBufferC' hdl is NULL"); \
6319 goto error ; \
6320 }
6321
6323 #define MkBUF_R(x) (*(x)).super.buf
6325 #define MkBUF(x) (&MkBUF_R(x))
6326
6329
6330// END-MkBufferS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6331// [MkBufferS_example]
6332
6334
6335// #######################################################################
6336// -----------------------------------------------------------------------
6342
6350__parser__(ignore)
6352 // BEGIN-MkBuffer64S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6353 union {
6354 struct MkObjectS obj; // base CLASS \MkObjectS
6355 struct MkBufferS buf; // base CLASS \MkBufferS
6357 // END-MkBuffer64S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6358
6359 // instance attributes
6360#define MkBuffer64S_ils_size (64)
6362};
6363
6364// BEGIN-MkBuffer64S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6365
6366// Signature --------------------------------------------------------------
6369
6370 #define MkBuffer64C_SIGNATURE (MkBufferC_SIGNATURE ^ (1u<<6))
6371 #define MkBuffer64C_MASK (((1u<<26)-1)<<6)
6372
6374
6375// Signature --------------------------------------------------------------
6378
6379 #define MkBuffer64C_X2buf(x) MkBUF(x)
6380 #define MkBuffer64C_X2obj(x) MkOBJ(x)
6381
6383
6384
6385// TypeDef --------------------------------------------------------------
6388
6390 __parser__(ignore) typedef struct MkBuffer64S MkBuffer64CR;
6392 __parser__(ignore) typedef const struct MkBuffer64S MkBuffer64CNR;
6394 #define MkBuffer64C_T (&MK_RT_REF._MkBuffer64C_T)
6396 #define MkBuffer64C_TT (MkTYP(MkBuffer64C_T))
6398 #define MkBuffer64ST MkBuffer64C_T
6400 #define MkBuffer64STT (MkTYP(MkBuffer64ST))
6402 #define MkBuffer64CT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
6404 #define MkBuffer64CTT_X(instance) (MkOBJ_R(instance).type)
6406 #define MkBuffer64CT_TT(typ) ( (struct MkDefTypeS *) (typ) )
6408 #define MkBuffer64C_NS MK
6410 #define MkBuffer64CTT MkBuffer64CTT
6412 #define MkBuffer64CT ( (struct MkDefTypeS *) MkBuffer64CTT )
6413
6415
6416// END-MkBuffer64S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6417
6419
6420// #######################################################################
6421// -----------------------------------------------------------------------
6426
6430__parser__(ignore)
6432 // BEGIN-MkBuffer256S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6433 union {
6434 struct MkObjectS obj; // base CLASS \MkObjectS
6435 struct MkBufferS buf; // base CLASS \MkBufferS
6437 // END-MkBuffer256S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6438
6439 // instance attributes
6440#define MkBuffer256S_ils_size (256)
6442};
6443
6444// BEGIN-MkBuffer256S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6445
6446// Signature --------------------------------------------------------------
6449
6450 #define MkBuffer256C_SIGNATURE (MkBufferC_SIGNATURE ^ (2u<<6))
6451 #define MkBuffer256C_MASK (((1u<<26)-1)<<6)
6452
6454
6455// Signature --------------------------------------------------------------
6458
6459 #define MkBuffer256C_X2buf(x) MkBUF(x)
6460 #define MkBuffer256C_X2obj(x) MkOBJ(x)
6461
6463
6464
6465// TypeDef --------------------------------------------------------------
6468
6470 __parser__(ignore) typedef struct MkBuffer256S MkBuffer256CR;
6472 __parser__(ignore) typedef const struct MkBuffer256S MkBuffer256CNR;
6474 #define MkBuffer256C_T (&MK_RT_REF._MkBuffer256C_T)
6476 #define MkBuffer256C_TT (MkTYP(MkBuffer256C_T))
6478 #define MkBuffer256ST MkBuffer256C_T
6480 #define MkBuffer256STT (MkTYP(MkBuffer256ST))
6482 #define MkBuffer256CT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
6484 #define MkBuffer256CTT_X(instance) (MkOBJ_R(instance).type)
6486 #define MkBuffer256CT_TT(typ) ( (struct MkDefTypeS *) (typ) )
6488 #define MkBuffer256C_NS MK
6490 #define MkBuffer256CTT MkBuffer256CTT
6492 #define MkBuffer256CT ( (struct MkDefTypeS *) MkBuffer256CTT )
6493
6495
6496// END-MkBuffer256S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6497
6499
6500// #######################################################################
6501// -----------------------------------------------------------------------
6507
6511__parser__(ignore)
6513 // BEGIN-MkBuffer1024S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6514 union {
6515 struct MkObjectS obj; // base CLASS \MkObjectS
6516 struct MkBufferS buf; // base CLASS \MkBufferS
6518 // END-MkBuffer1024S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6519
6520 // instance attributes
6521#define MkBuffer1024S_ils_size (1024)
6523};
6524
6525// BEGIN-MkBuffer1024S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6526
6527// Signature --------------------------------------------------------------
6530
6531 #define MkBuffer1024C_SIGNATURE (MkBufferC_SIGNATURE ^ (3u<<6))
6532 #define MkBuffer1024C_MASK (((1u<<26)-1)<<6)
6533
6535
6536// Signature --------------------------------------------------------------
6539
6540 #define MkBuffer1024C_X2buf(x) MkBUF(x)
6541 #define MkBuffer1024C_X2obj(x) MkOBJ(x)
6542
6544
6545
6546// TypeDef --------------------------------------------------------------
6549
6553 __parser__(ignore) typedef const struct MkBuffer1024S MkBuffer1024CNR;
6555 #define MkBuffer1024C_T (&MK_RT_REF._MkBuffer1024C_T)
6557 #define MkBuffer1024C_TT (MkTYP(MkBuffer1024C_T))
6559 #define MkBuffer1024ST MkBuffer1024C_T
6561 #define MkBuffer1024STT (MkTYP(MkBuffer1024ST))
6563 #define MkBuffer1024CT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
6565 #define MkBuffer1024CTT_X(instance) (MkOBJ_R(instance).type)
6567 #define MkBuffer1024CT_TT(typ) ( (struct MkDefTypeS *) (typ) )
6569 #define MkBuffer1024C_NS MK
6571 #define MkBuffer1024CTT MkBuffer1024CTT
6573 #define MkBuffer1024CT ( (struct MkDefTypeS *) MkBuffer1024CTT )
6574
6576
6577// END-MkBuffer1024S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
6578
6580
6581#if !defined(__has_parser__)
6582
6592#define MkBuf2XXXfast(buf) (*(buf)->storage.first.A)
6593
6594#define MkBuf2BOLfast(buf) MkBuf2XXXfast(buf).O
6595#define MkBuf2BYTfast(buf) MkBuf2XXXfast(buf).Y
6596#define MkBuf2SRTfast(buf) MkBuf2XXXfast(buf).S
6597#define MkBuf2INTfast(buf) MkBuf2XXXfast(buf).I
6598#define MkBuf2WIDfast(buf) MkBuf2XXXfast(buf).W
6599#define MkBuf2FLTfast(buf) MkBuf2XXXfast(buf).F
6600#define MkBuf2DBLfast(buf) MkBuf2XXXfast(buf).D
6602
6609#define MkBuf2XXX(xxx,len,buf) ({MK_##xxx __tmp; memcpy(&__tmp,buf->storage.first.B,len); __tmp;})
6610
6611#define MkBuf2BOL(buf) MkBuf2XXX(BOL,1,buf)
6612#define MkBuf2BYT(buf) MkBuf2XXX(BYT,1,buf)
6613#define MkBuf2SRT(buf) MkBuf2XXX(SRT,2,buf)
6614#define MkBuf2INT(buf) MkBuf2XXX(INT,4,buf)
6615#define MkBuf2WID(buf) MkBuf2XXX(WID,8,buf)
6616#define MkBuf2FLT(buf) MkBuf2XXX(FLT,4,buf)
6617#define MkBuf2DBL(buf) MkBuf2XXX(DBL,8,buf)
6618
6619#define MkBuf2Ptr(len,ptr,buf) memcpy((void*)ptr,buf->storage.first.B,len)
6620#define MkBuf2BOL_P(ptr,buf) MkBuf2Ptr(1,ptr,buf)
6621#define MkBuf2BYT_P(ptr,buf) MkBuf2Ptr(1,ptr,buf)
6622#define MkBuf2SRT_P(ptr,buf) MkBuf2Ptr(2,ptr,buf)
6623#define MkBuf2INT_P(ptr,buf) MkBuf2Ptr(4,ptr,buf)
6624#define MkBuf2WID_P(ptr,buf) MkBuf2Ptr(8,ptr,buf)
6625#define MkBuf2FLT_P(ptr,buf) MkBuf2Ptr(4,ptr,buf)
6626#define MkBuf2DBL_P(ptr,buf) MkBuf2Ptr(8,ptr,buf)
6627
6628#define MkBuf2Ptr_A(l,a,b) memcpy(a.B##l,b->storage.first.B,l)
6629#define MkBuf2BOL_A(ato,buf) MkBuf2Ptr_A(1,ato,buf)
6630#define MkBuf2BYT_A(ato,buf) MkBuf2Ptr_A(1,ato,buf)
6631#define MkBuf2SRT_A(ato,buf) MkBuf2Ptr_A(2,ato,buf)
6632#define MkBuf2INT_A(ato,buf) MkBuf2Ptr_A(4,ato,buf)
6633#define MkBuf2WID_A(ato,buf) MkBuf2Ptr_A(8,ato,buf)
6634#define MkBuf2FLT_A(ato,buf) MkBuf2Ptr_A(4,ato,buf)
6635#define MkBuf2DBL_A(ato,buf) MkBuf2Ptr_A(8,ato,buf)
6636
6638
6639#endif // __has_parser__
6640
6641__parser__(global=hide:^MkString);
6642__parser__push__(overload-c-no);
6643
6657
6661 MK_STRN const str,
6662 MK_NUM const length,
6663 MK_BOL *val_out
6665
6666#define MkString2O(s,l,r) MkString2BOL_RT(MK_RT_CALL s,l,r)
6667
6670 MK_STRN const str,
6671 MK_NUM const length,
6672 MK_BYT *val_out
6674
6675#define MkString2Y(s,l,r) MkString2BYT_RT(MK_RT_CALL s,l,r)
6676
6679 MK_STRN const str,
6680 MK_NUM const length,
6681 MK_SRT *val_out
6683
6684#define MkString2S(s,l,r) MkString2SRT_RT(MK_RT_CALL s,l,r)
6685
6688 MK_STRN const str,
6689 MK_NUM const length,
6690 MK_USS *val_out
6692
6693#define MkString2US(s,l,r) MkString2USS_RT(MK_RT_CALL s,l,r)
6694
6697 MK_STRN const str,
6698 MK_NUM const length,
6699 MK_INT *val_out
6701
6702#define MkString2I(s,l,r) MkString2INT_RT(MK_RT_CALL s,l,r)
6703
6706 MK_STRN const str,
6707 MK_NUM const length,
6708 MK_USI *val_out
6710
6711#define MkString2UI(s,l,r) MkString2USI_RT(MK_RT_CALL s,l,r)
6712
6715 MK_STRN const str,
6716 MK_NUM const length,
6717 MK_WID *val_out
6719
6720#define MkString2W(s,l,r) MkString2WID_RT(MK_RT_CALL s,l,r)
6721
6724 MK_STRN const str,
6725 MK_NUM const length,
6726 MK_LLG *val_out
6728
6729#define MkString2X(s,l,r) MkString2LLG_RT(MK_RT_CALL s,l,r)
6730
6733 MK_STRN const str,
6734 MK_NUM const length,
6735 MK_FLT *val_out
6737
6738#define MkString2F(s,l,r) MkString2FLT_RT(MK_RT_CALL s,l,r)
6739
6742 MK_STRN const str,
6743 MK_NUM const length,
6744 MK_DBL *val_out
6746
6747#define MkString2D(s,l,r) MkString2DBL_RT(MK_RT_CALL s,l,r)
6748
6751 MK_STRN const str,
6752 MK_NUM const length,
6753 MK_LONG *val_out
6755
6758 MK_STRN const str,
6759 MK_NUM const length,
6760 MK_BOOL *val_out
6762
6765 MK_STRN const str,
6766 MK_NUM const length,
6767 enum MkTypeE type,
6768 MK_ATO *val_out
6770
6772
6774
6776
6777// #######################################################################
6778// -----------------------------------------------------------------------
6783
6784__parser__push__(doc=TOR);
6785
6798__parser__(constructor,lng-constr)
6801 MK_TYP type __parser__(internal,default=NULL),
6802 MK_NUM const size __parser__(default=0)
6804
6806__parser__(constructor)
6809 MK_NUM const size __parser__(default=0)
6811
6813__parser__(constructor)
6816 MK_NUM const size __parser__(default=0)
6818
6820__parser__(constructor)
6823 MK_NUM const size __parser__(default=0)
6825
6837__parser__(constructor)
6840 MK_INT const tlsid
6842
6855__parser__(constructor,macro)
6857// [MkBufferCreateTLS_T]
6858#define MkBufferCreateTLS_T(cls,name,size) \
6859 static MkThreadLocal cls##R name##R = {0}; \
6860 MK_BUF name = MkBUF(&name##R); \
6861 if (unlikely(!__MkCheckX(cls,&name##R))) { \
6862 MkBufferInit(name,cls##_TT,size); \
6863 MkRefIncr_1X(name); \
6864 } else if (MkBUF_R(&name##R).var.cursize) { \
6865 MkBufferReset(name); \
6866 }
6867// [MkBufferCreateTLS_T]
6868
6882__parser__(constructor,macro)
6884// [MkBufferCreateLOCAL_T]
6885#define MkBufferCreateLOCAL_T(cls,n,s) \
6886 cls##R n##R = {0}; \
6887 struct MkBufferS * const n = MkBUF(&n##R); \
6888 MkBufferInit(n,cls##_TT,s); \
6889// [MkBufferCreateLOCAL_T]
6890
6899__parser__(constructor)
6902 MK_BYT const val
6904
6907__parser__(constructor)
6910 MK_BOL const val
6912
6915__parser__(constructor)
6918 MK_SRT const val
6920
6923__parser__(constructor)
6926 MK_INT const val
6928
6931__parser__(constructor)
6934 MK_FLT const val
6936
6939__parser__(constructor)
6942 MK_WID const val
6944
6947__parser__(constructor)
6950 MK_DBL const val
6952
6955__parser__(constructor)
6958 MK_STRN const val
6960
6963__parser__(constructor)
6966 MkBinaryR const val
6968
6971__parser__(constructor,static)
6974 MK_BUFN const val
6976
6978__parser__(no-rpc,flags=new)
6980 return MkBuf((MK_MNG)exporthdl);
6981}
6982
7003__parser__(internal)
7006 MK_BUF const buf
7008
7013__parser__(internal)
7016 MK_BUF const buf,
7017 MK_TYP type __parser__(internal,default=NULL),
7018 MK_NUM const size __parser__(default=0)
7020
7026__parser__(destructor)
7029 MK_BUF const buf
7031
7041__parser__(constructor)
7044 MK_BUFN const buf
7046
7062__parser__(constructor)
7065 MK_BUF const buf
7067
7068__parser__pop__; // TOR
7069
7071
7072
7073// #######################################################################
7074// -----------------------------------------------------------------------
7079
7080__parser__(global=prefix2doc:MkBufferGet:Get);
7081
7095 MK_BUFN const buf,
7096 MK_BYT * const val_out
7098
7099#define MkBufferGetBYT(b,o) MkBufferGetY(b,o)
7100
7105 MK_BUFN const buf,
7106 MK_BOL * const val_out
7108
7109#define MkBufferGetBOL(b,o) MkBufferGetO(b,o)
7110
7115 MK_BUFN const buf,
7116 MK_SRT * const val_out
7118
7119#define MkBufferGetSRT(b,o) MkBufferGetS(b,o)
7120
7123__parser__(internal)
7126 MK_BUFN const buf,
7127 MK_USS * const val_out
7129
7130#define MkBufferGetUSS(b,o) MkBufferGetUS(b,o)
7131
7136 MK_BUFN const buf,
7137 MK_INT * const val_out
7139
7140#define MkBufferGetINT(b,o) MkBufferGetI(b,o)
7141
7144__parser__(internal)
7147 MK_BUFN const buf,
7148 MK_USI * const val_out
7150
7151#define MkBufferGetUSI(b,o) MkBufferGetUI(b,o)
7152
7157 MK_BUFN const buf,
7158 MK_FLT * const val_out
7160
7161#define MkBufferGetFLT(b,o) MkBufferGetF(b,o)
7162
7167 MK_BUFN const buf,
7168 MK_WID * const val_out
7170
7171#define MkBufferGetWID(b,o) MkBufferGetW(b,o)
7172
7175__parser__(internal)
7178 MK_BUFN const buf,
7179 MK_LLG * const val_out
7181
7182#define MkBufferGetLLG(b,o) MkBufferGetLL(b,o)
7183
7188 MK_BUFN const buf,
7189 MK_DBL * const val_out
7191
7192#define MkBufferGetDBL(b,o) MkBufferGetD(b,o)
7193
7200 MK_BUFN const buf,
7201 MkBinaryR * const val_out
7203
7209 MK_BUFN const buf,
7210 MK_STRN * const val_out
7212
7218 MK_BUF const buf,
7219 MK_BUF * const val_out
7221
7238__parser__(no-static)
7241 MK_BUFN const buf,
7242 MK_BFL * val_inout
7244
7247__parser__(internal)
7250 MK_BUFN const buf,
7251 MK_LONG * const val_out
7253
7256__parser__(internal)
7259 MK_BUFN const buf,
7260 MK_BOOL * const val_out
7262
7264
7265
7266// #######################################################################
7267// -----------------------------------------------------------------------
7272
7273__parser__(global=prefix2doc:MkBufferSet:Set);
7274
7286 MK_BUF const buf,
7287 MK_BYT const val
7289
7294 MK_BUF const buf,
7295 MK_BOL const val
7297
7302 MK_BUF const buf,
7303 MK_SRT const val
7305
7310 MK_BUF const buf,
7311 MK_INT const val
7313
7318 MK_BUF const buf,
7319 MK_FLT const val
7321
7326 MK_BUF const buf,
7327 MK_WID const val
7329
7334 MK_BUF const buf,
7335 MK_DBL const val
7337
7342 MK_BUF const buf,
7343 MK_STRN const val
7345
7350 MK_BUF const buf,
7351 MkBinaryR const val
7353
7358 MK_BUF const buf,
7359 MK_BUFN const val
7361
7368 MK_BUF const buf,
7369 MK_FST const val,
7370 va_list var_list
7372
7378 MK_BUF const buf,
7379 MK_FST const val,
7380 ...
7382
7384
7385// #######################################################################
7386// -----------------------------------------------------------------------
7391
7392__parser__push__(doc=Info);
7393
7397__parser__(no-rpc)
7400 MK_BUFN const buf
7402
7408 MK_BUFN const buf
7410
7416 MK_BUFN const buf
7418
7426 MK_BUFN const buf
7428
7439__parser__(const,flags=new)
7442 MK_BUFN const buf,
7443 MK_OBJN fmtobj __parser__(default=NULL),
7444 MK_DBG const debug __parser__(default=0),
7445 MK_STRN const callfunc __parser__(default=F#FUNC),
7446 MK_INT const lvl __parser__(default=0)
7448
7456__parser__(internal)
7459 MK_BUFN const buf,
7460 MK_STRN const varname __parser__(default=S#"buf"),
7461 MK_OBJN fmtobj __parser__(default=NULL),
7462 MK_STRN const callfunc __parser__(default=F#FUNC)
7464
7474 MK_BUFN const buf,
7475 MK_STRN const varname __parser__(default=S#"buf"),
7476 MK_OBJN fmtobj __parser__(default=NULL),
7477 MK_STRN const callfunc __parser__(default=F#FUNC)
7479
7480#define MkBufferLogS_2V(buf,fmt) MkBufferLogS_3(buf,#fmt,MkOBJ(fmt))
7481
7483
7485
7486
7487// #######################################################################
7488// -----------------------------------------------------------------------
7493
7506 MK_BUFN const buf1,
7507 MK_BUFN const buf2
7509
7519 MK_BUF const buf, // TODO: special case update buffer should be default return
7520 enum MkTypeE const typ
7522
7534 MK_BUFN const buf
7536
7547 MK_BUF const buf,
7548 MK_NUM const size
7550
7560 MK_BUF const buf,
7561 MK_NUM const size
7563
7571 MK_BUF const buf
7573
7583 MK_BUF const buf
7585
7594 MK_BUF const buf,
7595 MK_BUFN const srce
7597
7610__parser__(no-static)
7613 MK_BUFN const buf
7615
7617
7618
7619// #######################################################################
7620// -----------------------------------------------------------------------
7625
7626__parser__push__(doc=Access);
7627
7636__parser__(no-type-extension)
7639 MK_BUF const buf,
7640 MK_STRN const val
7642
7652 MK_BUF const buf,
7653 MK_FST const printfmt,
7654 va_list var_list
7656
7665 MK_BUF const buf,
7666 MK_FST const printfmt,
7667 ...
7669
7679 MK_BUF const buf,
7680 MK_STRN const val
7682
7692 MK_BUF const buf,
7693 MK_STRN const val
7695
7697__parser__(template-require,no-rpc)
7700 MK_BUF const buf,
7701 MK_NAT_OBJECT * obj_out
7703
7705
7707
7708/* MARK_S ################################################################ */
7709/* ### ### */
7710/* ### B U F F E R - S T R E A M - A P I ### */
7711/* ### ### */
7712/* ####################################################################### */
7713
7729
7748
7749struct MkBufferStreamSaveS;
7750
7778// [MkBufferStreamS_example]
7780 // BEGIN-MkBufferStreamS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
7781 union {
7782 struct MkObjectS obj; // base CLASS \MkObjectS
7783 struct MkBufferS buf; // base CLASS \MkBufferS
7785 // END-MkBufferStreamS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
7786
7787 // instance attributes
7788 struct {
7789 MK_NUM numItems; // the number of items in the package
7790 MK_INT undo; // \e undo last operation: read=+1 < no=0 < write=-1)
7791 // \note The \e endian_is_wrong attribute is required if a \RMkBufferStreamC is send to
7792 // an other host. The \e sender-endian is part of the \e package-header and the \e reader is using
7793 // the information from the \e package-header to setup the \e endian_is_wrong attribute.
7794 // \li \b false (0) if the endian is the \b same as the local endian.
7795 // \li \b true (1) if the endian is \b not the same as the local endian.
7796 // If \e endian_is_wrong is \b true the package header transform the native-binary-package-data
7797 // to the local endian as part of the \RDocMqA{ReadTT} and \RDocNsA{BufferStreamReadTT} methods.
7798 // The transformation of native data is \b only done if required, just \e routing of a package
7799 // does \b not require a transformation.
7800 bool endian_is_wrong; // the value: \e TRUE if endian of storage != \c MK_ENDIAN_MY
7801 } var; // variable part of the \e instance-data
7802 struct {
7808 union MkBufferU cur;
7809 } storage; // storage part of the \e instance-data
7810
7811 // BUG FIX don't put busRef into "var" -> the pMkBusReadL_END will "overwrite" the data including the
7812 // "self" pointer
7813 struct MkBuffer64S busRef; // pBusReadNextWord will fill this
7814
7815 struct MkCacheS saveCache; // cache to support recursion in LST sub-package
7816 struct MkBufferStreamSaveS * busWriteSave; // if \b not NULL than an active LST-WRITE is ongoing
7817 struct MkBufferStreamSaveS * busReadSave; // if \b not NULL than an active LST-READ is ongoing
7818
7819#define MkBufferStreamS_ils_size 0 // \e ILS size
7820 MK_BINB ils_data[MkBufferStreamS_ils_size]; // \e ILS storage
7821};
7822// [MkBufferStreamS_example]
7823
7824// BEGIN-MkBufferStreamS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
7825
7826// Signature --------------------------------------------------------------
7829
7830 #define MkBufferStreamC_SIGNATURE (MkBufferC_SIGNATURE ^ (4u<<6))
7831 #define MkBufferStreamC_MASK (((1u<<26)-1)<<6)
7832
7834
7835// Signature --------------------------------------------------------------
7838
7839 #define MkBufferStreamC_X2bus(x) (x)
7840 #define MkBufferStreamC_X2buf(x) MkBUF(x)
7841 #define MkBufferStreamC_X2obj(x) MkOBJ(x)
7842
7844
7845
7846// TypeDef --------------------------------------------------------------
7849
7853 __parser__(ignore) typedef const struct MkBufferStreamS MkBufferStreamCNR;
7855 #define MkBufferStreamC_T (&MK_RT_REF._MkBufferStreamC_T)
7857 #define MkBufferStreamC_TT (MkTYP(MkBufferStreamC_T))
7859 #define MkBufferStreamST MkBufferStreamC_T
7861 #define MkBufferStreamSTT (MkTYP(MkBufferStreamST))
7863 #define MkBufferStreamC_type MK_BUS
7865 #define MkBufferStreamCT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
7867 #define MkBufferStreamCTT_X(instance) (MkOBJ_R(instance).type)
7869 #define MkBufferStreamCT_TT(typ) ( (struct MkDefTypeS *) (typ) )
7871 #define MkBufferStreamC_NS MK
7873 #define MkBufferStreamCTT MkBufferStreamCTT
7875 #define MkBufferStreamCT ( (struct MkDefTypeS *) MkBufferStreamCTT )
7876
7878
7879
7880// TypeCheck --------------------------------------------------------------
7883
7884 #pragma GCC diagnostic push
7885 #pragma GCC diagnostic ignored "-Wattributes"
7886
7889 __parser__(class=MkBufferStreamC,static,hide)
7891 return MkSanitizeCheck(MkBufferStreamC,mng);
7892 }
7893
7894 #pragma GCC diagnostic pop
7895 #define MkBufferStreamC_Check(mng) MkBusCheck(mng)
7896
7898
7899
7900// ObjectCast --------------------------------------------------------------
7904 __parser__push__(prefix=Cast);
7905
7907 __parser__(class=MkBufferStreamC,hide,static)
7908 META_ATTRIBUTE_SANITIZE
7910 return (MkBusCheck(mng) ? (MK_BUS)mng : NULL);
7911 }
7912
7914 __parser__(ignore)
7915 META_ATTRIBUTE_SANITIZE
7917 return (MkBusCheck(mng) ? (MK_BUSN)mng : NULL);
7918 }
7919
7921 #define MkBusRaise(_bus) if (!_MkCheckX(MkBufferStreamC,_bus)) { \
7922 MkErrorSetC_1E("'MkBufferStreamC' hdl is NULL"); \
7923 goto error ; \
7924 }
7925
7927 #define MkBUS_R(x) (*(x)).super.bus
7929 #define MkBUS(x) (&MkBUS_R(x))
7930
7933
7934// END-MkBufferStreamS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
7935
7937__parser__(ignore)
7939 // BEGIN-MkBufferStream16384S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
7940 union {
7941 struct MkObjectS obj; // base CLASS \MkObjectS
7942 struct MkBufferS buf; // base CLASS \MkBufferS
7943 struct MkBufferStreamS bus; // base CLASS \MkBufferStreamS
7945 // END-MkBufferStream16384S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
7946
7947 // instance attributes
7948#define MkBufferStream16384S_ils_size (16384)
7950};
7951
7952// BEGIN-MkBufferStream16384S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
7953
7954// Signature --------------------------------------------------------------
7957
7958 #define MkBufferStream16384C_SIGNATURE (MkBufferStreamC_SIGNATURE ^ (1u<<3))
7959 #define MkBufferStream16384C_MASK (((1u<<29)-1)<<3)
7960
7962
7963// Signature --------------------------------------------------------------
7966
7967 #define MkBufferStream16384C_X2bus(x) MkBUS(x)
7968 #define MkBufferStream16384C_X2buf(x) MkBUF(x)
7969 #define MkBufferStream16384C_X2obj(x) MkOBJ(x)
7970
7972
7973
7974// TypeDef --------------------------------------------------------------
7977
7983 #define MkBufferStream16384C_T (&MK_RT_REF._MkBufferStream16384C_T)
7985 #define MkBufferStream16384C_TT (MkTYP(MkBufferStream16384C_T))
7987 #define MkBufferStream16384ST MkBufferStream16384C_T
7989 #define MkBufferStream16384STT (MkTYP(MkBufferStream16384ST))
7991 #define MkBufferStream16384CT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
7993 #define MkBufferStream16384CTT_X(instance) (MkOBJ_R(instance).type)
7995 #define MkBufferStream16384CT_TT(typ) ( (struct MkDefTypeS *) (typ) )
7997 #define MkBufferStream16384C_NS MK
7999 #define MkBufferStream16384CTT MkBufferStream16384CTT
8001 #define MkBufferStream16384CT ( (struct MkDefTypeS *) MkBufferStream16384CTT )
8002
8004
8005// END-MkBufferStream16384S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8006
8008__parser__(ignore)
8010
8012__parser__(ignore)
8014 // BEGIN-MkBufferStream256S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8015 union {
8016 struct MkObjectS obj; // base CLASS \MkObjectS
8017 struct MkBufferS buf; // base CLASS \MkBufferS
8018 struct MkBufferStreamS bus; // base CLASS \MkBufferStreamS
8020 // END-MkBufferStream256S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8021
8022 // instance attributes
8023#define MkBufferStream256S_ils_size (256)
8025};
8026
8027// BEGIN-MkBufferStream256S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8028
8029// Signature --------------------------------------------------------------
8032
8033 #define MkBufferStream256C_SIGNATURE (MkBufferStreamC_SIGNATURE ^ (2u<<3))
8034 #define MkBufferStream256C_MASK (((1u<<29)-1)<<3)
8035
8037
8038// Signature --------------------------------------------------------------
8041
8042 #define MkBufferStream256C_X2bus(x) MkBUS(x)
8043 #define MkBufferStream256C_X2buf(x) MkBUF(x)
8044 #define MkBufferStream256C_X2obj(x) MkOBJ(x)
8045
8047
8048
8049// TypeDef --------------------------------------------------------------
8052
8058 #define MkBufferStream256C_T (&MK_RT_REF._MkBufferStream256C_T)
8060 #define MkBufferStream256C_TT (MkTYP(MkBufferStream256C_T))
8062 #define MkBufferStream256ST MkBufferStream256C_T
8064 #define MkBufferStream256STT (MkTYP(MkBufferStream256ST))
8066 #define MkBufferStream256CT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
8068 #define MkBufferStream256CTT_X(instance) (MkOBJ_R(instance).type)
8070 #define MkBufferStream256CT_TT(typ) ( (struct MkDefTypeS *) (typ) )
8072 #define MkBufferStream256C_NS MK
8074 #define MkBufferStream256CTT MkBufferStream256CTT
8076 #define MkBufferStream256CT ( (struct MkDefTypeS *) MkBufferStream256CTT )
8077
8079
8080// END-MkBufferStream256S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8081
8083__parser__(ignore)
8085 // BEGIN-MkBufferStream64S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8086 union {
8087 struct MkObjectS obj; // base CLASS \MkObjectS
8088 struct MkBufferS buf; // base CLASS \MkBufferS
8089 struct MkBufferStreamS bus; // base CLASS \MkBufferStreamS
8091 // END-MkBufferStream64S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8092
8093 // instance attributes
8094#define MkBufferStream64_ils_size (64)
8096};
8097
8098// BEGIN-MkBufferStream64S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8099
8100// Signature --------------------------------------------------------------
8103
8104 #define MkBufferStream64C_SIGNATURE (MkBufferStreamC_SIGNATURE ^ (3u<<3))
8105 #define MkBufferStream64C_MASK (((1u<<29)-1)<<3)
8106
8108
8109// Signature --------------------------------------------------------------
8112
8113 #define MkBufferStream64C_X2bus(x) MkBUS(x)
8114 #define MkBufferStream64C_X2buf(x) MkBUF(x)
8115 #define MkBufferStream64C_X2obj(x) MkOBJ(x)
8116
8118
8119
8120// TypeDef --------------------------------------------------------------
8123
8129 #define MkBufferStream64C_T (&MK_RT_REF._MkBufferStream64C_T)
8131 #define MkBufferStream64C_TT (MkTYP(MkBufferStream64C_T))
8133 #define MkBufferStream64ST MkBufferStream64C_T
8135 #define MkBufferStream64STT (MkTYP(MkBufferStream64ST))
8137 #define MkBufferStream64CT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
8139 #define MkBufferStream64CTT_X(instance) (MkOBJ_R(instance).type)
8141 #define MkBufferStream64CT_TT(typ) ( (struct MkDefTypeS *) (typ) )
8143 #define MkBufferStream64C_NS MK
8145 #define MkBufferStream64CTT MkBufferStream64CTT
8147 #define MkBufferStream64CT ( (struct MkDefTypeS *) MkBufferStream64CTT )
8148
8150
8151// END-MkBufferStream64S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8152
8154__parser__(ignore)
8156 // BEGIN-MkBufferStream1024S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8157 union {
8158 struct MkObjectS obj; // base CLASS \MkObjectS
8159 struct MkBufferS buf; // base CLASS \MkBufferS
8160 struct MkBufferStreamS bus; // base CLASS \MkBufferStreamS
8162 // END-MkBufferStream1024S-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8163
8164 // instance attributes
8165#define MkBufferStream1024_ils_size (1024)
8167};
8168
8169// BEGIN-MkBufferStream1024S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8170
8171// Signature --------------------------------------------------------------
8174
8175 #define MkBufferStream1024C_SIGNATURE (MkBufferStreamC_SIGNATURE ^ (4u<<3))
8176 #define MkBufferStream1024C_MASK (((1u<<29)-1)<<3)
8177
8179
8180// Signature --------------------------------------------------------------
8183
8184 #define MkBufferStream1024C_X2bus(x) MkBUS(x)
8185 #define MkBufferStream1024C_X2buf(x) MkBUF(x)
8186 #define MkBufferStream1024C_X2obj(x) MkOBJ(x)
8187
8189
8190
8191// TypeDef --------------------------------------------------------------
8194
8200 #define MkBufferStream1024C_T (&MK_RT_REF._MkBufferStream1024C_T)
8202 #define MkBufferStream1024C_TT (MkTYP(MkBufferStream1024C_T))
8204 #define MkBufferStream1024ST MkBufferStream1024C_T
8206 #define MkBufferStream1024STT (MkTYP(MkBufferStream1024ST))
8208 #define MkBufferStream1024CT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
8210 #define MkBufferStream1024CTT_X(instance) (MkOBJ_R(instance).type)
8212 #define MkBufferStream1024CT_TT(typ) ( (struct MkDefTypeS *) (typ) )
8214 #define MkBufferStream1024C_NS MK
8216 #define MkBufferStream1024CTT MkBufferStream1024CTT
8218 #define MkBufferStream1024CT ( (struct MkDefTypeS *) MkBufferStream1024CTT )
8219
8221
8222// END-MkBufferStream1024S-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
8223
8224/* ####################################################################### */
8225/* ### ### */
8226/* ### BufferStream - T O R - Api ### */
8227/* ### ### */
8228/* ####################################################################### */
8229
8236__parser__push__(doc=TOR);
8237
8246__parser__(constructor,lng-constr)
8249 MK_TYP type __parser__(internal,default=NULL),
8250 MK_NUM const size __parser__(default=0)
8252
8253#define MkBufferStreamCreate_1(size) MkBufferStreamCreate(NULL,size)
8254
8256__parser__(constructor)
8259 MK_NUM const size __parser__(default=0)
8261
8263__parser__(constructor)
8266 MK_NUM const size __parser__(default=0)
8268
8270__parser__(constructor)
8273 MK_NUM const size __parser__(default=0)
8275
8277__parser__(constructor)
8280 MK_NUM const size __parser__(default=0)
8282
8302__parser__(constructor)
8305 MK_NUM const tlsid
8307
8316// [MkBufferStreamCreateLOCAL_T]
8317__parser__(constructor,macro)
8319#define MkBufferStreamCreateLOCAL_T(cls,name,size) \
8320 cls##R name##R = {0}; \
8321 struct MkBufferStreamS * const name = cls##_X2bus(&name##R); \
8322 MkBufferStreamInit(name,cls##_TT,size); \
8323// [MkBufferStreamCreateLOCAL_T]
8324
8331__parser__(constructor,macro)
8333// [MkBufferStreamCreateSTATIC_T]
8334#define MkBufferStreamCreateSTATIC_T(cls,name) \
8335 static cls##R name##R = {0}; \
8336 struct MkBufferStreamS * const name = cls##_X2bus(&name##R); \
8337 if (__MkCheckX(cls,&name##R)) { \
8338 MkBufferStreamReset(name); \
8339 } else { \
8340 MkBufferStreamInit(name,cls##TT,0); \
8341 } \
8342// [MkBufferStreamCreateSTATIC_T]
8343
8350__parser__(constructor,macro)
8352// [MkBufferStreamCreateTLS_T]
8353#define MkBufferStreamCreateTLS_T(cls,name) \
8354 static MkThreadLocal cls##R name##R = {0}; \
8355 struct MkBufferStreamS * const name = cls##_X2bus(&name##R); \
8356 if (__MkCheckX(cls,&name##R)) { \
8357 MkBufferStreamReset(name); \
8358 } else { \
8359 MkBufferStreamInit(name,cls##_TT,0); \
8360 } \
8361// [MkBufferStreamCreateTLS_T]
8362
8393__parser__(internal)
8396 MK_BUS const bus
8398
8402__parser__(internal)
8405 MK_BUS const bus,
8406 MK_TYP type __parser__(internal,default=NULL),
8407 MK_NUM const size __parser__(default=0)
8409
8415__parser__(destructor)
8418 MK_BUS const bus
8420
8436__parser__(constructor)
8439 MK_BUS const bus
8441
8449__parser__(constructor)
8452 MK_BUSN const src
8454
8456__parser__(no-rpc,flags=new)
8458 return MkBus((MK_MNG)exporthdl);
8459}
8460
8462
8464
8465/* ####################################################################### */
8466/* ### ### */
8467/* ### BufferStream - M I S C - Api ### */
8468/* ### ### */
8469/* ####################################################################### */
8470
8476
8477__parser__push__(doc=Misc);
8478
8487 MK_BUS const bus,
8488 MK_BUSN const src
8490
8499 MK_BUS const bus
8501
8512 MK_BUS const bus
8514
8515__parser__(internal)
8518 MK_BUS const bus,
8519 MK_OBJ fmtobj __parser__(default=NULL),
8520 MK_STRN const callfunc __parser__(default=F#FUNC)
8522
8531__parser__(const,flags=new)
8534 MK_BUS const bus,
8535 MK_OBJN fmtobj __parser__(default=NULL),
8536 MK_DBG const debug __parser__(default=0),
8537 MK_STRN const callfunc __parser__(default=F#FUNC),
8538 MK_INT const lvl __parser__(default=0)
8540
8541#define MkBufferStreamLog_5F(bus,fmt,...) MkBufferStreamLog(bus,MkObj(fmt),__VA_ARGS__)
8542#define MkBufferStreamLog_2F(bus,fmt) MkBufferStreamLog_5F(bus,fmt,0,__func__,0)
8543#define MkBufferStreamLog_3F(bus,fmt,pfx) MkBufferStreamLog_5F(bus,fmt,0,pfx,0)
8544
8548 MK_BUS const bus
8550
8551__parser__pop__; // Misc
8552
8554
8555/* ####################################################################### */
8556/* ### ### */
8557/* ### BufferStream - W R I T E - Api ### */
8558/* ### ### */
8559/* ####################################################################### */
8560
8571__parser__push__(doc=Write);
8572
8584 MK_BUS const bus,
8585 MK_BYT const val
8587
8592 MK_BUS const bus,
8593 MK_BOL const val
8595
8600 MK_BUS const bus,
8601 MK_INT const val
8603
8608 MK_BUS const bus,
8609 MK_FLT const val
8611
8616 MK_BUS const bus,
8617 MK_WID const val
8619
8624 MK_BUS const bus,
8625 MK_DBL const val
8627
8632 MK_BUS const bus,
8633 MK_STRN const val
8635
8640 MK_BUS const bus,
8641 MkBinaryR const val
8643
8648 MK_BUS const bus,
8649 MK_BUF const val
8651
8665 MK_BUS const bus,
8666 MK_LONG const val
8668
8672 MK_BUS const bus,
8673 MK_STRN const fmt,
8674 va_list ap
8676
8680 MK_BUS const bus,
8681 MK_STRN const fmt,
8682 ...
8684
8701 MK_BUS const bus,
8702 MK_BFL const bfl
8704
8725 MK_BUS const bus,
8726 MK_BFL const bfl
8728
8732 MK_BUS const bus
8734
8738 MK_BUS const bus
8740
8741__parser__pop__; // Write
8742
8744
8745/* ####################################################################### */
8746/* ### ### */
8747/* ### BufferStream - R E A D - Api ### */
8748/* ### ### */
8749/* ####################################################################### */
8750
8760__parser__push__(doc=Read);
8761
8770 MK_BUS const bus,
8771 MK_BUF buf __parser__(default=NULL)
8773
8777 MK_BUS const bus
8779
8795 MK_BUS const bus,
8796 MK_BFL * const val_inout
8798
8820 MK_BUS const bus,
8821 MK_BFL * const val_out
8823
8824__parser__(ignore)
8827 MK_BUS const bus,
8828 MK_NAT_LIST * const val_out
8830
8831__parser__(ignore)
8834 MK_BUS const bus,
8835 MK_NAT_OBJECT * const val_out
8837
8851 MK_BUS const bus,
8852 MK_LONG * const val_out
8854
8855// *******
8856
8872 MK_BUS const bus,
8873 MK_BYT * const val_out
8875
8880 MK_BUS const bus,
8881 MK_BOL * const val_out
8883
8888 MK_BUS const bus,
8889 MK_INT * const val_out
8891
8896 MK_BUS const bus,
8897 MK_FLT * const val_out
8899
8904 MK_BUS const bus,
8905 MK_WID * const val_out
8907
8912 MK_BUS const bus,
8913 MK_DBL * const val_out
8915
8920 MK_BUS const bus,
8921 MK_STRN * const val_out
8923
8930 MK_BUS const bus,
8931 MkBinaryR * const val_out
8933
8938 MK_BUS const bus,
8939 MK_BUF*const val_out
8941
8949 MK_BUSN const bus
8951
8959 MK_BUSN const bus
8961
8969 MK_BUSN const bus
8971
8982 MK_BUS const bus
8984
8985__parser__pop__; // Read
8986
8988
8990
8991/* MARK_L ################################################################ */
8992/* ### ### */
8993/* ### B U F F E R - L I S T - A P I ### */
8994/* ### ### */
8995/* ####################################################################### */
8996
9019
9038 // BEGIN-MkBufferListS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
9039 union {
9040 struct MkObjectS obj; // base CLASS \MkObjectS
9041 } super;
9042 // END-MkBufferListS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
9043
9044 // instance attributes
9049#define MkBufferListS_bls_size 32
9051} ;
9052
9053// BEGIN-MkBufferListS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
9054
9055// Signature --------------------------------------------------------------
9058
9059 #define MkBufferListC_SIGNATURE (MkObjectC_SIGNATURE ^ (2u<<10))
9060 #define MkBufferListC_MASK (((1u<<22)-1)<<10)
9061
9063
9064// Signature --------------------------------------------------------------
9067
9068 #define MkBufferListC_X2bfl(x) (x)
9069 #define MkBufferListC_X2obj(x) MkOBJ(x)
9070
9072
9073
9074// TypeDef --------------------------------------------------------------
9077
9081 __parser__(ignore) typedef const struct MkBufferListS MkBufferListCNR;
9083 #define MkBufferListC_T (&MK_RT_REF._MkBufferListC_T)
9085 #define MkBufferListC_TT (MkTYP(MkBufferListC_T))
9087 #define MkBufferListST MkBufferListC_T
9089 #define MkBufferListSTT (MkTYP(MkBufferListST))
9091 #define MkBufferListC_type MK_BFL
9093 #define MkBufferListCT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
9095 #define MkBufferListCTT_X(instance) (MkOBJ_R(instance).type)
9097 #define MkBufferListCT_TT(typ) ( (struct MkDefTypeS *) (typ) )
9099 #define MkBufferListC_NS MK
9101 #define MkBufferListCTT MkBufferListCTT
9103 #define MkBufferListCT ( (struct MkDefTypeS *) MkBufferListCTT )
9104
9106
9107
9108// TypeCheck --------------------------------------------------------------
9111
9112 #pragma GCC diagnostic push
9113 #pragma GCC diagnostic ignored "-Wattributes"
9114
9117 __parser__(class=MkBufferListC,static,hide)
9119 return MkSanitizeCheck(MkBufferListC,mng);
9120 }
9121
9122 #pragma GCC diagnostic pop
9123 #define MkBufferListC_Check(mng) MkBflCheck(mng)
9124
9126
9127
9128// ObjectCast --------------------------------------------------------------
9132 __parser__push__(prefix=Cast);
9133
9135 __parser__(class=MkBufferListC,hide,static)
9136 META_ATTRIBUTE_SANITIZE
9138 return (MkBflCheck(mng) ? (MK_BFL)mng : NULL);
9139 }
9140
9142 __parser__(ignore)
9143 META_ATTRIBUTE_SANITIZE
9145 return (MkBflCheck(mng) ? (MK_BFLN)mng : NULL);
9146 }
9147
9149 #define MkBflRaise(_bfl) if (!_MkCheckX(MkBufferListC,_bfl)) { \
9150 MkErrorSetC_1E("'MkBufferListC' hdl is NULL"); \
9151 goto error ; \
9152 }
9153
9155 #define MkBFL_R(x) (*(x)).super.bfl
9157 #define MkBFL(x) (&MkBFL_R(x))
9158
9161
9162// END-MkBufferListS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
9163
9165
9166// #######################################################################
9167// -----------------------------------------------------------------------
9172
9173__parser__push__(doc=TOR);
9174
9182__parser__(constructor,lng-constr)
9185 MK_NUM const size __parser__(default=0)
9187
9206__parser__(constructor)
9209 MK_NUM const tlsid
9211
9220__parser__(constructor,macro)
9222// [MkBufferListCreateTLS_T]
9223#define MkBufferListCreateTLS_T(name,num) \
9224 static MkThreadLocal struct MkBufferListS name##R = {0}; \
9225 MK_BFL name = &name##R; \
9226 if (likely(__MkCheckX(MkBufferListC,&name##R))) { \
9227 MkBufferListReserve_RT(MK_RT_CALL name,num); \
9228 } else { \
9229 MkBufferListInit_RT(MK_RT_CALL name,num); \
9230 MkRefIncr_1X(name); \
9231 }
9232// [MkBufferListCreateTLS_T]
9233
9237__parser__(constructor,macro)
9239// [MkBufferListCreateTLS_inout_T]
9240#define MkBufferListCreateTLS_inout_T(name,num,inout) \
9241 static MkThreadLocal struct MkBufferListS __hidden_##name##R = {0}; \
9242 MK_BFL name = *inout != NULL ? *inout : &__hidden_##name##R; \
9243 if (likely(__MkCheckX(MkBufferListC,name))) { \
9244 MkBufferListReserve_RT(MK_RT_CALL name,num); \
9245 } else { \
9246 MkBufferListInit_RT(MK_RT_CALL name,num); \
9247 MkRefIncr_1X(name); \
9248 } \
9249<