| Introduction | Start | acdkcfgscript | Language | Library | Embedding | CfgScript IDE | Debugging | Templates | Samples | Wish List |
CfgScript is a full featured scripting language
based on ACDK. CfgScript is used in the
the ACDK Metacompiler and the ACDK Make.
CfgScript is a typed scripting language with similarities to Java and C#.
Nearly all that can be done with ACDK in C++ can also be done in CfgScript.
The same classes are used C++ as in CfgScript.
Of course some specific features of C++, like pointers, templates, and stack variables
are not supported in the scripting language, but for compensation CfgScript provides
high-level language constructs - missing in C++, like foreach loops , lamda expressions,
backtick evaluation, multimethods and complex type literals.
CfgScript has a similar relationship to ACDK C++ as Tcl has to C.
In component based development C++ classes can be tied by CfgScript together to
an application.
CfgScript can also serve configuration components to an C++ application, communicating
via C++ interfaces.
Complete Applications can be build in CfgScript in various domains, like multi threaded
network application, handling XML files, accessing SQL databases and easily and fast
written rich GUI applications.
CfgScript can be used for many purposes.
On the basis of the ACDK libraries prototypes can be implemented
very fast.
- No creation of make files is needed.
- No compilation of the script needed.
- One click/enter to run the application.
- Easy translation from CfgScript to C++ if the prototype should
be transformed to a compiled application.
Often Prototypes lives longer than originally was planned.
Simple tools - which are somewhere between shell scripts and C++/Java - can
be easily developed.
For a given ACDK C++ library (or of course also CfgScript class libraries)
test driver can be implemented in CfgScript.
In the ACDK library ACDK WX most test applications are not in C++, but in CfgScript.
Because of the neat integration of CfgScript with components implemented C++, COM, CORBA
CfgScript is a good choice to connect these components with some scripting (see also below).
The standard configuration mechanism in ACDK for configuration are properties files
with the same format known from Java.
But the properties files are limited to key=value string pairs.
CfgScript can be used to create typed, hierarchical structured configuration sets.
See in Properties Type.
Many complex software systems needs more than static data for configuration.
Configuration with dynamic parts (program code) often called Customization.
CfgScript can also be used as extended configuration with does not only setup some
configuration data, but setup and glue components to a customized application.
- Java/C# like syntax, with same constructs as in ACDK C++.
- Alternatively also ACDK C++ like syntax can be parsed. This is usable to use CfgScript
as prototype language, which may transferred later to C++.
- Runs on Windows, Linux, Solaris, FreeBSD
- common basic types, like bool char, short, int, long, float, double.
- Any-Type.
- container types like arrays and dictionaries.
- Literal support for Props (basically a hierarchical dictionary)
and arrays.
- Fully object oriented.
- Support for operation overloading.
- Customizable casting rules from strict (Java like) to lazy (Perl like)
- Support for lamda expressions.
- Support for delegates directly assigned from a lamda
expression of a object/class method.
- Support for enumerations.
- common control structures like: if, for, do, while, foreach, switch, break, return, continue, with
- Support for unicode character.
- Supports evaluate embedded variables in string like perl, tcl or sh
- Exceptions: throw, catch, finally
- Java like, multithreading support (synchronized)
- support for namespaces and modules, including using and
typealiase.
- Seamless integration of the interpreter into C++.
- Seamless using C++ classes in CfgScript.
- Seamless using CfgScript classes in C++.
- Seamless integration of other DMI Server like COM.
- ClassLoader for CfgScript files, C++ ACDK libraries, COM, JAVA and CORBA servers.
- Different to Java or C# CfgScript not compiled, but a true interpreted language.
- Integrated logging.
- Integrated debugger.
- Integrated JSP like templates.
- Same object model as Java, C# with owner defined:
- Classes
- Interfaces
- Enums
- user defined operator overloading
- in, out, inout parameter attributes
- byref, byval parameter attributes for remoting
- Polymorphic functions
- called by named parameters
- default value for parameter
- Call with rest (like ... in C/C++)
- Call with named rest (similar to ..., but the elements are named parameters)
- Delegates for signal/slot constructions
- lambda expressions for in place function definition
Every in ACDK defined C++-class, interface and Enumeration
can be used inside the script as naturally and seamless.
// CfgScript
// StringBuffer is an ACDK-C++ class
acdk.lang.StringBuffer sb = new acdk.lang.StringBuffer("asdf");
sb.append("asdf");
acdk.lang.System.out.println(sb.toString());
|
CfgScript uses the ACDK C++ Classes as default library framework, which
supports things like:
- Reflection mechanism
- IO
- collections
- regular expression
- logging
- networking
- and many other libraries
ACDK has object integration of following frameworks:
Object from these technology frameworks can be used inside CfgScript
in a seamless way.
Example:
// create a Com Object, like Microsoft Word
word = new acdkx.com.ComObject("Word.Application");
// use this object, like it is own
word.Visible = 1;
doc = word.Documents.add();
sel = word.ActiveWindow.Selection;
sel.TypeText("This is ");
sel.Font.Bold = 1;
sel.TypeText("ACDK");
sel.Font.Bold = 0;
sel.TypeText(" instrumenting Word through acdk_cfgscript");
acdk.lang.Thread.sleep(3000);
word.Quit(0);
|
CfgScript can be used extend C++ classes. The extended
class / implemented interface can be used inside C++ code,
like it is a own native C++ class
A common sample is:
class MyElement
extends acdk.lang.Object
implements acdk.lang.Comparable
{
int _el;
MyElement(int e) { _el = e; }
int getElement() { return _el; }
int compareTo(acdk.lang.Object other) { return _el - other._el; }
}
acdk.util.Collection coll = new acdk.util.TreeSet(); // TreeSet is a native C++-Class
coll.add(new MyElement(1)); // C++ implementation calls the native C++
// interface method compareTo() to inserted the element sorted
coll.add(new MyElement(3));
coll.add(new MyElement(2));
it = coll.iterator();
while (it.hasNext() == true)
{
out.println(it.next().getElement());
}
|
Classes/Objects implemented in CfgScript can be used
by other component languages:
// MyElement.csf
class MyElement
extends acdk.lang.Object
{
int _el;
MyElement(int e) { _el = e; }
int getElement() { return _el; }
acdk.lang.String toString() { return String.valueOf(_el); }
void addElement(int i) { _el = _el + i; }
}
|
Now in VBScript:
Dim acdk
Set acdk = CreateObject("Acdk.Object")
dim script
' load script
set script = acdk.New("acdk.cfgscript.Script", "MyElement.csf")
' class MyElement is now available as ActiveX component
Dim myElement
Set myElement = acdk.New("MyElement", 42)
dim i
i = myElement.getElement()
myElement.addElement 42
dim s
s = myElement.toString()
|
I started a project ACDK WX to provide GUI functionality
to ACDK and CfgScript.
|