User Tools

Site Tools


running-examples

This is an old revision of the document!


The standard Dana distribution package includes a collection of example programs. Their source code is in the components/examples/ directory of Dana's home folder. Here's how to run them.

Auto-linked examples

Most of the examples are designed to run by automatically linking all of the necessary components together. From a command-prompt in the examples directory, you can run these by typing commands like:

dana SysTest

dana RandomTest

dana Calendar

dana GApp

You can run these programs from a command-prompt that is open in any directory on your computer by typing commands like:

dana examples.SysTest

dana examples.Calendar

dana examples.GApp

Examples using the esher meta-program

The esher meta-program allows you to adapt systems while they're running. Only the graphical user interface examples are designed to work with esher (though you could easily write the necessary configuration files to support all of the other examples too).

You can run one of the graphical examples by opening a command-prompt in the components/examples/ directory and typing the command:

dana esher conf_filebrowser.txt

This means that the Dana language interpreter is running the program “esher” and the file conf_filebrowser.txt is being passed to esher as a parameter. There are two other configuration text files that you can also try for the other graphical examples.

Within esher, the commands pa, add, rem and tra are the most commonly used:

pa prints the current list of components in the system

add takes one parameter - the configuration text file describing the component to add to the system - and adds the selected component to the system (see the directory “conf” for possible configuration files; you could for example use the command add conf\buttonb.txt)

tra takes three parameters: the name or index number of the component whose dependency (required interface) you want to re-wire; the name of the required interface of that component that you want to re-wire; and the name or index number of the component to re-wire this dependency to. An example would be tra App Button 6 - a command which re-wires the dependency called Button of the component named App to be connected to the component at index 6 in the list printed by the pa command.

rem takes one parameter: the name or index number of the component that you would like to remove from the system. Be careful with this command to avoid removing a component that is currently in use.

running-examples.1401380657.txt.gz · Last modified: 2014/05/29 12:24 by barryfp

Page Tools