next up previous contents
Next: Running a burn-in job Up: Syntax Previous: Syntax   Contents

Subsections

Language syntax

Data types

Valid data types are int, float, string, time and period. int and float are used to store integer and floating point numbers, string to store character strings, time to store time values for task scheduling and period to store the period of recurring tasks. Conversion between data types happens automatically when it makes sense; when it doesn't, the shell will complain. There should be a table (Table [*]) here to show what conversions take place.

Variables

Variables are declared as in C:

type variable_name [ = initializer ];
The scope of all variables is global.

blah blah blah blah.

Expressions

The shell recognizes all C arithmetic expressions valid for the data types above. It also recognizes function calls. (The shell does not provide procedural abstraction, so it is not possible to define functions; you can only call built-in functions (subsection ??) or functions you have implemented in real C and told AMBUSH about (some other subsection)).

\begin{displaymath}
% latex2html id marker 362\fbox{\parbox[t]{0.99\textwidth...
... Sec.~\ref{sec-struct-queue} for discussion of the threading.}}\end{displaymath}

Statements

Expression statements, compound statements, selection statements, atomic statements and schedule statements are supported by the shell. Expression statements are familiar from C: they are of the form

expr;
Compound statements are equally familiar:
{
     statement$_1$
     statement$_2$
     ...
}
The remaining statement types are not found in C or found in modified form. They exist to add concurrency to the AMBUSH shell scripting language. We describe each statement type separately.

Selection (``condition'') statements

A selection statement has the form

if (expr) statement
This is syntactically identical to an if statement in C, but semantically different. Instead of immediately evaluating the predicate consequent, the shell continuously re-evaluates the predicate and evaluates the consequent once the predicate is met. This allows shell scripts to watch for conditions (tripped power supply, for example) and respond to them once they occur.

The shell also understands C-style if statements, where the consequent is evaluated immediately. These look thus:

immediate if (expr) statement
The C switch selection statement is not supported.

Schedule statements

Schedule statements are the heart and soul of AMBUSH. They come in two variants. The first one, the at statement, schedules a task for execution at a specified time:

at (expr) statement
expr should evaluate to a time in the future.

The second type of schedule statement is the every statement, which repeatedly executes a task with a specified period:

every (expr) statement
expr should evaluate to a time period.


Init statement


Atomic statements

The AMBUSH system allows several tasks to be performed concurrently. Frequently a set of instructions needs to be executed as a unit, i.e. no instructions from another tasks can be executed until the entire group of instructions has been processed. Such a group of instructions is called atomic. To create an atomic group in a shell script, you can use an atomic statement:

atomic statement
All the instructions generated by the statement are guaranteed to be executed as a group. (Note that even an expression statement can generate multiple instructions.)


Sequential statements

Built-in functions

We need lots of built-in functions to have a working system. There should be a chapter (Ch. 8) to list them.


next up previous contents
Next: Running a burn-in job Up: Syntax Previous: Syntax   Contents
Johannes Muelmenstaedt 2004-03-31