Permalink
Browse files

fix for #48, support for passing pointers to boxed types, support for…

… the already_retained retval attribute and resourceful CF objectx

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@240 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
lrz committed Jun 2, 2008
1 parent 5d36df8 commit 36b9ead6bf23fcc5d85d6a19c40547b21ce310b6
Showing with 598 additions and 61 deletions.
  1. +15 −1 bs.c
  2. +5 −2 bs.h
  3. +14 −0 instruby.rb
  4. +451 −0 markgc.c
  5. +97 −57 objc.m
  6. +15 −0 sample-macruby/Scripts/circle.rb
  7. +1 −1 sample-macruby/Scripts/hello_world.rb
View
16 bs.c
@@ -1096,7 +1096,21 @@ _bs_parse(const char *path, char **loaded_paths,
free(protocol_name);
xmlFreeTextReader(reader);
-
+
+ if (success && options == BS_PARSE_OPTIONS_LOAD_DYLIBS) {
+ char *p, buf[PATH_MAX];
+ strncpy(buf, path, sizeof buf);
+ p = strrchr(buf, '.');
+ assert(p != NULL);
+ strlcpy(p, ".dylib", p - path - 1);
+ if (access(buf, R_OK) == 0) {
+ if (dlopen(buf, RTLD_LAZY) == NULL) {
+ *error = dlerror();
+ success = false;
+ }
+ }
+ }
+
return success;
}
View
7 bs.h
@@ -202,7 +202,10 @@ typedef void (*bs_parse_callback_t)
(const char *path, bs_element_type_t type, void *value, void *context);
typedef enum {
- BS_PARSE_DEFAULT = 0
+ /* Default option: parse bridge support files. */
+ BS_PARSE_OPTIONS_DEFAULT = 0,
+ /* Parse bridge support files and dlopen(3) the dylib files, if any. */
+ BS_PARSE_OPTIONS_LOAD_DYLIBS
} bs_parse_options_t;
/* bs_parse()
@@ -213,7 +216,7 @@ typedef enum {
* Returns true on success, otherwise false.
*
* path: the full path of the bridge support file to parse.
- * options: parsing options, reserved for future use. You can pass 0 for now.
+ * options: parsing options.
* callback: a callback function pointer.
* context: a contextual data pointer that will be passed to the callback
* function.
View
@@ -489,6 +489,20 @@ def install_stuff(what, from, to, mode)
end
end
+puts "fixing bridge support dylibs"
+unless File.exist?('markgc')
+ unless system("gcc markgc.c -std=gnu99 -o markgc")
+ $stderr.puts "cannot build the markgc tool"
+ exit 1
+ end
+end
+Dir.glob('/System/Library/Frameworks/**/BridgeSupport/*.dylib').each do |p|
+ unless system("markgc '#{p}' >& /dev/null")
+ $stderr.puts "cannot markgc #{p}"
+ exit 1
+ end
+end
+
end # unless $installing_rdoc
# vi:set sw=2:
Oops, something went wrong.

0 comments on commit 36b9ead

Please sign in to comment.