Commit 258e9f91 authored by John van Groningen's avatar John van Groningen

optimize abc cache, replace old data with new data, if a file is modified,

instead of adding the new data and keeping the old data
parent 8f89101f
......@@ -79,8 +79,14 @@ Combined path date abccache files
= Read_Version_and_Options file
# (file,dInfo) = ParseABCDependencies file
# (_,files) = fclose file files
#! abccache = AC_Add path date dInfo abccache
= ((cInfo,dInfo,abccache),files)
#! maxi=abccache.maxi
# (cache_index,abccache) = search_path_in_cache path maxi abccache
| cache_index<0
#! abccache = AC_Add path date dInfo abccache
= ((cInfo,dInfo,abccache),files)
#! abccache = {abccache & cache.[cache_index]={c_path=path,c_date=date,c_info=dInfo}}
= ((cInfo,dInfo,abccache),files)
where
dummyCinf = (False,False,-1,DefaultABCOptions)
dummyDinf = dummyDepInfo
......@@ -232,21 +238,14 @@ where
newstuff :: ABCStuff
newstuff = {c_path=path,c_date=date,c_info=info}
UCache :: !ABCStuff !Int !*{!ABCStuff} -> *{!ABCStuff}
UCache e i a = {a & [i] = e}
ParseABCDependencies` :: !Pathname !DATE !*ABCCache !Files -> ((!Bool, !List Modulename, !Maybe ModuleDate, !List ModuleDate, !List LinkObjFileName, !List LinkLibraryName, !*ABCCache/*, !FileInfoCache*/), !Files);
ParseABCDependencies` path abcdate abccache files
= AC_Look path abccache files
where
AC_Look path abccache=:{maxi} files
# date = abcdate
# (foundl,abccache) = uSeqArray
(\{c_path,c_date}-> c_path == path && eqDate c_date date)
(\{c_info}->c_info)
(maxi)
abccache
| isEmpty foundl
# (cache_index,abccache) = search_path_in_cache path maxi abccache
| cache_index<0
# (opened,file,files) = fopen path FReadData files
| not opened
# (b,c,d,e,f) = dummyDepInfo
......@@ -255,20 +254,19 @@ where
# (_,files) = fclose file files
#! abccache = AC_Add path date (b,c,d,e,f) abccache
= ((True,b,c,d,e,f,abccache),files)
# (b,c,d,e,f) = hd foundl
= ((True,b,c,d,e,f,abccache),files)
# ({c_date,c_info},abccache) = abccache!cache.[cache_index]
| eqDate c_date date
# (b,c,d,e,f)=c_info
= ((True,b,c,d,e,f,abccache),files)
# (opened,file,files) = fopen path FReadData files
| not opened
# (b,c,d,e,f) = dummyDepInfo
= ((False,b,c,d,e,f,abccache),files)
# (file,(b,c,d,e,f)) = ParseABCDependencies file
# (_,files) = fclose file files
#! abccache = {abccache & cache.[cache_index]={c_path=path,c_date=date,c_info=(b,c,d,e,f)}}
= ((True,b,c,d,e,f,abccache),files)
uSeqList f g acc [] = ([],reverse acc)
uSeqList f g acc [h:t]
| f h = ([g h],reverse acc ++ [h:t])
= uSeqList f g [h:acc] t
uSeqArray f g n c
| n < 0 = ([],c)
# (r,c) = c!cache.[n]
| f r = ([g r],c)
= uSeqArray f g (dec n) c
eqDate l r
= l.exists == r.exists
&& l.yy == r.yy
......@@ -278,6 +276,14 @@ where
&& l.m == r.m
&& l.s == r.s
search_path_in_cache :: !{#Char} !Int !*ABCCache -> *(!Int,!*ABCCache)
search_path_in_cache path n c
| n < 0
= (-1,c)
| c.cache.[n].c_path == path
= (n,c)
= search_path_in_cache path (dec n) c
// Find the module depencies in the .abc files
dummyDepInfo = (Nil, Nothing, Nil, Nil, Nil)
......
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