www.digitalmars.com         C & C++   DMDScript  

DMDScript - System Object

reply Dan <Dan_member pathlink.com> writes:
Last night I created a static (it acts like Math) System object and bound it to
DMDScript.  I threw the following functions into it:

System.exit
version(console){
System.printLine
System.print
System.readLine
System.read
System.environment
System.command
}

I versioned off most of it so that people have the option to disable the
features.  They are too powerful for some browser/embedded uses after all.  :p

I also figured out exactly what DMDScript's testscript.d was doing.  I moved
that to console.d and thought about what to do with the arguments.  Currently,
it's designed to handle batch processesing with includes.  That may be very
useful for some people, and it's exactly how wscript/cscript manage their
command line arguments.  Since DMDScript is very close to being a stand-in for
JScript I thought it best not to ruin that.

Instead, I named yet another version() feature into the console - one that makes
it only process one script, and passes all the remaining arguments to the Global
arguments[].

I had to remove some of my old string manipulating assembler because I found an
obscure bug that I didn't feel like trying to understand.  I also streamlined
the sieve.ds to run about 15% faster.  :)

I'll post up changes tonight once I've tested it (I'm gonna bombard it with
about 40 of my scripts and see how it cries - I use every feature in the
language *and some* somewhere in those scripts).

I'll look over the posts lately and see if there was anything I missed (apart
from the Proxy bug)
Nov 11 2005
parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
"Dan" <Dan_member pathlink.com> wrote in message 
news:dl41ei$23ba$1 digitaldaemon.com...
 Last night I created a static (it acts like Math) System object and bound 
 it to
 DMDScript.  I threw the following functions into it:

 System.exit
 version(console){
 System.printLine
 System.print
 System.readLine
 System.read
 System.environment
 System.command
 }
As an idea: I did Stream object and its stdout/stdin/stderr instances as members of Global scope: http://www.terrainformatica.com/tiscript/Stream.whtm Also: VM can be parametrized by host implementation of stdout/stdin/stderr So host can send data to script and script can output data through its stdout to host. Pretty convenient. I also support << and >> operators for Streams. I have no goals to support JavaScript from A to Z so it works. Andrew Fedoniouk. http://terrainformatica.com
Feb 04 2006