aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2018-10-18 17:40:39 +1200
committerDevine Lu Linvega <[email protected]>2018-10-18 17:40:39 +1200
commite612be470cc41bf2687b08b2c5a6ea4930b3899d (patch)
tree3856cc9e298b9e42b1484a4017a0c7357cef9835
parent61ae575172077d36e2400a538e679f427b8e195e (diff)
downloadOrca-e612be470cc41bf2687b08b2c5a6ea4930b3899d.tar.gz
Orca-e612be470cc41bf2687b08b2c5a6ea4930b3899d.zip
Improved docs
-rw-r--r--README.md85
-rw-r--r--cli/terminal.js6
-rw-r--r--desktop/core/lib/__bpm.js3
-rw-r--r--desktop/core/lib/__qqq.js1
-rw-r--r--desktop/core/lib/__vol.js1
-rw-r--r--desktop/core/lib/_base.js1
-rw-r--r--desktop/core/lib/_wiref.js1
-rw-r--r--desktop/core/lib/_wireh.js1
-rw-r--r--desktop/core/lib/_wiren.js1
-rw-r--r--desktop/core/lib/_wirev.js1
-rw-r--r--desktop/core/lib/a.js1
-rw-r--r--desktop/core/lib/b.js3
-rw-r--r--desktop/core/lib/e.js1
-rw-r--r--desktop/core/lib/f.js1
-rw-r--r--desktop/core/lib/g.js14
-rw-r--r--desktop/core/lib/h.js1
-rw-r--r--desktop/core/lib/i.js10
-rw-r--r--desktop/core/lib/k.js18
-rw-r--r--desktop/core/lib/l.js1
-rw-r--r--desktop/core/lib/m.js1
-rw-r--r--desktop/core/lib/n.js1
-rw-r--r--desktop/core/lib/o.js2
-rw-r--r--desktop/core/lib/p.js4
-rw-r--r--desktop/core/lib/q.js2
-rw-r--r--desktop/core/lib/r.js3
-rw-r--r--desktop/core/lib/s.js1
-rw-r--r--desktop/core/lib/w.js1
-rw-r--r--desktop/core/lib/y.js1
-rw-r--r--desktop/core/pico.js2
-rw-r--r--desktop/main.js2
-rw-r--r--desktop/sources/scripts/cursor.js2
-rw-r--r--desktop/sources/scripts/keyboard.js26
-rw-r--r--desktop/sources/scripts/lib/controller.js10
-rw-r--r--desktop/sources/scripts/lib/theme.js2
-rw-r--r--desktop/sources/scripts/qqq.js2
-rw-r--r--desktop/sources/scripts/terminal.js8
-rw-r--r--docs.js18
37 files changed, 127 insertions, 112 deletions
diff --git a/README.md b/README.md
index c65e32d..02f18cb 100644
--- a/README.md
+++ b/README.md
@@ -4,68 +4,49 @@
<img src='https://raw.githubusercontent.com/hundredrabbits/Pico/master/PREVIEW.jpg' width="600"/>
-## Programs
-
-### num functions
-
-- `0`, **null**: void
-- `1`, **null**: void
-- `2`, **null**: void
-- `3`, **null**: void
-- `4`, **null**: void
-- `5`, **null**: void
-- `6`, **null**: void
-- `7`, **null**: void
-- `8`, **null**: void
-- `9`, **null**: void
+## Functions
### alpha functions
-- `A`, **add**: Creates the result of the addition of east and west fns, southward.
-- `B`, **bang**: The bang is used to trigger various fns, only lasts one cycle.
-- `C`, **clamp**: [FIX]Clamp the northern fn between the westward and eastward fn bang.
-- `D`, **deflect**: [FIX]Converts neighboors into direction fns.
-- `E`, **east**: Moves eastward, or bangs.
-- `F`, **if**: Bangs if east and west fns are equal, southward.
-- `G`, **generator**: [FIX]Generates a direction fn from bang.
-- `H`, **halt**: Stops southward fn from operating.
-- `I`, **increment**: Increments southward numeric fn on bang.
-- `J`, **jump**: Copies the northward fn, southwardly.
-- `K`, **kill**: [TODO]Kills southward fns, on bang.
-- `L`, **loop**: Loop a number of characters ahead.
-- `M`, **modulo**: Creates the result of the modulo operation of east and west fns, southward.
-- `N`, **north**: Moves Northward, or bangs.
-- `O`, **odd**: Adds 0 southward, transforms into Q on bang.
-- `P`, **push**: Moves away, on bang.
-- `Q`, **even**: Adds 1 southward, transforms into O on bang.
-- `R`, **raycast**: Sends a bang to the nearest fn following the direction of the bang.
-- `S`, **south**: Moves southward, or bangs.
-- `T`, **trigger**: Bangs southward in the presence of `1`, `N`, `S`, `W`, `E` or `Z` northward.
-- `U`, **idle**: [TODO]Nothing..
-- `V`, **value**: Creates a numerical value between 0 and 5 based on the number of present _fns_ westward.
-- `W`, **west**: Moves westward, or bangs.
-- `X`, **split**: [FIX]Bangs eastward when westward fn is 0, and southward when fn is 1.
-- `Y`, **type**: Compares the type(num/alpha/special) of westward and eastward fns, and return 1 or 0 southward.
-- `Z`, **creep**: Moves to a the next available location in a cycle of E, S, W, N based on the runtime frame.
+- `A`, **add**(math): Creates the result of the addition of east and west fns, southward.
+- `B`, **bang**(unique): The bang is used to trigger various fns, only lasts one cycle.
+- `E`, **east**(direction): Moves eastward, or bangs.
+- `F`, **if**(math): Bangs if east and west fns are equal, southward.
+- `G`, **generator**(transport): Generates a direction fn from bang.
+- `H`, **halt**(stopper): Stops southward fn from operating.
+- `I`, **increment**(trigger): Increments southward numeric fn on bang.
+- `K`, **kill**(trigger): Kills southward fns, on bang.
+- `L`, **loop**(list): Loop a number of characters ahead.
+- `M`, **modulo**(math): Creates the result of the modulo operation of east and west fns, southward.
+- `N`, **north**(direction): Moves Northward, or bangs.
+- `R`, **raycast**(transport): Sends a bang to the nearest fn following the direction of the bang.
+- `S`, **south**(direction): Moves southward, or bangs.
+- `W`, **west**(direction): Moves westward, or bangs.
+- `Y`, **type**(math): Compares the type(num/alpha/special) of westward and eastward fns, and return 1 or 0 southward.
### special functions
-- `.`, **null**: void
-- `:`, **query**: Call a function by name, freezes 3 characters eastward.
-- `-`, **wire-h**: Send data along the wire, horizontally.
-- `|`, **wire-v**: Send data along the wire, vertically.
-- `*`, **wire-n**: Send data along the wire, entry or exit.
-- `+`, **wire-f**: Send data along the wire, across an intersection.
+- `-`, **wire-h**(wire): Send data along the wire, horizontally.
+- `|`, **wire-v**(wire): Send data along the wire, vertically.
+- `*`, **wire-n**(wire): Send data along the wire, entry or exit.
+- `+`, **wire-f**(wire): Send data along the wire, across an intersection.
### queries functions
-- `BPM`, **bpm**: Sets the speed for the Pico terminal.
-- `VOL`, **volume**: Sets the volume for the Pico terminal.
-- `QQQ`, **qqq**: Plays note, on channel, with octave.
+- `BPM`, **bpm**(midi): Sets the speed for the Pico terminal.
+- `VOL`, **volume**(midi): Sets the volume for the Pico terminal.
+- `QQQ`, **qqq**(midi): Plays note, on channel, with octave.
-## Logic Functions
+### Functions(By Type)
-The logic functions are passive, and they are `a`, `f`, `m`, `y`.
+- **maths**: `a` `f` `m` `y`.
+- **uniques**: `b`.
+- **directions**: `e` `n` `s` `w`.
+- **transports**: `g` `r`.
+- **stoppers**: `h`.
+- **triggers**: `i` `k`.
+- **lists**: `l`.
+- **wires**: `-` `|` `*` `-`.
## CLI
@@ -106,7 +87,7 @@ The idea is to build a synth/mini sequencer, here's some tasks I need to tackle
- [ ] Implement midi
- [ ] Finish midi channel implementation
- [ ] Convert notes to midi values
-
+- [ ] Implement a block comment syntax
## Extras
diff --git a/cli/terminal.js b/cli/terminal.js
index 60978fa..69a604e 100644
--- a/cli/terminal.js
+++ b/cli/terminal.js
@@ -52,12 +52,12 @@ function Terminal (pico) {
this._screen.key(['backspace'], (ch, key) => { this.cursor.erase(); })
this._screen.on('keypress', (ch) => {
- if (!ch || ch.length != 1) { return }
+ if (!ch || ch.length !== 1) { return }
this.cursor.insert(ch)
- if(ch == "|"){
+ if(ch === "|"){
this.cursor.move(0,-1)
}
- else if(ch == ch.toUpperCase()){
+ else if(ch === ch.toUpperCase()){
this.cursor.move(1,0)
}
})
diff --git a/desktop/core/lib/__bpm.js b/desktop/core/lib/__bpm.js
index c2d97b7..a248406 100644
--- a/desktop/core/lib/__bpm.js
+++ b/desktop/core/lib/__bpm.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnBpm (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'midi'
this.name = 'bpm'
this.glyph = '?'
this.info = 'Sets the speed for the Pico terminal.'
@@ -20,7 +21,7 @@ function FnBpm (pico, x, y) {
this.run = function () {
const val = `${pico.glyphAt(this.x + 1, this.y)}${pico.glyphAt(this.x + 2, this.y)}${pico.glyphAt(this.x + 3, this.y)}`
- if (parseInt(val) == pico.terminal.bpm) { return }
+ if (parseInt(val) === pico.terminal.bpm) { return }
if (val.indexOf('.') > -1) {
const bpm = pad(pico.terminal.bpm)
diff --git a/desktop/core/lib/__qqq.js b/desktop/core/lib/__qqq.js
index 2dc6b0c..f322182 100644
--- a/desktop/core/lib/__qqq.js
+++ b/desktop/core/lib/__qqq.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnQqq (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'midi'
this.name = 'qqq'
this.glyph = '?'
this.info = 'Plays note, on channel, with octave.'
diff --git a/desktop/core/lib/__vol.js b/desktop/core/lib/__vol.js
index da40ce5..02bda99 100644
--- a/desktop/core/lib/__vol.js
+++ b/desktop/core/lib/__vol.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnVol (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'midi'
this.name = 'volume'
this.glyph = '?'
this.info = 'Sets the volume for the Pico terminal.'
diff --git a/desktop/core/lib/_base.js b/desktop/core/lib/_base.js
index 297bf76..6fc687e 100644
--- a/desktop/core/lib/_base.js
+++ b/desktop/core/lib/_base.js
@@ -5,6 +5,7 @@ function FnBase (pico, x, y) {
this.y = y
this.name = '<missing name>'
this.glyph = '.'
+ this.type = 'misc'
this.info = 'Missing docs.'
this.ports = []
this.docs = 'Hello!'
diff --git a/desktop/core/lib/_wiref.js b/desktop/core/lib/_wiref.js
index 75c767d..7b07585 100644
--- a/desktop/core/lib/_wiref.js
+++ b/desktop/core/lib/_wiref.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnWireF (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'wire'
this.name = 'wire-f'
this.glyph = '-'
this.info = 'Send data along the wire, across an intersection.'
diff --git a/desktop/core/lib/_wireh.js b/desktop/core/lib/_wireh.js
index ca77e65..fc55721 100644
--- a/desktop/core/lib/_wireh.js
+++ b/desktop/core/lib/_wireh.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnWireH (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'wire'
this.name = 'wire-h'
this.glyph = '-'
this.info = 'Send data along the wire, horizontally.'
diff --git a/desktop/core/lib/_wiren.js b/desktop/core/lib/_wiren.js
index e54dc70..5eb8d7c 100644
--- a/desktop/core/lib/_wiren.js
+++ b/desktop/core/lib/_wiren.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnWireN (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'wire'
this.name = 'wire-n'
this.glyph = '*'
this.info = 'Send data along the wire, entry or exit.'
diff --git a/desktop/core/lib/_wirev.js b/desktop/core/lib/_wirev.js
index a1e279a..b8369df 100644
--- a/desktop/core/lib/_wirev.js
+++ b/desktop/core/lib/_wirev.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnWireH (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'wire'
this.name = 'wire-v'
this.glyph = '|'
this.info = 'Send data along the wire, vertically.'
diff --git a/desktop/core/lib/a.js b/desktop/core/lib/a.js
index eabea47..ff52ff4 100644
--- a/desktop/core/lib/a.js
+++ b/desktop/core/lib/a.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnA (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'math'
this.name = 'add'
this.glyph = 'a'
this.info = 'Creates the result of the addition of east and west fns, southward.'
diff --git a/desktop/core/lib/b.js b/desktop/core/lib/b.js
index 0102c0a..c9cb8e8 100644
--- a/desktop/core/lib/b.js
+++ b/desktop/core/lib/b.js
@@ -5,11 +5,12 @@ const FnBase = require('./_base')
function FnB (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'unique'
this.name = 'bang'
this.glyph = 'b'
this.info = 'The bang is used to trigger various fns, only lasts one cycle.'
- this.operation = function () {
+ this.haste = function () {
this.remove()
}
}
diff --git a/desktop/core/lib/e.js b/desktop/core/lib/e.js
index 2c56984..7d83af2 100644
--- a/desktop/core/lib/e.js
+++ b/desktop/core/lib/e.js
@@ -5,6 +5,7 @@ const FnMove = require('./_move')
function FnE (pico, x, y) {
FnMove.call(this, pico, x, y)
+ this.type = 'direction'
this.name = 'east'
this.glyph = 'e'
this.info = 'Moves eastward, or bangs.'
diff --git a/desktop/core/lib/f.js b/desktop/core/lib/f.js
index e6c3db2..4328870 100644
--- a/desktop/core/lib/f.js
+++ b/desktop/core/lib/f.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnF (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'math'
this.name = 'if'
this.glyph = 'f'
this.info = 'Bangs if east and west fns are equal, southward.'
diff --git a/desktop/core/lib/g.js b/desktop/core/lib/g.js
index 32581bf..a31bf8b 100644
--- a/desktop/core/lib/g.js
+++ b/desktop/core/lib/g.js
@@ -5,16 +5,18 @@ const FnBase = require('./_base')
function FnG (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'transport'
this.name = 'generator'
this.glyph = 'g'
- this.info = '[FIX]Generates a direction fn from bang.'
-
- this.ports = [{ x: 0, y: 1, output: true }, { x: 0, y: 0, bang: true }]
+ this.info = 'Generates a direction fn from bang.'
+ this.ports = [{ x: 0, y: 0, bang: true }]
this.operation = function () {
- if (!this.bang()) { return }
-
- pico.add(this.x, this.y + 1, 's')
+ const origin = this.bang()
+ if (!origin) { return }
+ const vector = { x: this.x - origin.x, y: this.y - origin.y }
+ const beam = { x: this.x + vector.x, y: this.y + vector.y }
+ pico.add(beam.x, beam.y, vector.x === 1 ? 'e' : vector.x === -1 ? 'w' : vector.y === -1 ? 'n' : 's')
}
}
diff --git a/desktop/core/lib/h.js b/desktop/core/lib/h.js
index 1bb39bf..9f7f734 100644
--- a/desktop/core/lib/h.js
+++ b/desktop/core/lib/h.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnH (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'stopper'
this.name = 'halt'
this.glyph = 'h'
this.info = 'Stops southward fn from operating.'
diff --git a/desktop/core/lib/i.js b/desktop/core/lib/i.js
index 66bea28..b271190 100644
--- a/desktop/core/lib/i.js
+++ b/desktop/core/lib/i.js
@@ -5,11 +5,18 @@ const FnBase = require('./_base')
function FnI (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'trigger'
this.name = 'increment'
this.glyph = 'i'
this.info = 'Increments southward numeric fn on bang.'
this.ports = [{ x: 0, y: 0, bang: true }, { x: 0, y: 1, output: true }, { x: 1, y: 0, input: true }, { x: -1, y: 0, input: true }]
+ this.haste = function () {
+ pico.lock(this.x, this.y + 1)
+ pico.lock(this.x + 1, this.y)
+ pico.lock(this.x - 1, this.y)
+ }
+
this.operation = function () {
if (!this.bang()) { return }
@@ -23,8 +30,7 @@ function FnI (pico, x, y) {
const result = val + 1 >= max ? min : val + 1
- pico.add(this.x, this.y + 1, `${result}`)
- pico.lock(this.x, this.y + 1)
+ pico.add(this.x, this.y + 1, `${pico.allowed[result]}`)
}
}
diff --git a/desktop/core/lib/k.js b/desktop/core/lib/k.js
index d18bc86..e56be6d 100644
--- a/desktop/core/lib/k.js
+++ b/desktop/core/lib/k.js
@@ -5,23 +5,15 @@ const FnBase = require('./_base')
function FnK (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'trigger'
this.name = 'kill'
this.glyph = 'k'
- this.info = '[TODO]Kills southward fns, on bang.'
- this.ports = [{ x: 0, y: 0, bang: true }, { x: 0, y: 1 }, { x: 0, y: -1 }, { x: 1, y: 0 }, { x: -1, y: 0 }]
+ this.info = 'Kills southward fns, on bang.'
+ this.ports = [{ x: 0, y: 0, bang: true }, { x: 0, y: 1, output: true }]
this.operation = function () {
- if (this.bang()) {
- pico.remove(this.x - 1, this.y)
- pico.remove(this.x + 1, this.y)
- pico.remove(this.x, this.y + 1)
- pico.remove(this.x, this.y - 1)
-
- pico.lock(this.x, this.y + 1)
- pico.lock(this.x, this.y - 1)
- pico.lock(this.x + 1, this.y)
- pico.lock(this.x - 1, this.y)
- }
+ if (!this.bang()) { return }
+ pico.remove(this.x, this.y + 1)
}
}
diff --git a/desktop/core/lib/l.js b/desktop/core/lib/l.js
index ec41e86..df8992a 100644
--- a/desktop/core/lib/l.js
+++ b/desktop/core/lib/l.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnL (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'list'
this.name = 'loop'
this.glyph = 'l'
this.info = 'Loop a number of characters ahead.'
diff --git a/desktop/core/lib/m.js b/desktop/core/lib/m.js
index a5b92f8..17644fb 100644
--- a/desktop/core/lib/m.js
+++ b/desktop/core/lib/m.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnM (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'math'
this.name = 'modulo'
this.glyph = 'm'
this.info = 'Creates the result of the modulo operation of east and west fns, southward.'
diff --git a/desktop/core/lib/n.js b/desktop/core/lib/n.js
index 78dfb1c..02ce071 100644
--- a/desktop/core/lib/n.js
+++ b/desktop/core/lib/n.js
@@ -5,6 +5,7 @@ const FnMove = require('./_move')
function FnN (pico, x, y) {
FnMove.call(this, pico, x, y)
+ this.type = 'direction'
this.name = 'north'
this.glyph = 'n'
this.info = 'Moves Northward, or bangs.'
diff --git a/desktop/core/lib/o.js b/desktop/core/lib/o.js
index f6425cd..6479aad 100644
--- a/desktop/core/lib/o.js
+++ b/desktop/core/lib/o.js
@@ -7,7 +7,7 @@ function FnO (pico, x, y) {
this.name = 'odd'
this.glyph = 'o'
- this.info = 'Adds 0 southward, transforms into Q on bang.'
+ this.info = '[FIX]Adds 0 southward, transforms into Q on bang.'
this.ports = [{ x: 0, y: 0, bang: true }, { x: 0, y: -1 }]
this.operation = function () {
diff --git a/desktop/core/lib/p.js b/desktop/core/lib/p.js
index 9ccd846..2f23f25 100644
--- a/desktop/core/lib/p.js
+++ b/desktop/core/lib/p.js
@@ -24,10 +24,6 @@ function FnP (pico, x, y) {
pico.add(this.x + (direction.x * 2), this.y + (direction.y * 2), pushed.glyph)
}
}
-
- this.n_offset = function (pos) {
- return { x: this.x - pos.x, y: this.y - pos.y }
- }
}
module.exports = FnP
diff --git a/desktop/core/lib/q.js b/desktop/core/lib/q.js
index e8eedeb..520f33a 100644
--- a/desktop/core/lib/q.js
+++ b/desktop/core/lib/q.js
@@ -7,7 +7,7 @@ function FnQ (pico, x, y) {
this.name = 'even'
this.glyph = 'q'
- this.info = 'Adds 1 southward, transforms into O on bang.'
+ this.info = '[FIX]Adds 1 southward, transforms into O on bang.'
this.ports = [{ x: 0, y: 0, bang: true }, { x: 0, y: 1, output: true }]
this.operation = function () {
diff --git a/desktop/core/lib/r.js b/desktop/core/lib/r.js
index 454f411..2ecb290 100644
--- a/desktop/core/lib/r.js
+++ b/desktop/core/lib/r.js
@@ -5,10 +5,13 @@ const FnBase = require('./_base')
function FnR (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'transport'
this.name = 'raycast'
this.glyph = 'r'
this.info = 'Sends a bang to the nearest fn following the direction of the bang.'
+ this.ports = [{ x: 0, y: 0, bang: true }]
+
this.operation = function () {
const origin = this.bang()
if (!origin) { return }
diff --git a/desktop/core/lib/s.js b/desktop/core/lib/s.js
index d4fda97..00a8133 100644
--- a/desktop/core/lib/s.js
+++ b/desktop/core/lib/s.js
@@ -5,6 +5,7 @@ const FnMove = require('./_move')
function FnS (pico, x, y) {
FnMove.call(this, pico, x, y)
+ this.type = 'direction'
this.name = 'south'
this.glyph = 's'
this.info = 'Moves southward, or bangs.'
diff --git a/desktop/core/lib/w.js b/desktop/core/lib/w.js
index 06df04e..17f23bc 100644
--- a/desktop/core/lib/w.js
+++ b/desktop/core/lib/w.js
@@ -5,6 +5,7 @@ const FnMove = require('./_move')
function FnW (pico, x, y) {
FnMove.call(this, pico, x, y)
+ this.type = 'direction'
this.name = 'west'
this.glyph = 'w'
this.info = 'Moves westward, or bangs.'
diff --git a/desktop/core/lib/y.js b/desktop/core/lib/y.js
index b55b2d8..f93c727 100644
--- a/desktop/core/lib/y.js
+++ b/desktop/core/lib/y.js
@@ -5,6 +5,7 @@ const FnBase = require('./_base')
function FnY (pico, x, y) {
FnBase.call(this, pico, x, y)
+ this.type = 'math'
this.name = 'type'
this.glyph = 'y'
this.info = 'Compares the type(num/alpha/special) of westward and eastward fns, and return 1 or 0 southward.'
diff --git a/desktop/core/pico.js b/desktop/core/pico.js
index 05b9832..a4717e5 100644
--- a/desktop/core/pico.js
+++ b/desktop/core/pico.js
@@ -142,7 +142,7 @@ function Pico (w, h) {
}
this.addBlock = function (x, y, block) {
- if (!block || block.length == 0) { this.terminal.log('Nothing to paste'); return }
+ if (!block || block.length === 0) { this.terminal.log('Nothing to paste'); return }
let _y = y
for (const lineId in block) {
diff --git a/desktop/main.js b/desktop/main.js
index 438785b..10f2b60 100644
--- a/desktop/main.js
+++ b/desktop/main.js
@@ -57,7 +57,7 @@ app.toggle_fullscreen = function () {
}
app.toggle_visible = function () {
- if (process.platform == 'win32') {
+ if (process.platform === 'win32') {
if (!app.win.isMinimized()) { app.win.minimize() } else { app.win.restore() }
} else {
if (is_shown && !app.win.isFullScreen()) { app.win.hide() } else { app.win.show() }
diff --git a/desktop/sources/scripts/cursor.js b/desktop/sources/scripts/cursor.js
index e69a481..8316c8c 100644
--- a/desktop/sources/scripts/cursor.js
+++ b/desktop/sources/scripts/cursor.js
@@ -58,7 +58,7 @@ function Cursor (terminal) {
}
this._position = function () {
- return `${this.x},${this.y}` + (this.w != 1 || this.h != 1 ? `[${this.w}x${this.h}]` : '')
+ return `${this.x},${this.y}` + (this.w !== 1 || this.h !== 1 ? `[${this.w}x${this.h}]` : '')
}
function clamp (v, min, max) { return v < min ? min : v > max ? max : v }
diff --git a/desktop/sources/scripts/keyboard.js b/desktop/sources/scripts/keyboard.js
index 917dd74..826493d 100644
--- a/desktop/sources/scripts/keyboard.js
+++ b/desktop/sources/scripts/keyboard.js
@@ -6,35 +6,35 @@ function Keyboard () {
this.listen_onkeydown = function (event) {
// Reset
- if ((event.metaKey || event.ctrlKey) && event.key == 'Backspace') {
+ if ((event.metaKey || event.ctrlKey) && event.key === 'Backspace') {
terminal.reset()
event.preventDefault()
return
}
// Pause
- if ((event.metaKey || event.ctrlKey) && event.key == 'p') {
+ if ((event.metaKey || event.ctrlKey) && event.key === 'p') {
terminal.pause()
event.preventDefault()
return
}
- if (event.key == 'c' && event.metaKey) { terminal.cursor.copy(); return }
- if (event.key == 'v' && event.metaKey) { terminal.cursor.paste(); return }
- if (event.key == 'x' && event.metaKey) { terminal.cursor.cut(); return }
+ if (event.key === 'c' && event.metaKey) { terminal.cursor.copy(); return }
+ if (event.key === 'v' && event.metaKey) { terminal.cursor.paste(); return }
+ if (event.key === 'x' && event.metaKey) { terminal.cursor.cut(); return }
- if (event.keyCode == 38) { keyboard.key_arrow_up(event.shiftKey); return }
- if (event.keyCode == 40) { keyboard.key_arrow_down(event.shiftKey); return }
- if (event.keyCode == 37) { keyboard.key_arrow_left(event.shiftKey); return }
- if (event.keyCode == 39) { keyboard.key_arrow_right(event.shiftKey); return }
+ if (event.keyCode === 38) { keyboard.key_arrow_up(event.shiftKey); return }
+ if (event.keyCode === 40) { keyboard.key_arrow_down(event.shiftKey); return }
+ if (event.keyCode === 37) { keyboard.key_arrow_left(event.shiftKey); return }
+ if (event.keyCode === 39) { keyboard.key_arrow_right(event.shiftKey); return }
if (event.metaKey) { return }
if (event.ctrlKey) { return }
- if (event.key == 'Backspace') { terminal.cursor.erase(); return }
- if (event.key == ' ') { terminal.pause(); event.preventDefault(); return }
- if (event.key == 'Escape') { terminal.clear(); terminal.isPaused = false; terminal.cursor.reset(); return }
+ if (event.key === 'Backspace') { terminal.cursor.erase(); return }
+ if (event.key === ' ') { terminal.pause(); event.preventDefault(); return }
+ if (event.key === 'Escape') { terminal.clear(); terminal.isPaused = false; terminal.cursor.reset(); return }
- if (event.key.length == 1) {
+ if (event.key.length === 1) {
terminal.cursor.insert(event.key)
if (event.shiftKey) {
terminal.cursor.move(1, 0)
diff --git a/desktop/sources/scripts/lib/controller.js b/desktop/sources/scripts/lib/controller.js
index ae60096..58a1ff0 100644
--- a/desktop/sources/scripts/lib/controller.js
+++ b/desktop/sources/scripts/lib/controller.js
@@ -55,7 +55,7 @@ function Controller () {
const txt = this.documentation(this.format())
dialog.showSaveDialog((fileName) => {
if (fileName === undefined) { return }
- fileName = fileName.substr(-4, 4) != '.svg' ? fileName + '.svg' : fileName
+ fileName = fileName.substr(-4, 4) !== '.svg' ? fileName + '.svg' : fileName
fs.writeFile(fileName, svg)
fs.writeFile(fileName.replace('.svg', '.md'), txt)
})
@@ -82,7 +82,7 @@ function Controller () {
txt += this.documentation_for_mode('default', this.menu.default)
for (name in this.menu) {
- if (name == 'default') { continue }
+ if (name === 'default') { continue }
txt += this.documentation_for_mode(name, this.menu[name])
}
return txt
@@ -92,7 +92,7 @@ function Controller () {
const txt = `## ${name} Mode\n\n`
for (const id in mode) {
- if (id == '*' || id == 'Edit') { continue }
+ if (id === '*' || id === 'Edit') { continue }
txt += `### ${id}\n`
for (name in mode[id]) {
const option = mode[id][name]
@@ -110,8 +110,8 @@ function Controller () {
const options = menu[cat]
for (const id in options.submenu) {
const option = options.submenu[id]; if (option.role) { continue }
- acc.basic = (option.accelerator.toLowerCase() == key.toLowerCase()) ? option.label.toUpperCase().replace('TOGGLE ', '').substr(0, 8).trim() : acc.basic
- acc.ctrl = (option.accelerator.toLowerCase() == ('CmdOrCtrl+' + key).toLowerCase()) ? option.label.toUpperCase().replace('TOGGLE ', '').substr(0, 8).trim() : acc.ctrl
+ acc.basic = (option.accelerator.toLowerCase() === key.toLowerCase()) ? option.label.toUpperCase().replace('TOGGLE ', '').substr(0, 8).trim() : acc.basic
+ acc.ctrl = (option.accelerator.toLowerCase() === ('CmdOrCtrl+' + key).toLowerCase()) ? option.label.toUpperCase().replace('TOGGLE ', '').substr(0, 8).trim() : acc.ctrl
}
}
return acc
diff --git a/desktop/sources/scripts/lib/theme.js b/desktop/sources/scripts/lib/theme.js
index 8766529..172c606 100644
--- a/desktop/sources/scripts/lib/theme.js
+++ b/desktop/sources/scripts/lib/theme.js
@@ -100,7 +100,7 @@ function Theme (default_theme = { background: '#222', f_high: '#fff', f_med: '#7
}
this.invert = function () {
- this.load(this.active.background == this.collection.noir.background ? this.collection.pale : this.collection.noir)
+ this.load(this.active.background === this.collection.noir.background ? this.collection.pale : this.collection.noir)
}
// Drag
diff --git a/desktop/sources/scripts/qqq.js b/desktop/sources/scripts/qqq.js
index 9bf071c..9e0253a 100644
--- a/desktop/sources/scripts/qqq.js
+++ b/desktop/sources/scripts/qqq.js
@@ -41,7 +41,7 @@ function QQQ (terminal) {
}
this.midiInactive = function (err) {
- console.warn('No Midi')
+ console.warn('No Midi',err)
}
this.send = function (channel, octave, note, velocity) {
diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js
index 0258deb..461aa69 100644
--- a/desktop/sources/scripts/terminal.js
+++ b/desktop/sources/scripts/terminal.js
@@ -187,15 +187,15 @@ function Terminal (pico) {
ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h)
ctx.fillStyle = this.theme.active.f_inv
} else if (styles.is_port) {
- if (styles.is_port == 2) {
+ if (styles.is_port === 2) {
ctx.fillStyle = this.theme.active.b_high
ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h)
ctx.fillStyle = this.theme.active.f_low
- } else if (styles.is_port == 1) {
+ } else if (styles.is_port === 1) {
ctx.fillStyle = this.theme.active.b_med
ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h)
ctx.fillStyle = this.theme.active.f_med
- } else if (styles.is_port == 3) {
+ } else if (styles.is_port === 3) {
ctx.fillStyle = this.theme.active.b_low
ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h)
ctx.fillStyle = this.theme.active.f_high
@@ -203,7 +203,7 @@ function Terminal (pico) {
} else {
ctx.fillStyle = 'white'
}
- ctx.fillText(styles.isCursor && g == '.' ? (!pico.isPaused ? '@' : '~') : g.toUpperCase(), (x + 0.5) * this.tile.w, (y + 1) * this.tile.h)
+ ctx.fillText(styles.isCursor && g === '.' ? (!pico.isPaused ? '@' : '~') : g.toUpperCase(), (x + 0.5) * this.tile.w, (y + 1) * this.tile.h)
}
this.reset = function () {
diff --git a/docs.js b/docs.js
index b44e241..434d9dd 100644
--- a/docs.js
+++ b/docs.js
@@ -1,9 +1,25 @@
const lib = require('./desktop/core/lib')
+const types = {}
+
+console.log("## Functions")
for(const type in lib){
+ if(type === "num"){ continue; }
console.log(`\n### ${type} functions\n`)
for(const id in lib[type]){
const fn = new lib[type][id]()
- console.log(`- \`${id.toUpperCase()}\`, **${fn.name}**: ${fn.info}`)
+ if(fn.type === 'misc'){ continue; }
+ if(type !== 'queries'){
+ if(!types[fn.type]){types[fn.type] = []}
+ types[fn.type].push(fn)
+ }
+ console.log(`- \`${id.toUpperCase()}\`, **${fn.name}**${fn.type !== 'misc' ? `(${fn.type})` : ''}: ${fn.info}`)
}
}
+
+console.log("\n### Functions(By Type)\n")
+for(const id in types){
+ if(id === 'misc'){ continue; }
+ console.log(`- **${id}s**: ${types[id].reduce((acc,val) => { return `${acc}\`${val.glyph}\` `},"").trim()}.`)
+}
+console.log("\n") \ No newline at end of file