Esempio n. 1
0
void InternalUse(LispEnvironment& aEnvironment, const std::string& aFileName)
{
    LispDefFile* def = aEnvironment.DefFiles().File(aFileName);
    if (!def->IsLoaded())
    {
        def->SetLoaded();

        for (const LispString* s: def->symbols)
            aEnvironment.UnProtect(s);

        InternalLoad(aEnvironment,aFileName);

        for (const LispString* s: def->symbols)
            aEnvironment.Protect(s);
    }
}
Esempio n. 2
0
void LoadDefFile(LispEnvironment& aEnvironment, const std::string& aFileName)
{
  const std::string flatfile = InternalUnstringify(aFileName) + ".def";
  LispDefFile* def = aEnvironment.DefFiles().File(aFileName);

  InputStatus oldstatus = aEnvironment.iInputStatus;
  aEnvironment.iInputStatus.SetTo(flatfile);

  LispLocalFile localFP(aEnvironment, flatfile, true,
                        aEnvironment.iInputDirectories);
  if (!localFP.stream.is_open())
    throw LispErrFileNotFound();

  StdFileInput newInput(localFP,aEnvironment.iInputStatus);
  DoLoadDefFile(aEnvironment, &newInput,def);

  aEnvironment.iInputStatus.RestoreFrom(oldstatus);
}