I don't have much time on my hands but I was able to integrate my extended basic source code into the web server last night and get it to serve basic web pages as well as serve for logical processing! You can
write and test your script from inside of VOS with proper admin permissions!
I tried doing this with Lua. It is too complicated. Too many includes, too much difficult syntax parsing and too much knowledge of Lua required for beginners. If you know
GWBASIC or
QUICKBASIC, you can code
your own logic and web pages up in minutes! Amongst other things this reduced the executable down to 318K for the code (!), still about
50% of that is initialization data and compiled-in minified javascript!
I have added the following extension keywords to BASIC to facilitate this functionality as simply as possible!
I have not integrated Raphael or SVG drawing from inside the BASIC script yet (this is my next goal), here are the keywords I have added as of last night :
(VOSBasic files end with extension ".VOS" and are stored in general SQLite repository and edited on-the-fly in browser)
IMPORT - includes additional code file streamed from repository
WEBPRINT - Prints output to current socket with argument parameters and safety checking for overflow conditions
WEBSTYLE - Outputs include statement in HTML for stylesheet
WEBINCLUDE - Outputs HTML for script include for javascript with name
PRINT - Print to standard output with argument parameters, usually current console
LOG - Print to logging output with argument parameters
CGIPARAM - function to get CGI value passed by caller
GETLISTITEM - function that returns value from named list
GETGLOBAL - gets string from global cache from named resource (usually as JSON)
SETGLOBAL - Sets string in global cache to named resource (usually as JSON)
DBCREATE - create a new database
DBOPEN - open existing database and return handle
DBQUERY - execute SQL query against database handle and return success or failure
DBFETCH - get row of results from database if exists
DBFETCHNEXT - get next row of results
DBCLOSE - close database and release resources
DATABROWSER - web prints HTML table of browsable database records
DATARECORD - web prints HTML table of editable database information representing one record
One thing I need is an easy way to parse all the JSON tossed around internally inside the VOS Server to represent values from sensors and command calls. Still trying to hammer out the best way to do this as a VOSBASIC expression. Leaning towards something like JSONPARSE(fragment,path) to return the matching value out of the existing JSON and putting it back in a similar fashion. Structured correctly this could allow users to create their own custom AJAX/JSON web services using VOSBASIC script!