mirror of
https://github.com/musix-org/musix-oss
synced 2026-05-25 23:35:22 +00:00
Updated
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
npm-debug.log
|
||||
|
||||
/build
|
||||
/node_modules
|
||||
/docs/index.html
|
||||
|
||||
# ignore root-level single-letter file dev files
|
||||
?.js
|
||||
|
||||
#IDE
|
||||
/.idea
|
||||
.kdev*
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
sudo: false
|
||||
|
||||
env:
|
||||
- CXX=g++-4.8
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
||||
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "3.2"
|
||||
- "4"
|
||||
- "5"
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
install:
|
||||
- PATH="`npm bin`:`npm bin -g`:$PATH"
|
||||
# Install dependencies and build
|
||||
- npm install
|
||||
|
||||
script:
|
||||
# Output useful info for debugging
|
||||
- node --version
|
||||
- npm --version
|
||||
# Run tests
|
||||
- npm test
|
||||
+331
@@ -0,0 +1,331 @@
|
||||
|
||||
1.3.5 / 2017-01-27
|
||||
==================
|
||||
|
||||
* [[`a1b8216fe7`](https://github.com/TooTallNate/ref/commit/a1b8216fe7)] - fix `util.inspect()` overriding on Node v7 (Nathan Rajlich)
|
||||
* [[`0e26fcf81e`](https://github.com/TooTallNate/ref/commit/0e26fcf81e)] - **appveyor**: drop node v2 and v3 (Nathan Rajlich)
|
||||
* [[`9e9078a4e1`](https://github.com/TooTallNate/ref/commit/9e9078a4e1)] - **travis**: drop node v1 and v2 (Nathan Rajlich)
|
||||
* [[`615016ac1a`](https://github.com/TooTallNate/ref/commit/615016ac1a)] - **test**: fix `util.inspect()` test (Nathan Rajlich)
|
||||
* [[`e1fe604c05`](https://github.com/TooTallNate/ref/commit/e1fe604c05)] - **test**: fix tests after V8 6.0 GC changes (Michaël Zasso, #85)
|
||||
|
||||
1.3.4 / 2017-01-27
|
||||
==================
|
||||
|
||||
* [[`32637be7e4`](https://github.com/TooTallNate/ref/commit/32637be7e4)] - CI stuffs (Nathan Rajlich)
|
||||
* [[`55716fd9e3`](https://github.com/TooTallNate/ref/commit/55716fd9e3)] - always use `defineProperty()` for `name` (Nathan Rajlich)
|
||||
* [[`786b73941e`](https://github.com/TooTallNate/ref/commit/786b73941e)] - **refType**: force name to writable before updating it (Joel Martin) (#67)
|
||||
|
||||
1.3.3 / 2016-11-03
|
||||
==================
|
||||
|
||||
* [[`3f0a2d4775`](https://github.com/TooTallNate/ref/commit/3f0a2d4775)] - rename History.md to CHANGELOG.md (Nathan Rajlich)
|
||||
* [[`30fe405ae5`](https://github.com/TooTallNate/ref/commit/30fe405ae5)] - Merge pull request #62 from mhertsch/master (Nathan Rajlich)
|
||||
* [[`6fdb4b7b23`](https://github.com/TooTallNate/ref/commit/6fdb4b7b23)] - Replaced ForceSet with Nan::ForceSet to remove deprecation warnings when using node 6.9.1 (Michael Hertsch)
|
||||
* [[`000b2a7889`](https://github.com/TooTallNate/ref/commit/000b2a7889)] - **travis**: test node v6 (Nathan Rajlich)
|
||||
|
||||
1.3.2 / 2016-01-10
|
||||
==================
|
||||
|
||||
* int64: fix failing OS X tests now
|
||||
* int64: better error handling for Linux
|
||||
|
||||
1.3.1 / 2015-12-02
|
||||
==================
|
||||
|
||||
* writeUInt64: better error checking for `WriteUInt64()`
|
||||
* writeUInt64: allow hex or octal input string values
|
||||
|
||||
1.3.0 / 2015-12-02
|
||||
==================
|
||||
|
||||
* writeInt64: better error checking for `WriteInt64()`
|
||||
* writeInt64: allow hex or octal input string values
|
||||
* appveyor: test node v5
|
||||
* travis: test node v5
|
||||
|
||||
1.2.0 / 2015-10-08
|
||||
==================
|
||||
|
||||
* force Buffer length to 0 if NULL is read (#42, @saneki)
|
||||
|
||||
1.1.3 / 2015-09-23
|
||||
==================
|
||||
|
||||
* appveyor: remove v1
|
||||
* speed increase by avoiding `JSON.stringify()` constant call (#39, @dan-tull)
|
||||
|
||||
1.1.2 / 2015-09-19
|
||||
==================
|
||||
|
||||
* CString: allow a Buffer to be used as backing store in `set()` (https://github.com/node-ffi/node-ffi/issues/169)
|
||||
* travis, appveyor: test Node.js v4
|
||||
|
||||
1.1.1 / 2015-09-14
|
||||
==================
|
||||
|
||||
* remove unused WrapPointer overload (fix compile warning)
|
||||
* appveyor: better Windows testing
|
||||
|
||||
1.1.0 / 2015-08-26
|
||||
==================
|
||||
|
||||
* appveyor: 2.5 + 3 added
|
||||
* appveyor: attempt to fix v0.8 and v0.10
|
||||
* int64 conversion works with debug mode iojs runtime
|
||||
* persistent size fixed
|
||||
* better automated testing
|
||||
* package: update "weak" to v1
|
||||
* package: add "MIT" license field
|
||||
* NAN 2.0 support (#33, @unbornchikken)
|
||||
|
||||
1.0.2 / 2015-05-09
|
||||
==================
|
||||
|
||||
* package: update "nan" to v1.8.4 (#30, @mafintosh)
|
||||
* README: use SVG for appveyor badge
|
||||
|
||||
1.0.1 / 2015-03-22
|
||||
==================
|
||||
|
||||
* package: update "nan" to v1.7.0
|
||||
* appveyor: test node v0.12, don't test v0.11
|
||||
* travis: test node v0.12, don't test v0.11
|
||||
* README: add link to Known Types page
|
||||
|
||||
1.0.0 / 2015-01-20
|
||||
==================
|
||||
|
||||
* bumping to v1.0.0 for better semver semantics
|
||||
* travis: don't test node v0.8.x
|
||||
|
||||
0.3.5 / 2015-01-18
|
||||
==================
|
||||
|
||||
* src: add SET_SIZEOF and SET_ALIGNOF macros
|
||||
|
||||
0.3.4 / 2015-01-18
|
||||
==================
|
||||
|
||||
* package: update "nan" to v1.5.1
|
||||
* travis: don't test node v0.6.x
|
||||
* use `v8::Object::ForceSet` instead of `v8::Object:Set` (#20, @sarangsapre)
|
||||
|
||||
0.3.3 / 2014-12-29
|
||||
==================
|
||||
|
||||
* package: allow any "debug" v2
|
||||
* add support for `Buffer#reinterpret()` with `offset` (#18, @deepak1556)
|
||||
|
||||
0.3.2 / 2014-06-19
|
||||
==================
|
||||
|
||||
* src: fix comment typo
|
||||
* src: define our own `kMaxLength` constant
|
||||
|
||||
0.3.1 / 2014-06-09
|
||||
==================
|
||||
|
||||
* src: allow Buffers returned from `reinterpretUntilZeros()` up to `kMaxLength` bytes
|
||||
* test: move the reinterpretUntilZeros() tests to their own file
|
||||
* test: fix `Buffer#inspect()` test on Windows
|
||||
|
||||
0.3.0 / 2014-06-08
|
||||
==================
|
||||
|
||||
* ref: use `hexAddress()` for the Buffer inspect() override
|
||||
* ref: add `hexAddress()` function
|
||||
* src: use `NanEscapableScope` where appropriate
|
||||
* src: use `uintptr_t` to ensure a positive address
|
||||
* src: better _snprintf_s #define macro (#12, @fjhub)
|
||||
* package: update "debug" to v1.0.1
|
||||
|
||||
0.2.3 / 2014-06-04
|
||||
==================
|
||||
|
||||
* package: update "nan" to v1.2.0
|
||||
* src: remove commented code
|
||||
|
||||
0.2.2 / 2014-06-01
|
||||
==================
|
||||
|
||||
* package: update "nan" to v1.1.2
|
||||
* travis: remove IRC notifications from Travis
|
||||
|
||||
0.2.1 / 2014-05-27
|
||||
==================
|
||||
|
||||
* package: pin dev dependency versions
|
||||
* package: use explicit nan commit with LLVM fix
|
||||
* README: use https for Travis URL
|
||||
* travis: test node v0.6.x
|
||||
|
||||
0.2.0 / 2014-05-26
|
||||
==================
|
||||
|
||||
* binding: use `rvagg/nan` for node v0.8, v0.10, and v0.11 compat
|
||||
* package: update "nan" to v1.1.0
|
||||
* package: remove "engines" section
|
||||
* README: add appveyor test badge
|
||||
* README: use .svg for Travis badge
|
||||
* add appveyor.yml file
|
||||
* .travis: don't test node v0.9.x
|
||||
* package: beautify
|
||||
* add a `persistent` option to writeObject()
|
||||
* make passing `ref.NULL` to allocCString() work as expected
|
||||
* docs: document the "length" parameter of ref.readPointer()
|
||||
|
||||
0.1.3 / 2012-09-25
|
||||
==================
|
||||
|
||||
* fix compiler warnings on Windows
|
||||
|
||||
0.1.2 / 2012-09-02
|
||||
==================
|
||||
|
||||
* allow an offset as the third argument to the "reinterpret" functions
|
||||
|
||||
0.1.1 / 2012-08-03
|
||||
==================
|
||||
|
||||
* prevent multiple instances of ref from chaining inspects in "overwriteInspect"
|
||||
|
||||
0.1.0 / 2012-07-22
|
||||
==================
|
||||
|
||||
* initial release of the documentation (http://tootallnate.github.com/ref)
|
||||
* binding: make "endianness" and "NULL" be 'frozen'
|
||||
* lib: make derefType() throw an Error when given a "type" with indirection 1
|
||||
* augment the Buffer#inspect() function to print out the memory address as well
|
||||
|
||||
0.0.20 / 2012-06-27
|
||||
===================
|
||||
|
||||
* rename the `Utf8String` type to `CString` (#5)
|
||||
* make `Utf8String` an alias to `CString` and deprecated
|
||||
* more work on docs (not yet ready)
|
||||
|
||||
0.0.19 / 2012-06-25
|
||||
==================
|
||||
|
||||
* use node-bindings
|
||||
|
||||
0.0.18 / 2012-06-21
|
||||
===================
|
||||
|
||||
* add the non-native-endian read+write int64 functions
|
||||
* starting on some real (inline) documentation
|
||||
|
||||
0.0.17 / 2012-06-05
|
||||
===================
|
||||
|
||||
* allow the "bool" type to write arbitrary number values (0-255) to it
|
||||
* Utf8String: return JS `null` when reading a pointer pointing to NULL
|
||||
* make `reinterpret()` and `reinterpretUntilZeros()` throw an Error when given a NULL pointer
|
||||
* make `ref.get()` and `ref.set()` coerce their optional type when given
|
||||
* some more tests
|
||||
|
||||
0.0.16 / 2012-06-01
|
||||
===================
|
||||
|
||||
* use Object.create() and Object.getPrototypeOf() for `refType()` and `derefType()`
|
||||
* remove `cloneType()`
|
||||
* make reading from a NULL pointer always throw an Error:
|
||||
* readCString()
|
||||
* readPointer()
|
||||
* readObject()
|
||||
* readInt64()
|
||||
* readUInt64()
|
||||
|
||||
0.0.15 / 2012-05-31
|
||||
===================
|
||||
|
||||
* fix possible segmentation fault with `readObject()`
|
||||
* fix possible segmentation fault with `readPointer()`
|
||||
|
||||
0.0.14 / 2012-05-31
|
||||
===================
|
||||
|
||||
* fix possible segmentation fault with `readCString()`
|
||||
|
||||
0.0.13 / 2012-05-30
|
||||
===================
|
||||
|
||||
* make `refType()` coerce string types properly
|
||||
* make the `bool` type inherit from a proper fixed type (like `uint8`)
|
||||
|
||||
0.0.12 / 2012-05-30
|
||||
===================
|
||||
|
||||
* make the "char" and "uchar" types accept JS String values
|
||||
* make the synonym types (i.e. longlong is a synonym for int64) be distinct objects, rather than simple JS references
|
||||
* fix coersion of a string value of "Object"
|
||||
* added the `reinterpretUntilZeros()` function
|
||||
|
||||
0.0.11 / 2012-05-17
|
||||
===================
|
||||
|
||||
* always do string type coersion, like on `alloc()`
|
||||
* add a "bool" type, which works with JS `true`/`false` values
|
||||
|
||||
0.0.10 / 2012-05-15
|
||||
===================
|
||||
|
||||
* fix compiler error on Solaris
|
||||
* fix compiler errors on Windows
|
||||
|
||||
0.0.9 / 2012-05-13
|
||||
==================
|
||||
|
||||
* allow `ref.alloc()` to not have a value being set with it
|
||||
* add the `coerceType()` function (get a proper "type" instance from a string)
|
||||
* add the Utf8String type back over from node-ffi
|
||||
* conditionally extend SlowBuffer.prototype for node >= v0.7.9
|
||||
|
||||
0.0.8 / 2012-05-12
|
||||
==================
|
||||
|
||||
* make the `void` type "set()" function be a no-op instead of throwing
|
||||
* added some more test cases
|
||||
|
||||
0.0.7 / 2012-05-09
|
||||
==================
|
||||
|
||||
* added the `reinterpret()` function
|
||||
|
||||
0.0.6 / 2012-05-09
|
||||
==================
|
||||
|
||||
* add `alignof` mappings for the types
|
||||
* add an `Object` type
|
||||
* set the `alignment` property on the built-in types
|
||||
|
||||
0.0.5 / 2012-05-09
|
||||
==================
|
||||
|
||||
* quickly add get() and set() functions
|
||||
* use the `PRId64` and `PRIu64` snprintf types
|
||||
|
||||
0.0.4 / 2012-05-08
|
||||
==================
|
||||
|
||||
* README improvements; some API documentation
|
||||
* removed some leftover debugging statements
|
||||
|
||||
0.0.3 / 2012-05-08
|
||||
==================
|
||||
|
||||
* added `readCString()` function (to `Buffer.prototype` as well)
|
||||
* added `writeCString()` function (to `Buffer.prototype` as well)
|
||||
* added an `allocCString()` function
|
||||
* removed the `Utf8String` type; moved it to node-ffi
|
||||
* made `ref.NULL` be a 'void' type
|
||||
|
||||
0.0.2 / 2012-05-05
|
||||
==================
|
||||
|
||||
* Added missing includes for Linux, etc.
|
||||
|
||||
0.0.1 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
ref
|
||||
===
|
||||
### Turn Buffer instances into "pointers"
|
||||
[](https://travis-ci.org/TooTallNate/ref)
|
||||
[](https://ci.appveyor.com/project/TooTallNate/ref)
|
||||
|
||||
|
||||
This module is inspired by the old `Pointer` class from node-ffi, but with the
|
||||
intent of using Node's fast `Buffer` instances instead of a slow C++ `Pointer`
|
||||
class. These two concepts were previously very similar, but now this module
|
||||
brings over the functionality that Pointers had and Buffers are missing, so
|
||||
now Buffers are a lot more powerful.
|
||||
|
||||
### Features:
|
||||
|
||||
* Get the memory address of any `Buffer` instance
|
||||
* Read/write references to JavaScript Objects into `Buffer` instances
|
||||
* Read/write `Buffer` instances' memory addresses to other `Buffer` instances
|
||||
* Read/write `int64_t` and `uint64_t` data values (Numbers or Strings)
|
||||
* A "type" convention, so that you can specify a buffer as an `int *`,
|
||||
and reference/dereference at will.
|
||||
* Offers a buffer instance representing the `NULL` pointer
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
``` bash
|
||||
$ npm install ref
|
||||
```
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
#### referencing and derefencing
|
||||
|
||||
``` js
|
||||
var ref = require('ref')
|
||||
|
||||
// so we can all agree that a buffer with the int value written
|
||||
// to it could be represented as an "int *"
|
||||
var buf = new Buffer(4)
|
||||
buf.writeInt32LE(12345, 0)
|
||||
|
||||
// first, what is the memory address of the buffer?
|
||||
console.log(buf.address()) // ← 140362165284824
|
||||
|
||||
// using `ref`, you can set the "type", and gain magic abilities!
|
||||
buf.type = ref.types.int
|
||||
|
||||
// now we can dereference to get the "meaningful" value
|
||||
console.log(buf.deref()) // ← 12345
|
||||
|
||||
|
||||
// you can also get references to the original buffer if you need it.
|
||||
// this buffer could be thought of as an "int **"
|
||||
var one = buf.ref()
|
||||
|
||||
// and you can dereference all the way back down to an int
|
||||
console.log(one.deref().deref()) // ← 12345
|
||||
```
|
||||
|
||||
See the [full API Docs][docs] for more examples.
|
||||
|
||||
|
||||
The "type" interface
|
||||
--------------------
|
||||
|
||||
You can easily define your own "type" objects at attach to `Buffer` instances.
|
||||
It just needs to be a regular JavaScript Object that contains the following
|
||||
properties:
|
||||
|
||||
| **Name** | **Data Type** | **Description**
|
||||
|:--------------|:---------------------------------|:----------------------------------
|
||||
| `size` | Number | The size in bytes required to hold this type.
|
||||
| `indirection` | Number | The current level of indirection of the buffer. Usually this would be _1_, and gets incremented on Buffers from `ref()` calls. A value of less than or equal to _0_ is invalid.
|
||||
| `get` | Function (buffer, offset) | The function to invoke when dereferencing this type when the indirection level is _1_.
|
||||
| `set` | Function (buffer, offset, value) | The function to invoke when setting a value to a buffer instance.
|
||||
| `name` | String | _(optional)_ The name to use during debugging for this type.
|
||||
| `alignment` | Number | _(optional)_ The alignment of this type when placed in a struct. Defaults to the type's `size`.
|
||||
|
||||
Be sure to check out the Wiki page of ["Known
|
||||
Types"](https://github.com/TooTallNate/ref/wiki/Known-%22types%22), for the list
|
||||
of built-in ref types, as well as known external type implementations.
|
||||
|
||||
For example, you could define a "bigint" type that dereferences into a
|
||||
[`bigint`](https://github.com/substack/node-bigint) instance:
|
||||
|
||||
``` js
|
||||
var ref = require('ref')
|
||||
var bigint = require('bigint')
|
||||
|
||||
// define the "type" instance according to the spec
|
||||
var BigintType = {
|
||||
size: ref.sizeof.int64
|
||||
, indirection: 1
|
||||
, get: function (buffer, offset) {
|
||||
// return a bigint instance from the buffer
|
||||
return bigint.fromBuffer(buffer)
|
||||
}
|
||||
, set: function (buffer, offset, value) {
|
||||
// 'value' would be a bigint instance
|
||||
var val = value.toString()
|
||||
return ref.writeInt64(buffer, offset || 0, val)
|
||||
}
|
||||
}
|
||||
|
||||
// now we can create instances of the type from existing buffers.
|
||||
// "buf" is some Buffer instance returned from some external data
|
||||
// source, which should contain "bigint" binary data.
|
||||
buf.type = BigintType
|
||||
|
||||
// and now you can create "bigint" instances using this generic "types" API
|
||||
var val = buf.deref()
|
||||
.add('1234')
|
||||
.sqrt()
|
||||
.shiftLeft(5)
|
||||
```
|
||||
|
||||
Build the docs
|
||||
--------------
|
||||
|
||||
Install the dev dependencies:
|
||||
|
||||
``` bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
Generate the docs:
|
||||
|
||||
``` bash
|
||||
$ npm run docs
|
||||
```
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
[docs]: http://tootallnate.github.com/ref
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
# http://www.appveyor.com/docs/appveyor-yml
|
||||
|
||||
# Test against these versions of Node.js.
|
||||
environment:
|
||||
# Visual Studio Version
|
||||
MSVS_VERSION: 2013
|
||||
# Test against these versions of Node.js and io.js
|
||||
matrix:
|
||||
# node.js
|
||||
- nodejs_version: "0.10"
|
||||
- nodejs_version: "0.12"
|
||||
# io.js
|
||||
- nodejs_version: "4"
|
||||
- nodejs_version: "5"
|
||||
- nodejs_version: "6"
|
||||
- nodejs_version: "7"
|
||||
|
||||
platform:
|
||||
- x86
|
||||
- x64
|
||||
|
||||
# Install scripts. (runs after repo cloning)
|
||||
install:
|
||||
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
|
||||
- npm install -g npm@3
|
||||
- set PATH=%APPDATA%\npm;%PATH%
|
||||
# Typical npm stuff.
|
||||
- npm install --msvs_version=%MSVS_VERSION%
|
||||
|
||||
# Post-install test scripts.
|
||||
test_script:
|
||||
# Output useful info for debugging.
|
||||
- node --version
|
||||
- npm --version
|
||||
# run tests
|
||||
- npm test
|
||||
|
||||
# Don't actually build.
|
||||
build: off
|
||||
|
||||
# Set build version format here instead of in the admin panel.
|
||||
version: "{build}"
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'binding',
|
||||
'sources': [ 'src/binding.cc' ],
|
||||
'include_dirs': [
|
||||
'<!(node -e "require(\'nan\')")'
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+3079
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+2
@@ -0,0 +1,2 @@
|
||||
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native64Bit:WindowsTargetPlatformVersion=10.0.17763.0
|
||||
Release|x64|C:\Users\matia\Documents\GitHub\FutoX-Musix\node_modules\ref\build\|
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+19
@@ -0,0 +1,19 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2015
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "binding", "binding.vcxproj", "{52D9BDEB-F7A3-8669-93FA-E4EDF3C1AC4A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52D9BDEB-F7A3-8669-93FA-E4EDF3C1AC4A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{52D9BDEB-F7A3-8669-93FA-E4EDF3C1AC4A}.Debug|x64.Build.0 = Debug|x64
|
||||
{52D9BDEB-F7A3-8669-93FA-E4EDF3C1AC4A}.Release|x64.ActiveCfg = Release|x64
|
||||
{52D9BDEB-F7A3-8669-93FA-E4EDF3C1AC4A}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{52D9BDEB-F7A3-8669-93FA-E4EDF3C1AC4A}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>binding</RootNamespace>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Locals">
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props"/>
|
||||
<ImportGroup Label="ExtensionSettings"/>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros"/>
|
||||
<PropertyGroup>
|
||||
<ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\bin\;$(MSBuildProjectDirectory)\..\bin\</ExecutablePath>
|
||||
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
||||
<IntDir>$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<TargetPath>$(OutDir)\$(ProjectName).node</TargetPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>C:\Users\matia\.node-gyp\10.15.3\include\node;C:\Users\matia\.node-gyp\10.15.3\src;C:\Users\matia\.node-gyp\10.15.3\deps\openssl\config;C:\Users\matia\.node-gyp\10.15.3\deps\openssl\openssl\include;C:\Users\matia\.node-gyp\10.15.3\deps\uv\include;C:\Users\matia\.node-gyp\10.15.3\deps\zlib;C:\Users\matia\.node-gyp\10.15.3\deps\v8\include;..\..\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=binding;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;BUILDING_NODE_EXTENSION;DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;"C:\Users\matia\.node-gyp\10.15.3\x64\node.lib"</AdditionalDependencies>
|
||||
<AdditionalOptions>/ignore:4199 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AllowIsolation>true</AllowIsolation>
|
||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||
<DelayLoadDLLs>iojs.exe;node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapExports>true</MapExports>
|
||||
<OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
|
||||
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetExt>.node</TargetExt>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>C:\Users\matia\.node-gyp\10.15.3\include\node;C:\Users\matia\.node-gyp\10.15.3\src;C:\Users\matia\.node-gyp\10.15.3\deps\openssl\config;C:\Users\matia\.node-gyp\10.15.3\deps\openssl\openssl\include;C:\Users\matia\.node-gyp\10.15.3\deps\uv\include;C:\Users\matia\.node-gyp\10.15.3\deps\zlib;C:\Users\matia\.node-gyp\10.15.3\deps\v8\include;..\..\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=binding;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;BUILDING_NODE_EXTENSION;DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>C:\Users\matia\.node-gyp\10.15.3\include\node;C:\Users\matia\.node-gyp\10.15.3\src;C:\Users\matia\.node-gyp\10.15.3\deps\openssl\config;C:\Users\matia\.node-gyp\10.15.3\deps\openssl\openssl\include;C:\Users\matia\.node-gyp\10.15.3\deps\uv\include;C:\Users\matia\.node-gyp\10.15.3\deps\zlib;C:\Users\matia\.node-gyp\10.15.3\deps\v8\include;..\..\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<Optimization>Full</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=binding;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;BUILDING_NODE_EXTENSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<StringPooling>true</StringPooling>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalOptions>/LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
|
||||
</Lib>
|
||||
<Link>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;"C:\Users\matia\.node-gyp\10.15.3\x64\node.lib"</AdditionalDependencies>
|
||||
<AdditionalOptions>/ignore:4199 /LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
|
||||
<AllowIsolation>true</AllowIsolation>
|
||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||
<DelayLoadDLLs>iojs.exe;node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapExports>true</MapExports>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
|
||||
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetExt>.node</TargetExt>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>C:\Users\matia\.node-gyp\10.15.3\include\node;C:\Users\matia\.node-gyp\10.15.3\src;C:\Users\matia\.node-gyp\10.15.3\deps\openssl\config;C:\Users\matia\.node-gyp\10.15.3\deps\openssl\openssl\include;C:\Users\matia\.node-gyp\10.15.3\deps\uv\include;C:\Users\matia\.node-gyp\10.15.3\deps\zlib;C:\Users\matia\.node-gyp\10.15.3\deps\v8\include;..\..\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=binding;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;BUILDING_NODE_EXTENSION;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\binding.gyp"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\binding.cc"/>
|
||||
<ClCompile Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"/>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
</Project>
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="..">
|
||||
<UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="..\src">
|
||||
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="C:">
|
||||
<UniqueIdentifier>{7B735499-E5DD-1C2B-6C26-70023832A1CF}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="C:\Program Files">
|
||||
<UniqueIdentifier>{92EF4BA8-6BC2-65D1-451F-28EBD4AE726A}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="C:\Program Files\nodejs">
|
||||
<UniqueIdentifier>{A3C8E949-BCF6-0C67-6656-340A2A097708}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="C:\Program Files\nodejs\node_modules">
|
||||
<UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="C:\Program Files\nodejs\node_modules\npm">
|
||||
<UniqueIdentifier>{741E0E76-39B2-B1AB-9FA1-F1A20B16F295}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules">
|
||||
<UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp">
|
||||
<UniqueIdentifier>{77348C0E-2034-7791-74D5-63C077DF5A3B}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src">
|
||||
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="..">
|
||||
<UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\binding.cc">
|
||||
<Filter>..\src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc">
|
||||
<Filter>C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src</Filter>
|
||||
</ClCompile>
|
||||
<None Include="..\binding.gyp">
|
||||
<Filter>..</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
# Do not edit. File was generated by node-gyp's "configure" step
|
||||
{
|
||||
"target_defaults": {
|
||||
"cflags": [],
|
||||
"default_configuration": "Release",
|
||||
"defines": [],
|
||||
"include_dirs": [],
|
||||
"libraries": [],
|
||||
"msbuild_toolset": "v141",
|
||||
"msvs_windows_target_platform_version": "10.0.17763.0"
|
||||
},
|
||||
"variables": {
|
||||
"asan": 0,
|
||||
"build_v8_with_gn": "false",
|
||||
"coverage": "false",
|
||||
"debug_nghttp2": "false",
|
||||
"enable_lto": "false",
|
||||
"enable_pgo_generate": "false",
|
||||
"enable_pgo_use": "false",
|
||||
"force_dynamic_crt": 0,
|
||||
"host_arch": "x64",
|
||||
"icu_data_in": "..\\..\\deps/icu-small\\source/data/in\\icudt62l.dat",
|
||||
"icu_endianness": "l",
|
||||
"icu_gyp_path": "tools/icu/icu-generic.gyp",
|
||||
"icu_locales": "en,root",
|
||||
"icu_path": "deps/icu-small",
|
||||
"icu_small": "true",
|
||||
"icu_ver_major": "62",
|
||||
"nasm_version": "2.14",
|
||||
"node_byteorder": "little",
|
||||
"node_debug_lib": "false",
|
||||
"node_enable_d8": "false",
|
||||
"node_enable_v8_vtunejit": "false",
|
||||
"node_install_npm": "true",
|
||||
"node_module_version": 64,
|
||||
"node_no_browser_globals": "false",
|
||||
"node_prefix": "/usr/local",
|
||||
"node_release_urlbase": "https://nodejs.org/download/release/",
|
||||
"node_shared": "false",
|
||||
"node_shared_cares": "false",
|
||||
"node_shared_http_parser": "false",
|
||||
"node_shared_libuv": "false",
|
||||
"node_shared_nghttp2": "false",
|
||||
"node_shared_openssl": "false",
|
||||
"node_shared_zlib": "false",
|
||||
"node_tag": "",
|
||||
"node_target_type": "executable",
|
||||
"node_use_bundled_v8": "true",
|
||||
"node_use_dtrace": "false",
|
||||
"node_use_etw": "true",
|
||||
"node_use_large_pages": "false",
|
||||
"node_use_openssl": "true",
|
||||
"node_use_pch": "false",
|
||||
"node_use_perfctr": "true",
|
||||
"node_use_v8_platform": "true",
|
||||
"node_with_ltcg": "true",
|
||||
"node_without_node_options": "false",
|
||||
"openssl_fips": "",
|
||||
"openssl_no_asm": 0,
|
||||
"shlib_suffix": "so.64",
|
||||
"target_arch": "x64",
|
||||
"v8_enable_gdbjit": 0,
|
||||
"v8_enable_i18n_support": 1,
|
||||
"v8_enable_inspector": 1,
|
||||
"v8_no_strict_aliasing": 1,
|
||||
"v8_optimized_debug": 0,
|
||||
"v8_promise_internal_field_count": 1,
|
||||
"v8_random_seed": 0,
|
||||
"v8_trace_maps": 0,
|
||||
"v8_typed_array_max_size_in_heap": 0,
|
||||
"v8_use_snapshot": "true",
|
||||
"want_separate_host_toolset": 0,
|
||||
"nodedir": "C:\\Users\\matia\\.node-gyp\\10.15.3",
|
||||
"standalone_static_library": 1,
|
||||
"msbuild_path": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe",
|
||||
"access": "",
|
||||
"allow_same_version": "",
|
||||
"also": "",
|
||||
"always_auth": "",
|
||||
"audit": "true",
|
||||
"audit_level": "low",
|
||||
"auth_type": "legacy",
|
||||
"bin_links": "true",
|
||||
"browser": "",
|
||||
"ca": "",
|
||||
"cache": "C:\\Users\\matia\\AppData\\Roaming\\npm-cache",
|
||||
"cache_lock_retries": "10",
|
||||
"cache_lock_stale": "60000",
|
||||
"cache_lock_wait": "10000",
|
||||
"cache_max": "Infinity",
|
||||
"cache_min": "10",
|
||||
"cert": "",
|
||||
"cidr": "",
|
||||
"color": "true",
|
||||
"commit_hooks": "true",
|
||||
"depth": "Infinity",
|
||||
"description": "true",
|
||||
"dev": "",
|
||||
"dry_run": "",
|
||||
"editor": "notepad.exe",
|
||||
"engine_strict": "",
|
||||
"fetch_retries": "2",
|
||||
"fetch_retry_factor": "10",
|
||||
"fetch_retry_maxtimeout": "60000",
|
||||
"fetch_retry_mintimeout": "10000",
|
||||
"force": "",
|
||||
"git": "git",
|
||||
"git_tag_version": "true",
|
||||
"global": "",
|
||||
"globalconfig": "C:\\Users\\matia\\AppData\\Roaming\\npm\\etc\\npmrc",
|
||||
"globalignorefile": "C:\\Users\\matia\\AppData\\Roaming\\npm\\etc\\npmignore",
|
||||
"global_style": "",
|
||||
"group": "",
|
||||
"ham_it_up": "",
|
||||
"heading": "npm",
|
||||
"https_proxy": "",
|
||||
"if_present": "",
|
||||
"ignore_prepublish": "",
|
||||
"ignore_scripts": "",
|
||||
"init_author_email": "",
|
||||
"init_author_name": "",
|
||||
"init_author_url": "",
|
||||
"init_license": "ISC",
|
||||
"init_module": "C:\\Users\\matia\\.npm-init.js",
|
||||
"init_version": "1.0.0",
|
||||
"json": "",
|
||||
"key": "",
|
||||
"legacy_bundling": "",
|
||||
"link": "",
|
||||
"local_address": "",
|
||||
"logs_max": "10",
|
||||
"long": "",
|
||||
"maxsockets": "50",
|
||||
"message": "%s",
|
||||
"metrics_registry": "https://registry.npmjs.org/",
|
||||
"node_gyp": "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js",
|
||||
"node_options": "",
|
||||
"node_version": "10.15.3",
|
||||
"noproxy": "",
|
||||
"offline": "",
|
||||
"onload_script": "",
|
||||
"only": "",
|
||||
"optional": "true",
|
||||
"otp": "",
|
||||
"package_lock": "true",
|
||||
"package_lock_only": "",
|
||||
"parseable": "",
|
||||
"prefer_offline": "",
|
||||
"prefer_online": "",
|
||||
"prefix": "C:\\Users\\matia\\AppData\\Roaming\\npm",
|
||||
"preid": "",
|
||||
"production": "",
|
||||
"progress": "true",
|
||||
"read_only": "",
|
||||
"rebuild_bundle": "true",
|
||||
"registry": "https://registry.npmjs.org/",
|
||||
"rollback": "true",
|
||||
"save": "true",
|
||||
"save_bundle": "",
|
||||
"save_dev": "",
|
||||
"save_exact": "",
|
||||
"save_optional": "",
|
||||
"save_prefix": "^",
|
||||
"save_prod": "",
|
||||
"scope": "",
|
||||
"scripts_prepend_node_path": "warn-only",
|
||||
"script_shell": "",
|
||||
"searchexclude": "",
|
||||
"searchlimit": "20",
|
||||
"searchopts": "",
|
||||
"searchstaleness": "900",
|
||||
"send_metrics": "",
|
||||
"shell": "C:\\WINDOWS\\system32\\cmd.exe",
|
||||
"shrinkwrap": "true",
|
||||
"sign_git_commit": "",
|
||||
"sign_git_tag": "",
|
||||
"sso_poll_frequency": "500",
|
||||
"sso_type": "oauth",
|
||||
"strict_ssl": "true",
|
||||
"tag": "latest",
|
||||
"tag_version_prefix": "v",
|
||||
"timing": "",
|
||||
"tmp": "C:\\Users\\matia\\AppData\\Local\\Temp",
|
||||
"umask": "0000",
|
||||
"unicode": "",
|
||||
"unsafe_perm": "true",
|
||||
"update_notifier": "true",
|
||||
"usage": "",
|
||||
"user": "",
|
||||
"userconfig": "C:\\Users\\matia\\.npmrc",
|
||||
"user_agent": "npm/6.4.1 node/v10.15.3 win32 x64",
|
||||
"version": "",
|
||||
"versions": "",
|
||||
"viewer": "browser"
|
||||
}
|
||||
}
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var fs = require('fs')
|
||||
var dox = require('dox')
|
||||
var jade = require('jade')
|
||||
var marked = require('marked')
|
||||
var hljs = require('highlight.js')
|
||||
var assert = require('assert')
|
||||
|
||||
fs.readFile(__dirname + '/../lib/ref.js', 'utf8', function (err, data) {
|
||||
if (err) throw err
|
||||
|
||||
// don't depend on dox for parsing the Markdown (raw: true)
|
||||
var docs = dox.parseComments(data, { raw: true })
|
||||
var base = 0
|
||||
var sections = []
|
||||
docs.forEach(function (doc, i) {
|
||||
doc.tags.forEach(function (t) {
|
||||
if (t.type === 'section') {
|
||||
sections.push(docs.slice(base, i))
|
||||
base = i
|
||||
}
|
||||
if (t.type === 'name') {
|
||||
doc.name = t.string
|
||||
}
|
||||
if (t.type === 'type') {
|
||||
doc.type = t.types[0]
|
||||
}
|
||||
})
|
||||
if (!doc.name) {
|
||||
doc.name = doc.ctx && doc.ctx.name
|
||||
}
|
||||
if (!doc.type) {
|
||||
doc.type = doc.ctx && doc.ctx.type || 'property'
|
||||
}
|
||||
})
|
||||
sections.push(docs.slice(base))
|
||||
assert.equal(sections.length, 3)
|
||||
|
||||
// get the 3 sections
|
||||
var exports = sections[0]
|
||||
var types = sections[1]
|
||||
var extensions = sections[2]
|
||||
|
||||
// move NULL_POINTER from "types" to "exports"
|
||||
var null_pointer = types.pop()
|
||||
assert.equal(null_pointer.name, 'NULL_POINTER')
|
||||
exports.push(null_pointer)
|
||||
|
||||
// extract the "return" and "param" types
|
||||
exports.forEach(function (doc) {
|
||||
doc.tags.forEach(function (t) {
|
||||
if (t.description) {
|
||||
// parse the Markdown descriptions
|
||||
t.description = markdown(t.description).trim()
|
||||
// remove the surrounding <p> tags
|
||||
t.description = t.description.substring(3, t.description.length - 4)
|
||||
}
|
||||
})
|
||||
doc.returnType = doc.tags.filter(function (t) {
|
||||
return t.type == 'return'
|
||||
})[0]
|
||||
doc.paramTypes = doc.tags.filter(function (t) {
|
||||
return t.type == 'param'
|
||||
})
|
||||
})
|
||||
|
||||
// sort
|
||||
exports = exports.sort(sort)
|
||||
extensions = extensions.sort(sort)
|
||||
|
||||
// parse and highlight the Markdown descriptions
|
||||
;[exports, types, extensions].forEach(function (docs) {
|
||||
docs.forEach(function (doc) {
|
||||
var desc = doc.description
|
||||
desc.full = markdown(desc.full)
|
||||
desc.summary = markdown(desc.summary)
|
||||
desc.body = markdown(desc.body)
|
||||
})
|
||||
})
|
||||
|
||||
// get a reference to the ref export doc object for every Buffer extension doc
|
||||
extensions.forEach(function (doc) {
|
||||
doc.ref = exports.filter(function (ref) {
|
||||
return ref.name === doc.name
|
||||
})[0]
|
||||
})
|
||||
|
||||
fs.readFile(__dirname + '/index.jade', 'utf8', function (err, template) {
|
||||
if (err) throw err
|
||||
|
||||
template = jade.compile(template)
|
||||
var html = template({
|
||||
exports: sections[0]
|
||||
, types: sections[1]
|
||||
, extensions: sections[2]
|
||||
, package: require('../package.json')
|
||||
, markdown: markdown
|
||||
, highlight: highlight
|
||||
})
|
||||
|
||||
fs.writeFile(__dirname + '/index.html', html, function (err) {
|
||||
if (err) throw err
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* Sorts an array of dox objects by doc.name. If the first letter is an '_' then
|
||||
* it is considered "private" and gets sorted at the bottom.
|
||||
*/
|
||||
|
||||
function sort (a, b) {
|
||||
var aname = a.name
|
||||
var bname = b.name
|
||||
var aprivate = a.isPrivate
|
||||
var bprivate = b.isPrivate
|
||||
if (aprivate && !bprivate) {
|
||||
return 1
|
||||
}
|
||||
if (bprivate && !aprivate) {
|
||||
return -1
|
||||
}
|
||||
return aname > bname ? 1 : -1
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses Markdown into highlighted HTML.
|
||||
*/
|
||||
|
||||
function markdown (code) {
|
||||
if (!code) return code
|
||||
return marked(code, {
|
||||
gfm: true
|
||||
, highlight: highlight
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Add syntax highlighting HTML to the given `code` block.
|
||||
* `lang` defaults to "javascript" if no valid name is given.
|
||||
*/
|
||||
|
||||
function highlight (code, lang) {
|
||||
if (!hljs.LANGUAGES.hasOwnProperty(lang)) {
|
||||
lang = 'javascript'
|
||||
}
|
||||
return hljs.highlight(lang, code).value
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
DIR=`dirname $0`
|
||||
TMP_DOC_DIR="/tmp/ref_docs"
|
||||
|
||||
npm run docs \
|
||||
&& rm -rf $TMP_DOC_DIR \
|
||||
&& mkdir -p $TMP_DOC_DIR \
|
||||
&& cp -Lrf {"$DIR/index.html","$DIR/images","$DIR/scripts","$DIR/stylesheets"} $TMP_DOC_DIR \
|
||||
&& git checkout gh-pages \
|
||||
&& cp -Lrf $TMP_DOC_DIR/* . \
|
||||
&& echo "done"
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
Binary file not shown.
+264
@@ -0,0 +1,264 @@
|
||||
doctype 5
|
||||
html(lang="en")
|
||||
head
|
||||
meta(charset="utf-8")
|
||||
title "ref" documentation v#{package.version}
|
||||
meta(name="description", content=package.description)
|
||||
meta(name="keywords", content=['node.js', package.name].concat(package.keywords).join(', '))
|
||||
meta(name="author", content="Nathan Rajlich")
|
||||
meta(name="viewport", content="width=device-width, initial-scale=1, maximum-scale=1")
|
||||
|
||||
link(rel="stylesheet", href="stylesheets/hightlight.css")
|
||||
link(rel="stylesheet", href="stylesheets/base.css")
|
||||
link(rel="stylesheet", href="stylesheets/skeleton.css")
|
||||
link(rel="stylesheet", href="stylesheets/layout.css")
|
||||
|
||||
link(rel="shortcut icon", href="images/favicon.ico")
|
||||
link(rel="apple-touch-icon", href="images/apple-touch-icon.png")
|
||||
link(rel="apple-touch-icon", sizes="72x72", href="images/apple-touch-icon-72x72.png")
|
||||
link(rel="apple-touch-icon", sizes="114x114", href="images/apple-touch-icon-114x114.png")
|
||||
|
||||
body
|
||||
.container
|
||||
.columns.three.logo
|
||||
a(href="")
|
||||
h1 #{package.name}
|
||||
span.pointer *
|
||||
span.version v#{package.version}
|
||||
.columns.thirteen.subtitle
|
||||
h3= package.description
|
||||
.columns.sixteen.intro
|
||||
h4 What is <code>ref</code>?
|
||||
p
|
||||
code ref
|
||||
| is a native addon for
|
||||
a(href="http://nodejs.org") Node.js
|
||||
| that aids in doing C programming in JavaScript, by extending
|
||||
| the built-in
|
||||
a(href="http://nodejs.org/api/buffer.html")
|
||||
code Buffer
|
||||
| class
|
||||
| with some fancy additions like:
|
||||
ul
|
||||
li Getting the memory address of a Buffer
|
||||
li Checking the endianness of the processor
|
||||
li Checking if a Buffer represents the NULL pointer
|
||||
li Reading and writing "pointers" with Buffers
|
||||
li Reading and writing C Strings (NULL-terminated)
|
||||
li Reading and writing JavaScript Object references
|
||||
li Reading and writing
|
||||
strong int64_t
|
||||
| and
|
||||
strong uint64_t
|
||||
| values
|
||||
li A "type" convention to define the contents of a Buffer
|
||||
p
|
||||
| There is indeed a lot of
|
||||
em meat
|
||||
| to
|
||||
code ref
|
||||
| , but it all fits together in one way or another in the end.
|
||||
br
|
||||
| For simplicity,
|
||||
code ref
|
||||
| 's API can be broken down into 3 sections:
|
||||
a.nav.columns.five(href='#exports')
|
||||
h4 ref <code>exports</code>
|
||||
p
|
||||
| All the static versions of
|
||||
code ref
|
||||
| 's functions and default "types" available on the exports returned from
|
||||
code require('ref')
|
||||
| .
|
||||
a.nav.columns.five(href='#types')
|
||||
h4 <em>"type"</em> system
|
||||
p
|
||||
| The
|
||||
em "type"
|
||||
| system allows you to define a "type" on any Buffer instance, and then
|
||||
| use generic
|
||||
code ref()
|
||||
| and
|
||||
code deref()
|
||||
| functions to reference and dereference values.
|
||||
a.nav.columns.five(href='#extensions')
|
||||
h4 <code>Buffer</code> extensions
|
||||
p
|
||||
code Buffer.prototype
|
||||
| gets extended with some convenience functions. These all just mirror
|
||||
| their static counterpart, using the Buffer's
|
||||
code this
|
||||
| variable as the
|
||||
code buffer
|
||||
| variable.
|
||||
|
||||
|
||||
hr
|
||||
.columns.eight.section.exports
|
||||
a(name="exports")
|
||||
a(href="#exports")
|
||||
h2 ref exports
|
||||
.columns.sixteen.intro
|
||||
p
|
||||
| This section documents all the functions exported from
|
||||
code require('ref')
|
||||
| .
|
||||
each doc in exports
|
||||
if (!doc.ignore)
|
||||
.columns.sixteen.section
|
||||
a(name='exports-' + doc.name)
|
||||
a(href='#exports-' + doc.name)
|
||||
isFunc = doc.type == 'method' || doc.isPrivate
|
||||
h3
|
||||
| ref.#{doc.name}
|
||||
if (isFunc)
|
||||
| (
|
||||
each param, i in doc.paramTypes
|
||||
span.param #{param.types.join('|')} #{param.name}
|
||||
if (i + 1 < doc.paramTypes.length)
|
||||
| ,
|
||||
| )
|
||||
if (doc.returnType)
|
||||
|
|
||||
span.rtn → #{doc.returnType.types.join('|')}
|
||||
if (!isFunc)
|
||||
|
|
||||
span.rtn ⇒ #{doc.type}
|
||||
if (doc.paramTypes.length > 0 || doc.returnType)
|
||||
ul
|
||||
each param in doc.paramTypes
|
||||
li #{param.name} - !{param.description}
|
||||
if (doc.returnType)
|
||||
li
|
||||
strong Return:
|
||||
| !{doc.returnType.description}
|
||||
!= (doc && doc.description.full || '').replace(/\<br ?\/?\>/g, ' ')
|
||||
|
||||
|
||||
hr
|
||||
.columns.eight.section.types
|
||||
a(name="types")
|
||||
a(href="#types")
|
||||
h2
|
||||
em "type"
|
||||
| system
|
||||
.columns.sixteen.intro.types
|
||||
p
|
||||
| A "type" in
|
||||
code ref
|
||||
| is simply an plain 'ol JavaScript Object, with a set
|
||||
| of expected properties attached that implement the logic for getting
|
||||
| & setting values on a given
|
||||
code Buffer
|
||||
| instance.
|
||||
p
|
||||
| To attach a "type" to a Buffer instance, you simply attach the "type"
|
||||
| object to the Buffer's <code>type</code> property.
|
||||
code ref
|
||||
| comes with a set of commonly used types which are described in this
|
||||
| section.
|
||||
h4 Creating your own "type"
|
||||
p
|
||||
| It's trivial to create your own "type" that reads and writes your
|
||||
| own custom datatype/class to and from Buffer instances using
|
||||
code ref
|
||||
| 's unified API.
|
||||
br
|
||||
| To create your own "type", simply create a JavaScript Object with
|
||||
| the following properties defined:
|
||||
table
|
||||
tr
|
||||
th Name
|
||||
th Data Type
|
||||
th Description
|
||||
tr
|
||||
td: code size
|
||||
td: code Number
|
||||
td The size in bytes required to hold this datatype.
|
||||
tr
|
||||
td: code indirection
|
||||
td: code Number
|
||||
td
|
||||
| The current level of indirection of the buffer. When defining
|
||||
| your own "types", just set this value to <code>1</code>.
|
||||
tr
|
||||
td: code get
|
||||
td: code Function
|
||||
td
|
||||
| The function to invoke when
|
||||
a(href="#exports-get")
|
||||
code ref.get()
|
||||
| is invoked on a buffer of this type.
|
||||
tr
|
||||
td: code set
|
||||
td: code Function
|
||||
td
|
||||
| The function to invoke when
|
||||
a(href="#exports-set")
|
||||
code ref.set()
|
||||
| is invoked on a buffer of this type.
|
||||
tr
|
||||
td: code name
|
||||
td: code String
|
||||
td
|
||||
em (Optional)
|
||||
| The name to use during debugging for this datatype.
|
||||
tr
|
||||
td: code alignment
|
||||
td: code Number
|
||||
td
|
||||
em (Optional)
|
||||
| The alignment of this datatype when placed inside a struct.
|
||||
| Defaults to the type's
|
||||
code size
|
||||
| .
|
||||
h4 The built-in "types"
|
||||
p
|
||||
| Here is the list of
|
||||
code ref
|
||||
| 's built-in "type" Objects. All these built-in "types" can be found
|
||||
| on the
|
||||
code ref.types
|
||||
| export Object. All the built-in types use "native endianness" when
|
||||
| multi-byte datatypes are involved.
|
||||
each doc in types
|
||||
if (!doc.ignore)
|
||||
.columns.sixteen.section
|
||||
a(name='types-' + doc.name)
|
||||
a(href='#types-' + doc.name)
|
||||
h3 types.#{doc.name}
|
||||
!= doc.description.full.replace(/\<br ?\/?\>/g, ' ')
|
||||
|
||||
|
||||
hr
|
||||
.columns.eight.section.exports
|
||||
a(name="extensions")
|
||||
a(href="#extensions")
|
||||
h2 Buffer extensions
|
||||
.columns.sixteen.intro
|
||||
p
|
||||
code Buffer.prototype
|
||||
| gets extended with some convenience functions that you can use in
|
||||
| your modules and/or applications.
|
||||
each doc in extensions
|
||||
if (!doc.ignore)
|
||||
.columns.sixteen.section
|
||||
a(name='extensions-' + doc.name)
|
||||
a(href='#extensions-' + doc.name)
|
||||
h3 Buffer##{doc.name}()
|
||||
if (doc.name === 'inspect')
|
||||
!= doc.description.full.replace(/\<br ?\/?\>/g, ' ')
|
||||
else
|
||||
p
|
||||
| Shorthand for
|
||||
a(href='#exports-' + doc.name)
|
||||
code ref.#{doc.name}(this, …)
|
||||
| .
|
||||
!= (doc.ref && doc.ref.description.full || '').replace(/\<br ?\/?\>/g, ' ')
|
||||
|
||||
|
||||
.ribbon
|
||||
a(href="https://github.com/TooTallNate/ref", rel="me") Fork me on GitHub
|
||||
|
||||
script(src="scripts/jquery-1.7.2.min.js")
|
||||
script(src="scripts/main.js")
|
||||
+4
File diff suppressed because one or more lines are too long
+25
@@ -0,0 +1,25 @@
|
||||
|
||||
/**
|
||||
* Animated scroll to named anchors.
|
||||
*/
|
||||
|
||||
$(document.body).on('click', 'a', function () {
|
||||
var href = $(this).attr('href')
|
||||
if (href[0] === '#') {
|
||||
scrollTo(href)
|
||||
window.history && history.pushState({}, name, href)
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
function scrollTo (hash) {
|
||||
var name = hash.substring(1)
|
||||
var target = $('a[name="' + name + '"]')
|
||||
if (target.length) {
|
||||
$('html, body').animate({ scrollTop: target.offset().top }
|
||||
, { duration: 500, easing: 'swing'})
|
||||
} else {
|
||||
console.log('documentation not written: %s', name)
|
||||
}
|
||||
return target
|
||||
}
|
||||
+267
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* Skeleton V1.2
|
||||
* Copyright 2011, Dave Gamache
|
||||
* www.getskeleton.com
|
||||
* Free to use under the MIT license.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* 6/20/2012
|
||||
*/
|
||||
|
||||
|
||||
/* Table of Content
|
||||
==================================================
|
||||
#Reset & Basics
|
||||
#Basic Styles
|
||||
#Site Styles
|
||||
#Typography
|
||||
#Links
|
||||
#Lists
|
||||
#Images
|
||||
#Buttons
|
||||
#Forms
|
||||
#Misc */
|
||||
|
||||
|
||||
/* #Reset & Basics (Inspired by E. Meyers)
|
||||
================================================== */
|
||||
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline; }
|
||||
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
|
||||
display: block; }
|
||||
body {
|
||||
line-height: 1; }
|
||||
ol, ul {
|
||||
list-style: none; }
|
||||
blockquote, q {
|
||||
quotes: none; }
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none; }
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0; }
|
||||
|
||||
|
||||
/* #Basic Styles
|
||||
================================================== */
|
||||
body {
|
||||
background: #fff;
|
||||
font: 14px/21px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
color: #444;
|
||||
-webkit-font-smoothing: antialiased; /* Fix for webkit rendering */
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
|
||||
/* #Typography
|
||||
================================================== */
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: #181818;
|
||||
font-family: "Georgia", "Times New Roman", serif;
|
||||
font-weight: normal; }
|
||||
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-weight: inherit; }
|
||||
h1 { font-size: 46px; line-height: 50px; margin-bottom: 14px;}
|
||||
h2 { font-size: 35px; line-height: 40px; margin-bottom: 10px; }
|
||||
h3 { font-size: 28px; line-height: 34px; margin-bottom: 8px; }
|
||||
h4 { font-size: 21px; line-height: 30px; margin-bottom: 4px; }
|
||||
h5 { font-size: 17px; line-height: 24px; }
|
||||
h6 { font-size: 14px; line-height: 21px; }
|
||||
.subheader { color: #777; }
|
||||
|
||||
p { margin: 0 0 20px 0; }
|
||||
p img { margin: 0; }
|
||||
p.lead { font-size: 21px; line-height: 27px; color: #777; }
|
||||
|
||||
em { font-style: italic; }
|
||||
strong { font-weight: bold; color: #333; }
|
||||
small { font-size: 80%; }
|
||||
|
||||
/* Blockquotes */
|
||||
blockquote, blockquote p { font-size: 17px; line-height: 24px; color: #777; font-style: italic; }
|
||||
blockquote { margin: 0 0 20px; padding: 9px 20px 0 19px; border-left: 1px solid #ddd; }
|
||||
blockquote cite { display: block; font-size: 12px; color: #555; }
|
||||
blockquote cite:before { content: "\2014 \0020"; }
|
||||
blockquote cite a, blockquote cite a:visited, blockquote cite a:visited { color: #555; }
|
||||
|
||||
hr { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 10px 0 30px; height: 0; }
|
||||
|
||||
|
||||
/* #Links
|
||||
================================================== */
|
||||
a, a:visited { color: #333; text-decoration: underline; outline: 0; }
|
||||
a:hover, a:focus { color: #000; }
|
||||
p a, p a:visited { line-height: inherit; }
|
||||
|
||||
|
||||
/* #Lists
|
||||
================================================== */
|
||||
ul, ol { margin-bottom: 20px; }
|
||||
ul { list-style: none outside; }
|
||||
ol { list-style: decimal; }
|
||||
ol, ul.square, ul.circle, ul.disc { margin-left: 30px; }
|
||||
ul.square { list-style: square outside; }
|
||||
ul.circle { list-style: circle outside; }
|
||||
ul.disc { list-style: disc outside; }
|
||||
ul ul, ul ol,
|
||||
ol ol, ol ul { margin: 4px 0 5px 30px; font-size: 90%; }
|
||||
ul ul li, ul ol li,
|
||||
ol ol li, ol ul li { margin-bottom: 6px; }
|
||||
li { line-height: 18px; margin-bottom: 12px; }
|
||||
ul.large li { line-height: 21px; }
|
||||
li p { line-height: 21px; }
|
||||
|
||||
/* #Images
|
||||
================================================== */
|
||||
|
||||
img.scale-with-grid {
|
||||
max-width: 100%;
|
||||
height: auto; }
|
||||
|
||||
|
||||
/* #Buttons
|
||||
================================================== */
|
||||
|
||||
.button,
|
||||
button,
|
||||
input[type="submit"],
|
||||
input[type="reset"],
|
||||
input[type="button"] {
|
||||
background: #eee; /* Old browsers */
|
||||
background: #eee -moz-linear-gradient(top, rgba(255,255,255,.2) 0%, rgba(0,0,0,.2) 100%); /* FF3.6+ */
|
||||
background: #eee -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.2)), color-stop(100%,rgba(0,0,0,.2))); /* Chrome,Safari4+ */
|
||||
background: #eee -webkit-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: #eee -o-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Opera11.10+ */
|
||||
background: #eee -ms-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* IE10+ */
|
||||
background: #eee linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* W3C */
|
||||
border: 1px solid #aaa;
|
||||
border-top: 1px solid #ccc;
|
||||
border-left: 1px solid #ccc;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
color: #444;
|
||||
display: inline-block;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
text-shadow: 0 1px rgba(255, 255, 255, .75);
|
||||
cursor: pointer;
|
||||
margin-bottom: 20px;
|
||||
line-height: normal;
|
||||
padding: 8px 10px;
|
||||
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; }
|
||||
|
||||
.button:hover,
|
||||
button:hover,
|
||||
input[type="submit"]:hover,
|
||||
input[type="reset"]:hover,
|
||||
input[type="button"]:hover {
|
||||
color: #222;
|
||||
background: #ddd; /* Old browsers */
|
||||
background: #ddd -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); /* FF3.6+ */
|
||||
background: #ddd -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.3)), color-stop(100%,rgba(0,0,0,.3))); /* Chrome,Safari4+ */
|
||||
background: #ddd -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: #ddd -o-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Opera11.10+ */
|
||||
background: #ddd -ms-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* IE10+ */
|
||||
background: #ddd linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* W3C */
|
||||
border: 1px solid #888;
|
||||
border-top: 1px solid #aaa;
|
||||
border-left: 1px solid #aaa; }
|
||||
|
||||
.button:active,
|
||||
button:active,
|
||||
input[type="submit"]:active,
|
||||
input[type="reset"]:active,
|
||||
input[type="button"]:active {
|
||||
border: 1px solid #666;
|
||||
background: #ccc; /* Old browsers */
|
||||
background: #ccc -moz-linear-gradient(top, rgba(255,255,255,.35) 0%, rgba(10,10,10,.4) 100%); /* FF3.6+ */
|
||||
background: #ccc -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.35)), color-stop(100%,rgba(10,10,10,.4))); /* Chrome,Safari4+ */
|
||||
background: #ccc -webkit-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: #ccc -o-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Opera11.10+ */
|
||||
background: #ccc -ms-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* IE10+ */
|
||||
background: #ccc linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* W3C */ }
|
||||
|
||||
.button.full-width,
|
||||
button.full-width,
|
||||
input[type="submit"].full-width,
|
||||
input[type="reset"].full-width,
|
||||
input[type="button"].full-width {
|
||||
width: 100%;
|
||||
padding-left: 0 !important;
|
||||
padding-right: 0 !important;
|
||||
text-align: center; }
|
||||
|
||||
/* Fix for odd Mozilla border & padding issues */
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/* #Forms
|
||||
================================================== */
|
||||
|
||||
form {
|
||||
margin-bottom: 20px; }
|
||||
fieldset {
|
||||
margin-bottom: 20px; }
|
||||
input[type="text"],
|
||||
input[type="password"],
|
||||
input[type="email"],
|
||||
textarea,
|
||||
select {
|
||||
border: 1px solid #ccc;
|
||||
padding: 6px 4px;
|
||||
outline: none;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
font: 13px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
color: #777;
|
||||
margin: 0;
|
||||
width: 210px;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-bottom: 20px;
|
||||
background: #fff; }
|
||||
select {
|
||||
padding: 0; }
|
||||
input[type="text"]:focus,
|
||||
input[type="password"]:focus,
|
||||
input[type="email"]:focus,
|
||||
textarea:focus {
|
||||
border: 1px solid #aaa;
|
||||
color: #444;
|
||||
-moz-box-shadow: 0 0 3px rgba(0,0,0,.2);
|
||||
-webkit-box-shadow: 0 0 3px rgba(0,0,0,.2);
|
||||
box-shadow: 0 0 3px rgba(0,0,0,.2); }
|
||||
textarea {
|
||||
min-height: 60px; }
|
||||
label,
|
||||
legend {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
font-size: 13px; }
|
||||
select {
|
||||
width: 220px; }
|
||||
input[type="checkbox"] {
|
||||
display: inline; }
|
||||
label span,
|
||||
legend span {
|
||||
font-weight: normal;
|
||||
font-size: 13px;
|
||||
color: #444; }
|
||||
|
||||
/* #Misc
|
||||
================================================== */
|
||||
.remove-bottom { margin-bottom: 0 !important; }
|
||||
.half-bottom { margin-bottom: 10px !important; }
|
||||
.add-bottom { margin-bottom: 20px !important; }
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* Skeleton V1.2
|
||||
* Copyright 2011, Dave Gamache
|
||||
* www.getskeleton.com
|
||||
* Free to use under the MIT license.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* 6/20/2012
|
||||
*/
|
||||
|
||||
/* Table of Content
|
||||
==================================================
|
||||
#Site Styles
|
||||
#Page Styles
|
||||
#Media Queries
|
||||
#Font-Face */
|
||||
|
||||
/* #Site Styles
|
||||
================================================== */
|
||||
|
||||
/* #Page Styles
|
||||
================================================== */
|
||||
|
||||
/* #Media Queries
|
||||
================================================== */
|
||||
|
||||
/* Smaller than standard 960 (devices and browsers) */
|
||||
@media only screen and (max-width: 959px) {}
|
||||
|
||||
/* Tablet Portrait size to standard 960 (devices and browsers) */
|
||||
@media only screen and (min-width: 768px) and (max-width: 959px) {}
|
||||
|
||||
/* All Mobile Sizes (devices and browser) */
|
||||
@media only screen and (max-width: 767px) {}
|
||||
|
||||
/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
|
||||
@media only screen and (min-width: 480px) and (max-width: 767px) {}
|
||||
|
||||
/* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
|
||||
@media only screen and (max-width: 479px) {}
|
||||
|
||||
|
||||
/* #Font-Face
|
||||
================================================== */
|
||||
/* This is the proper syntax for an @font-face file
|
||||
Just create a "fonts" folder at the root,
|
||||
copy your FontName into code below and remove
|
||||
comment brackets */
|
||||
|
||||
/* @font-face {
|
||||
font-family: 'FontName';
|
||||
src: url('../fonts/FontName.eot');
|
||||
src: url('../fonts/FontName.eot?iefix') format('eot'),
|
||||
url('../fonts/FontName.woff') format('woff'),
|
||||
url('../fonts/FontName.ttf') format('truetype'),
|
||||
url('../fonts/FontName.svg#webfontZam02nTh') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal; }
|
||||
*/
|
||||
|
||||
|
||||
/* `ref` stuff */
|
||||
code, pre {
|
||||
background-color: #fcf8f2;
|
||||
border: solid 1px rgba(68, 68, 68, 0.3);
|
||||
border-radius: 2px;
|
||||
padding: 1px 2px;
|
||||
-webkit-transition-property: background-color;
|
||||
-webkit-transition-duration: 0.5s;
|
||||
-webkit-transition-delay: 0s;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
pre code {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
p a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: disc;
|
||||
margin-left: 40px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 100px auto;
|
||||
}
|
||||
|
||||
.logo h1 .pointer {
|
||||
color: #dbe8d9;
|
||||
-webkit-transition-property: color;
|
||||
-webkit-transition-duration: 0.5s;
|
||||
-webkit-transition-delay: 0s;
|
||||
}
|
||||
|
||||
.logo h1:hover .pointer {
|
||||
color: #444;
|
||||
}
|
||||
|
||||
.logo h1 .version {
|
||||
color: #aaa;
|
||||
font-size: 0.3em;
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
left: 70px;
|
||||
}
|
||||
|
||||
.types table, .types tr {
|
||||
border: solid 1px #444;
|
||||
}
|
||||
|
||||
.types td, .types th {
|
||||
border: solid 1px #444;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.param, .rtn {
|
||||
display: inline-block;
|
||||
font-size: 0.8em;
|
||||
font-style: italic;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
a.nav {
|
||||
border: solid 1px transparent;
|
||||
border-radius: 2px;
|
||||
padding: 3px;
|
||||
margin-bottom: 20px;
|
||||
text-decoration: none;
|
||||
background-color: transparent;
|
||||
-webkit-transition-property: background-color, border-color;
|
||||
-webkit-transition-duration: 0.5s;
|
||||
-webkit-transition-delay: 0s;
|
||||
}
|
||||
|
||||
a.nav:hover {
|
||||
background-color: #fcf8f2;
|
||||
border-color: rgba(68, 68, 68, 0.3);
|
||||
}
|
||||
|
||||
a.nav:hover code {
|
||||
background-color: #dbe8d9;
|
||||
}
|
||||
|
||||
.subtitle h3 {
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
|
||||
/* GitHub Ribbon
|
||||
* http://unindented.org/articles/2009/10/github-ribbon-using-css-transforms */
|
||||
.ribbon {
|
||||
background-color: #fcf8f2;
|
||||
overflow: hidden;
|
||||
/* top right corner */
|
||||
position: fixed;
|
||||
right: -3em;
|
||||
top: 2.5em;
|
||||
/* 45 deg ccw rotation */
|
||||
-moz-transform: rotate(45deg);
|
||||
-webkit-transform: rotate(45deg);
|
||||
/* shadow */
|
||||
-moz-box-shadow: 0 0 0.5em #888;
|
||||
-webkit-box-shadow: 0 0 0.5em #888;
|
||||
/* hover transition */
|
||||
-webkit-transition-property: background-color;
|
||||
-webkit-transition-duration: 0.3s;
|
||||
-webkit-transition-delay: 0s;
|
||||
}
|
||||
|
||||
.ribbon a {
|
||||
border: solid 1px rgba(68, 68, 68, 0.4);
|
||||
color: #444;
|
||||
display: block;
|
||||
font: bold 81.25% 'Helvetiva Neue', Helvetica, Arial, sans-serif;
|
||||
margin: 0.05em 0 0.075em 0;
|
||||
padding: 0.5em 3.5em;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
/* shadow */
|
||||
text-shadow: 0 0 0.5em #888;
|
||||
}
|
||||
|
||||
.ribbon:hover {
|
||||
background-color: #dbe8d9;
|
||||
}
|
||||
+242
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
* Skeleton V1.2
|
||||
* Copyright 2011, Dave Gamache
|
||||
* www.getskeleton.com
|
||||
* Free to use under the MIT license.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* 6/20/2012
|
||||
*/
|
||||
|
||||
|
||||
/* Table of Contents
|
||||
==================================================
|
||||
#Base 960 Grid
|
||||
#Tablet (Portrait)
|
||||
#Mobile (Portrait)
|
||||
#Mobile (Landscape)
|
||||
#Clearing */
|
||||
|
||||
|
||||
|
||||
/* #Base 960 Grid
|
||||
================================================== */
|
||||
|
||||
.container { position: relative; width: 960px; margin: 0 auto; padding: 0; }
|
||||
.container .column,
|
||||
.container .columns { float: left; display: inline; margin-left: 10px; margin-right: 10px; }
|
||||
.row { margin-bottom: 20px; }
|
||||
|
||||
/* Nested Column Classes */
|
||||
.column.alpha, .columns.alpha { margin-left: 0; }
|
||||
.column.omega, .columns.omega { margin-right: 0; }
|
||||
|
||||
/* Base Grid */
|
||||
.container .one.column,
|
||||
.container .one.columns { width: 40px; }
|
||||
.container .two.columns { width: 100px; }
|
||||
.container .three.columns { width: 160px; }
|
||||
.container .four.columns { width: 220px; }
|
||||
.container .five.columns { width: 280px; }
|
||||
.container .six.columns { width: 340px; }
|
||||
.container .seven.columns { width: 400px; }
|
||||
.container .eight.columns { width: 460px; }
|
||||
.container .nine.columns { width: 520px; }
|
||||
.container .ten.columns { width: 580px; }
|
||||
.container .eleven.columns { width: 640px; }
|
||||
.container .twelve.columns { width: 700px; }
|
||||
.container .thirteen.columns { width: 760px; }
|
||||
.container .fourteen.columns { width: 820px; }
|
||||
.container .fifteen.columns { width: 880px; }
|
||||
.container .sixteen.columns { width: 940px; }
|
||||
|
||||
.container .one-third.column { width: 300px; }
|
||||
.container .two-thirds.column { width: 620px; }
|
||||
|
||||
/* Offsets */
|
||||
.container .offset-by-one { padding-left: 60px; }
|
||||
.container .offset-by-two { padding-left: 120px; }
|
||||
.container .offset-by-three { padding-left: 180px; }
|
||||
.container .offset-by-four { padding-left: 240px; }
|
||||
.container .offset-by-five { padding-left: 300px; }
|
||||
.container .offset-by-six { padding-left: 360px; }
|
||||
.container .offset-by-seven { padding-left: 420px; }
|
||||
.container .offset-by-eight { padding-left: 480px; }
|
||||
.container .offset-by-nine { padding-left: 540px; }
|
||||
.container .offset-by-ten { padding-left: 600px; }
|
||||
.container .offset-by-eleven { padding-left: 660px; }
|
||||
.container .offset-by-twelve { padding-left: 720px; }
|
||||
.container .offset-by-thirteen { padding-left: 780px; }
|
||||
.container .offset-by-fourteen { padding-left: 840px; }
|
||||
.container .offset-by-fifteen { padding-left: 900px; }
|
||||
|
||||
|
||||
|
||||
/* #Tablet (Portrait)
|
||||
================================================== */
|
||||
|
||||
/* Note: Design for a width of 768px */
|
||||
|
||||
@media only screen and (min-width: 768px) and (max-width: 959px) {
|
||||
.container { width: 768px; }
|
||||
.container .column,
|
||||
.container .columns { margin-left: 10px; margin-right: 10px; }
|
||||
.column.alpha, .columns.alpha { margin-left: 0; margin-right: 10px; }
|
||||
.column.omega, .columns.omega { margin-right: 0; margin-left: 10px; }
|
||||
.alpha.omega { margin-left: 0; margin-right: 0; }
|
||||
|
||||
.container .one.column,
|
||||
.container .one.columns { width: 28px; }
|
||||
.container .two.columns { width: 76px; }
|
||||
.container .three.columns { width: 124px; }
|
||||
.container .four.columns { width: 172px; }
|
||||
.container .five.columns { width: 220px; }
|
||||
.container .six.columns { width: 268px; }
|
||||
.container .seven.columns { width: 316px; }
|
||||
.container .eight.columns { width: 364px; }
|
||||
.container .nine.columns { width: 412px; }
|
||||
.container .ten.columns { width: 460px; }
|
||||
.container .eleven.columns { width: 508px; }
|
||||
.container .twelve.columns { width: 556px; }
|
||||
.container .thirteen.columns { width: 604px; }
|
||||
.container .fourteen.columns { width: 652px; }
|
||||
.container .fifteen.columns { width: 700px; }
|
||||
.container .sixteen.columns { width: 748px; }
|
||||
|
||||
.container .one-third.column { width: 236px; }
|
||||
.container .two-thirds.column { width: 492px; }
|
||||
|
||||
/* Offsets */
|
||||
.container .offset-by-one { padding-left: 48px; }
|
||||
.container .offset-by-two { padding-left: 96px; }
|
||||
.container .offset-by-three { padding-left: 144px; }
|
||||
.container .offset-by-four { padding-left: 192px; }
|
||||
.container .offset-by-five { padding-left: 240px; }
|
||||
.container .offset-by-six { padding-left: 288px; }
|
||||
.container .offset-by-seven { padding-left: 336px; }
|
||||
.container .offset-by-eight { padding-left: 384px; }
|
||||
.container .offset-by-nine { padding-left: 432px; }
|
||||
.container .offset-by-ten { padding-left: 480px; }
|
||||
.container .offset-by-eleven { padding-left: 528px; }
|
||||
.container .offset-by-twelve { padding-left: 576px; }
|
||||
.container .offset-by-thirteen { padding-left: 624px; }
|
||||
.container .offset-by-fourteen { padding-left: 672px; }
|
||||
.container .offset-by-fifteen { padding-left: 720px; }
|
||||
}
|
||||
|
||||
|
||||
/* #Mobile (Portrait)
|
||||
================================================== */
|
||||
|
||||
/* Note: Design for a width of 320px */
|
||||
|
||||
@media only screen and (max-width: 767px) {
|
||||
.container { width: 300px; }
|
||||
.container .columns,
|
||||
.container .column { margin: 0; }
|
||||
|
||||
.container .one.column,
|
||||
.container .one.columns,
|
||||
.container .two.columns,
|
||||
.container .three.columns,
|
||||
.container .four.columns,
|
||||
.container .five.columns,
|
||||
.container .six.columns,
|
||||
.container .seven.columns,
|
||||
.container .eight.columns,
|
||||
.container .nine.columns,
|
||||
.container .ten.columns,
|
||||
.container .eleven.columns,
|
||||
.container .twelve.columns,
|
||||
.container .thirteen.columns,
|
||||
.container .fourteen.columns,
|
||||
.container .fifteen.columns,
|
||||
.container .sixteen.columns,
|
||||
.container .one-third.column,
|
||||
.container .two-thirds.column { width: 300px; }
|
||||
|
||||
/* Offsets */
|
||||
.container .offset-by-one,
|
||||
.container .offset-by-two,
|
||||
.container .offset-by-three,
|
||||
.container .offset-by-four,
|
||||
.container .offset-by-five,
|
||||
.container .offset-by-six,
|
||||
.container .offset-by-seven,
|
||||
.container .offset-by-eight,
|
||||
.container .offset-by-nine,
|
||||
.container .offset-by-ten,
|
||||
.container .offset-by-eleven,
|
||||
.container .offset-by-twelve,
|
||||
.container .offset-by-thirteen,
|
||||
.container .offset-by-fourteen,
|
||||
.container .offset-by-fifteen { padding-left: 0; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* #Mobile (Landscape)
|
||||
================================================== */
|
||||
|
||||
/* Note: Design for a width of 480px */
|
||||
|
||||
@media only screen and (min-width: 480px) and (max-width: 767px) {
|
||||
.container { width: 420px; }
|
||||
.container .columns,
|
||||
.container .column { margin: 0; }
|
||||
|
||||
.container .one.column,
|
||||
.container .one.columns,
|
||||
.container .two.columns,
|
||||
.container .three.columns,
|
||||
.container .four.columns,
|
||||
.container .five.columns,
|
||||
.container .six.columns,
|
||||
.container .seven.columns,
|
||||
.container .eight.columns,
|
||||
.container .nine.columns,
|
||||
.container .ten.columns,
|
||||
.container .eleven.columns,
|
||||
.container .twelve.columns,
|
||||
.container .thirteen.columns,
|
||||
.container .fourteen.columns,
|
||||
.container .fifteen.columns,
|
||||
.container .sixteen.columns,
|
||||
.container .one-third.column,
|
||||
.container .two-thirds.column { width: 420px; }
|
||||
}
|
||||
|
||||
|
||||
/* #Clearing
|
||||
================================================== */
|
||||
|
||||
/* Self Clearing Goodness */
|
||||
.container:after { content: "\0020"; display: block; height: 0; clear: both; visibility: hidden; }
|
||||
|
||||
/* Use clearfix class on parent to clear nested columns,
|
||||
or wrap each row of columns in a <div class="row"> */
|
||||
.clearfix:before,
|
||||
.clearfix:after,
|
||||
.row:before,
|
||||
.row:after {
|
||||
content: '\0020';
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
width: 0;
|
||||
height: 0; }
|
||||
.row:after,
|
||||
.clearfix:after {
|
||||
clear: both; }
|
||||
.row,
|
||||
.clearfix {
|
||||
zoom: 1; }
|
||||
|
||||
/* You can also use a <br class="clear" /> to clear columns */
|
||||
.clear {
|
||||
clear: both;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
+1463
File diff suppressed because it is too large
Load Diff
+80
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"_from": "ref@1",
|
||||
"_id": "ref@1.3.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-2cBCniTtxcGUjDpvFfVpw323a83/0RLSGJJY5l5lcomZWhYpU2cuLdsvYqMixvsdLJ9+sTdzEkju8J8ZHDM2nA==",
|
||||
"_location": "/ref",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ref@1",
|
||||
"name": "ref",
|
||||
"escapedName": "ref",
|
||||
"rawSpec": "1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/ref-struct"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ref/-/ref-1.3.5.tgz",
|
||||
"_shasum": "0e33f080cdb94a3d95312b2b3b1fd0f82044ca0f",
|
||||
"_spec": "ref@1",
|
||||
"_where": "C:\\Users\\matia\\Documents\\GitHub\\FutoX-Musix\\node_modules\\ref-struct",
|
||||
"author": {
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://tootallnate.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/TooTallNate/ref/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"bindings": "1",
|
||||
"debug": "2",
|
||||
"nan": "2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Turn Buffer instances into \"pointers\"",
|
||||
"devDependencies": {
|
||||
"dox": "0.4.4",
|
||||
"highlight.js": "1",
|
||||
"jade": "^0.35.0",
|
||||
"marked": "^0.3.2",
|
||||
"mocha": "*",
|
||||
"weak": "1"
|
||||
},
|
||||
"gypfile": true,
|
||||
"homepage": "https://github.com/TooTallNate/ref#readme",
|
||||
"keywords": [
|
||||
"native",
|
||||
"buffer",
|
||||
"extensions",
|
||||
"c++",
|
||||
"pointer",
|
||||
"reference",
|
||||
"dereference",
|
||||
"type",
|
||||
"int",
|
||||
"long",
|
||||
"float",
|
||||
"double",
|
||||
"byte",
|
||||
"64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/ref.js",
|
||||
"name": "ref",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TooTallNate/ref.git"
|
||||
},
|
||||
"scripts": {
|
||||
"docs": "node docs/compile",
|
||||
"install": "node-gyp rebuild",
|
||||
"test": "mocha -gc --reporter spec --use_strict"
|
||||
},
|
||||
"version": "1.3.5"
|
||||
}
|
||||
+660
@@ -0,0 +1,660 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "node.h"
|
||||
#include "node_buffer.h"
|
||||
#include "nan.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define __alignof__ __alignof
|
||||
#define snprintf(buf, bufSize, format, arg) _snprintf_s(buf, bufSize, _TRUNCATE, format, arg)
|
||||
#define strtoll _strtoi64
|
||||
#define strtoull _strtoui64
|
||||
#define PRId64 "lld"
|
||||
#define PRIu64 "llu"
|
||||
#else
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
|
||||
using namespace v8;
|
||||
using namespace node;
|
||||
|
||||
namespace {
|
||||
|
||||
// used by the Int64 functions to determine whether to return a Number
|
||||
// or String based on whether or not a Number will lose precision.
|
||||
// http://stackoverflow.com/q/307179/376773
|
||||
#define JS_MAX_INT +9007199254740992LL
|
||||
#define JS_MIN_INT -9007199254740992LL
|
||||
|
||||
// mirrors deps/v8/src/objects.h.
|
||||
// we could use `node::Buffer::kMaxLength`, but it's not defined on node v0.6.x
|
||||
static const unsigned int kMaxLength = 0x3fffffff;
|
||||
|
||||
// get int64 from a value
|
||||
inline int64_t GetInt64(Local<Value> value) {
|
||||
return value->IsNumber() ? Nan::To<int64_t>(value).FromJust() : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the pointer address as a Number of the given Buffer instance.
|
||||
* It's recommended to use `hexAddress()` in most cases instead of this function.
|
||||
*
|
||||
* WARNING: a JavaScript Number cannot precisely store a full 64-bit memory
|
||||
* address, so there's a possibility of an inaccurate value being returned
|
||||
* on 64-bit systems.
|
||||
*
|
||||
* info[0] - Buffer - the Buffer instance get the memory address of
|
||||
* info[1] - Number - optional (0) - the offset of the Buffer start at
|
||||
*/
|
||||
|
||||
NAN_METHOD(Address) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("address: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
uintptr_t intptr = (uintptr_t)ptr;
|
||||
Local<Number> rtn = Nan::New(static_cast<double>(intptr));
|
||||
|
||||
info.GetReturnValue().Set(rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pointer address as a hexadecimal String. This function
|
||||
* is safe to use for displaying memory addresses, as compared to the
|
||||
* `address()` function which could overflow since it returns a Number.
|
||||
*
|
||||
* info[0] - Buffer - the Buffer instance get the memory address of
|
||||
* info[1] - Number - optional (0) - the offset of the Buffer start at
|
||||
*/
|
||||
|
||||
NAN_METHOD(HexAddress) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("hexAddress: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
char strbuf[30]; /* should be plenty... */
|
||||
snprintf(strbuf, 30, "%p", ptr);
|
||||
|
||||
Local<String> val;
|
||||
if (strbuf[0] == '0' && strbuf[1] == 'x') {
|
||||
/* strip the leading "0x" from the address */
|
||||
val = Nan::New(strbuf + 2).ToLocalChecked();
|
||||
} else {
|
||||
val = Nan::New(strbuf).ToLocalChecked();
|
||||
}
|
||||
|
||||
info.GetReturnValue().Set(val);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns "true" if the given Buffer points to NULL, "false" otherwise.
|
||||
*
|
||||
* info[0] - Buffer - the Buffer instance to check for NULL
|
||||
* info[1] - Number - optional (0) - the offset of the Buffer start at
|
||||
*/
|
||||
|
||||
NAN_METHOD(IsNull) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("isNull: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
Local<Value> rtn = Nan::New(ptr == NULL);
|
||||
|
||||
info.GetReturnValue().Set(rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the machine endianness as C String; either "BE" or "LE".
|
||||
*/
|
||||
|
||||
const char *CheckEndianness() {
|
||||
int i = 1;
|
||||
bool is_bigendian = (*(char *)&i) == 0;
|
||||
if (is_bigendian) {
|
||||
return "BE";
|
||||
} else {
|
||||
return "LE";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts an arbitrary pointer to a node Buffer with specified length
|
||||
*/
|
||||
|
||||
void wrap_pointer_cb(char *data, void *hint) {
|
||||
}
|
||||
|
||||
inline Local<Value> WrapPointer(char *ptr, size_t length) {
|
||||
Nan::EscapableHandleScope scope;
|
||||
if (ptr == NULL) length = 0;
|
||||
return scope.Escape(Nan::NewBuffer(ptr, length, wrap_pointer_cb, NULL).ToLocalChecked());
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates the "null_pointer_buffer" Buffer instance that points to NULL.
|
||||
* It has a length of 0 so that you don't accidentally try to deref the NULL
|
||||
* pointer in JS-land by doing something like: `ref.NULL[0]`.
|
||||
*/
|
||||
|
||||
inline Local<Value> WrapNullPointer() {
|
||||
return WrapPointer((char*)NULL, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Retreives a JS Object instance that was previously stored in
|
||||
* the given Buffer instance at the given offset.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to read from
|
||||
* info[1] - Number - the offset from the "buf" buffer's address to read from
|
||||
*/
|
||||
|
||||
NAN_METHOD(ReadObject) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("readObject: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return Nan::ThrowError("readObject: Cannot read from NULL pointer");
|
||||
}
|
||||
|
||||
Persistent<Object>* prtn = reinterpret_cast<Persistent<Object>*>(ptr);
|
||||
Local<Value> rtn = Nan::New(*prtn);
|
||||
info.GetReturnValue().Set(rtn);
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback function for when the weak persistent object from WriteObject
|
||||
* gets garbage collected. We just have to dispose of our weak reference now.
|
||||
*/
|
||||
|
||||
void write_object_cb(const Nan::WeakCallbackInfo<void>& data) {
|
||||
//fprintf(stderr, "write_object_cb\n");
|
||||
//NanDisposePersistent(data.GetValue());
|
||||
}
|
||||
|
||||
/*
|
||||
* Writes a Persistent reference to given Object to the given Buffer
|
||||
* instance and offset.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to write to
|
||||
* info[1] - Number - the offset from the "buf" buffer's address to write to
|
||||
* info[2] - Object - the "obj" Object which will have a new Persistent reference
|
||||
* created for the obj, who'se memory address will be written
|
||||
* info[3] - Boolean - `false` by default. if `true` is passed in then a
|
||||
* persistent reference will be written to the Buffer instance.
|
||||
* A weak reference gets written by default.
|
||||
*/
|
||||
|
||||
NAN_METHOD(WriteObject) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("writeObject: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
Nan::Persistent<Object>* pptr = reinterpret_cast<Nan::Persistent<Object>*>(ptr);
|
||||
Local<Object> val = info[2].As<Object>();
|
||||
|
||||
bool persistent = info[3]->BooleanValue();
|
||||
if (persistent) {
|
||||
(*pptr).Reset(val);
|
||||
} else {
|
||||
void *user_data = NULL;
|
||||
Nan::Persistent<Object> p2(val);
|
||||
p2.SetWeak(user_data, write_object_cb, Nan::WeakCallbackType::kParameter);
|
||||
memcpy(pptr, &p2, sizeof(Nan::Persistent<Object>));
|
||||
}
|
||||
|
||||
info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads the memory address of the given "buf" pointer Buffer at the specified
|
||||
* offset, and returns a new SlowBuffer instance from the memory address stored.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to read from
|
||||
* info[1] - Number - the offset from the "buf" buffer's address to read from
|
||||
* info[2] - Number - the length in bytes of the returned SlowBuffer instance
|
||||
*/
|
||||
|
||||
NAN_METHOD(ReadPointer) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("readPointer: Buffer instance expected as first argument");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
size_t size = info[2]->Uint32Value();
|
||||
|
||||
if (ptr == NULL) {
|
||||
return Nan::ThrowError("readPointer: Cannot read from NULL pointer");
|
||||
}
|
||||
|
||||
char *val = *reinterpret_cast<char **>(ptr);
|
||||
info.GetReturnValue().Set(WrapPointer(val, size));
|
||||
}
|
||||
|
||||
/*
|
||||
* Writes the memory address of the "input" buffer (and optional offset) to the
|
||||
* specified "buf" buffer and offset. Essentially making "buf" hold a reference
|
||||
* to the "input" Buffer.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to write to
|
||||
* info[1] - Number - the offset from the "buf" buffer's address to write to
|
||||
* info[2] - Buffer - the "input" Buffer whose memory address will be written
|
||||
*/
|
||||
|
||||
NAN_METHOD(WritePointer) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
Local<Value> input = info[2];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("writePointer: Buffer instance expected as first argument");
|
||||
}
|
||||
if (!(input->IsNull() || Buffer::HasInstance(input))) {
|
||||
return Nan::ThrowTypeError("writePointer: Buffer instance expected as third argument");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
if (input->IsNull()) {
|
||||
*reinterpret_cast<char **>(ptr) = NULL;
|
||||
} else {
|
||||
char *input_ptr = Buffer::Data(input.As<Object>());
|
||||
*reinterpret_cast<char **>(ptr) = input_ptr;
|
||||
}
|
||||
|
||||
info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads a machine-endian int64_t from the given Buffer at the given offset.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to read from
|
||||
* info[1] - Number - the offset from the "buf" buffer's address to read from
|
||||
*/
|
||||
|
||||
NAN_METHOD(ReadInt64) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("readInt64: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return Nan::ThrowTypeError("readInt64: Cannot read from NULL pointer");
|
||||
}
|
||||
|
||||
int64_t val = *reinterpret_cast<int64_t *>(ptr);
|
||||
|
||||
Local<Value> rtn;
|
||||
if (val < JS_MIN_INT || val > JS_MAX_INT) {
|
||||
// return a String
|
||||
char strbuf[128];
|
||||
snprintf(strbuf, 128, "%" PRId64, val);
|
||||
rtn = Nan::New<v8::String>(strbuf).ToLocalChecked();
|
||||
} else {
|
||||
// return a Number
|
||||
rtn = Nan::New<v8::Number>(static_cast<double>(val));
|
||||
}
|
||||
|
||||
info.GetReturnValue().Set(rtn);
|
||||
}
|
||||
|
||||
/*
|
||||
* Writes the input Number/String int64 value as a machine-endian int64_t to
|
||||
* the given Buffer at the given offset.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to write to
|
||||
* info[1] - Number - the offset from the "buf" buffer's address to write to
|
||||
* info[2] - String/Number - the "input" String or Number which will be written
|
||||
*/
|
||||
|
||||
NAN_METHOD(WriteInt64) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("writeInt64: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
Local<Value> in = info[2];
|
||||
int64_t val;
|
||||
if (in->IsNumber()) {
|
||||
val = GetInt64(in);
|
||||
} else if (in->IsString()) {
|
||||
char *endptr, *str;
|
||||
int base = 0;
|
||||
String::Utf8Value _str(in);
|
||||
str = *_str;
|
||||
|
||||
errno = 0; /* To distinguish success/failure after call */
|
||||
val = strtoll(str, &endptr, base);
|
||||
|
||||
if (endptr == str) {
|
||||
return Nan::ThrowTypeError("writeInt64: no digits we found in input String");
|
||||
} else if (errno == ERANGE && (val == LLONG_MAX || val == LLONG_MIN)) {
|
||||
return Nan::ThrowTypeError("writeInt64: input String numerical value out of range");
|
||||
} else if (errno != 0 && val == 0) {
|
||||
char errmsg[200];
|
||||
snprintf(errmsg, sizeof(errmsg), "writeInt64: %s", strerror(errno));
|
||||
return Nan::ThrowTypeError(errmsg);
|
||||
}
|
||||
} else {
|
||||
return Nan::ThrowTypeError("writeInt64: Number/String 64-bit value required");
|
||||
}
|
||||
|
||||
*reinterpret_cast<int64_t *>(ptr) = val;
|
||||
|
||||
info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads a machine-endian uint64_t from the given Buffer at the given offset.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to read from
|
||||
* info[1] - Number - the offset from the "buf" buffer's address to read from
|
||||
*/
|
||||
|
||||
NAN_METHOD(ReadUInt64) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("readUInt64: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return Nan::ThrowTypeError("readUInt64: Cannot read from NULL pointer");
|
||||
}
|
||||
|
||||
uint64_t val = *reinterpret_cast<uint64_t *>(ptr);
|
||||
|
||||
Local<Value> rtn;
|
||||
if (val > JS_MAX_INT) {
|
||||
// return a String
|
||||
char strbuf[128];
|
||||
snprintf(strbuf, 128, "%" PRIu64, val);
|
||||
rtn = Nan::New<v8::String>(strbuf).ToLocalChecked();
|
||||
} else {
|
||||
// return a Number
|
||||
rtn = Nan::New<v8::Number>(static_cast<double>(val));
|
||||
}
|
||||
|
||||
info.GetReturnValue().Set(rtn);
|
||||
}
|
||||
|
||||
/*
|
||||
* Writes the input Number/String uint64 value as a machine-endian uint64_t to
|
||||
* the given Buffer at the given offset.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to write to
|
||||
* info[1] - Number - the offset from the "buf" buffer's address to write to
|
||||
* info[2] - String/Number - the "input" String or Number which will be written
|
||||
*/
|
||||
|
||||
NAN_METHOD(WriteUInt64) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("writeUInt64: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
Local<Value> in = info[2];
|
||||
uint64_t val;
|
||||
if (in->IsNumber()) {
|
||||
val = GetInt64(in);
|
||||
} else if (in->IsString()) {
|
||||
char *endptr, *str;
|
||||
int base = 0;
|
||||
String::Utf8Value _str(in);
|
||||
str = *_str;
|
||||
|
||||
errno = 0; /* To distinguish success/failure after call */
|
||||
val = strtoull(str, &endptr, base);
|
||||
|
||||
if (endptr == str) {
|
||||
return Nan::ThrowTypeError("writeUInt64: no digits we found in input String");
|
||||
} else if (errno == ERANGE && val == ULLONG_MAX) {
|
||||
return Nan::ThrowTypeError("writeUInt64: input String numerical value out of range");
|
||||
} else if (errno != 0 && val == 0) {
|
||||
char errmsg[200];
|
||||
snprintf(errmsg, sizeof(errmsg), "writeUInt64: %s", strerror(errno));
|
||||
return Nan::ThrowTypeError(errmsg);
|
||||
}
|
||||
} else {
|
||||
return Nan::ThrowTypeError("writeUInt64: Number/String 64-bit value required");
|
||||
}
|
||||
|
||||
*reinterpret_cast<uint64_t *>(ptr) = val;
|
||||
|
||||
info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads a Utf8 C String from the given pointer at the given offset (or 0).
|
||||
* I didn't want to add this function but it ends up being necessary for reading
|
||||
* past a 0 or 1 length Buffer's boundary in node-ffi :\
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to read from
|
||||
* info[1] - Number - the offset from the "buf" buffer's address to read from
|
||||
*/
|
||||
|
||||
NAN_METHOD(ReadCString) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("readCString: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[1]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return Nan::ThrowError("readCString: Cannot read from NULL pointer");
|
||||
}
|
||||
|
||||
Local<Value> rtn = Nan::New<v8::String>(ptr).ToLocalChecked();
|
||||
info.GetReturnValue().Set(rtn);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a new Buffer instance that has the same memory address
|
||||
* as the given buffer, but with the specified size.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to read the address from
|
||||
* info[1] - Number - the size in bytes that the returned Buffer should be
|
||||
* info[2] - Number - the offset from the "buf" buffer's address to read from
|
||||
*/
|
||||
|
||||
NAN_METHOD(ReinterpretBuffer) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("reinterpret: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[2]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return Nan::ThrowError("reinterpret: Cannot reinterpret from NULL pointer");
|
||||
}
|
||||
|
||||
size_t size = info[1]->Uint32Value();
|
||||
|
||||
info.GetReturnValue().Set(WrapPointer(ptr, size));
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a new Buffer instance that has the same memory address
|
||||
* as the given buffer, but with a length up to the first aligned set of values of
|
||||
* 0 in a row for the given length.
|
||||
*
|
||||
* info[0] - Buffer - the "buf" Buffer instance to read the address from
|
||||
* info[1] - Number - the number of sequential 0-byte values that need to be read
|
||||
* info[2] - Number - the offset from the "buf" buffer's address to read from
|
||||
*/
|
||||
|
||||
NAN_METHOD(ReinterpretBufferUntilZeros) {
|
||||
|
||||
Local<Value> buf = info[0];
|
||||
if (!Buffer::HasInstance(buf)) {
|
||||
return Nan::ThrowTypeError("reinterpretUntilZeros: Buffer instance expected");
|
||||
}
|
||||
|
||||
int64_t offset = GetInt64(info[2]);
|
||||
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return Nan::ThrowError("reinterpretUntilZeros: Cannot reinterpret from NULL pointer");
|
||||
}
|
||||
|
||||
uint32_t numZeros = info[1]->Uint32Value();
|
||||
uint32_t i = 0;
|
||||
size_t size = 0;
|
||||
bool end = false;
|
||||
|
||||
while (!end && size < kMaxLength) {
|
||||
end = true;
|
||||
for (i = 0; i < numZeros; i++) {
|
||||
if (ptr[size + i] != 0) {
|
||||
end = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!end) {
|
||||
size += numZeros;
|
||||
}
|
||||
}
|
||||
|
||||
info.GetReturnValue().Set(WrapPointer(ptr, size));
|
||||
}
|
||||
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
NAN_MODULE_INIT(init) {
|
||||
Nan::HandleScope scope;
|
||||
|
||||
// "sizeof" map
|
||||
Local<Object> smap = Nan::New<v8::Object>();
|
||||
// fixed sizes
|
||||
#define SET_SIZEOF(name, type) \
|
||||
smap->Set(Nan::New<v8::String>( #name ).ToLocalChecked(), Nan::New<v8::Uint32>(static_cast<uint32_t>(sizeof(type))));
|
||||
SET_SIZEOF(int8, int8_t);
|
||||
SET_SIZEOF(uint8, uint8_t);
|
||||
SET_SIZEOF(int16, int16_t);
|
||||
SET_SIZEOF(uint16, uint16_t);
|
||||
SET_SIZEOF(int32, int32_t);
|
||||
SET_SIZEOF(uint32, uint32_t);
|
||||
SET_SIZEOF(int64, int64_t);
|
||||
SET_SIZEOF(uint64, uint64_t);
|
||||
SET_SIZEOF(float, float);
|
||||
SET_SIZEOF(double, double);
|
||||
// (potentially) variable sizes
|
||||
SET_SIZEOF(bool, bool);
|
||||
SET_SIZEOF(byte, unsigned char);
|
||||
SET_SIZEOF(char, char);
|
||||
SET_SIZEOF(uchar, unsigned char);
|
||||
SET_SIZEOF(short, short);
|
||||
SET_SIZEOF(ushort, unsigned short);
|
||||
SET_SIZEOF(int, int);
|
||||
SET_SIZEOF(uint, unsigned int);
|
||||
SET_SIZEOF(long, long);
|
||||
SET_SIZEOF(ulong, unsigned long);
|
||||
SET_SIZEOF(longlong, long long);
|
||||
SET_SIZEOF(ulonglong, unsigned long long);
|
||||
SET_SIZEOF(pointer, char *);
|
||||
SET_SIZEOF(size_t, size_t);
|
||||
// size of a Persistent handle to a JS object
|
||||
SET_SIZEOF(Object, Nan::Persistent<Object>);
|
||||
|
||||
// "alignof" map
|
||||
Local<Object> amap = Nan::New<v8::Object>();
|
||||
#define SET_ALIGNOF(name, type) \
|
||||
struct s_##name { type a; }; \
|
||||
amap->Set(Nan::New<v8::String>( #name ).ToLocalChecked(), Nan::New<v8::Uint32>(static_cast<uint32_t>(__alignof__(struct s_##name))));
|
||||
SET_ALIGNOF(int8, int8_t);
|
||||
SET_ALIGNOF(uint8, uint8_t);
|
||||
SET_ALIGNOF(int16, int16_t);
|
||||
SET_ALIGNOF(uint16, uint16_t);
|
||||
SET_ALIGNOF(int32, int32_t);
|
||||
SET_ALIGNOF(uint32, uint32_t);
|
||||
SET_ALIGNOF(int64, int64_t);
|
||||
SET_ALIGNOF(uint64, uint64_t);
|
||||
SET_ALIGNOF(float, float);
|
||||
SET_ALIGNOF(double, double);
|
||||
SET_ALIGNOF(bool, bool);
|
||||
SET_ALIGNOF(char, char);
|
||||
SET_ALIGNOF(uchar, unsigned char);
|
||||
SET_ALIGNOF(short, short);
|
||||
SET_ALIGNOF(ushort, unsigned short);
|
||||
SET_ALIGNOF(int, int);
|
||||
SET_ALIGNOF(uint, unsigned int);
|
||||
SET_ALIGNOF(long, long);
|
||||
SET_ALIGNOF(ulong, unsigned long);
|
||||
SET_ALIGNOF(longlong, long long);
|
||||
SET_ALIGNOF(ulonglong, unsigned long long);
|
||||
SET_ALIGNOF(pointer, char *);
|
||||
SET_ALIGNOF(size_t, size_t);
|
||||
SET_ALIGNOF(Object, Nan::Persistent<Object>);
|
||||
|
||||
// exports
|
||||
target->Set(Nan::New<v8::String>("sizeof").ToLocalChecked(), smap);
|
||||
target->Set(Nan::New<v8::String>("alignof").ToLocalChecked(), amap);
|
||||
Nan::ForceSet(target, Nan::New<v8::String>("endianness").ToLocalChecked(), Nan::New<v8::String>(CheckEndianness()).ToLocalChecked(), static_cast<PropertyAttribute>(ReadOnly|DontDelete));
|
||||
Nan::ForceSet(target, Nan::New<v8::String>("NULL").ToLocalChecked(), WrapNullPointer(), static_cast<PropertyAttribute>(ReadOnly|DontDelete));
|
||||
Nan::SetMethod(target, "address", Address);
|
||||
Nan::SetMethod(target, "hexAddress", HexAddress);
|
||||
Nan::SetMethod(target, "isNull", IsNull);
|
||||
Nan::SetMethod(target, "readObject", ReadObject);
|
||||
Nan::SetMethod(target, "writeObject", WriteObject);
|
||||
Nan::SetMethod(target, "readPointer", ReadPointer);
|
||||
Nan::SetMethod(target, "writePointer", WritePointer);
|
||||
Nan::SetMethod(target, "readInt64", ReadInt64);
|
||||
Nan::SetMethod(target, "writeInt64", WriteInt64);
|
||||
Nan::SetMethod(target, "readUInt64", ReadUInt64);
|
||||
Nan::SetMethod(target, "writeUInt64", WriteUInt64);
|
||||
Nan::SetMethod(target, "readCString", ReadCString);
|
||||
Nan::SetMethod(target, "reinterpret", ReinterpretBuffer);
|
||||
Nan::SetMethod(target, "reinterpretUntilZeros", ReinterpretBufferUntilZeros);
|
||||
}
|
||||
NODE_MODULE(binding, init);
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
var ref = require('../')
|
||||
var assert = require('assert')
|
||||
var inspect = require('util').inspect
|
||||
|
||||
describe('address', function () {
|
||||
|
||||
var buf = new Buffer('hello')
|
||||
|
||||
it('should return 0 for the NULL pointer', function () {
|
||||
assert.strictEqual(0, ref.address(ref.NULL))
|
||||
})
|
||||
|
||||
it('should give a positive value for any other Buffer', function () {
|
||||
var address = ref.address(buf)
|
||||
assert.equal(typeof address, 'number')
|
||||
assert(isFinite(address))
|
||||
assert(address > 0)
|
||||
})
|
||||
|
||||
it('should accept an offset value for the 2nd argument', function () {
|
||||
var address = ref.address(buf)
|
||||
assert.equal(address + 0, ref.address(buf, 0))
|
||||
assert.equal(address + 1, ref.address(buf, 1))
|
||||
assert.equal(address + 2, ref.address(buf, 2))
|
||||
assert.equal(address + 3, ref.address(buf, 3))
|
||||
assert.equal(address + 4, ref.address(buf, 4))
|
||||
assert.equal(address + 5, ref.address(buf, 5))
|
||||
})
|
||||
|
||||
it('should accept a negative offset value for the 2nd argument', function () {
|
||||
var address = ref.address(buf)
|
||||
assert.equal(address - 0, ref.address(buf, -0))
|
||||
assert.equal(address - 1, ref.address(buf, -1))
|
||||
assert.equal(address - 2, ref.address(buf, -2))
|
||||
assert.equal(address - 3, ref.address(buf, -3))
|
||||
assert.equal(address - 4, ref.address(buf, -4))
|
||||
assert.equal(address - 5, ref.address(buf, -5))
|
||||
})
|
||||
|
||||
it('should have an offset of zero when none is given', function () {
|
||||
assert.equal(ref.address(buf), ref.address(buf, 0))
|
||||
})
|
||||
|
||||
describe('inspect()', function () {
|
||||
|
||||
it('should overwrite the default Buffer#inspect() to print the memory address', function () {
|
||||
assert(inspect(buf).indexOf(buf.hexAddress()) !== -1)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
describe('alloc()', function () {
|
||||
|
||||
it('should return a new Buffer of "bool" size', function () {
|
||||
var buf = ref.alloc(ref.types.bool)
|
||||
assert.equal(ref.sizeof.bool, buf.length)
|
||||
})
|
||||
|
||||
it('should coerce string type names', function () {
|
||||
var buf = ref.alloc('bool')
|
||||
assert.strictEqual(ref.types.bool, buf.type)
|
||||
})
|
||||
|
||||
})
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
describe('bool', function () {
|
||||
|
||||
var buf = ref.alloc('bool')
|
||||
|
||||
it('should return JS "false" for a value of 0', function () {
|
||||
buf[0] = 0
|
||||
assert.strictEqual(false, ref.get(buf))
|
||||
})
|
||||
|
||||
it('should return JS "true" for a value of 1', function () {
|
||||
buf[0] = 1
|
||||
assert.strictEqual(true, ref.get(buf))
|
||||
})
|
||||
|
||||
it('should write a JS "false" value as 0', function () {
|
||||
ref.set(buf, 0, false)
|
||||
assert.strictEqual(0, buf[0])
|
||||
})
|
||||
|
||||
it('should write a JS "true" value as 1', function () {
|
||||
ref.set(buf, 0, true)
|
||||
assert.strictEqual(1, buf[0])
|
||||
})
|
||||
|
||||
it('should allow uint8 number values to be written to it', function () {
|
||||
var val = 255
|
||||
ref.set(buf, 0, val)
|
||||
assert.strictEqual(true, ref.get(buf))
|
||||
assert.strictEqual(val, buf[0])
|
||||
})
|
||||
|
||||
})
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
describe('char', function () {
|
||||
|
||||
it('should accept a JS String, and write the first char\'s code', function () {
|
||||
var val = 'a'
|
||||
|
||||
var buf = ref.alloc('char', val)
|
||||
assert.strictEqual(val.charCodeAt(0), buf.deref())
|
||||
|
||||
buf = ref.alloc('uchar', val)
|
||||
assert.strictEqual(val.charCodeAt(0), buf.deref())
|
||||
})
|
||||
|
||||
})
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
describe('coerce', function () {
|
||||
|
||||
it('should return `ref.types.void` for "void"', function () {
|
||||
var type = ref.coerceType('void')
|
||||
assert.strictEqual(ref.types.void, type)
|
||||
})
|
||||
|
||||
it('should return a ref type when a "*" is present', function () {
|
||||
var type = ref.coerceType('void *')
|
||||
assert(type !== ref.types.void)
|
||||
assert.equal(type.indirection, ref.types.void.indirection + 1)
|
||||
})
|
||||
|
||||
it('should coerce the "type" property of a Buffer', function () {
|
||||
var buf = new Buffer(ref.sizeof.int)
|
||||
buf.type = 'int'
|
||||
var type = ref.getType(buf)
|
||||
assert.strictEqual(ref.types.int, type)
|
||||
assert.strictEqual('int', buf.type)
|
||||
})
|
||||
|
||||
it('should coerce "Object" to `ref.types.Object`', function () {
|
||||
assert.strictEqual(ref.types.Object, ref.coerceType('Object'))
|
||||
})
|
||||
|
||||
it('should coerce the optional type in `ref.get()`', function () {
|
||||
var b = new Buffer(ref.sizeof.int8)
|
||||
b[0] = 5
|
||||
assert.strictEqual(5, ref.get(b, 0, 'int8'))
|
||||
})
|
||||
|
||||
it('should coerce the optional type in `ref.set()`', function () {
|
||||
var b = new Buffer(ref.sizeof.int8)
|
||||
ref.set(b, 0, 5, 'int8')
|
||||
assert.strictEqual(5, b[0])
|
||||
})
|
||||
|
||||
it('should throw a TypeError if a "type" can not be inferred', function () {
|
||||
assert.throws(function () {
|
||||
ref.coerceType({ })
|
||||
}, /could not determine a proper \"type\"/)
|
||||
})
|
||||
|
||||
})
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
describe('int64', function () {
|
||||
|
||||
var JS_MAX_INT = +9007199254740992
|
||||
var JS_MIN_INT = -9007199254740992
|
||||
|
||||
it('should allow simple ints to be written and read', function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
var val = 123456789
|
||||
ref.writeInt64(buf, 0, val)
|
||||
var rtn = ref.readInt64(buf, 0)
|
||||
assert.equal(val, rtn)
|
||||
})
|
||||
|
||||
it('should allow INT64_MAX to be written and read', function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
var val = '9223372036854775807'
|
||||
ref.writeInt64(buf, 0, val)
|
||||
var rtn = ref.readInt64(buf, 0)
|
||||
assert.equal(val, rtn)
|
||||
})
|
||||
|
||||
it('should allow a hex String to be input (signed)', function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
var val = '-0x1234567890'
|
||||
ref.writeInt64(buf, 0, val)
|
||||
var rtn = ref.readInt64(buf, 0)
|
||||
assert.equal(parseInt(val, 16), rtn)
|
||||
})
|
||||
|
||||
it('should allow an octal String to be input (signed)', function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
var val = '-0777'
|
||||
ref.writeInt64(buf, 0, val)
|
||||
var rtn = ref.readInt64(buf, 0)
|
||||
assert.equal(parseInt(val, 8), rtn)
|
||||
})
|
||||
|
||||
it('should allow a hex String to be input (unsigned)', function () {
|
||||
var buf = new Buffer(ref.sizeof.uint64)
|
||||
var val = '0x1234567890'
|
||||
ref.writeUInt64(buf, 0, val)
|
||||
var rtn = ref.readUInt64(buf, 0)
|
||||
assert.equal(parseInt(val, 16), rtn)
|
||||
})
|
||||
|
||||
it('should allow an octal String to be input (unsigned)', function () {
|
||||
var buf = new Buffer(ref.sizeof.uint64)
|
||||
var val = '0777'
|
||||
ref.writeUInt64(buf, 0, val)
|
||||
var rtn = ref.readUInt64(buf, 0)
|
||||
assert.equal(parseInt(val, 8), rtn)
|
||||
})
|
||||
|
||||
it('should return a Number when reading JS_MIN_INT', function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
ref.writeInt64(buf, 0, JS_MIN_INT)
|
||||
var rtn = ref.readInt64(buf, 0)
|
||||
assert.equal('number', typeof rtn)
|
||||
assert.equal(JS_MIN_INT, rtn)
|
||||
})
|
||||
|
||||
it('should return a Number when reading JS_MAX_INT', function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
ref.writeInt64(buf, 0, JS_MAX_INT)
|
||||
var rtn = ref.readInt64(buf, 0)
|
||||
assert.equal('number', typeof rtn)
|
||||
assert.equal(JS_MAX_INT, rtn)
|
||||
})
|
||||
|
||||
it('should return a String when reading JS_MAX_INT+1', function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
var plus_one = '9007199254740993'
|
||||
ref.writeInt64(buf, 0, plus_one)
|
||||
var rtn = ref.readInt64(buf, 0)
|
||||
assert.equal('string', typeof rtn)
|
||||
assert.equal(plus_one, rtn)
|
||||
})
|
||||
|
||||
it('should return a String when reading JS_MIN_INT-1', function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
var minus_one = '-9007199254740993'
|
||||
ref.writeInt64(buf, 0, minus_one)
|
||||
var rtn = ref.readInt64(buf, 0)
|
||||
assert.equal('string', typeof rtn)
|
||||
assert.equal(minus_one, rtn)
|
||||
})
|
||||
|
||||
it('should return a Number when reading 0, even when written as a String', function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
var zero = '0'
|
||||
ref.writeInt64(buf, 0, zero)
|
||||
var rtn = ref.readInt64(buf, 0)
|
||||
assert.equal('number', typeof rtn)
|
||||
assert.equal(0, rtn)
|
||||
})
|
||||
|
||||
it('should throw a "no digits" Error when writing an invalid String (signed)', function () {
|
||||
assert.throws(function () {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
ref.writeInt64(buf, 0, 'foo')
|
||||
}, /no digits we found in input String/)
|
||||
})
|
||||
|
||||
it('should throw a "no digits" Error when writing an invalid String (unsigned)', function () {
|
||||
assert.throws(function () {
|
||||
var buf = new Buffer(ref.sizeof.uint64)
|
||||
ref.writeUInt64(buf, 0, 'foo')
|
||||
}, /no digits we found in input String/)
|
||||
})
|
||||
|
||||
it('should throw an "out of range" Error when writing an invalid String (signed)', function () {
|
||||
var e;
|
||||
try {
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
ref.writeInt64(buf, 0, '10000000000000000000000000')
|
||||
} catch (_e) {
|
||||
e = _e;
|
||||
}
|
||||
assert(/input String numerical value out of range/.test(e.message));
|
||||
})
|
||||
|
||||
it('should throw an "out of range" Error when writing an invalid String (unsigned)', function () {
|
||||
var e;
|
||||
try {
|
||||
var buf = new Buffer(ref.sizeof.uint64)
|
||||
ref.writeUInt64(buf, 0, '10000000000000000000000000')
|
||||
} catch (_e) {
|
||||
e = _e;
|
||||
}
|
||||
assert(/input String numerical value out of range/.test(e.message));
|
||||
})
|
||||
|
||||
it('should throw an Error when reading an int64_t from the NULL pointer', function () {
|
||||
assert.throws(function () {
|
||||
ref.readInt64(ref.NULL)
|
||||
})
|
||||
})
|
||||
|
||||
it('should throw an Error when reading an uint64_t from the NULL pointer', function () {
|
||||
assert.throws(function () {
|
||||
ref.readUInt64(ref.NULL)
|
||||
})
|
||||
})
|
||||
|
||||
;['LE', 'BE'].forEach(function (endianness) {
|
||||
|
||||
describe(endianness, function () {
|
||||
|
||||
it('should read and write a signed ' + endianness + ' 64-bit integer', function () {
|
||||
var val = -123456789
|
||||
var buf = new Buffer(ref.sizeof.int64)
|
||||
ref['writeInt64' + endianness](buf, 0, val)
|
||||
assert.equal(val, ref['readInt64' + endianness](buf, 0))
|
||||
})
|
||||
|
||||
it('should read and write an unsigned ' + endianness + ' 64-bit integer', function () {
|
||||
var val = 123456789
|
||||
var buf = new Buffer(ref.sizeof.uint64)
|
||||
ref['writeUInt64' + endianness](buf, 0, val)
|
||||
assert.equal(val, ref['readUInt64' + endianness](buf, 0))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
// This will check if the new Buffer implementation behaves like the pre io.js 3.0 one did:
|
||||
describe('iojs3issue', function () {
|
||||
it('should not crash', function() {
|
||||
for (var i = 0; i < 10; i++) {
|
||||
gc()
|
||||
var buf = new Buffer(8)
|
||||
buf.fill(0)
|
||||
var buf2 = ref.ref(buf)
|
||||
var buf3 = ref.deref(buf2)
|
||||
}
|
||||
})
|
||||
it('should not crash too', function() {
|
||||
for (var i = 0; i < 10; i++) {
|
||||
gc()
|
||||
var buf = new Buffer(7)
|
||||
buf.fill(0)
|
||||
var buf2 = ref.ref(buf)
|
||||
var buf3 = ref.deref(buf2)
|
||||
}
|
||||
})
|
||||
})
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
describe('isNull', function () {
|
||||
|
||||
it('should return "true" for the NULL pointer', function () {
|
||||
assert.strictEqual(true, ref.isNull(ref.NULL))
|
||||
})
|
||||
|
||||
it('should return "false" for a valid Buffer', function () {
|
||||
var buf = new Buffer('hello')
|
||||
assert.strictEqual(false, ref.isNull(buf))
|
||||
})
|
||||
|
||||
})
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var weak = require('weak')
|
||||
var ref = require('../')
|
||||
|
||||
describe('Object', function () {
|
||||
|
||||
var obj = {
|
||||
foo: 'bar'
|
||||
, test: Math.random()
|
||||
, now: new Date()
|
||||
}
|
||||
|
||||
beforeEach(gc)
|
||||
|
||||
it('should write and read back an Object in a Buffer', function () {
|
||||
var buf = new Buffer(ref.sizeof.Object)
|
||||
ref.writeObject(buf, 0, obj)
|
||||
var out = ref.readObject(buf)
|
||||
assert.strictEqual(obj, out)
|
||||
assert.deepEqual(obj, out)
|
||||
})
|
||||
|
||||
it('should retain references to written Objects', function (done) {
|
||||
var o_gc = false
|
||||
var buf_gc = false
|
||||
var o = { foo: 'bar' }
|
||||
var buf = new Buffer(ref.sizeof.Object)
|
||||
|
||||
weak(o, function () { o_gc = true })
|
||||
weak(buf, function () { buf_gc = true })
|
||||
ref.writeObject(buf, 0, o)
|
||||
assert(!o_gc, '"o" has been garbage collected too soon')
|
||||
assert(!buf_gc, '"buf" has been garbage collected too soon')
|
||||
|
||||
// try to GC `o`
|
||||
o = null
|
||||
gc()
|
||||
assert(!o_gc, '"o" has been garbage collected too soon')
|
||||
assert(!buf_gc, '"buf" has been garbage collected too soon')
|
||||
|
||||
// now GC `buf`
|
||||
buf = null
|
||||
setImmediate(function () {
|
||||
gc()
|
||||
assert(buf_gc, '"buf" has not been garbage collected')
|
||||
assert(o_gc, '"o" has not been garbage collected')
|
||||
done()
|
||||
});
|
||||
})
|
||||
|
||||
it('should throw an Error when reading an Object from the NULL pointer', function () {
|
||||
assert.throws(function () {
|
||||
ref.NULL.readObject()
|
||||
})
|
||||
})
|
||||
|
||||
describe('offset', function () {
|
||||
|
||||
it('should read two Objects next to each other in memory', function () {
|
||||
var buf = new Buffer(ref.sizeof.pointer * 2)
|
||||
var a = {}
|
||||
var b = {}
|
||||
buf.writeObject(a, 0 * ref.sizeof.pointer)
|
||||
buf.writeObject(b, 1 * ref.sizeof.pointer)
|
||||
var _a = buf.readObject(0 * ref.sizeof.pointer)
|
||||
var _b = buf.readObject(1 * ref.sizeof.pointer)
|
||||
assert.strictEqual(a, _a)
|
||||
assert.strictEqual(b, _b)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var weak = require('weak')
|
||||
var ref = require('../')
|
||||
|
||||
describe('pointer', function () {
|
||||
|
||||
var test = new Buffer('hello world')
|
||||
|
||||
beforeEach(gc)
|
||||
|
||||
it('should write and read back a pointer (Buffer) in a Buffer', function () {
|
||||
var buf = new Buffer(ref.sizeof.pointer)
|
||||
ref.writePointer(buf, 0, test)
|
||||
var out = ref.readPointer(buf, 0, test.length)
|
||||
assert.strictEqual(out.length, test.length)
|
||||
for (var i = 0, l = out.length; i < l; i++) {
|
||||
assert.strictEqual(out[i], test[i])
|
||||
}
|
||||
assert.strictEqual(ref.address(out), ref.address(test))
|
||||
})
|
||||
|
||||
it('should retain references to a written pointer in a Buffer', function (done) {
|
||||
var child_gc = false
|
||||
var parent_gc = false
|
||||
var child = new Buffer('a pointer holding some data...')
|
||||
var parent = new Buffer(ref.sizeof.pointer)
|
||||
|
||||
weak(child, function () { child_gc = true })
|
||||
weak(parent, function () { parent_gc = true })
|
||||
ref.writePointer(parent, 0, child)
|
||||
assert(!child_gc, '"child" has been garbage collected too soon')
|
||||
assert(!parent_gc, '"parent" has been garbage collected too soon')
|
||||
|
||||
// try to GC `child`
|
||||
child = null
|
||||
gc()
|
||||
assert(!child_gc, '"child" has been garbage collected too soon')
|
||||
assert(!parent_gc, '"parent" has been garbage collected too soon')
|
||||
|
||||
// now GC `parent`
|
||||
parent = null
|
||||
setImmediate(function () {
|
||||
gc()
|
||||
assert(parent_gc, '"parent" has not been garbage collected')
|
||||
assert(child_gc, '"child" has not been garbage collected')
|
||||
done()
|
||||
});
|
||||
})
|
||||
|
||||
it('should throw an Error when reading from the NULL pointer', function () {
|
||||
assert.throws(function () {
|
||||
ref.NULL.readPointer()
|
||||
})
|
||||
})
|
||||
|
||||
it('should return a 0-length Buffer when reading a NULL pointer', function () {
|
||||
var buf = new Buffer(ref.sizeof.pointer)
|
||||
ref.writePointer(buf, 0, ref.NULL)
|
||||
var out = ref.readPointer(buf, 0, 100)
|
||||
assert.strictEqual(out.length, 0)
|
||||
})
|
||||
|
||||
describe('offset', function () {
|
||||
|
||||
it('should read two pointers next to each other in memory', function () {
|
||||
var buf = new Buffer(ref.sizeof.pointer * 2)
|
||||
var a = new Buffer('hello')
|
||||
var b = new Buffer('world')
|
||||
buf.writePointer(a, 0 * ref.sizeof.pointer)
|
||||
buf.writePointer(b, 1 * ref.sizeof.pointer)
|
||||
var _a = buf.readPointer(0 * ref.sizeof.pointer)
|
||||
var _b = buf.readPointer(1 * ref.sizeof.pointer)
|
||||
assert.equal(a.address(), _a.address())
|
||||
assert.equal(b.address(), _b.address())
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
describe('ref(), deref()', function () {
|
||||
|
||||
beforeEach(gc)
|
||||
|
||||
it('should work 1 layer deep', function () {
|
||||
var test = new Buffer('one layer deep')
|
||||
var one = ref.ref(test)
|
||||
var _test = ref.deref(one)
|
||||
assert.equal(test.length, _test.length)
|
||||
assert.equal(test.toString(), _test.toString())
|
||||
})
|
||||
|
||||
it('should work 2 layers deep', function () {
|
||||
var test = new Buffer('two layers deep')
|
||||
var one = ref.ref(test)
|
||||
var two = ref.ref(one)
|
||||
var _one = ref.deref(two)
|
||||
var _test = ref.deref(_one)
|
||||
assert.equal(ref.address(one), ref.address(_one))
|
||||
assert.equal(ref.address(test), ref.address(_test))
|
||||
assert.equal(one.length, _one.length)
|
||||
assert.equal(test.length, _test.length)
|
||||
assert.equal(test.toString(), _test.toString())
|
||||
})
|
||||
|
||||
it('should throw when derefing a Buffer with no "type"', function () {
|
||||
var test = new Buffer('???')
|
||||
assert.throws(function () {
|
||||
ref.deref(test)
|
||||
}, /unknown "type"/)
|
||||
})
|
||||
|
||||
it('should throw when derefing a Buffer with no "type" 2', function () {
|
||||
var test = new Buffer('???')
|
||||
var r = ref.ref(test)
|
||||
var _test = ref.deref(r)
|
||||
assert.equal(ref.address(test), ref.address(_test))
|
||||
assert.throws(function () {
|
||||
ref.deref(_test)
|
||||
}, /unknown "type"/)
|
||||
})
|
||||
|
||||
it('should deref() a "char" type properly', function () {
|
||||
var test = new Buffer(ref.sizeof.char)
|
||||
test.type = ref.types.char
|
||||
test[0] = 50
|
||||
assert.equal(50, ref.deref(test))
|
||||
test[0] = 127
|
||||
assert.equal(127, ref.deref(test))
|
||||
})
|
||||
|
||||
it('should not throw when calling ref()/deref() on a `void` type', function () {
|
||||
var test = ref.alloc(ref.types.void)
|
||||
assert.strictEqual(null, test.deref())
|
||||
})
|
||||
|
||||
})
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var weak = require('weak')
|
||||
var ref = require('../')
|
||||
|
||||
describe('reinterpret()', function () {
|
||||
|
||||
beforeEach(gc)
|
||||
|
||||
it('should return a new Buffer instance at the same address', function () {
|
||||
var buf = new Buffer('hello world')
|
||||
var small = buf.slice(0, 0)
|
||||
assert.strictEqual(0, small.length)
|
||||
assert.strictEqual(buf.address(), small.address())
|
||||
var reinterpreted = small.reinterpret(buf.length)
|
||||
assert.strictEqual(buf.address(), reinterpreted.address())
|
||||
assert.strictEqual(buf.length, reinterpreted.length)
|
||||
assert.strictEqual(buf.toString(), reinterpreted.toString())
|
||||
})
|
||||
|
||||
it('should return a new Buffer instance starting at the offset address', function () {
|
||||
var buf = new Buffer('hello world')
|
||||
var offset = 3
|
||||
var small = buf.slice(offset, buf.length)
|
||||
assert.strictEqual(buf.length - offset, small.length)
|
||||
assert.strictEqual(buf.address() + offset, small.address())
|
||||
var reinterpreted = buf.reinterpret(small.length, offset)
|
||||
assert.strictEqual(small.address(), reinterpreted.address())
|
||||
assert.strictEqual(small.length, reinterpreted.length)
|
||||
assert.strictEqual(small.toString(), reinterpreted.toString())
|
||||
})
|
||||
|
||||
it('should retain a reference to the original Buffer when reinterpreted', function () {
|
||||
var origGCd = false
|
||||
var otherGCd = false
|
||||
var buf = new Buffer(1)
|
||||
weak(buf, function () { origGCd = true })
|
||||
var other = buf.reinterpret(0)
|
||||
weak(other, function () { otherGCd = true })
|
||||
|
||||
assert(!origGCd, '"buf" has been garbage collected too soon')
|
||||
assert(!otherGCd, '"other" has been garbage collected too soon')
|
||||
|
||||
// try to GC `buf`
|
||||
buf = null
|
||||
gc()
|
||||
assert(!origGCd, '"buf" has been garbage collected too soon')
|
||||
assert(!otherGCd, '"other" has been garbage collected too soon')
|
||||
|
||||
// now GC `other`
|
||||
other = null
|
||||
gc()
|
||||
assert(otherGCd, '"other" has not been garbage collected')
|
||||
assert(origGCd, '"buf" has not been garbage collected')
|
||||
})
|
||||
|
||||
})
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
|
||||
var fs = require('fs')
|
||||
var assert = require('assert')
|
||||
var weak = require('weak')
|
||||
var ref = require('../')
|
||||
|
||||
describe('reinterpretUntilZeros()', function () {
|
||||
|
||||
beforeEach(gc)
|
||||
|
||||
it('should return a new Buffer instance up until the first 0', function () {
|
||||
var buf = new Buffer('hello\0world')
|
||||
var buf2 = buf.reinterpretUntilZeros(1)
|
||||
assert.equal(buf2.length, 'hello'.length)
|
||||
assert.equal(buf2.toString(), 'hello')
|
||||
})
|
||||
|
||||
it('should return a new Buffer instance up until the first 0 starting from offset', function () {
|
||||
var buf = new Buffer('hello\0world')
|
||||
var buf2 = buf.reinterpretUntilZeros(1, 3)
|
||||
assert.equal(buf2.length, 'lo'.length)
|
||||
assert.equal(buf2.toString(), 'lo')
|
||||
})
|
||||
|
||||
it('should return a new Buffer instance up until the first 2-byte sequence of 0s', function () {
|
||||
var str = 'hello world'
|
||||
var buf = new Buffer(50)
|
||||
var len = buf.write(str, 'ucs2')
|
||||
buf.writeInt16LE(0, len) // NULL terminate the string
|
||||
|
||||
var buf2 = buf.reinterpretUntilZeros(2)
|
||||
assert.equal(str.length, buf2.length / 2)
|
||||
assert.equal(buf2.toString('ucs2'), str)
|
||||
})
|
||||
|
||||
it('should return a large Buffer instance > 10,000 bytes with UTF16-LE char bytes', function () {
|
||||
var data = fs.readFileSync(__dirname + '/utf16le.bin');
|
||||
var strBuf = ref.reinterpretUntilZeros(data, 2);
|
||||
assert(strBuf.length > 10000);
|
||||
var str = strBuf.toString('ucs2');
|
||||
// the data in `utf16le.bin` should be a JSON parsable string
|
||||
assert(JSON.parse(str));
|
||||
})
|
||||
|
||||
})
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
describe('C string', function () {
|
||||
|
||||
describe('readCString()', function () {
|
||||
|
||||
it('should return "" for a Buffer containing "\\0"', function () {
|
||||
var buf = new Buffer('\0')
|
||||
assert.strictEqual('', buf.readCString(0))
|
||||
})
|
||||
|
||||
it('should return "hello" for a Buffer containing "hello\\0world"', function () {
|
||||
var buf = new Buffer('hello\0world')
|
||||
assert.strictEqual('hello', buf.readCString(0))
|
||||
})
|
||||
|
||||
it('should throw an Error when reading from the NULL pointer', function () {
|
||||
assert.throws(function () {
|
||||
ref.NULL.readCString()
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('writeCString()', function () {
|
||||
|
||||
it('should write a C string (NULL terminated) to a Buffer', function () {
|
||||
var buf = new Buffer(20)
|
||||
var str = 'hello world'
|
||||
buf.writeCString(str)
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
assert.equal(str.charCodeAt(i), buf[i])
|
||||
}
|
||||
assert.equal(0, buf[str.length])
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('allocCString()', function () {
|
||||
|
||||
it('should return a new Buffer containing the given string', function () {
|
||||
var buf = ref.allocCString('hello world')
|
||||
assert.strictEqual('hello world', buf.readCString())
|
||||
})
|
||||
|
||||
it('should return the NULL pointer for `null` values', function () {
|
||||
var buf = ref.allocCString(null)
|
||||
assert(buf.isNull())
|
||||
assert.strictEqual(0, buf.address())
|
||||
})
|
||||
|
||||
it('should return the NULL pointer for `undefined` values', function () {
|
||||
var buf = ref.allocCString(undefined)
|
||||
assert(buf.isNull())
|
||||
assert.strictEqual(0, buf.address())
|
||||
})
|
||||
|
||||
it('should return the NULL pointer for a NULL pointer Buffer', function () {
|
||||
var buf = ref.allocCString(ref.NULL)
|
||||
assert(buf.isNull())
|
||||
assert.strictEqual(0, buf.address())
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('CString', function () {
|
||||
|
||||
it('should return JS `null` when given a pointer pointing to NULL', function () {
|
||||
var buf = ref.alloc(ref.types.CString)
|
||||
buf.writePointer(ref.NULL)
|
||||
assert.strictEqual(null, buf.deref())
|
||||
|
||||
// another version of the same test
|
||||
assert.strictEqual(null, ref.get(ref.NULL_POINTER, 0, ref.types.CString))
|
||||
})
|
||||
|
||||
it('should read a utf8 string from a Buffer', function () {
|
||||
var str = 'hello world'
|
||||
var buf = ref.alloc(ref.types.CString)
|
||||
buf.writePointer(new Buffer(str + '\0'))
|
||||
assert.strictEqual(str, buf.deref())
|
||||
})
|
||||
|
||||
// https://github.com/node-ffi/node-ffi/issues/169
|
||||
it('should set a Buffer as backing store', function () {
|
||||
var str = 'hey!'
|
||||
var store = new Buffer(str + '\0')
|
||||
var buf = ref.alloc(ref.types.CString)
|
||||
ref.set(buf, 0, store)
|
||||
|
||||
assert.equal(str, ref.get(buf, 0))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
|
||||
var assert = require('assert')
|
||||
var ref = require('../')
|
||||
|
||||
describe('types', function () {
|
||||
|
||||
describe('refType()', function () {
|
||||
|
||||
it('should return a new "type" with its `indirection` level increased by 1', function () {
|
||||
var int = ref.types.int
|
||||
var intPtr = ref.refType(int)
|
||||
assert.equal(int.size, intPtr.size)
|
||||
assert.equal(int.indirection + 1, intPtr.indirection)
|
||||
})
|
||||
|
||||
it('should coerce string types', function () {
|
||||
var intPtr = ref.refType('int')
|
||||
assert.equal(2, intPtr.indirection)
|
||||
assert.equal(intPtr.size, ref.types.int.size)
|
||||
})
|
||||
|
||||
it('should override and update a read-only name property', function () {
|
||||
// a type similar to ref-struct's StructType
|
||||
// used for types refType name property test
|
||||
function StructType() {}
|
||||
StructType.size = 0
|
||||
StructType.indirection = 0
|
||||
|
||||
// read-only name property
|
||||
assert.equal(StructType.name, 'StructType')
|
||||
try {
|
||||
StructType.name = 'foo'
|
||||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
assert.equal(StructType.name, 'StructType')
|
||||
|
||||
// name property should be writable and updated
|
||||
var newObj = ref.refType(StructType)
|
||||
var newProp = Object.getOwnPropertyDescriptor(newObj, 'name')
|
||||
assert.equal(newProp.writable, true)
|
||||
assert.equal(newObj.name, 'StructType*')
|
||||
})
|
||||
})
|
||||
|
||||
describe('derefType()', function () {
|
||||
|
||||
it('should return a new "type" with its `indirection` level decreased by 1', function () {
|
||||
var intPtr = Object.create(ref.types.int)
|
||||
intPtr.indirection++
|
||||
var int = ref.derefType(intPtr)
|
||||
assert.equal(intPtr.size, intPtr.size)
|
||||
assert.equal(intPtr.indirection - 1, int.indirection)
|
||||
})
|
||||
|
||||
it('should throw an Error when given a "type" with its `indirection` level already at 1', function () {
|
||||
assert.throws(function () {
|
||||
ref.derefType(ref.types.int)
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('size', function () {
|
||||
Object.keys(ref.types).forEach(function (name) {
|
||||
if (name === 'void') return
|
||||
it('sizeof(' + name + ') should be >= 1', function () {
|
||||
var type = ref.types[name]
|
||||
assert.equal('number', typeof type.size)
|
||||
assert(type.size >= 1)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('alignment', function () {
|
||||
Object.keys(ref.types).forEach(function (name) {
|
||||
if (name === 'void') return
|
||||
it('alignof(' + name + ') should be >= 1', function () {
|
||||
var type = ref.types[name]
|
||||
assert.equal('number', typeof type.alignment)
|
||||
assert(type.alignment >= 1)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user