| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

sym_assume_symbol_

#include "sflsymb.h"
SYMBOL *
sym_assume_symbol_ (
    SYMTAB *table,                      /*  Symbol table to search           */
    const char *name,                   /*  Name of symbol to find/create    */
    const char *value,                  /*  Value of symbol to create        */
    const char *filename,               /*  Name of source file making call  */
    size_t      lineno)                 /*  Line number in calling source    */

Synopsis

Searches for a symbol, by name, in the specified symbol table. If the symbol does not exist, creates the symbol as specified. Returns a SYMBOL pointer to the existing or new symbol, or NULL if a new symbol could not be created. The lookup and creation follow the same rules as sym lookup symbol() and sym create symbol(). The symbol's value is set to the supplied value in all cases. Do not call this function directly; pass through the sym_assume_symbol macro.

Source Code - (sflsymb.c)

{
    SYMBOL
        *symbol;                        /*  Allocated or found symbol        */

    ASSERT (table);

    symbol = sym lookup symbol (table, name);
    if (symbol)
      {
        /*  Update the symbol value, if it has changed                       */
        if (symbol-> value && strneq (symbol-> value, value))
            sym set value (symbol, value);
      }
    else
        symbol = sym create symbol  (table, name, value, filename, lineno);

    return (symbol);
}

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