1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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', ['@']))
|