compiler/libec: (#439) Removed unused declID from DeclClass()
[sdk] / compiler / libec / src / loadSymbols.ec
index 823d071..b6b6b48 100644 (file)
@@ -36,6 +36,8 @@ bool inPreCompiler = false;
 public void SetInPreCompiler(bool b) {inPreCompiler = b; }
 bool inSymbolGen = false;
 public void SetInSymbolGen(bool b) {inSymbolGen = b; }
+bool inDocumentor = false;
+public void SetInDocumentor(bool b) { inDocumentor = b; }
 OldList * precompDefines;
 public void SetPrecompDefines(OldList * list) { precompDefines = list; }
 
@@ -205,7 +207,7 @@ public bool LoadSymbols(const char * fileName, ImportType importType, bool loadD
                         TrimLSpaces(line, line);
 
                         if(importType == preDeclImport)
-                           DeclClass(0, name);
+                           DeclClass(name);
                         if(isStatic || loadDllOnly || importType == preDeclImport || importType == comCheckImport)
                           regClass = null;
                         else if(regClass = eSystem_FindClass(privateModule, name), !regClass || regClass.internalDecl || regClass.isRemote)
@@ -217,7 +219,7 @@ public bool LoadSymbols(const char * fileName, ImportType importType, bool loadD
                            /*if(classType != unitClass && classType != bitClass && classType != enumClass && baseName && !eSystem_FindClass(privateModule, baseName))
                            {
                               Compiler_Error($"Base class %s undefined\n", baseName);
-                              DeclClass(0, name);
+                              DeclClass(name);
                               regClass = null;
                               continue;
                            }
@@ -237,7 +239,7 @@ public bool LoadSymbols(const char * fileName, ImportType importType, bool loadD
                                     char className[1024] = "DCOMClient_";
                                     strcat(className, name);
                                     if(!existingClass)
-                                       existingClass = DeclClass(0, name);
+                                       existingClass = DeclClass(name);
                                     regClass = eSystem_RegisterClass(classType, className, baseName, 0, 0, null, null, privateModule, ecereCOMModule ? baseSystemAccess : publicAccess, inheritanceAccess);
                                  }
                                  if(regClass)
@@ -266,13 +268,11 @@ public bool LoadSymbols(const char * fileName, ImportType importType, bool loadD
                                  regClass.structSize = regClass.offset;    // THIS COULD PROBABLY BENEFIT FROM SOME EXPLANATIONS...
                               }
 
-                              // Added this
                               if(regClass && existingClass)
                               {
                                  existingClass.registered = regClass;
-                                 regClass.symbol = existingClass; // TESTING THIS
-                                 existingClass.id = MAXINT;
-                                 existingClass.idCode = MAXINT;
+                                 regClass.symbol = existingClass;
+                                 existingClass.notYetDeclared = true;
                                  existingClass.imported = true;
                                  if(regClass.module)
                                     existingClass.module = FindModule(regClass.module);
@@ -310,7 +310,7 @@ public bool LoadSymbols(const char * fileName, ImportType importType, bool loadD
                                  name[equal - line] = '\0';
                                  TrimLSpaces(name, name);
                                  TrimRSpaces(name, name);
-                                 eEnum_AddFixedValue(regClass, name, atoi(equal + 1));
+                                 eEnum_AddFixedValue(regClass, name, strtoll(equal + 1, null, 0));
                               }
                               else
                               {
@@ -784,7 +784,12 @@ public void ImportModule(const char * name, ImportType importType, AccessMode im
 
                // 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)
+
+               // Don't do this for Documentor, because files are loaded with full paths
+               // and won't be recognized as the same libecere that Documentor is actually using,
+               // and since this is loaded from the Documentor app module, it will invalidate classes in use.
+               // We only load one component app at a time for Documentor, so we do not need this trick.
+               if(!inCompiler && !inPreCompiler && !inSymbolGen && !inDocumentor)
                {
                   MapIterator<String, List<Module> > it { map = loadedModules };
                   if(!it.Index(name /*file*/, false))
@@ -855,7 +860,7 @@ public void ImportModule(const char * name, ImportType importType, AccessMode im
                   strcpy(symFile, dir);
                   // PathCat(symFile, "Debug");
                   PathCat(symFile, "obj");
-                  sprintf(configDir, "debug.%s", (GetRuntimePlatform() == win32) ? "win32" : "linux");
+                  sprintf(configDir, "debug.%s", (__runtimePlatform == win32) ? "win32" : (__runtimePlatform == apple) ? "apple" : "linux");
                   PathCat(symFile, configDir);
 
                   PathCat(symFile, name);