DMDScript in C++
An alternative to the D Programming Language, implementation of DMDScript is the C++ implementation. The C++ implementation is for those applications where:- The DMDScript must interface with a C++ application.
- Support for the IActiveScript COM interface is desirable.
Key Benefits of DMDScript
- Implementation of ECMA 262 with JScript extensions.
- More than twice as fast as JScript, as measured by included benchmark.
- Both standalone and COM versions built from the same source.
- COM version is an IActiveScript implementation designed to work under an IActiveScript host.
- Ideal for embedded systems - standalone version is not dependent on Windows COM API.
- Ideal for ECMAscript enabling browsers, email clients, and any application that needs a scripting language.
- For source licenses contact Digital Mars.
- Based on Walter Bright's ECMA 262 script engine, which is also used as the primary code base for Sun's ECMA 262 Script engine.
Installing DMDScript on Windows
Download DMDScript binaries for Win32.
The C++ source code for DMDScript is available for evaluation purposes. A license is available.
Files:
dscript.dll Digital Mars' DMDScript interpreter for COM
treatas.exe Convince Explorer to run DMDScript
ds.exe Standalone console version of DMDScript
sieve.html Benchmark speed of script engine, compare for yourself!
sieve.ds Benchmark speed of standalone script engine, compare for yourself!
Note: Much of the Windows user interface outside of the browser depends on Microsoft's JScript engine, and it depends on many undocumented features of JScript. These undocumented behaviors may not work with DMDScript; DMDScript is designed to handle script embedded in web pages accessed through the browser.
Installing DMDScript to run under Explorer
Explorer usually is configured to use Microsoft JScript as its ECMAscript interpreter. To configure Explorer to run DMDScript instead:- Close all browser windows.
- Execute the following commands:
regsvr32 dscript.dll treatas jscript dmdscript
- Load the web page sieve.html to verify that DMDScript is running.
- Try these speed tests.
Note: Much of the Windows user interface outside of the browser depends on Microsoft's JScript engine, and it depends on many undocumented features of JScript. These undocumented behaviors may not work with DMDScript; DMDScript is designed to handle script embedded in web pages accessed through the browser.
Switching Explorer Back to Using Jscript
To switch back to using Microsoft JScript:- Close all browser windows.
- Execute the following commands:
regsvr32 /u dscript.dll treatas jscript
Standalone Console Version of DMDScript
ds with no arguments will compile and run the dscript file test.ds. With an argument, it will compile & run that file:ds sievewill compile and run sieve.ds. The .ds is the default extension.
The console version has some additional builtin functions available:
- getenv(string)
- Get and return value of environment variable string.
- print(string)
- Print string to stdout.
- println(string)
- Print string to stdout followed by a newline.
- readln()
- Read and return an input line from stdin, not including the newline.
Differences Between DMDScript (Digital Mars), Jscript (Microsoft) and Javascript (Netscape)
goto Statement
DMDScript implements the goto label; statement, like in C. goto is not part of the ECMA 262 v3 standard.assert() Function
DMDScript implements the assert() function property of the Global Object. assert() throws a RuntimeError exception. If there is an argument to assert(), that argument is converted to a Boolean and a RuntimeError exception is thrown if the argument is false.__proto__ Property
Javascript supports the __proto__ property. Neither ECMA nor Jscript nor DMDScript supports it.Conditional Compilation
JScript's conditional compilation statements are not supported by DMDScript, Javascript, nor ECMA.
Copyright © 2001-2010 by Digital Mars ®, All Rights Reserved
|
Page generated by Ddoc.