Skip to content
Sasha Crofter edited this page Jun 5, 2012 · 2 revisions

p.init

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

p.loadPackage (pointer)

Loads a package by adding the identifier's crp.dsHash 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.

package.nocmd

package.ls

Writes the names all of the links (files and directories) in the current working directory to stdout. Output is currently somewhat garbled.

Clone this wiki locally