Registry

The registry is a sequence of named entries, each of which contains an ordered list of key/value pairs. The entry name and all keys and values are strings. See the user manual for a description of the registry. The registry is a raylib database that is not related to other registries found on Unix and Windows NT, unless raylib is built into an application that provides a connection. In this case, the eval and lookup functions can access the system registry through this connection, but all begin/add/end definitions stay local to raylib and do not write to the system registry. No such connection is built into standalone versions of mental ray.

mi_api_registry_begin
miBoolean mi_api_registry_begin(
    char              *regname)

Begin the definition of a new registry entry with the given name. The name must begin with { and end with }. It can later be looked up with mi_api_registry_eval and mi_api_registry_lookup. If the registry entry already existed, it is deleted along with all its key/value pairs and a new entry of the same name is created.

mi_api_registry_add
miBoolean mi_api_registry_add(
    char              *key,
    char              *value)

After beginning a registry entry with the previous function, key/value pairs can be associated with the registry entry using this function. The key and value arguments are unrestricted, but the eval and lookup functions assign special meaning to certain keys.

mi_api_registry_end
miBoolean mi_api_registry_end(void)

Completes the definition of a registry entry begun with mi_api_registry_begin. Calls to mi_api_registry_add are allowed only between begin and end, and no eval. The eval and lookup functions may be used between begin and end, and they will see partially built registry entries.

mi_api_registry_eval
const char *mi_api_registry_eval(
    char              *regname)

Scan the string regname for substrings enclosed in curly braces { }. If the substring begins with a dollar sign, an environment lookup is performed using getenv; otherwise the registry is searched for the given name and, if found, the value associated with its value key is substituted. All characters not encodes in curly braces are passed through unchanged. If a registry lookup is successful, all its known keys are evaluated:

value The substituted string.
link The name of a shared library or object (typically a shader library) to load.
code The name of a source code file to compile and load.
mi The name of a .mi scene file (typically containing shader declarations) to read and parse.
echo A string to echo on the console, if the verbosity allows it.
system A shell command to execute.

If the value of any key found in this way contains curly braces, it is evaluated in the same manner recursively. The final substituted regname string is returned as allocated memory that must be released with mi_mem_release by the caller. This function implements the .mi $lookup command.

mi_api_registry_lookup
const char *mi_api_registry_lookup(
    char              *regname)

This function is equivalent to mi_api_registry_eval, except that only the value associated with the value key is returned, and no other keys are evaluated.

Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.