Skip to content
SashaCrofter edited this page Jul 7, 2012 · 9 revisions

p.init

Initializes all of the pre-defined packages and their respective commands so that they can be accessed in a table.

p.loadPackage (pointer)

Loads a package by adding the identifier's crp.sum value and a pointer to the first instruction to the hash table. See Packages for more details.

returns 0 if successful, 1 if invalid package format

p.lookup (key)

Looks up a package in p.hashTable with key. returns a pointer to the main subroutine of the package

Packages

Packages are loaded by the DASH Package Handler at boot time. Standard packages are included in the module, and other packages can be loaded by calling p.loadPackage with a pointer to the header of the package. Packages are identified by the magic number 0xffab cdff, and contain a null-terminated string, the identifier. The index after the null in that string is the first instruction of the package. Packages are invoked in the DASH Shell by typing the identifier, letter for letter. Packages have by definition one modifier, and can hence have only one entry point. (A package cannot define two new top-level commands.) A package can, however, do its own parsing once it is invoked by reading stdin. This allows for such combinations as are seen in git init, git pull, git push, et cetera.

Clone this wiki locally