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 4ae3c941b93f599acbc35ea5d398fc26f9706916
parent 15e355a619af3cd8c511e81c757360503dea4f7b
Author: Remy Noulin <loader2x@gmail.com>
Date:   Wed, 15 Jul 2020 13:54:21 +0200

add otos function to print baset object in gdb

release/libsheepy.h        | 2 +-
release/libsheepyObject.h  | 9 +++++++++
src/json/libsheepyObject.c | 9 +++++++++
src/libsheepy.h            | 2 +-
src/libsheepyObject.h      | 9 +++++++++
5 files changed, 29 insertions(+), 2 deletions(-)

Diffstat:
Mrelease/libsheepy.h | 2+-
Mrelease/libsheepyObject.h | 9+++++++++
Msrc/json/libsheepyObject.c | 9+++++++++
Msrc/libsheepy.h | 2+-
Msrc/libsheepyObject.h | 9+++++++++
5 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/release/libsheepy.h b/release/libsheepy.h @@ -96,7 +96,7 @@ // version accoring to the version package: Release.Major.minor.patch // https://noulin.net/version/file/README.md.html -#define LIBSHEEPY_VERSION "1.2" +#define LIBSHEEPY_VERSION "1.2.1" #ifndef SH_PREFIX #define SH_PREFIX(NAME) NAME diff --git a/release/libsheepyObject.h b/release/libsheepyObject.h @@ -9602,6 +9602,15 @@ char *toStringSmallJsonGF(smallJsont* object); )(obj) /** + * object to string for debug + * this function is used for printing an object in gdb, lldb, any debugger, in gdb: + * p otos(obj) + * a longer alternative to print an object is: + * p obj->f->toString(obj) + */ +char *otos(void *basetObj); + +/** * puts for objects using toString */ void putsOF(baset* object); diff --git a/src/json/libsheepyObject.c b/src/json/libsheepyObject.c @@ -42,7 +42,9 @@ #include <stdio.h> #include <dirent.h> #include <stdarg.h> +#if (!(__OpenBSD__ || __HAIKU__)) #include <wordexp.h> +#endif #include <stdbool.h> #include <string.h> #include <stdlib.h> @@ -139,6 +141,7 @@ char *toStringSmallStringGF(smallStringt* object); char *toStringVoidGF(void* object); char *toStringSmallContainerGF(smallContainert* object); char *toStringSmallJsonGF(smallJsont* object); +char *otos(void *basetObj); smallStringt *formatO(const char *fmt, ...); int execO(const char *cmd, smallArrayt *out, smallArrayt *err UNUSED); int execSmallJsonO(smallJsont *cmd, smallArrayt *out, smallArrayt *err); @@ -1275,6 +1278,12 @@ char *toStringSmallJsonGF(smallJsont* object) { return(toStringO((baset *)object)); } +char *otos(void *basetObj) { + + cast(baset*, obj, basetObj); + return(toStringO(obj)); +} + smallStringt *formatO(const char *fmt, ...) { char *r = NULL; va_list pl; diff --git a/src/libsheepy.h b/src/libsheepy.h @@ -96,7 +96,7 @@ // version accoring to the version package: Release.Major.minor.patch // https://noulin.net/version/file/README.md.html -#define LIBSHEEPY_VERSION "1.2" +#define LIBSHEEPY_VERSION "1.2.1" #ifndef SH_PREFIX #define SH_PREFIX(NAME) NAME diff --git a/src/libsheepyObject.h b/src/libsheepyObject.h @@ -9602,6 +9602,15 @@ char *toStringSmallJsonGF(smallJsont* object); )(obj) /** + * object to string for debug + * this function is used for printing an object in gdb, lldb, any debugger, in gdb: + * p otos(obj) + * a longer alternative to print an object is: + * p obj->f->toString(obj) + */ +char *otos(void *basetObj); + +/** * puts for objects using toString */ void putsOF(baset* object);