ds: memove legacy object system
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
#ifndef BLUELIB_DSREF_H_
|
||||
#define BLUELIB_DSREF_H_
|
||||
|
||||
#include <blue/ds/type.h>
|
||||
|
||||
#define B_DSREF(p) ((b_dsref *)(p))
|
||||
|
||||
#define B_TYPEOF(object) ((struct b_dsref *)(object)->ob_type)
|
||||
#define B_TYPEID(object) (b_typeid(B_DSREF(object)))
|
||||
|
||||
#define B_RV(p) (b_make_rvalue(B_DSREF(p)))
|
||||
#define B_RVT(t, p) ((t *)(b_make_rvalue(B_DSREF(p))))
|
||||
|
||||
#define B_DSREF_IS(object, type) (B_TYPEID(object) == B_DSREF_TYPE_##type)
|
||||
|
||||
struct b_string;
|
||||
struct b_stream;
|
||||
|
||||
typedef enum b_comparison_result {
|
||||
B_LESS = -1,
|
||||
B_EQUAL = 0,
|
||||
B_GREATER = 1,
|
||||
} b_comparison_result_t;
|
||||
|
||||
typedef struct b_dsref {
|
||||
unsigned int ob_ref;
|
||||
const struct b_dsref_type *ob_type;
|
||||
} b_dsref;
|
||||
|
||||
BLUE_API b_dsref *b_make_rvalue(b_dsref *obj);
|
||||
|
||||
BLUE_API b_dsref *b_retain(b_dsref *obj);
|
||||
BLUE_API void b_release(b_dsref *obj);
|
||||
|
||||
BLUE_API void b_to_string(const b_dsref *obj, struct b_stream *out);
|
||||
BLUE_API b_dsref_type_id b_typeid(const b_dsref *obj);
|
||||
|
||||
BLUE_API b_comparison_result_t b_compare(const b_dsref *a, const b_dsref *b);
|
||||
|
||||
#endif
|
||||
@@ -1,54 +0,0 @@
|
||||
#ifndef BLUELIB_TYPE_H_
|
||||
#define BLUELIB_TYPE_H_
|
||||
|
||||
#include <blue/core/queue.h>
|
||||
#include <blue/core/status.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define B_NPOS ((size_t)INTPTR_MAX)
|
||||
|
||||
struct b_dsref;
|
||||
struct b_stream;
|
||||
|
||||
typedef uintptr_t b_dsref_type_id;
|
||||
|
||||
typedef enum b_fundamental_type_id {
|
||||
B_DSREF_TYPE_NONE = 0,
|
||||
B_DSREF_TYPE_ANY,
|
||||
B_DSREF_TYPE_LIST,
|
||||
B_DSREF_TYPE_ARRAY,
|
||||
B_DSREF_TYPE_BUFFER,
|
||||
B_DSREF_TYPE_DICT,
|
||||
B_DSREF_TYPE_ERROR,
|
||||
B_DSREF_TYPE_HASHMAP,
|
||||
B_DSREF_TYPE_NUMBER,
|
||||
B_DSREF_TYPE_STRING,
|
||||
B_DSREF_TYPE_TREE,
|
||||
B_DSREF_TYPE_UUID,
|
||||
B_DSREF_TYPE_PATH,
|
||||
B_DSREF_TYPE_FILE,
|
||||
B_DSREF_TYPE_DIRECTORY,
|
||||
B_DSREF_TYPE_DATETIME,
|
||||
} b_fundamental_type_id;
|
||||
|
||||
typedef enum b_dsref_type_flags {
|
||||
B_DSREF_FUNDAMENTAL = 0x01u,
|
||||
} b_dsref_type_flags;
|
||||
|
||||
typedef struct b_dsref_type {
|
||||
b_dsref_type_flags t_flags;
|
||||
char t_name[64];
|
||||
size_t t_instance_size;
|
||||
b_dsref_type_id t_id;
|
||||
b_queue_entry t_entry;
|
||||
void (*t_init)(struct b_dsref *);
|
||||
void (*t_release)(struct b_dsref *);
|
||||
void (*t_to_string)(const struct b_dsref *, struct b_stream *);
|
||||
} b_dsref_type;
|
||||
|
||||
BLUE_API b_status b_dsref_type_register(b_dsref_type *type);
|
||||
BLUE_API struct b_dsref *b_dsref_type_instantiate(const b_dsref_type *type);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user