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

 

method_lookup

#include "smtlib.h"
METHOD *
method_lookup (
    const AGENT *agent,                 /*  Agent to look at                 */
    const char *method_name             /*  Name of method to look for       */
)

Synopsis

Checks whether a specific method exists; returns the address of the method 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 NOSUCHMETHOD Specified method was not declared

Source Code - (smtlib.c)

{
    SYMBOL  *dict_entry;                /*  Dictionary symbol                */
    char    *full_name;                 /*  Full agent/method name           */

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

    full_name  = get_method_name (agent-> name, method_name);
    dict_entry = sym_lookup_symbol (dict, full_name);
    if (dict_entry == NULL)
      {
         smt_errno = SMT_NOSUCHMETHOD;
         return (NULL);
      }
    return (dict_entry-> data);         /*  Return pointer to METHOD         */
}

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