Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Created by Accident] Fix Code Style #18501

Closed
wants to merge 76 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
8922bba
deps: update npm to 5.5.1
MylesBorins Oct 27, 2017
0ea8ff3
deps: backport 4ca695819 from npm upstream
MylesBorins Oct 27, 2017
237067d
deps: manually add 9.x support to npm
MylesBorins Oct 26, 2017
4fdd76d
http2: fix stream reading resumption
apapirovski Oct 29, 2017
ef238fb
v8: migrate setFlagsFromString to internal/errors
jasnell Oct 26, 2017
07d71c9
async_hooks: enable runtime checks by default
AndreasMadsen Oct 19, 2017
decb9e7
doc: add license information for remark-cli
MylesBorins Oct 31, 2017
ed92e0c
doc: add Gibson Fahnestock to Release team
gibfahn Oct 30, 2017
45873d2
module: revert #3384 DEP0019 EOL
MylesBorins Oct 31, 2017
daa286a
2017-10-31, Version 8.9.0 'Carbon' (LTS) Release
gibfahn Oct 31, 2017
fa9990f
2017-10-31, Version 9.0.0 (Current)
jasnell Sep 1, 2017
a933179
implement intialize(), tear_down(), process_events() for shared lib API
justus-hildebrand Dec 13, 2017
1906ddd
forgot to remove the node_lib include
justus-hildebrand Dec 18, 2017
f685a03
update ReadMe
justus-hildebrand Dec 18, 2017
8b01e1e
Update README.md
justus-hildebrand Dec 18, 2017
819c0f6
added nodelib interface v0.3
Dec 18, 2017
0280f31
Build on Travis (#6)
cmfcmf Dec 18, 2017
42a0104
revert changes made to node.cc and node.h
justus-hildebrand Jan 4, 2018
f4a5f64
Merge branch 'node_lib' of github.com:hpicgs/node into node_lib
justus-hildebrand Jan 4, 2018
d88e1d5
WIP: added more calling convenience
Jan 4, 2018
c9949a5
Renamed nodelib to node_lib
Jan 4, 2018
02493bb
Added Linux build commands to README
luminosuslight Jan 4, 2018
aa2c043
implement Terminate(), RequestTerminate(), RunEventLoop()
justus-hildebrand Jan 5, 2018
6ed7163
Short comments on what the Start() funcs do
justus-hildebrand Jan 5, 2018
2fae0db
Implemented Initialize(), Run() and Evaluate()
cmfcmf Jan 7, 2018
c01f4e5
Replace argc agrv in Initialize() with std::string
luminosuslight Jan 8, 2018
6acebd9
wip
msoechting Jan 8, 2018
4ad8cce
Cleaned code style (no indent for namespaces, left-lean asteriks, uni…
luminosuslight Jan 9, 2018
cc91ae3
Refactored cmd arg generation
luminosuslight Jan 9, 2018
4812646
Fixed cmd args
luminosuslight Jan 9, 2018
9a264ce
Moved code from Initialize() to new functions
luminosuslight Jan 9, 2018
ef6b4e5
Removed unused v8 argc argv
luminosuslight Jan 10, 2018
53f74b8
Implement remaining Call() methods
cmfcmf Jan 10, 2018
d5bb393
Re-add missing node.h include
cmfcmf Jan 14, 2018
d7d4b2b
Make RegisterModule work. Sadly, we can't use std::function|s, becaus…
cmfcmf Jan 14, 2018
f3e7a6d
fix issues from comments on PR #16
justus-hildebrand Jan 15, 2018
7a59273
Fix pointer to stack variable in register module
luminosuslight Jan 15, 2018
9175443
Use UV_RUN_NOWAIT, @justus-hildebrand
cmfcmf Jan 16, 2018
75f39b0
Merge branch 'interface-implementation' of github.com:hpicgs/node int…
cmfcmf Jan 16, 2018
674c0ee
add comments and TODOs for investigation
justus-hildebrand Jan 17, 2018
4e32b91
Implement `Deinitialize()` and `StopEventLoop()`
Jan 19, 2018
734d0d6
Don't read from stdin
cmfcmf Jan 19, 2018
0c575d5
Merge pull request #16 from hpicgs/interface-implementation
Jan 22, 2018
b945ac7
WIP usage
msoechting Jan 22, 2018
78329e0
Update usage documentation
msoechting Jan 22, 2018
6ea63e2
added code docu
Jan 22, 2018
a323279
refactored internals
Jan 24, 2018
6126411
Option to auto-call process.binding() when calling RegisterModule() (…
justus-hildebrand Jan 24, 2018
0ee4348
Rename getters to match style guide
cmfcmf Jan 29, 2018
200c1a9
added error handling via MaybeLocal (#40)
Jan 29, 2018
ee01950
Add support for cmd args (#39)
luminosuslight Jan 29, 2018
d7c8a33
Merge branch 'node_lib' into expose_internals
cmfcmf Jan 29, 2018
22a3107
Update README.md
EmberFlare Jan 29, 2018
5e7adc7
Merge branch 'node_lib' into expose_internals
EmberFlare Jan 29, 2018
e582066
early check for uv_loop_alive(), small refactoring
justus-hildebrand Jan 29, 2018
25211e6
Merge pull request #41 from hpicgs/expose_internals
Jan 30, 2018
6854d8f
changed the way internals are exposed.
Jan 30, 2018
807709d
included feedback from PR
Jan 30, 2018
c51f3f6
Fix method names
luminosuslight Jan 30, 2018
c5c73ff
fix nits
justus-hildebrand Jan 30, 2018
2bb42fb
Merge branch 'node_lib' into tick-event-loop-early-exit
justus-hildebrand Jan 30, 2018
ecee92a
Merge pull request #46 from hpicgs/tick-event-loop-early-exit
luminosuslight Jan 30, 2018
588ab28
moved 'EventLoopIsRunning' back to node::lib
Jan 30, 2018
b607c9f
Merge branch 'node_lib' into expose_internals
justus-hildebrand Jan 30, 2018
5539564
Merge pull request #47 from hpicgs/expose_internals
Jan 31, 2018
40baf2c
Merge branch 'node_lib' into lib-usage-documentation
EmberFlare Jan 31, 2018
e693ecf
added code docu
Jan 22, 2018
0ed0c77
included feedback from PR
Jan 30, 2018
2e6b1ff
fixed merge problems, added more docu for new methods
Jan 31, 2018
c913d75
Merge remote-tracking branch 'origin/interface_docu' into interface_docu
Jan 31, 2018
9c6bf17
Merge pull request #37 from hpicgs/interface_docu
EmberFlare Jan 31, 2018
cac4d43
Merge branch 'node_lib' into lib-usage-documentation
EmberFlare Jan 31, 2018
fd520a7
Merge pull request #35 from hpicgs/lib-usage-documentation
EmberFlare Jan 31, 2018
fe6a38a
Start fixing code style
luminosuslight Feb 1, 2018
334c3a6
Fix more code style, left leaning asterisks
luminosuslight Feb 1, 2018
f45be81
Fix C style cast
luminosuslight Feb 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
msoechting committed Jan 8, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 6acebd9b950c5a7ad729f7ee922bbe0915ca6501
6 changes: 3 additions & 3 deletions src/node.cc
Original file line number Diff line number Diff line change
@@ -5013,8 +5013,8 @@ namespace lib {
// we do not support additional commandline options for node, uv, or v8
// we explicitily only set the first argument to the program name
int argc = 1;
std::string* program_name_on_heap = new std::string(program_name);
char* program_name_c_string = const_cast<char*>(program_name_on_heap->c_str());
char *program_name_c_string = new char[program_name.length() + 1];
std::strcpy(program_name_c_string, program_name.c_str());
char** argv = &program_name_c_string;

// Hack around with the argv pointer. Used for process.title = "blah".
@@ -5220,7 +5220,7 @@ namespace lib {
}
Local<v8::Function> _func = v8::Local<v8::Function>::Cast(value);

_func->Call(object, 1, const_cast<v8::Local<v8::Value>*>(&args[0]));
return _func->Call(object, 1, const_cast<v8::Local<v8::Value>*>(&args[0]));
}

// TODO: Node.js has exceptions disabled.
31 changes: 16 additions & 15 deletions src/node_lib.h
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
#include <functional>
#include <initializer_list>
#include "v8.h"
#include "node.h"

namespace node { namespace lib {
void _StartEnv(int argc,
@@ -50,7 +51,7 @@ namespace node { namespace lib {
*Important*: Node.js has to have been initialized by calling Initialize().
*/

v8::Local<v8::Value> Run(const std::string & path);
NODE_EXTERN v8::Local<v8::Value> Run(const std::string & path);

/*********************************************************
* Handle JavaScript events
@@ -59,14 +60,14 @@ namespace node { namespace lib {
/*
Processes the pending event queue of a *running* Node.js engine once.
*/
bool ProcessEvents();
NODE_EXTERN bool ProcessEvents();

/*
Starts the execution of the Node.js event loop, which processes any events in JavaScript.
Additionally, the given callback will be executed once per main loop run.
*Important*: Call `initialize()` before using this method.
*/
void RunEventLoop(const RunUserLoop & callback);
NODE_EXTERN void RunEventLoop(const RunUserLoop & callback);


/*********************************************************
@@ -76,13 +77,13 @@ namespace node { namespace lib {
/*
Sends termination event into event queue and runs event queue, until all events have been handled.
*/
void Terminate();
NODE_EXTERN void Terminate();


/*
Stops the *running* Node.js engine. Clears all events and puts Node.js into idle.
*/
void RequestTerminate();
NODE_EXTERN void RequestTerminate();

/*********************************************************
* Basic operations
@@ -91,22 +92,22 @@ namespace node { namespace lib {
/*
Executes a given piece of JavaScript code, using the *running* Node.js engine.
*/
v8::Local<v8::Value> Evaluate(const std::string & java_script_code);
NODE_EXTERN v8::Local<v8::Value> Evaluate(const std::string & java_script_code);

/*
Returns the JavaScript root object for the running application
*/
v8::Local<v8::Object> GetRootObject();
NODE_EXTERN v8::Local<v8::Object> GetRootObject();

/*
Registers a C++ module in the *running* Node.js engine.
*/
bool RegisterModule(const std::string & name, const CppModule & callback);
NODE_EXTERN bool RegisterModule(const std::string & name, const CppModule & callback);

/*
Registers a C++ module in the *running* Node.js engine exporting the given set of functions.
*/
bool RegisterModule(const std::string & name,
NODE_EXTERN bool RegisterModule(const std::string & name,
const std::map<std::string, ModuleFunction> & module_functions);


@@ -117,34 +118,34 @@ namespace node { namespace lib {
/*
Adds a new JavaScript module to the *running* Node.js engine.
*/
v8::Local<v8::Object> IncludeModule(const std::string & modul_name);
NODE_EXTERN v8::Local<v8::Object> IncludeModule(const std::string & modul_name);

/*
Returns the local value (specified by its name) of the module (defined in the `exports`-object).
*/
v8::MaybeLocal<v8::Value> GetValue(v8::MaybeLocal<v8::Object> object, const std::string & value_name);
NODE_EXTERN v8::MaybeLocal<v8::Value> GetValue(v8::MaybeLocal<v8::Object> object, const std::string & value_name);

/*
Calls a function (specified by its name) on a given object passing the given arguments.
*Important*: Throws an exception if the receiver does not define the specified function.
*/
v8::Local<v8::Value> Call(v8::Local<v8::Object> object, const std::string & function_name, const std::vector<v8::Local<v8::Value>> & args = {});
NODE_EXTERN v8::Local<v8::Value> Call(v8::Local<v8::Object> object, const std::string & function_name, const std::vector<v8::Local<v8::Value>> & args = {});

/*
Calls a function (specified by its name) on a given object passing the given arguments.
*Important*: Throws an exception if the receiver does not define the specified function.
*/
v8::Local<v8::Value> Call(v8::MaybeLocal<v8::Object> object, const std::string & function_name, std::initializer_list<v8::MaybeLocal<v8::Value>> args);
NODE_EXTERN v8::Local<v8::Value> Call(v8::MaybeLocal<v8::Object> object, const std::string & function_name, std::initializer_list<v8::MaybeLocal<v8::Value>> args);

/*
Calls a given function on a given receiver passing the given arguments.
*Important*: The amount of arguments can be changed at runtime (for JS var arg functions).
*/
v8::Local<v8::Value> Call(v8::MaybeLocal<v8::Object> receiver, v8::MaybeLocal<v8::Function> function, const std::vector<v8::MaybeLocal<v8::Value>> & args = {});
NODE_EXTERN v8::Local<v8::Value> Call(v8::MaybeLocal<v8::Object> receiver, v8::MaybeLocal<v8::Function> function, const std::vector<v8::MaybeLocal<v8::Value>> & args = {});

/*
Calls a given function on a given receiver passing the given arguments.
*Important*: The amount of arguments must be known at compile time.
*/
v8::Local<v8::Value> Call(v8::MaybeLocal<v8::Object> receiver, v8::MaybeLocal<v8::Function> function, std::initializer_list<v8::MaybeLocal<v8::Value>> args);
NODE_EXTERN v8::Local<v8::Value> Call(v8::MaybeLocal<v8::Object> receiver, v8::MaybeLocal<v8::Function> function, std::initializer_list<v8::MaybeLocal<v8::Value>> args);
}}