libsheepy
Macros
libsheepyCSmallJsonInternal.h File Reference
#include "recycleContainers.h"
Include dependency graph for libsheepyCSmallJsonInternal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LESSsa(i, j)   (sortFCmp(&arr[i], &arr[j], compareFunction))
 
#define SWAPsa(i, j)   tmp = arr[i], arr[i] = arr[j], arr[j] = tmp
 
#define walkJsonPath(getSmallObj, arrayCode, dictCode, returnFail, directHit, keyErrorReturn)
 
#define setJsonPath   walkJsonPath(if (!oo) {free(keyInPath); if(isNew){free(o);} return NULL;}/*getSmallObj*/, sArraySetTiny(*a, (uint32_t)idx, o)/*arrayCode*/, sDictSetTiny(d, keyInPath, o)/*dictCode*/, /*returnFail*/, sDictSetTiny(&(self->top), key, o); return self/*directHit*/, if(isNew){free(o);} return NULL/*keyErrorReturn*/)
 
#define setJsonPathsFree   walkJsonPath(if (!oo) {free(keyInPath); if(isNew){sFree(o);} return NULL;}/*getSmallObj*/, sArraySetTiny(*a, (uint32_t)idx, o)/*arrayCode*/, sDictSetTiny(d, keyInPath, o)/*dictCode*/, /*returnFail*/, sDictSetTiny(&(self->top), key, o); return self/*directHit*/, if(isNew){sFree(o);} return NULL/*keyErrorReturn*/)
 
#define setJsonPathWithoutReturn   walkJsonPath(if (!oo) {free(keyInPath);if(isNew){free(o);}return NULL;}/*getSmallObj*/, sArraySetTiny(*a, (uint32_t)idx, o)/*arrayCode*/, sDictSetTiny(d, keyInPath, o)/*dictCode*/, /*returnFail*/, sDictSetTiny(&(self->top), key, o); goto UNIQVAR(walkEnd)/*directHit*/, if(isNew){free(o);}return NULL/*keyErrorReturn*/)
 
#define setPJsonPath(objP)   walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, sArraySetP(*a, (uint32_t)idx, objP)/*arrayCode*/, sDictSetP(d, keyInPath, objP)/*dictCode*/, /*returnFail*/, sDictSetP(&(self->top), key, objP); return self/*directHit*/, return NULL/*keyErrorReturn*/)
 
#define setPNFreeJsonPath(objP, finishArg)   walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, sArraySetP(*a, (uint32_t)idx, objP)/*arrayCode*/, sDictSetP(d, keyInPath, objP)/*dictCode*/, /*returnFail*/, sDictSetP(&(self->top), key, objP); finishArg ; return self/*directHit*/, return NULL/*keyErrorReturn*/)
 
#define getJsonPath   walkJsonPath(if (!oo) {free(keyInPath);goto fail;} o = *oo/*getSmallObj*/, if (!*a) {free(keyInPath);goto fail;} o = sArrayGetTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);goto fail;} o = sDictGetTiny(*d, keyInPath)/*dictCode*/, if (!self->top) goto fail/*returnFail*/, o = sDictGetTiny(self->top, key); goto pass/*directHit*/, goto fail/*keyErrorReturn*/)
 
#define delJsonPath   walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, if (!*a) {free(keyInPath);return NULL;} sArrayDelTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);return NULL;} sDictDelTiny(*d, keyInPath)/*dictCode*/, if (!self->top) return NULL/*returnFail*/, sDictDelTiny(self->top, key) ; return self/*directHit*/, return NULL/*keyErrorReturn*/)
 
#define removeJsonPath   walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, if (!*a) {free(keyInPath);return NULL;} sArraySetShortTiny(*a, (uint32_t)idx, NULL)/*arrayCode*/, if (!*d) {free(keyInPath);return NULL;} forEachSDict(*d, e) {if (e->key && eqS(keyInPath, e->key)) { free(e->key); e->key = NULL; break;} }/*dictCode*/, if (!self->top) return NULL/*returnFail*/, forEachSDict(self->top, e) {if (e->key && eqS(key, e->key)) { free(e->key); e->key = NULL; break;} } ; return self/*directHit*/, return NULL/*keyErrorReturn*/)
 
#define typeStringJsonPath   walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, if (!*a) {free(keyInPath);return NULL;} o = sArrayGetTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);return NULL;} o = sDictGetTiny(*d, keyInPath)/*dictCode*/, if (!self->top) return NULL/*returnFail*/, o = sDictGet(self->top, key) ; if (!o) return NULL; return SMALL_TYPE_NAMES[(size_t)o->type]/*directHit*/, return NULL/*keyErrorReturn*/)
 
#define typeJsonPath   walkJsonPath(if (!oo) {free(keyInPath);return 0;}/*getSmallObj*/, if (!*a) {free(keyInPath);return 0;} o = sArrayGetTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);return 0;} o = sDictGetTiny(*d, keyInPath)/*dictCode*/, if (!self->top) return 0/*returnFail*/, o = sDictGet(self->top, key) ; if (!o) return 0; return o->type/*directHit*/, return 0/*keyErrorReturn*/)
 
#define isEJsonPath(test)   walkJsonPath(if (!oo) {free(keyInPath);return 0;}/*getSmallObj*/, if (!*a) {free(keyInPath);return 0;} o = sArrayGetTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);return 0;} o = sDictGetTiny(*d, keyInPath)/*dictCode*/, if (!self->top) return 0/*returnFail*/, o = sDictGet(self->top, key) ; if (!o) return false; return test/*directHit*/, return 0/*keyErrorReturn*/)
 
#define mainSetJsonPathWithoutReturn(initValue, allocValue, subSetJsonPath)
 
#define mainSetJsonPath(initValue, allocValue, subSetJsonPath)
 

Macro Definition Documentation

◆ LESSsa

#define LESSsa (   i,
 
)    (sortFCmp(&arr[i], &arr[j], compareFunction))

Definition at line 27 of file libsheepyCSmallJsonInternal.h.

◆ SWAPsa

#define SWAPsa (   i,
 
)    tmp = arr[i], arr[i] = arr[j], arr[j] = tmp

Definition at line 28 of file libsheepyCSmallJsonInternal.h.

◆ walkJsonPath

#define walkJsonPath (   getSmallObj,
  arrayCode,
  dictCode,
  returnFail,
  directHit,
  keyErrorReturn 
)

Definition at line 35 of file libsheepyCSmallJsonInternal.h.

◆ setJsonPath

#define setJsonPath   walkJsonPath(if (!oo) {free(keyInPath); if(isNew){free(o);} return NULL;}/*getSmallObj*/, sArraySetTiny(*a, (uint32_t)idx, o)/*arrayCode*/, sDictSetTiny(d, keyInPath, o)/*dictCode*/, /*returnFail*/, sDictSetTiny(&(self->top), key, o); return self/*directHit*/, if(isNew){free(o);} return NULL/*keyErrorReturn*/)

Definition at line 133 of file libsheepyCSmallJsonInternal.h.

◆ setJsonPathsFree

#define setJsonPathsFree   walkJsonPath(if (!oo) {free(keyInPath); if(isNew){sFree(o);} return NULL;}/*getSmallObj*/, sArraySetTiny(*a, (uint32_t)idx, o)/*arrayCode*/, sDictSetTiny(d, keyInPath, o)/*dictCode*/, /*returnFail*/, sDictSetTiny(&(self->top), key, o); return self/*directHit*/, if(isNew){sFree(o);} return NULL/*keyErrorReturn*/)

Definition at line 138 of file libsheepyCSmallJsonInternal.h.

◆ setJsonPathWithoutReturn

#define setJsonPathWithoutReturn   walkJsonPath(if (!oo) {free(keyInPath);if(isNew){free(o);}return NULL;}/*getSmallObj*/, sArraySetTiny(*a, (uint32_t)idx, o)/*arrayCode*/, sDictSetTiny(d, keyInPath, o)/*dictCode*/, /*returnFail*/, sDictSetTiny(&(self->top), key, o); goto UNIQVAR(walkEnd)/*directHit*/, if(isNew){free(o);}return NULL/*keyErrorReturn*/)

Definition at line 141 of file libsheepyCSmallJsonInternal.h.

◆ setPJsonPath

#define setPJsonPath (   objP)    walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, sArraySetP(*a, (uint32_t)idx, objP)/*arrayCode*/, sDictSetP(d, keyInPath, objP)/*dictCode*/, /*returnFail*/, sDictSetP(&(self->top), key, objP); return self/*directHit*/, return NULL/*keyErrorReturn*/)

Definition at line 144 of file libsheepyCSmallJsonInternal.h.

◆ setPNFreeJsonPath

#define setPNFreeJsonPath (   objP,
  finishArg 
)    walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, sArraySetP(*a, (uint32_t)idx, objP)/*arrayCode*/, sDictSetP(d, keyInPath, objP)/*dictCode*/, /*returnFail*/, sDictSetP(&(self->top), key, objP); finishArg ; return self/*directHit*/, return NULL/*keyErrorReturn*/)

Definition at line 147 of file libsheepyCSmallJsonInternal.h.

◆ getJsonPath

#define getJsonPath   walkJsonPath(if (!oo) {free(keyInPath);goto fail;} o = *oo/*getSmallObj*/, if (!*a) {free(keyInPath);goto fail;} o = sArrayGetTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);goto fail;} o = sDictGetTiny(*d, keyInPath)/*dictCode*/, if (!self->top) goto fail/*returnFail*/, o = sDictGetTiny(self->top, key); goto pass/*directHit*/, goto fail/*keyErrorReturn*/)

Definition at line 152 of file libsheepyCSmallJsonInternal.h.

◆ delJsonPath

#define delJsonPath   walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, if (!*a) {free(keyInPath);return NULL;} sArrayDelTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);return NULL;} sDictDelTiny(*d, keyInPath)/*dictCode*/, if (!self->top) return NULL/*returnFail*/, sDictDelTiny(self->top, key) ; return self/*directHit*/, return NULL/*keyErrorReturn*/)

Definition at line 155 of file libsheepyCSmallJsonInternal.h.

◆ removeJsonPath

#define removeJsonPath   walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, if (!*a) {free(keyInPath);return NULL;} sArraySetShortTiny(*a, (uint32_t)idx, NULL)/*arrayCode*/, if (!*d) {free(keyInPath);return NULL;} forEachSDict(*d, e) {if (e->key && eqS(keyInPath, e->key)) { free(e->key); e->key = NULL; break;} }/*dictCode*/, if (!self->top) return NULL/*returnFail*/, forEachSDict(self->top, e) {if (e->key && eqS(key, e->key)) { free(e->key); e->key = NULL; break;} } ; return self/*directHit*/, return NULL/*keyErrorReturn*/)

Definition at line 158 of file libsheepyCSmallJsonInternal.h.

◆ typeStringJsonPath

#define typeStringJsonPath   walkJsonPath(if (!oo) {free(keyInPath);return NULL;}/*getSmallObj*/, if (!*a) {free(keyInPath);return NULL;} o = sArrayGetTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);return NULL;} o = sDictGetTiny(*d, keyInPath)/*dictCode*/, if (!self->top) return NULL/*returnFail*/, o = sDictGet(self->top, key) ; if (!o) return NULL; return SMALL_TYPE_NAMES[(size_t)o->type]/*directHit*/, return NULL/*keyErrorReturn*/)

Definition at line 161 of file libsheepyCSmallJsonInternal.h.

◆ typeJsonPath

#define typeJsonPath   walkJsonPath(if (!oo) {free(keyInPath);return 0;}/*getSmallObj*/, if (!*a) {free(keyInPath);return 0;} o = sArrayGetTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);return 0;} o = sDictGetTiny(*d, keyInPath)/*dictCode*/, if (!self->top) return 0/*returnFail*/, o = sDictGet(self->top, key) ; if (!o) return 0; return o->type/*directHit*/, return 0/*keyErrorReturn*/)

Definition at line 164 of file libsheepyCSmallJsonInternal.h.

◆ isEJsonPath

#define isEJsonPath (   test)    walkJsonPath(if (!oo) {free(keyInPath);return 0;}/*getSmallObj*/, if (!*a) {free(keyInPath);return 0;} o = sArrayGetTiny(*a, (uint32_t)idx)/*arrayCode*/, if (!*d) {free(keyInPath);return 0;} o = sDictGetTiny(*d, keyInPath)/*dictCode*/, if (!self->top) return 0/*returnFail*/, o = sDictGet(self->top, key) ; if (!o) return false; return test/*directHit*/, return 0/*keyErrorReturn*/)

Definition at line 167 of file libsheepyCSmallJsonInternal.h.

◆ mainSetJsonPathWithoutReturn

#define mainSetJsonPathWithoutReturn (   initValue,
  allocValue,
  subSetJsonPath 
)
Value:
smallt *o = NULL;\
if (!key)\
return NULL;\
jsonPathRest kType = keyIsSmallJson(self, key);\
if (self->topIsA != SMALLJSON_IS_EMPTY && ((kType == ARRAY_PATH && self->topIsA != TOP_IS_ARRAY) || ((kType == NOT_A_PATH || kType == DICT_PATH) && self->topIsA != TOP_IS_DICT)))\
return NULL;\
initValue;\
switch(self->topIsA) {\
if (kType == NOT_A_PATH || kType == DICT_PATH)\
self->topIsA = TOP_IS_DICT;\
else if (kType == ARRAY_PATH)\
self->topIsA = TOP_IS_ARRAY;\
FALLTHRU;\
case TOP_IS_ARRAY:\
case TOP_IS_DICT:;\
bool isNew UNUSED = false;\
allocValue;\
subSetJsonPath;\
break;\
default:; /* do nothing */\
}
internal jsonPathRest keyIsSmallJson(smallJsont *self UNUSED, const char *key)
base class for the small objects all small objects have a type
#define FALLTHRU
Definition: libsheepy.h:8199
smallDictt * o
#define UNUSED
Definition: libsheepy.h:8195

Definition at line 170 of file libsheepyCSmallJsonInternal.h.

◆ mainSetJsonPath

#define mainSetJsonPath (   initValue,
  allocValue,
  subSetJsonPath 
)
Value:
mainSetJsonPathWithoutReturn(initValue, allocValue, subSetJsonPath)\
return self
#define mainSetJsonPathWithoutReturn(initValue, allocValue, subSetJsonPath)

Definition at line 196 of file libsheepyCSmallJsonInternal.h.