diff --git a/.travis.yml b/.travis.yml
index 9c04948..d4c7860 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,10 +12,9 @@ addons:
language: node_js
node_js:
- - "6"
- "8"
- "10"
- - "11"
+ - "12"
install:
- PATH="`npm bin`:`npm bin -g`:$PATH"
diff --git a/appveyor.yml b/appveyor.yml
index e29f913..3773169 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,10 +6,9 @@ environment:
MSVS_VERSION: 2013
# Test against these versions of Node.js and io.js
matrix:
- - nodejs_version: "6"
- nodejs_version: "8"
- nodejs_version: "10"
- - nodejs_version: "11"
+ - nodejs_version: "12"
platform:
- x86
diff --git a/docs/compile.js b/docs/compile.js
deleted file mode 100644
index 89daed6..0000000
--- a/docs/compile.js
+++ /dev/null
@@ -1,153 +0,0 @@
-
-/**
- * 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
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
-}
diff --git a/docs/gh-pages.sh b/docs/gh-pages.sh
deleted file mode 100755
index 6a7a97c..0000000
--- a/docs/gh-pages.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/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"
diff --git a/docs/images/apple-touch-icon-114x114.png b/docs/images/apple-touch-icon-114x114.png
deleted file mode 100644
index 8003885..0000000
Binary files a/docs/images/apple-touch-icon-114x114.png and /dev/null differ
diff --git a/docs/images/apple-touch-icon-72x72.png b/docs/images/apple-touch-icon-72x72.png
deleted file mode 100644
index a055a15..0000000
Binary files a/docs/images/apple-touch-icon-72x72.png and /dev/null differ
diff --git a/docs/images/apple-touch-icon.png b/docs/images/apple-touch-icon.png
deleted file mode 100644
index 40cffed..0000000
Binary files a/docs/images/apple-touch-icon.png and /dev/null differ
diff --git a/docs/images/favicon.ico b/docs/images/favicon.ico
deleted file mode 100644
index defe0a0..0000000
Binary files a/docs/images/favicon.ico and /dev/null differ
diff --git a/docs/images/ref.pxm b/docs/images/ref.pxm
deleted file mode 100644
index e623fec..0000000
Binary files a/docs/images/ref.pxm and /dev/null differ
diff --git a/docs/index.jade b/docs/index.jade
deleted file mode 100644
index cb892d9..0000000
--- a/docs/index.jade
+++ /dev/null
@@ -1,264 +0,0 @@
-doctype html
-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 ref?
- 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 exports
- 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 "type" 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 Buffer 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(/\ /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 type 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 1.
- 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(/\ /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(/\ /g, ' ')
- else
- p
- | Shorthand for
- a(href='#exports-' + doc.name)
- code ref.#{doc.name}(this, …)
- | .
- != (doc.ref && doc.ref.description.full || '').replace(/\ /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")
diff --git a/docs/scripts/jquery-1.7.2.min.js b/docs/scripts/jquery-1.7.2.min.js
deleted file mode 100644
index 16ad06c..0000000
--- a/docs/scripts/jquery-1.7.2.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/*! jQuery v1.7.2 jquery.com | jquery.org/license */
-(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+"