| OLD | NEW |
| 1 /* Copyright (c) 2014 Google Inc. All rights reserved. | 1 /* Copyright (c) 2014 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 #include <python2.7/Python.h> | 5 #include <python2.7/Python.h> |
| 6 #include <libtar.h> | 6 #include <libtar.h> |
| 7 #include <locale.h> | 7 #include <locale.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <sys/mount.h> | 10 #include <sys/mount.h> |
| 11 #include <errno.h> | 11 #include <errno.h> |
| 12 | 12 |
| 13 #include "ppapi/cpp/var.h" | 13 #include <ppapi/cpp/var.h> |
| 14 #include "ppapi/cpp/var_array.h" | 14 #include <ppapi/cpp/var_array.h> |
| 15 #include "ppapi/cpp/var_dictionary.h" | 15 #include <ppapi/cpp/var_dictionary.h> |
| 16 #include "ppapi_simple/ps_interface.h" | 16 #include <ppapi_simple/ps_interface.h> |
| 17 | 17 |
| 18 #include "nacl_io/nacl_io.h" | 18 #include <nacl_io/nacl_io.h> |
| 19 #include "ppapi_simple/ps_main.h" | 19 #include <ppapi_simple/ps_instance.h> |
| 20 #include "ppapi_simple/ps_instance.h" | 20 #include <ppapi_simple/ps_main.h> |
| 21 | 21 |
| 22 #ifdef __pnacl__ | 22 #ifdef __pnacl__ |
| 23 #define DATA_FILE "pydata_pnacl.tar" | 23 #define DATA_FILE "pydata_pnacl.tar" |
| 24 #else | 24 #else |
| 25 #error "Unknown arch" | 25 #error "Unknown arch" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 /* TODO(bradnelson): Switch ipython to use cli_main and drop this. */ | 28 /* TODO(bradnelson): Switch ipython to use cli_main and drop this. */ |
| 29 | 29 |
| 30 static int setup_unix_environment() { | 30 static int setup_unix_environment() { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 "Post a message encoded as JSON" | 138 "Post a message encoded as JSON" |
| 139 }, | 139 }, |
| 140 { | 140 { |
| 141 "_AcquireJSONMessageWait", | 141 "_AcquireJSONMessageWait", |
| 142 acquire_json_message_wait, | 142 acquire_json_message_wait, |
| 143 METH_VARARGS, | 143 METH_VARARGS, |
| 144 "Acquire a message encoded as JSON (blocking)"}, | 144 "Acquire a message encoded as JSON (blocking)"}, |
| 145 {NULL, NULL, 0, NULL} | 145 {NULL, NULL, 0, NULL} |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 int ipython_kernel_main(int argc, char **argv) { | 148 int main(int argc, char **argv) { |
| 149 printf("Setting up unix environment...\n"); | 149 printf("Setting up unix environment...\n"); |
| 150 if (setup_unix_environment()) { | 150 if (setup_unix_environment()) { |
| 151 printf("Error: %s\n", strerror(errno)); | 151 printf("Error: %s\n", strerror(errno)); |
| 152 return -1; | 152 return -1; |
| 153 } | 153 } |
| 154 printf("done\n"); | 154 printf("done\n"); |
| 155 | 155 |
| 156 // Initialize Pepper API | 156 // Initialize Pepper API |
| 157 PSInterfaceInit(); | 157 PSInterfaceInit(); |
| 158 | 158 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 174 return -1; | 174 return -1; |
| 175 } | 175 } |
| 176 | 176 |
| 177 quit = PyRun_SimpleFileEx(main, main_filename, 1); | 177 quit = PyRun_SimpleFileEx(main, main_filename, 1); |
| 178 | 178 |
| 179 Py_Finalize(); | 179 Py_Finalize(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 return 0; | 182 return 0; |
| 183 } | 183 } |
| 184 | |
| 185 PPAPI_SIMPLE_REGISTER_MAIN(ipython_kernel_main) | |
| OLD | NEW |