aboutsummaryrefslogtreecommitdiffstats
path: root/src/ini_rw.h
diff options
context:
space:
mode:
authorM.Gergő2020-05-06 23:03:17 +0200
committerM.Gergő2020-05-06 23:03:17 +0200
commit3cff0f1ab97bf61a53cc9c74b5e259947b3e2861 (patch)
tree0ec96a912c896fa78c25fb996d762144c80a1561 /src/ini_rw.h
downloadlightconfini-3cff0f1ab97bf61a53cc9c74b5e259947b3e2861.tar.gz
lightconfini-3cff0f1ab97bf61a53cc9c74b5e259947b3e2861.zip
LightConfINI rewrite & rework
Diffstat (limited to 'src/ini_rw.h')
-rw-r--r--src/ini_rw.h54
1 files changed, 54 insertions, 0 deletions
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 <stdint.h> /* 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
+