SP_API int sp_drop(void *ptr) { so *o = sp_cast(ptr, __func__); if (ssunlikely(o->i->drop == NULL)) { sp_unsupported(o, __func__); return -1; } so *e = o->env; se_apilock(e); int rc = o->i->drop(o); se_apiunlock(e); return rc; }
SP_API int sp_upsert(void *ptr, void *v) { so *o = sp_cast(ptr, __func__); if (ssunlikely(o->i->upsert == NULL)) { sp_unsupported(o, __func__); return -1; } so *e = o->env; se_apilock(e); int rc = o->i->upsert(o, v); se_apiunlock(e); return rc; }
SP_API void *sp_document(void *ptr) { so *o = sp_cast(ptr, __func__); if (ssunlikely(o->i->document == NULL)) { sp_unsupported(o, __func__); return NULL; } so *e = o->env; se_apilock(e); void *h = o->i->document(o); se_apiunlock(e); return h; }
SP_API void *sp_getstring(void *ptr, const char *path, int *size) { so *o = sp_cast(ptr, __func__); if (ssunlikely(o->i->getstring == NULL)) { sp_unsupported(o, __func__); return NULL; } so *e = o->env; se_apilock(e); void *h = o->i->getstring(o, path, size); se_apiunlock(e); return h; }
SP_API int64_t sp_getint(void *ptr, const char *path) { so *o = sp_cast(ptr, __func__); if (ssunlikely(o->i->getint == NULL)) { sp_unsupported(o, __func__); return -1; } so *e = o->env; se_apilock(e); int64_t rc = o->i->getint(o, path); se_apiunlock(e); return rc; }
SP_API void *sp_getobject(void *ptr, const char *path) { so *o = sp_cast(ptr, __func__); if (ssunlikely(o->i->getobject == NULL)) { sp_unsupported(o, __func__); return NULL; } so *e = o->env; se_apilock(e); void *h = o->i->getobject(o, path); se_apiunlock(e); return h; }
SP_API int sp_setstring(void *ptr, const char *path, const void *pointer, int size) { so *o = sp_cast(ptr, __func__); if (ssunlikely(o->i->setstring == NULL)) { sp_unsupported(o, __func__); return -1; } so *e = o->env; se_apilock(e); int rc = o->i->setstring(o, path, (void*)pointer, size); se_apiunlock(e); return rc; }
SP_API int sp_setobject(void *ptr, const char *path, const void *object) { so *o = sp_cast(ptr, __func__); if (ssunlikely(o->i->setobject == NULL)) { sp_unsupported(o, __func__); return -1; } so *e = o->env; se_apilock(e); int rc = o->i->setobject(o, path, (void*)object); se_apiunlock(e); return rc; }
SP_API int sp_delete(void *ptr, void *ptr_arg) { so *o = sp_cast(ptr, __func__); so *v = sp_cast(ptr_arg, __func__); if (ssunlikely(o->i->del == NULL)) { sp_unsupported(o, __func__); return -1; } so *e = o->env; se_apilock(e); int rc = o->i->del(o, v); se_apiunlock(e); return rc; }
SP_API void *sp_get(void *ptr, void *ptr_arg) { so *o = sp_cast(ptr, __func__); so *v = ptr_arg; if (v != NULL) v = sp_cast(ptr_arg, __func__); if (ssunlikely(o->i->get == NULL)) { sp_unsupported(o, __func__); return NULL; } so *e = o->env; se_apilock(e); void *h = o->i->get(o, v); se_apiunlock(e); return h; }