-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from LanzaSchneider/dev
update
- Loading branch information
Showing
6 changed files
with
1,609 additions
and
839 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
** mruby/marshal.h - Marshal class | ||
*/ | ||
|
||
#ifndef MRUBY_MARSHAL_H | ||
#define MRUBY_MARSHAL_H | ||
|
||
#include "mruby/common.h" | ||
|
||
MRB_BEGIN_DECL | ||
|
||
/** | ||
* Function pointer type for mruby-marshal-c writer. | ||
* | ||
* @param mrb mrb_state | ||
* @param src source data | ||
* @param size size of data to write | ||
* @param dest the target to write, maybe an IO or a String, etc. | ||
* @param position the write position of dest | ||
* @return bytes written | ||
*/ | ||
typedef mrb_uint (*mrb_marshal_writer_t)(mrb_state *mrb, const void *src, mrb_uint size, mrb_value dest, mrb_uint position); | ||
|
||
/** | ||
* Function pointer type for mruby-marshal-c reader. | ||
* | ||
* @param mrb mrb_state | ||
* @param src the source to read, maybe an IO or a String, etc. | ||
* @param dest the target to write | ||
* @param size size of data to read | ||
* @param position the read position of src | ||
* @return bytes read | ||
*/ | ||
typedef mrb_uint (*mrb_marshal_reader_t)(mrb_state *mrb, mrb_value src, void *dest, mrb_uint size, mrb_uint position); | ||
|
||
MRB_API void mrb_marshal_dump(mrb_state *mrb, mrb_value obj, mrb_marshal_writer_t writer, mrb_value target, int limit); | ||
MRB_API mrb_value mrb_marshal_load(mrb_state *mrb, mrb_marshal_reader_t reader, mrb_value source); | ||
|
||
MRB_END_DECL | ||
|
||
#endif /* MRUBY_MARSHAL_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#define MARSHAL_MAJOR 4 | ||
#define MARSHAL_MINOR 8 | ||
|
||
#define TYPE_NIL '0' | ||
#define TYPE_TRUE 'T' | ||
#define TYPE_FALSE 'F' | ||
#define TYPE_FIXNUM 'i' | ||
|
||
#define TYPE_EXTENDED 'e' | ||
#define TYPE_UCLASS 'C' | ||
#define TYPE_OBJECT 'o' | ||
#define TYPE_DATA 'd' | ||
#define TYPE_USERDEF 'u' | ||
#define TYPE_USRMARSHAL 'U' | ||
#define TYPE_FLOAT 'f' | ||
#define TYPE_BIGNUM 'l' | ||
#define TYPE_STRING '"' | ||
#define TYPE_REGEXP '/' | ||
#define TYPE_ARRAY '[' | ||
#define TYPE_HASH '{' | ||
#define TYPE_HASH_DEF '}' | ||
#define TYPE_STRUCT 'S' | ||
#define TYPE_MODULE_OLD 'M' | ||
#define TYPE_CLASS 'c' | ||
#define TYPE_MODULE 'm' | ||
|
||
#define TYPE_SYMBOL ':' | ||
#define TYPE_SYMLINK ';' | ||
|
||
#define TYPE_IVAR 'I' | ||
#define TYPE_LINK '@' | ||
|
||
#define s_dump MRB_SYM(_dump) | ||
#define s_load MRB_SYM(_load) | ||
#define s_mdump MRB_SYM(marshal_dump) | ||
#define s_mload MRB_SYM(marshal_load) | ||
#define s_dump_data MRB_SYM(_dump_data) | ||
#define s_load_data MRB_SYM(_load_data) | ||
#define s_alloc MRB_SYM(_alloc) | ||
#define s_call MRB_SYM(call) | ||
#define s_getbyte MRB_SYM(getbyte) | ||
#define s_read MRB_SYM(read) | ||
#define s_write MRB_SYM(write) | ||
#define s_binmode MRB_SYM(binmode) | ||
|
||
#define RSHIFT(x, y) ((x) >> (int)y) | ||
#define FLOAT_DIG 17 | ||
#define DECIMAL_MANT (53 - 16) /* from IEEE754 double precision */ | ||
#define SIZEOF_LONG 4 |
Oops, something went wrong.