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
import PmDriver
import StdSystem, StdClipboard
//import dodebug
//trace_n m f :== trace_n` m f
trace_n _ f :== f
......@@ -852,7 +851,7 @@ OpenModuleNoSel pathname ps
# srcpaths = case IsABCPathname pathname of
True -> Map MakeSystemPathname srcpaths
_ -> srcpaths
# ((ok,fullpath),ps) = accFiles (SearchDisk False pathname srcpaths) ps
# ((ok,fullpath),ps) = accFiles (SearchDisk pathname srcpaths) ps
| not ok
= okNotice
[ "Clean Project Manager"
......@@ -871,7 +870,7 @@ OpenModule pathname sel ps
# srcpaths = case IsABCPathname pathname of
True -> Map MakeSystemPathname srcpaths
_ -> srcpaths
# ((ok,fullpath),ps) = accFiles (SearchDisk False pathname srcpaths) ps
# ((ok,fullpath),ps) = accFiles (SearchDisk pathname srcpaths) ps
| not ok
= okNotice
[ "Clean Project Manager"
......
......@@ -625,7 +625,7 @@ exists_module pathname ps
# srcpaths = case IsABCPathname pathname of
True -> Map MakeSystemPathname srcpaths
_ -> srcpaths
# ((ok,fullpath),ps) = accFiles (SearchDisk False pathname srcpaths) ps
# ((ok,fullpath),ps) = accFiles (SearchDisk pathname srcpaths) ps
= (ok,GetLongPathName fullpath,ps)
// pm_set: set main module
......@@ -848,7 +848,7 @@ findModule pathname ps
# srcpaths = case IsABCPathname pathname of
True -> Map MakeSystemPathname srcpaths
_ -> srcpaths
# ((ok,fullpath),ps) = accFiles (SearchDisk False pathname srcpaths) ps
# ((ok,fullpath),ps) = accFiles (SearchDisk pathname srcpaths) ps
| not ok
= (Nothing, ps)
# fullpath` = GetLongPathName fullpath
......
......@@ -420,7 +420,7 @@ where
# text = {t \\ t <- text}
= accFiles (FindDefinitionInText imp rest cleanid text) 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
# (win,ps) = IsOpen path ps
| isJust win
......@@ -498,7 +498,7 @@ where
# text = {t \\ t <- text}
= accFiles (FindIdentifiersInText imp rest cleanid text) 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
# (win,pstate) = IsOpen path pstate
| isJust win
......
......@@ -16,9 +16,12 @@ DC_Setup :: !(List Pathname) !*Files -> (!(![String],![Warn],!.DirCache),!*Files
DC_Search :: !Modulename !*DirCache -> *(!Bool,!Pathname,!DateTime,!*DirCache)
// 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
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)
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;
MakeProjectPathname :: !String -> Pathname;
MakeExecPathname :: !String -> Pathname;
MakeSystemPathname :: !Pathname -> Pathname;
MakeObjSystemPathname :: !Processor !Pathname -> Pathname
MakeAssemblySystemPathname :: !Pathname -> Pathname
ModuleDirAndNameToDefPathname :: !ModuleDirAndName -> Pathname
......@@ -44,3 +43,5 @@ symAppPath :: !Pathname !Pathname -> Pathname
fulAppPath :: !Pathname !Pathname -> Pathname
symAppPaths :: !Pathname !(List Pathname) -> List Pathname
fulAppPaths :: !Pathname !(List Pathname) -> List Pathname
subdir_and_file_name_of_hmodule_name :: !Int !{#Char} !{#Char} -> (!*{#Char},!{#Char})
......@@ -120,34 +120,6 @@ subdir_and_file_name_of_hmodule_name last_dot_i mod file_ext
file_name = mod % (last_dot_i+1,size mod-1)+++file_ext
= (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 abcname
= directory_name_plus_system_dir +++ sep +++ file +++ suffix
......@@ -166,29 +138,6 @@ where
".s" // Win
".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 name = RemoveSuffix (RemovePath name);
......
......@@ -94,8 +94,7 @@ PR_UpdateModules :: ![Modulename] !(ModInfo -> ModInfo) !Project -> Project
PR_SetLinkOptions :: !Project !LinkOptions -> Project
PR_GetLinkOptions :: !Project -> LinkOptions
PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName)
!CompilerOptions !EditWdOptions !EditWdOptions !Project -> Project
PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName) !CompilerOptions !Project -> Project
PR_GetABCLinkInfo :: !Project -> ABCLinkInfo
......
......@@ -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 [!] = False
PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName) !CompilerOptions !EditWdOptions !EditWdOptions !Project -> Project
PR_AddABCInfo mdn dep_objects dep_libraries compilerOptions defeo impeo project=:{inflist=Nil}
PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName) !CompilerOptions !Project -> Project
PR_AddABCInfo mdn dep_objects dep_libraries compilerOptions project=:{inflist=Nil}
= 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,_) = UpdateList mod_name update inflist;
= {project & saved=False,inflist=inflist, built=False}
......
......@@ -76,6 +76,7 @@ CodeGen :: // Generates code for the given file:
!(WindowFun *GeneralSt) // error display fun
!CodeGenerateAsmOrCode // generate assembly only?
!Pathname // full .abc pathname of module to be compiled
!Pathname // full object pathname of module to be compiled
!Bool // time profiling...
!CodeGenOptions // code generator options
!Processor // target processor
......@@ -85,9 +86,6 @@ CodeGen :: // Generates code for the given file:
!*GeneralSt // state
->
( !Pathname // full pathname of generated object file
// Note: on the macintosh the .o file is generated in the standard Clean System
// Files Folder. On Unix, however, the location of the .o depends on the user
// settings.
, !Bool // success status
, !CompilerProcessIds
, !*GeneralSt // state
......
......@@ -552,7 +552,7 @@ where
/* Generates code for the given file:
*/
/*
watcom_quoted_string string = "\"" +++ escape_specials 0 string +++ "\""
where
escape_specials i string
......@@ -563,40 +563,38 @@ where
| string.[i]=='"'
= escape_specials (i+2) (string % (0,i-1)+++"\\"+++string % (i,dec (size 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
-> (!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
| not cgen_ok
# ps = wf [cgen] ps
= ("",False,compiler_process_ids,ps)
# objpath = MakeObjSystemPathname tp path
path_without_suffix = RemoveSuffix path
# path_without_suffix = RemoveSuffix abc_path
command = cgen +++ MakeCodeGenOptionsString genAsmOrCode timeprofile cgo tp
// +++ " " +++ (watcom_quoted_string path_without_suffix)
+++ " " +++ (quoted_string path_without_suffix)
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
= (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
// , startupdir
] ps
)
] ps)
# ((_, errors_not_empty, error_text),ps) = accFiles (ReadErrorsAndWarnings errorsfilename) ps
ps = (if errors_not_empty
(wf (StrictListToList error_text))
( 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
)
) ps
= (objpath,exit_code==0,compiler_process_ids,ps)
= (obj_path,exit_code==0,compiler_process_ids,ps)
:: StartedCodeGenerator = !{
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