Commit 23e66381 authored by John van Groningen's avatar John van Groningen
Browse files

use type ModuleDirAndName instead of type String

parent 6868ed0a
This diff is collapsed.
...@@ -3,30 +3,29 @@ definition module PmFileInfo ...@@ -3,30 +3,29 @@ definition module PmFileInfo
import StdFile import StdFile
import StdPathname import StdPathname
import UtilDate, UtilStrictLists import UtilDate, UtilStrictLists
from PmTypes import :: Processor, :: Modulename, :: StaticLibInfo from PmTypes import :: Processor, :: Modulename, :: StaticLibInfo, ::ModuleDirAndName
from PmAbcMagic import :: ABCCache, :: ABCOptions from PmAbcMagic import :: ABCCache, :: ABCOptions
:: FileInfoCache :: FileInfoCache
:: FileInfo = :: FileInfo =
{ path :: !Pathname { fi_mod_name :: !{#Char}
, abcpath :: !Pathname , abcpath :: !Pathname
, objpath :: !Pathname , objpath :: !Pathname
, sys :: !Bool // system file? , sys :: !Bool // system file?
, seq_stack :: !Bool // sequential code & stack info? , seq_stack :: !Bool // sequential code & stack info?
, version :: !Int , version :: !Int
, abcOptions :: !ABCOptions , abcOptions :: !ABCOptions
, icldate :: !DATE
, abcdate :: !DATE , abcdate :: !DATE
, objdate :: !DATE , objdate :: !DATE
} }
FI_EmptyCache :: FileInfoCache FI_EmptyCache :: FileInfoCache
FI_GetFileInfo :: !Processor !Pathname !ABCCache !FileInfoCache !*env -> ((!ABCCache,!FileInfoCache, !FileInfo),!*env) | FileEnv env FI_GetFileInfo :: !Processor !ModuleDirAndName !ABCCache !FileInfoCache !*env -> ((!ABCCache,!FileInfoCache, !FileInfo),!*env) | FileEnv env
FI_UpdateAbcDate :: !Pathname !Pathname !Bool !FileInfoCache !*Files -> ((!DATE,!FileInfoCache), !*Files) FI_UpdateAbcDate :: !Modulename !Pathname !Bool !FileInfoCache !*Files -> ((!DATE,!FileInfoCache), !*Files)
FI_UpdateABCInfo :: !Pathname !Pathname !ABCCache !FileInfoCache !*Files -> ((!DATE,!ABCCache,!FileInfoCache), !*Files) FI_UpdateABCInfo :: !Modulename !Pathname !ABCCache !FileInfoCache !*Files -> ((!DATE,!ABCCache,!FileInfoCache), !*Files)
FI_UpdateObjDate :: !Pathname !Pathname !FileInfoCache !*Files -> (!FileInfoCache, !*Files) FI_UpdateObjDate :: !Modulename !Pathname !FileInfoCache !*Files -> (!FileInfoCache, !*Files)
FI_UpdateFileInfo :: !Pathname !(FileInfo -> FileInfo) !FileInfoCache -> FileInfoCache FI_UpdateFileInfo :: !Modulename !(FileInfo -> FileInfo) !FileInfoCache -> FileInfoCache
FI_GetCleanModules :: !Pathname !StaticLibInfo !FileInfoCache -> (!List Pathname, !FileInfoCache) FI_GetCleanModules :: !Pathname !StaticLibInfo !FileInfoCache -> (!List Pathname, !FileInfoCache)
YoungestObj :: !DATE !FileInfoCache -> DATE YoungestObj :: !DATE !FileInfoCache -> DATE
...@@ -15,14 +15,13 @@ import PmAbcMagic ...@@ -15,14 +15,13 @@ import PmAbcMagic
//--- FileInfo stuff //--- FileInfo stuff
:: FileInfo = :: FileInfo =
{ path :: !Pathname { fi_mod_name :: !{#Char}
, abcpath :: !Pathname , abcpath :: !Pathname
, objpath :: !Pathname , objpath :: !Pathname
, sys :: !Bool // system file? , sys :: !Bool // system file?
, seq_stack :: !Bool // sequential code & stack info? , seq_stack :: !Bool // sequential code & stack info?
, version :: !Int // abc - version , version :: !Int // abc - version
, abcOptions :: !ABCOptions , abcOptions :: !ABCOptions
, icldate :: !DATE
, abcdate :: !DATE , abcdate :: !DATE
, objdate :: !DATE , objdate :: !DATE
} }
...@@ -32,29 +31,24 @@ import PmAbcMagic ...@@ -32,29 +31,24 @@ import PmAbcMagic
FI_EmptyCache :: FileInfoCache FI_EmptyCache :: FileInfoCache
FI_EmptyCache = Nil FI_EmptyCache = Nil
FI_GetFileInfo :: !Processor !Pathname !ABCCache !FileInfoCache !*env -> ((!ABCCache,!FileInfoCache, !FileInfo),!*env) | FileEnv env FI_GetFileInfo :: !Processor !ModuleDirAndName !ABCCache !FileInfoCache !*env -> ((!ABCCache,!FileInfoCache, !FileInfo),!*env) | FileEnv env
FI_GetFileInfo tp path abccache fileinfo ps FI_GetFileInfo tp mdn abccache fileinfo ps
= accFiles (GetFileInfo1 tp path abccache fileinfo fileinfo) ps = accFiles (GetFileInfo1 tp mdn abccache fileinfo fileinfo) ps
where where
GetFileInfo1 :: !Processor !Pathname !ABCCache !FileInfoCache !FileInfoCache !Files GetFileInfo1 :: !Processor !ModuleDirAndName !ABCCache !FileInfoCache !FileInfoCache !Files
-> ((!ABCCache,!FileInfoCache, !FileInfo), Files) -> ((!ABCCache,!FileInfoCache, !FileInfo), Files)
GetFileInfo1 tp this_path abccache fileinfo=:((info=:{path,abcpath,objpath}) :! rest) acc files GetFileInfo1 tp mdn=:{mdn_name} abccache (fileinfo:!rest) acc files
| this_path==path || this_path==abcpath || this_path==objpath | mdn_name==fileinfo.fi_mod_name
= ((abccache,acc, info), files) = ((abccache,acc,fileinfo), files)
= GetFileInfo1 tp this_path abccache rest acc files = GetFileInfo1 tp mdn abccache rest acc files
GetFileInfo1 tp path abccache Nil acc files GetFileInfo1 tp mdn=:{mdn_name} abccache Nil acc files
# iclpath = MakeImpPathname path # abcpath = ModuleDirAndNameToABCSystemPathname mdn
// # (abcpath, files) = MakeABCSystemPathname path files # objpath = ModuleDirAndNameToObjSystemPathname tp mdn
# abcpath = MakeABCSystemPathname path
// # (objpath, files) = MakeObjSystemPathname tp path files
# objpath = MakeObjSystemPathname tp path
# (icldate, files) = FModified iclpath files
# (abcdate, files) = FModified abcpath files # (abcdate, files) = FModified abcpath files
# (objdate, files) = FModified objpath files # (objdate, files) = FModified objpath files
| not abcdate.exists | not abcdate.exists
# finfo = { path = iclpath, # finfo = { fi_mod_name = mdn_name,
abcpath = abcpath, objpath = objpath, abcpath = abcpath, objpath = objpath,
icldate = icldate,
abcdate = abcdate, objdate = objdate, abcdate = abcdate, objdate = objdate,
sys = False, seq_stack = False, sys = False, seq_stack = False,
version = -1, abcOptions = DefaultABCOptions } version = -1, abcOptions = DefaultABCOptions }
...@@ -62,33 +56,33 @@ where ...@@ -62,33 +56,33 @@ where
// otherwise // otherwise
# ((sys,seq_stack,version,abcOptions,abccache),files) # ((sys,seq_stack,version,abcOptions,abccache),files)
= GetABCCompiledInfo False abcpath abccache files = GetABCCompiledInfo False abcpath abccache files
finfo = { path = iclpath, finfo = { fi_mod_name = mdn_name,
abcpath = abcpath, objpath = objpath, abcpath = abcpath, objpath = objpath,
icldate = icldate,
abcdate = abcdate, objdate = objdate, abcdate = abcdate, objdate = objdate,
sys = sys, seq_stack = seq_stack, sys = sys, seq_stack = seq_stack,
version = version, abcOptions = abcOptions } version = version, abcOptions = abcOptions }
= ((abccache,finfo:!acc, finfo), files) = ((abccache,finfo:!acc, finfo), files)
FI_UpdateFileInfo :: !Pathname !(FileInfo -> FileInfo) !FileInfoCache -> FileInfoCache FI_UpdateFileInfo :: !Modulename !(FileInfo -> FileInfo) !FileInfoCache -> FileInfoCache
FI_UpdateFileInfo key update list = UpdateFileInfo1 key update list Nil FI_UpdateFileInfo module_name update list = UpdateFileInfo1 module_name update list Nil
where where
UpdateFileInfo1 :: !Pathname !(FileInfo -> FileInfo) !FileInfoCache !FileInfoCache -> FileInfoCache UpdateFileInfo1 :: !Pathname !(FileInfo -> FileInfo) !FileInfoCache !FileInfoCache -> FileInfoCache
UpdateFileInfo1 key update_function Nil acc UpdateFileInfo1 module_name update_function Nil acc
= acc = acc
UpdateFileInfo1 key update_function ((first=:{path,abcpath,objpath}):!rest) acc UpdateFileInfo1 module_name update_function ((first=:{fi_mod_name}):!rest) acc
| key == path || key == abcpath || key == objpath | fi_mod_name == module_name
= Reverse2 (update_function first:!rest) acc = Reverse2 (update_function first:!rest) acc
= UpdateFileInfo1 key update_function rest (first:!acc) = UpdateFileInfo1 module_name update_function rest (first:!acc)
FI_UpdateAbcDate :: !Pathname !Pathname !Bool !FileInfoCache !*Files -> ((!DATE,!FileInfoCache), !*Files)
FI_UpdateAbcDate path abcPath abcTimeProfile fileInfo files
# (abcDate, files) = FModified abcPath files
# fileInfo = FI_UpdateFileInfo path (\info -> {info & abcpath=abcPath, abcdate=abcDate, abcOptions = {info.abcOptions & abcTimeProfile = abcTimeProfile}}) fileInfo
= ((abcDate,fileInfo), files)
FI_UpdateABCInfo :: !Pathname !Pathname !ABCCache !FileInfoCache !*Files -> ((!DATE,!ABCCache,!FileInfoCache), !*Files) FI_UpdateAbcDate :: !Modulename !Pathname !Bool !FileInfoCache !*Files -> ((!DATE,!FileInfoCache), !*Files)
FI_UpdateABCInfo path abcPath abcCache fileInfo files FI_UpdateAbcDate module_name abcPath abcTimeProfile fileInfo files
# (abcDate, files) = FModified abcPath files
# update = \info -> {info & abcpath=abcPath, abcdate=abcDate, abcOptions.abcTimeProfile = abcTimeProfile}
fileInfo = FI_UpdateFileInfo module_name update fileInfo
= ((abcDate,fileInfo), files)
FI_UpdateABCInfo :: !Modulename !Pathname !ABCCache !FileInfoCache !*Files -> ((!DATE,!ABCCache,!FileInfoCache), !*Files)
FI_UpdateABCInfo module_name abcPath abcCache fileInfo files
# (abcDate,files) = FModified abcPath files # (abcDate,files) = FModified abcPath files
((sys,stack,version,abcOptions,abcCache), files) ((sys,stack,version,abcOptions,abcCache), files)
= GetABCCompiledInfo True abcPath abcCache files = GetABCCompiledInfo True abcPath abcCache files
...@@ -101,18 +95,14 @@ FI_UpdateABCInfo path abcPath abcCache fileInfo files ...@@ -101,18 +95,14 @@ FI_UpdateABCInfo path abcPath abcCache fileInfo files
, version = version , version = version
, abcOptions = abcOptions , abcOptions = abcOptions
} }
fileInfo = FI_UpdateFileInfo path update fileInfo fileInfo = FI_UpdateFileInfo module_name update fileInfo
= ((abcDate,abcCache,fileInfo),files) = ((abcDate,abcCache,fileInfo),files)
FI_UpdateObjDate :: !Pathname !Pathname !FileInfoCache !*Files -> (!FileInfoCache, !*Files) FI_UpdateObjDate :: !Modulename !Pathname !FileInfoCache !*Files -> (!FileInfoCache, !*Files)
FI_UpdateObjDate path objPath fileInfo files FI_UpdateObjDate module_name objPath fileInfo files
# (objDate, files) = FModified objPath files # (objDate, files) = FModified objPath files
update = \finfo -> update = \finfo -> {finfo & objpath = objPath, objdate = objDate}
{ finfo fileInfo = FI_UpdateFileInfo module_name update fileInfo
& objpath = objPath
, objdate = objDate
}
fileInfo = FI_UpdateFileInfo path update fileInfo
= (fileInfo,files) = (fileInfo,files)
FI_GetCleanModules :: !Pathname !StaticLibInfo !FileInfoCache -> (!List Pathname, !FileInfoCache) FI_GetCleanModules :: !Pathname !StaticLibInfo !FileInfoCache -> (!List Pathname, !FileInfoCache)
......
...@@ -4,7 +4,7 @@ definition module PmPath ...@@ -4,7 +4,7 @@ definition module PmPath
import StdFile, StdOverloaded//, StdString import StdFile, StdOverloaded//, StdString
import StdPathname import StdPathname
from UtilStrictLists import :: List from UtilStrictLists import :: List
from PmTypes import :: Modulename, :: Processor from PmTypes import :: Modulename, :: Processor, ::ModuleDirAndName
IsDefPathname :: !Pathname -> Bool; IsDefPathname :: !Pathname -> Bool;
IsImpPathname :: !Pathname -> Bool; IsImpPathname :: !Pathname -> Bool;
...@@ -22,7 +22,12 @@ MakeABCSystemPathname :: !Pathname -> Pathname ...@@ -22,7 +22,12 @@ MakeABCSystemPathname :: !Pathname -> Pathname
MakeObjSystemPathname :: !Processor !Pathname -> Pathname MakeObjSystemPathname :: !Processor !Pathname -> Pathname
MakeAssemblySystemPathname :: !Pathname -> Pathname MakeAssemblySystemPathname :: !Pathname -> Pathname
ModuleDirAndNameToImpPathname :: !ModuleDirAndName -> Pathname
ModuleDirAndNameToABCSystemPathname :: !ModuleDirAndName -> Pathname
ModuleDirAndNameToObjSystemPathname :: !Processor !ModuleDirAndName -> Pathname
GetModuleName :: !Pathname -> Modulename; GetModuleName :: !Pathname -> Modulename;
determine_dir_and_filename :: !{#Char} !(List {#Char}) -> (!ModuleDirAndName,!{#Char})
/* The name of the system directory */ /* The name of the system directory */
SystemDir :== "Clean System Files"; SystemDir :== "Clean System Files";
......
...@@ -36,18 +36,7 @@ MakeABCPathname name = RemoveSuffix name +++ ".abc"; ...@@ -36,18 +36,7 @@ MakeABCPathname name = RemoveSuffix name +++ ".abc";
MakeObjPathname :: !Processor !String -> Pathname; MakeObjPathname :: !Processor !String -> Pathname;
MakeObjPathname processor name MakeObjPathname processor name
= RemoveSuffix name +++ ProcessorSuffix processor = RemoveSuffix name +++ ProcessorSuffix processor
/*
| processor == CurrentProcessor
// = RemoveSuffix name +++ ".o";
= RemoveSuffix name +++ ".xo";
| processor == MC68000
= RemoveSuffix name +++ ".obj0";
| processor == MC68020
= RemoveSuffix name +++ ".obj1";
| processor == MC68020_and_68881
= RemoveSuffix name +++ ".obj2";
= abort ("MakeObjPathname: " +++ toString processor +++ " : No such processor ");
*/
MakeProjectPathname :: !String -> Pathname; MakeProjectPathname :: !String -> Pathname;
MakeProjectPathname name = RemoveSuffix name +++ ".prj"; MakeProjectPathname name = RemoveSuffix name +++ ".prj";
...@@ -68,6 +57,65 @@ MakeSystemPathname pathname ...@@ -68,6 +57,65 @@ MakeSystemPathname pathname
where where
sep = toString DirSeparator; sep = toString DirSeparator;
ModuleDirAndNameToImpPathname :: !ModuleDirAndName -> Pathname
ModuleDirAndNameToImpPathname {mdn_dir,mdn_name}
= MakeFullPathname mdn_dir (replace_dot_chars_by_dir_separators mdn_name +++ ".icl")
replace_dot_chars_by_dir_separators :: !{#Char} -> {#Char}
replace_dot_chars_by_dir_separators module_name
# last_dot_i=find_last_dot_i module_name
| last_dot_i<0
= module_name
= {if (c=='.') DirSeparator c \\ c<-:module_name & i<-[0..]}
ModuleDirAndNameToABCSystemPathname :: !ModuleDirAndName -> Pathname
ModuleDirAndNameToABCSystemPathname {mdn_dir,mdn_name}
= make_clean_system_files_path mdn_dir mdn_name ".abc"
ModuleDirAndNameToObjSystemPathname :: !Processor !ModuleDirAndName -> Pathname
ModuleDirAndNameToObjSystemPathname processor {mdn_dir,mdn_name}
= make_clean_system_files_path mdn_dir mdn_name (ProcessorSuffix processor)
make_clean_system_files_path dir module_name file_ext
# last_dot_i=find_last_dot_i module_name
| last_dot_i<0
= directory_name_plus_system_dir_from_dir dir+++DirSeparatorString+++module_name+++file_ext
with
directory_name_plus_system_dir_from_dir dir
| equal_suffix SystemDir dir
= dir;
| size dir>0 && dir.[size dir-1]==DirSeparator
= dir +++ SystemDir;
| otherwise
= dir +++ DirSeparatorString +++ SystemDir;
# (subdir,file_name) = subdir_and_file_name_of_hmodule_name last_dot_i module_name file_ext
= directory_name_without_system_dir_with_separator_from_dir dir+++subdir+++DirSeparatorString+++SystemDir+++DirSeparatorString+++file_name
with
directory_name_without_system_dir_with_separator_from_dir dir
| equal_suffix SystemDir dir
= dir % (0,size dir-1-size SystemDir)+++DirSeparatorString
| size dir>0 && dir.[size dir-1]==DirSeparator
= dir
| otherwise
= dir+++DirSeparatorString;
find_last_dot_i :: !{#Char} -> Int
find_last_dot_i s
= find_last_dot_i s (size s-1)
where
find_last_dot_i s i
| i>=0
| s.[i]=='.'
= i
= find_last_dot_i s (i-1)
= i
subdir_and_file_name_of_hmodule_name :: !Int !{#Char} !{#Char} -> (!*{#Char},!{#Char})
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}
file_name = mod % (last_dot_i+1,size mod-1)+++file_ext
= (subdir_name,file_name)
MakeABCSystemPathname :: !Pathname -> Pathname MakeABCSystemPathname :: !Pathname -> Pathname
MakeABCSystemPathname abcname MakeABCSystemPathname abcname
= directory_name_plus_system_dir +++ sep +++ file +++ ".abc" = directory_name_plus_system_dir +++ sep +++ file +++ ".abc"
...@@ -167,6 +215,34 @@ where ...@@ -167,6 +215,34 @@ where
GetModuleName :: !Pathname -> Modulename; GetModuleName :: !Pathname -> Modulename;
GetModuleName name = RemoveSuffix (RemovePath name); GetModuleName name = RemoveSuffix (RemovePath name);
determine_dir_and_filename :: !{#Char} !(List {#Char}) -> (!ModuleDirAndName,!{#Char})
determine_dir_and_filename imp_pathname dirs
= determine_dir_and_filename dirs ""
where
determine_dir_and_filename (dir:!dirs) longest_dir
# sd=size dir
| sd>size longest_dir && sd<size imp_pathname && imp_pathname % (0,sd-1)==dir
= determine_dir_and_filename dirs dir
= determine_dir_and_filename dirs longest_dir
determine_dir_and_filename Nil longest_dir
| size longest_dir==0
# mdn = {mdn_dir = RemoveFilename imp_pathname, mdn_name = GetModuleName imp_pathname}
= (mdn,imp_pathname)
# (module_name,imp_pathname) = module_name_and_pathname_with_dots imp_pathname (size longest_dir)
# mdn = {mdn_dir = longest_dir, mdn_name = module_name}
= (mdn,imp_pathname)
module_name_and_pathname_with_dots pathname filename_i
| filename_i<size pathname && pathname.[filename_i]==DirSeparator
= module_name_and_pathname_with_dots pathname (filename_i+1)
# module_name = replace_dir_separators_by_dots (RemoveSuffix (pathname % (filename_i,size pathname-1)))
#! file_ext_i = filename_i+size module_name
# pathname = {if (i<filename_i || i>=file_ext_i) c module_name.[i-filename_i] \\ c<-:pathname & i<-[0..]}
= (module_name,pathname)
replace_dir_separators_by_dots s
= {if (c==DirSeparator) '.' c \\ c<-:s}
//== //==
symPath :: !Pathname !Pathname !Pathname -> Pathname symPath :: !Pathname !Pathname !Pathname -> Pathname
......
...@@ -52,7 +52,7 @@ PR_ProjectSet :: !Project -> Bool ...@@ -52,7 +52,7 @@ PR_ProjectSet :: !Project -> Bool
PR_NewProject :: !String !EditWdOptions !CompilerOptions !CodeGenOptions !ApplicationOptions PR_NewProject :: !String !EditWdOptions !CompilerOptions !CodeGenOptions !ApplicationOptions
!(List String) !LinkOptions -> Project !(List String) !LinkOptions -> Project
PR_SetBuilt :: !(List Modulename) !.Project -> .Project PR_SetBuilt :: ![!ModuleDirAndName] !.Project -> .Project
PR_ClearDependencies :: !Project -> Project PR_ClearDependencies :: !Project -> Project
PR_SetRoot :: !String !EditWdOptions !CompilerOptions !Project -> Project PR_SetRoot :: !String !EditWdOptions !CompilerOptions !Project -> Project
PR_SetCompiled :: !Modulename !Project -> Project PR_SetCompiled :: !Modulename !Project -> Project
...@@ -71,9 +71,11 @@ PR_GetPaths :: !Project -> List String ...@@ -71,9 +71,11 @@ PR_GetPaths :: !Project -> List String
PR_GetRootModuleName :: !Project -> String PR_GetRootModuleName :: !Project -> String
PR_GetRootPathName :: !Project -> (!String,!Project) PR_GetRootPathName :: !Project -> (!String,!Project)
PR_GetRootModuleDir :: !Project -> String PR_GetRootModuleDir :: !Project -> String
PR_GetRootModuleDirAndName :: !Project -> (!ModuleDirAndName,!Project)
PR_GetRootDir :: !Project -> String PR_GetRootDir :: !Project -> String
PR_GetRelativeRootDir :: !Project -> String PR_GetRelativeRootDir :: !Project -> String
PR_GetModulenames :: !Bool !Def_and_Imp !Project -> (List String,Project) PR_GetModulenames :: !Bool !Def_and_Imp !Project -> (List String,Project)
PR_GetDirAndModulenames :: !Project -> ([!ModuleDirAndName],Project)
PR_GetOpenModulenames :: !Project -> List String PR_GetOpenModulenames :: !Project -> List String
PR_GetModuleStuff :: !Project -> List (Modulename,String,Modulename,String) PR_GetModuleStuff :: !Project -> List (Modulename,String,Modulename,String)
...@@ -92,7 +94,7 @@ PR_UpdateModules :: ![Modulename] !(ModInfo -> ModInfo) !Project -> Project ...@@ -92,7 +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 :: !String !(List LinkObjFileName) !(List LinkLibraryName) PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName)
!CompilerOptions !EditWdOptions !EditWdOptions !Project -> Project !CompilerOptions !EditWdOptions !EditWdOptions !Project -> Project
PR_GetABCLinkInfo :: !Project -> ABCLinkInfo PR_GetABCLinkInfo :: !Project -> ABCLinkInfo
......
...@@ -128,12 +128,11 @@ PR_NewProject main_module_file_name eo compilerOptions cgo ao prjpaths linkOptio ...@@ -128,12 +128,11 @@ PR_NewProject main_module_file_name eo compilerOptions cgo ao prjpaths linkOptio
, root_directory = dirname , root_directory = dirname
} }
PR_SetBuilt :: !(List Modulename) !.Project -> .Project; PR_SetBuilt :: ![!ModuleDirAndName] !.Project -> .Project;
PR_SetBuilt used project=:{inflist=Nil} PR_SetBuilt used project=:{inflist=Nil}
= {Project | project & built = True}; = {Project | project & built = True};
PR_SetBuilt used prj=:{inflist=infl=:(root:!rest),saved} PR_SetBuilt used prj=:{inflist=infl=:(root:!rest),saved}
#! len = LLength rest #! len = LLength rest
# used = Map GetModuleName used
# rest = RemoveUnusedModules used rest # rest = RemoveUnusedModules used rest
# len` = LLength rest # len` = LLength rest
# unchanged = len == len` # unchanged = len == len`
...@@ -142,19 +141,20 @@ where ...@@ -142,19 +141,20 @@ where
{mn=rootmn,info} = root {mn=rootmn,info} = root
RemoveUnusedModules used list = FilterR member list RemoveUnusedModules used list = FilterR member list
where where
member {mn} = StringOccurs mn used && rootmn <> mn member {mn} = module_occurs mn used && rootmn <> mn
PR_AddABCInfo :: !String !(List LinkObjFileName) !(List LinkLibraryName) !CompilerOptions !EditWdOptions !EditWdOptions !Project -> Project module_occurs :: !String ![!ModuleDirAndName] -> Bool
PR_AddABCInfo mod_path dep_objects dep_libraries compilerOptions defeo impeo project=:{inflist=Nil} 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}
= project = project
PR_AddABCInfo mod_path dep_objects dep_libraries compilerOptions defeo impeo project=:{inflist} PR_AddABCInfo {mdn_dir=mod_dir,mdn_name=mod_name} dep_objects dep_libraries compilerOptions defeo impeo 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}
where where
mod_name = GetModuleName mod_path
mod_dir = RemoveFilename mod_path
update infListItem=:{InfListItem | info} update infListItem=:{InfListItem | info}
= ( { InfListItem | infListItem = ( { InfListItem | infListItem
& info.abcLinkInfo.linkObjFileNames = dep_objects & info.abcLinkInfo.linkObjFileNames = dep_objects
...@@ -390,6 +390,14 @@ PR_GetRootModuleDir {inflist={mn,info={dir}}:!rest} ...@@ -390,6 +390,14 @@ PR_GetRootModuleDir {inflist={mn,info={dir}}:!rest}
= EmptyPathname; = EmptyPathname;
= dir; = dir;
PR_GetRootModuleDirAndName :: !Project -> (!ModuleDirAndName,!Project)
PR_GetRootModuleDirAndName p=:{inflist=Nil}
= ({mdn_dir=EmptyPathname,mdn_name=""},p)
PR_GetRootModuleDirAndName p=:{inflist={mn,info={dir}}:!rest}
| size dir==0
= ({mdn_dir=EmptyPathname,mdn_name=""},p)
= ({mdn_dir=dir,mdn_name=mn},p)
PR_GetRootDir :: !Project -> String PR_GetRootDir :: !Project -> String
PR_GetRootDir {root_directory} PR_GetRootDir {root_directory}
= root_directory; = root_directory;
...@@ -410,6 +418,16 @@ where ...@@ -410,6 +418,16 @@ where
| full = MakeFullPathname dir (MakeImpPathname mn) | full = MakeFullPathname dir (MakeImpPathname mn)
= mn = mn
PR_GetDirAndModulenames :: !Project -> ([!ModuleDirAndName],Project)
PR_GetDirAndModulenames project=:{inflist}
# modnames = get_dir_and_module_names_r inflist [|]
= (modnames,project)
where
get_dir_and_module_names_r ({mn,info={dir}}:!inflist) r
= get_dir_and_module_names_r inflist [|{mdn_dir=dir,mdn_name=mn}:r]
get_dir_and_module_names_r Nil r
= r
PR_GetOpenModulenames :: !Project -> List String PR_GetOpenModulenames :: !Project -> List String
PR_GetOpenModulenames project=:{inflist} PR_GetOpenModulenames project=:{inflist}
= FlattenList modnames = FlattenList modnames
......
...@@ -10,6 +10,8 @@ import UtilDate ...@@ -10,6 +10,8 @@ import UtilDate
:: Modulename :== String :: Modulename :== String
:: ModuleDirAndName = {mdn_dir :: !{#Char}, mdn_name :: !{#Char}}
:: Processor //= CurrentProcessor | MC68000 | MC68020 | MC68020_and_68881 :: Processor //= CurrentProcessor | MC68000 | MC68020 | MC68020_and_68881
DefaultProcessor :: Processor DefaultProcessor :: Processor
PlatformProcessors :: [Processor] PlatformProcessors :: [Processor]
......
...@@ -48,6 +48,7 @@ Compile :: // Compiles the given file: ...@@ -48,6 +48,7 @@ Compile :: // Compiles the given file:
!(WindowFun *env) // error display fun !(WindowFun *env) // error display fun
!(WindowFun *env) // types display fun !(WindowFun *env) // types display fun
!CompileOrCheckSyntax // check syntax only? !CompileOrCheckSyntax // check syntax only?
!ModuleDirAndName
!Pathname // full .icl pathname of module to be compiled !Pathname // full .icl pathname of module to be compiled
!(List Pathname) // list of paths where compiler can find imported .dcl files !(List Pathname) // list of paths where compiler can find imported .dcl files
!Bool // project memory profiling? !Bool // project memory profiling?
...@@ -155,7 +156,7 @@ CompileStartCommand :: ...@@ -155,7 +156,7 @@ CompileStartCommand ::
!CompilerProcessIds