Commit 6198c5bc authored by John van Groningen's avatar John van Groningen

add functions for searching hierarchical modules in module PmDirCache,

use these functions in the project manager
parent 2e45ef2f
...@@ -33,7 +33,6 @@ import Platform,PlatformObjectIO, IdePlatform ...@@ -33,7 +33,6 @@ import Platform,PlatformObjectIO, IdePlatform
import PmDriver import PmDriver
import StdSystem, StdClipboard import StdSystem, StdClipboard
//import dodebug
//trace_n m f :== trace_n` m f //trace_n m f :== trace_n` m f
trace_n _ f :== f trace_n _ f :== f
...@@ -852,7 +851,7 @@ OpenModuleNoSel pathname ps ...@@ -852,7 +851,7 @@ OpenModuleNoSel pathname ps
# srcpaths = case IsABCPathname pathname of # srcpaths = case IsABCPathname pathname of
True -> Map MakeSystemPathname srcpaths True -> Map MakeSystemPathname srcpaths
_ -> srcpaths _ -> srcpaths
# ((ok,fullpath),ps) = accFiles (SearchDisk False pathname srcpaths) ps # ((ok,fullpath),ps) = accFiles (SearchDisk pathname srcpaths) ps
| not ok | not ok
= okNotice = okNotice
[ "Clean Project Manager" [ "Clean Project Manager"
...@@ -871,7 +870,7 @@ OpenModule pathname sel ps ...@@ -871,7 +870,7 @@ OpenModule pathname sel ps
# srcpaths = case IsABCPathname pathname of # srcpaths = case IsABCPathname pathname of
True -> Map MakeSystemPathname srcpaths True -> Map MakeSystemPathname srcpaths
_ -> srcpaths _ -> srcpaths
# ((ok,fullpath),ps) = accFiles (SearchDisk False pathname srcpaths) ps # ((ok,fullpath),ps) = accFiles (SearchDisk pathname srcpaths) ps
| not ok | not ok
= okNotice = okNotice
[ "Clean Project Manager" [ "Clean Project Manager"
......
...@@ -625,7 +625,7 @@ exists_module pathname ps ...@@ -625,7 +625,7 @@ exists_module pathname ps
# srcpaths = case IsABCPathname pathname of # srcpaths = case IsABCPathname pathname of
True -> Map MakeSystemPathname srcpaths True -> Map MakeSystemPathname srcpaths
_ -> srcpaths _ -> srcpaths
# ((ok,fullpath),ps) = accFiles (SearchDisk False pathname srcpaths) ps # ((ok,fullpath),ps) = accFiles (SearchDisk pathname srcpaths) ps
= (ok,GetLongPathName fullpath,ps) = (ok,GetLongPathName fullpath,ps)
// pm_set: set main module // pm_set: set main module
...@@ -848,7 +848,7 @@ findModule pathname ps ...@@ -848,7 +848,7 @@ findModule pathname ps
# srcpaths = case IsABCPathname pathname of # srcpaths = case IsABCPathname pathname of
True -> Map MakeSystemPathname srcpaths True -> Map MakeSystemPathname srcpaths
_ -> srcpaths _ -> srcpaths
# ((ok,fullpath),ps) = accFiles (SearchDisk False pathname srcpaths) ps # ((ok,fullpath),ps) = accFiles (SearchDisk pathname srcpaths) ps
| not ok | not ok
= (Nothing, ps) = (Nothing, ps)
# fullpath` = GetLongPathName fullpath # fullpath` = GetLongPathName fullpath
......
...@@ -420,7 +420,7 @@ where ...@@ -420,7 +420,7 @@ where
# text = {t \\ t <- text} # text = {t \\ t <- text}
= accFiles (FindDefinitionInText imp rest cleanid text) ps = accFiles (FindDefinitionInText imp rest cleanid text) ps
= accFiles (FindDefinitionInFile imp rest cleanid modname) ps = accFiles (FindDefinitionInFile imp rest cleanid modname) ps
# ((ok,path),ps) = accFiles (SearchDisk False modname (AppendLists prjpaths syspaths)) ps # ((ok,path),ps) = accFiles (SearchDisk modname (AppendLists prjpaths syspaths)) ps
| ok | ok
# (win,ps) = IsOpen path ps # (win,ps) = IsOpen path ps
| isJust win | isJust win
...@@ -498,7 +498,7 @@ where ...@@ -498,7 +498,7 @@ where
# text = {t \\ t <- text} # text = {t \\ t <- text}
= accFiles (FindIdentifiersInText imp rest cleanid text) pstate = accFiles (FindIdentifiersInText imp rest cleanid text) pstate
= accFiles (FindIdentifiersInFile imp rest cleanid modname) pstate = accFiles (FindIdentifiersInFile imp rest cleanid modname) pstate
# ((ok,path), pstate) = accFiles (SearchDisk False modname (AppendLists prjpaths syspaths)) pstate # ((ok,path), pstate) = accFiles (SearchDisk modname (AppendLists prjpaths syspaths)) pstate
| ok | ok
# (win,pstate) = IsOpen path pstate # (win,pstate) = IsOpen path pstate
| isJust win | isJust win
......
...@@ -16,9 +16,12 @@ DC_Setup :: !(List Pathname) !*Files -> (!(![String],![Warn],!.DirCache),!*Files ...@@ -16,9 +16,12 @@ DC_Setup :: !(List Pathname) !*Files -> (!(![String],![Warn],!.DirCache),!*Files
DC_Search :: !Modulename !*DirCache -> *(!Bool,!Pathname,!DateTime,!*DirCache) DC_Search :: !Modulename !*DirCache -> *(!Bool,!Pathname,!DateTime,!*DirCache)
// Find file in directory cache // Find file in directory cache
DC_HSearch :: !Modulename !String !*DirCache !*Files -> *(!Bool,!Pathname,!DateTime,!*DirCache,!*Files)
DC_Update :: !.(String,String,DateTime) !*DirCache -> *DirCache DC_Update :: !(!String,!String,!DateTime) !*DirCache -> *DirCache
// Update directory cache // Update directory cache
DC_HUpdate :: !(!String,!String,!DateTime) !String !*DirCache !*Files -> (!*DirCache,!*Files)
SearchDisk :: !Bool !Modulename !(List Pathname) !*Files -> ((!Bool,!Pathname),!*Files) SearchDisk :: !Modulename !(List Pathname) !*Files -> (!(!Bool,!Pathname),!*Files)
// Find file in paths (no caching) // Find file in paths (no caching)
FindHModule :: !Modulename !{#Char} !(List Pathname) !*Files -> (!(!Bool,!Pathname),!*Files)
This diff is collapsed.
This diff is collapsed.
...@@ -18,7 +18,6 @@ MakeObjPathname :: !Processor !String -> Pathname; ...@@ -18,7 +18,6 @@ MakeObjPathname :: !Processor !String -> Pathname;
MakeProjectPathname :: !String -> Pathname; MakeProjectPathname :: !String -> Pathname;
MakeExecPathname :: !String -> Pathname; MakeExecPathname :: !String -> Pathname;
MakeSystemPathname :: !Pathname -> Pathname; MakeSystemPathname :: !Pathname -> Pathname;
MakeObjSystemPathname :: !Processor !Pathname -> Pathname
MakeAssemblySystemPathname :: !Pathname -> Pathname MakeAssemblySystemPathname :: !Pathname -> Pathname
ModuleDirAndNameToDefPathname :: !ModuleDirAndName -> Pathname ModuleDirAndNameToDefPathname :: !ModuleDirAndName -> Pathname
...@@ -44,3 +43,5 @@ symAppPath :: !Pathname !Pathname -> Pathname ...@@ -44,3 +43,5 @@ symAppPath :: !Pathname !Pathname -> Pathname
fulAppPath :: !Pathname !Pathname -> Pathname fulAppPath :: !Pathname !Pathname -> Pathname
symAppPaths :: !Pathname !(List Pathname) -> List Pathname symAppPaths :: !Pathname !(List Pathname) -> List Pathname
fulAppPaths :: !Pathname !(List Pathname) -> List Pathname fulAppPaths :: !Pathname !(List Pathname) -> List Pathname
subdir_and_file_name_of_hmodule_name :: !Int !{#Char} !{#Char} -> (!*{#Char},!{#Char})
...@@ -119,34 +119,6 @@ subdir_and_file_name_of_hmodule_name last_dot_i mod file_ext ...@@ -119,34 +119,6 @@ subdir_and_file_name_of_hmodule_name last_dot_i mod file_ext
# subdir_name = {if (c=='.') DirSeparator c \\ i<-[0..last_dot_i-1] & c<-:mod} # subdir_name = {if (c=='.') DirSeparator c \\ i<-[0..last_dot_i-1] & c<-:mod}
file_name = mod % (last_dot_i+1,size mod-1)+++file_ext file_name = mod % (last_dot_i+1,size mod-1)+++file_ext
= (subdir_name,file_name) = (subdir_name,file_name)
MakeObjSystemPathname :: !Processor !Pathname -> Pathname
MakeObjSystemPathname processor name
= files_and_path (ProcessorSuffix processor)
/*
| processor == CurrentProcessor
// = files_and_path ".o";
= files_and_path ".xo";
| processor == MC68000
= files_and_path ".obj0";
| processor == MC68020
= files_and_path ".obj1";
| processor == MC68020_and_68881
= files_and_path ".obj2";
= abort ("MakeObjSystemPathname: " +++ toString processor +++ " : No such processor ");
*/
where
files_and_path extension = directory_name_plus_system_dir +++ sep +++ file+++extension
directory_name_plus_system_dir
| equal_suffix SystemDir dir
= dir;
| size dir > 0 && dir.[size dir - 1] == DirSeparator
= dir +++ SystemDir;
| otherwise
= dir +++ sep +++ SystemDir;
dir = RemoveFilename name;
sep = toString DirSeparator;
file = RemovePath (RemoveSuffix name);
MakeAssemblySystemPathname :: !Pathname -> Pathname MakeAssemblySystemPathname :: !Pathname -> Pathname
MakeAssemblySystemPathname abcname MakeAssemblySystemPathname abcname
...@@ -165,29 +137,6 @@ where ...@@ -165,29 +137,6 @@ where
suffix = PlatformDependant suffix = PlatformDependant
".s" // Win ".s" // Win
".a" // Mac ".a" // Mac
/*
MakeObjSystemPathname :: !Processor !Pathname !Files -> (!Pathname,!Files);
MakeObjSystemPathname processor name files
| processor == CurrentProcessor
= files_and_path ".o";
| processor == MC68000
= files_and_path ".obj0";
| processor == MC68020
= files_and_path ".obj1";
| processor == MC68020_and_68881
= files_and_path ".obj2";
= abort ("MakeObjSystemPathname: " +++ toString processor +++ " : No such processor ");
where
files_and_path extension = (directory_name_plus_system_dir +++ sep +++ file+++extension,files);
directory_name_plus_system_dir
| equal_suffix SystemDir dir
= dir;
= dir +++ sep +++ SystemDir;
dir = RemoveFilename name;
sep = toString DirSeparator;
file = RemovePath (RemoveSuffix name);
*/
GetModuleName :: !Pathname -> Modulename; GetModuleName :: !Pathname -> Modulename;
GetModuleName name = RemoveSuffix (RemovePath name); GetModuleName name = RemoveSuffix (RemovePath name);
......
...@@ -94,8 +94,7 @@ PR_UpdateModules :: ![Modulename] !(ModInfo -> ModInfo) !Project -> Project ...@@ -94,8 +94,7 @@ PR_UpdateModules :: ![Modulename] !(ModInfo -> ModInfo) !Project -> Project
PR_SetLinkOptions :: !Project !LinkOptions -> Project PR_SetLinkOptions :: !Project !LinkOptions -> Project
PR_GetLinkOptions :: !Project -> LinkOptions PR_GetLinkOptions :: !Project -> LinkOptions
PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName) PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName) !CompilerOptions !Project -> Project
!CompilerOptions !EditWdOptions !EditWdOptions !Project -> Project
PR_GetABCLinkInfo :: !Project -> ABCLinkInfo PR_GetABCLinkInfo :: !Project -> ABCLinkInfo
......
...@@ -147,10 +147,10 @@ module_occurs :: !String ![!ModuleDirAndName] -> Bool ...@@ -147,10 +147,10 @@ module_occurs :: !String ![!ModuleDirAndName] -> Bool
module_occurs s [|x:xs] = x.mdn_name == s || module_occurs s xs module_occurs s [|x:xs] = x.mdn_name == s || module_occurs s xs
module_occurs s [!] = False module_occurs s [!] = False
PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName) !CompilerOptions !EditWdOptions !EditWdOptions !Project -> Project PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName) !CompilerOptions !Project -> Project
PR_AddABCInfo mdn dep_objects dep_libraries compilerOptions defeo impeo project=:{inflist=Nil} PR_AddABCInfo mdn dep_objects dep_libraries compilerOptions project=:{inflist=Nil}
= project = project
PR_AddABCInfo {mdn_dir=mod_dir,mdn_name=mod_name} dep_objects dep_libraries compilerOptions defeo impeo project=:{inflist} PR_AddABCInfo {mdn_dir=mod_dir,mdn_name=mod_name} dep_objects dep_libraries compilerOptions project=:{inflist}
# inflist = TryInsertInList mod_name mod_dir inflist # inflist = TryInsertInList mod_name mod_dir inflist
# (inflist,_) = UpdateList mod_name update inflist; # (inflist,_) = UpdateList mod_name update inflist;
= {project & saved=False,inflist=inflist, built=False} = {project & saved=False,inflist=inflist, built=False}
......
...@@ -76,6 +76,7 @@ CodeGen :: // Generates code for the given file: ...@@ -76,6 +76,7 @@ CodeGen :: // Generates code for the given file:
!(WindowFun *GeneralSt) // error display fun !(WindowFun *GeneralSt) // error display fun
!CodeGenerateAsmOrCode // generate assembly only? !CodeGenerateAsmOrCode // generate assembly only?
!Pathname // full .abc pathname of module to be compiled !Pathname // full .abc pathname of module to be compiled
!Pathname // full object pathname of module to be compiled
!Bool // time profiling... !Bool // time profiling...
!CodeGenOptions // code generator options !CodeGenOptions // code generator options
!Processor // target processor !Processor // target processor
...@@ -85,10 +86,7 @@ CodeGen :: // Generates code for the given file: ...@@ -85,10 +86,7 @@ CodeGen :: // Generates code for the given file:
!*GeneralSt // state !*GeneralSt // state
-> ->
( !Pathname // full pathname of generated object file ( !Pathname // full pathname of generated object file
// Note: on the macintosh the .o file is generated in the standard Clean System , !Bool // success status
// Files Folder. On Unix, however, the location of the .o depends on the user
// settings.
, !Bool // success status
, !CompilerProcessIds , !CompilerProcessIds
, !*GeneralSt // state , !*GeneralSt // state
) )
......
...@@ -552,7 +552,7 @@ where ...@@ -552,7 +552,7 @@ where
/* Generates code for the given file: /* Generates code for the given file:
*/ */
/*
watcom_quoted_string string = "\"" +++ escape_specials 0 string +++ "\"" watcom_quoted_string string = "\"" +++ escape_specials 0 string +++ "\""
where where
escape_specials i string escape_specials i string
...@@ -563,40 +563,38 @@ where ...@@ -563,40 +563,38 @@ where
| string.[i]=='"' | string.[i]=='"'
= escape_specials (i+2) (string % (0,i-1)+++"\\"+++string % (i,dec (size string))) = escape_specials (i+2) (string % (0,i-1)+++"\\"+++string % (i,dec (size string)))
= escape_specials (inc i) string = escape_specials (inc i) string
*/
CodeGen :: !String !Bool !(WindowFun *GeneralSt) !CodeGenerateAsmOrCode !Pathname !Bool CodeGen :: !String !Bool !(WindowFun *GeneralSt) !CodeGenerateAsmOrCode !Pathname !Pathname !Bool
!CodeGenOptions !Processor !ApplicationOptions !Pathname !CompilerProcessIds !*GeneralSt !CodeGenOptions !Processor !ApplicationOptions !Pathname !CompilerProcessIds !*GeneralSt
-> (!Pathname,!Bool,!CompilerProcessIds,!*GeneralSt) -> (!Pathname,!Bool,!CompilerProcessIds,!*GeneralSt)
CodeGen cgen` used_compiler_process_ids wf genAsmOrCode path timeprofile cgo tp ao startupdir compiler_process_ids ps CodeGen cgen` used_compiler_process_ids wf genAsmOrCode abc_path obj_path timeprofile cgo tp ao startupdir compiler_process_ids ps
# (cgen_ok,cgen,cgendir) = mangleGenerator cgen` startupdir # (cgen_ok,cgen,cgendir) = mangleGenerator cgen` startupdir
| not cgen_ok | not cgen_ok
# ps = wf [cgen] ps # ps = wf [cgen] ps
= ("",False,compiler_process_ids,ps) = ("",False,compiler_process_ids,ps)
# objpath = MakeObjSystemPathname tp path # path_without_suffix = RemoveSuffix abc_path
path_without_suffix = RemoveSuffix path
command = cgen +++ MakeCodeGenOptionsString genAsmOrCode timeprofile cgo tp command = cgen +++ MakeCodeGenOptionsString genAsmOrCode timeprofile cgo tp
// +++ " " +++ (watcom_quoted_string path_without_suffix) // +++ " " +++ (watcom_quoted_string path_without_suffix)
+++ " " +++ (quoted_string path_without_suffix) +++ " " +++ (quoted_string path_without_suffix)
errorsfilename = tooltempdir +++ DirSeparatorString +++ "errors" errorsfilename = tooltempdir +++ DirSeparatorString +++ "errors"
(didit,exit_code,_) = trace_n errorsfilename CallProcess command [] cgendir "" "" errorsfilename 99 (didit,exit_code,_) = CallProcess command [] cgendir "" "" errorsfilename 99
| not didit | not didit
= (objpath,False,compiler_process_ids,wf [ "Error: Unable to run code generator: "+++cgen = (obj_path,False,compiler_process_ids,wf [ "Error: Unable to run code generator: "+++cgen
// , command // , command
// , startupdir // , startupdir
] ps ] ps)
)
# ((_, errors_not_empty, error_text),ps) = accFiles (ReadErrorsAndWarnings errorsfilename) ps # ((_, errors_not_empty, error_text),ps) = accFiles (ReadErrorsAndWarnings errorsfilename) ps
ps = (if errors_not_empty ps = (if errors_not_empty
(wf (StrictListToList error_text)) (wf (StrictListToList error_text))
( if (exit_code <> 0) ( if (exit_code <> 0)
(wf ["Error: Code generator failed for '" +++ path +++ "' with exit code: "+++toString exit_code,(quoted_string path_without_suffix)]) (wf ["Error: Code generator failed for '" +++ abc_path +++ "' with exit code: "+++toString exit_code,(quoted_string path_without_suffix)])
id id
) )
) ps ) ps
= (objpath,exit_code==0,compiler_process_ids,ps) = (obj_path,exit_code==0,compiler_process_ids,ps)
:: StartedCodeGenerator = !{ :: StartedCodeGenerator = !{
scg_thread_handle :: !Int, scg_thread_handle :: !Int,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment