mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 18:13:46 +01:00
new section flag: build=MIN-MAX
This commit is contained in:
parent
6d91b0da6e
commit
5e5122edba
@ -1006,10 +1006,44 @@ var
|
|||||||
|
|
||||||
procedure saveInSection();
|
procedure saveInSection();
|
||||||
var
|
var
|
||||||
ss: TStringDynArray;
|
|
||||||
s: string;
|
|
||||||
i: integer;
|
|
||||||
base: TtplSection;
|
base: TtplSection;
|
||||||
|
|
||||||
|
function parseFlagsAndAcceptSection(flags:TStringDynArray):boolean;
|
||||||
|
var
|
||||||
|
f, k, v, s: string;
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
for f in flags do
|
||||||
|
begin
|
||||||
|
i:=pos('=',f);
|
||||||
|
if i = 0 then
|
||||||
|
begin
|
||||||
|
if f='no log' then
|
||||||
|
base.nolog:=TRUE
|
||||||
|
else if f='private' then
|
||||||
|
base.nourl:=TRUE
|
||||||
|
else if f='no list' then
|
||||||
|
base.noList:=TRUE
|
||||||
|
else if f='cache' then
|
||||||
|
base.cache:=TRUE;
|
||||||
|
Continue;
|
||||||
|
end;
|
||||||
|
k:=copy(f,1,i-1);
|
||||||
|
v:=copy(f,i+1,MAXINT);
|
||||||
|
if k = 'build' then
|
||||||
|
begin
|
||||||
|
s:=chop('-',v);
|
||||||
|
if (v > '') and (VERSION_BUILD > v) // max
|
||||||
|
or (s > '') and (VERSION_BUILD < s) then // min
|
||||||
|
exit(FALSE);
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
result:=TRUE;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
ss: TStringDynArray;
|
||||||
|
s, si: string;
|
||||||
till: pchar;
|
till: pchar;
|
||||||
append: boolean;
|
append: boolean;
|
||||||
sect, from: PtplSection;
|
sect, from: PtplSection;
|
||||||
@ -1019,29 +1053,27 @@ var
|
|||||||
if till^ = #10 then dec(till);
|
if till^ = #10 then dec(till);
|
||||||
if till^ = #13 then dec(till);
|
if till^ = #13 then dec(till);
|
||||||
|
|
||||||
|
base:=default(TtplSection);
|
||||||
base.txt:=getStr(ptxt, till);
|
base.txt:=getStr(ptxt, till);
|
||||||
// there may be flags after |
|
|
||||||
s:=cur_section;
|
|
||||||
cur_section:=chop('|', s);
|
|
||||||
base.nolog:=containsStr('no log', s);
|
|
||||||
base.nourl:=containsStr('private', s);
|
|
||||||
base.noList:=containsStr('no list', s);
|
|
||||||
base.cache:=containsStr('cache', s);
|
|
||||||
base.ts:=now();
|
base.ts:=now();
|
||||||
|
ss:=split('|',cur_section);
|
||||||
|
cur_section:=popString(ss);
|
||||||
|
if not parseFlagsAndAcceptSection(ss) then
|
||||||
|
exit;
|
||||||
|
|
||||||
s:=cur_section;
|
append:=ansiStartsStr('+', cur_section);
|
||||||
append:=ansiStartsStr('+', s);
|
|
||||||
if append then
|
if append then
|
||||||
delete(s,1,1);
|
delete(cur_section,1,1);
|
||||||
|
|
||||||
// there may be several section names separated by =
|
// there may be several section names separated by =
|
||||||
ss:=split('=', s);
|
ss:=split('=', cur_section);
|
||||||
// handle the main section specific case
|
// handle the main section specific case
|
||||||
if ss = NIL then addString('', ss);
|
if ss = NIL then
|
||||||
|
addString('', ss);
|
||||||
// assign to every name the same txt
|
// assign to every name the same txt
|
||||||
for i:=0 to length(ss)-1 do
|
for si in ss do
|
||||||
begin
|
begin
|
||||||
s:=trim(ss[i]);
|
s:=trim(si);
|
||||||
sect:=getSection(s, FALSE);
|
sect:=getSection(s, FALSE);
|
||||||
from:=NIL;
|
from:=NIL;
|
||||||
if sect = NIL then // not found
|
if sect = NIL then // not found
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user