Subversion Repositories oidplus

Rev

Rev 992 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 992 Rev 995
Line 1... Line 1...
1
program OIDPLUS;
1
program OIDPLUS;
2
 
2
 
3
(************************************************)
3
(************************************************)
4
(* OIDPLUS.PAS                                  *)
4
(* OIDPLUS.PAS                                  *)
5
(* Author:   Daniel Marschall                   *)
5
(* Author:   Daniel Marschall                   *)
6
(* Revision: 2022-10-10                         *)
6
(* Revision: 2022-10-11                         *)
7
(* License:  Apache 2.0                         *)
7
(* License:  Apache 2.0                         *)
8
(* This file contains:                          *)
8
(* This file contains:                          *)
9
(* - "OIDplus for DOS" program                  *)
9
(* - "OIDplus for DOS" program                  *)
10
(************************************************)
10
(************************************************)
11
 
11
 
Line 415... Line 415...
415
end;
415
end;
416
 
416
 
417
function NextPossibleFileID: string;
417
function NextPossibleFileID: string;
418
var
418
var
419
  DirInfo: SearchRec;
419
  DirInfo: SearchRec;
420
  list: PStringList;
-
 
421
  iId: LongInt;
420
  iId, imax: LongInt;
422
  sId: string;
421
  sId: string;
423
begin
422
begin
424
  (* Put all found files into a list *)
-
 
425
  CreateList(list);
-
 
426
  FindFirst(RepeatStr('?',8)+OID_EXTENSION, Archive, DirInfo);
423
  FindFirst(RepeatStr('?',8)+OID_EXTENSION, Archive, DirInfo);
-
 
424
  imax := -1;
427
  while DosError = 0 do
425
  while DosError = 0 do
428
  begin
426
  begin
429
    sId := Copy(DirInfo.Name, 1, 8);
427
    sId := Copy(DirInfo.Name, 1, 8);
430
    ListAppend(list, sId);
428
    if IsPositiveIntegerOrZero(sId) then
431
    FindNext(DirInfo);
-
 
432
  end;
-
 
433
 
-
 
434
  (* Search for the first non existing item in the list *)
-
 
435
  sId := '';
-
 
436
  for iId := 0 to 99999999 do
-
 
437
  begin
429
    begin
438
    sId := ZeroPad(iId, 8);
430
      iId := StrToInt(sId);
439
    if not ListContains(list, sId) then break;
431
      if iId > iMax then iMax := iId;
-
 
432
    end;
-
 
433
    FindNext(DirInfo);
440
  end;
434
  end;
441
  NextPossibleFileId := sId;
435
  NextPossibleFileId := ZeroPad(iMax+1, 8);
442
  FreeList(list);
-
 
443
end;
436
end;
444
 
437
 
445
function NumIdAlreadyExisting(parentOID: POID; arcval: string): boolean;
438
function NumIdAlreadyExisting(parentOID: POID; arcval: string): boolean;
446
var
439
var
447
  searchDotNotation: string;
440
  searchDotNotation: string;