libsheepy

C lib for handling text files, strings and json like data structure with an object oriented system
git clone https://spartatek.se/git/libsheepy.git
Log | Files | Refs | README | LICENSE

commit bd7b119ba110622815d1bfca2ed8ac7097274098
parent 850dcb1cb1bdf1242450831f4ca216a9f0944c68
Author: Remy Noulin <loader2x@gmail.com>
Date:   Thu, 29 Aug 2019 15:06:59 +0200

add setValO and setValG for simplicity, set stdout unbuffered when redirected to a file

setValG is the opposite of getValG

completion.txt            |  2 ++
documentation.md          |  6 +++++-
release/libsheepy.c       | 12 ++++++++++++
release/libsheepyObject.h |  5 ++++-
src/libsheepy.c           | 12 ++++++++++++
src/libsheepyObject.h     |  5 ++++-
6 files changed, 39 insertions(+), 3 deletions(-)

Diffstat:
Mcompletion.txt | 2++
Mdocumentation.md | 6+++++-
Mrelease/libsheepy.c | 12++++++++++++
Mrelease/libsheepyObject.h | 5++++-
Msrc/libsheepy.c | 12++++++++++++
Msrc/libsheepyObject.h | 5++++-
6 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/completion.txt b/completion.txt @@ -1379,6 +1379,8 @@ iterK(obj, key) rallocG(obj, value) getValO(self) getValG +setValO +setValG getPO(self) getPG setTopO(self, value) diff --git a/documentation.md b/documentation.md @@ -14999,6 +14999,8 @@ iterK(obj, key) rallocG(obj, value) getValO(self) getValG +setValO +setValG getPO(self) getPG setTopO(self, value) @@ -19157,10 +19159,12 @@ void finishManyOF(void *paramType, ...); /* * get value in smallBool, smallBytes, smallDouble, smallInt, smallString * - * use setFromG to set a value + * use setValG or setFromG to set a value */ #define getValO(self) (self)->f->get(self) #define getValG getValO +#define setValO setFromO +#define setValG setFromG /* * get pointer to value in smallBool, smallDouble, smallInt */ diff --git a/release/libsheepy.c b/release/libsheepy.c @@ -1320,6 +1320,12 @@ static const char sheepyBuild[] = "/.sheepy/build"; #if ((__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__ || __HAIKU__)) void initLibsheepyF(const char *progPath, initLibsheepyObjectP initF) { + // no buffering if output is sent to file, this makes everything + // a bit slower, but it is possible to see where the code fails + if (!isatty(1)) { + setbuf(stdout, NULL); + } + libSheepyArg0 = progPath; libSheepyProgPath = findS(progPath, sheepyBuild);; if (!libSheepyProgPath) { @@ -1375,6 +1381,12 @@ void initLibsheepyF(const char *progPath, initLibsheepyObjectP initF) { #else // #if ((__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__ || __HAIKU__)) void initLibsheepyF(const char *progPath, initLibsheepyObjectP initF) { + // no buffering if output is sent to file, this makes everything + // a bit slower, but it is possible to see where the code fails + if (!isatty(1)) { + setbuf(stdout, NULL); + } + libSheepyArg0 = progPath; libSheepyProgPath = findS(progPath, sheepyBuild);; if (!libSheepyProgPath) { diff --git a/release/libsheepyObject.h b/release/libsheepyObject.h @@ -379,11 +379,14 @@ void finishManyOF(void *paramType, ...); /** * get value in smallBool, smallBytes, smallDouble, smallInt, smallString * - * use setFromG to set a value + * use setValG or setFromG to set a value */ #define getValO(self) (self)->f->get(self) #define getValG getValO +#define setValO setFromO +#define setValG setFromG + /** * get pointer to value in smallBool, smallDouble, smallInt */ diff --git a/src/libsheepy.c b/src/libsheepy.c @@ -1376,6 +1376,12 @@ static const char sheepyBuild[] = "/.sheepy/build"; #if ((__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__ || __HAIKU__)) void initLibsheepyF(const char *progPath, initLibsheepyObjectP initF) { + // no buffering if output is sent to file, this makes everything + // a bit slower, but it is possible to see where the code fails + if (!isatty(1)) { + setbuf(stdout, NULL); + } + libSheepyArg0 = progPath; libSheepyProgPath = findS(progPath, sheepyBuild);; if (!libSheepyProgPath) { @@ -1431,6 +1437,12 @@ void initLibsheepyF(const char *progPath, initLibsheepyObjectP initF) { #else // #if ((__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__ || __HAIKU__)) void initLibsheepyF(const char *progPath, initLibsheepyObjectP initF) { + // no buffering if output is sent to file, this makes everything + // a bit slower, but it is possible to see where the code fails + if (!isatty(1)) { + setbuf(stdout, NULL); + } + libSheepyArg0 = progPath; libSheepyProgPath = findS(progPath, sheepyBuild);; if (!libSheepyProgPath) { diff --git a/src/libsheepyObject.h b/src/libsheepyObject.h @@ -379,11 +379,14 @@ void finishManyOF(void *paramType, ...); /** * get value in smallBool, smallBytes, smallDouble, smallInt, smallString * - * use setFromG to set a value + * use setValG or setFromG to set a value */ #define getValO(self) (self)->f->get(self) #define getValG getValO +#define setValO setFromO +#define setValG setFromG + /** * get pointer to value in smallBool, smallDouble, smallInt */