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

 

smtoper_init

#include "smtdefn.h"
int
smtoper_init (void)

Synopsis

Initialises the SMT operator agent. Returns 0 if initialised okay, -1 if there was an error. The operator agent writes messages to the standard error device. More sophisticated implementations could send messages to consoles. Creates one unnamed thread automatically. Supports these public methods:
ERROR Handle event as a serious error message.
WARNING Handle event as a warning message.
INFO Handle event as an information message.
SET LOG Send all output to specified thread.
DISABLE Console ignores all messages.
ENABLE Console handles messages (default).
Does not send reply events.

Source Code - (smtoper.c)

{
    AGENT   *agent;                     /*  Handle for our agent             */
    THREAD  *thread;                    /*  Handle for initial thread        */

#   include "smtoper.i"                 /*  Include dialog interpreter       */

    /*  We give this agent a high priority, so that we get to see messages   */
    /*  and errors as soon as possible.                                      */
    agent-> priority = SMT_PRIORITY_HIGH;

    /*                      Method name     Event value      Priority        */
    /*  Shutdown event comes from Kernel, normal priority so we can show     */
    /*  incoming messages before we shut down.                               */
    method declare (agent, "SHUTDOWN",      shutdown_event,  0);

    /*  Public methods supported by this agent                               */
    method declare (agent, "SET_LOG",       log_event,       0);
    method declare (agent, "ERROR",         error_event,     0);
    method declare (agent, "WARNING",       warning_event,   0);
    method declare (agent, "INFO",          info_event,      0);
    method declare (agent, "DISABLE",       disable_event,   0);
    method declare (agent, "ENABLE",        enable_event,    0);

    /*  Create initial, unnamed thread                                       */
    thread = thread create (AGENT_NAME, "");
    smt set console (&thread-> queue-> qid);

    /*  Signal okay to caller that we initialised okay                       */
    return (0);
}

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