| OLD | NEW |
| 1 /* Copyright (c) 2013 The Native Client Authors. All rights reserved. | 1 /* Copyright (c) 2013 The Native Client Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. */ | 3 * found in the LICENSE file. */ |
| 4 | 4 |
| 5 #undef RUBY_EXPORT | 5 #undef RUBY_EXPORT |
| 6 #include <ruby.h> | 6 #include <ruby.h> |
| 7 #include <spawn.h> | 7 #include <spawn.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 | 9 |
| 10 #include "nacl_main.h" | 10 #include "nacl_main.h" |
| 11 | 11 |
| 12 #ifdef __x86_64__ | 12 #ifdef __x86_64__ |
| 13 #define NACL_ARCH "x86_64" | 13 #define NACL_ARCH "x86_64" |
| 14 #elif defined __i386__ | 14 #elif defined __i386__ |
| 15 /* | 15 /* |
| 16 * Use __i386__ rather then __i686__ since the latter is not defined | 16 * Use __i386__ rather then __i686__ since the latter is not defined |
| 17 * by i686-nacl-clang. | 17 * by i686-nacl-clang. |
| 18 */ | 18 */ |
| 19 #define NACL_ARCH "x86_32" | 19 #define NACL_ARCH "x86_32" |
| 20 #elif defined __arm__ | 20 #elif defined __arm__ |
| 21 #define NACL_ARCH "arm" | 21 #define NACL_ARCH "arm" |
| 22 #elif defined __pnacl__ | 22 #elif defined __pnacl__ |
| 23 #define NACL_ARCH "pnacl" | 23 #define NACL_ARCH "pnacl" |
| 24 #else | 24 #else |
| 25 #error "unknown arch" | 25 #error "unknown arch" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 #define DATA_ARCHIVE "rbdata-" NACL_ARCH ".tar" | 28 #define DATA_ARCHIVE "rbdata-" NACL_ARCH ".tar" |
| 29 | 29 |
| 30 int nacl_main(int argc, char** argv) { | 30 int main(int argc, char** argv) { |
| 31 if (nacl_startup_untar(argv[0], DATA_ARCHIVE, "/")) | 31 if (nacl_startup_untar(argv[0], DATA_ARCHIVE, "/")) |
| 32 return -1; | 32 return -1; |
| 33 | 33 |
| 34 if (argc == 2 && !strcmp(argv[1], "/bin/irb")) | 34 if (argc == 2 && !strcmp(argv[1], "/bin/irb")) |
| 35 fprintf(stderr, "Launching irb ...\n"); | 35 fprintf(stderr, "Launching irb ...\n"); |
| 36 ruby_sysinit(&argc, &argv); | 36 ruby_sysinit(&argc, &argv); |
| 37 { | 37 { |
| 38 RUBY_INIT_STACK; | 38 RUBY_INIT_STACK; |
| 39 ruby_init(); | 39 ruby_init(); |
| 40 return ruby_run_node(ruby_options(argc, argv)); | 40 return ruby_run_node(ruby_options(argc, argv)); |
| 41 } | 41 } |
| 42 } | 42 } |
| OLD | NEW |