mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Add typedef to structures that have mrb_ prefix. Use typedef-ed type instead of struct directly.
This commit is contained in:
@@ -11,18 +11,18 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct mrb_shared_array {
|
||||
typedef struct mrb_shared_array {
|
||||
int refcnt;
|
||||
mrb_value *ptr;
|
||||
int len;
|
||||
};
|
||||
} mrb_shared_array;
|
||||
|
||||
struct RArray {
|
||||
MRB_OBJECT_HEADER;
|
||||
int len;
|
||||
union {
|
||||
int capa;
|
||||
struct mrb_shared_array *shared;
|
||||
mrb_shared_array *shared;
|
||||
} aux;
|
||||
mrb_value *ptr;
|
||||
};
|
||||
@@ -35,7 +35,7 @@ struct RArray {
|
||||
#define RARRAY_PTR(a) (RARRAY(a)->ptr)
|
||||
#define MRB_ARY_SHARED 256
|
||||
|
||||
void mrb_ary_decref(mrb_state*, struct mrb_shared_array*);
|
||||
void mrb_ary_decref(mrb_state*, mrb_shared_array*);
|
||||
mrb_value mrb_ary_new_capa(mrb_state*, int);
|
||||
mrb_value mrb_ary_new(mrb_state *mrb);
|
||||
mrb_value mrb_ary_new_elts(mrb_state *mrb, int n, const mrb_value *elts);
|
||||
|
||||
@@ -11,19 +11,19 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct mrb_data_type {
|
||||
typedef struct mrb_data_type {
|
||||
const char *struct_name;
|
||||
void (*dfree)(mrb_state *mrb, void*);
|
||||
};
|
||||
} mrb_data_type;
|
||||
|
||||
struct RData {
|
||||
MRB_OBJECT_HEADER;
|
||||
struct iv_tbl *iv;
|
||||
struct mrb_data_type *type;
|
||||
mrb_data_type *type;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct RData *mrb_data_object_alloc(mrb_state *mrb, struct RClass* klass, void *datap, const struct mrb_data_type *type);
|
||||
struct RData *mrb_data_object_alloc(mrb_state *mrb, struct RClass* klass, void *datap, const mrb_data_type *type);
|
||||
|
||||
#define Data_Wrap_Struct(mrb,klass,type,ptr)\
|
||||
mrb_data_object_alloc(mrb,klass,ptr,type)
|
||||
@@ -37,8 +37,8 @@ struct RData *mrb_data_object_alloc(mrb_state *mrb, struct RClass* klass, void *
|
||||
#define RDATA(obj) ((struct RData *)((obj).value.p))
|
||||
#define DATA_PTR(d) (RDATA(d)->data)
|
||||
#define DATA_TYPE(d) (RDATA(d)->type)
|
||||
void *mrb_get_datatype(mrb_state *mrb, mrb_value, const struct mrb_data_type*);
|
||||
void *mrb_check_datatype(mrb_state *mrb, mrb_value, const struct mrb_data_type*);
|
||||
void *mrb_get_datatype(mrb_state *mrb, mrb_value, const mrb_data_type*);
|
||||
void *mrb_check_datatype(mrb_state *mrb, mrb_value, const mrb_data_type*);
|
||||
#define Data_Get_Struct(mrb,obj,type,sval) do {\
|
||||
*(void**)&sval = mrb_check_datatype(mrb, obj, type); \
|
||||
} while (0)
|
||||
|
||||
@@ -82,7 +82,7 @@ mrb_value mrb_load_irep_file(mrb_state*,FILE*);
|
||||
#define MRB_DUMP_DEFAULT_STR_LEN 128
|
||||
|
||||
//Rite Binary file_header
|
||||
typedef struct _rite_binary_header {
|
||||
typedef struct {
|
||||
unsigned char rbfi[4]; //Rite Binary File Identify
|
||||
unsigned char rbfv[8]; //Rite Binary File Format Version
|
||||
unsigned char risv[8]; //Rite Instruction Specification Version
|
||||
@@ -95,7 +95,7 @@ typedef struct _rite_binary_header {
|
||||
} rite_binary_header;
|
||||
|
||||
// Rite File file_header
|
||||
typedef struct _rite_file_header {
|
||||
typedef struct {
|
||||
unsigned char rbfi[4]; //Rite Binary File Identify
|
||||
unsigned char rbfv[8]; //Rite Binary File Format Version
|
||||
unsigned char risv[8]; //Rite Instruction Specification Version
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct mrb_range_edges {
|
||||
typedef struct mrb_range_edges {
|
||||
mrb_value beg;
|
||||
mrb_value end;
|
||||
};
|
||||
} mrb_range_edges;
|
||||
|
||||
struct RRange {
|
||||
MRB_OBJECT_HEADER;
|
||||
struct mrb_range_edges *edges;
|
||||
mrb_range_edges *edges;
|
||||
int excl;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,18 +21,18 @@ extern "C" {
|
||||
|
||||
extern const char mrb_digitmap[];
|
||||
|
||||
struct mrb_shared_string {
|
||||
typedef struct mrb_shared_string {
|
||||
int refcnt;
|
||||
char *ptr;
|
||||
int len;
|
||||
};
|
||||
} mrb_shared_string;
|
||||
|
||||
struct RString {
|
||||
MRB_OBJECT_HEADER;
|
||||
int len;
|
||||
union {
|
||||
int capa;
|
||||
struct mrb_shared_string *shared;
|
||||
mrb_shared_string *shared;
|
||||
} aux;
|
||||
char *ptr;
|
||||
};
|
||||
@@ -45,7 +45,7 @@ struct RString {
|
||||
#define RSTRING_END(s) (RSTRING(s)->ptr + RSTRING(s)->len)
|
||||
#define MRB_STR_SHARED 256
|
||||
|
||||
void mrb_str_decref(mrb_state*, struct mrb_shared_string*);
|
||||
void mrb_str_decref(mrb_state*, mrb_shared_string*);
|
||||
mrb_value mrb_str_literal(mrb_state*, mrb_value);
|
||||
void mrb_str_concat(mrb_state*, mrb_value, mrb_value);
|
||||
mrb_value mrb_str_plus(mrb_state*, mrb_value, mrb_value);
|
||||
|
||||
Reference in New Issue
Block a user