The typex Command

The typex command is used to manage data type handler extensions. The command has the following subcommands:

typex defined

typex defined datatypename
Typex.Defined(datatypename)

A boolean check whether a specific data type is supported by a data type handler. If the format is not yet known, an attempt is made to locate and auto-load the handler module. For an equivalent command without auto-loading, see typex exists .

typex exists

typex exists datatypename
tx.exists()
Typex.Exists(datatypename)

A boolean check whether a specific data type is supported by a data type handler. No attempt is made to auto-load a handler module if it is not already in memory. The name can be the primary name of the data type, or any recognized alias. For an equivalent command with auto-loading, see typex defined .

typex get

typex get datatypename attribute
Typex.Get(datatypename,attribute)
tx.get(attribute)
tx.attribute
tx[attribute]

Query the value of an attribute of the data type handler. Note that data type handlers are static - it is neither possible to define them on the command line, nor to change any attribute. Therefore, there are no typex create or typex set commands.

The following attributes are recognized:

typex list

typex list ?pattern?
Typex.List(?pattern=?)

Return a list of all currently loaded data types, including those handled by built-in data type handlers. If desired, the list can be filtered by a string pattern.

typex load

typex load datatypename ?objectfile?
typex load all
Typex.Load(datatypename,?objectfile?)
Typex.Load(“all”)

Explicitly load a data type handler module. If the module is already loaded, the current version is unloaded first.

If no specific object file (a shared library on Unix/Linux, a DLL on Windows, a bundle file for MacOSX) is specified, the standard name of the module file is automatically generated from the data type name, and then the file searched in the directories in the data type handler module path. The module search path can be customized in the control variable ::cactvs(typexpath).

For Tcl , the return value of the command is the slot in the handler module table the module has been loaded into. This corresponds to the value of the slot attribute which can be queried via typex get . For Python , the return value is a module reference.

The magic name all instructs the program to traverse the data type extension search path and to load all data type extension modules found which are not yet loaded. In that case, the return value of the command is empty.

typex ref

Typex.Ref(datatypename)

Python -only method to get a reference of the module, which allows terser attribute retrieval commands and other operations.

typex subcommands

typex subcommands
dir(Typex)

Return a list of all subcommands of the typex command in the current interpreter.

typex unload

typex unload ?datatypename?...
tx.unload()
Typex.Unload(?txref/datatypename?,...)

Unload zero or more data type handler modules. It is an error to specify the name of a module which is not loaded. Built-in handler modules cannot be unloaded. Unloading a handler module when there is still property data of that type linked to chemical objects lead to memory leaks and/or confusing error messages when operating with these objects.

The return value is the number of unloaded modules.