updated the API documentation to reflect the current version.

This commit is contained in:
Izaya 2017-09-06 18:35:18 +10:00
parent 7517afe85e
commit 5996ce4cbf

View File

@ -3,6 +3,8 @@
### system
#### spawn(*name*, *function*, *environment*)
Spawns a process from *function* called *name* with *environment*.
#### log(*messages...*, *severity*, *facility*, *meta*)
Writes messages to the system log, optionally, if *meta* is true, with *severity* and *facility*, which default to 6 and 2, respectively.
### os
#### os.getenv(*k*)
@ -13,6 +15,8 @@ Sets the *k* environment variable to *v* for the current process.
Returns a list of current processes running, the key being the pid and the value being the name.
#### os.taskinfo(*pid*)
Returns the name, parent process, and user ID for process *pid*.
#### os.genenv()
Generates an insulated environment table for running processes in.
### event
#### event.get()
@ -22,7 +26,11 @@ Gets, and possibly waits for up to *timeout* seconds, for an event, optionally w
### buffer
#### buffer.create(*w*, *c*)
Creates a buffer with worker function *w* and close function *c*. *w* is called on creation with the buffer as the argument.
**DEPRECEATED.** Creates a buffer with worker function *w* and close function *c*. *w* is called on creation with the buffer as the argument.
#### buffer.ucreate()
Creates a unidirectional buffer and returns it.
#### buffer.bcreate()
Creates a bidiretional buffer and returns both ends.
### filesystem
#### fs.mount(*mp*, *pr*)
@ -53,6 +61,10 @@ Returns true if a file or directory *path* exists.
Returns true if *path* is a directory.
#### fs.cd(*path*)
Changes the current directory to either *path* or *os.getenv("PWD")*/*path*.
#### fs.cp(*source*, *destination*)
Copies a file from *source* to *destination*.
#### fs.mv(*source*, *destination*)
Same as fs.cp but deletes *source* afterwards.
### io
#### write(...) or io.write(...)
@ -93,6 +105,26 @@ Sends *msg* to *addr* on *port*.
Sends *msg* to *addr* on *port* in *net.mtu* sized chunks.
#### net.recvstring(*addr*,*port*)
### cdlib
cdlib is the Copper Data Library
#### cdlib.encode(*hops*, *source*, *destination*, *data*)
Encodes a copper packet with *hops* from *source* to *destination* with *data*.
#### cdlib.decode(*data*)
Decodes a copper packet. Returns the same data cdlib.encode takes as input.
#### cdlib.encodeName(*name*)
Encodes a name for use in a copper packet.
#### cdlib.decodeName(*message*)
Returns just the name from an encoded copper packet.
#### cdlib.decodeNoHops(*data*)
Decodes a copper packet minus the hops.
### relib
relib is the Copper reliability layer library.
#### relib.encode(*packet*)
Encodes *packet* passed as a table as a relib packet.
#### relib.decode(*data*)
Decodes *data* into a relib packet table.
### drivers
#### tty(*gA*, *sA*, *sI*, *fg*, *bg*)
Creates a GPU driver instance for GPU *gA* and screen *sA* attached to session *sI*, optionally with foreground and background colours *fg* and *bg*.
@ -115,7 +147,13 @@ This is triggered to make a tty driver attached to *session* write *text* to the
## Applications
### luash(*sI*)
Spawns a luash instance for session *sI*
### skex("*fname*")
Launches an instance of the skex text editor, optionally reading *fname* at startup.
### skex2("*fname*")
### skex(*fname*)
Launches an instance of the skex text editor, optionally reading *fname* at startup.
May actually spawn skex2.
### skex2(*fname*)
Launches an instance of the skex2 text editor, optionally reading *fname* at startup.
### nsh(*host*, *port*)
Spawns the network shell client and attempts to connect to *host* on *port* for a remote login session.
ctrl-shift-c to exit.
### nshd(*port*)
Spawns a networh shell server listening on *port.*