aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--desktop/core/library/_bang.js9
-rw-r--r--desktop/core/library/_cc.js17
-rw-r--r--desktop/core/library/_comment.js3
-rw-r--r--desktop/core/library/_midi.js26
-rw-r--r--desktop/core/library/_mono.js26
-rw-r--r--desktop/core/library/_osc.js16
-rw-r--r--desktop/core/library/_udp.js8
-rw-r--r--desktop/core/library/a.js8
-rw-r--r--desktop/core/library/b.js8
-rw-r--r--desktop/core/library/c.js8
-rw-r--r--desktop/core/library/d.js8
-rw-r--r--desktop/core/library/e.js2
-rw-r--r--desktop/core/library/f.js8
-rw-r--r--desktop/core/library/g.js17
-rw-r--r--desktop/core/library/h.js5
-rw-r--r--desktop/core/library/i.js8
-rw-r--r--desktop/core/library/j.js8
-rw-r--r--desktop/core/library/k.js8
-rw-r--r--desktop/core/library/l.js17
-rw-r--r--desktop/core/library/m.js8
-rw-r--r--desktop/core/library/n.js2
-rw-r--r--desktop/core/library/o.js14
-rw-r--r--desktop/core/library/p.js18
-rw-r--r--desktop/core/library/q.js23
-rw-r--r--desktop/core/library/r.js8
-rw-r--r--desktop/core/library/s.js2
-rw-r--r--desktop/core/library/t.js20
-rw-r--r--desktop/core/library/u.js8
-rw-r--r--desktop/core/library/v.js14
-rw-r--r--desktop/core/library/w.js2
-rw-r--r--desktop/core/library/x.js12
-rw-r--r--desktop/core/library/y.js8
-rw-r--r--desktop/core/library/z.js10
-rw-r--r--desktop/core/operator.js26
-rw-r--r--desktop/core/orca.js1
-rw-r--r--desktop/main.js1
-rw-r--r--desktop/sources/scripts/commander.js6
-rw-r--r--desktop/sources/scripts/terminal.js2
-rw-r--r--examples/benchmarks/cardinals.orca18
-rw-r--r--examples/benchmarks/io.orca (renamed from examples/misc/io.orca)0
-rw-r--r--examples/benchmarks/logic.orca (renamed from examples/misc/benchmark.orca)0
-rw-r--r--examples/benchmarks/rw.orca (renamed from examples/misc/read+write.orca)0
42 files changed, 193 insertions, 220 deletions
diff --git a/desktop/core/library/_bang.js b/desktop/core/library/_bang.js
index dd0b9c8..90fb738 100644
--- a/desktop/core/library/_bang.js
+++ b/desktop/core/library/_bang.js
@@ -9,14 +9,7 @@ export default function OperatorBang (orca, x, y, passive) {
this.info = 'Bangs neighboring operands'
this.draw = false
- // Overwrite run, to disable draw.
-
- this.run = function (force = false) {
-
- }
-
- this.haste = function () {
- this.passive = true
+ this.operation = function () {
this.erase()
}
}
diff --git a/desktop/core/library/_cc.js b/desktop/core/library/_cc.js
index c785b44..455a893 100644
--- a/desktop/core/library/_cc.js
+++ b/desktop/core/library/_cc.js
@@ -8,19 +8,18 @@ export default function OperatorCC (orca, x, y) {
this.name = 'cc'
this.info = 'Sends MIDI control change'
- this.ports.input.channel = { x: 1, y: 0, clamp: { min: 0, max: 15 } }
- this.ports.input.knob = { x: 2, y: 0, clamp: { min: 0 } }
- this.ports.input.value = { x: 3, y: 0, clamp: { min: 0 } }
+ this.ports.channel = { x: 1, y: 0, clamp: { min: 0, max: 15 } }
+ this.ports.knob = { x: 2, y: 0, clamp: { min: 0 } }
+ this.ports.value = { x: 3, y: 0, clamp: { min: 0 } }
this.operation = function (force = false) {
if (!this.hasNeighbor('*') && force === false) { return }
+ if (this.listen(this.ports.channel) === '.') { return }
+ if (this.listen(this.ports.knob) === '.') { return }
- if (this.listen(this.ports.input.channel) === '.') { return }
- if (this.listen(this.ports.input.knob) === '.') { return }
-
- const channel = this.listen(this.ports.input.channel, true)
- const knob = this.listen(this.ports.input.knob, true)
- const rawValue = this.listen(this.ports.input.value, true)
+ const channel = this.listen(this.ports.channel, true)
+ const knob = this.listen(this.ports.knob, true)
+ const rawValue = this.listen(this.ports.value, true)
const val = Math.ceil((127 * rawValue) / 35)
diff --git a/desktop/core/library/_comment.js b/desktop/core/library/_comment.js
index 16cf02d..8dcf0ae 100644
--- a/desktop/core/library/_comment.js
+++ b/desktop/core/library/_comment.js
@@ -9,12 +9,11 @@ export default function OperatorComment (orca, x, y, passive) {
this.info = 'Halts line'
this.draw = false
- this.haste = function () {
+ this.operation = function () {
for (let x = this.x + 1; x <= orca.w; x++) {
orca.lock(x, this.y)
if (orca.glyphAt(x, this.y) === this.glyph) { break }
}
- this.passive = false
orca.lock(this.x, this.y)
}
}
diff --git a/desktop/core/library/_midi.js b/desktop/core/library/_midi.js
index 8b37c23..2f8ccc1 100644
--- a/desktop/core/library/_midi.js
+++ b/desktop/core/library/_midi.js
@@ -8,24 +8,24 @@ export default function OperatorMidi (orca, x, y, passive) {
this.name = 'midi'
this.info = 'Sends MIDI note'
- this.ports.input.channel = { x: 1, y: 0, clamp: { min: 0, max: 16 } }
- this.ports.input.octave = { x: 2, y: 0, clamp: { min: 0, max: 8 } }
- this.ports.input.note = { x: 3, y: 0 }
- this.ports.input.velocity = { x: 4, y: 0, default: 'f', clamp: { min: 0, max: 16 } }
- this.ports.input.length = { x: 5, y: 0, default: '1', clamp: { min: 0, max: 16 } }
+ this.ports.channel = { x: 1, y: 0, clamp: { min: 0, max: 16 } }
+ this.ports.octave = { x: 2, y: 0, clamp: { min: 0, max: 8 } }
+ this.ports.note = { x: 3, y: 0 }
+ this.ports.velocity = { x: 4, y: 0, default: 'f', clamp: { min: 0, max: 16 } }
+ this.ports.length = { x: 5, y: 0, default: '1', clamp: { min: 0, max: 16 } }
this.operation = function (force = false) {
if (!this.hasNeighbor('*') && force === false) { return }
- if (this.listen(this.ports.input.channel) === '.') { return }
- if (this.listen(this.ports.input.octave) === '.') { return }
- if (this.listen(this.ports.input.note) === '.') { return }
+ if (this.listen(this.ports.channel) === '.') { return }
+ if (this.listen(this.ports.octave) === '.') { return }
+ if (this.listen(this.ports.note) === '.') { return }
- const channel = this.listen(this.ports.input.channel, true)
- const rawOctave = this.listen(this.ports.input.octave, true)
- const rawNote = this.listen(this.ports.input.note)
- const rawVelocity = this.listen(this.ports.input.velocity, true)
- const length = this.listen(this.ports.input.length, true)
+ const channel = this.listen(this.ports.channel, true)
+ const rawOctave = this.listen(this.ports.octave, true)
+ const rawNote = this.listen(this.ports.note)
+ const rawVelocity = this.listen(this.ports.velocity, true)
+ const length = this.listen(this.ports.length, true)
if (!isNaN(rawNote)) { return }
diff --git a/desktop/core/library/_mono.js b/desktop/core/library/_mono.js
index 740e4a2..f920413 100644
--- a/desktop/core/library/_mono.js
+++ b/desktop/core/library/_mono.js
@@ -8,24 +8,24 @@ export default function OperatorMono (orca, x, y, passive) {
this.name = 'mono'
this.info = 'Sends MIDI monophonic note'
- this.ports.input.channel = { x: 1, y: 0, clamp: { min: 0, max: 16 } }
- this.ports.input.octave = { x: 2, y: 0, clamp: { min: 0, max: 8 } }
- this.ports.input.note = { x: 3, y: 0 }
- this.ports.input.velocity = { x: 4, y: 0, default: 'f', clamp: { min: 0, max: 16 } }
- this.ports.input.length = { x: 5, y: 0, default: '1', clamp: { min: 0, max: 16 } }
+ this.ports.channel = { x: 1, y: 0, clamp: { min: 0, max: 16 } }
+ this.ports.octave = { x: 2, y: 0, clamp: { min: 0, max: 8 } }
+ this.ports.note = { x: 3, y: 0 }
+ this.ports.velocity = { x: 4, y: 0, default: 'f', clamp: { min: 0, max: 16 } }
+ this.ports.length = { x: 5, y: 0, default: '1', clamp: { min: 0, max: 16 } }
this.operation = function (force = false) {
if (!this.hasNeighbor('*') && force === false) { return }
- if (this.listen(this.ports.input.channel) === '.') { return }
- if (this.listen(this.ports.input.octave) === '.') { return }
- if (this.listen(this.ports.input.note) === '.') { return }
+ if (this.listen(this.ports.channel) === '.') { return }
+ if (this.listen(this.ports.octave) === '.') { return }
+ if (this.listen(this.ports.note) === '.') { return }
- const channel = this.listen(this.ports.input.channel, true)
- const rawOctave = this.listen(this.ports.input.octave, true)
- const rawNote = this.listen(this.ports.input.note)
- const rawVelocity = this.listen(this.ports.input.velocity, true)
- const length = this.listen(this.ports.input.length, true)
+ const channel = this.listen(this.ports.channel, true)
+ const rawOctave = this.listen(this.ports.octave, true)
+ const rawNote = this.listen(this.ports.note)
+ const rawVelocity = this.listen(this.ports.velocity, true)
+ const length = this.listen(this.ports.length, true)
const transposed = this.transpose(rawNote, rawOctave)
// 1 - 8
diff --git a/desktop/core/library/_osc.js b/desktop/core/library/_osc.js
index 8f4fec2..51c9ed2 100644
--- a/desktop/core/library/_osc.js
+++ b/desktop/core/library/_osc.js
@@ -8,22 +8,24 @@ export default function OperatorOsc (orca, x, y, passive) {
this.name = 'osc'
this.info = 'Sends OSC message'
- this.ports.haste.path = { x: 1, y: 0 }
+ this.ports.path = { x: 1, y: 0 }
+
+ this.operation = function (force = false) {
+ if (!this.hasNeighbor('*') && force === false) { return }
+
+ this.path = this.listen(this.ports.path)
+
+ if (!this.path || this.path === '.') { return }
- this.haste = function () {
- this.path = this.listen(this.ports.haste.path)
this.msg = ''
+
for (let x = 2; x <= 36; x++) {
const g = orca.glyphAt(this.x + x, this.y)
if (g === '.') { break }
orca.lock(this.x + x, this.y)
this.msg += g
}
- }
- this.operation = function (force = false) {
- if (!this.hasNeighbor('*') && force === false) { return }
- if (!this.path || this.path === '.') { return }
this.draw = false
terminal.io.osc.send('/' + this.path, this.msg)
diff --git a/desktop/core/library/_udp.js b/desktop/core/library/_udp.js
index 5309e6b..f89c00c 100644
--- a/desktop/core/library/_udp.js
+++ b/desktop/core/library/_udp.js
@@ -8,16 +8,14 @@ export default function OperatorUdp (orca, x, y, passive) {
this.name = 'udp'
this.info = 'Sends UDP message'
- this.haste = function () {
+ this.operation = function (force = false) {
+ if (!this.hasNeighbor('*') && force === false) { return }
+
for (let x = 1; x <= 36; x++) {
const g = orca.glyphAt(this.x + x, this.y)
if (g === '.') { break }
orca.lock(this.x + x, this.y)
}
- }
-
- this.operation = function (force = false) {
- if (!this.hasNeighbor('*') && force === false) { return }
let msg = ''
for (let x = 1; x <= 36; x++) {
diff --git a/desktop/core/library/a.js b/desktop/core/library/a.js
index cdc42e6..e6cd4dd 100644
--- a/desktop/core/library/a.js
+++ b/desktop/core/library/a.js
@@ -8,13 +8,13 @@ export default function OperatorA (orca, x, y, passive) {
this.name = 'add'
this.info = 'Outputs sum of inputs'
- this.ports.haste.a = { x: -1, y: 0 }
- this.ports.input.b = { x: 1, y: 0 }
+ this.ports.a = { x: -1, y: 0, unlocked: true }
+ this.ports.b = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true }
this.operation = function (force = false) {
- const a = this.listen(this.ports.haste.a, true)
- const b = this.listen(this.ports.input.b, true)
+ const a = this.listen(this.ports.a, true)
+ const b = this.listen(this.ports.b, true)
return orca.keyOf(a + b)
}
}
diff --git a/desktop/core/library/b.js b/desktop/core/library/b.js
index f461b90..ddf9f93 100644
--- a/desktop/core/library/b.js
+++ b/desktop/core/library/b.js
@@ -8,13 +8,13 @@ export default function OperatorB (orca, x, y, passive) {
this.name = 'bounce'
this.info = 'Outputs values between inputs'
- this.ports.haste.rate = { x: -1, y: 0, clamp: { min: 1 } }
- this.ports.input.mod = { x: 1, y: 0, default: '8' }
+ this.ports.rate = { x: -1, y: 0, unlocked: true, clamp: { min: 1 } }
+ this.ports.mod = { x: 1, y: 0, default: '8' }
this.ports.output = { x: 0, y: 1, sensitive: true }
this.operation = function (force = false) {
- const rate = this.listen(this.ports.haste.rate, true)
- const mod = this.listen(this.ports.input.mod, true) - 1
+ const rate = this.listen(this.ports.rate, true)
+ const mod = this.listen(this.ports.mod, true) - 1
const key = (Math.floor(orca.f / rate) % (mod * 2))
return orca.keyOf(key <= mod ? key : mod - (key - mod))
}
diff --git a/desktop/core/library/c.js b/desktop/core/library/c.js
index 610e31e..df58b06 100644
--- a/desktop/core/library/c.js
+++ b/desktop/core/library/c.js
@@ -8,13 +8,13 @@ export default function OperatorC (orca, x, y, passive) {
this.name = 'clock'
this.info = 'Outputs modulo of frame'
- this.ports.haste.rate = { x: -1, y: 0, clamp: { min: 1 } }
- this.ports.input.mod = { x: 1, y: 0, default: '8' }
+ this.ports.rate = { x: -1, y: 0, unlocked: true, clamp: { min: 1 } }
+ this.ports.mod = { x: 1, y: 0, default: '8' }
this.ports.output = { x: 0, y: 1, sensitive: true }
this.operation = function (force = false) {
- const rate = this.listen(this.ports.haste.rate, true)
- const mod = this.listen(this.ports.input.mod, true)
+ const rate = this.listen(this.ports.rate, true)
+ const mod = this.listen(this.ports.mod, true)
const val = (Math.floor(orca.f / rate) % mod)
return orca.keyOf(val)
}
diff --git a/desktop/core/library/d.js b/desktop/core/library/d.js
index 46cdb86..fe96b9d 100644
--- a/desktop/core/library/d.js
+++ b/desktop/core/library/d.js
@@ -8,13 +8,13 @@ export default function OperatorD (orca, x, y, passive) {
this.name = 'delay'
this.info = 'Bangs on modulo of frame'
- this.ports.haste.rate = { x: -1, y: 0, clamp: { min: 1 } }
- this.ports.input.mod = { x: 1, y: 0, default: '8' }
+ this.ports.rate = { x: -1, y: 0, unlocked: true, clamp: { min: 1 } }
+ this.ports.mod = { x: 1, y: 0, default: '8' }
this.ports.output = { x: 0, y: 1, bang: true }
this.operation = function (force = false) {
- const rate = this.listen(this.ports.haste.rate, true)
- const mod = this.listen(this.ports.input.mod, true)
+ const rate = this.listen(this.ports.rate, true)
+ const mod = this.listen(this.ports.mod, true)
const res = orca.f % (mod * rate)
return res === 0 || mod === 1
}
diff --git a/desktop/core/library/e.js b/desktop/core/library/e.js
index ad6eb07..dab6b39 100644
--- a/desktop/core/library/e.js
+++ b/desktop/core/library/e.js
@@ -9,7 +9,7 @@ export default function OperatorE (orca, x, y, passive) {
this.info = 'Moves eastward, or bangs'
this.draw = false
- this.haste = function () {
+ this.operation = function () {
this.move(1, 0)
this.passive = false
}
diff --git a/desktop/core/library/f.js b/desktop/core/library/f.js
index 3960e8c..677291d 100644
--- a/desktop/core/library/f.js
+++ b/desktop/core/library/f.js
@@ -8,13 +8,13 @@ export default function OperatorF (orca, x, y, passive) {
this.name = 'if'
this.info = 'Bangs if inputs are equal'
- this.ports.haste.a = { x: -1, y: 0 }
- this.ports.input.b = { x: 1, y: 0 }
+ this.ports.a = { x: -1, y: 0, unlocked: true }
+ this.ports.b = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, bang: true }
this.operation = function (force = false) {
- const a = this.listen(this.ports.haste.a)
- const b = this.listen(this.ports.input.b)
+ const a = this.listen(this.ports.a)
+ const b = this.listen(this.ports.b)
return a === b && a !== '.'
}
}
diff --git a/desktop/core/library/g.js b/desktop/core/library/g.js
index e5f107b..de01640 100644
--- a/desktop/core/library/g.js
+++ b/desktop/core/library/g.js
@@ -8,22 +8,19 @@ export default function OperatorG (orca, x, y, passive) {
this.name = 'generator'
this.info = 'Writes operands with offset'
- this.ports.haste.x = { x: -3, y: 0 }
- this.ports.haste.y = { x: -2, y: 0 }
- this.ports.haste.len = { x: -1, y: 0, clamp: { min: 1 } }
+ this.ports.x = { x: -3, y: 0, unlocked: true }
+ this.ports.y = { x: -2, y: 0, unlocked: true }
+ this.ports.len = { x: -1, y: 0, clamp: { min: 1 }, unlocked: true }
this.ports.output = { x: 0, y: 1 }
- this.haste = function () {
- const len = this.listen(this.ports.haste.len, true)
+ this.operation = function (force = false) {
+ const len = this.listen(this.ports.len, true)
for (let x = 1; x <= len; x++) {
orca.lock(this.x + x, this.y)
}
- }
- this.operation = function (force = false) {
- const len = this.listen(this.ports.haste.len, true)
- const x = this.listen(this.ports.haste.x, true)
- const y = this.listen(this.ports.haste.y, true) + 1
+ const x = this.listen(this.ports.x, true)
+ const y = this.listen(this.ports.y, true) + 1
this.ports.output = { x: x, y: y }
// Read
for (let i = 0; i < len; i++) {
diff --git a/desktop/core/library/h.js b/desktop/core/library/h.js
index 8565b10..24b1184 100644
--- a/desktop/core/library/h.js
+++ b/desktop/core/library/h.js
@@ -10,11 +10,8 @@ export default function OperatorH (orca, x, y, passive) {
this.ports.output = { x: 0, y: 1, reader: true }
- this.haste = function () {
- orca.lock(this.x + this.ports.output.x, this.y + this.ports.output.y)
- }
-
this.operation = function (force = false) {
+ orca.lock(this.x + this.ports.output.x, this.y + this.ports.output.y)
return this.listen(this.ports.output, true)
}
}
diff --git a/desktop/core/library/i.js b/desktop/core/library/i.js
index cb3a44b..51b2b99 100644
--- a/desktop/core/library/i.js
+++ b/desktop/core/library/i.js
@@ -8,13 +8,13 @@ export default function OperatorI (orca, x, y, passive) {
this.name = 'increment'
this.info = 'Increments southward operand'
- this.ports.haste.step = { x: -1, y: 0, default: '1' }
- this.ports.input.mod = { x: 1, y: 0 }
+ this.ports.step = { x: -1, y: 0, default: '1', unlocked: true }
+ this.ports.mod = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, reader: true }
this.operation = function (force = false) {
- const step = this.listen(this.ports.haste.step, true)
- const mod = this.listen(this.ports.input.mod, true)
+ const step = this.listen(this.ports.step, true)
+ const mod = this.listen(this.ports.mod, true)
const val = this.listen(this.ports.output, true)
return orca.keyOf((val + step) % (mod > 0 ? mod : 36))
}
diff --git a/desktop/core/library/j.js b/desktop/core/library/j.js
index d8aaf5f..9dde5dc 100644
--- a/desktop/core/library/j.js
+++ b/desktop/core/library/j.js
@@ -8,14 +8,12 @@ export default function OperatorJ (orca, x, y, passive) {
this.name = 'jumper'
this.info = 'Outputs northward operand'
- this.ports.haste.val = { x: 0, y: -1 }
+ this.ports.val = { x: 0, y: -1, unlocked: true }
this.ports.output = { x: 0, y: 1 }
- this.haste = function () {
+ this.operation = function (force = false) {
orca.lock(this.x, this.y + 1)
- }
- this.operation = function (force = false) {
- return this.listen(this.ports.haste.val)
+ return this.listen(this.ports.val)
}
}
diff --git a/desktop/core/library/k.js b/desktop/core/library/k.js
index 07cad34..6c427da 100644
--- a/desktop/core/library/k.js
+++ b/desktop/core/library/k.js
@@ -8,10 +8,10 @@ export default function OperatorK (orca, x, y, passive) {
this.name = 'konkat'
this.info = 'Reads multiple variables'
- this.ports.haste.len = { x: -1, y: 0, clamp: { min: 1 } }
+ this.ports.len = { x: -1, y: 0, unlocked: true, clamp: { min: 1 } }
- this.haste = function () {
- this.len = this.listen(this.ports.haste.len, true)
+ this.operation = function (force = false) {
+ this.len = this.listen(this.ports.len, true)
for (let x = 1; x <= this.len; x++) {
orca.lock(this.x + x, this.y)
const g = orca.glyphAt(this.x + x, this.y)
@@ -19,9 +19,7 @@ export default function OperatorK (orca, x, y, passive) {
orca.lock(this.x + x, this.y + 1)
}
}
- }
- this.operation = function (force = false) {
for (let x = 1; x <= this.len; x++) {
const key = orca.glyphAt(this.x + x, this.y)
orca.write(this.x + x, this.y + 1, orca.valueIn(key))
diff --git a/desktop/core/library/l.js b/desktop/core/library/l.js
index 71a076b..98aa3c0 100644
--- a/desktop/core/library/l.js
+++ b/desktop/core/library/l.js
@@ -8,27 +8,24 @@ export default function OperatorL (orca, x, y, passive) {
this.name = 'loop'
this.info = 'Moves eastward operands'
- this.ports.haste.step = { x: -2, y: 0, default: '1' }
- this.ports.haste.len = { x: -1, y: 0 }
- this.ports.input.val = { x: 1, y: 0 }
+ this.ports.step = { x: -2, y: 0, unlocked: true, default: '1' }
+ this.ports.len = { x: -1, y: 0, unlocked: true }
+ this.ports.val = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1 }
- this.haste = function () {
- const len = this.listen(this.ports.haste.len, true)
+ this.operation = function (force = false) {
+ const len = this.listen(this.ports.len, true)
for (let x = 1; x <= len; x++) {
orca.lock(this.x + x, this.y)
}
- }
- this.operation = function (force = false) {
- const step = this.listen(this.ports.haste.step, true)
- const len = this.listen(this.ports.haste.len, true)
+ const step = this.listen(this.ports.step, true)
const index = orca.indexAt(this.x + 1, this.y)
const seg = orca.s.substr(index, len)
const res = seg.substr(len - step, step) + seg.substr(0, len - step)
for (let x = 0; x < len; x++) {
orca.write(this.x + x + 1, this.y, res.charAt(x))
}
- return this.listen(this.ports.input.val)
+ return this.listen(this.ports.val)
}
}
diff --git a/desktop/core/library/m.js b/desktop/core/library/m.js
index 5eb5514..4bc8e59 100644
--- a/desktop/core/library/m.js
+++ b/desktop/core/library/m.js
@@ -8,13 +8,13 @@ export default function OperatorM (orca, x, y, passive) {
this.name = 'multiply'
this.info = 'Outputs product of inputs'
- this.ports.haste.a = { x: -1, y: 0 }
- this.ports.input.b = { x: 1, y: 0 }
+ this.ports.a = { x: -1, y: 0, unlocked: true }
+ this.ports.b = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true }
this.operation = function (force = false) {
- const a = this.listen(this.ports.haste.a, true)
- const b = this.listen(this.ports.input.b, true)
+ const a = this.listen(this.ports.a, true)
+ const b = this.listen(this.ports.b, true)
return orca.keyOf(a * b)
}
}
diff --git a/desktop/core/library/n.js b/desktop/core/library/n.js
index c3cc89e..1f1f290 100644
--- a/desktop/core/library/n.js
+++ b/desktop/core/library/n.js
@@ -9,7 +9,7 @@ export default function OperatorN (orca, x, y, passive) {
this.info = 'Moves Northward, or bangs'
this.draw = false
- this.haste = function () {
+ this.operation = function () {
this.move(0, -1)
this.passive = false
}
diff --git a/desktop/core/library/o.js b/desktop/core/library/o.js
index 6d89dc7..10bb339 100644
--- a/desktop/core/library/o.js
+++ b/desktop/core/library/o.js
@@ -8,15 +8,15 @@ export default function OperatorO (orca, x, y, passive) {
this.name = 'read'
this.info = 'Reads operand with offset'
- this.ports.haste.x = { x: -2, y: 0 }
- this.ports.haste.y = { x: -1, y: 0 }
- this.ports.input.read = { x: 1, y: 0 }
+ this.ports.x = { x: -2, y: 0, unlocked: true }
+ this.ports.y = { x: -1, y: 0, unlocked: true }
+ this.ports.read = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1 }
this.operation = function (force = false) {
- const x = this.listen(this.ports.haste.x, true)
- const y = this.listen(this.ports.haste.y, true)
- this.ports.input.read = { x: x + 1, y: y }
- return this.listen(this.ports.input.read)
+ const x = this.listen(this.ports.x, true)
+ const y = this.listen(this.ports.y, true)
+ this.ports.read = { x: x + 1, y: y }
+ return this.listen(this.ports.read)
}
}
diff --git a/desktop/core/library/p.js b/desktop/core/library/p.js
index 82893df..b2a0142 100644
--- a/desktop/core/library/p.js
+++ b/desktop/core/library/p.js
@@ -8,22 +8,18 @@ export default function OperatorP (orca, x, y, passive) {
this.name = 'push'
this.info = 'Writes eastward operand'
- this.ports.haste.len = { x: -1, y: 0, clamp: { min: 1 } }
- this.ports.haste.key = { x: -2, y: 0 }
- this.ports.input.val = { x: 1, y: 0 }
+ this.ports.len = { x: -1, y: 0, unlocked: true, clamp: { min: 1 } }
+ this.ports.key = { x: -2, y: 0, unlocked: true }
+ this.ports.val = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1 }
- this.haste = function () {
- const len = this.listen(this.ports.haste.len, true)
+ this.operation = function (force = false) {
+ const len = this.listen(this.ports.len, true)
for (let x = 0; x < len; x++) {
orca.lock(this.x + x, this.y + 1)
}
- }
-
- this.operation = function (force = false) {
- const len = this.listen(this.ports.haste.len, true)
- const key = this.listen(this.ports.haste.key, true)
+ const key = this.listen(this.ports.key, true)
this.ports.output = { x: (key % len), y: 1 }
- return this.listen(this.ports.input.val)
+ return this.listen(this.ports.val)
}
}
diff --git a/desktop/core/library/q.js b/desktop/core/library/q.js
index 1890bf4..52934dc 100644
--- a/desktop/core/library/q.js
+++ b/desktop/core/library/q.js
@@ -8,28 +8,23 @@ export default function OperatorQ (orca, x, y, passive) {
this.name = 'query'
this.info = 'Reads operands with offset'
- this.ports.haste.x = { x: -3, y: 0 }
- this.ports.haste.y = { x: -2, y: 0 }
- this.ports.haste.len = { x: -1, y: 0, clamp: { min: 1 } }
+ this.ports.x = { x: -3, y: 0, unlocked: true }
+ this.ports.y = { x: -2, y: 0, unlocked: true }
+ this.ports.len = { x: -1, y: 0, unlocked: true, clamp: { min: 1 } }
- this.haste = function () {
- const len = this.listen(this.ports.haste.len, true)
- const x = this.listen(this.ports.haste.x, true)
- const y = this.listen(this.ports.haste.y, true)
+ this.operation = function (force = false) {
+ const len = this.listen(this.ports.len, true)
+ const x = this.listen(this.ports.x, true)
+ const y = this.listen(this.ports.y, true)
for (let i = 1; i <= len; i++) {
orca.lock(this.x + x + i, this.y + y)
}
- }
- this.operation = function (force = false) {
- const len = this.listen(this.ports.haste.len, true)
- const x = this.listen(this.ports.haste.x, true)
- const y = this.listen(this.ports.haste.y, true)
for (let i = 1; i <= len; i++) {
- this.ports.haste[`val${i}`] = { x: x + i, y: y }
+ this.ports[`val${i}`] = { x: x + i, y: y }
orca.lock(this.x + x + i, this.y + y)
this.ports.output = { x: i - len, y: 1 }
- const res = this.listen(this.ports.haste[`val${i}`])
+ const res = this.listen(this.ports[`val${i}`])
this.output(`${res}`)
}
this.ports.output = { x: 0, y: 1 }
diff --git a/desktop/core/library/r.js b/desktop/core/library/r.js
index d27635d..793dc7e 100644
--- a/desktop/core/library/r.js
+++ b/desktop/core/library/r.js
@@ -8,13 +8,13 @@ export default function OperatorR (orca, x, y, passive) {
this.name = 'random'
this.info = 'Outputs random value'
- this.ports.haste.min = { x: -1, y: 0 }
- this.ports.input.max = { x: 1, y: 0 }
+ this.ports.min = { x: -1, y: 0, unlocked: true }
+ this.ports.max = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true }
this.operation = function (force = false) {
- const min = this.listen(this.ports.haste.min, true)
- const max = this.listen(this.ports.input.max, true)
+ const min = this.listen(this.ports.min, true)
+ const max = this.listen(this.ports.max, true)
const val = parseInt((Math.random() * ((max > 0 ? max : 36) - min)) + min)
return orca.keyOf(val)
}
diff --git a/desktop/core/library/s.js b/desktop/core/library/s.js
index 1b9cccf..0c13a28 100644
--- a/desktop/core/library/s.js
+++ b/desktop/core/library/s.js
@@ -9,7 +9,7 @@ export default function OperatorS (orca, x, y, passive) {
this.info = 'Moves southward, or bangs'
this.draw = false
- this.haste = function () {
+ this.operation = function () {
this.move(0, 1)
this.passive = false
}
diff --git a/desktop/core/library/t.js b/desktop/core/library/t.js
index e140d24..c703a24 100644
--- a/desktop/core/library/t.js
+++ b/desktop/core/library/t.js
@@ -8,22 +8,18 @@ export default function OperatorT (orca, x, y, passive) {
this.name = 'track'
this.info = 'Reads eastward operand'
- this.ports.haste.key = { x: -2, y: 0 }
- this.ports.haste.len = { x: -1, y: 0, clamp: { min: 1 } }
- this.ports.input.val = { x: 1, y: 0 }
+ this.ports.key = { x: -2, y: 0, unlocked: true }
+ this.ports.len = { x: -1, y: 0, unlocked: true, clamp: { min: 1 } }
+ this.ports.val = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1 }
- this.haste = function () {
- const len = this.listen(this.ports.haste.len, true)
+ this.operation = function (force = false) {
+ const len = this.listen(this.ports.len, true)
for (let x = 1; x <= len; x++) {
orca.lock(this.x + x, this.y)
}
- }
-
- this.operation = function (force = false) {
- const len = this.listen(this.ports.haste.len, true)
- const key = this.listen(this.ports.haste.key, true)
- this.ports.input.val = { x: (key % len) + 1, y: 0 }
- return this.listen(this.ports.input.val)
+ const key = this.listen(this.ports.key, true)
+ this.ports.val = { x: (key % len) + 1, y: 0 }
+ return this.listen(this.ports.val)
}
}
diff --git a/desktop/core/library/u.js b/desktop/core/library/u.js
index ab82edb..6fc70d7 100644
--- a/desktop/core/library/u.js
+++ b/desktop/core/library/u.js
@@ -8,13 +8,13 @@ export default function OperatorU (orca, x, y, passive) {
this.name = 'uclid'
this.info = 'Bangs on Euclidean rhythm'
- this.ports.haste.step = { x: -1, y: 0, clamp: { min: 0 }, default: '1' }
- this.ports.input.max = { x: 1, y: 0, clamp: { min: 1 }, default: '8' }
+ this.ports.step = { x: -1, y: 0, unlocked: true, clamp: { min: 0 }, default: '1' }
+ this.ports.max = { x: 1, y: 0, clamp: { min: 1 }, default: '8' }
this.ports.output = { x: 0, y: 1, bang: true }
this.operation = function (force = false) {
- const step = this.listen(this.ports.haste.step, true)
- const max = this.listen(this.ports.input.max, true)
+ const step = this.listen(this.ports.step, true)
+ const max = this.listen(this.ports.max, true)
const bucket = (step * (orca.f + max - 1)) % max + step
return bucket >= max
}
diff --git a/desktop/core/library/v.js b/desktop/core/library/v.js
index ae20581..c0a7359 100644
--- a/desktop/core/library/v.js
+++ b/desktop/core/library/v.js
@@ -8,20 +8,16 @@ export default function OperatorV (orca, x, y, passive) {
this.name = 'variable'
this.info = 'Reads and writes variable'
- this.ports.haste.write = { x: -1, y: 0 }
- this.ports.input.read = { x: 1, y: 0 }
+ this.ports.write = { x: -1, y: 0, unlocked: true }
+ this.ports.read = { x: 1, y: 0 }
- this.haste = function () {
- const write = this.listen(this.ports.haste.write)
- const read = this.listen(this.ports.input.read)
+ this.operation = function (force = false) {
+ const write = this.listen(this.ports.write)
+ const read = this.listen(this.ports.read)
if (write === '.' && read !== '.') {
this.ports.output = { x: 0, y: 1 }
}
- }
- this.operation = function (force = false) {
- const write = this.listen(this.ports.haste.write)
- const read = this.listen(this.ports.input.read)
if (write !== '.') {
orca.variables[write] = read
return
diff --git a/desktop/core/library/w.js b/desktop/core/library/w.js
index c9b0439..aae8615 100644
--- a/desktop/core/library/w.js
+++ b/desktop/core/library/w.js
@@ -9,7 +9,7 @@ export default function OperatorW (orca, x, y, passive) {
this.info = 'Moves westward, or bangs'
this.draw = false
- this.haste = function () {
+ this.operation = function () {
this.move(-1, 0)
this.passive = false
}
diff --git a/desktop/core/library/x.js b/desktop/core/library/x.js
index 016c3db..fdb63d1 100644
--- a/desktop/core/library/x.js
+++ b/desktop/core/library/x.js
@@ -8,14 +8,14 @@ export default function OperatorX (orca, x, y, passive) {
this.name = 'write'
this.info = 'Writes operand with offset'
- this.ports.haste.x = { x: -2, y: 0 }
- this.ports.haste.y = { x: -1, y: 0 }
- this.ports.input.val = { x: 1, y: 0 }
+ this.ports.x = { x: -2, y: 0, unlocked: true }
+ this.ports.y = { x: -1, y: 0, unlocked: true }
+ this.ports.val = { x: 1, y: 0 }
this.operation = function (force = false) {
- const x = this.listen(this.ports.haste.x, true)
- const y = this.listen(this.ports.haste.y, true) + 1
+ const x = this.listen(this.ports.x, true)
+ const y = this.listen(this.ports.y, true) + 1
this.ports.output = { x: x, y: y }
- return this.listen(this.ports.input.val)
+ return this.listen(this.ports.val)
}
}
diff --git a/desktop/core/library/y.js b/desktop/core/library/y.js
index 05f5daf..fc4511e 100644
--- a/desktop/core/library/y.js
+++ b/desktop/core/library/y.js
@@ -8,14 +8,12 @@ export default function OperatorY (orca, x, y, passive) {
this.name = 'jymper'
this.info = 'Outputs westward operand'
- this.ports.haste.val = { x: -1, y: 0 }
+ this.ports.val = { x: -1, y: 0, unlocked: true }
this.ports.output = { x: 1, y: 0 }
- this.haste = function () {
+ this.operation = function (force = false) {
orca.lock(this.x + 1, this.y)
- }
- this.operation = function (force = false) {
- return this.listen(this.ports.haste.val)
+ return this.listen(this.ports.val)
}
}
diff --git a/desktop/core/library/z.js b/desktop/core/library/z.js
index c8ea941..211b91b 100644
--- a/desktop/core/library/z.js
+++ b/desktop/core/library/z.js
@@ -6,15 +6,15 @@ export default function OperatorZ (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'z', passive)
this.name = 'lerp'
- this.info = 'Transitions operand to input'
+ this.info = 'Transitions operand to target'
- this.ports.haste.rate = { x: -1, y: 0, default: '1' }
- this.ports.input.target = { x: 1, y: 0 }
+ this.ports.rate = { x: -1, y: 0, unlocked: true, default: '1' }
+ this.ports.target = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, reader: true }
this.operation = function (force = false) {
- const rate = this.listen(this.ports.haste.rate, true)
- const target = this.listen(this.ports.input.target, true)
+ const rate = this.listen(this.ports.rate, true)
+ const target = this.listen(this.ports.target, true)
const val = this.listen(this.ports.output, true)
const mod = val <= target - rate ? rate : val >= target + rate ? -rate : target - val
return orca.keyOf(val + mod)
diff --git a/desktop/core/operator.js b/desktop/core/operator.js
index 1539cb3..1a08d4f 100644
--- a/desktop/core/operator.js
+++ b/desktop/core/operator.js
@@ -10,7 +10,7 @@ export default function Operator (orca, x, y, glyph = '.', passive = false) {
this.draw = passive
this.glyph = passive ? glyph.toUpperCase() : glyph
this.info = '--'
- this.ports = { input: {}, haste: {}, bang: !passive }
+ this.ports = { bang: !passive }
// Actions
@@ -40,16 +40,10 @@ export default function Operator (orca, x, y, glyph = '.', passive = false) {
// Phases
this.permissions = function () {
- for (const id in this.ports.input) {
- const port = this.ports.input[id]
+ for (const id in this.ports) {
+ const port = this.ports[id]
orca.lock(this.x + port.x, this.y + port.y)
}
- if (this.ports.output) {
- orca.lock(this.x + this.ports.output.x, this.y + this.ports.output.y)
- }
- }
-
- this.haste = function () {
}
this.operation = function () {
@@ -84,7 +78,7 @@ export default function Operator (orca, x, y, glyph = '.', passive = false) {
this.explode = function () {
this.replace('*')
- this.lock()
+ // this.lock()
}
this.move = function (x, y) {
@@ -115,13 +109,9 @@ export default function Operator (orca, x, y, glyph = '.', passive = false) {
a.push([this.x, this.y, 0, `${this.name.charAt(0).toUpperCase() + this.name.substring(1).toLowerCase()}`])
}
if (!this.passive) { return a }
- for (const id in this.ports.haste) {
- const port = this.ports.haste[id]
- a.push([this.x + port.x, this.y + port.y, 1, `${this.glyph}-${id}`])
- }
- for (const id in this.ports.input) {
- const port = this.ports.input[id]
- a.push([this.x + port.x, this.y + port.y, 2, `${this.glyph}-${id}`])
+ for (const id in this.ports) {
+ const port = this.ports[id]
+ a.push([this.x + port.x, this.y + port.y, port.unlocked === true ? 1 : 2, `${this.glyph}-${id}`])
}
if (this.ports.output) {
const port = this.ports.output
@@ -130,7 +120,7 @@ export default function Operator (orca, x, y, glyph = '.', passive = false) {
return a
}
- this.requireUC = function (ports = this.ports.input) {
+ this.requireUC = function (ports = this.ports) {
if (this.ports.output.sensitive !== true) { return false }
for (const id in ports) {
const value = this.listen(ports[id])
diff --git a/desktop/core/orca.js b/desktop/core/orca.js
index c7c44c7..dbb3cf7 100644
--- a/desktop/core/orca.js
+++ b/desktop/core/orca.js
@@ -85,7 +85,6 @@ export default function Orca (terminal) {
const operator = operators[id]
if (this.lockAt(operator.x, operator.y)) { continue }
if (operator.passive || operator.hasNeighbor('*')) {
- operator.haste()
operator.permissions()
operator.run()
}
diff --git a/desktop/main.js b/desktop/main.js
index fc44717..2c3bc30 100644
--- a/desktop/main.js
+++ b/desktop/main.js
@@ -37,6 +37,7 @@ app.on('ready', () => {
})
app.win.loadURL(`file://${__dirname}/sources/index.html`)
+ app.inspect()
app.win.on('closed', () => {
win = null
diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js
index 8b7fd57..405305f 100644
--- a/desktop/sources/scripts/commander.js
+++ b/desktop/sources/scripts/commander.js
@@ -17,21 +17,27 @@ export default function Commander (terminal) {
}
this.actives = {
+ // Ports
'osc': (val) => { terminal.io.osc.select(parseInt(val)) },
'udp': (val) => { terminal.io.udp.select(parseInt(val)) },
+ // Cursor
'copy': (val) => { terminal.cursor.copy() },
'paste': (val) => { terminal.cursor.paste(true) },
'erase': (val) => { terminal.cursor.erase() },
+ // Controls
'play': (val) => { terminal.clock.play() },
'stop': (val) => { terminal.clock.stop() },
'run': (val) => { terminal.run() },
+ // Speed
'apm': (val) => { terminal.clock.set(null, parseInt(val)) },
'bpm': (val) => { terminal.clock.set(parseInt(val), parseInt(val), true) },
'time': (val) => { terminal.clock.setFrame(parseInt(val)) },
'rewind': (val) => { terminal.clock.setFrame(terminal.orca.f - parseInt(val)) },
'skip': (val) => { terminal.clock.setFrame(terminal.orca.f + parseInt(val)) },
+ // Themeing
'color': (val) => { const parts = val.split(';'); terminal.theme.set('b_med', parts[0]); terminal.theme.set('b_inv', parts[1]); terminal.theme.set('b_high', parts[2]) },
'graphic': (val) => { terminal.theme.setImage(terminal.source.locate(val + '.jpg')) },
+ // Edit
'inject': (val) => { terminal.source.inject(val, true) },
'write': (val) => { const parts = val.split(';'); terminal.cursor.select(parts[1], parts[2], parts[0].length); terminal.cursor.writeBlock([parts[0].split('')]) }
}
diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js
index bf41f20..6fc812b 100644
--- a/desktop/sources/scripts/terminal.js
+++ b/desktop/sources/scripts/terminal.js
@@ -376,7 +376,7 @@ export default function Terminal () {
const operators = Object.keys(library).filter((val) => { return isNaN(val) })
for (const id in operators) {
const oper = new this.library[operators[id]]()
- const ports = (oper.ports.haste ? Object.keys(oper.ports.haste).reduce((acc, key, val) => { return acc + ' *' + key + '*' }, '') : '') + (oper.ports.input ? Object.keys(oper.ports.input).reduce((acc, key, val) => { return acc + ' ' + key }, '') : '')
+ const ports = oper.ports.input ? Object.keys(oper.ports.input).reduce((acc, key, val) => { return acc + ' ' + key }, '') : ''
html += `- \`${oper.glyph.toUpperCase()}\` **${oper.name}**${ports !== '' ? '(' + ports.trim() + ')' : ''}: ${oper.info}.\n`
}
return html
diff --git a/examples/benchmarks/cardinals.orca b/examples/benchmarks/cardinals.orca
new file mode 100644
index 0000000..47c553f
--- /dev/null
+++ b/examples/benchmarks/cardinals.orca
@@ -0,0 +1,18 @@
+..........................................
+.#.CLOCKWISE.#...#.COUNTER.#..............
+..........................................
+...2D4.....D4......2D4....D4..............
+.32X.............32X......................
+.......H...............H..................
+.......E...H...........S..................
+.......j...S...........j..................
+...........j................0.............
+..........................................
+..........................H...............
+...........S..........H...Ny..............
+............H.........Ey..E.0.............
+...........xW.............................
+.......0..................................
+..........................................
+..........................................
+.......................................... \ No newline at end of file
diff --git a/examples/misc/io.orca b/examples/benchmarks/io.orca
index 9caea1e..9caea1e 100644
--- a/examples/misc/io.orca
+++ b/examples/benchmarks/io.orca
diff --git a/examples/misc/benchmark.orca b/examples/benchmarks/logic.orca
index 1245574..1245574 100644
--- a/examples/misc/benchmark.orca
+++ b/examples/benchmarks/logic.orca
diff --git a/examples/misc/read+write.orca b/examples/benchmarks/rw.orca
index d584ad6..d584ad6 100644
--- a/examples/misc/read+write.orca
+++ b/examples/benchmarks/rw.orca