diff --git a/LEGAL b/LEGAL index ecddf6b95..24c8dc670 100644 --- a/LEGAL +++ b/LEGAL @@ -3,3 +3,38 @@ LEGAL NOTICE INFORMATION All the files in this distribution are covered under the MIT license (see the file LICENSE) except some files mentioned below: + +- src/readfloat.c: public domain by Yasuhiro Matsumoto (@mattn) +- src/fmt_fp.c: public domain by Dave Hylands (@dhylands) +- mrbgems/mruby-dir/src/Win/dirent.c: MIT-like license by Kevlin Henney + +[src/readfloat.c] + +strtod implementation. +author: Yasuhiro Matsumoto (@mattn) +license: public domain + +The original code can be found in https://github.com/mattn/strtod + +[src/fmt_fp.c] + +The code in this function was inspired from Fred Bayer's pdouble.c. +Since pdouble.c was released as Public Domain, I'm releasing this +code as public domain as well. + +Dave Hylands + +The original code can be found in https://github.com/dhylands/format-float + +[mrbgems/mruby-dir/src/Win/dirent.c] used only for Windows platform + +Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose is hereby granted without fee, provided +that this copyright and permissions notice appear in all copies and +derivatives. + +This software is supplied "as is" without express or implied warranty. + +But that said, if there are any problems please get in touch. diff --git a/README.md b/README.md index cba0d33f9..99300a385 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ ## What is mruby mruby is the lightweight implementation of the Ruby language complying to (part -of) the [ISO standard][ISO-standard]. Its syntax is Ruby 2.x compatible. +of) the [ISO standard][ISO-standard] with more recent features provided by Ruby 3.x. +Also, its syntax is Ruby 3.x compatible except for pattern matching. mruby can be linked and embedded within your application. We provide the interpreter program "mruby", and the interactive mruby shell "mirb" as examples. diff --git a/doc/guides/compile.md b/doc/guides/compile.md index fbcc45319..4302d1362 100644 --- a/doc/guides/compile.md +++ b/doc/guides/compile.md @@ -545,7 +545,7 @@ For example, when you have a C source file (`c.c`) and try to compile and link it with `libmruby.a`, you can run the following command, ``` -gcc `mruby-config --cflags` c.c `mruby-config --ldflags` `mruby-config --libs` +`mruby-config --cc --cflags` c.c `mruby-config --ldflags --libs` ``` When you use `make`, add following lines in `Makefile` diff --git a/doc/internal/boxing.md b/doc/internal/boxing.md index a16ce8a15..f3bd086e4 100644 --- a/doc/internal/boxing.md +++ b/doc/internal/boxing.md @@ -45,7 +45,7 @@ The NaN boxing packing bit patterns are like following: | ptr | `01111111 11111100 PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPP01` | | nil | `00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000` | -The object values appear far more frequently than floating-point numbers, so we offset the value so that object pointers are unchanged. This technique is called "favor pointer"". +The object values appear far more frequently than floating-point numbers, so we offset the value so that object pointers are unchanged. This technique is called "favor pointer". ## No Boxing diff --git a/mrbgems/mruby-io/src/io.c b/mrbgems/mruby-io/src/io.c index 05b6aaa7a..5ef60d039 100644 --- a/mrbgems/mruby-io/src/io.c +++ b/mrbgems/mruby-io/src/io.c @@ -90,6 +90,11 @@ io_get_open_fptr(mrb_state *mrb, mrb_value io) return fptr; } +#if !defined(MRB_NO_IO_POPEN) && defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +# define MRB_NO_IO_POPEN 1 +#endif + +#ifndef MRB_NO_IO_POEPN static void io_set_process_status(mrb_state *mrb, pid_t pid, int status) { @@ -110,6 +115,7 @@ io_set_process_status(mrb_state *mrb, pid_t pid, int status) } mrb_gv_set(mrb, mrb_intern_lit(mrb, "$?"), v); } +#endif static int io_modestr_to_flags(mrb_state *mrb, const char *mode) @@ -333,7 +339,7 @@ io_alloc(mrb_state *mrb) #define NOFILE 64 #endif -#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +#ifdef NO_IO_POPEN # define io_s_popen mrb_notimplement_m #else static int @@ -764,6 +770,7 @@ fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int quiet) fptr->fd2 = -1; } +#ifndef NO_IO_POPEN if (fptr->pid != 0) { #if !defined(_WIN32) && !defined(_WIN64) pid_t pid; @@ -785,6 +792,7 @@ fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int quiet) fptr->pid = 0; /* Note: we don't raise an exception when waitpid(3) fails */ } +#endif if (fptr->buf) { mrb_free(mrb, fptr->buf); diff --git a/src/vm.c b/src/vm.c index 2328497fa..2bb3ff30f 100644 --- a/src/vm.c +++ b/src/vm.c @@ -2179,8 +2179,8 @@ RETRY_TRY_BLOCK: c->status = MRB_FIBER_TERMINATED; mrb->c = c->prev; - c->prev = NULL; if (!mrb->c) mrb->c = mrb->root_c; + else c->prev = NULL; goto L_RAISE; } } @@ -2257,11 +2257,17 @@ RETRY_TRY_BLOCK: struct mrb_context *c; c = mrb->c; - if (!c->prev) { /* toplevel return */ - regs[irep->nlocals] = v; - goto CHECKPOINT_LABEL_MAKE(RBREAK_TAG_STOP); + if (!c->prev) { + if (c != mrb->root_c) { + /* fiber termination should transfer to root */ + c->prev = mrb->root_c; + } + else { /* toplevel return */ + regs[irep->nlocals] = v; + goto CHECKPOINT_LABEL_MAKE(RBREAK_TAG_STOP); + } } - if (!c->vmexec && c->prev->ci == c->prev->cibase) { + else if (!c->vmexec && c->prev->ci == c->prev->cibase) { RAISE_LIT(mrb, E_FIBER_ERROR, "double resume"); } CHECKPOINT_RESTORE(RBREAK_TAG_RETURN_TOPLEVEL) {