diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/api/mruby/range.h.md | 47 | ||||
| -rw-r--r-- | doc/api/mruby/re.h.md | 3 | ||||
| -rw-r--r-- | doc/api/mruby/string.h.md | 46 | ||||
| -rw-r--r-- | doc/api/mruby/version.h.md | 33 |
4 files changed, 129 insertions, 0 deletions
diff --git a/doc/api/mruby/range.h.md b/doc/api/mruby/range.h.md new file mode 100644 index 000000000..188e6ede6 --- /dev/null +++ b/doc/api/mruby/range.h.md @@ -0,0 +1,47 @@ +#### mrb_range_new
+```C
+ mrb_value mrb_range_new(mrb_state*, mrb_value, mrb_value, mrb_bool);
+```
+Initializes a Range. The first mrb_value being the beginning value and second being the ending value.
+The third parameter is an mrb_bool value that represents the inclusion or exclusion of the last value.
+If the third parameter is 0 then it includes the last value in the range. If the third parameter is 1
+then it excludes the last value in the range.
+C code
+```C
+ #include <stdio.h>
+ #include <mruby.h>
+ #include "mruby/range.h" // Needs the range header.
+ #include "mruby/compile.h"
+
+ int main(int argc, char *argv[])
+ {
+ mrb_int beg = 0;
+ mrb_int end = 2;
+ mrb_bool exclude = 1;
+ mrb_value range_obj;
+ mrb_state *mrb = mrb_open();
+ if (!mrb) { /* handle error */ }
+ FILE *fp = fopen("test.rb","r");
+ range_obj = mrb_range_new(mrb, mrb_fixnum_value(beg), mrb_fixnum_value(end), exclude);
+ mrb_value obj = mrb_load_file(mrb,fp);
+ mrb_funcall(mrb, obj, "method_name", 1, range_obj);
+ fclose(fp);
+ mrb_close(mrb);
+ return 0;
+ }
+```
+Ruby code
+```Ruby
+ class Example_Class
+ def method_name(a)
+ puts a
+ puts a.class
+ end
+ end
+ Example_Class.new
+```
+This returns the following:
+```Ruby
+ 0...2
+ Range
+```
diff --git a/doc/api/mruby/re.h.md b/doc/api/mruby/re.h.md new file mode 100644 index 000000000..f5cd2a71e --- /dev/null +++ b/doc/api/mruby/re.h.md @@ -0,0 +1,3 @@ +### Macros
+#### REGEXP_CLASS
+A string with the name of the REGEXP class.
diff --git a/doc/api/mruby/string.h.md b/doc/api/mruby/string.h.md index 428a3ca40..7bf94df5b 100644 --- a/doc/api/mruby/string.h.md +++ b/doc/api/mruby/string.h.md @@ -1,3 +1,7 @@ +## Macros
+### mrb_str_ptr(s)
+Returns a pointer from a Ruby string.
+## Functions
### mrb_str_plus
```C
mrb_value mrb_str_plus(mrb_state*, mrb_value, mrb_value);
@@ -43,3 +47,45 @@ Duplicates a string object. mrb_value mrb_str_intern(mrb_state *mrb, mrb_value self);
```
Returns a symbol from a passed in string.
+### mrb_str_to_str
+```C
+ mrb_value mrb_str_to_str(mrb_state *mrb, mrb_value str);
+```
+Returns a converted string type.
+### mrb_str_equal
+```C
+ mrb_bool mrb_str_equal(mrb_state *mrb, mrb_value str1, mrb_value str2);
+```
+Returns true if the strings match and false if the strings don't match.
+### mrb_str_cat
+```C
+ mrb_value mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len);
+```
+Returns a concated string comprised of a Ruby string and a C string.
+### mrb_str_cat_cstr
+```C
+ mrb_value mrb_str_cat_str(mrb_state *mrb, mrb_value str, mrb_value str2);
+```
+Returns a concated string comprised of a Ruby string and a C string(A shorter alternative to mrb_str_cat).
+### mrb_str_append
+```C
+ mrb_value mrb_str_append(mrb_state *mrb, mrb_value str1, mrb_value str2);
+```
+Adds str2 to the end of str1.
+### mrb_str_cmp
+```C
+ int mrb_str_cmp(mrb_state *mrb, mrb_value str1, mrb_value str2);
+```
+Returns 0 if both Ruby strings are equal.
+Returns a value < 0 if Ruby str1 is less than Ruby str2.
+Returns a value > 0 if Ruby str2 is greater than Ruby str1.
+### mrb_str_to_cstr
+```C
+ char *mrb_str_to_cstr(mrb_state *mrb, mrb_value str);
+```
+Returns a C string from a Ruby string.
+### mrb_str_inspect
+```C
+ mrb_str_inspect(mrb_state *mrb, mrb_value str);
+```
+Returns a printable version of str, surrounded by quote marks, with special characters escaped.
diff --git a/doc/api/mruby/version.h.md b/doc/api/mruby/version.h.md new file mode 100644 index 000000000..f627b1da1 --- /dev/null +++ b/doc/api/mruby/version.h.md @@ -0,0 +1,33 @@ +### Macros
+#### MRUBY_RUBY_VERSION
+The version of Ruby used by mruby.
+#### MRUBY_RUBY_ENGINE
+Ruby engine.
+#### MRUBY_VERSION
+The mruby version.
+#### MRUBY_RELEASE_MAJOR
+Major release version.
+#### MRUBY_RELEASE_MINOR
+Minor release version.
+#### MRUBY_RELEASE_NO
+Release number.
+#### MRUBY_RELEASE_DATE
+Release date as a string.
+#### MRUBY_RELEASE_YEAR
+Release year.
+#### MRUBY_RELEASE_MONTH
+Release month.
+#### MRUBY_RELEASE_DAY
+Release day.
+#### MRUBY_BIRTH_YEAR
+The year mruby was first created.
+#### MRUBY_AUTHOR
+Mruby's authors.
+#### MRB_STRINGIZE0(expr)
+A passed in expression.
+#### MRB_STRINGIZE(expr)
+Passes in an expression to MRB_STRINGIZE0.
+#### MRUBY_DESCRIPTION
+mruby's version, and release date.
+#### MRUBY_COPYRIGHT
+mruby's copyright information.
|
