mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
move src/mdata.h to include/mruby/data.h
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#include "mruby/array.h"
|
||||
#include <string.h>
|
||||
#include "mruby/string.h"
|
||||
#include "mdata.h"
|
||||
#include "mruby/class.h"
|
||||
|
||||
#ifdef INCLUDE_REGEXP
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ extern "C" {
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "oniguruma.h"
|
||||
#include "mdata.h"
|
||||
#include "mruby/data.h"
|
||||
|
||||
int mrb_tolower(int c);
|
||||
int mrb_toupper(int c);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "mruby.h"
|
||||
#include "mdata.h"
|
||||
#include "mruby/string.h"
|
||||
#include "error.h"
|
||||
#include "mruby/numeric.h"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include "mruby/struct.h"
|
||||
#include "mruby/proc.h"
|
||||
#include "mdata.h"
|
||||
#include "mruby/data.h"
|
||||
#include "mruby/numeric.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "ritehash.h"
|
||||
#include "error.h"
|
||||
#include "method.h"
|
||||
#include "mdata.h"
|
||||
|
||||
#ifdef INCLUDE_REGEXP
|
||||
#include "re.h"
|
||||
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
mdata.h -
|
||||
|
||||
|
||||
Copyright (C) 2007 Yukihiro Matsumoto
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef RUBY_DATA_H
|
||||
#define RUBY_DATA_H 1
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
struct mrb_data_type {
|
||||
const char *struct_name;
|
||||
void (*dfree)(mrb_state *mrb, void*);
|
||||
};
|
||||
|
||||
struct RData {
|
||||
MRUBY_OBJECT_HEADER;
|
||||
struct kh_iv *iv;
|
||||
struct 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);
|
||||
|
||||
#define Data_Wrap_Struct(mrb,klass,type,ptr)\
|
||||
mrb_data_object_alloc(mrb,klass,ptr,type)
|
||||
|
||||
#define Data_Make_Struct(mrb,klass,strct,type,sval) (\
|
||||
sval = mrb_malloc(mrb, sizeof(strct)),\
|
||||
memset(sval, 0, sizeof(strct)),\
|
||||
Data_Wrap_Struct(mrb,klass,type,sval)\
|
||||
)
|
||||
|
||||
#define RDATA(obj) ((struct RData *)((obj).value.p))
|
||||
#define DATA_PTR(d) (RDATA(d)->data)
|
||||
#define DATA_TYPE(d) (RDATA(d)->type)
|
||||
void *mrb_check_datatype(mrb_state *mrb, mrb_value, const struct mrb_data_type*);
|
||||
#define Data_Get_Struct(mrb,obj,type,sval) do {\
|
||||
sval = mrb_check_datatype(mrb, obj, type); \
|
||||
} while (0)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif /* RUBY_DATA_H */
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "mruby/class.h"
|
||||
#include "method.h"
|
||||
#include "mruby/numeric.h"
|
||||
#include "mdata.h"
|
||||
|
||||
#ifdef INCLUDE_REGEXP
|
||||
#define mrb_usascii_str_new2 mrb_usascii_str_new_cstr
|
||||
|
||||
Reference in New Issue
Block a user