#ifndef _JOVE_SYS_OBJDIR_H #define _JOVE_SYS_OBJDIR_H 1 #include "api/obj.h" #include "hal/obj.h" typedef struct jove_objdir { jove_obj_t entries[OBJDIR_ENTRIES]; } jove_objdir_t; jove_objdir_t *obj_getobjdir(jove_obj_t *obj); int objdir_new(jove_owned_obj_t *untyped_obj); /*Returns the n'th entry of the object directory passed. * If the passed object is not an objdir, returns NULL and sets errno to EBADOBJ. * If the passed entry index is out of bounds, returns NULL and sets errno to EOOB.*/ jove_owned_obj_t *objdir_getlocal(jove_obj_t *objdir_obj, uint16_t entry); jove_owned_obj_t *objdir_getlocal_locked(jove_owned_obj_t *objdir, objpath_part_t entry); jove_obj_t objdir_peeklocal(jove_obj_t *objdir_obj, uint16_t entry); /*Recursively seeks through an object directory for an object following the passed * path variable. * If the path length is zero, returns the passed object. * If the passed object is not an objdir, returns NULL and sets errno to EBADOBJ. * If any object excluding the object at the end of the path is not an objdir, * returns NULL and sets errno to EBADOBJ. * If any entry in the path is out of bounds, returns NULL and sets errno to EBADOBJ.*/ jove_owned_obj_t *objdir_getobj(jove_obj_t *objdir_obj, const uint16_t *path, size_t path_len); jove_owned_obj_t *objdir_getobj_locked(jove_owned_obj_t *objdir, const objpath_part_t *path, size_t path_len); bool objdir_compare(jove_obj_t *objdir_obj, objpath_part_t entry, jove_obj_t *obj); void objdir_swapobj(jove_owned_obj_t *a, jove_owned_obj_t *b); #endif