From 4b234df8034182d16f39f82fdccba7699fdf0937 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 23 Jun 2018 09:42:06 +0200 Subject: Rename deno_rs to deno. --- src/BUILD.gn | 6 +++--- src/main.cc | 58 -------------------------------------------------------- src/mock_main.cc | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 61 deletions(-) delete mode 100644 src/main.cc create mode 100644 src/mock_main.cc (limited to 'src') diff --git a/src/BUILD.gn b/src/BUILD.gn index c433bda26..09ce945bb 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -8,7 +8,7 @@ config("deno_config") { configs = [ "v8:external_config" ] } -rust_executable("deno_rs") { +rust_executable("deno") { source_root = "main.rs" rust_deps = [ ":libc" ] deps = [ @@ -24,9 +24,9 @@ rust_library("libc") { ] } -executable("deno") { +executable("mock_main") { sources = [ - "main.cc", + "mock_main.cc", ] deps = [ ":libdeno", diff --git a/src/main.cc b/src/main.cc deleted file mode 100644 index 2a10b8820..000000000 --- a/src/main.cc +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2018 Ryan Dahl -// All rights reserved. MIT License. -#include -#include -#include - -#ifdef _WIN32 -#include -#else -#include -#endif - -#include "./msg.pb.h" -#include "include/deno.h" -#include "v8/src/base/logging.h" - -static char** global_argv; -static int global_argc; - -void MessagesFromJS(Deno* d, const char* channel, deno_buf buf) { - printf("MessagesFromJS %s\n", channel); - - deno::Msg response; - response.set_command(deno::Msg_Command_START); - - char cwdbuf[1024]; - // TODO(piscisaureus): support unicode on windows. - std::string cwd(getcwd(cwdbuf, sizeof(cwdbuf))); - response.set_start_cwd(cwd); - - for (int i = 0; i < global_argc; ++i) { - printf("arg %d %s\n", i, global_argv[i]); - response.add_start_argv(global_argv[i]); - } - printf("response.start_argv_size %d \n", response.start_argv_size()); - - std::string output; - CHECK(response.SerializeToString(&output)); - - deno_buf bufout{output.c_str(), output.length()}; - deno_set_response(d, bufout); -} - -int main(int argc, char** argv) { - deno_init(); - - deno_set_flags(&argc, argv); - global_argv = argv; - global_argc = argc; - - Deno* d = deno_new(NULL, MessagesFromJS); - bool r = deno_execute(d, "deno_main.js", "denoMain();"); - if (!r) { - printf("Error! %s\n", deno_last_exception(d)); - exit(1); - } - deno_delete(d); -} diff --git a/src/mock_main.cc b/src/mock_main.cc new file mode 100644 index 000000000..2a10b8820 --- /dev/null +++ b/src/mock_main.cc @@ -0,0 +1,58 @@ +// Copyright 2018 Ryan Dahl +// All rights reserved. MIT License. +#include +#include +#include + +#ifdef _WIN32 +#include +#else +#include +#endif + +#include "./msg.pb.h" +#include "include/deno.h" +#include "v8/src/base/logging.h" + +static char** global_argv; +static int global_argc; + +void MessagesFromJS(Deno* d, const char* channel, deno_buf buf) { + printf("MessagesFromJS %s\n", channel); + + deno::Msg response; + response.set_command(deno::Msg_Command_START); + + char cwdbuf[1024]; + // TODO(piscisaureus): support unicode on windows. + std::string cwd(getcwd(cwdbuf, sizeof(cwdbuf))); + response.set_start_cwd(cwd); + + for (int i = 0; i < global_argc; ++i) { + printf("arg %d %s\n", i, global_argv[i]); + response.add_start_argv(global_argv[i]); + } + printf("response.start_argv_size %d \n", response.start_argv_size()); + + std::string output; + CHECK(response.SerializeToString(&output)); + + deno_buf bufout{output.c_str(), output.length()}; + deno_set_response(d, bufout); +} + +int main(int argc, char** argv) { + deno_init(); + + deno_set_flags(&argc, argv); + global_argv = argv; + global_argc = argc; + + Deno* d = deno_new(NULL, MessagesFromJS); + bool r = deno_execute(d, "deno_main.js", "denoMain();"); + if (!r) { + printf("Error! %s\n", deno_last_exception(d)); + exit(1); + } + deno_delete(d); +} -- cgit v1.2.3