Permalink
Browse files

add mruby sources

  • Loading branch information...
1 parent 54ad561 commit e0d6430f63c4cbe0c71ce82ee23284671389a818 mimaki committed Apr 20, 2012
Showing with 87,350 additions and 4 deletions.
  1. +18 −0 .gitignore
  2. +120 −0 Makefile
  3. +0 −4 README.md
  4. +14 −0 Todo.txt
  5. 0 bin/.gitkeep
  6. 0 doc/.gitkeep
  7. 0 ext/.gitkeep
  8. +42 −0 include/mrbconf.h
  9. +623 −0 include/mruby.h
  10. +42 −0 include/mruby/array.h
  11. +71 −0 include/mruby/class.h
  12. +59 −0 include/mruby/hash.h
  13. +17 −0 include/mruby/numeric.h
  14. +46 −0 include/mruby/object.h
  15. +44 −0 include/mruby/proc.h
  16. +21 −0 include/mruby/range.h
  17. +133 −0 include/mruby/string.h
  18. +16 −0 include/mruby/struct.h
  19. 0 lib/.gitkeep
  20. +62 −0 mrblib/Makefile
  21. +79 −0 mrblib/array.rb
  22. +63 −0 mrblib/compar.rb
  23. +266 −0 mrblib/enum.rb
  24. +9 −0 mrblib/error.rb
  25. +58 −0 mrblib/hash.rb
  26. +17 −0 mrblib/init_mrblib.c
  27. +45 −0 mrblib/kernel.rb
  28. +42 −0 mrblib/numeric.rb
  29. +20 −0 mrblib/print.rb
  30. +30 −0 mrblib/range.rb
  31. +93 −0 mrblib/string.rb
  32. +30 −0 mrblib/struct.rb
  33. +89 −0 src/Makefile
  34. +1,458 −0 src/array.c
  35. +96 −0 src/ascii.c
  36. +197 −0 src/cdump.c
  37. +8 −0 src/cdump.h
  38. +1,049 −0 src/class.c
  39. +2,273 −0 src/codegen.c
  40. +144 −0 src/compar.c
  41. +73 −0 src/compile.h
  42. +28 −0 src/crc.c
  43. +697 −0 src/dump.c
  44. +118 −0 src/dump.h
  45. +1,663 −0 src/encoding.c
  46. +360 −0 src/encoding.h
  47. +1,077 −0 src/enum.c
  48. +479 −0 src/error.c
  49. +21 −0 src/error.h
  50. +280 −0 src/etc.c
  51. +217 −0 src/eval_intern.h
  52. 0 src/ext/.gitkeep
  53. +1,146 −0 src/gc.c
  54. +26 −0 src/gc.h
  55. +1,436 −0 src/hash.c
  56. +105 −0 src/init.c
  57. +10 −0 src/init_ext.c
  58. +23 −0 src/irep.h
  59. +1,530 −0 src/kernel.c
  60. +50 −0 src/keywords
  61. +216 −0 src/lex.def
  62. +642 −0 src/load.c
  63. +53 −0 src/mdata.h
  64. +103 −0 src/method.h
  65. +117 −0 src/minimain.c
  66. +17,985 −0 src/name2ctype.h
  67. +125 −0 src/node.h
  68. +2,018 −0 src/numeric.c
  69. +632 −0 src/object.c
  70. +771 −0 src/oniguruma.h
  71. +148 −0 src/opcode.h
  72. +5,435 −0 src/parse.y
  73. +152 −0 src/pool.c
  74. +19 −0 src/pool.h
  75. +69 −0 src/print.c
  76. +92 −0 src/proc.c
  77. +499 −0 src/range.c
  78. +3,306 −0 src/re.c
  79. +85 −0 src/re.h
  80. +6,286 −0 src/regcomp.c
  81. +909 −0 src/regenc.c
  82. +203 −0 src/regenc.h
  83. +375 −0 src/regerror.c
  84. +32 −0 src/regex.h
  85. +3,757 −0 src/regexec.c
  86. +833 −0 src/regint.h
  87. +5,600 −0 src/regparse.c
  88. +354 −0 src/regparse.h
  89. +203 −0 src/ritehash.h
  90. +1,112 −0 src/sprintf.c
  91. +1,283 −0 src/st.c
  92. +139 −0 src/st.h
  93. +88 −0 src/state.c
  94. +5,234 −0 src/string.c
  95. +824 −0 src/struct.c
  96. +255 −0 src/symbol.c
  97. +4,366 −0 src/transcode.c
  98. +109 −0 src/transcode_data.h
  99. +2,607 −0 src/unicode.c
  100. +34 −0 src/us_ascii.c
  101. +460 −0 src/utf_8.c
  102. +453 −0 src/variable.c
  103. +42 −0 src/variable.h
  104. +87 −0 src/version.c
  105. +32 −0 src/version.h
  106. +1,544 −0 src/vm.c
  107. +414 −0 src/vm_core.h
  108. +73 −0 tools/mrbc/Makefile
  109. +210 −0 tools/mrbc/mrbc.c
  110. +89 −0 tools/mruby/Makefile
  111. +143 −0 tools/mruby/mruby.c
View
@@ -0,0 +1,18 @@
+# /
+*.bak
+*.dylib
+*.inc
+*.o
+*.orig
+*.rej
+*.sav
+*.swp
+*.d
+*~
+.DS_Store
+.ccmalloc
+.svn
+/.git
+cscope.out
+mruby.exe
+y.tab.c
View
@@ -0,0 +1,120 @@
+# makefile discription.
+# basic build file for Rite-VM(mruby)
+# 11.Apr.2011 coded by Kenji Yoshimoto.
+# 17.Jan.2012 coded by Hiroshi Mimaki.
+
+# project-specific macros
+# extension of the executable-file is modifiable(.exe .out ...)
+TARGET := bin/mrubysample
+RITEVM := lib/ritevm
+MRUBY := tools/mruby/mruby
+ifeq ($(OS),Windows_NT)
+EXE := $(TARGET).exe
+LIB := $(RITEVM).lib
+MRB := $(MRUBY).exe
+else
+EXE := $(TARGET)
+LIB := $(RITEVM).a
+MRB := $(MRUBY)
+endif
+MSRC := src/minimain.c
+YSRC := src/parse.y
+YC := src/y.tab.c
+EXCEPT1 := $(YC) $(MSRC)
+OBJM := $(patsubst %.c,%.o,$(MSRC))
+OBJY := $(patsubst %.c,%.o,$(YC))
+OBJ1 := $(patsubst %.c,%.o,$(filter-out $(EXCEPT1),$(wildcard src/*.c)))
+#OBJ2 := $(patsubst %.c,%.o,$(wildcard ext/regex/*.c))
+#OBJ3 := $(patsubst %.c,%.o,$(wildcard ext/enc/*.c))
+OBJS := $(OBJ1) $(OBJ2) $(OBJ3)
+# mruby libraries
+EXTC := mrblib/mrblib.c
+EXTRB := $(wildcard mrblib/*.rb)
+EXT0 := $(patsubst %.c,%.o,src/$(EXTC))
+# ext libraries
+EXTS := $(EXT0)
+
+# libraries, includes
+LIBS = $(LIB) -lm
+INCLUDES = -I./src -I./include
+
+# library for iOS
+IOSLIB := $(RITEVM)-ios.a
+IOSSIMLIB := $(RITEVM)-iossim.a
+IOSDEVLIB := $(RITEVM)-iosdev.a
+IOSSIMCC := xcrun -sdk iphoneos llvm-gcc-4.2 -arch i386 -isysroot "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/"
+IOSDEVCC := xcrun -sdk iphoneos llvm-gcc-4.2 -arch armv7 -isysroot "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/"
+
+# compiler, linker (gcc)
+CC = gcc
+LL = gcc
+YACC = bison
+DEBUG_MODE = 1
+ifeq ($(DEBUG_MODE),1)
+CFLAGS = -g
+else
+CFLAGS = -O3
+endif
+ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
+MAKE_FLAGS = --no-print-directory CC="$(CC)" LL="$(LL)"
+
+##############################
+# generic build targets, rules
+
+.PHONY : all
+all : $(LIB) $(MRB) $(EXE)
+ @echo "make: built targets of `pwd`"
+
+##############################
+# make library for iOS
+.PHONY : ios
+ios : $(IOSLIB)
+
+$(IOSLIB) : $(IOSSIMLIB) $(IOSDEVLIB)
+ lipo -arch i386 $(IOSSIMLIB) -arch armv7 $(IOSDEVLIB) -create -output $(IOSLIB)
+
+$(IOSSIMLIB) :
+ $(MAKE) clean -C src $(MAKE_FLAGS)
+ $(MAKE) -C src $(MAKE_FLAGS) CC="$(IOSSIMCC)" LL="$(IOSSIMCC)"
+ cp $(LIB) $(IOSSIMLIB)
+
+$(IOSDEVLIB) :
+ $(MAKE) clean -C src $(MAKE_FLAGS)
+ $(MAKE) -C src $(MAKE_FLAGS) CC="$(IOSDEVCC)" LL="$(IOSDEVCC)"
+ cp $(LIB) $(IOSDEVLIB)
+
+# executable constructed using linker from object files
+$(EXE) : $(OBJM) $(LIB)
+ $(LL) -o $@ $(OBJM) $(LIBS)
+
+-include $(OBJS:.o=.d)
+
+# src compile
+$(LIB) : $(EXTS) $(OBJS) $(OBJY)
+ $(MAKE) -C src $(MAKE_FLAGS)
+
+# mruby interpreter compile
+$(MRB) : $(EXTS) $(OBJS) $(OBJY)
+ $(MAKE) -C tools/mruby $(MAKE_FLAGS)
+
+# objects compiled from source
+$(OBJS) :
+ $(MAKE) -C src $(MAKE_FLAGS) && $(MAKE) -C tools/mruby $(MAKE_FLAGS)
+
+# extend libraries complile
+$(EXTS) : $(EXTRB)
+ $(MAKE) -C mrblib $(MAKE_FLAGS)
+
+# test module compile
+$(OBJM) : $(MSRC)
+ $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $(MSRC) -o $(OBJM)
+
+# clean up
+.PHONY : clean
+clean :
+ $(MAKE) clean -C src $(MAKE_FLAGS)
+ $(MAKE) clean -C tools/mruby $(MAKE_FLAGS)
+ -rm -f $(EXE) $(OBJM)
+ -rm -f $(OBJM:.o=.d)
+ -rm -f $(IOSLIB) $(IOSSIMLIB) $(IOSDEVLIB)
+ @echo "make: removing targets, objects and depend files of `pwd`"
View
@@ -1,4 +0,0 @@
-mruby
-=====
-
-Lightweight Ruby
View
@@ -0,0 +1,14 @@
+やること(まだできてないこと) / not yet complete
+
+* ヒアドキュメント / here document
+* 特殊変数 ($1,$2..) / special variables
+* super in aliased methods
+* BEGIN/END (対応しないんだっけ?)
+* const_missing
+* respond_to_missing
+
+改善すること(できているが直すこと)
+
+* Hash (サイズを減らす。khashを使うか、順序を保存するか)
+* stringEx (encoding削除、CODERANGE削除、UTF-8 or ASCII以外削除)
+* 気づいたら書き加える
View
No changes.
View
No changes.
View
No changes.
View
@@ -0,0 +1,42 @@
+#ifndef MRUBYCONF_H
+#define MRUBYCONF_H
+
+#include <stdint.h>
+typedef double mrb_float;
+typedef int32_t mrb_int;
+typedef intptr_t mrb_sym;
+
+#define readint(p,base) strtol((p),NULL,(base))
+#define readfloat(p) strtod((p),NULL)
+
+#undef INCLUDE_ENCODING /* not use encoding classes (ascii only) */
+#define INCLUDE_ENCODING /* use UTF-8 encoding classes */
+
+#undef INCLUDE_REGEXP /* not use regular expression classes */
+#define INCLUDE_REGEXP /* use regular expression classes */
+
+#ifdef INCLUDE_REGEXP
+# define INCLUDE_ENCODING /* Regexp depends Encoding */
+#endif
+
+#undef HAVE_UNISTD_H /* WINDOWS */
+#define HAVE_UNISTD_H /* LINUX */
+
+#define SIZEOF_INT 4
+#define SIZEOF_SHORT 2
+#define SIZEOF_LONG 4
+#define SIZEOF_LONG_LONG 8
+#define SIZEOF___INT64 0
+#define SIZEOF_VOIDP 4
+#define SIZEOF_FLOAT 4
+#define SIZEOF_DOUBLE 8
+
+#ifndef FALSE
+# define FALSE 0
+#endif
+
+#ifndef TRUE
+# define TRUE 1
+#endif
+
+#endif /* MRUBYCONF_H */
Oops, something went wrong.

0 comments on commit e0d6430

Please sign in to comment.