📄 unitdllfunctiontcompile.pas
字号:
begin
result:=TCompile(hcm).IfHaveUnDefineParameter();
end;
function cm_SetExteriorParameter(const hcm: cm_Handle;const PName:PChar;const PAddress:PExtended):longbool;stdcall;
begin
result:=TCompile(hcm).SetExteriorParameter(PName,PAddress);
end;
function cm_SetExteriorArrayParameter(const hcm: cm_Handle;const ArrayPName:PChar;const ArrayPAddress:PExtended):longbool;stdcall;
begin
result:=TCompile(hcm).SetExteriorArrayParameter(ArrayPName,ArrayPAddress);
end;
procedure cm_RefreshExeAddressCodeInPointer(const hcm: cm_Handle);stdcall;
begin
TCompile(hcm).RefreshExeAddressCodeInPointer();
end;
function cm_Define(const hcm: cm_Handle;const Key,Value : PChar):longbool;stdcall;
begin
result:=TCompile(hcm).Define(Key,Value);
end;
function cm_DefineConst(const hcm: cm_Handle;const Key,Value: PChar):longbool;stdcall;
begin
result:=TCompile(hcm).DefineConst(Key,Value);
end;
function cm_GetParameterAddress(const hcm: cm_Handle;const PName:PChar):PExtended;stdcall;
begin
result:=TCompile(hcm).GetParameterAddress(PName);
end;
function cm_SetParameterN(const hcm: cm_Handle;const PName:PChar;const dValue:Extended):longbool;stdcall;
begin
result:=TCompile(hcm).SetParameter(PName,dValue);
end;
procedure cm_SetParameterA(const hcm: cm_Handle;const PAddress:PExtended;const dValue:Extended);stdcall;
begin
//TCompile(hcm).SetParameter(PAddress,dValue);
PAddress^:=dValue;
end;
procedure cm_GetParameterValue(const hcm: cm_Handle;const PName:PChar;const PResult: PExtended);stdcall;
begin
PResult^:=TCompile(hcm).GetParameterValue(PName);
end;
Function cm_GetUserParameterCount(const hcm: cm_Handle):DWord;stdcall;
begin
result:=TCompile(hcm).GetUserParameterCount();
end;
procedure cm_GetUserParameterList(const hcm: cm_Handle;const PList:cm_PTUserParameterList);
var
tPList :array of TUserParameterList;
i,count : integer;
tpPList : cm_PTUserParameterList;
procedure StringToCharArray(xpchar:Pchar ; str:string);
var
j : integer;
ccount : integer;
begin
ccount:=min(cm_Max_ParameterName_Length,length(str));
for j:=0 to count-1 do
begin
PChar(Dword(xpchar)+dword(j))^:=str[j]
end;
if ccount<cm_Max_ParameterName_Length then
begin
PChar(Dword(xpchar)+Dword(ccount))^:=#0;
end;
end;
begin
count:=TCompile(hcm).GetUserParameterCount();
Setlength(tPList,count);
TCompile(hcm).GetUserParameterList(tPList);
tpPList:=PList;
for i:=0 to count-1 do
begin
StringToCharArray(@(tpPList^.CName[0]),tPList[i].CName);
tpPList^.CAddress:=tPList[i].CAddress;
inc(DWord(tpPList),sizeof(cm_TUserParameterList));
end;
end;
function cm_IfHaveParameter(const hcm: cm_Handle;const PName:PChar):longBool;stdcall;
begin
result:=TCompile(hcm).IfHaveParameter(PName);
end;
procedure cm_SetRandomizeT(const hcm: cm_Handle);stdcall;
begin
TCompile(hcm).SetRandomize();
end;
procedure cm_SetRandomizeI(const hcm: cm_Handle;const RandomSeed :integer);stdcall;
begin
TCompile(hcm).SetRandomize(RandomSeed);
end;
procedure cm_SetEnabledNote(const hcm: cm_Handle;const Value:longbool);stdcall;
begin
TCompile(hcm).EnabledNote:=Value;
end;
procedure cm_SetEnabledOptimizeDiv(const hcm: cm_Handle;const Value:longbool); stdcall;
begin
TCompile(hcm).EnabledOptimizeDiv:=Value;
end;
procedure cm_SetEnabledOptimizeStack(const hcm: cm_Handle;const Value:longbool);stdcall;
begin
TCompile(hcm).EnabledOptimizeStack:=Value;
end;
procedure cm_SetEnabledOptimizeConst(const hcm: cm_Handle;const Value:longbool); stdcall;
begin
TCompile(hcm).EnabledOptimizeConst:=Value;
end;
Function cm_GetVersion():double;stdcall;
begin
result:=TCompile.GetVersion();
end;
function cm_GetErrorCode(const hcm: cm_Handle):integer;stdcall;
begin
result:=TCompile(hcm).GetErrorCode();
end;
Function cm_GetExeCodeLength(const hcm: cm_Handle):integer; stdcall;
begin
result:=TCompile(hcm).GetExeCodeLength();
end;
Function cm_GetExeParameterLength(const hcm: cm_Handle):integer;stdcall;
begin
result:=TCompile(hcm).GetExeParameterLength();
end;
////////////////////////////
//VB
function VB_cm_GetValue(const hcm: cm_Handle):double;stdcall;
begin
result:=TCompile(hcm).GetValue();
end;
function VB_cm_GetFunctionValue(const hcm: cm_Handle; const PList: PDouble ):Double;stdcall; // (编译后才能调用)
var
i,l : integer;
ArrayExtended :array of Extended;
begin
l:=TCompile(hcm).GetFunctionPlistCount();
setlength(ArrayExtended,l);
for i:=0 to l-1 do
begin
ArrayExtended[i]:=PDouble(DWORD(PList)+DWORD(i)*8)^;
end;
result:=TCompile(hcm).GetFunctionValue(ArrayExtended);
end;
procedure VB_cm_SetFunctionParameter(const hcm: cm_Handle; const PList: PDouble );stdcall;
var
i,l : integer;
ArrayExtended :array of Extended;
begin
l:=TCompile(hcm).GetFunctionPlistCount();
setlength(ArrayExtended,l);
for i:=0 to l-1 do
begin
ArrayExtended[i]:=PDouble(DWORD(PList)+DWORD(i)*8)^;
end;
TCompile(hcm).SetFunctionParameter(ArrayExtended);
end;
function VB_cm_SetParameterN(const hcm: cm_Handle;const PName:PChar;const dValue:double):longbool;stdcall;
begin
result:=TCompile(hcm).SetParameter(PName,dValue);
end;
procedure VB_cm_SetParameterA(const hcm: cm_Handle;const PAddress:PExtended;const dValue:Double);stdcall;
begin
//TCompile(hcm).SetParameter(PAddress,dValue);
PAddress^:=dValue;
end;
function VB_cm_GetParameterValueN(const hcm: cm_Handle;const PName:PChar):double;stdcall;
begin
result:=TCompile(hcm).GetParameterValue(PName);
end;
function VB_cm_GetParameterValueA(const PAddress:PExtended):double;stdcall;
begin
result:=PAddress^;
end;
function CPUCycleCounter():int64 register;assembler;{获取当前CPU周期计数(CPU周期数)}
asm
RDTSC {eax,edx}
end;
function VB_GetCPUCount():double;stdcall;
begin
result:=CPUCycleCounter();
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -