"Fossies" - the Fresh Open Source Software Archive

Member "asymptote-2.60/genv.h" (6 Nov 2019, 1626 Bytes) of package /linux/misc/asymptote-2.60.src.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "genv.h" see the Fossies "Dox" file reference documentation.

    1 /*****
    2  * genv.h
    3  * Andy Hammerlindl 2002/08/29
    4  *
    5  * This is the global environment for the translation of programs.  In
    6  * actuality, it is basically a module manager.  When a module is
    7  * requested, it looks for the corresponding filename, and if found,
    8  * parses and translates the file, returning the resultant module.
    9  *
   10  * genv sets up the basic type bindings and function bindings for
   11  * builtin functions, casts and operators, and imports plain (if set),
   12  * but all other initialization, is done by the local environmet defined
   13  * in env.h.
   14  *****/
   15 
   16 #ifndef GENV_H
   17 #define GENV_H
   18 
   19 #include "common.h"
   20 #include "table.h"
   21 #include "record.h"
   22 #include "absyn.h"
   23 #include "access.h"
   24 #include "coenv.h"
   25 #include "stack.h"
   26 
   27 using types::record;
   28 using vm::lambda;
   29 
   30 namespace trans {
   31 
   32 class genv : public gc {
   33   // The initializer functions for imports, indexed by filename.
   34   typedef mem::map<CONST string,record *> importMap;
   35   importMap imap;
   36 
   37   // List of modules in translation.  Used to detect and prevent infinite
   38   // recursion in loading modules.
   39   mem::list<string> inTranslation;
   40 
   41   // Checks for recursion in loading, reporting an error and throwing an
   42   // exception if it occurs.
   43   void checkRecursion(string filename);
   44 
   45   // Translate a module to build the record type.
   46   record *loadModule(symbol name, string s);
   47 
   48 public:
   49   genv();
   50 
   51   // Get an imported module, translating if necessary.
   52   record *getModule(symbol name, string s);
   53 
   54   // Uses the filename->record map to build a filename->initializer map to be
   55   // used at runtime.
   56   vm::stack::importInitMap *getInitMap();
   57 };
   58 
   59 } // namespace trans
   60 
   61 #endif