瀏覽代碼

compiler: pass both modulename and filename to tmodule.create. extract modulename from filename if modulename is not passed (probably fix an error with asm/obj filename appeared after the namespace branch merge).

git-svn-id: trunk@18930 -
paul 14 年之前
父節點
當前提交
8a8db0a822
共有 3 個文件被更改,包括 19 次插入12 次删除
  1. 14 7
      compiler/fmodule.pas
  2. 4 4
      compiler/fppu.pas
  3. 1 1
      compiler/parser.pas

+ 14 - 7
compiler/fmodule.pas

@@ -187,7 +187,7 @@ interface
         points to the module calling it. It is nil for the first compiled
         points to the module calling it. It is nil for the first compiled
         module. This allow inheritence of all path lists. MUST pay attention
         module. This allow inheritence of all path lists. MUST pay attention
         to that when creating link.res!!!!(mazen)}
         to that when creating link.res!!!!(mazen)}
-        constructor create(LoadedFrom:TModule;const s:string;_is_unit:boolean);
+        constructor create(LoadedFrom:TModule;const amodulename,afilename:string;_is_unit:boolean);
         destructor destroy;override;
         destructor destroy;override;
         procedure reset;virtual;
         procedure reset;virtual;
         procedure adddependency(callermodule:tmodule);
         procedure adddependency(callermodule:tmodule);
@@ -467,24 +467,31 @@ implementation
                                   TMODULE
                                   TMODULE
  ****************************************************************************}
  ****************************************************************************}
 
 
-    constructor tmodule.create(LoadedFrom:TModule;const s:string;_is_unit:boolean);
+    constructor tmodule.create(LoadedFrom:TModule;const amodulename,afilename:string;_is_unit:boolean);
       var
       var
-        n : string;
+        n,fn:string;
       begin
       begin
-        n:=s;
+        if amodulename='' then
+          n:=ChangeFileExt(ExtractFileName(afilename),'')
+        else
+          n:=amodulename;
+        if afilename='' then
+          fn:=amodulename
+        else
+          fn:=afilename;
         { Programs have the name 'Program' to don't conflict with dup id's }
         { Programs have the name 'Program' to don't conflict with dup id's }
         if _is_unit then
         if _is_unit then
-         inherited create(n)
+         inherited create(amodulename)
         else
         else
          inherited create('Program');
          inherited create('Program');
-        mainsource:=stringdup(s);
+        mainsource:=stringdup(fn);
         { Dos has the famous 8.3 limit :( }
         { Dos has the famous 8.3 limit :( }
 {$ifdef shortasmprefix}
 {$ifdef shortasmprefix}
         asmprefix:=stringdup(FixFileName('as'));
         asmprefix:=stringdup(FixFileName('as'));
 {$else}
 {$else}
         asmprefix:=stringdup(FixFileName(n));
         asmprefix:=stringdup(FixFileName(n));
 {$endif}
 {$endif}
-        setfilename(s,true);
+        setfilename(fn,true);
         localunitsearchpath:=TSearchPathList.Create;
         localunitsearchpath:=TSearchPathList.Create;
         localobjectsearchpath:=TSearchPathList.Create;
         localobjectsearchpath:=TSearchPathList.Create;
         localincludesearchpath:=TSearchPathList.Create;
         localincludesearchpath:=TSearchPathList.Create;

+ 4 - 4
compiler/fppu.pas

@@ -54,7 +54,7 @@ interface
           crc_array2 : pointer;
           crc_array2 : pointer;
           crc_size2  : longint;
           crc_size2  : longint;
 {$endif def Test_Double_checksum}
 {$endif def Test_Double_checksum}
-          constructor create(LoadedFrom:TModule;const s:string;const fn:string;_is_unit:boolean);
+          constructor create(LoadedFrom:TModule;const amodulename,afilename:string;_is_unit:boolean);
           destructor destroy;override;
           destructor destroy;override;
           procedure reset;override;
           procedure reset;override;
           function  openppu:boolean;
           function  openppu:boolean;
@@ -125,11 +125,11 @@ var
                                 TPPUMODULE
                                 TPPUMODULE
  ****************************************************************************}
  ****************************************************************************}
 
 
-    constructor tppumodule.create(LoadedFrom:TModule;const s:string;const fn:string;_is_unit:boolean);
+    constructor tppumodule.create(LoadedFrom:TModule;const amodulename,afilename:string;_is_unit:boolean);
       begin
       begin
-        inherited create(LoadedFrom,s,_is_unit);
+        inherited create(LoadedFrom,amodulename,afilename,_is_unit);
         ppufile:=nil;
         ppufile:=nil;
-        sourcefn:=stringdup(fn);
+        sourcefn:=stringdup(afilename);
       end;
       end;
 
 
 
 

+ 1 - 1
compiler/parser.pas

@@ -358,7 +358,7 @@ implementation
            begin
            begin
              if assigned(current_module) then
              if assigned(current_module) then
                internalerror(200501158);
                internalerror(200501158);
-             set_current_module(tppumodule.create(nil,filename,'',false));
+             set_current_module(tppumodule.create(nil,'',filename,false));
              addloadedunit(current_module);
              addloadedunit(current_module);
              main_module:=current_module;
              main_module:=current_module;
              current_module.state:=ms_compile;
              current_module.state:=ms_compile;