Index: EcnlProtoTool/trunk/mruby-1.2.0/.cproject
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/.cproject	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/.cproject	(revision 279)
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+	<storageModule moduleId="org.eclipse.cdt.core.settings">
+		<cconfiguration id="com.renesas.cdt.rz.debug.win32.configuration.Id.1552447583">
+			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.renesas.cdt.rz.debug.win32.configuration.Id.1552447583" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+				<externalSettings/>
+				<extensions>
+					<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+				</extensions>
+			</storageModule>
+			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+				<configuration artifactName="mruby" buildArtefactType="com.renesas.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=com.renesas.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf *.lst *.lis *.lpp *.map libgcc.a" description="" id="com.renesas.cdt.rz.debug.win32.configuration.Id.1552447583" name="Debug" parent="com.renesas.cdt.rz.debug.win32.configuration.Id">
+					<folderInfo id="com.renesas.cdt.rz.debug.win32.configuration.Id.1552447583." name="/" resourcePath="">
+						<toolChain id="com.renesas.cdt.rz.debug.win32.toolchain.Id.87786683" name="KPIT GNUARM-NONE-EABI Toolchain" superClass="com.renesas.cdt.rz.debug.win32.toolchain.Id">
+							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE" id="com.renesas.cdt.rz.debug.win32.targetplatform.Id.1600182357" name="Target Platform" osList="all" superClass="com.renesas.cdt.rz.debug.win32.targetplatform.Id"/>
+							<builder buildPath="${workspace_loc:/mruby-1.2.0}" id="com.renesas.cdt.rz.debug.win32.builder.Id.1846611762" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Builder" superClass="com.renesas.cdt.rz.debug.win32.builder.Id"/>
+							<tool id="com.renesas.cdt.rz.debug.win32.tool.libgen.Id.1116635171" name="Library Generator" superClass="com.renesas.cdt.rz.debug.win32.tool.libgen.Id">
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.ctype.458951408" name="ctype.h : æå­ãæ±ããã§ãã¯ãã¾ã" superClass="com.renesas.cdt.core.LibraryGenerator.option.ctype" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.math.1642753503" name="math.h : ä¸è§é¢æ°ãªã©æ°å¤ã®è¨ç®ãè¡ãã¾ã" superClass="com.renesas.cdt.core.LibraryGenerator.option.math" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.stdio.961659227" name="stdio.h : å
+¥å/åºåãè¡ãã¾ã" superClass="com.renesas.cdt.core.LibraryGenerator.option.stdio" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.stdlib.509673709" name="stdlib.h : æ ¼ç´é åã®ç®¡çãªã© C ãã­ã°ã©ã ã®æ¨æºå¦çãè¡ãã¾ã" superClass="com.renesas.cdt.core.LibraryGenerator.option.stdlib" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.string.1550848672" name="string.h : æå­åã®æ¯è¼ã¨ã³ãã¼ãè¡ãã¾ã" superClass="com.renesas.cdt.core.LibraryGenerator.option.string" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.selectLibrary.422121936" name="ã©ã¤ãã©ãªã¼ã®é¸æ" superClass="com.renesas.cdt.core.LibraryGenerator.option.selectLibrary" value="com.renesas.core.LibraryGenerator.option.selectLibrary.newLib" valueType="enumerated"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.libraryType.1589977374" name="ã©ã¤ãã©ãªã¼å" superClass="com.renesas.cdt.core.LibraryGenerator.option.libraryType" value="com.renesas.cdt.core.LibraryGenerator.option.libraryType.projectBuilt" valueType="enumerated"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.misc9.1198648676" name="åé¢æ°ããåºåãã¡ã¤ã«å
+ã®å¯¾å¿ããã»ã¯ã·ã§ã³ã«é
+ç½®ãã (-ffunction-sections)" superClass="com.renesas.cdt.core.LibraryGenerator.option.misc9" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.misc14.1587684955" name="é¢æ°ã®ã¢ãã¬ã¹ãã¬ã¸ã¹ã¿ã¼ã«ç½®ããªã (-fno-function-cse)" superClass="com.renesas.cdt.core.LibraryGenerator.option.misc14" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.misc36.1213035210" name="Parse the whole compilation unit before starting to produce code ( -funit-at-a-time)" superClass="com.renesas.cdt.core.LibraryGenerator.option.misc36" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.misc10.1626842453" name="åãã¼ã¿ããåºåãã¡ã¤ã«å
+ã®å¯¾å¿ããã»ã¯ã·ã§ã³ã«é
+ç½®ãã (-fdata-sections)" superClass="com.renesas.cdt.core.LibraryGenerator.option.misc10" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.core.LibraryGenerator.option.misc37.476113883" name="Align branch targets to a power-of-two boundary (-falign-jumps)" superClass="com.renesas.cdt.core.LibraryGenerator.option.misc37" value="true" valueType="boolean"/>
+							</tool>
+							<tool id="com.renesas.cdt.rz.debug.win32.tool.compiler.Id.2114772705" name="Compiler" superClass="com.renesas.cdt.rz.debug.win32.tool.compiler.Id">
+								<option defaultValue="true" id="com.renesas.cdt.core.Compiler.option.misc2.2071139574" name="æ¨æºã·ã¹ãã ã»ãã£ã¬ã¯ããªã¼ã§ãããã¼ã»ãã¡ã¤ã«ãæ¤ç´¢ããªã (-nostdinc)" superClass="com.renesas.cdt.core.Compiler.option.misc2" value="false" valueType="boolean"/>
+								<option id="com.renesas.cdt.rz.Debug.Compiler.option.architecture.712090671" name="ã¢ã¼ã­ãã¯ãã£ã¼" superClass="com.renesas.cdt.rz.Debug.Compiler.option.architecture" value="com.renesas.cdt.rz.Debug.Compiler.option.architecture.armv7a" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Compiler.option.cpuType.1792387458" name="CPU ã¿ã¤ã" superClass="com.renesas.cdt.rz.Debug.Compiler.option.cpuType" value="com.renesas.cdt.rz.Debug.Compiler.option.cpuType.rza" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Compiler.option.dataEndian.1830244232" name="ã¨ã³ãã£ã¢ã³" superClass="com.renesas.cdt.rz.Debug.Compiler.option.dataEndian" value="com.renesas.cdt.rz.Debug.Compiler.option.dataEndian.little" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Compiler.option.instructionset.1447259851" name="å½ä»¤ã»ãã" superClass="com.renesas.cdt.rz.Debug.Compiler.option.instructionset" value="com.renesas.cdt.rz.Debug.Compiler.option.instructionset.arm" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Compiler.option.interworking.260043818" name="ã¤ã³ã¿ã¼ã»ã¯ã¼ã­ã³ã° (-mthumb-interwork)" superClass="com.renesas.cdt.rz.Debug.Compiler.option.interworking" value="true" valueType="boolean"/>
+								<option id="com.renesas.cdt.rz.Debug.Compiler.option.targetfpu.367057389" name="ã¿ã¼ã²ãã FPU (-mfpu)" superClass="com.renesas.cdt.rz.Debug.Compiler.option.targetfpu" value="com.renesas.cdt.rz.Debug.Compiler.option.targetfpu.vfp" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Compiler.option.floatingpointabi.1426976645" name="æµ®åå°æ°ç¹ ABI (-mfloat-abi=name)" superClass="com.renesas.cdt.rz.Debug.Compiler.option.floatingpointabi" value="com.renesas.cdt.rz.Debug.Compiler.option.floatingpointabi.soft" valueType="enumerated"/>
+								<option id="com.renesas.cdt.core.Compiler.option.warnStackSize.1147490000" name="Warn if stack size exceeds the limit (-Wstack-usage) (H')" superClass="com.renesas.cdt.core.Compiler.option.warnStackSize" value="100" valueType="string"/>
+								<option id="com.renesas.cdt.core.Compiler.option.CPUSeries.1824596418" name="CPU ã·ãªã¼ãº" superClass="com.renesas.cdt.core.Compiler.option.CPUSeries" value="RZ/A" valueType="string"/>
+								<option id="com.renesas.cdt.core.Compiler.option.device.961121392" name="Device" superClass="com.renesas.cdt.core.Compiler.option.device" value="R7S721001" valueType="string"/>
+								<option id="com.renesas.cdt.core.Compiler.option.deviceShortName.635132041" name="DeviceShortName" superClass="com.renesas.cdt.core.Compiler.option.deviceShortName" value="R7S721001" valueType="string"/>
+								<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.rz.Debug.Compiler.option.macroDefines.57380421" name="ãã¯ã­å®ç¾©" superClass="com.renesas.cdt.rz.Debug.Compiler.option.macroDefines" valueType="definedSymbols">
+									<listOptionValue builtIn="false" value="SIMULATOR_DEBUG"/>
+									<listOptionValue builtIn="false" value="CPPAPP"/>
+								</option>
+								<inputType id="%Base.Compiler.C.InputType.Id.379655366" name="C å
+¥å" superClass="%Base.Compiler.C.InputType.Id"/>
+								<inputType id="Base.Compiler.CPP.InputType.Id.1101890027" name="C++ å
+¥å" superClass="Base.Compiler.CPP.InputType.Id"/>
+							</tool>
+							<tool id="com.renesas.cdt.rz.debug.win32.tool.assembler.Id.1166037999" name="Assembler" superClass="com.renesas.cdt.rz.debug.win32.tool.assembler.Id">
+								<option id="com.renesas.cdt.rz.Debug.Assembler.option.architecture.1178720663" name="ã¢ã¼ã­ãã¯ãã£ã¼" superClass="com.renesas.cdt.rz.Debug.Assembler.option.architecture" value="com.renesas.cdt.rz.Debug.Assembler.option.architecture.armv7a" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Assembler.option.cpuType.1700798679" name="CPU ã¿ã¤ã" superClass="com.renesas.cdt.rz.Debug.Assembler.option.cpuType" value="com.renesas.cdt.rz.Debug.Assembler.option.cpuType.rza" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Assembler.option.dataEndian.835685972" name="ã¨ã³ãã£ã¢ã³" superClass="com.renesas.cdt.rz.Debug.Assembler.option.dataEndian" value="com.renesas.cdt.rz.Debug.Assembler.option.dataEndian.little" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Assembler.option.instructionset.1591801771" name="å½ä»¤ã»ãã" superClass="com.renesas.cdt.rz.Debug.Assembler.option.instructionset" value="com.renesas.cdt.rz.Debug.Assembler.option.instructionset.arm" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Assembler.option.targetfpu.1672411105" name="ã¿ã¼ã²ãã FPU (-mfpu)" superClass="com.renesas.cdt.rz.Debug.Assembler.option.targetfpu" value="com.renesas.cdt.rz.Debug.Assembler.option.targetfpu.vfp" valueType="enumerated"/>
+								<option id="com.renesas.cdt.rz.Debug.Assembler.option.floatingpointabi.1400638226" name="æµ®åå°æ°ç¹ ABI (-mfloat-abi=name)" superClass="com.renesas.cdt.rz.Debug.Assembler.option.floatingpointabi" value="com.renesas.cdt.rz.Debug.Assembler.option.floatingpointabi.soft" valueType="enumerated"/>
+								<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.core.Assembler.option.includeFileDirectories.1632699435" name="ã¤ã³ã¯ã«ã¼ãã»ãã¡ã¤ã«ã»ãã£ã¬ã¯ããªã¼" superClass="com.renesas.cdt.core.Assembler.option.includeFileDirectories" valueType="includePath">
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/src&quot;"/>
+								</option>
+								<inputType id="%Base.Assembler.inputType.Id.1006307562" name="ã¢ã»ã³ãã©ã¼å
+¥åã¿ã¤ã" superClass="%Base.Assembler.inputType.Id"/>
+							</tool>
+							<tool id="com.renesas.cdt.rz.debug.win32.tool.linker.Id.497903742" name="Linker" superClass="com.renesas.cdt.rz.debug.win32.tool.linker.Id">
+								<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.rz.Debug.Linker.option.archiveSearchDirectories.2062570669" name="ã¢ã¼ã«ã¤ãæ¤ç´¢ãã£ã¬ã¯ããªã¼" superClass="com.renesas.cdt.rz.Debug.Linker.option.archiveSearchDirectories" valueType="stringList">
+									<listOptionValue builtIn="false" value="&quot;${CONFIGDIR}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${TCINSTALL}/lib/gcc/arm-none-eabi/${GCC_VERSION}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${TCINSTALL}/arm-none-eabi/lib&quot;"/>
+								</option>
+								<option id="com.renesas.cdt.rz.Debug.Linker.option.dataEndian.718941051" name="ã¨ã³ãã£ã¢ã³" superClass="com.renesas.cdt.rz.Debug.Linker.option.dataEndian" value="com.renesas.cdt.rz.Debug.Linker.option.dataEndian.little" valueType="enumerated"/>
+								<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.rz.Debug.Linker.option.archiveLibraryFiles.6194456" name="ã¢ã¼ã«ã¤ã ( ã©ã¤ãã©ãªã¼ ) ãã¡ã¤ã«" superClass="com.renesas.cdt.rz.Debug.Linker.option.archiveLibraryFiles" valueType="stringList">
+									<listOptionValue builtIn="false" value="${BuildArtifactFileBaseName}"/>
+									<listOptionValue builtIn="false" value="gcc"/>
+									<listOptionValue builtIn="false" value="stdc++"/>
+								</option>
+								<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.core.Linker.option.userDefinedOptions.947383497" name="ã¦ã¼ã¶ã¼å®ç¾©ãªãã·ã§ã³" superClass="com.renesas.cdt.core.Linker.option.userDefinedOptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-e_PowerON_Reset"/>
+								</option>
+								<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.core.Linker.option.linkOrderList.298210254" name="" superClass="com.renesas.cdt.core.Linker.option.linkOrderList" valueType="stringList">
+									<listOptionValue builtIn="false" value="&quot;.\src\hardware_setup.o&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;.\src\interrupt_handlers.o&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;.\src\mruby.o&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;.\src\reset_program.o&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;.\src\vector_table.o&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;.\libmruby.a&quot;"/>
+								</option>
+							</tool>
+							<tool id="com.renesas.cdt.rz.debug.win32.tool.objcopy.Id.1923834783" name="Objcopy" superClass="com.renesas.cdt.rz.debug.win32.tool.objcopy.Id"/>
+						</toolChain>
+					</folderInfo>
+					<sourceEntries>
+						<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+					</sourceEntries>
+				</configuration>
+			</storageModule>
+			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+		</cconfiguration>
+	</storageModule>
+	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+		<project id="mruby.com.renesas.cdt.rz.projectType.win32.Id.3696189" name="Executable (Renesas)" projectType="com.renesas.cdt.rz.projectType.win32.Id"/>
+	</storageModule>
+	<storageModule moduleId="scannerConfiguration">
+		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+	</storageModule>
+	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+	<storageModule moduleId="refreshScope" versionNumber="2">
+		<configuration configurationName="Debug">
+			<resource resourceType="PROJECT" workspacePath="/mruby"/>
+		</configuration>
+	</storageModule>
+</cproject>
Index: EcnlProtoTool/trunk/mruby-1.2.0/.info
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/.info	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/.info	(revision 279)
@@ -0,0 +1,7 @@
+TOOL_CHAIN=KPIT GNUARM-NONE-EABI Toolchain
+VERSION=v16.01
+TC_INSTALL=C:\Program Files (x86)\KPIT\GNUARM-NONEv16.01-EABI\arm-none-eabi\arm-none-eabi\
+GCC_STRING=5.2-GNUARM-NONE_v16.01
+VERSION_IDE=
+E2STUDIO_VERSION=5.3.1.002
+ACTIVE_CONFIGURATION=Debug
Index: EcnlProtoTool/trunk/mruby-1.2.0/.project
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/.project	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/.project	(revision 279)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>mruby-1.2.0</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+			<triggers>clean,full,incremental,</triggers>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+			<triggers>full,incremental,</triggers>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.core.ccnature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+	</natures>
+</projectDescription>
Index: EcnlProtoTool/trunk/mruby-1.2.0/Makefile
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/Makefile	(revision 274)
+++ EcnlProtoTool/trunk/mruby-1.2.0/Makefile	(revision 279)
@@ -3,5 +3,5 @@
 # codebase.
 
-RAKE = ruby ./minirake
+RAKE = ruby -Eutf-8 ./minirake
 
 all :
Index: EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_ao_render.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_ao_render.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_ao_render.rb	(revision 279)
@@ -0,0 +1,314 @@
+# AO render benchmark
+# Original program (C) Syoyo Fujita in Javascript (and other languages)
+#      https://code.google.com/p/aobench/
+# Ruby(yarv2llvm) version by Hideki Miura
+# mruby version by Hideki Miura
+#
+
+IMAGE_WIDTH = 64
+IMAGE_HEIGHT = 64
+NSUBSAMPLES = 2
+NAO_SAMPLES = 8
+
+module Rand
+  # Use xorshift
+  @@x = 123456789
+  @@y = 362436069
+  @@z = 521288629
+  @@w = 88675123
+  BNUM = 1 << 29
+  BNUMF = BNUM.to_f
+  def self.rand
+    x = @@x
+    t = x ^ ((x & 0xfffff) << 11)
+    w = @@w
+    @@x, @@y, @@z = @@y, @@z, w
+    w = @@w = (w ^ (w >> 19) ^ (t ^ (t >> 8)))
+    (w % BNUM) / BNUMF
+  end
+end
+
+class Vec
+  def initialize(x, y, z)
+    @x = x
+    @y = y
+    @z = z
+  end
+
+  def x=(v); @x = v; end
+  def y=(v); @y = v; end
+  def z=(v); @z = v; end
+  def x; @x; end
+  def y; @y; end
+  def z; @z; end
+
+  def vadd(b)
+    Vec.new(@x + b.x, @y + b.y, @z + b.z)
+  end
+
+  def vsub(b)
+    Vec.new(@x - b.x, @y - b.y, @z - b.z)
+  end
+
+  def vcross(b)
+    Vec.new(@y * b.z - @z * b.y,
+            @z * b.x - @x * b.z,
+            @x * b.y - @y * b.x)
+  end
+
+  def vdot(b)
+    r = @x * b.x + @y * b.y + @z * b.z
+    r
+  end
+
+  def vlength
+    Math.sqrt(@x * @x + @y * @y + @z * @z)
+  end
+
+  def vnormalize
+    len = vlength
+    v = Vec.new(@x, @y, @z)
+    if len > 1.0e-17 then
+      v.x = v.x / len
+      v.y = v.y / len
+      v.z = v.z / len
+    end
+    v
+  end
+end
+
+
+class Sphere
+  def initialize(center, radius)
+    @center = center
+    @radius = radius
+  end
+
+  def center; @center; end
+  def radius; @radius; end
+
+  def intersect(ray, isect)
+    rs = ray.org.vsub(@center)
+    b = rs.vdot(ray.dir)
+    c = rs.vdot(rs) - (@radius * @radius)
+    d = b * b - c
+    if d > 0.0 then
+      t = - b - Math.sqrt(d)
+
+      if t > 0.0 and t < isect.t then
+        isect.t = t
+        isect.hit = true
+        isect.pl = Vec.new(ray.org.x + ray.dir.x * t,
+                          ray.org.y + ray.dir.y * t,
+                          ray.org.z + ray.dir.z * t)
+        n = isect.pl.vsub(@center)
+        isect.n = n.vnormalize
+      end
+    end
+  end
+end
+
+class Plane
+  def initialize(p, n)
+    @p = p
+    @n = n
+  end
+
+  def intersect(ray, isect)
+    d = -@p.vdot(@n)
+    v = ray.dir.vdot(@n)
+    v0 = v
+    if v < 0.0 then
+      v0 = -v
+    end
+    if v0 < 1.0e-17 then
+      return
+    end
+
+    t = -(ray.org.vdot(@n) + d) / v
+
+    if t > 0.0 and t < isect.t then
+      isect.hit = true
+      isect.t = t
+      isect.n = @n
+      isect.pl = Vec.new(ray.org.x + t * ray.dir.x,
+                        ray.org.y + t * ray.dir.y,
+                        ray.org.z + t * ray.dir.z)
+    end
+  end
+end
+
+class Ray
+  def initialize(org, dir)
+    @org = org
+    @dir = dir
+  end
+
+  def org; @org; end
+  def org=(v); @org = v; end
+  def dir; @dir; end
+  def dir=(v); @dir = v; end
+end
+
+class Isect
+  def initialize
+    @t = 10000000.0
+    @hit = false
+    @pl = Vec.new(0.0, 0.0, 0.0)
+    @n = Vec.new(0.0, 0.0, 0.0)
+  end
+
+  def t; @t; end
+  def t=(v); @t = v; end
+  def hit; @hit; end
+  def hit=(v); @hit = v; end
+  def pl; @pl; end
+  def pl=(v); @pl = v; end
+  def n; @n; end
+  def n=(v); @n = v; end
+end
+
+def clamp(f)
+  i = f * 255.5
+  if i > 255.0 then
+    i = 255.0
+  end
+  if i < 0.0 then
+    i = 0.0
+  end
+  i.to_i
+end
+
+def otherBasis(basis, n)
+  basis[2] = Vec.new(n.x, n.y, n.z)
+  basis[1] = Vec.new(0.0, 0.0, 0.0)
+
+  if n.x < 0.6 and n.x > -0.6 then
+    basis[1].x = 1.0
+  elsif n.y < 0.6 and n.y > -0.6 then
+    basis[1].y = 1.0
+  elsif n.z < 0.6 and n.z > -0.6 then
+    basis[1].z = 1.0
+  else
+    basis[1].x = 1.0
+  end
+
+  basis[0] = basis[1].vcross(basis[2])
+  basis[0] = basis[0].vnormalize
+
+  basis[1] = basis[2].vcross(basis[0])
+  basis[1] = basis[1].vnormalize
+end
+
+class Scene
+  def initialize
+    @spheres = Array.new
+    @spheres[0] = Sphere.new(Vec.new(-2.0, 0.0, -3.5), 0.5)
+    @spheres[1] = Sphere.new(Vec.new(-0.5, 0.0, -3.0), 0.5)
+    @spheres[2] = Sphere.new(Vec.new(1.0, 0.0, -2.2), 0.5)
+    @plane = Plane.new(Vec.new(0.0, -0.5, 0.0), Vec.new(0.0, 1.0, 0.0))
+  end
+
+  def ambient_occlusion(isect)
+    basis = Array.new(3)
+    otherBasis(basis, isect.n)
+
+    ntheta    = NAO_SAMPLES
+    nphi      = NAO_SAMPLES
+    eps       = 0.0001
+    occlusion = 0.0
+
+    p0 = Vec.new(isect.pl.x + eps * isect.n.x,
+                isect.pl.y + eps * isect.n.y,
+                isect.pl.z + eps * isect.n.z)
+    nphi.times do |j|
+      ntheta.times do |i|
+        r = Rand::rand
+        phi = 2.0 * 3.14159265 * Rand::rand
+        x = Math.cos(phi) * Math.sqrt(1.0 - r)
+        y = Math.sin(phi) * Math.sqrt(1.0 - r)
+        z = Math.sqrt(r)
+
+        rx = x * basis[0].x + y * basis[1].x + z * basis[2].x
+        ry = x * basis[0].y + y * basis[1].y + z * basis[2].y
+        rz = x * basis[0].z + y * basis[1].z + z * basis[2].z
+
+        raydir = Vec.new(rx, ry, rz)
+        ray = Ray.new(p0, raydir)
+
+        occisect = Isect.new
+        @spheres[0].intersect(ray, occisect)
+        @spheres[1].intersect(ray, occisect)
+        @spheres[2].intersect(ray, occisect)
+        @plane.intersect(ray, occisect)
+        if occisect.hit then
+          occlusion = occlusion + 1.0
+        else
+          0.0
+        end
+      end
+    end
+
+    occlusion = (ntheta.to_f * nphi.to_f - occlusion) / (ntheta.to_f * nphi.to_f)
+    Vec.new(occlusion, occlusion, occlusion)
+  end
+
+  def render(w, h, nsubsamples)
+    cnt = 0
+    nsf = nsubsamples.to_f
+    h.times do |y|
+      w.times do |x|
+        rad = Vec.new(0.0, 0.0, 0.0)
+
+        # Subsmpling
+        nsubsamples.times do |v|
+          nsubsamples.times do |u|
+            cnt = cnt + 1
+            wf = w.to_f
+            hf = h.to_f
+            xf = x.to_f
+            yf = y.to_f
+            uf = u.to_f
+            vf = v.to_f
+
+            px = (xf + (uf / nsf) - (wf / 2.0)) / (wf / 2.0)
+            py = -(yf + (vf / nsf) - (hf / 2.0)) / (hf / 2.0)
+
+            eye = Vec.new(px, py, -1.0).vnormalize
+
+            ray = Ray.new(Vec.new(0.0, 0.0, 0.0), eye)
+
+            isect = Isect.new
+            @spheres[0].intersect(ray, isect)
+            @spheres[1].intersect(ray, isect)
+            @spheres[2].intersect(ray, isect)
+            @plane.intersect(ray, isect)
+            if isect.hit then
+              col = ambient_occlusion(isect)
+              rad.x = rad.x + col.x
+              rad.y = rad.y + col.y
+              rad.z = rad.z + col.z
+            else
+              0.0
+            end
+          end
+        end
+
+        r = rad.x / (nsf * nsf)
+        g = rad.y / (nsf * nsf)
+        b = rad.z / (nsf * nsf)
+        printf("%c", clamp(r))
+        printf("%c", clamp(g))
+        printf("%c", clamp(b))
+      end
+    end
+  end
+end
+
+# File.open("ao.ppm", "w") do |fp|
+  printf("P6\n")
+  printf("%d %d\n", IMAGE_WIDTH, IMAGE_HEIGHT)
+  printf("255\n", IMAGE_WIDTH, IMAGE_HEIGHT)
+  Scene.new.render(IMAGE_WIDTH, IMAGE_HEIGHT, NSUBSAMPLES)
+#  Scene.new.render(256, 256, 2)
+# end
Index: EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_app_lc_fizzbuzz.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_app_lc_fizzbuzz.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_app_lc_fizzbuzz.rb	(revision 279)
@@ -0,0 +1,52 @@
+#
+# FizzBuzz program using only lambda calculus
+#
+# This program is quoted from
+#   "Understanding Computation" by Tom Stuart
+#   http://computationbook.com/
+#
+# You can understand why this program works fine by reading this book.
+#
+
+solution = -> k { -> f { -> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> l { -> x { -> g { -> b { b }[-> p { p[-> x { -> y { x } }] }[l]][x][-> y { g[f[-> l { -> p { p[-> x { -> y { y } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][x][g]][-> l { -> p { p[-> x { -> y { x } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][y] }] } } } }][k][-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> l { -> x { -> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[l][f[x]] } }] } }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[m][n]][-> x { -> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[f[-> n { -> p { -> x { p[n[p][x]] } } }[m]][n]][m][x] }][-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]] } } }][-> p { -> x { p[x] } }][-> p { -> x { p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] } }]][-> n { -> b { b }[-> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> p { -> x { p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[x]]]]]]]]]]]]]]] } }]]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]][-> b { b }[-> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> p { -> x { p[p[p[x]]] } }]]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]][-> b { b }[-> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> n { -> l { -> x { -> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> l { -> x { -> g { -> b { b }[-> p { p[-> x { -> y { x } }] }[l]][x][-> y { g[f[-> l { -> p { p[-> x { -> y { y } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][x][g]][-> l { -> p { p[-> x { -> y { x } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][y] }] } } } }][l][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][x]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }] } }[-> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]][-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> x { f[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { -> n { -> p { -> x { p[n[p][x]] } } }[f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n]][x] }][-> p { -> x { x } }] } } }][n][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][x] }]][-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]] } }][n]]]] }]
+
+FIRST     = -> l { LEFT[RIGHT[l]] }
+IF        = -> b { b }
+LEFT      = -> p { p[-> x { -> y { x } } ] }
+RIGHT     = -> p { p[-> x { -> y { y } } ] }
+IS_EMPTY  = LEFT
+REST      = -> l { RIGHT[RIGHT[l]] }
+
+def to_integer(proc)
+  proc[-> n { n + 1 }][0]
+end
+
+def to_boolean(proc)
+  IF[proc][true][false]
+end
+
+def to_array(proc)
+  array = []
+
+  until to_boolean(IS_EMPTY[proc])
+    array.push(FIRST[proc])
+    proc = REST[proc]
+  end
+
+  array
+end
+
+def to_char(c)
+  '0123456789BFiuz'.slice(to_integer(c))
+end
+
+def to_string(s)
+  to_array(s).map { |c| to_char(c) }.join
+end
+
+answer = to_array(solution).map do |p|
+  to_string(p)
+end
+
+answer_str = answer.to_a
+# puts answer_str
Index: EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_fib.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_fib.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_fib.rb	(revision 279)
@@ -0,0 +1,7 @@
+
+def fib n
+  return n if n < 2
+  fib(n-2) + fib(n-1)
+end
+
+puts fib(37)
Index: EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_so_lists.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_so_lists.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/benchmark/bm_so_lists.rb	(revision 279)
@@ -0,0 +1,47 @@
+#from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby
+
+NUM = 300
+SIZE = 10000
+
+def test_lists()
+  # create a list of integers (Li1) from 1 to SIZE
+  li1 = (1..SIZE).to_a
+  # copy the list to li2 (not by individual items)
+  li2 = li1.dup
+  # remove each individual item from left side of li2 and
+  # append to right side of li3 (preserving order)
+  li3 = Array.new
+  while (not li2.empty?)
+    li3.push(li2.shift)
+  end
+  # li2 must now be empty
+  # remove each individual item from right side of li3 and
+  # append to right side of li2 (reversing list)
+  while (not li3.empty?)
+    li2.push(li3.pop)
+  end
+  # li3 must now be empty
+  # reverse li1 in place
+  li1.reverse!
+  # check that first item is now SIZE
+  if li1[0] != SIZE then
+    p "not SIZE"
+    0
+  else
+    # compare li1 and li2 for equality
+    if li1 != li2 then
+      return(0)
+    else
+      # return the length of the list
+      li1.length
+    end
+  end
+end
+
+i = 0
+while i<NUM
+  i += 1
+  result = test_lists()
+end
+
+result
Index: EcnlProtoTool/trunk/mruby-1.2.0/benchmark/build_config_boxing.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/benchmark/build_config_boxing.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/benchmark/build_config_boxing.rb	(revision 279)
@@ -0,0 +1,28 @@
+MRuby::Build.new do |conf|
+  toolchain :gcc
+end
+
+MRuby::Build.new('no_boxing') do |conf|
+  toolchain :gcc
+
+  conf.gembox 'default'
+end
+
+MRuby::Build.new('word_boxing') do |conf|
+  toolchain :gcc
+
+  conf.gembox 'default'
+  conf.compilers.each do |c|
+    c.defines += %w(MRB_WORD_BOXING)
+  end
+end
+
+MRuby::Build.new('nan_boxing') do |conf|
+  toolchain :gcc
+
+  conf.gembox 'default'
+  conf.compilers.each do |c|
+    c.defines += %w(MRB_NAN_BOXING)
+  end
+end
+
Index: EcnlProtoTool/trunk/mruby-1.2.0/benchmark/build_config_cc.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/benchmark/build_config_cc.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/benchmark/build_config_cc.rb	(revision 279)
@@ -0,0 +1,13 @@
+MRuby::Build.new do |conf|
+  toolchain :gcc
+end
+
+MRuby::Build.new('gcc') do |conf|
+  toolchain :gcc
+  conf.gembox 'default'
+end
+
+MRuby::Build.new('clang') do |conf|
+  toolchain :clang
+  conf.gembox 'default'
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/benchmark/plot.gpl
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/benchmark/plot.gpl	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/benchmark/plot.gpl	(revision 279)
@@ -0,0 +1,5 @@
+set yrange [0:]
+set terminal pngcairo font 'Sans, 8' lw 1 size 1400,1024
+set xtics rotate by -45
+set style histogram errorbars gap 2 lw 1
+set style fill solid border -1
Index: EcnlProtoTool/trunk/mruby-1.2.0/build_config.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/build_config.rb	(revision 274)
+++ EcnlProtoTool/trunk/mruby-1.2.0/build_config.rb	(revision 279)
@@ -152,19 +152,23 @@
   conf.cc.defines << %w(MRB_GC_STRESS)
   #conf.cc.defines << %w(DISABLE_STDIO)
+  conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK)
 
   conf.build_mrbtest_lib_only
 
+  conf.gem "#{root}/mrbgems/mruby-compiler"
   conf.gem "#{root}/mrbgems/mruby-numeric-ext"
   conf.gem "#{root}/mrbgems/mruby-string-ext"
+  conf.gem '../mrbgems/mruby-onig-regexp'  do |g|
+    g.cc.include_paths  << "../onigmo-5.15.0/src"
+  end
   conf.gem "#{root}/../mrbgems/mruby-blockly"
-  conf.gem "#{root}/../mrbgems/gr_peach" do |g|
-    g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/api"
-    g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/hal"
-    g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/targets/cmsis"
-    g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H"
-    g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H/inc"
-    g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H/inc/iodefines"
-    g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H"
-    g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/TARGET_MBED_MBRZA1H"
+  conf.gem "#{root}/../mrbgems/mruby-io"
+  conf.gem "#{root}/../mrbgems/mruby-dir" do |g|
+    g.cc.defines = %w(__NEWLIB__=2)
+    g.cc.include_paths << "#{g.dir}/../../musl-1.1.12/include"
+  end
+  conf.gem "#{root}/../mrbgems/mruby-pack"
+  conf.gem "#{root}/../mrbgems/mruby-socket" do |g|
+    g.cc.include_paths << "#{g.dir}/../../musl-1.1.12/include"
   end
   conf.gem "#{root}/../mrbgems/mruby-arduino" do |g|
@@ -177,5 +181,6 @@
     g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H"
     g.cc.include_paths << "#{g.dir}/../../asp3_dcre/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/TARGET_MBED_MBRZA1H"
-    g.cc.include_paths << "#{g.dir}/../../mrbgems/gr_peach/src"
+    g.cc.include_paths << "#{g.dir}/../../sample/gr_peach"
+    g.cc.include_paths << "#{g.dir}/../../prototool/src"
   end
   conf.gem "#{root}/../mrbgems/mruby-ecnl"
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/README.md
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/README.md	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/README.md	(revision 279)
@@ -0,0 +1,4 @@
+C and Ruby Extension Example
+=========
+
+This is an example gem which implements a C and Ruby extension.
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake	(revision 279)
@@ -0,0 +1,23 @@
+MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec|
+  spec.license = 'MIT'
+  spec.author  = 'mruby developers'
+
+  # Add compile flags
+  # spec.cc.flags << ''
+
+  # Add cflags to all
+  # spec.mruby.cc.flags << '-g'
+
+  # Add libraries
+  # spec.linker.libraries << 'external_lib'
+
+  # Default build files
+  # spec.rbfiles = Dir.glob("#{dir}/mrblib/*.rb")
+  # spec.objs = Dir.glob("#{dir}/src/*.{c,cpp,m,asm,S}").map { |f| objfile(f.relative_path_from(dir).pathmap("#{build_dir}/%X")) }
+  # spec.test_rbfiles = Dir.glob("#{dir}/test/*.rb")
+  # spec.test_objs = Dir.glob("#{dir}/test/*.{c,cpp,m,asm,S}").map { |f| objfile(f.relative_path_from(dir).pathmap("#{build_dir}/%X")) }
+  # spec.test_preload = 'test/assert.rb'
+
+  # Values accessible as TEST_ARGS inside test scripts
+  # spec.test_args = {'tmp_dir' => Dir::tmpdir}
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb	(revision 279)
@@ -0,0 +1,5 @@
+module CRubyExtension
+  def CRubyExtension.ruby_method
+    puts "A Ruby Extension"
+  end
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/src/example.c
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/src/example.c	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/src/example.c	(revision 279)
@@ -0,0 +1,20 @@
+#include <mruby.h>
+#include <stdio.h>
+
+static mrb_value
+mrb_c_method(mrb_state *mrb, mrb_value self)
+{
+  puts("A C Extension");
+  return self;
+}
+
+void
+mrb_c_and_ruby_extension_example_gem_init(mrb_state* mrb) {
+  struct RClass *class_cextension = mrb_define_module(mrb, "CRubyExtension");
+  mrb_define_class_method(mrb, class_cextension, "c_method", mrb_c_method, MRB_ARGS_NONE());
+}
+
+void
+mrb_c_and_ruby_extension_example_gem_final(mrb_state* mrb) {
+  /* finalizer */
+}
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/test/example.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/test/example.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_and_ruby_extension_example/test/example.rb	(revision 279)
@@ -0,0 +1,7 @@
+assert('C and Ruby Extension Example 1') do
+  CRubyExtension.respond_to? :c_method
+end
+
+assert('C and Ruby Extension Example 2') do
+  CRubyExtension.respond_to? :ruby_method
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/README.md
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/README.md	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/README.md	(revision 279)
@@ -0,0 +1,4 @@
+C Extension Example
+=========
+
+This is an example gem which implements a C extension.
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/mrbgem.rake
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/mrbgem.rake	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/mrbgem.rake	(revision 279)
@@ -0,0 +1,23 @@
+MRuby::Gem::Specification.new('c_extension_example') do |spec|
+  spec.license = 'MIT'
+  spec.author  = 'mruby developers'
+
+  # Add compile flags
+  # spec.cc.flags << '-g'
+
+  # Add cflags to all
+  # spec.mruby.cc.flags << '-g'
+
+  # Add libraries
+  # spec.linker.libraries << 'external_lib'
+
+  # Default build files
+  # spec.rbfiles = Dir.glob("#{dir}/mrblib/*.rb")
+  # spec.objs = Dir.glob("#{dir}/src/*.{c,cpp,m,asm,S}").map { |f| objfile(f.relative_path_from(dir).pathmap("#{build_dir}/%X")) }
+  # spec.test_rbfiles = Dir.glob("#{dir}/test/*.rb")
+  # spec.test_objs = Dir.glob("#{dir}/test/*.{c,cpp,m,asm,S}").map { |f| objfile(f.relative_path_from(dir).pathmap("#{build_dir}/%X")) }
+  # spec.test_preload = 'test/assert.rb'
+
+  # Values accessible as TEST_ARGS inside test scripts
+  # spec.test_args = {'tmp_dir' => Dir::tmpdir}
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/src/example.c
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/src/example.c	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/src/example.c	(revision 279)
@@ -0,0 +1,20 @@
+#include <mruby.h>
+#include <stdio.h>
+
+static mrb_value
+mrb_c_method(mrb_state *mrb, mrb_value self)
+{
+  puts("A C Extension");
+  return self;
+}
+
+void
+mrb_c_extension_example_gem_init(mrb_state* mrb) {
+  struct RClass *class_cextension = mrb_define_module(mrb, "CExtension");
+  mrb_define_class_method(mrb, class_cextension, "c_method", mrb_c_method, MRB_ARGS_NONE());
+}
+
+void
+mrb_c_extension_example_gem_final(mrb_state* mrb) {
+  /* finalizer */
+}
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/test/example.c
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/test/example.c	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/test/example.c	(revision 279)
@@ -0,0 +1,7 @@
+#include <mruby.h>
+
+void
+mrb_c_extension_example_gem_test(mrb_state *mrb)
+{
+  /* test initializer in C */
+}
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/test/example.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/test/example.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/c_extension_example/test/example.rb	(revision 279)
@@ -0,0 +1,3 @@
+assert('C Extension Example') do
+  CExtension.respond_to? :c_method
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/README.md
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/README.md	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/README.md	(revision 279)
@@ -0,0 +1,4 @@
+Pure Ruby Extension Example
+=========
+
+This is an example gem which implements a pure Ruby extension.
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/mrbgem.rake
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/mrbgem.rake	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/mrbgem.rake	(revision 279)
@@ -0,0 +1,23 @@
+MRuby::Gem::Specification.new('ruby_extension_example') do |spec|
+  spec.license = 'MIT'
+  spec.author  = 'mruby developers'
+
+  # Add compile flags
+  # spec.cc.flags << ''
+
+  # Add cflags to all
+  # spec.mruby.cc.flags << '-g'
+
+  # Add libraries
+  # spec.linker.libraries << 'external_lib'
+
+  # Default build files
+  # spec.rbfiles = Dir.glob("#{dir}/mrblib/*.rb")
+  # spec.objs = Dir.glob("#{dir}/src/*.{c,cpp,m,asm,S}").map { |f| objfile(f.relative_path_from(dir).pathmap("#{build_dir}/%X")) }
+  # spec.test_rbfiles = Dir.glob("#{dir}/test/*.rb")
+  # spec.test_objs = Dir.glob("#{dir}/test/*.{c,cpp,m,asm,S}").map { |f| objfile(f.relative_path_from(dir).pathmap("#{build_dir}/%X")) }
+  # spec.test_preload = 'test/assert.rb'
+
+  # Values accessible as TEST_ARGS inside test scripts
+  # spec.test_args = {'tmp_dir' => Dir::tmpdir}
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/mrblib/example.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/mrblib/example.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/mrblib/example.rb	(revision 279)
@@ -0,0 +1,5 @@
+class RubyExtension
+  def RubyExtension.ruby_method
+    puts "A Ruby Extension"
+  end
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/test/example.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/test/example.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/mrbgems/ruby_extension_example/test/example.rb	(revision 279)
@@ -0,0 +1,3 @@
+assert('Ruby Extension Example') do
+  RubyExtension.respond_to? :ruby_method
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/targets/build_config_ArduinoDue.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/targets/build_config_ArduinoDue.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/targets/build_config_ArduinoDue.rb	(revision 279)
@@ -0,0 +1,91 @@
+MRuby::Build.new do |conf|
+
+  # Gets set by the VS command prompts.
+  if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
+    toolchain :visualcpp
+  else
+    toolchain :gcc
+  end
+
+  enable_debug
+
+  # include the default GEMs
+  conf.gembox 'default'
+
+end
+
+# Cross Compiling configuration for Arduino Due
+# http://arduino.cc/en/Main/ArduinoBoardDue
+#
+# Requires Arduino IDE >= 1.5
+MRuby::CrossBuild.new("ArduinoDue") do |conf|
+  toolchain :gcc
+
+  # Mac OS X, Arduino IDE <= 1.5.6
+  # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Resources/Java'
+  # Mac OS X, Arduino IDE >= 1.5.7
+  # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Java'
+  # GNU Linux
+  ARDUINO_PATH = '/opt/arduino'
+   # Arduino IDE <= 1.5.6
+  BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/g++_arm_none_eabi/bin"
+  # Arduino IDE >= 1.5.7
+  # BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin"
+  SAM_PATH = "#{ARDUINO_PATH}/hardware/arduino/sam"
+  TARGET_PATH = "#{SAM_PATH}/variants/arduino_due_x"
+
+  conf.cc do |cc|
+    cc.command = "#{BIN_PATH}/arm-none-eabi-gcc"
+    cc.include_paths << ["#{SAM_PATH}/system/libsam", "#{SAM_PATH}/system/CMSIS/CMSIS/Include/",
+                        "#{SAM_PATH}/system/CMSIS/Device/ATMEL/",
+                        "#{SAM_PATH}/cores/arduino", "#{SAM_PATH}/libraries","#{TARGET_PATH}"]
+    cc.flags = %w(-g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500
+                -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=156 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM
+                -D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due")
+    cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
+
+    #configuration for low memory environment
+    cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
+    cc.defines << %w(MRB_USE_IV_SEGLIST)
+    cc.defines << %w(KHASH_DEFAULT_SIZE=8)
+    cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
+    cc.defines << %w(MRB_GC_STRESS)
+    #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio.
+    #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
+  end
+
+  conf.cxx do |cxx|
+    cxx.command = conf.cc.command.dup
+    cxx.include_paths = conf.cc.include_paths.dup
+    cxx.flags = conf.cc.flags.dup
+    cxx.flags << %w(-fno-rtti -fno-exceptions)
+    cxx.defines = conf.cc.defines.dup
+    cxx.compile_options = conf.cc.compile_options.dup
+  end
+
+  conf.archiver do |archiver|
+    archiver.command = "#{BIN_PATH}/arm-none-eabi-ar"
+    archiver.archive_options = 'rcs %{outfile} %{objs}'
+  end
+
+  #no executables
+  conf.bins = []
+
+  #do not build executable test
+  conf.build_mrbtest_lib_only
+
+  #disable C++ exception
+  conf.disable_cxx_exception
+
+  #gems from core
+  conf.gem :core => "mruby-print"
+  conf.gem :core => "mruby-math"
+  conf.gem :core => "mruby-enum-ext"
+
+  #light-weight regular expression
+  conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
+
+  #Arduino API
+  #conf.gem :github =>"kyab/mruby-arduino", :branch => "master"
+
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/targets/build_config_IntelGalileo.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/targets/build_config_IntelGalileo.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/targets/build_config_IntelGalileo.rb	(revision 279)
@@ -0,0 +1,106 @@
+MRuby::Build.new do |conf|
+
+  # Gets set by the VS command prompts.
+  if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
+    toolchain :visualcpp
+  else
+    toolchain :gcc
+  end
+
+  enable_debug
+
+  # include the default GEMs
+  conf.gembox 'default'
+
+end
+
+
+# Cross Compiling configuration for Intel Galileo on Arduino environment
+# http://arduino.cc/en/ArduinoCertified/IntelGalileo
+#
+# Requires Arduino IDE for Intel Galileo
+MRuby::CrossBuild.new("Galileo") do |conf|
+  toolchain :gcc
+
+  # Mac OS X
+  # Assume you renamed Arduino.app to Arduino_Galileo.app
+  GALILEO_ARDUINO_PATH = '/Applications/Arduino_Galileo.app/Contents/Resources/Java'
+  # GNU Linux
+  #ARDUINO_GALILEO_PATH = '/opt/arduino'
+
+  GALILEO_BIN_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i386-pokysdk-darwin/usr/bin/i586-poky-linux-uclibc"
+  GALILEO_SYSROOT =  "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc"
+  GALILEO_X86_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/arduino/x86"
+
+
+  conf.cc do |cc|
+    cc.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-gcc"
+    cc.include_paths << ["#{GALILEO_X86_PATH}/cores/arduino", "#{GALILEO_X86_PATH}/variants/galileo_fab_d"]
+    cc.flags = %w(-m32 -march=i586 -c -g -Os -w
+              -ffunction-sections -fdata-sections -MMD -DARDUINO=153)
+    cc.flags << "--sysroot=#{GALILEO_SYSROOT}"
+    cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
+  end
+
+  conf.cxx do |cxx|
+    cxx.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++"
+    cxx.include_paths = conf.cc.include_paths.dup
+    cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++"
+    cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++/i586-poky-linux-uclibc"
+    cxx.flags = conf.cc.flags.dup
+    cxx.defines = conf.cc.defines.dup
+    cxx.compile_options = conf.cc.compile_options.dup
+  end
+
+  conf.archiver do |archiver|
+    archiver.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-ar"
+    archiver.archive_options = 'rcs %{outfile} %{objs}'
+  end
+
+  conf.linker do |linker|
+    linker.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++"
+    linker.flags = %w(-m32 -march=i586)
+    linker.flags << "--sysroot=#{GALILEO_SYSROOT}"
+    linker.flags << %w(-Os -Wl,--gc-sections)
+    linker.libraries = %w(m pthread)
+  end
+
+  #no executables
+  conf.bins = []
+
+  #do not build executable test
+  conf.build_mrbtest_lib_only
+
+  #official mrbgems
+  conf.gem :core => "mruby-sprintf"
+  conf.gem :core => "mruby-print"
+  conf.gem :core => "mruby-math"
+  conf.gem :core => "mruby-time"
+  conf.gem :core => "mruby-struct"
+  conf.gem :core => "mruby-enum-ext"
+  conf.gem :core => "mruby-string-ext"
+  conf.gem :core => "mruby-numeric-ext"
+  conf.gem :core => "mruby-array-ext"
+  conf.gem :core => "mruby-hash-ext"
+  conf.gem :core => "mruby-range-ext"
+  conf.gem :core => "mruby-proc-ext"
+  conf.gem :core => "mruby-symbol-ext"
+  conf.gem :core => "mruby-random"
+  conf.gem :core => "mruby-object-ext"
+  conf.gem :core => "mruby-objectspace"
+  conf.gem :core => "mruby-fiber"
+  conf.gem :core => "mruby-toplevel-ext"
+
+  #lightweigh regular expression
+  conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
+
+  #Arduino API
+  #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" do |g|
+  #  g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Wire"
+  #  g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Servo"
+
+    #enable unsupported Servo class
+  #  g.cxx.defines << "MRUBY_ARDUINO_GALILEO_ENABLE_SERVO"
+  #end
+
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/examples/targets/build_config_chipKITMax32.rb
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/examples/targets/build_config_chipKITMax32.rb	(revision 279)
+++ EcnlProtoTool/trunk/mruby-1.2.0/examples/targets/build_config_chipKITMax32.rb	(revision 279)
@@ -0,0 +1,87 @@
+MRuby::Build.new do |conf|
+
+  # Gets set by the VS command prompts.
+  if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
+    toolchain :visualcpp
+  else
+    toolchain :gcc
+  end
+
+  enable_debug
+
+  # include the default GEMs
+  conf.gembox 'default'
+
+end
+
+# Cross Compiling configuration for Digilent chipKIT Max32
+# http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-MAX32
+#
+# Requires MPIDE (https://github.com/chipKIT32/chipKIT32-MAX)
+#
+# This configuration is based on @kyab's version
+# http://d.hatena.ne.jp/kyab/20130201
+MRuby::CrossBuild.new("chipKITMax32") do |conf|
+  toolchain :gcc
+
+  # Mac OS X
+  # MPIDE_PATH = '/Applications/Mpide.app/Contents/Resources/Java'
+  # GNU Linux
+  MPIDE_PATH = '/opt/mpide-0023-linux-20120903'
+
+  PIC32_PATH = "#{MPIDE_PATH}/hardware/pic32"
+
+  conf.cc do |cc|
+    cc.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-gcc"
+    cc.include_paths << ["#{PIC32_PATH}/cores/pic32",
+                        "#{PIC32_PATH}/variants/Max32",
+                        "#{PIC32_PATH}/libraries"]
+    cc.flags = %w(-O2 -mno-smart-io -w -ffunction-sections -fdata-sections -g -mdebugger -Wcast-align
+                -fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -D_BOARD_MEGA_
+                -DMPIDEVER=0x01000202 -DMPIDE=23)
+    cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
+
+    #configuration for low memory environment
+    cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
+    cc.defines << %w(MRB_USE_IV_SEGLIST)
+    cc.defines << %w(KHASH_DEFAULT_SIZE=8)
+    cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
+    cc.defines << %w(MRB_GC_STRESS)
+    #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio.
+    #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
+  end
+
+  conf.cxx do |cxx|
+    cxx.command = conf.cc.command.dup
+    cxx.include_paths = conf.cc.include_paths.dup
+    cxx.flags = conf.cc.flags.dup
+    cxx.defines = conf.cc.defines.dup
+    cxx.compile_options = conf.cc.compile_options.dup
+  end
+
+  conf.archiver do |archiver|
+    archiver.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-ar"
+    archiver.archive_options = 'rcs %{outfile} %{objs}'
+  end
+
+  #no executables
+  conf.bins = []
+
+  #do not build test executable
+  conf.build_mrbtest_lib_only
+
+  #disable C++ exception
+  conf.disable_cxx_exception
+
+  #gems from core
+  conf.gem :core => "mruby-print"
+  conf.gem :core => "mruby-math"
+  conf.gem :core => "mruby-enum-ext"
+
+  #light-weight regular expression
+  conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
+
+  #Arduino API
+  #conf.gem :github =>"kyab/mruby-arduino", :branch => "master"
+
+end
Index: EcnlProtoTool/trunk/mruby-1.2.0/include/mruby.h
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/include/mruby.h	(revision 274)
+++ EcnlProtoTool/trunk/mruby-1.2.0/include/mruby.h	(revision 279)
@@ -859,5 +859,5 @@
  *      Pointer to the newly created mrb_state.
  */
-MRB_API mrb_state* mrb_open_allocf(mrb_allocf f, void *ud);
+MRB_API mrb_state* mrb_open_allocf(mrb_allocf f, void *ud, mrb_bool disable_gems);
 
 /**
Index: EcnlProtoTool/trunk/mruby-1.2.0/src/state.c
===================================================================
--- EcnlProtoTool/trunk/mruby-1.2.0/src/state.c	(revision 274)
+++ EcnlProtoTool/trunk/mruby-1.2.0/src/state.c	(revision 279)
@@ -97,5 +97,5 @@
 mrb_open(void)
 {
-  mrb_state *mrb = mrb_open_allocf(mrb_default_allocf, NULL);
+  mrb_state *mrb = mrb_open_allocf(mrb_default_allocf, NULL, FALSE);
 
   return mrb;
@@ -103,5 +103,5 @@
 
 MRB_API mrb_state*
-mrb_open_allocf(mrb_allocf f, void *ud)
+mrb_open_allocf(mrb_allocf f, void *ud, mrb_bool disable_gems)
 {
   mrb_state *mrb = mrb_open_core(f, ud);
@@ -111,8 +111,8 @@
   }
 
-#ifndef DISABLE_GEMS
-  mrb_init_mrbgems(mrb);
-  mrb_gc_arena_restore(mrb, 0);
-#endif
+  if (!disable_gems) {
+    mrb_init_mrbgems(mrb);
+    mrb_gc_arena_restore(mrb, 0);
+  }
   return mrb;
 }
