XbWrapper - Xbase Interpreter


XbWrapper-Xbase script interXbWrapper is a simple scripting language.It is intended to use as an embedded language in other C# programs.It's an Xbase style script language.XbWrapper is small and simple, and is only one thousand lines of source. So if the functionality you are looking for is more than a simple configuration file parser, XbWrapper could be for you. XbWrapper based on interpreter and wrapper functions library. This library is designed as a set of XBase commands and functions and provided wrappers for work with Access databases. You establish connection from your application and further in the scripts, work with the Access tables using XBase like functions and commands in application:

XbParser parser=new XbParser(lexer);
parser.DbClass=new DbWrapper("book.mdb");

in script:

# bookstock is table from book.mdb
# make dataset
use bookstock
# set current work table
select bookstock
while !eof()
? bookstosk.booktitle
# in expression bookstock is table and booktitle is field name
# bookstosk.booktitle=something means store in field "booktitle" variable
# something
skip
endwhile          

There are some XBase like functions and commands that you may use with your
scripts application. These are:

use <tablename>
select <tablename>
skip
eof()
fcount()
recno()
reccount()
field(integer n) ant etc.
For full information see source code.

Interpreter support:

Automatic declare variables (string,integer,double,boolean)
Conditional execution ('if','case' statements)
Loops ('while','for')
Functions
Local variable scope and array.
# declare array length of array=0
Declare ahtml[0]
# add element to array
AAdd(ahtml,"<TABLE Border>")
#Length of array =1
? Alen(ahtml)

The usual range of logic and math operators.script.xbs - contains example how to generate html page from database, written on XbWrapper.

Note: The submitted code is not a complete application and is intended for the educational purposes. The only requirement is .NET SDK Runtime environment.

Up Next
    Ebook Download
    View all
    Learn
    View all