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
40bf7bde
Commit
40bf7bde
authored
Sep 21, 2015
by
Seba Gamboa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sorting documentation grouping
parent
c1276146
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
131 additions
and
94 deletions
+131
-94
include/mruby.h
include/mruby.h
+91
-43
include/mruby/array.h
include/mruby/array.h
+2
-3
include/mruby/class.h
include/mruby/class.h
+2
-3
include/mruby/compile.h
include/mruby/compile.h
+2
-3
include/mruby/data.h
include/mruby/data.h
+2
-3
include/mruby/debug.h
include/mruby/debug.h
+2
-3
include/mruby/dump.h
include/mruby/dump.h
+2
-3
include/mruby/error.h
include/mruby/error.h
+2
-3
include/mruby/gc.h
include/mruby/gc.h
+2
-3
include/mruby/hash.h
include/mruby/hash.h
+2
-3
include/mruby/irep.h
include/mruby/irep.h
+2
-3
include/mruby/khash.h
include/mruby/khash.h
+2
-3
include/mruby/numeric.h
include/mruby/numeric.h
+5
-3
include/mruby/proc.h
include/mruby/proc.h
+2
-3
include/mruby/range.h
include/mruby/range.h
+2
-3
include/mruby/string.h
include/mruby/string.h
+2
-3
include/mruby/value.h
include/mruby/value.h
+5
-3
include/mruby/variable.h
include/mruby/variable.h
+2
-3
No files found.
include/mruby.h
View file @
40bf7bde
...
@@ -40,15 +40,19 @@
...
@@ -40,15 +40,19 @@
/**
/**
* @file mruby.h
* @file mruby.h
* @brief Main header of mruby C API. Include this first.
* @brief Main header of mruby C API. Include this first.
* @defgroup mrb_core MRuby core
* @defgroup mruby MRuby C API
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
typedef
uint32_t
mrb_code
;
typedef
uint32_t
mrb_code
;
/**
* Required arguments signature type.
*/
typedef
uint32_t
mrb_aspec
;
typedef
uint32_t
mrb_aspec
;
struct
mrb_irep
;
struct
mrb_irep
;
struct
mrb_state
;
struct
mrb_state
;
...
@@ -245,19 +249,17 @@ MRB_API void mrb_prepend_module(mrb_state*, struct RClass*, struct RClass*);
...
@@ -245,19 +249,17 @@ MRB_API void mrb_prepend_module(mrb_state*, struct RClass*, struct RClass*);
*
*
* If you're creating a gem it may look something like this:
* If you're creating a gem it may look something like this:
*
*
* mrb_value example_method(mrb_state* mrb, mrb_value self){
* mrb_value example_method(mrb_state* mrb, mrb_value self)
* {
* puts("Executing example command!");
* puts("Executing example command!");
* return self;
* return self;
* }
* }
*
*
* void mrb_example_gem_init(mrb_state* mrb) {
* void mrb_example_gem_init(mrb_state* mrb)
* {
* mrb_define_method(mrb, mrb->kernel_module, "example_method", example_method, MRB_ARGS_NONE());
* mrb_define_method(mrb, mrb->kernel_module, "example_method", example_method, MRB_ARGS_NONE());
* }
* }
*
*
* void mrb_example_gem_final(mrb_state* mrb) {
* //free(TheAnimals);
* }
*
* @param mrb
* @param mrb
* The MRuby state reference.
* The MRuby state reference.
* @param cla
* @param cla
...
@@ -265,7 +267,8 @@ MRB_API void mrb_prepend_module(mrb_state*, struct RClass*, struct RClass*);
...
@@ -265,7 +267,8 @@ MRB_API void mrb_prepend_module(mrb_state*, struct RClass*, struct RClass*);
* @param func
* @param func
* The function pointer to the method definition.
* The function pointer to the method definition.
* @param aspec
* @param aspec
* The method required parameters definition.
* The method parameters declaration.
* See @ref mruby_mrb_aspec for details.
*/
*/
MRB_API
void
mrb_define_method
(
mrb_state
*
mrb
,
struct
RClass
*
cla
,
const
char
*
name
,
mrb_func_t
func
,
mrb_aspec
aspec
);
MRB_API
void
mrb_define_method
(
mrb_state
*
mrb
,
struct
RClass
*
cla
,
const
char
*
name
,
mrb_func_t
func
,
mrb_aspec
aspec
);
...
@@ -293,28 +296,95 @@ MRB_API mrb_bool mrb_obj_respond_to(mrb_state *mrb, struct RClass* c, mrb_sym mi
...
@@ -293,28 +296,95 @@ MRB_API mrb_bool mrb_obj_respond_to(mrb_state *mrb, struct RClass* c, mrb_sym mi
MRB_API
struct
RClass
*
mrb_define_class_under
(
mrb_state
*
mrb
,
struct
RClass
*
outer
,
const
char
*
name
,
struct
RClass
*
super
);
MRB_API
struct
RClass
*
mrb_define_class_under
(
mrb_state
*
mrb
,
struct
RClass
*
outer
,
const
char
*
name
,
struct
RClass
*
super
);
MRB_API
struct
RClass
*
mrb_define_module_under
(
mrb_state
*
mrb
,
struct
RClass
*
outer
,
const
char
*
name
);
MRB_API
struct
RClass
*
mrb_define_module_under
(
mrb_state
*
mrb
,
struct
RClass
*
outer
,
const
char
*
name
);
/* required arguments */
/**
* @defgroup mruby_mrb_aspec Required arguments declaration helpers.
*
* Helper functions to declare arguments requirements on methods declared by
* \ref mrb_define_method and the like
*
* @{
*/
/**
* Function requires n arguments.
*
* @param n
* The number of required arguments.
*/
#define MRB_ARGS_REQ(n) ((mrb_aspec)((n)&0x1f) << 18)
#define MRB_ARGS_REQ(n) ((mrb_aspec)((n)&0x1f) << 18)
/* optional arguments */
/**
* Funtion takes n optional arguments
*
* @param n
* The number of optional arguments.
*/
#define MRB_ARGS_OPT(n) ((mrb_aspec)((n)&0x1f) << 13)
#define MRB_ARGS_OPT(n) ((mrb_aspec)((n)&0x1f) << 13)
/* mandatory and optinal arguments */
/**
* Funtion takes n1 mandatory arguments and n2 optional arguments
*
* @param n1
* The number of required arguments.
* @param n2
* The number of optional arguments.
*/
#define MRB_ARGS_ARG(n1,n2) (MRB_ARGS_REQ(n1)|MRB_ARGS_OPT(n2))
#define MRB_ARGS_ARG(n1,n2) (MRB_ARGS_REQ(n1)|MRB_ARGS_OPT(n2))
/* rest argument */
/*
*
rest argument */
#define MRB_ARGS_REST() ((mrb_aspec)(1 << 12))
#define MRB_ARGS_REST() ((mrb_aspec)(1 << 12))
/* required arguments after rest */
/** required arguments after rest */
#define MRB_ARGS_POST(n) ((mrb_aspec)((n)&0x1f) << 7)
#define MRB_ARGS_POST(n) ((mrb_aspec)((n)&0x1f) << 7)
/* keyword arguments (n of keys, kdict) */
/** keyword arguments (n of keys, kdict) */
#define MRB_ARGS_KEY(n1,n2) ((mrb_aspec)((((n1)&0x1f) << 2) | ((n2)?(1<<1):0)))
#define MRB_ARGS_KEY(n1,n2) ((mrb_aspec)((((n1)&0x1f) << 2) | ((n2)?(1<<1):0)))
/* block argument */
/**
* Function takes a block argument
*/
#define MRB_ARGS_BLOCK() ((mrb_aspec)1)
#define MRB_ARGS_BLOCK() ((mrb_aspec)1)
/* accept any number of arguments */
/**
* Function accepts any number of arguments
*/
#define MRB_ARGS_ANY() MRB_ARGS_REST()
#define MRB_ARGS_ANY() MRB_ARGS_REST()
/* accept no arguments */
/**
* Function accepts no arguments
*/
#define MRB_ARGS_NONE() ((mrb_aspec)0)
#define MRB_ARGS_NONE() ((mrb_aspec)0)
/** Retrieve arguments from mrb_state.
/** @} */
/**
* Format specifiers for \ref mrb_get_args function
*
* Must be a list of following format specifiers:
*
* | char | mruby type | retrieve types |note |
* |:----:|----------------|---------------------|----------------------------------------------------|
* | o | Object | mrb_value | Could be used to retrieve any type of argument |
* | C | Class/Module | mrb_value | |
* | S | String | mrb_value | when ! follows, the value may be nil |
* | A | Array | mrb_value | when ! follows, the value may be nil |
* | H | Hash | mrb_value | when ! follows, the value may be nil |
* | s | String | char *, mrb_int | Receive two arguments; s! gives (NULL,0) for nil |
* | z | String | char * | NUL terminated string; z! gives NULL for nil |
* | a | Array | mrb_value *, mrb_int | Receive two arguments; a! gives (NULL,0) for nil |
* | f | Float | mrb_float | |
* | i | Integer | mrb_int | |
* | b | boolean | mrb_bool | |
* | n | Symbol | mrb_sym | |
* | & | block | mrb_value | |
* | * | rest arguments | mrb_value *, mrb_int | Receive the rest of arguments as an array. |
* | \| | optional | | After this spec following specs would be optional. |
* | ? | optional given | mrb_bool | True if preceding argument is given. Used to check optional argument is given. |
*/
typedef
const
char
*
mrb_args_format
;
/**
* Retrieve arguments from mrb_state.
*
*
* When applicable, implicit conversions (such as to_str, to_ary, to_hash) are
* When applicable, implicit conversions (such as to_str, to_ary, to_hash) are
* applied to received arguments.
* applied to received arguments.
...
@@ -322,36 +392,14 @@ MRB_API struct RClass * mrb_define_module_under(mrb_state *mrb, struct RClass *o
...
@@ -322,36 +392,14 @@ MRB_API struct RClass * mrb_define_module_under(mrb_state *mrb, struct RClass *o
*
*
* @param mrb
* @param mrb
* The current MRuby state.
* The current MRuby state.
*
* @param format
* @param format
* is a list of following format specifiers:
* is a list of format specifiers see @ref mrb_args_format
* <pre>
* char mruby type retrieve types note
* o Object mrb_value Could be used to retrieve any type of argument
* C Class/Module mrb_value
* S String mrb_value when ! follows, the value may be nil
* A Array mrb_value when ! follows, the value may be nil
* H Hash mrb_value when ! follows, the value may be nil
* s String char*, mrb_int Receive two arguments; s! gives (NULL,0) for nil
* z String char* NUL terminated string; z! gives NULL for nil
* a Array mrb_value*, mrb_int Receive two arguments; a! gives (NULL,0) for nil
* f Float mrb_float
* i Integer mrb_int
* b boolean mrb_bool
* n Symbol mrb_sym
* & block mrb_value
* * rest arguments mrb_value*, mrb_int Receive the rest of arguments as an array.
* | optional After this spec following specs would be optional.
* ? optional given mrb_bool True if preceding argument is given. Used to check optional argument is given.
* </pre>
*
* @param ...
* @param ...
* The passing variadic arguments must be a pointer of retrieving type.
* The passing variadic arguments must be a pointer of retrieving type.
*
* @return
* @return
* the number of arguments retrieved.
* the number of arguments retrieved.
*/
*/
MRB_API
mrb_int
mrb_get_args
(
mrb_state
*
mrb
,
const
char
*
format
,
...);
MRB_API
mrb_int
mrb_get_args
(
mrb_state
*
mrb
,
mrb_args_format
format
,
...);
/* `strlen` for character string literals (use with caution or `strlen` instead)
/* `strlen` for character string literals (use with caution or `strlen` instead)
Adjacent string literals are concatenated in C/C++ in translation phase 6.
Adjacent string literals are concatenated in C/C++ in translation phase 6.
...
...
include/mruby/array.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/array.h
* @file mruby/array.h
* @brief Array class
* @defgroup mruby_array Array class
* @defgroup mrb_array MRuby Array class
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/class.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/class.h
* @file mruby/class.h
* @brief Class class
* @defgroup mruby_class Class class
* @defgroup mrb_class MRuby Class class
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/compile.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/compile.h
* @file mruby/compile.h
* @brief MRuby compiler
* @defgroup mruby_compile Compiler
* @defgroup mrb_compile MRuby compiler
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/data.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/data.h
* @file mruby/data.h
* @brief User defined objects.
* @defgroup mruby_data User defined objects.
* @defgroup mrb_string MRuby User defined objects.
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/debug.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/debug.h
* @file mruby/debug.h
* @brief Debugging.
* @defgroup mruby_debug Debugging.
* @defgroup mrb_string MRuby Debugging.
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/dump.h
View file @
40bf7bde
...
@@ -13,9 +13,8 @@
...
@@ -13,9 +13,8 @@
/**
/**
* @file mruby/dump.h
* @file mruby/dump.h
* @brief Dumping compiled mruby script.
* @defgroup mruby_dump Dumping compiled mruby script.
* @defgroup mrb_dump Dumping compiled mruby script.
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/error.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/error.h
* @file mruby/error.h
* @brief Error handling.
* @defgroup mruby_error Error handling.
* @defgroup mrb_error MRuby Error handling.
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/gc.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/gc.h
* @file mruby/gc.h
* @brief Uncommon memory management stuffs.
* @defgroup mruby_gc Uncommon memory management stuffs.
* @defgroup mrb_gc MRuby garbage collection.
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/hash.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/hash.h
* @file mruby/hash.h
* @brief Hash class
* @defgroup mruby_hash Hash class
* @defgroup mrb_hash MRuby Hash class
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/irep.h
View file @
40bf7bde
...
@@ -12,9 +12,8 @@
...
@@ -12,9 +12,8 @@
/**
/**
* @file mruby/irep.h
* @file mruby/irep.h
* @brief Compiled mruby script.
* @defgroup mruby_irep Compiled mruby scripts.
* @defgroup mrb_irep Compiled mruby script.
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/khash.h
View file @
40bf7bde
...
@@ -14,9 +14,8 @@
...
@@ -14,9 +14,8 @@
/**
/**
* @file mruby/khash.h
* @file mruby/khash.h
* @brief Defines of khash which is used in hash table of mruby.
* @defgroup mruby_khash khash definitions used in mruby's hash table.
* @defgroup mrb_khash Defines of khash which is used in hash table of mruby.
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/numeric.h
View file @
40bf7bde
...
@@ -11,9 +11,11 @@
...
@@ -11,9 +11,11 @@
/**
/**
* @file mruby/numeric.h
* @file mruby/numeric.h
* @brief Numeric class and sub-classes of it.
* @defgroup mruby_numeric Numeric class and it's sub-classes.
* @defgroup mrb_string Numeric class and sub-classes of it.
*
* @ingroup MRuby
* Numeric, Integer, Float, Fixnum classes
*
* @ingroup mruby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/proc.h
View file @
40bf7bde
...
@@ -12,9 +12,8 @@
...
@@ -12,9 +12,8 @@
/**
/**
* @file mruby/proc.h
* @file mruby/proc.h
* @brief Proc class
* @defgroup mruby_proc Proc class
* @defgroup mrb_proc MRuby Proc class
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/range.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/range.h
* @file mruby/range.h
* @brief Range class
* @defgroup mruby_range Range class
* @defgroup mrb_range MRuby Range class
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/string.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/string.h
* @file mruby/string.h
* @brief String class
* @defgroup mrb_string String class
* @defgroup mrb_string MRuby String class
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/value.h
View file @
40bf7bde
...
@@ -11,9 +11,11 @@
...
@@ -11,9 +11,11 @@
/**
/**
* @file mruby/value.h
* @file mruby/value.h
* @brief mrb_value functions and macros.
* @defgroup mruby_value Value definitions
* @defgroup mrb_value mrb_value functions and macros.
*
* @ingroup MRuby
* @ref mrb_value functions and macros.
*
* @ingroup mruby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
include/mruby/variable.h
View file @
40bf7bde
...
@@ -11,9 +11,8 @@
...
@@ -11,9 +11,8 @@
/**
/**
* @file mruby/variable.h
* @file mruby/variable.h
* @brief Functions to access mruby variables.
* @defgroup mruby_variable Functions to access to mruby variables.
* @defgroup mrb_variable Functions to access to mruby variables.
* @ingroup mruby
* @ingroup MRuby
* @{
* @{
*/
*/
MRB_BEGIN_DECL
MRB_BEGIN_DECL
...
...
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