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

0.8.1-wip #64

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .dntrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

NODE_VERSIONS="\
master \
v0.11.11 \
v0.11.10 \
v0.11.9 \
v0.11.8 \
Expand Down
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test/
examples/
.travis.yml
.npmignore
.npmignore
Makefile
cpplint.py
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
TOPLEVEL ?= $(dir $(lastword $(MAKEFILE_LIST)))
CPPLINT ?= $(TOPLEVEL)/cpplint.py
PYTHON ?= python

SOURCES = \
examples/async_pi_estimate/addon.cc \
examples/async_pi_estimate/async.cc \
examples/async_pi_estimate/async.h \
examples/async_pi_estimate/pi_est.cc \
examples/async_pi_estimate/pi_est.h \
examples/async_pi_estimate/sync.cc \
examples/async_pi_estimate/sync.h \
nan.h \
test/cpp/asyncworker.cpp \
test/cpp/fromv8string.cpp \
test/cpp/multifile1.cpp \
test/cpp/multifile2.cpp \
test/cpp/multifile2.h \
test/cpp/optionvalues.cpp \
test/cpp/persistent.cpp \
test/cpp/returnemptystring.cpp \
test/cpp/returnnull.cpp \
test/cpp/returnundefined.cpp \
test/cpp/returnvalue.cpp \
test/cpp/settergetter.cpp \
test/cpp/symbols.cpp \
test/cpp/weak.cpp \
test/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc \

FILTER = -whitespace/parens

.PHONY: lint

lint:
cd $(TOPLEVEL) && $(PYTHON) $(CPPLINT) --filter=$(FILTER) $(SOURCES)
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Simply add **NAN** as a dependency in the *package.json* of your Node addon:
$ npm install --save nan
```

Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include "nan.h"` in your *.cpp* files:
Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include <nan.h>` in your *.cpp* files:

``` python
"include_dirs" : [
Expand All @@ -66,10 +66,12 @@ Note that there is no embedded version sniffing going on here and also the async
```c++
// addon.cc
#include <node.h>
#include "nan.h"
#include <nan.h>
// ...

using namespace v8;
using v8::FunctionTemplate;
using v8::Handle;
using v8::Object;

void InitAll(Handle<Object> exports) {
exports->Set(NanSymbol("calculateSync"),
Expand All @@ -85,19 +87,19 @@ NODE_MODULE(addon, InitAll)
```c++
// sync.h
#include <node.h>
#include "nan.h"
#include <nan.h>

NAN_METHOD(CalculateSync);
```

```c++
// sync.cc
#include <node.h>
#include "nan.h"
#include "sync.h"
#include <nan.h>
#include "./sync.h"
// ...

using namespace v8;
using v8::Number;

// Simple synchronous access to the `Estimate()` function
NAN_METHOD(CalculateSync) {
Expand All @@ -114,12 +116,16 @@ NAN_METHOD(CalculateSync) {
```c++
// async.cc
#include <node.h>
#include "nan.h"
#include "async.h"
#include <nan.h>
#include "./async.h"

// ...

using namespace v8;
using v8::Function;
using v8::Local;
using v8::Null;
using v8::Number;
using v8::Value;

class PiWorker : public NanAsyncWorker {
public:
Expand All @@ -142,7 +148,7 @@ class PiWorker : public NanAsyncWorker {
NanScope();

Local<Value> argv[] = {
Local<Value>::New(Null())
NanNewLocal(Null())
, Number::New(estimate)
};

Expand Down Expand Up @@ -529,7 +535,7 @@ char *plugh(uint32_t *optional) {
<a name="api_nan_set_pointer_safe"></a>
### bool NanSetPointerSafe(Type *, Type)

A helper for setting optional argument pointers. If the pointer is `NULL`, the function simply return `false`. Otherwise, the value is assigned to the variable the pointer points to.
A helper for setting optional argument pointers. If the pointer is `NULL`, the function simply returns `false`. Otherwise, the value is assigned to the variable the pointer points to.

```c++
const char *plugh(size_t *outputsize) {
Expand Down Expand Up @@ -813,6 +819,6 @@ NAN is only possible due to the excellent work of the following contributors:
Licence &amp; copyright
-----------------------

Copyright (c) 2013 NAN contributors (listed above).
Copyright (c) 2014 NAN contributors (listed above).

Native Abstractions for Node.js is licensed under an MIT +no-false-attribs license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
Loading