beginning node integration
This commit is contained in:
parent
10626ad3df
commit
7ea4275e31
2553 changed files with 391925 additions and 0 deletions
27
node_modules/osc/.jshintrc
generated
vendored
Normal file
27
node_modules/osc/.jshintrc
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"white": true,
|
||||
"newcap": true,
|
||||
"regexp": true,
|
||||
"browser": true,
|
||||
"forin": false,
|
||||
"nomen": true,
|
||||
"bitwise": false,
|
||||
"maxerr": 100,
|
||||
"indent": 4,
|
||||
"plusplus": false,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"freeze": true,
|
||||
"latedef": true,
|
||||
"noarg": true,
|
||||
"nonew": true,
|
||||
"quotmark": "double",
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"strict": true,
|
||||
"asi": false,
|
||||
"boss": false,
|
||||
"evil": false,
|
||||
"expr": false,
|
||||
"funcscope": false
|
||||
}
|
||||
2
node_modules/osc/.npmignore
generated
vendored
Normal file
2
node_modules/osc/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
bower_components
|
||||
278
node_modules/osc/GPL-LICENSE.txt
generated
vendored
Normal file
278
node_modules/osc/GPL-LICENSE.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
124
node_modules/osc/Gruntfile.js
generated
vendored
Normal file
124
node_modules/osc/Gruntfile.js
generated
vendored
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* osc.js: An Open Sound Control library for JavaScript that works in both the browser and Node.js
|
||||
*
|
||||
* Grunt Build File
|
||||
*
|
||||
* Copyright 2014-2015, Colin Clark
|
||||
* Licensed under the MIT and GPL 3 licenses.
|
||||
*/
|
||||
|
||||
/*global module*/
|
||||
/*jshint strict:false*/
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
var files = {
|
||||
moduleDeps: [
|
||||
"bower_components/long/dist/Long.js",
|
||||
"bower_components/slip.js/src/slip.js",
|
||||
"bower_components/eventEmitter/EventEmitter.js"
|
||||
],
|
||||
|
||||
osc: [
|
||||
"src/osc.js"
|
||||
],
|
||||
|
||||
oscWeb: [
|
||||
"src/osc-transports.js",
|
||||
"src/platforms/osc-browser.js"
|
||||
],
|
||||
|
||||
oscChrome: [
|
||||
"src/platforms/osc-chromeapp.js"
|
||||
],
|
||||
|
||||
moduleHeader: [
|
||||
"build-support/js/module-header.js"
|
||||
],
|
||||
|
||||
moduleFooter: [
|
||||
"build-support/js/module-footer.js"
|
||||
]
|
||||
};
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON("package.json"),
|
||||
|
||||
jshint: {
|
||||
all: ["src/*.js", "tests/**/*.js", "!**/third-party/**"],
|
||||
options: {
|
||||
jshintrc: true
|
||||
}
|
||||
},
|
||||
|
||||
concat: {
|
||||
options: {
|
||||
separator: ";",
|
||||
banner: "<%= oscjs.banners.short %>"
|
||||
},
|
||||
|
||||
base: {
|
||||
src: [].concat(files.osc),
|
||||
dest: "dist/<%= pkg.name %>.js"
|
||||
},
|
||||
|
||||
browser: {
|
||||
src: [].concat(files.osc, files.moduleDeps, files.oscWeb),
|
||||
dest: "dist/<%= pkg.name %>-browser.js"
|
||||
},
|
||||
|
||||
chromeapp: {
|
||||
src: [].concat(files.osc, files.moduleDeps, files.oscWeb, files.oscChrome),
|
||||
dest: "dist/<%= pkg.name %>-chromeapp.js"
|
||||
},
|
||||
|
||||
module: {
|
||||
src: [].concat(files.moduleHeader, files.osc, files.oscWeb, files.moduleFooter),
|
||||
dest: "dist/<%= pkg.name %>-module.js"
|
||||
}
|
||||
},
|
||||
|
||||
uglify: {
|
||||
options: {
|
||||
banner: "<%= oscjs.banners.short %>",
|
||||
beautify: {
|
||||
ascii_only: true
|
||||
}
|
||||
},
|
||||
all: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: "dist/",
|
||||
src: ["*.js"],
|
||||
dest: "dist/",
|
||||
ext: ".min.js",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
clean: {
|
||||
all: {
|
||||
src: ["dist/"]
|
||||
}
|
||||
},
|
||||
|
||||
oscjs: {
|
||||
banners: {
|
||||
short: "/*! osc.js <%= pkg.version %>, " +
|
||||
"Copyright <%= grunt.template.today('yyyy') %> Colin Clark | " +
|
||||
"github.com/colinbdclark/osc.js */\n\n"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Load relevant Grunt plugins.
|
||||
grunt.loadNpmTasks("grunt-contrib-concat");
|
||||
grunt.loadNpmTasks("grunt-contrib-uglify");
|
||||
grunt.loadNpmTasks("grunt-contrib-clean");
|
||||
grunt.loadNpmTasks("grunt-contrib-jshint");
|
||||
grunt.loadNpmTasks("grunt-gpii");
|
||||
|
||||
grunt.registerTask("default", ["clean", "jshint", "concat", "uglify"]);
|
||||
};
|
||||
20
node_modules/osc/MIT-LICENSE.txt
generated
vendored
Normal file
20
node_modules/osc/MIT-LICENSE.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Copyright (c) 2011-2014 Colin Clark
|
||||
|
||||
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.
|
||||
513
node_modules/osc/README.md
generated
vendored
Normal file
513
node_modules/osc/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,513 @@
|
|||
osc.js
|
||||
======
|
||||
|
||||
osc.js is a library for reading and writing [Open Sound Control](http://opensoundcontrol.org) messages in JavaScript. It works in both Node.js and in a web browser.
|
||||
|
||||
Why osc.js?
|
||||
-----------
|
||||
|
||||
There are several other OSC libraries available for JavaScript. However, most depend on Node.js-specific APIs. This means that they can't be run in a browser or on web-only platforms such as Chrome OS. osc.js uses only cross-platform APIs (`TypedArrays` and `DataView`), ensuring that it can run in any modern JavaScript environment.
|
||||
|
||||
osc.js is fast, comprehensive, fully spec-compliant, tested, modular, and provides a wide variety of optional transports for sending and receiving OSC data.
|
||||
|
||||
What Does it Do?
|
||||
----------------
|
||||
|
||||
osc.js reads and writes OSC-formatted binary data into plain JavaScript objects. It provides adaptors for Node.js Buffer objects as well as standard ArrayBuffers.
|
||||
|
||||
The core of osc.js is transport agnostic. You can receive OSC data in whatever manner works best for your application: serial port APIs such as node-serialport or chrome.serial, socket APIs such as Node.js dgram or WebRTC data channels, WebSockets or binary XHR messages should all work. Connect osc.js up to your source of incoming/outgoing data, and you're all set. This approach is consistent with the design of Open Sound Control as a _content format_ that is independent from its means of transport.
|
||||
|
||||
In addition to the low-level encoder/decoder functions, osc.js also provides a comprehensive set of transport objects, called <code>Port</code>s, for use in standard browsers, Chrome Apps, and Node.js applications. These include:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Transport</th>
|
||||
<th>Supported Platforms</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UDP</td>
|
||||
<td>Node.js, Chrome Apps</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Serial port</td>
|
||||
<td>Node.js, Chrome Apps</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Web Sockets</td>
|
||||
<td>Browsers, Node.js, Chrome Apps</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TCP</td>
|
||||
<td>Node.js</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
For stream-based protocols such as serial and TCP, osc.js will take care of SLIP framing for you.
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
osc.js supports all OSC 1.0 and 1.1 required and optional types.
|
||||
|
||||
How it Works
|
||||
------------
|
||||
|
||||
osc.js consists of two distinct layers:
|
||||
|
||||
1. The transports, which provide a simple EventEmitter-style API for sending an receiving OSC packets using a variety of transports such as UDP and Web Sockets.
|
||||
2. The underlying stateless API that provides functions for reading and writing OSC packets.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
In-depth example osc.js applications for the browser, Node.js, and Chrome OS are available in the [osc.js examples repository](https://github.com/colinbdclark/osc.js-examples).
|
||||
|
||||
### Web Sockets in the Browser
|
||||
|
||||
The <code>osc.WebSocketPort</code> object supports sending and receiving
|
||||
OSC messages over Web Sockets.
|
||||
|
||||
#### Options
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Description</th>
|
||||
<th>Default Value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>url</td>
|
||||
<td>The Web Socket URL to connect to (required for clients)</td>
|
||||
<td>none</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
#### Sample Code
|
||||
|
||||
##### Including osc.js in your HTML page:
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>osc.js Web Sockets</title>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="bower_components/osc.js/dist/osc-browser.min.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
```
|
||||
|
||||
##### Creating an OSC Web Socket Port object:
|
||||
```javascript
|
||||
var oscPort = new osc.WebSocketPort({
|
||||
url: "ws://localhost:8081" // URL to your Web Socket server.
|
||||
});
|
||||
```
|
||||
|
||||
##### Listening for incoming OSC messages:
|
||||
```javascript
|
||||
oscPort.on("message", function (oscMsg) {
|
||||
console.log("An OSC message just arrived!", oscMsg);
|
||||
});
|
||||
```
|
||||
|
||||
##### Sending OSC messages:
|
||||
```javascript
|
||||
oscPort.send({
|
||||
address: "/carrier/frequency",
|
||||
args: 440
|
||||
});
|
||||
```
|
||||
|
||||
##### Sending OSC bundles:
|
||||
```javascript
|
||||
oscPort.send({
|
||||
timeTag: osc.timeTag(60), // Schedules this bundle 60 seconds from now.
|
||||
packets: [
|
||||
{
|
||||
address: "/carrier/frequency",
|
||||
args: 440
|
||||
},
|
||||
{
|
||||
address: "/carrier/amplitude"
|
||||
args: 0.5
|
||||
}
|
||||
]
|
||||
});
|
||||
```
|
||||
|
||||
##### Using osc.js with Require.js
|
||||
```javascript
|
||||
// Define your module paths, including osc.js' dependencies.
|
||||
// Note: these paths must resolve to wherever you have placed
|
||||
// osc.js, slip.js, and eventEmitter in your project.
|
||||
require.config({
|
||||
paths: {
|
||||
slip: "../bower_components/slip.js/dist/slip.min",
|
||||
EventEmitter: "../bower_components/eventEmitter/EventEmitter.min",
|
||||
long: "../bower_components/long/dist/Long.min",
|
||||
osc: "../bower_components/osc.js/osc-module.min"
|
||||
}
|
||||
});
|
||||
|
||||
// Load it asynchronously.
|
||||
require(["osc"], function (osc) {
|
||||
// Do something with osc.js when it has fully loaded.
|
||||
});
|
||||
```
|
||||
|
||||
### Web Sockets in Node.js
|
||||
|
||||
The <code>osc.WebSocketPort</code> object supports sending and receiving
|
||||
OSC messages over Web Sockets.
|
||||
|
||||
#### Options
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Description</th>
|
||||
<th>Default Value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>url</td>
|
||||
<td>The Web Socket URL to connect to (required for clients)</td>
|
||||
<td>none</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>socket</td>
|
||||
<td>A Web Socket instance to bind to (required for servers)</td>
|
||||
<td>none</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
#### Sample Code
|
||||
|
||||
```javascript
|
||||
var osc = require("osc"),
|
||||
http = require("http"),
|
||||
WebSocket = require("ws");
|
||||
|
||||
// Create an Express server app
|
||||
// and serve up a directory of static files.
|
||||
var app = require("express").express(),
|
||||
server = app.listen(8081);
|
||||
app.use("/", express.static(__dirname + "/static"));
|
||||
|
||||
// Listen for Web Socket requests.
|
||||
var wss = new WebSocket.Server({
|
||||
server: server
|
||||
});
|
||||
|
||||
// Listen for Web Socket connections.
|
||||
wss.on("connection", function (socket) {
|
||||
var socketPort = new osc.WebSocketPort({
|
||||
socket: socket
|
||||
});
|
||||
|
||||
socketPort.on("message", function (oscMsg) {
|
||||
console.log("An OSC Message was received!", oscMsg);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### UDP in Node.js
|
||||
|
||||
The <code>osc.UDPPort</code> object supports the sending and receiving of
|
||||
OSC messages over Node.js's UDP sockets. It also supports multicast UDP.
|
||||
|
||||
#### Options
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Description</th>
|
||||
<th>Default Value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>localPort</td>
|
||||
<td>The port to listen on (required for UDP servers)</td>
|
||||
<td>57121</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>localAddress</td>
|
||||
<td>The local address to bind to; will be ignored in the case of multicast UDP (required for UDP servers)</td>
|
||||
<td>"127.0.0.1"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>remotePort</td>
|
||||
<td>The remote port to send messages to (optional)</td>
|
||||
<td>none</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>remoteAddress</td>
|
||||
<td>The remote address to send messages to (optional)</td>
|
||||
<td>none</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>multicast</td>
|
||||
<td>A flag determining whether to use multicast mode</td>
|
||||
<td>false</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>multicastTTL</td>
|
||||
<td>The time to live (number of hops) fora multicast connection</td>
|
||||
<td>none</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
#### Sample Code
|
||||
|
||||
```javascript
|
||||
// Create an osc.js UDP Port listening on port 57121.
|
||||
var udpPort = new osc.UDPPort({
|
||||
localAddress: "0.0.0.0",
|
||||
localPort: 57121
|
||||
});
|
||||
|
||||
// Listen for incoming OSC bundles.
|
||||
udpPort.on("bundle", function (oscBundle) {
|
||||
console.log("An OSC bundle just arrived!", oscBundle);
|
||||
});
|
||||
|
||||
// Open the socket.
|
||||
udpPort.open();
|
||||
|
||||
// Send an OSC message to, say, SuperCollider
|
||||
udpPort.send({
|
||||
address: "/s_new",
|
||||
args: ["default", 100]
|
||||
}, "127.0.0.1", 57110);
|
||||
```
|
||||
|
||||
### Serial in a Chrome App
|
||||
|
||||
#### Including osc.js in your Chrome App page
|
||||
```html
|
||||
<script src="../bower_components/osc.js/dist/osc-chromeapp.min.js"></script>
|
||||
```
|
||||
|
||||
#### Defining the appropriate permissions in manifest.json
|
||||
```json
|
||||
{
|
||||
"name": "OSC.js Chrome App Demo",
|
||||
"version": "1",
|
||||
"manifest_version": 2,
|
||||
"permissions": [
|
||||
"serial"
|
||||
],
|
||||
"app": {
|
||||
"background": {
|
||||
"scripts": ["js/launch.js"],
|
||||
"transient": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Connecting to the serial port and listening for OSC messages
|
||||
```javascript
|
||||
// Instantiate a new OSC Serial Port.
|
||||
var serialPort = new osc.SerialPort({
|
||||
devicePath: "/dev/cu.usbmodem22131"
|
||||
});
|
||||
|
||||
// Listen for the message event and map the OSC message to the synth.
|
||||
serialPort.on("message", function (oscMsg) {
|
||||
console.log("An OSC message was received!", oscMsg);
|
||||
});
|
||||
|
||||
// Open the port.
|
||||
serialPort.open();
|
||||
```
|
||||
|
||||
More code examples showing how osc.js can be used in browser-based, Node.js, and Chrome App applications can be found in the [osc.js examples repository](https://github.com/colinbdclark/osc.js-examples).
|
||||
|
||||
The osc.js Low-Level API
|
||||
------------------------
|
||||
|
||||
There are two primary functions in osc.js used to read and write OSC data:
|
||||
|
||||
* ``osc.readPacket()``, which takes a DataView-friendly data buffer (i.e. an ArrayBuffer, TypedArray, DataView, or Node.js Buffer) and returns a tree of JavaScript objects representing the messages and bundles that were read
|
||||
* ``osc.writePacket()``, which takes a message or bundle object and packs it up into a Uint8Array or Buffer object
|
||||
|
||||
Both functions take an optional `withMetadata` parameter, which specifies if the OSC type metadata should be included. By default, type metadata isn't included when reading packets, and is inferred automatically when writing packets.If you need greater precision in regards to the arguments in an OSC message, set the `withMetadata` argument to true.
|
||||
|
||||
### OSC Bundle and Message Objects
|
||||
|
||||
osc.js represents bundles and messages as (mostly) JSON-compatible objects. Here's how they are structured:
|
||||
|
||||
#### Messages
|
||||
OSC Message objects consist of two properties, `address`, which contains the URL-style address path and `args` which is an array of either raw argument values or type-annotated Argument objects (depending on the value of `withMetadata` when reading the message).
|
||||
|
||||
```javascript
|
||||
{
|
||||
address: "/an/osc/address",
|
||||
args: [
|
||||
{} // Raw or type-annotated OSC arguments
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Bundles
|
||||
|
||||
OSC bundle objects consist of a time tag and an array of `packets`. Packets can be a mix of OSC bundle objects and message objects.
|
||||
|
||||
```javascript
|
||||
{
|
||||
timeTag: {
|
||||
// OSC Time Tag object
|
||||
},
|
||||
packets: [
|
||||
{} // Nested OSC bundle and message objects>
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Argument Objects with Type Metadata
|
||||
|
||||
Type-annotated argument objects contain two properties: `type`, which contains the OSC type tag character (e.g. `"i"`, `"f"`, `"t"`, etc.) and the raw `value`.
|
||||
|
||||
```javascript
|
||||
{
|
||||
type: "f", // OSC type tag string
|
||||
value: 444.4
|
||||
}
|
||||
```
|
||||
|
||||
If you are using type-annotated arguments, you should also set the <code>metadata</code> option to <code>true</code> when you instantiate your <code>OSCPort</code> instance (or in the <code>options</code> argument to <code>osc.writeMessage</code> if you're using the low-level API).
|
||||
|
||||
|
||||
#### Time Tags
|
||||
Time tag objects contain two different representations: the raw NTP time and the equivalent (though less precise) native JavaScript timestamp. NTP times consist of a pair of values in an array. The first value represents the number of seconds since January 1, 1900. The second value is a Uint32 value (i.e. between 0 and 4294967296) that represents fractions of a second.
|
||||
|
||||
JavaScript timestamps are represented as milliseconds since January 1, 1970, which is the same unit as is returned by calls to `Date.now()`.
|
||||
|
||||
```javascript
|
||||
{
|
||||
raw: [
|
||||
3608146800, // seconds since January 1, 1900.
|
||||
2147483648 // fractions of a second
|
||||
],
|
||||
native: Number // Milliseconds since January 1, 1970
|
||||
}
|
||||
```
|
||||
#### Colours
|
||||
Colours are automatically normalized to CSS 3 rgba values (i.e. the alpha channel is represented as a float from `0.0` to `1.0`).
|
||||
|
||||
```javascript
|
||||
{
|
||||
r: 255,
|
||||
g: 255,
|
||||
b: 255,
|
||||
a: 1.0
|
||||
}
|
||||
```
|
||||
|
||||
Mapping OSC to JS
|
||||
------------------
|
||||
|
||||
Here are a few examples showing how OSC packets are mapped to plain JavaScript objects by osc.js.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Message</th>
|
||||
<th>Objects</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"/carrier/freq" ",f" 440.4</td>
|
||||
<td><pre><code>{
|
||||
address: "/carrier/freq",
|
||||
args: [440.4]
|
||||
}</pre></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"/float/andArray" ",f[ii]" 440.4 42 47</td>
|
||||
<td><pre><code>{
|
||||
address: "/carrier/freq",
|
||||
args: [
|
||||
440.4, [42, 47]
|
||||
]
|
||||
}</pre></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"/aTimeTag" ",t" 3608146800 2147483648</td>
|
||||
<td><pre><code>{
|
||||
address: "/scheduleAt",
|
||||
args: [
|
||||
{
|
||||
raw: [3608146800, 2147483648],
|
||||
jsTime: 1399158000500
|
||||
}
|
||||
]
|
||||
}</code></pre>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"/blob" ",b" 0x63 0x61 0x74 0x21</td>
|
||||
<td><pre><code>
|
||||
{
|
||||
address: "/blob",
|
||||
args: [
|
||||
Uint8Aray([0x63, 0x61, 0x74, 0x21])
|
||||
]
|
||||
}
|
||||
<tr>
|
||||
<td>"/colour" ",r" "255 255 255 255"</td>
|
||||
<td><pre><code>{
|
||||
address: "/colour",
|
||||
args: [{
|
||||
r: 255,
|
||||
g: 255,
|
||||
b: 255,
|
||||
a: 1.0
|
||||
}
|
||||
]
|
||||
}</pre></code</td>
|
||||
<tr>
|
||||
<td>"/midiMessage" ",m" 0x00 0x90 0x45 0x65</td>
|
||||
<td><pre><code>{
|
||||
address: "/midiMessage",
|
||||
args: [
|
||||
// Port ID, Status, Data 1, Data 2
|
||||
Uint8Array([0, 144, 69, 101])
|
||||
]
|
||||
}</pre></code</td>
|
||||
</table>
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
osc.js is maintained by Colin Clark and distributed under the MIT and GPL 3 licenses.
|
||||
|
||||
Contributing to osc.js
|
||||
----------------------
|
||||
|
||||
Contributions and pull requests to osc.js are hugely appreciated. Wherever possible, all fixes and new features should be accompanied by unit tests to help verify that they work and avoid regressions. When new features are introduced, a pull request to the [osc.js-examples repository](https://github.com/colinbdclark/osc.js-examples) with an example of how to use it is also appreciated.
|
||||
|
||||
Code should follow the style conventions of the project (such as they are), which can be automatically validated using JSHint by running <code>grunt jshint</code>.
|
||||
|
||||
Currently, the project is maintained by one person; sometimes it will take a bit of time to respond, review, and merge contributions. Help with bug triage, code reviews, testing, and examples is also welcome.
|
||||
|
||||
## How to Build and Test Your Contributions
|
||||
|
||||
osc.js depends on npm, bower, and Grunt. Make sure you have these installed, and then run the following commands to fetch all necessary dependencies:
|
||||
|
||||
npm install
|
||||
grunt dedupe-infusion
|
||||
bower install
|
||||
|
||||
To lint and generate builds from new source code:
|
||||
|
||||
grunt
|
||||
|
||||
Running unit tests:
|
||||
|
||||
1. To run the Node.js unit tests, run <code>node tests/node-all-tests.js</code>
|
||||
2. In the browser, open <code>tests/all-tests.html</code>
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* @colinbdclark wrote the core.
|
||||
* @jacoscaz and @xseignard fixed bugs.
|
||||
* @egasmus added support for 64-bit integers.
|
||||
21
node_modules/osc/bower.json
generated
vendored
Normal file
21
node_modules/osc/bower.json
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "osc.js",
|
||||
"version": "1.2.1",
|
||||
"main": "dist/osc.min.js",
|
||||
"ignore": [
|
||||
".jshintrc",
|
||||
"package.json",
|
||||
"bower.json",
|
||||
"Gruntfile.js",
|
||||
"node_modules",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"slip.js": "1.0.2",
|
||||
"eventEmitter": "4.2.11",
|
||||
"long": "2.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"requirejs": ">=2.1.14"
|
||||
}
|
||||
}
|
||||
3
node_modules/osc/build-support/js/module-footer.js
generated
vendored
Normal file
3
node_modules/osc/build-support/js/module-footer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
return osc;
|
||||
}));
|
||||
17
node_modules/osc/build-support/js/module-header.js
generated
vendored
Normal file
17
node_modules/osc/build-support/js/module-header.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// We're in a CommonJS-style loader.
|
||||
root.osc = exports;
|
||||
factory(exports, require("slip"), require("EventEmitter"), require("long"));
|
||||
} else if (typeof define === "function" && define.amd) {
|
||||
// We're in an AMD-style loader.
|
||||
define(["exports", "slip", "EventEmitter", "long"], function (exports, slip, EventEmitter, Long) {
|
||||
root.osc = exports;
|
||||
return (root.osc, factory(exports, slip, EventEmitter, Long));
|
||||
});
|
||||
} else {
|
||||
// Plain old browser.
|
||||
root.osc = {};
|
||||
factory(root.osc, slip, EventEmitter);
|
||||
}
|
||||
}(this, function (exports, slip, EventEmitter, Long) {
|
||||
2913
node_modules/osc/dist/osc-browser.js
generated
vendored
Normal file
2913
node_modules/osc/dist/osc-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
3
node_modules/osc/dist/osc-browser.min.js
generated
vendored
Normal file
3
node_modules/osc/dist/osc-browser.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3079
node_modules/osc/dist/osc-chromeapp.js
generated
vendored
Normal file
3079
node_modules/osc/dist/osc-chromeapp.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
3
node_modules/osc/dist/osc-chromeapp.min.js
generated
vendored
Normal file
3
node_modules/osc/dist/osc-chromeapp.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1318
node_modules/osc/dist/osc-module.js
generated
vendored
Normal file
1318
node_modules/osc/dist/osc-module.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
3
node_modules/osc/dist/osc-module.min.js
generated
vendored
Normal file
3
node_modules/osc/dist/osc-module.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1044
node_modules/osc/dist/osc.js
generated
vendored
Normal file
1044
node_modules/osc/dist/osc.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
3
node_modules/osc/dist/osc.min.js
generated
vendored
Normal file
3
node_modules/osc/dist/osc.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/osc/node_modules/.bin/serialportlist
generated
vendored
Symbolic link
1
node_modules/osc/node_modules/.bin/serialportlist
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../serialport/bin/serialportList.js
|
||||
1
node_modules/osc/node_modules/.bin/serialportterm
generated
vendored
Symbolic link
1
node_modules/osc/node_modules/.bin/serialportterm
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../serialport/bin/serialportTerminal.js
|
||||
15
node_modules/osc/node_modules/buffer-dataview/History.md
generated
vendored
Normal file
15
node_modules/osc/node_modules/buffer-dataview/History.md
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
0.0.2 / 2013-08-16
|
||||
==================
|
||||
|
||||
- Add the V8 test suite for DataView: "v8/test/mjsunit/harmony/dataview-accessors.js"
|
||||
- Refactored test case to use our custom DataView implementation and Node.js Buffer instances
|
||||
- Added bounds checking for the given offset
|
||||
- Added wrapping logic for out-of-range values in the "set*" functions
|
||||
- Added argument checking for when not enough arguments are given
|
||||
- Throw a TypeError if `new` is not used
|
||||
- Coerce `byteOffset` and `byteValue` to ints
|
||||
|
||||
0.0.1 / 2013-08-15
|
||||
==================
|
||||
|
||||
- Initial release
|
||||
73
node_modules/osc/node_modules/buffer-dataview/README.md
generated
vendored
Normal file
73
node_modules/osc/node_modules/buffer-dataview/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
buffer-dataview
|
||||
===============
|
||||
### Minimal DataView implementation that works with Node.js Buffers
|
||||
|
||||
This module provides a very minimal [DataView][] implementation. Node.js already
|
||||
comes with a DataView implementation, but it only works with `ArrayBuffer`
|
||||
instances, and not Node's preferred `Buffer` type. This is mostly useful when
|
||||
re-using previously written code which interacts with `DataView` instances
|
||||
rather than Node.js Buffers.
|
||||
|
||||
The `DataView` instances simply proxy the invoked instance method to the
|
||||
equivalent [Buffer API][] call.
|
||||
|
||||
Note that the `buffer` property of the `DataView` instance is the Node.js `Buffer`
|
||||
instance, and _not_ a converted `ArrayBuffer` or something else like that. There's
|
||||
no copying that happens here, it's just a "view"...
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
``` bash
|
||||
$ npm install buffer-dataview
|
||||
```
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
``` js
|
||||
var DataView = require('buffer-dataview');
|
||||
|
||||
var buffer = new Buffer(4);
|
||||
var view = new DataView(buffer);
|
||||
|
||||
// set a "float" in the data view
|
||||
view.setFloat32(0, 1337.1234, true);
|
||||
|
||||
// ensure that the original Buffer was modified
|
||||
console.log(buffer.readFloatLE(0));
|
||||
// → 1337.1234130859375
|
||||
```
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 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.
|
||||
|
||||
[DataView]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays/DataView
|
||||
[Buffer API]: http://nodejs.org/docs/latest/api/buffer.html
|
||||
257
node_modules/osc/node_modules/buffer-dataview/dataview.js
generated
vendored
Normal file
257
node_modules/osc/node_modules/buffer-dataview/dataview.js
generated
vendored
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = DataView;
|
||||
|
||||
/**
|
||||
* Very minimal `DataView` implementation that wraps (doesn't *copy*)
|
||||
* Node.js Buffer instances.
|
||||
*
|
||||
* Spec: http://www.khronos.org/registry/typedarray/specs/latest/#8
|
||||
* MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays/DataView
|
||||
*
|
||||
* @param {Buffer} buffer
|
||||
* @param {Number} byteOffset (optional)
|
||||
* @param {Number} byteLength (optional)
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function DataView (buffer, byteOffset, byteLength) {
|
||||
if (!(this instanceof DataView)) throw new TypeError('Constructor DataView requires \'new\'');
|
||||
if (!buffer || null == buffer.length) throw new TypeError('First argument to DataView constructor must be a Buffer');
|
||||
if (null == byteOffset) byteOffset = 0;
|
||||
if (null == byteLength) byteLength = buffer.length;
|
||||
this.buffer = buffer;
|
||||
this.byteOffset = byteOffset | 0;
|
||||
this.byteLength = byteLength | 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Get" functions.
|
||||
*/
|
||||
|
||||
DataView.prototype.getInt8 = function (byteOffset) {
|
||||
if (arguments.length < 1) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
return this.buffer.readInt8(offset);
|
||||
};
|
||||
|
||||
DataView.prototype.getUint8 = function (byteOffset) {
|
||||
if (arguments.length < 1) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
return this.buffer.readUInt8(offset);
|
||||
};
|
||||
|
||||
DataView.prototype.getInt16 = function (byteOffset, littleEndian) {
|
||||
if (arguments.length < 1) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
if (littleEndian) {
|
||||
return this.buffer.readInt16LE(offset);
|
||||
} else {
|
||||
return this.buffer.readInt16BE(offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.getUint16 = function (byteOffset, littleEndian) {
|
||||
if (arguments.length < 1) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
if (littleEndian) {
|
||||
return this.buffer.readUInt16LE(offset);
|
||||
} else {
|
||||
return this.buffer.readUInt16BE(offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.getInt32 = function (byteOffset, littleEndian) {
|
||||
if (arguments.length < 1) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
if (littleEndian) {
|
||||
return this.buffer.readInt32LE(offset);
|
||||
} else {
|
||||
return this.buffer.readInt32BE(offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.getUint32 = function (byteOffset, littleEndian) {
|
||||
if (arguments.length < 1) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
if (littleEndian) {
|
||||
return this.buffer.readUInt32LE(offset);
|
||||
} else {
|
||||
return this.buffer.readUInt32BE(offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.getFloat32 = function (byteOffset, littleEndian) {
|
||||
if (arguments.length < 1) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
if (littleEndian) {
|
||||
return this.buffer.readFloatLE(offset);
|
||||
} else {
|
||||
return this.buffer.readFloatBE(offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.getFloat64 = function (byteOffset, littleEndian) {
|
||||
if (arguments.length < 1) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
if (littleEndian) {
|
||||
return this.buffer.readDoubleLE(offset);
|
||||
} else {
|
||||
return this.buffer.readDoubleBE(offset);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* "Set" functions.
|
||||
*/
|
||||
|
||||
DataView.prototype.setInt8 = function (byteOffset, value) {
|
||||
if (arguments.length < 2) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
// wrap the `value` from -128 to 128
|
||||
value = ((value + 128) & 255) - 128;
|
||||
this.buffer.writeInt8(value, offset);
|
||||
};
|
||||
|
||||
DataView.prototype.setUint8 = function (byteOffset, value) {
|
||||
if (arguments.length < 2) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
// wrap the `value` from 0 to 255
|
||||
value = value & 255;
|
||||
this.buffer.writeUInt8(value, offset);
|
||||
};
|
||||
|
||||
DataView.prototype.setInt16 = function (byteOffset, value, littleEndian) {
|
||||
if (arguments.length < 2) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
// wrap the `value` from -32768 to 32768
|
||||
value = ((value + 32768) & 65535) - 32768;
|
||||
if (littleEndian) {
|
||||
this.buffer.writeInt16LE(value, offset);
|
||||
} else {
|
||||
this.buffer.writeInt16BE(value, offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.setUint16 = function (byteOffset, value, littleEndian) {
|
||||
if (arguments.length < 2) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
// wrap the `value` from 0 to 65535
|
||||
value = value & 65535;
|
||||
if (littleEndian) {
|
||||
this.buffer.writeUInt16LE(value, offset);
|
||||
} else {
|
||||
this.buffer.writeUInt16BE(value, offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.setInt32 = function (byteOffset, value, littleEndian) {
|
||||
if (arguments.length < 2) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
// wrap the `value` from -2147483648 to 2147483648
|
||||
value |= 0;
|
||||
if (littleEndian) {
|
||||
this.buffer.writeInt32LE(value, offset);
|
||||
} else {
|
||||
this.buffer.writeInt32BE(value, offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.setUint32 = function (byteOffset, value, littleEndian) {
|
||||
if (arguments.length < 2) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
// wrap the `value` from 0 to 4294967295
|
||||
value = value >>> 0;
|
||||
if (littleEndian) {
|
||||
this.buffer.writeUInt32LE(value, offset);
|
||||
} else {
|
||||
this.buffer.writeUInt32BE(value, offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.setFloat32 = function (byteOffset, value, littleEndian) {
|
||||
if (arguments.length < 2) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
if (littleEndian) {
|
||||
this.buffer.writeFloatLE(value, offset);
|
||||
} else {
|
||||
this.buffer.writeFloatBE(value, offset);
|
||||
}
|
||||
};
|
||||
|
||||
DataView.prototype.setFloat64 = function (byteOffset, value, littleEndian) {
|
||||
if (arguments.length < 2) throw new TypeError('invalid_argument');
|
||||
var offset = this.byteOffset + (byteOffset | 0);
|
||||
var max = this.byteOffset + this.byteLength - 1;
|
||||
if (offset < this.byteOffset || offset > max) {
|
||||
throw new RangeError('Offset is outside the bounds of the DataView');
|
||||
}
|
||||
if (littleEndian) {
|
||||
this.buffer.writeDoubleLE(value, offset);
|
||||
} else {
|
||||
this.buffer.writeDoubleBE(value, offset);
|
||||
}
|
||||
};
|
||||
51
node_modules/osc/node_modules/buffer-dataview/package.json
generated
vendored
Normal file
51
node_modules/osc/node_modules/buffer-dataview/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "buffer-dataview",
|
||||
"version": "0.0.2",
|
||||
"description": "Minimal DataView implementation that works with Node.js Buffers",
|
||||
"main": "dataview.js",
|
||||
"scripts": {
|
||||
"test": "node test/dataview-accessors.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TooTallNate/node-buffer-dataview.git"
|
||||
},
|
||||
"keywords": [
|
||||
"node",
|
||||
"buffer",
|
||||
"data",
|
||||
"view",
|
||||
"dataview"
|
||||
],
|
||||
"author": {
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://n8.io/"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/TooTallNate/node-buffer-dataview/issues"
|
||||
},
|
||||
"readme": "buffer-dataview\n===============\n### Minimal DataView implementation that works with Node.js Buffers\n\nThis module provides a very minimal [DataView][] implementation. Node.js already\ncomes with a DataView implementation, but it only works with `ArrayBuffer`\ninstances, and not Node's preferred `Buffer` type. This is mostly useful when\nre-using previously written code which interacts with `DataView` instances\nrather than Node.js Buffers.\n\nThe `DataView` instances simply proxy the invoked instance method to the\nequivalent [Buffer API][] call.\n\nNote that the `buffer` property of the `DataView` instance is the Node.js `Buffer`\ninstance, and _not_ a converted `ArrayBuffer` or something else like that. There's\nno copying that happens here, it's just a \"view\"...\n\nInstallation\n------------\n\nInstall with `npm`:\n\n``` bash\n$ npm install buffer-dataview\n```\n\n\nExample\n-------\n\n``` js\nvar DataView = require('buffer-dataview');\n\nvar buffer = new Buffer(4);\nvar view = new DataView(buffer);\n\n// set a \"float\" in the data view\nview.setFloat32(0, 1337.1234, true);\n\n// ensure that the original Buffer was modified\nconsole.log(buffer.readFloatLE(0));\n// → 1337.1234130859375\n```\n\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[DataView]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays/DataView\n[Buffer API]: http://nodejs.org/docs/latest/api/buffer.html\n",
|
||||
"readmeFilename": "README.md",
|
||||
"_id": "buffer-dataview@0.0.2",
|
||||
"dist": {
|
||||
"shasum": "f2be7ee29ac2443ff3706ddef746c75cfe6507e1",
|
||||
"tarball": "http://registry.npmjs.org/buffer-dataview/-/buffer-dataview-0.0.2.tgz"
|
||||
},
|
||||
"_from": "buffer-dataview@0.0.2",
|
||||
"_npmVersion": "1.3.6",
|
||||
"_npmUser": {
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "f2be7ee29ac2443ff3706ddef746c75cfe6507e1",
|
||||
"_resolved": "https://registry.npmjs.org/buffer-dataview/-/buffer-dataview-0.0.2.tgz"
|
||||
}
|
||||
456
node_modules/osc/node_modules/buffer-dataview/test/dataview-accessors.js
generated
vendored
Normal file
456
node_modules/osc/node_modules/buffer-dataview/test/dataview-accessors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,456 @@
|
|||
// Copyright 2013 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// These tests are adapted from Khronos DataView tests
|
||||
|
||||
var assert = require('assert');
|
||||
var assertThrows = assert.throws;
|
||||
var assertSame = assert.equal;
|
||||
|
||||
// load our custom NodeDataView
|
||||
var DataView = require('../');
|
||||
|
||||
var intArray1 =
|
||||
[0, 1, 2, 3, 100, 101, 102, 103, 128, 129, 130, 131, 252, 253, 254, 255];
|
||||
var intArray2 =
|
||||
[31, 32, 33, 0, 1, 2, 3, 100, 101, 102, 103, 128, 129, 130, 131, 252,
|
||||
253, 254, 255];
|
||||
var initialArray =
|
||||
[204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204,
|
||||
204, 204, 204];
|
||||
|
||||
var arayBuffer = null;
|
||||
var view = null;
|
||||
var viewStart = 0;
|
||||
var viewLength = 0;
|
||||
|
||||
function getElementSize(func) {
|
||||
switch (func) {
|
||||
case "Int8":
|
||||
case "Uint8":
|
||||
return 1;
|
||||
case "Int16":
|
||||
case "Uint16":
|
||||
return 2;
|
||||
case "Int32":
|
||||
case "Uint32":
|
||||
case "Float32":
|
||||
return 4;
|
||||
case "Float64":
|
||||
return 8;
|
||||
default:
|
||||
assertUnreachable(func);
|
||||
}
|
||||
}
|
||||
|
||||
function checkGet(func, index, expected, littleEndian) {
|
||||
function doGet() {
|
||||
if (littleEndian != undefined)
|
||||
return view["get" + func](index, littleEndian);
|
||||
else
|
||||
return view["get" + func](index);
|
||||
}
|
||||
if (index >=0 && index + getElementSize(func) - 1 < view.byteLength)
|
||||
assertSame(expected, doGet());
|
||||
else
|
||||
assertThrows(doGet, RangeError);
|
||||
}
|
||||
|
||||
function checkSet(func, index, value, littleEndian) {
|
||||
function doSet() {
|
||||
if (littleEndian != undefined)
|
||||
view["set" + func](index, value, littleEndian);
|
||||
else
|
||||
view["set" + func](index, value);
|
||||
}
|
||||
if (index >= 0 &&
|
||||
index + getElementSize(func) - 1 < view.byteLength) {
|
||||
assertSame(undefined, doSet());
|
||||
checkGet(func, index, value, littleEndian);
|
||||
} else {
|
||||
assertThrows(doSet, RangeError);
|
||||
}
|
||||
}
|
||||
|
||||
function test(isTestingGet, func, index, value, littleEndian) {
|
||||
if (isTestingGet)
|
||||
checkGet(func, index, value, littleEndian);
|
||||
else
|
||||
checkSet(func, index, value, littleEndian);
|
||||
}
|
||||
|
||||
function createDataView(
|
||||
array, frontPaddingNum, littleEndian, start, length) {
|
||||
if (!littleEndian)
|
||||
array.reverse();
|
||||
var paddingArray = new Array(frontPaddingNum);
|
||||
arrayBuffer = new Buffer(paddingArray.concat(array));
|
||||
view = new DataView(arrayBuffer, viewStart, viewLength);
|
||||
if (!littleEndian)
|
||||
array.reverse(); // restore the array.
|
||||
}
|
||||
|
||||
function runIntegerTestCases(isTestingGet, array, start, length) {
|
||||
createDataView(array, 0, true, start, length);
|
||||
|
||||
test(isTestingGet, "Int8", 0, 0);
|
||||
test(isTestingGet, "Int8", undefined, 0);
|
||||
test(isTestingGet, "Int8", 8, -128);
|
||||
test(isTestingGet, "Int8", 15, -1);
|
||||
|
||||
test(isTestingGet, "Uint8", 0, 0);
|
||||
test(isTestingGet, "Uint8", undefined, 0);
|
||||
test(isTestingGet, "Uint8", 8, 128);
|
||||
test(isTestingGet, "Uint8", 15, 255);
|
||||
|
||||
// Little endian.
|
||||
test(isTestingGet, "Int16", 0, 256, true);
|
||||
test(isTestingGet, "Int16", undefined, 256, true);
|
||||
test(isTestingGet, "Int16", 5, 26213, true);
|
||||
test(isTestingGet, "Int16", 9, -32127, true);
|
||||
test(isTestingGet, "Int16", 14, -2, true);
|
||||
|
||||
// Big endian.
|
||||
test(isTestingGet, "Int16", 0, 1);
|
||||
test(isTestingGet, "Int16", undefined, 1);
|
||||
test(isTestingGet, "Int16", 5, 25958);
|
||||
test(isTestingGet, "Int16", 9, -32382);
|
||||
test(isTestingGet, "Int16", 14, -257);
|
||||
|
||||
// Little endian.
|
||||
test(isTestingGet, "Uint16", 0, 256, true);
|
||||
test(isTestingGet, "Uint16", undefined, 256, true);
|
||||
test(isTestingGet, "Uint16", 5, 26213, true);
|
||||
test(isTestingGet, "Uint16", 9, 33409, true);
|
||||
test(isTestingGet, "Uint16", 14, 65534, true);
|
||||
|
||||
// Big endian.
|
||||
test(isTestingGet, "Uint16", 0, 1);
|
||||
test(isTestingGet, "Uint16", undefined, 1);
|
||||
test(isTestingGet, "Uint16", 5, 25958);
|
||||
test(isTestingGet, "Uint16", 9, 33154);
|
||||
test(isTestingGet, "Uint16", 14, 65279);
|
||||
|
||||
// Little endian.
|
||||
test(isTestingGet, "Int32", 0, 50462976, true);
|
||||
test(isTestingGet, "Int32", undefined, 50462976, true);
|
||||
test(isTestingGet, "Int32", 3, 1717920771, true);
|
||||
test(isTestingGet, "Int32", 6, -2122291354, true);
|
||||
test(isTestingGet, "Int32", 9, -58490239, true);
|
||||
test(isTestingGet, "Int32", 12,-66052, true);
|
||||
|
||||
// Big endian.
|
||||
test(isTestingGet, "Int32", 0, 66051);
|
||||
test(isTestingGet, "Int32", undefined, 66051);
|
||||
test(isTestingGet, "Int32", 3, 56911206);
|
||||
test(isTestingGet, "Int32", 6, 1718059137);
|
||||
test(isTestingGet, "Int32", 9, -2122152964);
|
||||
test(isTestingGet, "Int32", 12, -50462977);
|
||||
|
||||
// Little endian.
|
||||
test(isTestingGet, "Uint32", 0, 50462976, true);
|
||||
test(isTestingGet, "Uint32", undefined, 50462976, true);
|
||||
test(isTestingGet, "Uint32", 3, 1717920771, true);
|
||||
test(isTestingGet, "Uint32", 6, 2172675942, true);
|
||||
test(isTestingGet, "Uint32", 9, 4236477057, true);
|
||||
test(isTestingGet, "Uint32", 12,4294901244, true);
|
||||
|
||||
// Big endian.
|
||||
test(isTestingGet, "Uint32", 0, 66051);
|
||||
test(isTestingGet, "Uint32", undefined, 66051);
|
||||
test(isTestingGet, "Uint32", 3, 56911206);
|
||||
test(isTestingGet, "Uint32", 6, 1718059137);
|
||||
test(isTestingGet, "Uint32", 9, 2172814332);
|
||||
test(isTestingGet, "Uint32", 12, 4244504319);
|
||||
}
|
||||
|
||||
function testFloat(isTestingGet, func, array, start, expected) {
|
||||
// Little endian.
|
||||
createDataView(array, 0, true, start);
|
||||
test(isTestingGet, func, 0, expected, true);
|
||||
test(isTestingGet, func, undefined, expected, true);
|
||||
createDataView(array, 3, true, start);
|
||||
test(isTestingGet, func, 3, expected, true);
|
||||
createDataView(array, 7, true, start);
|
||||
test(isTestingGet, func, 7, expected, true);
|
||||
createDataView(array, 10, true, start);
|
||||
test(isTestingGet, func, 10, expected, true);
|
||||
|
||||
// Big endian.
|
||||
createDataView(array, 0, false);
|
||||
test(isTestingGet, func, 0, expected, false);
|
||||
test(isTestingGet, func, undefined, expected, false);
|
||||
createDataView(array, 3, false);
|
||||
test(isTestingGet, func, 3, expected, false);
|
||||
createDataView(array, 7, false);
|
||||
test(isTestingGet, func, 7, expected, false);
|
||||
createDataView(array, 10, false);
|
||||
test(isTestingGet, func, 10, expected, false);
|
||||
}
|
||||
|
||||
function runFloatTestCases(isTestingGet, start) {
|
||||
testFloat(isTestingGet, "Float32",
|
||||
isTestingGet ? [0, 0, 32, 65] : initialArray, start, 10);
|
||||
|
||||
testFloat(isTestingGet, "Float32",
|
||||
isTestingGet ? [164, 112, 157, 63] : initialArray,
|
||||
start, 1.2300000190734863);
|
||||
testFloat(isTestingGet, "Float32",
|
||||
isTestingGet ? [95, 53, 50, 199] : initialArray,
|
||||
start, -45621.37109375);
|
||||
testFloat(isTestingGet, "Float32",
|
||||
isTestingGet ? [255, 255, 255, 127] : initialArray,
|
||||
start, NaN);
|
||||
testFloat(isTestingGet, "Float32",
|
||||
isTestingGet ? [255, 255, 255, 255] : initialArray,
|
||||
start, -NaN);
|
||||
|
||||
testFloat(isTestingGet, "Float64",
|
||||
isTestingGet ? [0, 0, 0, 0, 0, 0, 36, 64] : initialArray,
|
||||
start, 10);
|
||||
testFloat(isTestingGet, "Float64",
|
||||
isTestingGet ? [174, 71, 225, 122, 20, 174, 243, 63] : initialArray,
|
||||
start, 1.23);
|
||||
testFloat(isTestingGet, "Float64",
|
||||
isTestingGet ? [181, 55, 248, 30, 242, 179, 87, 193] : initialArray,
|
||||
start, -6213576.4839);
|
||||
testFloat(isTestingGet, "Float64",
|
||||
isTestingGet ? [255, 255, 255, 255, 255, 255, 255, 127] : initialArray,
|
||||
start, NaN);
|
||||
testFloat(isTestingGet, "Float64",
|
||||
isTestingGet ? [255, 255, 255, 255, 255, 255, 255, 255] : initialArray,
|
||||
start, -NaN);
|
||||
}
|
||||
|
||||
function runNegativeIndexTests(isTestingGet) {
|
||||
createDataView(intArray1, 0, true, 0, 16);
|
||||
|
||||
test(isTestingGet, "Int8", -1, 0);
|
||||
test(isTestingGet, "Int8", -2, 0);
|
||||
|
||||
test(isTestingGet, "Uint8", -1, 0);
|
||||
test(isTestingGet, "Uint8", -2, 0);
|
||||
|
||||
test(isTestingGet, "Int16", -1, 1);
|
||||
test(isTestingGet, "Int16", -2, 1);
|
||||
test(isTestingGet, "Int16", -3, 1);
|
||||
|
||||
test(isTestingGet, "Uint16", -1, 1);
|
||||
test(isTestingGet, "Uint16", -2, 1);
|
||||
test(isTestingGet, "Uint16", -3, 1);
|
||||
|
||||
test(isTestingGet, "Int32", -1, 66051);
|
||||
test(isTestingGet, "Int32", -3, 66051);
|
||||
test(isTestingGet, "Int32", -5, 66051);
|
||||
|
||||
test(isTestingGet, "Uint32", -1, 66051);
|
||||
test(isTestingGet, "Uint32", -3, 66051);
|
||||
test(isTestingGet, "Uint32", -5, 66051);
|
||||
|
||||
createDataView([0, 0, 0, 0, 0, 0, 0, 0], 0, true, 0, 8);
|
||||
|
||||
test(isTestingGet, "Float32", -1, 0);
|
||||
test(isTestingGet, "Float32", -3, 0);
|
||||
test(isTestingGet, "Float32", -5, 0);
|
||||
|
||||
test(isTestingGet, "Float64", -1, 0);
|
||||
test(isTestingGet, "Float64", -5, 0);
|
||||
test(isTestingGet, "Float64", -9, 0);
|
||||
}
|
||||
|
||||
|
||||
function TestGetters() {
|
||||
runIntegerTestCases(true, intArray1, 0, 16);
|
||||
runFloatTestCases(true, 0);
|
||||
|
||||
runIntegerTestCases(true, intArray2, 3, 2);
|
||||
runFloatTestCases(true, 3);
|
||||
|
||||
runNegativeIndexTests(true);
|
||||
}
|
||||
|
||||
function TestSetters() {
|
||||
runIntegerTestCases(false, initialArray, 0, 16);
|
||||
runFloatTestCases(false);
|
||||
|
||||
runIntegerTestCases(false, initialArray, 3, 2);
|
||||
runFloatTestCases(false, 7);
|
||||
|
||||
runNegativeIndexTests(false);
|
||||
}
|
||||
|
||||
TestGetters();
|
||||
TestSetters();
|
||||
|
||||
function CheckOutOfRangeInt8(value, expected) {
|
||||
var view = new DataView(new Buffer(100));
|
||||
assertSame(undefined, view.setInt8(0, value));
|
||||
assertSame(expected, view.getInt8(0));
|
||||
assertSame(undefined, view.setInt8(0, value, true));
|
||||
assertSame(expected, view.getInt8(0, true));
|
||||
}
|
||||
|
||||
function CheckOutOfRangeUint8(value, expected) {
|
||||
var view = new DataView(new Buffer(100));
|
||||
assertSame(undefined, view.setUint8(0, value));
|
||||
assertSame(expected, view.getUint8(0));
|
||||
assertSame(undefined, view.setUint8(0, value, true));
|
||||
assertSame(expected, view.getUint8(0, true));
|
||||
}
|
||||
|
||||
function CheckOutOfRangeInt16(value, expected) {
|
||||
var view = new DataView(new Buffer(100));
|
||||
assertSame(undefined, view.setInt16(0, value));
|
||||
assertSame(expected, view.getInt16(0));
|
||||
assertSame(undefined, view.setInt16(0, value, true));
|
||||
assertSame(expected, view.getInt16(0, true));
|
||||
}
|
||||
|
||||
function CheckOutOfRangeUint16(value, expected) {
|
||||
var view = new DataView(new Buffer(100));
|
||||
assertSame(undefined, view.setUint16(0, value));
|
||||
assertSame(expected, view.getUint16(0));
|
||||
assertSame(undefined, view.setUint16(0, value, true));
|
||||
assertSame(expected, view.getUint16(0, true));
|
||||
}
|
||||
|
||||
function CheckOutOfRangeInt32(value, expected) {
|
||||
var view = new DataView(new Buffer(100));
|
||||
assertSame(undefined, view.setInt32(0, value));
|
||||
assertSame(expected, view.getInt32(0));
|
||||
assertSame(undefined, view.setInt32(0, value, true));
|
||||
assertSame(expected, view.getInt32(0, true));
|
||||
}
|
||||
|
||||
function CheckOutOfRangeUint32(value, expected) {
|
||||
var view = new DataView(new Buffer(100));
|
||||
assertSame(undefined, view.setUint32(0, value));
|
||||
assertSame(expected, view.getUint32(0));
|
||||
assertSame(undefined, view.setUint32(0, value, true));
|
||||
assertSame(expected, view.getUint32(0, true));
|
||||
}
|
||||
|
||||
function TestOutOfRange() {
|
||||
CheckOutOfRangeInt8(0x80, -0x80);
|
||||
CheckOutOfRangeInt8(0x1000, 0);
|
||||
CheckOutOfRangeInt8(-0x81, 0x7F);
|
||||
|
||||
CheckOutOfRangeUint8(0x100, 0);
|
||||
CheckOutOfRangeUint8(0x1000, 0);
|
||||
CheckOutOfRangeUint8(-0x80, 0x80);
|
||||
CheckOutOfRangeUint8(-1, 0xFF);
|
||||
CheckOutOfRangeUint8(-0xFF, 1);
|
||||
|
||||
CheckOutOfRangeInt16(0x8000, -0x8000);
|
||||
CheckOutOfRangeInt16(0x10000, 0);
|
||||
CheckOutOfRangeInt16(-0x8001, 0x7FFF);
|
||||
|
||||
CheckOutOfRangeUint16(0x10000, 0);
|
||||
CheckOutOfRangeUint16(0x100000, 0);
|
||||
CheckOutOfRangeUint16(-0x8000, 0x8000);
|
||||
CheckOutOfRangeUint16(-1, 0xFFFF);
|
||||
CheckOutOfRangeUint16(-0xFFFF, 1);
|
||||
|
||||
CheckOutOfRangeInt32(0x80000000, -0x80000000);
|
||||
CheckOutOfRangeInt32(0x100000000, 0);
|
||||
CheckOutOfRangeInt32(-0x80000001, 0x7FFFFFFF);
|
||||
|
||||
CheckOutOfRangeUint32(0x100000000, 0);
|
||||
CheckOutOfRangeUint32(0x1000000000, 0);
|
||||
CheckOutOfRangeUint32(-0x80000000, 0x80000000);
|
||||
CheckOutOfRangeUint32(-1, 0xFFFFFFFF);
|
||||
CheckOutOfRangeUint32(-0xFFFFFFFF, 1);
|
||||
}
|
||||
|
||||
TestOutOfRange();
|
||||
|
||||
function TestGeneralAccessors() {
|
||||
var a = new DataView(new Buffer(256));
|
||||
function CheckAccessor(name) {
|
||||
var f = a[name];
|
||||
assertThrows(function() { f(); }, TypeError);
|
||||
f.call(a, 0, 0); // should not throw
|
||||
assertThrows(function() { f.call({}, 0, 0); }, TypeError);
|
||||
assertThrows(function() { f.call(a); }, TypeError);
|
||||
if (name.indexOf("set") == 0) {
|
||||
assertThrows(function() { f.call(a, 1); }, TypeError);
|
||||
} else {
|
||||
f.call(a, 1); // should not throw
|
||||
}
|
||||
}
|
||||
CheckAccessor("getUint8");
|
||||
CheckAccessor("setUint8");
|
||||
CheckAccessor("getInt8");
|
||||
CheckAccessor("setInt8");
|
||||
CheckAccessor("getUint16");
|
||||
CheckAccessor("setUint16");
|
||||
CheckAccessor("getInt16");
|
||||
CheckAccessor("setInt16");
|
||||
CheckAccessor("getUint32");
|
||||
CheckAccessor("setUint32");
|
||||
CheckAccessor("getInt32");
|
||||
CheckAccessor("setInt32");
|
||||
CheckAccessor("getFloat32");
|
||||
CheckAccessor("setFloat32");
|
||||
CheckAccessor("getFloat64");
|
||||
CheckAccessor("setFloat64");
|
||||
}
|
||||
|
||||
TestGeneralAccessors();
|
||||
|
||||
function TestInsufficientArguments() {
|
||||
var a = new DataView(new Buffer(256));
|
||||
|
||||
assertThrows(function() { a.getUint8(); }, TypeError);
|
||||
assertThrows(function() { a.getInt8(); }, TypeError);
|
||||
assertThrows(function() { a.getUint16(); }, TypeError);
|
||||
assertThrows(function() { a.getInt16(); }, TypeError);
|
||||
assertThrows(function() { a.getUint32(); }, TypeError);
|
||||
assertThrows(function() { a.getInt32(); }, TypeError);
|
||||
assertThrows(function() { a.getFloat32(); }, TypeError);
|
||||
assertThrows(function() { a.getFloat64(); }, TypeError);
|
||||
|
||||
assertThrows(function() { a.setUint8(); }, TypeError);
|
||||
assertThrows(function() { a.setInt8(); }, TypeError);
|
||||
assertThrows(function() { a.setUint16(); }, TypeError);
|
||||
assertThrows(function() { a.setInt16(); }, TypeError);
|
||||
assertThrows(function() { a.setUint32(); }, TypeError);
|
||||
assertThrows(function() { a.setInt32(); }, TypeError);
|
||||
assertThrows(function() { a.setFloat32(); }, TypeError);
|
||||
assertThrows(function() { a.setFloat64(); }, TypeError);
|
||||
|
||||
assertThrows(function() { a.setUint8(1); }, TypeError);
|
||||
assertThrows(function() { a.setInt8(1); }, TypeError);
|
||||
assertThrows(function() { a.setUint16(1); }, TypeError);
|
||||
assertThrows(function() { a.setInt16(1); }, TypeError);
|
||||
assertThrows(function() { a.setUint32(1); }, TypeError);
|
||||
assertThrows(function() { a.setInt32(1); }, TypeError);
|
||||
assertThrows(function() { a.setFloat32(1); }, TypeError);
|
||||
assertThrows(function() { a.setFloat64(1); }, TypeError);
|
||||
}
|
||||
|
||||
TestInsufficientArguments();
|
||||
3
node_modules/osc/node_modules/long/.npmignore
generated
vendored
Normal file
3
node_modules/osc/node_modules/long/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
node_modules
|
||||
npm-debug.log
|
||||
.idea/
|
||||
5
node_modules/osc/node_modules/long/.travis.yml
generated
vendored
Normal file
5
node_modules/osc/node_modules/long/.travis.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 0.10
|
||||
- 0.12
|
||||
|
||||
202
node_modules/osc/node_modules/long/LICENSE
generated
vendored
Normal file
202
node_modules/osc/node_modules/long/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
BIN
node_modules/osc/node_modules/long/Long.png
generated
vendored
Normal file
BIN
node_modules/osc/node_modules/long/Long.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
513
node_modules/osc/node_modules/long/README.md
generated
vendored
Normal file
513
node_modules/osc/node_modules/long/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,513 @@
|
|||

|
||||
=======
|
||||
A Long class for representing a 64 bit two's-complement integer value derived from the [Closure Library](https://code.google.com/p/closure-library/)
|
||||
for stand-alone use and extended with unsigned support.
|
||||
|
||||
[](https://travis-ci.org/dcodeIO/Long.js)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=info%40code-emitter.com&item_name=Open%20Source%3A%20Long.js)
|
||||
|
||||
Background
|
||||
----------
|
||||
As of [ECMA-262 5th Edition](http://ecma262-5.com/ELS5_HTML.htm#Section_8.5), "all the positive and negative integers
|
||||
whose magnitude is no greater than 2<sup>53</sup> are representable in the Number type", which is "representing the
|
||||
doubleprecision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic".
|
||||
The [maximum safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)
|
||||
in JavaScript is 2<sup>53</sup>-1.
|
||||
|
||||
Example: 2<sup>64</sup>-1 is 18446744073709551615 but in JavaScript it evaluates to `18446744073709552000`.
|
||||
|
||||
Furthermore, bitwise operators in JavaScript "deal only with integers in the range −2<sup>31</sup> through
|
||||
2<sup>31</sup>−1, inclusive, or in the range 0 through 2<sup>32</sup>−1, inclusive. These operators accept any value of
|
||||
the Number type but first convert each such value to one of 2<sup>32</sup> integer values."
|
||||
|
||||
In some use cases, however, it is required to be able to reliably work with and perform bitwise operations on the full
|
||||
64 bits. This is where Long.js comes into play.
|
||||
|
||||
Usage
|
||||
-----
|
||||
The class is compatible with CommonJS and AMD loaders and is exposed globally as `dcodeIO.Long` if neither is available.
|
||||
|
||||
```javascript
|
||||
var Long = require("long");
|
||||
|
||||
var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
|
||||
console.log(longVal.toString());
|
||||
...
|
||||
```
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
#### new Long(low, high=, unsigned=)
|
||||
|
||||
Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
|
||||
See the from* functions below for more convenient ways of constructing Longs.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| low | *number* | The low (signed) 32 bits of the long
|
||||
| high | *number* | The high (signed) 32 bits of the long
|
||||
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
|
||||
|
||||
---
|
||||
|
||||
#### Long.MAX_UNSIGNED_VALUE
|
||||
|
||||
Maximum unsigned value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.MAX_VALUE
|
||||
|
||||
Maximum signed value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.MIN_VALUE
|
||||
|
||||
Minimum signed value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.NEG_ONE
|
||||
|
||||
Signed negative one.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.ONE
|
||||
|
||||
Signed one.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.UONE
|
||||
|
||||
Unsigned one.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.UZERO
|
||||
|
||||
Unsigned zero.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.ZERO
|
||||
|
||||
Signed zero.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.fromBits(lowBits, highBits, unsigned=)
|
||||
|
||||
Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
|
||||
assumed to use 32 bits.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| lowBits | *number* | The low 32 bits
|
||||
| highBits | *number* | The high 32 bits
|
||||
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
|
||||
| **@returns** | *!Long* | The corresponding Long value
|
||||
|
||||
#### Long.fromInt(value, unsigned=)
|
||||
|
||||
Returns a Long representing the given 32 bit integer value.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| value | *number* | The 32 bit integer in question
|
||||
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
|
||||
| **@returns** | *!Long* | The corresponding Long value
|
||||
|
||||
#### Long.fromNumber(value, unsigned=)
|
||||
|
||||
Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| value | *number* | The number in question
|
||||
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
|
||||
| **@returns** | *!Long* | The corresponding Long value
|
||||
|
||||
#### Long.fromString(str, unsigned=, radix=)
|
||||
|
||||
Returns a Long representation of the given string, written using the specified radix.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| str | *string* | The textual representation of the Long
|
||||
| unsigned | *boolean | number* | Whether unsigned or not, defaults to `false` for signed
|
||||
| radix | *number* | The radix in which the text is written (2-36), defaults to 10
|
||||
| **@returns** | *!Long* | The corresponding Long value
|
||||
|
||||
#### Long.isLong(obj)
|
||||
|
||||
Tests if the specified object is a Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| obj | *** | Object
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long.fromValue(val)
|
||||
|
||||
Converts the specified value to a Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| val | *!Long | number | string | !{low: number, high: number, unsigned: boolean}* | Value
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
---
|
||||
|
||||
#### Long#high
|
||||
|
||||
The high 32 bits as a signed value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *number* |
|
||||
|
||||
#### Long#low
|
||||
|
||||
The low 32 bits as a signed value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *number* |
|
||||
|
||||
#### Long#unsigned
|
||||
|
||||
Whether unsigned or not.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *boolean* |
|
||||
|
||||
#### Long#add(addend)
|
||||
|
||||
Returns the sum of this and the specified Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| addend | *!Long | number | string* | Addend
|
||||
| **@returns** | *!Long* | Sum
|
||||
|
||||
#### Long#and(other)
|
||||
|
||||
Returns the bitwise AND of this Long and the specified.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other Long
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
#### Long#compare(other)
|
||||
|
||||
Compares this Long's value with the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *number* | 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
|
||||
|
||||
#### Long#div(divisor)
|
||||
|
||||
Returns this Long divided by the specified.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| divisor | *!Long | number | string* | Divisor
|
||||
| **@returns** | *!Long* | Quotient
|
||||
|
||||
#### Long#equals(other)
|
||||
|
||||
Tests if this Long's value equals the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#getHighBits()
|
||||
|
||||
Gets the high 32 bits as a signed integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* | Signed high bits
|
||||
|
||||
#### Long#getHighBitsUnsigned()
|
||||
|
||||
Gets the high 32 bits as an unsigned integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* | Unsigned high bits
|
||||
|
||||
#### Long#getLowBits()
|
||||
|
||||
Gets the low 32 bits as a signed integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* | Signed low bits
|
||||
|
||||
#### Long#getLowBitsUnsigned()
|
||||
|
||||
Gets the low 32 bits as an unsigned integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* | Unsigned low bits
|
||||
|
||||
#### Long#getNumBitsAbs()
|
||||
|
||||
Gets the number of bits needed to represent the absolute value of this Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* |
|
||||
|
||||
#### Long#greaterThan(other)
|
||||
|
||||
Tests if this Long's value is greater than the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#greaterThanOrEqual(other)
|
||||
|
||||
Tests if this Long's value is greater than or equal the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isEven()
|
||||
|
||||
Tests if this Long's value is even.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isNegative()
|
||||
|
||||
Tests if this Long's value is negative.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isOdd()
|
||||
|
||||
Tests if this Long's value is odd.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isPositive()
|
||||
|
||||
Tests if this Long's value is positive.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isZero()
|
||||
|
||||
Tests if this Long's value equals zero.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#lessThan(other)
|
||||
|
||||
Tests if this Long's value is less than the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#lessThanOrEqual(other)
|
||||
|
||||
Tests if this Long's value is less than or equal the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#modulo(divisor)
|
||||
|
||||
Returns this Long modulo the specified.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| divisor | *!Long | number | string* | Divisor
|
||||
| **@returns** | *!Long* | Remainder
|
||||
|
||||
#### Long#multiply(multiplier)
|
||||
|
||||
Returns the product of this and the specified Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| multiplier | *!Long | number | string* | Multiplier
|
||||
| **@returns** | *!Long* | Product
|
||||
|
||||
#### Long#negate()
|
||||
|
||||
Negates this Long's value.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *!Long* | Negated Long
|
||||
|
||||
#### Long#not()
|
||||
|
||||
Returns the bitwise NOT of this Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
#### Long#notEquals(other)
|
||||
|
||||
Tests if this Long's value differs from the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#or(other)
|
||||
|
||||
Returns the bitwise OR of this Long and the specified.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other Long
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
#### Long#shiftLeft(numBits)
|
||||
|
||||
Returns this Long with bits shifted to the left by the given amount.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| numBits | *number | !Long* | Number of bits
|
||||
| **@returns** | *!Long* | Shifted Long
|
||||
|
||||
#### Long#shiftRight(numBits)
|
||||
|
||||
Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| numBits | *number | !Long* | Number of bits
|
||||
| **@returns** | *!Long* | Shifted Long
|
||||
|
||||
#### Long#shiftRightUnsigned(numBits)
|
||||
|
||||
Returns this Long with bits logically shifted to the right by the given amount.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| numBits | *number | !Long* | Number of bits
|
||||
| **@returns** | *!Long* | Shifted Long
|
||||
|
||||
#### Long#subtract(subtrahend)
|
||||
|
||||
Returns the difference of this and the specified Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| subtrahend | *!Long | number | string* | Subtrahend
|
||||
| **@returns** | *!Long* | Difference
|
||||
|
||||
#### Long#toInt()
|
||||
|
||||
Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* |
|
||||
|
||||
#### Long#toNumber()
|
||||
|
||||
Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* |
|
||||
|
||||
#### Long#toSigned()
|
||||
|
||||
Converts this Long to signed.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *!Long* | Signed long
|
||||
|
||||
#### Long#toString(radix=)
|
||||
|
||||
Converts the Long to a string written in the specified radix.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| radix | *number* | Radix (2-36), defaults to 10
|
||||
| **@returns** | *string* |
|
||||
| **@throws** | *RangeError* | If `radix` is out of range
|
||||
|
||||
#### Long#toUnsigned()
|
||||
|
||||
Converts this Long to unsigned.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *!Long* | Unsigned long
|
||||
|
||||
#### Long#xor(other)
|
||||
|
||||
Returns the bitwise XOR of this Long and the given one.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other Long
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
Downloads
|
||||
---------
|
||||
* [Distributions](https://github.com/dcodeIO/Long.js/tree/master/dist)
|
||||
* [ZIP-Archive](https://github.com/dcodeIO/Long.js/archive/master.zip)
|
||||
* [Tarball](https://github.com/dcodeIO/Long.js/tarball/master)
|
||||
|
||||
License
|
||||
-------
|
||||
Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
9
node_modules/osc/node_modules/long/bower.json
generated
vendored
Normal file
9
node_modules/osc/node_modules/long/bower.json
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "long",
|
||||
"version": "2.2.5",
|
||||
"author": "Daniel Wirtz <dcode@dcode.io>",
|
||||
"description": "A Long class for representing a 64 bit two's-complement integer value.",
|
||||
"main": "dist/Long.js",
|
||||
"keywords": ["math"],
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
944
node_modules/osc/node_modules/long/dist/Long.js
generated
vendored
Normal file
944
node_modules/osc/node_modules/long/dist/Long.js
generated
vendored
Normal file
|
|
@ -0,0 +1,944 @@
|
|||
/*
|
||||
Copyright 2013 Daniel Wirtz <dcode@dcode.io>
|
||||
Copyright 2009 The Closure Library Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
||||
* Released under the Apache License, Version 2.0
|
||||
* see: https://github.com/dcodeIO/Long.js for details
|
||||
*/
|
||||
(function(global) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
|
||||
* See the from* functions below for more convenient ways of constructing Longs.
|
||||
* @exports Long
|
||||
* @class A Long class for representing a 64 bit two's-complement integer value.
|
||||
* @param {number} low The low (signed) 32 bits of the long
|
||||
* @param {number} high The high (signed) 32 bits of the long
|
||||
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @constructor
|
||||
*/
|
||||
var Long = function(low, high, unsigned) {
|
||||
|
||||
/**
|
||||
* The low 32 bits as a signed value.
|
||||
* @type {number}
|
||||
* @expose
|
||||
*/
|
||||
this.low = low|0;
|
||||
|
||||
/**
|
||||
* The high 32 bits as a signed value.
|
||||
* @type {number}
|
||||
* @expose
|
||||
*/
|
||||
this.high = high|0;
|
||||
|
||||
/**
|
||||
* Whether unsigned or not.
|
||||
* @type {boolean}
|
||||
* @expose
|
||||
*/
|
||||
this.unsigned = !!unsigned;
|
||||
};
|
||||
|
||||
// The internal representation of a long is the two given signed, 32-bit values.
|
||||
// We use 32-bit pieces because these are the size of integers on which
|
||||
// Javascript performs bit-operations. For operations like addition and
|
||||
// multiplication, we split each number into 16 bit pieces, which can easily be
|
||||
// multiplied within Javascript's floating-point representation without overflow
|
||||
// or change in sign.
|
||||
//
|
||||
// In the algorithms below, we frequently reduce the negative case to the
|
||||
// positive case by negating the input(s) and then post-processing the result.
|
||||
// Note that we must ALWAYS check specially whether those values are MIN_VALUE
|
||||
// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
|
||||
// a positive number, it overflows back into a negative). Not handling this
|
||||
// case would often result in infinite recursion.
|
||||
//
|
||||
// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
|
||||
// methods on which they depend.
|
||||
|
||||
/**
|
||||
* Tests if the specified object is a Long.
|
||||
* @param {*} obj Object
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.isLong = function(obj) {
|
||||
return (obj && obj instanceof Long) === true;
|
||||
};
|
||||
|
||||
/**
|
||||
* A cache of the Long representations of small integer values.
|
||||
* @type {!Object}
|
||||
* @inner
|
||||
*/
|
||||
var INT_CACHE = {};
|
||||
|
||||
/**
|
||||
* A cache of the Long representations of small unsigned integer values.
|
||||
* @type {!Object}
|
||||
* @inner
|
||||
*/
|
||||
var UINT_CACHE = {};
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given 32 bit integer value.
|
||||
* @param {number} value The 32 bit integer in question
|
||||
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @returns {!Long} The corresponding Long value
|
||||
* @expose
|
||||
*/
|
||||
Long.fromInt = function(value, unsigned) {
|
||||
var obj, cachedObj;
|
||||
if (!unsigned) {
|
||||
value = value | 0;
|
||||
if (-128 <= value && value < 128) {
|
||||
cachedObj = INT_CACHE[value];
|
||||
if (cachedObj)
|
||||
return cachedObj;
|
||||
}
|
||||
obj = new Long(value, value < 0 ? -1 : 0, false);
|
||||
if (-128 <= value && value < 128)
|
||||
INT_CACHE[value] = obj;
|
||||
return obj;
|
||||
} else {
|
||||
value = value >>> 0;
|
||||
if (0 <= value && value < 256) {
|
||||
cachedObj = UINT_CACHE[value];
|
||||
if (cachedObj)
|
||||
return cachedObj;
|
||||
}
|
||||
obj = new Long(value, (value | 0) < 0 ? -1 : 0, true);
|
||||
if (0 <= value && value < 256)
|
||||
UINT_CACHE[value] = obj;
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
||||
* @param {number} value The number in question
|
||||
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @returns {!Long} The corresponding Long value
|
||||
* @expose
|
||||
*/
|
||||
Long.fromNumber = function(value, unsigned) {
|
||||
unsigned = !!unsigned;
|
||||
if (isNaN(value) || !isFinite(value))
|
||||
return Long.ZERO;
|
||||
if (!unsigned && value <= -TWO_PWR_63_DBL)
|
||||
return Long.MIN_VALUE;
|
||||
if (!unsigned && value + 1 >= TWO_PWR_63_DBL)
|
||||
return Long.MAX_VALUE;
|
||||
if (unsigned && value >= TWO_PWR_64_DBL)
|
||||
return Long.MAX_UNSIGNED_VALUE;
|
||||
if (value < 0)
|
||||
return Long.fromNumber(-value, unsigned).negate();
|
||||
return new Long((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
|
||||
* assumed to use 32 bits.
|
||||
* @param {number} lowBits The low 32 bits
|
||||
* @param {number} highBits The high 32 bits
|
||||
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @returns {!Long} The corresponding Long value
|
||||
* @expose
|
||||
*/
|
||||
Long.fromBits = function(lowBits, highBits, unsigned) {
|
||||
return new Long(lowBits, highBits, unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Long representation of the given string, written using the specified radix.
|
||||
* @param {string} str The textual representation of the Long
|
||||
* @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @param {number=} radix The radix in which the text is written (2-36), defaults to 10
|
||||
* @returns {!Long} The corresponding Long value
|
||||
* @expose
|
||||
*/
|
||||
Long.fromString = function(str, unsigned, radix) {
|
||||
if (str.length === 0)
|
||||
throw Error('number format error: empty string');
|
||||
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
|
||||
return Long.ZERO;
|
||||
if (typeof unsigned === 'number') // For goog.math.long compatibility
|
||||
radix = unsigned,
|
||||
unsigned = false;
|
||||
radix = radix || 10;
|
||||
if (radix < 2 || 36 < radix)
|
||||
throw Error('radix out of range: ' + radix);
|
||||
|
||||
var p;
|
||||
if ((p = str.indexOf('-')) > 0)
|
||||
throw Error('number format error: interior "-" character: ' + str);
|
||||
else if (p === 0)
|
||||
return Long.fromString(str.substring(1), unsigned, radix).negate();
|
||||
|
||||
// Do several (8) digits each time through the loop, so as to
|
||||
// minimize the calls to the very expensive emulated div.
|
||||
var radixToPower = Long.fromNumber(Math.pow(radix, 8));
|
||||
|
||||
var result = Long.ZERO;
|
||||
for (var i = 0; i < str.length; i += 8) {
|
||||
var size = Math.min(8, str.length - i);
|
||||
var value = parseInt(str.substring(i, i + size), radix);
|
||||
if (size < 8) {
|
||||
var power = Long.fromNumber(Math.pow(radix, size));
|
||||
result = result.multiply(power).add(Long.fromNumber(value));
|
||||
} else {
|
||||
result = result.multiply(radixToPower);
|
||||
result = result.add(Long.fromNumber(value));
|
||||
}
|
||||
}
|
||||
result.unsigned = unsigned;
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the specified value to a Long.
|
||||
* @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.fromValue = function(val) {
|
||||
if (typeof val === 'number')
|
||||
return Long.fromNumber(val);
|
||||
if (typeof val === 'string')
|
||||
return Long.fromString(val);
|
||||
if (Long.isLong(val))
|
||||
return val;
|
||||
// Throws for not an object (undefined, null):
|
||||
return new Long(val.low, val.high, val.unsigned);
|
||||
};
|
||||
|
||||
// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
|
||||
// no runtime penalty for these.
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_16_DBL = 1 << 16;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_24_DBL = 1 << 24;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
|
||||
|
||||
/**
|
||||
* Signed zero.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.ZERO = Long.fromInt(0);
|
||||
|
||||
/**
|
||||
* Unsigned zero.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.UZERO = Long.fromInt(0, true);
|
||||
|
||||
/**
|
||||
* Signed one.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.ONE = Long.fromInt(1);
|
||||
|
||||
/**
|
||||
* Unsigned one.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.UONE = Long.fromInt(1, true);
|
||||
|
||||
/**
|
||||
* Signed negative one.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.NEG_ONE = Long.fromInt(-1);
|
||||
|
||||
/**
|
||||
* Maximum signed value.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.MAX_VALUE = Long.fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
|
||||
|
||||
/**
|
||||
* Maximum unsigned value.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.MAX_UNSIGNED_VALUE = Long.fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
|
||||
|
||||
/**
|
||||
* Minimum signed value.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.MIN_VALUE = Long.fromBits(0, 0x80000000|0, false);
|
||||
|
||||
/**
|
||||
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
|
||||
* @returns {number}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toInt = function() {
|
||||
return this.unsigned ? this.low >>> 0 : this.low;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
|
||||
* @returns {number}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toNumber = function() {
|
||||
if (this.unsigned) {
|
||||
return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
|
||||
}
|
||||
return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the Long to a string written in the specified radix.
|
||||
* @param {number=} radix Radix (2-36), defaults to 10
|
||||
* @returns {string}
|
||||
* @override
|
||||
* @throws {RangeError} If `radix` is out of range
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toString = function(radix) {
|
||||
radix = radix || 10;
|
||||
if (radix < 2 || 36 < radix)
|
||||
throw RangeError('radix out of range: ' + radix);
|
||||
if (this.isZero())
|
||||
return '0';
|
||||
var rem;
|
||||
if (this.isNegative()) { // Unsigned Longs are never negative
|
||||
if (this.equals(Long.MIN_VALUE)) {
|
||||
// We need to change the Long value before it can be negated, so we remove
|
||||
// the bottom-most digit in this base and then recurse to do the rest.
|
||||
var radixLong = Long.fromNumber(radix);
|
||||
var div = this.div(radixLong);
|
||||
rem = div.multiply(radixLong).subtract(this);
|
||||
return div.toString(radix) + rem.toInt().toString(radix);
|
||||
} else
|
||||
return '-' + this.negate().toString(radix);
|
||||
}
|
||||
|
||||
// Do several (6) digits each time through the loop, so as to
|
||||
// minimize the calls to the very expensive emulated div.
|
||||
var radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
|
||||
rem = this;
|
||||
var result = '';
|
||||
while (true) {
|
||||
var remDiv = rem.div(radixToPower),
|
||||
intval = rem.subtract(remDiv.multiply(radixToPower)).toInt() >>> 0,
|
||||
digits = intval.toString(radix);
|
||||
rem = remDiv;
|
||||
if (rem.isZero())
|
||||
return digits + result;
|
||||
else {
|
||||
while (digits.length < 6)
|
||||
digits = '0' + digits;
|
||||
result = '' + digits + result;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as a signed integer.
|
||||
* @returns {number} Signed high bits
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getHighBits = function() {
|
||||
return this.high;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as an unsigned integer.
|
||||
* @returns {number} Unsigned high bits
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getHighBitsUnsigned = function() {
|
||||
return this.high >>> 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as a signed integer.
|
||||
* @returns {number} Signed low bits
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getLowBits = function() {
|
||||
return this.low;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as an unsigned integer.
|
||||
* @returns {number} Unsigned low bits
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getLowBitsUnsigned = function() {
|
||||
return this.low >>> 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the number of bits needed to represent the absolute value of this Long.
|
||||
* @returns {number}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getNumBitsAbs = function() {
|
||||
if (this.isNegative()) // Unsigned Longs are never negative
|
||||
return this.equals(Long.MIN_VALUE) ? 64 : this.negate().getNumBitsAbs();
|
||||
var val = this.high != 0 ? this.high : this.low;
|
||||
for (var bit = 31; bit > 0; bit--)
|
||||
if ((val & (1 << bit)) != 0)
|
||||
break;
|
||||
return this.high != 0 ? bit + 33 : bit + 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals zero.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isZero = function() {
|
||||
return this.high === 0 && this.low === 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is negative.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isNegative = function() {
|
||||
return !this.unsigned && this.high < 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is positive.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isPositive = function() {
|
||||
return this.unsigned || this.high >= 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is odd.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isOdd = function() {
|
||||
return (this.low & 1) === 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is even.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isEven = function() {
|
||||
return (this.low & 1) === 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.equals = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
|
||||
return false;
|
||||
return this.high === other.high && this.low === other.low;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value differs from the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.notEquals = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return !this.equals(other);
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.lessThan = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return this.compare(other) < 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than or equal the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.lessThanOrEqual = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return this.compare(other) <= 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.greaterThan = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return this.compare(other) > 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than or equal the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.greaterThanOrEqual = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return this.compare(other) >= 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compares this Long's value with the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {number} 0 if they are the same, 1 if the this is greater and -1
|
||||
* if the given one is greater
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.compare = function(other) {
|
||||
if (this.equals(other))
|
||||
return 0;
|
||||
var thisNeg = this.isNegative(),
|
||||
otherNeg = other.isNegative();
|
||||
if (thisNeg && !otherNeg)
|
||||
return -1;
|
||||
if (!thisNeg && otherNeg)
|
||||
return 1;
|
||||
// At this point the sign bits are the same
|
||||
if (!this.unsigned)
|
||||
return this.subtract(other).isNegative() ? -1 : 1;
|
||||
// Both are positive if at least one is unsigned
|
||||
return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Negates this Long's value.
|
||||
* @returns {!Long} Negated Long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.negate = function() {
|
||||
if (!this.unsigned && this.equals(Long.MIN_VALUE))
|
||||
return Long.MIN_VALUE;
|
||||
return this.not().add(Long.ONE);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the sum of this and the specified Long.
|
||||
* @param {!Long|number|string} addend Addend
|
||||
* @returns {!Long} Sum
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.add = function(addend) {
|
||||
if (!Long.isLong(addend))
|
||||
addend = Long.fromValue(addend);
|
||||
|
||||
// Divide each number into 4 chunks of 16 bits, and then sum the chunks.
|
||||
|
||||
var a48 = this.high >>> 16;
|
||||
var a32 = this.high & 0xFFFF;
|
||||
var a16 = this.low >>> 16;
|
||||
var a00 = this.low & 0xFFFF;
|
||||
|
||||
var b48 = addend.high >>> 16;
|
||||
var b32 = addend.high & 0xFFFF;
|
||||
var b16 = addend.low >>> 16;
|
||||
var b00 = addend.low & 0xFFFF;
|
||||
|
||||
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
||||
c00 += a00 + b00;
|
||||
c16 += c00 >>> 16;
|
||||
c00 &= 0xFFFF;
|
||||
c16 += a16 + b16;
|
||||
c32 += c16 >>> 16;
|
||||
c16 &= 0xFFFF;
|
||||
c32 += a32 + b32;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c48 += a48 + b48;
|
||||
c48 &= 0xFFFF;
|
||||
return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the specified Long.
|
||||
* @param {!Long|number|string} subtrahend Subtrahend
|
||||
* @returns {!Long} Difference
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.subtract = function(subtrahend) {
|
||||
if (!Long.isLong(subtrahend))
|
||||
subtrahend = Long.fromValue(subtrahend);
|
||||
return this.add(subtrahend.negate());
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the product of this and the specified Long.
|
||||
* @param {!Long|number|string} multiplier Multiplier
|
||||
* @returns {!Long} Product
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.multiply = function(multiplier) {
|
||||
if (this.isZero())
|
||||
return Long.ZERO;
|
||||
if (!Long.isLong(multiplier))
|
||||
multiplier = Long.fromValue(multiplier);
|
||||
if (multiplier.isZero())
|
||||
return Long.ZERO;
|
||||
if (this.equals(Long.MIN_VALUE))
|
||||
return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
|
||||
if (multiplier.equals(Long.MIN_VALUE))
|
||||
return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
|
||||
|
||||
if (this.isNegative()) {
|
||||
if (multiplier.isNegative())
|
||||
return this.negate().multiply(multiplier.negate());
|
||||
else
|
||||
return this.negate().multiply(multiplier).negate();
|
||||
} else if (multiplier.isNegative())
|
||||
return this.multiply(multiplier.negate()).negate();
|
||||
|
||||
// If both longs are small, use float multiplication
|
||||
if (this.lessThan(TWO_PWR_24) && multiplier.lessThan(TWO_PWR_24))
|
||||
return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
|
||||
|
||||
// Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
|
||||
// We can skip products that would overflow.
|
||||
|
||||
var a48 = this.high >>> 16;
|
||||
var a32 = this.high & 0xFFFF;
|
||||
var a16 = this.low >>> 16;
|
||||
var a00 = this.low & 0xFFFF;
|
||||
|
||||
var b48 = multiplier.high >>> 16;
|
||||
var b32 = multiplier.high & 0xFFFF;
|
||||
var b16 = multiplier.low >>> 16;
|
||||
var b00 = multiplier.low & 0xFFFF;
|
||||
|
||||
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
||||
c00 += a00 * b00;
|
||||
c16 += c00 >>> 16;
|
||||
c00 &= 0xFFFF;
|
||||
c16 += a16 * b00;
|
||||
c32 += c16 >>> 16;
|
||||
c16 &= 0xFFFF;
|
||||
c16 += a00 * b16;
|
||||
c32 += c16 >>> 16;
|
||||
c16 &= 0xFFFF;
|
||||
c32 += a32 * b00;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c32 += a16 * b16;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c32 += a00 * b32;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
|
||||
c48 &= 0xFFFF;
|
||||
return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the specified.
|
||||
* @param {!Long|number|string} divisor Divisor
|
||||
* @returns {!Long} Quotient
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.div = function(divisor) {
|
||||
if (!Long.isLong(divisor))
|
||||
divisor = Long.fromValue(divisor);
|
||||
if (divisor.isZero())
|
||||
throw(new Error('division by zero'));
|
||||
if (this.isZero())
|
||||
return this.unsigned ? Long.UZERO : Long.ZERO;
|
||||
var approx, rem, res;
|
||||
if (this.equals(Long.MIN_VALUE)) {
|
||||
if (divisor.equals(Long.ONE) || divisor.equals(Long.NEG_ONE))
|
||||
return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
|
||||
else if (divisor.equals(Long.MIN_VALUE))
|
||||
return Long.ONE;
|
||||
else {
|
||||
// At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
|
||||
var halfThis = this.shiftRight(1);
|
||||
approx = halfThis.div(divisor).shiftLeft(1);
|
||||
if (approx.equals(Long.ZERO)) {
|
||||
return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
|
||||
} else {
|
||||
rem = this.subtract(divisor.multiply(approx));
|
||||
res = approx.add(rem.div(divisor));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
} else if (divisor.equals(Long.MIN_VALUE))
|
||||
return this.unsigned ? Long.UZERO : Long.ZERO;
|
||||
if (this.isNegative()) {
|
||||
if (divisor.isNegative())
|
||||
return this.negate().div(divisor.negate());
|
||||
return this.negate().div(divisor).negate();
|
||||
} else if (divisor.isNegative())
|
||||
return this.div(divisor.negate()).negate();
|
||||
|
||||
// Repeat the following until the remainder is less than other: find a
|
||||
// floating-point that approximates remainder / other *from below*, add this
|
||||
// into the result, and subtract it from the remainder. It is critical that
|
||||
// the approximate value is less than or equal to the real value so that the
|
||||
// remainder never becomes negative.
|
||||
res = Long.ZERO;
|
||||
rem = this;
|
||||
while (rem.greaterThanOrEqual(divisor)) {
|
||||
// Approximate the result of division. This may be a little greater or
|
||||
// smaller than the actual value.
|
||||
approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
|
||||
|
||||
// We will tweak the approximate result by changing it in the 48-th digit or
|
||||
// the smallest non-fractional digit, whichever is larger.
|
||||
var log2 = Math.ceil(Math.log(approx) / Math.LN2),
|
||||
delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48),
|
||||
|
||||
// Decrease the approximation until it is smaller than the remainder. Note
|
||||
// that if it is too large, the product overflows and is negative.
|
||||
approxRes = Long.fromNumber(approx),
|
||||
approxRem = approxRes.multiply(divisor);
|
||||
while (approxRem.isNegative() || approxRem.greaterThan(rem)) {
|
||||
approx -= delta;
|
||||
approxRes = Long.fromNumber(approx, this.unsigned);
|
||||
approxRem = approxRes.multiply(divisor);
|
||||
}
|
||||
|
||||
// We know the answer can't be zero... and actually, zero would cause
|
||||
// infinite recursion since we would make no progress.
|
||||
if (approxRes.isZero())
|
||||
approxRes = Long.ONE;
|
||||
|
||||
res = res.add(approxRes);
|
||||
rem = rem.subtract(approxRem);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the specified.
|
||||
* @param {!Long|number|string} divisor Divisor
|
||||
* @returns {!Long} Remainder
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.modulo = function(divisor) {
|
||||
if (!Long.isLong(divisor))
|
||||
divisor = Long.fromValue(divisor);
|
||||
return this.subtract(this.div(divisor).multiply(divisor));
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the bitwise NOT of this Long.
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.not = function() {
|
||||
return Long.fromBits(~this.low, ~this.high, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the bitwise AND of this Long and the specified.
|
||||
* @param {!Long|number|string} other Other Long
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.and = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the bitwise OR of this Long and the specified.
|
||||
* @param {!Long|number|string} other Other Long
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.or = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the bitwise XOR of this Long and the given one.
|
||||
* @param {!Long|number|string} other Other Long
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.xor = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount.
|
||||
* @param {number|!Long} numBits Number of bits
|
||||
* @returns {!Long} Shifted Long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.shiftLeft = function(numBits) {
|
||||
if (Long.isLong(numBits))
|
||||
numBits = numBits.toInt();
|
||||
if ((numBits &= 63) === 0)
|
||||
return this;
|
||||
else if (numBits < 32)
|
||||
return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
|
||||
else
|
||||
return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
* @param {number|!Long} numBits Number of bits
|
||||
* @returns {!Long} Shifted Long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.shiftRight = function(numBits) {
|
||||
if (Long.isLong(numBits))
|
||||
numBits = numBits.toInt();
|
||||
if ((numBits &= 63) === 0)
|
||||
return this;
|
||||
else if (numBits < 32)
|
||||
return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
|
||||
else
|
||||
return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long with bits logically shifted to the right by the given amount.
|
||||
* @param {number|!Long} numBits Number of bits
|
||||
* @returns {!Long} Shifted Long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.shiftRightUnsigned = function(numBits) {
|
||||
if (Long.isLong(numBits))
|
||||
numBits = numBits.toInt();
|
||||
numBits &= 63;
|
||||
if (numBits === 0)
|
||||
return this;
|
||||
else {
|
||||
var high = this.high;
|
||||
if (numBits < 32) {
|
||||
var low = this.low;
|
||||
return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
|
||||
} else if (numBits === 32)
|
||||
return Long.fromBits(high, 0, this.unsigned);
|
||||
else
|
||||
return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Long to signed.
|
||||
* @returns {!Long} Signed long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toSigned = function() {
|
||||
if (!this.unsigned)
|
||||
return this;
|
||||
return new Long(this.low, this.high, false);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Long to unsigned.
|
||||
* @returns {!Long} Unsigned long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toUnsigned = function() {
|
||||
if (this.unsigned)
|
||||
return this;
|
||||
return new Long(this.low, this.high, true);
|
||||
};
|
||||
|
||||
/* CommonJS */ if (typeof require === 'function' && typeof module === 'object' && module && typeof exports === 'object' && exports)
|
||||
module["exports"] = Long;
|
||||
/* AMD */ else if (typeof define === 'function' && define["amd"])
|
||||
define(function() { return Long; });
|
||||
/* Global */ else
|
||||
(global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = Long;
|
||||
|
||||
})(this);
|
||||
22
node_modules/osc/node_modules/long/dist/Long.min.js
generated
vendored
Normal file
22
node_modules/osc/node_modules/long/dist/Long.min.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(function(){/*
|
||||
Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
||||
Released under the Apache License, Version 2.0
|
||||
see: https://github.com/dcodeIO/Long.js for details
|
||||
*/
|
||||
(function(q){function b(a,b,d){this.low=a|0;this.high=b|0;this.unsigned=!!d}b.isLong=function(a){return!0===(a&&a instanceof b)};var r={},s={};b.fromInt=function(a,c){var d;if(c){a>>>=0;if(0<=a&&256>a&&(d=s[a]))return d;d=new b(a,0>(a|0)?-1:0,!0);0<=a&&256>a&&(s[a]=d)}else{a|=0;if(-128<=a&&128>a&&(d=r[a]))return d;d=new b(a,0>a?-1:0,!1);-128<=a&&128>a&&(r[a]=d)}return d};b.fromNumber=function(a,c){c=!!c;return isNaN(a)||!isFinite(a)?b.ZERO:!c&&a<=-t?b.MIN_VALUE:!c&&a+1>=t?b.MAX_VALUE:c&&a>=u?b.MAX_UNSIGNED_VALUE:
|
||||
0>a?b.fromNumber(-a,c).negate():new b(a%4294967296|0,a/4294967296|0,c)};b.fromBits=function(a,c,d){return new b(a,c,d)};b.fromString=function(a,c,d){if(0===a.length)throw Error("number format error: empty string");if("NaN"===a||"Infinity"===a||"+Infinity"===a||"-Infinity"===a)return b.ZERO;"number"===typeof c&&(d=c,c=!1);d=d||10;if(2>d||36<d)throw Error("radix out of range: "+d);var e;if(0<(e=a.indexOf("-")))throw Error('number format error: interior "-" character: '+a);if(0===e)return b.fromString(a.substring(1),
|
||||
c,d).negate();e=b.fromNumber(Math.pow(d,8));for(var f=b.ZERO,g=0;g<a.length;g+=8){var k=Math.min(8,a.length-g),l=parseInt(a.substring(g,g+k),d);8>k?(k=b.fromNumber(Math.pow(d,k)),f=f.multiply(k).add(b.fromNumber(l))):(f=f.multiply(e),f=f.add(b.fromNumber(l)))}f.unsigned=c;return f};b.fromValue=function(a){return"number"===typeof a?b.fromNumber(a):"string"===typeof a?b.fromString(a):b.isLong(a)?a:new b(a.low,a.high,a.unsigned)};var u=4294967296*4294967296,t=u/2,v=b.fromInt(16777216);b.ZERO=b.fromInt(0);
|
||||
b.UZERO=b.fromInt(0,!0);b.ONE=b.fromInt(1);b.UONE=b.fromInt(1,!0);b.NEG_ONE=b.fromInt(-1);b.MAX_VALUE=b.fromBits(-1,2147483647,!1);b.MAX_UNSIGNED_VALUE=b.fromBits(-1,-1,!0);b.MIN_VALUE=b.fromBits(0,-2147483648,!1);b.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low};b.prototype.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)};b.prototype.toString=function(a){a=a||10;if(2>a||36<a)throw RangeError("radix out of range: "+
|
||||
a);if(this.isZero())return"0";var c;if(this.isNegative()){if(this.equals(b.MIN_VALUE)){c=b.fromNumber(a);var d=this.div(c);c=d.multiply(c).subtract(this);return d.toString(a)+c.toInt().toString(a)}return"-"+this.negate().toString(a)}d=b.fromNumber(Math.pow(a,6),this.unsigned);c=this;for(var e="";;){var f=c.div(d),g=(c.subtract(f.multiply(d)).toInt()>>>0).toString(a);c=f;if(c.isZero())return g+e;for(;6>g.length;)g="0"+g;e=""+g+e}};b.prototype.getHighBits=function(){return this.high};b.prototype.getHighBitsUnsigned=
|
||||
function(){return this.high>>>0};b.prototype.getLowBits=function(){return this.low};b.prototype.getLowBitsUnsigned=function(){return this.low>>>0};b.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(b.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var a=0!=this.high?this.high:this.low,c=31;0<c&&0==(a&1<<c);c--);return 0!=this.high?c+33:c+1};b.prototype.isZero=function(){return 0===this.high&&0===this.low};b.prototype.isNegative=function(){return!this.unsigned&&0>this.high};
|
||||
b.prototype.isPositive=function(){return this.unsigned||0<=this.high};b.prototype.isOdd=function(){return 1===(this.low&1)};b.prototype.isEven=function(){return 0===(this.low&1)};b.prototype.equals=function(a){b.isLong(a)||(a=b.fromValue(a));return this.unsigned!==a.unsigned&&1===this.high>>>31&&1===a.high>>>31?!1:this.high===a.high&&this.low===a.low};b.prototype.notEquals=function(a){b.isLong(a)||(a=b.fromValue(a));return!this.equals(a)};b.prototype.lessThan=function(a){b.isLong(a)||(a=b.fromValue(a));
|
||||
return 0>this.compare(a)};b.prototype.lessThanOrEqual=function(a){b.isLong(a)||(a=b.fromValue(a));return 0>=this.compare(a)};b.prototype.greaterThan=function(a){b.isLong(a)||(a=b.fromValue(a));return 0<this.compare(a)};b.prototype.greaterThanOrEqual=function(a){b.isLong(a)||(a=b.fromValue(a));return 0<=this.compare(a)};b.prototype.compare=function(a){if(this.equals(a))return 0;var b=this.isNegative(),d=a.isNegative();return b&&!d?-1:!b&&d?1:this.unsigned?a.high>>>0>this.high>>>0||a.high===this.high&&
|
||||
a.low>>>0>this.low>>>0?-1:1:this.subtract(a).isNegative()?-1:1};b.prototype.negate=function(){return!this.unsigned&&this.equals(b.MIN_VALUE)?b.MIN_VALUE:this.not().add(b.ONE)};b.prototype.add=function(a){b.isLong(a)||(a=b.fromValue(a));var c=this.high>>>16,d=this.high&65535,e=this.low>>>16,f=a.high>>>16,g=a.high&65535,k=a.low>>>16,l;l=0+((this.low&65535)+(a.low&65535));a=0+(l>>>16);a+=e+k;e=0+(a>>>16);e+=d+g;d=0+(e>>>16);d=d+(c+f)&65535;return b.fromBits((a&65535)<<16|l&65535,d<<16|e&65535,this.unsigned)};
|
||||
b.prototype.subtract=function(a){b.isLong(a)||(a=b.fromValue(a));return this.add(a.negate())};b.prototype.multiply=function(a){if(this.isZero())return b.ZERO;b.isLong(a)||(a=b.fromValue(a));if(a.isZero())return b.ZERO;if(this.equals(b.MIN_VALUE))return a.isOdd()?b.MIN_VALUE:b.ZERO;if(a.equals(b.MIN_VALUE))return this.isOdd()?b.MIN_VALUE:b.ZERO;if(this.isNegative())return a.isNegative()?this.negate().multiply(a.negate()):this.negate().multiply(a).negate();if(a.isNegative())return this.multiply(a.negate()).negate();
|
||||
if(this.lessThan(v)&&a.lessThan(v))return b.fromNumber(this.toNumber()*a.toNumber(),this.unsigned);var c=this.high>>>16,d=this.high&65535,e=this.low>>>16,f=this.low&65535,g=a.high>>>16,k=a.high&65535,l=a.low>>>16;a=a.low&65535;var n,h,m,p;p=0+f*a;m=0+(p>>>16);m+=e*a;h=0+(m>>>16);m=(m&65535)+f*l;h+=m>>>16;m&=65535;h+=d*a;n=0+(h>>>16);h=(h&65535)+e*l;n+=h>>>16;h&=65535;h+=f*k;n+=h>>>16;h&=65535;n=n+(c*a+d*l+e*k+f*g)&65535;return b.fromBits(m<<16|p&65535,n<<16|h,this.unsigned)};b.prototype.div=function(a){b.isLong(a)||
|
||||
(a=b.fromValue(a));if(a.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?b.UZERO:b.ZERO;var c,d,e;if(this.equals(b.MIN_VALUE)){if(a.equals(b.ONE)||a.equals(b.NEG_ONE))return b.MIN_VALUE;if(a.equals(b.MIN_VALUE))return b.ONE;c=this.shiftRight(1).div(a).shiftLeft(1);if(c.equals(b.ZERO))return a.isNegative()?b.ONE:b.NEG_ONE;d=this.subtract(a.multiply(c));return e=c.add(d.div(a))}if(a.equals(b.MIN_VALUE))return this.unsigned?b.UZERO:b.ZERO;if(this.isNegative())return a.isNegative()?
|
||||
this.negate().div(a.negate()):this.negate().div(a).negate();if(a.isNegative())return this.div(a.negate()).negate();e=b.ZERO;for(d=this;d.greaterThanOrEqual(a);){c=Math.max(1,Math.floor(d.toNumber()/a.toNumber()));for(var f=Math.ceil(Math.log(c)/Math.LN2),f=48>=f?1:Math.pow(2,f-48),g=b.fromNumber(c),k=g.multiply(a);k.isNegative()||k.greaterThan(d);)c-=f,g=b.fromNumber(c,this.unsigned),k=g.multiply(a);g.isZero()&&(g=b.ONE);e=e.add(g);d=d.subtract(k)}return e};b.prototype.modulo=function(a){b.isLong(a)||
|
||||
(a=b.fromValue(a));return this.subtract(this.div(a).multiply(a))};b.prototype.not=function(){return b.fromBits(~this.low,~this.high,this.unsigned)};b.prototype.and=function(a){b.isLong(a)||(a=b.fromValue(a));return b.fromBits(this.low&a.low,this.high&a.high,this.unsigned)};b.prototype.or=function(a){b.isLong(a)||(a=b.fromValue(a));return b.fromBits(this.low|a.low,this.high|a.high,this.unsigned)};b.prototype.xor=function(a){b.isLong(a)||(a=b.fromValue(a));return b.fromBits(this.low^a.low,this.high^
|
||||
a.high,this.unsigned)};b.prototype.shiftLeft=function(a){b.isLong(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?b.fromBits(this.low<<a,this.high<<a|this.low>>>32-a,this.unsigned):b.fromBits(0,this.low<<a-32,this.unsigned)};b.prototype.shiftRight=function(a){b.isLong(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?b.fromBits(this.low>>>a|this.high<<32-a,this.high>>a,this.unsigned):b.fromBits(this.high>>a-32,0<=this.high?0:-1,this.unsigned)};b.prototype.shiftRightUnsigned=function(a){b.isLong(a)&&(a=
|
||||
a.toInt());a&=63;if(0===a)return this;var c=this.high;return 32>a?b.fromBits(this.low>>>a|c<<32-a,c>>>a,this.unsigned):32===a?b.fromBits(c,0,this.unsigned):b.fromBits(c>>>a-32,0,this.unsigned)};b.prototype.toSigned=function(){return this.unsigned?new b(this.low,this.high,!1):this};b.prototype.toUnsigned=function(){return this.unsigned?this:new b(this.low,this.high,!0)};"function"===typeof require&&"object"===typeof module&&module&&"object"===typeof exports&&exports?module.exports=b:"function"===typeof define&&
|
||||
define.amd?define(function(){return b}):(q.dcodeIO=q.dcodeIO||{}).Long=b})(this);})();
|
||||
BIN
node_modules/osc/node_modules/long/dist/Long.min.js.gz
generated
vendored
Normal file
BIN
node_modules/osc/node_modules/long/dist/Long.min.js.gz
generated
vendored
Normal file
Binary file not shown.
8
node_modules/osc/node_modules/long/dist/Long.min.map
generated
vendored
Normal file
8
node_modules/osc/node_modules/long/dist/Long.min.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
16
node_modules/osc/node_modules/long/dist/README.md
generated
vendored
Normal file
16
node_modules/osc/node_modules/long/dist/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Distributions
|
||||
=============
|
||||
|
||||
* **[Long.js](https://raw.githubusercontent.com/dcodeIO/Long.js/master/dist/Long.js)**
|
||||
contains the commented source.
|
||||
|
||||
* **[Long.min.js](https://raw.githubusercontent.com/dcodeIO/Long.js/master/dist/Long.min.js)**
|
||||
has been compiled with Closure Compiler using `--compilation_level=ADVANCED_OPTIMIZATIONS`.
|
||||
|
||||
* **[Long.min.js.gz](https://raw.githubusercontent.com/dcodeIO/Long.js/master/dist/Long.min.js.gz)**
|
||||
has also been gzipped using `-9`.
|
||||
|
||||
* **[Long.min.map](https://raw.githubusercontent.com/dcodeIO/Long.js/master/dist/Long.min.map)**
|
||||
is the source map generated by Closure Compiler.
|
||||
|
||||
Also available as `long` on [npm](https://www.npmjs.org/package/long) and [bower](http://bower.io/search/?q=long).
|
||||
6
node_modules/osc/node_modules/long/doco/INDEX.md
generated
vendored
Normal file
6
node_modules/osc/node_modules/long/doco/INDEX.md
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
### Class [Long](Long.md)
|
||||
|
||||
A Long class for representing a 64 bit two's-complement integer value.
|
||||
|
||||
---
|
||||
*Generated with [doco](https://github.com/dcodeIO/doco) v0.3.0*
|
||||
473
node_modules/osc/node_modules/long/doco/Long.md
generated
vendored
Normal file
473
node_modules/osc/node_modules/long/doco/Long.md
generated
vendored
Normal file
|
|
@ -0,0 +1,473 @@
|
|||
## Class Long
|
||||
|
||||
A Long class for representing a 64 bit two's-complement integer value.
|
||||
|
||||
---
|
||||
|
||||
#### new Long(low, high=, unsigned=)
|
||||
|
||||
Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
|
||||
See the from* functions below for more convenient ways of constructing Longs.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| low | *number* | The low (signed) 32 bits of the long
|
||||
| high | *number* | The high (signed) 32 bits of the long
|
||||
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
|
||||
|
||||
---
|
||||
|
||||
#### Long.MAX_UNSIGNED_VALUE
|
||||
|
||||
Maximum unsigned value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.MAX_VALUE
|
||||
|
||||
Maximum signed value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.MIN_VALUE
|
||||
|
||||
Minimum signed value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.NEG_ONE
|
||||
|
||||
Signed negative one.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.ONE
|
||||
|
||||
Signed one.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.UONE
|
||||
|
||||
Unsigned one.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.UZERO
|
||||
|
||||
Unsigned zero.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.ZERO
|
||||
|
||||
Signed zero.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *!Long* |
|
||||
|
||||
#### Long.fromBits(lowBits, highBits, unsigned=)
|
||||
|
||||
Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
|
||||
assumed to use 32 bits.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| lowBits | *number* | The low 32 bits
|
||||
| highBits | *number* | The high 32 bits
|
||||
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
|
||||
| **@returns** | *!Long* | The corresponding Long value
|
||||
|
||||
#### Long.fromInt(value, unsigned=)
|
||||
|
||||
Returns a Long representing the given 32 bit integer value.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| value | *number* | The 32 bit integer in question
|
||||
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
|
||||
| **@returns** | *!Long* | The corresponding Long value
|
||||
|
||||
#### Long.fromNumber(value, unsigned=)
|
||||
|
||||
Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| value | *number* | The number in question
|
||||
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
|
||||
| **@returns** | *!Long* | The corresponding Long value
|
||||
|
||||
#### Long.fromString(str, unsigned=, radix=)
|
||||
|
||||
Returns a Long representation of the given string, written using the specified radix.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| str | *string* | The textual representation of the Long
|
||||
| unsigned | *boolean | number* | Whether unsigned or not, defaults to `false` for signed
|
||||
| radix | *number* | The radix in which the text is written (2-36), defaults to 10
|
||||
| **@returns** | *!Long* | The corresponding Long value
|
||||
|
||||
#### Long.isLong(obj)
|
||||
|
||||
Tests if the specified object is a Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| obj | *** | Object
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long.fromValue(val)
|
||||
|
||||
Converts the specified value to a Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| val | *!Long | number | string | !{low: number, high: number, unsigned: boolean}* | Value
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
---
|
||||
|
||||
#### Long#high
|
||||
|
||||
The high 32 bits as a signed value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *number* |
|
||||
|
||||
#### Long#low
|
||||
|
||||
The low 32 bits as a signed value.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *number* |
|
||||
|
||||
#### Long#unsigned
|
||||
|
||||
Whether unsigned or not.
|
||||
|
||||
| | |
|
||||
|-----------------|-----------------|
|
||||
| **@type** | *boolean* |
|
||||
|
||||
#### Long#add(addend)
|
||||
|
||||
Returns the sum of this and the specified Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| addend | *!Long | number | string* | Addend
|
||||
| **@returns** | *!Long* | Sum
|
||||
|
||||
#### Long#and(other)
|
||||
|
||||
Returns the bitwise AND of this Long and the specified.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other Long
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
#### Long#compare(other)
|
||||
|
||||
Compares this Long's value with the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *number* | 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
|
||||
|
||||
#### Long#div(divisor)
|
||||
|
||||
Returns this Long divided by the specified.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| divisor | *!Long | number | string* | Divisor
|
||||
| **@returns** | *!Long* | Quotient
|
||||
|
||||
#### Long#equals(other)
|
||||
|
||||
Tests if this Long's value equals the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#getHighBits()
|
||||
|
||||
Gets the high 32 bits as a signed integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* | Signed high bits
|
||||
|
||||
#### Long#getHighBitsUnsigned()
|
||||
|
||||
Gets the high 32 bits as an unsigned integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* | Unsigned high bits
|
||||
|
||||
#### Long#getLowBits()
|
||||
|
||||
Gets the low 32 bits as a signed integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* | Signed low bits
|
||||
|
||||
#### Long#getLowBitsUnsigned()
|
||||
|
||||
Gets the low 32 bits as an unsigned integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* | Unsigned low bits
|
||||
|
||||
#### Long#getNumBitsAbs()
|
||||
|
||||
Gets the number of bits needed to represent the absolute value of this Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* |
|
||||
|
||||
#### Long#greaterThan(other)
|
||||
|
||||
Tests if this Long's value is greater than the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#greaterThanOrEqual(other)
|
||||
|
||||
Tests if this Long's value is greater than or equal the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isEven()
|
||||
|
||||
Tests if this Long's value is even.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isNegative()
|
||||
|
||||
Tests if this Long's value is negative.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isOdd()
|
||||
|
||||
Tests if this Long's value is odd.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isPositive()
|
||||
|
||||
Tests if this Long's value is positive.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#isZero()
|
||||
|
||||
Tests if this Long's value equals zero.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#lessThan(other)
|
||||
|
||||
Tests if this Long's value is less than the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#lessThanOrEqual(other)
|
||||
|
||||
Tests if this Long's value is less than or equal the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#modulo(divisor)
|
||||
|
||||
Returns this Long modulo the specified.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| divisor | *!Long | number | string* | Divisor
|
||||
| **@returns** | *!Long* | Remainder
|
||||
|
||||
#### Long#multiply(multiplier)
|
||||
|
||||
Returns the product of this and the specified Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| multiplier | *!Long | number | string* | Multiplier
|
||||
| **@returns** | *!Long* | Product
|
||||
|
||||
#### Long#negate()
|
||||
|
||||
Negates this Long's value.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *!Long* | Negated Long
|
||||
|
||||
#### Long#not()
|
||||
|
||||
Returns the bitwise NOT of this Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
#### Long#notEquals(other)
|
||||
|
||||
Tests if this Long's value differs from the specified's.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other value
|
||||
| **@returns** | *boolean* |
|
||||
|
||||
#### Long#or(other)
|
||||
|
||||
Returns the bitwise OR of this Long and the specified.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other Long
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
#### Long#shiftLeft(numBits)
|
||||
|
||||
Returns this Long with bits shifted to the left by the given amount.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| numBits | *number | !Long* | Number of bits
|
||||
| **@returns** | *!Long* | Shifted Long
|
||||
|
||||
#### Long#shiftRight(numBits)
|
||||
|
||||
Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| numBits | *number | !Long* | Number of bits
|
||||
| **@returns** | *!Long* | Shifted Long
|
||||
|
||||
#### Long#shiftRightUnsigned(numBits)
|
||||
|
||||
Returns this Long with bits logically shifted to the right by the given amount.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| numBits | *number | !Long* | Number of bits
|
||||
| **@returns** | *!Long* | Shifted Long
|
||||
|
||||
#### Long#subtract(subtrahend)
|
||||
|
||||
Returns the difference of this and the specified Long.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| subtrahend | *!Long | number | string* | Subtrahend
|
||||
| **@returns** | *!Long* | Difference
|
||||
|
||||
#### Long#toInt()
|
||||
|
||||
Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* |
|
||||
|
||||
#### Long#toNumber()
|
||||
|
||||
Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *number* |
|
||||
|
||||
#### Long#toSigned()
|
||||
|
||||
Converts this Long to signed.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *!Long* | Signed long
|
||||
|
||||
#### Long#toString(radix=)
|
||||
|
||||
Converts the Long to a string written in the specified radix.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| radix | *number* | Radix (2-36), defaults to 10
|
||||
| **@returns** | *string* |
|
||||
| **@throws** | *RangeError* | If `radix` is out of range
|
||||
|
||||
#### Long#toUnsigned()
|
||||
|
||||
Converts this Long to unsigned.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| **@returns** | *!Long* | Unsigned long
|
||||
|
||||
#### Long#xor(other)
|
||||
|
||||
Returns the bitwise XOR of this Long and the given one.
|
||||
|
||||
| Parameter | Type | Description
|
||||
|-----------------|-----------------|---------------
|
||||
| other | *!Long | number | string* | Other Long
|
||||
| **@returns** | *!Long* |
|
||||
|
||||
|
||||
---
|
||||
*Generated with [doco](https://github.com/dcodeIO/doco) v0.3.0*
|
||||
BIN
node_modules/osc/node_modules/long/donate.png
generated
vendored
Normal file
BIN
node_modules/osc/node_modules/long/donate.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
321
node_modules/osc/node_modules/long/externs/Long.js
generated
vendored
Normal file
321
node_modules/osc/node_modules/long/externs/Long.js
generated
vendored
Normal file
|
|
@ -0,0 +1,321 @@
|
|||
/*
|
||||
* Copyright 2012 The Closure Compiler Authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Externs for Long.js.
|
||||
* @see https://github.com/dcodeIO/Long.js
|
||||
* @externs
|
||||
*/
|
||||
|
||||
/**
|
||||
BEGIN_NODE_INCLUDE
|
||||
var Long = require('long');
|
||||
END_NODE_INCLUDE
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number|!{low: number, high: number, unsigned: boolean}} low
|
||||
* @param {number=} high
|
||||
* @param {boolean=} unsigned
|
||||
* @constructor
|
||||
*/
|
||||
var Long = function(low, high, unsigned) {};
|
||||
|
||||
/**
|
||||
* @param {*} obj
|
||||
* @returns {boolean}
|
||||
*/
|
||||
Long.isLong = function(obj) {};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean=} unsigned
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.fromInt = function(value, unsigned) {};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean=} unsigned
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.fromNumber = function(value, unsigned) {};
|
||||
|
||||
/**
|
||||
* @param {number} lowBits
|
||||
* @param {number} highBits
|
||||
* @param {boolean=} unsigned
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.fromBits = function(lowBits, highBits, unsigned) {};
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @param {(boolean|number)=} unsigned
|
||||
* @param {number=} radix
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.fromString = function(str, unsigned, radix) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.valueOf = function(val) {};
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
*/
|
||||
Long.ZERO;
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
*/
|
||||
Long.UZERO;
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
*/
|
||||
Long.ONE;
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
*/
|
||||
Long.UONE;
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
*/
|
||||
Long.NEG_ONE;
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
*/
|
||||
Long.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
*/
|
||||
Long.MIN_VALUE;
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
*/
|
||||
Long.MAX_UNSIGNED_VALUE;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
Long.prototype.low;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
Long.prototype.high;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Long.prototype.unsigned;
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
Long.prototype.toInt = function() {};
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
Long.prototype.toNumber = function() {};
|
||||
|
||||
/**
|
||||
* @param {number=} radix
|
||||
* @return {string}
|
||||
*/
|
||||
Long.prototype.toString = function(radix) {};
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
Long.prototype.getHighBits = function() {};
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
Long.prototype.getHighBitsUnsigned = function() {};
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
Long.prototype.getLowBits = function() {};
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
Long.prototype.getLowBitsUnsigned = function() {};
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
Long.prototype.getNumBitsAbs = function() {};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.isZero = function() {};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.isNegative = function() {};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.isOdd = function() {};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.isEven = function() {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.equals = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.notEquals = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.lessThan = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.lessThanOrEqual = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.greaterThan = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {boolean}
|
||||
*/
|
||||
Long.prototype.greaterThanOrEqual = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {number}
|
||||
*/
|
||||
Long.prototype.compare = function(other) {};
|
||||
|
||||
/**
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.negate = function() {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.add = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.subtract = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.multiply = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.div = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.modulo = function(other) {};
|
||||
|
||||
/**
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.not = function() {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.and = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.or = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {!Long|number|string} other
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.xor = function(other) {};
|
||||
|
||||
/**
|
||||
* @param {number|!Long} numBits
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.shiftLeft = function(numBits) {};
|
||||
|
||||
/**
|
||||
* @param {number|!Long} numBits
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.shiftRight = function(numBits) {};
|
||||
|
||||
/**
|
||||
* @param {number|!Long} numBits
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.shiftRightUnsigned = function(numBits) {};
|
||||
|
||||
/**
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.toSigned = function() {};
|
||||
|
||||
/**
|
||||
* @return {!Long}
|
||||
*/
|
||||
Long.prototype.toUnsigned = function() {};
|
||||
18
node_modules/osc/node_modules/long/index.js
generated
vendored
Normal file
18
node_modules/osc/node_modules/long/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Copyright 2013 Daniel Wirtz <dcode@dcode.io>
|
||||
Copyright 2009 The Closure Library Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
module.exports = require("./dist/Long.js");
|
||||
13
node_modules/osc/node_modules/long/jsdoc.json
generated
vendored
Normal file
13
node_modules/osc/node_modules/long/jsdoc.json
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"tags": {
|
||||
"allowUnknownTags": true
|
||||
},
|
||||
"source": {
|
||||
"include": ["dist/Long.js"]
|
||||
},
|
||||
"opts": {
|
||||
"template": "templates/esoccer",
|
||||
"destination": "docs"
|
||||
},
|
||||
"plugins": []
|
||||
}
|
||||
60
node_modules/osc/node_modules/long/package.json
generated
vendored
Normal file
60
node_modules/osc/node_modules/long/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"name": "long",
|
||||
"version": "2.2.5",
|
||||
"author": {
|
||||
"name": "Daniel Wirtz",
|
||||
"email": "dcode@dcode.io"
|
||||
},
|
||||
"description": "A Long class for representing a 64-bit two's-complement integer value.",
|
||||
"main": "dist/Long.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dcodeIO/Long.js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"math"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"testjs": "latest",
|
||||
"closurecompiler": "latest",
|
||||
"metascript": "~0"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js",
|
||||
"make": "npm run-script build && npm run-script compile && npm run-script compress && npm test",
|
||||
"compile": "ccjs dist/Long.js --compilation_level=ADVANCED_OPTIMIZATIONS --output_wrapper=\"(function(){%output%})();\" --create_source_map=dist/Long.min.map > dist/Long.min.js",
|
||||
"compress": "gzip -c -9 dist/Long.min.js > dist/Long.min.js.gz",
|
||||
"test": "node node_modules/testjs/bin/testjs tests/suite.js"
|
||||
},
|
||||
"gitHead": "59ed8d33ff4a8fadf4eb3a56ac2242f4fef3b9a4",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dcodeIO/Long.js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/dcodeIO/Long.js",
|
||||
"_id": "long@2.2.5",
|
||||
"_shasum": "5a286b6f86ea81a28720d2702948fddc7d61310e",
|
||||
"_from": "long@2.2.5",
|
||||
"_npmVersion": "1.4.28",
|
||||
"_npmUser": {
|
||||
"name": "dcode",
|
||||
"email": "dcode@dcode.io"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dcode",
|
||||
"email": "dcode@dcode.io"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "5a286b6f86ea81a28720d2702948fddc7d61310e",
|
||||
"tarball": "http://registry.npmjs.org/long/-/long-2.2.5.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/long/-/long-2.2.5.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
28
node_modules/osc/node_modules/long/scripts/build.js
generated
vendored
Normal file
28
node_modules/osc/node_modules/long/scripts/build.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
var MetaScript = require("metascript"),
|
||||
path = require("path"),
|
||||
fs = require("fs");
|
||||
|
||||
var rootDir = path.join(__dirname, ".."),
|
||||
srcDir = path.join(__dirname, "..", "src"),
|
||||
distDir = path.join(__dirname, "..", "dist"),
|
||||
pkg = require(path.join(rootDir, "package.json")),
|
||||
filename;
|
||||
|
||||
var scope = {};
|
||||
|
||||
// Build
|
||||
console.log("Building Long with scope", JSON.stringify(scope, null, 2));
|
||||
fs.writeFileSync(
|
||||
path.join(distDir, "Long.js"),
|
||||
MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "Long.js")), filename, scope, srcDir)
|
||||
);
|
||||
|
||||
// Update bower.json
|
||||
scope = { VERSION: pkg.version };
|
||||
console.log("Updating bower.json with scope", JSON.stringify(scope, null, 2));
|
||||
fs.writeFileSync(
|
||||
path.join(rootDir, "bower.json"),
|
||||
MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "bower.json")), filename, scope, srcDir)
|
||||
);
|
||||
|
||||
console.log("Done");
|
||||
944
node_modules/osc/node_modules/long/src/Long.js
generated
vendored
Normal file
944
node_modules/osc/node_modules/long/src/Long.js
generated
vendored
Normal file
|
|
@ -0,0 +1,944 @@
|
|||
/*
|
||||
Copyright 2013 Daniel Wirtz <dcode@dcode.io>
|
||||
Copyright 2009 The Closure Library Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
||||
* Released under the Apache License, Version 2.0
|
||||
* see: https://github.com/dcodeIO/Long.js for details
|
||||
*/
|
||||
(function(global) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
|
||||
* See the from* functions below for more convenient ways of constructing Longs.
|
||||
* @exports Long
|
||||
* @class A Long class for representing a 64 bit two's-complement integer value.
|
||||
* @param {number} low The low (signed) 32 bits of the long
|
||||
* @param {number} high The high (signed) 32 bits of the long
|
||||
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @constructor
|
||||
*/
|
||||
var Long = function(low, high, unsigned) {
|
||||
|
||||
/**
|
||||
* The low 32 bits as a signed value.
|
||||
* @type {number}
|
||||
* @expose
|
||||
*/
|
||||
this.low = low|0;
|
||||
|
||||
/**
|
||||
* The high 32 bits as a signed value.
|
||||
* @type {number}
|
||||
* @expose
|
||||
*/
|
||||
this.high = high|0;
|
||||
|
||||
/**
|
||||
* Whether unsigned or not.
|
||||
* @type {boolean}
|
||||
* @expose
|
||||
*/
|
||||
this.unsigned = !!unsigned;
|
||||
};
|
||||
|
||||
// The internal representation of a long is the two given signed, 32-bit values.
|
||||
// We use 32-bit pieces because these are the size of integers on which
|
||||
// Javascript performs bit-operations. For operations like addition and
|
||||
// multiplication, we split each number into 16 bit pieces, which can easily be
|
||||
// multiplied within Javascript's floating-point representation without overflow
|
||||
// or change in sign.
|
||||
//
|
||||
// In the algorithms below, we frequently reduce the negative case to the
|
||||
// positive case by negating the input(s) and then post-processing the result.
|
||||
// Note that we must ALWAYS check specially whether those values are MIN_VALUE
|
||||
// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
|
||||
// a positive number, it overflows back into a negative). Not handling this
|
||||
// case would often result in infinite recursion.
|
||||
//
|
||||
// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
|
||||
// methods on which they depend.
|
||||
|
||||
/**
|
||||
* Tests if the specified object is a Long.
|
||||
* @param {*} obj Object
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.isLong = function(obj) {
|
||||
return (obj && obj instanceof Long) === true;
|
||||
};
|
||||
|
||||
/**
|
||||
* A cache of the Long representations of small integer values.
|
||||
* @type {!Object}
|
||||
* @inner
|
||||
*/
|
||||
var INT_CACHE = {};
|
||||
|
||||
/**
|
||||
* A cache of the Long representations of small unsigned integer values.
|
||||
* @type {!Object}
|
||||
* @inner
|
||||
*/
|
||||
var UINT_CACHE = {};
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given 32 bit integer value.
|
||||
* @param {number} value The 32 bit integer in question
|
||||
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @returns {!Long} The corresponding Long value
|
||||
* @expose
|
||||
*/
|
||||
Long.fromInt = function(value, unsigned) {
|
||||
var obj, cachedObj;
|
||||
if (!unsigned) {
|
||||
value = value | 0;
|
||||
if (-128 <= value && value < 128) {
|
||||
cachedObj = INT_CACHE[value];
|
||||
if (cachedObj)
|
||||
return cachedObj;
|
||||
}
|
||||
obj = new Long(value, value < 0 ? -1 : 0, false);
|
||||
if (-128 <= value && value < 128)
|
||||
INT_CACHE[value] = obj;
|
||||
return obj;
|
||||
} else {
|
||||
value = value >>> 0;
|
||||
if (0 <= value && value < 256) {
|
||||
cachedObj = UINT_CACHE[value];
|
||||
if (cachedObj)
|
||||
return cachedObj;
|
||||
}
|
||||
obj = new Long(value, (value | 0) < 0 ? -1 : 0, true);
|
||||
if (0 <= value && value < 256)
|
||||
UINT_CACHE[value] = obj;
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
||||
* @param {number} value The number in question
|
||||
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @returns {!Long} The corresponding Long value
|
||||
* @expose
|
||||
*/
|
||||
Long.fromNumber = function(value, unsigned) {
|
||||
unsigned = !!unsigned;
|
||||
if (isNaN(value) || !isFinite(value))
|
||||
return Long.ZERO;
|
||||
if (!unsigned && value <= -TWO_PWR_63_DBL)
|
||||
return Long.MIN_VALUE;
|
||||
if (!unsigned && value + 1 >= TWO_PWR_63_DBL)
|
||||
return Long.MAX_VALUE;
|
||||
if (unsigned && value >= TWO_PWR_64_DBL)
|
||||
return Long.MAX_UNSIGNED_VALUE;
|
||||
if (value < 0)
|
||||
return Long.fromNumber(-value, unsigned).negate();
|
||||
return new Long((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
|
||||
* assumed to use 32 bits.
|
||||
* @param {number} lowBits The low 32 bits
|
||||
* @param {number} highBits The high 32 bits
|
||||
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @returns {!Long} The corresponding Long value
|
||||
* @expose
|
||||
*/
|
||||
Long.fromBits = function(lowBits, highBits, unsigned) {
|
||||
return new Long(lowBits, highBits, unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Long representation of the given string, written using the specified radix.
|
||||
* @param {string} str The textual representation of the Long
|
||||
* @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
|
||||
* @param {number=} radix The radix in which the text is written (2-36), defaults to 10
|
||||
* @returns {!Long} The corresponding Long value
|
||||
* @expose
|
||||
*/
|
||||
Long.fromString = function(str, unsigned, radix) {
|
||||
if (str.length === 0)
|
||||
throw Error('number format error: empty string');
|
||||
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
|
||||
return Long.ZERO;
|
||||
if (typeof unsigned === 'number') // For goog.math.long compatibility
|
||||
radix = unsigned,
|
||||
unsigned = false;
|
||||
radix = radix || 10;
|
||||
if (radix < 2 || 36 < radix)
|
||||
throw Error('radix out of range: ' + radix);
|
||||
|
||||
var p;
|
||||
if ((p = str.indexOf('-')) > 0)
|
||||
throw Error('number format error: interior "-" character: ' + str);
|
||||
else if (p === 0)
|
||||
return Long.fromString(str.substring(1), unsigned, radix).negate();
|
||||
|
||||
// Do several (8) digits each time through the loop, so as to
|
||||
// minimize the calls to the very expensive emulated div.
|
||||
var radixToPower = Long.fromNumber(Math.pow(radix, 8));
|
||||
|
||||
var result = Long.ZERO;
|
||||
for (var i = 0; i < str.length; i += 8) {
|
||||
var size = Math.min(8, str.length - i);
|
||||
var value = parseInt(str.substring(i, i + size), radix);
|
||||
if (size < 8) {
|
||||
var power = Long.fromNumber(Math.pow(radix, size));
|
||||
result = result.multiply(power).add(Long.fromNumber(value));
|
||||
} else {
|
||||
result = result.multiply(radixToPower);
|
||||
result = result.add(Long.fromNumber(value));
|
||||
}
|
||||
}
|
||||
result.unsigned = unsigned;
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the specified value to a Long.
|
||||
* @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.fromValue = function(val) {
|
||||
if (typeof val === 'number')
|
||||
return Long.fromNumber(val);
|
||||
if (typeof val === 'string')
|
||||
return Long.fromString(val);
|
||||
if (Long.isLong(val))
|
||||
return val;
|
||||
// Throws for not an object (undefined, null):
|
||||
return new Long(val.low, val.high, val.unsigned);
|
||||
};
|
||||
|
||||
// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
|
||||
// no runtime penalty for these.
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_16_DBL = 1 << 16;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_24_DBL = 1 << 24;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
|
||||
|
||||
/**
|
||||
* @type {!Long}
|
||||
* @const
|
||||
* @inner
|
||||
*/
|
||||
var TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
|
||||
|
||||
/**
|
||||
* Signed zero.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.ZERO = Long.fromInt(0);
|
||||
|
||||
/**
|
||||
* Unsigned zero.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.UZERO = Long.fromInt(0, true);
|
||||
|
||||
/**
|
||||
* Signed one.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.ONE = Long.fromInt(1);
|
||||
|
||||
/**
|
||||
* Unsigned one.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.UONE = Long.fromInt(1, true);
|
||||
|
||||
/**
|
||||
* Signed negative one.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.NEG_ONE = Long.fromInt(-1);
|
||||
|
||||
/**
|
||||
* Maximum signed value.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.MAX_VALUE = Long.fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
|
||||
|
||||
/**
|
||||
* Maximum unsigned value.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.MAX_UNSIGNED_VALUE = Long.fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
|
||||
|
||||
/**
|
||||
* Minimum signed value.
|
||||
* @type {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.MIN_VALUE = Long.fromBits(0, 0x80000000|0, false);
|
||||
|
||||
/**
|
||||
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
|
||||
* @returns {number}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toInt = function() {
|
||||
return this.unsigned ? this.low >>> 0 : this.low;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
|
||||
* @returns {number}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toNumber = function() {
|
||||
if (this.unsigned) {
|
||||
return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
|
||||
}
|
||||
return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the Long to a string written in the specified radix.
|
||||
* @param {number=} radix Radix (2-36), defaults to 10
|
||||
* @returns {string}
|
||||
* @override
|
||||
* @throws {RangeError} If `radix` is out of range
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toString = function(radix) {
|
||||
radix = radix || 10;
|
||||
if (radix < 2 || 36 < radix)
|
||||
throw RangeError('radix out of range: ' + radix);
|
||||
if (this.isZero())
|
||||
return '0';
|
||||
var rem;
|
||||
if (this.isNegative()) { // Unsigned Longs are never negative
|
||||
if (this.equals(Long.MIN_VALUE)) {
|
||||
// We need to change the Long value before it can be negated, so we remove
|
||||
// the bottom-most digit in this base and then recurse to do the rest.
|
||||
var radixLong = Long.fromNumber(radix);
|
||||
var div = this.div(radixLong);
|
||||
rem = div.multiply(radixLong).subtract(this);
|
||||
return div.toString(radix) + rem.toInt().toString(radix);
|
||||
} else
|
||||
return '-' + this.negate().toString(radix);
|
||||
}
|
||||
|
||||
// Do several (6) digits each time through the loop, so as to
|
||||
// minimize the calls to the very expensive emulated div.
|
||||
var radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
|
||||
rem = this;
|
||||
var result = '';
|
||||
while (true) {
|
||||
var remDiv = rem.div(radixToPower),
|
||||
intval = rem.subtract(remDiv.multiply(radixToPower)).toInt() >>> 0,
|
||||
digits = intval.toString(radix);
|
||||
rem = remDiv;
|
||||
if (rem.isZero())
|
||||
return digits + result;
|
||||
else {
|
||||
while (digits.length < 6)
|
||||
digits = '0' + digits;
|
||||
result = '' + digits + result;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as a signed integer.
|
||||
* @returns {number} Signed high bits
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getHighBits = function() {
|
||||
return this.high;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as an unsigned integer.
|
||||
* @returns {number} Unsigned high bits
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getHighBitsUnsigned = function() {
|
||||
return this.high >>> 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as a signed integer.
|
||||
* @returns {number} Signed low bits
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getLowBits = function() {
|
||||
return this.low;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as an unsigned integer.
|
||||
* @returns {number} Unsigned low bits
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getLowBitsUnsigned = function() {
|
||||
return this.low >>> 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the number of bits needed to represent the absolute value of this Long.
|
||||
* @returns {number}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.getNumBitsAbs = function() {
|
||||
if (this.isNegative()) // Unsigned Longs are never negative
|
||||
return this.equals(Long.MIN_VALUE) ? 64 : this.negate().getNumBitsAbs();
|
||||
var val = this.high != 0 ? this.high : this.low;
|
||||
for (var bit = 31; bit > 0; bit--)
|
||||
if ((val & (1 << bit)) != 0)
|
||||
break;
|
||||
return this.high != 0 ? bit + 33 : bit + 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals zero.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isZero = function() {
|
||||
return this.high === 0 && this.low === 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is negative.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isNegative = function() {
|
||||
return !this.unsigned && this.high < 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is positive.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isPositive = function() {
|
||||
return this.unsigned || this.high >= 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is odd.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isOdd = function() {
|
||||
return (this.low & 1) === 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is even.
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.isEven = function() {
|
||||
return (this.low & 1) === 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.equals = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
|
||||
return false;
|
||||
return this.high === other.high && this.low === other.low;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value differs from the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.notEquals = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return !this.equals(other);
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.lessThan = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return this.compare(other) < 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than or equal the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.lessThanOrEqual = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return this.compare(other) <= 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.greaterThan = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return this.compare(other) > 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than or equal the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {boolean}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.greaterThanOrEqual = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return this.compare(other) >= 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compares this Long's value with the specified's.
|
||||
* @param {!Long|number|string} other Other value
|
||||
* @returns {number} 0 if they are the same, 1 if the this is greater and -1
|
||||
* if the given one is greater
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.compare = function(other) {
|
||||
if (this.equals(other))
|
||||
return 0;
|
||||
var thisNeg = this.isNegative(),
|
||||
otherNeg = other.isNegative();
|
||||
if (thisNeg && !otherNeg)
|
||||
return -1;
|
||||
if (!thisNeg && otherNeg)
|
||||
return 1;
|
||||
// At this point the sign bits are the same
|
||||
if (!this.unsigned)
|
||||
return this.subtract(other).isNegative() ? -1 : 1;
|
||||
// Both are positive if at least one is unsigned
|
||||
return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Negates this Long's value.
|
||||
* @returns {!Long} Negated Long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.negate = function() {
|
||||
if (!this.unsigned && this.equals(Long.MIN_VALUE))
|
||||
return Long.MIN_VALUE;
|
||||
return this.not().add(Long.ONE);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the sum of this and the specified Long.
|
||||
* @param {!Long|number|string} addend Addend
|
||||
* @returns {!Long} Sum
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.add = function(addend) {
|
||||
if (!Long.isLong(addend))
|
||||
addend = Long.fromValue(addend);
|
||||
|
||||
// Divide each number into 4 chunks of 16 bits, and then sum the chunks.
|
||||
|
||||
var a48 = this.high >>> 16;
|
||||
var a32 = this.high & 0xFFFF;
|
||||
var a16 = this.low >>> 16;
|
||||
var a00 = this.low & 0xFFFF;
|
||||
|
||||
var b48 = addend.high >>> 16;
|
||||
var b32 = addend.high & 0xFFFF;
|
||||
var b16 = addend.low >>> 16;
|
||||
var b00 = addend.low & 0xFFFF;
|
||||
|
||||
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
||||
c00 += a00 + b00;
|
||||
c16 += c00 >>> 16;
|
||||
c00 &= 0xFFFF;
|
||||
c16 += a16 + b16;
|
||||
c32 += c16 >>> 16;
|
||||
c16 &= 0xFFFF;
|
||||
c32 += a32 + b32;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c48 += a48 + b48;
|
||||
c48 &= 0xFFFF;
|
||||
return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the specified Long.
|
||||
* @param {!Long|number|string} subtrahend Subtrahend
|
||||
* @returns {!Long} Difference
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.subtract = function(subtrahend) {
|
||||
if (!Long.isLong(subtrahend))
|
||||
subtrahend = Long.fromValue(subtrahend);
|
||||
return this.add(subtrahend.negate());
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the product of this and the specified Long.
|
||||
* @param {!Long|number|string} multiplier Multiplier
|
||||
* @returns {!Long} Product
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.multiply = function(multiplier) {
|
||||
if (this.isZero())
|
||||
return Long.ZERO;
|
||||
if (!Long.isLong(multiplier))
|
||||
multiplier = Long.fromValue(multiplier);
|
||||
if (multiplier.isZero())
|
||||
return Long.ZERO;
|
||||
if (this.equals(Long.MIN_VALUE))
|
||||
return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
|
||||
if (multiplier.equals(Long.MIN_VALUE))
|
||||
return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
|
||||
|
||||
if (this.isNegative()) {
|
||||
if (multiplier.isNegative())
|
||||
return this.negate().multiply(multiplier.negate());
|
||||
else
|
||||
return this.negate().multiply(multiplier).negate();
|
||||
} else if (multiplier.isNegative())
|
||||
return this.multiply(multiplier.negate()).negate();
|
||||
|
||||
// If both longs are small, use float multiplication
|
||||
if (this.lessThan(TWO_PWR_24) && multiplier.lessThan(TWO_PWR_24))
|
||||
return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
|
||||
|
||||
// Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
|
||||
// We can skip products that would overflow.
|
||||
|
||||
var a48 = this.high >>> 16;
|
||||
var a32 = this.high & 0xFFFF;
|
||||
var a16 = this.low >>> 16;
|
||||
var a00 = this.low & 0xFFFF;
|
||||
|
||||
var b48 = multiplier.high >>> 16;
|
||||
var b32 = multiplier.high & 0xFFFF;
|
||||
var b16 = multiplier.low >>> 16;
|
||||
var b00 = multiplier.low & 0xFFFF;
|
||||
|
||||
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
||||
c00 += a00 * b00;
|
||||
c16 += c00 >>> 16;
|
||||
c00 &= 0xFFFF;
|
||||
c16 += a16 * b00;
|
||||
c32 += c16 >>> 16;
|
||||
c16 &= 0xFFFF;
|
||||
c16 += a00 * b16;
|
||||
c32 += c16 >>> 16;
|
||||
c16 &= 0xFFFF;
|
||||
c32 += a32 * b00;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c32 += a16 * b16;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c32 += a00 * b32;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
|
||||
c48 &= 0xFFFF;
|
||||
return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the specified.
|
||||
* @param {!Long|number|string} divisor Divisor
|
||||
* @returns {!Long} Quotient
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.div = function(divisor) {
|
||||
if (!Long.isLong(divisor))
|
||||
divisor = Long.fromValue(divisor);
|
||||
if (divisor.isZero())
|
||||
throw(new Error('division by zero'));
|
||||
if (this.isZero())
|
||||
return this.unsigned ? Long.UZERO : Long.ZERO;
|
||||
var approx, rem, res;
|
||||
if (this.equals(Long.MIN_VALUE)) {
|
||||
if (divisor.equals(Long.ONE) || divisor.equals(Long.NEG_ONE))
|
||||
return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
|
||||
else if (divisor.equals(Long.MIN_VALUE))
|
||||
return Long.ONE;
|
||||
else {
|
||||
// At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
|
||||
var halfThis = this.shiftRight(1);
|
||||
approx = halfThis.div(divisor).shiftLeft(1);
|
||||
if (approx.equals(Long.ZERO)) {
|
||||
return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
|
||||
} else {
|
||||
rem = this.subtract(divisor.multiply(approx));
|
||||
res = approx.add(rem.div(divisor));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
} else if (divisor.equals(Long.MIN_VALUE))
|
||||
return this.unsigned ? Long.UZERO : Long.ZERO;
|
||||
if (this.isNegative()) {
|
||||
if (divisor.isNegative())
|
||||
return this.negate().div(divisor.negate());
|
||||
return this.negate().div(divisor).negate();
|
||||
} else if (divisor.isNegative())
|
||||
return this.div(divisor.negate()).negate();
|
||||
|
||||
// Repeat the following until the remainder is less than other: find a
|
||||
// floating-point that approximates remainder / other *from below*, add this
|
||||
// into the result, and subtract it from the remainder. It is critical that
|
||||
// the approximate value is less than or equal to the real value so that the
|
||||
// remainder never becomes negative.
|
||||
res = Long.ZERO;
|
||||
rem = this;
|
||||
while (rem.greaterThanOrEqual(divisor)) {
|
||||
// Approximate the result of division. This may be a little greater or
|
||||
// smaller than the actual value.
|
||||
approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
|
||||
|
||||
// We will tweak the approximate result by changing it in the 48-th digit or
|
||||
// the smallest non-fractional digit, whichever is larger.
|
||||
var log2 = Math.ceil(Math.log(approx) / Math.LN2),
|
||||
delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48),
|
||||
|
||||
// Decrease the approximation until it is smaller than the remainder. Note
|
||||
// that if it is too large, the product overflows and is negative.
|
||||
approxRes = Long.fromNumber(approx),
|
||||
approxRem = approxRes.multiply(divisor);
|
||||
while (approxRem.isNegative() || approxRem.greaterThan(rem)) {
|
||||
approx -= delta;
|
||||
approxRes = Long.fromNumber(approx, this.unsigned);
|
||||
approxRem = approxRes.multiply(divisor);
|
||||
}
|
||||
|
||||
// We know the answer can't be zero... and actually, zero would cause
|
||||
// infinite recursion since we would make no progress.
|
||||
if (approxRes.isZero())
|
||||
approxRes = Long.ONE;
|
||||
|
||||
res = res.add(approxRes);
|
||||
rem = rem.subtract(approxRem);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the specified.
|
||||
* @param {!Long|number|string} divisor Divisor
|
||||
* @returns {!Long} Remainder
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.modulo = function(divisor) {
|
||||
if (!Long.isLong(divisor))
|
||||
divisor = Long.fromValue(divisor);
|
||||
return this.subtract(this.div(divisor).multiply(divisor));
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the bitwise NOT of this Long.
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.not = function() {
|
||||
return Long.fromBits(~this.low, ~this.high, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the bitwise AND of this Long and the specified.
|
||||
* @param {!Long|number|string} other Other Long
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.and = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the bitwise OR of this Long and the specified.
|
||||
* @param {!Long|number|string} other Other Long
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.or = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the bitwise XOR of this Long and the given one.
|
||||
* @param {!Long|number|string} other Other Long
|
||||
* @returns {!Long}
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.xor = function(other) {
|
||||
if (!Long.isLong(other))
|
||||
other = Long.fromValue(other);
|
||||
return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount.
|
||||
* @param {number|!Long} numBits Number of bits
|
||||
* @returns {!Long} Shifted Long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.shiftLeft = function(numBits) {
|
||||
if (Long.isLong(numBits))
|
||||
numBits = numBits.toInt();
|
||||
if ((numBits &= 63) === 0)
|
||||
return this;
|
||||
else if (numBits < 32)
|
||||
return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
|
||||
else
|
||||
return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
* @param {number|!Long} numBits Number of bits
|
||||
* @returns {!Long} Shifted Long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.shiftRight = function(numBits) {
|
||||
if (Long.isLong(numBits))
|
||||
numBits = numBits.toInt();
|
||||
if ((numBits &= 63) === 0)
|
||||
return this;
|
||||
else if (numBits < 32)
|
||||
return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
|
||||
else
|
||||
return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this Long with bits logically shifted to the right by the given amount.
|
||||
* @param {number|!Long} numBits Number of bits
|
||||
* @returns {!Long} Shifted Long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.shiftRightUnsigned = function(numBits) {
|
||||
if (Long.isLong(numBits))
|
||||
numBits = numBits.toInt();
|
||||
numBits &= 63;
|
||||
if (numBits === 0)
|
||||
return this;
|
||||
else {
|
||||
var high = this.high;
|
||||
if (numBits < 32) {
|
||||
var low = this.low;
|
||||
return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
|
||||
} else if (numBits === 32)
|
||||
return Long.fromBits(high, 0, this.unsigned);
|
||||
else
|
||||
return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Long to signed.
|
||||
* @returns {!Long} Signed long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toSigned = function() {
|
||||
if (!this.unsigned)
|
||||
return this;
|
||||
return new Long(this.low, this.high, false);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Long to unsigned.
|
||||
* @returns {!Long} Unsigned long
|
||||
* @expose
|
||||
*/
|
||||
Long.prototype.toUnsigned = function() {
|
||||
if (this.unsigned)
|
||||
return this;
|
||||
return new Long(this.low, this.high, true);
|
||||
};
|
||||
|
||||
/* CommonJS */ if (typeof require === 'function' && typeof module === 'object' && module && typeof exports === 'object' && exports)
|
||||
module["exports"] = Long;
|
||||
/* AMD */ else if (typeof define === 'function' && define["amd"])
|
||||
define(function() { return Long; });
|
||||
/* Global */ else
|
||||
(global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = Long;
|
||||
|
||||
})(this);
|
||||
9
node_modules/osc/node_modules/long/src/bower.json
generated
vendored
Normal file
9
node_modules/osc/node_modules/long/src/bower.json
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "long",
|
||||
"version": "/*?= VERSION */",
|
||||
"author": "Daniel Wirtz <dcode@dcode.io>",
|
||||
"description": "A Long class for representing a 64 bit two's-complement integer value.",
|
||||
"main": "dist/Long.js",
|
||||
"keywords": ["math"],
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
807
node_modules/osc/node_modules/long/tests/goog.math.long.js
generated
vendored
Normal file
807
node_modules/osc/node_modules/long/tests/goog.math.long.js
generated
vendored
Normal file
|
|
@ -0,0 +1,807 @@
|
|||
// Copyright 2009 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Defines a Long class for representing a 64-bit two's-complement
|
||||
* integer value, which faithfully simulates the behavior of a Java "long". This
|
||||
* implementation is derived from LongLib in GWT.
|
||||
*
|
||||
*/
|
||||
|
||||
// goog.provide('goog.math.Long');
|
||||
var goog = {}; goog.math = {};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a 64-bit two's-complement integer, given its low and high 32-bit
|
||||
* values as *signed* integers. See the from* functions below for more
|
||||
* convenient ways of constructing Longs.
|
||||
*
|
||||
* The internal representation of a long is the two given signed, 32-bit values.
|
||||
* We use 32-bit pieces because these are the size of integers on which
|
||||
* Javascript performs bit-operations. For operations like addition and
|
||||
* multiplication, we split each number into 16-bit pieces, which can easily be
|
||||
* multiplied within Javascript's floating-point representation without overflow
|
||||
* or change in sign.
|
||||
*
|
||||
* In the algorithms below, we frequently reduce the negative case to the
|
||||
* positive case by negating the input(s) and then post-processing the result.
|
||||
* Note that we must ALWAYS check specially whether those values are MIN_VALUE
|
||||
* (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
|
||||
* a positive number, it overflows back into a negative). Not handling this
|
||||
* case would often result in infinite recursion.
|
||||
*
|
||||
* @param {number} low The low (signed) 32 bits of the long.
|
||||
* @param {number} high The high (signed) 32 bits of the long.
|
||||
* @constructor
|
||||
* @final
|
||||
*/
|
||||
goog.math.Long = function(low, high) {
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.low_ = low | 0; // force into 32 signed bits.
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.high_ = high | 0; // force into 32 signed bits.
|
||||
};
|
||||
|
||||
|
||||
// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the
|
||||
// from* methods on which they depend.
|
||||
|
||||
|
||||
/**
|
||||
* A cache of the Long representations of small integer values.
|
||||
* @type {!Object}
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.IntCache_ = {};
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given (32-bit) integer value.
|
||||
* @param {number} value The 32-bit integer in question.
|
||||
* @return {!goog.math.Long} The corresponding Long value.
|
||||
*/
|
||||
goog.math.Long.fromInt = function(value) {
|
||||
if (-128 <= value && value < 128) {
|
||||
var cachedObj = goog.math.Long.IntCache_[value];
|
||||
if (cachedObj) {
|
||||
return cachedObj;
|
||||
}
|
||||
}
|
||||
|
||||
var obj = new goog.math.Long(value | 0, value < 0 ? -1 : 0);
|
||||
if (-128 <= value && value < 128) {
|
||||
goog.math.Long.IntCache_[value] = obj;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given value, provided that it is a finite
|
||||
* number. Otherwise, zero is returned.
|
||||
* @param {number} value The number in question.
|
||||
* @return {!goog.math.Long} The corresponding Long value.
|
||||
*/
|
||||
goog.math.Long.fromNumber = function(value) {
|
||||
if (isNaN(value) || !isFinite(value)) {
|
||||
return goog.math.Long.ZERO;
|
||||
} else if (value <= -goog.math.Long.TWO_PWR_63_DBL_) {
|
||||
return goog.math.Long.MIN_VALUE;
|
||||
} else if (value + 1 >= goog.math.Long.TWO_PWR_63_DBL_) {
|
||||
return goog.math.Long.MAX_VALUE;
|
||||
} else if (value < 0) {
|
||||
return goog.math.Long.fromNumber(-value).negate();
|
||||
} else {
|
||||
return new goog.math.Long(
|
||||
(value % goog.math.Long.TWO_PWR_32_DBL_) | 0,
|
||||
(value / goog.math.Long.TWO_PWR_32_DBL_) | 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Long representing the 64-bit integer that comes by concatenating
|
||||
* the given high and low bits. Each is assumed to use 32 bits.
|
||||
* @param {number} lowBits The low 32-bits.
|
||||
* @param {number} highBits The high 32-bits.
|
||||
* @return {!goog.math.Long} The corresponding Long value.
|
||||
*/
|
||||
goog.math.Long.fromBits = function(lowBits, highBits) {
|
||||
return new goog.math.Long(lowBits, highBits);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Long representation of the given string, written using the given
|
||||
* radix.
|
||||
* @param {string} str The textual representation of the Long.
|
||||
* @param {number=} opt_radix The radix in which the text is written.
|
||||
* @return {!goog.math.Long} The corresponding Long value.
|
||||
*/
|
||||
goog.math.Long.fromString = function(str, opt_radix) {
|
||||
if (str.length == 0) {
|
||||
throw Error('number format error: empty string');
|
||||
}
|
||||
|
||||
var radix = opt_radix || 10;
|
||||
if (radix < 2 || 36 < radix) {
|
||||
throw Error('radix out of range: ' + radix);
|
||||
}
|
||||
|
||||
if (str.charAt(0) == '-') {
|
||||
return goog.math.Long.fromString(str.substring(1), radix).negate();
|
||||
} else if (str.indexOf('-') >= 0) {
|
||||
throw Error('number format error: interior "-" character: ' + str);
|
||||
}
|
||||
|
||||
// Do several (8) digits each time through the loop, so as to
|
||||
// minimize the calls to the very expensive emulated div.
|
||||
var radixToPower = goog.math.Long.fromNumber(Math.pow(radix, 8));
|
||||
|
||||
var result = goog.math.Long.ZERO;
|
||||
for (var i = 0; i < str.length; i += 8) {
|
||||
var size = Math.min(8, str.length - i);
|
||||
var value = parseInt(str.substring(i, i + size), radix);
|
||||
if (size < 8) {
|
||||
var power = goog.math.Long.fromNumber(Math.pow(radix, size));
|
||||
result = result.multiply(power).add(goog.math.Long.fromNumber(value));
|
||||
} else {
|
||||
result = result.multiply(radixToPower);
|
||||
result = result.add(goog.math.Long.fromNumber(value));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
// NOTE: the compiler should inline these constant values below and then remove
|
||||
// these variables, so there should be no runtime penalty for these.
|
||||
|
||||
|
||||
/**
|
||||
* Number used repeated below in calculations. This must appear before the
|
||||
* first call to any from* function below.
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.TWO_PWR_16_DBL_ = 1 << 16;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.TWO_PWR_24_DBL_ = 1 << 24;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.TWO_PWR_32_DBL_ =
|
||||
goog.math.Long.TWO_PWR_16_DBL_ * goog.math.Long.TWO_PWR_16_DBL_;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.TWO_PWR_31_DBL_ =
|
||||
goog.math.Long.TWO_PWR_32_DBL_ / 2;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.TWO_PWR_48_DBL_ =
|
||||
goog.math.Long.TWO_PWR_32_DBL_ * goog.math.Long.TWO_PWR_16_DBL_;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.TWO_PWR_64_DBL_ =
|
||||
goog.math.Long.TWO_PWR_32_DBL_ * goog.math.Long.TWO_PWR_32_DBL_;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.TWO_PWR_63_DBL_ =
|
||||
goog.math.Long.TWO_PWR_64_DBL_ / 2;
|
||||
|
||||
|
||||
/** @type {!goog.math.Long} */
|
||||
goog.math.Long.ZERO = goog.math.Long.fromInt(0);
|
||||
|
||||
|
||||
/** @type {!goog.math.Long} */
|
||||
goog.math.Long.ONE = goog.math.Long.fromInt(1);
|
||||
|
||||
|
||||
/** @type {!goog.math.Long} */
|
||||
goog.math.Long.NEG_ONE = goog.math.Long.fromInt(-1);
|
||||
|
||||
|
||||
/** @type {!goog.math.Long} */
|
||||
goog.math.Long.MAX_VALUE =
|
||||
goog.math.Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);
|
||||
|
||||
|
||||
/** @type {!goog.math.Long} */
|
||||
goog.math.Long.MIN_VALUE = goog.math.Long.fromBits(0, 0x80000000 | 0);
|
||||
|
||||
|
||||
/**
|
||||
* @type {!goog.math.Long}
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.TWO_PWR_24_ = goog.math.Long.fromInt(1 << 24);
|
||||
|
||||
|
||||
/** @return {number} The value, assuming it is a 32-bit integer. */
|
||||
goog.math.Long.prototype.toInt = function() {
|
||||
return this.low_;
|
||||
};
|
||||
|
||||
|
||||
/** @return {number} The closest floating-point representation to this value. */
|
||||
goog.math.Long.prototype.toNumber = function() {
|
||||
return this.high_ * goog.math.Long.TWO_PWR_32_DBL_ +
|
||||
this.getLowBitsUnsigned();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number=} opt_radix The radix in which the text should be written.
|
||||
* @return {string} The textual representation of this value.
|
||||
* @override
|
||||
*/
|
||||
goog.math.Long.prototype.toString = function(opt_radix) {
|
||||
var radix = opt_radix || 10;
|
||||
if (radix < 2 || 36 < radix) {
|
||||
throw Error('radix out of range: ' + radix);
|
||||
}
|
||||
|
||||
if (this.isZero()) {
|
||||
return '0';
|
||||
}
|
||||
|
||||
if (this.isNegative()) {
|
||||
if (this.equals(goog.math.Long.MIN_VALUE)) {
|
||||
// We need to change the Long value before it can be negated, so we remove
|
||||
// the bottom-most digit in this base and then recurse to do the rest.
|
||||
var radixLong = goog.math.Long.fromNumber(radix);
|
||||
var div = this.div(radixLong);
|
||||
var rem = div.multiply(radixLong).subtract(this);
|
||||
return div.toString(radix) + rem.toInt().toString(radix);
|
||||
} else {
|
||||
return '-' + this.negate().toString(radix);
|
||||
}
|
||||
}
|
||||
|
||||
// Do several (6) digits each time through the loop, so as to
|
||||
// minimize the calls to the very expensive emulated div.
|
||||
var radixToPower = goog.math.Long.fromNumber(Math.pow(radix, 6));
|
||||
|
||||
var rem = this;
|
||||
var result = '';
|
||||
while (true) {
|
||||
var remDiv = rem.div(radixToPower);
|
||||
var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt() >>> 0; // wraps around for base 36 (dcode)
|
||||
console.log(intval);
|
||||
var digits = intval.toString(radix);
|
||||
|
||||
rem = remDiv;
|
||||
if (rem.isZero()) {
|
||||
return digits + result;
|
||||
} else {
|
||||
while (digits.length < 6) {
|
||||
digits = '0' + digits;
|
||||
}
|
||||
result = '' + digits + result;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** @return {number} The high 32-bits as a signed value. */
|
||||
goog.math.Long.prototype.getHighBits = function() {
|
||||
return this.high_;
|
||||
};
|
||||
|
||||
|
||||
/** @return {number} The low 32-bits as a signed value. */
|
||||
goog.math.Long.prototype.getLowBits = function() {
|
||||
return this.low_;
|
||||
};
|
||||
|
||||
|
||||
/** @return {number} The low 32-bits as an unsigned value. */
|
||||
goog.math.Long.prototype.getLowBitsUnsigned = function() {
|
||||
return (this.low_ >= 0) ?
|
||||
this.low_ : goog.math.Long.TWO_PWR_32_DBL_ + this.low_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {number} Returns the number of bits needed to represent the absolute
|
||||
* value of this Long.
|
||||
*/
|
||||
goog.math.Long.prototype.getNumBitsAbs = function() {
|
||||
if (this.isNegative()) {
|
||||
if (this.equals(goog.math.Long.MIN_VALUE)) {
|
||||
return 64;
|
||||
} else {
|
||||
return this.negate().getNumBitsAbs();
|
||||
}
|
||||
} else {
|
||||
var val = this.high_ != 0 ? this.high_ : this.low_;
|
||||
for (var bit = 31; bit > 0; bit--) {
|
||||
if ((val & (1 << bit)) != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this.high_ != 0 ? bit + 33 : bit + 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** @return {boolean} Whether this value is zero. */
|
||||
goog.math.Long.prototype.isZero = function() {
|
||||
return this.high_ == 0 && this.low_ == 0;
|
||||
};
|
||||
|
||||
|
||||
/** @return {boolean} Whether this value is negative. */
|
||||
goog.math.Long.prototype.isNegative = function() {
|
||||
return this.high_ < 0;
|
||||
};
|
||||
|
||||
|
||||
/** @return {boolean} Whether this value is odd. */
|
||||
goog.math.Long.prototype.isOdd = function() {
|
||||
return (this.low_ & 1) == 1;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.math.Long} other Long to compare against.
|
||||
* @return {boolean} Whether this Long equals the other.
|
||||
*/
|
||||
goog.math.Long.prototype.equals = function(other) {
|
||||
return (this.high_ == other.high_) && (this.low_ == other.low_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.math.Long} other Long to compare against.
|
||||
* @return {boolean} Whether this Long does not equal the other.
|
||||
*/
|
||||
goog.math.Long.prototype.notEquals = function(other) {
|
||||
return (this.high_ != other.high_) || (this.low_ != other.low_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.math.Long} other Long to compare against.
|
||||
* @return {boolean} Whether this Long is less than the other.
|
||||
*/
|
||||
goog.math.Long.prototype.lessThan = function(other) {
|
||||
return this.compare(other) < 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.math.Long} other Long to compare against.
|
||||
* @return {boolean} Whether this Long is less than or equal to the other.
|
||||
*/
|
||||
goog.math.Long.prototype.lessThanOrEqual = function(other) {
|
||||
return this.compare(other) <= 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.math.Long} other Long to compare against.
|
||||
* @return {boolean} Whether this Long is greater than the other.
|
||||
*/
|
||||
goog.math.Long.prototype.greaterThan = function(other) {
|
||||
return this.compare(other) > 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.math.Long} other Long to compare against.
|
||||
* @return {boolean} Whether this Long is greater than or equal to the other.
|
||||
*/
|
||||
goog.math.Long.prototype.greaterThanOrEqual = function(other) {
|
||||
return this.compare(other) >= 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Compares this Long with the given one.
|
||||
* @param {goog.math.Long} other Long to compare against.
|
||||
* @return {number} 0 if they are the same, 1 if the this is greater, and -1
|
||||
* if the given one is greater.
|
||||
*/
|
||||
goog.math.Long.prototype.compare = function(other) {
|
||||
if (this.equals(other)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var thisNeg = this.isNegative();
|
||||
var otherNeg = other.isNegative();
|
||||
if (thisNeg && !otherNeg) {
|
||||
return -1;
|
||||
}
|
||||
if (!thisNeg && otherNeg) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// at this point, the signs are the same, so subtraction will not overflow
|
||||
if (this.subtract(other).isNegative()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** @return {!goog.math.Long} The negation of this value. */
|
||||
goog.math.Long.prototype.negate = function() {
|
||||
if (this.equals(goog.math.Long.MIN_VALUE)) {
|
||||
return goog.math.Long.MIN_VALUE;
|
||||
} else {
|
||||
return this.not().add(goog.math.Long.ONE);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the sum of this and the given Long.
|
||||
* @param {goog.math.Long} other Long to add to this one.
|
||||
* @return {!goog.math.Long} The sum of this and the given Long.
|
||||
*/
|
||||
goog.math.Long.prototype.add = function(other) {
|
||||
// Divide each number into 4 chunks of 16 bits, and then sum the chunks.
|
||||
|
||||
var a48 = this.high_ >>> 16;
|
||||
var a32 = this.high_ & 0xFFFF;
|
||||
var a16 = this.low_ >>> 16;
|
||||
var a00 = this.low_ & 0xFFFF;
|
||||
|
||||
var b48 = other.high_ >>> 16;
|
||||
var b32 = other.high_ & 0xFFFF;
|
||||
var b16 = other.low_ >>> 16;
|
||||
var b00 = other.low_ & 0xFFFF;
|
||||
|
||||
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
||||
c00 += a00 + b00;
|
||||
c16 += c00 >>> 16;
|
||||
c00 &= 0xFFFF;
|
||||
c16 += a16 + b16;
|
||||
c32 += c16 >>> 16;
|
||||
c16 &= 0xFFFF;
|
||||
c32 += a32 + b32;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c48 += a48 + b48;
|
||||
c48 &= 0xFFFF;
|
||||
return goog.math.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the given Long.
|
||||
* @param {goog.math.Long} other Long to subtract from this.
|
||||
* @return {!goog.math.Long} The difference of this and the given Long.
|
||||
*/
|
||||
goog.math.Long.prototype.subtract = function(other) {
|
||||
return this.add(other.negate());
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the product of this and the given long.
|
||||
* @param {goog.math.Long} other Long to multiply with this.
|
||||
* @return {!goog.math.Long} The product of this and the other.
|
||||
*/
|
||||
goog.math.Long.prototype.multiply = function(other) {
|
||||
if (this.isZero()) {
|
||||
return goog.math.Long.ZERO;
|
||||
} else if (other.isZero()) {
|
||||
return goog.math.Long.ZERO;
|
||||
}
|
||||
|
||||
if (this.equals(goog.math.Long.MIN_VALUE)) {
|
||||
return other.isOdd() ? goog.math.Long.MIN_VALUE : goog.math.Long.ZERO;
|
||||
} else if (other.equals(goog.math.Long.MIN_VALUE)) {
|
||||
return this.isOdd() ? goog.math.Long.MIN_VALUE : goog.math.Long.ZERO;
|
||||
}
|
||||
|
||||
if (this.isNegative()) {
|
||||
if (other.isNegative()) {
|
||||
return this.negate().multiply(other.negate());
|
||||
} else {
|
||||
return this.negate().multiply(other).negate();
|
||||
}
|
||||
} else if (other.isNegative()) {
|
||||
return this.multiply(other.negate()).negate();
|
||||
}
|
||||
|
||||
// If both longs are small, use float multiplication
|
||||
if (this.lessThan(goog.math.Long.TWO_PWR_24_) &&
|
||||
other.lessThan(goog.math.Long.TWO_PWR_24_)) {
|
||||
return goog.math.Long.fromNumber(this.toNumber() * other.toNumber());
|
||||
}
|
||||
|
||||
// Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
|
||||
// We can skip products that would overflow.
|
||||
|
||||
var a48 = this.high_ >>> 16;
|
||||
var a32 = this.high_ & 0xFFFF;
|
||||
var a16 = this.low_ >>> 16;
|
||||
var a00 = this.low_ & 0xFFFF;
|
||||
|
||||
var b48 = other.high_ >>> 16;
|
||||
var b32 = other.high_ & 0xFFFF;
|
||||
var b16 = other.low_ >>> 16;
|
||||
var b00 = other.low_ & 0xFFFF;
|
||||
|
||||
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
||||
c00 += a00 * b00;
|
||||
c16 += c00 >>> 16;
|
||||
c00 &= 0xFFFF;
|
||||
c16 += a16 * b00;
|
||||
c32 += c16 >>> 16;
|
||||
c16 &= 0xFFFF;
|
||||
c16 += a00 * b16;
|
||||
c32 += c16 >>> 16;
|
||||
c16 &= 0xFFFF;
|
||||
c32 += a32 * b00;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c32 += a16 * b16;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c32 += a00 * b32;
|
||||
c48 += c32 >>> 16;
|
||||
c32 &= 0xFFFF;
|
||||
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
|
||||
c48 &= 0xFFFF;
|
||||
return goog.math.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the given one.
|
||||
* @param {goog.math.Long} other Long by which to divide.
|
||||
* @return {!goog.math.Long} This Long divided by the given one.
|
||||
*/
|
||||
goog.math.Long.prototype.div = function(other) {
|
||||
if (other.isZero()) {
|
||||
throw Error('division by zero');
|
||||
} else if (this.isZero()) {
|
||||
return goog.math.Long.ZERO;
|
||||
}
|
||||
|
||||
if (this.equals(goog.math.Long.MIN_VALUE)) {
|
||||
if (other.equals(goog.math.Long.ONE) ||
|
||||
other.equals(goog.math.Long.NEG_ONE)) {
|
||||
return goog.math.Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
|
||||
} else if (other.equals(goog.math.Long.MIN_VALUE)) {
|
||||
return goog.math.Long.ONE;
|
||||
} else {
|
||||
// At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
|
||||
var halfThis = this.shiftRight(1);
|
||||
var approx = halfThis.div(other).shiftLeft(1);
|
||||
if (approx.equals(goog.math.Long.ZERO)) {
|
||||
return other.isNegative() ? goog.math.Long.ONE : goog.math.Long.NEG_ONE;
|
||||
} else {
|
||||
var rem = this.subtract(other.multiply(approx));
|
||||
var result = approx.add(rem.div(other));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
} else if (other.equals(goog.math.Long.MIN_VALUE)) {
|
||||
return goog.math.Long.ZERO;
|
||||
}
|
||||
|
||||
if (this.isNegative()) {
|
||||
if (other.isNegative()) {
|
||||
return this.negate().div(other.negate());
|
||||
} else {
|
||||
return this.negate().div(other).negate();
|
||||
}
|
||||
} else if (other.isNegative()) {
|
||||
return this.div(other.negate()).negate();
|
||||
}
|
||||
|
||||
// Repeat the following until the remainder is less than other: find a
|
||||
// floating-point that approximates remainder / other *from below*, add this
|
||||
// into the result, and subtract it from the remainder. It is critical that
|
||||
// the approximate value is less than or equal to the real value so that the
|
||||
// remainder never becomes negative.
|
||||
var res = goog.math.Long.ZERO;
|
||||
var rem = this;
|
||||
while (rem.greaterThanOrEqual(other)) {
|
||||
// Approximate the result of division. This may be a little greater or
|
||||
// smaller than the actual value.
|
||||
var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));
|
||||
|
||||
// We will tweak the approximate result by changing it in the 48-th digit or
|
||||
// the smallest non-fractional digit, whichever is larger.
|
||||
var log2 = Math.ceil(Math.log(approx) / Math.LN2);
|
||||
var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);
|
||||
|
||||
// Decrease the approximation until it is smaller than the remainder. Note
|
||||
// that if it is too large, the product overflows and is negative.
|
||||
var approxRes = goog.math.Long.fromNumber(approx);
|
||||
var approxRem = approxRes.multiply(other);
|
||||
while (approxRem.isNegative() || approxRem.greaterThan(rem)) {
|
||||
approx -= delta;
|
||||
approxRes = goog.math.Long.fromNumber(approx);
|
||||
approxRem = approxRes.multiply(other);
|
||||
}
|
||||
|
||||
// We know the answer can't be zero... and actually, zero would cause
|
||||
// infinite recursion since we would make no progress.
|
||||
if (approxRes.isZero()) {
|
||||
approxRes = goog.math.Long.ONE;
|
||||
}
|
||||
|
||||
res = res.add(approxRes);
|
||||
rem = rem.subtract(approxRem);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the given one.
|
||||
* @param {goog.math.Long} other Long by which to mod.
|
||||
* @return {!goog.math.Long} This Long modulo the given one.
|
||||
*/
|
||||
goog.math.Long.prototype.modulo = function(other) {
|
||||
return this.subtract(this.div(other).multiply(other));
|
||||
};
|
||||
|
||||
|
||||
/** @return {!goog.math.Long} The bitwise-NOT of this value. */
|
||||
goog.math.Long.prototype.not = function() {
|
||||
return goog.math.Long.fromBits(~this.low_, ~this.high_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the bitwise-AND of this Long and the given one.
|
||||
* @param {goog.math.Long} other The Long with which to AND.
|
||||
* @return {!goog.math.Long} The bitwise-AND of this and the other.
|
||||
*/
|
||||
goog.math.Long.prototype.and = function(other) {
|
||||
return goog.math.Long.fromBits(this.low_ & other.low_,
|
||||
this.high_ & other.high_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the bitwise-OR of this Long and the given one.
|
||||
* @param {goog.math.Long} other The Long with which to OR.
|
||||
* @return {!goog.math.Long} The bitwise-OR of this and the other.
|
||||
*/
|
||||
goog.math.Long.prototype.or = function(other) {
|
||||
return goog.math.Long.fromBits(this.low_ | other.low_,
|
||||
this.high_ | other.high_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the bitwise-XOR of this Long and the given one.
|
||||
* @param {goog.math.Long} other The Long with which to XOR.
|
||||
* @return {!goog.math.Long} The bitwise-XOR of this and the other.
|
||||
*/
|
||||
goog.math.Long.prototype.xor = function(other) {
|
||||
return goog.math.Long.fromBits(this.low_ ^ other.low_,
|
||||
this.high_ ^ other.high_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount.
|
||||
* @param {number} numBits The number of bits by which to shift.
|
||||
* @return {!goog.math.Long} This shifted to the left by the given amount.
|
||||
*/
|
||||
goog.math.Long.prototype.shiftLeft = function(numBits) {
|
||||
numBits &= 63;
|
||||
if (numBits == 0) {
|
||||
return this;
|
||||
} else {
|
||||
var low = this.low_;
|
||||
if (numBits < 32) {
|
||||
var high = this.high_;
|
||||
return goog.math.Long.fromBits(
|
||||
low << numBits,
|
||||
(high << numBits) | (low >>> (32 - numBits)));
|
||||
} else {
|
||||
return goog.math.Long.fromBits(0, low << (numBits - 32));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the right by the given amount.
|
||||
* @param {number} numBits The number of bits by which to shift.
|
||||
* @return {!goog.math.Long} This shifted to the right by the given amount.
|
||||
*/
|
||||
goog.math.Long.prototype.shiftRight = function(numBits) {
|
||||
numBits &= 63;
|
||||
if (numBits == 0) {
|
||||
return this;
|
||||
} else {
|
||||
var high = this.high_;
|
||||
if (numBits < 32) {
|
||||
var low = this.low_;
|
||||
return goog.math.Long.fromBits(
|
||||
(low >>> numBits) | (high << (32 - numBits)),
|
||||
high >> numBits);
|
||||
} else {
|
||||
return goog.math.Long.fromBits(
|
||||
high >> (numBits - 32),
|
||||
high >= 0 ? 0 : -1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the right by the given amount, with
|
||||
* zeros placed into the new leading bits.
|
||||
* @param {number} numBits The number of bits by which to shift.
|
||||
* @return {!goog.math.Long} This shifted to the right by the given amount, with
|
||||
* zeros placed into the new leading bits.
|
||||
*/
|
||||
goog.math.Long.prototype.shiftRightUnsigned = function(numBits) {
|
||||
numBits &= 63;
|
||||
if (numBits == 0) {
|
||||
return this;
|
||||
} else {
|
||||
var high = this.high_;
|
||||
if (numBits < 32) {
|
||||
var low = this.low_;
|
||||
return goog.math.Long.fromBits(
|
||||
(low >>> numBits) | (high << (32 - numBits)),
|
||||
high >>> numBits);
|
||||
} else if (numBits == 32) {
|
||||
return goog.math.Long.fromBits(high, 0);
|
||||
} else {
|
||||
return goog.math.Long.fromBits(high >>> (numBits - 32), 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = goog.math.Long;
|
||||
156
node_modules/osc/node_modules/long/tests/suite.js
generated
vendored
Normal file
156
node_modules/osc/node_modules/long/tests/suite.js
generated
vendored
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
Copyright 2013 Daniel Wirtz <dcode@dcode.io>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Long.js Pretty Simple Test Suite.
|
||||
*/
|
||||
var Long = require(__dirname+"/../index.js"),
|
||||
gmLong = require("./goog.math.long.js");
|
||||
|
||||
var suite = {
|
||||
|
||||
"basic": function(test) {
|
||||
var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
|
||||
test.equal(longVal.toNumber(), 9223372036854775807);
|
||||
test.equal(longVal.toString(), "9223372036854775807");
|
||||
var longVal2 = Long.fromValue(longVal);
|
||||
test.equal(longVal2.toNumber(), 9223372036854775807);
|
||||
test.equal(longVal2.toString(), "9223372036854775807");
|
||||
test.equal(longVal2.unsigned, longVal.unsigned);
|
||||
test.done();
|
||||
},
|
||||
|
||||
// Let's assume goog.math.Long has been tested properly and focus on our extensions:
|
||||
|
||||
"toString": function(test) {
|
||||
var longVal = Long.fromBits(0xFFFFFFFF, 0xFFFFFFFF, true);
|
||||
// #10
|
||||
test.equal(longVal.toString(16), "ffffffffffffffff");
|
||||
test.equal(longVal.toString(10), "18446744073709551615");
|
||||
test.equal(longVal.toString(8), "1777777777777777777777");
|
||||
// #7, obviously wrong in goog.math.Long
|
||||
test.equal(Long.fromString("zzzzzz", 36).toString(36), "zzzzzz");
|
||||
test.equal(Long.fromString("-zzzzzz", 36).toString(36), "-zzzzzz");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"unsigned": {
|
||||
|
||||
"min/max": function(test) {
|
||||
test.equal(Long.MIN_VALUE.toString(), "-9223372036854775808");
|
||||
test.equal(Long.MAX_VALUE.toString(), "9223372036854775807");
|
||||
test.equal(Long.MAX_UNSIGNED_VALUE.toString(), "18446744073709551615");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"construct_negint": function(test) {
|
||||
var longVal = Long.fromInt(-1, true);
|
||||
test.equal(longVal.low, -1);
|
||||
test.equal(longVal.high, -1);
|
||||
test.equal(longVal.unsigned, true);
|
||||
test.equal(longVal.toNumber(), 18446744073709551615);
|
||||
test.equal(longVal.toString(), "18446744073709551615");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"construct_highlow": function(test) {
|
||||
var longVal = new Long(0xFFFFFFFF, 0xFFFFFFFF, true);
|
||||
test.equal(longVal.low, -1);
|
||||
test.equal(longVal.high, -1);
|
||||
test.equal(longVal.unsigned, true);
|
||||
test.equal(longVal.toNumber(), 18446744073709551615);
|
||||
test.equal(longVal.toString(), "18446744073709551615");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"construct_number": function(test) {
|
||||
var longVal = Long.fromNumber(0xFFFFFFFFFFFFFFFF, true);
|
||||
test.equal(longVal.low, -1);
|
||||
test.equal(longVal.high, -1);
|
||||
test.equal(longVal.unsigned, true);
|
||||
test.equal(longVal.toNumber(), 18446744073709551615);
|
||||
test.equal(longVal.toString(), "18446744073709551615");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"toSigned/Unsigned": function(test) {
|
||||
var longVal = Long.fromNumber(-1, false);
|
||||
test.equal(longVal.toNumber(), -1);
|
||||
longVal = longVal.toUnsigned();
|
||||
test.equal(longVal.toNumber(), 0xFFFFFFFFFFFFFFFF);
|
||||
longVal = longVal.toSigned();
|
||||
test.equal(longVal.toNumber(), -1);
|
||||
test.done();
|
||||
},
|
||||
|
||||
"max_unsigned_sub_max_signed": function(test) {
|
||||
var longVal = Long.MAX_UNSIGNED_VALUE.subtract(Long.MAX_VALUE).subtract(Long.ONE);
|
||||
test.equal(longVal.toNumber(), Long.MAX_VALUE);
|
||||
test.equal(longVal.toString(), Long.MAX_VALUE.toString());
|
||||
test.done();
|
||||
},
|
||||
|
||||
"max_sub_max": function(test) {
|
||||
var longVal = Long.MAX_UNSIGNED_VALUE.subtract(Long.MAX_UNSIGNED_VALUE);
|
||||
test.equal(longVal, 0);
|
||||
test.equal(longVal.low, 0);
|
||||
test.equal(longVal.high, 0);
|
||||
test.equal(longVal.unsigned, true);
|
||||
test.equal(longVal.toNumber(), 0);
|
||||
test.equal(longVal.toString(), "0");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"zero_sub_signed": function(test) {
|
||||
var longVal = Long.fromInt(0, true).add(Long.fromInt(-1, false));
|
||||
test.equal(longVal.low, -1);
|
||||
test.equal(longVal.high, -1);
|
||||
test.equal(longVal.unsigned, true);
|
||||
test.equal(longVal.toNumber(), 18446744073709551615);
|
||||
test.equal(longVal.toString(), "18446744073709551615");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"max_unsigned_div_max_signed": function(test) {
|
||||
var longVal = Long.MAX_UNSIGNED_VALUE.div(Long.MAX_VALUE);
|
||||
test.equal(longVal.toNumber(), 2);
|
||||
test.equal(longVal.toString(), "2");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"max_unsigned_div_neg_signed": function(test) {
|
||||
var longVal = Long.MAX_UNSIGNED_VALUE.div(Long.fromInt(-2));
|
||||
test.equal(longVal.toNumber(), -Long.MAX_VALUE);
|
||||
test.done();
|
||||
},
|
||||
|
||||
"min_signed_div_one": function(test) {
|
||||
var longVal = Long.MIN_VALUE.div(Long.ONE);
|
||||
test.equal(longVal.toNumber(), Long.MIN_VALUE);
|
||||
test.done();
|
||||
},
|
||||
|
||||
"msb_unsigned": function(test) {
|
||||
var longVal = Long.UONE.shiftLeft(63);
|
||||
test.ok(longVal.notEquals(Long.MIN_VALUE));
|
||||
test.equal(longVal.toString(), "9223372036854775808");
|
||||
test.equal(Long.fromString("9223372036854775808", true).toString(), "9223372036854775808");
|
||||
test.done();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = suite;
|
||||
28
node_modules/osc/node_modules/serialport/.jshintrc
generated
vendored
Normal file
28
node_modules/osc/node_modules/serialport/.jshintrc
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"node": true,
|
||||
"strict": true,
|
||||
"mocha": true,
|
||||
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"expr": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"loopfunc": false,
|
||||
"noarg": true,
|
||||
"shadow": false,
|
||||
"supernew": false,
|
||||
"undef": true,
|
||||
|
||||
"newcap": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"indent": 2,
|
||||
"white": true,
|
||||
"quotmark": true,
|
||||
|
||||
"maxparams": 5,
|
||||
"maxdepth": 3,
|
||||
"maxstatements": 60, //default 25
|
||||
"maxcomplexity": 40 //default 6
|
||||
}
|
||||
5
node_modules/osc/node_modules/serialport/.npmignore
generated
vendored
Normal file
5
node_modules/osc/node_modules/serialport/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
serialport_native/build
|
||||
serialport_native.node
|
||||
serialport_native/.lock-wscript
|
||||
*.node
|
||||
.DS_Store
|
||||
75
node_modules/osc/node_modules/serialport/.travis.yml
generated
vendored
Normal file
75
node_modules/osc/node_modules/serialport/.travis.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
- '0.11'
|
||||
- '0.12'
|
||||
compiler: clang
|
||||
env:
|
||||
global:
|
||||
- secure: "Zg7w8hTpgVfm6JeTScsMhaexFcVS5N2oI9O/6MLtsm3CUhb0Txq65y4y/a5DU3re6Pl1ryE21anVLdg4RGDeykCauQtg8nFzuGXBfNn9bRTnsIfkiS9LNkbSZ8h3c7EsyX0NJ7LVgnkPh/XXMqMj4Nh0ovbBCwZJ6k2ZvccvDvU="
|
||||
- secure: "VS7JTJYfcCDOiWZH6g+Lm4y+QFuCB++4GnYvWqqaUljebuB2l8gZhDrmQtWKFPBEZP21ptjtpNWJC6hCUf07qJ81vVpb6wMUikfOOLN0nulED+AC5HtCxYnfwIu1i0z00YxaSfvozMXKk9TCLabE0ognoDV+XV1bQoYm8668z7E="
|
||||
|
||||
before_install:
|
||||
# get commit message
|
||||
- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
|
||||
# put local node-pre-gyp on PATH
|
||||
- export PATH=./node_modules/.bin/:$PATH
|
||||
# put global node-gyp on PATH
|
||||
- npm install node-gyp -g
|
||||
# install aws-sdk so it is available for publishing
|
||||
- npm install aws-sdk
|
||||
# figure out if we should publish
|
||||
- PUBLISH_BINARY=false
|
||||
# if we are building a tag then publish
|
||||
- if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then PUBLISH_BINARY=true; fi;
|
||||
# or if we put [publish binary] in the commit message
|
||||
- if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi;
|
||||
- platform=$(uname -s | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/")
|
||||
# If version is 0.9 do not publish to avoid duplicated binary error, caused by 0.9 and 0.10
|
||||
# returning same v number in node.js.
|
||||
- if [[ "$TRAVIS_NODE_VERSION" == '0.9' ]]; then PUBLISH_BINARY=false; fi;
|
||||
# Fix a problem with apt-get failing later, see http://docs.travis-ci.com/user/installing-dependencies/#Installing-Ubuntu-packages
|
||||
- sudo apt-get update -qq
|
||||
|
||||
|
||||
install:
|
||||
# ensure source install works
|
||||
- npm install --build-from-source
|
||||
# test our module
|
||||
- node serialport.js
|
||||
|
||||
before_script:
|
||||
- echo "Publishing native platform Binary Package? ->" $PUBLISH_BINARY
|
||||
# if publishing, do it
|
||||
- if [[ $PUBLISH_BINARY == true ]]; then node-pre-gyp package publish; fi;
|
||||
# cleanup
|
||||
- node-pre-gyp clean
|
||||
- node-gyp clean
|
||||
|
||||
script:
|
||||
# if publishing, test installing from remote
|
||||
- INSTALL_RESULT=0
|
||||
- if [[ $PUBLISH_BINARY == true ]]; then INSTALL_RESULT=$(npm install --fallback-to-build=false > /dev/null)$? || true; fi;
|
||||
# if install returned non zero (errored) then we first unpublish and then call false so travis will bail at this line
|
||||
- if [[ $INSTALL_RESULT != 0 ]]; then echo "returned $INSTALL_RESULT";node-pre-gyp unpublish;false; fi
|
||||
# If success then we arrive here so lets clean up
|
||||
- node-pre-gyp clean
|
||||
# node v0.8 and above provide pre-built 32 bit and 64 bit binaries
|
||||
# so here we use the 32 bit ones to also test 32 bit builds
|
||||
- NVER=`node -v`
|
||||
- wget http://nodejs.org/dist/${NVER}/node-${NVER}-${platform}-x86.tar.gz
|
||||
- tar xf node-${NVER}-${platform}-x86.tar.gz
|
||||
# enable 32 bit node
|
||||
- export PATH=$(pwd)/node-${NVER}-${platform}-x86/bin:$PATH
|
||||
# install 32 bit compiler toolchain and X11
|
||||
- if [[ "$platform" == 'linux' ]]; then sudo apt-get -y install gcc-multilib g++-multilib; fi
|
||||
# test source compile in 32 bit mode with internal libsqlite3
|
||||
- if [[ "$platform" == 'linux' ]]; then CC=gcc-4.6 CXX=g++-4.6 npm install --build-from-source; else npm install --build-from-source; fi
|
||||
- npm test
|
||||
# publish 32 bit build
|
||||
- echo "Publishing x86 32bit Binary Package? ->" $PUBLISH_BINARY
|
||||
- if [[ $PUBLISH_BINARY == true ]]; then node-pre-gyp package publish; fi;
|
||||
|
||||
after_success:
|
||||
# if success then query and display all published binaries
|
||||
- node-pre-gyp info
|
||||
18
node_modules/osc/node_modules/serialport/AUTHORS
generated
vendored
Normal file
18
node_modules/osc/node_modules/serialport/AUTHORS
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# The main authors of this library
|
||||
|
||||
Chris Williams <chris@iterativedesigns.com>
|
||||
Jay Beavers <jay@hikinghomeschoolers.org>
|
||||
Francis Gulotta <wizard@roborooter.com>
|
||||
Rob Giseburt <giseburt@gmail.com>
|
||||
|
||||
# Other contributors ordered by first contribution.
|
||||
|
||||
Joe Ferner <joe.ferner@nearinfinity.com>
|
||||
Esa-Matti Suuronen <esa-matti@suuronen.org>
|
||||
Nathan Rajlich <nathan@tootallnate.net>
|
||||
Rick Waldron <waldron.rick@gmail.com>
|
||||
<w1nk>
|
||||
Georges-Etienne Legendre <legege>
|
||||
Duane Johnson <duane.johnson@gmail.com>
|
||||
Rod Vagg <@rvagg>
|
||||
Edgar Silva <@edgarsilva>
|
||||
24
node_modules/osc/node_modules/serialport/Gruntfile.js
generated
vendored
Normal file
24
node_modules/osc/node_modules/serialport/Gruntfile.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
mochaTest: {
|
||||
test: {
|
||||
options: { reporter: 'spec' },
|
||||
src: ['test/**/*.js']
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
all: ['*.js', 'test/**/*.js', 'arduinoTest/**/*.js'],
|
||||
options:{
|
||||
jshintrc: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-mocha-test');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.registerTask('default', ['jshint', 'mochaTest']);
|
||||
|
||||
};
|
||||
18
node_modules/osc/node_modules/serialport/LICENSE
generated
vendored
Normal file
18
node_modules/osc/node_modules/serialport/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
Copyright 2010, 2011, 2012 Christopher Williams. 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.
|
||||
30
node_modules/osc/node_modules/serialport/Makefile
generated
vendored
Normal file
30
node_modules/osc/node_modules/serialport/Makefile
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
VERSION := $(shell node -e "console.log(require('./package.json').version)")
|
||||
|
||||
.PHONY: default release
|
||||
|
||||
# Add a default task so we don't release just because someone ran 'make'
|
||||
default:
|
||||
@echo "Did you mean to release a new version?"
|
||||
@echo "If so, run 'make release'."
|
||||
|
||||
release:
|
||||
@echo "Tagging release $(VERSION)"
|
||||
@git tag -m "$(VERSION)" v$(VERSION)
|
||||
|
||||
@echo "Pushing tags to GitHub"
|
||||
@git push --tags
|
||||
|
||||
@echo "Switching to osx-binaries branch"
|
||||
@git checkout osx-binaries
|
||||
|
||||
@echo "Merging master into osx-binaries"
|
||||
@git merge --no-ff --commit -m "Merge master into osx-binaries [publish binary]" master
|
||||
|
||||
@echo "Pushing osx-binaries"
|
||||
@git push
|
||||
|
||||
@echo "Switching to master branch"
|
||||
@git checkout master
|
||||
|
||||
@echo "Publishing to NPM"
|
||||
@npm publish ./
|
||||
415
node_modules/osc/node_modules/serialport/README.md
generated
vendored
Normal file
415
node_modules/osc/node_modules/serialport/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,415 @@
|
|||
```
|
||||
eeeee eeeee eeeee eeee e eeeee
|
||||
8 8 8 88 8 8 8 8 8 "
|
||||
8e 8 8 8 8e 8 8eee 8e 8eeee
|
||||
88 8 8 8 88 8 88 e 88 88
|
||||
88 8 8eee8 88ee8 88ee 88 8ee88 8ee88
|
||||
|
||||
eeeee eeee eeeee e eeeee e eeeee eeeee eeeee eeeee
|
||||
8 " 8 8 8 8 8 8 8 8 8 8 88 8 8 8
|
||||
8eeee 8eee 8eee8e 8e 8eee8 8e 8eee8 8 8 8eee8e 8e
|
||||
88 88 88 8 88 88 8 88 88 8 8 88 8 88
|
||||
8ee88 88ee 88 8 88 88 8 88eee 88 8eee8 88 8 88
|
||||
```
|
||||
|
||||
[](https://travis-ci.org/voodootikigod/node-serialport)
|
||||
[](https://gitter.im/voodootikigod/node-serialport)
|
||||
[
|
||||
|
||||
For all discussions, designs, and clarifications, we recommend you join our Gitter Chat room: [https://gitter.im/voodootikigod/node-serialport](https://gitter.im/voodootikigod/node-serialport)
|
||||
|
||||
|
||||
|
||||
Version: 1.6.1 - Released March 5, 2015
|
||||
|
||||
*****
|
||||
|
||||
Imagine a world where you can write JavaScript to control blenders, lights, security systems, or even robots. Yes, I said robots. That world is here and now with node-serialport. It provides a very simple interface to the low level serial port code necessary to program [Arduino](http://www.arduino.cc/) chipsets, [X10](http://www.smarthome.com/manuals/protocol.txt) wireless communications, or even the rising [Z-Wave](http://www.z-wave.com/modules/ZwaveStart/) and [Zigbee](http://www.zigbee.org/) standards. The physical world is your oyster with this goodie. For a full break down of why we made this, please read [NodeBots - The Rise of JS Robotics](http://www.voodootikigod.com/nodebots-the-rise-of-js-robotics).
|
||||
|
||||
*****
|
||||
|
||||
Robots, you say?
|
||||
================
|
||||
|
||||
This library is admittedly a base level toolkit for building amazing things with real world (including robots). Here are a couple of those amazing things that leverage node-serialport:
|
||||
|
||||
* [Johnny-Five](https://github.com/rwaldron/johnny-five) - JavaScript IoT and Robotics programming framework.
|
||||
* [Cylon.js](http://cylonjs.com/) - JavaScript Robotics, By Your Command.
|
||||
* [node-l8smartlight](http://jakobwesthoff.github.io/node-l8smartlight/) ([source](https://github.com/jakobwesthoff/node-l8smartlight)) A node library to control the L8 Smartlight via Bluetooth or USB port
|
||||
* [firmata](https://github.com/jgautier/firmata) Talk natively to Arduino using the firmata protocol.
|
||||
* [tmpad](http://tmpvar.com/project/tmpad/) [source](https://github.com/tmpvar/tmpad) - a DIY midi pad using infrared, arduino, and nodejs. [Video](http://vimeo.com/34575470)
|
||||
* [duino](https://github.com/ecto/duino) - A higher level framework for working with Arduinos in node.js.
|
||||
* [Arduino Drinking Game Extravaganza](http://jsconf.eu/2011/arduino_drinking_game_extravaganza.html) - AKA "The Russian" a hexidecimal drinking game for geeks by Uxebu presented at JSConf EU 2011.
|
||||
* [Arduino controlling popcorn.js](https://gist.github.com/968773) - Controlling a popcorn.js video with an Arduino kit.
|
||||
* [Robotic JavaScript](http://jsconf.eu/2010/speaker/livingroombindmotion_function.html) - The first live presentation of the node-serialport code set as presented at JSConf EU 2010.
|
||||
* [devicestack](https://github.com/adrai/devicestack) - This module helps you to represent a device and its protocol.
|
||||
* [reflecta](https://github.com/JayBeavers/Reflecta) A communication protocol that combines Arduino Libraries and NodeJS into an integrated system.
|
||||
* [rc4pt-node](https://github.com/comsolid/rc4pt-node) - Control Popcorntime with an Infrared receiver and Arduino.
|
||||
|
||||
For getting started with node-serialport, we recommend you begin with the following articles:
|
||||
|
||||
* [Arduino Node Security Sensor Hacking](http://nexxylove.tumblr.com/post/20159263403/arduino-node-security-sensor-hacking) - A great all around "how do I use this" article.
|
||||
* [NodeBots - The Rise of JS Robotics](http://www.voodootikigod.com/nodebots-the-rise-of-js-robotics) - A survey article of why one would want to program robots in JS.
|
||||
* [Johnny-Five Getting Started Guide](https://github.com/rwldrn/johnny-five#setup-and-assemble-arduino) - Introduction to using the high level Johnny-Five library (awesome).
|
||||
|
||||
How To Use
|
||||
==========
|
||||
|
||||
Using node-serialport is pretty easy because it is pretty basic. It provides you with the building block to make great things, it is not a complete solution - just a cog in the (world domination) machine.
|
||||
|
||||
**Special Notes**
|
||||
|
||||
* Support for Node.js version 0.8.x has been removed. Version 1.4.0 is the last version that supported node.js version 0.8.x.
|
||||
* Currently support for Node.js version 0.11.x is dealing with an issue in the latest version of v. 0.11.13. We have confirmed things are fine with 0.11.10 and earlier, but not 0.11.11+.
|
||||
|
||||
Good luck.
|
||||
|
||||
|
||||
To Install
|
||||
----------
|
||||
|
||||
For most "standard" use cases (node v0.10.x on mac, linux, windows on a x86 or x64 processor), node-serialport will install nice and easy with a simple
|
||||
|
||||
```
|
||||
npm install serialport
|
||||
```
|
||||
|
||||
We are using [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) to compile and post binaries of the library for most common use cases (linux, mac, windows on standard processor platforms). If you are on a special case, node-serialport will work, but it will compile the binary when you install. Follow the instructions below for how that works.
|
||||
|
||||
### Installation Special Cases
|
||||
|
||||
|
||||
This assumes you have everything on your system necessary to compile ANY native module for Node.js. This may not be the case, though, so please ensure the following are true for your system before filing an issue about "Does not install". For all operatings systems, please ensure you have Python 2.x installed AND not 3.0, node-gyp (what we use to compile) requires Python 2.x.
|
||||
|
||||
#### Windows:
|
||||
|
||||
* Windows 7 or Windows 8.1 are supported.
|
||||
* Install [Visual Studio Express 2013 for Windows Desktop](http://www.microsoft.com/visualstudio/eng/2013-downloads#d-2013-express).
|
||||
* If you are hacking on an Arduino, be sure to install [the drivers](http://arduino.cc/en/Guide/windows#toc4).
|
||||
* Install [node.js 0.10.x](http://nodejs.org/) matching the bitness (32 or 64) of your operating system.
|
||||
* Install [Python 2.7.6](http://www.python.org/download/releases/2.7.6/) matching the bitness of your operating system. For any questions, please refer to their [FAQ](http://docs.python.org/2/faq/windows.html). Default settings are perfect.
|
||||
* Open the 'Visual Studio Command Prompt' and add Python to the path.
|
||||
|
||||
#### Mac OS X:
|
||||
|
||||
Ensure that you have at a minimum the xCode Command Line Tools installed appropriate for your system configuration. If you recently upgraded the OS, it probably removed your installation of Command Line Tools, please verify before submitting a ticket.
|
||||
|
||||
#### Desktop (Debian/Ubuntu) Linux:
|
||||
|
||||
You know what you need for you system, basically your appropriate analog of build-essential. Keep rocking! Ubuntu renamed the `node` binary `nodejs` which can cause problems building `node-serialport`. The fix is simple, install the [nodejs-legacy package](https://packages.debian.org/sid/nodejs-legacy) that symlinks `/usr/bin/nodejs => /usr/bin/node` or install the more up to date nodejs package from [Chris Lea's PPA](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#ubuntu-mint-elementary-os).
|
||||
|
||||
|
||||
```
|
||||
# Ubuntu node
|
||||
sudo apt-get install nodejs nodejs-legacy
|
||||
|
||||
# Or Chris Lea's PPA Node (more up to date)
|
||||
sudo add-apt-repository ppa:chris-lea/node.js
|
||||
sudo apt-get update
|
||||
sudo apt-get install nodejs
|
||||
|
||||
sudo apt-get install build-essential
|
||||
npm install serialport
|
||||
```
|
||||
|
||||
#### Raspberry Pi Linux:
|
||||
|
||||
* Starting with a a vanilla New Out of the Box Software (NOOBS) Raspbian image (currently tested: 5/25/2013)
|
||||
* Log into your Raspberry Pi through whatever means works best and ensure you are on a terminal prompt for the remaining steps. This could be local or through an SSH (or a serial connection if you like).
|
||||
* Issue the following commands to ensure you are up to date:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -y
|
||||
```
|
||||
|
||||
* Download and install node.js:
|
||||
|
||||
```bash
|
||||
wget http://nodejs.org/dist/v0.10.16/node-v0.10.16-linux-arm-pi.tar.gz
|
||||
tar xvfz node-v0.10.16-linux-arm-pi.tar.gz
|
||||
sudo mv node-v0.10.16-linux-arm-pi /opt/node/
|
||||
```
|
||||
|
||||
* Set up your paths correctly:
|
||||
|
||||
```bash
|
||||
echo 'export PATH="$PATH:/opt/node/bin"' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
* Install using npm, note this will take a while as it is actually compiling code and that ARM processor is getting a workout.
|
||||
|
||||
```bash
|
||||
npm install serialport
|
||||
```
|
||||
|
||||
To Use
|
||||
------
|
||||
|
||||
Opening a serial port:
|
||||
|
||||
```js
|
||||
var SerialPort = require("serialport").SerialPort
|
||||
var serialPort = new SerialPort("/dev/tty-usbserial1", {
|
||||
baudrate: 57600
|
||||
});
|
||||
```
|
||||
|
||||
When opening a serial port, you can specify (in this order).
|
||||
|
||||
1. Path to Serial Port - required.
|
||||
1. Options - optional and described below.
|
||||
|
||||
The options object allows you to pass named options to the serial port during initialization. The valid attributes for the options object are the following:
|
||||
|
||||
* baudrate: Baud Rate, defaults to 9600. Should be one of: 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1800, 1200, 600, 300, 200, 150, 134, 110, 75, or 50. Custom rates as allowed by hardware is supported.
|
||||
* databits: Data Bits, defaults to 8. Must be one of: 8, 7, 6, or 5.
|
||||
* stopbits: Stop Bits, defaults to 1. Must be one of: 1 or 2.
|
||||
* parity: Parity, defaults to 'none'. Must be one of: 'none', 'even', 'mark', 'odd', 'space'
|
||||
* buffersize: Size of read buffer, defaults to 255. Must be an integer value.
|
||||
* parser: The parser engine to use with read data, defaults to rawPacket strategy which just emits the raw buffer as a "data" event. Can be any function that accepts EventEmitter as first parameter and the raw buffer as the second parameter.
|
||||
|
||||
**Note, we have added support for either all lowercase OR camelcase of the options (thanks @jagautier), use whichever style you prefer.**
|
||||
|
||||
open event
|
||||
----------
|
||||
|
||||
You MUST wait for the open event to be emitted before reading/writing to the serial port. The open happens asynchronously so installing 'data' listeners and writing
|
||||
before the open event might result in... nothing at all.
|
||||
|
||||
Assuming you are connected to a serial console, you would for example:
|
||||
|
||||
```js
|
||||
serialPort.on("open", function () {
|
||||
console.log('open');
|
||||
serialPort.on('data', function(data) {
|
||||
console.log('data received: ' + data);
|
||||
});
|
||||
serialPort.write("ls\n", function(err, results) {
|
||||
console.log('err ' + err);
|
||||
console.log('results ' + results);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
You can also call the open function, in this case instanciate the serialport with an additional flag.
|
||||
|
||||
```js
|
||||
var SerialPort = require("serialport").SerialPort
|
||||
var serialPort = new SerialPort("/dev/tty-usbserial1", {
|
||||
baudrate: 57600
|
||||
}, false); // this is the openImmediately flag [default is true]
|
||||
|
||||
serialPort.open(function (error) {
|
||||
if ( error ) {
|
||||
console.log('failed to open: '+error);
|
||||
} else {
|
||||
console.log('open');
|
||||
serialPort.on('data', function(data) {
|
||||
console.log('data received: ' + data);
|
||||
});
|
||||
serialPort.write("ls\n", function(err, results) {
|
||||
console.log('err ' + err);
|
||||
console.log('results ' + results);
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
List Ports
|
||||
----------
|
||||
|
||||
You can also list the ports along with some metadata as well.
|
||||
|
||||
```js
|
||||
var serialPort = require("serialport");
|
||||
serialPort.list(function (err, ports) {
|
||||
ports.forEach(function(port) {
|
||||
console.log(port.comName);
|
||||
console.log(port.pnpId);
|
||||
console.log(port.manufacturer);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Parsers
|
||||
-------
|
||||
|
||||
Out of the box, node-serialport provides two parsers one that simply emits the raw buffer as a data event and the other which provides familiar "readline" style parsing. To use the readline parser, you must provide a delimiter as such:
|
||||
|
||||
```js
|
||||
var serialport = require("serialport");
|
||||
var SerialPort = serialport.SerialPort; // localize object constructor
|
||||
|
||||
var sp = new SerialPort("/dev/tty-usbserial1", {
|
||||
parser: serialport.parsers.readline("\n")
|
||||
});
|
||||
```
|
||||
|
||||
To use the raw parser, you just provide the function definition (or leave undefined):
|
||||
|
||||
```js
|
||||
var serialport = require("serialport");
|
||||
var SerialPort = serialport.SerialPort; // localize object constructor
|
||||
|
||||
var sp = new SerialPort("/dev/tty-usbserial1", {
|
||||
parser: serialport.parsers.raw
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
You can get updates of new data from the Serial Port as follows:
|
||||
|
||||
```js
|
||||
serialPort.on("data", function (data) {
|
||||
sys.puts("here: "+data);
|
||||
});
|
||||
```
|
||||
|
||||
You can write to the serial port by sending a string or buffer to the write method as follows:
|
||||
|
||||
```js
|
||||
serialPort.write("OMG IT WORKS\r");
|
||||
```
|
||||
|
||||
Enjoy and do cool things with this code.
|
||||
|
||||
Reference Guide
|
||||
---------------
|
||||
|
||||
## Methods
|
||||
|
||||
### SerialPort (path, options, openImmediately, callback)
|
||||
|
||||
Create a new serial port on `path`.
|
||||
|
||||
**_path_**
|
||||
|
||||
The system path of the serial port to open. For example, `/dev/tty` on Mac/Linux or `COM1` on Windows.
|
||||
|
||||
**_options (optional)_**
|
||||
|
||||
Port configuration options.
|
||||
|
||||
* `baudRate`
|
||||
* `dataBits`
|
||||
* `stopBits`
|
||||
* `parity`
|
||||
* `rtscts`
|
||||
* `xon`
|
||||
* `xoff`
|
||||
* `xany`
|
||||
* `flowControl`
|
||||
* `bufferSize`
|
||||
* `parser`
|
||||
* `encoding`
|
||||
* `dataCallback`
|
||||
* `disconnectedCallback`
|
||||
* `platformOptions` - sets platform specific options, see below.
|
||||
|
||||
#### Unix Platform Options
|
||||
|
||||
An object with the following properties:
|
||||
|
||||
* `vmin` (default: 1) - see [`man termios`](http://linux.die.net/man/3/termios)
|
||||
* `vtime` (default: 0) - see [`man termios`](http://linux.die.net/man/3/termios)
|
||||
|
||||
**_openImmediately (optional)_**
|
||||
|
||||
Attempts to open a connection to the serial port on `process.nextTick`. The default is `true`. Set to `false` to manually call `open()` at a later time, but note you'll need to use factory error listener in the case of constructor errors.
|
||||
|
||||
**_callback (optional)_**
|
||||
|
||||
Called when a connection has been opened. The callback should be a function that looks like: `function (error) { ... }`
|
||||
|
||||
### .open (callback)
|
||||
|
||||
Opens a connection to the given serial port.
|
||||
|
||||
**_callback (optional)_**
|
||||
|
||||
Called when a connection has been opened. NOTE: Will NOT be called if openImmediately is set to false as open will not be performed. The callback should be a function that looks like: `function (error) { ... }`
|
||||
|
||||
### .isOpen()
|
||||
|
||||
Returns `true` if the port is open.
|
||||
|
||||
### .write (buffer, callback)
|
||||
|
||||
Writes data to the given serial port.
|
||||
|
||||
**_buffer_**
|
||||
|
||||
The `buffer` parameter accepts a [`Buffer` ](http://nodejs.org/api/buffer.html) object, or a type that is accepted by the `Buffer` constructor (ex. an array of bytes or a string).
|
||||
|
||||
**_callback (optional)_**
|
||||
|
||||
Called once the write operation returns. The callback should be a function that looks like: `function (error) { ... }` _Note: The write operation is non-blocking. When it returns, data may still have not actually been written to the serial port. See `drain()`._
|
||||
|
||||
### .pause ()
|
||||
|
||||
Pauses an open connection.
|
||||
|
||||
### .resume ()
|
||||
|
||||
Resumes a paused connection.
|
||||
|
||||
### .flush (callback)
|
||||
|
||||
Flushes data received but not read. See [`tcflush()`](http://linux.die.net/man/3/tcflush) for Mac/Linux and [`FlushFileBuffers`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa364439) for Windows.
|
||||
|
||||
**_callback (optional)_**
|
||||
|
||||
Called once the flush operation returns. The callback should be a function that looks like: `function (error) { ... }`
|
||||
|
||||
### .drain (callback)
|
||||
|
||||
Waits until all output data has been transmitted to the serial port. See [`tcdrain()`](http://linux.die.net/man/3/tcdrain) for more information.
|
||||
|
||||
**_callback (optional)_**
|
||||
|
||||
Called once the drain operation returns. The callback should be a function that looks like: `function (error) { ... }`
|
||||
|
||||
**Example**
|
||||
|
||||
Writes `data` and waits until it has finish transmitting to the target serial port before calling the callback.
|
||||
|
||||
```
|
||||
function writeAndDrain (data, callback) {
|
||||
sp.write(data, function () {
|
||||
sp.drain(callback);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### .close (callback)
|
||||
|
||||
Closes an open connection.
|
||||
|
||||
**_callback (optional)_**
|
||||
|
||||
Called once a connection is closed. Closing a connection will also remove all event listeners. The callback should be a function that looks like: `function (error) { ... }`
|
||||
|
||||
## Events
|
||||
|
||||
### .on('open', callback)
|
||||
|
||||
### .on('data', callback)
|
||||
|
||||
### .on('close', callback)
|
||||
|
||||
### .on('error', callback)
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Credit
|
||||
|
||||
A special thanks to [The Hybrid Group](http://hybridgroup.com) for helping create and hosting the precompiled binaries for OSX, Linux, & Windows. This makes installing node-serialport much easier and much simpler for individuals using those platforms. Thank you.
|
||||
86
node_modules/osc/node_modules/serialport/appveyor.yml
generated
vendored
Normal file
86
node_modules/osc/node_modules/serialport/appveyor.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
# environment variables
|
||||
environment:
|
||||
node_pre_gyp_secretAccessKey:
|
||||
secure: wJRlPhmqDgwxllTxhhG5JJosBf3nKYxcXO6NfGnrUUnxmECHeNTsBrldqW8+EjyK
|
||||
node_pre_gyp_accessKeyId:
|
||||
secure: cgGBaLa6xiPo5duak1/xU5hxPCn1aUQqkQQZf27QQp0=
|
||||
|
||||
matrix:
|
||||
- nodejs_version: "0.10"
|
||||
- nodejs_version: "0.11"
|
||||
- nodejs_version: "0.12"
|
||||
|
||||
|
||||
# to add several platforms to build matrix:
|
||||
platform:
|
||||
- x64
|
||||
|
||||
install:
|
||||
- cmd: ECHO "INSTALL:"
|
||||
- cmd: ECHO "APPVEYOR_REPO_COMMIT_MESSAGE ->"
|
||||
- cmd: ECHO %APPVEYOR_REPO_COMMIT_MESSAGE%
|
||||
- cmd: SET COMMIT_MSG="%APPVEYOR_REPO_COMMIT_MESSAGE%"
|
||||
- cmd: SET NODIST_PREFIX=C:\nodist
|
||||
- cmd: SET PATH=C:\nodist\bin;%PATH%
|
||||
- cmd: SET PUBLISH_BINARY=false
|
||||
# Check to verify the branch is the same than latest tag, if so
|
||||
# then we publish the binaries if everything else is successful.
|
||||
- cmd: git describe --tags --always HEAD > _git_tag.tmp
|
||||
- cmd: SET /p GIT_TAG=<_git_tag.tmp
|
||||
- cmd: ECHO "LATEST LOCAL TAG:"
|
||||
- cmd: ECHO %GIT_TAG%
|
||||
- cmd: ECHO "APPVEYOR REPO BRANCH/TAG:"
|
||||
- cmd: ECHO %APPVEYOR_REPO_BRANCH%
|
||||
- cmd: DEL _git_tag.tmp
|
||||
- cmd: IF x%APPVEYOR_REPO_BRANCH%==x%GIT_TAG% SET PUBLISH_BINARY=true
|
||||
# Or look for commit message containing `[publish binary]`
|
||||
- cmd: IF not x%COMMIT_MSG:[publish binary]=%==x%COMMIT_MSG% SET PUBLISH_BINARY=true
|
||||
- cmd: ECHO "Env Var PUBLISH_BINARY:"
|
||||
- cmd: ECHO %PUBLISH_BINARY%
|
||||
- cmd: git clone https://github.com/marcelklehr/nodist.git c:\nodist 2>&1
|
||||
- cmd: SET NODIST_X64=0
|
||||
- cmd: nodist update
|
||||
- cmd: nodist %nodejs_version%
|
||||
- cmd: npm install -g node-gyp
|
||||
|
||||
# to run your custom scripts instead of automatic MSBuild
|
||||
build_script:
|
||||
- cmd: ECHO "BUILDING ia32 version:"
|
||||
- cmd: npm install --build-from-source
|
||||
- cmd: SET PATH=%cd%\node_modules\.bin\;%PATH%
|
||||
- cmd: node serialport.js
|
||||
- cmd: ECHO "PUBLISH ia32 package:"
|
||||
- cmd: npm install aws-sdk
|
||||
- cmd: IF %PUBLISH_BINARY%==true (node-pre-gyp package publish 2>&1)
|
||||
- cmd: node-pre-gyp clean
|
||||
- cmd: node-gyp clean
|
||||
- cmd: rmdir /q /s node_modules
|
||||
- cmd: ECHO "INSTALLING x64 node.js:"
|
||||
# We add newest MSBuild so we can use the correct libs for the x64 version
|
||||
- cmd: SET PATH=C:\Program Files (x86)\MSBuild\12.0\bin\;%PATH%
|
||||
- cmd: SET PATH=C:\python27;%PATH%
|
||||
- cmd: set NODIST_X64=1
|
||||
- cmd: nodist update
|
||||
- cmd: nodist %nodejs_version%
|
||||
- cmd: npm install -g node-gyp
|
||||
- cmd: ECHO "BUILDING x64 version:"
|
||||
- cmd: npm install --build-from-source --msvs_version=2013
|
||||
- cmd: ECHO "PUBLISH package:"
|
||||
- cmd: npm install aws-sdk
|
||||
- cmd: IF %PUBLISH_BINARY%==true (node-pre-gyp package publish 2>&1)
|
||||
- cmd: node-pre-gyp clean
|
||||
- cmd: node-gyp clean
|
||||
|
||||
on_success:
|
||||
# test installing from binary package works
|
||||
- cmd: ECHO "ON SUCCESS:"
|
||||
- cmd: ECHO "Try installing from binary:"
|
||||
- cmd: IF %PUBLISH_BINARY%==true npm install --fallback-to-build=false
|
||||
# Clean Directories.
|
||||
- cmd: node-pre-gyp clean
|
||||
# Print Available Binaries
|
||||
- cmd: node-pre-gyp info
|
||||
|
||||
test: OFF
|
||||
|
||||
deploy: OFF
|
||||
18
node_modules/osc/node_modules/serialport/arduinoTest/arduinoEcho/arduinoEcho.ino
generated
vendored
Normal file
18
node_modules/osc/node_modules/serialport/arduinoTest/arduinoEcho/arduinoEcho.ino
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
const int ledPin = 11;
|
||||
|
||||
void setup() {
|
||||
pinMode(ledPin, OUTPUT);
|
||||
Serial.begin(9600);
|
||||
Serial.write("READY");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
while (Serial.available()) {
|
||||
digitalWrite(ledPin, HIGH);
|
||||
Serial.write(Serial.read());
|
||||
}
|
||||
|
||||
delay(100);
|
||||
digitalWrite(ledPin, LOW);
|
||||
}
|
||||
118
node_modules/osc/node_modules/serialport/arduinoTest/requiresComPort.js
generated
vendored
Normal file
118
node_modules/osc/node_modules/serialport/arduinoTest/requiresComPort.js
generated
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
'use strict';
|
||||
|
||||
var chai = require('chai');
|
||||
var util = require('util');
|
||||
var serialPort = require('../serialport');
|
||||
|
||||
describe ('requiresComPort', function() {
|
||||
|
||||
describe('echo hello', function() {
|
||||
it('sends hello to the last port and validates that it is received back (see arduinoEcho.ino for echo sketch)', function(done) {
|
||||
serialPort.list(function(err, ports) {
|
||||
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
chai.assert.isDefined(ports, 'ports is not defined');
|
||||
chai.assert.isTrue(ports.length > 0, 'no ports found');
|
||||
|
||||
var data = new Buffer('hello');
|
||||
|
||||
var port = new serialPort.SerialPort(ports.slice(-1)[0].comName, null, false);
|
||||
port.on('error', function(err) {
|
||||
chai.assert.fail(util.inspect(err));
|
||||
});
|
||||
|
||||
port.on('data', function(d) {
|
||||
chai.assert.equal(data.toString(), d.toString(), 'incorrect data received');
|
||||
port.close(function(err) {
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
port.open(function(err) {
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
port.write(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('relaxed baud rate', function() {
|
||||
it('opens a port with a non-standard baud rate', function(done) {
|
||||
serialPort.list(function(err, ports) {
|
||||
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
chai.assert.isDefined(ports, 'ports is not defined');
|
||||
chai.assert.isTrue(ports.length > 0, 'no ports found');
|
||||
|
||||
var port = new serialPort.SerialPort(ports.slice(-1)[0].comName, {baudrate: 5}, false);
|
||||
port.on('error', function(err) {
|
||||
chai.assert.fail(util.inspect(err));
|
||||
});
|
||||
|
||||
port.open(function(err) {
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
port.close(function(err) {
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('simple write', function() {
|
||||
it('opens a port and sends data without encountering error', function(done) {
|
||||
serialPort.list(function(err, ports) {
|
||||
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
chai.assert.isDefined(ports, 'ports is not defined');
|
||||
chai.assert.isTrue(ports.length > 0, 'no ports found');
|
||||
|
||||
var data = new Buffer('hello');
|
||||
|
||||
var port = new serialPort.SerialPort(ports.slice(-1)[0].comName, null, false);
|
||||
port.on('error', function(err) {
|
||||
chai.assert.fail(util.inspect(err));
|
||||
});
|
||||
|
||||
port.open(function(err) {
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
port.write(data);
|
||||
port.close(function(err) {
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('validate close event', function() {
|
||||
it('opens a port then closes it using events', function(done) {
|
||||
serialPort.list(function(err, ports) {
|
||||
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
chai.assert.isDefined(ports, 'ports is not defined');
|
||||
chai.assert.isTrue(ports.length > 0, 'no ports found');
|
||||
|
||||
var port = new serialPort.SerialPort(ports.slice(-1)[0].comName, null, false);
|
||||
|
||||
port.on('error', function(err) {
|
||||
chai.assert.fail(util.inspect(err));
|
||||
});
|
||||
|
||||
port.on('open', function() {
|
||||
port.close();
|
||||
});
|
||||
|
||||
port.on('close', function() {
|
||||
done();
|
||||
});
|
||||
|
||||
port.open();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
74
node_modules/osc/node_modules/serialport/arduinoTest/stress.js
generated
vendored
Normal file
74
node_modules/osc/node_modules/serialport/arduinoTest/stress.js
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*jslint node: true */
|
||||
/*global describe, it */
|
||||
'use strict';
|
||||
|
||||
var chai = require('chai');
|
||||
var util = require('util');
|
||||
var serialPort = require('../serialport');
|
||||
var colors = require('colors');
|
||||
var fs = require('fs');
|
||||
var memwatch = require('memwatch');
|
||||
|
||||
describe ('stress', function() {
|
||||
|
||||
describe('long running', function() {
|
||||
it('opens a port and sends data, repeated indefinately', function (done) {
|
||||
|
||||
var hd = new memwatch.HeapDiff();
|
||||
|
||||
memwatch.on('leak', function(info) {
|
||||
fs.appendFile('leak.log', util.inspect(info));
|
||||
console.log(util.inspect(info).red);
|
||||
|
||||
var diff = hd.end();
|
||||
fs.appendFile('heapdiff.log', util.inspect(diff));
|
||||
hd = new memwatch.HeapDiff();
|
||||
});
|
||||
|
||||
memwatch.on('stats', function (stats) {
|
||||
fs.appendFile('stats.log', util.inspect(stats));
|
||||
console.log(util.inspect(stats).green);
|
||||
});
|
||||
|
||||
serialPort.list(function(err, ports) {
|
||||
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
chai.assert.isDefined(ports, 'ports is not defined');
|
||||
chai.assert.isTrue(ports.length > 0, 'no ports found');
|
||||
|
||||
var data = new Buffer('hello');
|
||||
|
||||
var port = new serialPort.SerialPort(ports.slice(-1)[0].comName, null, false);
|
||||
port.on('error', function(err) {
|
||||
chai.assert.fail(util.inspect(err));
|
||||
});
|
||||
|
||||
port.on('data', function (data) {
|
||||
});
|
||||
|
||||
port.open(function(err) {
|
||||
chai.assert.isUndefined(err, util.inspect(err));
|
||||
|
||||
|
||||
var intervalId = setInterval(function () {
|
||||
port.write(data);
|
||||
}, 20 );
|
||||
|
||||
setTimeout(function() {
|
||||
|
||||
clearInterval(intervalId);
|
||||
|
||||
var diff = hd.end();
|
||||
fs.appendFile('heapdiff.log', util.inspect(diff));
|
||||
|
||||
console.log(util.inspect(diff).green);
|
||||
|
||||
done();
|
||||
|
||||
}, 3590000);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
15
node_modules/osc/node_modules/serialport/bin/serialportList.js
generated
vendored
Executable file
15
node_modules/osc/node_modules/serialport/bin/serialportList.js
generated
vendored
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var serialport = require('../');
|
||||
var sf = require('sf');
|
||||
|
||||
serialport.list(function (err, results) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
var item = results[i];
|
||||
console.log(sf('{comName,-15} {pnpId,-20} {manufacturer}', item));
|
||||
}
|
||||
});
|
||||
80
node_modules/osc/node_modules/serialport/bin/serialportTerminal.js
generated
vendored
Executable file
80
node_modules/osc/node_modules/serialport/bin/serialportTerminal.js
generated
vendored
Executable file
|
|
@ -0,0 +1,80 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var SerialPort = require('../').SerialPort;
|
||||
var optimist = require('optimist');
|
||||
|
||||
var args = optimist
|
||||
.alias('h', 'help')
|
||||
.alias('h', '?')
|
||||
.options('portname', {
|
||||
alias: 'p',
|
||||
describe: 'Name of serial port. See serialPortList.js for open serial ports.'
|
||||
})
|
||||
.options('baud', {
|
||||
describe: 'Baud rate.',
|
||||
default: 9600
|
||||
})
|
||||
.options('databits', {
|
||||
describe: 'Data bits.',
|
||||
default: 8
|
||||
})
|
||||
.options('parity', {
|
||||
describe: 'Parity.',
|
||||
default: 'none'
|
||||
})
|
||||
.options('stopbits', {
|
||||
describe: 'Stop bits.',
|
||||
default: 1
|
||||
})
|
||||
.options('localecho', {
|
||||
describe: 'Enable local echo.',
|
||||
boolean: true
|
||||
})
|
||||
.argv;
|
||||
|
||||
if (args.help) {
|
||||
optimist.showHelp();
|
||||
return process.exit(-1);
|
||||
}
|
||||
|
||||
if (!args.portname) {
|
||||
console.error("Serial port name is required.");
|
||||
return process.exit(-1);
|
||||
}
|
||||
|
||||
process.stdin.resume();
|
||||
process.stdin.setRawMode(true);
|
||||
process.stdin.on('data', function (s) {
|
||||
if (s[0] === 0x03) {
|
||||
port.close();
|
||||
process.exit(0);
|
||||
}
|
||||
if (args.localecho) {
|
||||
if (s[0] === 0x0d) {
|
||||
process.stdout.write('\n');
|
||||
} else {
|
||||
process.stdout.write(s);
|
||||
}
|
||||
}
|
||||
port.write(s, function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var openOptions = {
|
||||
baudRate: args.baud,
|
||||
dataBits: args.databits,
|
||||
parity: args.parity,
|
||||
stopBits: args.stopbits
|
||||
};
|
||||
var port = new SerialPort(args.portname, openOptions);
|
||||
|
||||
port.on('data', function (data) {
|
||||
process.stdout.write(data.toString());
|
||||
});
|
||||
|
||||
port.on('error', function (err) {
|
||||
console.log(err);
|
||||
});
|
||||
62
node_modules/osc/node_modules/serialport/binding.gyp
generated
vendored
Normal file
62
node_modules/osc/node_modules/serialport/binding.gyp
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'serialport',
|
||||
'sources': [
|
||||
'src/serialport.cpp',
|
||||
],
|
||||
'include_dirs': [
|
||||
'<!(node -e "require(\'nan\')")'
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"',
|
||||
{
|
||||
'sources': [
|
||||
'src/serialport_win.cpp',
|
||||
'src/win/disphelper.c',
|
||||
'src/win/enumser.cpp',
|
||||
],
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'ExceptionHandling': '2',
|
||||
'DisableSpecificWarnings': [ '4530', '4506' ],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
['OS=="mac"',
|
||||
{
|
||||
'sources': [
|
||||
'src/serialport_unix.cpp',
|
||||
'src/serialport_poller.cpp',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'-framework CoreFoundation -framework IOKit'
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
['OS!="win"',
|
||||
{
|
||||
'sources': [
|
||||
'src/serialport_unix.cpp',
|
||||
'src/serialport_poller.cpp',
|
||||
],
|
||||
}
|
||||
],
|
||||
],
|
||||
},
|
||||
{
|
||||
"target_name": "action_after_build",
|
||||
"type": "none",
|
||||
"dependencies": [ "<(module_name)" ],
|
||||
"copies": [
|
||||
{
|
||||
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
|
||||
"destination": "<(module_path)"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
355
node_modules/osc/node_modules/serialport/build/Makefile
generated
vendored
Normal file
355
node_modules/osc/node_modules/serialport/build/Makefile
generated
vendored
Normal file
|
|
@ -0,0 +1,355 @@
|
|||
# We borrow heavily from the kernel build setup, though we are simpler since
|
||||
# we don't have Kconfig tweaking settings on us.
|
||||
|
||||
# The implicit make rules have it looking for RCS files, among other things.
|
||||
# We instead explicitly write all the rules we care about.
|
||||
# It's even quicker (saves ~200ms) to pass -r on the command line.
|
||||
MAKEFLAGS=-r
|
||||
|
||||
# The source directory tree.
|
||||
srcdir := ..
|
||||
abs_srcdir := $(abspath $(srcdir))
|
||||
|
||||
# The name of the builddir.
|
||||
builddir_name ?= .
|
||||
|
||||
# The V=1 flag on command line makes us verbosely print command lines.
|
||||
ifdef V
|
||||
quiet=
|
||||
else
|
||||
quiet=quiet_
|
||||
endif
|
||||
|
||||
# Specify BUILDTYPE=Release on the command line for a release build.
|
||||
BUILDTYPE ?= Release
|
||||
|
||||
# Directory all our build output goes into.
|
||||
# Note that this must be two directories beneath src/ for unit tests to pass,
|
||||
# as they reach into the src/ directory for data with relative paths.
|
||||
builddir ?= $(builddir_name)/$(BUILDTYPE)
|
||||
abs_builddir := $(abspath $(builddir))
|
||||
depsdir := $(builddir)/.deps
|
||||
|
||||
# Object output directory.
|
||||
obj := $(builddir)/obj
|
||||
abs_obj := $(abspath $(obj))
|
||||
|
||||
# We build up a list of every single one of the targets so we can slurp in the
|
||||
# generated dependency rule Makefiles in one pass.
|
||||
all_deps :=
|
||||
|
||||
|
||||
|
||||
CC.target ?= $(CC)
|
||||
CFLAGS.target ?= $(CFLAGS)
|
||||
CXX.target ?= $(CXX)
|
||||
CXXFLAGS.target ?= $(CXXFLAGS)
|
||||
LINK.target ?= $(LINK)
|
||||
LDFLAGS.target ?= $(LDFLAGS)
|
||||
AR.target ?= $(AR)
|
||||
|
||||
# C++ apps need to be linked with g++.
|
||||
#
|
||||
# Note: flock is used to seralize linking. Linking is a memory-intensive
|
||||
# process so running parallel links can often lead to thrashing. To disable
|
||||
# the serialization, override LINK via an envrionment variable as follows:
|
||||
#
|
||||
# export LINK=g++
|
||||
#
|
||||
# This will allow make to invoke N linker processes as specified in -jN.
|
||||
LINK ?= ./gyp-mac-tool flock $(builddir)/linker.lock $(CXX.target)
|
||||
|
||||
# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
|
||||
# to replicate this environment fallback in make as well.
|
||||
CC.host ?= gcc
|
||||
CFLAGS.host ?=
|
||||
CXX.host ?= g++
|
||||
CXXFLAGS.host ?=
|
||||
LINK.host ?= $(CXX.host)
|
||||
LDFLAGS.host ?=
|
||||
AR.host ?= ar
|
||||
|
||||
# Define a dir function that can handle spaces.
|
||||
# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
|
||||
# "leading spaces cannot appear in the text of the first argument as written.
|
||||
# These characters can be put into the argument value by variable substitution."
|
||||
empty :=
|
||||
space := $(empty) $(empty)
|
||||
|
||||
# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
|
||||
replace_spaces = $(subst $(space),?,$1)
|
||||
unreplace_spaces = $(subst ?,$(space),$1)
|
||||
dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
|
||||
|
||||
# Flags to make gcc output dependency info. Note that you need to be
|
||||
# careful here to use the flags that ccache and distcc can understand.
|
||||
# We write to a dep file on the side first and then rename at the end
|
||||
# so we can't end up with a broken dep file.
|
||||
depfile = $(depsdir)/$(call replace_spaces,$@).d
|
||||
DEPFLAGS = -MMD -MF $(depfile).raw
|
||||
|
||||
# We have to fixup the deps output in a few ways.
|
||||
# (1) the file output should mention the proper .o file.
|
||||
# ccache or distcc lose the path to the target, so we convert a rule of
|
||||
# the form:
|
||||
# foobar.o: DEP1 DEP2
|
||||
# into
|
||||
# path/to/foobar.o: DEP1 DEP2
|
||||
# (2) we want missing files not to cause us to fail to build.
|
||||
# We want to rewrite
|
||||
# foobar.o: DEP1 DEP2 \
|
||||
# DEP3
|
||||
# to
|
||||
# DEP1:
|
||||
# DEP2:
|
||||
# DEP3:
|
||||
# so if the files are missing, they're just considered phony rules.
|
||||
# We have to do some pretty insane escaping to get those backslashes
|
||||
# and dollar signs past make, the shell, and sed at the same time.
|
||||
# Doesn't work with spaces, but that's fine: .d files have spaces in
|
||||
# their names replaced with other characters.
|
||||
define fixup_dep
|
||||
# The depfile may not exist if the input file didn't have any #includes.
|
||||
touch $(depfile).raw
|
||||
# Fixup path as in (1).
|
||||
sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
|
||||
# Add extra rules as in (2).
|
||||
# We remove slashes and replace spaces with new lines;
|
||||
# remove blank lines;
|
||||
# delete the first line and append a colon to the remaining lines.
|
||||
sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
|
||||
grep -v '^$$' |\
|
||||
sed -e 1d -e 's|$$|:|' \
|
||||
>> $(depfile)
|
||||
rm $(depfile).raw
|
||||
endef
|
||||
|
||||
# Command definitions:
|
||||
# - cmd_foo is the actual command to run;
|
||||
# - quiet_cmd_foo is the brief-output summary of the command.
|
||||
|
||||
quiet_cmd_cc = CC($(TOOLSET)) $@
|
||||
cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
|
||||
|
||||
quiet_cmd_cxx = CXX($(TOOLSET)) $@
|
||||
cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
|
||||
|
||||
quiet_cmd_objc = CXX($(TOOLSET)) $@
|
||||
cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<
|
||||
|
||||
quiet_cmd_objcxx = CXX($(TOOLSET)) $@
|
||||
cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<
|
||||
|
||||
# Commands for precompiled header files.
|
||||
quiet_cmd_pch_c = CXX($(TOOLSET)) $@
|
||||
cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
|
||||
quiet_cmd_pch_cc = CXX($(TOOLSET)) $@
|
||||
cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
|
||||
quiet_cmd_pch_m = CXX($(TOOLSET)) $@
|
||||
cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<
|
||||
quiet_cmd_pch_mm = CXX($(TOOLSET)) $@
|
||||
cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<
|
||||
|
||||
# gyp-mac-tool is written next to the root Makefile by gyp.
|
||||
# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd
|
||||
# already.
|
||||
quiet_cmd_mac_tool = MACTOOL $(4) $<
|
||||
cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@"
|
||||
|
||||
quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@
|
||||
cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4)
|
||||
|
||||
quiet_cmd_infoplist = INFOPLIST $@
|
||||
cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@"
|
||||
|
||||
quiet_cmd_touch = TOUCH $@
|
||||
cmd_touch = touch $@
|
||||
|
||||
quiet_cmd_copy = COPY $@
|
||||
# send stderr to /dev/null to ignore messages when linking directories.
|
||||
cmd_copy = rm -rf "$@" && cp -af "$<" "$@"
|
||||
|
||||
quiet_cmd_alink = LIBTOOL-STATIC $@
|
||||
cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)
|
||||
|
||||
quiet_cmd_link = LINK($(TOOLSET)) $@
|
||||
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
|
||||
|
||||
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
|
||||
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
|
||||
|
||||
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
|
||||
cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
|
||||
|
||||
|
||||
# Define an escape_quotes function to escape single quotes.
|
||||
# This allows us to handle quotes properly as long as we always use
|
||||
# use single quotes and escape_quotes.
|
||||
escape_quotes = $(subst ','\'',$(1))
|
||||
# This comment is here just to include a ' to unconfuse syntax highlighting.
|
||||
# Define an escape_vars function to escape '$' variable syntax.
|
||||
# This allows us to read/write command lines with shell variables (e.g.
|
||||
# $LD_LIBRARY_PATH), without triggering make substitution.
|
||||
escape_vars = $(subst $$,$$$$,$(1))
|
||||
# Helper that expands to a shell command to echo a string exactly as it is in
|
||||
# make. This uses printf instead of echo because printf's behaviour with respect
|
||||
# to escape sequences is more portable than echo's across different shells
|
||||
# (e.g., dash, bash).
|
||||
exact_echo = printf '%s\n' '$(call escape_quotes,$(1))'
|
||||
|
||||
# Helper to compare the command we're about to run against the command
|
||||
# we logged the last time we ran the command. Produces an empty
|
||||
# string (false) when the commands match.
|
||||
# Tricky point: Make has no string-equality test function.
|
||||
# The kernel uses the following, but it seems like it would have false
|
||||
# positives, where one string reordered its arguments.
|
||||
# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
|
||||
# $(filter-out $(cmd_$@), $(cmd_$(1))))
|
||||
# We instead substitute each for the empty string into the other, and
|
||||
# say they're equal if both substitutions produce the empty string.
|
||||
# .d files contain ? instead of spaces, take that into account.
|
||||
command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
|
||||
$(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))
|
||||
|
||||
# Helper that is non-empty when a prerequisite changes.
|
||||
# Normally make does this implicitly, but we force rules to always run
|
||||
# so we can check their command lines.
|
||||
# $? -- new prerequisites
|
||||
# $| -- order-only dependencies
|
||||
prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
|
||||
|
||||
# Helper that executes all postbuilds until one fails.
|
||||
define do_postbuilds
|
||||
@E=0;\
|
||||
for p in $(POSTBUILDS); do\
|
||||
eval $$p;\
|
||||
E=$$?;\
|
||||
if [ $$E -ne 0 ]; then\
|
||||
break;\
|
||||
fi;\
|
||||
done;\
|
||||
if [ $$E -ne 0 ]; then\
|
||||
rm -rf "$@";\
|
||||
exit $$E;\
|
||||
fi
|
||||
endef
|
||||
|
||||
# do_cmd: run a command via the above cmd_foo names, if necessary.
|
||||
# Should always run for a given target to handle command-line changes.
|
||||
# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
|
||||
# Third argument, if non-zero, makes it do POSTBUILDS processing.
|
||||
# Note: We intentionally do NOT call dirx for depfile, since it contains ? for
|
||||
# spaces already and dirx strips the ? characters.
|
||||
define do_cmd
|
||||
$(if $(or $(command_changed),$(prereq_changed)),
|
||||
@$(call exact_echo, $($(quiet)cmd_$(1)))
|
||||
@mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
|
||||
$(if $(findstring flock,$(word 2,$(cmd_$1))),
|
||||
@$(cmd_$(1))
|
||||
@echo " $(quiet_cmd_$(1)): Finished",
|
||||
@$(cmd_$(1))
|
||||
)
|
||||
@$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
|
||||
@$(if $(2),$(fixup_dep))
|
||||
$(if $(and $(3), $(POSTBUILDS)),
|
||||
$(call do_postbuilds)
|
||||
)
|
||||
)
|
||||
endef
|
||||
|
||||
# Declare the "all" target first so it is the default,
|
||||
# even though we don't have the deps yet.
|
||||
.PHONY: all
|
||||
all:
|
||||
|
||||
# make looks for ways to re-generate included makefiles, but in our case, we
|
||||
# don't have a direct way. Explicitly telling make that it has nothing to do
|
||||
# for them makes it go faster.
|
||||
%.d: ;
|
||||
|
||||
# Use FORCE_DO_CMD to force a target to run. Should be coupled with
|
||||
# do_cmd.
|
||||
.PHONY: FORCE_DO_CMD
|
||||
FORCE_DO_CMD:
|
||||
|
||||
TOOLSET := target
|
||||
# Suffix rules, putting all outputs into $(obj).
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD
|
||||
@$(call do_cmd,objc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD
|
||||
@$(call do_cmd,objcxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
# Try building from generated source, too.
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD
|
||||
@$(call do_cmd,objc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD
|
||||
@$(call do_cmd,objcxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD
|
||||
@$(call do_cmd,objc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD
|
||||
@$(call do_cmd,objcxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
|
||||
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
||||
$(findstring $(join ^,$(prefix)),\
|
||||
$(join ^,action_after_build.target.mk)))),)
|
||||
include action_after_build.target.mk
|
||||
endif
|
||||
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
||||
$(findstring $(join ^,$(prefix)),\
|
||||
$(join ^,serialport.target.mk)))),)
|
||||
include serialport.target.mk
|
||||
endif
|
||||
|
||||
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
||||
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/webgeek/Projects/node-serialport/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/webgeek/.node-gyp/0.10.36/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/webgeek/.node-gyp/0.10.36" "-Dmodule_root_dir=/Users/webgeek/Projects/node-serialport" binding.gyp
|
||||
Makefile: $(srcdir)/../../.node-gyp/0.10.36/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
|
||||
$(call do_cmd,regen_makefile)
|
||||
|
||||
# "all" is a concatenation of the "all" targets from all the included
|
||||
# sub-makefiles. This is just here to clarify.
|
||||
all:
|
||||
|
||||
# Add in dependency-tracking rules. $(all_deps) is the list of every single
|
||||
# target in our tree. Only consider the ones with .d (dependency) info:
|
||||
d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
|
||||
ifneq ($(d_files),)
|
||||
include $(d_files)
|
||||
endif
|
||||
1
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/obj.target/action_after_build.stamp.d
generated
vendored
Normal file
1
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/obj.target/action_after_build.stamp.d
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
cmd_Release/obj.target/action_after_build.stamp := touch Release/obj.target/action_after_build.stamp
|
||||
32
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/obj.target/serialport/src/serialport.o.d
generated
vendored
Normal file
32
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/obj.target/serialport/src/serialport.o.d
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
cmd_Release/obj.target/serialport/src/serialport.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/webgeek/.node-gyp/0.10.36/src -I/Users/webgeek/.node-gyp/0.10.36/deps/uv/include -I/Users/webgeek/.node-gyp/0.10.36/deps/v8/include -I../node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/serialport/src/serialport.o.d.raw -c -o Release/obj.target/serialport/src/serialport.o ../src/serialport.cpp
|
||||
Release/obj.target/serialport/src/serialport.o: ../src/serialport.cpp \
|
||||
../src/serialport.h ../node_modules/nan/nan.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-darwin.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8stdint.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_object_wrap.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_buffer.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_version.h \
|
||||
../node_modules/nan/nan_new.h \
|
||||
../node_modules/nan/nan_implementation_pre_12_inl.h \
|
||||
../src/serialport_poller.h
|
||||
../src/serialport.cpp:
|
||||
../src/serialport.h:
|
||||
../node_modules/nan/nan.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-darwin.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8stdint.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_object_wrap.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_buffer.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_version.h:
|
||||
../node_modules/nan/nan_new.h:
|
||||
../node_modules/nan/nan_implementation_pre_12_inl.h:
|
||||
../src/serialport_poller.h:
|
||||
32
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/obj.target/serialport/src/serialport_poller.o.d
generated
vendored
Normal file
32
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/obj.target/serialport/src/serialport_poller.o.d
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
cmd_Release/obj.target/serialport/src/serialport_poller.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/webgeek/.node-gyp/0.10.36/src -I/Users/webgeek/.node-gyp/0.10.36/deps/uv/include -I/Users/webgeek/.node-gyp/0.10.36/deps/v8/include -I../node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/serialport/src/serialport_poller.o.d.raw -c -o Release/obj.target/serialport/src/serialport_poller.o ../src/serialport_poller.cpp
|
||||
Release/obj.target/serialport/src/serialport_poller.o: \
|
||||
../src/serialport_poller.cpp ../node_modules/nan/nan.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-darwin.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8stdint.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_object_wrap.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_buffer.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_version.h \
|
||||
../node_modules/nan/nan_new.h \
|
||||
../node_modules/nan/nan_implementation_pre_12_inl.h \
|
||||
../src/serialport_poller.h ../src/serialport.h
|
||||
../src/serialport_poller.cpp:
|
||||
../node_modules/nan/nan.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-darwin.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8stdint.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_object_wrap.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_buffer.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_version.h:
|
||||
../node_modules/nan/nan_new.h:
|
||||
../node_modules/nan/nan_implementation_pre_12_inl.h:
|
||||
../src/serialport_poller.h:
|
||||
../src/serialport.h:
|
||||
33
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/obj.target/serialport/src/serialport_unix.o.d
generated
vendored
Normal file
33
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/obj.target/serialport/src/serialport_unix.o.d
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
cmd_Release/obj.target/serialport/src/serialport_unix.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/webgeek/.node-gyp/0.10.36/src -I/Users/webgeek/.node-gyp/0.10.36/deps/uv/include -I/Users/webgeek/.node-gyp/0.10.36/deps/v8/include -I../node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/serialport/src/serialport_unix.o.d.raw -c -o Release/obj.target/serialport/src/serialport_unix.o ../src/serialport_unix.cpp
|
||||
Release/obj.target/serialport/src/serialport_unix.o: \
|
||||
../src/serialport_unix.cpp ../src/serialport.h \
|
||||
../node_modules/nan/nan.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-darwin.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8stdint.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_object_wrap.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_buffer.h \
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_version.h \
|
||||
../node_modules/nan/nan_new.h \
|
||||
../node_modules/nan/nan_implementation_pre_12_inl.h \
|
||||
../src/serialport_poller.h
|
||||
../src/serialport_unix.cpp:
|
||||
../src/serialport.h:
|
||||
../node_modules/nan/nan.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-darwin.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/deps/v8/include/v8stdint.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_object_wrap.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_buffer.h:
|
||||
/Users/webgeek/.node-gyp/0.10.36/src/node_version.h:
|
||||
../node_modules/nan/nan_new.h:
|
||||
../node_modules/nan/nan_implementation_pre_12_inl.h:
|
||||
../src/serialport_poller.h:
|
||||
1
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/serialport.node.d
generated
vendored
Normal file
1
node_modules/osc/node_modules/serialport/build/Release/.deps/Release/serialport.node.d
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
cmd_Release/serialport.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -bundle -framework CoreFoundation -framework IOKit -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -o Release/serialport.node Release/obj.target/serialport/src/serialport.o Release/obj.target/serialport/src/serialport_unix.o Release/obj.target/serialport/src/serialport_poller.o -undefined dynamic_lookup
|
||||
|
|
@ -0,0 +1 @@
|
|||
cmd_/Users/webgeek/Projects/node-serialport/build/serialport/v1.7.2/Release/node-v11-darwin-x64/serialport.node := rm -rf "/Users/webgeek/Projects/node-serialport/build/serialport/v1.7.2/Release/node-v11-darwin-x64/serialport.node" && cp -af "Release/serialport.node" "/Users/webgeek/Projects/node-serialport/build/serialport/v1.7.2/Release/node-v11-darwin-x64/serialport.node"
|
||||
0
node_modules/osc/node_modules/serialport/build/Release/linker.lock
generated
vendored
Normal file
0
node_modules/osc/node_modules/serialport/build/Release/linker.lock
generated
vendored
Normal file
0
node_modules/osc/node_modules/serialport/build/Release/obj.target/action_after_build.stamp
generated
vendored
Normal file
0
node_modules/osc/node_modules/serialport/build/Release/obj.target/action_after_build.stamp
generated
vendored
Normal file
BIN
node_modules/osc/node_modules/serialport/build/Release/obj.target/serialport/src/serialport.o
generated
vendored
Normal file
BIN
node_modules/osc/node_modules/serialport/build/Release/obj.target/serialport/src/serialport.o
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/osc/node_modules/serialport/build/Release/obj.target/serialport/src/serialport_poller.o
generated
vendored
Normal file
BIN
node_modules/osc/node_modules/serialport/build/Release/obj.target/serialport/src/serialport_poller.o
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/osc/node_modules/serialport/build/Release/obj.target/serialport/src/serialport_unix.o
generated
vendored
Normal file
BIN
node_modules/osc/node_modules/serialport/build/Release/obj.target/serialport/src/serialport_unix.o
generated
vendored
Normal file
Binary file not shown.
32
node_modules/osc/node_modules/serialport/build/action_after_build.target.mk
generated
vendored
Normal file
32
node_modules/osc/node_modules/serialport/build/action_after_build.target.mk
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# This file is generated by gyp; do not edit.
|
||||
|
||||
TOOLSET := target
|
||||
TARGET := action_after_build
|
||||
### Generated for copy rule.
|
||||
/Users/webgeek/Projects/node-serialport/build/serialport/v1.7.2/Release/node-v11-darwin-x64/serialport.node: TOOLSET := $(TOOLSET)
|
||||
/Users/webgeek/Projects/node-serialport/build/serialport/v1.7.2/Release/node-v11-darwin-x64/serialport.node: $(builddir)/serialport.node FORCE_DO_CMD
|
||||
$(call do_cmd,copy)
|
||||
|
||||
all_deps += /Users/webgeek/Projects/node-serialport/build/serialport/v1.7.2/Release/node-v11-darwin-x64/serialport.node
|
||||
binding_gyp_action_after_build_target_copies = /Users/webgeek/Projects/node-serialport/build/serialport/v1.7.2/Release/node-v11-darwin-x64/serialport.node
|
||||
|
||||
### Rules for final target.
|
||||
# Build our special outputs first.
|
||||
$(obj).target/action_after_build.stamp: | $(binding_gyp_action_after_build_target_copies)
|
||||
|
||||
# Preserve order dependency of special output on deps.
|
||||
$(binding_gyp_action_after_build_target_copies): | $(builddir)/serialport.node
|
||||
|
||||
$(obj).target/action_after_build.stamp: TOOLSET := $(TOOLSET)
|
||||
$(obj).target/action_after_build.stamp: $(builddir)/serialport.node FORCE_DO_CMD
|
||||
$(call do_cmd,touch)
|
||||
|
||||
all_deps += $(obj).target/action_after_build.stamp
|
||||
# Add target alias
|
||||
.PHONY: action_after_build
|
||||
action_after_build: $(obj).target/action_after_build.stamp
|
||||
|
||||
# Add target alias to "all" target.
|
||||
.PHONY: all
|
||||
all: action_after_build
|
||||
|
||||
6
node_modules/osc/node_modules/serialport/build/binding.Makefile
generated
vendored
Normal file
6
node_modules/osc/node_modules/serialport/build/binding.Makefile
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# This file is generated by gyp; do not edit.
|
||||
|
||||
export builddir_name ?= ./build/.
|
||||
.PHONY: all
|
||||
all:
|
||||
$(MAKE) serialport action_after_build
|
||||
125
node_modules/osc/node_modules/serialport/build/config.gypi
generated
vendored
Normal file
125
node_modules/osc/node_modules/serialport/build/config.gypi
generated
vendored
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
# Do not edit. File was generated by node-gyp's "configure" step
|
||||
{
|
||||
"target_defaults": {
|
||||
"cflags": [],
|
||||
"default_configuration": "Release",
|
||||
"defines": [],
|
||||
"include_dirs": [],
|
||||
"libraries": []
|
||||
},
|
||||
"variables": {
|
||||
"clang": 1,
|
||||
"host_arch": "x64",
|
||||
"node_install_npm": "true",
|
||||
"node_prefix": "/",
|
||||
"node_shared_cares": "false",
|
||||
"node_shared_http_parser": "false",
|
||||
"node_shared_libuv": "false",
|
||||
"node_shared_openssl": "false",
|
||||
"node_shared_v8": "false",
|
||||
"node_shared_zlib": "false",
|
||||
"node_tag": "",
|
||||
"node_unsafe_optimizations": 0,
|
||||
"node_use_dtrace": "true",
|
||||
"node_use_etw": "false",
|
||||
"node_use_openssl": "true",
|
||||
"node_use_perfctr": "false",
|
||||
"openssl_no_asm": 0,
|
||||
"python": "/usr/bin/python",
|
||||
"target_arch": "x64",
|
||||
"v8_enable_gdbjit": 0,
|
||||
"v8_no_strict_aliasing": 1,
|
||||
"v8_use_snapshot": "false",
|
||||
"want_separate_host_toolset": 0,
|
||||
"nodedir": "/Users/webgeek/.node-gyp/0.10.36",
|
||||
"copy_dev_lib": "true",
|
||||
"standalone_static_library": 1,
|
||||
"fallback_to_build": "true",
|
||||
"module": "/Users/webgeek/Projects/node-serialport/build/serialport/v1.7.2/Release/node-v11-darwin-x64/serialport.node",
|
||||
"module_name": "serialport",
|
||||
"module_path": "/Users/webgeek/Projects/node-serialport/build/serialport/v1.7.2/Release/node-v11-darwin-x64",
|
||||
"save_dev": "",
|
||||
"viewer": "man",
|
||||
"browser": "",
|
||||
"rollback": "true",
|
||||
"usage": "",
|
||||
"globalignorefile": "/usr/local/etc/npmignore",
|
||||
"__registry_npmjs_org___authToken": "a6f2fbfe-a5f5-40a4-b18e-dedd0042b86f",
|
||||
"shell": "/bin/bash",
|
||||
"init_author_url": "",
|
||||
"shrinkwrap": "true",
|
||||
"parseable": "",
|
||||
"init_license": "ISC",
|
||||
"email": "voodootikigod@gmail.com",
|
||||
"sign_git_tag": "",
|
||||
"init_author_email": "",
|
||||
"cache_max": "Infinity",
|
||||
"long": "",
|
||||
"local_address": "",
|
||||
"git_tag_version": "true",
|
||||
"cert": "",
|
||||
"npat": "",
|
||||
"fetch_retries": "2",
|
||||
"registry": "https://registry.npmjs.org/",
|
||||
"versions": "",
|
||||
"message": "%s",
|
||||
"key": "",
|
||||
"globalconfig": "/usr/local/etc/npmrc",
|
||||
"always_auth": "",
|
||||
"spin": "true",
|
||||
"cache_lock_retries": "10",
|
||||
"cafile": "",
|
||||
"heading": "npm",
|
||||
"proprietary_attribs": "true",
|
||||
"fetch_retry_mintimeout": "10000",
|
||||
"json": "",
|
||||
"https_proxy": "",
|
||||
"engine_strict": "",
|
||||
"description": "true",
|
||||
"userconfig": "/Users/webgeek/.npmrc",
|
||||
"init_module": "/Users/webgeek/.npm-init.js",
|
||||
"user": "501",
|
||||
"node_version": "0.10.36",
|
||||
"save": "",
|
||||
"editor": "/usr/local/bin/subl -w",
|
||||
"tag": "latest",
|
||||
"global": "",
|
||||
"optional": "true",
|
||||
"username": "voodootikigod",
|
||||
"force": "",
|
||||
"bin_links": "true",
|
||||
"searchopts": "",
|
||||
"depth": "Infinity",
|
||||
"searchsort": "name",
|
||||
"rebuild_bundle": "true",
|
||||
"unicode": "true",
|
||||
"fetch_retry_maxtimeout": "60000",
|
||||
"strict_ssl": "true",
|
||||
"save_prefix": "^",
|
||||
"ca": "",
|
||||
"save_exact": "",
|
||||
"group": "20",
|
||||
"fetch_retry_factor": "10",
|
||||
"dev": "",
|
||||
"version": "",
|
||||
"cache_lock_stale": "60000",
|
||||
"cache_min": "10",
|
||||
"searchexclude": "",
|
||||
"cache": "/Users/webgeek/.npm",
|
||||
"color": "true",
|
||||
"save_optional": "",
|
||||
"ignore_scripts": "",
|
||||
"user_agent": "npm/1.4.28 node/v0.10.36 darwin x64",
|
||||
"cache_lock_wait": "10000",
|
||||
"production": "",
|
||||
"save_bundle": "",
|
||||
"umask": "18",
|
||||
"init_author_name": "",
|
||||
"git": "git",
|
||||
"unsafe_perm": "true",
|
||||
"tmp": "/var/folders/dt/m043hkss4tv3mt5tfqf05jd00000gn/T",
|
||||
"onload_script": "",
|
||||
"link": "",
|
||||
"prefix": "/usr/local"
|
||||
}
|
||||
}
|
||||
512
node_modules/osc/node_modules/serialport/build/gyp-mac-tool
generated
vendored
Executable file
512
node_modules/osc/node_modules/serialport/build/gyp-mac-tool
generated
vendored
Executable file
|
|
@ -0,0 +1,512 @@
|
|||
#!/usr/bin/env python
|
||||
# Generated by gyp. Do not edit.
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Utility functions to perform Xcode-style build steps.
|
||||
|
||||
These functions are executed via gyp-mac-tool when using the Makefile generator.
|
||||
"""
|
||||
|
||||
import fcntl
|
||||
import fnmatch
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import plistlib
|
||||
import re
|
||||
import shutil
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
|
||||
def main(args):
|
||||
executor = MacTool()
|
||||
exit_code = executor.Dispatch(args)
|
||||
if exit_code is not None:
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
||||
class MacTool(object):
|
||||
"""This class performs all the Mac tooling steps. The methods can either be
|
||||
executed directly, or dispatched from an argument list."""
|
||||
|
||||
def Dispatch(self, args):
|
||||
"""Dispatches a string command to a method."""
|
||||
if len(args) < 1:
|
||||
raise Exception("Not enough arguments")
|
||||
|
||||
method = "Exec%s" % self._CommandifyName(args[0])
|
||||
return getattr(self, method)(*args[1:])
|
||||
|
||||
def _CommandifyName(self, name_string):
|
||||
"""Transforms a tool name like copy-info-plist to CopyInfoPlist"""
|
||||
return name_string.title().replace('-', '')
|
||||
|
||||
def ExecCopyBundleResource(self, source, dest):
|
||||
"""Copies a resource file to the bundle/Resources directory, performing any
|
||||
necessary compilation on each resource."""
|
||||
extension = os.path.splitext(source)[1].lower()
|
||||
if os.path.isdir(source):
|
||||
# Copy tree.
|
||||
# TODO(thakis): This copies file attributes like mtime, while the
|
||||
# single-file branch below doesn't. This should probably be changed to
|
||||
# be consistent with the single-file branch.
|
||||
if os.path.exists(dest):
|
||||
shutil.rmtree(dest)
|
||||
shutil.copytree(source, dest)
|
||||
elif extension == '.xib':
|
||||
return self._CopyXIBFile(source, dest)
|
||||
elif extension == '.storyboard':
|
||||
return self._CopyXIBFile(source, dest)
|
||||
elif extension == '.strings':
|
||||
self._CopyStringsFile(source, dest)
|
||||
else:
|
||||
shutil.copy(source, dest)
|
||||
|
||||
def _CopyXIBFile(self, source, dest):
|
||||
"""Compiles a XIB file with ibtool into a binary plist in the bundle."""
|
||||
|
||||
# ibtool sometimes crashes with relative paths. See crbug.com/314728.
|
||||
base = os.path.dirname(os.path.realpath(__file__))
|
||||
if os.path.relpath(source):
|
||||
source = os.path.join(base, source)
|
||||
if os.path.relpath(dest):
|
||||
dest = os.path.join(base, dest)
|
||||
|
||||
args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices',
|
||||
'--output-format', 'human-readable-text', '--compile', dest, source]
|
||||
ibtool_section_re = re.compile(r'/\*.*\*/')
|
||||
ibtool_re = re.compile(r'.*note:.*is clipping its content')
|
||||
ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE)
|
||||
current_section_header = None
|
||||
for line in ibtoolout.stdout:
|
||||
if ibtool_section_re.match(line):
|
||||
current_section_header = line
|
||||
elif not ibtool_re.match(line):
|
||||
if current_section_header:
|
||||
sys.stdout.write(current_section_header)
|
||||
current_section_header = None
|
||||
sys.stdout.write(line)
|
||||
return ibtoolout.returncode
|
||||
|
||||
def _CopyStringsFile(self, source, dest):
|
||||
"""Copies a .strings file using iconv to reconvert the input into UTF-16."""
|
||||
input_code = self._DetectInputEncoding(source) or "UTF-8"
|
||||
|
||||
# Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call
|
||||
# CFPropertyListCreateFromXMLData() behind the scenes; at least it prints
|
||||
# CFPropertyListCreateFromXMLData(): Old-style plist parser: missing
|
||||
# semicolon in dictionary.
|
||||
# on invalid files. Do the same kind of validation.
|
||||
import CoreFoundation
|
||||
s = open(source, 'rb').read()
|
||||
d = CoreFoundation.CFDataCreate(None, s, len(s))
|
||||
_, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None)
|
||||
if error:
|
||||
return
|
||||
|
||||
fp = open(dest, 'wb')
|
||||
fp.write(s.decode(input_code).encode('UTF-16'))
|
||||
fp.close()
|
||||
|
||||
def _DetectInputEncoding(self, file_name):
|
||||
"""Reads the first few bytes from file_name and tries to guess the text
|
||||
encoding. Returns None as a guess if it can't detect it."""
|
||||
fp = open(file_name, 'rb')
|
||||
try:
|
||||
header = fp.read(3)
|
||||
except e:
|
||||
fp.close()
|
||||
return None
|
||||
fp.close()
|
||||
if header.startswith("\xFE\xFF"):
|
||||
return "UTF-16"
|
||||
elif header.startswith("\xFF\xFE"):
|
||||
return "UTF-16"
|
||||
elif header.startswith("\xEF\xBB\xBF"):
|
||||
return "UTF-8"
|
||||
else:
|
||||
return None
|
||||
|
||||
def ExecCopyInfoPlist(self, source, dest, *keys):
|
||||
"""Copies the |source| Info.plist to the destination directory |dest|."""
|
||||
# Read the source Info.plist into memory.
|
||||
fd = open(source, 'r')
|
||||
lines = fd.read()
|
||||
fd.close()
|
||||
|
||||
# Insert synthesized key/value pairs (e.g. BuildMachineOSBuild).
|
||||
plist = plistlib.readPlistFromString(lines)
|
||||
if keys:
|
||||
plist = dict(plist.items() + json.loads(keys[0]).items())
|
||||
lines = plistlib.writePlistToString(plist)
|
||||
|
||||
# Go through all the environment variables and replace them as variables in
|
||||
# the file.
|
||||
IDENT_RE = re.compile('[/\s]')
|
||||
for key in os.environ:
|
||||
if key.startswith('_'):
|
||||
continue
|
||||
evar = '${%s}' % key
|
||||
evalue = os.environ[key]
|
||||
lines = string.replace(lines, evar, evalue)
|
||||
|
||||
# Xcode supports various suffices on environment variables, which are
|
||||
# all undocumented. :rfc1034identifier is used in the standard project
|
||||
# template these days, and :identifier was used earlier. They are used to
|
||||
# convert non-url characters into things that look like valid urls --
|
||||
# except that the replacement character for :identifier, '_' isn't valid
|
||||
# in a URL either -- oops, hence :rfc1034identifier was born.
|
||||
evar = '${%s:identifier}' % key
|
||||
evalue = IDENT_RE.sub('_', os.environ[key])
|
||||
lines = string.replace(lines, evar, evalue)
|
||||
|
||||
evar = '${%s:rfc1034identifier}' % key
|
||||
evalue = IDENT_RE.sub('-', os.environ[key])
|
||||
lines = string.replace(lines, evar, evalue)
|
||||
|
||||
# Remove any keys with values that haven't been replaced.
|
||||
lines = lines.split('\n')
|
||||
for i in range(len(lines)):
|
||||
if lines[i].strip().startswith("<string>${"):
|
||||
lines[i] = None
|
||||
lines[i - 1] = None
|
||||
lines = '\n'.join(filter(lambda x: x is not None, lines))
|
||||
|
||||
# Write out the file with variables replaced.
|
||||
fd = open(dest, 'w')
|
||||
fd.write(lines)
|
||||
fd.close()
|
||||
|
||||
# Now write out PkgInfo file now that the Info.plist file has been
|
||||
# "compiled".
|
||||
self._WritePkgInfo(dest)
|
||||
|
||||
def _WritePkgInfo(self, info_plist):
|
||||
"""This writes the PkgInfo file from the data stored in Info.plist."""
|
||||
plist = plistlib.readPlist(info_plist)
|
||||
if not plist:
|
||||
return
|
||||
|
||||
# Only create PkgInfo for executable types.
|
||||
package_type = plist['CFBundlePackageType']
|
||||
if package_type != 'APPL':
|
||||
return
|
||||
|
||||
# The format of PkgInfo is eight characters, representing the bundle type
|
||||
# and bundle signature, each four characters. If that is missing, four
|
||||
# '?' characters are used instead.
|
||||
signature_code = plist.get('CFBundleSignature', '????')
|
||||
if len(signature_code) != 4: # Wrong length resets everything, too.
|
||||
signature_code = '?' * 4
|
||||
|
||||
dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo')
|
||||
fp = open(dest, 'w')
|
||||
fp.write('%s%s' % (package_type, signature_code))
|
||||
fp.close()
|
||||
|
||||
def ExecFlock(self, lockfile, *cmd_list):
|
||||
"""Emulates the most basic behavior of Linux's flock(1)."""
|
||||
# Rely on exception handling to report errors.
|
||||
fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666)
|
||||
fcntl.flock(fd, fcntl.LOCK_EX)
|
||||
return subprocess.call(cmd_list)
|
||||
|
||||
def ExecFilterLibtool(self, *cmd_list):
|
||||
"""Calls libtool and filters out '/path/to/libtool: file: foo.o has no
|
||||
symbols'."""
|
||||
libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$')
|
||||
libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE)
|
||||
_, err = libtoolout.communicate()
|
||||
for line in err.splitlines():
|
||||
if not libtool_re.match(line):
|
||||
print >>sys.stderr, line
|
||||
return libtoolout.returncode
|
||||
|
||||
def ExecPackageFramework(self, framework, version):
|
||||
"""Takes a path to Something.framework and the Current version of that and
|
||||
sets up all the symlinks."""
|
||||
# Find the name of the binary based on the part before the ".framework".
|
||||
binary = os.path.basename(framework).split('.')[0]
|
||||
|
||||
CURRENT = 'Current'
|
||||
RESOURCES = 'Resources'
|
||||
VERSIONS = 'Versions'
|
||||
|
||||
if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)):
|
||||
# Binary-less frameworks don't seem to contain symlinks (see e.g.
|
||||
# chromium's out/Debug/org.chromium.Chromium.manifest/ bundle).
|
||||
return
|
||||
|
||||
# Move into the framework directory to set the symlinks correctly.
|
||||
pwd = os.getcwd()
|
||||
os.chdir(framework)
|
||||
|
||||
# Set up the Current version.
|
||||
self._Relink(version, os.path.join(VERSIONS, CURRENT))
|
||||
|
||||
# Set up the root symlinks.
|
||||
self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary)
|
||||
self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES)
|
||||
|
||||
# Back to where we were before!
|
||||
os.chdir(pwd)
|
||||
|
||||
def _Relink(self, dest, link):
|
||||
"""Creates a symlink to |dest| named |link|. If |link| already exists,
|
||||
it is overwritten."""
|
||||
if os.path.lexists(link):
|
||||
os.remove(link)
|
||||
os.symlink(dest, link)
|
||||
|
||||
def ExecCodeSignBundle(self, key, resource_rules, entitlements, provisioning):
|
||||
"""Code sign a bundle.
|
||||
|
||||
This function tries to code sign an iOS bundle, following the same
|
||||
algorithm as Xcode:
|
||||
1. copy ResourceRules.plist from the user or the SDK into the bundle,
|
||||
2. pick the provisioning profile that best match the bundle identifier,
|
||||
and copy it into the bundle as embedded.mobileprovision,
|
||||
3. copy Entitlements.plist from user or SDK next to the bundle,
|
||||
4. code sign the bundle.
|
||||
"""
|
||||
resource_rules_path = self._InstallResourceRules(resource_rules)
|
||||
substitutions, overrides = self._InstallProvisioningProfile(
|
||||
provisioning, self._GetCFBundleIdentifier())
|
||||
entitlements_path = self._InstallEntitlements(
|
||||
entitlements, substitutions, overrides)
|
||||
subprocess.check_call([
|
||||
'codesign', '--force', '--sign', key, '--resource-rules',
|
||||
resource_rules_path, '--entitlements', entitlements_path,
|
||||
os.path.join(
|
||||
os.environ['TARGET_BUILD_DIR'],
|
||||
os.environ['FULL_PRODUCT_NAME'])])
|
||||
|
||||
def _InstallResourceRules(self, resource_rules):
|
||||
"""Installs ResourceRules.plist from user or SDK into the bundle.
|
||||
|
||||
Args:
|
||||
resource_rules: string, optional, path to the ResourceRules.plist file
|
||||
to use, default to "${SDKROOT}/ResourceRules.plist"
|
||||
|
||||
Returns:
|
||||
Path to the copy of ResourceRules.plist into the bundle.
|
||||
"""
|
||||
source_path = resource_rules
|
||||
target_path = os.path.join(
|
||||
os.environ['BUILT_PRODUCTS_DIR'],
|
||||
os.environ['CONTENTS_FOLDER_PATH'],
|
||||
'ResourceRules.plist')
|
||||
if not source_path:
|
||||
source_path = os.path.join(
|
||||
os.environ['SDKROOT'], 'ResourceRules.plist')
|
||||
shutil.copy2(source_path, target_path)
|
||||
return target_path
|
||||
|
||||
def _InstallProvisioningProfile(self, profile, bundle_identifier):
|
||||
"""Installs embedded.mobileprovision into the bundle.
|
||||
|
||||
Args:
|
||||
profile: string, optional, short name of the .mobileprovision file
|
||||
to use, if empty or the file is missing, the best file installed
|
||||
will be used
|
||||
bundle_identifier: string, value of CFBundleIdentifier from Info.plist
|
||||
|
||||
Returns:
|
||||
A tuple containing two dictionary: variables substitutions and values
|
||||
to overrides when generating the entitlements file.
|
||||
"""
|
||||
source_path, provisioning_data, team_id = self._FindProvisioningProfile(
|
||||
profile, bundle_identifier)
|
||||
target_path = os.path.join(
|
||||
os.environ['BUILT_PRODUCTS_DIR'],
|
||||
os.environ['CONTENTS_FOLDER_PATH'],
|
||||
'embedded.mobileprovision')
|
||||
shutil.copy2(source_path, target_path)
|
||||
substitutions = self._GetSubstitutions(bundle_identifier, team_id + '.')
|
||||
return substitutions, provisioning_data['Entitlements']
|
||||
|
||||
def _FindProvisioningProfile(self, profile, bundle_identifier):
|
||||
"""Finds the .mobileprovision file to use for signing the bundle.
|
||||
|
||||
Checks all the installed provisioning profiles (or if the user specified
|
||||
the PROVISIONING_PROFILE variable, only consult it) and select the most
|
||||
specific that correspond to the bundle identifier.
|
||||
|
||||
Args:
|
||||
profile: string, optional, short name of the .mobileprovision file
|
||||
to use, if empty or the file is missing, the best file installed
|
||||
will be used
|
||||
bundle_identifier: string, value of CFBundleIdentifier from Info.plist
|
||||
|
||||
Returns:
|
||||
A tuple of the path to the selected provisioning profile, the data of
|
||||
the embedded plist in the provisioning profile and the team identifier
|
||||
to use for code signing.
|
||||
|
||||
Raises:
|
||||
SystemExit: if no .mobileprovision can be used to sign the bundle.
|
||||
"""
|
||||
profiles_dir = os.path.join(
|
||||
os.environ['HOME'], 'Library', 'MobileDevice', 'Provisioning Profiles')
|
||||
if not os.path.isdir(profiles_dir):
|
||||
print >>sys.stderr, (
|
||||
'cannot find mobile provisioning for %s' % bundle_identifier)
|
||||
sys.exit(1)
|
||||
provisioning_profiles = None
|
||||
if profile:
|
||||
profile_path = os.path.join(profiles_dir, profile + '.mobileprovision')
|
||||
if os.path.exists(profile_path):
|
||||
provisioning_profiles = [profile_path]
|
||||
if not provisioning_profiles:
|
||||
provisioning_profiles = glob.glob(
|
||||
os.path.join(profiles_dir, '*.mobileprovision'))
|
||||
valid_provisioning_profiles = {}
|
||||
for profile_path in provisioning_profiles:
|
||||
profile_data = self._LoadProvisioningProfile(profile_path)
|
||||
app_id_pattern = profile_data.get(
|
||||
'Entitlements', {}).get('application-identifier', '')
|
||||
for team_identifier in profile_data.get('TeamIdentifier', []):
|
||||
app_id = '%s.%s' % (team_identifier, bundle_identifier)
|
||||
if fnmatch.fnmatch(app_id, app_id_pattern):
|
||||
valid_provisioning_profiles[app_id_pattern] = (
|
||||
profile_path, profile_data, team_identifier)
|
||||
if not valid_provisioning_profiles:
|
||||
print >>sys.stderr, (
|
||||
'cannot find mobile provisioning for %s' % bundle_identifier)
|
||||
sys.exit(1)
|
||||
# If the user has multiple provisioning profiles installed that can be
|
||||
# used for ${bundle_identifier}, pick the most specific one (ie. the
|
||||
# provisioning profile whose pattern is the longest).
|
||||
selected_key = max(valid_provisioning_profiles, key=lambda v: len(v))
|
||||
return valid_provisioning_profiles[selected_key]
|
||||
|
||||
def _LoadProvisioningProfile(self, profile_path):
|
||||
"""Extracts the plist embedded in a provisioning profile.
|
||||
|
||||
Args:
|
||||
profile_path: string, path to the .mobileprovision file
|
||||
|
||||
Returns:
|
||||
Content of the plist embedded in the provisioning profile as a dictionary.
|
||||
"""
|
||||
with tempfile.NamedTemporaryFile() as temp:
|
||||
subprocess.check_call([
|
||||
'security', 'cms', '-D', '-i', profile_path, '-o', temp.name])
|
||||
return self._LoadPlistMaybeBinary(temp.name)
|
||||
|
||||
def _LoadPlistMaybeBinary(self, plist_path):
|
||||
"""Loads into a memory a plist possibly encoded in binary format.
|
||||
|
||||
This is a wrapper around plistlib.readPlist that tries to convert the
|
||||
plist to the XML format if it can't be parsed (assuming that it is in
|
||||
the binary format).
|
||||
|
||||
Args:
|
||||
plist_path: string, path to a plist file, in XML or binary format
|
||||
|
||||
Returns:
|
||||
Content of the plist as a dictionary.
|
||||
"""
|
||||
try:
|
||||
# First, try to read the file using plistlib that only supports XML,
|
||||
# and if an exception is raised, convert a temporary copy to XML and
|
||||
# load that copy.
|
||||
return plistlib.readPlist(plist_path)
|
||||
except:
|
||||
pass
|
||||
with tempfile.NamedTemporaryFile() as temp:
|
||||
shutil.copy2(plist_path, temp.name)
|
||||
subprocess.check_call(['plutil', '-convert', 'xml1', temp.name])
|
||||
return plistlib.readPlist(temp.name)
|
||||
|
||||
def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix):
|
||||
"""Constructs a dictionary of variable substitutions for Entitlements.plist.
|
||||
|
||||
Args:
|
||||
bundle_identifier: string, value of CFBundleIdentifier from Info.plist
|
||||
app_identifier_prefix: string, value for AppIdentifierPrefix
|
||||
|
||||
Returns:
|
||||
Dictionary of substitutions to apply when generating Entitlements.plist.
|
||||
"""
|
||||
return {
|
||||
'CFBundleIdentifier': bundle_identifier,
|
||||
'AppIdentifierPrefix': app_identifier_prefix,
|
||||
}
|
||||
|
||||
def _GetCFBundleIdentifier(self):
|
||||
"""Extracts CFBundleIdentifier value from Info.plist in the bundle.
|
||||
|
||||
Returns:
|
||||
Value of CFBundleIdentifier in the Info.plist located in the bundle.
|
||||
"""
|
||||
info_plist_path = os.path.join(
|
||||
os.environ['TARGET_BUILD_DIR'],
|
||||
os.environ['INFOPLIST_PATH'])
|
||||
info_plist_data = self._LoadPlistMaybeBinary(info_plist_path)
|
||||
return info_plist_data['CFBundleIdentifier']
|
||||
|
||||
def _InstallEntitlements(self, entitlements, substitutions, overrides):
|
||||
"""Generates and install the ${BundleName}.xcent entitlements file.
|
||||
|
||||
Expands variables "$(variable)" pattern in the source entitlements file,
|
||||
add extra entitlements defined in the .mobileprovision file and the copy
|
||||
the generated plist to "${BundlePath}.xcent".
|
||||
|
||||
Args:
|
||||
entitlements: string, optional, path to the Entitlements.plist template
|
||||
to use, defaults to "${SDKROOT}/Entitlements.plist"
|
||||
substitutions: dictionary, variable substitutions
|
||||
overrides: dictionary, values to add to the entitlements
|
||||
|
||||
Returns:
|
||||
Path to the generated entitlements file.
|
||||
"""
|
||||
source_path = entitlements
|
||||
target_path = os.path.join(
|
||||
os.environ['BUILT_PRODUCTS_DIR'],
|
||||
os.environ['PRODUCT_NAME'] + '.xcent')
|
||||
if not source_path:
|
||||
source_path = os.path.join(
|
||||
os.environ['SDKROOT'],
|
||||
'Entitlements.plist')
|
||||
shutil.copy2(source_path, target_path)
|
||||
data = self._LoadPlistMaybeBinary(target_path)
|
||||
data = self._ExpandVariables(data, substitutions)
|
||||
if overrides:
|
||||
for key in overrides:
|
||||
if key not in data:
|
||||
data[key] = overrides[key]
|
||||
plistlib.writePlist(data, target_path)
|
||||
return target_path
|
||||
|
||||
def _ExpandVariables(self, data, substitutions):
|
||||
"""Expands variables "$(variable)" in data.
|
||||
|
||||
Args:
|
||||
data: object, can be either string, list or dictionary
|
||||
substitutions: dictionary, variable substitutions to perform
|
||||
|
||||
Returns:
|
||||
Copy of data where each references to "$(variable)" has been replaced
|
||||
by the corresponding value found in substitutions, or left intact if
|
||||
the key was not found.
|
||||
"""
|
||||
if isinstance(data, str):
|
||||
for key, value in substitutions.iteritems():
|
||||
data = data.replace('$(%s)' % key, value)
|
||||
return data
|
||||
if isinstance(data, list):
|
||||
return [self._ExpandVariables(v, substitutions) for v in data]
|
||||
if isinstance(data, dict):
|
||||
return dict((k, self._ExpandVariables(data[k],
|
||||
substitutions)) for k in data)
|
||||
return data
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
162
node_modules/osc/node_modules/serialport/build/serialport.target.mk
generated
vendored
Normal file
162
node_modules/osc/node_modules/serialport/build/serialport.target.mk
generated
vendored
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
# This file is generated by gyp; do not edit.
|
||||
|
||||
TOOLSET := target
|
||||
TARGET := serialport
|
||||
DEFS_Debug := \
|
||||
'-D_DARWIN_USE_64_BIT_INODE=1' \
|
||||
'-D_LARGEFILE_SOURCE' \
|
||||
'-D_FILE_OFFSET_BITS=64' \
|
||||
'-DBUILDING_NODE_EXTENSION' \
|
||||
'-DDEBUG' \
|
||||
'-D_DEBUG'
|
||||
|
||||
# Flags passed to all source files.
|
||||
CFLAGS_Debug := \
|
||||
-O0 \
|
||||
-gdwarf-2 \
|
||||
-mmacosx-version-min=10.5 \
|
||||
-arch x86_64 \
|
||||
-Wall \
|
||||
-Wendif-labels \
|
||||
-W \
|
||||
-Wno-unused-parameter
|
||||
|
||||
# Flags passed to only C files.
|
||||
CFLAGS_C_Debug := \
|
||||
-fno-strict-aliasing
|
||||
|
||||
# Flags passed to only C++ files.
|
||||
CFLAGS_CC_Debug := \
|
||||
-fno-rtti \
|
||||
-fno-exceptions \
|
||||
-fno-threadsafe-statics \
|
||||
-fno-strict-aliasing
|
||||
|
||||
# Flags passed to only ObjC files.
|
||||
CFLAGS_OBJC_Debug :=
|
||||
|
||||
# Flags passed to only ObjC++ files.
|
||||
CFLAGS_OBJCC_Debug :=
|
||||
|
||||
INCS_Debug := \
|
||||
-I/Users/webgeek/.node-gyp/0.10.36/src \
|
||||
-I/Users/webgeek/.node-gyp/0.10.36/deps/uv/include \
|
||||
-I/Users/webgeek/.node-gyp/0.10.36/deps/v8/include \
|
||||
-I$(srcdir)/node_modules/nan
|
||||
|
||||
DEFS_Release := \
|
||||
'-D_DARWIN_USE_64_BIT_INODE=1' \
|
||||
'-D_LARGEFILE_SOURCE' \
|
||||
'-D_FILE_OFFSET_BITS=64' \
|
||||
'-DBUILDING_NODE_EXTENSION'
|
||||
|
||||
# Flags passed to all source files.
|
||||
CFLAGS_Release := \
|
||||
-Os \
|
||||
-gdwarf-2 \
|
||||
-mmacosx-version-min=10.5 \
|
||||
-arch x86_64 \
|
||||
-Wall \
|
||||
-Wendif-labels \
|
||||
-W \
|
||||
-Wno-unused-parameter
|
||||
|
||||
# Flags passed to only C files.
|
||||
CFLAGS_C_Release := \
|
||||
-fno-strict-aliasing
|
||||
|
||||
# Flags passed to only C++ files.
|
||||
CFLAGS_CC_Release := \
|
||||
-fno-rtti \
|
||||
-fno-exceptions \
|
||||
-fno-threadsafe-statics \
|
||||
-fno-strict-aliasing
|
||||
|
||||
# Flags passed to only ObjC files.
|
||||
CFLAGS_OBJC_Release :=
|
||||
|
||||
# Flags passed to only ObjC++ files.
|
||||
CFLAGS_OBJCC_Release :=
|
||||
|
||||
INCS_Release := \
|
||||
-I/Users/webgeek/.node-gyp/0.10.36/src \
|
||||
-I/Users/webgeek/.node-gyp/0.10.36/deps/uv/include \
|
||||
-I/Users/webgeek/.node-gyp/0.10.36/deps/v8/include \
|
||||
-I$(srcdir)/node_modules/nan
|
||||
|
||||
OBJS := \
|
||||
$(obj).target/$(TARGET)/src/serialport.o \
|
||||
$(obj).target/$(TARGET)/src/serialport_unix.o \
|
||||
$(obj).target/$(TARGET)/src/serialport_poller.o
|
||||
|
||||
# Add to the list of files we specially track dependencies for.
|
||||
all_deps += $(OBJS)
|
||||
|
||||
# CFLAGS et al overrides must be target-local.
|
||||
# See "Target-specific Variable Values" in the GNU Make manual.
|
||||
$(OBJS): TOOLSET := $(TOOLSET)
|
||||
$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
|
||||
$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
|
||||
$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))
|
||||
$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))
|
||||
|
||||
# Suffix rules, putting all outputs into $(obj).
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
|
||||
# Try building from generated source, too.
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
|
||||
# End of this set of suffix rules
|
||||
### Rules for final target.
|
||||
LDFLAGS_Debug := \
|
||||
-framework CoreFoundation -framework IOKit \
|
||||
-Wl,-search_paths_first \
|
||||
-mmacosx-version-min=10.5 \
|
||||
-arch x86_64 \
|
||||
-L$(builddir)
|
||||
|
||||
LIBTOOLFLAGS_Debug := \
|
||||
-framework CoreFoundation -framework IOKit \
|
||||
-Wl,-search_paths_first
|
||||
|
||||
LDFLAGS_Release := \
|
||||
-framework CoreFoundation -framework IOKit \
|
||||
-Wl,-search_paths_first \
|
||||
-mmacosx-version-min=10.5 \
|
||||
-arch x86_64 \
|
||||
-L$(builddir)
|
||||
|
||||
LIBTOOLFLAGS_Release := \
|
||||
-framework CoreFoundation -framework IOKit \
|
||||
-Wl,-search_paths_first
|
||||
|
||||
LIBS := \
|
||||
-undefined dynamic_lookup
|
||||
|
||||
$(builddir)/serialport.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
|
||||
$(builddir)/serialport.node: LIBS := $(LIBS)
|
||||
$(builddir)/serialport.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))
|
||||
$(builddir)/serialport.node: TOOLSET := $(TOOLSET)
|
||||
$(builddir)/serialport.node: $(OBJS) FORCE_DO_CMD
|
||||
$(call do_cmd,solink_module)
|
||||
|
||||
all_deps += $(builddir)/serialport.node
|
||||
# Add target alias
|
||||
.PHONY: serialport
|
||||
serialport: $(builddir)/serialport.node
|
||||
|
||||
# Short alias for building this executable.
|
||||
.PHONY: serialport.node
|
||||
serialport.node: $(builddir)/serialport.node
|
||||
|
||||
# Add executable to "all" target.
|
||||
.PHONY: all
|
||||
all: $(builddir)/serialport.node
|
||||
|
||||
BIN
node_modules/osc/node_modules/serialport/build/serialport/v1.7.4/Release/node-v11-linux-ia32/serialport.node
generated
vendored
Executable file
BIN
node_modules/osc/node_modules/serialport/build/serialport/v1.7.4/Release/node-v11-linux-ia32/serialport.node
generated
vendored
Executable file
Binary file not shown.
160
node_modules/osc/node_modules/serialport/changelog.md
generated
vendored
Normal file
160
node_modules/osc/node_modules/serialport/changelog.md
generated
vendored
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
Version 1.7.1
|
||||
-------------
|
||||
- Fixed breaking issues in underlying code. (@voodootikigod)
|
||||
|
||||
Version 1.7.0
|
||||
-------------
|
||||
- Fix for #518 and #498 If you pass to SerialPort function (constructor) the same object for argument "options", inside SerialPort will use it as internal object and adds handlers to it. That causes only one callback to work on different SerialPort instances. (@bullmastiffo)
|
||||
- Update README.md #515 (@arahlf)
|
||||
- Fix a memory leak in SerialportPoller::New (@jpilet)
|
||||
- unix support for update baudrate #502 (@jacobrosenthal)
|
||||
- set cloexec after open, possible fix for #468 (@jacobrosenthal)
|
||||
- Added hang up on close option to constructor. #495 (@jbendes)
|
||||
- Upgraded NAN to 1.8.4 due to complaints from io.js 2.x users. (@imyller)
|
||||
|
||||
Version 1.6.1
|
||||
-------------
|
||||
- Upgraded to NAN 1.7.0
|
||||
- #476 adding break signal
|
||||
|
||||
Version 1.6.0
|
||||
-------------
|
||||
- Long standing issue resolved thanks to @jacobrosenthal for adding control signals into the serialport. YAY!
|
||||
- Fix for #426
|
||||
- Ability to return from inside loop #453
|
||||
- Emits for close/disconnect. #452
|
||||
|
||||
Version 1.5.0
|
||||
-------------
|
||||
- Fixed to work with io.js and node 0.11.x by upgrading to recent nan 1.6.2
|
||||
|
||||
|
||||
Version 1.4.8
|
||||
-------------
|
||||
- Simple bump for the binary.
|
||||
|
||||
Version 1.4.7
|
||||
-------------
|
||||
- Fix for Issue #398 - Dropped sent characters on OSX and Linux
|
||||
- Fix for Issue #387 - added isOpen
|
||||
- removed a residual comment
|
||||
- Added osx control signalling
|
||||
- Fix for Issue #401
|
||||
- Fix for double write callbacks.
|
||||
- detect a serialport disconnect on linux.
|
||||
|
||||
Version 1.4.6
|
||||
-------------
|
||||
- Emit error on serialport when explicit handler present. Fixes gh-369
|
||||
- Fix for windows and Node 0.11.13 (atom-shell)
|
||||
- Fix for broken Travis-CI build.
|
||||
|
||||
Version 1.4.5
|
||||
-------------
|
||||
- Identified and report issue to node.js core about recent 0.11.x system.
|
||||
- Removed support for 0.8.x
|
||||
- Updated dependencies
|
||||
|
||||
Version 1.4.4
|
||||
-------------
|
||||
- Fix for delete error.
|
||||
|
||||
Version 1.3.0
|
||||
-------------
|
||||
- Merged NAN integration for Node 0.8->0.11+ compatibility (#270)
|
||||
|
||||
Version 1.2.5
|
||||
-------------
|
||||
- Fixed an issue with pool handlers being global instead of instance isolation (Issue #252 and #255 thanks: foobarth !!! )
|
||||
|
||||
|
||||
Version 1.2.4
|
||||
-------------
|
||||
- Resolved parity error under linux as reported here: https://github.com/voodootikigod/node-serialport/issues/219
|
||||
|
||||
|
||||
Version 1.1.3
|
||||
-------------
|
||||
- Remove ATL dependency on Windows (added Visual Studio Pro requirement)
|
||||
- Update build instructions
|
||||
- Four small bugfixes
|
||||
|
||||
Version 1.0.7
|
||||
-------------
|
||||
- Guaranteed in-order delivery of messages thanks to Jay Beavers and bnoordhuis
|
||||
|
||||
Version 1.0.6
|
||||
-------------
|
||||
- Support higher baud rates in Mac OS X
|
||||
|
||||
Version 1.0.5
|
||||
-------------
|
||||
- Added flush support.
|
||||
|
||||
Version 1.0.4
|
||||
-------------
|
||||
- Fix for arduino firmata support on windows thanks to @jgautier.
|
||||
|
||||
Version 1.0.3
|
||||
-------------
|
||||
- Fixed issue 65 - https://github.com/voodootikigod/node-serialport/issues/65
|
||||
- Added note in readme about what is required for the system to be able to compile module, should solve 90% of issues.
|
||||
|
||||
Version 1.0.2
|
||||
-------------
|
||||
- Fixed issue 59 - https://github.com/voodootikigod/node-serialport/issues/59
|
||||
|
||||
Version 1.0.1
|
||||
-------------
|
||||
- Fixed items from Firmata
|
||||
- Added flexibility for options (camelcase or all lower)
|
||||
|
||||
Version 1.0.0
|
||||
-------------
|
||||
- Added Windows support thanks to Joe Ferner.
|
||||
- Merged in the various underlying changes from node-serialport2 complete thanks to Joe Ferner for that!
|
||||
- Verified against known installations.
|
||||
|
||||
|
||||
Version 0.6.5
|
||||
-------------
|
||||
- Added SetBaudRate, SetDTR; Custom Baud Rates
|
||||
- New "close" listener when device being disconnected
|
||||
|
||||
Version 0.2.8
|
||||
-------------
|
||||
- BufferSize fix for readstream (thanks jgautier, you rock)
|
||||
|
||||
Version 0.2.7
|
||||
-------------
|
||||
- Make no port available be an exception not error emitted - Ticket #12.
|
||||
|
||||
Version 0.2.5 - Version 0.2.6
|
||||
-----------------------------
|
||||
- Debugging issue with IOWatcher not holding in the event loop in node.js.
|
||||
- Converted to ReadStream instead of IOWatcher.
|
||||
|
||||
Version 0.2.4
|
||||
-------------
|
||||
- Integrated arduino tests (rwaldron)
|
||||
- Integrated options bug fix (w1nk)
|
||||
- Integrated hardware flow control for crazier serial port action (w1nk)
|
||||
|
||||
Version 0.2.3
|
||||
-------------
|
||||
- Something amazing that has since been lost and forgotten.
|
||||
|
||||
Version 0.2.2
|
||||
-------------
|
||||
- Integrated enhanced version of arduino/readline that actually buffers the data (epeli)
|
||||
|
||||
Version 0.2.1
|
||||
-------------
|
||||
- Refactored the parsing code upon data receipt, now allows for dynamic specification of how incoming data is handled.
|
||||
- Revised creation interface to use named parameters as an object versions positional parameters.
|
||||
|
||||
Version: 0.2
|
||||
------------
|
||||
- Upgraded to node v. 0.4.X compatibility
|
||||
|
||||
All other version are not recorded.
|
||||
39
node_modules/osc/node_modules/serialport/examples/break.js
generated
vendored
Normal file
39
node_modules/osc/node_modules/serialport/examples/break.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// Use the cool library //
|
||||
// git://github.com/voodootikigod/node-serialport.git //
|
||||
// to send break condition. //
|
||||
////////////////////////////////////////////////////////
|
||||
var com = require("serialport");
|
||||
|
||||
var serialPort = new com.SerialPort("/dev/tty.usbserial-A700eTSd", {
|
||||
baudrate: 115200,
|
||||
parser: com.parsers.readline('\r\n')
|
||||
}, false);
|
||||
|
||||
serialPort.on('open',function() {
|
||||
console.log('Port open');
|
||||
});
|
||||
|
||||
serialPort.on('data', function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
function asserting() {
|
||||
console.log('asserting');
|
||||
serialPort.set({brk:true}, function(err, something) {
|
||||
console.log('asserted');
|
||||
setTimeout(clear, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function clear() {
|
||||
console.log('clearing');
|
||||
serialPort.set({brk:false}, function(err, something) {
|
||||
console.log('clear');
|
||||
setTimeout(done, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function done() {
|
||||
console.log("done breaking");
|
||||
}
|
||||
45
node_modules/osc/node_modules/serialport/examples/drain.js
generated
vendored
Normal file
45
node_modules/osc/node_modules/serialport/examples/drain.js
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
var SerialPort = require("serialport").SerialPort;
|
||||
|
||||
var sp = new SerialPort("/dev/cu.Cubelet-RGB", {
|
||||
baudrate: 38400
|
||||
});
|
||||
|
||||
sp.on('open',function() {
|
||||
sp.on('data', function(data) {
|
||||
console.log('>>>>>', data);
|
||||
});
|
||||
|
||||
var message = new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
||||
|
||||
function writeThenDrainThenWait(duration) {
|
||||
console.log('Calling write...');
|
||||
sp.write(message, function() {
|
||||
console.log('...Write callback returned...');
|
||||
// At this point, data may still be buffered and not sent out from the port yet (write function returns asynchrounously).
|
||||
console.log('...Calling drain...');
|
||||
sp.drain(function() {
|
||||
// Now data has "left the pipe" (tcdrain[1]/FlushFileBuffers[2] finished blocking).
|
||||
// [1] http://linux.die.net/man/3/tcdrain
|
||||
// [2] http://msdn.microsoft.com/en-us/library/windows/desktop/aa364439(v=vs.85).aspx
|
||||
console.log('...Drain callback returned...');
|
||||
console.log('...Waiting', duration, 'milliseconds...');
|
||||
setInterval(writeThenDrainThenWait, duration);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function writeThenWait(duration) {
|
||||
console.log('Calling write...');
|
||||
sp.write(message, function() {
|
||||
console.log('...Write callback returned...'); // Write function call immediately returned (asynchrounous).
|
||||
console.log('...Waiting', duration, 'milliseconds...');
|
||||
// Even though write returned, the data may still be in the pipe, and hasn't reached your robot yet.
|
||||
setInterval(writeThenWait, duration);
|
||||
});
|
||||
};
|
||||
|
||||
// Stuff starts happening here
|
||||
writeThenDrainThenWait(1000);
|
||||
//writeThenWait(1000);
|
||||
|
||||
});
|
||||
58
node_modules/osc/node_modules/serialport/examples/logger.js
generated
vendored
Normal file
58
node_modules/osc/node_modules/serialport/examples/logger.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
Simple example that takes a command line provided serial port destination and routes the output to a file of the same name with .log appended to the port name.
|
||||
|
||||
usage: node logger.js /dev/tty.usbserial <baudrate>
|
||||
|
||||
*/
|
||||
|
||||
var SerialPort = require("serialport");
|
||||
var fs = require("fs");
|
||||
var port = process.argv[2];
|
||||
var baudrate = process.argv[3];
|
||||
var active = false;
|
||||
|
||||
function attemptLogging(fd, port, baudrate) {
|
||||
if (!active) {
|
||||
fs.stat(port, function (err, stats) {
|
||||
if (!err) {
|
||||
active = true;
|
||||
|
||||
var serialPort = new SerialPort.SerialPort(port, {
|
||||
baudrate: baudrate
|
||||
});
|
||||
fs.write(fd, "\n------------------------------------------------------------\nOpening SerialPort: "+target+" at "+Date.now()+"\n------------------------------------------------------------\n");
|
||||
serialPort.on("data", function (data) {
|
||||
fs.write(fd, data.toString());
|
||||
});
|
||||
serialPort.on("close", function (data) {
|
||||
active = false;
|
||||
fs.write(fd, "\n------------------------------------------------------------\nClosing SerialPort: "+target+" at "+Date.now()+"\n------------------------------------------------------------\n");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!port) {
|
||||
console.log("You must specify a serial port location.");
|
||||
} else {
|
||||
var target = port.split("/");
|
||||
target = target[target.length-1]+".log";
|
||||
if (!baudrate) {
|
||||
baudrate = 115200;
|
||||
}
|
||||
fs.open("./"+target, 'w', function (err, fd) {
|
||||
setInterval(function () {
|
||||
if (!active) {
|
||||
try {
|
||||
attemptLogging(fd, port, baudrate);
|
||||
} catch (e) {
|
||||
// Error means port is not available for listening.
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
19
node_modules/osc/node_modules/serialport/examples/readdata.js
generated
vendored
Normal file
19
node_modules/osc/node_modules/serialport/examples/readdata.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// Use the cool library //
|
||||
// git://github.com/voodootikigod/node-serialport.git //
|
||||
// to read the serial port where arduino is sitting. //
|
||||
////////////////////////////////////////////////////////
|
||||
var com = require("serialport");
|
||||
|
||||
var serialPort = new com.SerialPort("/dev/cu.usbmodemfd121", {
|
||||
baudrate: 9600,
|
||||
parser: com.parsers.readline('\r\n')
|
||||
});
|
||||
|
||||
serialPort.on('open',function() {
|
||||
console.log('Port open');
|
||||
});
|
||||
|
||||
serialPort.on('data', function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
43
node_modules/osc/node_modules/serialport/examples/reset.js
generated
vendored
Normal file
43
node_modules/osc/node_modules/serialport/examples/reset.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// Use the cool library //
|
||||
// git://github.com/voodootikigod/node-serialport.git //
|
||||
// to reset an arduino. //
|
||||
////////////////////////////////////////////////////////
|
||||
var com = require("serialport");
|
||||
|
||||
var serialPort = new com.SerialPort("/dev/tty.usbmodem1411", {
|
||||
baudrate: 115200,
|
||||
parser: com.parsers.readline('\r\n')
|
||||
});
|
||||
|
||||
serialPort.on('open',function() {
|
||||
console.log('Port open');
|
||||
// note you get a dtr for free on port open so lets wait 5 seconds
|
||||
// to make sure ours is seperate from that one
|
||||
setTimeout(asserting, 5000);
|
||||
});
|
||||
|
||||
serialPort.on('data', function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
function asserting() {
|
||||
console.log('asserting');
|
||||
//NOTE: you actually de-assert rts and dtr to toggle!
|
||||
serialPort.set({rts:false, dtr:false}, function(err, something) {
|
||||
console.log('asserted');
|
||||
setTimeout(clear, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function clear() {
|
||||
console.log('clearing');
|
||||
serialPort.set({rts:true, dtr:true}, function(err, something) {
|
||||
console.log('clear');
|
||||
setTimeout(done, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function done() {
|
||||
console.log("done resetting");
|
||||
}
|
||||
13
node_modules/osc/node_modules/serialport/hwtest/package.json
generated
vendored
Normal file
13
node_modules/osc/node_modules/serialport/hwtest/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "node-sptest",
|
||||
"version": "0.0.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"serialport": "^1.4.6"
|
||||
}
|
||||
}
|
||||
40
node_modules/osc/node_modules/serialport/hwtest/test1.js
generated
vendored
Normal file
40
node_modules/osc/node_modules/serialport/hwtest/test1.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
var serialport = require("serialport");
|
||||
var SerialPort = serialport.SerialPort; // localize object constructor
|
||||
|
||||
serialport.list(function(err, ports) {
|
||||
console.log(ports);
|
||||
|
||||
});
|
||||
|
||||
var sp = new SerialPort("/dev/tty.usbmodem1421", {
|
||||
baudrate: 9600,
|
||||
parser: serialport.parsers.readline("\n")
|
||||
});
|
||||
|
||||
var i = 1;
|
||||
|
||||
sp.on("open", function() {
|
||||
console.log('open');
|
||||
sp.on('data', function(data) {
|
||||
console.log('count : ' + (i++));
|
||||
console.log('data received: ' + data);
|
||||
});
|
||||
|
||||
sp.on('disconnect', function(err) {
|
||||
console.log('on.disconnect');
|
||||
});
|
||||
|
||||
sp.on('error', function(err) {
|
||||
console.log("Erreur ?? " + err);
|
||||
});
|
||||
|
||||
sp.on('close', function() {
|
||||
console.log("Someone close the port ...");
|
||||
});
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
sp.close(function() {
|
||||
console.log("We're closing");
|
||||
});
|
||||
}, 10000);
|
||||
14
node_modules/osc/node_modules/serialport/hwtest/test2.js
generated
vendored
Normal file
14
node_modules/osc/node_modules/serialport/hwtest/test2.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
var SerialPort = require('serialport').SerialPort;
|
||||
|
||||
process.stdin.on('data', function() {});
|
||||
|
||||
process.stdin.on('end', function() {
|
||||
var sp = new SerialPort('/dev/tty.usbmodemfd121');
|
||||
sp.on('open', function() {
|
||||
console.log('SerialPort FD:', sp.fd);
|
||||
|
||||
sp.write('this will not get sent');
|
||||
|
||||
setTimeout(process.exit, 100);
|
||||
});
|
||||
});
|
||||
1
node_modules/osc/node_modules/serialport/node_modules/.bin/node-pre-gyp
generated
vendored
Symbolic link
1
node_modules/osc/node_modules/serialport/node_modules/.bin/node-pre-gyp
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../node-pre-gyp/bin/node-pre-gyp
|
||||
3
node_modules/osc/node_modules/serialport/node_modules/async/.travis.yml
generated
vendored
Normal file
3
node_modules/osc/node_modules/serialport/node_modules/async/.travis.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
19
node_modules/osc/node_modules/serialport/node_modules/async/LICENSE
generated
vendored
Normal file
19
node_modules/osc/node_modules/serialport/node_modules/async/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2010-2014 Caolan McMahon
|
||||
|
||||
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.
|
||||
1646
node_modules/osc/node_modules/serialport/node_modules/async/README.md
generated
vendored
Normal file
1646
node_modules/osc/node_modules/serialport/node_modules/async/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
11
node_modules/osc/node_modules/serialport/node_modules/async/component.json
generated
vendored
Normal file
11
node_modules/osc/node_modules/serialport/node_modules/async/component.json
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "async",
|
||||
"repo": "caolan/async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.1.23",
|
||||
"keywords": [],
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"main": "lib/async.js",
|
||||
"scripts": [ "lib/async.js" ]
|
||||
}
|
||||
1123
node_modules/osc/node_modules/serialport/node_modules/async/lib/async.js
generated
vendored
Executable file
1123
node_modules/osc/node_modules/serialport/node_modules/async/lib/async.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
60
node_modules/osc/node_modules/serialport/node_modules/async/package.json
generated
vendored
Normal file
60
node_modules/osc/node_modules/serialport/node_modules/async/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"name": "async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"main": "./lib/async",
|
||||
"author": {
|
||||
"name": "Caolan McMahon"
|
||||
},
|
||||
"version": "0.9.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/caolan/async.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/caolan/async/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/caolan/async/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"devDependencies": {
|
||||
"nodeunit": ">0.0.0",
|
||||
"uglify-js": "1.2.x",
|
||||
"nodelint": ">0.0.0"
|
||||
},
|
||||
"jam": {
|
||||
"main": "lib/async.js",
|
||||
"include": [
|
||||
"lib/async.js",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test/test-async.js"
|
||||
},
|
||||
"homepage": "https://github.com/caolan/async",
|
||||
"_id": "async@0.9.0",
|
||||
"dist": {
|
||||
"shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7",
|
||||
"tarball": "http://registry.npmjs.org/async/-/async-0.9.0.tgz"
|
||||
},
|
||||
"_from": "async@0.9.0",
|
||||
"_npmVersion": "1.4.3",
|
||||
"_npmUser": {
|
||||
"name": "caolan",
|
||||
"email": "caolan.mcmahon@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "caolan",
|
||||
"email": "caolan@caolanmcmahon.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7",
|
||||
"_resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
97
node_modules/osc/node_modules/serialport/node_modules/bindings/README.md
generated
vendored
Normal file
97
node_modules/osc/node_modules/serialport/node_modules/bindings/README.md
generated
vendored
Normal file
|
|
@ -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.<anonymous> (/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.
|
||||
166
node_modules/osc/node_modules/serialport/node_modules/bindings/bindings.js
generated
vendored
Normal file
166
node_modules/osc/node_modules/serialport/node_modules/bindings/bindings.js
generated
vendored
Normal file
|
|
@ -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<l; i++) {
|
||||
n = join.apply(null, opts.try[i].map(function (p) {
|
||||
return opts[p] || p
|
||||
}))
|
||||
tries.push(n)
|
||||
try {
|
||||
b = opts.path ? require.resolve(n) : require(n)
|
||||
if (!opts.path) {
|
||||
b.path = n
|
||||
}
|
||||
return b
|
||||
} catch (e) {
|
||||
if (!/not find/i.test(e.message)) {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = new Error('Could not locate the bindings file. Tried:\n'
|
||||
+ tries.map(function (a) { return opts.arrow + a }).join('\n'))
|
||||
err.tries = tries
|
||||
throw err
|
||||
}
|
||||
module.exports = exports = bindings
|
||||
|
||||
|
||||
/**
|
||||
* Gets the filename of the JavaScript file that invokes this function.
|
||||
* Used to help find the root directory of a module.
|
||||
* Optionally accepts an filename argument to skip when searching for the invoking filename
|
||||
*/
|
||||
|
||||
exports.getFileName = function getFileName (calling_file) {
|
||||
var origPST = Error.prepareStackTrace
|
||||
, origSTL = Error.stackTraceLimit
|
||||
, dummy = {}
|
||||
, fileName
|
||||
|
||||
Error.stackTraceLimit = 10
|
||||
|
||||
Error.prepareStackTrace = function (e, st) {
|
||||
for (var i=0, l=st.length; i<l; i++) {
|
||||
fileName = st[i].getFileName()
|
||||
if (fileName !== __filename) {
|
||||
if (calling_file) {
|
||||
if (fileName !== calling_file) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// run the 'prepareStackTrace' function above
|
||||
Error.captureStackTrace(dummy)
|
||||
dummy.stack
|
||||
|
||||
// cleanup
|
||||
Error.prepareStackTrace = origPST
|
||||
Error.stackTraceLimit = origSTL
|
||||
|
||||
return fileName
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root directory of a module, given an arbitrary filename
|
||||
* somewhere in the module tree. The "root directory" is the directory
|
||||
* containing the `package.json` file.
|
||||
*
|
||||
* In: /home/nate/node-native-module/lib/index.js
|
||||
* Out: /home/nate/node-native-module
|
||||
*/
|
||||
|
||||
exports.getRoot = function getRoot (file) {
|
||||
var dir = dirname(file)
|
||||
, prev
|
||||
while (true) {
|
||||
if (dir === '.') {
|
||||
// Avoids an infinite loop in rare cases, like the REPL
|
||||
dir = process.cwd()
|
||||
}
|
||||
if (exists(join(dir, 'package.json')) || exists(join(dir, 'node_modules'))) {
|
||||
// Found the 'package.json' file or 'node_modules' dir; we're done
|
||||
return dir
|
||||
}
|
||||
if (prev === dir) {
|
||||
// Got to the top
|
||||
throw new Error('Could not find module root given file: "' + file
|
||||
+ '". Do you have a `package.json` file? ')
|
||||
}
|
||||
// Try the parent dir next
|
||||
prev = dir
|
||||
dir = join(dir, '..')
|
||||
}
|
||||
}
|
||||
56
node_modules/osc/node_modules/serialport/node_modules/bindings/package.json
generated
vendored
Normal file
56
node_modules/osc/node_modules/serialport/node_modules/bindings/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "bindings",
|
||||
"description": "Helper module for loading your native module's .node file",
|
||||
"keywords": [
|
||||
"native",
|
||||
"addon",
|
||||
"bindings",
|
||||
"gyp",
|
||||
"waf",
|
||||
"c",
|
||||
"c++"
|
||||
],
|
||||
"version": "1.2.1",
|
||||
"author": {
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://tootallnate.net"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TooTallNate/node-bindings.git"
|
||||
},
|
||||
"main": "./bindings.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/TooTallNate/node-bindings/issues"
|
||||
},
|
||||
"homepage": "https://github.com/TooTallNate/node-bindings",
|
||||
"license": "MIT",
|
||||
"gitHead": "e404152ee27f8478ccbc7122ee051246e8e5ec02",
|
||||
"_id": "bindings@1.2.1",
|
||||
"scripts": {},
|
||||
"_shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11",
|
||||
"_from": "bindings@1.2.1",
|
||||
"_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!"
|
||||
}
|
||||
3
node_modules/osc/node_modules/serialport/node_modules/debug/.jshintrc
generated
vendored
Normal file
3
node_modules/osc/node_modules/serialport/node_modules/debug/.jshintrc
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"laxbreak": true
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue