| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 #include <pthread.h> | 6 #include <pthread.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "include/fletch_api.h" | 9 #include "include/dartino_api.h" |
| 10 #include "include/service_api.h" | 10 #include "include/service_api.h" |
| 11 #include "generated/cc/simple_todo.h" | 11 #include "generated/cc/simple_todo.h" |
| 12 | 12 |
| 13 typedef enum { | 13 typedef enum { |
| 14 EC_OK = 0, | 14 EC_OK = 0, |
| 15 EC_THREAD, | 15 EC_THREAD, |
| 16 EC_INPUT_ERR, | 16 EC_INPUT_ERR, |
| 17 } ErrorCode; | 17 } ErrorCode; |
| 18 | 18 |
| 19 static void* StartFletch(void* arg) { | 19 static void* StartDartino(void* arg) { |
| 20 char* snapshot_filepath_with_name = reinterpret_cast<char*>(arg); | 20 char* snapshot_filepath_with_name = reinterpret_cast<char*>(arg); |
| 21 | 21 |
| 22 FletchSetup(); | 22 DartinoSetup(); |
| 23 FletchRunSnapshotFromFile(snapshot_filepath_with_name); | 23 DartinoRunSnapshotFromFile(snapshot_filepath_with_name); |
| 24 FletchTearDown(); | 24 DartinoTearDown(); |
| 25 | 25 |
| 26 return NULL; | 26 return NULL; |
| 27 } | 27 } |
| 28 | 28 |
| 29 static void StartVmThread(char* snapshot_filename) { | 29 static void StartVmThread(char* snapshot_filename) { |
| 30 pthread_t tid = 0; | 30 pthread_t tid = 0; |
| 31 int result = pthread_create(&tid, 0, StartFletch, | 31 int result = pthread_create(&tid, 0, StartDartino, |
| 32 reinterpret_cast<void*>(snapshot_filename)); | 32 reinterpret_cast<void*>(snapshot_filename)); |
| 33 if (result != 0) { | 33 if (result != 0) { |
| 34 printf("Error creating thread\n"); | 34 printf("Error creating thread\n"); |
| 35 exit(EC_THREAD); | 35 exit(EC_THREAD); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 class TodoListView { | 39 class TodoListView { |
| 40 public: | 40 public: |
| 41 void showMenu() { | 41 void showMenu() { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 int main(int argc, char** argv) { | 172 int main(int argc, char** argv) { |
| 173 if (argc < 2) { | 173 if (argc < 2) { |
| 174 printf("Usage: %s <snapshot file>\n", argv[0]); | 174 printf("Usage: %s <snapshot file>\n", argv[0]); |
| 175 return EC_OK; | 175 return EC_OK; |
| 176 } | 176 } |
| 177 | 177 |
| 178 ServiceApiSetup(); | 178 ServiceApiSetup(); |
| 179 StartVmThread(argv[1]); | 179 StartVmThread(argv[1]); |
| 180 return InteractWithService(); | 180 return InteractWithService(); |
| 181 } | 181 } |
| OLD | NEW |