DEV Community

Thomas Leathers
Thomas Leathers

Posted on

SSTNPL v0.3: Modules & command prompts.

Overview:

Some of you may have seen my tutorials on SSTNPL in the past, but considering how much has been added since then, i figure id post about some of its latest features.

This post will refrence this SSTNPL source file

simple, yet endlessly helpful.

One of the first things you might notice if you scroll down past the comments, is the code indenting. similar to languages like C, it means nothing, but is there to help make code more readable.

command prompts ahoy!

The linked SSTNPL soruce code actually creates basic Command line shell. now, part of this involves the new module system, and a module called comprompt. but all the latter does is take user input and pass it into an SSTNPL table (2D array, note that SSTNPL has no normal 1D arrays).

gsub cp.getentry

The actual syntax checking is done via the tabstrc operations that start at line 57. all it does is checks if the given string is at the given location, in the given table. notice the table name starts with cp..

tabstrc cp.buffer,@0,@0,help
    set cmdflg
    if cmdflg,@1 =validcom @1
    if cmdflg,@1 gsub help

module system.

if you scroll to the end of the file, you will see a command that looks like such:

include comprompt as cp

Top comments (0)