From e0631c30ebaa884b773c08d20c1cfe000edbb3b0 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 17 Sep 2025 00:37:10 +0800 Subject: [PATCH] Remove the map_ prefix --- ds/map/btree/README | 1 + ds/map/map_btree/README | 1 - ds/map/map_btree/del.ha => ds/map/btree/del.ha | 0 ds/map/map_btree/finish.ha => ds/map/btree/finish.ha | 0 ds/map/map_btree/get.ha => ds/map/btree/get.ha | 0 ds/map/map_btree/internal.ha => ds/map/btree/internal.ha | 0 ds/map/map_btree/map.ha => ds/map/btree/map.ha | 0 ds/map/map_btree/new.ha => ds/map/btree/new.ha | 0 ds/map/map_btree/node.ha => ds/map/btree/node.ha | 0 ds/map/map_btree/set.ha => ds/map/btree/set.ha | 0 ds/map/map_fnv/README => ds/map/fnv/README | 2 +- ds/map/map_fnv/del.ha => ds/map/fnv/del.ha | 0 ds/map/map_fnv/finish.ha => ds/map/fnv/finish.ha | 0 ds/map/map_fnv/get.ha => ds/map/fnv/get.ha | 0 ds/map/map_fnv/internal.ha => ds/map/fnv/internal.ha | 0 ds/map/map_fnv/map.ha => ds/map/fnv/map.ha | 0 ds/map/map_fnv/new.ha => ds/map/fnv/new.ha | 6 +++--- ds/map/map_fnv/set.ha => ds/map/fnv/set.ha | 0 ds/map/map_hashmap/README => ds/map/hashmap/README | 2 +- ds/map/map_hashmap/del.ha => ds/map/hashmap/del.ha | 0 ds/map/map_hashmap/finish.ha => ds/map/hashmap/finish.ha | 0 ds/map/map_hashmap/get.ha => ds/map/hashmap/get.ha | 0 ds/map/map_hashmap/map.ha => ds/map/hashmap/map.ha | 0 ds/map/map_hashmap/new.ha => ds/map/hashmap/new.ha | 0 ds/map/map_hashmap/set.ha => ds/map/hashmap/set.ha | 0 ds/map/map_rbtree/README | 1 - ds/map/map_rbtree/del.ha => ds/map/rbtree/del.ha | 0 ds/map/map_rbtree/finish.ha => ds/map/rbtree/finish.ha | 0 ds/map/map_rbtree/get.ha => ds/map/rbtree/get.ha | 0 ds/map/map_rbtree/internal.ha => ds/map/rbtree/internal.ha | 0 ds/map/map_rbtree/map.ha => ds/map/rbtree/map.ha | 0 ds/map/map_rbtree/new.ha => ds/map/rbtree/new.ha | 0 ds/map/map_rbtree/node.ha => ds/map/rbtree/node.ha | 0 ds/map/map_rbtree/set.ha => ds/map/rbtree/set.ha | 0 ds/map/map_siphash/README => ds/map/siphash/README | 2 +- ds/map/map_siphash/del.ha => ds/map/siphash/del.ha | 0 ds/map/map_siphash/finish.ha => ds/map/siphash/finish.ha | 0 ds/map/map_siphash/get.ha => ds/map/siphash/get.ha | 0 ds/map/map_siphash/internal.ha => ds/map/siphash/internal.ha | 2 +- ds/map/map_siphash/map.ha => ds/map/siphash/map.ha | 0 ds/map/map_siphash/new.ha => ds/map/siphash/new.ha | 6 +++--- ds/map/map_siphash/set.ha => ds/map/siphash/set.ha | 0 ds/map/map_slice_basic/README | 1 - ds/map/map_slice_basic/del.ha => ds/map/slice_basic/del.ha | 0 ds/map/map_slice_basic/finish.ha => ds/map/slice_basic/finish.ha | 0 ds/map/map_slice_basic/get.ha => ds/map/slice_basic/get.ha | 0 ds/map/map_slice_basic/map.ha => ds/map/slice_basic/map.ha | 0 ds/map/map_slice_basic/new.ha => ds/map/slice_basic/new.ha | 0 ds/map/map_slice_basic/set.ha => ds/map/slice_basic/set.ha | 0 ds/map/map_slice_sorted/README | 1 - ds/map/map_slice_sorted/del.ha => ds/map/slice_sorted/del.ha | 0 ds/map/map_slice_sorted/finish.ha => ds/map/slice_sorted/finish.ha | 0 ds/map/map_slice_sorted/get.ha => ds/map/slice_sorted/get.ha | 0 ds/map/map_slice_sorted/internal.ha => ds/map/slice_sorted/internal.ha | 0 ds/map/map_slice_sorted/map.ha => ds/map/slice_sorted/map.ha | 0 ds/map/map_slice_sorted/new.ha => ds/map/slice_sorted/new.ha | 0 ds/map/map_slice_sorted/set.ha => ds/map/slice_sorted/set.ha | 0 ds/map/map_swiss_siphash/README | 1 - ds/map/map_swiss_siphash/del.ha => ds/map/swiss_siphash/del.ha | 0 ds/map/map_swiss_siphash/finish.ha => ds/map/swiss_siphash/finish.ha | 0 ds/map/map_swiss_siphash/get.ha => ds/map/swiss_siphash/get.ha | 0 ds/map/map_swiss_siphash/internal.ha => ds/map/swiss_siphash/internal.ha | 0 ds/map/map_swiss_siphash/map.ha => ds/map/swiss_siphash/map.ha | 0 ds/map/map_swiss_siphash/new.ha => ds/map/swiss_siphash/new.ha | 0 ds/map/map_swiss_siphash/set.ha => ds/map/swiss_siphash/set.ha | 0 ds/map/rbtree/README | 1 + ds/map/slice_basic/README | 1 + ds/map/slice_sorted/README | 1 + ds/map/swiss_siphash/README | 1 + diff --git a/ds/map/btree/README b/ds/map/btree/README new file mode 100644 index 0000000000000000000000000000000000000000..ec0faba5eb7f279093c9e258b1791eaab9260346 --- /dev/null +++ b/ds/map/btree/README @@ -0,0 +1 @@ +btree: b-tree map diff --git a/ds/map/map_btree/README b/ds/map/map_btree/README deleted file mode 100644 index fd40e753e4485fef0f4f236732133f601224a9f6..0000000000000000000000000000000000000000 --- a/ds/map/map_btree/README +++ /dev/null @@ -1 +0,0 @@ -map_btree: key-value map implemented with a b-tree diff --git a/ds/map/map_btree/del.ha b/ds/map/btree/del.ha rename from ds/map/map_btree/del.ha rename to ds/map/btree/del.ha diff --git a/ds/map/map_btree/finish.ha b/ds/map/btree/finish.ha rename from ds/map/map_btree/finish.ha rename to ds/map/btree/finish.ha diff --git a/ds/map/map_btree/get.ha b/ds/map/btree/get.ha rename from ds/map/map_btree/get.ha rename to ds/map/btree/get.ha diff --git a/ds/map/map_btree/internal.ha b/ds/map/btree/internal.ha rename from ds/map/map_btree/internal.ha rename to ds/map/btree/internal.ha diff --git a/ds/map/map_btree/map.ha b/ds/map/btree/map.ha rename from ds/map/map_btree/map.ha rename to ds/map/btree/map.ha diff --git a/ds/map/map_btree/new.ha b/ds/map/btree/new.ha rename from ds/map/map_btree/new.ha rename to ds/map/btree/new.ha diff --git a/ds/map/map_btree/node.ha b/ds/map/btree/node.ha rename from ds/map/map_btree/node.ha rename to ds/map/btree/node.ha diff --git a/ds/map/map_btree/set.ha b/ds/map/btree/set.ha rename from ds/map/map_btree/set.ha rename to ds/map/btree/set.ha diff --git a/ds/map/map_fnv/README b/ds/map/fnv/README rename from ds/map/map_fnv/README rename to ds/map/fnv/README index 4105f9f80eb29babe876f7c26a0320ea46a4eac0..04dc230ac7abea9fb72fc85af3e5bd892a7642c4 100644 --- a/ds/map/map_fnv/README +++ b/ds/map/fnv/README @@ -1,4 +1,4 @@ -map_fnv: key-value map implemented as a Fowler-Noll-Vo hashmap +fnv: Fowler-Noll-Vo hashmap This module provides a simple implementation of a hashmap using the Fowler-Noll-Vo (FNV) hashing algorithm. diff --git a/ds/map/map_fnv/del.ha b/ds/map/fnv/del.ha rename from ds/map/map_fnv/del.ha rename to ds/map/fnv/del.ha diff --git a/ds/map/map_fnv/finish.ha b/ds/map/fnv/finish.ha rename from ds/map/map_fnv/finish.ha rename to ds/map/fnv/finish.ha diff --git a/ds/map/map_fnv/get.ha b/ds/map/fnv/get.ha rename from ds/map/map_fnv/get.ha rename to ds/map/fnv/get.ha diff --git a/ds/map/map_fnv/internal.ha b/ds/map/fnv/internal.ha rename from ds/map/map_fnv/internal.ha rename to ds/map/fnv/internal.ha diff --git a/ds/map/map_fnv/map.ha b/ds/map/fnv/map.ha rename from ds/map/map_fnv/map.ha rename to ds/map/fnv/map.ha diff --git a/ds/map/map_fnv/new.ha b/ds/map/fnv/new.ha rename from ds/map/map_fnv/new.ha rename to ds/map/fnv/new.ha index 44b3882e20ed60858438905d3e80454902a327b2..356bf4a585244da0cdb2f252888c98e5814012a0 100644 --- a/ds/map/map_fnv/new.ha +++ b/ds/map/fnv/new.ha @@ -4,7 +4,7 @@ // SPDX-FileCopyrightText: 2025 Runxi Yu use errors; use ds::map; -use ds::map::map_hashmap; +use ds::map::hashmap; // Creates a new [[map]] with the given number of buckets. // make_fallback is a function that creates per-bucket fallback maps. @@ -12,8 +12,8 @@ export fn new( make_fallback: *fn() (*map::map | nomem), n: size, ) (*map | errors::invalid | nomem) = { - let inner = match (map_hashmap::new(make_fallback, n, &hash64, null)) { - case let hm: *map_hashmap::map => + let inner = match (hashmap::new(make_fallback, n, &hash64, null)) { + case let hm: *hashmap::map => yield (hm: *map::map); case errors::invalid => return errors::invalid; diff --git a/ds/map/map_fnv/set.ha b/ds/map/fnv/set.ha rename from ds/map/map_fnv/set.ha rename to ds/map/fnv/set.ha diff --git a/ds/map/map_hashmap/README b/ds/map/hashmap/README rename from ds/map/map_hashmap/README rename to ds/map/hashmap/README index eeca73d2cf4fd1688ff2e8e78e2ad31d75f6ffbc..896f241f2d3d41c6e9faac212603883e8c84ef90 100644 --- a/ds/map/map_hashmap/README +++ b/ds/map/hashmap/README @@ -1,4 +1,4 @@ -map_hashmap: key-value map implemented as a generic hashmap +hashmap: generic hashmap This module provides a simple implementation of a hashmap from []u8 to *opaque. The hash algorithm and fallback collision resolution strategy are both diff --git a/ds/map/map_hashmap/del.ha b/ds/map/hashmap/del.ha rename from ds/map/map_hashmap/del.ha rename to ds/map/hashmap/del.ha diff --git a/ds/map/map_hashmap/finish.ha b/ds/map/hashmap/finish.ha rename from ds/map/map_hashmap/finish.ha rename to ds/map/hashmap/finish.ha diff --git a/ds/map/map_hashmap/get.ha b/ds/map/hashmap/get.ha rename from ds/map/map_hashmap/get.ha rename to ds/map/hashmap/get.ha diff --git a/ds/map/map_hashmap/map.ha b/ds/map/hashmap/map.ha rename from ds/map/map_hashmap/map.ha rename to ds/map/hashmap/map.ha diff --git a/ds/map/map_hashmap/new.ha b/ds/map/hashmap/new.ha rename from ds/map/map_hashmap/new.ha rename to ds/map/hashmap/new.ha diff --git a/ds/map/map_hashmap/set.ha b/ds/map/hashmap/set.ha rename from ds/map/map_hashmap/set.ha rename to ds/map/hashmap/set.ha diff --git a/ds/map/map_rbtree/README b/ds/map/map_rbtree/README deleted file mode 100644 index 19d1dfb238868193cc4d43330f60d63f690ac745..0000000000000000000000000000000000000000 --- a/ds/map/map_rbtree/README +++ /dev/null @@ -1 +0,0 @@ -map_rbtree: key-value map implemented as a red–black tree diff --git a/ds/map/map_rbtree/del.ha b/ds/map/rbtree/del.ha rename from ds/map/map_rbtree/del.ha rename to ds/map/rbtree/del.ha diff --git a/ds/map/map_rbtree/finish.ha b/ds/map/rbtree/finish.ha rename from ds/map/map_rbtree/finish.ha rename to ds/map/rbtree/finish.ha diff --git a/ds/map/map_rbtree/get.ha b/ds/map/rbtree/get.ha rename from ds/map/map_rbtree/get.ha rename to ds/map/rbtree/get.ha diff --git a/ds/map/map_rbtree/internal.ha b/ds/map/rbtree/internal.ha rename from ds/map/map_rbtree/internal.ha rename to ds/map/rbtree/internal.ha diff --git a/ds/map/map_rbtree/map.ha b/ds/map/rbtree/map.ha rename from ds/map/map_rbtree/map.ha rename to ds/map/rbtree/map.ha diff --git a/ds/map/map_rbtree/new.ha b/ds/map/rbtree/new.ha rename from ds/map/map_rbtree/new.ha rename to ds/map/rbtree/new.ha diff --git a/ds/map/map_rbtree/node.ha b/ds/map/rbtree/node.ha rename from ds/map/map_rbtree/node.ha rename to ds/map/rbtree/node.ha diff --git a/ds/map/map_rbtree/set.ha b/ds/map/rbtree/set.ha rename from ds/map/map_rbtree/set.ha rename to ds/map/rbtree/set.ha diff --git a/ds/map/map_siphash/README b/ds/map/siphash/README rename from ds/map/map_siphash/README rename to ds/map/siphash/README index f9f6fb5f561de5defd1c90b006483d3ebd5a72b2..be422e23e3d867d3ce37b00ae6ab8167f8a8e7c6 100644 --- a/ds/map/map_siphash/README +++ b/ds/map/siphash/README @@ -1,4 +1,4 @@ -map_siphash: key-value map implemented as a SipHash hashmap +siphash: SipHash hashmap This module provides a simple implementation of a hashmap using the SipHash hashing algorithm for collision-resistant mapping. It is designed for diff --git a/ds/map/map_siphash/del.ha b/ds/map/siphash/del.ha rename from ds/map/map_siphash/del.ha rename to ds/map/siphash/del.ha diff --git a/ds/map/map_siphash/finish.ha b/ds/map/siphash/finish.ha rename from ds/map/map_siphash/finish.ha rename to ds/map/siphash/finish.ha diff --git a/ds/map/map_siphash/get.ha b/ds/map/siphash/get.ha rename from ds/map/map_siphash/get.ha rename to ds/map/siphash/get.ha diff --git a/ds/map/map_siphash/internal.ha b/ds/map/siphash/internal.ha rename from ds/map/map_siphash/internal.ha rename to ds/map/siphash/internal.ha index 95f8078320cd68e89bfa68cd394f42c33859cbbf..de89b190565d9cfa1f6fa8a5459f36ee3a334ca0 100644 --- a/ds/map/map_siphash/internal.ha +++ b/ds/map/siphash/internal.ha @@ -8,7 +8,7 @@ fn hash64(params: nullable *opaque, key: []u8) size = { let keyptr = match (params) { case null => - abort("map_siphash: missing key"); + abort("ds::map::siphash: missing key"); case let p: *opaque => yield (p: *[16]u8); }; diff --git a/ds/map/map_siphash/map.ha b/ds/map/siphash/map.ha rename from ds/map/map_siphash/map.ha rename to ds/map/siphash/map.ha diff --git a/ds/map/map_siphash/new.ha b/ds/map/siphash/new.ha rename from ds/map/map_siphash/new.ha rename to ds/map/siphash/new.ha index 3624b100fe925fa5a9c02bb3b81ff3a49c4336aa..d6392c7d9304076d201f0d87cb22142c51524e7b 100644 --- a/ds/map/map_siphash/new.ha +++ b/ds/map/siphash/new.ha @@ -4,7 +4,7 @@ // SPDX-FileCopyrightText: 2025 Runxi Yu use errors; use ds::map; -use ds::map::map_hashmap; +use ds::map::hashmap; // Creates a new [[map]] with a function that creates fallback maps, the number // of buckets, and the SipHash key. @@ -18,10 +18,10 @@ case let kp: *[16]u8 => yield kp; case nomem => return nomem; }; - let inner = match (map_hashmap::new( + let inner = match (hashmap::new( make_fallback, n, &hash64, (keybox: *opaque), )) { - case let hm: *map_hashmap::map => + case let hm: *hashmap::map => yield (hm: *map::map); case errors::invalid => free(keybox); diff --git a/ds/map/map_siphash/set.ha b/ds/map/siphash/set.ha rename from ds/map/map_siphash/set.ha rename to ds/map/siphash/set.ha diff --git a/ds/map/map_slice_basic/README b/ds/map/map_slice_basic/README deleted file mode 100644 index 41de4fe314bcc0de808dbf18a9169136a22fcf3d..0000000000000000000000000000000000000000 --- a/ds/map/map_slice_basic/README +++ /dev/null @@ -1 +0,0 @@ -map_slice_basic: trivial key-value map backed by a single slice diff --git a/ds/map/map_slice_basic/del.ha b/ds/map/slice_basic/del.ha rename from ds/map/map_slice_basic/del.ha rename to ds/map/slice_basic/del.ha diff --git a/ds/map/map_slice_basic/finish.ha b/ds/map/slice_basic/finish.ha rename from ds/map/map_slice_basic/finish.ha rename to ds/map/slice_basic/finish.ha diff --git a/ds/map/map_slice_basic/get.ha b/ds/map/slice_basic/get.ha rename from ds/map/map_slice_basic/get.ha rename to ds/map/slice_basic/get.ha diff --git a/ds/map/map_slice_basic/map.ha b/ds/map/slice_basic/map.ha rename from ds/map/map_slice_basic/map.ha rename to ds/map/slice_basic/map.ha diff --git a/ds/map/map_slice_basic/new.ha b/ds/map/slice_basic/new.ha rename from ds/map/map_slice_basic/new.ha rename to ds/map/slice_basic/new.ha diff --git a/ds/map/map_slice_basic/set.ha b/ds/map/slice_basic/set.ha rename from ds/map/map_slice_basic/set.ha rename to ds/map/slice_basic/set.ha diff --git a/ds/map/map_slice_sorted/README b/ds/map/map_slice_sorted/README deleted file mode 100644 index 72e729adaab89eeaeafd79ad73b2013434d1b707..0000000000000000000000000000000000000000 --- a/ds/map/map_slice_sorted/README +++ /dev/null @@ -1 +0,0 @@ -map_slice_sorted: sorted slice key-value store with binary search diff --git a/ds/map/map_slice_sorted/del.ha b/ds/map/slice_sorted/del.ha rename from ds/map/map_slice_sorted/del.ha rename to ds/map/slice_sorted/del.ha diff --git a/ds/map/map_slice_sorted/finish.ha b/ds/map/slice_sorted/finish.ha rename from ds/map/map_slice_sorted/finish.ha rename to ds/map/slice_sorted/finish.ha diff --git a/ds/map/map_slice_sorted/get.ha b/ds/map/slice_sorted/get.ha rename from ds/map/map_slice_sorted/get.ha rename to ds/map/slice_sorted/get.ha diff --git a/ds/map/map_slice_sorted/internal.ha b/ds/map/slice_sorted/internal.ha rename from ds/map/map_slice_sorted/internal.ha rename to ds/map/slice_sorted/internal.ha diff --git a/ds/map/map_slice_sorted/map.ha b/ds/map/slice_sorted/map.ha rename from ds/map/map_slice_sorted/map.ha rename to ds/map/slice_sorted/map.ha diff --git a/ds/map/map_slice_sorted/new.ha b/ds/map/slice_sorted/new.ha rename from ds/map/map_slice_sorted/new.ha rename to ds/map/slice_sorted/new.ha diff --git a/ds/map/map_slice_sorted/set.ha b/ds/map/slice_sorted/set.ha rename from ds/map/map_slice_sorted/set.ha rename to ds/map/slice_sorted/set.ha diff --git a/ds/map/map_swiss_siphash/README b/ds/map/map_swiss_siphash/README deleted file mode 100644 index 2078461fc8c5affae685c5f13929c150b8e33e55..0000000000000000000000000000000000000000 --- a/ds/map/map_swiss_siphash/README +++ /dev/null @@ -1 +0,0 @@ -map_swiss_siphash: key-value map implemented with Swiss tables and SipHash diff --git a/ds/map/map_swiss_siphash/del.ha b/ds/map/swiss_siphash/del.ha rename from ds/map/map_swiss_siphash/del.ha rename to ds/map/swiss_siphash/del.ha diff --git a/ds/map/map_swiss_siphash/finish.ha b/ds/map/swiss_siphash/finish.ha rename from ds/map/map_swiss_siphash/finish.ha rename to ds/map/swiss_siphash/finish.ha diff --git a/ds/map/map_swiss_siphash/get.ha b/ds/map/swiss_siphash/get.ha rename from ds/map/map_swiss_siphash/get.ha rename to ds/map/swiss_siphash/get.ha diff --git a/ds/map/map_swiss_siphash/internal.ha b/ds/map/swiss_siphash/internal.ha rename from ds/map/map_swiss_siphash/internal.ha rename to ds/map/swiss_siphash/internal.ha diff --git a/ds/map/map_swiss_siphash/map.ha b/ds/map/swiss_siphash/map.ha rename from ds/map/map_swiss_siphash/map.ha rename to ds/map/swiss_siphash/map.ha diff --git a/ds/map/map_swiss_siphash/new.ha b/ds/map/swiss_siphash/new.ha rename from ds/map/map_swiss_siphash/new.ha rename to ds/map/swiss_siphash/new.ha diff --git a/ds/map/map_swiss_siphash/set.ha b/ds/map/swiss_siphash/set.ha rename from ds/map/map_swiss_siphash/set.ha rename to ds/map/swiss_siphash/set.ha diff --git a/ds/map/rbtree/README b/ds/map/rbtree/README new file mode 100644 index 0000000000000000000000000000000000000000..a1534c4dd802b2204be0a47a6c7148f83d28e0a0 --- /dev/null +++ b/ds/map/rbtree/README @@ -0,0 +1 @@ +rbtree: red–black tree map diff --git a/ds/map/slice_basic/README b/ds/map/slice_basic/README new file mode 100644 index 0000000000000000000000000000000000000000..e3773f0f19d4e5710d64920fa3ce67cb680d7a1a --- /dev/null +++ b/ds/map/slice_basic/README @@ -0,0 +1 @@ +slice_basic: trivial linear search slice map diff --git a/ds/map/slice_sorted/README b/ds/map/slice_sorted/README new file mode 100644 index 0000000000000000000000000000000000000000..72301d6316307a7cb709c79e84075d1a51e77149 --- /dev/null +++ b/ds/map/slice_sorted/README @@ -0,0 +1 @@ +slice_sorted: sorted binary search slice map diff --git a/ds/map/swiss_siphash/README b/ds/map/swiss_siphash/README new file mode 100644 index 0000000000000000000000000000000000000000..9e2ffdd6762a5bcaeda3eea35c5d1d1a40f8ce05 --- /dev/null +++ b/ds/map/swiss_siphash/README @@ -0,0 +1 @@ +swiss_siphash: SipHash swiss tables -- 2.48.1