This commit is contained in:
parent
3e6da6e25c
commit
fbc1f309d8
|
@ -1,10 +0,0 @@
|
|||
fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "loading data disk..", 3/fg 0/bg
|
||||
# too large for stack
|
||||
var s-h: (handle stream byte)
|
||||
var s-ah/ebx: (addr handle stream byte) <- address s-h
|
||||
populate-stream s-ah, 0x4000000
|
||||
var s/eax: (addr stream byte) <- lookup *s-ah
|
||||
load-sectors data-disk, 0/lba, 0x20000/sectors, s
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "done", 3/fg 0/bg
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
# The environment is a thin layer in this app, just a history of 'tabs' that
|
||||
# are fully specified by the operations used to generate them.
|
||||
|
||||
type environment {
|
||||
tabs: (handle array tab)
|
||||
current: int # index into tabs
|
||||
}
|
||||
|
||||
type tab {
|
||||
type: int
|
||||
# type 0: items by a user
|
||||
# type 1: items in a channel
|
||||
# type 2: comments for a post
|
||||
# type 3: items containing a search (TODO)
|
||||
root-index: int # into either users, items or comments
|
||||
item-index: int # what item in the corresponding list we start rendering
|
||||
# the current page at
|
||||
grapheme-index: int # what character in the item we start rendering
|
||||
# the current page at
|
||||
}
|
||||
|
||||
fn render-environment env: (addr environment), users: (addr array user), channels: (addr array channel), items: (addr array item) {
|
||||
}
|
||||
|
||||
fn update-environment env: (addr environment), key: byte {
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
type channel {
|
||||
id: (handle array byte)
|
||||
name: (handle array byte)
|
||||
posts: (handle array int) # item indices
|
||||
newest-post-index: int
|
||||
}
|
||||
|
||||
type user {
|
||||
id: (handle array byte)
|
||||
name: (handle array byte)
|
||||
real-name: (handle array byte)
|
||||
avatar: (handle image)
|
||||
}
|
||||
|
||||
type item {
|
||||
id: (handle array byte)
|
||||
channel: (handle array byte)
|
||||
by: int # user index
|
||||
text: (handle array byte)
|
||||
parent: int # item index
|
||||
}
|
||||
|
||||
type post {
|
||||
root: int # item index
|
||||
comments: (handle array int) # item indices
|
||||
}
|
||||
|
||||
# globals:
|
||||
# users: (handle array user)
|
||||
# channels: (handle array channel)
|
||||
# items: (handle array item)
|
||||
#
|
||||
# flows:
|
||||
# channel -> posts
|
||||
# user -> posts
|
||||
# post -> comments
|
||||
# keywords -> posts|comments
|
||||
|
||||
# I try to put all the static buffer sizes in this function.
|
||||
fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
|
||||
# load entire disk contents to a single enormous stream
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "loading data disk..", 3/fg 0/bg
|
||||
var s-h: (handle stream byte) # the stream is too large to put on the stack
|
||||
var s-ah/eax: (addr handle stream byte) <- address s-h
|
||||
populate-stream s-ah, 0x4000000
|
||||
var _s/eax: (addr stream byte) <- lookup *s-ah
|
||||
var s/ebx: (addr stream byte) <- copy _s
|
||||
load-sectors data-disk, 0/lba, 0x20000/sectors, s
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "done", 3/fg 0/bg
|
||||
# parse global data structures out of the stream
|
||||
var users-h: (handle array user)
|
||||
var users-ah/eax: (addr handle array user) <- address users-h
|
||||
populate users-ah, 0x800
|
||||
var _users/eax: (addr array user) <- lookup *users-ah
|
||||
var users/edi: (addr array user) <- copy _users
|
||||
var channels-h: (handle array channel)
|
||||
var channels-ah/eax: (addr handle array channel) <- address channels-h
|
||||
populate channels-ah, 0x20
|
||||
var _channels/eax: (addr array channel) <- lookup *channels-ah
|
||||
var channels/esi: (addr array channel) <- copy _channels
|
||||
var items-h: (handle array item)
|
||||
var items-ah/eax: (addr handle array item) <- address items-h
|
||||
populate items-ah, 0x10000
|
||||
var _items/eax: (addr array item) <- lookup *items-ah
|
||||
var items/edx: (addr array item) <- copy _items
|
||||
parse s, users, channels, items
|
||||
# render
|
||||
var env-storage: environment
|
||||
var env/ebx: (addr environment) <- address env-storage
|
||||
{
|
||||
render-environment env, users, channels, items
|
||||
{
|
||||
var key/eax: byte <- read-key keyboard
|
||||
compare key, 0
|
||||
loop-if-=
|
||||
update-environment env, key
|
||||
}
|
||||
loop
|
||||
}
|
||||
}
|
||||
|
||||
fn parse s: (addr stream byte), users: (addr array user), channels: (addr array channel), items: (addr array item) {
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
" when opening files in this directory, load vimrc from cwd (top-level)
|
||||
source vimrc.vim
|
Loading…
Reference in New Issue