Command: atable  

Syntax

atable <name>{,<file>}

Description

Create and/or load an application identifier table.

Parameters

Switches

Notes

All identifier table identifiers have global scope.

Identifier table contents may be block saved to a .ata file via the unload command.

For reasons of file-persistent data, there is a limit of 4080 atables available in a session.

Callbacks

When loading an atable from a .ata file, 2 procedures (pre_load and post_load) can be defined to be executed before and after the load. These must be defined and saved with the .ata file.

The pre_load procedure is often used to test for the presence of environment variables, or other atables on which the new atable depends, and to abort the load if they are missing. New identifiers cannot be defined for the new atable within this procedure.

The post_load procedure is often used to add new or customize existing identifiers in the atable.

For both callbacks, 2 parameters are passed: the atable and file name being loaded. If an abort of the load is required then the atable can be deleted within either callback, and the atable will consequently not be created.

Typical examples:

atable mytable
procedure ~myatable.pre_load = {
   args at=atable,fname=string
# Abort if an environment variable has not been set
   unless (envval(IMAGEDIR) && fexist($IMAGEDIR)) {
      tell err,'IMAGEDIR has not been defined correctly'
      bell
      delid at
   }
# Abort if an atable is not present
   unless (exist(youratable)) {
      tell err,'youratable has not been loaded'
      bell
      delid at
   }
# Add the the atable to the search path
   at.search_path = youratable
}
procedure ~myatable.post_load = { 
   args at=atable,fname=string
# Remember the current time
   time ~at.load_time = now
}
unload myatable,mytable.ata

Note: Empty versions of these callbacks are not present by default, so they must be declared in the above manner if required.

Examples

1. Create an empty application identifier table, and add a numeric identifier to it.

atable mytable
numeric ~mytable.x=5

2. Block load an atable from file, overwriting it if it already exists.

atable ductwork, @duct/duct.ata, -ov

See Also

Commands:

delid, unload

Identifiers:

scope (atable)

Structures:

atable_struct