#ifndef TOBI_NM_H #define TOBI_NM_H #include "rd.h" #include #include typedef enum tobi_ns_kind { TOBI_NS_UNKNOWN, TOBI_NS_SCOPE, TOBI_NS_DEVICE, TOBI_NS_METHOD, TOBI_NS_PROCESSOR, TOBI_NS_NAME, TOBI_NS_ALIAS, TOBI_NS_OPREGION, TOBI_NS_FIELD, TOBI_NS_MUTEX, TOBI_NS_EVENT, TOBI_NS_EXTERNAL } tobi_ns_kind; typedef struct tobi_ns_ent { char *path; char *name; char *owner; char *target; tobi_ns_kind kind; size_t off; unsigned args; unsigned flags; int external; } tobi_ns_ent; typedef struct tobi_ns { tobi_ns_ent *items; size_t len; size_t cap; } tobi_ns; int tobi_nm_is_lead(unsigned char c); int tobi_nm_is_tail(unsigned char c); int tobi_nm_nameseg(tobi_rd *rd, char **out); int tobi_nm_namestring(tobi_rd *rd, char **out); char *tobi_nm_resolve(const char *scope, const char *name); void tobi_ns_init(tobi_ns *ns); void tobi_ns_free(tobi_ns *ns); const char *tobi_ns_kind_name(tobi_ns_kind kind); const char *tobi_ns_leaf(const char *path); tobi_ns_ent *tobi_ns_find(tobi_ns *ns, const char *path); const tobi_ns_ent *tobi_ns_find_const(const tobi_ns *ns, const char *path); const tobi_ns_ent *tobi_ns_find_method(const tobi_ns *ns, const char *name); tobi_ns_ent *tobi_ns_add(tobi_ns *ns, tobi_ns_kind kind, const char *path, const char *owner, size_t off, unsigned args, unsigned flags, int external, const char *target, int *duplicate); #endif