diff options
author | Karl Berry <karl@freefriends.org> | 2009-05-16 00:19:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-05-16 00:19:13 +0000 |
commit | bab45528d65eaafe68a705dbb2a57075c7b7cbd8 (patch) | |
tree | 10b4ae2b5195c8dede153ab89359ec00f55f325f /Build/source/utils/asymptote/genv.h | |
parent | 8643d90372e9c31e0f461c15c596b60a545bd7d3 (diff) |
asymptote 1.72 sources (not integrated into build yet)
git-svn-id: svn://tug.org/texlive/trunk@13110 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/genv.h')
-rw-r--r-- | Build/source/utils/asymptote/genv.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/genv.h b/Build/source/utils/asymptote/genv.h new file mode 100644 index 00000000000..051b7b6e030 --- /dev/null +++ b/Build/source/utils/asymptote/genv.h @@ -0,0 +1,61 @@ +/***** + * genv.h + * Andy Hammerlindl 2002/08/29 + * + * This is the global environment for the translation of programs. In + * actuality, it is basically a module manager. When a module is + * requested, it looks for the corresponding filename, and if found, + * parses and translates the file, returning the resultant module. + * + * genv sets up the basic type bindings and function bindings for + * builtin functions, casts and operators, and imports plain (if set), + * but all other initialization, is done by the local environmet defined + * in env.h. + *****/ + +#ifndef GENV_H +#define GENV_H + +#include "common.h" +#include "table.h" +#include "record.h" +#include "absyn.h" +#include "access.h" +#include "coenv.h" +#include "stack.h" + +using types::record; +using vm::lambda; + +namespace trans { + +class genv { + // The initializer functions for imports, indexed by filename. + typedef mem::map<CONST string,record *> importMap; + importMap imap; + + // List of modules in translation. Used to detect and prevent infinite + // recursion in loading modules. + mem::list<string> inTranslation; + + // Checks for recursion in loading, reporting an error and throwing an + // exception if it occurs. + void checkRecursion(string filename); + + // Translate a module to build the record type. + record *loadModule(symbol *name, string s); + +public: + genv(); + + // Get an imported module, translating if necessary. + record *getModule(symbol *name, string s); + + // Uses the filename->record map to build a filename->initializer map to be + // used at runtime. + vm::stack::importInitMap *getInitMap(); +}; + +} // namespace trans + +#endif |