Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 49 lines (41 sloc) 0.946 kb
cd74469 moved the VM exception handler to main()
Laurent Sansonetti authored
1 /*
2 * This file is covered by the Ruby license. See COPYING for more details.
7d7d3e8 @ferrous26 Change ownership to The MacRuby Team and update copyrights
ferrous26 authored
3 *
4 * Copyright (C) 2012, The MacRuby Team. All rights reserved.
9595725 update copyrights to 2011
Laurent Sansonetti authored
5 * Copyright (C) 2007-2011, Apple Inc. All rights reserved.
cd74469 moved the VM exception handler to main()
Laurent Sansonetti authored
6 * Copyright (C) 1993-2007 Yukihiro Matsumoto
7 */
8
cf73725 experimental debugger
Laurent Sansonetti authored
9 #include "llvm.h"
10
cd74469 moved the VM exception handler to main()
Laurent Sansonetti authored
11 #undef RUBY_EXPORT
d0898dd include/ruby/macruby.h -> macruby_internal.h
Laurent Sansonetti authored
12 #include "macruby_internal.h"
2f48a2d working on an experimental AOT compiler
Laurent Sansonetti authored
13 #include "ruby/node.h"
cd74469 moved the VM exception handler to main()
Laurent Sansonetti authored
14 #ifdef HAVE_LOCALE_H
15 #include <locale.h>
16 #endif
17
cf73725 experimental debugger
Laurent Sansonetti authored
18 #include "vm.h"
cd74469 moved the VM exception handler to main()
Laurent Sansonetti authored
19
9dfd3de moved the ruby_is_miniruby symbol somewhere else because main.o is no…
Laurent Sansonetti authored
20 extern bool ruby_is_miniruby;
df691c9 make sure miniruby doesn't crash loading a C extension bundle
Laurent Sansonetti authored
21
cd74469 moved the VM exception handler to main()
Laurent Sansonetti authored
22 int
23 main(int argc, char **argv, char **envp)
24 {
25 #ifdef HAVE_LOCALE_H
26 setlocale(LC_CTYPE, "");
27 #endif
28
df691c9 make sure miniruby doesn't crash loading a C extension bundle
Laurent Sansonetti authored
29 ruby_is_miniruby = argc > 0 && strstr(argv[0], "miniruby") != NULL;
30
cd74469 moved the VM exception handler to main()
Laurent Sansonetti authored
31 try {
32 ruby_sysinit(&argc, &argv);
33 ruby_init();
2f48a2d working on an experimental AOT compiler
Laurent Sansonetti authored
34 void *node = ruby_options(argc, argv);
4c0734a introduce rb_vm_init_compiler() to initialize the shared Compiler object
Laurent Sansonetti authored
35 rb_vm_init_compiler();
2f48a2d working on an experimental AOT compiler
Laurent Sansonetti authored
36 if (ruby_aot_compile) {
37 rb_vm_aot_compile((NODE *)node);
38 rb_exit(0);
39 }
40 else {
41 rb_exit(ruby_run_node(node));
42 }
cd74469 moved the VM exception handler to main()
Laurent Sansonetti authored
43 }
44 catch (...) {
45 rb_vm_print_current_exception();
79466bf make sure we run the finalizers in case of an uncaught exception
Laurent Sansonetti authored
46 rb_exit(1);
cd74469 moved the VM exception handler to main()
Laurent Sansonetti authored
47 }
48 }
Something went wrong with that request. Please try again.