diff --git a/index.html b/index.html index fea9225..f9a6c46 100644 --- a/index.html +++ b/index.html @@ -472,8 +472,8 @@

Ternary scale properties

- Enter a specific ternary scale word using L, M, and s (use capital - M for medium): + Enter a specific ternary scale word using L, m, and s (use + lowercase m for medium):

@@ -492,7 +492,7 @@

Ternary scale properties

Enter the numbers of step sizes as steps get smaller, as positive numbers separated by spaces. For example, "3 2 2" means - 3L2M2s. + 3L2m2s.

@@ -541,7 +541,7 @@

Ternary scale properties

name="monotone-lm" value="on" /> - +
Ternary scale properties name="monotone-ms" value="on" /> - +
{ case "L": ++sig[0]; break; - case "M": + case "m": ++sig[1]; break; case "s": @@ -348,12 +348,12 @@ import("./pkg").then((wasm) => { let currentX = ORIGIN_X; let currentY = ORIGIN_Y; for (let deg = 0; deg < n; ++deg) { - svgTag.innerHTML += ` { currentX += L_x * SPACING_X; currentY += L_y * SPACING_Y; // SPACING_Y is negative since we represented y as positive. break; - case "M": + case "m": currentX += M_x * SPACING_X; currentY += M_y * SPACING_Y; break; @@ -447,7 +447,7 @@ import("./pkg").then((wasm) => { codeblock.innerHTML = arity === 3 ? `let L = ${currentTuning[0]} -let M = ${currentTuning[1]} +let m = ${currentTuning[1]} let s = ${currentTuning[2]} ${arr.join(";")}; stack()` @@ -488,8 +488,8 @@ stack()` el.innerHTML += `Multiplicity ${JSON.stringify(structure["multiplicity"])}
`; // TODO prettify el.innerHTML += `Complexity ${JSON.stringify(structure["complexity"])}

`; // TODO prettify el.innerHTML += `Monotone MOS properties
`; - el.innerHTML += currentProfile["lm"] ? `L = M
` : ""; - el.innerHTML += currentProfile["ms"] ? `M = s
` : ""; + el.innerHTML += currentProfile["lm"] ? `L = m
` : ""; + el.innerHTML += currentProfile["ms"] ? `m = s
` : ""; el.innerHTML += currentProfile["s0"] ? `s = 0
` : ""; if ( !currentProfile["lm"] && @@ -578,7 +578,7 @@ stack()` document.getElementById("tables").innerHTML = `

Tables

- +
diff --git a/package-lock.json b/package-lock.json index 33793ed..1ff908b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,7 +4,6 @@ "requires": true, "packages": { "": { - "name": "ternary", "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.7.0", "html-webpack-plugin": "^5.6.0", diff --git a/src/lib.rs b/src/lib.rs index 024be69..868eb26 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,20 +20,30 @@ use words::{Chirality, Letter}; #[wasm_bindgen] extern "C" { fn alert(s: &str); + // Use `js_namespace` here to bind `console.log(..)` instead of just + // `log(..)` + #[wasm_bindgen(js_namespace = console)] + fn log(s: &str); +} + +macro_rules! console_log { + // Note that this is using the `log` function imported above during + // `bare_bones` + ($($t:tt)*) => (log(&format_args!($($t)*).to_string())) } const STEP_LETTERS: [&str; 12] = [ "", // 0 "X", // 1 "Ls", // 2 - "LMs", // 3 - "LMns", // 4 - "HLMns", // 5 - "HLMnst", // 6 - "BHLMnst", // 7 - "BHLMnstw", // 8 - "BCHLMnstw", // 9 - "BCHLMnpstw", // 10 + "Lms", // 3 + "Lmns", // 4 + "HLmns", // 5 + "HLmnst", // 6 + "BHLmnst", // 7 + "BHLmnstw", // 8 + "BCHLmnstw", // 9 + "BCHLmnpstw", // 10 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", // >= 11 ]; @@ -53,14 +63,6 @@ pub const EDO_BOUND: i32 = 53; pub const S_LOWER_BOUND: f64 = 20.0; pub const S_UPPER_BOUND: f64 = 200.0; -#[wasm_bindgen] -extern "C" { - // Use `js_namespace` here to bind `console.log(..)` instead of just - // `log(..)` - #[wasm_bindgen(js_namespace = console)] - fn log(s: &str); -} - fn det3(v0: &[u8], v1: &[u8], v2: &[u8]) -> i16 { v0[0] as i16 * v1[1] as i16 * v2[2] as i16 + v0[1] as i16 * v1[2] as i16 * v2[0] as i16 @@ -321,6 +323,7 @@ pub fn word_to_profile(query: &[usize]) -> ScaleProfile { &string_to_numbers(&brightest), &step_sig, ) { + console_log!("{:?}: {:?}", query, guide_frames(query)); let (lattice_basis, structure) = pair; ScaleProfile { word: brightest,