~kvik/lu9-p9

misc: use usize instead of lua_Unsigned
misc: implement p9.{enc,dec}{16,32,64} bindings
extra/lfs: add lfs._VERSION

Some programs ask for this (lie).
base: add p9.nsec and p9.nanosec functions
extra: LuaFileSystem emulation API

Drop extra/lfs.lua into your project to use it.

Locks and links aren't implemented.
file: rework api and implementation, fix nasty bug as well

The File object is reimplemented as a userdata type which cleans up the
implementation.

The confusing file:dup() method is gone.  Its functionality is now split
between a simple file:dup() which takes no arguments and returns a clone
of file, and a new method file:set() which rewires the file descriptor.

The p9.file() constructor is gone.  It was a lazy approach for accessing
already-open file descriptors like the standard input and output but it
turned out to be awkward to use and a very bad idea: the way you'd
access the, for example, standard output was to write:

	p9.file(1):write("hello")

This would create a File object wrapping the fd, call the write method,
after which the newly created file handle would become unreachable and
get picked up by the garbage collector, closing the standard output fd
at some arbitrary time.  This is obviously a very bad interface and I
got punished hard for making and misusing it.

An alternative solution introduced in this patch is to have a p9.fd
table through which arbitrary already-open file descriptors might be
used without needing to explicitly wrap and worry about them being
collected under you. Thus the above example becomes:

	p9.fd[1]:write("hello")

Currently, only the fd 0 through 2 are exposed here, but in some
following patch the table will act as a proxy for any file descriptor.

Some other unimportant changes to code structure sneaked in as well.
test: do a memory leak check
common: fix Lalloc error checks

Simply checking for nil return is not enough because the allocator
function also has to act as free, in which case it must return nil.
common: avoid polluting the stack
common: improve memory allocation helpers
all: remove unused data, clarify naming
mkfile: specify dependencies
all: introduce nicer project structure

This should allow easier maintenance and cherry linking of
modules planned in the future.
note: implement (horrible) note handling
proc: implement p9.wait()
proc: implement p9.exec()
proc: implement p9.(pid ppid user sysname)
proc: implement p9.fatal()
misc: implement p9.cleanname()
Next