program JkDefrag;
Uses sysutils;

procedure RunJkDefrag(
  Path: PWideChar;
  Mode: Integer;
  Speed: Integer;
  FreeSpace: Double;
  Excludes: array of PWideChar;
  SpaceHogs: array of PWideChar;
  Running: PInteger;
  RedrawScreen: PInteger;
  ShowStatus, ShowMove, ShowAnalyze, ShowDebug, DrawCluster, ClearScreen: Pointer;
  DebugMsg: array of PWideChar);
  CDECL; external 'JkDefragLib' name 'RunJkDefrag';
procedure StopJkDefrag(Running: Pointer; TimeOut: Integer);
  CDECL; external 'JkDefragLib' name 'StopJkDefrag';


procedure ShowStatus(Data: pointer); CDECL;
begin
writeln('ShowStatus:');
end;

procedure ShowMove(Item: pointer; Clusters, FromLcn, ToLcn, FromVcn: int64); CDECL;
begin
writeln('ShowMove:');
end;

procedure ShowAnalyze(Data: pointer; Item: pointer); CDECL;
begin
writeln('ShowAnalyze:');
end;

procedure ShowDebug(Level: Integer; Item: Pointer; Format: PChar; Args: Array of const); CDECL;
begin
writeln('Debug: ',Format);
end;

procedure DrawCluster(Data: pointer; ClusterStart, ClusterEnd: int64; Color: Integer); CDECL;
begin
writeln('DrawCluster:');
end;

procedure ClearScreen(Format: PChar; Args: Array of const); CDECL;
begin
writeln('ClearScreen: ',Format);
end;



var
Excludes : Array of PWideChar = nil;
SpaceHogs : Array[0..2] of PWideChar = (
  '?:\WINDOWS\ServicePackFiles\*',
  '*.zip',
  nil
  );
DebugMsg : Array of PWideChar = nil;
Running: Integer;
RedrawScreen: Integer;

begin
writeln('Starting JkDefrag');
RunJkDefrag(PWideChar('c:'),0,100,1,Excludes,SpaceHogs,@Running,@RedrawScreen,
  @ShowStatus,@ShowMove,@ShowAnalyze,@ShowDebug,@DrawCluster,@ClearScreen,DebugMsg);
writeln('Finished.');
end.