theLib 10.0
Loading...
Searching...
No Matches
rl_mox.h File Reference

tag: nhi1-release-250425 More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RL(num)
 
#define RL_RT   (*moxrt)
 
#define RL_init(max, ref, code)
 
#define RL_ref(num, code)
 
#define RL_NewS(num, s)
 
#define RL_NewL(num, c, v)
 
#define RL_T(num, t)
 
#define RL_O(num, l)
 
#define RL_NewC(num, s)
 
#define RL_NewI(num, i)
 
#define RL_args(start, _c, _v)
 
#define RL_EvalEx(f)
 
#define RL_EvalDirect(cmd)
 
#define RL_debug   printAry2("RL_debug",RL_num,RL_data)
 

Detailed Description

tag: nhi1-release-250425

Definition in file rl_mox.h.

Macro Definition Documentation

◆ RL

#define RL ( num)
Value:
RL_data[num]

Definition at line 14 of file rl_mox.h.

◆ RL_args

#define RL_args ( start,
_c,
_v )
Value:
do { \
int c = _c; const MOX_OBJ_T * v = _v ; \
if (c+start > RL_num) { \
Tcl_SetObjResult(interp,Tcl_ObjPrintf( \
"[%s:%d] error: overflow in 'RL_args', get '%d' items but only space for '%d' items is available", \
__func__, __LINE__, c, RL_num-start) \
); \
Tcl_SetErrorCode(interp, "MYOOX", "EVAL", "OVERFLOW", NULL); \
return TCL_ERROR; \
} \
for (int i=0,j=start; i<c; i++, j++) RL_ref(j,v[i]); \
RL_num=(start)+(c); \
} while(0)
Tcl_Obj * MOX_OBJ_T
#define RL_ref(num, code)
Definition rl_mox.h:30

Definition at line 45 of file rl_mox.h.

45#define RL_args(start,_c,_v) do { \
46 int c = _c; const MOX_OBJ_T * v = _v ; \
47 if (c+start > RL_num) { \
48 Tcl_SetObjResult(interp,Tcl_ObjPrintf( \
49 "[%s:%d] error: overflow in 'RL_args', get '%d' items but only space for '%d' items is available", \
50 __func__, __LINE__, c, RL_num-start) \
51 ); \
52 Tcl_SetErrorCode(interp, "MYOOX", "EVAL", "OVERFLOW", NULL); \
53 return TCL_ERROR; \
54 } \
55 for (int i=0,j=start; i<c; i++, j++) RL_ref(j,v[i]); \
56 RL_num=(start)+(c); \
57} while(0)

◆ RL_debug

#define RL_debug   printAry2("RL_debug",RL_num,RL_data)

Definition at line 67 of file rl_mox.h.

◆ RL_EvalDirect

#define RL_EvalDirect ( cmd)
Value:
(cmd)(&RL_RT,interp,RL_num,RL_data)
#define RL_RT
Definition rl_mox.h:15

Definition at line 65 of file rl_mox.h.

◆ RL_EvalEx

#define RL_EvalEx ( f)
Value:
({ \
/* RL_debug; */ \
Tcl_EvalObjv(interp, RL_num, RL_data, (f)); \
})

Definition at line 61 of file rl_mox.h.

61#define RL_EvalEx(f) ({ \
62 /* RL_debug; */ \
63 Tcl_EvalObjv(interp, RL_num, RL_data, (f)); \
64})

◆ RL_init

#define RL_init ( max,
ref,
code )
Value:
/* check if data is valid */ \
static_assert(max == sizeof(RL_RT.ref)/sizeof(MOX_OBJ_T), \
"RL_init(max," #ref ",..) is NOT in sync with REGISTRY."); \
/* init "num" to max */ \
int RL_num=max; \
/* FAST assess to "RL_RT.ref" without deref */ \
MOX_OBJ_T *RL_data = RL_RT.ref; \
/* FIRST? - do initialize */ \
if (RL_data[0] == NULL) { \
{ code; } \
}

Definition at line 17 of file rl_mox.h.

17#define RL_init(max, ref, code) \
18 /* check if data is valid */ \
19 static_assert(max == sizeof(RL_RT.ref)/sizeof(MOX_OBJ_T), \
20 "RL_init(max," #ref ",..) is NOT in sync with REGISTRY."); \
21 /* init "num" to max */ \
22 int RL_num=max; \
23 /* FAST assess to "RL_RT.ref" without deref */ \
24 MOX_OBJ_T *RL_data = RL_RT.ref; \
25 /* FIRST? - do initialize */ \
26 if (RL_data[0] == NULL) { \
27 { code; } \
28 }

◆ RL_NewC

#define RL_NewC ( num,
s )
Value:
RL_ref(num,STR2VAL(#s))
#define STR2VAL(str)

Definition at line 42 of file rl_mox.h.

◆ RL_NewI

#define RL_NewI ( num,
i )
Value:
RL_ref(num,INT2VAL(i))

Definition at line 43 of file rl_mox.h.

◆ RL_NewL

#define RL_NewL ( num,
c,
v )
Value:
RL_ref(num,c ? Tcl_NewListObj(c,v) : Tcl_NewObj())

Definition at line 39 of file rl_mox.h.

◆ RL_NewS

#define RL_NewS ( num,
s )
Value:
RL_ref(num,s ? STR2VAL(s) : Tcl_NewObj())

Definition at line 38 of file rl_mox.h.

◆ RL_O

#define RL_O ( num,
l )
Value:
RL_ref(num,l ? l : Tcl_NewObj())

Definition at line 41 of file rl_mox.h.

◆ RL_ref

#define RL_ref ( num,
code )
Value:
do { \
/*printV("num<%d>,code<%p|%s>",num,code,VAL2STR(code));*/ \
if (RL_data[num] != NULL) Tcl_DecrRefCount(RL_data[num]); \
RL_data[num] = (code); \
assert(RL_data[num] != NULL); \
Tcl_IncrRefCount(RL_data[num]); \
} while (0)

Definition at line 30 of file rl_mox.h.

30#define RL_ref(num,code) do { \
31/*printV("num<%d>,code<%p|%s>",num,code,VAL2STR(code));*/ \
32 if (RL_data[num] != NULL) Tcl_DecrRefCount(RL_data[num]); \
33 RL_data[num] = (code); \
34 assert(RL_data[num] != NULL); \
35 Tcl_IncrRefCount(RL_data[num]); \
36} while (0)

◆ RL_RT

#define RL_RT   (*moxrt)

Definition at line 15 of file rl_mox.h.

◆ RL_T

#define RL_T ( num,
t )
Value:
RL_ref(num,RL_RT.t)

Definition at line 40 of file rl_mox.h.