return (((void *)0));
}
+extern char * __ecereNameSpace__ecere__sys__GetLastDirectory(char * string, char * output);
+
+extern char * __ecereNameSpace__ecere__sys__GetExtension(char * string, char * output);
+
+extern unsigned int __ecereNameSpace__ecere__sys__StripExtension(char * string);
+
+extern int strcasecmp(const char * , const char * );
+
static struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__com__Module_Load(struct __ecereNameSpace__ecere__com__Instance * fromModule, char * name, int importAccess, unsigned int ensureCOM)
{
unsigned int (stdcall * Load)(struct __ecereNameSpace__ecere__com__Instance * module) = (((void *)0));
module = (struct __ecereNameSpace__ecere__com__Instance *)__ecereNameSpace__ecere__com__eInstance_New(__ecereNameSpace__ecere__com__eSystem_FindClass(fromModule, "Module"));
((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)fromModule + structSize_Instance)))->application;
((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->library = library;
-((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->name = __ecereNameSpace__ecere__sys__CopyString(name);
+{
+char moduleName[274];
+char ext[17];
+
+__ecereNameSpace__ecere__sys__GetLastDirectory(name, moduleName);
+__ecereNameSpace__ecere__sys__GetExtension(moduleName, ext);
+__ecereNameSpace__ecere__sys__StripExtension(moduleName);
+if((!(strcasecmp)(ext, "dylib") || !(strcasecmp)(ext, "so")) && strstr(moduleName, "lib") == moduleName)
+{
+int len = strlen(moduleName) - 3;
+
+memmove(moduleName, moduleName + 3, len);
+moduleName[len] = (char)0;
+}
+((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->name = __ecereNameSpace__ecere__sys__CopyString(moduleName);
+}
((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->Unload = Unload;
((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->origImportType = 0;
if(!Load(module))
void ImportModule(char * name, int importType, int importAccess, unsigned int loadDllOnly)
{
struct ImportedModule * module = (((void *)0));
-char moduleName[274];
+char moduleName[797];
-strncpy(moduleName, name, (274) - 1);
-moduleName[(274) - 1] = (char)0;
+strncpy(moduleName, name, (797) - 1);
+moduleName[(797) - 1] = (char)0;
__ecereNameSpace__ecere__sys__StripExtension(moduleName);
for(module = (*defines).first; module; module = module->next)
{
strcpy(symFile, symbolsDir ? symbolsDir : "");
__ecereNameSpace__ecere__sys__PathCat(symFile, name);
__ecereNameSpace__ecere__sys__ChangeExtension(symFile, "sym", symFile);
-if(!strcmp(ext, "dll") || !strcmp(ext, "dll") || !ext[0])
+if(!strcmp(ext, "dll") || !strcmp(ext, "so") || !strcmp(ext, "dylib") || !ext[0])
{
if(importType != 4)
{
{
unsigned int skipLoad = 0x0;
struct __ecereNameSpace__ecere__com__Instance * list = (((void *)0));
-char file[274];
-strcpy(file, name);
-__ecereNameSpace__ecere__sys__StripExtension(file);
if(!inCompiler && !inPreCompiler && !inSymbolGen)
{
struct __ecereNameSpace__ecere__com__MapIterator it = (it.container = (void *)0, it.pointer = (void *)0, __ecereProp___ecereNameSpace__ecere__com__MapIterator_Set_map(&it, loadedModules), it);
-if(!__ecereMethod___ecereNameSpace__ecere__com__Iterator_Index(&it, (uint64)(file), 0x0))
+if(!__ecereMethod___ecereNameSpace__ecere__com__Iterator_Index(&it, (uint64)(name), 0x0))
{
-struct __ecereNameSpace__ecere__com__Instance * firstModule = __ecereNameSpace__ecere__com__eModule_LoadStrict(((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application, file, importAccess);
+struct __ecereNameSpace__ecere__com__Instance * firstModule = __ecereNameSpace__ecere__com__eModule_LoadStrict(((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application, name, importAccess);
if(firstModule)
{
loadedModules, 0
};
-__ecereMethod___ecereNameSpace__ecere__com__Iterator_Index(&__internalIterator, (uint64)(((uint64)(file))), 0x1);
+__ecereMethod___ecereNameSpace__ecere__com__Iterator_Index(&__internalIterator, (uint64)(((uint64)(name))), 0x1);
__ecereProp___ecereNameSpace__ecere__com__Iterator_Set_data(&__internalIterator, list);
});
}
}
if(!skipLoad)
{
-loadedModule = __ecereNameSpace__ecere__com__eModule_LoadStrict(privateModule, file, importAccess);
+loadedModule = __ecereNameSpace__ecere__com__eModule_LoadStrict(privateModule, name, importAccess);
if(loadedModule)
{
((struct __ecereNameSpace__ecere__com__Module *)(((char *)loadedModule + structSize_Instance)))->importType = importType;
public void ImportModule(char * name, ImportType importType, AccessMode importAccess, bool loadDllOnly)
{
ImportedModule module = null;
- char moduleName[MAX_FILENAME];
+ char moduleName[MAX_LOCATION];
- strncpy(moduleName, name, MAX_FILENAME-1);
- moduleName[MAX_FILENAME-1] = 0;
+ strncpy(moduleName, name, MAX_LOCATION-1);
+ moduleName[MAX_LOCATION-1] = 0;
StripExtension(moduleName);
for(module = defines->first; module; module = module.next)
PathCat(symFile, name);
ChangeExtension(symFile, "sym", symFile);
- if(!strcmp(ext, "dll") || !strcmp(ext, "dll") || !ext[0])
+ if(!strcmp(ext, "dll") || !strcmp(ext, "so") || !strcmp(ext, "dylib") || !ext[0])
{
if(importType != comCheckImport)
{
{
bool skipLoad = false;
List<Module> list = null;
-
- char file[MAX_FILENAME];
+ /*
+ char file[MAX_LOCATION];
strcpy(file, name);
StripExtension(file);
+ */
// Load an extra instance of any shared module to ensure freeing up a
// module loaded in another file will not invalidate our objects.
if(!inCompiler && !inPreCompiler && !inSymbolGen)
{
MapIterator<String, List<Module> > it { map = loadedModules };
- if(!it.Index(file, false))
+ if(!it.Index(name /*file*/, false))
{
- Module firstModule = eModule_LoadStrict(__thisModule.application, file, importAccess);
+ Module firstModule = eModule_LoadStrict(__thisModule.application, name /*file*/, importAccess);
if(firstModule)
{
list = { };
list.Add(firstModule);
- loadedModules[file] = list;
+ loadedModules[name /*file*/] = list;
}
else
skipLoad = true;
if(!skipLoad)
{
- loadedModule = eModule_LoadStrict(privateModule, file, importAccess);
+ loadedModule = eModule_LoadStrict(privateModule, name /*file*/, importAccess);
if(loadedModule)
{
loadedModule.importType = importType;
import "IDESettings"
import "SettingsDialog"
+uint64 strtoull(const char * nptr, char ** endptr, int base);
+
static Context globalContext { };
static OldList defines { };
static OldList imports { };
char nsName[1024], temp[1024];
NameSpace * ns;
BTNamedLink link;
- uint tag;
+ int64 tag;
nsName[0] = 0;
ns = nameSpace;
if(nsName[0])
{
f.Printf("<FONT FACE=\"Arial\" SIZE=\"6\">%s</FONT><br><br>\n", nsName );
- tag = (uint)nameSpace;
+ tag = (int64)nameSpace;
f.Printf($"Module: <a href=\"api://%p\" style=\"text-decoration: none;\">%s</a><br>\n", (module && module.name) ? module : null, (!module || !module.name || !strcmp(nsName, "ecere::com")) ? "ecereCOM" : module.name);
}
else
{
- tag = (uint)((!module || !module.name || !strcmp(nsName, "ecere::com") ? null : module));
+ tag = (int64)(!module || !module.name || !strcmp(nsName, "ecere::com") ? null : module);
f.Printf($"<FONT FACE=\"Arial\" SIZE=\"6\">Module %s</FONT><br>\n", (!module || !module.name || !strcmp(nsName, "ecere::com")) ? "ecereCOM" : module.name);
}
ImportModule(filePath, normalImport, publicAccess, false);
- if(extension[0] && strcmpi(extension, "so") && strcmpi(extension, "dll"))
+ if(extension[0] && strcmpi(extension, "so") && strcmpi(extension, "dll") && strcmpi(extension, "dylib"))
componentsApp.name = CopyString(filePath);
for(module = componentsApp.allModules.first; module; module = module.next)
eModule_LoadStrict(componentsApp, "ecereCOM", publicAccess /*privateAccess*/);
AddComponents(componentsApp, false);
- // lib prefix and extension get removed by ImportModule
+ GetLastDirectory(filePath, moduleName);
+ // Extension, path and lib prefix get removed in Module::name
if(extension[0])
{
- char name[MAX_FILENAME];
- GetLastDirectory(filePath, name);
- StripLastDirectory(filePath, moduleName);
- StripExtension(name);
- if((!strcmpi(extension, "so") || !strcmpi(extension, "dylib")) && strstr(name, "lib") == name)
- memmove(name, name + 3, strlen(name)-3);
- PathCat(moduleName, name);
+ StripExtension(moduleName);
+ if((!strcmpi(extension, "so") || !strcmpi(extension, "dylib")) && strstr(moduleName, "lib") == moduleName)
+ {
+ int len = strlen(moduleName) - 3;
+ memmove(moduleName, moduleName + 3, len);
+ moduleName[len] = 0;
+ }
}
- else
- strcpy(moduleName, filePath);
for(module = componentsApp.allModules.first; module; module = module.next)
{
NameSpace * ns = page ? page.GetNameSpace() : null;
sprintf(docFile, "%s/%s.eCdoc", settings.docDir, (!module || !module.name || (ns && ns->name && !strcmp(ns->name, "namespaces/ecere/namespaces/com"))) ? "ecereCOM" : module.name);
- if(strchr(docFile, DIR_SEP))
- {
- char temp[MAX_LOCATION];
- GetLastDirectory(docFile, temp);
- strcpy(docFile, temp);
- }
-
if(FileExists(docFile))
{
archive = ArchiveOpen(docFile, { true } );
{
if(!strncmp(href, "api://", 6))
{
- int tag = (uint)strtoul(href + 6, null, 16);
+ int64 tag = (int64)strtoull(href + 6, null, 16);
DataRow row = mainForm.browser.FindSubRow(tag);
if(row)
{
FreeLibrary(library);
}
#elif defined(__unix__) || defined(__APPLE__)
- if(libLocation)
- strcpy(fileName, libLocation);
+ if(libLocation || strchr(name, '/'))
+ strcpy(fileName, libLocation ? libLocation : "");
else
strcpy(fileName, "lib");
strcat(fileName, name);
dlclose(library);
}
#elif defined(__APPLE__)
- strcpy(fileName, "lib");
+ if(libLocation || strchr(name, '/'))
+ strcpy(fileName, libLocation ? libLocation : "");
+ else
+ strcpy(fileName, "lib");
strcat(fileName, name);
GetExtension(fileName, extension);
if(!extension[0])
module = (Module)eInstance_New(eSystem_FindClass(fromModule, "Module"));
module.application = fromModule.application;
module.library = library;
- module.name = CopyString(name);
+ {
+ char moduleName[MAX_FILENAME];
+ char ext[MAX_EXTENSION];
+ GetLastDirectory(name, moduleName);
+ GetExtension(moduleName, ext);
+ StripExtension(moduleName);
+ if((!strcmpi(ext, "dylib") || !strcmpi(ext, "so")) && strstr(moduleName, "lib") == moduleName)
+ {
+ int len = strlen(moduleName) - 3;
+ memmove(moduleName, moduleName + 3, len);
+ moduleName[len] = 0;
+ }
+ module.name = CopyString(moduleName);
+ }
module.Unload = Unload;
module.origImportType = normalImport;