Skip to content
Browse files

Contrib update

  • Loading branch information...
1 parent 6abdd03 commit ba043314f620971f34fc6340c5024e82970b9c6d Daniel Wirtz committed Mar 19, 2013
Showing with 493 additions and 7 deletions.
  1. +154 −1 contrib/ByteBuffer.js
  2. +328 −0 contrib/Long.js
  3. +8 −3 contrib/ProtoBuf.js
  4. +1 −1 contrib/Require.js
  5. +2 −2 crypto.js
View
155 contrib/ByteBuffer.js
@@ -46,6 +46,11 @@ ByteBuffer.prototype.offset;
/**
* @type {number}
*/
+ByteBuffer.prototype.markedOffset;
+
+/**
+ * @type {number}
+ */
ByteBuffer.prototype.length;
/**
@@ -71,6 +76,60 @@ ByteBuffer.LITTLE_ENDIAN = true;
*/
ByteBuffer.BIG_ENDIAN = false;
+/**
+ * @type {Int8Array}
+ * @const
+ */
+ByteBuffer.INT8;
+
+/**
+ * @type {Uint8Array}
+ * @const
+ */
+ByteBuffer.UINT8;
+
+/**
+ * @type {Int16Array}
+ * @const
+ */
+ByteBuffer.INT16;
+
+/**
+ * @type {Uint16Array}
+ * @const
+ */
+ByteBuffer.UINT16;
+
+/**
+ * @type {Int32Array}
+ * @const
+ */
+ByteBuffer.INT32;
+
+/**
+ * @type {Uint32Array}
+ * @const
+ */
+ByteBuffer.UINT32;
+
+/**
+ * @type {Float32Array}
+ * @const
+ */
+ByteBuffer.FLOAT32;
+
+/**
+ * @type {Float64Array}
+ * @const
+ */
+ByteBuffer.FLOAT64;
+
+/**
+ * @param {Uint8Array|Int8Array|Uint16Array|Int16Array|Uint32Array|Int32Array|Float32Array|Float64Array} type
+ * @param {number} value
+ * @return {number}
+ */
+ByteBuffer.cast = function(type, value) {};
/**
* @param {number=} capacity
@@ -135,6 +194,13 @@ ByteBuffer.prototype.ensureCapacity = function(capacity) {};
ByteBuffer.prototype.flip = function() {};
/**
+ * @param {number=} offset
+ * @return {!ByteBuffer}
+ * @throws {Error}
+ */
+ByteBuffer.prototype.mark = function(offset) {};
+
+/**
* @return {!ByteBuffer} this
*/
ByteBuffer.prototype.reset = function() {};
@@ -323,6 +389,34 @@ ByteBuffer.prototype.writeUint32 = function(value, offset) {};
ByteBuffer.prototype.readUint32 = function(offset) {};
/**
+ * @param {number|Long} value
+ * @param {number=} offset
+ * @return {!ByteBuffer}
+ */
+ByteBuffer.prototype.writeInt64 = function(value, offset) {};
+
+/**
+ * @param {number=} offset
+ * @return {Long}
+ * @throws {Error}
+ */
+ByteBuffer.prototype.readInt64 = function(offset) {};
+
+/**
+ * @param {number|Long} value
+ * @param {number=} offset
+ * @return {!ByteBuffer}
+ */
+ByteBuffer.prototype.writeUint64 = function(value, offset) {};
+
+/**
+ * @param {number=} offset
+ * @return {Long}
+ * @throws {Error}
+ */
+ByteBuffer.prototype.readUint64 = function(offset) {};
+
+/**
* @param {number} value
* @param {number=} offset
* @return {!ByteBuffer}
@@ -415,12 +509,42 @@ ByteBuffer.prototype.writeZigZagVarint32 = function(value, offset) {};
/**
* @param {number=} offset
- * @return {number|!{value: number, length: number}}
+ * @return {number|{value: number, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readZigZagVarint32 = function(offset) {};
/**
+ * @param {number|Long} value
+ * @param {number=} offset
+ * @return {!ByteBuffer|number}
+ * @throws {Error}
+ */
+ByteBuffer.prototype.writeVarint64 = function(value, offset) {};
+
+/**
+ * @param {number=} offset
+ * @return {!Long|{value: !Long, length: number}}
+ * @throws {Error}
+ */
+ByteBuffer.prototype.readVarint64 = function(offset) {};
+
+/**
+ * @param {number|Long} value
+ * @param {number=} offset
+ * @return {!ByteBuffer|number}
+ * @throws {Error}
+ */
+ByteBuffer.prototype.writeZigZagVarint64 = function(value, offset) {};
+
+/**
+ * @param {number=} offset
+ * @return {!Long|!{value: !Long, length: number}}
+ * @throws {Error}
+ */
+ByteBuffer.prototype.readZigZagVarint64 = function(offset) {};
+
+/**
* @param {number} value
* @param {number=} offset
* @return {!ByteBuffer|number}
@@ -436,12 +560,35 @@ ByteBuffer.prototype.readVarint = function(offset) {};
/**
* @param {number} value
+ * @param {number=} offset
+ * @return {!ByteBuffer|number}
+ */
+ByteBuffer.prototype.writeZigZagVarint = function(value, offset) {};
+
+/**
+ * @param {number=} offset
+ * @return {number|{value: number, length: number}}
+ * @throws {Error}
+ */
+ByteBuffer.prototype.readZigZagVarint = function(offset) {};
+
+/**
+ * @param {number} value
* @return {number}
+ * @throws {Error}
* @nosideeffects
*/
ByteBuffer.calculateVarint32 = function(value) {};
/**
+ * @param {number} value
+ * @return {number}
+ * @throws {Error}
+ * @nosideeffects
+ */
+ByteBuffer.calculateVarint64 = function(value) {};
+
+/**
* @param {string} str
* @return {number}
* @nosideeffects
@@ -607,3 +754,9 @@ ByteBuffer.zigZagDecode32 = function(n) {};
* @const
*/
ByteBuffer.MAX_VARINT32_BYTES = 5;
+
+/**
+ * @type {number}
+ * @const
+ */
+ByteBuffer.MAX_VARINT64_BYTES = 10;
View
328 contrib/Long.js
@@ -0,0 +1,328 @@
+/*
+ * 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
+ * @param {number} high
+ * @param {boolean=} unsigned
+ * @constructor
+ */
+var Long = function(low, high, unsigned) {};
+
+/**
+ * @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 {number} part0
+ * @param {number} part1
+ * @param {number} part2
+ * @param {boolean=} unsigned
+ * @return {!Long}
+ */
+Long.from28Bits = function(part0, part1, part2, unsigned) {};
+
+/**
+ * @param {string} str
+ * @param {(boolean|number)=} unsigned
+ * @param {number=} radix
+ * @return {!Long}
+ */
+Long.fromString = function(str, unsigned, radix) {};
+
+/**
+ * @type {!Long}
+ */
+Long.ZERO;
+
+/**
+ * @type {!Long}
+ */
+Long.ONE;
+
+/**
+ * @type {!Long}
+ */
+Long.NEG_ONE;
+
+/**
+ * @type {!Long}
+ */
+Long.MAX_SIGNED_VALUE;
+
+/**
+ * @type {!Long}
+ */
+Long.MIN_SIGNED_VALUE;
+
+/**
+ * @type {!Long}
+ */
+Long.MAX_UNSIGNED_VALUE;
+
+/**
+ * @type {!Long}
+ */
+Long.MIN_UNSIGNED_VALUE;
+
+/**
+ * @type {!Long}
+ */
+Long.MAX_VALUE;
+
+/**
+ * @type {!Long}
+ */
+Long.MIN_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} other
+ * @return {boolean}
+ */
+Long.prototype.equals = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {boolean}
+ */
+Long.prototype.notEquals = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {boolean}
+ */
+Long.prototype.lessThan = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {boolean}
+ */
+Long.prototype.lessThanOrEqual = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {boolean}
+ */
+Long.prototype.greaterThan = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {boolean}
+ */
+Long.prototype.greaterThanOrEqual = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {number}
+ */
+Long.prototype.compare = function(other) {};
+
+/**
+ * @return {!Long}
+ */
+Long.prototype.negate = function() {};
+
+/**
+ * @param {Long} other
+ * @return {!Long}
+ */
+Long.prototype.add = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {!Long}
+ */
+Long.prototype.subtract = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {!Long}
+ */
+Long.prototype.multiply = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {!Long}
+ */
+Long.prototype.div = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {!Long}
+ */
+Long.prototype.modulo = function(other) {};
+
+/**
+ * @return {!Long}
+ */
+Long.prototype.not = function() {};
+
+/**
+ * @param {Long} other
+ * @return {!Long}
+ */
+Long.prototype.and = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {!Long}
+ */
+Long.prototype.or = function(other) {};
+
+/**
+ * @param {Long} other
+ * @return {!Long}
+ */
+Long.prototype.xor = function(other) {};
+
+/**
+ * @param {number} numBits
+ * @return {!Long}
+ */
+Long.prototype.shiftLeft = function(numBits) {};
+
+/**
+ * @param {number} numBits
+ * @return {!Long}
+ */
+Long.prototype.shiftRight = function(numBits) {};
+
+/**
+ * @param {number} numBits
+ * @return {!Long}
+ */
+Long.prototype.shiftRightUnsigned = function(numBits) {};
+
+/**
+ * @return {!Long}
+ */
+Long.prototype.toSigned = function() {};
+
+/**
+ * @return {!Long}
+ */
+Long.prototype.toUnsigned = function() {};
+
+/**
+ * @return {!Long}
+ */
+Long.prototype.clone = function() {};
View
11 contrib/ProtoBuf.js
@@ -319,6 +319,7 @@ ProtoBuf.Reflect.Message.prototype.build = function() {};
/**
* @param {!ProtoBuf.Builder.Message} message
* @param {!ByteBuffer} buffer
+ * @return {!ByteBuffer}
* @throws {string}
*/
ProtoBuf.Reflect.Message.prototype.encode = function(message, buffer) {};
@@ -380,6 +381,7 @@ ProtoBuf.Reflect.Message.Field.prototype.verifyValue = function(value, skipRepea
/**
* @param {*} value
* @param {!ByteBuffer} buffer
+ * @return {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
@@ -397,6 +399,7 @@ ProtoBuf.Reflect.Message.Field.prototype.decode = function(wireType, buffer) {};
/**
* @param {*} value
* @param {!ByteBuffer} buffer
+ * @return {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
@@ -571,18 +574,20 @@ ProtoBuf.Builder.Message.prototype.toString = function() {};
/**
* @param {string} proto
+ * @param {ProtoBuf.Builder=} builder
* @return {!ProtoBuf.Builder}
* @throws {Error}
*/
-ProtoBuf.protoFromString = function(proto) {};
+ProtoBuf.protoFromString = function(proto, builder) {};
/**
* @param {string} filename
- * @param {function(ProtoBuf.Builder)=} callback
+ * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback
+ * @param {ProtoBuf.Builder=} builder
* @return {ProtoBuf.Builder|undefined}
* @throws {Error}
*/
-ProtoBuf.protoFromFile = function(filename, callback) {};
+ProtoBuf.protoFromFile = function(filename, callback, builder) {};
/**
* @param {string=} pkg
View
2 contrib/Require.js
@@ -42,7 +42,7 @@ define.amd;
function requirejs(deps, callback, errback, optional) {}
/**
- * @typedef {{nodeRequire: boolean, paths: Object.<string,string>, shim: Object.<string,string>}}
+ * @typedef {{nodeRequire: boolean=, baseUrl: string, paths: Object.<string,string>, shim: Object.<string,string>}}
*/
var RequireConfig;
View
4 crypto.js
@@ -351,12 +351,12 @@ crypto.DiffieHellman.prototype.setPrivateKey = function(key, encoding) {};
crypto.DiffieHellmanGroup = function(name) {};
/**
- * @type {crypto.DiffieHellman.prototype.generateKeys}
+ * @alias crypto.DiffieHellman.prototype.generateKeys
*/
crypto.DiffieHellmanGroup.prototype.generateKeys = crypto.DiffieHellman.prototype.generateKeys;
/**
- * @type {crypto.DiffieHellman.prototype.computeSecret}
+ * @alias crypto.DiffieHellman.prototype.computeSecret
*/
crypto.DiffieHellmanGroup.prototype.computeSecret = crypto.DiffieHellman.prototype.computeSecret;

0 comments on commit ba04331

Please sign in to comment.
Something went wrong with that request. Please try again.