From 3cff0f1ab97bf61a53cc9c74b5e259947b3e2861 Mon Sep 17 00:00:00 2001 From: M.Gergő Date: Wed, 6 May 2020 23:03:17 +0200 Subject: LightConfINI rewrite & rework --- src/ini_rw.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/ini_rw.h (limited to 'src/ini_rw.h') diff --git a/src/ini_rw.h b/src/ini_rw.h new file mode 100644 index 0000000..3e23e03 --- /dev/null +++ b/src/ini_rw.h @@ -0,0 +1,54 @@ +#ifndef INI_READ_H_INCLUDED +#define INI_READ_H_INCLUDED +// #include "deftypes.h" +#include /* int64_t*/ + + + +typedef struct lci_data { + + enum nodeState {EMPTY, READY, CONTINUE, MULTILINE, ERROR } nodeState; + uint64_t lineNum; + uint64_t lineLen; + + char *section; + uint64_t sectionLen; + uint64_t sectionStartPos; + char *param; + uint64_t paramLen; + uint64_t paramStartPos; + char *value; + uint64_t valueLen; + uint64_t valueStartPos; + char *comment; + uint64_t commentLen; + uint64_t commentStartPos; + char *errorMsg; + uint64_t errorMsgLen; + + struct lci_data *next; +} lci_data; + +enum ini_states {Start, BgnSp, CommEndW, SectEndW, SectEndD, EqW1, EqW2, ValPSP, ValW, ValFSP, DqmW, Bslsh, Error, Stop }; + +struct lci_data *iniReadOut(const char *filename); +int64_t getFileMaxLineLen(FILE *tfd); + + + +char *lciGETtoStr( const char *section, const char *param, char *dest, size_t dstlen ); +//int lciGETtoStrlen(const char *section, const char *param, ...); +int8_t lciGETtoInt8( const char *filename, const char *section, const char *param); +int16_t lciGETtoInt16(const char *filename, const char *section, const char *param); +int32_t lciGETtoInt32(const char *filename, const char *section, const char *param); +int64_t lciGETtoInt64(const char *filename, const char *section, const char *param); + +double lciGETtoDlb(const char *filename, const char *section, const char *param); +float lciGETtoFlt(const char *filename, const char *section, const char *param); +long int lciGETtoLng(const char *filename, const char *section, const char *param); + + + + +#endif // INI_READ_H_INCLUDED + -- cgit v1.2.3