Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mrbconf.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mrbconf.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mrbconf.h	(revision 331)
@@ -8,8 +8,24 @@
 #define MRUBYCONF_H
 
+#include <limits.h>
+#include <stdint.h>
+
+/* architecture selection: */
+/* specify -DMRB_32BIT or -DMRB_64BIT to override */
+#if !defined(MRB_32BIT) && !defined(MRB_64BIT)
+#if UINT64_MAX == SIZE_MAX
+#define MRB_64BIT
+#else
+#define MRB_32BIT
+#endif
+#endif
+
+#if defined(MRB_32BIT) && defined(MRB_64BIT)
+#error Cannot build for 32 and 64 bit architecture at the same time
+#endif
+
 /* configuration options: */
 /* add -DMRB_USE_FLOAT to use float instead of double for floating point numbers */
 //#define MRB_USE_FLOAT
-#define MRB_USE_FLOAT
 
 /* add -DMRB_INT16 to use 16bit integer for mrb_int; conflict with MRB_INT64 */
@@ -33,13 +49,10 @@
 /* argv max size in mrb_funcall */
 //#define MRB_FUNCALL_ARGC_MAX 16
-#define MRB_FUNCALL_ARGC_MAX 8
 
 /* number of object per heap page */
 //#define MRB_HEAP_PAGE_SIZE 1024
-#define MRB_HEAP_PAGE_SIZE 64
 
 /* use segmented list for IV table */
 //#define MRB_USE_IV_SEGLIST
-#define MRB_USE_IV_SEGLIST
 
 /* initial size for IV khash; ignored when MRB_USE_IV_SEGLIST is set */
@@ -58,5 +71,4 @@
 /* default size of khash table bucket */
 //#define KHASH_DEFAULT_SIZE 32
-#define KHASH_DEFAULT_SIZE 8
 
 /* allocated memory address alignment */
@@ -65,9 +77,7 @@
 /* page size of memory pool */
 //#define POOL_PAGE_SIZE 16000
-#define POOL_PAGE_SIZE 4096
 
 /* initial minimum size for string buffer */
 //#define MRB_STR_BUF_MIN_SIZE 128
-#define MRB_STR_BUF_MIN_SIZE 20
 
 /* arena size */
@@ -76,5 +86,4 @@
 /* fixed size GC arena */
 //#define MRB_GC_FIXED_ARENA
-#define MRB_GC_FIXED_ARENA
 
 /* state atexit stack size */
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby.h	(revision 331)
@@ -2,5 +2,5 @@
 ** mruby - An embeddable Ruby implementation
 **
-** Copyright (c) mruby developers 2010-2015
+** Copyright (c) mruby developers 2010-2017
 **
 ** Permission is hereby granted, free of charge, to any person obtaining
@@ -29,13 +29,51 @@
 #define MRUBY_H
 
+#ifdef __cplusplus
+#define __STDC_LIMIT_MACROS
+#define __STDC_CONSTANT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
+
 #include <stdint.h>
 #include <stddef.h>
 #include <limits.h>
 
+#ifdef __cplusplus
+#ifndef SIZE_MAX
+#ifdef __SIZE_MAX__
+#define SIZE_MAX __SIZE_MAX__
+#else
+#define SIZE_MAX std::numeric_limits<size_t>::max()
+#endif
+#endif
+#endif
+
+#ifdef MRB_DEBUG
+#include <assert.h>
+#define mrb_assert(p) assert(p)
+#define mrb_assert_int_fit(t1,n,t2,max) assert((n)>=0 && ((sizeof(n)<=sizeof(t2))||(n<=(t1)(max))))
+#else
+#define mrb_assert(p) ((void)0)
+#define mrb_assert_int_fit(t1,n,t2,max) ((void)0)
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#define mrb_static_assert(exp, str) _Static_assert(exp, str)
+#else
+#define mrb_static_assert(exp, str) mrb_assert(exp)
+#endif
+
 #include "mrbconf.h"
+
+#ifdef MRB_USE_FLOAT
+#define MRB_FLOAT_EPSILON FLT_EPSILON
+#else
+#define MRB_FLOAT_EPSILON DBL_EPSILON
+#endif
+
 #include "mruby/common.h"
-#include "mruby/value.h"
-#include "mruby/gc.h"
-#include "mruby/version.h"
+#include <mruby/value.h>
+#include <mruby/gc.h>
+#include <mruby/version.h>
 
 /**
@@ -76,5 +114,5 @@
   int nregs;
   int ridx;
-  int eidx;
+  int epos;
   struct REnv *env;
   mrb_code *pc;                 /* return address */
@@ -88,5 +126,5 @@
   MRB_FIBER_CREATED = 0,
   MRB_FIBER_RUNNING,
-  MRB_FIBER_RESUMING,
+  MRB_FIBER_RESUMED,
   MRB_FIBER_SUSPENDED,
   MRB_FIBER_TRANSFERRED,
@@ -106,7 +144,8 @@
   int rsize;
   struct RProc **ensure;                  /* ensure handler stack */
-  int esize;
+  int esize, eidx;
 
   enum mrb_fiber_state status;
+  mrb_bool vmexec;
   struct RFiber *fib;
 };
@@ -116,7 +155,11 @@
 typedef void (*mrb_atexit_func)(struct mrb_state*);
 
+#define MRB_STATE_NO_REGEXP 1
+#define MRB_STATE_REGEXP    2
+
 typedef struct mrb_state {
   struct mrb_jmpbuf *jmp;
 
+  uint32_t flags;
   mrb_allocf allocf;                      /* memory allocation function */
   void *allocf_ud;                        /* auxiliary data of allocf */
@@ -124,7 +167,7 @@
   struct mrb_context *c;
   struct mrb_context *root_c;
+  struct iv_tbl *globals;                 /* global variable table */
 
   struct RObject *exc;                    /* exception */
-  struct iv_tbl *globals;                 /* global variable table */
 
   struct RObject *top_self;
@@ -158,7 +201,15 @@
 #endif
 
+#ifdef MRB_BYTECODE_DECODE_OPTION
+  mrb_code (*bytecode_decoder)(struct mrb_state* mrb, mrb_code code);
+#endif
+
   struct RClass *eException_class;
   struct RClass *eStandardError_class;
   struct RObject *nomem_err;              /* pre-allocated NoMemoryError */
+  struct RObject *stack_err;              /* pre-allocated SysStackError */
+#ifdef MRB_GC_FIXED_ARENA
+  struct RObject *arena_err;              /* pre-allocated arena overfow error */
+#endif
 
   void *ud; /* auxiliary data */
@@ -182,10 +233,10 @@
  *      !!!c
  *      void mrb_example_gem_init(mrb_state* mrb) {
- *              struct RClass *example_class;
- *              example_class = mrb_define_class(mrb, "Example_Class", mrb->object_class);
+ *          struct RClass *example_class;
+ *          example_class = mrb_define_class(mrb, "Example_Class", mrb->object_class);
  *      }
  *
  *      void mrb_example_gem_final(mrb_state* mrb) {
- *              //free(TheAnimals);
+ *          //free(TheAnimals);
  *      }
  *
@@ -200,4 +251,5 @@
 /**
  * Defines a new module.
+ *
  * @param [mrb_state *] mrb_state* The current mruby state.
  * @param [const char *] char* The name of the module.
@@ -209,9 +261,9 @@
 /**
  * Include a module in another class or module.
- * Equivalent to: 
- *
- *   module B                                                                                                         
- *     include A                                                                                                      
- *   end 
+ * Equivalent to:
+ *
+ *   module B
+ *     include A
+ *   end
  * @param [mrb_state *] mrb_state* The current mruby state.
  * @param [struct RClass *] RClass* A reference to module or a class.
@@ -230,5 +282,5 @@
  * @param [struct RClass *] RClass* A reference to module or a class.
  * @param [struct RClass *] RClass* A reference to the module to be prepended.
- */ 
+ */
 MRB_API void mrb_prepend_module(mrb_state*, struct RClass*, struct RClass*);
 
@@ -264,27 +316,20 @@
  *
  * Example:
- *   # Ruby style
- *   class Foo
- *
- *     def Foo.bar
+ *
+ *     # Ruby style
+ *     class Foo
+ *       def Foo.bar
+ *       end
  *     end
- *
- *   end
- *   // C style
- *   mrb_value bar_method(mrb_state* mrb, mrb_value self){
- *
- *     return mrb_nil_value();
- *
- *   }
- *   void mrb_example_gem_init(mrb_state* mrb){
- *
- *     struct RClass *foo;
- *
- *     foo = mrb_define_class(mrb, "Foo", mrb->object_class);
- *
- *     mrb_define_class_method(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
- * 
- *   }
- * @param [mrb_state *] mrb_state* The MRuby state reference. 
+ *     // C style
+ *     mrb_value bar_method(mrb_state* mrb, mrb_value self){
+ *       return mrb_nil_value();
+ *     }
+ *     void mrb_example_gem_init(mrb_state* mrb){
+ *       struct RClass *foo;
+ *       foo = mrb_define_class(mrb, "Foo", mrb->object_class);
+ *       mrb_define_class_method(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
+ *     }
+ * @param [mrb_state *] mrb_state* The MRuby state reference.
  * @param [struct RClass *] RClass* The class where the class method will be defined.
  * @param [const char *] char* The name of the class method being defined.
@@ -299,28 +344,23 @@
  *
  * Example:
- *   # Ruby style
- *   module Foo
- *                                                                                                     
- *     def Foo.bar                                                                                                    *     end
- *
- *   end                                                                                                             
- *   // C style                                                                                                      
- *   mrb_value bar_method(mrb_state* mrb, mrb_value self){ 
- *                                                          
- *     return mrb_nil_value();                                                                                        *               
- *   }                                                                                                               
- *   void mrb_example_gem_init(mrb_state* mrb){
- *                                                                      
- *     struct RClass *foo;
- *                                                                                           
- *     foo = mrb_define_module(mrb, "Foo");
- *                                                        
- *     mrb_define_module_function(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
- *
- *   }    
+ *
+ *        # Ruby style
+ *        module Foo
+ *          def Foo.bar
+ *          end
+ *        end
+ *        // C style
+ *        mrb_value bar_method(mrb_state* mrb, mrb_value self){
+ *          return mrb_nil_value();
+ *        }
+ *        void mrb_example_gem_init(mrb_state* mrb){
+ *          struct RClass *foo;
+ *          foo = mrb_define_module(mrb, "Foo");
+ *          mrb_define_module_function(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
+ *        }
  *  @param [mrb_state *] mrb_state* The MRuby state reference.
  *  @param [struct RClass *] RClass* The module where the module function will be defined.
  *  @param [const char *] char* The name of the module function being defined.
- *  @param [mrb_func_t] mrb_func_t The function pointer to the module function definition. 
+ *  @param [mrb_func_t] mrb_func_t The function pointer to the module function definition.
  *  @param [mrb_aspec] mrb_aspec The method parameters declaration.
  */
@@ -331,27 +371,21 @@
  *
  * Example:
- *    # Ruby style
- *
- *    class ExampleClass
- *    
- *    AGE = 22
- *
- *    end
- *
- *    // C style
- *    #include <stdio.h> 
- *    #include <mruby.h>
- *
- *    void
- *    mrb_example_gem_init(mrb_state* mrb){
- * 
- *      mrb_define_const(mrb, mrb->kernel_module, "AGE", mrb_fixnum_value(22));
- *
- *    }
- *
- *    mrb_value
- *    mrb_example_gem_final(mrb_state* mrb){
- *
- *    }
+ *
+ *          # Ruby style
+ *          class ExampleClass
+ *            AGE = 22
+ *          end
+ *          // C style
+ *          #include <stdio.h>
+ *          #include <mruby.h>
+ *
+ *          void
+ *          mrb_example_gem_init(mrb_state* mrb){
+ *            mrb_define_const(mrb, mrb->kernel_module, "AGE", mrb_fixnum_value(22));
+ *          }
+ *
+ *          mrb_value
+ *          mrb_example_gem_final(mrb_state* mrb){
+ *          }
  *  @param [mrb_state *] mrb_state* The MRuby state reference.
  *  @param [struct RClass *] RClass* A class or module the constant is defined in.
@@ -365,57 +399,44 @@
  *
  * Example:
- *   # Ruby style
- *
- *   class ExampleClassA
- *
- *     def example_method
- *       "example"
+ *
+ *     # Ruby style
+ *
+ *     class ExampleClassA
+ *       def example_method
+ *         "example"
+ *       end
  *     end
- *
- *   end
- *
- *   ExampleClassA.new.example_method # => example
- *
- *   class ExampleClassB < ExampleClassA
- *
- *     undef_method :example_method
- *
- *   end
- *
- *   ExampleClassB.new.example_method # => undefined method 'example_method' for ExampleClassB (NoMethodError)
- *
- *   // C style
- *   #include <stdio.h>
- *   #include <mruby.h>
- *  
- *   mrb_value
- *   mrb_example_method(mrb_state *mrb){
- *
- *     return mrb_str_new_cstr(mrb, "example");
- *
- *   }
- *
- *   void
- *   mrb_example_gem_init(mrb_state* mrb){
- *     struct RClass *example_class_a;
- *     struct RClass *example_class_b;
- *     struct RClass *example_class_c;
- *
- *     example_class_a = mrb_define_class(mrb, "ExampleClassA", mrb->object_class);
- *
- *     mrb_define_method(mrb, example_class_a, "example_method", mrb_example_method, MRB_ARGS_NONE());
- *
- *     example_class_b = mrb_define_class(mrb, "ExampleClassB", example_class_a);
- *
- *     example_class_c = mrb_define_class(mrb, "ExampleClassC", example_class_b);
- *
- *     mrb_undef_method(mrb, example_class_c, "example_method");
- *
- *   }
- *
- *   mrb_example_gem_final(mrb_state* mrb){
- *
- *   }
- *
+ *     ExampleClassA.new.example_method # => example
+ *
+ *     class ExampleClassB < ExampleClassA
+ *       undef_method :example_method
+ *     end
+ *
+ *     ExampleClassB.new.example_method # => undefined method 'example_method' for ExampleClassB (NoMethodError)
+ *
+ *     // C style
+ *     #include <stdio.h>
+ *     #include <mruby.h>
+ *
+ *     mrb_value
+ *     mrb_example_method(mrb_state *mrb){
+ *       return mrb_str_new_lit(mrb, "example");
+ *     }
+ *
+ *     void
+ *     mrb_example_gem_init(mrb_state* mrb){
+ *       struct RClass *example_class_a;
+ *       struct RClass *example_class_b;
+ *       struct RClass *example_class_c;
+ *
+ *       example_class_a = mrb_define_class(mrb, "ExampleClassA", mrb->object_class);
+ *       mrb_define_method(mrb, example_class_a, "example_method", mrb_example_method, MRB_ARGS_NONE());
+ *       example_class_b = mrb_define_class(mrb, "ExampleClassB", example_class_a);
+ *       example_class_c = mrb_define_class(mrb, "ExampleClassC", example_class_b);
+ *       mrb_undef_method(mrb, example_class_c, "example_method");
+ *     }
+ *
+ *     mrb_example_gem_final(mrb_state* mrb){
+ *     }
  * @param [mrb_state*] mrb_state* The mruby state reference.
  * @param [struct RClass*] RClass* A class the method will be undefined from.
@@ -426,45 +447,35 @@
 /**
  * Undefine a class method.
- *
  * Example:
- *   # Ruby style
- *
- *   class ExampleClass
- *     def self.example_method
- *       "example"
- *     end
- *
- *   end
- *
- *   ExampleClass.example_method
- *   
- *   // C style
- *   #include <stdio.h>
- *   #include <mruby.h> 
- *
- *   mrb_value
- *   mrb_example_method(mrb_state *mrb){
- *
- *     return mrb_str_new_cstr(mrb, "example");
- *     
- *   }
- *
- *   void
- *   mrb_example_gem_init(mrb_state* mrb){
- *
- *     struct RClass *example_class;
- *     
- *     example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class);
- *
- *     mrb_define_class_method(mrb, example_class, "example_method", mrb_example_method, MRB_ARGS_NONE());
- *
- *     mrb_undef_class_method(mrb, example_class, "example_method");
- *
- *   }
- *
- *   void
- *   mrb_example_gem_final(mrb_state* mrb){
- *
- *   }
+ *
+ *      # Ruby style
+ *      class ExampleClass
+ *        def self.example_method
+ *          "example"
+ *        end
+ *      end
+ *
+ *     ExampleClass.example_method
+ *
+ *     // C style
+ *     #include <stdio.h>
+ *     #include <mruby.h>
+ *
+ *     mrb_value
+ *     mrb_example_method(mrb_state *mrb){
+ *       return mrb_str_new_lit(mrb, "example");
+ *     }
+ *
+ *     void
+ *     mrb_example_gem_init(mrb_state* mrb){
+ *       struct RClass *example_class;
+ *       example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class);
+ *       mrb_define_class_method(mrb, example_class, "example_method", mrb_example_method, MRB_ARGS_NONE());
+ *       mrb_undef_class_method(mrb, example_class, "example_method");
+ *      }
+ *
+ *      void
+ *      mrb_example_gem_final(mrb_state* mrb){
+ *      }
  * @param [mrb_state*] mrb_state* The mruby state reference.
  * @param [RClass*] RClass* A class the class method will be undefined from.
@@ -478,22 +489,21 @@
  * Example:
  *
- *   # Ruby style
- *   class ExampleClass
- *   end
- *
- *   p ExampleClass # => #<ExampleClass:0x9958588>
- *   // C style
- *   #include <stdio.h>
- *   #include <mruby.h>
- *
- *   void
- *   mrb_example_gem_init(mrb_state* mrb) {
- *     struct RClass *example_class;
- *     mrb_value obj;
- *
- *     example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class); # => class ExampleClass; end
- *     obj = mrb_obj_new(mrb, example_class, 0, NULL); # => ExampleClass.new
- *     mrb_p(mrb, obj); // => Kernel#p
- *   }  
+ *     # Ruby style
+ *     class ExampleClass
+ *     end
+ *
+ *     p ExampleClass # => #<ExampleClass:0x9958588>
+ *     // C style
+ *     #include <stdio.h>
+ *     #include <mruby.h>
+ *
+ *     void
+ *     mrb_example_gem_init(mrb_state* mrb) {
+ *       struct RClass *example_class;
+ *       mrb_value obj;
+ *       example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class); # => class ExampleClass; end
+ *       obj = mrb_obj_new(mrb, example_class, 0, NULL); # => ExampleClass.new
+ *       mrb_p(mrb, obj); // => Kernel#p
+ *      }
  * @param [mrb_state*] mrb The current mruby state.
  * @param [RClass*] c Reference to the class of the new object.
@@ -517,13 +527,13 @@
  * Example:
  *
- *   void
- *   mrb_example_gem_init(mrb_state* mrb) {
- *      struct RClass *example_class;
- *      mrb_value obj;
- *
- *      example_class = mrb_class_new(mrb, mrb->object_class);
- *      obj = mrb_obj_new(mrb, example_class, 0, NULL); // => #<#<Class:0x9a945b8>:0x9a94588>
- *      mrb_p(mrb, obj); // => Kernel#p
- *   }
+ *      void
+ *      mrb_example_gem_init(mrb_state* mrb) {
+ *        struct RClass *example_class;
+ *
+ *        mrb_value obj;
+ *        example_class = mrb_class_new(mrb, mrb->object_class);
+ *        obj = mrb_obj_new(mrb, example_class, 0, NULL); // => #<#<Class:0x9a945b8>:0x9a94588>
+ *        mrb_p(mrb, obj); // => Kernel#p
+ *       }
  *
  * @param [mrb_state*] mrb The current mruby state.
@@ -537,10 +547,10 @@
  *
  * Example:
- *   void
- *   mrb_example_gem_init(mrb_state* mrb) {
- *      struct RClass *example_module;
- *
- *      example_module = mrb_module_new(mrb);
- *   }
+ *      void
+ *      mrb_example_gem_init(mrb_state* mrb) {
+ *        struct RClass *example_module;
+ *
+ *        example_module = mrb_module_new(mrb);
+ *      }
  *
  * @param [mrb_state*] mrb The current mruby state.
@@ -553,21 +563,21 @@
  *
  * Example:
- *   void
- *   mrb_example_gem_init(mrb_state* mrb) {
- *      struct RClass *example_class;
- *      mrb_bool cd;
- *
- *      example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class);
- *      cd = mrb_class_defined(mrb, "ExampleClass");
- *      
- *      // If mrb_class_defined returns 1 then puts "True"
- *      // If mrb_class_defined returns 0 then puts "False"
- *      if (cd == 1){
- *        puts("True");
+ *     void
+ *     mrb_example_gem_init(mrb_state* mrb) {
+ *       struct RClass *example_class;
+ *       mrb_bool cd;
+ *
+ *       example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class);
+ *       cd = mrb_class_defined(mrb, "ExampleClass");
+ *
+ *       // If mrb_class_defined returns 1 then puts "True"
+ *       // If mrb_class_defined returns 0 then puts "False"
+ *       if (cd == 1){
+ *         puts("True");
+ *       }
+ *       else {
+ *         puts("False");
+ *       }
  *      }
- *      else {
- *        puts("False");
- *      }
- *   }
  *
  * @param [mrb_state*] mrb The current mruby state.
@@ -584,4 +594,43 @@
 */
 MRB_API struct RClass * mrb_class_get(mrb_state *mrb, const char *name);
+
+/**
+ * Gets a exception class.
+ * @param [mrb_state*] mrb The current mruby state.
+ * @param [const char *] name The name of the class.
+ * @return [struct RClass *] A reference to the class.
+*/
+MRB_API struct RClass * mrb_exc_get(mrb_state *mrb, const char *name);
+
+/**
+ * Returns an mrb_bool. True if inner class was defined, and false if the inner class was not defined.
+ *
+ * Example:
+ *     void
+ *     mrb_example_gem_init(mrb_state* mrb) {
+ *       struct RClass *example_outer, *example_inner;
+ *       mrb_bool cd;
+ *
+ *       example_outer = mrb_define_module(mrb, "ExampleOuter");
+ *
+ *       example_inner = mrb_define_class_under(mrb, example_outer, "ExampleInner", mrb->object_class);
+ *       cd = mrb_class_defined_under(mrb, example_outer, "ExampleInner");
+ *
+ *       // If mrb_class_defined_under returns 1 then puts "True"
+ *       // If mrb_class_defined_under returns 0 then puts "False"
+ *       if (cd == 1){
+ *         puts("True");
+ *       }
+ *       else {
+ *         puts("False");
+ *       }
+ *      }
+ *
+ * @param [mrb_state*] mrb The current mruby state.
+ * @param [struct RClass *] outer The name of the outer class.
+ * @param [const char *] name A string representing the name of the inner class.
+ * @return [mrb_bool] A boolean value.
+ */
+MRB_API mrb_bool mrb_class_defined_under(mrb_state *mrb, struct RClass *outer, const char *name);
 
 /**
@@ -616,5 +665,5 @@
  *
  * Equivalent to:
- *   Object#dup    
+ *   Object#dup
  * @param [mrb_state*] mrb The current mruby state.
  * @param [mrb_value] obj Object to be duplicate.
@@ -628,34 +677,34 @@
  * class it returns true, it returns false otherwise.
  *
- * Example:
- *   # Ruby style
- *   class ExampleClass
- *      def example_method
+ *      Example:
+ *      # Ruby style
+ *      class ExampleClass
+ *        def example_method
+ *        end
  *      end
- *   end
- *
- *   ExampleClass.new.respond_to?(:example_method) # => true
- *
- *   // C style
- *   void
- *   mrb_example_gem_init(mrb_state* mrb) {
- *      struct RClass *example_class;
- *      mrb_sym mid;
- *      mrb_bool obj_resp;
- *
- *      example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class);
- *      mrb_define_method(mrb, example_class, "example_method", exampleMethod, MRB_ARGS_NONE());
- *      mid = mrb_intern_str(mrb, mrb_str_new_cstr(mrb, "example_method" ));
- *      obj_resp = mrb_obj_respond_to(mrb, example_class, mid); // => 1(true in Ruby world)
- *      
- *      // If mrb_obj_respond_to returns 1 then puts "True"
- *      // If mrb_obj_respond_to returns 0 then puts "False"
- *      if (obj_resp == 1) {
- *        puts("True");
+ *
+ *      ExampleClass.new.respond_to?(:example_method) # => true
+ *
+ *      // C style
+ *      void
+ *      mrb_example_gem_init(mrb_state* mrb) {
+ *        struct RClass *example_class;
+ *        mrb_sym mid;
+ *        mrb_bool obj_resp;
+ *
+ *        example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class);
+ *        mrb_define_method(mrb, example_class, "example_method", exampleMethod, MRB_ARGS_NONE());
+ *        mid = mrb_intern_str(mrb, mrb_str_new_lit(mrb, "example_method" ));
+ *        obj_resp = mrb_obj_respond_to(mrb, example_class, mid); // => 1(true in Ruby world)
+ *
+ *        // If mrb_obj_respond_to returns 1 then puts "True"
+ *        // If mrb_obj_respond_to returns 0 then puts "False"
+ *        if (obj_resp == 1) {
+ *          puts("True");
+ *        }
+ *        else if (obj_resp == 0) {
+ *          puts("False");
+ *        }
  *      }
- *      else if (obj_resp == 0) {
- *        puts("False");
- *      }
- *   }
  *
  * @param [mrb_state*] mrb The current mruby state.
@@ -795,8 +844,76 @@
 /**
  * Call existing ruby functions.
+ *
+ *      #include <stdio.h>
+ *      #include <mruby.h>
+ *      #include "mruby/compile.h"
+ *
+ *      int
+ *      main()
+ *      {
+ *        mrb_int i = 99;
+ *        mrb_state *mrb = mrb_open();
+ *
+ *        if (!mrb) { }
+ *        FILE *fp = fopen("test.rb","r");
+ *        mrb_value obj = mrb_load_file(mrb,fp);
+ *        mrb_funcall(mrb, obj, "method_name", 1, mrb_fixnum_value(i));
+ *        fclose(fp);
+ *        mrb_close(mrb);
+ *       }
+ * @param [mrb_state*] mrb_state* The current mruby state.
+ * @param [mrb_value] mrb_value A reference to an mruby value.
+ * @param [const char*] const char* The name of the method.
+ * @param [mrb_int] mrb_int The number of arguments the method has.
+ * @param [...] ... Variadic values(not type safe!).
+ * @return [mrb_value] mrb_value mruby function value.
  */
 MRB_API mrb_value mrb_funcall(mrb_state*, mrb_value, const char*, mrb_int,...);
+/**
+ * Call existing ruby functions. This is basically the type safe version of mrb_funcall.
+ *
+ *      #include <stdio.h>
+ *      #include <mruby.h>
+ *      #include "mruby/compile.h"
+ *      int
+ *      main()
+ *      {
+ *        mrb_int i = 99;
+ *        mrb_state *mrb = mrb_open();
+ *
+ *        if (!mrb) { }
+ *        mrb_sym m_sym = mrb_intern_lit(mrb, "method_name"); // Symbol for method.
+ *
+ *        FILE *fp = fopen("test.rb","r");
+ *        mrb_value obj = mrb_load_file(mrb,fp);
+ *        mrb_funcall_argv(mrb, obj, m_sym, 1, &obj); // Calling ruby function from test.rb.
+ *        fclose(fp);
+ *        mrb_close(mrb);
+ *       }
+ * @param [mrb_state*] mrb_state* The current mruby state.
+ * @param [mrb_value] mrb_value A reference to an mruby value.
+ * @param [mrb_sym] mrb_sym The symbol representing the method.
+ * @param [mrb_int] mrb_int The number of arguments the method has.
+ * @param [const mrb_value*] mrb_value* Pointer to the object.
+ * @return [mrb_value] mrb_value mruby function value.
+ * @see mrb_funcall
+ */
 MRB_API mrb_value mrb_funcall_argv(mrb_state*, mrb_value, mrb_sym, mrb_int, const mrb_value*);
+/**
+ * Call existing ruby functions with a block.
+ */
 MRB_API mrb_value mrb_funcall_with_block(mrb_state*, mrb_value, mrb_sym, mrb_int, const mrb_value*, mrb_value);
+/**
+ * Create a symbol
+ *
+ *     # Ruby style:
+ *     :pizza # => :pizza
+ *
+ *     // C style:
+ *     mrb_sym m_sym = mrb_intern_lit(mrb, "pizza"); //  => :pizza
+ * @param [mrb_state*] mrb_state* The current mruby state.
+ * @param [const char*] const char* The name of the method.
+ * @return [mrb_sym] mrb_sym A symbol.
+ */
 MRB_API mrb_sym mrb_intern_cstr(mrb_state*,const char*);
 MRB_API mrb_sym mrb_intern(mrb_state*,const char*,size_t);
@@ -892,6 +1009,11 @@
 MRB_API mrb_value mrb_top_self(mrb_state *);
 MRB_API mrb_value mrb_run(mrb_state*, struct RProc*, mrb_value);
-MRB_API mrb_value mrb_toplevel_run(mrb_state*, struct RProc*);
-MRB_API mrb_value mrb_context_run(mrb_state*, struct RProc*, mrb_value, unsigned int);
+MRB_API mrb_value mrb_top_run(mrb_state*, struct RProc*, mrb_value, unsigned int);
+MRB_API mrb_value mrb_vm_run(mrb_state*, struct RProc*, mrb_value, unsigned int);
+MRB_API mrb_value mrb_vm_exec(mrb_state*, struct RProc*, mrb_code*);
+/* compatibility macros */
+#define mrb_toplevel_run_keep(m,p,k) mrb_top_run((m),(p),mrb_top_self(m),(k))
+#define mrb_toplevel_run(m,p) mrb_toplevel_run_keep((m),(p),0)
+#define mrb_context_run(m,p,s,k) mrb_vm_run((m),(p),(s),(k))
 
 MRB_API void mrb_p(mrb_state*, mrb_value);
@@ -965,25 +1087,29 @@
    + exception objects obtained from those macros are local to mrb
 */
-#define E_RUNTIME_ERROR             (mrb_class_get(mrb, "RuntimeError"))
-#define E_TYPE_ERROR                (mrb_class_get(mrb, "TypeError"))
-#define E_ARGUMENT_ERROR            (mrb_class_get(mrb, "ArgumentError"))
-#define E_INDEX_ERROR               (mrb_class_get(mrb, "IndexError"))
-#define E_RANGE_ERROR               (mrb_class_get(mrb, "RangeError"))
-#define E_NAME_ERROR                (mrb_class_get(mrb, "NameError"))
-#define E_NOMETHOD_ERROR            (mrb_class_get(mrb, "NoMethodError"))
-#define E_SCRIPT_ERROR              (mrb_class_get(mrb, "ScriptError"))
-#define E_SYNTAX_ERROR              (mrb_class_get(mrb, "SyntaxError"))
-#define E_LOCALJUMP_ERROR           (mrb_class_get(mrb, "LocalJumpError"))
-#define E_REGEXP_ERROR              (mrb_class_get(mrb, "RegexpError"))
-#define E_SYSSTACK_ERROR            (mrb_class_get(mrb, "SystemStackError"))
-
-#define E_NOTIMP_ERROR              (mrb_class_get(mrb, "NotImplementedError"))
-#define E_FLOATDOMAIN_ERROR         (mrb_class_get(mrb, "FloatDomainError"))
-
-#define E_KEY_ERROR                 (mrb_class_get(mrb, "KeyError"))
+#define E_RUNTIME_ERROR             (mrb_exc_get(mrb, "RuntimeError"))
+#define E_TYPE_ERROR                (mrb_exc_get(mrb, "TypeError"))
+#define E_ARGUMENT_ERROR            (mrb_exc_get(mrb, "ArgumentError"))
+#define E_INDEX_ERROR               (mrb_exc_get(mrb, "IndexError"))
+#define E_RANGE_ERROR               (mrb_exc_get(mrb, "RangeError"))
+#define E_NAME_ERROR                (mrb_exc_get(mrb, "NameError"))
+#define E_NOMETHOD_ERROR            (mrb_exc_get(mrb, "NoMethodError"))
+#define E_SCRIPT_ERROR              (mrb_exc_get(mrb, "ScriptError"))
+#define E_SYNTAX_ERROR              (mrb_exc_get(mrb, "SyntaxError"))
+#define E_LOCALJUMP_ERROR           (mrb_exc_get(mrb, "LocalJumpError"))
+#define E_REGEXP_ERROR              (mrb_exc_get(mrb, "RegexpError"))
+
+#define E_NOTIMP_ERROR              (mrb_exc_get(mrb, "NotImplementedError"))
+#define E_FLOATDOMAIN_ERROR         (mrb_exc_get(mrb, "FloatDomainError"))
+
+#define E_KEY_ERROR                 (mrb_exc_get(mrb, "KeyError"))
 
 MRB_API mrb_value mrb_yield(mrb_state *mrb, mrb_value b, mrb_value arg);
 MRB_API mrb_value mrb_yield_argv(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv);
 MRB_API mrb_value mrb_yield_with_class(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv, mrb_value self, struct RClass *c);
+
+/* continue execution to the proc */
+/* this function should always be called as the last function of a method */
+/* e.g. return mrb_yield_cont(mrb, proc, self, argc, argv); */
+mrb_value mrb_yield_cont(mrb_state *mrb, mrb_value b, mrb_value self, mrb_int argc, const mrb_value *argv);
 
 /* mrb_gc_protect() leaves the object in the arena */
@@ -1013,4 +1139,5 @@
 MRB_API mrb_bool mrb_respond_to(mrb_state *mrb, mrb_value obj, mrb_sym mid);
 MRB_API mrb_bool mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, struct RClass* c);
+MRB_API mrb_bool mrb_func_basic_p(mrb_state *mrb, mrb_value obj, mrb_sym mid, mrb_func_t func);
 
 
@@ -1034,5 +1161,5 @@
  * @mrbgem mruby-fiber
  */
-#define E_FIBER_ERROR (mrb_class_get(mrb, "FiberError"))
+#define E_FIBER_ERROR (mrb_exc_get(mrb, "FiberError"))
 
 /* memory pool implementation */
@@ -1050,21 +1177,33 @@
 MRB_API void mrb_show_copyright(mrb_state *mrb);
 
-#ifdef MRB_DEBUG
-#include <assert.h>
-#define mrb_assert(p) assert(p)
-#define mrb_assert_int_fit(t1,n,t2,max) assert((n)>=0 && ((sizeof(n)<=sizeof(t2))||(n<=(t1)(max))))
-#else
-#define mrb_assert(p) ((void)0)
-#define mrb_assert_int_fit(t1,n,t2,max) ((void)0)
-#endif
-
-#if __STDC_VERSION__ >= 201112L
-#define mrb_static_assert(exp, str) _Static_assert(exp, str)
-#else
-#define mrb_static_assert(exp, str) mrb_assert(exp)
-#endif
-
 MRB_API mrb_value mrb_format(mrb_state *mrb, const char *format, ...);
 
+#if 0
+/* memcpy and memset does not work with gdb reverse-next on my box */
+/* use naive memcpy and memset instead */
+#undef memcpy
+#undef memset
+static inline void*
+mrbmemcpy(void *dst, const void *src, size_t n)
+{
+  char *d = dst;
+  const char *s = src;
+  while (n--)
+    *d++ = *s++;
+  return d;
+}
+#define memcpy(a,b,c) mrbmemcpy(a,b,c)
+
+static inline void*
+mrbmemset(void *s, int c, size_t n)
+{
+  char *t = s;
+  while (n--)
+    *t++ = c;
+  return s;
+}
+#define memset(a,b,c) mrbmemset(a,b,c)
+#endif
+
 MRB_END_DECL
 
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/array.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/array.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/array.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_ARRAY_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /*
@@ -55,12 +55,58 @@
  *
  * @param mrb The mruby state reference.
- * @return The initialized array
+ * @return The initialized array.
  */
 MRB_API mrb_value mrb_ary_new(mrb_state *mrb);
 
+/*
+ * Initializes a new array with initial values
+ *
+ * Equivalent to:
+ *
+ *      Array[value1, value2, ...]
+ *
+ * @param mrb The mruby state reference.
+ * @param size The numer of values.
+ * @param vals The actual values.
+ * @return The initialized array.
+ */
 MRB_API mrb_value mrb_ary_new_from_values(mrb_state *mrb, mrb_int size, const mrb_value *vals);
+
+/*
+ * Initializes a new array with two initial values
+ *
+ * Equivalent to:
+ *
+ *      Array[car, cdr]
+ *
+ * @param mrb The mruby state reference.
+ * @param car The first value.
+ * @param cdr The second value.
+ * @return The initialized array.
+ */
 MRB_API mrb_value mrb_assoc_new(mrb_state *mrb, mrb_value car, mrb_value cdr);
-MRB_API void mrb_ary_concat(mrb_state*, mrb_value, mrb_value);
-MRB_API mrb_value mrb_ary_splat(mrb_state*, mrb_value);
+
+/*
+ * Concatenate two arrays. The target array will be modified
+ *
+ * Equivalent to:
+ *      ary.concat(other)
+ *
+ * @param mrb The mruby state reference.
+ * @param self The target array.
+ * @param other The array that will be concatenated to self.
+ */
+MRB_API void mrb_ary_concat(mrb_state *mrb, mrb_value self, mrb_value other);
+
+/*
+ * Create an array from the input. It tries calling to_a on the
+ * value. If value does not respond to that, it creates a new
+ * array with just this value.
+ *
+ * @param mrb The mruby state reference.
+ * @param value The value to change into an array.
+ * @return An array representation of value.
+ */
+MRB_API mrb_value mrb_ary_splat(mrb_state *mrb, mrb_value value);
 
 /*
@@ -85,6 +131,6 @@
  *
  * @param mrb The mruby state reference.
- * @param ary The array from which the value will be poped.
- * @return The poped value.
+ * @param ary The array from which the value will be popped.
+ * @return The popped value.
  */
 MRB_API mrb_value mrb_ary_pop(mrb_state *mrb, mrb_value ary);
@@ -118,12 +164,79 @@
 MRB_API void mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val);
 
-MRB_API void mrb_ary_replace(mrb_state *mrb, mrb_value a, mrb_value b);
+/*
+ * Replace the array with another array
+ *
+ * Equivalent to:
+ *
+ *      ary.replace(other)
+ *
+ * @param mrb The mruby state reference
+ * @param self The target array.
+ * @param other The array to replace it with.
+ */
+MRB_API void mrb_ary_replace(mrb_state *mrb, mrb_value self, mrb_value other);
 MRB_API mrb_value mrb_check_array_type(mrb_state *mrb, mrb_value self);
+
+/*
+ * Unshift an element into an array
+ *
+ * Equivalent to:
+ *
+ *     ary.unshift(item)
+ *
+ * @param mrb The mruby state reference.
+ * @param self The target array.
+ * @param item The item to unshift.
+ */
 MRB_API mrb_value mrb_ary_unshift(mrb_state *mrb, mrb_value self, mrb_value item);
 MRB_API mrb_value mrb_ary_entry(mrb_value ary, mrb_int offset);
+
+/*
+ * Shifts the first element from the array.
+ *
+ * Equivalent to:
+ *
+ *      ary.shift
+ *
+ * @param mrb The mruby state reference.
+ * @param self The array from which the value will be shifted.
+ * @return The shifted value.
+ */
 MRB_API mrb_value mrb_ary_shift(mrb_state *mrb, mrb_value self);
+
+/*
+ * Removes all elements from this array
+ *
+ * Equivalent to:
+ *
+ *      ary.clear
+ *
+ * @param mrb The mruby state reference.
+ * @param self The target array.
+ * @return self
+ */
 MRB_API mrb_value mrb_ary_clear(mrb_state *mrb, mrb_value self);
+
+/*
+ * Join the array elements together in a string
+ *
+ * Equivalent to:
+ *
+ *      ary.join(sep="")
+ *
+ * @param mrb The mruby state reference.
+ * @param ary The target array
+ * @param sep The separater, can be NULL
+ */
 MRB_API mrb_value mrb_ary_join(mrb_state *mrb, mrb_value ary, mrb_value sep);
-MRB_API mrb_value mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int len);
+
+/*
+ * Update the capacity of the array
+ *
+ * @param mrb The mruby state reference.
+ * @param ary The target array.
+ * @param new_len The new capacity of the array
+ */
+MRB_API mrb_value mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int new_len);
 
 static inline mrb_int
@@ -135,4 +248,13 @@
 }
 
+static inline mrb_value
+ary_elt(mrb_value ary, mrb_int offset)
+{
+  if (offset < 0 || RARRAY_LEN(ary) <= offset) {
+    return mrb_nil_value();
+  }
+  return RARRAY_PTR(ary)[offset];
+}
+
 MRB_END_DECL
 
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/boxing_nan.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/boxing_nan.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/boxing_nan.h	(revision 331)
@@ -54,5 +54,5 @@
 
 #define mrb_tt(o)       ((enum mrb_vtype)(((o).value.ttt & 0xfc000)>>14)-1)
-#define mrb_type(o)     ((uint32_t)0xfff00000 < (o).value.ttt ? mrb_tt(o) : MRB_TT_FLOAT)
+#define mrb_type(o)     (enum mrb_vtype)((uint32_t)0xfff00000 < (o).value.ttt ? mrb_tt(o) : MRB_TT_FLOAT)
 #define mrb_ptr(o)      ((void*)((((uintptr_t)0x3fffffffffff)&((uintptr_t)((o).value.p)))<<2))
 #define mrb_float(o)    (o).f
@@ -61,14 +61,18 @@
 #define mrb_symbol(o)   (o).value.sym
 
+#ifdef MRB_64BIT
+#define BOXNAN_SHIFT_LONG_POINTER(v) (((uintptr_t)(v)>>34)&0x3fff)
+#else
+#define BOXNAN_SHIFT_LONG_POINTER(v) 0
+#endif
+
 #define BOXNAN_SET_VALUE(o, tt, attr, v) do {\
-  switch (tt) {\
-  case MRB_TT_FALSE:\
-  case MRB_TT_TRUE:\
-  case MRB_TT_UNDEF:\
-  case MRB_TT_FIXNUM:\
-  case MRB_TT_SYMBOL: (o).attr = (v); break;\
-  default: (o).value.i = 0; (o).value.p = (void*)((uintptr_t)(o).value.p | (((uintptr_t)(v))>>2)); break;\
-  }\
-  (o).value.ttt = (0xfff00000|(((tt)+1)<<14));\
+  (o).attr = (v);\
+  (o).value.ttt = 0xfff00000 | (((tt)+1)<<14);\
+} while (0)
+
+#define BOXNAN_SET_OBJ_VALUE(o, tt, v) do {\
+  (o).value.p = (void*)((uintptr_t)(v)>>2);\
+  (o).value.ttt = (0xfff00000|(((tt)+1)<<14)|BOXNAN_SHIFT_LONG_POINTER(v));\
 } while (0)
 
@@ -77,5 +81,6 @@
     (r).value.ttt = 0x7ff80000; \
     (r).value.i = 0; \
-  } else { \
+  } \
+  else { \
     (r).f = v; \
   }} while(0)
@@ -87,6 +92,6 @@
 #define SET_INT_VALUE(r,n) BOXNAN_SET_VALUE(r, MRB_TT_FIXNUM, value.i, (n))
 #define SET_SYM_VALUE(r,v) BOXNAN_SET_VALUE(r, MRB_TT_SYMBOL, value.sym, (v))
-#define SET_OBJ_VALUE(r,v) BOXNAN_SET_VALUE(r, (((struct RObject*)(v))->tt), value.p, (v))
-#define SET_CPTR_VALUE(mrb,r,v) BOXNAN_SET_VALUE(r, MRB_TT_CPTR, value.p, v)
+#define SET_OBJ_VALUE(r,v) BOXNAN_SET_OBJ_VALUE(r, (((struct RObject*)(v))->tt), (v))
+#define SET_CPTR_VALUE(mrb,r,v) BOXNAN_SET_OBJ_VALUE(r, MRB_TT_CPTR, v)
 #define SET_UNDEF_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_UNDEF, value.i, 0)
 
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/boxing_word.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/boxing_word.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/boxing_word.h	(revision 331)
@@ -10,4 +10,8 @@
 #if defined(MRB_INT16)
 # error MRB_INT16 is too small for MRB_WORD_BOXING.
+#endif
+
+#if defined(MRB_INT64) && !defined(MRB_64BIT)
+#error MRB_INT64 cannot be used with MRB_WORD_BOXING in 32-bit mode.
 #endif
 
@@ -63,5 +67,5 @@
 #define mrb_cptr(o)    (o).value.vp->p
 #define mrb_float(o)   (o).value.fp->f
-#define mrb_fixnum(o)  (o).value.i
+#define mrb_fixnum(o)  ((mrb_int)(o).value.i)
 #define mrb_symbol(o)  (o).value.sym
 
@@ -92,11 +96,11 @@
 #define mrb_nil_p(o)  ((o).w == MRB_Qnil)
 
-#define BOXWORD_SET_VALUE(o, ttt, attr, v) do {\
+#define BOXWORD_SET_VALUE(o, ttt, attr, v) do { \
   switch (ttt) {\
   case MRB_TT_FALSE:  (o).w = (v) ? MRB_Qfalse : MRB_Qnil; break;\
   case MRB_TT_TRUE:   (o).w = MRB_Qtrue; break;\
   case MRB_TT_UNDEF:  (o).w = MRB_Qundef; break;\
-  case MRB_TT_FIXNUM: (o).value.i_flag = MRB_FIXNUM_FLAG; (o).attr = (v); break;\
-  case MRB_TT_SYMBOL: (o).value.sym_flag = MRB_SYMBOL_FLAG; (o).attr = (v); break;\
+  case MRB_TT_FIXNUM: (o).w = 0;(o).value.i_flag = MRB_FIXNUM_FLAG; (o).attr = (v); break;\
+  case MRB_TT_SYMBOL: (o).w = 0;(o).value.sym_flag = MRB_SYMBOL_FLAG; (o).attr = (v); break;\
   default:            (o).w = 0; (o).attr = (v); if ((o).value.bp) (o).value.bp->tt = ttt; break;\
   }\
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/class.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/class.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/class.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_CLASS_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -52,5 +52,6 @@
 }
 
-// TODO: figure out where to put user flags
+/* TODO: figure out where to put user flags */
+#define MRB_FLAG_IS_FROZEN (1 << 18)
 #define MRB_FLAG_IS_PREPENDED (1 << 19)
 #define MRB_FLAG_IS_ORIGIN (1 << 20)
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/common.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/common.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/common.h	(revision 331)
@@ -1,4 +1,4 @@
 /*
-** mruby/common.h - mruby common platform definitions
+**"common.h - mruby common platform definition"
 **
 ** See Copyright Notice in mruby.h
@@ -10,6 +10,11 @@
 
 #ifdef __cplusplus
+#ifdef MRB_ENABLE_CXX_ABI
+#define MRB_BEGIN_DECL
+#define MRB_END_DECL
+#else
 # define MRB_BEGIN_DECL extern "C" {
 # define MRB_END_DECL	}
+#endif
 #else
 /** Start declarations in C mode */
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/compile.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/compile.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/compile.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_COMPILE_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -15,5 +15,5 @@
 MRB_BEGIN_DECL
 
-#include "mruby.h"
+#include <mruby.h>
 
 struct mrb_jmpbuf;
@@ -40,6 +40,4 @@
 MRB_API const char *mrbc_filename(mrb_state *mrb, mrbc_context *c, const char *s);
 MRB_API void mrbc_partial_hook(mrb_state *mrb, mrbc_context *c, int (*partial_hook)(struct mrb_parser_state*), void*data);
-
-MRB_API mrb_value mrb_toplevel_run_keep(mrb_state*, struct RProc*, unsigned int);
 
 /* AST node structure */
@@ -105,5 +103,6 @@
 };
 
-#define MRB_PARSER_BUF_SIZE 1024
+#define MRB_PARSER_TOKBUF_MAX 65536
+#define MRB_PARSER_TOKBUF_SIZE 256
 
 /* parser structure */
@@ -133,6 +132,8 @@
 
   mrb_ast_node *pb;
-  char buf[MRB_PARSER_BUF_SIZE];
-  int bidx;
+  char *tokbuf;
+  char buf[MRB_PARSER_TOKBUF_SIZE];
+  int tidx;
+  int tsiz;
 
   mrb_ast_node *all_heredocs;	/* list of mrb_parser_heredoc_info* */
@@ -163,4 +164,5 @@
 MRB_API void mrb_parser_free(struct mrb_parser_state*);
 MRB_API void mrb_parser_parse(struct mrb_parser_state*,mrbc_context*);
+MRB_API double mrb_float_read(const char*, char**);
 
 MRB_API void mrb_parser_set_filename(struct mrb_parser_state*, char const*);
@@ -174,4 +176,5 @@
 MRB_API struct mrb_parser_state* mrb_parse_nstring(mrb_state*,const char*,int,mrbc_context*);
 MRB_API struct RProc* mrb_generate_code(mrb_state*, struct mrb_parser_state*);
+MRB_API mrb_value mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c);
 
 /* program load functions */
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/data.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/data.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/data.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_DATA_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/debug.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/debug.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/debug.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_DEBUG_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/dump.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/dump.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/dump.h	(revision 331)
@@ -8,7 +8,7 @@
 #define MRUBY_DUMP_H
 
-#include "mruby.h"
-#include "mruby/irep.h"
-#include "mruby/common.h"
+#include <mruby.h>
+#include <mruby/irep.h>
+#include "common.h"
 
 /**
@@ -53,5 +53,5 @@
 #define RITE_BINARY_IDENT              "RITE"
 #define RITE_BINARY_IDENT_LIL          "ETIR"
-#define RITE_BINARY_FORMAT_VER         "0003"
+#define RITE_BINARY_FORMAT_VER         "0004"
 #define RITE_COMPILER_NAME             "MATZ"
 #define RITE_COMPILER_VERSION          "0000"
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/error.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/error.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/error.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_ERROR_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -32,4 +32,11 @@
 /* declaration for fail method */
 MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value);
+
+struct RBreak {
+  MRB_OBJECT_HEADER;
+  struct iv_tbl *iv;
+  struct RProc *proc;
+  mrb_value val;
+};
 
 /**
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/gc.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/gc.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/gc.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_GC_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -18,5 +18,7 @@
 struct mrb_state;
 
-typedef void (mrb_each_object_callback)(struct mrb_state *mrb, struct RBasic *obj, void *data);
+#define MRB_EACH_OBJ_OK 0
+#define MRB_EACH_OBJ_BREAK 1
+typedef int (mrb_each_object_callback)(struct mrb_state *mrb, struct RBasic *obj, void *data);
 void mrb_objspace_each_objects(struct mrb_state *mrb, mrb_each_object_callback *callback, void *data);
 MRB_API void mrb_free_context(struct mrb_state *mrb, struct mrb_context *c);
@@ -63,4 +65,5 @@
   int interval_ratio;
   int step_ratio;
+  mrb_bool iterating     :1;
   mrb_bool disabled      :1;
   mrb_bool full          :1;
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/hash.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/hash.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/hash.h	(revision 331)
@@ -8,5 +8,6 @@
 #define MRUBY_HASH_H
 
-#include "mruby/common.h"
+#include "common.h"
+#include <mruby/khash.h>
 
 /**
@@ -24,8 +25,15 @@
 #define mrb_hash_value(p)  mrb_obj_value((void*)(p))
 
-MRB_API mrb_value mrb_hash_new_capa(mrb_state*, int);
+MRB_API mrb_value mrb_hash_new_capa(mrb_state*, mrb_int);
 
 /*
  * Initializes a new hash.
+ *
+ * Equivalent to:
+ *
+ *      Hash.new
+ *
+ * @param mrb The mruby state reference.
+ * @return The initialized hash.
  */
 MRB_API mrb_value mrb_hash_new(mrb_state *mrb);
@@ -33,16 +41,59 @@
 /*
  * Sets a keys and values to hashes.
+ *
+ * Equivalent to:
+ *
+ *      hash[key] = val
+ *
+ * @param mrb The mruby state reference.
+ * @param hash The target hash.
+ * @param key The key to set.
+ * @param val The value to set.
+ * @return The value.
  */
 MRB_API void mrb_hash_set(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value val);
 
 /*
- * Gets a value from a key.
+ * Gets a value from a key. If the key is not found, the default of the
+ * hash is used.
+ *
+ * Equivalent to:
+ *
+ *     hash[key]
+ *
+ * @param mrb The mruby state reference.
+ * @param hash The target hash.
+ * @param key The key to get.
+ * @return The found value.
  */
 MRB_API mrb_value mrb_hash_get(mrb_state *mrb, mrb_value hash, mrb_value key);
 
+/*
+ * Gets a value from a key. If the key is not found, the default parameter is
+ * used.
+ *
+ * Equivalent to:
+ *
+ *     hash.hash_key?(key) ? hash[key] : def
+ *
+ * @param mrb The mruby state reference.
+ * @param hash The target hash.
+ * @param key The key to get.
+ * @param def The default value.
+ * @return The found value.
+ */
 MRB_API mrb_value mrb_hash_fetch(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value def);
 
 /*
  * Deletes hash key and value pair.
+ *
+ * Equivalent to:
+ *
+ *     hash.delete(key)
+ *
+ * @param mrb The mruby state reference.
+ * @param hash The target hash.
+ * @param key The key to delete.
+ * @return The deleted value.
  */
 MRB_API mrb_value mrb_hash_delete_key(mrb_state *mrb, mrb_value hash, mrb_value key);
@@ -50,13 +101,63 @@
 /*
  * Gets an array of keys.
+ *
+ * Equivalent to:
+ *
+ *     hash.keys
+ *
+ * @param mrb The mruby state reference.
+ * @param hash The target hash.
+ * @return An array with the keys of the hash.
  */
 MRB_API mrb_value mrb_hash_keys(mrb_state *mrb, mrb_value hash);
 MRB_API mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value hash);
+
+/*
+ * Check if the hash is empty
+ *
+ * Equivalent to:
+ *
+ *     hash.empty?
+ *
+ * @param mrb The mruby state reference.
+ * @param self The target hash.
+ * @return True if the hash is empty, false otherwise.
+ */
 MRB_API mrb_value mrb_hash_empty_p(mrb_state *mrb, mrb_value self);
 
 /*
+ * Gets an array of values.
+ *
+ * Equivalent to:
+ *
+ *     hash.values
+ *
+ * @param mrb The mruby state reference.
+ * @param hash The target hash.
+ * @return An array with the values of the hash.
+ */
+MRB_API mrb_value mrb_hash_values(mrb_state *mrb, mrb_value hash);
+
+/*
  * Clears the hash.
+ *
+ * Equivalent to:
+ *
+ *     hash.clear
+ *
+ * @param mrb The mruby state reference.
+ * @param hash The target hash.
+ * @return The hash
  */
 MRB_API mrb_value mrb_hash_clear(mrb_state *mrb, mrb_value hash);
+
+/* declaration of struct kh_ht */
+/* be careful when you touch the internal */
+typedef struct {
+  mrb_value v;
+  mrb_int n;
+} mrb_hash_value;
+
+KHASH_DECLARE(ht, mrb_value, mrb_hash_value, TRUE)
 
 /* RHASH_TBL allocates st_table if not available. */
@@ -67,5 +168,7 @@
 MRB_API struct kh_ht * mrb_hash_tbl(mrb_state *mrb, mrb_value hash);
 
-#define MRB_HASH_PROC_DEFAULT 256
+#define MRB_HASH_DEFAULT      1
+#define MRB_HASH_PROC_DEFAULT 2
+#define MRB_RHASH_DEFAULT_P(h) (RHASH(h)->flags & MRB_HASH_DEFAULT)
 #define MRB_RHASH_PROCDEFAULT_P(h) (RHASH(h)->flags & MRB_HASH_PROC_DEFAULT)
 
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/irep.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/irep.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/irep.h	(revision 331)
@@ -8,6 +8,6 @@
 #define MRUBY_IREP_H
 
-#include "mruby/common.h"
-#include "mruby/compile.h"
+#include "common.h"
+#include <mruby/compile.h>
 
 /**
@@ -40,4 +40,5 @@
   struct mrb_locals *lv;
   /* debug info */
+  mrb_bool own_filename;
   const char *filename;
   uint16_t *lines;
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/istruct.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/istruct.h	(revision 331)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/istruct.h	(revision 331)
@@ -0,0 +1,47 @@
+/*
+** mruby/istruct.h - Inline structures
+**
+** See Copyright Notice in mruby.h
+*/
+
+#ifndef MRUBY_ISTRUCT_H
+#define MRUBY_ISTRUCT_H
+
+#include "common.h"
+#include <string.h>
+
+/**
+ * Inline structures that fit in RVALUE
+ *
+ * They cannot have finalizer, and cannot have instance variables.
+ */
+MRB_BEGIN_DECL
+
+#define ISTRUCT_DATA_SIZE (sizeof(void*) * 3)
+
+struct RIstruct {
+  MRB_OBJECT_HEADER;
+  char inline_data[ISTRUCT_DATA_SIZE];
+};
+
+#define RISTRUCT(obj)         ((struct RIstruct*)(mrb_ptr(obj)))
+#define ISTRUCT_PTR(obj)      (RISTRUCT(obj)->inline_data)
+
+MRB_INLINE mrb_int mrb_istruct_size()
+{
+  return ISTRUCT_DATA_SIZE;
+}
+
+MRB_INLINE void* mrb_istruct_ptr(mrb_value object)
+{
+  return ISTRUCT_PTR(object);
+}
+
+MRB_INLINE void mrb_istruct_copy(mrb_value dest, mrb_value src)
+{
+  memcpy(ISTRUCT_PTR(dest), ISTRUCT_PTR(src), ISTRUCT_DATA_SIZE);
+}
+
+MRB_END_DECL
+
+#endif /* MRUBY_ISTRUCT_H */
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/khash.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/khash.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/khash.h	(revision 331)
@@ -10,6 +10,6 @@
 #include <string.h>
 
-#include "mruby.h"
-#include "mruby/common.h"
+#include <mruby.h>
+#include "common.h"
 
 /**
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/numeric.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/numeric.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/numeric.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_NUMERIC_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -21,4 +21,10 @@
 #define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
 
+#ifdef MRB_INT64
+#define FIXABLE_FLOAT(f) FIXABLE((mrb_int)(f))
+#else
+#define FIXABLE_FLOAT(f) FIXABLE(f)
+#endif
+
 MRB_API mrb_value mrb_flo_to_fixnum(mrb_state *mrb, mrb_value val);
 MRB_API mrb_value mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, int base);
@@ -32,4 +38,57 @@
 mrb_value mrb_num_div(mrb_state *mrb, mrb_value x, mrb_value y);
 
+#ifndef __has_builtin
+  #define __has_builtin(x) 0
+#endif
+
+#if (defined(__GNUC__) && __GNUC__ >= 5) ||   \
+    (__has_builtin(__builtin_add_overflow) && \
+     __has_builtin(__builtin_sub_overflow) && \
+     __has_builtin(__builtin_mul_overflow))
+# define MRB_HAVE_TYPE_GENERIC_CHECKED_ARITHMETIC_BUILTINS
+#endif
+
+/*
+// Clang 3.8 and 3.9 have problem compiling mruby in 32-bit mode, when MRB_INT64 is set
+// because of missing __mulodi4 and similar functions in its runtime. We need to use custom
+// implementation for them.
+*/
+#ifdef MRB_HAVE_TYPE_GENERIC_CHECKED_ARITHMETIC_BUILTINS
+#if defined(__clang__) && (__clang_major__ == 3) && (__clang_minor__ >= 8) && \
+    defined(MRB_32BIT) && defined(MRB_INT64)
+#undef MRB_HAVE_TYPE_GENERIC_CHECKED_ARITHMETIC_BUILTINS
+#endif
+#endif
+
+#ifdef MRB_HAVE_TYPE_GENERIC_CHECKED_ARITHMETIC_BUILTINS
+
+#ifndef MRB_WORD_BOXING
+# define WBCHK(x) 0
+#else
+# define WBCHK(x) !FIXABLE(x)
+#endif
+
+static inline mrb_bool
+mrb_int_add_overflow(mrb_int augend, mrb_int addend, mrb_int *sum)
+{
+  return __builtin_add_overflow(augend, addend, sum) || WBCHK(*sum);
+}
+
+static inline mrb_bool
+mrb_int_sub_overflow(mrb_int minuend, mrb_int subtrahend, mrb_int *difference)
+{
+  return __builtin_sub_overflow(minuend, subtrahend, difference) || WBCHK(*difference);
+}
+
+static inline mrb_bool
+mrb_int_mul_overflow(mrb_int multiplier, mrb_int multiplicand, mrb_int *product)
+{
+  return __builtin_mul_overflow(multiplier, multiplicand, product) || WBCHK(*product);
+}
+
+#undef WBCHK
+
+#else
+
 #define MRB_UINT_MAKE2(n) uint ## n ## _t
 #define MRB_UINT_MAKE(n) MRB_UINT_MAKE2(n)
@@ -37,45 +96,4 @@
 
 #define MRB_INT_OVERFLOW_MASK ((mrb_uint)1 << (MRB_INT_BIT - 1 - MRB_FIXNUM_SHIFT))
-
-/* Idea from Potion: https://github.com/perl11/potion (MIT) */
-#if (defined(__clang__) && ((__clang_major__ > 3) || (__clang_major__ == 3 && __clang_minor__ >= 4))) \
-    || (defined(__GNUC__) && __GNUC__ >= 5)
-
-static inline mrb_bool
-mrb_int_add_overflow(mrb_int augend, mrb_int addend, mrb_int *sum)
-{
-  mrb_bool of;
-
-#ifdef MRB_INT64
-  long long val;
-  of = __builtin_saddll_overflow(augend, addend, &val) ||
-#else
-  int val;
-  of = __builtin_sadd_overflow(augend, addend, &val) ||
-#endif
-  (val > MRB_INT_MAX) || (val < MRB_INT_MIN);
-
-  *sum = (mrb_int) val;
-  return of;
-}
-
-static inline mrb_bool
-mrb_int_sub_overflow(mrb_int minuend, mrb_int subtrahend, mrb_int *difference)
-{
-  mrb_bool of;
-
-#ifdef MRB_INT64
-  long long val;
-  of = __builtin_ssubll_overflow(minuend, subtrahend, &val) ||
-#else
-  int val;
-  of = __builtin_ssub_overflow(minuend, subtrahend, &val) ||
-#endif
-  (val > MRB_INT_MAX) || (val < MRB_INT_MIN);
-
-  *difference = (mrb_int) val;
-  return of;
-}
-#else
 
 static inline mrb_bool
@@ -99,5 +117,32 @@
 }
 
+static inline mrb_bool
+mrb_int_mul_overflow(mrb_int multiplier, mrb_int multiplicand, mrb_int *product)
+{
+#if MRB_INT_BIT == 32
+  int64_t n = (int64_t)multiplier * multiplicand;
+  *product = (mrb_int)n;
+  return !FIXABLE(n);
+#else
+  if (multiplier > 0) {
+    if (multiplicand > 0) {
+      if (multiplier > MRB_INT_MAX / multiplicand) return TRUE;
+    }
+    else {
+      if (multiplicand < MRB_INT_MAX / multiplier) return TRUE;
+    }
+  }
+  else {
+    if (multiplicand > 0) {
+      if (multiplier < MRB_INT_MAX / multiplicand) return TRUE;
+    }
+    else {
+      if (multiplier != 0 && multiplicand < MRB_INT_MAX / multiplier) return TRUE;
+    }
+  }
+  *product = multiplier * multiplicand;
+  return FALSE;
 #endif
+}
 
 #undef MRB_INT_OVERFLOW_MASK
@@ -106,4 +151,6 @@
 #undef MRB_UINT_MAKE2
 
+#endif
+
 MRB_END_DECL
 
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/object.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/object.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/object.h	(revision 331)
@@ -23,4 +23,8 @@
 #define mrb_basic_ptr(v) ((struct RBasic*)(mrb_ptr(v)))
 
+#define MRB_FROZEN_P(o) ((o)->flags & MRB_FLAG_IS_FROZEN)
+#define MRB_SET_FROZEN_FLAG(o) ((o)->flags |= MRB_FLAG_IS_FROZEN)
+#define MRB_UNSET_FROZEN_FLAG(o) ((o)->flags &= ~MRB_FLAG_IS_FROZEN)
+
 struct RObject {
   MRB_OBJECT_HEADER;
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/opcode.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/opcode.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/opcode.h	(revision 331)
@@ -83,5 +83,6 @@
   OP_JMPNOT,/*    A sBx   if !R(A) pc+=sBx                                */
   OP_ONERR,/*     sBx     rescue_push(pc+sBx)                             */
-  OP_RESCUE,/*    A       clear(exc); R(A) := exception (ignore when A=0) */
+  OP_RESCUE,/*    A B C   if A (if C exc=R(A) else R(A) := exc);
+                          if B R(B) := exc.isa?(R(B)); clear(exc)         */
   OP_POPERR,/*    A       A.times{rescue_pop()}                           */
   OP_RAISE,/*     A       raise(R(A))                                     */
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/proc.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/proc.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/proc.h	(revision 331)
@@ -8,6 +8,6 @@
 #define MRUBY_PROC_H
 
-#include "mruby/common.h"
-#include "mruby/irep.h"
+#include "common.h"
+#include <mruby/irep.h>
 
 /**
@@ -19,6 +19,9 @@
   MRB_OBJECT_HEADER;
   mrb_value *stack;
-  mrb_sym mid;
   ptrdiff_t cioff;
+  union {
+    mrb_sym mid;
+    struct mrb_context *c;
+  } cxt;
 };
 
@@ -27,4 +30,6 @@
 #define MRB_ENV_UNSHARE_STACK(e) ((e)->cioff = -1)
 #define MRB_ENV_STACK_SHARED_P(e) ((e)->cioff >= 0)
+
+MRB_API void mrb_env_unshare(mrb_state*, struct REnv*);
 
 struct RProc {
@@ -51,4 +56,6 @@
 #define MRB_PROC_STRICT 256
 #define MRB_PROC_STRICT_P(p) (((p)->flags & MRB_PROC_STRICT) != 0)
+#define MRB_PROC_ORPHAN 512
+#define MRB_PROC_ORPHAN_P(p) (((p)->flags & MRB_PROC_ORPHAN) != 0)
 
 #define mrb_proc_ptr(v)    ((struct RProc*)(mrb_ptr(v)))
@@ -69,5 +76,5 @@
 #define mrb_cfunc_env_get(mrb, idx) mrb_proc_cfunc_env_get(mrb, idx)
 
-#include "mruby/khash.h"
+#include <mruby/khash.h>
 KHASH_DECLARE(mt, mrb_sym, struct RProc*, TRUE)
 
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/range.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/range.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/range.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_RANGE_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -26,5 +26,6 @@
 };
 
-#define mrb_range_ptr(v)    ((struct RRange*)(mrb_ptr(v)))
+MRB_API struct RRange* mrb_range_ptr(mrb_state *mrb, mrb_value v);
+#define mrb_range_raw_ptr(v) ((struct RRange*)mrb_ptr(v))
 #define mrb_range_value(p)  mrb_obj_value((void*)(p))
 
@@ -41,5 +42,5 @@
 MRB_API mrb_value mrb_range_new(mrb_state *mrb, mrb_value start, mrb_value end, mrb_bool exclude);
 
-MRB_API mrb_bool mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp, mrb_int len);
+MRB_API mrb_int mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp, mrb_int len, mrb_bool trunc);
 mrb_value mrb_get_values_at(mrb_state *mrb, mrb_value obj, mrb_int olen, mrb_int argc, const mrb_value *argv, mrb_value (*func)(mrb_state*, mrb_value, mrb_int));
 
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/re.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/re.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/re.h	(revision 331)
@@ -8,13 +8,9 @@
 #define MRUBY_RE_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+MRB_BEGIN_DECL
 
 #define REGEXP_CLASS          "Regexp"
 
-#ifdef __cplusplus
-}
-#endif
+MRB_END_DECL
 
 #endif  /* RE_H */
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/string.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/string.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/string.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_STRING_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -45,5 +45,6 @@
   if (RSTR_EMBED_P(s)) {\
     RSTR_SET_EMBED_LEN((s),(n));\
-  } else {\
+  }\
+  else {\
     s->as.heap.len = (mrb_int)(n);\
   }\
@@ -63,8 +64,4 @@
 #define RSTR_UNSET_NOFREE_FLAG(s) ((s)->flags &= ~MRB_STR_NOFREE)
 
-#define RSTR_FROZEN_P(s) ((s)->flags & MRB_STR_FROZEN)
-#define RSTR_SET_FROZEN_FLAG(s) ((s)->flags |= MRB_STR_FROZEN)
-#define RSTR_UNSET_FROZEN_FLAG(s) ((s)->flags &= ~MRB_STR_FROZEN)
-
 /*
  * Returns a pointer from a Ruby string
@@ -73,23 +70,117 @@
 #define RSTRING(s)           mrb_str_ptr(s)
 #define RSTRING_PTR(s)       RSTR_PTR(RSTRING(s))
-#define RSTRING_EMBED_LEN(s) RSTR_ENBED_LEN(RSTRING(s))
+#define RSTRING_EMBED_LEN(s) RSTR_EMBED_LEN(RSTRING(s))
 #define RSTRING_LEN(s)       RSTR_LEN(RSTRING(s))
 #define RSTRING_CAPA(s)      RSTR_CAPA(RSTRING(s))
 #define RSTRING_END(s)       (RSTRING_PTR(s) + RSTRING_LEN(s))
-mrb_int mrb_str_strlen(mrb_state*, struct RString*);
+MRB_API mrb_int mrb_str_strlen(mrb_state*, struct RString*);
 
 #define MRB_STR_SHARED    1
 #define MRB_STR_NOFREE    2
-#define MRB_STR_FROZEN    4
-#define MRB_STR_EMBED     8
-#define MRB_STR_EMBED_LEN_MASK 0x1f0
-#define MRB_STR_EMBED_LEN_SHIFT 4
+#define MRB_STR_NO_UTF    8
+#define MRB_STR_EMBED    16
+#define MRB_STR_EMBED_LEN_MASK 0x3e0
+#define MRB_STR_EMBED_LEN_SHIFT 5
 
 void mrb_gc_free_str(mrb_state*, struct RString*);
 MRB_API void mrb_str_modify(mrb_state*, struct RString*);
+/*
+ * Appends self to other. Returns self as a concatnated string.
+ *
+ *
+ *  Example:
+ *
+ *     !!!c
+ *     int
+ *     main(int argc,
+ *          char **argv)
+ *     {
+ *       // Variable declarations.
+ *       mrb_value str1;
+ *       mrb_value str2;
+ *
+ *       mrb_state *mrb = mrb_open();
+ *       if (!mrb)
+ *       {
+ *          // handle error
+ *       }
+ *
+ *       // Creates new Ruby strings.
+ *       str1 = mrb_str_new_lit(mrb, "abc");
+ *       str2 = mrb_str_new_lit(mrb, "def");
+ *
+ *       // Concatnates str2 to str1.
+ *       mrb_str_concat(mrb, str1, str2);
+ *
+ *      // Prints new Concatnated Ruby string.
+ *      mrb_p(mrb, str1);
+ *
+ *      mrb_close(mrb);
+ *      return 0;
+ *    }
+ *
+ *
+ *  Result:
+ *
+ *     => "abcdef"
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] self String to concatenate.
+ * @param [mrb_value] other String to append to self.
+ * @return [mrb_value] Returns a new String appending other to self.
+ */
 MRB_API void mrb_str_concat(mrb_state*, mrb_value, mrb_value);
 
 /*
  * Adds two strings together.
+ *
+ *
+ *  Example:
+ *
+ *     !!!c
+ *     int
+ *     main(int argc,
+ *          char **argv)
+ *     {
+ *       // Variable declarations.
+ *       mrb_value a;
+ *       mrb_value b;
+ *       mrb_value c;
+ *
+ *       mrb_state *mrb = mrb_open();
+ *       if (!mrb)
+ *       {
+ *          // handle error
+ *       }
+ *
+ *       // Creates two Ruby strings from the passed in C strings.
+ *       a = mrb_str_new_lit(mrb, "abc");
+ *       b = mrb_str_new_lit(mrb, "def");
+ *
+ *       // Prints both C strings.
+ *       mrb_p(mrb, a);
+ *       mrb_p(mrb, b);
+ *
+ *       // Concatnates both Ruby strings.
+ *       c = mrb_str_plus(mrb, a, b);
+ *
+ *      // Prints new Concatnated Ruby string.
+ *      mrb_p(mrb, c);
+ *
+ *      mrb_close(mrb);
+ *      return 0;
+ *    }
+ *
+ *
+ *  Result:
+ *
+ *     => "abc"  # First string
+ *     => "def"  # Second string
+ *     => "abcdef" # First & Second concatnated.
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] a First string to concatenate.
+ * @param [mrb_value] b Second string to concatenate.
+ * @return [mrb_value] Returns a new String containing a concatenated to b.
  */
 MRB_API mrb_value mrb_str_plus(mrb_state*, mrb_value, mrb_value);
@@ -97,4 +188,8 @@
 /*
  * Converts pointer into a Ruby string.
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [void*] p The pointer to convert to Ruby string.
+ * @return [mrb_value] Returns a new Ruby String.
  */
 MRB_API mrb_value mrb_ptr_to_str(mrb_state *, void*);
@@ -102,9 +197,48 @@
 /*
  * Returns an object as a Ruby string.
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] obj An object to return as a Ruby string.
+ * @return [mrb_value] An object as a Ruby string.
  */
 MRB_API mrb_value mrb_obj_as_string(mrb_state *mrb, mrb_value obj);
 
 /*
- * Resizes the string's length.
+ * Resizes the string's length. Returns the amount of characters
+ * in the specified by len.
+ *
+ * Example:
+ *
+ *     !!!c
+ *     int
+ *     main(int argc,
+ *          char **argv)
+ *     {
+ *         // Variable declaration.
+ *         mrb_value str;
+ *
+ *         mrb_state *mrb = mrb_open();
+ *         if (!mrb)
+ *         {
+ *            // handle error
+ *         }
+ *         // Creates a new string.
+ *         str = mrb_str_new_lit(mrb, "Hello, world!");
+ *         // Returns 5 characters of
+ *         mrb_str_resize(mrb, str, 5);
+ *         mrb_p(mrb, str);
+ *
+ *         mrb_close(mrb);
+ *         return 0;
+ *      }
+ *
+ * Result:
+ *
+ *     => "Hello"
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] str The Ruby string to resize.
+ * @param [mrb_value] len The length.
+ * @return [mrb_value] An object as a Ruby string.
  */
 MRB_API mrb_value mrb_str_resize(mrb_state *mrb, mrb_value str, mrb_int len);
@@ -112,4 +246,42 @@
 /*
  * Returns a sub string.
+ *
+ *  Example:
+ *
+ *     !!!c
+ *     int
+ *     main(int argc,
+ *     char const **argv)
+ *     {
+ *       // Variable declarations.
+ *       mrb_value str1;
+ *       mrb_value str2;
+ *
+ *       mrb_state *mrb = mrb_open();
+ *       if (!mrb)
+ *       {
+ *         // handle error
+ *       }
+ *       // Creates new string.
+ *       str1 = mrb_str_new_lit(mrb, "Hello, world!");
+ *       // Returns a sub-string within the range of 0..2
+ *       str2 = mrb_str_substr(mrb, str1, 0, 2);
+ *
+ *       // Prints sub-string.
+ *       mrb_p(mrb, str2);
+ *
+ *       mrb_close(mrb);
+ *       return 0;
+ *     }
+ *
+ *  Result:
+ *
+ *     => "He"
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] str Ruby string.
+ * @param [mrb_int] beg The beginning point of the sub-string.
+ * @param [mrb_int] len The end point of the sub-string.
+ * @return [mrb_value] An object as a Ruby sub-string.
  */
 MRB_API mrb_value mrb_str_substr(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len);
@@ -117,4 +289,9 @@
 /*
  * Returns a Ruby string type.
+ *
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] str Ruby string.
+ * @return [mrb_value] A Ruby string.
  */
 MRB_API mrb_value mrb_string_type(mrb_state *mrb, mrb_value str);
@@ -124,13 +301,31 @@
 
 MRB_API const char *mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr);
-MRB_API const char *mrb_string_value_ptr(mrb_state *mrb, mrb_value ptr);
+MRB_API const char *mrb_string_value_ptr(mrb_state *mrb, mrb_value str);
+/*
+ * Returns the length of the Ruby string.
+ *
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] str Ruby string.
+ * @return [mrb_int] The length of the passed in Ruby string.
+ */
+MRB_API mrb_int mrb_string_value_len(mrb_state *mrb, mrb_value str);
 
 /*
  * Duplicates a string object.
+ *
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] str Ruby string.
+ * @return [mrb_value] Duplicated Ruby string.
  */
 MRB_API mrb_value mrb_str_dup(mrb_state *mrb, mrb_value str);
 
 /*
- * Returns a symbol from a passed in string.
+ * Returns a symbol from a passed in Ruby string.
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] self Ruby string.
+ * @return [mrb_value] A symbol.
  */
 MRB_API mrb_value mrb_str_intern(mrb_state *mrb, mrb_value self);
@@ -146,4 +341,9 @@
 /*
  * Returns true if the strings match and false if the strings don't match.
+ *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] str1 Ruby string to compare.
+ * @param [mrb_value] str2 Ruby string to compare.
+ * @return [mrb_value] boolean value.
  */
 MRB_API mrb_bool mrb_str_equal(mrb_state *mrb, mrb_value str1, mrb_value str2);
@@ -152,4 +352,9 @@
  * Returns a concated string comprised of a Ruby string and a C string.
  *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] str Ruby string.
+ * @param [const char *] ptr A C string.
+ * @param [size_t] len length of C string.
+ * @return [mrb_value] A Ruby string.
  * @see mrb_str_cat_cstr
  */
@@ -159,4 +364,8 @@
  * Returns a concated string comprised of a Ruby string and a C string.
  *
+ * @param [mrb_state] mrb The current mruby state.
+ * @param [mrb_value] str Ruby string.
+ * @param [const char *] ptr A C string.
+ * @return [mrb_value] A Ruby string.
  * @see mrb_str_cat
  */
@@ -176,5 +385,17 @@
 
 /*
- * Returns a C string from a Ruby string.
+ * Returns a newly allocated C string from a Ruby string.
+ * This is an utility function to pass a Ruby string to C library functions.
+ *
+ * - Returned string does not contain any NUL characters (but terminator).
+ * - It raises an ArgumentError exception if Ruby string contains
+ *   NUL characters.
+ * - Retured string will be freed automatically on next GC.
+ * - Caller can modify returned string without affecting Ruby string
+ *   (e.g. it can be used for mkstemp(3)).
+ *
+ * @param [mrb_state *] mrb The current mruby state.
+ * @param [mrb_value] str Ruby string. Must be an instance of String.
+ * @return [char *] A newly allocated C string.
  */
 MRB_API char *mrb_str_to_cstr(mrb_state *mrb, mrb_value str);
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/throw.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/throw.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/throw.h	(revision 331)
@@ -8,5 +8,11 @@
 #define MRB_THROW_H
 
-#ifdef MRB_ENABLE_CXX_EXCEPTION
+#if defined(MRB_ENABLE_CXX_ABI)
+# if !defined(__cplusplus)
+#  error Trying to use C++ exception handling in C code
+# endif
+#endif
+
+#if defined(MRB_ENABLE_CXX_EXCEPTION) && defined(__cplusplus)
 
 #define MRB_TRY(buf) do { try {
@@ -21,9 +27,17 @@
 #include <setjmp.h>
 
-#define MRB_TRY(buf) do { if (setjmp((buf)->impl) == 0) {
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#define MRB_SETJMP _setjmp
+#define MRB_LONGJMP _longjmp
+#else
+#define MRB_SETJMP setjmp
+#define MRB_LONGJMP longjmp
+#endif
+
+#define MRB_TRY(buf) do { if (MRB_SETJMP((buf)->impl) == 0) {
 #define MRB_CATCH(buf) } else {
 #define MRB_END_EXC(buf) } } while(0)
 
-#define MRB_THROW(buf) longjmp((buf)->impl, 1);
+#define MRB_THROW(buf) MRB_LONGJMP((buf)->impl, 1);
 #define mrb_jmpbuf_impl jmp_buf
 
@@ -33,5 +47,5 @@
   mrb_jmpbuf_impl impl;
 
-#ifdef MRB_ENABLE_CXX_EXCEPTION
+#if defined(MRB_ENABLE_CXX_EXCEPTION) && defined(__cplusplus)
   static mrb_int jmpbuf_id;
   mrb_jmpbuf() : impl(jmpbuf_id++) {}
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/value.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/value.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/value.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_VALUE_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -21,4 +21,18 @@
 #if defined(MRB_INT16) && defined(MRB_INT64)
 # error "You can't define MRB_INT16 and MRB_INT64 at the same time."
+#endif
+
+#if defined _MSC_VER && _MSC_VER < 1800
+# define PRIo64 "llo"
+# define PRId64 "lld"
+# define PRIx64 "llx"
+# define PRIo16 "ho"
+# define PRId16 "hd"
+# define PRIx16 "hx"
+# define PRIo32 "o"
+# define PRId32 "d"
+# define PRIx32 "x"
+#else
+# include <inttypes.h>
 #endif
 
@@ -28,4 +42,7 @@
 # define MRB_INT_MIN (INT64_MIN>>MRB_FIXNUM_SHIFT)
 # define MRB_INT_MAX (INT64_MAX>>MRB_FIXNUM_SHIFT)
+# define MRB_PRIo PRIo64
+# define MRB_PRId PRId64
+# define MRB_PRIx PRIx64
 #elif defined(MRB_INT16)
   typedef int16_t mrb_int;
@@ -33,4 +50,7 @@
 # define MRB_INT_MIN (INT16_MIN>>MRB_FIXNUM_SHIFT)
 # define MRB_INT_MAX (INT16_MAX>>MRB_FIXNUM_SHIFT)
+# define MRB_PRIo PRIo16
+# define MRB_PRId PRId16
+# define MRB_PRIx PRIx16
 #else
   typedef int32_t mrb_int;
@@ -38,12 +58,15 @@
 # define MRB_INT_MIN (INT32_MIN>>MRB_FIXNUM_SHIFT)
 # define MRB_INT_MAX (INT32_MAX>>MRB_FIXNUM_SHIFT)
-#endif
-
+# define MRB_PRIo PRIo32
+# define MRB_PRId PRId32
+# define MRB_PRIx PRIx32
+#endif
+
+
+MRB_API double mrb_float_read(const char*, char**);
 #ifdef MRB_USE_FLOAT
   typedef float mrb_float;
-# define str_to_mrb_float(buf) strtof(buf, NULL)
 #else
   typedef double mrb_float;
-# define str_to_mrb_float(buf) strtod(buf, NULL)
 #endif
 
@@ -63,5 +86,4 @@
 #  define isinf(n) (!_finite(n) && !_isnan(n))
 #  define signbit(n) (_copysign(1.0, (n)) < 0.0)
-#  define strtof (float)strtod
 static const unsigned int IEEE754_INFINITY_BITS_SINGLE = 0x7F800000;
 #  define INFINITY (*(float *)&IEEE754_INFINITY_BITS_SINGLE)
@@ -94,8 +116,10 @@
   MRB_TT_DATA,        /*  21 */
   MRB_TT_FIBER,       /*  22 */
-  MRB_TT_MAXDEFINE    /*  23 */
+  MRB_TT_ISTRUCT,     /*  23 */
+  MRB_TT_BREAK,       /*  24 */
+  MRB_TT_MAXDEFINE    /*  25 */
 };
 
-#include "mruby/object.h"
+#include <mruby/object.h>
 
 #ifdef MRB_DOCUMENTATION_BLOCK
@@ -188,4 +212,6 @@
   mrb_value v;
   SET_OBJ_VALUE(v, (struct RBasic*)p);
+  mrb_assert(p == mrb_ptr(v));
+  mrb_assert(((struct RBasic*)p)->tt == mrb_type(v));
   return v;
 }
@@ -242,4 +268,12 @@
 
 #ifdef MRB_USE_ETEXT_EDATA
+#if (defined(__APPLE__) && defined(__MACH__))
+#include <mach-o/getsect.h>
+static inline mrb_bool
+mrb_ro_data_p(const char *p)
+{
+  return (const char*)get_etext() < p && p < (const char*)get_edata();
+}
+#else
 extern char _etext[];
 #ifdef MRB_NO_INIT_ARRAY_START
@@ -260,4 +294,5 @@
 }
 #endif
+#endif
 #else
 # define mrb_ro_data_p(p) FALSE
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/variable.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/variable.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/variable.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_VARIABLE_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -55,7 +55,65 @@
 MRB_API void mrb_iv_copy(mrb_state *mrb, mrb_value dst, mrb_value src);
 MRB_API mrb_bool mrb_const_defined_at(mrb_state *mrb, mrb_value mod, mrb_sym id);
+
+/**
+ * Get a global variable. Will return nil if the var does not exist
+ *
+ * Example:
+ *
+ *     !!!ruby
+ *     # Ruby style
+ *     var = $value
+ *
+ *     !!!c
+ *     // C style
+ *     mrb_sym sym = mrb_intern_lit(mrb, "$value");
+ *     mrb_value var = mrb_gv_get(mrb, sym);
+ *
+ * @param mrb The mruby state reference
+ * @param sym The name of the global variable
+ * @return The value of that global variable. May be nil
+ */
 MRB_API mrb_value mrb_gv_get(mrb_state *mrb, mrb_sym sym);
+
+/**
+ * Set a global variable
+ *
+ * Example:
+ *
+ *     !!!ruby
+ *     # Ruby style
+ *     $value = "foo"
+ *
+ *     !!!c
+ *     // C style
+ *     mrb_sym sym = mrb_intern_lit(mrb, "$value");
+ *     mrb_gv_set(mrb, sym, mrb_str_new_lit("foo"));
+ *
+ * @param mrb The mruby state reference
+ * @param sym The name of the global variable
+ * @param val The value of the global variable
+ */
 MRB_API void mrb_gv_set(mrb_state *mrb, mrb_sym sym, mrb_value val);
+
+/**
+ * Remove a global variable.
+ *
+ * Example:
+ *
+ *     !!!ruby
+ *     # Ruby style
+ *     $value = nil
+ *
+ *     !!!c
+ *     // C style
+ *     mrb_sym sym = mrb_intern_lit(mrb, "$value");
+ *     mrb_gv_remove(mrb, sym);
+ *
+ * @param mrb The mruby state reference
+ * @param sym The name of the global variable
+ * @param val The value of the global variable
+ */
 MRB_API void mrb_gv_remove(mrb_state *mrb, mrb_sym sym);
+
 MRB_API mrb_value mrb_cv_get(mrb_state *mrb, mrb_value mod, mrb_sym sym);
 MRB_API void mrb_mod_cv_set(mrb_state *mrb, struct RClass * c, mrb_sym sym, mrb_value v);
Index: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/version.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/version.h	(revision 321)
+++ EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/version.h	(revision 331)
@@ -8,5 +8,5 @@
 #define MRUBY_VERSION_H
 
-#include "mruby/common.h"
+#include "common.h"
 
 /**
@@ -43,5 +43,5 @@
  * Minor release version number.
  */
-#define MRUBY_RELEASE_MINOR 2
+#define MRUBY_RELEASE_MINOR 3
 
 /*
@@ -63,15 +63,15 @@
  * Release year.
  */
-#define MRUBY_RELEASE_YEAR 2015
+#define MRUBY_RELEASE_YEAR 2017
 
 /*
  * Release month.
  */
-#define MRUBY_RELEASE_MONTH 11
+#define MRUBY_RELEASE_MONTH 7
 
 /*
  * Release day.
  */
-#define MRUBY_RELEASE_DAY 17
+#define MRUBY_RELEASE_DAY 4
 
 /*
