meta: rename to fx
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
include(../cmake/Templates.cmake)
|
||||
|
||||
add_bluelib_module(NAME serial DEPENDENCIES core ds)
|
||||
add_fx_module(NAME serial DEPENDENCIES core ds)
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
#include <blue/serial/bitcode.h>
|
||||
#include <blue/serial/ctx.h>
|
||||
#include <fx/serial/bitcode.h>
|
||||
#include <fx/serial/ctx.h>
|
||||
|
||||
/*** VIRTUAL FUNCTIONS ********************************************************/
|
||||
|
||||
static enum b_status bitcode_serialise(
|
||||
b_serial_ctx *serial, b_object *src, b_stream *dest,
|
||||
enum b_serial_flags flags)
|
||||
static enum fx_status bitcode_serialise(
|
||||
fx_serial_ctx *serial, fx_object *src, fx_stream *dest,
|
||||
enum fx_serial_flags flags)
|
||||
{
|
||||
return B_ERR_NOT_SUPPORTED;
|
||||
return FX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static enum b_status bitcode_deserialise(
|
||||
b_serial_ctx *serial, b_stream *src, b_object **dest,
|
||||
enum b_serial_flags flags)
|
||||
static enum fx_status bitcode_deserialise(
|
||||
fx_serial_ctx *serial, fx_stream *src, fx_object **dest,
|
||||
enum fx_serial_flags flags)
|
||||
{
|
||||
return B_ERR_NOT_SUPPORTED;
|
||||
return FX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static void bitcode_serial_ctx_init(b_object *obj, void *priv)
|
||||
static void bitcode_serial_ctx_init(fx_object *obj, void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
static void bitcode_serial_ctx_fini(b_object *obj, void *priv)
|
||||
static void bitcode_serial_ctx_fini(fx_object *obj, void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
/*** CLASS DEFINITION *********************************************************/
|
||||
|
||||
B_TYPE_CLASS_DEFINITION_BEGIN(b_bitcode_serial_ctx)
|
||||
B_TYPE_CLASS_INTERFACE_BEGIN(b_object, B_TYPE_OBJECT)
|
||||
B_INTERFACE_ENTRY(to_string) = NULL;
|
||||
B_TYPE_CLASS_INTERFACE_END(b_object, B_TYPE_OBJECT)
|
||||
FX_TYPE_CLASS_DEFINITION_BEGIN(fx_bitcode_serial_ctx)
|
||||
FX_TYPE_CLASS_INTERFACE_BEGIN(fx_object, FX_TYPE_OBJECT)
|
||||
FX_INTERFACE_ENTRY(to_string) = NULL;
|
||||
FX_TYPE_CLASS_INTERFACE_END(fx_object, FX_TYPE_OBJECT)
|
||||
|
||||
B_TYPE_CLASS_INTERFACE_BEGIN(b_serial_ctx, B_TYPE_SERIAL_CTX)
|
||||
B_INTERFACE_ENTRY(s_serialise) = bitcode_serialise;
|
||||
B_INTERFACE_ENTRY(s_deserialise) = bitcode_deserialise;
|
||||
B_TYPE_CLASS_INTERFACE_END(b_serial_ctx, B_TYPE_SERIAL_CTX)
|
||||
B_TYPE_CLASS_DEFINITION_END(b_bitcode_serial_ctx)
|
||||
FX_TYPE_CLASS_INTERFACE_BEGIN(fx_serial_ctx, FX_TYPE_SERIAL_CTX)
|
||||
FX_INTERFACE_ENTRY(s_serialise) = bitcode_serialise;
|
||||
FX_INTERFACE_ENTRY(s_deserialise) = bitcode_deserialise;
|
||||
FX_TYPE_CLASS_INTERFACE_END(fx_serial_ctx, FX_TYPE_SERIAL_CTX)
|
||||
FX_TYPE_CLASS_DEFINITION_END(fx_bitcode_serial_ctx)
|
||||
|
||||
B_TYPE_DEFINITION_BEGIN(b_bitcode_serial_ctx)
|
||||
B_TYPE_ID(0xcdc8c462, 0xf2b3, 0x4193, 0x8cae, 0xc1e5ad9afcb8);
|
||||
B_TYPE_CLASS(b_bitcode_serial_ctx_class);
|
||||
B_TYPE_INSTANCE_INIT(bitcode_serial_ctx_init);
|
||||
B_TYPE_INSTANCE_FINI(bitcode_serial_ctx_fini);
|
||||
B_TYPE_DEFINITION_END(b_bitcode_serial_ctx)
|
||||
FX_TYPE_DEFINITION_BEGIN(fx_bitcode_serial_ctx)
|
||||
FX_TYPE_ID(0xcdc8c462, 0xf2b3, 0x4193, 0x8cae, 0xc1e5ad9afcb8);
|
||||
FX_TYPE_CLASS(fx_bitcode_serial_ctx_class);
|
||||
FX_TYPE_INSTANCE_INIT(bitcode_serial_ctx_init);
|
||||
FX_TYPE_INSTANCE_FINI(bitcode_serial_ctx_fini);
|
||||
FX_TYPE_DEFINITION_END(fx_bitcode_serial_ctx)
|
||||
|
||||
54
serial/ctx.c
54
serial/ctx.c
@@ -1,4 +1,4 @@
|
||||
#include <blue/serial.h>
|
||||
#include <fx/serial.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -8,50 +8,50 @@
|
||||
/*** PUBLIC ALIAS FUNCTIONS ***************************************************/
|
||||
/*** VIRTUAL FUNCTIONS ********************************************************/
|
||||
|
||||
static void serial_ctx_init(b_object *obj, void *priv)
|
||||
static void serial_ctx_init(fx_object *obj, void *priv)
|
||||
{
|
||||
b_serial_ctx_data *data = b_object_get_protected(obj, B_TYPE_SERIAL_CTX);
|
||||
fx_serial_ctx_data *data = fx_object_get_protected(obj, FX_TYPE_SERIAL_CTX);
|
||||
|
||||
data->ctx_streambuf = b_stream_buffer_create_dynamic(2048);
|
||||
data->ctx_streambuf = fx_stream_buffer_create_dynamic(2048);
|
||||
}
|
||||
|
||||
static void serial_ctx_fini(b_object *obj, void *priv)
|
||||
static void serial_ctx_fini(fx_object *obj, void *priv)
|
||||
{
|
||||
b_serial_ctx_data *data = b_object_get_protected(obj, B_TYPE_SERIAL_CTX);
|
||||
fx_serial_ctx_data *data = fx_object_get_protected(obj, FX_TYPE_SERIAL_CTX);
|
||||
|
||||
b_stream_buffer_unref(data->ctx_streambuf);
|
||||
fx_stream_buffer_unref(data->ctx_streambuf);
|
||||
}
|
||||
|
||||
/*** CLASS DEFINITION *********************************************************/
|
||||
|
||||
B_TYPE_CLASS_DEFINITION_BEGIN(b_serial_ctx)
|
||||
B_TYPE_CLASS_INTERFACE_BEGIN(b_object, B_TYPE_OBJECT)
|
||||
B_INTERFACE_ENTRY(to_string) = NULL;
|
||||
B_TYPE_CLASS_INTERFACE_END(b_object, B_TYPE_OBJECT)
|
||||
B_TYPE_CLASS_DEFINITION_END(b_serial_ctx)
|
||||
FX_TYPE_CLASS_DEFINITION_BEGIN(fx_serial_ctx)
|
||||
FX_TYPE_CLASS_INTERFACE_BEGIN(fx_object, FX_TYPE_OBJECT)
|
||||
FX_INTERFACE_ENTRY(to_string) = NULL;
|
||||
FX_TYPE_CLASS_INTERFACE_END(fx_object, FX_TYPE_OBJECT)
|
||||
FX_TYPE_CLASS_DEFINITION_END(fx_serial_ctx)
|
||||
|
||||
B_TYPE_DEFINITION_BEGIN(b_serial_ctx)
|
||||
B_TYPE_ID(0xc7c1039a, 0xf397, 0x4fda, 0xb473, 0x4d86fec85384);
|
||||
B_TYPE_CLASS(b_serial_ctx_class);
|
||||
B_TYPE_INSTANCE_PROTECTED(b_serial_ctx_data);
|
||||
B_TYPE_INSTANCE_INIT(serial_ctx_init);
|
||||
B_TYPE_INSTANCE_FINI(serial_ctx_fini);
|
||||
B_TYPE_DEFINITION_END(b_serial_ctx)
|
||||
FX_TYPE_DEFINITION_BEGIN(fx_serial_ctx)
|
||||
FX_TYPE_ID(0xc7c1039a, 0xf397, 0x4fda, 0xb473, 0x4d86fec85384);
|
||||
FX_TYPE_CLASS(fx_serial_ctx_class);
|
||||
FX_TYPE_INSTANCE_PROTECTED(fx_serial_ctx_data);
|
||||
FX_TYPE_INSTANCE_INIT(serial_ctx_init);
|
||||
FX_TYPE_INSTANCE_FINI(serial_ctx_fini);
|
||||
FX_TYPE_DEFINITION_END(fx_serial_ctx)
|
||||
|
||||
/*** ITERATOR FUNCTIONS *******************************************************/
|
||||
|
||||
enum b_status b_serial_ctx_serialise(
|
||||
b_serial_ctx *ctx, b_object *src, b_stream *dest, enum b_serial_flags flags)
|
||||
enum fx_status fx_serial_ctx_serialise(
|
||||
fx_serial_ctx *ctx, fx_object *src, fx_stream *dest, enum fx_serial_flags flags)
|
||||
{
|
||||
B_CLASS_DISPATCH_VIRTUAL(
|
||||
b_serial_ctx, B_TYPE_SERIAL_CTX, B_ERR_NOT_SUPPORTED,
|
||||
FX_CLASS_DISPATCH_VIRTUAL(
|
||||
fx_serial_ctx, FX_TYPE_SERIAL_CTX, FX_ERR_NOT_SUPPORTED,
|
||||
s_serialise, ctx, src, dest, flags);
|
||||
}
|
||||
|
||||
enum b_status b_serial_ctx_deserialise(
|
||||
b_serial_ctx *ctx, b_stream *src, b_object **dest, enum b_serial_flags flags)
|
||||
enum fx_status fx_serial_ctx_deserialise(
|
||||
fx_serial_ctx *ctx, fx_stream *src, fx_object **dest, enum fx_serial_flags flags)
|
||||
{
|
||||
B_CLASS_DISPATCH_VIRTUAL(
|
||||
b_serial_ctx, B_TYPE_SERIAL_CTX, B_ERR_NOT_SUPPORTED,
|
||||
FX_CLASS_DISPATCH_VIRTUAL(
|
||||
fx_serial_ctx, FX_TYPE_SERIAL_CTX, FX_ERR_NOT_SUPPORTED,
|
||||
s_deserialise, ctx, src, dest, flags);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef BLUE_SERIAL_H_
|
||||
#define BLUE_SERIAL_H_
|
||||
|
||||
#include <blue/serial/bitcode.h>
|
||||
#include <blue/serial/ctx.h>
|
||||
#include <blue/serial/toml.h>
|
||||
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef BLUE_SERIAL_BITCODE_H_
|
||||
#define BLUE_SERIAL_BITCODE_H_
|
||||
|
||||
#include <blue/core/macros.h>
|
||||
|
||||
B_DECLS_BEGIN;
|
||||
|
||||
#define B_TYPE_BITCODE_SERIAL_CTX (b_bitcode_serial_ctx_get_type())
|
||||
|
||||
B_DECLARE_TYPE(b_bitcode_serial_ctx);
|
||||
|
||||
B_TYPE_CLASS_DECLARATION_BEGIN(b_bitcode_serial_ctx)
|
||||
B_TYPE_CLASS_DECLARATION_END(b_bitcode_serial_ctx)
|
||||
|
||||
BLUE_API b_type b_bitcode_serial_ctx_get_type(void);
|
||||
|
||||
B_TYPE_DEFAULT_CONSTRUCTOR(b_bitcode_serial_ctx, B_TYPE_BITCODE_SERIAL_CTX);
|
||||
|
||||
B_DECLS_END;
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
#ifndef BLUE_SERIAL_CTX_H_
|
||||
#define BLUE_SERIAL_CTX_H_
|
||||
|
||||
#include <blue/core/macros.h>
|
||||
#include <blue/core/misc.h>
|
||||
#include <blue/core/object.h>
|
||||
#include <blue/core/status.h>
|
||||
#include <blue/core/stream.h>
|
||||
|
||||
B_DECLS_BEGIN;
|
||||
|
||||
#define B_TYPE_SERIAL_CTX (b_serial_ctx_get_type())
|
||||
|
||||
typedef enum b_serial_flags {
|
||||
B_SERIAL_F_NONE = 0,
|
||||
B_SERIAL_F_PRETTY = 0x01u,
|
||||
} b_serial_flags;
|
||||
|
||||
B_DECLARE_TYPE(b_serial_ctx);
|
||||
|
||||
B_TYPE_CLASS_DECLARATION_BEGIN(b_serial_ctx)
|
||||
b_status (*s_serialise)(
|
||||
b_serial_ctx *, b_object *, b_stream *, b_serial_flags);
|
||||
b_status (*s_deserialise)(
|
||||
b_serial_ctx *, b_stream *, b_object **, b_serial_flags);
|
||||
B_TYPE_CLASS_DECLARATION_END(b_serial_ctx)
|
||||
|
||||
typedef struct b_serial_ctx_data {
|
||||
b_stream_buffer *ctx_streambuf;
|
||||
} b_serial_ctx_data;
|
||||
|
||||
BLUE_API b_type b_serial_ctx_get_type(void);
|
||||
|
||||
BLUE_API b_status b_serial_ctx_serialise(
|
||||
b_serial_ctx *ctx, b_object *src, b_stream *dest, b_serial_flags flags);
|
||||
|
||||
BLUE_API b_status b_serial_ctx_deserialise(
|
||||
b_serial_ctx *ctx, b_stream *src, b_object **dest, b_serial_flags flags);
|
||||
|
||||
B_DECLS_END;
|
||||
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef BLUE_SERIAL_TOML_H_
|
||||
#define BLUE_SERIAL_TOML_H_
|
||||
|
||||
#include <blue/core/macros.h>
|
||||
|
||||
B_DECLS_BEGIN;
|
||||
|
||||
#define B_TYPE_TOML_SERIAL_CTX (b_toml_serial_ctx_get_type())
|
||||
|
||||
B_DECLARE_TYPE(b_toml_serial_ctx);
|
||||
|
||||
B_TYPE_CLASS_DECLARATION_BEGIN(b_toml_serial_ctx)
|
||||
B_TYPE_CLASS_DECLARATION_END(b_toml_serial_ctx)
|
||||
|
||||
BLUE_API b_type b_toml_serial_ctx_get_type(void);
|
||||
|
||||
B_TYPE_DEFAULT_CONSTRUCTOR(b_toml_serial_ctx, B_TYPE_TOML_SERIAL_CTX);
|
||||
|
||||
B_DECLS_END;
|
||||
|
||||
#endif
|
||||
8
serial/include/fx/serial.h
Normal file
8
serial/include/fx/serial.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef FX_SERIAL_H_
|
||||
#define FX_SERIAL_H_
|
||||
|
||||
#include <fx/serial/bitcode.h>
|
||||
#include <fx/serial/ctx.h>
|
||||
#include <fx/serial/toml.h>
|
||||
|
||||
#endif
|
||||
21
serial/include/fx/serial/bitcode.h
Normal file
21
serial/include/fx/serial/bitcode.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef FX_SERIAL_BITCODE_H_
|
||||
#define FX_SERIAL_BITCODE_H_
|
||||
|
||||
#include <fx/core/macros.h>
|
||||
|
||||
FX_DECLS_BEGIN;
|
||||
|
||||
#define FX_TYPE_BITCODE_SERIAL_CTX (fx_bitcode_serial_ctx_get_type())
|
||||
|
||||
FX_DECLARE_TYPE(fx_bitcode_serial_ctx);
|
||||
|
||||
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_bitcode_serial_ctx)
|
||||
FX_TYPE_CLASS_DECLARATION_END(fx_bitcode_serial_ctx)
|
||||
|
||||
FX_API fx_type fx_bitcode_serial_ctx_get_type(void);
|
||||
|
||||
FX_TYPE_DEFAULT_CONSTRUCTOR(fx_bitcode_serial_ctx, FX_TYPE_BITCODE_SERIAL_CTX);
|
||||
|
||||
FX_DECLS_END;
|
||||
|
||||
#endif
|
||||
42
serial/include/fx/serial/ctx.h
Normal file
42
serial/include/fx/serial/ctx.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef FX_SERIAL_CTX_H_
|
||||
#define FX_SERIAL_CTX_H_
|
||||
|
||||
#include <fx/core/macros.h>
|
||||
#include <fx/core/misc.h>
|
||||
#include <fx/core/object.h>
|
||||
#include <fx/core/status.h>
|
||||
#include <fx/core/stream.h>
|
||||
|
||||
FX_DECLS_BEGIN;
|
||||
|
||||
#define FX_TYPE_SERIAL_CTX (fx_serial_ctx_get_type())
|
||||
|
||||
typedef enum fx_serial_flags {
|
||||
FX_SERIAL_F_NONE = 0,
|
||||
FX_SERIAL_F_PRETTY = 0x01u,
|
||||
} fx_serial_flags;
|
||||
|
||||
FX_DECLARE_TYPE(fx_serial_ctx);
|
||||
|
||||
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_serial_ctx)
|
||||
fx_status (*s_serialise)(
|
||||
fx_serial_ctx *, fx_object *, fx_stream *, fx_serial_flags);
|
||||
fx_status (*s_deserialise)(
|
||||
fx_serial_ctx *, fx_stream *, fx_object **, fx_serial_flags);
|
||||
FX_TYPE_CLASS_DECLARATION_END(fx_serial_ctx)
|
||||
|
||||
typedef struct fx_serial_ctx_data {
|
||||
fx_stream_buffer *ctx_streambuf;
|
||||
} fx_serial_ctx_data;
|
||||
|
||||
FX_API fx_type fx_serial_ctx_get_type(void);
|
||||
|
||||
FX_API fx_status fx_serial_ctx_serialise(
|
||||
fx_serial_ctx *ctx, fx_object *src, fx_stream *dest, fx_serial_flags flags);
|
||||
|
||||
FX_API fx_status fx_serial_ctx_deserialise(
|
||||
fx_serial_ctx *ctx, fx_stream *src, fx_object **dest, fx_serial_flags flags);
|
||||
|
||||
FX_DECLS_END;
|
||||
|
||||
#endif
|
||||
21
serial/include/fx/serial/toml.h
Normal file
21
serial/include/fx/serial/toml.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef FX_SERIAL_TOML_H_
|
||||
#define FX_SERIAL_TOML_H_
|
||||
|
||||
#include <fx/core/macros.h>
|
||||
|
||||
FX_DECLS_BEGIN;
|
||||
|
||||
#define FX_TYPE_TOML_SERIAL_CTX (fx_toml_serial_ctx_get_type())
|
||||
|
||||
FX_DECLARE_TYPE(fx_toml_serial_ctx);
|
||||
|
||||
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_toml_serial_ctx)
|
||||
FX_TYPE_CLASS_DECLARATION_END(fx_toml_serial_ctx)
|
||||
|
||||
FX_API fx_type fx_toml_serial_ctx_get_type(void);
|
||||
|
||||
FX_TYPE_DEFAULT_CONSTRUCTOR(fx_toml_serial_ctx, FX_TYPE_TOML_SERIAL_CTX);
|
||||
|
||||
FX_DECLS_END;
|
||||
|
||||
#endif
|
||||
804
serial/toml.c
804
serial/toml.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user