From 486e6c8bee5b730d00dae800ba1b93e86563a39f Mon Sep 17 00:00:00 2001 From: tiye Date: Thu, 27 Jun 2024 02:14:19 +0800 Subject: [PATCH 1/2] force dylibs rebload when --pull-branch --- src/bin/calcit_deps.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/bin/calcit_deps.rs b/src/bin/calcit_deps.rs index 02bd8a6..b630cf2 100644 --- a/src/bin/calcit_deps.rs +++ b/src/bin/calcit_deps.rs @@ -139,6 +139,7 @@ fn handle_path(modules_dir: PathBuf, version: Arc, options: CliArgs, org_an // split with / into (org,folder) let folder_path = modules_dir.join(folder); + let build_file = folder_path.join("build.sh"); if folder_path.exists() { // println!("module {} exists", folder); // check branch @@ -150,6 +151,13 @@ fn handle_path(modules_dir: PathBuf, version: Arc, options: CliArgs, org_an dim_println(format!("↺ pulling {} at version {}", gray(&org_and_folder), gray(&version))); git_pull(&folder_path, &branch)?; dim_println(format!("pulled {} at {}", gray(folder), gray(&version))); + + // if there's a build.sh file in the folder, run it + if build_file.exists() { + let build_msg = call_build_script(&folder_path)?; + dim_println(format!("ran build script for {}", gray(&org_and_folder))); + dim_println(build_msg); + } } } return Ok(()); @@ -177,7 +185,6 @@ fn handle_path(modules_dir: PathBuf, version: Arc, options: CliArgs, org_an } } - let build_file = folder_path.join("build.sh"); // if there's a build.sh file in the folder, run it if build_file.exists() { let build_msg = call_build_script(&folder_path)?; @@ -196,7 +203,6 @@ fn handle_path(modules_dir: PathBuf, version: Arc, options: CliArgs, org_an dim_println(format!("downloaded {} at version {}", gray(&org_and_folder), gray(&version))); if !options.ci { - let build_file = folder_path.join("build.sh"); // if there's a build.sh file in the folder, run it if build_file.exists() { let build_msg = call_build_script(&folder_path)?; @@ -265,8 +271,13 @@ fn gray(msg: &str) -> ColoredString { } fn indent4(msg: &str) -> String { - let ret = msg.lines().map(|line| format!(" {}", line)).collect::>().join("\n"); - format!("\n{}\n", ret.trim()) + let ret = msg + .trim() + .lines() + .map(|line| format!(" {}", line)) + .collect::>() + .join("\n"); + format!("\n{}\n", ret) } /// calcit dynamic libs uses a `build.sh` script to build Rust `.so` files From a4f4d56ac3a4a99a60e22c37d8ed30b9ccc58bfe Mon Sep 17 00:00:00 2001 From: tiye Date: Thu, 27 Jun 2024 02:58:27 +0800 Subject: [PATCH 2/2] handle ckj displaying; tag 0.8.59 --- Cargo.lock | 31 ++++++++++++++++++++++++++++--- Cargo.toml | 4 ++-- calcit/test-string.cirru | 2 ++ package.json | 2 +- src/calcit.rs | 13 +++++++++++-- ts-src/js-tuple.mts | 2 +- 6 files changed, 45 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8dba189..baf6bbc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -94,7 +94,7 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "calcit" -version = "0.8.58" +version = "0.8.59" dependencies = [ "cirru_edn", "cirru_parser", @@ -128,12 +128,13 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "cirru_edn" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d12eb005cacee402564d56df5f2e2ee66b1c9440f3de3a972fd4aa0ff5a283" +checksum = "452dd17601be10c1007c43db6e39cc53b28d2be3cd4a82b01d3f5ac70b8afc05" dependencies = [ "bincode", "cirru_parser", + "cjk", "hex", "lazy_static", ] @@ -147,6 +148,18 @@ dependencies = [ "bincode", ] +[[package]] +name = "cjk" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c5581b1ff873217332789ccc8956c1c68bcf9d693e7e5c6bcc677897fda5257" +dependencies = [ + "hex", + "lazy_static", + "unicode-blocks", + "widestring", +] + [[package]] name = "clap" version = "4.5.7" @@ -583,6 +596,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee8098afad3fb0c54a9007aab6804558410503ad676d4633f9c2559a00ac0f" +[[package]] +name = "unicode-blocks" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b12e05d9e06373163a9bb6bb8c263c261b396643a99445fe6b9811fd376581b" + [[package]] name = "unicode-ident" version = "1.0.12" @@ -617,6 +636,12 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "widestring" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index a0fe297..fec6915 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "calcit" -version = "0.8.58" +version = "0.8.59" authors = ["jiyinyiyong "] edition = "2021" license = "MIT" @@ -20,7 +20,7 @@ exclude = [ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cirru_edn = "0.6.10" +cirru_edn = "0.6.11" # cirru_edn = { path = "/Users/chenyong/repo/cirru/edn.rs" } cirru_parser = "0.1.31" # cirru_parser = { path = "/Users/chenyong/repo/cirru/parser.rs" } diff --git a/calcit/test-string.cirru b/calcit/test-string.cirru index 4929a87..507e870 100644 --- a/calcit/test-string.cirru +++ b/calcit/test-string.cirru @@ -166,6 +166,8 @@ assert= (str-spaced nil nil |c 12) "|c 12" assert= (str-spaced |a nil |c 12 nil) "|a c 12" assert= (str 1 2 3) |123 + assert= "|(:: :a |世界 \"|海 洋\")" + str $ :: :a |世界 "|海 洋" assert= type-of $ &str 1 , :string diff --git a/package.json b/package.json index 9a4c77b..c23445f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@calcit/procs", - "version": "0.8.58", + "version": "0.8.59", "main": "./lib/calcit.procs.mjs", "devDependencies": { "@types/node": "^20.11.28", diff --git a/src/calcit.rs b/src/calcit.rs index 854a52d..236fdd0 100644 --- a/src/calcit.rs +++ b/src/calcit.rs @@ -121,7 +121,16 @@ impl fmt::Display for Calcit { if is_simple_str(s) { write!(f, "|{s}") } else { - write!(f, "\"|{}\"", s.escape_default()) + // write!(f, "\"|{}\"", s.escape_default()) + write!(f, "\"|")?; + for c in s.chars() { + if cirru_edn::is_simple_char(c) { + write!(f, "{}", c)?; + } else { + write!(f, "{}", c.escape_default())?; + } + } + write!(f, "\"") } } // TODO, escaping choices Calcit::Thunk(thunk) => match thunk { @@ -281,7 +290,7 @@ impl fmt::Display for Calcit { fn is_simple_str(tok: &str) -> bool { for c in tok.chars() { - if !matches!(c, 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '?' | '!' | '|') { + if !cirru_edn::is_simple_char(c) { return false; } } diff --git a/ts-src/js-tuple.mts b/ts-src/js-tuple.mts index 7e7e729..fd1629a 100644 --- a/ts-src/js-tuple.mts +++ b/ts-src/js-tuple.mts @@ -59,7 +59,7 @@ export class CalcitTuple { if (i > 0) { content += " "; } - content += toString(args[i], false, disableJsDataWarning); + content += toString(args[i], true, disableJsDataWarning); } if (this.klass instanceof CalcitRecord) { return `(%:: ${content} (:class ${this.klass.name.value}))`;