mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 01:39:27 +02:00
--- Merging r30728 into '.':
U rtl/unix/dos.pp --- Recording mergeinfo for merge of r30728 into '.': U . --- Merging r30704 into '.': U rtl/objpas/sysutils/sysuintf.inc --- Recording mergeinfo for merge of r30704 into '.': G . --- Merging r30652 into '.': U packages/cdrom/src/cdrom.pp --- Recording mergeinfo for merge of r30652 into '.': G . --- Merging r30642 into '.': U packages/rtl-objpas/src/inc/strutils.pp --- Recording mergeinfo for merge of r30642 into '.': G . # revisions: 30728,30704,30652,30642 git-svn-id: branches/fixes_3_0@31112 -
This commit is contained in:
parent
2b6c1e12fc
commit
7ca1faa6b4
@ -20,12 +20,23 @@ unit cdrom;
|
||||
interface
|
||||
|
||||
Type
|
||||
// Frames are 1/75th of a second.
|
||||
// To get the seconds of a track divide the frames by 75.
|
||||
// TrackLen: Double; ...
|
||||
// TrackLen := Frames / 75.
|
||||
TTocEntry = Record
|
||||
min, sec, frame : Integer;
|
||||
end;
|
||||
PTocEntry = ^TTocEntry;
|
||||
|
||||
// Returns the High value to use in a loop. Each entry is the position of the end
|
||||
// of a track. For audio cd's the zero'th entry is not audio data. If an audio cd
|
||||
// has 10 songs then ReadCDToc will return 10 but there are 11 entries: 0..10.
|
||||
// You still need to use the zero'th entry to get the first track length:
|
||||
// Track1Length := TOC[1].frames = TOC[0].frames.
|
||||
Function ReadCDTOC(Device : String; Var CDTOC : Array of TTocEntry) : Integer;
|
||||
|
||||
// Returns the number of devices placed in 'Devices'
|
||||
Function GetCDRomDevices(Var Devices : Array of string) : Integer;
|
||||
|
||||
Implementation
|
||||
|
@ -1770,10 +1770,55 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
Function isMatch(inputstr,wilds : string; CWild, CinputWord: integer;MaxInputword,maxwilds : word) : Boolean;
|
||||
|
||||
begin
|
||||
Result:=True;
|
||||
repeat
|
||||
if Wilds[CWild] = '*' then { handling of '*' }
|
||||
begin
|
||||
inc(CWild);
|
||||
while Wilds[CWild] = '?' do { equal to '?' }
|
||||
begin
|
||||
{ goto next letter }
|
||||
inc(CWild);
|
||||
inc(CinputWord);
|
||||
end;
|
||||
{ increase until a match }
|
||||
Repeat
|
||||
while (inputStr[CinputWord]<>Wilds[CWild]) and (CinputWord <= MaxinputWord) do
|
||||
inc(CinputWord);
|
||||
Result:=isMatch(inputstr,wilds,CWild, CinputWord,MaxInputword,maxwilds);
|
||||
if not Result then
|
||||
Inc(cInputWord);
|
||||
Until Result or (CinputWord>=MaxinputWord);
|
||||
Continue;
|
||||
end;
|
||||
if Wilds[CWild] = '?' then { equal to '?' }
|
||||
begin
|
||||
{ goto next letter }
|
||||
inc(CWild);
|
||||
inc(CinputWord);
|
||||
Continue;
|
||||
end;
|
||||
if inputStr[CinputWord] = Wilds[CWild] then { equal letters }
|
||||
begin
|
||||
{ goto next letter }
|
||||
inc(CWild);
|
||||
inc(CinputWord);
|
||||
Continue;
|
||||
end;
|
||||
Result:=false;
|
||||
Exit;
|
||||
until (CinputWord > MaxinputWord) or (CWild > MaxWilds);
|
||||
{ no completed evaluation }
|
||||
if (CinputWord <= MaxinputWord) or (CWild <= MaxWilds) then
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function isWild(inputStr, Wilds: string; ignoreCase: boolean): boolean;
|
||||
|
||||
var
|
||||
CWild, CinputWord: integer; { counter for positions }
|
||||
i: integer;
|
||||
MaxinputWord, MaxWilds: integer; { Length of inputStr and Wilds }
|
||||
begin
|
||||
@ -1801,45 +1846,7 @@ begin
|
||||
inputStr:=AnsiUpperCase(inputStr);
|
||||
Wilds:=AnsiUpperCase(Wilds);
|
||||
end;
|
||||
CinputWord:=1;
|
||||
CWild:=1;
|
||||
repeat
|
||||
if Wilds[CWild] = '*' then { handling of '*' }
|
||||
begin
|
||||
inc(CWild);
|
||||
while Wilds[CWild] = '?' do { equal to '?' }
|
||||
begin
|
||||
{ goto next letter }
|
||||
inc(CWild);
|
||||
inc(CinputWord);
|
||||
end;
|
||||
{ increase until a match }
|
||||
while (inputStr[CinputWord] <> Wilds[CWild]) and
|
||||
(CinputWord <= MaxinputWord) do
|
||||
inc(CinputWord);
|
||||
Continue;
|
||||
end;
|
||||
if Wilds[CWild] = '?' then { equal to '?' }
|
||||
begin
|
||||
{ goto next letter }
|
||||
inc(CWild);
|
||||
inc(CinputWord);
|
||||
Continue;
|
||||
end;
|
||||
if inputStr[CinputWord] = Wilds[CWild] then { equal letters }
|
||||
begin
|
||||
{ goto next letter }
|
||||
inc(CWild);
|
||||
inc(CinputWord);
|
||||
Continue;
|
||||
end;
|
||||
Result:=false;
|
||||
Exit;
|
||||
until (CinputWord > MaxinputWord) or (CWild > MaxWilds);
|
||||
{ no completed evaluation }
|
||||
if (CinputWord <= MaxinputWord) or
|
||||
(CWild <= MaxWilds) then
|
||||
Result:=false;
|
||||
Result:=isMatch(inputStr,wilds,1,1,MaxinputWord, MaxWilds);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -157,7 +157,7 @@ begin
|
||||
SetLength(Result, 38);
|
||||
StrLFmt(PChar(Result), 38,'{%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x}',
|
||||
[
|
||||
GUID.D1, GUID.D2, GUID.D3,
|
||||
Longint(GUID.D1), GUID.D2, GUID.D3,
|
||||
GUID.D4[0], GUID.D4[1], GUID.D4[2], GUID.D4[3],
|
||||
GUID.D4[4], GUID.D4[5], GUID.D4[6], GUID.D4[7]
|
||||
]);
|
||||
|
@ -245,6 +245,7 @@ var
|
||||
begin
|
||||
GetDate (Year, Month, Day,dow);
|
||||
tv.tv_sec:= LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) ;
|
||||
tv.tv_usec:= Sec100 * 10000;
|
||||
fpSettimeofday(@tv,nil);
|
||||
end;
|
||||
|
||||
@ -255,6 +256,7 @@ var
|
||||
begin
|
||||
GetTime ( Hour, Min, Sec, Sec100 );
|
||||
tv.tv_sec:= LocalToEpoch ( Year, Month, Day, Hour, Min, Sec ) ;
|
||||
tv.tv_usec:= Sec100 * 10000;
|
||||
fpSettimeofday(@tv,nil);
|
||||
end;
|
||||
|
||||
@ -264,6 +266,7 @@ var
|
||||
tv : timeval;
|
||||
begin
|
||||
tv.tv_sec:= LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) ;
|
||||
tv.tv_usec:= 0;
|
||||
SetDatetime:=fpSettimeofday(@tv,nil)=0;
|
||||
end;
|
||||
|
||||
@ -319,7 +322,7 @@ Begin
|
||||
begin
|
||||
doserror:=2;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
pid:=fpFork;
|
||||
if pid=0 then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user