summaryrefslogtreecommitdiff
path: root/graphics/asymptote/genv.cc
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/asymptote/genv.cc')
-rw-r--r--graphics/asymptote/genv.cc41
1 files changed, 21 insertions, 20 deletions
diff --git a/graphics/asymptote/genv.cc b/graphics/asymptote/genv.cc
index fe8e1b5cab..65e132ef56 100644
--- a/graphics/asymptote/genv.cc
+++ b/graphics/asymptote/genv.cc
@@ -32,7 +32,6 @@
using namespace types;
using settings::getSetting;
using settings::Setting;
-using vm::importIndex_t;
// Dynamic loading of external libraries.
types::record *transExternalModule(
@@ -46,7 +45,7 @@ genv::genv()
{
// Add settings as a module. This is so that the init file ~/.asy/config.asy
// can set settings.
- imap[importIndex_t("settings","")]=settings::getSettingsModule();
+ imap[symbol::literalTrans("settings")]=settings::getSettingsModule();
// Translate plain in advance, if we're using autoplain.
if(getSetting<bool>("autoplain")) {
@@ -58,7 +57,7 @@ genv::genv()
Setting("autoplain")=true;
}
#ifdef HAVE_LIBGSL
- imap[importIndex_t("gsl","")]=trans::getGSLModule();
+ imap[symbol::literalTrans("gsl")]=trans::getGSLModule();
#endif
}
@@ -93,7 +92,7 @@ record *genv::loadTemplatedModule(
symbol id,
string filename,
mem::vector<absyntax::namedTyEntry*> *args,
- trans::frame *parent
+ coenv& e
) {
// Hackish way to load an external library.
#if 0
@@ -109,7 +108,7 @@ record *genv::loadTemplatedModule(
em.sync();
- record *r=ast->transAsTemplatedFile(*this, id, args, parent);
+ record *r=ast->transAsTemplatedFile(*this, id, args, e);
inTranslation.remove(filename);
@@ -130,46 +129,48 @@ void genv::checkRecursion(string filename) {
record *genv::getModule(symbol id, string filename) {
checkRecursion(filename);
- importIndex_t Index(filename,"");
- record *r=imap[Index];
+ symbol index=symbol::literalTrans(filename);
+ record *r=imap[index];
if (r)
return r;
else {
record *r=loadModule(id, filename);
// Don't add an erroneous module to the dictionary in interactive mode, as
// the user may try to load it again.
- if (!interact::interactive || !em.errors())
- imap[Index]=r;
+ if (!interact::interactive || !em.errors()) {
+ imap[index]=r;
+ }
return r;
}
}
record *genv::getTemplatedModule(
- symbol id,
+ symbol index,
string filename,
- string sigHandle,
mem::vector<absyntax::namedTyEntry*>* args,
- frame *parent
+ coenv& e
) {
checkRecursion(filename);
- importIndex_t Index(filename,sigHandle);
-
- record *r=imap[Index];
+ record *r=imap[index];
if (r)
return r;
else {
- record *r=loadTemplatedModule(id, filename, args, parent);
+ record *r=loadTemplatedModule(index, filename, args, e);
// Don't add an erroneous module to the dictionary in interactive mode, as
// the user may try to load it again.
- if (!interact::interactive || !em.errors())
- imap[Index]=r;
+ if (!interact::interactive || !em.errors()) {
+ imap[index]=r;
+ }
return r;
}
}
+record *genv::getLoadedModule(symbol id) {
+ return imap[id];
+}
typedef vm::stack::importInitMap importInitMap;
@@ -179,8 +180,8 @@ importInitMap *genv::getInitMap()
genv &ge;
initMap(genv &ge)
: ge(ge) {}
- lambda *operator[](importIndex_t s) {
- record *r=ge.imap[s];
+ lambda *operator[](string s) {
+ record *r=ge.imap[symbol::literalTrans(s)];
return r ? r->getInit() : 0;
}
};