diff options
| author | Paolo Bosetti <[email protected]> | 2012-05-29 14:32:05 -0700 |
|---|---|---|
| committer | Paolo Bosetti <[email protected]> | 2012-05-29 14:32:05 -0700 |
| commit | d73517877847dab5b345c7fa98091647737bbfe0 (patch) | |
| tree | 6090a2df49b8093606181e5416e6aa6a5040b0ec /mrblib | |
| parent | 391f8dcef02cdafeb4e0acc693945acb166a8d09 (diff) | |
| parent | 1e5d15dbcb977f6d197c24eca4a973ee1c5bf521 (diff) | |
| download | mruby-d73517877847dab5b345c7fa98091647737bbfe0.tar.gz mruby-d73517877847dab5b345c7fa98091647737bbfe0.zip | |
Merge branch 'master' of git://github.com/mruby/mruby into XCode
Diffstat (limited to 'mrblib')
| -rw-r--r-- | mrblib/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | mrblib/Makefile | 17 | ||||
| -rw-r--r-- | mrblib/compar.rb | 52 |
3 files changed, 53 insertions, 20 deletions
diff --git a/mrblib/CMakeLists.txt b/mrblib/CMakeLists.txt index b9fa22587..a0386f0fe 100644 --- a/mrblib/CMakeLists.txt +++ b/mrblib/CMakeLists.txt @@ -45,12 +45,10 @@ else() endif() -add_library(mrblib_object OBJECT mrblib.c) - # generate final static libmruby archive library add_library(libmruby_static STATIC + mrblib.c $<TARGET_OBJECTS:mruby_object> - $<TARGET_OBJECTS:mrblib_object> ) set_target_properties(libmruby_static PROPERTIES OUTPUT_NAME mruby) diff --git a/mrblib/Makefile b/mrblib/Makefile index d22c4509f..c7226ddcd 100644 --- a/mrblib/Makefile +++ b/mrblib/Makefile @@ -15,17 +15,15 @@ MRBS := $(MRB1) LIBR0 := ../lib/libmruby_core.a LIBR := ../lib/libmruby.a -# C compiler (gcc) -CC = gcc -LL = gcc -AR = ar +# libraries, includes +INCLUDES = -I../src -I../include + DEBUG_MODE = 1 ifeq ($(DEBUG_MODE),1) CFLAGS = -g else CFLAGS = -O3 endif -INCLUDES = -I../src -I../include ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) ifeq ($(OS),Windows_NT) MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS="$(ALL_CFLAGS)" @@ -40,6 +38,7 @@ else MRBC = ../bin/mrbc endif + ############################## # generic build targets, rules @@ -48,7 +47,7 @@ all : $(LIBR) # update libmruby.a $(LIBR) : $(MLIB) $(LIBR0) - cp $(LIBR0) $(LIBR) + $(CP) $(LIBR0) $(LIBR) $(AR) r $(LIBR) $(MLIB) # Compile mrblib source @@ -57,17 +56,17 @@ $(MLIB) : $(CLIB) # Compile C source from merged mruby source $(CLIB) : $(RLIB) $(MRBC) - $(MRBC) -Bmrblib_irep -o$(DLIB) $(RLIB); cat init_$(TARGET).c $(DLIB) > $@ + $(MRBC) -Bmrblib_irep -o$(DLIB) $(RLIB); $(CAT) init_$(TARGET).c $(DLIB) > $@ $(MRBC) : ../src/opcode.h ../src/codegen.c ../src/parse.y $(MAKE) -C ../tools/mrbc $(MAKE_FLAGS) # merge mruby sources $(RLIB) : $(MRBS) - cat $? > $@ + $(CAT) $(MRBS) > $@ # clean up .PHONY : clean clean : @echo "make: removing targets, objects and depend files of `pwd`" - -rm -f $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(LIBR) + -$(RM_F) $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(LIBR) diff --git a/mrblib/compar.rb b/mrblib/compar.rb index 3badf57de..9f2ab887d 100644 --- a/mrblib/compar.rb +++ b/mrblib/compar.rb @@ -1,5 +1,15 @@ +## +# Comparable +# +# ISO 15.3.3 module Comparable - # 15.3.3.2.1 + + ## + # Return true if +self+ is less + # than +other+. Otherwise return + # false. + # + # ISO 15.3.3.2.1 def < other cmp = self <=> other if cmp.nil? @@ -11,7 +21,12 @@ module Comparable end end - # 15.3.3.2.2 + ## + # Return true if +self+ is less + # than or equal to +other+. + # Otherwise return false. + # + # ISO 15.3.3.2.2 def <= other cmp = self <=> other if cmp.nil? @@ -23,7 +38,12 @@ module Comparable end end - # 15.3.3.2.3 + ## + # Return true if +self+ is equal + # to +other+. Otherwise return + # false. + # + # ISO 15.3.3.2.3 def == other cmp = self <=> other if cmp == 0 @@ -33,7 +53,12 @@ module Comparable end end - # 15.3.3.2.4 + ## + # Return true if +self+ is greater + # than +other+. Otherwise return + # false. + # + # ISO 15.3.3.2.4 def > other cmp = self <=> other if cmp.nil? @@ -45,9 +70,14 @@ module Comparable end end - # 15.3.3.2.5 + ## + # Return true if +self+ is greater + # than or equal to +other+. + # Otherwise return false. + # + # ISO 15.3.3.2.5 def >= other - cmp = self <=> other + cmp = self <=> other if cmp.nil? false elsif cmp >= 0 @@ -57,8 +87,14 @@ module Comparable end end - # 15.3.3.2.6 - def between?(min,max) + ## + # Return true if +self+ is greater + # than or equal to +min+ and + # less than or equal to +max+. + # Otherwise return false. + # + # ISO 15.3.3.2.6 + def between?(min, max) if self < min or self > max false else |
