11#define META_FILE_NAME "LcConfigC_tcl.c"
15#define OT_CLASS NS(LcConfigC)
16#define OT_CLASS_NAME "LcConfigC"
18#define OBJECT2CFG(O) MkAssertCastM(LcConfigC,(Tcl_ObjectGetMetadata(O, &MK(AtomMeta))))
48#define OT_SETUP_hdl_static_constr_pre
49#define OT_SETUP_hdl_static_constr \
50 OT_SETUP_hdl_static_constr_pre; \
53#define OT_SETUP_hdl_static \
54 int __skip=Tcl_ObjectContextSkippedArgs(objCtx); \
56 __attribute__((unused)) OT_SELF_T selfO = Tcl_ObjectContextObject(objCtx); \
57 __attribute__((unused)) MK_TYP hdl = LcConfigC##_TT;
59#define OT_SETUP_hdl SetupHdlFromMetaData_2(CFG,LC_CFG);
60#define OT_SETUP_hdl__null_allow SetupHdlFromMetaData__null_allow_2(CFG,LC_CFG);
61#define OT_SETUP_hdl_destr SetupHdlFromMetaData__null_allow_2(CFG,LC_CFG);
63#define OT_SETUP_hdl_constr_pre
64#define OT_SETUP_hdl_constr \
65 OT_SETUP_hdl_constr_pre; \
66 int __skip=Tcl_ObjectContextSkippedArgs(objCtx); \
68 MK_RT_UNUSED OT_SELF_T selfO = Tcl_ObjectContextObject(objCtx); \
69 LC_CFG hdl = (LC_CFG) &MkERROR;
71#if !defined(SetupRtFromHdl_XN)
72 #define SetupRtFromHdl_XN(hdl) AllRtSetup_XN(hdl)
73 #define SetupRtFromHdl_X(hdl) AllRtSetup_X(hdl)
79 if (LcConfigCTT == NULL) LcConfigCTT = LcConfigSTT; \
82 if (LcConfigCTT->selfCreate == NS(LcConfigC_selfCreate)) return MK_OK; \
85 LcConfigCTT->selfCreate = NS(LcConfigC_selfCreate); \
86 LcConfigCTT->selfDelete = NS(LcConfigC_selfDelete); \
87 LcConfigCTT->selfUnlink = NS(LcConfigC_selfUnlink); \
90 OT_SELF_T classO = MK(ClassDef)(interp,ns,LcConfigCTT); \
91 check_NULL(classO) goto error; \
92 OT_CLASS = Tcl_GetObjectAsClass(classO); \
95 static MkThreadLocal OtUnknownS NS(sClassUnknown) = {OT_UNKNOWN_CLASS}; \
96 check_LNG(MK(UnknownSetup) (interp,classO,NS(sOtClassDef),&NS(sClassUnknown))) goto error; \
99 static MkThreadLocal OtUnknownS NS(sInstanceUnknown) = {OT_UNKNOWN_INSTANCE}; \
100 check_LNG(MK(UnknownSetup) (interp,classO,NS(sInstanceDef),&NS(sInstanceUnknown))) goto error; \
103 LC(LcConfigC_MK_NULL) = Tcl_GetObjectName(interp, \
104 MK(AtomCreate) (MK_RT_CALL interp, NULL , OT_CLASS, "MK_NULL" , "::tcllcconfig::LcConfigC" ) \
106 Tcl_IncrRefCount(LC(LcConfigC_MK_NULL));
108#define VER TCL_OO_METHOD_VERSION_CURRENT
115#define CTOR_doc "LcConfigC [LcConfigC CTOR]"
116#define Create_doc "LcConfigC [LcConfigC Create]"
119#define GetNull_doc "LcConfigC [LcConfigC GetNull]"
120#define HandleResolve_doc "LcConfigC [LcConfigC HandleResolve netHdl:MK_HDL]"
121#define Instances_doc "LcConfigC [LcConfigC Instances]"
124#define Lookup_doc "LcSettingC [$config Lookup path:string] (const)"
125#define Next_doc "LcConfigC [$cfg Next]"
126#define Prev_doc "LcConfigC [$cfg Prev]"
127#define RootSetting_doc "LcSettingC [$config RootSetting] (const)"
130#define Clear_doc "$config Clear"
131#define ErrorType_doc "LcErrorTypeE [$config ErrorType] (const)"
132#define GetDefaultFormat_doc "LcConfigFormatE [$config GetDefaultFormat] (const)"
133#define GetFloatPrecision_doc "int16 [$config GetFloatPrecision] (const)"
134#define GetIncludeDir_doc "string [$config GetIncludeDir] (const)"
135#define GetOption_doc "bool [$config GetOption option:LcConfigOptionsEF] (const)"
136#define GetOptions_doc "LcConfigOptionsEF [$config GetOptions] (const)"
137#define GetTabWidth_doc "int16 [$config GetTabWidth] (const)"
139#define Log_doc "$cfg Log ?fmtobj:MkObjectC=\"MK_NULL\"? ?debug:int32=0? ?callfunc:string=\"MK_NULL\"? ?lvl:int32=0? (const)"
140#define ReadFile_doc "$config ReadFile filename:string"
141#define ReadString_doc "$config ReadString str:string"
142#define SetDefaultFormat_doc "$config SetDefaultFormat format:LcConfigFormatE"
143#define SetFloatPrecision_doc "$config SetFloatPrecision digits:int16"
144#define SetIncludeDir_doc "$config SetIncludeDir include_dir:string"
145#define SetIncludeFunc_doc "$cfg SetIncludeFunc ?fConfigIncludeData:LC_CBP=\"MK_NULL\"?"
146#define SetOption_doc "$config SetOption option:LcConfigOptionsEF flag:bool"
147#define SetOptions_doc "$config SetOptions options:LcConfigOptionsEF"
148#define SetSettingDeleteFunc_doc "$cfg SetSettingDeleteFunc ?fSettingDeleteData:LC_CBP=\"MK_NULL\"?"
149#define SetTabWidth_doc "$config SetTabWidth width:int16"
150#define WriteFile_doc "$config WriteFile filename:string"
153#define LookupBool_doc "bool [$config LookupBool path:string] (const)"
154#define LookupFloat_doc "double [$config LookupFloat path:string] (const)"
155#define LookupInt_doc "int32 [$config LookupInt path:string] (const)"
156#define LookupInt64_doc "int64 [$config LookupInt64 path:string] (const)"
157#define LookupString_doc "string [$config LookupString path:string] (const)"
158#define WriteString_doc "string [$cfg WriteString] (const)"
796 if (retVal == NULL) {
815 if (retVal == NULL) {
837char* printBits(
size_t const size,
void const *
const ptr)
839 static char buf[100];
840 char * bufP = &buf[0];
841 unsigned char *b = (
unsigned char*) ptr;
846 for (i = (
int)size-1; i >= 0; i--) {
847 for (j = 7; j >= 0; j--) {
848 byte = (b[i] >> j) & 1;
849 num = sprintf(bufP,
"%u",
byte);
857#define myprint(num) ({ \
858 unsigned int tmp=num; \
859 printf("%-40s → %s\n", #num, printBits(4,&tmp)); \
867 __skip = Tcl_ObjectContextSkippedArgs(objCtx); \
868 selfO = Tcl_ObjectContextObject(objCtx); \
871 Tcl_SetResult(interp,
"PointerError: 'LcConfigC' hdl is NULL", TCL_STATIC); \
876myprint(
MkOBJ_R(hdl).signature);
877myprint(
MkOBJ_R(hdl).type->objmask);
878myprint(LcConfigS_SIGNATURE);
879myprint(LcConfigS_MASK);
880myprint(MkObjectS_SIGNATURE);
881myprint(MkObjectS_MASK);
888 hdl = (
LC_CFG) clientData; \
914static Tcl_MethodType
NS(sOtClassDef)[] = {
918 {
VER,
"Create" ,
NS(LcConfigC_Create) , NULL, NULL},
921 {
VER,
"GetNull" ,
NS(LcConfigC_GetNull) , NULL, NULL},
922 {
VER,
"HandleResolve" ,
NS(LcConfigC_HandleResolve) , NULL, NULL},
923 {
VER,
"Instances" ,
NS(LcConfigC_Instances) , NULL, NULL},
926 {0, NULL, NULL, NULL}
931static Tcl_MethodType
NS(sInstanceDef)[] = {
936 {
VER,
"<constructor>" ,
NS(LcConfigC_CTOR) , NULL, NULL},
939 {
VER,
"Lookup" ,
NS(LcConfigC_Lookup) , NULL, NULL},
940 {
VER,
"Next" ,
NS(LcConfigC_Next) , NULL, NULL},
941 {
VER,
"Prev" ,
NS(LcConfigC_Prev) , NULL, NULL},
942 {
VER,
"RootSetting" ,
NS(LcConfigC_RootSetting) , NULL, NULL},
945 {
VER,
"Clear" ,
NS(LcConfigC_Clear) , NULL, NULL},
946 {
VER,
"ErrorType" ,
NS(LcConfigC_ErrorType) , NULL, NULL},
947 {
VER,
"GetDefaultFormat" ,
NS(LcConfigC_GetDefaultFormat) , NULL, NULL},
948 {
VER,
"GetFloatPrecision" ,
NS(LcConfigC_GetFloatPrecision) , NULL, NULL},
949 {
VER,
"GetIncludeDir" ,
NS(LcConfigC_GetIncludeDir) , NULL, NULL},
950 {
VER,
"GetOption" ,
NS(LcConfigC_GetOption) , NULL, NULL},
951 {
VER,
"GetOptions" ,
NS(LcConfigC_GetOptions) , NULL, NULL},
952 {
VER,
"GetTabWidth" ,
NS(LcConfigC_GetTabWidth) , NULL, NULL},
954 {
VER,
"Log" ,
NS(LcConfigC_Log) , NULL, NULL},
955 {
VER,
"ReadFile" ,
NS(LcConfigC_ReadFile) , NULL, NULL},
956 {
VER,
"ReadString" ,
NS(LcConfigC_ReadString) , NULL, NULL},
957 {
VER,
"SetDefaultFormat" ,
NS(LcConfigC_SetDefaultFormat) , NULL, NULL},
958 {
VER,
"SetFloatPrecision" ,
NS(LcConfigC_SetFloatPrecision) , NULL, NULL},
959 {
VER,
"SetIncludeDir" ,
NS(LcConfigC_SetIncludeDir) , NULL, NULL},
960 {
VER,
"SetIncludeFunc" ,
NS(LcConfigC_SetIncludeFunc) , NULL, NULL},
961 {
VER,
"SetOption" ,
NS(LcConfigC_SetOption) , NULL, NULL},
962 {
VER,
"SetOptions" ,
NS(LcConfigC_SetOptions) , NULL, NULL},
963 {
VER,
"SetSettingDeleteFunc",
NS(LcConfigC_SetSettingDeleteFunc) , NULL, NULL},
964 {
VER,
"SetTabWidth" ,
NS(LcConfigC_SetTabWidth) , NULL, NULL},
965 {
VER,
"WriteFile" ,
NS(LcConfigC_WriteFile) , NULL, NULL},
968 {
VER,
"LookupBool" ,
NS(LcConfigC_LookupBool) , NULL, NULL},
969 {
VER,
"LookupFloat" ,
NS(LcConfigC_LookupFloat) , NULL, NULL},
970 {
VER,
"LookupInt" ,
NS(LcConfigC_LookupInt) , NULL, NULL},
971 {
VER,
"LookupInt64" ,
NS(LcConfigC_LookupInt64) , NULL, NULL},
972 {
VER,
"LookupString" ,
NS(LcConfigC_LookupString) , NULL, NULL},
973 {
VER,
"WriteString" ,
NS(LcConfigC_WriteString) , NULL, NULL},
976 {0, NULL, NULL, NULL, NULL}
985int NS(pLcConfigC_Init) (
MK_RT_ARGS Tcl_Interp *interp, Tcl_Namespace *ns)
#define SetIncludeFunc_doc
#define SetIncludeDir_doc
#define OT_SETUP_hdl_static_constr
static __thread MK_TYP LcConfigCTT
#define SetSettingDeleteFunc_doc
#define HandleResolve_doc
#define SetFloatPrecision_doc
#define OT_SETUP_hdl_static
#define OT_SETUP_hdl_constr
#define GetFloatPrecision_doc
#define SetDefaultFormat_doc
#define GetDefaultFormat_doc
#define GetIncludeDir_doc
#define OT_retObj_SET_CFG(nat)
#define OT_retObj_SET_CFS(nat)
#define OT_NEW_Lc_enum_OBJ(typ, val)
#define OT_CHECK_bool(val)
#define OT_SETUP_VARARGS(min, max, d)
#define OT_CHECK_NIH(val)
#define OT_retObj_SET_BOL(nat)
#define OT_SETUP_NOARG(d)
#define OT_SETUP_ONEARG(d)
#define OT_ERROR_LNG_RETURN
#define OT_CHECK_NI4(val)
#define OT_retObj_SET_I16(nat)
#define OT_retObj_SET_Error
#define OT_CONSTRUCTOR_POST(x)
#define OT_ERROR_CONSTRUCTOR(class)
#define OT_retObj_SET_DBL(nat)
#define OT_retObj_SET_I64(nat)
#define OT_CHECK_REQUIRED(val)
#define OT_retObj_SET_None
#define OT_retObj_SET_I32(nat)
#define OT_SETUP_CONSTRUCTOR_ARGS(...)
#define OT_CHECK_ENUM(ename, val)
#define OT_CHECK_NI2(val)
#define OT_retObj_SET_STR(nat)
#define OT_CHECK_OPTIONAL(val)
#define OT_retObj_SET(val)
#define OT_retObj_CONSTR(x)
#define MkErrorC_Check(mng, PROC)
#define OT_CHECK_STRN(val)
enum MkErrorE(* LcSettingDeleteCallF)(LcSettingDeleteCallF_ARGS)
enum MkErrorE(* LcConfigIncludeCallF)(LcConfigIncludeCallF_ARGS)
struct LcConfigS * LC_CFG
class-shortcut for struct LcConfigS *, all shortcut using the XX_YYY syntax (only for public API) …
#define LcConfigInstances()
static LC_CFG LcConfigPrev(LC_CFG const cfg)
get previous instance from linked-list of LcConfigS type
static LC_CFG LcConfigNext(LC_CFG const cfg)
get next instance from linked-list of LcConfigS type
static LC_CFG LcConfigGetNull(void)
Null-Slot - return a LcConfigC typed NULL instance …
#define LcConfigHandleResolve(...)
static enum LcErrorTypeE LcConfigErrorType(LC_CFGN config)
This function, which is implemented as a macro, returns the type of error that occurred during the la...
static enum LcConfigFormatE LcConfigGetDefaultFormat(LC_CFGN config)
These functions, which are implemented as macros, get and set the default external format for setting...
static MK_I16 LcConfigGetTabWidth(LC_CFGN config)
These functions, which are implemented as macros, get and set the tab width for the configuration con...
static MK_BOOL LcConfigGetOption(LC_CFGN config, enum LcConfigOptionsEF option)
Since v1.7 These functions get and set the given option of the configuration config …
static MK_I16 LcConfigGetFloatPrecision(LC_CFGN config)
Since v1.6 These functions get and set the number of decimal digits to output after the radix charact...
static enum LcConfigOptionsEF LcConfigGetOptions(LC_CFGN config)
These functions get and set the options for the configuration config …
static MK_STRN LcConfigGetIncludeDir(LC_CFGN config)
ConfigSetIncludeDir specifies the include directory, include_dir, relative to which the files specifi...
static enum MkErrorE LcConfigLookupFloat(LC_CFGN config, MK_STRN path, MK_DBL *value_out)
These functions look up the value of the setting in the configuration config specified by the path pa...
static enum MkErrorE LcConfigLookupBool(LC_CFGN config, MK_STRN path, MK_BOOL *value_out)
These functions look up the value of the setting in the configuration config specified by the path pa...
static enum MkErrorE LcConfigLookupString(LC_CFGN config, MK_STRN path, MK_STRN *value_out)
These functions look up the value of the setting in the configuration config specified by the path pa...
static enum MkErrorE LcConfigLookupInt(LC_CFGN config, MK_STRN path, MK_I32 *value_out)
These functions look up the value of the setting in the configuration config specified by the path pa...
static enum MkErrorE LcConfigLookupInt64(LC_CFGN config, MK_STRN path, MK_I64 *value_out)
These functions look up the value of the setting in the configuration config specified by the path pa...
static LC_CFS LcConfigLookup(LC_CFGN config, MK_STRN path)
This function locates the setting in the configuration config specified by the path path …
static enum MkErrorE LcConfigWriteFile(LC_CFG config, MK_STRN filename)
This function writes the configuration config to the file named filename …
#define LcConfigWriteString(...)
static LC_CFS LcConfigRootSetting(LC_CFGN config)
This function, which is implemented as a macro, returns the root setting for the configuration config...
static void LcConfigClear(LC_CFG config)
Since v1.7 This function clears the configuration config …
static enum MkErrorE LcConfigReadFile(LC_CFG config, MK_STRN filename)
This function reads and parses a configuration from the file named filename into the configuration ob...
static enum MkErrorE LcConfigReadString(LC_CFG config, MK_STRN str)
This function reads and parses a configuration from the string str into the configuration object conf...
static void LcConfigSetTabWidth(LC_CFG config, MK_I16 width)
These functions, which are implemented as macros, get and set the tab width for the configuration con...
static void LcConfigSetFloatPrecision(LC_CFG config, MK_I16 digits)
Since v1.6 These functions get and set the number of decimal digits to output after the radix charact...
#define LcConfigSetSettingDeleteFunc(...)
static void LcConfigSetOptions(LC_CFG config, enum LcConfigOptionsEF options)
These functions get and set the options for the configuration config …
static void LcConfigSetOption(LC_CFG config, enum LcConfigOptionsEF option, MK_BOOL flag)
Since v1.7 These functions get and set the given option of the configuration config …
static void LcConfigSetIncludeDir(LC_CFG config, MK_STRN include_dir)
ConfigSetIncludeDir specifies the include directory, include_dir, relative to which the files specifi...
#define LcConfigSetIncludeFunc(...)
static void LcConfigSetDefaultFormat(LC_CFG config, enum LcConfigFormatE format)
These functions, which are implemented as macros, get and set the default external format for setting...
static LC_CFG LcConfigCreate(MK_TYP type, config_t *nat)
create a LcConfigC instance …
LcConfigFormatE
set the format of a LcSettingC …
LcConfigOptionsEF
define the configuration-option of a LcConfigC …
static bool MkSysStringIsNULL(MK_STRN str)
static MK_I32 MkRuntimeDebugGet(void)
#define OT_CHECK_CALLABLE(val)
#define OT_CLEANUP_CALLABLE(val)
#define OT_SETUP_CALLABLE(val)
#define OT_CHECK_OBJN(val, nullB)
Struct to represent the data from the LcConfigC …
Struct to represent the data from the LcSettingC …