atable <name>{,<file>}
Create and/or load an application identifier table.
<name>
The name of the atable identifier.
<file>
A file containing identifier table contents to be read. The default
file extension is .ata.
If <file> is omitted, the identifier table <name> is initialized to empty.
-full
Set the access for the atable to "open to all". Without this
switch, the access permission for the atable (atable.access)
is set to "g:r--,w:---",
and the default access permission for identifiers within the atable is
set to "g:r-x,w:---".
With this switch, both access and default access permission are set to
"g:rwx,w:rwx",
i.e. open access to all. If any permissions different to the above are
required they should be set individually after atable creation. e.g.
mytab.access = 'g:rx-,w:rx-'.
-ov
Overwrite the atable if it already exists.
The default action if <name>
already exists, is to produce an error.
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.
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 mytableprocedure ~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.
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
Commands: |
|
Identifiers: |
scope (atable) |
Structures: |