Index: src/vm/dartino_api_impl.cc |
diff --git a/src/vm/fletch_api_impl.cc b/src/vm/dartino_api_impl.cc |
similarity index 53% |
rename from src/vm/fletch_api_impl.cc |
rename to src/vm/dartino_api_impl.cc |
index ad8051200743b0e77603553dbee303a631dd2876..6a9051abb3a90b103063e29e8abda46d37a39b2e 100644 |
--- a/src/vm/fletch_api_impl.cc |
+++ b/src/vm/dartino_api_impl.cc |
@@ -4,13 +4,13 @@ |
#include <stdlib.h> |
-#include "src/vm/fletch_api_impl.h" |
+#include "src/vm/dartino_api_impl.h" |
#include "src/shared/assert.h" |
-#ifdef FLETCH_ENABLE_LIVE_CODING |
+#ifdef DARTINO_ENABLE_LIVE_CODING |
#include "src/shared/connection.h" |
#endif |
-#include "src/shared/fletch.h" |
+#include "src/shared/dartino.h" |
#include "src/shared/list.h" |
#include "src/vm/ffi.h" |
@@ -21,7 +21,7 @@ |
#include "src/vm/session.h" |
#include "src/vm/snapshot.h" |
-namespace fletch { |
+namespace dartino { |
class PrintInterceptorImpl : public PrintInterceptor { |
public: |
@@ -50,9 +50,9 @@ static Program* LoadSnapshot(List<uint8> bytes) { |
} |
static int RunProgram(Program* program) { |
-#ifdef FLETCH_ENABLE_LIVE_CODING |
+#ifdef DARTINO_ENABLE_LIVE_CODING |
ProgramFolder::FoldProgramByDefault(program); |
-#endif // FLETCH_ENABLE_LIVE_CODING |
+#endif // DARTINO_ENABLE_LIVE_CODING |
SimpleProgramRunner runner; |
@@ -66,9 +66,9 @@ static int RunProgram(Program* program) { |
static void StartProgram(Program* program, |
ProgramExitListener listener, |
void* data) { |
-#ifdef FLETCH_ENABLE_LIVE_CODING |
+#ifdef DARTINO_ENABLE_LIVE_CODING |
ProgramFolder::FoldProgramByDefault(program); |
-#endif // FLETCH_ENABLE_LIVE_CODING |
+#endif // DARTINO_ENABLE_LIVE_CODING |
program->SetProgramExitListener(listener, data); |
Process* process = program->ProcessSpawnForMain(); |
@@ -90,7 +90,7 @@ static void RunSnapshotFromFile(const char* path) { |
} |
static void WaitForDebuggerConnection(int port) { |
-#ifdef FLETCH_ENABLE_LIVE_CODING |
+#ifdef DARTINO_ENABLE_LIVE_CODING |
ConnectionListener listener("127.0.0.1", port); |
Connection* connection = listener.Accept(); |
Session session(connection); |
@@ -99,104 +99,105 @@ static void WaitForDebuggerConnection(int port) { |
bool success = session.ProcessRun() == 0; |
if (!success) FATAL("Failed to run via debugger connection"); |
#else |
- FATAL("fletch was built without live coding support."); |
+ FATAL("dartino was built without live coding support."); |
#endif |
} |
-} // namespace fletch |
+} // namespace dartino |
-void FletchSetup() { fletch::Fletch::Setup(); } |
+void DartinoSetup() { dartino::Dartino::Setup(); } |
-void FletchTearDown() { fletch::Fletch::TearDown(); } |
+void DartinoTearDown() { dartino::Dartino::TearDown(); } |
-void FletchWaitForDebuggerConnection(int port) { |
- fletch::WaitForDebuggerConnection(port); |
+void DartinoWaitForDebuggerConnection(int port) { |
+ dartino::WaitForDebuggerConnection(port); |
} |
-FletchProgram FletchLoadSnapshotFromFile(const char* path) { |
- fletch::Program* program = fletch::LoadSnapshotFromFile(path); |
+DartinoProgram DartinoLoadSnapshotFromFile(const char* path) { |
+ dartino::Program* program = dartino::LoadSnapshotFromFile(path); |
if (program == NULL) FATAL("Failed to load snapshot from file.\n"); |
- return reinterpret_cast<FletchProgram>(program); |
+ return reinterpret_cast<DartinoProgram>(program); |
} |
-FletchProgram FletchLoadSnapshot(unsigned char* snapshot, int length) { |
- fletch::List<uint8> bytes(snapshot, length); |
- fletch::Program* program = fletch::LoadSnapshot(bytes); |
+DartinoProgram DartinoLoadSnapshot(unsigned char* snapshot, int length) { |
+ dartino::List<uint8> bytes(snapshot, length); |
+ dartino::Program* program = dartino::LoadSnapshot(bytes); |
if (program == NULL) FATAL("Failed to load snapshot.\n"); |
- return reinterpret_cast<FletchProgram>(program); |
+ return reinterpret_cast<DartinoProgram>(program); |
} |
-int FletchRunMain(FletchProgram raw_program) { |
- fletch::Program* program = reinterpret_cast<fletch::Program*>(raw_program); |
- return fletch::RunProgram(program); |
+int DartinoRunMain(DartinoProgram raw_program) { |
+ dartino::Program* program = reinterpret_cast<dartino::Program*>(raw_program); |
+ return dartino::RunProgram(program); |
} |
-void FletchRunMultipleMain(int count, |
- FletchProgram* fletch_programs, |
+void DartinoRunMultipleMain(int count, |
+ DartinoProgram* dartino_programs, |
int* exitcodes) { |
- fletch::SimpleProgramRunner runner; |
+ dartino::SimpleProgramRunner runner; |
- auto programs = reinterpret_cast<fletch::Program**>(fletch_programs); |
+ auto programs = reinterpret_cast<dartino::Program**>(dartino_programs); |
for (int i = 0; i < count; i++) { |
exitcodes[i] = -1; |
-#ifdef FLETCH_ENABLE_LIVE_CODING |
- fletch::ProgramFolder::FoldProgramByDefault(programs[i]); |
-#endif // FLETCH_ENABLE_LIVE_CODING |
+#ifdef DARTINO_ENABLE_LIVE_CODING |
+ dartino::ProgramFolder::FoldProgramByDefault(programs[i]); |
+#endif // DARTINO_ENABLE_LIVE_CODING |
} |
runner.Run(count, exitcodes, programs); |
} |
-FletchProgram FletchLoadProgramFromFlash(void* heap, size_t size) { |
- fletch::Program* program = |
- new fletch::Program(fletch::Program::kLoadedFromSnapshot); |
+DartinoProgram DartinoLoadProgramFromFlash(void* heap, size_t size) { |
+ dartino::Program* program = |
+ new dartino::Program(dartino::Program::kLoadedFromSnapshot); |
uword address = reinterpret_cast<uword>(heap); |
// The info block is appended at the end of the image. |
- size_t heap_size = size - sizeof(fletch::ProgramInfoBlock); |
+ size_t heap_size = size - sizeof(dartino::ProgramInfoBlock); |
uword block_address = address + heap_size; |
- fletch::ProgramInfoBlock* program_info = |
- reinterpret_cast<fletch::ProgramInfoBlock*>(block_address); |
+ dartino::ProgramInfoBlock* program_info = |
+ reinterpret_cast<dartino::ProgramInfoBlock*>(block_address); |
program_info->WriteToProgram(program); |
- fletch::Chunk* memory = fletch::ObjectMemory::CreateFlashChunk( |
+ dartino::Chunk* memory = dartino::ObjectMemory::CreateFlashChunk( |
program->heap()->space(), heap, heap_size); |
program->heap()->space()->Append(memory); |
program->heap()->space()->SetReadOnly(); |
- return reinterpret_cast<FletchProgram>(program); |
+ return reinterpret_cast<DartinoProgram>(program); |
} |
-FLETCH_EXPORT void FletchStartMain(FletchProgram raw_program, |
+DARTINO_EXPORT void DartinoStartMain(DartinoProgram raw_program, |
ProgramExitCallback callback, |
void* callback_data) { |
- fletch::Program* program = reinterpret_cast<fletch::Program*>(raw_program); |
- fletch::ProgramExitListener listener = |
- reinterpret_cast<fletch::ProgramExitListener>(callback); |
- fletch::StartProgram(program, listener, callback_data); |
+ dartino::Program* program = reinterpret_cast<dartino::Program*>(raw_program); |
+ dartino::ProgramExitListener listener = |
+ reinterpret_cast<dartino::ProgramExitListener>(callback); |
+ dartino::StartProgram(program, listener, callback_data); |
} |
-void FletchDeleteProgram(FletchProgram raw_program) { |
- fletch::Program* program = reinterpret_cast<fletch::Program*>(raw_program); |
+void DartinoDeleteProgram(DartinoProgram raw_program) { |
+ dartino::Program* program = reinterpret_cast<dartino::Program*>(raw_program); |
delete program; |
} |
-void FletchRunSnapshotFromFile(const char* path) { |
- fletch::RunSnapshotFromFile(path); |
+void DartinoRunSnapshotFromFile(const char* path) { |
+ dartino::RunSnapshotFromFile(path); |
} |
-bool FletchAddDefaultSharedLibrary(const char* library) { |
- return fletch::ForeignFunctionInterface::AddDefaultSharedLibrary(library); |
+bool DartinoAddDefaultSharedLibrary(const char* library) { |
+ return dartino::ForeignFunctionInterface::AddDefaultSharedLibrary(library); |
} |
-FletchPrintInterceptor FletchRegisterPrintInterceptor( |
+DartinoPrintInterceptor DartinoRegisterPrintInterceptor( |
PrintInterceptionFunction function, void* data) { |
- fletch::PrintInterceptorImpl* impl = |
- new fletch::PrintInterceptorImpl(function, data); |
- fletch::Print::RegisterPrintInterceptor(impl); |
+ dartino::PrintInterceptorImpl* impl = |
+ new dartino::PrintInterceptorImpl(function, data); |
+ dartino::Print::RegisterPrintInterceptor(impl); |
return reinterpret_cast<void*>(impl); |
} |
-void FletchUnregisterPrintInterceptor(FletchPrintInterceptor raw_interceptor) { |
- fletch::PrintInterceptorImpl* impl = |
- reinterpret_cast<fletch::PrintInterceptorImpl*>(raw_interceptor); |
- fletch::Print::UnregisterPrintInterceptor(impl); |
+void DartinoUnregisterPrintInterceptor( |
+ DartinoPrintInterceptor raw_interceptor) { |
+ dartino::PrintInterceptorImpl* impl = |
+ reinterpret_cast<dartino::PrintInterceptorImpl*>(raw_interceptor); |
+ dartino::Print::UnregisterPrintInterceptor(impl); |
delete impl; |
} |