[macruby-changes] [2440] MacRuby/trunk/load.c
source_changes at macosforge.org
source_changes at macosforge.org
Sun Aug 30 16:10:13 PDT 2009
Revision: 2440
http://trac.macosforge.org/projects/ruby/changeset/2440
Author: lsansonetti at apple.com
Date: 2009-08-30 16:10:13 -0700 (Sun, 30 Aug 2009)
Log Message:
-----------
load .rbo files prior to .rb files (this is all temporary since we will very soon replace that ugly file)
Modified Paths:
--------------
MacRuby/trunk/load.c
Modified: MacRuby/trunk/load.c
===================================================================
--- MacRuby/trunk/load.c 2009-08-30 23:09:33 UTC (rev 2439)
+++ MacRuby/trunk/load.c 2009-08-30 23:10:13 UTC (rev 2440)
@@ -8,6 +8,7 @@
#include "dln.h"
#define IS_RBEXT(e) (strcmp(e, ".rb") == 0)
+#define IS_RBOEXT(e) (strcmp(e, ".rbo") == 0)
#define IS_SOEXT(e) (strcmp(e, ".so") == 0 || strcmp(e, ".o") == 0)
#ifdef DLEXT2
#define IS_DLEXT(e) (strcmp(e, DLEXT) == 0 || strcmp(e, DLEXT2) == 0)
@@ -15,9 +16,8 @@
#define IS_DLEXT(e) (strcmp(e, DLEXT) == 0)
#endif
-
static const char *const loadable_ext[] = {
- ".rb", DLEXT,
+ ".rbo", ".rb", DLEXT,
#ifdef DLEXT2
DLEXT2,
#endif
@@ -485,15 +485,28 @@
else {
// TODO: load should be protected by a lock
rb_set_safe_level_force(0);
- switch (found) {
- case 'r':
- rb_load(path, 0);
- break;
-
- case 's':
- dln_load(RSTRING_PTR(path));
- break;
+ const char *cpath = RSTRING_PTR(path);
+ const size_t cpathlen = strlen(cpath);
+ if (cpathlen > 3 && cpath[cpathlen - 3] == '.'
+ && cpath[cpathlen - 2] == 'r'
+ && cpath[cpathlen - 1] == 'b') {
+ rb_load(path, 0);
}
+ else if (cpathlen > 7 && cpath[cpathlen - 7] == '.'
+ && cpath[cpathlen - 6] == 'b'
+ && cpath[cpathlen - 5] == 'u'
+ && cpath[cpathlen - 4] == 'n'
+ && cpath[cpathlen - 3] == 'd'
+ && cpath[cpathlen - 2] == 'l'
+ && cpath[cpathlen - 1] == 'e') {
+ dln_load(cpath);
+ }
+ else if (cpathlen > 4 && cpath[cpathlen - 4] == '.'
+ && cpath[cpathlen - 3] == 'r'
+ && cpath[cpathlen - 2] == 'b'
+ && cpath[cpathlen - 1] == 'o') {
+ dln_load(cpath);
+ }
rb_provide_feature(path);
result = Qtrue;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090830/b0890ea7/attachment.html>
More information about the macruby-changes
mailing list