From 87507a3e17e7afc8ea01b9e0bb25f9a8dbe6b0f0 Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Tue, 5 Sep 2023 16:23:46 -0400 Subject: Test struct array. Fix trie ? --- lib/trie.tcl | 2 +- test/cstructs.tcl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/trie.tcl b/lib/trie.tcl index 467631b7..e5c2c0be 100644 --- a/lib/trie.tcl +++ b/lib/trie.tcl @@ -77,7 +77,7 @@ namespace eval ctrie { return Tcl_NewStringObj(varName, -1); } $cc proc startsWithDollarSign {Tcl_Obj* wordobj} bool { - return Tcl_GetString(wordobj)[0] == '$'; + return Tcl_GetString(wordobj)[0] == '\$'; } $cc proc addImpl {trie_t** trie int wordc Tcl_Obj** wordv uint64_t value} void { diff --git a/test/cstructs.tcl b/test/cstructs.tcl index 623cd53f..9b2faad6 100644 --- a/test/cstructs.tcl +++ b/test/cstructs.tcl @@ -14,11 +14,16 @@ $cc proc omar {} Person { }; return ret; } +$cc proc plural {int npersons Person[] persons} void {} $cc compile puts [omar] assert {[dict get [omar] name last] eq "Rizwan"} +plural 2 [list \ + [dict create name [dict create first Omar last Rizwan] state NJ] \ + [dict create name [dict create first Californian last Resident] state CA]] + set cc [c create] $cc proc plusone {int a} int { return a + 1; -- cgit v1.2.3