about summary refs log tree commit diff stats
path: root/browse-slack
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-08-13 08:27:50 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-13 08:27:50 -0700
commitc9e9b5612382ddcec5ed185125b6d4212d0509d0 (patch)
tree7ce9585dee44adeaf207b925e379ead8f046f1e9 /browse-slack
parente2dd5420b2ca0ce9333667cb3be9d49673209f37 (diff)
downloadmu-c9e9b5612382ddcec5ed185125b6d4212d0509d0.tar.gz
start standardizing how we manage item arrays
I need to start treating them as postings lists (https://en.wikipedia.org/wiki/Inverted_index)
Diffstat (limited to 'browse-slack')
-rw-r--r--browse-slack/environment.mu16
-rw-r--r--browse-slack/main.mu22
2 files changed, 19 insertions, 19 deletions
diff --git a/browse-slack/environment.mu b/browse-slack/environment.mu
index 95ed63f3..0a638a75 100644
--- a/browse-slack/environment.mu
+++ b/browse-slack/environment.mu
@@ -19,10 +19,10 @@ type environment {
 fn initialize-environment _self: (addr environment), _items: (addr item-list) {
   var self/esi: (addr environment) <- copy _self
   var items/eax: (addr item-list) <- copy _items
-  var newest-item-a/eax: (addr int) <- get items, newest
-  var newest-item/eax: int <- copy *newest-item-a
+  var items-data-first-free-a/eax: (addr int) <- get items, data-first-free
+  var final-item/eax: int <- copy *items-data-first-free-a
   var dest/edi: (addr int) <- get self, item-index
-  copy-to *dest, newest-item
+  copy-to *dest, final-item
 }
 
 ### Render
@@ -435,10 +435,10 @@ fn next-item _env: (addr environment), _items: (addr item-list) {
 fn previous-item _env: (addr environment), _items: (addr item-list) {
   var env/edi: (addr environment) <- copy _env
   var items/esi: (addr item-list) <- copy _items
-  var newest-item-index-a/ecx: (addr int) <- get items, newest
-  var newest-item-index/ecx: int <- copy *newest-item-index-a
+  var items-data-first-free-a/ecx: (addr int) <- get items, data-first-free
+  var items-data-first-free/ecx: int <- copy *items-data-first-free-a
   var dest/eax: (addr int) <- get env, item-index
-  compare *dest, newest-item-index
+  compare *dest, items-data-first-free
   break-if->=
   increment *dest
 }
@@ -491,12 +491,12 @@ fn page-up _env: (addr environment), _items: (addr item-list) {
   var items-data-ah/eax: (addr handle array item) <- get items, data
   var _items-data/eax: (addr array item) <- lookup *items-data-ah
   var items-data/ebx: (addr array item) <- copy _items-data
-  var newest-item-index-a/esi: (addr int) <- get items, newest
+  var items-data-first-free-a/esi: (addr int) <- get items, data-first-free
   var src/eax: (addr int) <- get env, item-index
   var new-item-index/ecx: int <- copy *src
   var y/edx: int <- copy 2
   {
-    compare new-item-index, *newest-item-index-a
+    compare new-item-index, *items-data-first-free-a
     break-if->
     compare y, 0x28/screen-height-minus-menu
     break-if->=
diff --git a/browse-slack/main.mu b/browse-slack/main.mu
index c1ab1c2d..7ce8d36c 100644
--- a/browse-slack/main.mu
+++ b/browse-slack/main.mu
@@ -1,7 +1,7 @@
 type channel {
   name: (handle array byte)
   posts: (handle array int)  # item indices
-  newest-post-index: int
+  posts-first-free: int
 }
 
 type user {
@@ -18,12 +18,12 @@ type item {
   text: (handle array byte)
   parent: int  # item index
   comments: (handle array int)
-  newest-comment-index: int
+  comments-first-free: int
 }
 
 type item-list {
   data: (handle array item)
-  newest: int
+  data-first-free: int
 }
 
 # globals:
@@ -135,7 +135,7 @@ fn parse in: (addr stream byte), users: (addr array user), channels: (addr array
     }
     loop
   }
-  var dest/eax: (addr int) <- get items, newest
+  var dest/eax: (addr int) <- get items, data-first-free
   copy-to *dest, item-idx
   decrement *dest
 }
@@ -307,12 +307,12 @@ fn parse-item record: (addr stream byte), _channels: (addr array channel), _item
       populate parent-comments-ah, 0x200/num-comments
       parent-comments <- lookup *parent-comments-ah
     }
-    var parent-newest-comment-index-addr/edi: (addr int) <- get parent-item, newest-comment-index
-    var parent-newest-comment-index/edx: int <- copy *parent-newest-comment-index-addr
-    var dest/eax: (addr int) <- index parent-comments, parent-newest-comment-index
+    var parent-comments-first-free-addr/edi: (addr int) <- get parent-item, comments-first-free
+    var parent-comments-first-free/edx: int <- copy *parent-comments-first-free-addr
+    var dest/eax: (addr int) <- index parent-comments, parent-comments-first-free
     var src/ecx: int <- copy item-idx
     copy-to *dest, src
-    increment *parent-newest-comment-index-addr
+    increment *parent-comments-first-free-addr
   }
   # channel name
   skip-chars-matching-whitespace record
@@ -333,10 +333,10 @@ fn parse-item record: (addr stream byte), _channels: (addr array channel), _item
     var channel-offset/eax: (offset channel) <- compute-offset channels, channel-index
     var channel/eax: (addr channel) <- index channels, channel-offset
     var channel-posts-ah/ecx: (addr handle array int) <- get channel, posts
-    var channel-newest-post-index-addr/edx: (addr int) <- get channel, newest-post-index
-    var channel-newest-post-index/edx: int <- copy *channel-newest-post-index-addr
+    var channel-posts-first-free-addr/edx: (addr int) <- get channel, posts-first-free
+    var channel-posts-first-free/ebx: int <- copy *channel-posts-first-free-addr
     var channel-posts/eax: (addr array int) <- lookup *channel-posts-ah
-    var dest/eax: (addr int) <- index channel-posts, channel-newest-post-index
+    var dest/eax: (addr int) <- index channel-posts, channel-posts-first-free
   }
   # user index
   {