| iMatix home page
| << | < | > | >>
SMT Logo SMT
Version 2.81

 

agent_lookup

#include "smtlib.h"
AGENT *
agent_lookup (
    const char *agent_name              /*  Name of agent to look for        */
)

Synopsis

Checks whether a specific agent exists; returns the address of the agent information block, or NULL if there was an error, setting smt_errno to one of these values:
SMT NOTREADY smt_init() was not called, or failed
SMT NOSUCHAGENT Specified agent was not declared

Source Code - (smtlib.c)

{
    SYMBOL  *dict_entry;                /*  Dictionary symbol                */

#if (defined (SMT_TRACE))
    trace ("agent_lookup: agent=%s", agent_name);
#endif
    if (!smt_alive)                     /*  If SMT API was not correctly     */
      {                                 /*    initialised, forget it         */
        smt_errno = SMT_NOTREADY;
        return (NULL);
      }

    dict_entry = sym_lookup_symbol (dict, get_entity_name (agent_name, NULL));
    if (dict_entry == NULL)
      {
         smt_errno = SMT_NOSUCHAGENT;
         return (NULL);
      }
    return (dict_entry-> data);         /*  Return pointer to AGENT          */
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation