FAUST compiler  0.9.9.6b8
Functions
names.hh File Reference

Interface for names management. More...

#include "tlib.hh"
#include "propagate.hh"
#include <string>
Include dependency graph for names.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool getDefNameProperty (Tree t, Tree &id)
 Indicates the identifier (if any) the expression was a definition of.
void setDefNameProperty (Tree t, Tree id)
void setDefNameProperty (Tree t, const string &name)
void setSigListNickName (Tree lsig, const string &nickname)
 set the nickname property of a list of signals.
void setSigNickname (Tree t, const string &id)
 Set the nickname property of a signal.
bool getSigNickname (Tree t, Tree &id)
 Get the nickname property of a signal.
Tree pushValueDef (Tree id, Tree def, Tree lenv)
 Push a new layer and add a single definition.
Tree simplifyPattern (Tree pattern)
 Simplify a block-diagram pattern by computing its numerical sub-expressions.

Detailed Description

Interface for names management.

Definition in file names.hh.


Function Documentation

bool getDefNameProperty ( Tree  t,
Tree id 
)

Indicates the identifier (if any) the expression was a definition of.

Parameters:
tthe expression
idreference to the identifier
Returns:
true if the expression t was a definition of id

Definition at line 85 of file names.cpp.

References getProperty().

Referenced by a2sb(), applyList(), boxSimplification(), eval(), evalIdDef(), generateDiagramSchema(), generateInputSlotSchema(), generateInsideSchema(), generateOutputSlotSchema(), legalFileName(), mapGetEqName(), real_a2sb(), and writeSchemaFile().

{
    //cerr << "getDefNameProperty of : " << t << endl;
    return getProperty(t, DEFNAMEPROPERTY, id);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool getSigNickname ( Tree  t,
Tree id 
)

Get the nickname property of a signal.

Definition at line 122 of file names.cpp.

References getProperty().

Referenced by DocCompiler::compileLateq().

{
    bool r = getProperty(t, NICKNAMEPROPERTY, id);
    return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Tree pushValueDef ( Tree  id,
Tree  def,
Tree  lenv 
)

Push a new layer and add a single definition.

Parameters:
idthe symbol id to be defined
defthe definition to be binded to the symbol id
lenvthe environment where to push the layer and add the definition
Returns:
the new environment

Definition at line 94 of file environment.cpp.

References addLayerDef(), and pushNewLayer().

Referenced by apply_pattern_matcher(), applyList(), iteratePar(), iterateProd(), iterateSeq(), iterateSum(), and real_a2sb().

{
    Tree lenv2 = pushNewLayer(lenv);
    addLayerDef(id, def, lenv2);
    return lenv2;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void setDefNameProperty ( Tree  t,
Tree  id 
)

Definition at line 54 of file names.cpp.

References setProperty().

Referenced by a2sb(), applyList(), boxSimplification(), copyEnvReplaceDefs(), eval(), pushMultiClosureDefs(), real_a2sb(), and realeval().

{
    //cerr << "setDefNameProperty : " << *id << " FOR " << t << "#" << boxpp(t) << endl;
    setProperty(t, DEFNAMEPROPERTY, id);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void setDefNameProperty ( Tree  t,
const string &  name 
)

Definition at line 60 of file names.cpp.

References gMaxNameSize, setProperty(), and tree().

{
    //cerr << "setDefNameProperty : " << name << " FOR " << t << "#" << boxpp(t) << endl;
    int     n = name.size();
    int     m = (gMaxNameSize>1023) ? 1023 : gMaxNameSize;
    if (n > m) {
        // the name is too long we reduce it to 2/3 of maxsize
        char    buf[1024];
        int i = 0;
        // copy first third
        for (; i < m/3; i++) { buf[i] = name[i]; }
        // add ...
        buf[i++] = '.';
        buf[i++] = '.';
        buf[i++] = '.';
        // copy last third
        for (int c = n-m/3; c<n; c++, i++) { buf[i] = name[c]; }
        buf[i] = 0;
        setProperty(t, DEFNAMEPROPERTY, tree(buf));
    } else {
        setProperty(t, DEFNAMEPROPERTY, tree(name.c_str()));
    }

}

Here is the call graph for this function:

void setSigListNickName ( Tree  lsig,
const string &  nickname 
)

set the nickname property of a list of signals.

If the list contains more than one signal, adds an index to the nickname

Definition at line 134 of file names.cpp.

References hd(), isList(), isNil(), setSigNickname(), subst(), T(), and tl().

{
    assert(isList(lsig));
    
    if (isNil(tl(lsig))) {
        setSigNickname(hd(lsig), nickname);
    } else {
        int     i=0;
        while (!isNil(lsig)) {
            setSigNickname(hd(lsig), subst("$0_$1", nickname, T(++i)));
            lsig = tl(lsig);
        }
    }
}

Here is the call graph for this function:

void setSigNickname ( Tree  t,
const string &  id 
)

Set the nickname property of a signal.

Definition at line 108 of file names.cpp.

References isSigFixDelay(), isZero(), setProperty(), and tree().

Referenced by setSigListNickName().

{
    Tree    s,d;
    if (isSigFixDelay(t,s,d) && isZero(d)) {
        setProperty(s, NICKNAMEPROPERTY, tree(id));
    } else {
        setProperty(t, NICKNAMEPROPERTY, tree(id));
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Simplify a block-diagram pattern by computing its numerical sub-expressions.

Parameters:
patternan evaluated block-diagram
Returns:
a simplified pattern

Definition at line 590 of file eval.cpp.

References getNumericProperty(), isBoxNumeric(), and setNumericProperty().

Referenced by apply_pattern_matcher_internal().

{
    Tree num;
    if (!getNumericProperty(value,num)) {
        if (!isBoxNumeric(value,num)) {
            num = value;
        }
        setNumericProperty(value,num);
    }
    return num;
}

Here is the call graph for this function:

Here is the caller graph for this function: