meta: rename legacy object module to 'ds'
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
include(../cmake/Templates.cmake)
|
||||
|
||||
add_bluelib_module(NAME io DEPENDENCIES core object)
|
||||
add_bluelib_module(NAME io DEPENDENCIES core ds)
|
||||
|
||||
@@ -69,12 +69,12 @@ BLUE_API bool b_directory_iterator_is_valid(const b_directory_iterator *it);
|
||||
|
||||
static inline b_directory *b_directory_retain(b_directory *dir)
|
||||
{
|
||||
return B_DIRECTORY(b_retain(B_OBJECT(dir)));
|
||||
return B_DIRECTORY(b_retain(B_DSREF(dir)));
|
||||
}
|
||||
|
||||
static inline void b_directory_release(b_directory *dir)
|
||||
{
|
||||
b_release(B_OBJECT(dir));
|
||||
b_release(B_DSREF(dir));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <blue/core/error.h>
|
||||
#include <blue/core/misc.h>
|
||||
#include <blue/core/stream.h>
|
||||
#include <blue/object/object.h>
|
||||
#include <blue/ds/object.h>
|
||||
|
||||
#define B_FILE(p) ((b_file *)(p))
|
||||
|
||||
@@ -73,11 +73,11 @@ BLUE_API b_status b_file_write(
|
||||
|
||||
static inline b_file *b_file_retain(b_file *file)
|
||||
{
|
||||
return B_FILE(b_retain(B_OBJECT(file)));
|
||||
return B_FILE(b_retain(B_DSREF(file)));
|
||||
}
|
||||
static inline void b_file_release(b_file *file)
|
||||
{
|
||||
b_release(B_OBJECT(file));
|
||||
b_release(B_DSREF(file));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <blue/core/misc.h>
|
||||
#include <blue/core/status.h>
|
||||
#include <blue/object/object.h>
|
||||
#include <blue/ds/object.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define B_PATH(p) ((b_path *)p)
|
||||
@@ -43,12 +43,12 @@ BLUE_API size_t b_path_length(const b_path *path);
|
||||
|
||||
static inline b_path *b_path_retain(b_path *path)
|
||||
{
|
||||
return B_PATH(b_retain(B_OBJECT(path)));
|
||||
return B_PATH(b_retain(B_DSREF(path)));
|
||||
}
|
||||
|
||||
static inline void b_path_release(b_path *path)
|
||||
{
|
||||
b_release(B_OBJECT(path));
|
||||
b_release(B_DSREF(path));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <blue/core/error.h>
|
||||
#include <blue/io/directory.h>
|
||||
#include <blue/object/string.h>
|
||||
#include <blue/ds/string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <fts.h>
|
||||
@@ -17,7 +17,7 @@ enum directory_flags {
|
||||
};
|
||||
|
||||
struct b_directory {
|
||||
struct b_object base;
|
||||
struct b_dsref base;
|
||||
enum directory_flags flags;
|
||||
int fd;
|
||||
struct b_path *rel_path;
|
||||
@@ -29,12 +29,12 @@ struct z__b_directory_iterator {
|
||||
FTSENT *ent;
|
||||
};
|
||||
|
||||
static void directory_release(struct b_object *obj);
|
||||
static void directory_release(struct b_dsref *obj);
|
||||
|
||||
static struct b_object_type directory_type = {
|
||||
static struct b_dsref_type directory_type = {
|
||||
.t_name = "corelib::directory",
|
||||
.t_flags = B_OBJECT_FUNDAMENTAL,
|
||||
.t_id = B_OBJECT_TYPE_PATH,
|
||||
.t_flags = B_DSREF_FUNDAMENTAL,
|
||||
.t_id = B_DSREF_TYPE_PATH,
|
||||
.t_instance_size = sizeof(struct b_directory),
|
||||
.t_release = directory_release,
|
||||
};
|
||||
@@ -133,7 +133,7 @@ b_result b_directory_open(
|
||||
}
|
||||
|
||||
struct b_directory *dir
|
||||
= (struct b_directory *)b_object_type_instantiate(&directory_type);
|
||||
= (struct b_directory *)b_dsref_type_instantiate(&directory_type);
|
||||
|
||||
struct b_path *cwd = NULL;
|
||||
|
||||
@@ -579,7 +579,7 @@ bool b_directory_iterator_is_valid(const struct b_directory_iterator *it)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void directory_release(struct b_object *obj)
|
||||
static void directory_release(struct b_dsref *obj)
|
||||
{
|
||||
struct b_directory *dir = B_DIRECTORY(obj);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <blue/io/directory.h>
|
||||
#include <blue/io/file.h>
|
||||
#include <blue/io/path.h>
|
||||
#include <blue/object/string.h>
|
||||
#include <blue/ds/string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
@@ -15,18 +15,18 @@
|
||||
#include <unistd.h>
|
||||
|
||||
struct b_file {
|
||||
struct b_object base;
|
||||
struct b_dsref base;
|
||||
enum b_file_mode mode;
|
||||
int fd;
|
||||
struct b_path *path;
|
||||
};
|
||||
|
||||
static void file_release(struct b_object *obj);
|
||||
static void file_release(struct b_dsref *obj);
|
||||
|
||||
static struct b_object_type file_type = {
|
||||
static struct b_dsref_type file_type = {
|
||||
.t_name = "corelib::file",
|
||||
.t_flags = B_OBJECT_FUNDAMENTAL,
|
||||
.t_id = B_OBJECT_TYPE_FILE,
|
||||
.t_flags = B_DSREF_FUNDAMENTAL,
|
||||
.t_id = B_DSREF_TYPE_FILE,
|
||||
.t_instance_size = sizeof(struct b_file),
|
||||
.t_release = file_release,
|
||||
};
|
||||
@@ -104,7 +104,7 @@ b_result b_file_open(
|
||||
}
|
||||
|
||||
struct b_file *file
|
||||
= (struct b_file *)b_object_type_instantiate(&file_type);
|
||||
= (struct b_file *)b_dsref_type_instantiate(&file_type);
|
||||
if (!file) {
|
||||
close(fd);
|
||||
b_path_release(abs_path);
|
||||
@@ -482,7 +482,7 @@ enum b_status b_file_write(
|
||||
return status;
|
||||
}
|
||||
|
||||
static void file_release(struct b_object *obj)
|
||||
static void file_release(struct b_dsref *obj)
|
||||
{
|
||||
struct b_file *file = (struct b_file *)obj;
|
||||
close(file->fd);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <blue/core/stringstream.h>
|
||||
#include <blue/io/file.h>
|
||||
#include <blue/io/path.h>
|
||||
#include <blue/object/string.h>
|
||||
#include <blue/ds/string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@@ -13,17 +13,17 @@
|
||||
#include <unistd.h>
|
||||
|
||||
struct b_path {
|
||||
struct b_object base;
|
||||
struct b_dsref base;
|
||||
struct b_string *pathstr;
|
||||
};
|
||||
|
||||
static void path_release(struct b_object *obj);
|
||||
static void path_to_string(struct b_object *obj, struct b_stream *out);
|
||||
static void path_release(struct b_dsref *obj);
|
||||
static void path_to_string(struct b_dsref *obj, struct b_stream *out);
|
||||
|
||||
static struct b_object_type path_type = {
|
||||
static struct b_dsref_type path_type = {
|
||||
.t_name = "corelib::path",
|
||||
.t_flags = B_OBJECT_FUNDAMENTAL,
|
||||
.t_id = B_OBJECT_TYPE_PATH,
|
||||
.t_flags = B_DSREF_FUNDAMENTAL,
|
||||
.t_id = B_DSREF_TYPE_PATH,
|
||||
.t_instance_size = sizeof(struct b_path),
|
||||
.t_release = path_release,
|
||||
.t_to_string = path_to_string,
|
||||
@@ -32,7 +32,7 @@ static struct b_object_type path_type = {
|
||||
struct b_path *b_path_create()
|
||||
{
|
||||
struct b_path *path
|
||||
= (struct b_path *)b_object_type_instantiate(&path_type);
|
||||
= (struct b_path *)b_dsref_type_instantiate(&path_type);
|
||||
if (!path) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -305,14 +305,14 @@ size_t b_path_length(const struct b_path *path)
|
||||
return b_string_get_size(path->pathstr, B_STRLEN_NORMAL);
|
||||
}
|
||||
|
||||
void path_release(struct b_object *obj)
|
||||
void path_release(struct b_dsref *obj)
|
||||
{
|
||||
struct b_path *path = (struct b_path *)obj;
|
||||
|
||||
b_string_release(path->pathstr);
|
||||
}
|
||||
|
||||
void path_to_string(struct b_object *obj, struct b_stream *out)
|
||||
void path_to_string(struct b_dsref *obj, struct b_stream *out)
|
||||
{
|
||||
struct b_path *path = (struct b_path *)obj;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <string.h>
|
||||
|
||||
struct b_directory {
|
||||
struct b_object base;
|
||||
struct b_dsref base;
|
||||
HANDLE handle;
|
||||
struct b_path *abs_path;
|
||||
};
|
||||
@@ -23,12 +23,12 @@ struct iteration_state {
|
||||
bool child_search_complete;
|
||||
};
|
||||
|
||||
static void directory_release(struct b_object *obj);
|
||||
static void directory_release(struct b_dsref *obj);
|
||||
|
||||
static struct b_object_type directory_type = {
|
||||
static struct b_dsref_type directory_type = {
|
||||
.t_name = "corelib::directory",
|
||||
.t_flags = B_OBJECT_FUNDAMENTAL,
|
||||
.t_id = B_OBJECT_TYPE_PATH,
|
||||
.t_flags = B_DSREF_FUNDAMENTAL,
|
||||
.t_id = B_DSREF_TYPE_PATH,
|
||||
.t_instance_size = sizeof(struct b_directory),
|
||||
.t_release = directory_release,
|
||||
};
|
||||
@@ -89,7 +89,7 @@ enum b_status b_directory_open(
|
||||
}
|
||||
|
||||
struct b_directory *dir
|
||||
= (struct b_directory *)b_object_type_instantiate(&directory_type);
|
||||
= (struct b_directory *)b_dsref_type_instantiate(&directory_type);
|
||||
if (!path) {
|
||||
CloseHandle(dir_handle);
|
||||
b_path_release(new_path);
|
||||
@@ -361,6 +361,6 @@ bool b_directory_iterator_is_valid(const struct b_directory_iterator *it)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void directory_release(struct b_object *obj)
|
||||
static void directory_release(struct b_dsref *obj)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,24 +2,24 @@
|
||||
|
||||
#include <blue/core/stringstream.h>
|
||||
#include <blue/io/path.h>
|
||||
#include <blue/object/string.h>
|
||||
#include <blue/ds/string.h>
|
||||
#include <Windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
struct b_path {
|
||||
struct b_object base;
|
||||
struct b_dsref base;
|
||||
struct b_string *pathstr;
|
||||
};
|
||||
|
||||
static void path_release(struct b_object *obj);
|
||||
static void path_to_string(struct b_object *obj, struct b_stringstream *out);
|
||||
static void path_release(struct b_dsref *obj);
|
||||
static void path_to_string(struct b_dsref *obj, struct b_stringstream *out);
|
||||
|
||||
static struct b_object_type path_type = {
|
||||
static struct b_dsref_type path_type = {
|
||||
.t_name = "corelib::path",
|
||||
.t_flags = B_OBJECT_FUNDAMENTAL,
|
||||
.t_id = B_OBJECT_TYPE_PATH,
|
||||
.t_flags = B_DSREF_FUNDAMENTAL,
|
||||
.t_id = B_DSREF_TYPE_PATH,
|
||||
.t_instance_size = sizeof(struct b_path),
|
||||
.t_release = path_release,
|
||||
.t_to_string = path_to_string,
|
||||
@@ -28,7 +28,7 @@ static struct b_object_type path_type = {
|
||||
struct b_path *b_path_create()
|
||||
{
|
||||
struct b_path *path
|
||||
= (struct b_path *)b_object_type_instantiate(&path_type);
|
||||
= (struct b_path *)b_dsref_type_instantiate(&path_type);
|
||||
if (!path) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -234,13 +234,13 @@ const char *b_path_ptr(const struct b_path *path)
|
||||
return b_string_ptr(path->pathstr);
|
||||
}
|
||||
|
||||
void path_release(struct b_object* obj)
|
||||
void path_release(struct b_dsref* obj)
|
||||
{
|
||||
struct b_path *path = B_PATH(obj);
|
||||
b_string_release(path->pathstr);
|
||||
}
|
||||
|
||||
void path_to_string(struct b_object* obj, struct b_stringstream* out)
|
||||
void path_to_string(struct b_dsref* obj, struct b_stringstream* out)
|
||||
{
|
||||
struct b_path *path = (struct b_path *)obj;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user