Jump to:  OMake Home • Guide Home • Guide (single-page) • Contents (short) • Contents (long)
Index:  All • Variables • Functions • Objects • Targets • Options

Chapter 12  The standard objects

Pervasives defines the objects that are defined in all programs. The following objects are defined.

12.1  Pervasives objects

12.1.1  Object

Parent objects: none.

The Object object is the root object. Every class is a subclass of Object.

It provides the following fields:

12.1.2  Map

Parent objects: Object.

A Map object is a dictionary from values to values. The <key> values are restricted to simple values: integers, floating-point numbers, strings, files, directories, and arrays of simple values.

The Map object provides the following methods.

There is also simpler syntax when the key is a string. The table can be defined using definitions with the form $|key| (the number of pipe symbols | is allowed to vary).

    $|key 1| = value1
    $||key1|key2|| = value2    # The key is key1|key2
    X = $|key 1|               # Define X to be the value of field $|key 1|

The usual modifiers are also allowed. The expression $`|key| represents lazy evaluation of the key, and $,|key| is normal evaluation.

12.1.3  Number

Parent objects: Object.

The Number object is the parent object for integers and floating-point numbers.

12.1.4  Int

Parent objects: Number.

The Int object represents integer values.

12.1.5  Float

Parent objects: Number.

The Float object represents floating-point numbers.

12.1.6  Sequence

Parent objects: Object.

The Sequence object represents a generic object containing sequential elements. It provides the following methods.

12.1.7  Array

Parent objects: Sequence.

The Array is a random-access sequence. It provides the following additional methods.

12.1.8  String

Parent objects: Array.

12.1.9  Fun

Parent objects: Object.

The Fun object provides the following methods.

12.1.10  Rule

Parent objects: Object.

The Rule object represents a build rule. It does not currently have any methods.

12.1.11  Target

Parent object: Object.

The Target object contains information collected for a specific target file.

The object supports the following methods.

NOTE: the information for a target is constructed dynamically, so it is possible that the Target object for a node will contain different values in different contexts. The easiest way to make sure that the Target information is complete is to compute it within a rule body, where the rule depends on the target file, or the dependencies of the target file.

12.1.12  Node

Parent objects: Object.

The Node object is the parent object for files and directories. It supports the following operations.

12.1.13  File

Parent objects: Node.

The file object represents the name of a file.

12.1.14  Dir

Parent objects: Node.

The Dir object represents the name of a directory.

12.1.15  Channel

Parent objects: Object.

A Channel is a generic IO channel. It provides the following methods.

12.1.16  InChannel

Parent objects: Channel.

A InChannel is an input channel. The variable stdin is the standard input channel.

It provides the following methods.

12.1.17  OutChannel

Parent object: Channel.

A OutChannel is an output channel. The variables stdout and stderr are the standard output and error channels.

It provides the following methods.

12.1.18  Location

Parent objects: Location.

The Location object represents a location in a file.

12.1.19  Exception

Parent objects: Object.

The Exception object is used as the base object for exceptions. It has no fields.

12.1.20  RuntimeException

Parent objects: Exception.

The RuntimeException object represents an exception from the runtime system. It has the following fields.

12.1.21  UnbuildableException

Parent objects: Exception.

The UnbuildableException object should be used to signal that a target is not buildable. It will be caught by functions such as target-exists. This exception has the following fields:

12.1.22  Shell

Parent objects: Object.

The Shell object contains the collection of builtin functions available as shell commands.

You can define aliases by extending this object with additional methods. All methods in this class are called with one argument: a single array containing an argument list.

Jump to:  OMake Home • Guide Home • Guide (single-page) • Contents (short) • Contents (long)
Index:  All • Variables • Functions • Objects • Targets • Options