diff options
author | Jay Freeman <saurik@saurik.com> | 2008-03-20 01:14:05 +0000 |
---|---|---|
committer | Jay Freeman <saurik@saurik.com> | 2008-03-20 01:14:05 +0000 |
commit | 008c079a8811f91867d743ef0fb8cbada33a496f (patch) | |
tree | 99bca321849a3c7af73714b5b6349089fc32848b | |
parent | 9d0efc95755dc903caf7a6942c9943f7fee1c5ee (diff) |
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
-rw-r--r-- | data/rubyobjc_/UIKit.xml | 12 | ||||
-rw-r--r-- | data/rubyobjc_/_metadata/description | 1 | ||||
l--------- | data/rubyobjc_/_metadata/license | 1 | ||||
l--------- | data/rubyobjc_/_metadata/maintainer | 1 | ||||
-rw-r--r-- | data/rubyobjc_/_metadata/name | 1 | ||||
-rw-r--r-- | data/rubyobjc_/_metadata/priority | 1 | ||||
-rw-r--r-- | data/rubyobjc_/_metadata/section | 1 | ||||
-rw-r--r-- | data/rubyobjc_/_metadata/version | 0 | ||||
-rw-r--r-- | data/rubyobjc_/foundation.diff | 102 | ||||
-rw-r--r-- | data/rubyobjc_/make.sh | 14 | ||||
-rw-r--r-- | data/rubyobjc_/port.diff | 134 | ||||
-rw-r--r-- | data/rubyobjc_/rubyobjc-4.tgz | bin | 0 -> 480060 bytes |
12 files changed, 268 insertions, 0 deletions
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 @@ +<?xml version='1.0'?> +<!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd"> +<signatures version='0.9'> + <function name='UIApplicationMain' returns='_C_INT'> + <function_arg type='_C_INT'/> + <function_arg type='_PRIV_C_PTR'/> + <function_arg type='_C_CLASS'/> + </function> + <informal_protocol name='UIApplicationNotifications'> + <method encoding='v12@0:4@8' selector='applicationDidFinishLaunching:'/> + </informal_protocol> +</signatures> 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 --- /dev/null +++ b/data/rubyobjc_/_metadata/version 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 @@ + <signatures version='0.9'> + <constant name='NSAppleEventTimeOutDefault' type='_C_DBL'/> + <constant name='NSAppleEventTimeOutNone' type='_C_DBL'/> +- <constant name='NSAppleEventManagerWillProcessFirstEventNotification' type='_C_ID'/> +- <constant name='NSAppleScriptErrorMessage' type='_C_ID'/> +- <constant name='NSAppleScriptErrorNumber' type='_C_ID'/> +- <constant name='NSAppleScriptErrorAppName' type='_C_ID'/> +- <constant name='NSAppleScriptErrorBriefMessage' type='_C_ID'/> +- <constant name='NSAppleScriptErrorRange' type='_C_ID'/> + <constant name='NSInconsistentArchiveException' type='_C_ID'/> + <constant name='NSBundleDidLoadNotification' type='_C_ID'/> + <constant name='NSLoadedClasses' type='_C_ID'/> + <constant name='NSClassDescriptionNeededForClassNotification' type='_C_ID'/> +- <constant name='NSConnectionReplyMode' type='_C_ID'/> +- <constant name='NSConnectionDidDieNotification' type='_C_ID'/> +- <constant name='NSFailedAuthenticationException' type='_C_ID'/> +- <constant name='NSConnectionDidInitializeNotification' type='_C_ID'/> + <constant name='NSDebugEnabled' type='_PRIV_C_BOOL'/> + <constant name='NSZombieEnabled' type='_PRIV_C_BOOL'/> + <constant name='NSDeallocateZombies' type='_PRIV_C_BOOL'/> +@@ -131,10 +121,6 @@ + <constant name='NSUnionOfArraysKeyValueOperator' type='_C_ID'/> + <constant name='NSUnionOfObjectsKeyValueOperator' type='_C_ID'/> + <constant name='NSUnionOfSetsKeyValueOperator' type='_C_ID'/> +- <constant name='NSKeyValueChangeKindKey' type='_C_ID'/> +- <constant name='NSKeyValueChangeNewKey' type='_C_ID'/> +- <constant name='NSKeyValueChangeOldKey' type='_C_ID'/> +- <constant name='NSKeyValueChangeIndexesKey' type='_C_ID'/> + <constant name='NSLocaleIdentifier' type='_C_ID'/> + <constant name='NSLocaleLanguageCode' type='_C_ID'/> + <constant name='NSLocaleCountryCode' type='_C_ID'/> +@@ -167,20 +153,9 @@ + <constant name='NSObjectMapValueCallBacks' type='UNKNOWN'/> + <constant name='NSNonRetainedObjectMapValueCallBacks' type='UNKNOWN'/> + <constant name='NSOwnedPointerMapValueCallBacks' type='UNKNOWN'/> +- <constant name='NSMetadataQueryDidStartGatheringNotification' type='_C_ID'/> +- <constant name='NSMetadataQueryGatheringProgressNotification' type='_C_ID'/> +- <constant name='NSMetadataQueryDidFinishGatheringNotification' type='_C_ID'/> +- <constant name='NSMetadataQueryDidUpdateNotification' type='_C_ID'/> +- <constant name='NSMetadataQueryResultContentRelevanceAttribute' type='_C_ID'/> +- <constant name='NSMetadataQueryUserHomeScope' type='_C_ID'/> +- <constant name='NSMetadataQueryLocalComputerScope' type='_C_ID'/> +- <constant name='NSMetadataQueryNetworkScope' type='_C_ID'/> +- <constant name='NSNetServicesErrorCode' type='_C_ID'/> +- <constant name='NSNetServicesErrorDomain' type='_C_ID'/> + <constant name='NSFoundationVersionNumber' type='_C_DBL'/> + <constant name='NSPortDidBecomeInvalidNotification' type='_C_ID'/> + <constant name='NSDefaultRunLoopMode' type='_C_ID'/> +- <constant name='NSOperationNotSupportedForKeyException' type='_C_ID'/> + <constant name='NSStreamSocketSecurityLevelKey' type='_C_ID'/> + <constant name='NSStreamSocketSecurityLevelNone' type='_C_ID'/> + <constant name='NSStreamSocketSecurityLevelSSLv2' type='_C_ID'/> +@@ -202,33 +177,14 @@ + <constant name='NSParseErrorException' type='_C_ID'/> + <constant name='NSCharacterConversionException' type='_C_ID'/> + <constant name='_NSConstantStringClassReference' type='_PRIV_C_PTR'/> +- <constant name='NSTaskDidTerminateNotification' type='_C_ID'/> + <constant name='NSWillBecomeMultiThreadedNotification' type='_C_ID'/> + <constant name='NSDidBecomeSingleThreadedNotification' type='_C_ID'/> + <constant name='NSThreadWillExitNotification' type='_C_ID'/> + <constant name='NSSystemTimeZoneDidChangeNotification' type='_C_ID'/> +- <constant name='NSUndoManagerCheckpointNotification' type='_C_ID'/> +- <constant name='NSUndoManagerWillUndoChangeNotification' type='_C_ID'/> +- <constant name='NSUndoManagerWillRedoChangeNotification' type='_C_ID'/> +- <constant name='NSUndoManagerDidUndoChangeNotification' type='_C_ID'/> +- <constant name='NSUndoManagerDidRedoChangeNotification' type='_C_ID'/> +- <constant name='NSUndoManagerDidOpenUndoGroupNotification' type='_C_ID'/> +- <constant name='NSUndoManagerWillCloseUndoGroupNotification' type='_C_ID'/> + <constant name='NSURLFileScheme' type='_C_ID'/> + <constant name='NSURLCredentialStorageChangedNotification' type='_C_ID'/> + <constant name='NSURLErrorDomain' type='_C_ID'/> + <constant name='NSErrorFailingURLStringKey' type='_C_ID'/> +- <constant name='NSHTTPPropertyStatusCodeKey' type='_C_ID'/> +- <constant name='NSHTTPPropertyStatusReasonKey' type='_C_ID'/> +- <constant name='NSHTTPPropertyServerHTTPVersionKey' type='_C_ID'/> +- <constant name='NSHTTPPropertyRedirectionHeadersKey' type='_C_ID'/> +- <constant name='NSHTTPPropertyErrorPageDataKey' type='_C_ID'/> +- <constant name='NSHTTPPropertyHTTPProxy' type='_C_ID'/> +- <constant name='NSFTPPropertyUserLoginKey' type='_C_ID'/> +- <constant name='NSFTPPropertyUserPasswordKey' type='_C_ID'/> +- <constant name='NSFTPPropertyActiveTransferModeKey' type='_C_ID'/> +- <constant name='NSFTPPropertyFileOffsetKey' type='_C_ID'/> +- <constant name='NSFTPPropertyFTPProxy' type='_C_ID'/> + <constant name='NSURLProtectionSpaceHTTPProxy' type='_C_ID'/> + <constant name='NSURLProtectionSpaceHTTPSProxy' type='_C_ID'/> + <constant name='NSURLProtectionSpaceFTPProxy' type='_C_ID'/> +@@ -241,11 +197,6 @@ + <constant name='NSArgumentDomain' type='_C_ID'/> + <constant name='NSRegistrationDomain' type='_C_ID'/> + <constant name='NSUserDefaultsDidChangeNotification' type='_C_ID'/> +- <constant name='NSNegateBooleanTransformerName' type='_C_ID'/> +- <constant name='NSIsNilTransformerName' type='_C_ID'/> +- <constant name='NSIsNotNilTransformerName' type='_C_ID'/> +- <constant name='NSUnarchiveFromDataTransformerName' type='_C_ID'/> +- <constant name='NSXMLParserErrorDomain' type='_C_ID'/> + <enum name='NSEndsWithComparison' value='0x6'/> + <enum name='NSAllPredicateModifier' value='0x1'/> + <enum name='NSBeginsWithPredicateOperatorType' value='0x8'/> 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 <Cocoa/Cocoa.h> ++#include <Foundation/Foundation.h> + #import <ruby.h> + #include <string.h> + #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 <dlfcn.h> + +-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 Binary files differnew file mode 100644 index 000000000..546cfbe89 --- /dev/null +++ b/data/rubyobjc_/rubyobjc-4.tgz |