unit Js;

interface

type

HCkJs = Pointer;
HCkStringBuilder = Pointer;
HCkTask = Pointer;
HCkJsonObject = Pointer;
HCkString = Pointer;


// Note: The callback functions use the cdecl calling convention, while all other functions use stdcall.
TJsAbortCheck = function(): Integer; cdecl;
TJsProgressInfo = procedure(name: PWideChar; value: PWideChar); cdecl;
TJsPercentDone = function(pctDone: Integer): Integer; cdecl;
TJsTaskCompleted = procedure(task: HCkTask); cdecl;


function CkJs_Create: HCkJs; stdcall;
procedure CkJs_Dispose(handle: HCkJs); stdcall;

procedure CkJs_SetAbortCheck(objHandle: HCkJs; fn: TJsAbortCheck) stdcall;
procedure CkJs_SetProgressInfo(objHandle: HCkJs; fn: TJsProgressInfo) stdcall;
procedure CkJs_SetPercentDone(objHandle: HCkJs; fn: TJsPercentDone) stdcall;
procedure CkJs_SetTaskCompleted(objHandle: HCkJs; fn: TJsTaskCompleted) stdcall;
procedure CkJs_getDebugLogFilePath(objHandle: HCkJs; outPropVal: HCkString); stdcall;

procedure CkJs_putDebugLogFilePath(objHandle: HCkJs; newPropVal: PWideChar); stdcall;

function CkJs__debugLogFilePath(objHandle: HCkJs): PWideChar; stdcall;

procedure CkJs_getLastErrorHtml(objHandle: HCkJs; outPropVal: HCkString); stdcall;

function CkJs__lastErrorHtml(objHandle: HCkJs): PWideChar; stdcall;

procedure CkJs_getLastErrorText(objHandle: HCkJs; outPropVal: HCkString); stdcall;

function CkJs__lastErrorText(objHandle: HCkJs): PWideChar; stdcall;

procedure CkJs_getLastErrorXml(objHandle: HCkJs; outPropVal: HCkString); stdcall;

function CkJs__lastErrorXml(objHandle: HCkJs): PWideChar; stdcall;

function CkJs_getLastMethodSuccess(objHandle: HCkJs): wordbool; stdcall;

procedure CkJs_putLastMethodSuccess(objHandle: HCkJs; newPropVal: wordbool); stdcall;

function CkJs_getTimeoutSeconds(objHandle: HCkJs): Integer; stdcall;

procedure CkJs_putTimeoutSeconds(objHandle: HCkJs; newPropVal: Integer); stdcall;

function CkJs_getVerboseLogging(objHandle: HCkJs): wordbool; stdcall;

procedure CkJs_putVerboseLogging(objHandle: HCkJs; newPropVal: wordbool); stdcall;

procedure CkJs_getVersion(objHandle: HCkJs; outPropVal: HCkString); stdcall;

function CkJs__version(objHandle: HCkJs): PWideChar; stdcall;

function CkJs_CallFunction(objHandle: HCkJs; funcJson: HCkJsonObject; resultJson: HCkJsonObject): wordbool; stdcall;

function CkJs_CallFunctionAsync(objHandle: HCkJs; funcJson: HCkJsonObject; resultJson: HCkJsonObject): HCkTask; stdcall;

procedure CkJs_ConsoleOutputSb(objHandle: HCkJs; sb: HCkStringBuilder); stdcall;

function CkJs_Eval(objHandle: HCkJs; jscript: HCkStringBuilder; resultJson: HCkJsonObject): wordbool; stdcall;

function CkJs_EvalAsync(objHandle: HCkJs; jscript: HCkStringBuilder; resultJson: HCkJsonObject): HCkTask; stdcall;

function CkJs_SetCkPermission(objHandle: HCkJs; chilkatClassName: PWideChar; permission: PWideChar): wordbool; stdcall;

implementation

{$Include chilkatDllPath.inc}

function CkJs_Create; external DLLName;
procedure CkJs_Dispose; external DLLName;

procedure CkJs_SetAbortCheck; external DLLName;
procedure CkJs_SetProgressInfo; external DLLName;
procedure CkJs_SetPercentDone; external DLLName;
procedure CkJs_SetTaskCompleted; external DLLName;
procedure CkJs_getDebugLogFilePath; external DLLName;
procedure CkJs_putDebugLogFilePath; external DLLName;
function CkJs__debugLogFilePath; external DLLName;
procedure CkJs_getLastErrorHtml; external DLLName;
function CkJs__lastErrorHtml; external DLLName;
procedure CkJs_getLastErrorText; external DLLName;
function CkJs__lastErrorText; external DLLName;
procedure CkJs_getLastErrorXml; external DLLName;
function CkJs__lastErrorXml; external DLLName;
function CkJs_getLastMethodSuccess; external DLLName;
procedure CkJs_putLastMethodSuccess; external DLLName;
function CkJs_getTimeoutSeconds; external DLLName;
procedure CkJs_putTimeoutSeconds; external DLLName;
function CkJs_getVerboseLogging; external DLLName;
procedure CkJs_putVerboseLogging; external DLLName;
procedure CkJs_getVersion; external DLLName;
function CkJs__version; external DLLName;
function CkJs_CallFunction; external DLLName;
function CkJs_CallFunctionAsync; external DLLName;
procedure CkJs_ConsoleOutputSb; external DLLName;
function CkJs_Eval; external DLLName;
function CkJs_EvalAsync; external DLLName;
function CkJs_SetCkPermission; external DLLName;



end.
