David Pilling
homenewssoftwarefree utilitieslinksmailing listview cart
OvationPro

Back to OvationPro page | Back to specification page

Specification: 6 Script Language

6.1 Running Scripts

Ovation Pro provides an embedded script language based on a subset of C. Script programs may be executed by double-clicking or dragging to the icon bar icon. After execution all functions and variables are discarded.

Scripts in the AutoRun directory are executed when Ovation Pro is run. After execution, all functions and variables are discarded.

Scripts in the Library directory allow functions and global variables to remain resident for use by other scripts.

Scripts may also be assigned to key presses or buttons on the button bar.

6.2 Script Language Details

Comments may be introduced using the C /* */ syntax or the C++ // syntax.

An Identifier is a sequence of letters and digits. The first character must be a letter or underscore. Identifiers may have any length and all characters are significant. Identifiers are case-specific.

The following identifiers are reserved for use as keywords:

break else string case for switch continue

if void default int while do return

Integer, character and string Constants are supported. A sequence of digits is taken to be an integer constant (preceded by 0 for octal or 0x/0X for hexadecimal). A character enclosed by single quotes is taken to be a character constant. Characters enclosed by double quotes are taken to be a string constant.

Three Types are supported: void, int (32-bit signed) and string (variable length string).

There are two Storage Classes: automatic and global. Variables declared within functions are automatic; they are local to the function and are discarded on exit. Variables declared outside all functions are global.

Functions may have int or string arguments and may return void, int or string types. Arguments are normally passed as 'call by value', but string arguments may be passed as 'call by reference'. Each script must have a main() function which is called first. Function prototypes are not supported.

A wide range of Operators are supported. Some operators can be applied to strings e.g. the + operator concatenates two strings.

+ - * / % & | ^ << >> ~ ! && || , ?: == != < >

<= >= ++ -- = += -= *= /= %= |= &= <<= >>=

The following Control Flow statements are supported:

while ( expression ) statement

do statement while ( expression )

for ( expression1 ; expression2 ; expression3 ) statement

if ( expression ) statement

if ( expression ) statement else statement

switch ( expression ) statement

6.3 Function Library

A wide range of functions may be called from scripts, from keys or from buttons on the button bar. They give control over many aspects of the software from opening dialogue boxes, to invoking specific operations. Functions are also provided to manipulate text in documents such as reading and writing text at the caret, selecting text, and manipulating bookmarks.

Other functions supplied include:

Menu functions allow existing menus to be edited or new menus to be created and attached to the menu structure or to the button bar.

Macro functions allow button bar, key or user macros to be defined or deleted.

RISC OS functions give access to the operating system.

File functions allow files to be opened, closed and data read and written.

String functions allow strings to be manipulated in various ways.

Additional libraries of functions may be created by adding scripts defining the functions to the Library directory.



back to top

Interesting and useful software
david@davidpilling.com Copyright David Pilling 2012