diff --git a/tools/LiveTexturing/main.js b/tools/LiveTexturing/main.js new file mode 100644 index 00000000..07da11c3 --- /dev/null +++ b/tools/LiveTexturing/main.js @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. + * + * 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. + * + */ + +(function () { + "use strict"; + var start = 0; + var zmq = require('zmq'); + var publisher = zmq.socket('pub'); + + publisher.bind('tcp://*:5555', function (err) { + if (err) { + console.log(err); + } + else { + console.log("5555"); + } + }); + + + + process.on('SIGINT', function () { + publisher.close(); + }); + + + var PLUGIN_ID = require("./package.json").name, + MENU_ID = "TeamFisk plugins", + MENU_LABEL = "$$$/JavaScripts/Generator/TeamFisk plugins/Menu=Live Texturing RAMDisk"; + + var _generator = null; + + // Initialize script here + function init(generator, config) { + _generator = generator; + _generator.addMenuItem(MENU_ID, MENU_LABEL, true, false) + .then( + function () { + console.log("Menu created", MENU_ID); + }, function () { + console.error("Menu creation failed", MENU_ID); + } + ); + + _generator.onPhotoshopEvent("imageChanged", handleImageChanged); + } + + var lastSent = 0; + var isSaving = false; + function handleImageChanged(document) { + + var start = new Date().getTime(); + if (start - lastSent > 350 && !isSaving) { + isSaving = true; + //console.log("DOC: " + document.id); + _generator.getDocumentInfo(document.id).then( + function (document) { + // console.log(new Date().getTime() / 1000); + // console.log(stringify(document.timeStamp)); + //console.log("HELLO 1"); + //lastSent = document.timeStamp + // console.log(stringify(document)); + //console.log("Received complete document:", stringify(document)); + //var str = 'var options = new PNGSaveOptions(); app.activeDocument.saveAs (new File("D:/HejHej.png"),options, false);'; + var str = 'app.activeDocument.save()'; + + _generator.evaluateJSXString(str).then(function () { + isSaving = false; + //console.log("Save succes"); + var size = (4 + document.file.length + 1); + var message = new Buffer(size); + + var offset = 0; + + //console.log("document.file.length: " + document.file.length); + //console.log("document.fileName: " + document.file); + + message.writeInt32LE(document.file.length + 1, offset); + + offset += 4; + + var fileName = document.file.replace(/\\/g, "/"); + message.write(fileName, offset, fileName.length, 'utf8'); + offset += fileName.length; + message.writeUInt8(0, offset); //Null byte + offset += 1; + + publisher.send(message); + + var asd = new Date().getTime(); + var time = asd - start; + //console.log(time); + lastSent = new Date().getTime(); + //console.log("LastSent: " + lastSent); + + }, + function () { + console.log("Save Failure"); + isSaving = false; + }).done(); + }); + } + } + + function stringify(object) { + try { + return JSON.stringify(object, null, " "); + } catch (e) { + console.error(e); + } + return String(object); + } + + //Declare entery function in the script + exports.init = init; +}()); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/.editorconfig b/tools/LiveTexturing/node_modules/zmq/.editorconfig new file mode 100644 index 00000000..fd99cd74 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true + +[*.js] +indent_style = space +indent_size = 2 + +[*.cc] +indent_style = space +indent_size = 2 + diff --git a/tools/LiveTexturing/node_modules/zmq/.npmignore b/tools/LiveTexturing/node_modules/zmq/.npmignore new file mode 100644 index 00000000..2fe9e51d --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/.npmignore @@ -0,0 +1,13 @@ +*.swp +*.swo +*.o +build +*.lock* +binding.node +examples/stress-test-client +node_modules +Makefile.gyp +binding.Makefile +binding.target.gyp.mk +gyp-mac-tool +out/ diff --git a/tools/LiveTexturing/node_modules/zmq/.travis.yml b/tools/LiveTexturing/node_modules/zmq/.travis.yml new file mode 100644 index 00000000..e0df0b55 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/.travis.yml @@ -0,0 +1,37 @@ +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 +env: + - ZMQ="git://github.com/zeromq/zeromq2-x.git" + - ZMQ="git://github.com/zeromq/zeromq3-x.git -b v3.1.0" + - ZMQ="git://github.com/zeromq/zeromq3-x.git -b v3.2.5" + - ZMQ="git://github.com/zeromq/zeromq4-x.git -b v4.0.5" SODIUM="git://github.com/jedisct1/libsodium.git -b 0.4.5" +before_install: + - export CXX=g++-4.8 + - sudo apt-get install uuid-dev + - '[ -z "$SODIUM" ] || git clone --depth 1 $SODIUM libsodium' + - '[ -z "$SODIUM" ] || cd libsodium' + - '[ -z "$SODIUM" ] || ./autogen.sh' + - '[ -z "$SODIUM" ] || ./configure' + - '[ -z "$SODIUM" ] || make' + - '[ -z "$SODIUM" ] || sudo make install' + - '[ -z "$SODIUM" ] || cd ..' + - git clone --depth 1 $ZMQ zmqlib + - cd zmqlib + - ./autogen.sh + - ./configure + - make + - sudo make install + - sudo /sbin/ldconfig + - cd .. +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.12" + - "4" + - "5" +script: travis_retry npm test diff --git a/tools/LiveTexturing/node_modules/zmq/History.md b/tools/LiveTexturing/node_modules/zmq/History.md new file mode 100644 index 00000000..0bb45956 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/History.md @@ -0,0 +1,154 @@ +2.14.0 / 2015-11-20 +=================== + + * A socket.read() method was added to retrieve messages while paused [sshutovskyi] + * socket.send() now takes a callback as 3rd argument which is called once the message is sent [ronkorving] + * Now tested on Node.js 0.8, 0.10, 0.12, 4 and 5 [ronkorving] + +2.13.0 / 2015-08-26 +=================== + + * io.js 3.x compatible [kkoopa] + * corrections to type casting operations [kkoopa] + * "make clean" now also removes node_modules [reqshark] + +2.12.0 / 2015-07-10 +=================== + + * Massive improvements to monitoring code, with new documentation and tests [ValYouW] + * Improved documentation [reqshark] + * Updated bindings from ~1.1.1 to ~1.2.1 [reqshark] + * Test suite improvements [reqshark] + * Updated the Windows bundle to ZeroMQ 4.0.4 [kkoopa] + * License attribute added to package.json [pdehaan] + +2.11.1 / 2015-05-21 +=================== + + * io.js 2.x compatible [transcranial] + * replaced asserts with proper exceptions [reqshark] + +2.11.0 / 2015-03-31 +=================== + + * Added pause() and resume() APIs on sockets to allow backpressure [philip1986] + * Elegant handling of EINTR return codes [hurricaneLTG] + * Small performance improvements in send() and internal flush methods [ronkorving] + * Updated test suite to cover io.js and Node 0.12 (removed 0.11) [ronkorving] + * Added "make perf" for easy benchmarking [ronkorving] + +2.10.0 / 2015-01-22 +=================== + + * Added ZMQ_STREAM socket type [reqshark] + * Update NAN to io.js compatible 1.5.0 [kkoopa] + * Hitting open file descriptor limit now throws an error during zmq.socket() [briansorahan] + * More reliable benchmarking [maxired] + +2.9.0 / 2015-01-05 +================== + + * More unit tests [bluebery and reqshark] + * More reliable testing [f34rdotcom and kkoopa] + * Improved ReadMe [dminkovsky and skibz] + * Support for zmq_proxy sockets [reqshark] + * Removed "docs" and related deps in favor of ReadMe [reqshark] + +2.8.0 / 2014-08-27 +================== + + * Fixed: monitor API would keep CPU busy at 100% [f34rdotcom] + * Fixed: an exception during flush could render a socket unusable [ronkorving] + * Fixed: Travis changed behavior and broke our tests [ronkorving] + * Code cleanup [kkoopa and ronkorving] + * Removed legacy nextTick event emission during flush [utvara and ronkorving] + * Context API added: setMaxThreads, getMaxThreads, setMaxSockets, getMaxSockets [yoneal] + * Changed unit test suite to Mocha [skeggse and yoneal] + * NAN updated to ~1.3.0 [kkoopa] + +2.7.0 / 2014-04-24 +================== + + * Fixed memory leak when closing socket [rasky] + * Fixed high water mark [soplwang, kkoopa] + * Added socket opts for zeromq 4.x security mechanisms [msealand] + * Use MakeCallback [kkoopa] + * Remove useless setImmediate [kkoopa] + * Use `zmq_msg_send` for ZMQ >= 4.0 [kkoopa] + * Expose the Socket class as zmq.Socket [tcr] + +2.6.0 / 2014-01-23 +================== + + * Monitor support [f34rdotcom, dr-fozzy] + * Unbind support [kkoopa] + * Node 0.11.9 compatibility [kkoopa] + * Support for ZMQ 4 [atrniv] + * Fixed memory leak [utvara] + * OSX Homebrew support [jwalton] + * Fix unit tests [ryanlelek] + +2.5.1 / 2013-08-28 +================== + + * Regression fix for IPC socket bind failure [christopherobin] + +2.5.0 / 2013-08-20 +================== + + * Added testing against Node.js v0.11 [AlexeyKupershtokh] + * Add support for Joyent SmartMachines [JonGretar] + * Use pkg-config on OS X too [blalor] + * Patch for Node 0.11.3 [kkoopa] + * Fix for bind / connect / send problem [kkoopa] + * Fixed multiple bugs in perf tests and changed them to push/pull [ronkorving] + * Add definitions for building on openbsd & freebsd [Minjung] + +2.4.0 / 2013-04-09 +================== + + * added: Windows support [mscdex] + * added: support for all options ever [AlexeyKupershtokh] + * fixed: prevent zeromq sockets from being destroyed by GC [AlexeyKupershtokh] + +2.3.0 / 2013-03-15 +================== + + * added: xpub/xsub socket types [xla] + * added: support for zmq_disconnect [matehat] + * added: LAST_ENDPOINT socket option [ronkorving] + * added: local/remote_lat local/remote_thr perf test [wavded] + * fixed: tests improved [qubyte, jeremybarnes, ronkorving] + * fixed: Node v0.9.4+ compatibility [mscdex] + * fixed: SNDHWM and RCVHWM options were given the wrong type [freehaha] + * removed: waf support [mscdex] + +2.2.0 / 2012-10-17 +================== + + * add support for pkg-config + * add libzmq 3.x support [aaudis] + * fix: prevent GC happening too soon for connect/bindSync + +2.1.0 / 2012-06-29 +================== + + * fix require() for 0.8.0 + * change: use uv_poll in place of IOWatcher + * remove stupid engines field + +2.0.3 / 2012-03-14 +================== + + * Removed -Wall (libuv unused vars caused the build to fail...) + +2.0.2 / 2012-02-16 +================== + + * Added back `.createSocket()` for BC. Closes #86 + +2.0.1 / 2012-01-26 +================== + + * Added `.zmqVersion` [patricklucas] + * Fixed multipart support [joshrtay] diff --git a/tools/LiveTexturing/node_modules/zmq/LICENSE b/tools/LiveTexturing/node_modules/zmq/LICENSE new file mode 100644 index 00000000..ee35089d --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2011 TJ Holowaychuk +Copyright (c) 2010, 2011 Justin Tulloss + +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. diff --git a/tools/LiveTexturing/node_modules/zmq/Makefile b/tools/LiveTexturing/node_modules/zmq/Makefile new file mode 100644 index 00000000..3d4e2e81 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/Makefile @@ -0,0 +1,18 @@ + +build/Release/binding.node: binding.cc binding.gyp + npm install + +test: + npm test + +clean: + rm -fr build node_modules + +distclean: + node-gyp clean + +perf: + node perf/local_lat.js tcp://127.0.0.1:5555 1 100000& node perf/remote_lat.js tcp://127.0.0.1:5555 1 100000 + node perf/local_thr.js tcp://127.0.0.1:5556 1 100000& node perf/remote_thr.js tcp://127.0.0.1:5556 1 100000 + +.PHONY: test clean distclean perf diff --git a/tools/LiveTexturing/node_modules/zmq/README.md b/tools/LiveTexturing/node_modules/zmq/README.md new file mode 100644 index 00000000..f1dcccb1 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/README.md @@ -0,0 +1,224 @@ +# zmq   [![Build Status](https://travis-ci.org/JustinTulloss/zeromq.node.png)](https://travis-ci.org/JustinTulloss/zeromq.node)  [![Build status](https://ci.appveyor.com/api/projects/status/n0h0sjs127eadfuo/branch/windowsbuild?svg=true)](https://ci.appveyor.com/project/reqshark/zeromq-node) + +[ØMQ](http://www.zeromq.org/) bindings for node.js. + +## Installation + +### on Windows: +First install [Visual Studio](https://www.visualstudio.com/) and either +[Node.js](https://nodejs.org/download/) or [io.js](https://iojs.org/dist/latest/). + +Ensure you're building zmq from a conservative location on disk, one without +unusual characters or spaces, for example somewhere like: `C:\sources\myproject`. + +Installing the ZeroMQ library is optional and not required on Windows. We +recommend running `npm install` and node executable commands from a +[github for windows](https://windows.github.com/) shell or similar environment. + +### installing on Unix/POSIX (and osx): + +First install `pkg-config` and the [ZeroMQ library](http://www.zeromq.org/intro:get-the-software). + +This module is compatible with ZeroMQ versions 2, 3 and 4. The installation +process varies by platform, but headers are mandatory. Most Linux distributions +provide these headers with `-devel` packages like `zeromq-devel` or +`zeromq3-devel`. Homebrew for OS X provides versions 4 and 3 with packages +`zeromq` and `zeromq3`, respectively. A +[Chris Lea PPA](https://launchpad.net/~chris-lea/+archive/ubuntu/zeromq) +is available for Debian-like users who want a version newer than currently +provided by their distribution. Windows is supported but not actively +maintained. + +Note: For zap support with versions >=4 you need to have libzmq built and linked +against libsodium. Check the [Travis configuration](.travis.yml) for a list of what is tested +and therefore known to work. + +#### with your platform-specifics taken care of, install and use this module: + + $ npm install zmq + +## Examples + +### Push/Pull + +```js +// producer.js +var zmq = require('zmq') + , sock = zmq.socket('push'); + +sock.bindSync('tcp://127.0.0.1:3000'); +console.log('Producer bound to port 3000'); + +setInterval(function(){ + console.log('sending work'); + sock.send('some work'); +}, 500); +``` + +```js +// worker.js +var zmq = require('zmq') + , sock = zmq.socket('pull'); + +sock.connect('tcp://127.0.0.1:3000'); +console.log('Worker connected to port 3000'); + +sock.on('message', function(msg){ + console.log('work: %s', msg.toString()); +}); +``` + +### Pub/Sub + +```js +// pubber.js +var zmq = require('zmq') + , sock = zmq.socket('pub'); + +sock.bindSync('tcp://127.0.0.1:3000'); +console.log('Publisher bound to port 3000'); + +setInterval(function(){ + console.log('sending a multipart message envelope'); + sock.send(['kitty cats', 'meow!']); +}, 500); +``` + +```js +// subber.js +var zmq = require('zmq') + , sock = zmq.socket('sub'); + +sock.connect('tcp://127.0.0.1:3000'); +sock.subscribe('kitty cats'); +console.log('Subscriber connected to port 3000'); + +sock.on('message', function(topic, message) { + console.log('received a message related to:', topic, 'containing message:', message); +}); +``` +## Monitoring + +You can get socket state changes events by calling to the `monitor` function. +The supported events are (see ZMQ [docs](http://api.zeromq.org/4-2:zmq-socket-monitor) for full description): +* connect - ZMQ_EVENT_CONNECTED +* connect_delay - ZMQ_EVENT_CONNECT_DELAYED +* connect_retry - ZMQ_EVENT_CONNECT_RETRIED +* listen - ZMQ_EVENT_LISTENING +* bind_error - ZMQ_EVENT_BIND_FAILED +* accept - ZMQ_EVENT_ACCEPTED +* accept_error - ZMQ_EVENT_ACCEPT_FAILED +* close - ZMQ_EVENT_CLOSED +* close_error - ZMQ_EVENT_CLOSE_FAILED +* disconnect - ZMQ_EVENT_DISCONNECTED + +All events get 2 arguments: +* fd - The file descriptor of the underlying socket (if available) +* endpoint - The underlying socket endpoint + +A special `monitor_error` event will be raised when there was an error in the monitoring process, after this event no more +monitoring events will be sent, you can try and call `monitor` again to restart the monitoring process. + +### monitor(interval, numOfEvents) +Will create an inproc PAIR socket where zmq will publish socket state changes events, the events from this socket will +be read every `interval` (defaults to 10ms). +By default only 1 message will be read every interval, this can be configured by using the `numOfEvents` parameter, +where passing 0 will read all available messages per interval. + +### unmonitor() +Stop the monitoring process + +### example + +```js +// Create a socket +var zmq = require('zmq'); +socket = zmq.socket('req'); + +// Register to monitoring events +socket.on('connect', function(fd, ep) {console.log('connect, endpoint:', ep);}); +socket.on('connect_delay', function(fd, ep) {console.log('connect_delay, endpoint:', ep);}); +socket.on('connect_retry', function(fd, ep) {console.log('connect_retry, endpoint:', ep);}); +socket.on('listen', function(fd, ep) {console.log('listen, endpoint:', ep);}); +socket.on('bind_error', function(fd, ep) {console.log('bind_error, endpoint:', ep);}); +socket.on('accept', function(fd, ep) {console.log('accept, endpoint:', ep);}); +socket.on('accept_error', function(fd, ep) {console.log('accept_error, endpoint:', ep);}); +socket.on('close', function(fd, ep) {console.log('close, endpoint:', ep);}); +socket.on('close_error', function(fd, ep) {console.log('close_error, endpoint:', ep);}); +socket.on('disconnect', function(fd, ep) {console.log('disconnect, endpoint:', ep);}); + +// Handle monitor error +socket.on('monitor_error', function(err) { + console.log('Error in monitoring: %s, will restart monitoring in 5 seconds', err); + setTimeout(function() { socket.monitor(500, 0); }, 5000); +}); + +// Call monitor, check for events every 500ms and get all available events. +console.log('Start monitoring...'); +socket.monitor(500, 0); +socket.connect('tcp://127.0.0.1:1234'); + +setTimeout(function() { + console.log('Stop the monitoring...'); + socket.unmonitor(); +}, 20000); + +``` + +## Running tests + +#### Install dev deps: +```sh +$ git clone https://github.com/JustinTulloss/zeromq.node.git zmq && cd zmq +$ npm i +``` +#### Build: +```sh +# on unix: +$ make + +# building on windows: +> npm i +``` +#### Test: +```sh +# on unix: +$ make test + +# testing on windows: +> npm t +``` +## Running benchmarks + +Benchmarks are available in the `perf` directory, and have been implemented +according to the zmq documentation: +[How to run performance tests](http://www.zeromq.org/results:perf-howto) + +In the following examples, the arguments are respectively: +- the host to connect to/bind on +- message size (in bytes) +- message count + +You can run a latency benchmark by running these two commands in two separate +shells: + +```sh +node ./local_lat.js tcp://127.0.0.1:5555 1 100000 +``` + +```sh +node ./remote_lat.js tcp://127.0.0.1:5555 1 100000 +``` + +And you can run throughput tests by running these two commands in two +separate shells: + +```sh +node ./local_thr.js tcp://127.0.0.1:5555 1 100000 +``` + +```sh +node ./remote_thr.js tcp://127.0.0.1:5555 1 100000 +``` + +Running `make perf` will run the commands listed above. diff --git a/tools/LiveTexturing/node_modules/zmq/appveyor.yml b/tools/LiveTexturing/node_modules/zmq/appveyor.yml new file mode 100644 index 00000000..1e11ca87 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/appveyor.yml @@ -0,0 +1,24 @@ +environment: + matrix: + - nodejs_version: "0.10" + - nodejs_version: "0.12" + - nodejs_version: "2" + +#platform: +# - x86 +# - x64 + +install: + - ps: Install-Product node $env:nodejs_version #$env:platform + - npm install + +test_script: + - node --version + - npm --version + - npm test + +build: off + +matrix: + allow_failures: + - nodejs_version: "2" diff --git a/tools/LiveTexturing/node_modules/zmq/binding.cc b/tools/LiveTexturing/node_modules/zmq/binding.cc new file mode 100644 index 00000000..751135c9 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/binding.cc @@ -0,0 +1,1393 @@ +/* + * Copyright (c) 2011 Justin Tulloss + * Copyright (c) 2010 Justin Tulloss + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nan.h" + +#ifdef _WIN32 +# include +# define snprintf _snprintf_s + typedef BOOL (WINAPI* SetDllDirectoryFunc)(wchar_t *lpPathName); + class SetDllDirectoryCaller { + public: + explicit SetDllDirectoryCaller() : func_(NULL) { } + ~SetDllDirectoryCaller() { + if (func_) + func_(NULL); + } + // Sets the SetDllDirectory function pointer to activates this object. + void set_func(SetDllDirectoryFunc func) { func_ = func; } + private: + SetDllDirectoryFunc func_; + }; +#endif + +#define ZMQ_CAN_DISCONNECT (ZMQ_VERSION_MAJOR == 3 && ZMQ_VERSION_MINOR >= 2) || ZMQ_VERSION_MAJOR > 3 +#define ZMQ_CAN_UNBIND (ZMQ_VERSION_MAJOR == 3 && ZMQ_VERSION_MINOR >= 2) || ZMQ_VERSION_MAJOR > 3 +#define ZMQ_CAN_MONITOR (ZMQ_VERSION > 30201) +#define ZMQ_CAN_SET_CTX (ZMQ_VERSION_MAJOR == 3 && ZMQ_VERSION_MINOR >= 2) || ZMQ_VERSION_MAJOR > 3 + +using namespace v8; +using namespace node; + +enum { + STATE_READY + , STATE_BUSY + , STATE_CLOSED +}; + +namespace zmq { + + std::set opts_int; + std::set opts_uint32; + std::set opts_int64; + std::set opts_uint64; + std::set opts_binary; + + class Socket; + + class Context : public Nan::ObjectWrap { + friend class Socket; + public: + static NAN_MODULE_INIT(Initialize); + virtual ~Context(); + + private: + Context(int io_threads); + static NAN_METHOD(New); + static Context *GetContext(const Nan::FunctionCallbackInfo&); + void Close(); + static NAN_METHOD(Close); +#if ZMQ_CAN_SET_CTX + static NAN_METHOD(GetOpt); + static NAN_METHOD(SetOpt); +#endif + + void* context_; + }; + + class Socket : public Nan::ObjectWrap { + public: + static NAN_MODULE_INIT(Initialize); + virtual ~Socket(); + void CallbackIfReady(); +#if ZMQ_CAN_MONITOR + void MonitorEvent(uint16_t event_id, int32_t event_value, char *endpoint); + void MonitorError(const char *error_msg); +#endif + + private: + static NAN_METHOD(New); + Socket(Context *context, int type); + + static Socket* GetSocket(const Nan::FunctionCallbackInfo&); + static NAN_GETTER(GetState); + + static NAN_GETTER(GetPending); + static NAN_SETTER(SetPending); + + template + Local GetSockOpt(int option); + template + Local SetSockOpt(int option, Local wrappedValue); + static NAN_METHOD(GetSockOpt); + static NAN_METHOD(SetSockOpt); + + struct BindState; + static NAN_METHOD(Bind); + + static void UV_BindAsync(uv_work_t* req); + static void UV_BindAsyncAfter(uv_work_t* req); + + static NAN_METHOD(BindSync); +#if ZMQ_CAN_UNBIND + static NAN_METHOD(Unbind); + + static void UV_UnbindAsync(uv_work_t* req); + static void UV_UnbindAsyncAfter(uv_work_t* req); + + static NAN_METHOD(UnbindSync); +#endif + static NAN_METHOD(Connect); +#if ZMQ_CAN_DISCONNECT + static NAN_METHOD(Disconnect); +#endif + + class IncomingMessage; + static NAN_METHOD(Recv); + class OutgoingMessage; + static NAN_METHOD(Send); + void Close(); + static NAN_METHOD(Close); + + Nan::Persistent context_; + void *socket_; + int32_t pending_; + uint8_t state_; + int32_t endpoints; +#if ZMQ_CAN_MONITOR + void *monitor_socket_; + uv_timer_t *monitor_handle_; + int64_t timer_interval_; + int64_t num_of_events_; + static void UV_MonitorCallback(uv_timer_t* handle, int status); + static NAN_METHOD(Monitor); + void Unmonitor(); + static NAN_METHOD(Unmonitor); +#endif + + bool IsReady(); + uv_poll_t *poll_handle_; + static void UV_PollCallback(uv_poll_t* handle, int status, int events); + }; + + Nan::Persistent callback_symbol; +#if ZMQ_CAN_MONITOR + Nan::Persistent monitor_symbol; + Nan::Persistent monitor_error; + int monitors_count = 0; +#endif + + static NAN_MODULE_INIT(Initialize); + + /* + * Helpers for dealing with ØMQ errors. + */ + + static inline const char* + ErrorMessage() { + return zmq_strerror(zmq_errno()); + } + + static inline Local + ExceptionFromError() { + return Nan::Error(ErrorMessage()); + } + + + /* + * Context methods. + */ + + NAN_MODULE_INIT(Context::Initialize) { + Nan::HandleScope scope; + Local t = Nan::New(New); + t->InstanceTemplate()->SetInternalFieldCount(1); + + Nan::SetPrototypeMethod(t, "close", Close); +#if ZMQ_CAN_SET_CTX + Nan::SetPrototypeMethod(t, "setOpt", SetOpt); + Nan::SetPrototypeMethod(t, "getOpt", GetOpt); +#endif + + Nan::Set(target, Nan::New("Context").ToLocalChecked(), Nan::GetFunction(t).ToLocalChecked()); + } + + + Context::~Context() { + Close(); + } + + NAN_METHOD(Context::New) { + assert(info.IsConstructCall()); + int io_threads = 1; + if (info.Length() == 1) { + if (!info[0]->IsNumber()) { + return Nan::ThrowTypeError("io_threads must be an integer"); + } + io_threads = Nan::To(info[0]).FromJust(); + if (io_threads < 1) { + return Nan::ThrowRangeError("io_threads must be a positive number"); + } + } + Context *context = new Context(io_threads); + context->Wrap(info.This()); + info.GetReturnValue().Set(info.This()); + } + + Context::Context(int io_threads) : Nan::ObjectWrap() { + context_ = zmq_init(io_threads); + if (!context_) throw std::runtime_error(ErrorMessage()); + } + + Context * + Context::GetContext(const Nan::FunctionCallbackInfo& info) { + return Nan::ObjectWrap::Unwrap(info.This()); + } + + void + Context::Close() { + if (context_ != NULL) { + if (zmq_term(context_) < 0) throw std::runtime_error(ErrorMessage()); + context_ = NULL; + } + } + + NAN_METHOD(Context::Close) { + GetContext(info)->Close(); + return; + } + +#if ZMQ_CAN_SET_CTX + NAN_METHOD(Context::SetOpt) { + if (info.Length() != 2) + return Nan::ThrowError("Must pass an option and a value"); + if (!info[0]->IsNumber() || !info[1]->IsNumber()) + return Nan::ThrowTypeError("Arguments must be numbers"); + int option = Nan::To(info[0]).FromJust(); + int value = Nan::To(info[1]).FromJust(); + + Context *context = GetContext(info); + if (zmq_ctx_set(context->context_, option, value) < 0) + return Nan::ThrowError(ExceptionFromError()); + return; + } + + NAN_METHOD(Context::GetOpt) { + if (info.Length() != 1) + return Nan::ThrowError("Must pass an option"); + if (!info[0]->IsNumber()) + return Nan::ThrowTypeError("Option must be an integer"); + int option = Nan::To(info[0]).FromJust(); + + Context *context = GetContext(info); + int value = zmq_ctx_get(context->context_, option); + info.GetReturnValue().Set(Nan::New(value)); + } +#endif + /* + * Socket methods. + */ + + NAN_MODULE_INIT(Socket::Initialize) { + Nan::HandleScope scope; + + Local t = Nan::New(New); + t->InstanceTemplate()->SetInternalFieldCount(1); + Nan::SetAccessor(t->InstanceTemplate(), + Nan::New("state").ToLocalChecked(), Socket::GetState); + Nan::SetAccessor(t->InstanceTemplate(), + Nan::New("pending").ToLocalChecked(), GetPending, SetPending); + + Nan::SetPrototypeMethod(t, "bind", Bind); + Nan::SetPrototypeMethod(t, "bindSync", BindSync); +#if ZMQ_CAN_UNBIND + Nan::SetPrototypeMethod(t, "unbind", Unbind); + Nan::SetPrototypeMethod(t, "unbindSync", UnbindSync); +#endif + Nan::SetPrototypeMethod(t, "connect", Connect); + Nan::SetPrototypeMethod(t, "getsockopt", GetSockOpt); + Nan::SetPrototypeMethod(t, "setsockopt", SetSockOpt); + Nan::SetPrototypeMethod(t, "recv", Recv); + Nan::SetPrototypeMethod(t, "send", Send); + Nan::SetPrototypeMethod(t, "close", Close); + +#if ZMQ_CAN_DISCONNECT + Nan::SetPrototypeMethod(t, "disconnect", Disconnect); +#endif + +#if ZMQ_CAN_MONITOR + Nan::SetPrototypeMethod(t, "monitor", Monitor); + Nan::SetPrototypeMethod(t, "unmonitor", Unmonitor); + monitor_symbol.Reset(Nan::New("onMonitorEvent").ToLocalChecked()); + monitor_error.Reset(Nan::New("onMonitorError").ToLocalChecked()); +#endif + + Nan::Set(target, Nan::New("SocketBinding").ToLocalChecked(), Nan::GetFunction(t).ToLocalChecked()); + + callback_symbol.Reset(Nan::New("onReady").ToLocalChecked()); + } + + Socket::~Socket() { + Close(); + } + + NAN_METHOD(Socket::New) { + assert(info.IsConstructCall()); + + if (info.Length() != 2) { + return Nan::ThrowError("Must pass a context and a type to constructor"); + } + + Context *context = Nan::ObjectWrap::Unwrap(info[0].As()); + + if (!info[1]->IsNumber()) { + return Nan::ThrowTypeError("Type must be an integer"); + } + + int type = Nan::To(info[1]).FromJust(); + + Socket *socket = new Socket(context, type); + socket->Wrap(info.This()); + info.GetReturnValue().Set(info.This()); + } + + bool + Socket::IsReady() { + zmq_pollitem_t item = {socket_, 0, ZMQ_POLLIN, 0}; + if (pending_ > 0) + item.events |= ZMQ_POLLOUT; + while (true) { + int rc = zmq_poll(&item, 1, 0); + if (rc < 0) { + if (zmq_errno()==EINTR) { + continue; + } + throw std::runtime_error(ErrorMessage()); + } else { + break; + } + } + return item.revents & item.events; + } + + void + Socket::CallbackIfReady() { + if (this->IsReady()) { + Nan::HandleScope scope; + + Local callback_v = Nan::Get(this->handle(), Nan::New(callback_symbol)).ToLocalChecked(); + if (!callback_v->IsFunction()) { + return; + } + + Nan::MakeCallback(this->handle(), callback_v.As(), 0, NULL); + } + } + + void + Socket::UV_PollCallback(uv_poll_t* handle, int status, int events) { + if (status != 0) { + Nan::ThrowError("I/O status: socket not ready !=0 "); + return; + } + Socket* s = static_cast(handle->data); + s->CallbackIfReady(); + } + +#if ZMQ_CAN_MONITOR + void + Socket::MonitorEvent(uint16_t event_id, int32_t event_value, char *event_endpoint) { + Nan::HandleScope scope; + + Local callback_v = Nan::Get(this->handle(), Nan::New(monitor_symbol)).ToLocalChecked(); + if (!callback_v->IsFunction()) { + return; + } + + Local argv[3]; + argv[0] = Nan::New(event_id); + argv[1] = Nan::New(event_value); + argv[2] = Nan::New(event_endpoint).ToLocalChecked(); + + Nan::MakeCallback(this->handle(), callback_v.As(), 3, argv); + } + + void + Socket::MonitorError(const char *error_msg) { + Nan::HandleScope scope; + + Local callback_v = Nan::Get(this->handle(), Nan::New(monitor_error)).ToLocalChecked(); + if (!callback_v->IsFunction()) { + return; + } + + Local argv[1]; + argv[0] = Nan::New(error_msg).ToLocalChecked(); + + Nan::MakeCallback(this->handle(), callback_v.As(), 1, argv); + } + + void + Socket::UV_MonitorCallback(uv_timer_t* handle, int status) { + Nan::HandleScope scope; + Socket* s = static_cast(handle->data); + zmq_msg_t msg1; /* 3.x has 1 message per event */ + + zmq_pollitem_t item; + item.socket = s->monitor_socket_; + item.events = ZMQ_POLLIN; + + const char* error = NULL; + int64_t ittr = 0; + while ((s->num_of_events_ == 0 || s->num_of_events_ > ittr++) && zmq_poll(&item, 1, 0)) { + zmq_msg_init (&msg1); + if (zmq_recvmsg (s->monitor_socket_, &msg1, ZMQ_DONTWAIT) > 0) { + char event_endpoint[1025]; + uint16_t event_id; + int32_t event_value; + +#if ZMQ_VERSION_MAJOR >= 4 + uint8_t *data = static_cast(zmq_msg_data(&msg1)); + event_id = *reinterpret_cast(data); + event_value = *reinterpret_cast(data + 2); + + zmq_msg_t msg2; /* 4.x has 2 messages per event */ + + // get our next frame it may have the target address and safely copy to our buffer + zmq_msg_init (&msg2); + if (zmq_msg_more(&msg1) == 0 || zmq_recvmsg (s->monitor_socket_, &msg2, 0) == -1) { + error = ErrorMessage(); + zmq_msg_close(&msg2); + break; + } + + // protect from overflow + size_t len = zmq_msg_size(&msg2); + // MIN message size and buffer size with null padding + len = len < sizeof(event_endpoint)-1 ? len : sizeof(event_endpoint)-1; + memcpy(event_endpoint, zmq_msg_data(&msg2), len); + zmq_msg_close(&msg2); + + // null terminate our string + event_endpoint[len]=0; +#else + // monitoring on zmq < 4 used zmq_event_t + zmq_event_t event; + memcpy (&event, zmq_msg_data (&msg1), sizeof (zmq_event_t)); + event_id = event.event; + + // Bit of a hack, but all events in the zmq_event_t union have the same layout so this will work for all event types. + event_value = event.data.connected.fd; + snprintf(event_endpoint, sizeof(event_endpoint), "%s", event.data.connected.addr); +#endif + + s->MonitorEvent(event_id, event_value, event_endpoint); + zmq_msg_close(&msg1); + } + else { + error = ErrorMessage(); + zmq_msg_close(&msg1); + break; + } + } + + // If there was no error and we still monitor we reset the monitor timer + if (error == NULL && s->monitor_handle_ != NULL) { + uv_timer_start(s->monitor_handle_, reinterpret_cast(Socket::UV_MonitorCallback), s->timer_interval_, 0); + } + // If error raise the monitor error event and stop the monitor + else if (error != NULL) { + s->Unmonitor(); + s->MonitorError(error); + } + } +#endif + + Socket::Socket(Context *context, int type) : Nan::ObjectWrap() { + context_.Reset(context->handle()); + socket_ = zmq_socket(context->context_, type); + pending_ = 0; + state_ = STATE_READY; + + if (NULL == socket_) { + Nan::ThrowError(ErrorMessage()); + return; + } + + endpoints = 0; + + poll_handle_ = new uv_poll_t; + + poll_handle_->data = this; + + uv_os_sock_t socket; + size_t len = sizeof(uv_os_sock_t); + + if (zmq_getsockopt(socket_, ZMQ_FD, &socket, &len)) { + throw std::runtime_error(ErrorMessage()); + } + + #if ZMQ_CAN_MONITOR + this->monitor_socket_ = NULL; + #endif + + uv_poll_init_socket(uv_default_loop(), poll_handle_, socket); + uv_poll_start(poll_handle_, UV_READABLE, Socket::UV_PollCallback); + } + + Socket * + Socket::GetSocket(const Nan::FunctionCallbackInfo &info) { + return Nan::ObjectWrap::Unwrap(info.This()); + } + + /* + * This macro makes a call to GetSocket and checks the socket state. These two + * things go hand in hand everywhere in our code. + */ + #define GET_SOCKET(info) \ + Socket* socket = GetSocket(info); \ + if (socket->state_ == STATE_CLOSED) \ + return Nan::ThrowTypeError("Socket is closed"); \ + if (socket->state_ == STATE_BUSY) \ + return Nan::ThrowTypeError("Socket is busy"); + + NAN_GETTER(Socket::GetState) { + Socket* socket = Nan::ObjectWrap::Unwrap(info.Holder()); + info.GetReturnValue().Set(Nan::New(socket->state_)); + } + + NAN_GETTER(Socket::GetPending) { + Socket* socket = Nan::ObjectWrap::Unwrap(info.Holder()); + info.GetReturnValue().Set(Nan::New(socket->pending_)); + } + + NAN_SETTER(Socket::SetPending) { + if (!value->IsNumber()) { + Nan::ThrowTypeError("Pending must be an integer"); + } + + Socket* socket = Nan::ObjectWrap::Unwrap(info.Holder()); + socket->pending_ = Nan::To(value).FromJust(); + } + + template + Local Socket::GetSockOpt(int option) { + T value = 0; + size_t len = sizeof(T); + while (true) { + int rc = zmq_getsockopt(socket_, option, &value, &len); + if (rc < 0) { + if(zmq_errno()==EINTR) { + continue; + } + Nan::ThrowError(ExceptionFromError()); + return Nan::Undefined(); + } else { + break; + } + } + return Nan::New(value); + } + + template + Local Socket::SetSockOpt(int option, Local wrappedValue) { + if (!wrappedValue->IsNumber()) { + Nan::ThrowError("Value must be an integer"); + return Nan::Undefined(); + } + T value = Nan::To(wrappedValue).FromJust(); + if (zmq_setsockopt(socket_, option, &value, sizeof(T)) < 0) + Nan::ThrowError(ExceptionFromError()); + return Nan::Undefined(); + } + + template<> Local + Socket::GetSockOpt(int option) { + char value[1024]; + size_t len = sizeof(value) - 1; + if (zmq_getsockopt(socket_, option, value, &len) < 0) { + Nan::ThrowError(ExceptionFromError()); + return Nan::Undefined(); + } + value[len] = '\0'; + return Nan::New(value).ToLocalChecked(); + } + + template<> Local + Socket::SetSockOpt(int option, Local wrappedValue) { + if (!Buffer::HasInstance(wrappedValue)) { + Nan::ThrowTypeError("Value must be a buffer"); + return Nan::Undefined(); + } + Local buf = wrappedValue.As(); + size_t length = Buffer::Length(buf); + if (zmq_setsockopt(socket_, option, Buffer::Data(buf), length) < 0) + Nan::ThrowError(ExceptionFromError()); + return Nan::Undefined(); + } + + NAN_METHOD(Socket::GetSockOpt) { + if (info.Length() != 1) + return Nan::ThrowError("Must pass an option"); + if (!info[0]->IsNumber()) + return Nan::ThrowTypeError("Option must be an integer"); + int64_t option = Nan::To(info[0]).FromJust(); + + GET_SOCKET(info); + + if (opts_int.count(option)) { + info.GetReturnValue().Set(socket->GetSockOpt(option)); + } else if (opts_uint32.count(option)) { + info.GetReturnValue().Set(socket->GetSockOpt(option)); + } else if (opts_int64.count(option)) { + info.GetReturnValue().Set(socket->GetSockOpt(option)); + } else if (opts_uint64.count(option)) { + info.GetReturnValue().Set(socket->GetSockOpt(option)); + } else if (opts_binary.count(option)) { + info.GetReturnValue().Set(socket->GetSockOpt(option)); + } else { + return Nan::ThrowError(zmq_strerror(EINVAL)); + } + } + + NAN_METHOD(Socket::SetSockOpt) { + if (info.Length() != 2) + return Nan::ThrowError("Must pass an option and a value"); + if (!info[0]->IsNumber()) + return Nan::ThrowTypeError("Option must be an integer"); + int64_t option = Nan::To(info[0]).FromJust(); + GET_SOCKET(info); + + if (opts_int.count(option)) { + info.GetReturnValue().Set(socket->SetSockOpt(option, info[1])); + } else if (opts_uint32.count(option)) { + info.GetReturnValue().Set(socket->SetSockOpt(option, info[1])); + } else if (opts_int64.count(option)) { + info.GetReturnValue().Set(socket->SetSockOpt(option, info[1])); + } else if (opts_uint64.count(option)) { + info.GetReturnValue().Set(socket->SetSockOpt(option, info[1])); + } else if (opts_binary.count(option)) { + info.GetReturnValue().Set(socket->SetSockOpt(option, info[1])); + } else { + return Nan::ThrowError(zmq_strerror(EINVAL)); + } + } + + struct Socket::BindState { + BindState(Socket* sock_, Local cb_, Local addr_) + : addr(addr_) { + sock_obj.Reset(sock_->handle()); + sock = sock_->socket_; + cb.Reset(cb_); + error = 0; + } + + ~BindState() { + sock_obj.Reset(); + cb.Reset(); + } + + Nan::Persistent sock_obj; + void* sock; + Nan::Persistent cb; + Nan::Utf8String addr; + int error; + }; + + NAN_METHOD(Socket::Bind) { + if (!info[0]->IsString()) + return Nan::ThrowTypeError("Address must be a string!"); + Local addr = info[0].As(); + if (info.Length() > 1 && !info[1]->IsFunction()) + return Nan::ThrowTypeError("Provided callback must be a function"); + Local cb = Local::Cast(info[1]); + + GET_SOCKET(info); + + BindState* state = new BindState(socket, cb, addr); + uv_work_t* req = new uv_work_t; + req->data = state; + uv_queue_work(uv_default_loop(), + req, + UV_BindAsync, + (uv_after_work_cb)UV_BindAsyncAfter); + socket->state_ = STATE_BUSY; + + return; + } + + void Socket::UV_BindAsync(uv_work_t* req) { + BindState* state = static_cast(req->data); + if (zmq_bind(state->sock, *state->addr) < 0) + state->error = zmq_errno(); + } + + void Socket::UV_BindAsyncAfter(uv_work_t* req) { + BindState* state = static_cast(req->data); + Nan::HandleScope scope; + + Local argv[1]; + + if (state->error) { + argv[0] = Nan::Error(zmq_strerror(state->error)); + } else { + argv[0] = Nan::Undefined(); + } + + Local cb = Nan::New(state->cb); + + Socket *socket = Nan::ObjectWrap::Unwrap(Nan::New(state->sock_obj)); + socket->state_ = STATE_READY; + + if (socket->endpoints == 0) + socket->Ref(); + socket->endpoints += 1; + + Nan::MakeCallback(Nan::GetCurrentContext()->Global(), cb, 1, argv); + + delete state; + delete req; + } + + NAN_METHOD(Socket::BindSync) { + if (!info[0]->IsString()) + return Nan::ThrowTypeError("Address must be a string!"); + Nan::Utf8String addr(info[0].As()); + GET_SOCKET(info); + socket->state_ = STATE_BUSY; + if (zmq_bind(socket->socket_, *addr) < 0) + return Nan::ThrowError(ErrorMessage()); + + socket->state_ = STATE_READY; + + if (socket->endpoints == 0) + socket->Ref(); + + socket->endpoints += 1; + + return; + } + +#if ZMQ_CAN_UNBIND + NAN_METHOD(Socket::Unbind) { + if (!info[0]->IsString()) + return Nan::ThrowTypeError("Address must be a string!"); + Local addr = info[0].As(); + if (info.Length() > 1 && !info[1]->IsFunction()) + return Nan::ThrowTypeError("Provided callback must be a function"); + Local cb = Local::Cast(info[1]); + + GET_SOCKET(info); + + BindState* state = new BindState(socket, cb, addr); + uv_work_t* req = new uv_work_t; + req->data = state; + uv_queue_work(uv_default_loop(), + req, + UV_UnbindAsync, + (uv_after_work_cb)UV_UnbindAsyncAfter); + socket->state_ = STATE_BUSY; + return; + } + + void Socket::UV_UnbindAsync(uv_work_t* req) { + BindState* state = static_cast(req->data); + if (zmq_unbind(state->sock, *state->addr) < 0) + state->error = zmq_errno(); + } + + void Socket::UV_UnbindAsyncAfter(uv_work_t* req) { + BindState* state = static_cast(req->data); + Nan::HandleScope scope; + + Local argv[1]; + + if (state->error) { + argv[0] = Nan::Error(zmq_strerror(state->error)); + } else { + argv[0] = Nan::Undefined(); + } + + Local cb = Nan::New(state->cb); + + Socket *socket = Nan::ObjectWrap::Unwrap(Nan::New(state->sock_obj)); + socket->state_ = STATE_READY; + + if (--socket->endpoints == 0) + socket->Unref(); + + Nan::MakeCallback(Nan::GetCurrentContext()->Global(), cb, 1, argv); + + delete state; + delete req; + } + + NAN_METHOD(Socket::UnbindSync) { + if (!info[0]->IsString()) + return Nan::ThrowTypeError("Address must be a string!"); + Nan::Utf8String addr(info[0].As()); + GET_SOCKET(info); + socket->state_ = STATE_BUSY; + if (zmq_unbind(socket->socket_, *addr) < 0) + return Nan::ThrowError(ErrorMessage()); + + socket->state_ = STATE_READY; + + if (--socket->endpoints == 0) + socket->Unref(); + + return; + } +#endif + + NAN_METHOD(Socket::Connect) { + if (!info[0]->IsString()) { + return Nan::ThrowTypeError("Address must be a string!"); + } + + GET_SOCKET(info); + + Nan::Utf8String address(info[0].As()); + if (zmq_connect(socket->socket_, *address)) + return Nan::ThrowError(ErrorMessage()); + + if (socket->endpoints++ == 0) + socket->Ref(); + + return; + } + +#if ZMQ_CAN_DISCONNECT + NAN_METHOD(Socket::Disconnect) { + + if (!info[0]->IsString()) { + return Nan::ThrowTypeError("Address must be a string!"); + } + + GET_SOCKET(info); + + Nan::Utf8String address(info[0].As()); + if (zmq_disconnect(socket->socket_, *address)) + return Nan::ThrowError(ErrorMessage()); + if (--socket->endpoints == 0) + socket->Unref(); + + return; + } +#endif + + /* + * An object that creates an empty ØMQ message, which can be used for + * zmq_recv. After the receive call, a Buffer object wrapping the ØMQ + * message can be requested. The reference for the ØMQ message will + * remain while the data is in use by the Buffer. + */ + + class Socket::IncomingMessage { + public: + inline IncomingMessage() { + msgref_ = new MessageReference(); + }; + + inline ~IncomingMessage() { + if (buf_.IsEmpty() && msgref_) { + delete msgref_; + msgref_ = NULL; + } else { + buf_.Reset(); + } + }; + + inline operator zmq_msg_t*() { + return *msgref_; + } + + inline Local GetBuffer() { + if (buf_.IsEmpty()) { + Local buf_obj = Nan::NewBuffer((char*)zmq_msg_data(*msgref_), zmq_msg_size(*msgref_), FreeCallback, msgref_).ToLocalChecked(); + if (buf_obj.IsEmpty()) { + return Local(); + } + buf_.Reset(buf_obj); + } + return Nan::New(buf_); + } + + private: + static void FreeCallback(char* data, void* message) { + delete static_cast(message); + } + + class MessageReference { + public: + inline MessageReference() { + if (zmq_msg_init(&msg_) < 0) + throw std::runtime_error(ErrorMessage()); + } + + inline ~MessageReference() { + if (zmq_msg_close(&msg_) < 0) + throw std::runtime_error(ErrorMessage()); + } + + inline operator zmq_msg_t*() { + return &msg_; + } + + private: + zmq_msg_t msg_; + }; + + Nan::Persistent buf_; + MessageReference* msgref_; + }; + +#if ZMQ_CAN_MONITOR + NAN_METHOD(Socket::Monitor) { + int64_t timer_interval = 10; // default to 10ms interval + int64_t num_of_events = 1; // default is 1 event per interval + + if (info.Length() > 0 && !info[0]->IsUndefined()) { + if (!info[0]->IsNumber()) + return Nan::ThrowTypeError("Option must be an integer"); + timer_interval = Nan::To(info[0]).FromJust(); + if (timer_interval <= 0) + return Nan::ThrowTypeError("Option must be a positive integer"); + } + + if (info.Length() > 1 && !info[1]->IsUndefined()) { + if (!info[1]->IsNumber()) + return Nan::ThrowTypeError("numOfEvents must be an integer"); + num_of_events = Nan::To(info[1]).FromJust(); + if (num_of_events < 0) + return Nan::ThrowTypeError("numOfEvents should be no less than zero"); + } + + GET_SOCKET(info); + char addr[255]; + Context *context = Nan::ObjectWrap::Unwrap(Nan::New(socket->context_)); + sprintf(addr, "%s%d", "inproc://monitor.req.", monitors_count++); + + if(zmq_socket_monitor(socket->socket_, addr, ZMQ_EVENT_ALL) != -1) { + socket->monitor_socket_ = zmq_socket (context->context_, ZMQ_PAIR); + zmq_connect (socket->monitor_socket_, addr); + socket->timer_interval_ = timer_interval; + socket->num_of_events_ = num_of_events; + socket->monitor_handle_ = new uv_timer_t; + socket->monitor_handle_->data = socket; + + uv_timer_init(uv_default_loop(), socket->monitor_handle_); + uv_timer_start(socket->monitor_handle_, reinterpret_cast(Socket::UV_MonitorCallback), timer_interval, 0); + } + + return; + } + + void + Socket::Unmonitor() { + // Make sure we are monitoring + if (this->monitor_socket_ == NULL) { + return; + } + + // Passing NULL as addr will tell zmq to stop monitor + zmq_socket_monitor(this->socket_, NULL, ZMQ_EVENT_ALL); + + // Close the monitor socket and stop timer + if (zmq_close(this->monitor_socket_) < 0) + throw std::runtime_error(ErrorMessage()); + uv_timer_stop(this->monitor_handle_); + this->monitor_handle_ = NULL; + this->monitor_socket_ = NULL; + } + + NAN_METHOD(Socket::Unmonitor) { + // We can't use the GET_SOCKET macro here as it requries the socket to be open, + // which might not always be the case + Socket* socket = GetSocket(info); + socket->Unmonitor(); + return; + } + +#endif + + NAN_METHOD(Socket::Recv) { + int flags = 0; + int argc = info.Length(); + if (argc == 1) { + if (!info[0]->IsNumber()) + return Nan::ThrowTypeError("Argument should be an integer"); + flags = Nan::To(info[0]).FromJust(); + } else if (argc != 0) { + return Nan::ThrowTypeError("Only one argument at most was expected"); + } + + GET_SOCKET(info); + + IncomingMessage msg; + while (true) { + int rc; + #if ZMQ_VERSION_MAJOR == 2 + rc = zmq_recv(socket->socket_, msg, flags); + #else + rc = zmq_recvmsg(socket->socket_, msg, flags); + #endif + if (rc < 0) { + if (zmq_errno()==EINTR) { + continue; + } + return Nan::ThrowError(ErrorMessage()); + } else { + break; + } + } + info.GetReturnValue().Set(msg.GetBuffer()); + } + + /* + * An object that creates a ØMQ message from the given Buffer Object, + * and manages the reference to it using RAII. A persistent V8 handle + * for the Buffer object will remain while its data is in use by ØMQ. + */ + + class Socket::OutgoingMessage { + public: + inline OutgoingMessage(Local buf) { + bufref_ = new BufferReference(buf); + if (zmq_msg_init_data(&msg_, Buffer::Data(buf), Buffer::Length(buf), + BufferReference::FreeCallback, bufref_) < 0) { + delete bufref_; + throw std::runtime_error(ErrorMessage()); + } + }; + + inline ~OutgoingMessage() { + if (zmq_msg_close(&msg_) < 0) + throw std::runtime_error(ErrorMessage()); + }; + + inline operator zmq_msg_t*() { + return &msg_; + } + + private: + class BufferReference { + public: + inline BufferReference(Local buf) { + loop = uv_default_loop(); + uv_async_init(loop, &async, reinterpret_cast(cleanup)); + async.data = this; + persistent.Reset(buf); + } + + inline ~BufferReference() { + persistent.Reset(); + } + + // Called by zmq when the message has been sent. + // NOTE: May be called from a worker thread. Do not modify V8/Node. + static void FreeCallback(void* data, void* message) { + uv_async_send(&static_cast(message)->async); + } + + static void cleanup(uv_async_t *handle, int status) { + delete static_cast(handle->data); + } + private: + Nan::Persistent persistent; + uv_async_t async; + uv_loop_t *loop; + }; + + zmq_msg_t msg_; + BufferReference* bufref_; + }; + + // WARNING: the buffer passed here will be kept alive + // until zmq_send completes, possibly on another thread. + // Do not modify or reuse any buffer passed to send. + // This is bad, but allows us to send without copying. + NAN_METHOD(Socket::Send) { + + int argc = info.Length(); + if (argc != 1 && argc != 2) + return Nan::ThrowTypeError("Must pass a Buffer and optionally flags"); + if (!Buffer::HasInstance(info[0])) + return Nan::ThrowTypeError("First argument should be a Buffer"); + int flags = 0; + if (argc == 2) { + if (!info[1]->IsNumber()) + return Nan::ThrowTypeError("Second argument should be an integer"); + flags = Nan::To(info[1]).FromJust(); + } + + GET_SOCKET(info); + +#if 0 // zero-copy version, but doesn't properly pin buffer and so has GC issues + OutgoingMessage msg(info[0].As()); + if (zmq_send(socket->socket_, msg, flags) < 0) + return Nan::ThrowError(ErrorMessage()); +#else // copying version that has no GC issues + zmq_msg_t msg; + Local buf = info[0].As(); + size_t len = Buffer::Length(buf); + int res = zmq_msg_init_size(&msg, len); + if (res != 0) + return Nan::ThrowError(ErrorMessage()); + + char * cp = static_cast(zmq_msg_data(&msg)); + const char * dat = Buffer::Data(buf); + std::copy(dat, dat + len, cp); + while (true) { + int rc; + #if ZMQ_VERSION_MAJOR == 2 + rc = zmq_send(socket->socket_, &msg, flags); + #elif ZMQ_VERSION_MAJOR == 3 + rc = zmq_sendmsg(socket->socket_, &msg, flags); + #else + rc = zmq_msg_send(&msg, socket->socket_, flags); + #endif + if (rc < 0){ + if (zmq_errno()==EINTR) { + continue; + } + return Nan::ThrowError(ErrorMessage()); + } else { + break; + } + } +#endif // zero copy / copying version + + return; + } + + + static void + on_uv_close(uv_handle_t *handle) + { + delete handle; + } + + void + Socket::Close() { + if (socket_) { + if (zmq_close(socket_) < 0) + throw std::runtime_error(ErrorMessage()); + socket_ = NULL; + state_ = STATE_CLOSED; + context_.Reset(); + + if (this->endpoints > 0) + this->Unref(); + this->endpoints = 0; + + uv_poll_stop(poll_handle_); + uv_close(reinterpret_cast(poll_handle_), on_uv_close); + } + } + + NAN_METHOD(Socket::Close) { + GET_SOCKET(info); + socket->Close(); + return; + } + + // Make zeromq versions less than 2.1.3 work by defining + // the new constants if they don't already exist + #if (ZMQ_VERSION < 20103) + # define ZMQ_DEALER ZMQ_XREQ + # define ZMQ_ROUTER ZMQ_XREP + #endif + + /* + * Module functions. + */ + + static NAN_METHOD(ZmqVersion) { + int major, minor, patch; + zmq_version(&major, &minor, &patch); + + char version_info[16]; + snprintf(version_info, 16, "%d.%d.%d", major, minor, patch); + + info.GetReturnValue().Set(Nan::New(version_info).ToLocalChecked()); + } + +#if ZMQ_VERSION_MAJOR >= 4 + static NAN_METHOD(ZmqCurveKeypair) { + + char public_key [41]; + char secret_key [41]; + + int rc = zmq_curve_keypair( public_key, secret_key); + if (rc < 0) { + return Nan::ThrowError("zmq_curve_keypair operation failed. Method support in libzmq v4+ -with-libsodium."); + } + + Local obj = Nan::New(); + Nan::Set(obj, Nan::New("public").ToLocalChecked(), Nan::New(public_key).ToLocalChecked()); + Nan::Set(obj, Nan::New("secret").ToLocalChecked(), Nan::New(secret_key).ToLocalChecked()); + + info.GetReturnValue().Set(obj); + } +#endif + + static NAN_MODULE_INIT(Initialize) { + Nan::HandleScope scope; + + opts_int.insert(14); // ZMQ_FD + opts_int.insert(16); // ZMQ_TYPE + opts_int.insert(17); // ZMQ_LINGER + opts_int.insert(18); // ZMQ_RECONNECT_IVL + opts_int.insert(19); // ZMQ_BACKLOG + opts_int.insert(21); // ZMQ_RECONNECT_IVL_MAX + opts_int.insert(23); // ZMQ_SNDHWM + opts_int.insert(24); // ZMQ_RCVHWM + opts_int.insert(25); // ZMQ_MULTICAST_HOPS + opts_int.insert(27); // ZMQ_RCVTIMEO + opts_int.insert(28); // ZMQ_SNDTIMEO + opts_int.insert(29); // ZMQ_RCVLABEL + opts_int.insert(30); // ZMQ_RCVCMD + opts_int.insert(31); // ZMQ_IPV4ONLY + opts_int.insert(33); // ZMQ_ROUTER_MANDATORY + opts_int.insert(34); // ZMQ_TCP_KEEPALIVE + opts_int.insert(35); // ZMQ_TCP_KEEPALIVE_CNT + opts_int.insert(36); // ZMQ_TCP_KEEPALIVE_IDLE + opts_int.insert(37); // ZMQ_TCP_KEEPALIVE_INTVL + opts_int.insert(39); // ZMQ_DELAY_ATTACH_ON_CONNECT + opts_int.insert(40); // ZMQ_XPUB_VERBOSE + opts_int.insert(41); // ZMQ_ROUTER_RAW + opts_int.insert(42); // ZMQ_IPV6 + + opts_int64.insert(3); // ZMQ_SWAP + opts_int64.insert(8); // ZMQ_RATE + opts_int64.insert(10); // ZMQ_MCAST_LOOP + opts_int64.insert(20); // ZMQ_RECOVERY_IVL_MSEC + opts_int64.insert(22); // ZMQ_MAXMSGSIZE + + opts_uint64.insert(1); // ZMQ_HWM + opts_uint64.insert(4); // ZMQ_AFFINITY + + opts_binary.insert(5); // ZMQ_IDENTITY + opts_binary.insert(6); // ZMQ_SUBSCRIBE + opts_binary.insert(7); // ZMQ_UNSUBSCRIBE + opts_binary.insert(32); // ZMQ_LAST_ENDPOINT + opts_binary.insert(38); // ZMQ_TCP_ACCEPT_FILTER + + // transition types + #if ZMQ_VERSION_MAJOR >= 3 + opts_int.insert(15); // ZMQ_EVENTS 3.x int + opts_int.insert(8); // ZMQ_RATE 3.x int + opts_int.insert(9); // ZMQ_RECOVERY_IVL 3.x int + opts_int.insert(13); // ZMQ_RCVMORE 3.x int + opts_int.insert(11); // ZMQ_SNDBUF 3.x int + opts_int.insert(12); // ZMQ_RCVBUF 3.x int + #else + opts_uint32.insert(15); // ZMQ_EVENTS 2.x uint32_t + opts_int64.insert(8); // ZMQ_RATE 2.x int64_t + opts_int64.insert(9); // ZMQ_RECOVERY_IVL 2.x int64_t + opts_int64.insert(13); // ZMQ_RCVMORE 2.x int64_t + opts_uint64.insert(11); // ZMQ_SNDBUF 2.x uint64_t + opts_uint64.insert(12); // ZMQ_RCVBUF 2.x uint64_t + #endif + + #if ZMQ_VERSION_MAJOR >= 4 + opts_int.insert(43); // ZMQ_MECHANISM + opts_int.insert(44); // ZMQ_PLAIN_SERVER + opts_binary.insert(45); // ZMQ_PLAIN_USERNAME + opts_binary.insert(46); // ZMQ_PLAIN_PASSWORD + opts_int.insert(47); // ZMQ_CURVE_SERVER + opts_binary.insert(48); // ZMQ_CURVE_PUBLICKEY + opts_binary.insert(49); // ZMQ_CURVE_SECRETKEY + opts_binary.insert(50); // ZMQ_CURVE_SERVERKEY + opts_binary.insert(55); // ZMQ_ZAP_DOMAIN + #endif + + NODE_DEFINE_CONSTANT(target, ZMQ_CAN_DISCONNECT); + NODE_DEFINE_CONSTANT(target, ZMQ_CAN_UNBIND); + NODE_DEFINE_CONSTANT(target, ZMQ_CAN_MONITOR); + NODE_DEFINE_CONSTANT(target, ZMQ_CAN_SET_CTX); + NODE_DEFINE_CONSTANT(target, ZMQ_PUB); + NODE_DEFINE_CONSTANT(target, ZMQ_SUB); + #if ZMQ_VERSION_MAJOR >= 3 + NODE_DEFINE_CONSTANT(target, ZMQ_XPUB); + NODE_DEFINE_CONSTANT(target, ZMQ_XSUB); + #endif + NODE_DEFINE_CONSTANT(target, ZMQ_REQ); + NODE_DEFINE_CONSTANT(target, ZMQ_XREQ); + NODE_DEFINE_CONSTANT(target, ZMQ_REP); + NODE_DEFINE_CONSTANT(target, ZMQ_XREP); + NODE_DEFINE_CONSTANT(target, ZMQ_DEALER); + NODE_DEFINE_CONSTANT(target, ZMQ_ROUTER); + NODE_DEFINE_CONSTANT(target, ZMQ_PUSH); + NODE_DEFINE_CONSTANT(target, ZMQ_PULL); + NODE_DEFINE_CONSTANT(target, ZMQ_PAIR); + #if ZMQ_VERSION_MAJOR >= 4 + NODE_DEFINE_CONSTANT(target, ZMQ_STREAM); + #endif + + NODE_DEFINE_CONSTANT(target, ZMQ_POLLIN); + NODE_DEFINE_CONSTANT(target, ZMQ_POLLOUT); + NODE_DEFINE_CONSTANT(target, ZMQ_POLLERR); + + NODE_DEFINE_CONSTANT(target, ZMQ_SNDMORE); + #if ZMQ_VERSION_MAJOR == 2 + NODE_DEFINE_CONSTANT(target, ZMQ_NOBLOCK); + #endif + + NODE_DEFINE_CONSTANT(target, STATE_READY); + NODE_DEFINE_CONSTANT(target, STATE_BUSY); + NODE_DEFINE_CONSTANT(target, STATE_CLOSED); + + Nan::SetMethod(target, "zmqVersion", ZmqVersion); + #if ZMQ_VERSION_MAJOR >= 4 + Nan::SetMethod(target, "zmqCurveKeypair", ZmqCurveKeypair); + #endif + + Context::Initialize(target); + Socket::Initialize(target); + } +} // namespace zmq + + +// module + +extern "C" NAN_MODULE_INIT(init) { +#ifdef _MSC_VER + // On Windows, inject the windows/lib folder into the DLL search path so that + // it will pick up our bundled DLL in case we do not have zmq installed on + // this system. + HMODULE kernel32_dll = GetModuleHandleW(L"kernel32.dll"); + SetDllDirectoryCaller caller; + SetDllDirectoryFunc set_dll_directory; + wchar_t path[MAX_PATH] = L""; + wchar_t pathDir[MAX_PATH] = L""; + if (kernel32_dll != NULL) { + set_dll_directory = + reinterpret_cast(GetProcAddress(kernel32_dll, "SetDllDirectoryW")); + if (set_dll_directory) { + GetModuleFileNameW(GetModuleHandleW(L"zmq.node"), path, MAX_PATH - 1); + wcsncpy(pathDir, path, wcsrchr(path, '\\') - path); + path[0] = '\0'; + pathDir[wcslen(pathDir)] = '\0'; +# ifdef _WIN64 + wcscat(pathDir, L"\\..\\..\\windows\\lib\\x64"); +# else + wcscat(pathDir, L"\\..\\..\\windows\\lib\\x86"); +# endif + _wfullpath(path, pathDir, MAX_PATH); + set_dll_directory(path); + caller.set_func(set_dll_directory); + assert (!FAILED(__HrLoadAllImportsForDll("libzmq-v100-mt-4_0_4.dll")) && + "delayload error"); + } + } +#endif + zmq::Initialize(target); +} + +NODE_MODULE(zmq, init) diff --git a/tools/LiveTexturing/node_modules/zmq/binding.gyp b/tools/LiveTexturing/node_modules/zmq/binding.gyp new file mode 100644 index 00000000..3a952637 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/binding.gyp @@ -0,0 +1,76 @@ +{ + 'targets': [ + { + 'target_name': 'zmq', + 'sources': [ 'binding.cc' ], + 'include_dirs' : [ + "/dev/null || echo "")', + ], + 'libraries': [ + '/dev/null || echo "")', + ], + }], + ] + } + ] +} diff --git a/tools/LiveTexturing/node_modules/zmq/examples/dealer_router.js b/tools/LiveTexturing/node_modules/zmq/examples/dealer_router.js new file mode 100644 index 00000000..12662428 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/dealer_router.js @@ -0,0 +1,54 @@ +/* + * + * One client two servers (round roobin) + * + */ + +var cluster = require('cluster') + , zmq = require('../') + , port = 'tcp://127.0.0.1:12345'; + +if (cluster.isMaster) { + for (var i = 0; i < 2; i++) cluster.fork(); + + cluster.on('death', function(worker) { + console.log('worker ' + worker.pid + ' died'); + }); + + //dealer = client + + var socket = zmq.socket('dealer'); + + socket.identity = 'client' + process.pid; + + socket.bind(port, function(err) { + if (err) throw err; + console.log('bound!'); + + setInterval(function() { + var value = Math.floor(Math.random()*100); + + console.log(socket.identity + ': asking ' + value); + socket.send(value); + }, 100); + + + socket.on('message', function(data) { + console.log(socket.identity + ': answer data ' + data); + }); + }); +} else { + //router = server + + var socket = zmq.socket('router'); + + socket.identity = 'server' + process.pid; + + socket.connect(port); + console.log('connected!'); + + socket.on('message', function(envelope, data) { + console.log(socket.identity + ': received ' + envelope + ' - ' + data.toString()); + socket.send([envelope, data * 2]); + }); +} \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/devices/forwarder.js b/tools/LiveTexturing/node_modules/zmq/examples/devices/forwarder.js new file mode 100644 index 00000000..3ad29df2 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/devices/forwarder.js @@ -0,0 +1,69 @@ +/* + * + * Forwarder device + * + */ + +var zmq = require('../../') + , frontPort = 'tcp://127.0.0.1:12345' + , backPort = 'tcp://127.0.0.1:12346'; + +function createClient (port) { + var socket = zmq.socket('pub'); + + socket.identity = 'client' + process.pid; + + socket.connect(port); + console.log('client connected!'); + + setInterval(function() { + var value = Math.floor(Math.random()*100); + + console.log(socket.identity + ': broadcasting ' + value); + socket.send(value); + }, 100); +}; + +function createWorker (port) { + var socket = zmq.socket('sub'); + + socket.identity = 'worker' + process.pid; + + socket.subscribe(''); + socket.on('message', function(data) { + console.log(socket.identity + ': got ' + data.toString()); + }); + + socket.connect(port, function(err) { + if (err) throw err; + console.log('worker connected!'); + }); +}; + +function createForwarderDevice(frontPort, backPort) { + var frontSocket = zmq.socket('sub'), + backSocket = zmq.socket('pub'); + + frontSocket.identity = 'sub' + process.pid; + backSocket.identity = 'pub' + process.pid; + + frontSocket.subscribe(''); + frontSocket.bind(frontPort, function (err) { + console.log('bound', frontPort); + }); + + frontSocket.on('message', function() { + //pass to back + console.log('forwarder: recasting', arguments[0].toString()); + backSocket.send(Array.prototype.slice.call(arguments)); + }); + + backSocket.bind(backPort, function (err) { + console.log('bound', backPort); + }); +} + +createForwarderDevice(frontPort, backPort); + +createClient(frontPort); +createWorker(backPort); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/devices/queue.js b/tools/LiveTexturing/node_modules/zmq/examples/devices/queue.js new file mode 100644 index 00000000..2e536a5c --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/devices/queue.js @@ -0,0 +1,78 @@ +/* + * + * Queue device + * + */ + +var zmq = require('../../') + , frontPort = 'tcp://127.0.0.1:12345' + , backPort = 'tcp://127.0.0.1:12346'; + +function createClient (port) { + var socket = zmq.socket('req'); + + socket.identity = 'client' + process.pid; + + socket.on('message', function(data) { + console.log(socket.identity + ': answer data ' + data); + }); + + socket.connect(port); + console.log('client connected!'); + + setInterval(function() { + var value = Math.floor(Math.random()*100); + + console.log(socket.identity + ': asking ' + value); + socket.send(value); + }, 100); +}; + +function createServer (port) { + var socket = zmq.socket('rep'); + + socket.identity = 'server' + process.pid; + + socket.on('message', function(data) { + console.log(socket.identity + ': received ' + data.toString()); + socket.send(data * 2); + }); + + socket.connect(port, function(err) { + if (err) throw err; + console.log('server connected!'); + }); +}; + +function createQueueDevice(frontPort, backPort) { + var frontSocket = zmq.socket('router'), + backSocket = zmq.socket('dealer'); + + frontSocket.identity = 'router' + process.pid; + backSocket.identity = 'dealer' + process.pid; + + frontSocket.bind(frontPort, function (err) { + console.log('bound', frontPort); + }); + + frontSocket.on('message', function() { + //pass to back + console.log('router: sending to server', arguments[0].toString(), arguments[2].toString()); + backSocket.send(Array.prototype.slice.call(arguments)); + }); + + backSocket.bind(backPort, function (err) { + console.log('bound', backPort); + }); + + backSocket.on('message', function() { + //pass to front + console.log('dealer: sending to client', arguments[0].toString(), arguments[2].toString()); + frontSocket.send(Array.prototype.slice.call(arguments)); + }); +} + +createQueueDevice(frontPort, backPort); + +createClient(frontPort); +createServer(backPort); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/devices/streamer.js b/tools/LiveTexturing/node_modules/zmq/examples/devices/streamer.js new file mode 100644 index 00000000..5ad53f42 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/devices/streamer.js @@ -0,0 +1,67 @@ +/* + * + * Forwarder device + * + */ + +var zmq = require('../../') + , frontPort = 'tcp://127.0.0.1:12345' + , backPort = 'tcp://127.0.0.1:12346'; + +function createClient (port) { + var socket = zmq.socket('push'); + + socket.identity = 'client' + process.pid; + + socket.connect(port); + console.log('client connected!'); + + setInterval(function() { + var value = Math.floor(Math.random()*100); + + console.log(socket.identity + ': pushing ' + value); + socket.send(value); + }, 100); +}; + +function createWorker (port) { + var socket = zmq.socket('pull'); + + socket.identity = 'worker' + process.pid; + + socket.on('message', function(data) { + console.log(socket.identity + ': pulled ' + data.toString()); + }); + + socket.connect(port, function(err) { + if (err) throw err; + console.log('worker connected!'); + }); +}; + +function createStreamerDevice(frontPort, backPort) { + var frontSocket = zmq.socket('pull'), + backSocket = zmq.socket('push'); + + frontSocket.identity = 'sub' + process.pid; + backSocket.identity = 'pub' + process.pid; + + frontSocket.bind(frontPort, function (err) { + console.log('bound', frontPort); + }); + + frontSocket.on('message', function() { + //pass to back + console.log('forwarder: sending downstream', arguments[0].toString()); + backSocket.send(Array.prototype.slice.call(arguments)); + }); + + backSocket.bind(backPort, function (err) { + console.log('bound', backPort); + }); +} + +createStreamerDevice(frontPort, backPort); + +createClient(frontPort); +createWorker(backPort); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/pub_sub.js b/tools/LiveTexturing/node_modules/zmq/examples/pub_sub.js new file mode 100644 index 00000000..eb206ba4 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/pub_sub.js @@ -0,0 +1,55 @@ +/* + * + * Publisher subscriber pattern + * + */ + +var cluster = require('cluster') + , zmq = require('../') + , port = 'tcp://127.0.0.1:12345'; + +if (cluster.isMaster) { + for (var i = 0; i < 2; i++) cluster.fork(); + + cluster.on('death', function(worker) { + console.log('worker ' + worker.pid + ' died'); + }); + + //publisher = send only + + var socket = zmq.socket('pub'); + + socket.identity = 'publisher' + process.pid; + + var stocks = ['AAPL', 'GOOG', 'YHOO', 'MSFT', 'INTC']; + + socket.bind(port, function(err) { + if (err) throw err; + console.log('bound!'); + + setInterval(function() { + var symbol = stocks[Math.floor(Math.random()*stocks.length)] + , value = Math.random()*1000; + + console.log(socket.identity + ': sent ' + symbol + ' ' + value); + socket.send(symbol + ' ' + value); + }, 100); + }); +} else { + //subscriber = receive only + + var socket = zmq.socket('sub'); + + socket.identity = 'subscriber' + process.pid; + + socket.connect(port); + + socket.subscribe('AAPL'); + socket.subscribe('GOOG'); + + console.log('connected!'); + + socket.on('message', function(data) { + console.log(socket.identity + ': received data ' + data.toString()); + }); +} \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/push_pull.js b/tools/LiveTexturing/node_modules/zmq/examples/push_pull.js new file mode 100644 index 00000000..16a472ee --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/push_pull.js @@ -0,0 +1,48 @@ +/* + * + * Pipeline + * + */ + +var cluster = require('cluster') + , zmq = require('../') + , port = 'tcp://127.0.0.1:12345'; + +if (cluster.isMaster) { + for (var i = 0; i < 2; i++) cluster.fork(); + + cluster.on('death', function(worker) { + console.log('worker ' + worker.pid + ' died'); + }); + + //push = upstream + + var socket = zmq.socket('push'); + + socket.identity = 'upstream' + process.pid; + + socket.bind(port, function(err) { + if (err) throw err; + console.log('bound!'); + + setInterval(function() { + var date = new Date(); + + console.log(socket.identity + ': sending data ' + date.toString()); + socket.send(date.toString()); + }, 500); + }); +} else { + //pull = downstream + + var socket = zmq.socket('pull'); + + socket.identity = 'downstream' + process.pid; + + socket.connect(port); + console.log('connected!'); + + socket.on('message', function(data) { + console.log(socket.identity + ': received data ' + data.toString()); + }); +} \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/rep_req.js b/tools/LiveTexturing/node_modules/zmq/examples/rep_req.js new file mode 100644 index 00000000..fd1b310b --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/rep_req.js @@ -0,0 +1,53 @@ +/* + * + * One responseder two requesters + * + */ + +var cluster = require('cluster') + , zmq = require('../') + , port = 'tcp://127.0.0.1:12345'; + +if (cluster.isMaster) { + for (var i = 0; i < 2; i++) cluster.fork(); + + cluster.on('death', function(worker) { + console.log('worker ' + worker.pid + ' died'); + }); + + //responseder = server + + var socket = zmq.socket('rep'); + + socket.identity = 'server' + process.pid; + + socket.bind(port, function(err) { + if (err) throw err; + console.log('bound!'); + + socket.on('message', function(data) { + console.log(socket.identity + ': received ' + data.toString()); + socket.send(2 * data); + }); + }); +} else { + //requester = client + + var socket = zmq.socket('req'); + + socket.identity = 'client' + process.pid; + + socket.connect(port); + console.log('connected!'); + + setInterval(function() { + var value = Math.floor(Math.random()*100); + + socket.send(value); + console.log(socket.identity + ': asking ' + value); + }, 100); + + socket.on('message', function(data) { + console.log(socket.identity + ': answer data ' + data); + }); +} \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/req_rep.js b/tools/LiveTexturing/node_modules/zmq/examples/req_rep.js new file mode 100644 index 00000000..cb1fdc42 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/req_rep.js @@ -0,0 +1,57 @@ +/* + * + * One requester two responders (round robin) + * + */ + +var cluster = require('cluster') + , zeromq = require('../') + , port = 'tcp://127.0.0.1:12345'; + +if (cluster.isMaster) { + //Fork servers. + for (var i = 0; i < 2; i++) { + cluster.fork(); + } + + cluster.on('death', function(worker) { + console.log('worker ' + worker.pid + ' died'); + }); + + //requester = client + + var socket = zeromq.socket('req'); + + socket.identity = 'client' + process.pid; + + socket.bind(port, function(err) { + if (err) throw err; + console.log('bound!'); + + setInterval(function() { + var value = Math.floor(Math.random()*100); + + console.log(socket.identity + ': asking ' + value); + socket.send(value); + }, 100); + + + socket.on('message', function(data) { + console.log(socket.identity + ': answer data ' + data); + }); + }); +} else { + //responder = server + + var socket = zeromq.socket('rep'); + + socket.identity = 'server' + process.pid; + + socket.connect(port); + console.log('connected!'); + + socket.on('message', function(data) { + console.log(socket.identity + ': received ' + data.toString()); + socket.send(data * 2); + }); +} \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/router_dealer.js b/tools/LiveTexturing/node_modules/zmq/examples/router_dealer.js new file mode 100644 index 00000000..b1c33a3e --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/router_dealer.js @@ -0,0 +1,53 @@ +/* + * + * One server two clients + * + */ + +var cluster = require('cluster') + , zeromq = require('../') + , port = 'tcp://127.0.0.1:12345'; + +if (cluster.isMaster) { + for (var i = 0; i < 2; i++) cluster.fork(); + + cluster.on('death', function(worker) { + console.log('worker ' + worker.pid + ' died'); + }); + + //router = server + + var socket = zeromq.socket('router'); + + socket.identity = 'server' + process.pid; + + socket.bind(port, function(err) { + if (err) throw err; + console.log('bound!'); + + socket.on('message', function(envelope, data) { + console.log(socket.identity + ': received ' + envelope + ' - ' + data.toString()); + socket.send([envelope, data * 2]); + }); + }); +} else { + //dealer = client + + var socket = zeromq.socket('dealer'); + + socket.identity = 'client' + process.pid; + + socket.connect(port); + console.log('connected!'); + + setInterval(function() { + var value = Math.floor(Math.random()*100); + + socket.send(value); + console.log(socket.identity + ': asking ' + value); + }, 100); + + socket.on('message', function(data) { + console.log(socket.identity + ': answer data ' + data); + }); +} \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/rpc.js b/tools/LiveTexturing/node_modules/zmq/examples/rpc.js new file mode 100644 index 00000000..a320c763 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/rpc.js @@ -0,0 +1,17 @@ + +/** + * One server two clients + */ + +var cluster = require('cluster') + , zmq = require('../') + , port = 'tcp://127.0.0.1:12345'; + +if (cluster.isMaster) { + for (var i = 0; i < 2; i++) cluster.fork(); + + +} else { + var sock = zmq.socket('dealer'); + sock.connect(port); +} \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/examples/workers/producer.js b/tools/LiveTexturing/node_modules/zmq/examples/workers/producer.js new file mode 100644 index 00000000..97577156 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/workers/producer.js @@ -0,0 +1,11 @@ + +var zmq = require('../../') + , sock = zmq.socket('push'); + +sock.bindSync('tcp://127.0.0.1:3000'); +console.log('Producer bound to port 3000'); + +setInterval(function(){ + console.log('sending work'); + sock.send('some work'); +}, 500); diff --git a/tools/LiveTexturing/node_modules/zmq/examples/workers/worker.js b/tools/LiveTexturing/node_modules/zmq/examples/workers/worker.js new file mode 100644 index 00000000..ad879bd0 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/examples/workers/worker.js @@ -0,0 +1,10 @@ + +var zmq = require('../../') + , sock = zmq.socket('pull'); + +sock.connect('tcp://127.0.0.1:3000'); +console.log('Worker connected to port 3000'); + +sock.on('message', function(msg){ + console.log('work: %s', msg.toString()); +}); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/index.js b/tools/LiveTexturing/node_modules/zmq/index.js new file mode 100644 index 00000000..13a03e22 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib'); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/bindings/README.md b/tools/LiveTexturing/node_modules/zmq/node_modules/bindings/README.md new file mode 100644 index 00000000..585cf512 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/bindings/README.md @@ -0,0 +1,97 @@ +node-bindings +============= +### Helper module for loading your native module's .node file + +This is a helper module for authors of Node.js native addon modules. +It is basically the "swiss army knife" of `require()`ing your native module's +`.node` file. + +Throughout the course of Node's native addon history, addons have ended up being +compiled in a variety of different places, depending on which build tool and which +version of node was used. To make matters worse, now the _gyp_ build tool can +produce either a _Release_ or _Debug_ build, each being built into different +locations. + +This module checks _all_ the possible locations that a native addon would be built +at, and returns the first one that loads successfully. + + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install bindings +``` + +Or add it to the `"dependencies"` section of your _package.json_ file. + + +Example +------- + +`require()`ing the proper bindings file for the current node version, platform +and architecture is as simple as: + +``` js +var bindings = require('bindings')('binding.node') + +// Use your bindings defined in your C files +bindings.your_c_function() +``` + + +Nice Error Output +----------------- + +When the `.node` file could not be loaded, `node-bindings` throws an Error with +a nice error message telling you exactly what was tried. You can also check the +`err.tries` Array property. + +``` +Error: Could not load the bindings file. Tried: + → /Users/nrajlich/ref/build/binding.node + → /Users/nrajlich/ref/build/Debug/binding.node + → /Users/nrajlich/ref/build/Release/binding.node + → /Users/nrajlich/ref/out/Debug/binding.node + → /Users/nrajlich/ref/Debug/binding.node + → /Users/nrajlich/ref/out/Release/binding.node + → /Users/nrajlich/ref/Release/binding.node + → /Users/nrajlich/ref/build/default/binding.node + → /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node + at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13) + at Object. (/Users/nrajlich/ref/lib/ref.js:5:47) + at Module._compile (module.js:449:26) + at Object.Module._extensions..js (module.js:467:10) + at Module.load (module.js:356:32) + at Function.Module._load (module.js:312:12) + ... +``` + + +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. diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/bindings/bindings.js b/tools/LiveTexturing/node_modules/zmq/node_modules/bindings/bindings.js new file mode 100644 index 00000000..93dcf85a --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/bindings/bindings.js @@ -0,0 +1,166 @@ + +/** + * Module dependencies. + */ + +var fs = require('fs') + , path = require('path') + , join = path.join + , dirname = path.dirname + , exists = fs.existsSync || path.existsSync + , defaults = { + arrow: process.env.NODE_BINDINGS_ARROW || ' → ' + , compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' + , platform: process.platform + , arch: process.arch + , version: process.versions.node + , bindings: 'bindings.node' + , try: [ + // node-gyp's linked version in the "build" dir + [ 'module_root', 'build', 'bindings' ] + // node-waf and gyp_addon (a.k.a node-gyp) + , [ 'module_root', 'build', 'Debug', 'bindings' ] + , [ 'module_root', 'build', 'Release', 'bindings' ] + // Debug files, for development (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Debug', 'bindings' ] + , [ 'module_root', 'Debug', 'bindings' ] + // Release files, but manually compiled (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Release', 'bindings' ] + , [ 'module_root', 'Release', 'bindings' ] + // Legacy from node-waf, node <= 0.4.x + , [ 'module_root', 'build', 'default', 'bindings' ] + // Production "Release" buildtype binary (meh...) + , [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ] + ] + } + +/** + * The main `bindings()` function loads the compiled bindings for a given module. + * It uses V8's Error API to determine the parent filename that this function is + * being invoked from, which is then used to find the root directory. + */ + +function bindings (opts) { + + // Argument surgery + if (typeof opts == 'string') { + opts = { bindings: opts } + } else if (!opts) { + opts = {} + } + opts.__proto__ = defaults + + // Get the module root + if (!opts.module_root) { + opts.module_root = exports.getRoot(exports.getFileName()) + } + + // Ensure the given bindings name ends with .node + if (path.extname(opts.bindings) != '.node') { + opts.bindings += '.node' + } + + var tries = [] + , i = 0 + , l = opts.try.length + , n + , b + , err + + for (; i=1.2.1 <1.3.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "TooTallNate", + "email": "nathan@tootallnate.net" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11", + "tarball": "http://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/nan/.dntrc b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/.dntrc new file mode 100644 index 00000000..47971da6 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/.dntrc @@ -0,0 +1,30 @@ +## DNT config file +## see https://github.com/rvagg/dnt + +NODE_VERSIONS="\ + master \ + v0.11.13 \ + v0.10.30 \ + v0.10.29 \ + v0.10.28 \ + v0.10.26 \ + v0.10.25 \ + v0.10.24 \ + v0.10.23 \ + v0.10.22 \ + v0.10.21 \ + v0.10.20 \ + v0.10.19 \ + v0.8.28 \ + v0.8.27 \ + v0.8.26 \ + v0.8.24 \ +" +OUTPUT_PREFIX="nan-" +TEST_CMD=" \ + cd /dnt/ && \ + npm install && \ + node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild --directory test && \ + node_modules/.bin/tap --gc test/js/*-test.js \ +" + diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/nan/CHANGELOG.md b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/CHANGELOG.md new file mode 100644 index 00000000..457e7c44 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/CHANGELOG.md @@ -0,0 +1,374 @@ +# NAN ChangeLog + +**Version 2.0.9: current Node 4.0.0, Node 12: 0.12.7, Node 10: 0.10.40, iojs: 3.2.0** + +### 2.0.9 Sep 8 2015 + + - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7 + +### 2.0.8 Aug 28 2015 + + - Work around duplicate linking bug in clang 11902da + +### 2.0.7 Aug 26 2015 + + - Build: Repackage + +### 2.0.6 Aug 26 2015 + + - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1 + - Bugfix: Remove unused static std::map instances 525bddc + - Bugfix: Make better use of maybe versions of APIs bfba85b + - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d + +### 2.0.5 Aug 10 2015 + + - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1 + - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d + +### 2.0.4 Aug 6 2015 + + - Build: Repackage + +### 2.0.3 Aug 6 2015 + + - Bugfix: Don't use clang++ / g++ syntax extension. 231450e + +### 2.0.2 Aug 6 2015 + + - Build: Repackage + +### 2.0.1 Aug 6 2015 + + - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687 + - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601 + - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f + - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed + +### 2.0.0 Jul 31 2015 + + - Change: Renamed identifiers with leading underscores b5932b4 + - Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1 + - Change: Replace NanScope and NanEscpableScope macros with classes 47751c4 + - Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99 + - Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5 + - Change: Rename NanNewBuffer to NanCopyBuffer d6af78d + - Change: Remove Nan prefix from all names 72d1f67 + - Change: Update Buffer API for new upstream changes d5d3291 + - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a + - Change: Get rid of Handles e6c0daf + - Feature: Support io.js 3 with V8 4.4 + - Feature: Introduce NanPersistent 7fed696 + - Feature: Introduce NanGlobal 4408da1 + - Feature: Added NanTryCatch 10f1ca4 + - Feature: Update for V8 v4.3 4b6404a + - Feature: Introduce NanNewOneByteString c543d32 + - Feature: Introduce namespace Nan 67ed1b1 + - Removal: Remove NanLocker and NanUnlocker dd6e401 + - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9 + - Removal: Remove NanReturn* macros d90a25c + - Removal: Remove HasInstance e8f84fe + + +### 1.9.0 Jul 31 2015 + + - Feature: Added `NanFatalException` 81d4a2c + - Feature: Added more error types 4265f06 + - Feature: Added dereference and function call operators to NanCallback c4b2ed0 + - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c + - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6 + - Feature: Added NanErrnoException dd87d9e + - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130 + - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c + - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b + +### 1.8.4 Apr 26 2015 + + - Build: Repackage + +### 1.8.3 Apr 26 2015 + + - Bugfix: Include missing header 1af8648 + +### 1.8.2 Apr 23 2015 + + - Build: Repackage + +### 1.8.1 Apr 23 2015 + + - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3 + +### 1.8.0 Apr 23 2015 + + - Feature: Allow primitives with NanReturnValue 2e4475e + - Feature: Added comparison operators to NanCallback 55b075e + - Feature: Backport thread local storage 15bb7fa + - Removal: Remove support for signatures with arguments 8a2069d + - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59 + +### 1.7.0 Feb 28 2015 + + - Feature: Made NanCallback::Call accept optional target 8d54da7 + - Feature: Support atom-shell 0.21 0b7f1bb + +### 1.6.2 Feb 6 2015 + + - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 + +### 1.6.1 Jan 23 2015 + + - Build: version bump + +### 1.5.3 Jan 23 2015 + + - Build: repackage + +### 1.6.0 Jan 23 2015 + + - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af + - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 + - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 + +### 1.5.2 Jan 23 2015 + + - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 + - Bugfix: Readded missing String constructors 18d828f + - Bugfix: Add overload handling NanNew(..) 5ef813b + - Bugfix: Fix uv_work_cb versioning 997e4ae + - Bugfix: Add function factory and test 4eca89c + - Bugfix: Add object template factory and test cdcb951 + - Correctness: Lifted an io.js related typedef c9490be + - Correctness: Make explicit downcasts of String lengths 00074e6 + - Windows: Limit the scope of disabled warning C4530 83d7deb + +### 1.5.1 Jan 15 2015 + + - Build: version bump + +### 1.4.3 Jan 15 2015 + + - Build: version bump + +### 1.4.2 Jan 15 2015 + + - Feature: Support io.js 0dbc5e8 + +### 1.5.0 Jan 14 2015 + + - Feature: Support io.js b003843 + - Correctness: Improved NanNew internals 9cd4f6a + - Feature: Implement progress to NanAsyncWorker 8d6a160 + +### 1.4.1 Nov 8 2014 + + - Bugfix: Handle DEBUG definition correctly + - Bugfix: Accept int as Boolean + +### 1.4.0 Nov 1 2014 + + - Feature: Added NAN_GC_CALLBACK 6a5c245 + - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 + - Correctness: Added constness to references in NanHasInstance 02c61cd + - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 + - Windoze: Shut Visual Studio up when compiling 8d558c1 + - License: Switch to plain MIT from custom hacked MIT license 11de983 + - Build: Added test target to Makefile e232e46 + - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 + - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 + - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 + +### 1.3.0 Aug 2 2014 + + - Added NanNew(std::string) + - Added NanNew(std::string&) + - Added NanAsciiString helper class + - Added NanUtf8String helper class + - Added NanUcs2String helper class + - Deprecated NanRawString() + - Deprecated NanCString() + - Added NanGetIsolateData(v8::Isolate *isolate) + - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) + - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) + - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + +### 1.2.0 Jun 5 2014 + + - Add NanSetPrototypeTemplate + - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, + introduced _NanWeakCallbackDispatcher + - Removed -Wno-unused-local-typedefs from test builds + - Made test builds Windows compatible ('Sleep()') + +### 1.1.2 May 28 2014 + + - Release to fix more stuff-ups in 1.1.1 + +### 1.1.1 May 28 2014 + + - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 + +### 1.1.0 May 25 2014 + + - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead + - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), + (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, + v8::String::ExternalAsciiStringResource* + - Deprecate NanSymbol() + - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker + +### 1.0.0 May 4 2014 + + - Heavy API changes for V8 3.25 / Node 0.11.13 + - Use cpplint.py + - Removed NanInitPersistent + - Removed NanPersistentToLocal + - Removed NanFromV8String + - Removed NanMakeWeak + - Removed NanNewLocal + - Removed NAN_WEAK_CALLBACK_OBJECT + - Removed NAN_WEAK_CALLBACK_DATA + - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions + - Introduce NanUndefined, NanNull, NanTrue and NanFalse + - Introduce NanEscapableScope and NanEscapeScope + - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) + - Introduce NanMakeCallback for node::MakeCallback + - Introduce NanSetTemplate + - Introduce NanGetCurrentContext + - Introduce NanCompileScript and NanRunScript + - Introduce NanAdjustExternalMemory + - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback + - Introduce NanGetHeapStatistics + - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() + +### 0.8.0 Jan 9 2014 + + - NanDispose -> NanDisposePersistent, deprecate NanDispose + - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() + +### 0.7.1 Jan 9 2014 + + - Fixes to work against debug builds of Node + - Safer NanPersistentToLocal (avoid reinterpret_cast) + - Speed up common NanRawString case by only extracting flattened string when necessary + +### 0.7.0 Dec 17 2013 + + - New no-arg form of NanCallback() constructor. + - NanCallback#Call takes Handle rather than Local + - Removed deprecated NanCallback#Run method, use NanCallback#Call instead + - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS + - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() + - Introduce NanRawString() for char* (or appropriate void*) from v8::String + (replacement for NanFromV8String) + - Introduce NanCString() for null-terminated char* from v8::String + +### 0.6.0 Nov 21 2013 + + - Introduce NanNewLocal(v8::Handle value) for use in place of + v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 + +### 0.5.2 Nov 16 2013 + + - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public + +### 0.5.1 Nov 12 2013 + + - Use node::MakeCallback() instead of direct v8::Function::Call() + +### 0.5.0 Nov 11 2013 + + - Added @TooTallNate as collaborator + - New, much simpler, "include_dirs" for binding.gyp + - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros + +### 0.4.4 Nov 2 2013 + + - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ + +### 0.4.3 Nov 2 2013 + + - Include node_object_wrap.h, removed from node.h for Node 0.11.8. + +### 0.4.2 Nov 2 2013 + + - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for + Node 0.11.8 release. + +### 0.4.1 Sep 16 2013 + + - Added explicit `#include ` as it was removed from node.h for v0.11.8 + +### 0.4.0 Sep 2 2013 + + - Added NAN_INLINE and NAN_DEPRECATED and made use of them + - Added NanError, NanTypeError and NanRangeError + - Cleaned up code + +### 0.3.2 Aug 30 2013 + + - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent + in NanAsyncWorker + +### 0.3.1 Aug 20 2013 + + - fix "not all control paths return a value" compile warning on some platforms + +### 0.3.0 Aug 19 2013 + + - Made NAN work with NPM + - Lots of fixes to NanFromV8String, pulling in features from new Node core + - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API + - Added optional error number argument for NanThrowError() + - Added NanInitPersistent() + - Added NanReturnNull() and NanReturnEmptyString() + - Added NanLocker and NanUnlocker + - Added missing scopes + - Made sure to clear disposed Persistent handles + - Changed NanAsyncWorker to allocate error messages on the heap + - Changed NanThrowError(Local) to NanThrowError(Handle) + - Fixed leak in NanAsyncWorker when errmsg is used + +### 0.2.2 Aug 5 2013 + + - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() + +### 0.2.1 Aug 5 2013 + + - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for + NanFromV8String() + +### 0.2.0 Aug 5 2013 + + - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, + NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY + - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, + _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, + _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, + _NAN_PROPERTY_QUERY_ARGS + - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer + - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, + NAN_WEAK_CALLBACK_DATA, NanMakeWeak + - Renamed THROW_ERROR to _NAN_THROW_ERROR + - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) + - Added NanBufferUse(char*, uint32_t) + - Added NanNewContextHandle(v8::ExtensionConfiguration*, + v8::Handle, v8::Handle) + - Fixed broken NanCallback#GetFunction() + - Added optional encoding and size arguments to NanFromV8String() + - Added NanGetPointerSafe() and NanSetPointerSafe() + - Added initial test suite (to be expanded) + - Allow NanUInt32OptionValue to convert any Number object + +### 0.1.0 Jul 21 2013 + + - Added `NAN_GETTER`, `NAN_SETTER` + - Added `NanThrowError` with single Local argument + - Added `NanNewBufferHandle` with single uint32_t argument + - Added `NanHasInstance(Persistent&, Handle)` + - Added `Local NanCallback#GetFunction()` + - Added `NanCallback#Call(int, Local[])` + - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/nan/LICENSE.md b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/LICENSE.md new file mode 100644 index 00000000..77666cdf --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/LICENSE.md @@ -0,0 +1,13 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2015 NAN contributors +----------------------------------- + +*NAN contributors listed at * + +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. diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/nan/README.md b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/README.md new file mode 100644 index 00000000..db3daec9 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/README.md @@ -0,0 +1,367 @@ +Native Abstractions for Node.js +=============================== + +**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10 and 0.12 as well as io.js.** + +***Current version: 2.0.9*** + +*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)* + +[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/) + +[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](http://travis-ci.org/nodejs/nan) +[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan) + +Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle. + +This project also contains some helper utilities that make addon development a bit more pleasant. + + * **[News & Updates](#news)** + * **[Usage](#usage)** + * **[Example](#example)** + * **[API](#api)** + * **[Tests](#tests)** + * **[Governance & Contributing](#governance)** + + +## News & Updates + + +## Usage + +Simply add **NAN** as a dependency in the *package.json* of your Node addon: + +``` bash +$ npm install --save nan +``` + +Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include ` in your *.cpp* files: + +``` python +"include_dirs" : [ + "` when compiling your addon. + + +## Example + +Just getting started with Nan? Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality. + +For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**. + +For another example, see **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon. + + +## API + +Additional to the NAN documentation below, please consult: + +* [The V8 Getting Started Guide](https://developers.google.com/v8/get_started) +* [The V8 Embedders Guide](https://developers.google.com/v8/embed) +* [V8 API Documentation](http://v8docs.nodesource.com/) + + + +### JavaScript-accessible methods + +A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://developers.google.com/v8/embed#templates) for further information. + +In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. + +* **Method argument types** + - Nan::FunctionCallbackInfo + - Nan::PropertyCallbackInfo + - Nan::ReturnValue +* **Method declarations** + - Method declaration + - Getter declaration + - Setter declaration + - Property getter declaration + - Property setter declaration + - Property enumerator declaration + - Property deleter declaration + - Property query declaration + - Index getter declaration + - Index setter declaration + - Index enumerator declaration + - Index deleter declaration + - Index query declaration +* Method and template helpers + - Nan::SetMethod() + - Nan::SetNamedPropertyHandler() + - Nan::SetIndexedPropertyHandler() + - Nan::SetPrototypeMethod() + - Nan::SetTemplate() + - Nan::SetPrototypeTemplate() + - Nan::SetInstanceTemplate() + +### Scopes + +A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. + +A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. + +The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. + + - Nan::HandleScope + - Nan::EscapableHandleScope + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). + +### Persistent references + +An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. + +Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. + + - Nan::PersistentBase & v8::PersistentBase + - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits + - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits + - Nan::Persistent + - Nan::Global + - Nan::WeakCallbackInfo + - Nan::WeakCallbackType + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). + +### New + +NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. + + - Nan::New() + - Nan::Undefined() + - Nan::Null() + - Nan::True() + - Nan::False() + - Nan::EmptyString() + + +### Converters + +NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. + + - Nan::To() + +### Maybe Types + +The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. + +* **Maybe Types** + - Nan::MaybeLocal + - Nan::Maybe + - Nan::Nothing + - Nan::Just +* **Maybe Helpers** + - Nan::ToDetailString() + - Nan::ToArrayIndex() + - Nan::Equals() + - Nan::NewInstance() + - Nan::GetFunction() + - Nan::Set() + - Nan::ForceSet() + - Nan::Get() + - Nan::GetPropertyAttributes() + - Nan::Has() + - Nan::Delete() + - Nan::GetPropertyNames() + - Nan::GetOwnPropertyNames() + - Nan::SetPrototype() + - Nan::ObjectProtoToString() + - Nan::HasOwnProperty() + - Nan::HasRealNamedProperty() + - Nan::HasRealIndexedProperty() + - Nan::HasRealNamedCallbackProperty() + - Nan::GetRealNamedPropertyInPrototypeChain() + - Nan::GetRealNamedProperty() + - Nan::CallAsFunction() + - Nan::CallAsConstructor() + - Nan::GetSourceLine() + - Nan::GetLineNumber() + - Nan::GetStartColumn() + - Nan::GetEndColumn() + - Nan::CloneElementAt() + +### Script + +NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. + + - Nan::CompileScript() + - Nan::RunScript() + + +### Errors + +NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. + +Note that an Error object is simply a specialized form of `v8::Value`. + +Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. + + - Nan::Error() + - Nan::RangeError() + - Nan::ReferenceError() + - Nan::SyntaxError() + - Nan::TypeError() + - Nan::ThrowError() + - Nan::ThrowRangeError() + - Nan::ThrowReferenceError() + - Nan::ThrowSyntaxError() + - Nan::ThrowTypeError() + - Nan::FatalException() + - Nan::ErrnoException() + - Nan::TryCatch + + +### Buffers + +NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. + + - Nan::NewBuffer() + - Nan::CopyBuffer() + - Nan::FreeCallback() + +### Nan::Callback + +`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. + + - Nan::Callback + +### Asynchronous work helpers + +`Nan::AsyncWorker` and `Nan::AsyncProgressWorker` are helper classes that make working with asynchronous code easier. + + - Nan::AsyncWorker + - Nan::AsyncProgressWorker + - Nan::AsyncQueueWorker + +### Strings & Bytes + +Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. + + - Nan::Encoding + - Nan::Encode() + - Nan::DecodeBytes() + - Nan::DecodeWrite() + + +### V8 internals + +The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. + + - NAN_GC_CALLBACK() + - Nan::AddGCEpilogueCallback() + - Nan::RemoveGCEpilogueCallback() + - Nan::AddGCPrologueCallback() + - Nan::RemoveGCPrologueCallback() + - Nan::GetHeapStatistics() + - Nan::SetCounterFunction() + - Nan::SetCreateHistogramFunction() + - Nan::SetAddHistogramSampleFunction() + - Nan::IdleNotification() + - Nan::LowMemoryNotification() + - Nan::ContextDisposedNotification() + - Nan::GetInternalFieldPointer() + - Nan::SetInternalFieldPointer() + - Nan::AdjustExternalMemory() + + +### Miscellaneous V8 Helpers + + - Nan::Utf8String + - Nan::GetCurrentContext() + - Nan::SetIsolateData() + - Nan::GetIsolateData() + + +### Miscellaneous Node Helpers + + - Nan::MakeCallback() + - Nan::ObjectWrap + - NAN_MODULE_INIT() + - Nan::Export() + + + + + +### Tests + +To run the NAN tests do: + +``` sh +npm install +npm run-script rebuild-tests +npm test +``` + +Or just: + +``` sh +npm install +make test +``` + + +## Governance & Contributing + +NAN is governed by the [io.js](https://iojs.org/) Addon API Working Group + +### Addon API Working Group (WG) + +The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project. + +Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other io.js projects. + +The WG has final authority over this project including: + +* Technical direction +* Project governance and process (including this policy) +* Contribution policy +* GitHub repository hosting +* Maintaining the list of additional Collaborators + +For the current list of WG members, see the project [README.md](./README.md#collaborators). + +Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote. + +_Note:_ If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly. + +For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators). + +### Consensus Seeking Process + +The WG follows a [Consensus Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) decision making model. + +Modifications of the contents of the NAN repository are made on a collaborative basis. Anybody with a GitHub account may propose a modification via pull request and it will be considered by the WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification. + +If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins. + +### Developer's Certificate of Origin 1.0 + +By making a contribution to this project, I certify that: + +* (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or +* (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or +* (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. + + +### WG Members / Collaborators + + + + + + + + + +
Rod VaggGitHub/rvaggTwitter/@rvagg
Benjamin ByholmGitHub/kkoopa-
Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
Nathan RajlichGitHub/TooTallNateTwitter/@TooTallNate
Brett LawsonGitHub/brett19Twitter/@brett19x
Ben NoordhuisGitHub/bnoordhuisTwitter/@bnoordhuis
David SiegelGitHub/agnat-
+ +## Licence & copyright + +Copyright (c) 2015 NAN WG Members / Collaborators (listed above). + +Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/nan/appveyor.yml b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/appveyor.yml new file mode 100644 index 00000000..1378d310 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/appveyor.yml @@ -0,0 +1,38 @@ +# http://www.appveyor.com/docs/appveyor-yml + +# Test against these versions of Io.js and Node.js. +environment: + matrix: + # node.js + - nodejs_version: "0.8" + - nodejs_version: "0.10" + - nodejs_version: "0.12" + # io.js + - nodejs_version: "1" + - nodejs_version: "2" + - nodejs_version: "3" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node 0.STABLE.latest + - ps: if($env:nodejs_version -eq "0.8") {Install-Product node $env:nodejs_version} + - ps: if($env:nodejs_version -ne "0.8") {Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)} + - IF %nodejs_version% LSS 1 npm -g install npm + - IF %nodejs_version% LSS 1 set PATH=%APPDATA%\npm;%PATH% + # Typical npm stuff. + - npm install + - IF %nodejs_version% EQU 0.8 (node node_modules\node-gyp\bin\node-gyp.js rebuild --msvs_version=2013 --directory test) ELSE (npm run rebuild-tests) + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - IF %nodejs_version% LSS 1 (npm test) ELSE (iojs node_modules\tap\bin\tap.js --gc test/js/*-test.js) + +# Don't actually build. +build: off + +# Set build version format here instead of in the admin panel. +version: "{build}" diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/nan/doc/.build.sh b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/doc/.build.sh new file mode 100644 index 00000000..75a975af --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/doc/.build.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +files=" \ + methods.md \ + scopes.md \ + persistent.md \ + new.md \ + converters.md \ + maybe_types.md \ + script.md \ + errors.md \ + buffers.md \ + callback.md \ + asyncworker.md \ + string_bytes.md \ + v8_internals.md \ + v8_misc.md \ + node_misc.md \ +" + +__dirname=$(dirname "${BASH_SOURCE[0]}") +head=$(perl -e 'while (<>) { if (!$en){print;} if ($_=~/ NanNew("foo").ToLocalChecked() */ + if (arguments[groups[3][0]] === 'NanNew') { + return [arguments[0], '.ToLocalChecked()'].join(''); + } + + /* insert warning for removed functions as comment on new line above */ + switch (arguments[groups[4][0]]) { + case 'GetIndexedPropertiesExternalArrayData': + case 'GetIndexedPropertiesExternalArrayDataLength': + case 'GetIndexedPropertiesExternalArrayDataType': + case 'GetIndexedPropertiesPixelData': + case 'GetIndexedPropertiesPixelDataLength': + case 'HasIndexedPropertiesInExternalArrayData': + case 'HasIndexedPropertiesInPixelData': + case 'SetIndexedPropertiesToExternalArrayData': + case 'SetIndexedPropertiesToPixelData': + return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join(''); + default: + } + + /* remove unnecessary NanScope() */ + switch (arguments[groups[5][0]]) { + case 'NAN_GETTER': + case 'NAN_METHOD': + case 'NAN_SETTER': + case 'NAN_INDEX_DELETER': + case 'NAN_INDEX_ENUMERATOR': + case 'NAN_INDEX_GETTER': + case 'NAN_INDEX_QUERY': + case 'NAN_INDEX_SETTER': + case 'NAN_PROPERTY_DELETER': + case 'NAN_PROPERTY_ENUMERATOR': + case 'NAN_PROPERTY_GETTER': + case 'NAN_PROPERTY_QUERY': + case 'NAN_PROPERTY_SETTER': + return arguments[groups[5][0] - 1]; + default: + } + + /* Value converstion */ + switch (arguments[groups[6][0]]) { + case 'Boolean': + case 'Int32': + case 'Integer': + case 'Number': + case 'Object': + case 'String': + case 'Uint32': + return [arguments[groups[6][0] - 2], 'NanTo(', arguments[groups[6][0] - 1]].join(''); + default: + } + + /* other value conversion */ + switch (arguments[groups[7][0]]) { + case 'BooleanValue': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'Int32Value': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'IntegerValue': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'Uint32Value': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + default: + } + + /* NAN_WEAK_CALLBACK */ + if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') { + return ['template\nvoid ', + arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo &data)'].join(''); + } + + /* use methods on NAN classes instead */ + switch (arguments[groups[9][0]]) { + case 'NanDisposePersistent': + return [arguments[groups[9][0] + 1], '.Reset('].join(''); + case 'NanObjectWrapHandle': + return [arguments[groups[9][0] + 1], '->handle('].join(''); + default: + } + + /* use method on NanPersistent instead */ + if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') { + return arguments[groups[10][0] + 1] + '.SetWeak('; + } + + /* These return Maybes, the upper ones take no arguments */ + switch (arguments[groups[11][0]]) { + case 'GetEndColumn': + case 'GetFunction': + case 'GetLineNumber': + case 'GetOwnPropertyNames': + case 'GetPropertyNames': + case 'GetSourceLine': + case 'GetStartColumn': + case 'NewInstance': + case 'ObjectProtoToString': + case 'ToArrayIndex': + case 'ToDetailString': + return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join(''); + case 'CallAsConstructor': + case 'CallAsFunction': + case 'CloneElementAt': + case 'Delete': + case 'ForceSet': + case 'Get': + case 'GetPropertyAttributes': + case 'GetRealNamedProperty': + case 'GetRealNamedPropertyInPrototypeChain': + case 'Has': + case 'HasOwnProperty': + case 'HasRealIndexedProperty': + case 'HasRealNamedCallbackProperty': + case 'HasRealNamedProperty': + case 'Set': + case 'SetAccessor': + case 'SetIndexedPropertyHandler': + case 'SetNamedPropertyHandler': + case 'SetPrototype': + return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join(''); + default: + } + + /* Automatic ToLocalChecked(), take it or leave it */ + switch (arguments[groups[12][0]]) { + case 'Date': + case 'String': + case 'RegExp': + return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join(''); + default: + } + + /* NanEquals is now required for uniformity */ + if (arguments[groups[13][0]] === 'Equals') { + return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join(''); + } + + /* use method on replacement class instead */ + if (arguments[groups[14][0]] === 'NanAssignPersistent') { + return [arguments[groups[14][0] + 1], '.Reset('].join(''); + } + + /* args --> info */ + if (arguments[groups[15][0]] === 'args') { + return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join(''); + } + + /* ObjectWrap --> NanObjectWrap */ + if (arguments[groups[16][0]] === 'ObjectWrap') { + return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join(''); + } + + /* Persistent --> NanPersistent */ + if (arguments[groups[17][0]] === 'Persistent') { + return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join(''); + } + + /* This should not happen. A switch is probably missing a case if it does. */ + throw 'Unhandled match: ' + arguments[0]; +} + +/* reads a file, runs replacement and writes it back */ +function processFile(file) { + fs.readFile(file, {encoding: 'utf8'}, function (err, data) { + if (err) { + throw err; + } + + /* run replacement twice, might need more runs */ + fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) { + if (err) { + throw err; + } + }); + }); +} + +/* process file names from command line and process the identified files */ +for (i = 2, length = process.argv.length; i < length; i++) { + glob(process.argv[i], function (err, matches) { + if (err) { + throw err; + } + matches.forEach(processFile); + }); +} diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/nan/tools/README.md b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/tools/README.md new file mode 100644 index 00000000..7f07e4b8 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/tools/README.md @@ -0,0 +1,14 @@ +1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, +false positives and missed opportunities. The input files are rewritten in place. Make sure that +you have backups. You will have to manually review the changes afterwards and do some touchups. + +```sh +$ tools/1to2.js + + Usage: 1to2 [options] + + Options: + + -h, --help output usage information + -V, --version output the version number +``` diff --git a/tools/LiveTexturing/node_modules/zmq/node_modules/nan/tools/package.json b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/tools/package.json new file mode 100644 index 00000000..2dcdd789 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/node_modules/nan/tools/package.json @@ -0,0 +1,19 @@ +{ + "name": "1to2", + "version": "1.0.0", + "description": "NAN 1 -> 2 Migration Script", + "main": "1to2.js", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/nan.git" + }, + "contributors": [ + "Benjamin Byholm (https://github.com/kkoopa/)", + "Mathias Küsel (https://github.com/mathiask88/)" + ], + "dependencies": { + "glob": "~5.0.10", + "commander": "~2.8.1" + }, + "license": "MIT" +} diff --git a/tools/LiveTexturing/node_modules/zmq/package.json b/tools/LiveTexturing/node_modules/zmq/package.json new file mode 100644 index 00000000..740e8f3d --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/package.json @@ -0,0 +1,230 @@ +{ + "_args": [ + [ + "zmq", + "C:\\Users\\kamisama\\Downloads\\plugins\\LiveTexturing" + ] + ], + "_from": "zmq@*", + "_id": "zmq@2.14.0", + "_inCache": true, + "_installable": true, + "_location": "/zmq", + "_npmUser": { + "email": "ron@ronkorving.nl", + "name": "ronkorving" + }, + "_npmVersion": "1.4.28", + "_phantomChildren": {}, + "_requested": { + "name": "zmq", + "raw": "zmq", + "rawSpec": "", + "scope": null, + "spec": "*", + "type": "range" + }, + "_requiredBy": [ + "#USER" + ], + "_resolved": "https://registry.npmjs.org/zmq/-/zmq-2.14.0.tgz", + "_shasum": "86e7ba8814363c98655553325d214daaa52fc8a4", + "_shrinkwrap": null, + "_spec": "zmq", + "_where": "C:\\Users\\kamisama\\Downloads\\plugins\\LiveTexturing", + "author": { + "email": "justin.tulloss@gmail.com", + "name": "Justin Tulloss", + "url": "http://justin.harmonize.fm" + }, + "bugs": { + "url": "https://github.com/JustinTulloss/zeromq.node/issues" + }, + "contributors": [ + { + "name": "Alexander Simmerl", + "url": "https://github.com/xla" + }, + { + "name": "Justin Tulloss", + "email": "justin.tulloss@gmail.com", + "url": "http://justin.harmonize.fm" + }, + { + "name": "Mike Castleman", + "email": "m@mlcastle.net", + "url": "http://mlcastle.net/" + }, + { + "name": "Matt Crocker" + }, + { + "name": "Jeremy Barnes", + "email": "jeremy@barneso.com", + "url": "http://www.barneso.com/" + }, + { + "name": "Rick", + "email": "technoweenie@gmail.com", + "url": "http://techno-weenie.net/" + }, + { + "name": "Corey Jewett", + "url": "http://syntheticplayground.com/" + }, + { + "name": "Micheil Smith", + "email": "micheil@brandedcode.com", + "url": "http://brandedcode.com/" + }, + { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca", + "url": "http://tjholowaychuk.com/" + }, + { + "name": "Ron Korving", + "url": "https://github.com/ronkorving" + }, + { + "name": "Mark Everitt", + "url": "http://qubyte.dyndns.org/" + }, + { + "name": "Aldis Andrejevs", + "url": "https://github.com/aaudis" + }, + { + "name": "Iskren Ivov Chernev", + "email": "iskren.chernev@gmail.com" + }, + { + "name": "Seth Fitzsimmons" + }, + { + "name": "Patrick Lucas" + }, + { + "name": "Stéphan Kochen", + "email": "stephan@kochen.nl", + "url": "http://stephan.kochen.nl/" + }, + { + "name": "Ian Babrou" + }, + { + "name": "Niall O'Higgins" + }, + { + "name": "Brian White", + "url": "https://github.com/mscdex" + }, + { + "name": "Mathieu D'Amours", + "url": "https://github.com/matehat" + }, + { + "name": "Joshua Gourneau" + }, + { + "name": "Yaroslav Shirokov" + }, + { + "name": "Marc Harter", + "url": "https://github.com/wavded" + }, + { + "name": "John Sun", + "url": "https://github.com/freehaha" + }, + { + "name": "Alexey Kupershtokh", + "email": "alexey.kupershtokh@gmail.com" + }, + { + "name": "Jon Gretar Borgthorsson", + "url": "https://github.com/JonGretar" + }, + { + "name": "Brian Lalor", + "url": "https://github.com/blalor" + }, + { + "name": "Benjamin Byholm", + "url": "https://github.com/kkoopa" + }, + { + "name": "Alejandro", + "url": "https://github.com/Minjung" + }, + { + "name": "Eli Skeggs", + "email": "skeggse@gmail.com", + "url": "https://github.com/skeggse" + }, + { + "name": "Bent Cardan", + "email": "bent@nothingsatisfies.com", + "url": "https://github.com/reqshark" + } + ], + "dependencies": { + "bindings": "~1.2.1", + "nan": "~2.0.0" + }, + "description": "Bindings for node.js and io.js to ZeroMQ", + "devDependencies": { + "mocha": "~1.13.0", + "semver": "~4.1.1", + "should": "2.1.x" + }, + "directories": {}, + "dist": { + "shasum": "86e7ba8814363c98655553325d214daaa52fc8a4", + "tarball": "http://registry.npmjs.org/zmq/-/zmq-2.14.0.tgz" + }, + "engines": { + "node": ">=0.8" + }, + "gitHead": "59338450cc2e20d442b4a282e9a53b8a5f3152b7", + "gypfile": true, + "homepage": "https://github.com/JustinTulloss/zeromq.node", + "keywords": [ + "0mq", + "addon", + "binding", + "libzmq", + "native", + "zeromq", + "zmq", + "ømq" + ], + "license": "MIT", + "main": "index", + "maintainers": [ + { + "name": "justin", + "email": "justin.tulloss@gmail.com" + }, + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "ronkorving", + "email": "ron@ronkorving.nl" + } + ], + "name": "zmq", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/JustinTulloss/zeromq.node.git" + }, + "scripts": { + "install": "node-gyp rebuild", + "test": "mocha --expose-gc --slow 2000 --timeout 600000" + }, + "version": "2.14.0" +} diff --git a/tools/LiveTexturing/node_modules/zmq/perf/local_lat.js b/tools/LiveTexturing/node_modules/zmq/perf/local_lat.js new file mode 100644 index 00000000..7ea5598a --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/perf/local_lat.js @@ -0,0 +1,25 @@ +var zmq = require('../'); +var assert = require('assert'); + +if (process.argv.length != 5) { + console.log('usage: local_lat '); + process.exit(1); +} + +var bind_to = process.argv[2]; +var message_size = Number(process.argv[3]); +var roundtrip_count = Number(process.argv[4]); +var counter = 0; + +var rep = zmq.socket('rep'); +rep.bindSync(bind_to); + +rep.on('message', function (data) { + assert.equal(data.length, message_size, 'message-size did not match'); + rep.send(data); + if (++counter === roundtrip_count){ + setTimeout( function(){ + rep.close(); + }, 1000); + } +}) diff --git a/tools/LiveTexturing/node_modules/zmq/perf/local_thr.js b/tools/LiveTexturing/node_modules/zmq/perf/local_thr.js new file mode 100644 index 00000000..2b7fce69 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/perf/local_thr.js @@ -0,0 +1,41 @@ +var zmq = require('../'); +var assert = require('assert'); + +if (process.argv.length != 5) { + console.log('usage: local_thr '); + process.exit(1); +} + +var bind_to = process.argv[2]; +var message_size = Number(process.argv[3]); +var message_count = Number(process.argv[4]); +var counter = 0; + +var sock = zmq.socket('pull'); +sock.bindSync(bind_to); + +var timer; + +sock.on('message', function (data) { + if (!timer) { + console.log('started receiving'); + timer = process.hrtime(); + } + + assert.equal(data.length, message_size, 'message-size did not match'); + if (++counter === message_count) finish(); +}) + +function finish(){ + var endtime = process.hrtime(timer); + var sec = endtime[0] + (endtime[1]/1000000000); + var throughput = message_count / sec; + var megabits = (throughput * message_size * 8) / 1000000; + + console.log('message size: %d [B]', message_size); + console.log('message count: %d', message_count); + console.log('mean throughput: %d [msg/s]', throughput.toFixed(0)); + console.log('mean throughput: %d [Mbit/s]', megabits.toFixed(0)); + console.log('overall time: %d secs and %d nanoseconds', endtime[0], endtime[1]); + sock.close(); +} diff --git a/tools/LiveTexturing/node_modules/zmq/perf/remote_lat.js b/tools/LiveTexturing/node_modules/zmq/perf/remote_lat.js new file mode 100644 index 00000000..18baf220 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/perf/remote_lat.js @@ -0,0 +1,52 @@ +var zmq = require('../'); +var assert = require('assert'); + +if (process.argv.length != 5) { + console.log('usage: remote_lat '); + process.exit(1); +} + +var connect_to = process.argv[2]; +var message_size = Number(process.argv[3]); +var roundtrip_count = Number(process.argv[4]); +var message = new Buffer(message_size); +message.fill('h'); + +var recvCounter = 0; + +var req = zmq.socket('req'); +req.connect(connect_to); + +var timer; + +req.on('message', function (data) { + if (!timer) { + console.log('started receiving'); + timer = process.hrtime(); + } + + assert.equal(data.length, message_size, 'message-size did not match'); + + if (++recvCounter === roundtrip_count) { + finish(); + } else { + send(); + } +}); + +function finish() { + var duration = process.hrtime(timer); + var millis = duration[0] * 1000 + duration[1] / 1000000; + + console.log('message size: %d [B]', message_size); + console.log('roundtrip count: %d', roundtrip_count); + console.log('mean latency: %d [msecs]', millis / (roundtrip_count * 2)); + console.log('overall time: %d secs and %d nanoseconds', duration[0], duration[1]); + req.close() +} + +function send() { + req.send(message); +} + +send() diff --git a/tools/LiveTexturing/node_modules/zmq/perf/remote_thr.js b/tools/LiveTexturing/node_modules/zmq/perf/remote_thr.js new file mode 100644 index 00000000..b44fe5f2 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/perf/remote_thr.js @@ -0,0 +1,37 @@ +var zmq = require('../') +var assert = require('assert') + +if (process.argv.length != 5) { + console.log('usage: remote_thr ') + process.exit(1) +} + +var connect_to = process.argv[2] +var message_size = Number(process.argv[3]) +var message_count = Number(process.argv[4]) +var message = new Buffer(message_size) +message.fill('h') + +var counter = 0 + +var sock = zmq.socket('push') +//sock.setsockopt(zmq.ZMQ_SNDHWM, message_count); +sock.connect(connect_to) + +function send(){ + for (var i = 0; i < message_count; i++) { + sock.send(message) + } + + // all messages may not be received by local_thr if closed immediately + setTimeout(function () { + sock.close() + }, 1000); +} + +// because of what seems to be a bug in node-zmq, we would lose messages +// if we start sending immediately after calling connect(), so to make this +// benchmark behave well, we wait a bit... + +setTimeout(send, 1000); + diff --git a/tools/LiveTexturing/node_modules/zmq/test/context.js b/tools/LiveTexturing/node_modules/zmq/test/context.js new file mode 100644 index 00000000..09eda651 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/context.js @@ -0,0 +1,32 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver') + +describe('context', function() { + + it('should support setting max io threads', function(done) { + // 3.2 and above. + if (!semver.gte(zmq.version, '3.2.0')) { + done(); + return console.warn('Test requires libzmq >= 3.2.0'); + } + zmq.Context.setMaxThreads(3); + zmq.Context.getMaxThreads().should.equal(3); + zmq.Context.setMaxThreads(1); + done(); + }); + + it('should support setting max number of sockets', function(done) { + // 3.2 and above. + if (!semver.gte(zmq.version, '3.2.0')) { + done(); + return console.warn('Test requires libzmq >= 3.2.0'); + } + var currMaxSockets = zmq.Context.getMaxSockets(); + zmq.Context.setMaxSockets(256); + zmq.Context.getMaxSockets().should.equal(256); + zmq.Context.setMaxSockets(currMaxSockets); + done(); + }); + +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/exports.js b/tools/LiveTexturing/node_modules/zmq/test/exports.js new file mode 100644 index 00000000..03beb17a --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/exports.js @@ -0,0 +1,132 @@ + +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('exports', function(){ + it('should export a valid version', function(){ + semver.valid(zmq.version).should.be.ok; + }); + + it('should generate valid curve keypair', function(done) { + if (!semver.gte(zmq.version,'4.0.0') || require('os').platform() == 'win32'){ + done(); + return console.warn('Test requires libzmq >= 4 compiled with libsodium'); + } + var curve = zmq.curveKeypair(); + should.exist(curve); + should.exist(curve.public); + should.exist(curve.secret); + curve.public.length.should.equal(40); + curve.secret.length.should.equal(40); + done(); + }); + + it('should export socket types and options', function(){ + // All versions. + var constants = [ + 'PUB', + 'SUB', + 'REQ', + 'XREQ', + 'REP', + 'XREP', + 'DEALER', + 'ROUTER', + 'PUSH', + 'PULL', + 'PAIR', + 'AFFINITY', + 'IDENTITY', + 'SUBSCRIBE', + 'UNSUBSCRIBE', + 'RCVTIMEO', + 'SNDTIMEO', + 'RATE', + 'RECOVERY_IVL', + 'SNDBUF', + 'RCVBUF', + 'RCVMORE', + 'FD', + 'EVENTS', + 'TYPE', + 'LINGER', + 'RECONNECT_IVL', + 'RECONNECT_IVL_MAX', + 'BACKLOG', + 'POLLIN', + 'POLLOUT', + 'POLLERR', + 'SNDMORE' + ]; + + // 2.x only. + if (semver.satisfies(zmq.version, '2.x')) { + constants.concat([ + 'HWM', + 'SWAP', + 'MCAST_LOOP', + 'ZMQ_RECOVERY_IVL_MSEC', + 'NOBLOCK' + ]); + } + + // 3.0 and above. + if (semver.gte(zmq.version, '3.0.0')) { + constants.concat([ + 'XPUB', + 'XSUB', + 'SNDHWM', + 'RCVHWM', + 'MAXMSGSIZE', + 'ZMQ_MULTICAST_HOPS', + 'TCP_KEEPALIVE', + 'TCP_KEEPALIVE_CNT', + 'TCP_KEEPALIVE_IDLE', + 'TCP_KEEPALIVE_INTVL' + ]); + } + + // 3.2 and above. + if (semver.gte(zmq.version, '3.2.0')) { + constants.concat([ + 'IPV4ONLY', + 'DELAY_ATTACH_ON_CONNECT', + 'ROUTER_MANDATORY', + 'XPUB_VERBOSE', + 'TCP_KEEPALIVE', + 'TCP_KEEPALIVE_IDLE', + 'TCP_KEEPALIVE_CNT', + 'TCP_KEEPALIVE_INTVL', + 'TCP_ACCEPT_FILTER', + 'LAST_ENDPOINT' + ]); + } + + // 3.3 and above. + if (semver.gte(zmq.version, '3.3.0')) { + constants.concat([ + 'ROUTER_RAW' + ]); + } + + constants.forEach(function(typeOrProp){ + zmq['ZMQ_' + typeOrProp].should.be.a.Number; + }); + }); + + it('should export states', function(){ + ['STATE_READY', 'STATE_BUSY', 'STATE_CLOSED'].forEach(function(state){ + zmq[state].should.be.a.Number; + }); + }); + + it('should export constructors', function(){ + zmq.Context.should.be.a.Function; + zmq.Socket.should.be.a.Function; + }); + + it('should export methods', function(){ + zmq.socket.should.be.a.Function; + }); +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/gc.js b/tools/LiveTexturing/node_modules/zmq/test/gc.js new file mode 100644 index 00000000..0b2e94c9 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/gc.js @@ -0,0 +1,52 @@ + +var zmq = require('..') + , should = require('should'); + +it('should cooperate with gc', function(done){ + var a = zmq.socket('dealer') + , b = zmq.socket('dealer'); + + /** + * We create 2 dealer sockets. + * One of them (`a`) is not referenced explicitly after the main loop + * finishes so it's a pretender for garbage collection. + * This test performs gc() explicitly and then tries to send a message + * to a dealer socket that could be destroyed and collected. + * If a message is delivered, than everything is ok. Otherwise the guard + * timeout will make the test fail. + */ + a.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('hello'); + this.close(); + b.close(); + clearTimeout(timeout); + done(); + }); + + var bound = false; + + a.bind('tcp://127.0.0.1:5555', function(e){ + if (e) { + clearInterval(interval); + done(e); + } else { + bound = true; + } + }); + + var interval = setInterval(function(){ + gc(); + if (bound) { + clearInterval(interval); + b.connect('tcp://127.0.0.1:5555'); + b.send('hello'); + } + }, 100); + + // guard against hanging + var timeout = setTimeout(function(){ + clearInterval(interval); + done(new Error('timeout of 5000ms exceeded (bound: ' + bound + ')')); + }, 15000); +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/mocha.opts b/tools/LiveTexturing/node_modules/zmq/test/mocha.opts new file mode 100644 index 00000000..5ada47be --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/mocha.opts @@ -0,0 +1 @@ +--reporter spec diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.events.js b/tools/LiveTexturing/node_modules/zmq/test/socket.events.js new file mode 100644 index 00000000..c6e80eb5 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.events.js @@ -0,0 +1,31 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.events', function(){ + + it('should support events', function(done){ + var rep = zmq.socket('rep') + , req = zmq.socket('req'); + + rep.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('hello'); + rep.send('world'); + }); + + rep.bind('inproc://stuff'); + + rep.on('bind', function(){ + req.connect('inproc://stuff'); + req.send('hello'); + req.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('world'); + req.close(); + rep.close(); + done(); + }); + }); + }); +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.js b/tools/LiveTexturing/node_modules/zmq/test/socket.js new file mode 100644 index 00000000..c583b869 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.js @@ -0,0 +1,60 @@ + +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket', function(){ + var sock; + + it('should alias socket', function(){ + zmq.createSocket.should.equal(zmq.socket); + }); + + it('should include type and close', function(){ + sock = zmq.socket('req'); + sock.type.should.equal('req'); + sock.close.should.be.a.Function; + }); + + it('should use socketopt', function(){ + sock.getsockopt(zmq.ZMQ_BACKLOG).should.not.equal(75); + sock.setsockopt(zmq.ZMQ_BACKLOG, 75).should.equal(sock); + sock.getsockopt(zmq.ZMQ_BACKLOG).should.equal(75); + sock.setsockopt(zmq.ZMQ_BACKLOG, 100); + }); + + it('should use socketopt with sugar', function(){ + sock.getsockopt('backlog').should.not.equal(75); + sock.setsockopt('backlog', 75).should.equal(sock); + sock.getsockopt('backlog').should.equal(75); + + sock.backlog.should.be.a.Number; + sock.backlog.should.not.equal(50); + sock.backlog = 50; + sock.backlog.should.equal(50); + }); + + it('should close', function(){ + sock.close(); + }); + + it('should support options', function(){ + sock = zmq.socket('req', { backlog: 30 }); + sock.backlog.should.equal(30); + sock.close(); + }); + + it('should throw a javascript error if it hits the system file descriptor limit', function() { + var i, socks = [], numSocks = 10000; + function hitlimit() { + for (i = 0; i < numSocks; i++) { + socks.push(zmq.socket('router')); + } + } + hitlimit.should['throw']; + for (i = 0; i < socks.length; i++) { + socks[i].close(); + } + }); + +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.messages.js b/tools/LiveTexturing/node_modules/zmq/test/socket.messages.js new file mode 100644 index 00000000..4b1aade0 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.messages.js @@ -0,0 +1,141 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.messages', function(){ + var push, pull; + + beforeEach(function(){ + push = zmq.socket('push'); + pull = zmq.socket('pull'); + }); + + it('should support messages', function(done){ + var n = 0; + + pull.on('message', function(msg){ + msg = msg.toString(); + switch (n++) { + case 0: + msg.should.equal('string'); + break; + case 1: + msg.should.equal('15.99'); + break; + case 2: + msg.should.equal('buffer'); + push.close(); + pull.close(); + done(); + break; + } + }); + + pull.bind('inproc://stuff_ssm', function(){ + push.connect('inproc://stuff_ssm'); + push.send('string'); + push.send(15.99); + push.send(new Buffer('buffer')); + }); + }); + + it('should support multipart messages', function(done){ + pull.on('message', function(msg1, msg2, msg3){ + msg1.toString().should.equal('string'); + msg2.toString().should.equal('15.99'); + msg3.toString().should.equal('buffer'); + push.close(); + pull.close(); + done(); + }); + + pull.bind('inproc://stuff_ssmm', function(){ + push.connect('inproc://stuff_ssmm'); + push.send(['string', 15.99, new Buffer('buffer')]); + }); + }); + + it('should support sndmore', function(done){ + pull.on('message', function(a, b, c, d, e){ + a.toString().should.equal('tobi'); + b.toString().should.equal('loki'); + c.toString().should.equal('jane'); + d.toString().should.equal('luna'); + e.toString().should.equal('manny'); + push.close(); + pull.close(); + done(); + }); + + pull.bind('inproc://stuff_sss', function(){ + push.connect('inproc://stuff_sss'); + push.send(['tobi', 'loki'], zmq.ZMQ_SNDMORE); + push.send(['jane', 'luna'], zmq.ZMQ_SNDMORE); + push.send('manny'); + }); + }); + + it('should handle late connect', function(done){ + var n = 0; + + pull.on('message', function(msg){ + msg = msg.toString(); + switch (n++) { + case 0: + msg.should.equal('string'); + break; + case 1: + msg.should.equal('15.99'); + break; + case 2: + msg.should.equal('buffer'); + push.close(); + pull.close(); + done(); + break; + } + }); + + if (semver.satisfies(zmq.version, '>=3.x')) { + push.setsockopt(zmq.ZMQ_SNDHWM, 1); + pull.setsockopt(zmq.ZMQ_RCVHWM, 1); + } else if (semver.satisfies(zmq.version, '2.x')) { + push.setsockopt(zmq.ZMQ_HWM, 1); + pull.setsockopt(zmq.ZMQ_HWM, 1); + } + + push.bind('tcp://127.0.0.1:12345', function () { + push.send('string'); + push.send(15.99); + push.send(new Buffer('buffer')); + pull.connect('tcp://127.0.0.1:12345'); + }); + }); + + it('should call send() callbacks', function(done){ + var received = 0; + var callbacks = 0; + + function cb() { + callbacks += 1; + } + + pull.on('message', function () { + received += 1; + + if (received === 4) { + callbacks.should.equal(received); + done(); + } + }); + + pull.bind('inproc://stuff_ssmm', function(){ + push.connect('inproc://stuff_ssmm'); + + push.send('hello', null, cb); + push.send('hello', null, cb); + push.send('hello', null, cb); + push.send(['hello', 'world'], null, cb); + }); + }); +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.monitor.js b/tools/LiveTexturing/node_modules/zmq/test/socket.monitor.js new file mode 100644 index 00000000..d7c988ad --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.monitor.js @@ -0,0 +1,104 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.monitor', function() { + if (!zmq.ZMQ_CAN_MONITOR) { + console.log("monitoring not enabled skipping test"); + return; + } + + it('should be able to monitor the socket', function(done) { + var rep = zmq.socket('rep') + , req = zmq.socket('req') + , events = []; + + rep.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('hello'); + rep.send('world'); + }); + + var testedEvents = ['listen', 'accept', 'disconnect', 'close']; + testedEvents.forEach(function(e) { + rep.on(e, function(event_value, event_endpoint_addr) { + // Test the endpoint addr arg + event_endpoint_addr.toString().should.equal('tcp://127.0.0.1:5423'); + + // If this is a disconnect event we can now close the rep socket + if (e === 'disconnect') { + rep.close(); + } + + testedEvents.pop(); + if (testedEvents.length === 0) { + rep.unmonitor(); + done(); + } + }); + }); + + // enable monitoring for this socket + rep.monitor(); + + rep.bind('tcp://127.0.0.1:5423'); + + rep.on('bind', function(){ + req.connect('tcp://127.0.0.1:5423'); + req.send('hello'); + req.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('world'); + req.close(); + }); + }); + }); + + it('should use default interval and numOfEvents', function(done) { + var req = zmq.socket('req'); + req.setsockopt(zmq.ZMQ_RECONNECT_IVL, 5); // We want a quick connect retry from zmq + + // We will try to connect to a non-existing server, zmq will issue events: "connect_retry", "close", "connect_retry" + // The connect_retry will be issued immediately after the close event, so we will measure the time between the close + // event and connect_retry event, those should >= 10 (this will tell us that we are reading 1 event at a time from + // the monitor socket). + + var closeTime; + req.on('close', function() { + closeTime = Date.now(); + }); + + req.on('connect_retry', function() { + var diff = Date.now() - closeTime; + req.unmonitor(); + req.close(); + diff.should.be.within(10, 20); + done(); + }); + + req.monitor(); + req.connect('tcp://127.0.0.1:5423'); + }); + + it('should read multiple events on monitor interval', function(done) { + var req = zmq.socket('req'); + req.setsockopt(zmq.ZMQ_RECONNECT_IVL, 5); + var closeTime; + req.on('close', function() { + closeTime = Date.now(); + }); + + req.on('connect_retry', function() { + var diff = Date.now() - closeTime; + req.unmonitor(); + req.close(); + diff.should.be.within(0, 5); + done(); + }); + + // This should read all available messages from the queue, and we expect that "close" and "connect_retry" will be + // read on the same interval (for further details see the comment in the previous test) + req.monitor(10, 0); + req.connect('tcp://127.0.0.1:5423'); + }); +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.pair.js b/tools/LiveTexturing/node_modules/zmq/test/socket.pair.js new file mode 100644 index 00000000..9c9d4433 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.pair.js @@ -0,0 +1,46 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.pair', function(){ + + it('should support pair-pair', function (done){ + var pairB = zmq.socket('pair') + , pairC = zmq.socket('pair'); + + var n = 0; + pairB.on('message', function (msg){ + msg.should.be.an.instanceof(Buffer); + switch (n++) { + case 0: + msg.toString().should.equal('foo'); + break; + case 1: + msg.toString().should.equal('bar'); + break; + case 2: + msg.toString().should.equal('baz'); + pairB.close(); + pairC.close(); + done(); + break; + } + }); + + pairC.on('message', function (msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('barnacle'); + }) + + var addr = "inproc://stuff"; + + pairB.bind(addr, function(){ + pairC.connect(addr); + pairB.send('barnacle'); + pairC.send('foo'); + pairC.send('bar'); + pairC.send('baz'); + }); + }); + +}); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.pub-sub.js b/tools/LiveTexturing/node_modules/zmq/test/socket.pub-sub.js new file mode 100644 index 00000000..a0f81a82 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.pub-sub.js @@ -0,0 +1,92 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.pub-sub', function(){ + var pub, sub; + + beforeEach(function() { + pub = zmq.socket('pub'); + sub = zmq.socket('sub'); + }); + + it('should support pub-sub', function(done){ + var n = 0; + + sub.subscribe(''); + sub.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + switch (n++) { + case 0: + msg.toString().should.equal('foo'); + break; + case 1: + msg.toString().should.equal('bar'); + break; + case 2: + msg.toString().should.equal('baz'); + sub.close(); + pub.close(); + done(); + break; + } + }); + + var addr = "inproc://stuff_ssps"; + + sub.bind(addr, function(){ + pub.connect(addr); + + // The connect is asynchronous, and messages published to a non- + // connected socket are silently dropped. That means that there is + // a race between connecting and sending the first message which + // causes this test to hang, especially when running on Linux. Even an + // inproc:// socket seems to be asynchronous. So instead of + // sending straight away, we wait 100ms for the connection to be + // established before we start the send. This fixes the observed + // hang. + + setTimeout(function() { + pub.send('foo'); + pub.send('bar'); + pub.send('baz'); + }, 100.0); + }); + }); + + it('should support pub-sub filter', function(done){ + var n = 0; + + sub.subscribe('js'); + sub.subscribe('luna'); + + sub.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + switch (n++) { + case 0: + msg.toString().should.equal('js is cool'); + break; + case 1: + msg.toString().should.equal('luna is cool too'); + sub.close(); + pub.close(); + done(); + break; + } + }); + + sub.bind('inproc://stuff_sspsf', function(){ + pub.connect('inproc://stuff_sspsf'); + + // See comments on pub-sub test. + + setTimeout(function() { + pub.send('js is cool'); + pub.send('ruby is meh'); + pub.send('py is pretty cool'); + pub.send('luna is cool too'); + }, 100.0); + }); + }); + +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.push-pull.js b/tools/LiveTexturing/node_modules/zmq/test/socket.push-pull.js new file mode 100644 index 00000000..6bef25ce --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.push-pull.js @@ -0,0 +1,152 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.push-pull', function(){ + + it('should support push-pull', function(done){ + var push = zmq.socket('push') + , pull = zmq.socket('pull'); + + var n = 0; + pull.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + switch (n++) { + case 0: + msg.toString().should.equal('foo'); + break; + case 1: + msg.toString().should.equal('bar'); + break; + case 2: + msg.toString().should.equal('baz'); + pull.close(); + push.close(); + done(); + break; + } + }); + + var addr = "inproc://stuff"; + + pull.bind(addr, function(){ + push.connect(addr); + + push.send('foo'); + push.send('bar'); + push.send('baz'); + }); + }); + + + it('should not emit messages after pause()', function(done){ + var push = zmq.socket('push') + , pull = zmq.socket('pull'); + + var n = 0; + + pull.on('message', function(msg){ + if(n++ === 0) { + msg.toString().should.equal('foo'); + } + else{ + should.not.exist(msg); + } + }); + + var addr = "inproc://pause_stuff"; + + pull.bind(addr, function(){ + push.connect(addr); + + push.send('foo'); + pull.pause() + push.send('bar'); + push.send('baz'); + }); + + setTimeout(function (){ + pull.close(); + push.close(); + done(); + }, 100); + }); + + it('should be able to read messages after pause()', function(done){ + var push = zmq.socket('push') + , pull = zmq.socket('pull'); + + var addr = "inproc://pause_stuff"; + + var messages = ['bar', 'foo']; + pull.bind(addr, function(){ + push.connect(addr); + + pull.pause() + messages.forEach(function(message){ + push.send(message); + }); + + messages.forEach(function(message){ + pull.read().toString().should.eql(message); + }); + }); + + setTimeout(function (){ + pull.close(); + push.close(); + done(); + }, 100); + }); + + + it('should emit messages after resume()', function(done){ + var push = zmq.socket('push') + , pull = zmq.socket('pull'); + + var n = 0; + + function checkNoMessages(msg){ + should.not.exist(msg); + } + + function checkMessages(msg){ + msg.should.be.an.instanceof(Buffer); + switch (n++) { + case 0: + msg.toString().should.equal('foo'); + break; + case 1: + msg.toString().should.equal('bar'); + break; + case 2: + msg.toString().should.equal('baz'); + pull.close(); + push.close(); + done(); + break; + } + } + + pull.on('message', checkNoMessages) + + var addr = "inproc://resume_stuff"; + + pull.bind(addr, function(){ + push.connect(addr); + pull.pause() + + push.send('foo'); + push.send('bar'); + push.send('baz'); + + setTimeout(function (){ + pull.removeListener('message', checkNoMessages) + pull.on('message', checkMessages) + pull.resume() + }, 100) + + }); + + }); +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.req-rep.js b/tools/LiveTexturing/node_modules/zmq/test/socket.req-rep.js new file mode 100644 index 00000000..133eb4db --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.req-rep.js @@ -0,0 +1,58 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.req-rep', function(){ + it('should support req-rep', function(done){ + var rep = zmq.socket('rep') + , req = zmq.socket('req'); + + rep.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('hello'); + rep.send('world'); + }); + + rep.bind('inproc://stuff', function(){ + req.connect('inproc://stuff'); + req.send('hello'); + req.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('world'); + rep.close(); + req.close(); + done(); + }); + }); + }); + + it('should support multiple', function(done){ + var n = 5; + + for (var i = 0; i < n; i++) { + (function(n){ + var rep = zmq.socket('rep') + , req = zmq.socket('req'); + + rep.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('hello'); + rep.send('world'); + }); + + rep.bind('inproc://' + n, function(){ + req.connect('inproc://' + n); + req.send('hello'); + req.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('world'); + req.close(); + rep.close(); + if (!--n) done(); + }); + }); + })(i); + } + }); + +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.router.js b/tools/LiveTexturing/node_modules/zmq/test/socket.router.js new file mode 100644 index 00000000..37ed7092 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.router.js @@ -0,0 +1,73 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.router', function(){ + it('should handle the unroutable', function(done){ + var complete = 0; + + if (!semver.gte(zmq.version, '3.2.0')) { + done(); + return console.warn('Test requires libzmq >= 3.2.0'); + } + + if (semver.eq(zmq.version, '3.2.1')) { + done(); + return console.warn('ZMQ_ROUTER_MANDATORY is broken in libzmq = 3.2.1'); + } + + var envelope = '12384982398293'; + var errMsg = 'No route to host'; + if (require('os').platform() == 'win32') errMsg = 'Unknown error'; + + // should emit an error event on unroutable msgs if mandatory = 1 and error handler is set + + (function(){ + var sock = zmq.socket('router'); + sock.on('error', function(err){ + err.message.should.equal(errMsg); + sock.close(); + if (++complete === 2) done(); + }); + + sock.setsockopt(zmq.ZMQ_ROUTER_MANDATORY, 1); + + sock.send([envelope, '']); + })(); + + // should throw an error on unroutable msgs if mandatory = 1 and no error handler is set + + (function(){ + var sock = zmq.socket('router'); + + sock.setsockopt(zmq.ZMQ_ROUTER_MANDATORY, 1); + + (function(){ + sock.send([envelope, '']); + }).should.throw(errMsg); + + (function(){ + sock.send([envelope, '']); + }).should.throw(errMsg); + + (function(){ + sock.send([envelope, '']); + }).should.throw(errMsg); + + sock.close(); + })(); + + // should silently ignore unroutable msgs if mandatory = 0 + + (function(){ + var sock = zmq.socket('router'); + + (function(){ + sock.send([envelope, '']); + sock.close(); + }).should.not.throw(errMsg); + })(); + if (++complete === 2) done(); + }); + +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.stream.js b/tools/LiveTexturing/node_modules/zmq/test/socket.stream.js new file mode 100644 index 00000000..cbabf403 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.stream.js @@ -0,0 +1,73 @@ +var zmq = require('..') + , http = require('http') + , should = require('should') + , semver = require('semver'); + +describe('socket.stream', function(){ + + it('should support a streaming socket', function (done){ + + //socket stream type API after libzmq4+, target > 4.0.0 + if (semver.gte(zmq.version, '4.0.0')) { + + var stream = zmq.socket('stream'); + stream.on('message', function (id,msg){ + + msg.should.be.an.instanceof(Buffer); + + var raw_header = String(msg).split('\r\n'); + var method = raw_header[0].split(' ')[0]; + method.should.equal('GET'); + + //finding an HTTP GET method, prepare HTTP response for TCP socket + var httpProtocolString = 'HTTP/1.0 200 OK\r\n' //status code + + 'Content-Type: text/html\r\n' //headers + + '\r\n' + + '' //response body + + '' //make it xml, json, html or something else + + '' + + '' + + '' + +'

derpin over protocols

' + + '' + +'' + + //zmq streaming prefixed by envelope's routing identifier + stream.send([id,httpProtocolString]); + }); + + var addr = '127.0.0.1:5513'; + stream.bind('tcp://'+addr, function(){ + //send non-peer request to zmq, like an http GET method with URI path + http.get('http://'+addr+'/aRandomRequestPath', function (httpMsg){ + + //msg should now be a node readable stream as the good lord intended + if (semver.gte(process.versions.node, '0.11.0')){ + httpMsg.socket._readableState.reading.should.be.false + } else { + if(semver.gte(process.versions.node, '0.10.0')){ + httpMsg.socket._readableState.reading.should.be.true + } + } + + //conventional node streams emit data events to process zmq stream response + httpMsg.on('data',function (msg){ + msg.should.be.an.instanceof(Buffer); + String(msg).should.equal('' + +'' + +'

derpin over protocols

' + +'' + +''); + done(); + }); + }); + }); + + } else { + + done(); + return console.warn('stream socket type in libzmq v4+'); + + } + }); +}); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.unbind.js b/tools/LiveTexturing/node_modules/zmq/test/socket.unbind.js new file mode 100644 index 00000000..07b72b63 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.unbind.js @@ -0,0 +1,53 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.unbind', function(){ + + it('should be able to unbind', function(done){ + if (!zmq.ZMQ_CAN_UNBIND) { + done(); + return; + } + var a = zmq.socket('dealer') + , b = zmq.socket('dealer') + , c = zmq.socket('dealer'); + + var message_count = 0; + a.bind('tcp://127.0.0.1:5420', function (err) { + if (err) throw err; + a.bind('tcp://127.0.0.1:5421', function (err) { + if (err) throw err; + b.connect('tcp://127.0.0.1:5420'); + b.send('Hello from b.'); + c.connect('tcp://127.0.0.1:5421'); + c.send('Hello from c.'); + }); + }); + + a.on('unbind', function(addr) { + if (addr === 'tcp://127.0.0.1:5420') { + b.send('Error from b.'); + c.send('Messsage from c.'); + setTimeout(function () { + c.send('Final message from c.'); + }, 100); + } + }); + + a.on('message', function(msg) { + message_count++; + if (msg.toString() === 'Hello from b.') { + a.unbind('tcp://127.0.0.1:5420'); + } else if (msg.toString() === 'Final message from c.') { + message_count.should.equal(4); + a.close(); + b.close(); + c.close(); + done(); + } else if (msg.toString() === 'Error from b.') { + throw Error('b should have been unbound'); + } + }); + }); +}); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.xpub-xsub.js b/tools/LiveTexturing/node_modules/zmq/test/socket.xpub-xsub.js new file mode 100644 index 00000000..ae2b5aa7 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.xpub-xsub.js @@ -0,0 +1,88 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.xpub-xsub', function () { + it('should support pub-sub tracing and filtering', function (done) { + if (!semver.gte(zmq.version, '3.1.0')) { + done(); + return console.warn('Test requires libzmq >= 3.1.0'); + } + + var n = 0; + var m = 0; + var pub = zmq.socket('pub'); + var sub = zmq.socket('sub'); + var xpub = zmq.socket('xpub'); + var xsub = zmq.socket('xsub'); + + pub.bindSync('tcp://*:5556'); + xsub.connect('tcp://127.0.0.1:5556'); + xpub.bindSync('tcp://*:5555'); + sub.connect('tcp://127.0.0.1:5555'); + + xsub.on('message', function (msg) { + xpub.send(msg); // Forward message using the xpub so subscribers can receive it + }); + + xpub.on('message', function (msg) { + msg.should.be.an.instanceof(Buffer); + + var type = msg[0] === 0 ? 'unsubscribe' : 'subscribe'; + var channel = msg.slice(1).toString(); + + switch (type) { + case 'subscribe': + switch (m++) { + case 0: + channel.should.equal('js'); + break; + case 1: + channel.should.equal('luna'); + break; + } + break; + case 'unsubscribe': + switch (m++) { + case 2: + channel.should.equal('luna'); + sub.close(); + pub.close(); + xsub.close(); + xpub.close(); + done(); + break; + } + break; + } + + xsub.send(msg); // Forward message using the xsub so the publisher knows it has a subscriber + }); + + sub.on('message', function (msg) { + msg.should.be.an.instanceof(Buffer); + switch (n++) { + case 0: + msg.toString().should.equal('js is cool'); + break; + case 1: + msg.toString().should.equal('luna is cool too'); + break; + } + }); + + sub.subscribe('js'); + sub.subscribe('luna'); + + setTimeout(function () { + pub.send('js is cool'); + pub.send('ruby is meh'); + pub.send('py is pretty cool'); + pub.send('luna is cool too'); + }, 100.0); + + setTimeout(function () { + sub.unsubscribe('luna'); + }, 300); + }); +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/socket.zap.js b/tools/LiveTexturing/node_modules/zmq/test/socket.zap.js new file mode 100644 index 00000000..f0651e91 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/socket.zap.js @@ -0,0 +1,132 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +describe('socket.zap', function(){ + + var zap = require('./zap') + , zapSocket, rep, req, count = 0; + + beforeEach(function(){ + count++; + zapSocket = zap.start(count); + rep = zmq.socket('rep'); + req = zmq.socket('req'); + }); + + afterEach(function(){ + req.close(); + rep.close(); + zapSocket.close(); + }); + + it('should support curve', function(done){ + var port = 'tcp://127.0.0.1:12347'; + if (!semver.gte(zmq.version, '4.0.0')) { + done(); + return; + } + + try { + rep.curve_server = 0; + } catch(e) { + console.log("libsodium seems to be missing; skipping curve test"); + done(); + return; + } + + var serverPublicKey = new Buffer('7f188e5244b02bf497b86de417515cf4d4053ce4eb977aee91a55354655ec33a', 'hex') + , serverPrivateKey = new Buffer('1f5d3873472f95e11f4723d858aaf0919ab1fb402cb3097742c606e61dd0d7d8', 'hex') + , clientPublicKey = new Buffer('ea1cc8bd7c8af65497d43fc21dbec6560c5e7b61bcfdcbd2b0dfacf0b4c38d45', 'hex') + , clientPrivateKey = new Buffer('83f99afacfab052406e5f421612568034e85f4c8182a1c92671e83dca669d31d', 'hex'); + + rep.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('hello'); + rep.send('world'); + }); + + rep.zap_domain = "test"; + rep.curve_server = 1; + rep.curve_secretkey = serverPrivateKey; + rep.mechanism.should.eql(2); + + rep.bind(port, function(){ + req.curve_serverkey = serverPublicKey; + req.curve_publickey = clientPublicKey; + req.curve_secretkey = clientPrivateKey; + req.mechanism.should.eql(2); + + req.connect(port); + req.send('hello'); + req.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('world'); + done(); + }); + }); + + }); + + it('should supoort null', function(done){ + var port = 'tcp://127.0.0.1:12345'; + if (!semver.gte(zmq.version, '4.0.0')) { + done(); + return; + } + + rep.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('hello'); + rep.send('world'); + }); + + rep.zap_domain = "test"; + rep.mechanism.should.eql(0); + + rep.bind(port, function(){ + req.mechanism.should.eql(0); + req.connect(port); + req.send('hello'); + req.on('message', function(msg){ + console.log('here') + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('world'); + done(); + }); + }); + }); + + it('should supoort plain', function(done){ + var port = 'tcp://127.0.0.1:12346'; + if (!semver.gte(zmq.version, '4.0.0')) { + done(); + return; + } + + rep.on('message', function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('hello'); + rep.send('world'); + }); + + rep.zap_domain = "test"; + rep.plain_server = 1; + rep.mechanism.should.eql(1); + + rep.bind(port, function(){ + req.plain_username = "user"; + req.plain_password = "pass"; + req.mechanism.should.eql(1); + + req.connect(port); + req.send('hello'); + req.on('message', function(msg){ + console.log('here') + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('world'); + done(); + }); + }); + }); +}); diff --git a/tools/LiveTexturing/node_modules/zmq/test/zap.js b/tools/LiveTexturing/node_modules/zmq/test/zap.js new file mode 100644 index 00000000..238fee92 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/zap.js @@ -0,0 +1,46 @@ +// This is mainly for testing that the security mechanisms themselves are working +// not the ZAP protocol itself. As long as the request is valid, this will +// authenticate it. + +var zmq = require('../'); + +module.exports.start = function(count) { + var zap = zmq.socket('router'); + zap.on('message', function() { + var data = Array.prototype.slice.call(arguments); + + if (!data || !data.length) throw new Error("Invalid ZAP request"); + + var returnPath = [], + frame = data.shift(); + while (frame && (frame.length != 0)) { + returnPath.push(frame); + frame = data.shift(); + } + returnPath.push(frame); + + if (data.length < 6) throw new Error("Invalid ZAP request"); + + var zapReq = { + version: data.shift(), + requestId: data.shift(), + domain: new Buffer(data.shift()).toString('utf8'), + address: new Buffer(data.shift()).toString('utf8'), + identity: new Buffer(data.shift()).toString('utf8'), + mechanism: new Buffer(data.shift()).toString('utf8'), + credentials: data.slice(0) + }; + + zap.send(returnPath.concat([ + zapReq.version, + zapReq.requestId, + new Buffer("200", "utf8"), + new Buffer("OK", "utf8"), + new Buffer(0), + new Buffer(0) + ])); + }); + + zap.bindSync("inproc://zeromq.zap.01."+count); + return zap; +} diff --git a/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.js b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.js new file mode 100644 index 00000000..438814e6 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.js @@ -0,0 +1,10 @@ + +var zmq = require('..') + , should = require('should'); + +describe('proxy', function() { + it('should be a function off the module namespace', function (done) { + zmq.proxy.should.be.a.Function; + done(); + }); +}); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.push-pull.js b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.push-pull.js new file mode 100644 index 00000000..dc369d66 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.push-pull.js @@ -0,0 +1,95 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +var addr = 'tcp://127.0.0.1' + , frontendAddr = addr+':5501' + , backendAddr = addr+':5502' + , captureAddr = addr+':5503'; + +describe('proxy.push-pull', function() { + + it('should proxy push-pull connected to pull-push',function (done) { + + var frontend = zmq.socket('pull'); + var backend = zmq.socket('push'); + + var pull = zmq.socket('pull'); + var push = zmq.socket('push'); + + frontend.bindSync(frontendAddr); + backend.bindSync(backendAddr); + + push.connect(frontendAddr); + pull.connect(backendAddr); + + pull.on('message',function (msg) { + + frontend.close(); + backend.close(); + push.close(); + pull.close(); + + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('foo'); + done(); + }); + + setTimeout(function() { + push.send('foo'); + }, 100.0); + + zmq.proxy(frontend,backend); + + }); + + it('should proxy pull-push connected to push-pull with capture',function (done) { + + var frontend = zmq.socket('push'); + var backend = zmq.socket('pull'); + + var capture = zmq.socket('pub'); + var capSub = zmq.socket('sub'); + + var pull = zmq.socket('pull'); + var push = zmq.socket('push'); + + frontend.bindSync(frontendAddr); + backend.bindSync(backendAddr); + capture.bindSync(captureAddr); + + pull.connect(frontendAddr); + push.connect(backendAddr); + capSub.connect(captureAddr); + + pull.on('message',function (msg) { + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('foo'); + console.log(msg.toString()); + }); + + capSub.subscribe(''); + capSub.on('message',function (msg) { + capture.close(); + capSub.close(); + + setTimeout(function() { + frontend.close(); + backend.close(); + push.close(); + pull.close(); + + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('foo'); + done(); + },100.0); + }); + + setTimeout(function() { + push.send('foo'); + }, 100.0); + + zmq.proxy(frontend,backend,capture); + + }); +}); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.router-dealer.js b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.router-dealer.js new file mode 100644 index 00000000..a403c2f5 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.router-dealer.js @@ -0,0 +1,97 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +var addr = 'tcp://127.0.0.1' + , frontendAddr = addr+':5504' + , backendAddr = addr+':5505' + , captureAddr = addr+':5506'; + +describe('proxy.router-dealer', function() { + + it('should proxy req-rep connected over router-dealer', function (done){ + + var frontend = zmq.socket('router'); + var backend = zmq.socket('dealer'); + + var rep = zmq.socket('rep'); + var req = zmq.socket('req'); + + frontend.bindSync(frontendAddr); + backend.bindSync(backendAddr); + + req.connect(frontendAddr); + rep.connect(backendAddr); + + req.on('message',function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('foo bar'); + frontend.close(); + backend.close(); + req.close(); + rep.close(); + done(); + }); + + rep.on('message', function (msg) { + rep.send(msg+' bar'); + }); + + setTimeout(function() { + req.send('foo'); + }, 100.0); + + zmq.proxy(frontend,backend); + + }); + + it('should proxy rep-req connections with capture', function (done){ + + var frontend = zmq.socket('router'); + var backend = zmq.socket('dealer'); + + var rep = zmq.socket('rep'); + var req = zmq.socket('req'); + + var capture = zmq.socket('pub'); + var capSub = zmq.socket('sub'); + + frontend.bindSync(frontendAddr); + backend.bindSync(backendAddr); + capture.bindSync(captureAddr); + + req.connect(frontendAddr); + rep.connect(backendAddr); + capSub.connect(captureAddr); + capSub.subscribe(''); + + req.on('message',function (msg) { + req.close(); + rep.close(); + console.log(msg.toString()); + }); + + rep.on('message', function (msg) { + rep.send(msg+' bar'); + }); + + capSub.on('message',function (msg) { + backend.close(); + frontend.close(); + capture.close(); + capSub.close(); + setTimeout(function() { + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('foo bar'); + done(); + },100.0) + }); + + setTimeout(function() { + req.send('foo'); + },200.0) + + zmq.proxy(frontend,backend,capture); + + }); +}); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.xpub-xsub.js b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.xpub-xsub.js new file mode 100644 index 00000000..1fac8c4b --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.xpub-xsub.js @@ -0,0 +1,155 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +var addr = 'tcp://127.0.0.1' + , frontendAddr = addr+':5507' + , backendAddr = addr+':5508' + , captureAddr = addr+':5509'; + +var version = semver.gte(zmq.version, '3.1.0'); + +describe('proxy.xpub-xsub', function() { + + it('should proxy pub-sub connected to xpub-xsub', function (done) { + if (!version) { + done(); + return console.warn('Test requires libzmq >= 3.1.0'); + } + + var frontend = zmq.socket('xpub'); + var backend = zmq.socket('xsub'); + + var sub = zmq.socket('sub'); + var pub = zmq.socket('pub'); + + sub.subscribe(''); + sub.on('message',function (msg) { + + frontend.close(); + backend.close(); + sub.close(); + pub.close(); + + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('foo'); + + done(); + }); + + frontend.bind(frontendAddr,function() { + backend.bind(backendAddr,function() { + + sub.connect(frontendAddr); + pub.connect(backendAddr); + + setTimeout(function() { + pub.send('foo'); + }, 200.0); + + zmq.proxy(frontend,backend); + + }); + }); + }); + + it('should proxy connections with capture', function (done) { + if (!version) { + done(); + return console.warn('Test requires libzmq >= 3.1.0'); + } + + var frontend = zmq.socket('xpub'); + var backend = zmq.socket('xsub'); + + var capture = zmq.socket('pub'); + var capSub = zmq.socket('sub'); + + var sub = zmq.socket('sub'); + var pub = zmq.socket('pub'); + + sub.subscribe(''); + sub.on('message', function (msg) { + + sub.close(); + pub.close(); + backend.close(); + frontend.close(); + + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('foo'); + + console.log(msg.toString()); + + }); + + capSub.subscribe(''); + capSub.on('message',function (msg) { + + capture.close(); + capSub.close(); + + setTimeout(function(){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('foo'); + done(); + },100.0); + }); + + capture.bind(captureAddr,function() { + frontend.bind(frontendAddr,function() { + backend.bind(backendAddr,function() { + + pub.connect(backendAddr); + sub.connect(frontendAddr); + capSub.connect(captureAddr); + + setTimeout(function () { + pub.send('foo'); + }, 200.0); + + zmq.proxy(frontend,backend,capture); + }); + }); + }); + }); + + it('should throw an error if the order is wrong', function (done) { + if (!version) { + done(); + return console.warn('Test requires libzmq >= 3.1.0'); + } + + var frontend = zmq.socket('xpub'); + var backend = zmq.socket('xsub'); + + var sub = zmq.socket('sub'); + var pub = zmq.socket('pub'); + + frontend.bindSync(frontendAddr); + backend.bindSync(backendAddr); + + sub.connect(frontendAddr); + pub.connect(backendAddr); + + try{ + + zmq.proxy(backend,frontend); + + } catch(e){ + + e.message.should.equal('wrong socket order to proxy'); + + } finally{ + frontend.close(); + backend.close(); + pub.close(); + sub.close(); + + //allow time for TCP sockets to close + setTimeout(function(){ + done(); + },200) + } + }) +}); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.xrep-xreq.js b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.xrep-xreq.js new file mode 100644 index 00000000..f9ce1904 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/test/zmq_proxy.xrep-xreq.js @@ -0,0 +1,52 @@ +var zmq = require('..') + , should = require('should') + , semver = require('semver'); + +var addr = 'tcp://127.0.0.1' + , frontendAddr = addr+':5510' + , backendAddr = addr+':5511' + , captureAddr = addr+':5512'; + +//since its for libzmq2, we target versions < 3.0.0 +var version = semver.lte(zmq.version, '3.0.0'); + +describe('proxy.xrep-xreq', function() { + it('should proxy req-rep connected to xrep-xreq', function (done) { + if (!version) { + done(); + return console.warn('Test requires libzmq v2'); + } + + var frontend = zmq.socket('xrep'); + var backend = zmq.socket('xreq'); + + var req = zmq.socket('req'); + var rep = zmq.socket('rep'); + + frontend.bindSync(frontendAddr); + backend.bindSync(backendAddr); + + req.connect(frontendAddr); + rep.connect(backendAddr); + + req.on('message',function(msg){ + msg.should.be.an.instanceof(Buffer); + msg.toString().should.equal('foo bar'); + frontend.close(); + backend.close(); + req.close(); + rep.close(); + done(); + }); + + rep.on('message', function (msg) { + rep.send(msg+' bar'); + }); + + setTimeout(function() { + req.send('foo'); + }, 100.0); + + zmq.proxy(frontend,backend); + }); +}); \ No newline at end of file diff --git a/tools/LiveTexturing/node_modules/zmq/windows/include/zmq.h b/tools/LiveTexturing/node_modules/zmq/windows/include/zmq.h new file mode 100644 index 00000000..78e594f1 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/windows/include/zmq.h @@ -0,0 +1,416 @@ +/* + Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file + + This file is part of 0MQ. + + 0MQ is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + 0MQ is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . + + ************************************************************************* + NOTE to contributors. This file comprises the principal public contract + for ZeroMQ API users (along with zmq_utils.h). Any change to this file + supplied in a stable release SHOULD not break existing applications. + In practice this means that the value of constants must not change, and + that old values may not be reused for new constants. + ************************************************************************* +*/ + +#ifndef __ZMQ_H_INCLUDED__ +#define __ZMQ_H_INCLUDED__ + +/* Version macros for compile-time API version detection */ +#define ZMQ_VERSION_MAJOR 4 +#define ZMQ_VERSION_MINOR 0 +#define ZMQ_VERSION_PATCH 4 + +#define ZMQ_MAKE_VERSION(major, minor, patch) \ + ((major) * 10000 + (minor) * 100 + (patch)) +#define ZMQ_VERSION \ + ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined _WIN32_WCE +#include +#endif +#include +#include +#if defined _WIN32 +#include +#endif + +/* Handle DSO symbol visibility */ +#if defined _WIN32 +# if defined ZMQ_STATIC +# define ZMQ_EXPORT +# elif defined DLL_EXPORT +# define ZMQ_EXPORT __declspec(dllexport) +# else +# define ZMQ_EXPORT __declspec(dllimport) +# endif +#else +# if defined __SUNPRO_C || defined __SUNPRO_CC +# define ZMQ_EXPORT __global +# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER +# define ZMQ_EXPORT __attribute__ ((visibility("default"))) +# else +# define ZMQ_EXPORT +# endif +#endif + +/* Define integer types needed for event interface */ +#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS +# include +#elif defined _MSC_VER && _MSC_VER < 1600 +# ifndef int32_t +typedef __int32 int32_t; +# endif +# ifndef uint16_t +typedef unsigned __int16 uint16_t; +# endif +# ifndef uint8_t +typedef unsigned __int8 uint8_t; +# endif +#else +# include +#endif + + +/******************************************************************************/ +/* 0MQ errors. */ +/******************************************************************************/ + +/* A number random enough not to collide with different errno ranges on */ +/* different OSes. The assumption is that error_t is at least 32-bit type. */ +#define ZMQ_HAUSNUMERO 156384712 + +/* On Windows platform some of the standard POSIX errnos are not defined. */ +#ifndef ENOTSUP +#define ENOTSUP (ZMQ_HAUSNUMERO + 1) +#endif +#ifndef EPROTONOSUPPORT +#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) +#endif +#ifndef ENOBUFS +#define ENOBUFS (ZMQ_HAUSNUMERO + 3) +#endif +#ifndef ENETDOWN +#define ENETDOWN (ZMQ_HAUSNUMERO + 4) +#endif +#ifndef EADDRINUSE +#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) +#endif +#ifndef EADDRNOTAVAIL +#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) +#endif +#ifndef ECONNREFUSED +#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) +#endif +#ifndef EINPROGRESS +#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) +#endif +#ifndef ENOTSOCK +#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) +#endif +#ifndef EMSGSIZE +#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) +#endif +#ifndef EAFNOSUPPORT +#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) +#endif +#ifndef ENETUNREACH +#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) +#endif +#ifndef ECONNABORTED +#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) +#endif +#ifndef ECONNRESET +#define ECONNRESET (ZMQ_HAUSNUMERO + 14) +#endif +#ifndef ENOTCONN +#define ENOTCONN (ZMQ_HAUSNUMERO + 15) +#endif +#ifndef ETIMEDOUT +#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) +#endif +#ifndef EHOSTUNREACH +#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) +#endif +#ifndef ENETRESET +#define ENETRESET (ZMQ_HAUSNUMERO + 18) +#endif + +/* Native 0MQ error codes. */ +#define EFSM (ZMQ_HAUSNUMERO + 51) +#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) +#define ETERM (ZMQ_HAUSNUMERO + 53) +#define EMTHREAD (ZMQ_HAUSNUMERO + 54) + +/* Run-time API version detection */ +ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); + +/* This function retrieves the errno as it is known to 0MQ library. The goal */ +/* of this function is to make the code 100% portable, including where 0MQ */ +/* compiled with certain CRT library (on Windows) is linked to an */ +/* application that uses different CRT library. */ +ZMQ_EXPORT int zmq_errno (void); + +/* Resolves system errors and 0MQ errors to human-readable string. */ +ZMQ_EXPORT const char *zmq_strerror (int errnum); + +/******************************************************************************/ +/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ +/******************************************************************************/ + +/* New API */ +/* Context options */ +#define ZMQ_IO_THREADS 1 +#define ZMQ_MAX_SOCKETS 2 + +/* Default for new contexts */ +#define ZMQ_IO_THREADS_DFLT 1 +#define ZMQ_MAX_SOCKETS_DFLT 1023 + +ZMQ_EXPORT void *zmq_ctx_new (void); +ZMQ_EXPORT int zmq_ctx_term (void *context); +ZMQ_EXPORT int zmq_ctx_shutdown (void *ctx_); +ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); +ZMQ_EXPORT int zmq_ctx_get (void *context, int option); + +/* Old (legacy) API */ +ZMQ_EXPORT void *zmq_init (int io_threads); +ZMQ_EXPORT int zmq_term (void *context); +ZMQ_EXPORT int zmq_ctx_destroy (void *context); + + +/******************************************************************************/ +/* 0MQ message definition. */ +/******************************************************************************/ + +typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; + +typedef void (zmq_free_fn) (void *data, void *hint); + +ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); +ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, + size_t size, zmq_free_fn *ffn, void *hint); +ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); +ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); +ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); +ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); +ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); +ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int option); +ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int option, int optval); + + +/******************************************************************************/ +/* 0MQ socket definition. */ +/******************************************************************************/ + +/* Socket types. */ +#define ZMQ_PAIR 0 +#define ZMQ_PUB 1 +#define ZMQ_SUB 2 +#define ZMQ_REQ 3 +#define ZMQ_REP 4 +#define ZMQ_DEALER 5 +#define ZMQ_ROUTER 6 +#define ZMQ_PULL 7 +#define ZMQ_PUSH 8 +#define ZMQ_XPUB 9 +#define ZMQ_XSUB 10 +#define ZMQ_STREAM 11 + +/* Deprecated aliases */ +#define ZMQ_XREQ ZMQ_DEALER +#define ZMQ_XREP ZMQ_ROUTER + +/* Socket options. */ +#define ZMQ_AFFINITY 4 +#define ZMQ_IDENTITY 5 +#define ZMQ_SUBSCRIBE 6 +#define ZMQ_UNSUBSCRIBE 7 +#define ZMQ_RATE 8 +#define ZMQ_RECOVERY_IVL 9 +#define ZMQ_SNDBUF 11 +#define ZMQ_RCVBUF 12 +#define ZMQ_RCVMORE 13 +#define ZMQ_FD 14 +#define ZMQ_EVENTS 15 +#define ZMQ_TYPE 16 +#define ZMQ_LINGER 17 +#define ZMQ_RECONNECT_IVL 18 +#define ZMQ_BACKLOG 19 +#define ZMQ_RECONNECT_IVL_MAX 21 +#define ZMQ_MAXMSGSIZE 22 +#define ZMQ_SNDHWM 23 +#define ZMQ_RCVHWM 24 +#define ZMQ_MULTICAST_HOPS 25 +#define ZMQ_RCVTIMEO 27 +#define ZMQ_SNDTIMEO 28 +#define ZMQ_LAST_ENDPOINT 32 +#define ZMQ_ROUTER_MANDATORY 33 +#define ZMQ_TCP_KEEPALIVE 34 +#define ZMQ_TCP_KEEPALIVE_CNT 35 +#define ZMQ_TCP_KEEPALIVE_IDLE 36 +#define ZMQ_TCP_KEEPALIVE_INTVL 37 +#define ZMQ_TCP_ACCEPT_FILTER 38 +#define ZMQ_IMMEDIATE 39 +#define ZMQ_XPUB_VERBOSE 40 +#define ZMQ_ROUTER_RAW 41 +#define ZMQ_IPV6 42 +#define ZMQ_MECHANISM 43 +#define ZMQ_PLAIN_SERVER 44 +#define ZMQ_PLAIN_USERNAME 45 +#define ZMQ_PLAIN_PASSWORD 46 +#define ZMQ_CURVE_SERVER 47 +#define ZMQ_CURVE_PUBLICKEY 48 +#define ZMQ_CURVE_SECRETKEY 49 +#define ZMQ_CURVE_SERVERKEY 50 +#define ZMQ_PROBE_ROUTER 51 +#define ZMQ_REQ_CORRELATE 52 +#define ZMQ_REQ_RELAXED 53 +#define ZMQ_CONFLATE 54 +#define ZMQ_ZAP_DOMAIN 55 + +/* Message options */ +#define ZMQ_MORE 1 + +/* Send/recv options. */ +#define ZMQ_DONTWAIT 1 +#define ZMQ_SNDMORE 2 + +/* Security mechanisms */ +#define ZMQ_NULL 0 +#define ZMQ_PLAIN 1 +#define ZMQ_CURVE 2 + +/* Deprecated options and aliases */ +#define ZMQ_IPV4ONLY 31 +#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE +#define ZMQ_NOBLOCK ZMQ_DONTWAIT +#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY +#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY + +/******************************************************************************/ +/* 0MQ socket events and monitoring */ +/******************************************************************************/ + +/* Socket transport events (tcp and ipc only) */ +#define ZMQ_EVENT_CONNECTED 1 +#define ZMQ_EVENT_CONNECT_DELAYED 2 +#define ZMQ_EVENT_CONNECT_RETRIED 4 + +#define ZMQ_EVENT_LISTENING 8 +#define ZMQ_EVENT_BIND_FAILED 16 + +#define ZMQ_EVENT_ACCEPTED 32 +#define ZMQ_EVENT_ACCEPT_FAILED 64 + +#define ZMQ_EVENT_CLOSED 128 +#define ZMQ_EVENT_CLOSE_FAILED 256 +#define ZMQ_EVENT_DISCONNECTED 512 +#define ZMQ_EVENT_MONITOR_STOPPED 1024 + +#define ZMQ_EVENT_ALL ( ZMQ_EVENT_CONNECTED | ZMQ_EVENT_CONNECT_DELAYED | \ + ZMQ_EVENT_CONNECT_RETRIED | ZMQ_EVENT_LISTENING | \ + ZMQ_EVENT_BIND_FAILED | ZMQ_EVENT_ACCEPTED | \ + ZMQ_EVENT_ACCEPT_FAILED | ZMQ_EVENT_CLOSED | \ + ZMQ_EVENT_CLOSE_FAILED | ZMQ_EVENT_DISCONNECTED | \ + ZMQ_EVENT_MONITOR_STOPPED) + +/* Socket event data */ +typedef struct { + uint16_t event; // id of the event as bitfield + int32_t value ; // value is either error code, fd or reconnect interval +} zmq_event_t; + +ZMQ_EXPORT void *zmq_socket (void *, int type); +ZMQ_EXPORT int zmq_close (void *s); +ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, + size_t optvallen); +ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, + size_t *optvallen); +ZMQ_EXPORT int zmq_bind (void *s, const char *addr); +ZMQ_EXPORT int zmq_connect (void *s, const char *addr); +ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); +ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); +ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); + +ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); +ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); + +/* Experimental */ +struct iovec; + +ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); +ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); + +/******************************************************************************/ +/* I/O multiplexing. */ +/******************************************************************************/ + +#define ZMQ_POLLIN 1 +#define ZMQ_POLLOUT 2 +#define ZMQ_POLLERR 4 + +typedef struct +{ + void *socket; +#if defined _WIN32 + SOCKET fd; +#else + int fd; +#endif + short events; + short revents; +} zmq_pollitem_t; + +#define ZMQ_POLLITEMS_DFLT 16 + +ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); + +/* Built-in message proxy (3-way) */ + +ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); + +/* Encode a binary key as printable text using ZMQ RFC 32 */ +ZMQ_EXPORT char *zmq_z85_encode (char *dest, uint8_t *data, size_t size); + +/* Encode a binary key from printable text per ZMQ RFC 32 */ +ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, char *string); + +/* Deprecated aliases */ +#define ZMQ_STREAMER 1 +#define ZMQ_FORWARDER 2 +#define ZMQ_QUEUE 3 +/* Deprecated method */ +ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); + +#undef ZMQ_EXPORT + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/tools/LiveTexturing/node_modules/zmq/windows/include/zmq_utils.h b/tools/LiveTexturing/node_modules/zmq/windows/include/zmq_utils.h new file mode 100644 index 00000000..9b14aa72 --- /dev/null +++ b/tools/LiveTexturing/node_modules/zmq/windows/include/zmq_utils.h @@ -0,0 +1,105 @@ +/* + Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file + + This file is part of 0MQ. + + 0MQ is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + 0MQ is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef __ZMQ_UTILS_H_INCLUDED__ +#define __ZMQ_UTILS_H_INCLUDED__ + +#include +#include +#include + +/* Define integer types needed for event interface */ +#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS +# include +#elif defined _MSC_VER && _MSC_VER < 1600 +# ifndef int32_t +typedef __int32 int32_t; +# endif +# ifndef uint16_t +typedef unsigned __int16 uint16_t; +# endif +#else +# include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Handle DSO symbol visibility */ +#if defined _WIN32 +# if defined ZMQ_STATIC +# define ZMQ_EXPORT +# elif defined DLL_EXPORT +# define ZMQ_EXPORT __declspec(dllexport) +# else +# define ZMQ_EXPORT __declspec(dllimport) +# endif +#else +# if defined __SUNPRO_C || defined __SUNPRO_CC +# define ZMQ_EXPORT __global +# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER +# define ZMQ_EXPORT __attribute__ ((visibility("default"))) +# else +# define ZMQ_EXPORT +# endif +#endif + +/* These functions are documented by man pages */ + +/* Encode data with Z85 encoding. Returns encoded data */ +ZMQ_EXPORT char *zmq_z85_encode (char *dest, uint8_t *data, size_t size); + +/* Decode data with Z85 encoding. Returns decoded data */ +ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, char *string); + +/* Generate z85-encoded public and private keypair with libsodium. */ +/* Returns 0 on success. */ +ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); + +typedef void (zmq_thread_fn) (void*); + +/* These functions are not documented by man pages */ + +/* Helper functions are used by perf tests so that they don't have to care */ +/* about minutiae of time-related functions on different OS platforms. */ + +/* Starts the stopwatch. Returns the handle to the watch. */ +ZMQ_EXPORT void *zmq_stopwatch_start (void); + +/* Stops the stopwatch. Returns the number of microseconds elapsed since */ +/* the stopwatch was started. */ +ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); + +/* Sleeps for specified number of seconds. */ +ZMQ_EXPORT void zmq_sleep (int seconds_); + +/* Start a thread. Returns a handle to the thread. */ +ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); + +/* Wait for thread to complete then free up resources. */ +ZMQ_EXPORT void zmq_threadclose (void* thread); + +#undef ZMQ_EXPORT + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/LiveTexturing/package.json b/tools/LiveTexturing/package.json new file mode 100644 index 00000000..bfdd6ba4 --- /dev/null +++ b/tools/LiveTexturing/package.json @@ -0,0 +1,15 @@ +{ + "name": "LiveTexturing", + "version": "1.0.0", + "description": "Send image from Photoshop to Maya", + "main": "main.js", + "generator-core-version": "~3", + "license": "", + "readmeFilename": "", + "scripts": { + }, + "dependencies": { + }, + "devDependencies": { + } +} diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/Export.obj b/tools/MayaExporter/MayaExporter/x64/Debug/Export.obj new file mode 100644 index 00000000..d582f0aa Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/Export.obj differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/Main.obj b/tools/MayaExporter/MayaExporter/x64/Debug/Main.obj new file mode 100644 index 00000000..8449d64e Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/Main.obj differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/Material.obj b/tools/MayaExporter/MayaExporter/x64/Debug/Material.obj new file mode 100644 index 00000000..2343fb55 Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/Material.obj differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.log b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.log new file mode 100644 index 00000000..d0eaf785 --- /dev/null +++ b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.log @@ -0,0 +1,38 @@ +Build started 2016-01-27 12:36:51. + 1>Project "C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\MayaExporter\MayaExporter.vcxproj" on node 2 (Build target(s)). + 1>CustomBuild: + Uic'ing MayaExporter.ui... + Moc'ing Menu.h... + Rcc'ing leeeeel.qrc... + 1>RCC : warning : No resources in 'C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\MayaExporter\leeeeel.qrc'. + + ClCompile: + C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /I"C:\Program Files\Autodesk\Maya2016\include" /I.\GeneratedFiles /I.\GeneratedFiles\Debug /Zi /nologo /W1 /WX- /Od /D QT_DLL /D QT_NO_IMPORT_QT47_QML /D UNICODE /D WIN32 /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"x64\Debug\\" /Fd"x64\Debug\vc140.pdb" /Gd /TP /errorReport:prompt Export.cpp Material.cpp Menu.cpp GeneratedFiles\Debug\moc_Menu.cpp Main.cpp Mesh.cpp Skeleton.cpp WriteToFile.cpp + Export.cpp + Material.cpp + Menu.cpp + moc_Menu.cpp + Main.cpp + Mesh.cpp + Skeleton.cpp + WriteToFile.cpp + Generating Code... + C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /I"C:\Program Files\Autodesk\Maya2016\include" /I.\GeneratedFiles /I.\GeneratedFiles\Debug /Zi /nologo /W1 /WX- /Od /D QT_DLL /D QT_NO_IMPORT_QT47_QML /D UNICODE /D WIN32 /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"x64\Debug\\" /Fd"x64\Debug\vc140.pdb" /Gd /TP /errorReport:prompt GeneratedFiles\qrc_leeeeel.cpp + qrc_leeeeel.cpp + Link: + C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\x64\Debug\MayaExporter.mll" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files\Autodesk\Maya2016\lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /Debug /PDB:"C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\x64\Debug\MayaExporter.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\x64\Debug\MayaExporter.lib" /MACHINE:X64 /SUBSYSTEM:WINDOWS /DLL x64\Debug\Export.obj + x64\Debug\Material.obj + x64\Debug\Menu.obj + x64\Debug\moc_Menu.obj + x64\Debug\qrc_leeeeel.obj + x64\Debug\Main.obj + x64\Debug\Mesh.obj + x64\Debug\Skeleton.obj + x64\Debug\WriteToFile.obj + Creating library C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\x64\Debug\MayaExporter.lib and object C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\x64\Debug\MayaExporter.exp + MayaExporter.vcxproj -> C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\x64\Debug\MayaExporter.mll + 1>Done Building Project "C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\MayaExporter\MayaExporter.vcxproj" (Build target(s)). + +Build succeeded. + +Time Elapsed 00:00:14.13 diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/CL.command.1.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/CL.command.1.tlog new file mode 100644 index 00000000..1386a807 Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/CL.command.1.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/CL.read.1.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/CL.read.1.tlog new file mode 100644 index 00000000..2f9070ec Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/CL.read.1.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/CL.write.1.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/CL.write.1.tlog new file mode 100644 index 00000000..b0e2576e Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/CL.write.1.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/MayaExporter.lastbuildstate b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/MayaExporter.lastbuildstate new file mode 100644 index 00000000..dfbf888f --- /dev/null +++ b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/MayaExporter.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit +Debug|x64|C:\Users\panda\Desktop\TacticalZ\tools\MayaExporter\| diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/MayaExporter.write.1u.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/MayaExporter.write.1u.tlog new file mode 100644 index 00000000..78401989 Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/MayaExporter.write.1u.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/custombuild.command.1.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/custombuild.command.1.tlog new file mode 100644 index 00000000..62437006 Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/custombuild.command.1.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/custombuild.read.1.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/custombuild.read.1.tlog new file mode 100644 index 00000000..d49df970 Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/custombuild.read.1.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/custombuild.write.1.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/custombuild.write.1.tlog new file mode 100644 index 00000000..e65134df Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/custombuild.write.1.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/link.command.1.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/link.command.1.tlog new file mode 100644 index 00000000..5a95849d Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/link.command.1.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/link.read.1.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/link.read.1.tlog new file mode 100644 index 00000000..793953ad Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/link.read.1.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/link.write.1.tlog b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/link.write.1.tlog new file mode 100644 index 00000000..b522b193 Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/MayaExporter.tlog/link.write.1.tlog differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/Menu.obj b/tools/MayaExporter/MayaExporter/x64/Debug/Menu.obj new file mode 100644 index 00000000..1024629e Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/Menu.obj differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/Mesh.obj b/tools/MayaExporter/MayaExporter/x64/Debug/Mesh.obj new file mode 100644 index 00000000..938b43ba Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/Mesh.obj differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/Skeleton.obj b/tools/MayaExporter/MayaExporter/x64/Debug/Skeleton.obj new file mode 100644 index 00000000..6c23032a Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/Skeleton.obj differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/WriteToFile.obj b/tools/MayaExporter/MayaExporter/x64/Debug/WriteToFile.obj new file mode 100644 index 00000000..354504ea Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/WriteToFile.obj differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/moc_Menu.obj b/tools/MayaExporter/MayaExporter/x64/Debug/moc_Menu.obj new file mode 100644 index 00000000..50c521c8 Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/moc_Menu.obj differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/qrc_leeeeel.obj b/tools/MayaExporter/MayaExporter/x64/Debug/qrc_leeeeel.obj new file mode 100644 index 00000000..fc6fc4b7 Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/qrc_leeeeel.obj differ diff --git a/tools/MayaExporter/MayaExporter/x64/Debug/vc140.pdb b/tools/MayaExporter/MayaExporter/x64/Debug/vc140.pdb new file mode 100644 index 00000000..e21a987e Binary files /dev/null and b/tools/MayaExporter/MayaExporter/x64/Debug/vc140.pdb differ diff --git a/tools/MayaExporter/x64/Debug/MayaExporter.exp b/tools/MayaExporter/x64/Debug/MayaExporter.exp new file mode 100644 index 00000000..3900cb80 Binary files /dev/null and b/tools/MayaExporter/x64/Debug/MayaExporter.exp differ diff --git a/tools/MayaExporter/x64/Debug/MayaExporter.ilk b/tools/MayaExporter/x64/Debug/MayaExporter.ilk new file mode 100644 index 00000000..27c1c9e9 Binary files /dev/null and b/tools/MayaExporter/x64/Debug/MayaExporter.ilk differ diff --git a/tools/MayaExporter/x64/Debug/MayaExporter.lib b/tools/MayaExporter/x64/Debug/MayaExporter.lib new file mode 100644 index 00000000..3453e2ed Binary files /dev/null and b/tools/MayaExporter/x64/Debug/MayaExporter.lib differ diff --git a/tools/MayaExporter/x64/Debug/MayaExporter.mll b/tools/MayaExporter/x64/Debug/MayaExporter.mll new file mode 100644 index 00000000..6ac7796d Binary files /dev/null and b/tools/MayaExporter/x64/Debug/MayaExporter.mll differ diff --git a/tools/MayaExporter/x64/Debug/MayaExporter.pdb b/tools/MayaExporter/x64/Debug/MayaExporter.pdb new file mode 100644 index 00000000..6092f424 Binary files /dev/null and b/tools/MayaExporter/x64/Debug/MayaExporter.pdb differ diff --git a/tools/mayaPluginRTT/.vs/config/applicationhost.config b/tools/mayaPluginRTT/.vs/config/applicationhost.config new file mode 100644 index 00000000..c2abfb48 --- /dev/null +++ b/tools/mayaPluginRTT/.vs/config/applicationhost.config @@ -0,0 +1,1030 @@ + + + + + + + + +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/mayaPluginRTT/mayaPluginRTT.sdf b/tools/mayaPluginRTT/mayaPluginRTT.sdf new file mode 100644 index 00000000..33971a4b Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT.sdf differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT.sln b/tools/mayaPluginRTT/mayaPluginRTT.sln new file mode 100644 index 00000000..1e3c9af8 --- /dev/null +++ b/tools/mayaPluginRTT/mayaPluginRTT.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mayaPluginRTT", "mayaPluginRTT\mayaPluginRTT.vcxproj", "{C26D6DAB-3247-4782-94AC-738BDB20CFD0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C26D6DAB-3247-4782-94AC-738BDB20CFD0}.Debug|x64.ActiveCfg = Debug|x64 + {C26D6DAB-3247-4782-94AC-738BDB20CFD0}.Debug|x64.Build.0 = Debug|x64 + {C26D6DAB-3247-4782-94AC-738BDB20CFD0}.Debug|x86.ActiveCfg = Debug|Win32 + {C26D6DAB-3247-4782-94AC-738BDB20CFD0}.Debug|x86.Build.0 = Debug|Win32 + {C26D6DAB-3247-4782-94AC-738BDB20CFD0}.Release|x64.ActiveCfg = Release|x64 + {C26D6DAB-3247-4782-94AC-738BDB20CFD0}.Release|x64.Build.0 = Release|x64 + {C26D6DAB-3247-4782-94AC-738BDB20CFD0}.Release|x86.ActiveCfg = Release|Win32 + {C26D6DAB-3247-4782-94AC-738BDB20CFD0}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tools/mayaPluginRTT/mayaPluginRTT/libzmq-v120-mt-4_0_4.lib b/tools/mayaPluginRTT/mayaPluginRTT/libzmq-v120-mt-4_0_4.lib new file mode 100644 index 00000000..b2f765ca Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/libzmq-v120-mt-4_0_4.lib differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/main.cpp b/tools/mayaPluginRTT/mayaPluginRTT/main.cpp new file mode 100644 index 00000000..28b31644 --- /dev/null +++ b/tools/mayaPluginRTT/mayaPluginRTT/main.cpp @@ -0,0 +1,429 @@ +// UD1414_Plugin.cpp : Defines the exported functions for the DLL application. +#include "zmq.hpp" +#include "maya_includes.h" +#include +#include +#include +#include +#include + +#pragma comment(lib, "libzmq-v120-mt-4_0_4.lib") + +using namespace std; + +MCallbackIdArray IDArray; +map > textureObject; +//map compareObject; +vector compareObject_key; +vector compareObject_value; +struct message { + int docNameLength; + //int numPixels; + //int startX; + //int startY; + //int canvasY; + //int canvasX; + //int rowLength; + char* docName; + //unsigned char* pixels; +}; + +typedef struct +{ + bool shutDown = false; + bool hasShutdown = false; +} ThreadVars; + +ThreadVars threadVars; +vector images; + +map docName_map; +list toUpdate; +MThreadRetVal ThreadFunction(void* data) +{ + zmq::context_t context(1); + zmq::socket_t subscriber(context, ZMQ_SUB); + + std::cout << "Connecting to hello world server..." << std::endl; + subscriber.connect("tcp://localhost:5555"); + subscriber.setsockopt(ZMQ_SUBSCRIBE, "", 0); + + zmq::message_t msg; + while (!threadVars.shutDown) + { + if (subscriber.recv(&msg, ZMQ_DONTWAIT)) + { + //MGlobal::displayInfo(MString() + "test1: " + msg.size()); + + MObject outColorObject; + MPlug outColorPlug; + + size_t tet = msg.size(); + message PSData; + PSData.docNameLength = ((message*)msg.data())->docNameLength; + //PSData.numPixels = ((message*)msg.data())->numPixels; + //PSData.startX = ((message*)msg.data())->startX; + //PSData.startY = ((message*)msg.data())->startY; + //PSData.canvasY = ((message*)msg.data())->canvasY; + //PSData.canvasX = ((message*)msg.data())->canvasX; + //PSData.rowLength = ((message*)msg.data())->rowLength; + PSData.docName = (char*)msg.data() + sizeof(message) - sizeof(char*) - 4; + //PSData.pixels = (unsigned char*)msg.data() + sizeof(message) - sizeof(char*) * 2 + 8 + PSData.docNameLength; + + //MGlobal::displayInfo(MString() + "docName: " + PSData.docName); + //MGlobal::displayInfo(MString() + "docNameLength: " + PSData.docNameLength); + + if (textureObject.find(PSData.docName) != textureObject.end()) + { + toUpdate.push_back(PSData.docName); + //toUpdate.unique(); + /* vector& textureNode = textureObject[PSData.docName]; + vector::iterator it; + for (it = textureNode.begin(); it != textureNode.end(); it++) + { + MFnDependencyNode depNode(*it); + MPlug plug = depNode.findPlug("outColor"); + MGlobal::displayInfo(MString() + "ANKA: " + plug.name()); + plug.setMObject(plug.asMObject()); + }*/ + } + + //std::map::iterator it; + //it = docName_map.find(PSData.docName); + //if (! (it != docName_map.end())) + //{ + // MStatus res = MS::kSuccess; + // MString file; + // MString place2dTexture; + + // do + // { + // res = MGlobal::executeCommand(MString() + "shadingNode - asUtility place2dTexture;", place2dTexture); + // } while (res != MS::kSuccess); + + // do + // { + // res = MGlobal::executeCommand(MString() + "shadingNode - asTexture - isColorManaged file;", file); + // } while (res != MS::kSuccess); + + // MGlobal::displayInfo(MString() + "ASDASDASD: " + file); + // MGlobal::displayInfo(MString() + "ASDASDASD: " + place2dTexture); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".coverage " + file + ".coverage;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".translateFrame " + file + ".translateFrame;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".rotateFrame " + file + ".rotateFrame;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".mirrorU " + file + ".mirrorU;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".mirrorV " + file + ".mirrorV;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".stagger " + file + ".stagger;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".wrapU " + file + ".wrapU;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".wrapV " + file + ".wrapV;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".repeatUV " + file + ".repeatUV;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".offset " + file + ".offset;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".rotateUV " + file + ".rotateUV;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".noiseUV " + file + ".noiseUV;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".vertexUvOne " + file + ".vertexUvOne;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".vertexUvTwo " + file + ".vertexUvTwo;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".vertexUvThree " + file + ".vertexUvThree;"); + // MGlobal::executeCommand("connectAttr - f " + place2dTexture + ".vertexCameraOne " + file + ".vertexCameraOne;"); + // MGlobal::executeCommand("connectAttr " + place2dTexture + ".outUvFilterSize " + file + ".uvFilterSize;"); + // MGlobal::executeCommand("connectAttr " + place2dTexture + ".outUV " + file + ".uv;"); + // MSelectionList thisFile; + // MObject thisFileObject; + + // for (map >::iterator it = textureObject.begin(); it != textureObject.end(); ++it) + // { + // //MGlobal::displayInfo(MString() + "SECOND: " + it->second[0].apiTypeStr()); + // //MFnDependencyNode tmp_DN(it->second[0]); + // //MPlug tmpPlug = tmp_DN.findPlug("outColor"); + // //tmpPlug.setMObject(tmpPlug.asMObject()); + // //MGlobal::displayInfo(MString() + "tmp_DN: " + tmp_DN.name()); + // } + + + + // MGlobal::getSelectionListByName(file, thisFile); + // thisFile.getDependNode(0, thisFileObject); + + // docName_map[PSData.docName] = thisFileObject; + // MFnDependencyNode textureNode(thisFileObject); + // MImage image; + // image.readFromTextureNode(thisFileObject); + // + // unsigned int w, h; + // image.getSize(w, h); + // /*MGlobal::displayInfo(MString() + w + " " + h); + // for (unsigned int i = 0; i < w * h * 4; i++) + // { + // MGlobal::displayInfo(MString() + "Pix: " + imagePixels[i]); + // }*/ + // //image.setPixels(PSData.pixels, PSData.canvasX, PSData.canvasY); + // image.setRGBA(true); + // image.convertPixelFormat(MImage::MPixelType::kByte); + // unsigned char* imagePixels = image.pixels(); + + // MPlug color = textureNode.findPlug("uvCoord"); + // //color.setMObject(color.asMObject()); + // + // //unsigned int w, h; + // image.getSize(w, h); + // MGlobal::displayInfo(MString() + w + " " + h); + // for (unsigned int i = 0; i < w * h * 4; i++) + // { + // MGlobal::displayInfo(MString() + "Pix: " + imagePixels[i]); + // } + // MGlobal::displayInfo("999999999999"); + + // //image.writeToFile("C:/Users/kamisama/Desktop/3.png", "png"); + + // color.setMObject(color.asMObject()); + //} + //else + //{ + // MObject& thisFileObject = docName_map[PSData.docName]; + // MFnDependencyNode textureNode(thisFileObject); + // + // MImage image; + // image.readFromTextureNode(thisFileObject); + // unsigned char* imagePixels = image.pixels(); + + // unsigned int w, h; + // image.getSize(w, h); + // MGlobal::displayInfo("Before"); + // MGlobal::displayInfo(MString() + w + " " + h); + // for (unsigned int i = 0; i < w * h * 4; i++) + // { + // //MGlobal::displayInfo(MString() + "Pix: " + imagePixels[i]); + // } + // //image.setPixels(PSData.pixels, PSData.canvasX, PSData.canvasY); + // //memcpy(image.pixels(), PSData.pixels, w * h * 4); + // //MPlug color = textureNode.findPlug("outColor"); + + // image.getSize(w, h); + // MGlobal::displayInfo("After"); + // MGlobal::displayInfo(MString() + w + " " + h); + // for (unsigned int i = 0; i < w * h * 4; i++) + // { + // //MGlobal::displayInfo(MString() + "Pix: " + imagePixels[i]); + // } + // + // MPlug color = textureNode.findPlug("uvCoord"); + // color.setMObject(color.asMObject()); + //} + //MItDependencyNodes it(MFn::kFileTexture); + //for (; !it.isDone(); it.next()) + //{ + // MFnDependencyNode texture_node(it.thisNode()); + // globalShitPlug = texture_node.findPlug("outColor"); + // globalShit = globalShitPlug.asMObject(); + // MGlobal::displayInfo(MString() + "Plug name: " + globalShitPlug.name()); + // MImage test_Mimage; + // MGlobal::displayInfo(MString() + "hej"); + // test_Mimage.create(1, 1, 4, MImage::kByte); + // //test_Mimage.readFromTextureNode(globalShit); + // MGlobal::displayInfo(MString() + "hej igen"); + // unsigned char* test_pixels; + // test_pixels = test_Mimage.pixels(); + + // unsigned int width, height; + // test_Mimage.getSize(width, height); + // MGlobal::displayInfo(MString() + "WIDTH: " + width); + // MGlobal::displayInfo(MString() + "HEIGHT: " + height); + // for (unsigned int i = 0; i < width * height * 4; i++) + // { + // test_pixels[i] = imageData->pixels[i]; + // } + + // globalShitPlug.setMObject(globalShit); + + // break; + //} + } + } + + threadVars.hasShutdown = true; + return 0; +} + +void textureChanged(MNodeMessage::AttributeMessage msg, MPlug &plug, MPlug &otherPlug, void *clientData) +{ + //MGlobal::displayInfo(MString() + "Hello!!!!!!!!!!!! " + otherPlug.name()); + //MGlobal::displayInfo(MString() + "Hello! :DDDDDDD " + otherPlug.asString()); + string plugName(plug.name().asChar()); + if (plugName.find("fileTextureName") != string::npos) + { + if (msg & MNodeMessage::AttributeMessage::kAttributeSet) + { + //MGlobal::displayInfo("Hello from file name! :P"); + + map >::iterator it; + vector::iterator its; + vector::iterator itVec_string; + bool newName = false; + bool nameIsBiggerThenZero = false; + int index = 0; + for (its = compareObject_key.begin(); its != compareObject_key.end(); its++) + { + //MGlobal::displayInfo("Cool"); + if (*its == plug.node()) + { + if (compareObject_value[index].compare(plug.asString().asChar()) != 0) + { + //MGlobal::displayInfo("Cool 1"); + newName = true; + if (compareObject_value[index].length() > 0) + //MGlobal::displayInfo("Cool 2"); + nameIsBiggerThenZero = true; + break; + } + } + index++; + } + if (its == compareObject_key.end()) + { + newName = true; + } + + if (newName == true) + { + MGlobal::displayInfo("New Name"); + if (nameIsBiggerThenZero) + { + vector::iterator iii; + vector& objectVector = textureObject[compareObject_value[index]]; + index = 0; + for (iii = objectVector.begin(); iii != objectVector.end(); iii++) + { + //MGlobal::displayInfo(MString() + "INSIDE THE FOR LOOP!!!!!! III " + (*iii).apiTypeStr()); + if ((*iii) == plug.node()) + { + MGlobal::displayInfo("iii == plug.node()"); + break; + } + index++; + } + //MGlobal::displayInfo("erase"); + + objectVector.erase(objectVector.begin() + index); + textureObject[plug.asString().asChar()].push_back(plug.node()); + //MGlobal::displayInfo(MString() + "index: " + index + " " + objectVector.size()); + } + + index = 0; + for (its = compareObject_key.begin(); its != compareObject_key.end(); its++) + { + if (*its == plug.node()) + { + MGlobal::displayInfo("its->first == plug.node()"); + compareObject_value[index] = plug.asString().asChar(); + break; + } + index++; + } + if (its == compareObject_key.end()) + { + //MGlobal::displayInfo("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); + compareObject_key.push_back(plug.node()); + compareObject_value.push_back(plug.asString().asChar()); + textureObject[plug.asString().asChar()].push_back(plug.node()); + } + // //compareObject[plug.node()] = plug.asString().asChar(); + + } + + //MGlobal::displayInfo("Here"); + for (its = compareObject_key.begin(); its != compareObject_key.end(); its++) + { + //MGlobal::displayInfo(MString() + "compareObject_key: " + its->apiTypeStr()); + } + + for (itVec_string = compareObject_value.begin(); itVec_string != compareObject_value.end(); itVec_string++) + { + //MGlobal::displayInfo(MString() + "compareObject_value: " + (*itVec_string).c_str()); + } + + MGlobal::displayInfo("--- textureObject ---"); + + for (it = textureObject.begin(); it != textureObject.end(); it++) + { + MGlobal::displayInfo(MString() + "filename: " + it->first.c_str()); + MGlobal::displayInfo(MString() + "nr of nodes: " + it->second.size()); + } + + } + } +} + +void nodeCreated(MObject& node, void *clientData) +{ + if (node.hasFn(MFn::kFileTexture)) + { + MGlobal::displayInfo("FileTextureAdded"); + IDArray.append(MNodeMessage::addAttributeChangedCallback(node, textureChanged)); + } +} + +void timer(float elapsedTime, float lastTime, void *clientData) +{ + int size = toUpdate.size(); + while(size) + { + vector& textureNode = textureObject[toUpdate.front()]; + vector::iterator it; + for (it = textureNode.begin(); it != textureNode.end(); it++) + { + MFnDependencyNode depNode(*it); + MPlug plug = depNode.findPlug("outColor"); + //MGlobal::displayInfo(MString() + "ANKA: " + plug.name()); + plug.setMObject(plug.asMObject()); + } + toUpdate.pop_front(); + size = toUpdate.size(); + } +} + +EXPORT MStatus initializePlugin(MObject obj) +{ + MStatus res = MS::kSuccess; + + threadVars.shutDown = false; + threadVars.hasShutdown = false; + MFnPlugin myPlugin(obj, "Maya plugin", "1.0", "Any", &res); + if (MFAIL(res)) { + CHECK_MSTATUS(res); + } + IDArray.append(MDGMessage::addNodeAddedCallback(nodeCreated)); + IDArray.append(MTimerMessage::addTimerCallback(0.2, timer)); + + res = MThreadAsync::init(); + if (res == MStatus::kSuccess) + { + res = MThreadAsync::createTask(ThreadFunction, nullptr, nullptr, NULL); + + if (res != MStatus::kSuccess) + { + threadVars.hasShutdown = true; + return MStatus::kFailure; + } + } + + MGlobal::displayInfo("Maya plugin loaded!"); + return res; +} + + +EXPORT MStatus uninitializePlugin(MObject obj) +{ + MFnPlugin plugin(obj); + + threadVars.shutDown = true; + //Wait for thread to shutdown befor releasing it + while (!threadVars.hasShutdown) + { + Sleep(1); + } + MThreadAsync::release(); + MMessage::removeCallbacks(IDArray); + + MGlobal::displayInfo("Maya plugin unloaded!"); + + return MS::kSuccess; +} \ No newline at end of file diff --git a/tools/mayaPluginRTT/mayaPluginRTT/mayaPluginRTT.vcxproj b/tools/mayaPluginRTT/mayaPluginRTT/mayaPluginRTT.vcxproj new file mode 100644 index 00000000..88df7e84 --- /dev/null +++ b/tools/mayaPluginRTT/mayaPluginRTT/mayaPluginRTT.vcxproj @@ -0,0 +1,160 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {C26D6DAB-3247-4782-94AC-738BDB20CFD0} + Win32Proj + mayaPluginRTT + 8.1 + + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + .mll + C:\Program Files\ZeroMQ 4.0.4\include;$(IncludePath) + $(LibraryPath) + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;MAYAPLUGINRTT_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + + + + + + + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;MAYAPLUGINRTT_EXPORTS;%(PreprocessorDefinitions) + C:\Program Files\Autodesk\Maya2016\include;%(AdditionalIncludeDirectories) + + + Windows + true + C:\Program Files\Autodesk\Maya2016\lib;%(AdditionalLibraryDirectories) + libzmq-v120-mt-4_0_4.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;MAYAPLUGINRTT_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_WINDOWS;_USRDLL;MAYAPLUGINRTT_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/mayaPluginRTT/mayaPluginRTT/mayaPluginRTT.vcxproj.filters b/tools/mayaPluginRTT/mayaPluginRTT/mayaPluginRTT.vcxproj.filters new file mode 100644 index 00000000..e4528f22 --- /dev/null +++ b/tools/mayaPluginRTT/mayaPluginRTT/mayaPluginRTT.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/tools/mayaPluginRTT/mayaPluginRTT/mayaPluginRTT.vcxproj.user b/tools/mayaPluginRTT/mayaPluginRTT/mayaPluginRTT.vcxproj.user new file mode 100644 index 00000000..abe8dd89 --- /dev/null +++ b/tools/mayaPluginRTT/mayaPluginRTT/mayaPluginRTT.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tools/mayaPluginRTT/mayaPluginRTT/maya_includes.h b/tools/mayaPluginRTT/mayaPluginRTT/maya_includes.h new file mode 100644 index 00000000..c9612783 --- /dev/null +++ b/tools/mayaPluginRTT/mayaPluginRTT/maya_includes.h @@ -0,0 +1,71 @@ +#pragma once + +// some definitions for the DLL to play nice with Maya +#define NT_PLUGIN +#define REQUIRE_IOSTREAM +#define EXPORT __declspec(dllexport) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Wrappers +#include + +// Commands +#include + +// Libraries to link from Maya +// This can be also done in the properties setting for the project. +#pragma comment(lib,"Foundation.lib") +#pragma comment(lib,"OpenMaya.lib") +#pragma comment(lib,"OpenMayaUI.lib") \ No newline at end of file diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/main.obj b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/main.obj new file mode 100644 index 00000000..35f4cde9 Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/main.obj differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.log b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.log new file mode 100644 index 00000000..2b2c0dbb --- /dev/null +++ b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.log @@ -0,0 +1,19 @@ +Build started 2016-02-09 12:46:49. + 1>Project "C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\mayaPluginRTT\mayaPluginRTT.vcxproj" on node 2 (Build target(s)). + 1>ClCompile: + C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /I"C:\Program Files\Autodesk\Maya2016\include" /ZI /nologo /W3 /WX- /Od /D _DEBUG /D _WINDOWS /D _USRDLL /D MAYAPLUGINRTT_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"x64\Debug\\" /Fd"x64\Debug\vc140.pdb" /Gd /TP /errorReport:prompt main.cpp + main.cpp + 1>c:\users\panda\desktop\tacticalz\tools\livetexturing\mayapluginrtt\mayapluginrtt\main.cpp(348): warning C4244: 'argument': conversion from 'unsigned __int64' to 'double', possible loss of data + 1>c:\users\panda\desktop\tacticalz\tools\livetexturing\mayapluginrtt\mayapluginrtt\main.cpp(366): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data + 1>c:\users\panda\desktop\tacticalz\tools\livetexturing\mayapluginrtt\mayapluginrtt\main.cpp(379): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data + 1>c:\users\panda\desktop\tacticalz\tools\livetexturing\mayapluginrtt\mayapluginrtt\main.cpp(394): warning C4305: 'argument': truncation from 'double' to 'float' + Link: + C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\x64\Debug\mayaPluginRTT.mll" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files\Autodesk\Maya2016\lib" "libzmq-v120-mt-4_0_4.lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /Debug /PDB:"C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\x64\Debug\mayaPluginRTT.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\x64\Debug\mayaPluginRTT.lib" /MACHINE:X64 /DLL x64\Debug\main.obj + LINK : C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\x64\Debug\mayaPluginRTT.mll not found or not built by the last incremental link; performing full link + Creating library C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\x64\Debug\mayaPluginRTT.lib and object C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\x64\Debug\mayaPluginRTT.exp + mayaPluginRTT.vcxproj -> C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\x64\Debug\mayaPluginRTT.mll + 1>Done Building Project "C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\mayaPluginRTT\mayaPluginRTT.vcxproj" (Build target(s)). + +Build succeeded. + +Time Elapsed 00:00:34.69 diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/CL.command.1.tlog b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/CL.command.1.tlog new file mode 100644 index 00000000..791c7c87 Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/CL.command.1.tlog differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/CL.read.1.tlog b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/CL.read.1.tlog new file mode 100644 index 00000000..d7dfba25 Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/CL.read.1.tlog differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/CL.write.1.tlog b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/CL.write.1.tlog new file mode 100644 index 00000000..4dcdebe9 Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/CL.write.1.tlog differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/link.command.1.tlog b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/link.command.1.tlog new file mode 100644 index 00000000..faf0b33c Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/link.command.1.tlog differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/link.read.1.tlog b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/link.read.1.tlog new file mode 100644 index 00000000..87ef4f33 Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/link.read.1.tlog differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/link.write.1.tlog b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/link.write.1.tlog new file mode 100644 index 00000000..b87b5d4a Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/link.write.1.tlog differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/mayaPluginRTT.lastbuildstate b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/mayaPluginRTT.lastbuildstate new file mode 100644 index 00000000..50393c48 --- /dev/null +++ b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/mayaPluginRTT.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit +Debug|x64|C:\Users\panda\Desktop\TacticalZ\tools\LiveTexturing\mayaPluginRTT\| diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/mayaPluginRTT.write.1u.tlog b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/mayaPluginRTT.write.1u.tlog new file mode 100644 index 00000000..0cb71510 Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/mayaPluginRTT.tlog/mayaPluginRTT.write.1u.tlog differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/vc140.idb b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/vc140.idb new file mode 100644 index 00000000..7c5bc699 Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/vc140.idb differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/vc140.pdb b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/vc140.pdb new file mode 100644 index 00000000..f4085502 Binary files /dev/null and b/tools/mayaPluginRTT/mayaPluginRTT/x64/Debug/vc140.pdb differ diff --git a/tools/mayaPluginRTT/mayaPluginRTT/zmq.hpp b/tools/mayaPluginRTT/mayaPluginRTT/zmq.hpp new file mode 100644 index 00000000..c1353abe --- /dev/null +++ b/tools/mayaPluginRTT/mayaPluginRTT/zmq.hpp @@ -0,0 +1,765 @@ +/* + Copyright (c) 2009-2011 250bpm s.r.o. + Copyright (c) 2011 Botond Ballo + Copyright (c) 2007-2009 iMatix Corporation + + 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. +*/ + +#ifndef __ZMQ_HPP_INCLUDED__ +#define __ZMQ_HPP_INCLUDED__ + +#if __cplusplus >= 201103L +#define ZMQ_CPP11 +#define ZMQ_NOTHROW noexcept +#define ZMQ_EXPLICIT explicit +#else + #define ZMQ_CPP03 + #define ZMQ_NOTHROW + #define ZMQ_EXPLICIT +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef ZMQ_CPP11 +#include +#include +#endif + +// Detect whether the compiler supports C++11 rvalue references. +#if (defined(__GNUC__) && (__GNUC__ > 4 || \ + (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && \ + defined(__GXX_EXPERIMENTAL_CXX0X__)) + #define ZMQ_HAS_RVALUE_REFS + #define ZMQ_DELETED_FUNCTION = delete +#elif defined(__clang__) + #if __has_feature(cxx_rvalue_references) + #define ZMQ_HAS_RVALUE_REFS + #endif + + #if __has_feature(cxx_deleted_functions) + #define ZMQ_DELETED_FUNCTION = delete + #else + #define ZMQ_DELETED_FUNCTION + #endif +#elif defined(_MSC_VER) && (_MSC_VER >= 1600) + #define ZMQ_HAS_RVALUE_REFS + #define ZMQ_DELETED_FUNCTION +#else + #define ZMQ_DELETED_FUNCTION +#endif + +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 3, 0) +#define ZMQ_NEW_MONITOR_EVENT_LAYOUT +#endif + +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) +#define ZMQ_HAS_PROXY_STEERABLE +/* Socket event data */ +typedef struct { + uint16_t event; // id of the event as bitfield + int32_t value ; // value is either error code, fd or reconnect interval +} zmq_event_t; +#endif + +// Avoid using deprecated message receive function when possible +#if ZMQ_VERSION < ZMQ_MAKE_VERSION(3, 2, 0) +# define zmq_msg_recv(msg, socket, flags) zmq_recvmsg(socket, msg, flags) +#endif + + +// In order to prevent unused variable warnings when building in non-debug +// mode use this macro to make assertions. +#ifndef NDEBUG +# define ZMQ_ASSERT(expression) assert(expression) +#else +# define ZMQ_ASSERT(expression) (void)(expression) +#endif + +namespace zmq +{ + + typedef zmq_free_fn free_fn; + typedef zmq_pollitem_t pollitem_t; + + class error_t : public std::exception + { + public: + + error_t () : errnum (zmq_errno ()) {} + + virtual const char *what () const throw () + { + return zmq_strerror (errnum); + } + + int num () const + { + return errnum; + } + + private: + + int errnum; + }; + + inline int poll (zmq_pollitem_t const* items_, int nitems_, long timeout_ = -1) + { + int rc = zmq_poll (const_cast(items_), nitems_, timeout_); + if (rc < 0) + throw error_t (); + return rc; + } + + inline int poll(zmq_pollitem_t const* items, size_t nitems) + { + return poll(items, static_cast(nitems), -1); + } + + #ifdef ZMQ_CPP11 + inline int poll(zmq_pollitem_t const* items, size_t nitems, std::chrono::milliseconds timeout) + { + return poll(items, nitems, timeout.count() ); + } + + inline int poll(std::vector const& items, std::chrono::milliseconds timeout) + { + return poll(items.data(), items.size(), timeout.count() ); + } + + inline int poll(std::vector const& items, long timeout_ = -1) + { + return poll(items.data(), static_cast(items.size()), timeout_); + } + #endif + + + + inline void proxy (void *frontend, void *backend, void *capture) + { + int rc = zmq_proxy (frontend, backend, capture); + if (rc != 0) + throw error_t (); + } + +#ifdef ZMQ_HAS_PROXY_STEERABLE + inline void proxy_steerable (void *frontend, void *backend, void *capture, void *control) + { + int rc = zmq_proxy_steerable (frontend, backend, capture, control); + if (rc != 0) + throw error_t (); + } +#endif + + inline void version (int *major_, int *minor_, int *patch_) + { + zmq_version (major_, minor_, patch_); + } + + #ifdef ZMQ_CPP11 + inline std::tuple version() + { + std::tuple v; + zmq_version(&std::get<0>(v), &std::get<1>(v), &std::get<2>(v) ); + return v; + } + #endif + + class message_t + { + friend class socket_t; + + public: + + inline message_t () + { + int rc = zmq_msg_init (&msg); + if (rc != 0) + throw error_t (); + } + + inline explicit message_t (size_t size_) + { + int rc = zmq_msg_init_size (&msg, size_); + if (rc != 0) + throw error_t (); + } + + template message_t(I first, I last): + msg() + { + typedef typename std::iterator_traits::difference_type size_type; + typedef typename std::iterator_traits::pointer pointer_t; + + size_type const size_ = std::distance(first, last); + int const rc = zmq_msg_init_size (&msg, size_); + if (rc != 0) + throw error_t (); + std::copy(first, last, static_cast(zmq_msg_data (&msg)) ); + } + + inline message_t (void *data_, size_t size_, free_fn *ffn_, + void *hint_ = NULL) + { + int rc = zmq_msg_init_data (&msg, data_, size_, ffn_, hint_); + if (rc != 0) + throw error_t (); + } + +#ifdef ZMQ_HAS_RVALUE_REFS + inline message_t (message_t &&rhs): msg (rhs.msg) + { + int rc = zmq_msg_init (&rhs.msg); + if (rc != 0) + throw error_t (); + } + + inline message_t &operator = (message_t &&rhs) ZMQ_NOTHROW + { + std::swap (msg, rhs.msg); + return *this; + } +#endif + + inline ~message_t () ZMQ_NOTHROW + { + int rc = zmq_msg_close (&msg); + ZMQ_ASSERT (rc == 0); + } + + inline void rebuild () + { + int rc = zmq_msg_close (&msg); + if (rc != 0) + throw error_t (); + rc = zmq_msg_init (&msg); + if (rc != 0) + throw error_t (); + } + + inline void rebuild (size_t size_) + { + int rc = zmq_msg_close (&msg); + if (rc != 0) + throw error_t (); + rc = zmq_msg_init_size (&msg, size_); + if (rc != 0) + throw error_t (); + } + + inline void rebuild (void *data_, size_t size_, free_fn *ffn_, + void *hint_ = NULL) + { + int rc = zmq_msg_close (&msg); + if (rc != 0) + throw error_t (); + rc = zmq_msg_init_data (&msg, data_, size_, ffn_, hint_); + if (rc != 0) + throw error_t (); + } + + inline void move (message_t const *msg_) + { + int rc = zmq_msg_move (&msg, const_cast(&(msg_->msg))); + if (rc != 0) + throw error_t (); + } + + inline void copy (message_t const *msg_) + { + int rc = zmq_msg_copy (&msg, const_cast(&(msg_->msg))); + if (rc != 0) + throw error_t (); + } + + inline bool more () const ZMQ_NOTHROW + { + int rc = zmq_msg_more (const_cast(&msg) ); + return rc != 0; + } + + inline void *data () ZMQ_NOTHROW + { + return zmq_msg_data (&msg); + } + + inline const void* data () const ZMQ_NOTHROW + { + return zmq_msg_data (const_cast(&msg)); + } + + inline size_t size () const ZMQ_NOTHROW + { + return zmq_msg_size (const_cast(&msg)); + } + + template T* data() ZMQ_NOTHROW + { + return static_cast( data() ); + } + + template T const* data() const ZMQ_NOTHROW + { + return static_cast( data() ); + } + + + private: + // The underlying message + zmq_msg_t msg; + + // Disable implicit message copying, so that users won't use shared + // messages (less efficient) without being aware of the fact. + message_t (const message_t&) ZMQ_DELETED_FUNCTION; + void operator = (const message_t&) ZMQ_DELETED_FUNCTION; + }; + + class context_t + { + friend class socket_t; + + public: + inline context_t () + { + ptr = zmq_ctx_new (); + if (ptr == NULL) + throw error_t (); + } + + + inline explicit context_t (int io_threads_, int max_sockets_ = ZMQ_MAX_SOCKETS_DFLT) + { + ptr = zmq_ctx_new (); + if (ptr == NULL) + throw error_t (); + + int rc = zmq_ctx_set (ptr, ZMQ_IO_THREADS, io_threads_); + ZMQ_ASSERT (rc == 0); + + rc = zmq_ctx_set (ptr, ZMQ_MAX_SOCKETS, max_sockets_); + ZMQ_ASSERT (rc == 0); + } + +#ifdef ZMQ_HAS_RVALUE_REFS + inline context_t (context_t &&rhs) ZMQ_NOTHROW : ptr (rhs.ptr) + { + rhs.ptr = NULL; + } + inline context_t &operator = (context_t &&rhs) ZMQ_NOTHROW + { + std::swap (ptr, rhs.ptr); + return *this; + } +#endif + + inline ~context_t () ZMQ_NOTHROW + { + int rc = zmq_ctx_destroy (ptr); + ZMQ_ASSERT (rc == 0); + } + + inline void close() ZMQ_NOTHROW + { + int rc = zmq_ctx_shutdown (ptr); + ZMQ_ASSERT (rc == 0); + } + + // Be careful with this, it's probably only useful for + // using the C api together with an existing C++ api. + // Normally you should never need to use this. + inline ZMQ_EXPLICIT operator void* () ZMQ_NOTHROW + { + return ptr; + } + + inline ZMQ_EXPLICIT operator void const* () const ZMQ_NOTHROW + { + return ptr; + } + private: + + void *ptr; + + context_t (const context_t&) ZMQ_DELETED_FUNCTION; + void operator = (const context_t&) ZMQ_DELETED_FUNCTION; + }; + + #ifdef ZMQ_CPP11 + enum class socket_type: int + { + req = ZMQ_REQ, + rep = ZMQ_REP, + dealer = ZMQ_DEALER, + router = ZMQ_ROUTER, + pub = ZMQ_PUB, + sub = ZMQ_SUB, + xpub = ZMQ_XPUB, + xsub = ZMQ_XSUB, + push = ZMQ_PUSH, + pull = ZMQ_PULL, +#if ZMQ_VERSION_MAJOR < 4 + pair = ZMQ_PAIR +#else + pair = ZMQ_PAIR, + stream = ZMQ_STREAM +#endif + }; + #endif + + class socket_t + { + friend class monitor_t; + public: + inline socket_t(context_t& context_, int type_) + { + init(context_, type_); + } + + #ifdef ZMQ_CPP11 + inline socket_t(context_t& context_, socket_type type_) + { + init(context_, static_cast(type_)); + } + #endif + +#ifdef ZMQ_HAS_RVALUE_REFS + inline socket_t(socket_t&& rhs) ZMQ_NOTHROW : ptr(rhs.ptr) + { + rhs.ptr = NULL; + } + inline socket_t& operator=(socket_t&& rhs) ZMQ_NOTHROW + { + std::swap(ptr, rhs.ptr); + return *this; + } +#endif + + inline ~socket_t () ZMQ_NOTHROW + { + close(); + } + + inline ZMQ_EXPLICIT operator void* () ZMQ_NOTHROW + { + return ptr; + } + + inline ZMQ_EXPLICIT operator void const* () const ZMQ_NOTHROW + { + return ptr; + } + + inline void close() ZMQ_NOTHROW + { + if(ptr == NULL) + // already closed + return ; + int rc = zmq_close (ptr); + ZMQ_ASSERT (rc == 0); + ptr = 0 ; + } + + template void setsockopt(int option_, T const& optval) + { + setsockopt(option_, &optval, sizeof(T) ); + } + + inline void setsockopt (int option_, const void *optval_, + size_t optvallen_) + { + int rc = zmq_setsockopt (ptr, option_, optval_, optvallen_); + if (rc != 0) + throw error_t (); + } + + inline void getsockopt (int option_, void *optval_, + size_t *optvallen_) const + { + int rc = zmq_getsockopt (ptr, option_, optval_, optvallen_); + if (rc != 0) + throw error_t (); + } + + template T getsockopt(int option_) const + { + T optval; + size_t optlen = sizeof(T); + getsockopt(option_, &optval, &optlen ); + return optval; + } + + inline void bind(std::string const& addr) + { + bind(addr.c_str()); + } + + inline void bind (const char *addr_) + { + int rc = zmq_bind (ptr, addr_); + if (rc != 0) + throw error_t (); + } + + inline void unbind(std::string const& addr) + { + unbind(addr.c_str()); + } + + inline void unbind (const char *addr_) + { + int rc = zmq_unbind (ptr, addr_); + if (rc != 0) + throw error_t (); + } + + inline void connect(std::string const& addr) + { + connect(addr.c_str()); + } + + inline void connect (const char *addr_) + { + int rc = zmq_connect (ptr, addr_); + if (rc != 0) + throw error_t (); + } + + inline void disconnect(std::string const& addr) + { + disconnect(addr.c_str()); + } + + inline void disconnect (const char *addr_) + { + int rc = zmq_disconnect (ptr, addr_); + if (rc != 0) + throw error_t (); + } + + inline bool connected() const ZMQ_NOTHROW + { + return(ptr != NULL); + } + + inline size_t send (const void *buf_, size_t len_, int flags_ = 0) + { + int nbytes = zmq_send (ptr, buf_, len_, flags_); + if (nbytes >= 0) + return (size_t) nbytes; + if (zmq_errno () == EAGAIN) + return 0; + throw error_t (); + } + + inline bool send (message_t &msg_, int flags_ = 0) + { + int nbytes = zmq_msg_send (&(msg_.msg), ptr, flags_); + if (nbytes >= 0) + return true; + if (zmq_errno () == EAGAIN) + return false; + throw error_t (); + } + + template bool send(I first, I last, int flags_=0) + { + zmq::message_t msg(first, last); + return send(msg, flags_); + } + +#ifdef ZMQ_HAS_RVALUE_REFS + inline bool send (message_t &&msg_, int flags_ = 0) + { + return send(msg_, flags_); + } +#endif + + inline size_t recv (void *buf_, size_t len_, int flags_ = 0) + { + int nbytes = zmq_recv (ptr, buf_, len_, flags_); + if (nbytes >= 0) + return (size_t) nbytes; + if (zmq_errno () == EAGAIN) + return 0; + throw error_t (); + } + + inline bool recv (message_t *msg_, int flags_ = 0) + { + int nbytes = zmq_msg_recv (&(msg_->msg), ptr, flags_); + if (nbytes >= 0) + return true; + if (zmq_errno () == EAGAIN) + return false; + throw error_t (); + } + + private: + inline void init(context_t& context_, int type_) + { + ctxptr = context_.ptr; + ptr = zmq_socket (context_.ptr, type_ ); + if (ptr == NULL) + throw error_t (); + } + + void *ptr; + void *ctxptr; + + socket_t (const socket_t&) ZMQ_DELETED_FUNCTION; + void operator = (const socket_t&) ZMQ_DELETED_FUNCTION; + }; + + class monitor_t + { + public: + monitor_t() : socketPtr(NULL) {} + virtual ~monitor_t() {} + + void monitor(socket_t &socket, std::string const& addr, int events = ZMQ_EVENT_ALL) + { + monitor(socket, addr.c_str(), events); + } + + void monitor(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) + { + int rc = zmq_socket_monitor(socket.ptr, addr_, events); + if (rc != 0) + throw error_t (); + + socketPtr = socket.ptr; + void *s = zmq_socket (socket.ctxptr, ZMQ_PAIR); + assert (s); + + rc = zmq_connect (s, addr_); + assert (rc == 0); + + on_monitor_started(); + + while (true) { + zmq_msg_t eventMsg; + zmq_msg_init (&eventMsg); + rc = zmq_msg_recv (&eventMsg, s, 0); + if (rc == -1 && zmq_errno() == ETERM) + break; + assert (rc != -1); +#if ZMQ_VERSION_MAJOR >= 4 + const char* data = static_cast(zmq_msg_data(&eventMsg)); + zmq_event_t msgEvent; + memcpy(&msgEvent.event, data, sizeof(uint16_t)); data += sizeof(uint16_t); + memcpy(&msgEvent.value, data, sizeof(int32_t)); + zmq_event_t* event = &msgEvent; +#else + zmq_event_t* event = static_cast(zmq_msg_data(&eventMsg)); +#endif + +#ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT + zmq_msg_t addrMsg; + zmq_msg_init (&addrMsg); + rc = zmq_msg_recv (&addrMsg, s, 0); + if (rc == -1 && zmq_errno() == ETERM) + break; + assert (rc != -1); + const char* str = static_cast(zmq_msg_data (&addrMsg)); + std::string address(str, str + zmq_msg_size(&addrMsg)); + zmq_msg_close (&addrMsg); +#else + // Bit of a hack, but all events in the zmq_event_t union have the same layout so this will work for all event types. + std::string address = event->data.connected.addr; +#endif + +#ifdef ZMQ_EVENT_MONITOR_STOPPED + if (event->event == ZMQ_EVENT_MONITOR_STOPPED) + break; +#endif + + switch (event->event) { + case ZMQ_EVENT_CONNECTED: + on_event_connected(*event, address.c_str()); + break; + case ZMQ_EVENT_CONNECT_DELAYED: + on_event_connect_delayed(*event, address.c_str()); + break; + case ZMQ_EVENT_CONNECT_RETRIED: + on_event_connect_retried(*event, address.c_str()); + break; + case ZMQ_EVENT_LISTENING: + on_event_listening(*event, address.c_str()); + break; + case ZMQ_EVENT_BIND_FAILED: + on_event_bind_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_ACCEPTED: + on_event_accepted(*event, address.c_str()); + break; + case ZMQ_EVENT_ACCEPT_FAILED: + on_event_accept_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_CLOSED: + on_event_closed(*event, address.c_str()); + break; + case ZMQ_EVENT_CLOSE_FAILED: + on_event_close_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_DISCONNECTED: + on_event_disconnected(*event, address.c_str()); + break; + default: + on_event_unknown(*event, address.c_str()); + break; + } + zmq_msg_close (&eventMsg); + } + zmq_close (s); + socketPtr = NULL; + } + +#ifdef ZMQ_EVENT_MONITOR_STOPPED + void abort() + { + if (socketPtr) + zmq_socket_monitor(socketPtr, NULL, 0); + } +#endif + virtual void on_monitor_started() {} + virtual void on_event_connected(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_connect_delayed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_connect_retried(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_listening(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_bind_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_accepted(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_accept_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_closed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_close_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_disconnected(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_unknown(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + private: + void* socketPtr; + }; +} + +#endif diff --git a/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.exp b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.exp new file mode 100644 index 00000000..43c5f958 Binary files /dev/null and b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.exp differ diff --git a/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.ilk b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.ilk new file mode 100644 index 00000000..7ca63e25 Binary files /dev/null and b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.ilk differ diff --git a/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.lib b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.lib new file mode 100644 index 00000000..db2f2e7a Binary files /dev/null and b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.lib differ diff --git a/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.mll b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.mll new file mode 100644 index 00000000..773952f7 Binary files /dev/null and b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.mll differ diff --git a/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.pdb b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.pdb new file mode 100644 index 00000000..9f818cd0 Binary files /dev/null and b/tools/mayaPluginRTT/x64/Debug/mayaPluginRTT.pdb differ