diff --git a/bootstrap/check-rnode.js b/bootstrap/check-rnode.js old mode 100755 new mode 100644 index 314cf13e..871e9f74 --- a/bootstrap/check-rnode.js +++ b/bootstrap/check-rnode.js @@ -18,4 +18,4 @@ async function main () { } } -main(); \ No newline at end of file +main(); diff --git a/bootstrap/cli-utils/create-snapshot-script.js b/bootstrap/cli-utils/create-snapshot-script.js index 624e7845..0e2e8a06 100644 --- a/bootstrap/cli-utils/create-snapshot-script.js +++ b/bootstrap/cli-utils/create-snapshot-script.js @@ -20,7 +20,7 @@ module.exports = { if (!fs.existsSync(homedir + '/.rnode')) { console.log(`Cannot snapshot: ${homedir}/.rnode does not exist`); rl.close(); - return; + return {message:"failed"}; } //run stop node script @@ -29,7 +29,7 @@ module.exports = { //if stop script terminates with error, exit if (code === 1) { rl.close(); - return; + return {message:"failed"}; } fs.mkdirSync('snapshot', { recursive: true }); @@ -49,9 +49,11 @@ module.exports = { await exec_shell(`cd ~ && tar czf "${target}" .rnode`); console.log(`snapshot created: ${target}`); rl.close(); + return {message:"successful"}; } else { console.log('Aborting...'); rl.close(); + return {message:"failed"} } }, ); @@ -59,6 +61,7 @@ module.exports = { await exec_shell(`cd ~ && tar czf "${target}" .rnode`); console.log(`snapshot created: ${target}`); rl.close(); + return {message:"successful"}; } }); diff --git a/src/actions.js b/src/actions.js index 4af8fb00..c08ae9bc 100644 --- a/src/actions.js +++ b/src/actions.js @@ -23,6 +23,13 @@ export const actions = { }, filename: 'actions/transfer.rho', }, + _____________________________________: { + fields: {}, +}, + sequencialLooping: { + fields: {}, + filename: 'actions/sequencialLooping.rho', +}, _____________________________: { fields: {}, }, diff --git a/src/actions/sequencialLooping.rho b/src/actions/sequencialLooping.rho new file mode 100644 index 00000000..4d2d5d8a --- /dev/null +++ b/src/actions/sequencialLooping.rho @@ -0,0 +1,38 @@ +match [] { + [] => { + new output, num, increaseByNum, increase, currentCount in { + currentCount!(0) | + contract increase(ack) = { + for(old <- currentCount) { + currentCount!(*old + 1) | + ack!(*old) + } + + } | + contract increaseByNum(num, ack) = { + // output!(*num) | + match *num { + 0 => { + output!("Recursion finished.") | + ack!(Nil) + } + _ => { + new kiril in { + for (k <- kiril) { ack!(Nil) } | + output!(*num) | + increase!(*num) | + increaseByNum!(*num-1, *kiril) + } + } + } + } | + new finished in { + increaseByNum!(500, *finished) | + for (_ <- finished) { + for (cc <- currentCount) { + output!({"Current count": *cc}) + } + } + } + } +}