GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bindings: adding process.binding('builtins') method by thlorenz · Pull Request #2180 · nodejs/node

bindings: adding process.binding('builtins') method #2180

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.

Sign up for GitHub

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

Closed
thlorenz wants to merge 2 commits into nodejs:master from thlorenz:resolve-builtins

Uh oh!

There was an error while loading. Please reload this page.

Closed

bindings: adding process.binding('builtins') method #2180

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
4d5011a
bindings: adding process.binding('builtins') method
thlorenz Jul 14, 2015
5651e0c
fixup! bindings: adding process.binding('builtins') method
thlorenz Jul 15, 2015
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Next Next commit
bindings: adding process.binding('builtins') method
- this method traverses the `modlist_builtin` linked list and returns an
  object which has binding names as keys and their versions as values
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@thlorenz
thlorenz committed Jul 14, 2015
commit 4d5011a5b320e73ca646f4ef7eaa5f86c1c562ec

There are no files selected for viewing

2 changes: 2 additions & 0 deletions 2 node.gyp
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
'src/js_stream.cc',
'src/node.cc',
'src/node_buffer.cc',
'src/node_builtins.cc',
'src/node_constants.cc',
'src/node_contextify.cc',
'src/node_file.cc',
Expand Down Expand Up @@ -146,6 +147,7 @@
'src/js_stream.h',
'src/node.h',
'src/node_buffer.h',
'src/node_builtins.h',
'src/node_constants.h',
'src/node_file.h',
'src/node_http_parser.h',
Expand Down
5 changes: 5 additions & 0 deletions 5 src/node.cc
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "node.h"
#include "node_buffer.h"
#include "node_builtins.h"
#include "node_constants.h"
#include "node_file.h"
#include "node_http_parser.h"
Expand Down Expand Up @@ -2281,6 +2282,10 @@ static void Binding(const FunctionCallbackInfo<Value>& args) {
exports = Object::New(env->isolate());
DefineJavaScript(env, exports);
cache->Set(module, exports);
} else if (!strcmp(*module_v, "builtins")) {
exports = Object::New(env->isolate());
DefineBuiltins(env, exports, modlist_builtin);
cache->Set(module, exports);
} else {
char errmsg[1024];
snprintf(errmsg,
Expand Down
28 changes: 28 additions & 0 deletions 28 src/node_builtins.cc
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "node.h"
#include "v8.h"
#include "env.h"
#include "env-inl.h"

namespace node {

using v8::Handle;
using v8::HandleScope;
using v8::Integer;
using v8::Local;
using v8::Object;
using v8::String;

void DefineBuiltins(Environment* env,
Handle<Object> target,
node_module* builtins) {
HandleScope scope(env->isolate());
struct node_module* mp;

for (mp = builtins; mp != nullptr; mp = mp->nm_link) {
Local<String> name = String::NewFromUtf8(env->isolate(), mp->nm_modname);
Local<Integer> version = Integer::New(env->isolate(), mp->nm_version);
target->Set(name, version);
}
}

} // namespace node
15 changes: 15 additions & 0 deletions 15 src/node_builtins.h
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef SRC_NODE_BUILTINS_H_
#define SRC_NODE_BUILTINS_H_

#include "v8.h"
#include "env.h"

namespace node {

void DefineBuiltins(Environment* env,
v8::Handle<v8::Object> target,
node_module* builtins);

} // namespace node

#endif // SRC_NODE_BUILTINS_H_
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.