____ ____ ____ ____ 
||n |||i |||m |||f ||
||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|

	

the nimf guide : api : " gopher "

The gopher module is slightly different from the other modules that come packaged with nimf in that it is meant for interactive use, rather than as providing building blocks for other programs. The words in the module, when used together, make up a basic gopher client that can be used from within a nimf interactive session.

As configured by default the gopher module reserves a good bit of system memory to allow for the needed string storage: 57k+ blocks. This is admittedly a large amount considering nimf's default memory allocation (though is not particularly large by modern computer storage standards). This memory usage should be taken into account when running interactively and loading other large modules.

Variables


gopher.host:port

String variable that holds the current host/port. This is generally set by other words in the gopher module, but can be set or accessed manually

gopher.resource

String variable that holds the current resource path. This is generally set by other words in the gopher module, but can be set or accessed manually.

gopher.favs-path

This string variable should be set to a string representing a path to a file to be used for storing favorites on a user's local filesystem. If the file does not exist, it will be created. If the directory does not exist or the path is otherwise invalid, an error willbe thrown when other words attempt to use it.

Words


gopher.visit

Signature: ( _ -- _ )

Description: Will query the user for a host:port string and a resource string. Note that passing a port as a part of the host string is optional and 70 will be used if no port is passed. Note that resource is optional and / will be used if not resource is passed. Once the user supplies these values gopher.visit will attempt to retrieve the resource and output it to the terminal. If it is a gophermap it will be parsed. At present only gophermaps or plain text are supported. Leaves nothing on the stack.

gopher.follow

Signature: ( link-num -- _ )

Description: Eats a link number from TOS. Navigate to the given link and outputs it to the terminal (or throws an error). Leaves nothing on the stack.

gopher.back

Signature: ( _ -- _ )

Description: Takes nothing from the stack and leaves nothing on the stack. Navigates to the previous host/resource. The gopher module supports up to three levels of gopher.back functionality.

gopher.reload

Signature: ( _ -- _ )

Description: Takes nothing from the stack and leaves nothing on the stack. Reloads the current host/resource.

gopher.url?

Signature: ( link-num -- _ )

Description: Eats a link number from TOS and leaves nothing on the stack. Outputs the host/resource associated with that link number.

gopher.fav

Signature: ( link-num -- _ )

Description: Eats a link number from TOS and leaves nothing on the stack. Will add the host/resource associated with the link number to the favorites file (whose path is stored at gopher.favs-path) and will query for the text to refer to the favorite as.

gopher.favs

Signature: ( _ -- _ )

Description: Takes nothing from the stack and leaves nothing on the stack. Loads, parses, and displays the favorites file (whose path is stored at gopher.favs-path).

gopher.help

Signature: ( _ -- _ )

Descriptioin: Takes nothing from the stack and leaves nothing on the stack. Outputs help text describing the functionality of the gopher module.