Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
138ecf47
Commit
138ecf47
authored
Mar 01, 2013
by
mattn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pluggable Struct
parent
c567a28f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
25 additions
and
59 deletions
+25
-59
include/mrbconf.h
include/mrbconf.h
+0
-4
include/mruby/struct.h
include/mruby/struct.h
+0
-27
include/mruby/value.h
include/mruby/value.h
+10
-12
mrbgems/mruby-struct/mrbgem.rake
mrbgems/mruby-struct/mrbgem.rake
+4
-0
mrbgems/mruby-struct/src/struct.c
mrbgems/mruby-struct/src/struct.c
+11
-7
mrbgems/mruby-struct/test/struct.rb
mrbgems/mruby-struct/test/struct.rb
+0
-0
src/etc.c
src/etc.c
+0
-1
src/gc.c
src/gc.c
+0
-3
src/init.c
src/init.c
+0
-4
src/object.c
src/object.c
+0
-1
No files found.
include/mrbconf.h
View file @
138ecf47
...
...
@@ -45,7 +45,6 @@
/* -DDISABLE_XXXX to drop following features */
//#define DISABLE_SPRINTF /* Kernel.sprintf method */
//#define DISABLE_STRUCT /* Struct class */
//#define DISABLE_STDIO /* use of stdio */
/* -DENABLE_XXXX to enable following features */
...
...
@@ -84,9 +83,6 @@ typedef short mrb_sym;
#ifndef DISABLE_SPRINTF
#define ENABLE_SPRINTF
#endif
#ifndef DISABLE_STRUCT
#define ENABLE_STRUCT
#endif
#ifndef DISABLE_STDIO
#define ENABLE_STDIO
#endif
...
...
include/mruby/struct.h
deleted
100644 → 0
View file @
c567a28f
/*
** mruby/struct.h - Struct class
**
** See Copyright Notice in mruby.h
*/
#ifndef MRUBY_STRUCT_H
#define MRUBY_STRUCT_H
#if defined(__cplusplus)
extern
"C"
{
#endif
struct
RStruct
{
struct
RBasic
basic
;
long
len
;
mrb_value
*
ptr
;
};
#define RSTRUCT(st) ((struct RStruct*)((st).value.p))
#define RSTRUCT_LEN(st) ((int)(RSTRUCT(st)->len))
#define RSTRUCT_PTR(st) (RSTRUCT(st)->ptr)
#if defined(__cplusplus)
}
/* extern "C" { */
#endif
#endif
/* MRUBY_STRUCT_H */
include/mruby/value.h
View file @
138ecf47
...
...
@@ -29,12 +29,11 @@ enum mrb_vtype {
MRB_TT_HASH
,
/* 16 */
MRB_TT_STRING
,
/* 17 */
MRB_TT_RANGE
,
/* 18 */
MRB_TT_STRUCT
,
/* 19 */
MRB_TT_EXCEPTION
,
/* 20 */
MRB_TT_FILE
,
/* 21 */
MRB_TT_ENV
,
/* 22 */
MRB_TT_DATA
,
/* 23 */
MRB_TT_MAXDEFINE
/* 24 */
MRB_TT_EXCEPTION
,
/* 19 */
MRB_TT_FILE
,
/* 20 */
MRB_TT_ENV
,
/* 21 */
MRB_TT_DATA
,
/* 22 */
MRB_TT_MAXDEFINE
/* 23 */
};
typedef
struct
mrb_value
{
...
...
@@ -89,12 +88,11 @@ enum mrb_vtype {
MRB_TT_HASH
,
/* 17 */
MRB_TT_STRING
,
/* 18 */
MRB_TT_RANGE
,
/* 19 */
MRB_TT_STRUCT
,
/* 20 */
MRB_TT_EXCEPTION
,
/* 21 */
MRB_TT_FILE
,
/* 22 */
MRB_TT_ENV
,
/* 23 */
MRB_TT_DATA
,
/* 24 */
MRB_TT_MAXDEFINE
/* 25 */
MRB_TT_EXCEPTION
,
/* 20 */
MRB_TT_FILE
,
/* 21 */
MRB_TT_ENV
,
/* 22 */
MRB_TT_DATA
,
/* 23 */
MRB_TT_MAXDEFINE
/* 24 */
};
#ifdef MRB_ENDIAN_BIG
...
...
mrbgems/mruby-struct/mrbgem.rake
0 → 100644
View file @
138ecf47
MRuby
::
Gem
::
Specification
.
new
(
'mruby-struct'
)
do
|
spec
|
spec
.
license
=
'MIT'
spec
.
authors
=
'mruby developers'
end
src/struct.c
→
mrbgems/mruby-struct/
src/struct.c
View file @
138ecf47
...
...
@@ -4,18 +4,23 @@
** See Copyright Notice in mruby.h
*/
#include "mruby.h"
#ifdef ENABLE_STRUCT
#include <string.h>
#include "error.h"
#include "mruby/struct.h"
#include "mruby/array.h"
#include <stdarg.h>
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/string.h"
#include "mruby/class.h"
#include "mruby/variable.h"
struct
RStruct
{
struct
RBasic
basic
;
long
len
;
mrb_value
*
ptr
;
};
#define RSTRUCT(st) ((struct RStruct*)((st).value.p))
#define RSTRUCT_LEN(st) ((int)(RSTRUCT(st)->len))
#define RSTRUCT_PTR(st) (RSTRUCT(st)->ptr)
static
struct
RClass
*
struct_class
(
mrb_state
*
mrb
)
...
...
@@ -778,4 +783,3 @@ mrb_init_struct(mrb_state *mrb)
mrb_define_method
(
mrb
,
st
,
"eql?"
,
mrb_struct_eql
,
ARGS_REQ
(
1
));
/* 15.2.18.4.12(x) */
}
#endif
/* ENABLE_STRUCT */
test/
t/struct.rb
→
mrbgems/mruby-struct/tes
t/struct.rb
View file @
138ecf47
File moved
src/etc.c
View file @
138ecf47
...
...
@@ -170,7 +170,6 @@ mrb_obj_id(mrb_value obj)
case
MRB_TT_ARRAY
:
case
MRB_TT_HASH
:
case
MRB_TT_RANGE
:
case
MRB_TT_STRUCT
:
case
MRB_TT_EXCEPTION
:
case
MRB_TT_FILE
:
case
MRB_TT_DATA
:
...
...
src/gc.c
View file @
138ecf47
...
...
@@ -86,9 +86,6 @@ typedef struct {
struct
RArray
array
;
struct
RHash
hash
;
struct
RRange
range
;
#ifdef ENABLE_STRUCT
struct
RStruct
strct
;
#endif
struct
RData
data
;
struct
RProc
proc
;
}
as
;
...
...
src/init.c
View file @
138ecf47
...
...
@@ -20,7 +20,6 @@ void mrb_init_array(mrb_state*);
void
mrb_init_hash
(
mrb_state
*
);
void
mrb_init_numeric
(
mrb_state
*
);
void
mrb_init_range
(
mrb_state
*
);
void
mrb_init_struct
(
mrb_state
*
);
void
mrb_init_gc
(
mrb_state
*
);
void
mrb_init_print
(
mrb_state
*
);
void
mrb_init_math
(
mrb_state
*
);
...
...
@@ -48,9 +47,6 @@ mrb_init_core(mrb_state *mrb)
mrb_init_hash
(
mrb
);
DONE
;
mrb_init_numeric
(
mrb
);
DONE
;
mrb_init_range
(
mrb
);
DONE
;
#ifdef ENABLE_STRUCT
mrb_init_struct
(
mrb
);
DONE
;
#endif
mrb_init_gc
(
mrb
);
DONE
;
#ifdef ENABLE_STDIO
mrb_init_print
(
mrb
);
DONE
;
...
...
src/object.c
View file @
138ecf47
...
...
@@ -379,7 +379,6 @@ static const struct types {
{
MRB_TT_HASH
,
"Hash"
},
{
MRB_TT_STRING
,
"String"
},
{
MRB_TT_RANGE
,
"Range"
},
{
MRB_TT_STRUCT
,
"Struct"
},
// {MRB_TT_BIGNUM, "Bignum"},
{
MRB_TT_FILE
,
"File"
},
{
MRB_TT_DATA
,
"Data"
},
/* internal use: wrapped C pointers */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment