Permalink
Browse files

updated local to match joint project

  • Loading branch information...
1 parent 67292c3 commit 8438a9bc28e270be15a9f49db26299f67e01295b @banister committed Nov 2, 2010
View
@@ -7,13 +7,16 @@ have to really read this once.
% installation %
with gem:
- $ gem install mixico -s http://gemcutter.org
+ $ gem install mixico
without:
$ ruby setup.rb config
$ ruby setup.rb setup
$ sudo ruby setup.rb install
+% documentation %
+http://rubydoc.info/github/rkh/mixico/master/file/README
+
% source code %
mixico is written in c. it is very quick (basically atomic.)
@@ -175,5 +178,5 @@ no sign of the mixin at all.
Until _why might reappear someday, this project is maintained by Konstantin Haase (rkh).
konstantin.mailinglists <at> googlemail <dot> com
http://github.com/rkh/mixico
-* updated for Ruby 1.9 by banisterfiend
+* updated for Ruby 1.9 + other changes by banisterfiend
http://github.com/banister
View
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+direc = File.dirname(__FILE__)
+dlext = Config::CONFIG['DLEXT']
+
+require 'rake/clean'
+require 'rake/gempackagetask'
+require './lib/mixico/version'
+
+CLEAN.include("ext/**/*.#{dlext}", "ext/**/*.log", "ext/**/*.o", "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "ext/**/*.def", "ext/**/*.pdb")
+CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
+
+def apply_spec_defaults(s)
+ s.name = "mixico"
+ s.version = Mixico::VERSION
+ s.summary = "mixin hijinks — enable and disable mixins"
+ s.description = s.summary
+ s.files = Dir['COPYING', 'README', '**/*.rb', '**/*.c', '**/*.h']
+ s.authors = ["why the lucky stiff", "Konstantin Haase", "John Mair (banisterfiend)"]
+ s.email = "konstantin.mailinglists@googlemail.com"
+ s.homepage = "http://github.com/rkh/mixico/tree"
+ s.has_rdoc = 'yard'
+end
+
+task :test do
+ sh "bacon -k #{direc}/test/test.rb"
+end
+
+[:mingw32, :mswin32].each do |v|
+ namespace v do
+ spec = Gem::Specification.new do |s|
+ apply_spec_defaults(s)
+ s.platform = "i386-#{v}"
+ s.files += FileList["lib/**/*.#{dlext}"].to_a
+ end
+
+ Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.need_zip = false
+ pkg.need_tar = false
+ end
+ end
+end
+
+namespace :ruby do
+ spec = Gem::Specification.new do |s|
+ apply_spec_defaults(s)
+ s.platform = Gem::Platform::RUBY
+ s.extensions = ["ext/mixico/extconf.rb"]
+ end
+
+ Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.need_zip = false
+ pkg.need_tar = false
+ end
+end
+
+
+
View
@@ -0,0 +1,156 @@
+
+SHELL = /bin/sh
+
+#### Start of system configuration section. ####
+
+srcdir = .
+topdir = /C/ruby187/lib/ruby/1.8/i386-mingw32
+hdrdir = $(topdir)
+VPATH = $(srcdir):$(topdir):$(hdrdir)
+
+DESTDIR = C:
+exec_prefix = $(prefix)
+prefix = $(DESTDIR)/ruby187
+sharedstatedir = $(prefix)/com
+mandir = $(datarootdir)/man
+psdir = $(docdir)
+oldincludedir = $(DESTDIR)/usr/include
+localedir = $(datarootdir)/locale
+bindir = $(exec_prefix)/bin
+libexecdir = $(exec_prefix)/libexec
+sitedir = $(libdir)/ruby/site_ruby
+htmldir = $(docdir)
+vendorarchdir = $(vendorlibdir)/$(sitearch)
+includedir = $(prefix)/include
+infodir = $(datarootdir)/info
+vendorlibdir = $(vendordir)/$(ruby_version)
+sysconfdir = $(prefix)/etc
+libdir = $(exec_prefix)/lib
+sbindir = $(exec_prefix)/sbin
+rubylibdir = $(libdir)/ruby/$(ruby_version)
+docdir = $(datarootdir)/doc/$(PACKAGE)
+dvidir = $(docdir)
+vendordir = $(libdir)/ruby/vendor_ruby
+datarootdir = $(prefix)/share
+pdfdir = $(docdir)
+archdir = $(rubylibdir)/$(arch)
+sitearchdir = $(sitelibdir)/$(sitearch)
+datadir = $(datarootdir)
+localstatedir = $(prefix)/var
+sitelibdir = $(sitedir)/$(ruby_version)
+
+CC = gcc
+LIBRUBY = lib$(LIBRUBY_SO).a
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
+
+RUBY_EXTCONF_H =
+CFLAGS = -g -O2 -DFD_SETSIZE=256 $(cflags)
+INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
+DEFS =
+CPPFLAGS = $(DEFS) $(cppflags)
+CXXFLAGS = $(CFLAGS)
+ldflags = -L.
+dldflags = -Wl,--enable-auto-image-base,--enable-auto-import,--export-all
+archflag =
+DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
+LDSHARED = gcc -shared -s
+AR = ar
+EXEEXT = .exe
+
+RUBY_INSTALL_NAME = ruby
+RUBY_SO_NAME = msvcrt-ruby18
+arch = i386-mingw32
+sitearch = i386-msvcrt
+ruby_version = 1.8
+ruby = C:/ruby187/bin/ruby
+RUBY = $(ruby)
+RM = rm -f
+MAKEDIRS = install -d
+INSTALL = /bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+
+#### End of system configuration section. ####
+
+preload =
+
+libpath = . $(libdir)
+LIBPATH = -L. -L$(libdir)
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES =
+
+extout =
+extout_prefix =
+target_prefix =
+LOCAL_LIBS =
+LIBS = $(LIBRUBYARG_SHARED) -lshell32 -lws2_32
+SRCS = mixico.c
+OBJS = mixico.o
+TARGET = mixico
+DLLIB = $(TARGET).so
+EXTSTATIC =
+STATIC_LIB =
+
+BINDIR = $(bindir)
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+
+TARGET_SO = $(DLLIB)
+CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
+CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
+
+all: $(DLLIB)
+static: $(STATIC_LIB)
+
+clean:
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
+
+distclean: clean
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: $(RUBYARCHDIR)
+install-so: $(RUBYARCHDIR)/$(DLLIB)
+$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+$(RUBYARCHDIR):
+ $(MAKEDIRS) $@
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
+.SUFFIXES: .c .m .cc .cxx .cpp .o
+
+.cc.o:
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
+
+.cxx.o:
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
+
+.cpp.o:
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
+
+.c.o:
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
+
+$(DLLIB): $(OBJS) Makefile
+ @-$(RM) $@
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
+
+
+
+$(OBJS): ruby.h defines.h
View
@@ -5,17 +5,52 @@
#include <ruby.h>
+/* test for 1.9 */
+#if !defined(RUBY_19) && defined(ROBJECT_EMBED_LEN_MAX)
+# define RUBY_19
+#endif
+
/* macros for backwards compatibility with 1.8 */
#ifndef RUBY_19
# define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
# define RCLASS_SUPER(c) (RCLASS(c)->super)
# define RCLASS_IV_TBL(c) (RCLASS(c)->iv_tbl)
# define OBJ_UNTRUSTED OBJ_TAINTED
-# define FALSE 0
-# define TRUE 1
# include "st.h"
#endif
+#ifdef RUBY_19
+inline static VALUE
+class_alloc(VALUE flags, VALUE klass)
+{
+ rb_classext_t *ext = ALLOC(rb_classext_t);
+ NEWOBJ(obj, struct RClass);
+ OBJSETUP(obj, klass, flags);
+ obj->ptr = ext;
+ RCLASS_IV_TBL(obj) = 0;
+ RCLASS_M_TBL(obj) = 0;
+ RCLASS_SUPER(obj) = 0;
+ RCLASS_IV_INDEX_TBL(obj) = 0;
+ return (VALUE)obj;
+}
+#endif
+
+inline static VALUE
+create_class(VALUE flags, VALUE klass)
+{
+#ifdef RUBY_19
+ VALUE new_klass = class_alloc(flags, klass);
+#else
+ NEWOBJ(new_klass, struct RClass);
+ OBJSETUP(new_klass, klass, flags);
+#endif
+
+ return (VALUE)new_klass;
+}
+
+# define FALSE 0
+# define TRUE 1
+
/* a useful macro. cannot use ordinary CLASS_OF as it does not return an lvalue */
#define KLASS_OF(c) (RBASIC(c)->klass)
@@ -1,6 +1,3 @@
require 'mkmf'
-# 1.9 compatibility
-$CFLAGS += " -DRUBY_19" if RUBY_VERSION =~ /1.9/
-
-create_makefile("cmixico")
+create_makefile("mixico")
@@ -0,0 +1,2 @@
+EXPORTS
+Init_mixico
View
@@ -9,22 +9,6 @@
static VALUE mixin_eval, mixout_eval;
-#ifdef RUBY_19
-static VALUE
-class_alloc(VALUE flags, VALUE klass)
-{
- rb_classext_t *ext = ALLOC(rb_classext_t);
- NEWOBJ(obj, struct RClass);
- OBJSETUP(obj, klass, flags);
- obj->ptr = ext;
- RCLASS_IV_TBL(obj) = 0;
- RCLASS_M_TBL(obj) = 0;
- RCLASS_SUPER(obj) = 0;
- RCLASS_IV_INDEX_TBL(obj) = 0;
- return (VALUE)obj;
-}
-#endif
-
static VALUE
rb_mod_disable_mixin(VALUE module, VALUE super)
{
@@ -66,13 +50,8 @@ static VALUE
rb_mod_mixin_object(VALUE target, VALUE obj)
{
VALUE singleton = rb_singleton_class(obj);
+ VALUE iclass = create_class(T_ICLASS, rb_cClass);
-#ifdef RUBY_19
- VALUE iclass = class_alloc(T_ICLASS, rb_cClass);
-#else
- NEWOBJ(iclass, struct RClass);
- OBJSETUP(iclass, rb_cClass, T_ICLASS);
-#endif
Check_Type(target, T_MODULE);
if (!RCLASS_IV_TBL(obj))
RCLASS_IV_TBL(obj) = st_init_numtable();
@@ -90,7 +69,7 @@ rb_mod_mixin_object(VALUE target, VALUE obj)
return Qnil;
}
-void Init_cmixico()
+void Init_mixico()
{
rb_define_method(rb_cModule, "disable_mixin", rb_mod_disable_mixin, 1);
rb_define_method(rb_cModule, "enable_mixin", rb_mod_enable_mixin, 1);
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 8438a9b

Please sign in to comment.