浏览代码

+ search_unit arg to only search for sources

peter 27 年之前
父节点
当前提交
436274abfc
共有 2 个文件被更改,包括 36 次插入29 次删除
  1. 29 23
      compiler/files.pas
  2. 7 6
      compiler/pmodules.pas

+ 29 - 23
compiler/files.pas

@@ -167,7 +167,7 @@ unit files;
           procedure reset;
           procedure setfilename(const fn:string;allowoutput:boolean);
           function  openppu:boolean;
-          function  search_unit(const n : string):boolean;
+          function  search_unit(const n : string;onlysource:boolean):boolean;
        end;
 
        pused_unit = ^tused_unit;
@@ -742,7 +742,7 @@ unit files;
       end;
 
 
-    function tmodule.search_unit(const n : string):boolean;
+    function tmodule.search_unit(const n : string;onlysource:boolean):boolean;
       var
          ext       : string[8];
          singlepathstring,
@@ -769,25 +769,28 @@ unit files;
             i:=length(unitpath)+1;
            singlepathstring:=FixPath(copy(unitpath,start,i-start),false);
            delete(unitpath,start,i-start+1);
-         { Check for PPL file }
-           if not Found then
+           if not onlysource then
             begin
-              Found:=UnitExists(target_info.unitlibext);
-              if Found then
-               Begin
-                 SetFileName(SinglePathString+FileName,false);
-                 Found:=OpenPPU;
-               End;
-             end;
-         { Check for PPU file }
-           if not Found then
-            begin
-              Found:=UnitExists(target_info.unitext);
-              if Found then
-               Begin
-                 SetFileName(SinglePathString+FileName,false);
-                 Found:=OpenPPU;
-               End;
+            { Check for PPL file }
+              if not Found then
+               begin
+                 Found:=UnitExists(target_info.unitlibext);
+                 if Found then
+                  Begin
+                    SetFileName(SinglePathString+FileName,false);
+                    Found:=OpenPPU;
+                  End;
+                end;
+            { Check for PPU file }
+              if not Found then
+               begin
+                 Found:=UnitExists(target_info.unitext);
+                 if Found then
+                  Begin
+                    SetFileName(SinglePathString+FileName,false);
+                    Found:=OpenPPU;
+                  End;
+               end;
             end;
          { Check for Sources }
            if not Found then
@@ -941,8 +944,8 @@ unit files;
        { search the PPU file if it is an unit }
          if is_unit then
           begin
-            if (not search_unit(modulename^)) and (length(modulename^)>8) then
-             search_unit(copy(modulename^,1,8));
+            if (not search_unit(modulename^,false)) and (length(modulename^)>8) then
+             search_unit(copy(modulename^,1,8),false);
           end;
       end;
 
@@ -1024,7 +1027,10 @@ unit files;
 end.
 {
   $Log$
-  Revision 1.69  1998-10-29 11:35:44  florian
+  Revision 1.70  1998-11-03 11:33:14  peter
+    + search_unit arg to only search for sources
+
+  Revision 1.69  1998/10/29 11:35:44  florian
     * some dll support for win32
     * fixed assembler writing for PalmOS
 

+ 7 - 6
compiler/pmodules.pas

@@ -325,9 +325,9 @@ unit pmodules;
               end;
            { recompile the unit or give a fatal error if sources not available }
              if not(current_module^.sources_avail) then
-               if (not current_module^.search_unit(current_module^.modulename^))
+               if (not current_module^.search_unit(current_module^.modulename^,true))
                   and (length(current_module^.modulename^)>8) then
-                 current_module^.search_unit(copy(current_module^.modulename^,1,8));
+                 current_module^.search_unit(copy(current_module^.modulename^,1,8),true);
              if not(current_module^.sources_avail) then
               Message1(unit_f_cant_compile_unit,current_module^.modulename^)
              else
@@ -411,10 +411,8 @@ unit pmodules;
                hp^.reset;
                hp^.scanner:=scanner;
                { try to reopen ppu }
-               hp^.search_unit(s);
+               hp^.search_unit(s,false);
                { try to load the unit a second time first }
-{               if not current_module^.in_implementation then
-                 hp^.do_compile:=true; }
                current_module:=hp;
                current_module^.in_second_compile:=true;
                Message1(unit_u_second_load_unit,current_module^.modulename^);
@@ -1112,7 +1110,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.78  1998-10-30 12:23:41  peter
+  Revision 1.79  1998-11-03 11:33:11  peter
+    + search_unit arg to only search for sources
+
+  Revision 1.78  1998/10/30 12:23:41  peter
     * fix for lognunitname and longunit.pas
 
   Revision 1.77  1998/10/29 11:35:52  florian