Base and Script Classes
If that's the way that you want it...
That's the way I want it more.
- Jim Croce
Aztec Base Class
The 'Base' Class is a special abstract class in the Aztec Class Framework. By definition, every Aztec class is derived from Base, either directly or indirectly. Therefore, every Aztec object has access to the methods provided in the Base class, some of which are shown below. Most of the methods are purposefully named starting with "Object", with the goal of minimizing any naming conflict within a user defined class.
Since all classes are ultimately derived from Base, all of these methods become part of the class hierarchy for every Aztec class, including primitive classes such as int, float and string. The Base class is defined in the 'aztec.system' space. Some key methods of the Base class are shown in the following table.
Event handling is typically an important part of an Aztec Script/Application, and all Aztec Class Framework events are handled in the same, flexible and consistent manner. As such, the Base class provides the AddEventHandler() and ProcessEvent() methods to help any user defined class create a custom Aztec event handling framework that works the same way that system events are handled. Event handling support is built directly into the Aztec Virtual Machine, with the ability to automatically wake up other Aztec Threads which are waiting for event(s) to occur. These two methods tie the user defined event directly into the Virtual Machine's event processing system to gain that same functionality.
Aztec Script Class
The 'Script' Class is also a special class in the Aztec Class Framework. An Aztec program or application is also known as a script. The one and only Script object is created automatically by the Virtual Machine during script startup.
The Script class contains many useful methods related to general Script related processing
♦ Operating system access
♦ Default folder settings
♦ Command line argument access
♦ Dynamic code generation
♦ Send and receive messages within the Script and to and from remote Scripts, including Text, Object and Binary messages
The Script class is defined in the 'aztec.system' space, and is derived from Base, as shown in the following inheritance diagram.
There is one and only Script object, and a compile error is produced if code in the Script tries to create a new Script object. A global VM method named “GetScript()” provides the reference to the Script object from anywhere and the “Thread” class provides the “Script()” method for the same purpose. The global VM methods "GetThread()" and "GetMainThread()" return the current calling Thread and the Main Thread object references, respectively.
Some key methods of the Script class are shown in the following table.
The Script class provides some very useful methods, from accessing operating system variables, executing OS commands and applications, accessing the script's Metadata and message event handling. In addition, it also includes three separate families of methods to perform run-time compilation and execution of Aztec source code.