parent
c4b9d57ea0
commit
971182bb4a
@ -1,121 +0,0 @@
|
||||
NOTE: This assumes that variable storage is reworked and that there is no longer a separate bucket for
|
||||
strings and int vars. Both use the same bucket, but svar knows to add an extra space for the length
|
||||
and to copy the string in. A new word will be needed for storing strings vs int values in order to be
|
||||
sure to store the length.
|
||||
|
||||
|
||||
- - - - -
|
||||
Variables
|
||||
- - - - -
|
||||
|
||||
gopher.links ( []int )
|
||||
- `200 allot` should be called at the beginning to provide enough space for 200 links
|
||||
- gopher.links[0] is the number of links on the current page
|
||||
- gopher.links[1:] contain pointers to strings
|
||||
- Links can be followed with gopher.follow taking top of stack as the offset,
|
||||
so `5 gopher.follow` would check `5 gopher.links @ <=` and if that is true then
|
||||
would get the string address like so: `gopher.links 5 + @`
|
||||
- gopher.links will get overwritten each time a new gophermap is requested
|
||||
|
||||
gopher.link-storage ( []str )
|
||||
- `20000 allot` should be used to make sure there is enough room for the text of 200 links
|
||||
- gopher.link-storage is a bucket space that will get cleared/managed by the gophermap parser.
|
||||
As such, the 0 value will be the length of the first link rather than the number of links or
|
||||
total storage space
|
||||
- Links are stored as [host:port]\t[resource] with the tab being inserted by the link parser
|
||||
- Link storage will get overwritten each time a new gophermap is requested
|
||||
|
||||
gopher.link-storage-pointer ( int )
|
||||
- Used by the parser to keep track of the current writable space
|
||||
|
||||
gopher.page ( str )
|
||||
- String storage, allot at least 10000
|
||||
- 0 value will be the length of the content
|
||||
- Will get overwritten each time a new page is requested
|
||||
|
||||
gopher.host:port ( str )
|
||||
- Stores the current host:port
|
||||
|
||||
gopher.resource ( str )
|
||||
- Stores the current resource
|
||||
|
||||
|
||||
- - - - - -
|
||||
Subroutines
|
||||
- - - - - -
|
||||
|
||||
gopher.visit
|
||||
- Takes no stack data
|
||||
- Initiates a new request
|
||||
- Will query for input to get:
|
||||
- gopher.host:port
|
||||
- gopher.resource
|
||||
- Call: gopher.request
|
||||
- Call: gopher.is-map?
|
||||
- Call: gopher.parse-map || gopher.display-page
|
||||
|
||||
gopher.follow
|
||||
- Eats TOS as link offset
|
||||
- Call: gopher.get-link-address
|
||||
- Call: gopher.request
|
||||
- Call: gopher.is-map?
|
||||
- Call: gopher.parse-map || gopher.display-page
|
||||
|
||||
gopher.request
|
||||
- Call: gopher.host:port tcp-connect
|
||||
- Call: gopher.resource tcp-send
|
||||
- Call: tcp-receive
|
||||
- Call: tcp-close
|
||||
- Store the page data from the temp buffer into the page var
|
||||
|
||||
gopher.is-map?
|
||||
- Checks the first line for three tab characters
|
||||
- Leaves a bool on TOS
|
||||
|
||||
gopher.parse-map
|
||||
- Loop Call: gopher.line
|
||||
|
||||
gopher.display-page
|
||||
- Will print the current page
|
||||
- Used when not a gophermap or when wanting to view a raw gophermap
|
||||
|
||||
gopher.store-page
|
||||
- Will copy the temporary string buffer to gopher.page
|
||||
|
||||
gopher.line
|
||||
- Will find the bounds of the next available line in page
|
||||
- Will need to use a pointer for page (TODO add to vars above)
|
||||
- Will likely need vars for line-start and line-end (TODO add to vars above)
|
||||
- Will copy the given line into the temp string buffer
|
||||
- Call: gopher.print-line
|
||||
- Call: gopher.process-line
|
||||
|
||||
gopher.print-line
|
||||
- Works on the temporary string buffer
|
||||
- Will print a substring of the temp string buffer from 2 through `\t str.index-of
|
||||
|
||||
gopher.process-line
|
||||
- Works on the temporary string buffer
|
||||
- Call: gopher.get-new-link-address
|
||||
- Call: gopher.store-host
|
||||
- Call: gopher.store-port
|
||||
- Call: gopher.store-resource
|
||||
|
||||
|
||||
- - - - - - - - -
|
||||
Example workflow
|
||||
- - - - - - - - -
|
||||
" gopher " inline
|
||||
go.visit
|
||||
~> " host:port > " str.print-buf input ( circumlunar.space:70 ) go.new-host:port
|
||||
~> " resource > " str.print-buf input ( /~sloum/ ) go.new-resource
|
||||
-- go.host:port tcp-connect go.resource tcp-send tcp-receive tcp-close go.store-page
|
||||
-- go.parse-page go.display-page
|
||||
5 go.follow ( to follow the 5th link on the page )
|
||||
|
||||
|
||||
|
||||
|
||||
-TODO-
|
||||
- Build an append string function (right now only append char exists)
|
||||
|
Loading…
Reference in new issue