|
FAUST compiler
0.9.9.6b8
|
#include "environment.hh"#include "errormsg.hh"#include "boxes.hh"#include "ppbox.hh"#include "names.hh"
Go to the source code of this file.
Functions | |
| static Tree | pushNewLayer (Tree lenv) |
| Push a new (unique) empty layer (where multiple definitions can be stored) on top of an existing environment. More... | |
| Tree | pushEnvBarrier (Tree lenv) |
| bool | isEnvBarrier (Tree lenv) |
| Test if the environment is a barrier (or nil) so that searchIdDef will know where to stop when searching an environment. More... | |
| static void | addLayerDef (Tree id, Tree def, Tree lenv) |
| Add a definition (as a property) to the current top level layer. More... | |
| Tree | pushValueDef (Tree id, Tree def, Tree lenv) |
| Push a new layer and add a single definition. More... | |
| Tree | pushMultiClosureDefs (Tree ldefs, Tree visited, Tree lenv) |
| Push a new layer with multiple definitions creating the appropriate closures. More... | |
| bool | searchIdDef (Tree id, Tree &def, Tree lenv) |
| Search the environment (until first barrier) for the definition of a symbol ID and return it. More... | |
| static void | updateClosures (vector< Tree > &clos, Tree oldEnv, Tree newEnv) |
| Replace closure that point to oldEnv with closure on newEnv. More... | |
| Tree | copyEnvReplaceDefs (Tree anEnv, Tree ldefs, Tree visited, Tree curEnv) |
| Create a new environment by copying an existing one and replacing some definitions. More... | |
Variables | |
| Sym | BARRIER = symbol ("BARRIER") |
| Push a new environment barrier on top of an existing environment so that searchIdDef (used by the pattern matcher) will not look after the barrier. More... | |
Add a definition (as a property) to the current top level layer.
Check and warn for multiple definitions.
| id | the symbol id to be defined |
| def | the definition to be binded to the symbol id |
| lenv | the environment where to add this new definition |
Definition at line 69 of file environment.cpp.
References evalwarning(), gErrorCount, getDefFileProp(), getDefLineProp(), getProperty(), print(), and setProperty().
Referenced by pushMultiClosureDefs(), and pushValueDef().


Create a new environment by copying an existing one and replacing some definitions.
| xenv | existing environment we will copy |
| ldefs | list of pairs (symbol id x definition) that will replace old definitions |
| visited | set of visited symbols (used for recursive definition detection) |
| lenv | the current environment to evaluate the definitions |
Definition at line 169 of file environment.cpp.
References CTree::branch(), closure(), CTree::exportProperties(), hd(), isBoxCase(), isNil(), nil, pushNewLayer(), setDefNameProperty(), setProperty(), tl(), and updateClosures().
Referenced by realeval().


| bool isEnvBarrier | ( | Tree | lenv | ) |
Test if the environment is a barrier (or nil) so that searchIdDef will know where to stop when searching an environment.
| lenv | the environment to test |
Definition at line 56 of file environment.cpp.
References isNil(), and CTree::node().
Referenced by searchIdDef().


Definition at line 43 of file environment.cpp.
References tree().
Referenced by evalCase().


Push a new layer with multiple definitions creating the appropriate closures.
| ldefs | list of pairs (symbol id x definition) to be binded to the symbol id |
| visited | set of visited symbols (used for recursive definition detection) |
| lenv | the environment where to push the layer and add all the definitions |
Definition at line 109 of file environment.cpp.
References addLayerDef(), closure(), hd(), isBoxCase(), isNil(), nil, pushNewLayer(), setDefNameProperty(), and tl().
Referenced by evaldocexpr(), evalprocess(), and realeval().


Push a new (unique) empty layer (where multiple definitions can be stored) on top of an existing environment.
| lenv | the old environment |
Definition at line 26 of file environment.cpp.
References tree(), and unique().
Referenced by copyEnvReplaceDefs(), pushMultiClosureDefs(), and pushValueDef().


Push a new layer and add a single definition.
| id | the symbol id to be defined |
| def | the definition to be binded to the symbol id |
| lenv | the environment where to push the layer and add the definition |
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().


Search the environment (until first barrier) for the definition of a symbol ID and return it.
Used by the pattern matcher.
| id | the symbol ID to search |
| def | where to store the definition if any |
| lenv | the environment |
Definition at line 135 of file environment.cpp.
References CTree::branch(), getProperty(), and isEnvBarrier().
Referenced by apply_pattern_matcher().


Replace closure that point to oldEnv with closure on newEnv.
Definition at line 149 of file environment.cpp.
References closure(), and isClosure().
Referenced by copyEnvReplaceDefs().


Push a new environment barrier on top of an existing environment so that searchIdDef (used by the pattern matcher) will not look after the barrier.
This barrier will not any influence on regular environment lookup.
| lenv | the old environment |
Definition at line 41 of file environment.cpp.
1.8.7