Permalink
Browse files

trim the parser and command-line parsing from static

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@4251 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
lrz committed Jun 19, 2010
1 parent 21174f3 commit e68823cdb827a320988b73a07036546c01b5b218
Showing with 325 additions and 280 deletions.
  1. +7 −0 eval.c
  2. +21 −9 load.c
  3. +0 −44 parse.y
  4. +214 −227 ruby.c
  5. +76 −0 symbol.c
  6. +2 −0 vm.cpp
  7. +5 −0 vm_eval.c
View
7 eval.c
@@ -68,7 +68,12 @@ ruby_init(void)
void *
ruby_options(int argc, char **argv)
{
+#if MACRUBY_STATIC
+ printf("command-line options are not supported in MacRuby static\n");
+ abort();
+#else
return ruby_process_options(argc, argv);
+#endif
}
static void
@@ -193,6 +198,7 @@ ruby_executable_node(void *n, int *status)
return FALSE;
}
+#if !defined(MACRUBY_STATIC)
int
ruby_run_node(void *n)
{
@@ -205,6 +211,7 @@ ruby_run_node(void *n)
rb_vm_run(RSTRING_PTR(rb_progname), (NODE *)n, NULL, false);
return ruby_cleanup(0);
}
+#endif
/*
* call-seq:
View
30 load.c
@@ -52,28 +52,27 @@ rb_provide_feature(VALUE feature)
rb_ary_push(get_loaded_features(), feature);
}
+#if !defined(MACRUBY_STATIC)
static void
-rb_remove_feature(VALUE feature)
+load_failed(VALUE fname)
{
- rb_ary_delete(get_loaded_features(), feature);
+ rb_raise(rb_eLoadError, "no such file to load -- %s",
+ RSTRING_PTR(fname));
}
+#endif
void
rb_provide(const char *feature)
{
rb_provide_feature(rb_str_new2(feature));
}
-static void
-load_failed(VALUE fname)
-{
- rb_raise(rb_eLoadError, "no such file to load -- %s",
- RSTRING_PTR(fname));
-}
-
void
rb_load(VALUE fname, int wrap)
{
+#if MACRUBY_STATIC
+ rb_raise(rb_eRuntimeError, "#load is not supported in MacRuby static");
+#else
// TODO honor wrap
// Locate file.
@@ -95,6 +94,7 @@ rb_load(VALUE fname, int wrap)
Class old_klass = rb_vm_set_current_class(NULL);
rb_vm_run(fname_str, node, NULL, false);
rb_vm_set_current_class(old_klass);
+#endif
}
/*
@@ -155,6 +155,7 @@ rb_f_require_imp(VALUE obj, SEL sel, VALUE fname)
return rb_f_require(obj, fname);
}
+#if !defined(MACRUBY_STATIC)
#define TYPE_RB 0x1
#define TYPE_RBO 0x2
#define TYPE_BUNDLE 0x3
@@ -251,13 +252,20 @@ load_try(VALUE path)
return Qnil;
}
+static void
+rb_remove_feature(VALUE feature)
+{
+ rb_ary_delete(get_loaded_features(), feature);
+}
+
static VALUE
load_rescue(VALUE path, VALUE exc)
{
rb_remove_feature(path);
rb_exc_raise(exc);
return Qnil;
}
+#endif
VALUE
rb_require_safe(VALUE fname, int safe)
@@ -270,6 +278,9 @@ rb_require_safe(VALUE fname, int safe)
return Qtrue;
}
+#if MACRUBY_STATIC
+ rb_raise(rb_eRuntimeError, "#require is not supported in MacRuby static");
+#else
VALUE result = Qnil;
VALUE path;
int type = 0;
@@ -307,6 +318,7 @@ rb_require_safe(VALUE fname, int safe)
}
return result;
+#endif
}
VALUE
View
44 parse.y
@@ -9304,50 +9304,6 @@ ruby_node_name(int node)
return 0;
}
}
-
-int
-rb_is_const_id(ID id)
-{
- if (is_const_id(id)) return Qtrue;
- return Qfalse;
-}
-
-int
-rb_is_class_id(ID id)
-{
- if (is_class_id(id)) return Qtrue;
- return Qfalse;
-}
-
-int
-rb_is_instance_id(ID id)
-{
- if (is_instance_id(id)) return Qtrue;
- return Qfalse;
-}
-
-int
-rb_is_local_id(ID id)
-{
- if (is_local_id(id)) return Qtrue;
- return Qfalse;
-}
-
-int
-rb_is_junk_id(ID id)
-{
- if (is_junk_id(id)) return Qtrue;
- return Qfalse;
-}
-
-ID
-rb_id_attrset(ID id)
-{
- id &= ~ID_SCOPE_MASK;
- id |= ID_ATTRSET;
- return id;
-}
-
#endif /* !RIPPER */
static void
Oops, something went wrong.

0 comments on commit e68823c

Please sign in to comment.