Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

float.patch 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. diff --git a/lib/util.js b/lib/util.js
  2. index a03e874..9074e8e 100644
  3. --- a/lib/util.js
  4. +++ b/lib/util.js
  5. @@ -19,430 +19,6 @@
  6. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  7. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  8. -var formatRegExp = /%[sdj%]/g;
  9. -exports.format = function(f) {
  10. - if (!isString(f)) {
  11. - var objects = [];
  12. - for (var i = 0; i < arguments.length; i++) {
  13. - objects.push(inspect(arguments[i]));
  14. - }
  15. - return objects.join(' ');
  16. - }
  17. -
  18. - var i = 1;
  19. - var args = arguments;
  20. - var len = args.length;
  21. - var str = String(f).replace(formatRegExp, function(x) {
  22. - if (x === '%%') return '%';
  23. - if (i >= len) return x;
  24. - switch (x) {
  25. - case '%s': return String(args[i++]);
  26. - case '%d': return Number(args[i++]);
  27. - case '%j':
  28. - try {
  29. - return JSON.stringify(args[i++]);
  30. - } catch (_) {
  31. - return '[Circular]';
  32. - }
  33. - default:
  34. - return x;
  35. - }
  36. - });
  37. - for (var x = args[i]; i < len; x = args[++i]) {
  38. - if (isNull(x) || !isObject(x)) {
  39. - str += ' ' + x;
  40. - } else {
  41. - str += ' ' + inspect(x);
  42. - }
  43. - }
  44. - return str;
  45. -};
  46. -
  47. -
  48. -// Mark that a method should not be used.
  49. -// Returns a modified function which warns once by default.
  50. -// If --no-deprecation is set, then it is a no-op.
  51. -exports.deprecate = function(fn, msg) {
  52. - // Allow for deprecating things in the process of starting up.
  53. - if (isUndefined(global.process)) {
  54. - return function() {
  55. - return exports.deprecate(fn, msg).apply(this, arguments);
  56. - };
  57. - }
  58. -
  59. - if (process.noDeprecation === true) {
  60. - return fn;
  61. - }
  62. -
  63. - var warned = false;
  64. - function deprecated() {
  65. - if (!warned) {
  66. - if (process.throwDeprecation) {
  67. - throw new Error(msg);
  68. - } else if (process.traceDeprecation) {
  69. - console.trace(msg);
  70. - } else {
  71. - console.error(msg);
  72. - }
  73. - warned = true;
  74. - }
  75. - return fn.apply(this, arguments);
  76. - }
  77. -
  78. - return deprecated;
  79. -};
  80. -
  81. -
  82. -var debugs = {};
  83. -var debugEnviron;
  84. -exports.debuglog = function(set) {
  85. - if (isUndefined(debugEnviron))
  86. - debugEnviron = process.env.NODE_DEBUG || '';
  87. - set = set.toUpperCase();
  88. - if (!debugs[set]) {
  89. - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  90. - var pid = process.pid;
  91. - debugs[set] = function() {
  92. - var msg = exports.format.apply(exports, arguments);
  93. - console.error('%s %d: %s', set, pid, msg);
  94. - };
  95. - } else {
  96. - debugs[set] = function() {};
  97. - }
  98. - }
  99. - return debugs[set];
  100. -};
  101. -
  102. -
  103. -/**
  104. - * Echos the value of a value. Trys to print the value out
  105. - * in the best way possible given the different types.
  106. - *
  107. - * @param {Object} obj The object to print out.
  108. - * @param {Object} opts Optional options object that alters the output.
  109. - */
  110. -/* legacy: obj, showHidden, depth, colors*/
  111. -function inspect(obj, opts) {
  112. - // default options
  113. - var ctx = {
  114. - seen: [],
  115. - stylize: stylizeNoColor
  116. - };
  117. - // legacy...
  118. - if (arguments.length >= 3) ctx.depth = arguments[2];
  119. - if (arguments.length >= 4) ctx.colors = arguments[3];
  120. - if (isBoolean(opts)) {
  121. - // legacy...
  122. - ctx.showHidden = opts;
  123. - } else if (opts) {
  124. - // got an "options" object
  125. - exports._extend(ctx, opts);
  126. - }
  127. - // set default options
  128. - if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  129. - if (isUndefined(ctx.depth)) ctx.depth = 2;
  130. - if (isUndefined(ctx.colors)) ctx.colors = false;
  131. - if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  132. - if (ctx.colors) ctx.stylize = stylizeWithColor;
  133. - return formatValue(ctx, obj, ctx.depth);
  134. -}
  135. -exports.inspect = inspect;
  136. -
  137. -
  138. -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  139. -inspect.colors = {
  140. - 'bold' : [1, 22],
  141. - 'italic' : [3, 23],
  142. - 'underline' : [4, 24],
  143. - 'inverse' : [7, 27],
  144. - 'white' : [37, 39],
  145. - 'grey' : [90, 39],
  146. - 'black' : [30, 39],
  147. - 'blue' : [34, 39],
  148. - 'cyan' : [36, 39],
  149. - 'green' : [32, 39],
  150. - 'magenta' : [35, 39],
  151. - 'red' : [31, 39],
  152. - 'yellow' : [33, 39]
  153. -};
  154. -
  155. -// Don't use 'blue' not visible on cmd.exe
  156. -inspect.styles = {
  157. - 'special': 'cyan',
  158. - 'number': 'yellow',
  159. - 'boolean': 'yellow',
  160. - 'undefined': 'grey',
  161. - 'null': 'bold',
  162. - 'string': 'green',
  163. - 'date': 'magenta',
  164. - // "name": intentionally not styling
  165. - 'regexp': 'red'
  166. -};
  167. -
  168. -
  169. -function stylizeWithColor(str, styleType) {
  170. - var style = inspect.styles[styleType];
  171. -
  172. - if (style) {
  173. - return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  174. - '\u001b[' + inspect.colors[style][1] + 'm';
  175. - } else {
  176. - return str;
  177. - }
  178. -}
  179. -
  180. -
  181. -function stylizeNoColor(str, styleType) {
  182. - return str;
  183. -}
  184. -
  185. -
  186. -function arrayToHash(array) {
  187. - var hash = {};
  188. -
  189. - array.forEach(function(val, idx) {
  190. - hash[val] = true;
  191. - });
  192. -
  193. - return hash;
  194. -}
  195. -
  196. -
  197. -function formatValue(ctx, value, recurseTimes) {
  198. - // Provide a hook for user-specified inspect functions.
  199. - // Check that value is an object with an inspect function on it
  200. - if (ctx.customInspect &&
  201. - value &&
  202. - isFunction(value.inspect) &&
  203. - // Filter out the util module, it's inspect function is special
  204. - value.inspect !== exports.inspect &&
  205. - // Also filter out any prototype objects using the circular check.
  206. - !(value.constructor && value.constructor.prototype === value)) {
  207. - var ret = value.inspect(recurseTimes, ctx);
  208. - if (!isString(ret)) {
  209. - ret = formatValue(ctx, ret, recurseTimes);
  210. - }
  211. - return ret;
  212. - }
  213. -
  214. - // Primitive types cannot have properties
  215. - var primitive = formatPrimitive(ctx, value);
  216. - if (primitive) {
  217. - return primitive;
  218. - }
  219. -
  220. - // Look up the keys of the object.
  221. - var keys = Object.keys(value);
  222. - var visibleKeys = arrayToHash(keys);
  223. -
  224. - if (ctx.showHidden) {
  225. - keys = Object.getOwnPropertyNames(value);
  226. - }
  227. -
  228. - // Some type of object without properties can be shortcutted.
  229. - if (keys.length === 0) {
  230. - if (isFunction(value)) {
  231. - var name = value.name ? ': ' + value.name : '';
  232. - return ctx.stylize('[Function' + name + ']', 'special');
  233. - }
  234. - if (isRegExp(value)) {
  235. - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  236. - }
  237. - if (isDate(value)) {
  238. - return ctx.stylize(Date.prototype.toString.call(value), 'date');
  239. - }
  240. - if (isError(value)) {
  241. - return formatError(value);
  242. - }
  243. - }
  244. -
  245. - var base = '', array = false, braces = ['{', '}'];
  246. -
  247. - // Make Array say that they are Array
  248. - if (isArray(value)) {
  249. - array = true;
  250. - braces = ['[', ']'];
  251. - }
  252. -
  253. - // Make functions say that they are functions
  254. - if (isFunction(value)) {
  255. - var n = value.name ? ': ' + value.name : '';
  256. - base = ' [Function' + n + ']';
  257. - }
  258. -
  259. - // Make RegExps say that they are RegExps
  260. - if (isRegExp(value)) {
  261. - base = ' ' + RegExp.prototype.toString.call(value);
  262. - }
  263. -
  264. - // Make dates with properties first say the date
  265. - if (isDate(value)) {
  266. - base = ' ' + Date.prototype.toUTCString.call(value);
  267. - }
  268. -
  269. - // Make error with message first say the error
  270. - if (isError(value)) {
  271. - base = ' ' + formatError(value);
  272. - }
  273. -
  274. - if (keys.length === 0 && (!array || value.length == 0)) {
  275. - return braces[0] + base + braces[1];
  276. - }
  277. -
  278. - if (recurseTimes < 0) {
  279. - if (isRegExp(value)) {
  280. - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  281. - } else {
  282. - return ctx.stylize('[Object]', 'special');
  283. - }
  284. - }
  285. -
  286. - ctx.seen.push(value);
  287. -
  288. - var output;
  289. - if (array) {
  290. - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  291. - } else {
  292. - output = keys.map(function(key) {
  293. - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  294. - });
  295. - }
  296. -
  297. - ctx.seen.pop();
  298. -
  299. - return reduceToSingleString(output, base, braces);
  300. -}
  301. -
  302. -
  303. -function formatPrimitive(ctx, value) {
  304. - if (isUndefined(value))
  305. - return ctx.stylize('undefined', 'undefined');
  306. - if (isString(value)) {
  307. - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  308. - .replace(/'/g, "\\'")
  309. - .replace(/\\"/g, '"') + '\'';
  310. - return ctx.stylize(simple, 'string');
  311. - }
  312. - if (isNumber(value)) {
  313. - // Format -0 as '-0'. Strict equality won't distinguish 0 from -0,
  314. - // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 .
  315. - if (value === 0 && 1 / value < 0)
  316. - return ctx.stylize('-0', 'number');
  317. - return ctx.stylize('' + value, 'number');
  318. - }
  319. - if (isBoolean(value))
  320. - return ctx.stylize('' + value, 'boolean');
  321. - // For some reason typeof null is "object", so special case here.
  322. - if (isNull(value))
  323. - return ctx.stylize('null', 'null');
  324. -}
  325. -
  326. -
  327. -function formatError(value) {
  328. - return '[' + Error.prototype.toString.call(value) + ']';
  329. -}
  330. -
  331. -
  332. -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  333. - var output = [];
  334. - for (var i = 0, l = value.length; i < l; ++i) {
  335. - if (hasOwnProperty(value, String(i))) {
  336. - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  337. - String(i), true));
  338. - } else {
  339. - output.push('');
  340. - }
  341. - }
  342. - keys.forEach(function(key) {
  343. - if (!key.match(/^\d+$/)) {
  344. - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  345. - key, true));
  346. - }
  347. - });
  348. - return output;
  349. -}
  350. -
  351. -
  352. -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  353. - var name, str, desc;
  354. - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  355. - if (desc.get) {
  356. - if (desc.set) {
  357. - str = ctx.stylize('[Getter/Setter]', 'special');
  358. - } else {
  359. - str = ctx.stylize('[Getter]', 'special');
  360. - }
  361. - } else {
  362. - if (desc.set) {
  363. - str = ctx.stylize('[Setter]', 'special');
  364. - }
  365. - }
  366. - if (!hasOwnProperty(visibleKeys, key)) {
  367. - name = '[' + key + ']';
  368. - }
  369. - if (!str) {
  370. - if (ctx.seen.indexOf(desc.value) < 0) {
  371. - if (isNull(recurseTimes)) {
  372. - str = formatValue(ctx, desc.value, null);
  373. - } else {
  374. - str = formatValue(ctx, desc.value, recurseTimes - 1);
  375. - }
  376. - if (str.indexOf('\n') > -1) {
  377. - if (array) {
  378. - str = str.split('\n').map(function(line) {
  379. - return ' ' + line;
  380. - }).join('\n').substr(2);
  381. - } else {
  382. - str = '\n' + str.split('\n').map(function(line) {
  383. - return ' ' + line;
  384. - }).join('\n');
  385. - }
  386. - }
  387. - } else {
  388. - str = ctx.stylize('[Circular]', 'special');
  389. - }
  390. - }
  391. - if (isUndefined(name)) {
  392. - if (array && key.match(/^\d+$/)) {
  393. - return str;
  394. - }
  395. - name = JSON.stringify('' + key);
  396. - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  397. - name = name.substr(1, name.length - 2);
  398. - name = ctx.stylize(name, 'name');
  399. - } else {
  400. - name = name.replace(/'/g, "\\'")
  401. - .replace(/\\"/g, '"')
  402. - .replace(/(^"|"$)/g, "'");
  403. - name = ctx.stylize(name, 'string');
  404. - }
  405. - }
  406. -
  407. - return name + ': ' + str;
  408. -}
  409. -
  410. -
  411. -function reduceToSingleString(output, base, braces) {
  412. - var numLinesEst = 0;
  413. - var length = output.reduce(function(prev, cur) {
  414. - numLinesEst++;
  415. - if (cur.indexOf('\n') >= 0) numLinesEst++;
  416. - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  417. - }, 0);
  418. -
  419. - if (length > 60) {
  420. - return braces[0] +
  421. - (base === '' ? '' : base + '\n ') +
  422. - ' ' +
  423. - output.join(',\n ') +
  424. - ' ' +
  425. - braces[1];
  426. - }
  427. -
  428. - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  429. -}
  430. -
  431. -
  432. // NOTE: These type checking functions intentionally don't use `instanceof`
  433. // because it is fragile and can be easily faked with `Object.create()`.
  434. function isArray(ar) {
  435. @@ -522,166 +98,10 @@ function isPrimitive(arg) {
  436. exports.isPrimitive = isPrimitive;
  437. function isBuffer(arg) {
  438. - return arg instanceof Buffer;
  439. + return Buffer.isBuffer(arg);
  440. }
  441. exports.isBuffer = isBuffer;
  442. function objectToString(o) {
  443. return Object.prototype.toString.call(o);
  444. -}
  445. -
  446. -
  447. -function pad(n) {
  448. - return n < 10 ? '0' + n.toString(10) : n.toString(10);
  449. -}
  450. -
  451. -
  452. -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  453. - 'Oct', 'Nov', 'Dec'];
  454. -
  455. -// 26 Feb 16:19:34
  456. -function timestamp() {
  457. - var d = new Date();
  458. - var time = [pad(d.getHours()),
  459. - pad(d.getMinutes()),
  460. - pad(d.getSeconds())].join(':');
  461. - return [d.getDate(), months[d.getMonth()], time].join(' ');
  462. -}
  463. -
  464. -
  465. -// log is just a thin wrapper to console.log that prepends a timestamp
  466. -exports.log = function() {
  467. - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  468. -};
  469. -
  470. -
  471. -/**
  472. - * Inherit the prototype methods from one constructor into another.
  473. - *
  474. - * The Function.prototype.inherits from lang.js rewritten as a standalone
  475. - * function (not on Function.prototype). NOTE: If this file is to be loaded
  476. - * during bootstrapping this function needs to be rewritten using some native
  477. - * functions as prototype setup using normal JavaScript does not work as
  478. - * expected during bootstrapping (see mirror.js in r114903).
  479. - *
  480. - * @param {function} ctor Constructor function which needs to inherit the
  481. - * prototype.
  482. - * @param {function} superCtor Constructor function to inherit prototype from.
  483. - */
  484. -exports.inherits = function(ctor, superCtor) {
  485. - ctor.super_ = superCtor;
  486. - ctor.prototype = Object.create(superCtor.prototype, {
  487. - constructor: {
  488. - value: ctor,
  489. - enumerable: false,
  490. - writable: true,
  491. - configurable: true
  492. - }
  493. - });
  494. -};
  495. -
  496. -exports._extend = function(origin, add) {
  497. - // Don't do anything if add isn't an object
  498. - if (!add || !isObject(add)) return origin;
  499. -
  500. - var keys = Object.keys(add);
  501. - var i = keys.length;
  502. - while (i--) {
  503. - origin[keys[i]] = add[keys[i]];
  504. - }
  505. - return origin;
  506. -};
  507. -
  508. -function hasOwnProperty(obj, prop) {
  509. - return Object.prototype.hasOwnProperty.call(obj, prop);
  510. -}
  511. -
  512. -
  513. -// Deprecated old stuff.
  514. -
  515. -exports.p = exports.deprecate(function() {
  516. - for (var i = 0, len = arguments.length; i < len; ++i) {
  517. - console.error(exports.inspect(arguments[i]));
  518. - }
  519. -}, 'util.p: Use console.error() instead');
  520. -
  521. -
  522. -exports.exec = exports.deprecate(function() {
  523. - return require('child_process').exec.apply(this, arguments);
  524. -}, 'util.exec is now called `child_process.exec`.');
  525. -
  526. -
  527. -exports.print = exports.deprecate(function() {
  528. - for (var i = 0, len = arguments.length; i < len; ++i) {
  529. - process.stdout.write(String(arguments[i]));
  530. - }
  531. -}, 'util.print: Use console.log instead');
  532. -
  533. -
  534. -exports.puts = exports.deprecate(function() {
  535. - for (var i = 0, len = arguments.length; i < len; ++i) {
  536. - process.stdout.write(arguments[i] + '\n');
  537. - }
  538. -}, 'util.puts: Use console.log instead');
  539. -
  540. -
  541. -exports.debug = exports.deprecate(function(x) {
  542. - process.stderr.write('DEBUG: ' + x + '\n');
  543. -}, 'util.debug: Use console.error instead');
  544. -
  545. -
  546. -exports.error = exports.deprecate(function(x) {
  547. - for (var i = 0, len = arguments.length; i < len; ++i) {
  548. - process.stderr.write(arguments[i] + '\n');
  549. - }
  550. -}, 'util.error: Use console.error instead');
  551. -
  552. -
  553. -exports.pump = exports.deprecate(function(readStream, writeStream, callback) {
  554. - var callbackCalled = false;
  555. -
  556. - function call(a, b, c) {
  557. - if (callback && !callbackCalled) {
  558. - callback(a, b, c);
  559. - callbackCalled = true;
  560. - }
  561. - }
  562. -
  563. - readStream.addListener('data', function(chunk) {
  564. - if (writeStream.write(chunk) === false) readStream.pause();
  565. - });
  566. -
  567. - writeStream.addListener('drain', function() {
  568. - readStream.resume();
  569. - });
  570. -
  571. - readStream.addListener('end', function() {
  572. - writeStream.end();
  573. - });
  574. -
  575. - readStream.addListener('close', function() {
  576. - call();
  577. - });
  578. -
  579. - readStream.addListener('error', function(err) {
  580. - writeStream.end();
  581. - call(err);
  582. - });
  583. -
  584. - writeStream.addListener('error', function(err) {
  585. - readStream.destroy();
  586. - call(err);
  587. - });
  588. -}, 'util.pump(): Use readableStream.pipe() instead');
  589. -
  590. -
  591. -var uv;
  592. -exports._errnoException = function(err, syscall) {
  593. - if (isUndefined(uv)) uv = process.binding('uv');
  594. - var errname = uv.errname(err);
  595. - var e = new Error(syscall + ' ' + errname);
  596. - e.code = errname;
  597. - e.errno = errname;
  598. - e.syscall = syscall;
  599. - return e;
  600. -};
  601. +}