From ee15e1da29eea49057ea3b87ac861e6a2f1fea96 Mon Sep 17 00:00:00 2001 From: M.Gergő Date: Wed, 20 May 2020 00:20:53 +0200 Subject: New function: lciniReadOutOwn() + Clarifying numeric types --- src/lightconfini.h | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'src/lightconfini.h') diff --git a/src/lightconfini.h b/src/lightconfini.h index 7bbe918..e2b4e2d 100644 --- a/src/lightconfini.h +++ b/src/lightconfini.h @@ -7,33 +7,32 @@ typedef struct lcini_data { int32_t lineNum; int32_t lineLen; - char *section; + uint8_t *section; int32_t sectionLen; int32_t sectionStartPos; - char *param; + uint8_t *param; int32_t paramLen; int32_t paramStartPos; - char *value; + uint8_t *value; int32_t valueLen; int32_t valueStartPos; enum valueDraw {lcini_EMPTYVAL, lcini_SIMPLEVAL, lcini_MULTILINEVAL, lcini_DQUOTEDVAL} valueDraw; - char *comment; + uint8_t *comment; int32_t commentLen; int32_t commentStartPos; - char commentSign; - char *errorMsg; + uint8_t commentSign; + uint8_t *errorMsg; int32_t errorMsgLen; struct lcini_data *next; } lcini_data; -typedef struct lcini_retdata{ - char *value; - int32_t vallen; - char *error; - int32_t errorlen; -} lcini_retdata; +typedef struct lcini_shortret{ + uint8_t *ret; + int32_t retlen; + enum retType{lcini_shortretOK, lcini_shortretERROR, lcini_shortretEMPTY} retType; +} lcini_shortret; /* Ha maga függvény van átpakolva, nevestül, testestül */ /* extern void (mylciniReadOutFunct)(int line, int linelen, char *section, int sectionlen, char *param, int paramlen, char *value, int valuelen, char *comment, int commentlen, char *error, int errorlen ) ; */ @@ -45,27 +44,17 @@ extern lcinimyReadFunc mylciniReadOutFunct; struct lcini_data *lciniReadOut(const char *filename); int lciniReadOutOwn(const char *filename); -char *lciniGet(const char *filename, const char *section, const char *parameter, int32_t bufflen); -lcini_retdata *lciniGet2(const char *filename, const char *section, const char *parameter); +lcini_data *lciniGet(lcini_data *head, const char *section, const char *parameter); /* FETCH requested value TO an lcini_data object, FROM lcini_data list*/ +char *lciniGetStr(lcini_data *head, const char *section, const char *parameter, char *dst, int dstlen); /* FETCH requested value TO null-terminated-string, FROM lcini_data list */ +lcini_shortret *lciniGetShort(lcini_data *head, const char *section, const char *parameter); /* FETCH requested value TO shortret object, FROM lcini_data list*/ +lcini_shortret *lciniGetFromFileShort(const char *filename, const char *section, const char *parameter); /* FETCH requested value TO shortret object FROM file */ +char *lciniGetFromFileStr(const char *filename, const char *section, const char *parameter, char *buff, int len); - -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); - -char *lciniStrResize(char *ptr, size_t oldsize, size_t newsize); lcini_data *lciniDestroyNodes( lcini_data *head); -lcini_data *lciniCreateNode( lcini_data *head, int64_t lineLen ); +lcini_data *lciniCreateNode( lcini_data *head, int lineLen ); size_t lciniFileMaxLineLen(FILE *tfd); #endif /* LIGHTCONFINI_H_INCLUDED */ -- cgit v1.2.3