Beispiel #1
0
bool InstanceConfig :: load(path_t path, Templates* templates)
{
   IniConfigFile config;
   if (_ELENA_::emptystr(path) || !config.load(path, feUTF8)) {
      return false;
   }

   if (templates != NULL) {
      // load template
      IdentifierString projectTemplate(config.getSetting(PROJECT_CATEGORY, PROJECT_TEMPLATE));

      if (!_ELENA_::emptystr(projectTemplate)) {
         Path templatePath;
         Path::loadPath(templatePath, templates->get(projectTemplate));

         load(templatePath, templates);
      }
   }

   _ELENA_::Path configPath;
   configPath.copySubPath(path);

   // init config
   init(configPath, config);

   return true;
}
Beispiel #2
0
// === Main Program ===
int main(int argc, char* argv[])
{
	printf("ELENA command line ByteCode Viewer %d.%d.%d (C)2012-2013 by Alexei Rakov\n\n", ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION, BUILD_VERSION);

   if (argc<2) {
      printf("ecv <module name> | ecv -p<module path>");
      return 0;
   }

   // prepare library manager
   const char* configPath = "elc.cfg";
   const char* rootPath = NULL;

   // get viewing module name
   IdentifierString moduleName(argv[1]);

   // load config attributes
   IniConfigFile config;
   if (config.load(Path(configPath), feUTF8)) {
      rootPath = config.getSetting(PROJECT_SECTION, ROOTPATH_OPTION, rootPath);
   }

   LibraryManager loader(Path(rootPath), NULL);
   LoadResult result = lrNotFound;
   _Module* module = NULL;

   // if direct path is provieded
   if (moduleName[0]=='-' && moduleName[1]=='p') {
      moduleName = moduleName + 2;

      Path     path;
      path.copyPath(moduleName);

      FileName name(moduleName);

      loader.setPackage(name, path);
      module = loader.loadModule(name, result, false);
   }
   else module = loader.loadModule(moduleName, result, false);

   if (result != lrSuccessful) {
      printLoadError(result);

      return -1;
   }
   else wprintf(_T("%s module loaded\n"), (const wchar16_t*)moduleName);

   loadVerbs(_verbs);

   runSession(module);

   if (_writer)
      freeobj(_writer);

   return 0;
}
Beispiel #3
0
void InstanceConfig :: init(path_t configPath, IniConfigFile& config)
{
   // compiler options
   //maxThread = config.getIntSetting(SYSTEM_CATEGORY, SYSTEM_MAXTHREAD, maxThread);
   mgSize = config.getIntSetting(LINKER_CATEGORY, LINKER_MGSIZE, mgSize);
   ygSize = config.getIntSetting(LINKER_CATEGORY, LINKER_YGSIZE, ygSize);
   objSize = config.getIntSetting(LINKER_CATEGORY, LINKER_OBJSIZE, objSize);

   const char* path = config.getSetting(LIBRARY_CATEGORY, LIBRARY_PATH, NULL);
   if (!emptystr(path)) {
      libPath.copy(configPath);
      Path::combinePath(libPath, path);
   }

   loadList(config, PRIMITIVE_CATEGORY, configPath, &primitives);
   loadForwardList(config);
}