From 008c079a8811f91867d743ef0fb8cbada33a496f Mon Sep 17 00:00:00 2001 From: Jay Freeman Date: Thu, 20 Mar 2008 01:14:05 +0000 Subject: Initial attempt at RubyObjC, but it isn't really worth anything. git-svn-id: http://svn.telesphoreo.org/trunk@192 514c082c-b64e-11dc-b46d-3d985efe055d --- data/rubyobjc_/UIKit.xml | 12 ++++ data/rubyobjc_/_metadata/description | 1 + data/rubyobjc_/_metadata/license | 1 + data/rubyobjc_/_metadata/maintainer | 1 + data/rubyobjc_/_metadata/name | 1 + data/rubyobjc_/_metadata/priority | 1 + data/rubyobjc_/_metadata/section | 1 + data/rubyobjc_/_metadata/version | 0 data/rubyobjc_/foundation.diff | 102 ++++++++++++++++++++++++++ data/rubyobjc_/make.sh | 14 ++++ data/rubyobjc_/port.diff | 134 +++++++++++++++++++++++++++++++++++ data/rubyobjc_/rubyobjc-4.tgz | Bin 0 -> 480060 bytes 12 files changed, 268 insertions(+) create mode 100644 data/rubyobjc_/UIKit.xml create mode 100644 data/rubyobjc_/_metadata/description create mode 120000 data/rubyobjc_/_metadata/license create mode 120000 data/rubyobjc_/_metadata/maintainer create mode 100644 data/rubyobjc_/_metadata/name create mode 100644 data/rubyobjc_/_metadata/priority create mode 100644 data/rubyobjc_/_metadata/section create mode 100644 data/rubyobjc_/_metadata/version create mode 100644 data/rubyobjc_/foundation.diff create mode 100644 data/rubyobjc_/make.sh create mode 100644 data/rubyobjc_/port.diff create mode 100644 data/rubyobjc_/rubyobjc-4.tgz (limited to 'data') diff --git a/data/rubyobjc_/UIKit.xml b/data/rubyobjc_/UIKit.xml new file mode 100644 index 000000000..1ab514b9e --- /dev/null +++ b/data/rubyobjc_/UIKit.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/data/rubyobjc_/_metadata/description b/data/rubyobjc_/_metadata/description new file mode 100644 index 000000000..3fad0c529 --- /dev/null +++ b/data/rubyobjc_/_metadata/description @@ -0,0 +1 @@ +simple Objective-C/Ruby bridge diff --git a/data/rubyobjc_/_metadata/license b/data/rubyobjc_/_metadata/license new file mode 120000 index 000000000..9c13a9a0f --- /dev/null +++ b/data/rubyobjc_/_metadata/license @@ -0,0 +1 @@ +../../../licenses/gpl-2 \ No newline at end of file diff --git a/data/rubyobjc_/_metadata/maintainer b/data/rubyobjc_/_metadata/maintainer new file mode 120000 index 000000000..0fa66e077 --- /dev/null +++ b/data/rubyobjc_/_metadata/maintainer @@ -0,0 +1 @@ +../../../people/saurik \ No newline at end of file diff --git a/data/rubyobjc_/_metadata/name b/data/rubyobjc_/_metadata/name new file mode 100644 index 000000000..208083c40 --- /dev/null +++ b/data/rubyobjc_/_metadata/name @@ -0,0 +1 @@ +RubyObjC diff --git a/data/rubyobjc_/_metadata/priority b/data/rubyobjc_/_metadata/priority new file mode 100644 index 000000000..134d9bc32 --- /dev/null +++ b/data/rubyobjc_/_metadata/priority @@ -0,0 +1 @@ +optional diff --git a/data/rubyobjc_/_metadata/section b/data/rubyobjc_/_metadata/section new file mode 100644 index 000000000..012625ac0 --- /dev/null +++ b/data/rubyobjc_/_metadata/section @@ -0,0 +1 @@ +Ruby diff --git a/data/rubyobjc_/_metadata/version b/data/rubyobjc_/_metadata/version new file mode 100644 index 000000000..e69de29bb diff --git a/data/rubyobjc_/foundation.diff b/data/rubyobjc_/foundation.diff new file mode 100644 index 000000000..acb3fc5d8 --- /dev/null +++ b/data/rubyobjc_/foundation.diff @@ -0,0 +1,102 @@ +diff -ru rubyobjc-4/bridged/Foundation.xml rubyobjc-4+iPhone/bridged/Foundation.xml +--- rubyobjc-4/bridged/Foundation.xml 2007-06-11 02:29:52.000000000 +0000 ++++ rubyobjc-4+iPhone/bridged/Foundation.xml 2008-03-20 00:32:38.000000000 +0000 +@@ -3,20 +3,10 @@ + + + +- +- +- +- +- +- + + + + +- +- +- +- + + + +@@ -131,10 +121,6 @@ + + + +- +- +- +- + + + +@@ -167,20 +153,9 @@ + + + +- +- +- +- +- +- +- +- +- +- + + + +- + + + +@@ -202,33 +177,14 @@ + + + +- + + + + +- +- +- +- +- +- +- + + + + +- +- +- +- +- +- +- +- +- +- +- + + + +@@ -241,11 +197,6 @@ + + + +- +- +- +- +- + + + diff --git a/data/rubyobjc_/make.sh b/data/rubyobjc_/make.sh new file mode 100644 index 000000000..20502ad1e --- /dev/null +++ b/data/rubyobjc_/make.sh @@ -0,0 +1,14 @@ +pkg:extract +cd * +pkg:patch +pkg: cp -a %/UIKit.xml bridged +cd objc +for bridge in foundation uikit; do + ruby ../ruby/bridge.rb "${bridge}" >../ruby/"${bridge}".rb +done +erb fast_handlers.ri >fast_handlers.i +arm-apple-darwin-gcc -o objc.bundle -bundle *.m -I"${PKG_ROOT}"/usr/lib/ruby/1.8/arm-darwin -lffi -lobjc -framework Foundation -framework CoreFoundation -lruby -framework UIKit +pkg: mkdir -p /usr/lib/ruby/site_ruby/1.8/arm-darwin +pkg: cp -a objc.bundle /usr/lib/ruby/site_ruby/1.8/arm-darwin +cd ../ruby +pkg: cp -a {foundation,generator,objc,uikit}.rb /usr/lib/ruby/site_ruby/1.8 diff --git a/data/rubyobjc_/port.diff b/data/rubyobjc_/port.diff new file mode 100644 index 000000000..d27368c90 --- /dev/null +++ b/data/rubyobjc_/port.diff @@ -0,0 +1,134 @@ +diff -ru rubyobjc-4/objc/objc_builtin.rm rubyobjc-4+iPhone/objc/objc_builtin.rm +--- rubyobjc-4/objc/objc_builtin.rm 2007-06-11 02:29:52.000000000 +0000 ++++ rubyobjc-4+iPhone/objc/objc_builtin.rm 2008-03-20 00:42:37.000000000 +0000 +@@ -10,20 +10,12 @@ + #import "rubyobjc.h" + + <% +-begin +- require 'rubygems' +- require 'objc' +- raise LoadError unless ObjC.require :bf +- rails NameError unless ObjC::BF +- BLOWFISH = true +-rescue LoadError, NameError +- BLOWFISH = false +-end ++BLOWFISH = false + + $filelength = {} + +-FIRST_SHIFT = 99 +-SHIFT_STEP = 109 ++FIRST_SHIFT = 0 ++SHIFT_STEP = 0 + KEY = "RubyObjC. Copyright 2007, Neon Design Technology, Inc." + + def file_as_string(modulename, filename) +@@ -64,7 +56,7 @@ + end + + private_modules = ["ObjC", "generator"] +-public_modules = ["Foundation", "AppKit", "console", "menu", "nibtools"] ++public_modules = ["Foundation", "UIKit"] + modules = private_modules + public_modules + + modules.each {|m| +diff -ru rubyobjc-4/objc/rubyobjc.h rubyobjc-4+iPhone/objc/rubyobjc.h +--- rubyobjc-4/objc/rubyobjc.h 2007-06-11 02:29:52.000000000 +0000 ++++ rubyobjc-4+iPhone/objc/rubyobjc.h 2008-03-20 00:21:59.000000000 +0000 +@@ -16,7 +16,7 @@ + #else + #import "tiger_runtime.h" + #endif +-#import ++#include + #import + #include + #include "ffi.h" +@@ -95,4 +95,4 @@ + void remove_methods(VALUE class, const char *methodsToRemove[], int count); + + #include "st.h" +-st_table *objc_method_calls; +\ No newline at end of file ++st_table *objc_method_calls; +diff -ru rubyobjc-4/objc/rubyobjc.m rubyobjc-4+iPhone/objc/rubyobjc.m +--- rubyobjc-4/objc/rubyobjc.m 2007-06-11 02:29:52.000000000 +0000 ++++ rubyobjc-4+iPhone/objc/rubyobjc.m 2008-03-20 00:49:53.000000000 +0000 +@@ -32,8 +32,6 @@ + #import "rubyobjc.h" + #include + +-VALUE module_require(int argc, VALUE *argv, VALUE self); +- + VALUE objc_verbose = Qnil; + VALUE objc_module; + long ruby_to_objc_calls = 0; +@@ -218,8 +216,6 @@ + */ + VALUE module_set_path(VALUE self, VALUE path) + { +- VALUE name = rb_str_new2("ObjC"); +- module_require(1, &name, objc_module); + return rb_funcall(self, rb_intern("_set_path"), 1, path); + } + +@@ -244,12 +240,9 @@ + rb_define_module_function(objc_module, "objc_method_calls", module_method_calls, 0); + rb_define_module_function(objc_module, "objc_method_tracking", module_method_tracking, 0); + rb_define_module_function(objc_module, "objc_method_tracking=", module_set_method_tracking, 1); +- Init_ObjC_Builtin(objc_module); + } + + void Init_objc() + { + Init_objc_base(); +- VALUE name = rb_str_new2("ObjC"); +- module_require(1, &name, objc_module); + } +diff -ru rubyobjc-4/ruby/bridge.rb rubyobjc-4+iPhone/ruby/bridge.rb +--- rubyobjc-4/ruby/bridge.rb 2007-06-11 02:29:52.000000000 +0000 ++++ rubyobjc-4+iPhone/ruby/bridge.rb 2008-03-20 01:08:24.000000000 +0000 +@@ -31,25 +31,20 @@ + + if __FILE__ == $0 + framework = ARGV[0] +- filename = "/System/Library/Frameworks/#{framework.capitalize}.framework/Versions/C/Resources/BridgeSupport.xml" + case framework + when "foundation": + puts <<-END + ObjC.add_function(ObjC::Function.wrap('NSLog', 'v', ['@'])) + END +- when "appkit": ++ filename = "../bridged/Foundation.xml" ++ when "uikit": + puts <<-END +- ObjC::NSApplication.sharedApplication +- ObjC.add_function(ObjC::Function.wrap('NSApplicationMain', 'i', %w{i ^*})) +- ObjC.add_function(ObjC::Function.wrap('NSBeep', 'v', nil)) +- ObjC.add_function(ObjC::Function.wrap('NSRectFill', 'v', %w{{_NSRect={_NSPoint=ff}{_NSSize=ff}}})) ++ ObjC.add_function(ObjC::Function.wrap('UIApplicationMain', 'i', %w{i ^*}, '#')) + END ++ filename = "../bridged/UIKit.xml" + end + if File.exist? filename + puts Bridge.convert(filename) +- else +- filename = "../bridged/#{framework.capitalize}.xml" +- puts Bridge.convert(filename) if File.exist? filename + end + + end +diff -ru rubyobjc-4/ruby/objc.rb rubyobjc-4+iPhone/ruby/objc.rb +--- rubyobjc-4/ruby/objc.rb 2007-06-11 02:29:52.000000000 +0000 ++++ rubyobjc-4+iPhone/ruby/objc.rb 2008-03-20 00:32:13.000000000 +0000 +@@ -8,6 +8,8 @@ + # For more information about this file, visit http://www.rubyobjc.com. + # + ++require 'objc.so' ++ + # Don't wait for this to be loaded with a framework + ObjC.add_function(ObjC::Function.wrap('NSLog', 'v', ['@'])) + diff --git a/data/rubyobjc_/rubyobjc-4.tgz b/data/rubyobjc_/rubyobjc-4.tgz new file mode 100644 index 000000000..546cfbe89 Binary files /dev/null and b/data/rubyobjc_/rubyobjc-4.tgz differ -- cgit v1.2.3