Skip to content

Commit

Permalink
matz
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Aug 9, 2000
1 parent a3edeb5 commit c1bbe10
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 43 deletions.
17 changes: 8 additions & 9 deletions cygwin/GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,23 @@ else
endif
WPROGRAM = $(RUBYW_INSTALL_NAME)$(EXEEXT)
RUBYDEF = $(RUBY_INSTALL_NAME).def
RUBY_SO_NAME = $(LIBRUBY_SO:.dll=)
SOLIBS := $(RUBY_SO_NAME).res.o $(SOLIBS)
EXTOBJS += $(@:$(EXEEXT)=.res.o)
SOLIBS := $(LIBRUBY_SO).res.@OBJEXT@ $(SOLIBS)
EXTOBJS += $(@:$(EXEEXT)=.res.@OBJEXT@)

$(LIBRUBY_SO): $(RUBYDEF) $(RUBY_SO_NAME).res.o
$(LIBRUBY_SO): $(RUBYDEF) $(LIBRUBY_SO).res.@OBJEXT@
$(LIBRUBY): $(LIBRUBY_SO)

%.res.o: %.rc
%.res.@OBJEXT@: %.rc
@WINDRES@ --include-dir . --include-dir $(<D) --include-dir $(srcdir)/win32 $< $@

$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb
$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(LIBRUBY_SO).rc: rbconfig.rb
@@MINIRUBY@ $(srcdir)/win32/resource.rb \
-ruby_name=$(RUBY_INSTALL_NAME) -rubyw_name=$(RUBYW_INSTALL_NAME) \
-so_name=$(RUBY_SO_NAME) \
-so_name=$(LIBRUBY_SO) \
. $(icondirs) $(srcdir)/win32

$(PROGRAM): $(RUBY_INSTALL_NAME).res.o
$(WPROGRAM): $(RUBYW_INSTALL_NAME).res.o
$(PROGRAM): $(RUBY_INSTALL_NAME).res.@OBJEXT@
$(WPROGRAM): $(RUBYW_INSTALL_NAME).res.@OBJEXT@
@rm -f $@
$(PURIFY) $(CC) -mwindows -e _mainCRTStartup $(LDFLAGS) $(XLDFLAGS) \
$(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
Expand Down
19 changes: 12 additions & 7 deletions ext/extmk.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ if RUBY_PLATFORM == "m68k-human"
else
CFLAGS = "@CFLAGS@"
end
LINK = "@CC@ -o conftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir @LDFLAGS@ %s %s conftest.c %s %s @LIBS@"
CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir %s %s conftest.c"
LINK = "@CC@ -o conftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir @LDFLAGS@ %s %s %s conftest.c %s %s @LIBS@"
CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir %s %s %s conftest.c"

if FileTest.readable? 'nul'
$null = open('nul', 'w')
Expand Down Expand Up @@ -91,7 +91,7 @@ def try_link0(src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
xsystem(format(LINK, $CFLAGS, $CPPFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
end

def try_link(src, opt="")
Expand All @@ -107,7 +107,7 @@ def try_cpp(src, opt="")
cfile.print src
cfile.close
begin
xsystem(format(CPP, $CFLAGS, opt))
xsystem(format(CPP, $CFLAGS, $CPPFLAGS, opt))
ensure
rm_f "conftest*"
end
Expand All @@ -118,7 +118,7 @@ def egrep_cpp(pat, src, opt="")
cfile.print src
cfile.close
begin
xsystem(format(CPP+"|egrep #{pat}", $CFLAGS, opt))
xsystem(format(CPP+"|egrep #{pat}", $CFLAGS, $CPPFLAGS, opt))
ensure
rm_f "conftest*"
end
Expand Down Expand Up @@ -326,7 +326,7 @@ def dir_config(target)
ldir = " -L"+dir if dir
end

$CFLAGS += idir if idir
$CPPFLAGS += idir if idir
$LDFLAGS += ldir if ldir
end

Expand Down Expand Up @@ -375,7 +375,7 @@ DESTDIR =
CC = @CC@
CFLAGS = %s #{CFLAGS} #$CFLAGS
CPPFLAGS = -I$(topdir) -I$(hdrdir) -I@includedir@ %s
CPPFLAGS = -I$(topdir) -I$(hdrdir) -I@includedir@ %s #$CPPFLAGS
DLDFLAGS = #$DLDFLAGS #$LDFLAGS
LDSHARED = @LDSHARED@ #{defflag}
", if $static then "" else "@CCDLFLAGS@" end, $defs.join(" ")
Expand Down Expand Up @@ -464,6 +464,11 @@ EOS
{$(srcdir)}.c{}.obj:
$(CC) -I. -I$(<D) $(CFLAGS) $(CPPFLAGS) -c $(<:/=\\)
"
else
mfile.puts "
.c.@OBJEXT@:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
"
end

Expand Down
2 changes: 1 addition & 1 deletion gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ rb_newobj()

if (!freelist) rb_gc();

if (freelist->as.free.next && freelist->as.free.next->as.free.flag != 0) abort();
obj = (VALUE)freelist;
freelist = freelist->as.free.next;
MEMZERO((void*)obj, RVALUE, 1);
return obj;
}

Expand Down
6 changes: 0 additions & 6 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ rb_hash_new2(klass)
NEWOBJ(hash, struct RHash);
OBJSETUP(hash, klass, T_HASH);

hash->iter_lev = 0;
hash->ifnone = Qnil;
hash->tbl = 0; /* avoid GC crashing */
hash->tbl = st_init_table(&objhash);

return (VALUE)hash;
Expand Down Expand Up @@ -225,9 +223,7 @@ rb_hash_s_create(argc, argv, klass)
NEWOBJ(hash, struct RHash);
OBJSETUP(hash, klass, T_HASH);

hash->iter_lev = 0;
hash->ifnone = Qnil;
hash->tbl = 0; /* avoid GC crashing */
hash->tbl = st_copy(RHASH(argv[0])->tbl);

return (VALUE)hash;
Expand All @@ -252,9 +248,7 @@ rb_hash_clone(hash)
NEWOBJ(clone, struct RHash);
CLONESETUP(clone, hash);

clone->iter_lev = 0;
clone->ifnone = RHASH(hash)->ifnone;
clone->tbl = 0; /* avoid GC crashing */
clone->tbl = (st_table*)st_copy(RHASH(hash)->tbl);

return (VALUE)clone;
Expand Down
2 changes: 1 addition & 1 deletion lib/cgi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ def CGI::pretty(string, shift = " ")
start_pos = lines.rindex(/^\s*<#{element}/ni, end_pos)
lines[start_pos ... end_pos] = "__" + lines[start_pos ... end_pos].gsub(/\n(?!\z)/n, "\n" + shift) + "__"
end
lines.gsub(/^(\s*)__(?=<\/?\w)/n, '\1')
lines.gsub(/^((?:#{Regexp::quote(shift)})*)__(?=<\/?\w)/n, '\1')
end


Expand Down
7 changes: 6 additions & 1 deletion lib/mkmf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def create_makefile(target)
CC = #{CONFIG["CC"]}
CFLAGS = #{CONFIG["CCDLFLAGS"]} #{CFLAGS} #{$CFLAGS}
CPPFLAGS = -I$(hdrdir) -I#{CONFIG["includedir"]} #{$defs.join(" ")}
CPPFLAGS = -I$(hdrdir) -I#{CONFIG["includedir"]} #{$defs.join(" ")} #{CONFIG["CPPFLAGS"]}
CXXFLAGS = $(CFLAGS)
DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS}
LDSHARED = #{CONFIG["LDSHARED"]} #{defflag}
Expand Down Expand Up @@ -454,6 +454,11 @@ def create_makefile(target)
{$(srcdir)}.c.obj:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
"
else
mfile.print "
.c.#{$OBJEXT}:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
"
end

Expand Down
3 changes: 0 additions & 3 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ rb_obj_clone(obj)
rb_raise(rb_eTypeError, "can't clone %s", rb_class2name(CLASS_OF(obj)));
}
clone = rb_obj_alloc(RBASIC(obj)->klass);
ROBJECT(clone)->iv_tbl = 0; /* avoid GC crash */
CLONESETUP(clone,obj);
if (ROBJECT(obj)->iv_tbl) {
ROBJECT(clone)->iv_tbl = st_copy(ROBJECT(obj)->iv_tbl);
Expand Down Expand Up @@ -521,8 +520,6 @@ rb_mod_clone(module)
CLONESETUP(clone, module);

clone->super = RCLASS(module)->super;
clone->iv_tbl = 0;
clone->m_tbl = 0; /* avoid GC crashing */
if (RCLASS(module)->iv_tbl) {
clone->iv_tbl = st_copy(RCLASS(module)->iv_tbl);
}
Expand Down
5 changes: 2 additions & 3 deletions ruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,12 @@ char *rb_str2cstr _((VALUE,int*));
VALUE rb_newobj _((void));
#define NEWOBJ(obj,type) type *obj = (type*)rb_newobj()
#define OBJSETUP(obj,c,t) {\
RBASIC(obj)->klass = (c);\
RBASIC(obj)->flags = (t);\
RBASIC(obj)->klass = (c);\
if (rb_safe_level() >= 3) FL_SET(obj, FL_TAINT);\
}
#define CLONESETUP(clone,obj) do {\
RBASIC(clone)->flags = (RBASIC(obj)->flags);\
RBASIC(obj)->klass = (rb_singleton_class_clone(RBASIC(obj)->klass));\
OBJSETUP(clone,rb_singleton_class_clone(RBASIC(obj)->klass),RBASIC(obj)->flags);\
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);\
if (FL_TEST(obj, FL_EXIVAR)) rb_clone_generic_ivar((VALUE)clone,(VALUE)obj);\
} while (0)
Expand Down
2 changes: 0 additions & 2 deletions struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ struct_alloc(argc, argv, klass)
size = iv_get(klass, "__size__");
n = FIX2LONG(size);

st->len = 0; /* avoid GC crashing */
st->ptr = ALLOC_N(VALUE, n);
rb_mem_clear(st->ptr, n);
st->len = n;
Expand Down Expand Up @@ -408,7 +407,6 @@ rb_struct_clone(s)
{
NEWOBJ(clone, struct RStruct);
CLONESETUP(clone, s);
clone->len = 0; /* avoid GC crashing */
clone->ptr = ALLOC_N(VALUE, RSTRUCT(s)->len);
clone->len = RSTRUCT(s)->len;
MEMCPY(clone->ptr, RSTRUCT(s)->ptr, VALUE, clone->len);
Expand Down
4 changes: 2 additions & 2 deletions win32/Makefile.sub
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ AUTOCONF = autoconf


prefix = /usr
CFLAGS = -nologo -DNT=1 -MDd -Zi
CFLAGS = -nologo -DNT=1 -Zi -O2b2x -G5
CPPFLAGS = -I$(srcdir) -I$(srcdir)/missing
LDFLAGS = $(CFLAGS) -Fm
XLDFLAGS =
#EXTLIBS =
LIBS = RubyCRTD.lib user32.lib advapi32.lib ws2_32.lib $(EXTLIBS)
LIBS = user32.lib advapi32.lib wsock32.lib $(EXTLIBS)
MISSING = crypt.obj alloca.obj win32.obj isinf.obj isnan.obj
LDSHARED =
DLDFLAGS =
Expand Down
12 changes: 6 additions & 6 deletions win32/config.status.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
s%@SHELL@%%g
s%@CFLAGS@%-nologo -DNT=1 -MDd -Zi%g
s%@CFLAGS@%-nologo -DNT=1 -Zi -O2b2x -G5%g
s%@CPPFLAGS@%%g
s%@CXXFLAGS@%%g
s%@FFLAGS@%%g
s%@DEFS@%
-DUSE_THREAD -DSIZEOF_INT=4 -DSIZEOF_SHORT=2 -DSIZEOF_LONG=4 -DSIZEOF_VOIDP=4 -DSIZEOF_FLOAT=4 -DSIZEOF_DOUBLE=8 -DHAVE_PROTOTYPES=1 -DHAVE_STDARG_PROTOTYPES=1 -DHAVE_STDLIB_H=1 -DHAVE_LIMITS_H=1 -DHAVE_FCNTL_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ST_RDEV=1 -DGETGROUPS_T=int -DRETSIGTYPE=void -DHAVE_ALLOCA=1 -DHAVE_FMOD=1 -DHAVE_WAITPID=1 -DHAVE_GETCWD=1 -DHAVE_CHSIZE=1 -DHAVE_GETGROUPS=1 -DHAVE_GETLOGIN=1 -DRSHIFT=\(x,y\)\ \(\(x\)\>\>y\) -DFILE_COUNT=_cnt -DDLEXT=\".so\" -DDLEXT2=\".dll\" -DRUBY_PLATFORM=\"i586-mswin32\" %g
s%@LDFLAGS@%-nologo -MDd -Zi%g
s%@LIBS@%RubyCRTD.lib user32.lib advapi32.lib ws2_32.lib%g
s%@LDFLAGS@%-nologo%g
s%@LIBS@%user32.lib advapi32.lib wsock32.lib%g
s%@exec_prefix@%${prefix}%g
s%@prefix@%%g
s%@program_transform_name@%s,x,x,%g
Expand Down Expand Up @@ -40,7 +40,7 @@ s%@DEFAULT_KCODE@%%g
s%@EXEEXT@%.exe%g
s%@OBJEXT@%obj%g
s%@XLDFLAGS@%%g
s%@DLDFLAGS@%-MDd -Zi%g
s%@DLDFLAGS@%$(CFLAGS)%g
s%@STATIC@%%g
s%@CCDLFLAGS@%-DIMPORT%g
s%@LDSHARED@%cl -LD%g
Expand All @@ -59,10 +59,10 @@ s%@LIBRUBY_ALIASES@%%g
s%@LIBRUBY@%$(RUBY_SO_NAME).lib%g
s%@LIBRUBYARG@%$(topdir)/$(RUBY_SO_NAME).lib%g
s%@SOLIBS@%%g
s%@DLDLIBS@%RubyCRTD.lib%g
s%@DLDLIBS@%%g
s%@arch@%i586-mswin32%g
s%@sitedir@%${prefix}/lib/ruby/site_ruby%g
s%@configure_args@%--with-make-prog=nmake --with-tcllib=tcl83 --with-tklib=tk83%g
s%@configure_args@%--with-make-prog=nmake%g
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
4 changes: 2 additions & 2 deletions win32/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

$ruby_name ||= CONFIG["RUBY_INSTALL_NAME"]
$rubyw_name ||= CONFIG["RUBYW_INSTALL_NAME"] || $ruby_name.sub(/ruby/, '\&w')
$so_name ||= CONFIG["RUBY_SO_NAME"]
$so_name ||= CONFIG["RUBY_SO_NAME"] + '.dll'

icons = {}
def icons.find(path)
Expand Down Expand Up @@ -49,7 +49,7 @@ def icons.find(path)
[ # base name extension file type icons
[$ruby_name, CONFIG["EXEEXT"], 'VFT_APP', ruby_icon],
[$rubyw_name, CONFIG["EXEEXT"], 'VFT_APP', rubyw_icon],
[$so_name, '.'+CONFIG["DLEXT2"], 'VFT_DLL', dll_icons],
[$so_name, '', 'VFT_DLL', dll_icons],
].each do |base, ext, type, icons|
open(base + '.rc', "w") { |f|
f.binmode if /mingw/ =~ RUBY_PLATFORM
Expand Down

0 comments on commit c1bbe10

Please sign in to comment.