From ad547a6b5986815fda458221149728d9d9ab1d87 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 25 Feb 2021 19:22:25 +0000 Subject: restore Build,TODO from r57911 git-svn-id: svn://tug.org/texlive/trunk@57915 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/asymptote/genv.h | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Build/source/utils/asymptote/genv.h (limited to 'Build/source/utils/asymptote/genv.h') diff --git a/Build/source/utils/asymptote/genv.h b/Build/source/utils/asymptote/genv.h new file mode 100644 index 00000000000..014896e3e26 --- /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 : public gc { + // The initializer functions for imports, indexed by filename. + typedef mem::map importMap; + importMap imap; + + // List of modules in translation. Used to detect and prevent infinite + // recursion in loading modules. + mem::list 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 -- cgit v1.2.3