Fix coding style javascript files (prettier)
This commit is contained in:
parent
82d1464f94
commit
162322634e
5 changed files with 493 additions and 687 deletions
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
const cxx = require('./cxx')().then((mod) => {
|
||||
var demangleCxx = mod.cwrap('cxx', 'string', ['string']);
|
||||
const cxx = require("./cxx")().then((mod) => {
|
||||
var demangleCxx = mod.cwrap("cxx", "string", ["string"]);
|
||||
console.log(demangleCxx("_Z29api_internal_launch_ipykernelP7_objectS0_S0_"));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
var fs = require ('fs');
|
||||
var fs = require("fs");
|
||||
|
||||
var nfd_in = +process.env.RZ_PIPE_IN;
|
||||
var nfd_out = +process.env.RZ_PIPE_OUT;
|
||||
|
||||
if (!nfd_in || !nfd_out) {
|
||||
console.error ("Only from r2");
|
||||
process.exit(1);
|
||||
console.error("Only from r2");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var fd_in = fs.createReadStream(null, {fd: nfd_in});
|
||||
var fd_out = fs.createWriteStream(null, {fd: nfd_out});
|
||||
var fd_in = fs.createReadStream(null, { fd: nfd_in });
|
||||
var fd_out = fs.createWriteStream(null, { fd: nfd_out });
|
||||
|
||||
console.error ("Running rzpipe io using fds: ", nfd_in, nfd_out);
|
||||
console.error("Running rzpipe io using fds: ", nfd_in, nfd_out);
|
||||
|
||||
fd_in.on('data', function(data) {
|
||||
data = data.slice(0,-1);
|
||||
var obj_in = JSON.parse (data);
|
||||
console.error ("got data(",obj_in,")");
|
||||
var obj = {result:obj_in.count, data:[1,2,3]};
|
||||
fd_out.write (JSON.stringify (obj)+"\x00");
|
||||
fd_in.on("data", function (data) {
|
||||
data = data.slice(0, -1);
|
||||
var obj_in = JSON.parse(data);
|
||||
console.error("got data(", obj_in, ")");
|
||||
var obj = { result: obj_in.count, data: [1, 2, 3] };
|
||||
fd_out.write(JSON.stringify(obj) + "\x00");
|
||||
});
|
||||
|
||||
fd_in.on('end', function() {
|
||||
console.log ("--> THE END");
|
||||
fd_in.on("end", function () {
|
||||
console.log("--> THE END");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,56 +3,56 @@
|
|||
|
||||
var isMain = process.argv[1] == __filename;
|
||||
|
||||
var fs = require ("fs");
|
||||
var fs = require("fs");
|
||||
|
||||
function langPipe () {
|
||||
var IN = +process.env.RZ_PIPE_IN;
|
||||
var OUT = +process.env.RZ_PIPE_OUT;
|
||||
function langPipe() {
|
||||
var IN = +process.env.RZ_PIPE_IN;
|
||||
var OUT = +process.env.RZ_PIPE_OUT;
|
||||
|
||||
var rzio = {
|
||||
r: fs.createReadStream (null, {fd: IN}),
|
||||
w: fs.createWriteStream (null, {fd: OUT})
|
||||
};
|
||||
var rzio = {
|
||||
r: fs.createReadStream(null, { fd: IN }),
|
||||
w: fs.createWriteStream(null, { fd: OUT }),
|
||||
};
|
||||
|
||||
var replies = [];
|
||||
rzio.cmd = function(cmd, cb) {
|
||||
replies.push (cb);
|
||||
rzio.w.write (cmd);
|
||||
}
|
||||
rzio.r.on ('data', function (foo) {
|
||||
if (replies.length>0) {
|
||||
var cb = replies[0];
|
||||
replies = replies.slice(1);
|
||||
if (cb) cb (''+foo);
|
||||
}
|
||||
});
|
||||
var replies = [];
|
||||
rzio.cmd = function (cmd, cb) {
|
||||
replies.push(cb);
|
||||
rzio.w.write(cmd);
|
||||
};
|
||||
rzio.r.on("data", function (foo) {
|
||||
if (replies.length > 0) {
|
||||
var cb = replies[0];
|
||||
replies = replies.slice(1);
|
||||
if (cb) cb("" + foo);
|
||||
}
|
||||
});
|
||||
|
||||
rzio.repl = function () {
|
||||
/* rizin repl implemented in pipe-node.js */
|
||||
rzio.r.pipe (process.stdout);
|
||||
process.stdin.on ('data', function (chunk) {
|
||||
if (replies.length>0) {
|
||||
var cb = replies[0];
|
||||
replies = replies.slice(1);
|
||||
var cb = replies.pop ();
|
||||
if (cb) cb (''+chunk);
|
||||
}
|
||||
rzio.w.write (chunk);
|
||||
});
|
||||
}
|
||||
return rzio;
|
||||
rzio.repl = function () {
|
||||
/* rizin repl implemented in pipe-node.js */
|
||||
rzio.r.pipe(process.stdout);
|
||||
process.stdin.on("data", function (chunk) {
|
||||
if (replies.length > 0) {
|
||||
var cb = replies[0];
|
||||
replies = replies.slice(1);
|
||||
var cb = replies.pop();
|
||||
if (cb) cb("" + chunk);
|
||||
}
|
||||
rzio.w.write(chunk);
|
||||
});
|
||||
};
|
||||
return rzio;
|
||||
}
|
||||
|
||||
// Example:
|
||||
if (isMain) {
|
||||
var lp = langPipe ();
|
||||
lp.cmd ("pd 3", function (x) {
|
||||
console.log (x);
|
||||
lp.cmd ("px 64", function (y) {
|
||||
console.log (y);
|
||||
lp.repl ();
|
||||
});
|
||||
});
|
||||
var lp = langPipe();
|
||||
lp.cmd("pd 3", function (x) {
|
||||
console.log(x);
|
||||
lp.cmd("px 64", function (y) {
|
||||
console.log(y);
|
||||
lp.repl();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
module.exports = langPipe();
|
||||
module.exports = langPipe();
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,7 @@ try {
|
|||
try {
|
||||
module.exports = require("./build/Debug/tree_sitter_rzcmd_binding");
|
||||
} catch (_) {
|
||||
throw error
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue