ATBTariffWebInterface/atbgit.pas

64 lines
1.6 KiB
ObjectPascal

unit ATBGit;
{$mode ObjFPC}{$H+}
interface
uses SysUtils, fpjson, jsonparser;
//
// public interface
//
procedure SetReposRootDirectory(const rootDir: UTF8String);
function GetReposRootDirectory(): UTF8String;
function GetLocalRepositoryPath(const localrepo: UTF8String): UTF8String;
// private c-interface
procedure SetReposRootDirectoryInternal(const rootDir: PChar); stdcall;
function GetReposRootDirectoryInternal(): PChar; stdcall;
function GetLocalRepositoryPathInternal(const localRepo: PChar): PChar; stdcall;
implementation
const DLLName = 'CalculatorCInterface.dll';
///
procedure SetReposRootDirectory(const rootDir: UTF8String);
begin
try
SetReposRootDirectoryInternal(PChar(Utf8toAnsi(rootDir)));
finally
end;
end;
///
function GetReposRootDirectory(): UTF8String;
begin
try
Result := UTF8String(GetReposRootDirectoryInternal());
finally
end;
end;
function GetLocalRepositoryPath(const localRepo: UTF8String): UTF8String;
begin
try
Result := UTF8String(GetLocalRepositoryPathInternal(PChar(Utf8toAnsi(localRepo))));
finally
end;
end;
//
// external c-interface
//
procedure SetReposRootDirectoryInternal(const rootDir: PChar); stdcall;
external DLLName;
function GetReposRootDirectoryInternal(): PChar; stdcall;
external DLLName;
function GetLocalRepositoryPathInternal(const localRepo: PChar): PChar; stdcall;
external DLLName;
end.