📄 unitdllfunctiontcompilecomplex.pas
字号:
begin
result:=TCompileComplex(hcmcx).SetExteriorArrayParameter(ArrayPName,ArrayPAddress);
end;
procedure cmcx_RefreshExeAddressCodeInPointer(const hcmcx: cmcx_Handle);stdcall;
begin
TCompileComplex(hcmcx).RefreshExeAddressCodeInPointer();
end;
function cmcx_Define(const hcmcx: cmcx_Handle;const Key,Value : PChar):longbool;stdcall;
begin
result:=TCompileComplex(hcmcx).Define(Key,Value);
end;
function cmcx_DefineConst(const hcmcx: cmcx_Handle;const Key,Value: PChar):longbool;stdcall;
begin
result:=TCompileComplex(hcmcx).DefineConst(Key,Value);
end;
function cmcx_GetParameterAddress(const hcmcx: cmcx_Handle;const PName:PChar):PTComplex;stdcall;
begin
result:=TCompileComplex(hcmcx).GetParameterAddress(PName);
end;
function cmcx_SetParameterN(const hcmcx: cmcx_Handle;const PName:PChar;const dValue:TComplex):longbool;stdcall;
begin
result:=TCompileComplex(hcmcx).SetParameter(PName,dValue);
end;
procedure cmcx_SetParameterA(const hcmcx: cmcx_Handle;const PAddress:PTComplex;const dValue:TComplex);stdcall;
begin
//TCompileComplex(hcmcx).SetParameter(PAddress,dValue);
PAddress^:=dValue;
end;
procedure cmcx_GetParameterValue(const hcmcx: cmcx_Handle;const PName:PChar;const PResult: PTComplex);stdcall;
begin
PResult^:=TCompileComplex(hcmcx).GetParameterValue(PName);
end;
Function cmcx_GetUserParameterCount(const hcmcx: cmcx_Handle):DWord;stdcall;
begin
result:=TCompileComplex(hcmcx).GetUserParameterCount();
end;
procedure cmcx_GetUserParameterList(const hcmcx: cmcx_Handle;const PList:cmcx_PTUserParameterList);
var
tPList :array of TUserParameterListCmCx;
i,count : integer;
tpPList : cmcx_PTUserParameterList;
procedure StringToCharArray(xpchar:Pchar ; str:string);
var
j : integer;
ccount : integer;
begin
ccount:=min(cmcx_Max_ParameterName_Length,length(str));
for j:=0 to count-1 do
begin
PChar(Dword(xpchar)+dword(j))^:=str[j]
end;
if ccount<cmcx_Max_ParameterName_Length then
begin
PChar(Dword(xpchar)+Dword(ccount))^:=#0;
end;
end;
begin
count:=TCompileComplex(hcmcx).GetUserParameterCount();
Setlength(tPList,count);
TCompileComplex(hcmcx).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(cmcx_TUserParameterList));
end;
end;
function cmcx_IfHaveParameter(const hcmcx: cmcx_Handle;const PName:PChar):longBool;stdcall;
begin
result:=TCompileComplex(hcmcx).IfHaveParameter(PName);
end;
procedure cmcx_SetRandomizeT(const hcmcx: cmcx_Handle);stdcall;
begin
TCompileComplex(hcmcx).SetRandomize();
end;
procedure cmcx_SetRandomizeI(const hcmcx: cmcx_Handle;const RandomSeed :integer);stdcall;
begin
TCompileComplex(hcmcx).SetRandomize(RandomSeed);
end;
procedure cmcx_SetEnabledNote(const hcmcx: cmcx_Handle;const Value:longbool);stdcall;
begin
TCompileComplex(hcmcx).EnabledNote:=Value;
end;
procedure cmcx_SetEnabledOptimizeDiv(const hcmcx: cmcx_Handle;const Value:longbool); stdcall;
begin
TCompileComplex(hcmcx).EnabledOptimizeDiv:=Value;
end;
procedure cmcx_SetEnabledOptimizeStack(const hcmcx: cmcx_Handle;const Value:longbool);stdcall;
begin
TCompileComplex(hcmcx).EnabledOptimizeStack:=Value;
end;
procedure cmcx_SetEnabledOptimizeConst(const hcmcx: cmcx_Handle;const Value:longbool); stdcall;
begin
TCompileComplex(hcmcx).EnabledOptimizeConst:=Value;
end;
Function cmcx_GetVersion():double;stdcall;
begin
result:=TCompileComplex.GetVersion();
end;
function cmcx_GetErrorCode(const hcmcx: cmcx_Handle):integer;stdcall;
begin
result:=TCompileComplex(hcmcx).GetErrorCode();
end;
Function cmcx_GetExeCodeLength(const hcmcx: cmcx_Handle):integer; stdcall;
begin
result:=TCompileComplex(hcmcx).GetExeCodeLength();
end;
Function cmcx_GetExeParameterLength(const hcmcx: cmcx_Handle):integer;stdcall;
begin
result:=TCompileComplex(hcmcx).GetExeParameterLength();
end;
////////////////////////////
//VB
procedure VB_cmcx_GetValue(const hcmcx: cmcx_Handle;const RReal,RImag :PDouble);stdcall;
var
rt : TComplex;
begin
rt:=TCompileComplex(hcmcx).GetValue();
RReal^:=rt.x;
RImag^:=rt.y;
end;
procedure VB_cmcx_GetFunctionValue(const hcmcx: cmcx_Handle; const PList: PDouble ;const RReal,RImag :PDouble);stdcall; // (编译后才能调用)
var
i,l : integer;
ArrayComplex :array of TComplex;
rt : TComplex;
begin
l:=TCompileComplex(hcmcx).GetFunctionPlistCount();
setlength(ArrayComplex,l);
for i:=0 to l-1 do
begin
ArrayComplex[i].x:=PDouble(DWORD(PList)+DWORD(i)*16)^;
ArrayComplex[i].y:=PDouble(DWORD(PList)+DWORD(i)*16+8)^;
end;
rt:=TCompileComplex(hcmcx).GetFunctionValue(ArrayComplex);
RReal^:=rt.x;
RImag^:=rt.y;
end;
procedure VB_cmcx_SetFunctionParameter(const hcmcx: cmcx_Handle; const PList: PDouble );stdcall;
var
i,l : integer;
ArrayComplex :array of TComplex;
begin
l:=TCompileComplex(hcmcx).GetFunctionPlistCount();
setlength(ArrayComplex,l);
for i:=0 to l-1 do
begin
ArrayComplex[i].x:=PDouble(DWORD(PList)+DWORD(i)*16)^;
ArrayComplex[i].y:=PDouble(DWORD(PList)+DWORD(i)*16+8)^;
end;
TCompileComplex(hcmcx).SetFunctionParameter(ArrayComplex);
end;
function VB_cmcx_SetParameterN(const hcmcx: cmcx_Handle;const PName:PChar;const dValueRe,dValueIm:double):longbool;stdcall;
var
rt : TComplex;
begin
rt.x:=dValueRe;
rt.y:=dValueIm;
result:=TCompileComplex(hcmcx).SetParameter(PName,rt);
end;
procedure VB_cmcx_SetParameterA(const hcmcx: cmcx_Handle;const PAddress:PTComplex;const dValueRe,dValueIm:Double);stdcall;
begin
PAddress^.x:=dValueRe;
PAddress^.y:=dValueIm;
end;
procedure VB_cmcx_GetParameterValueN(const hcmcx: cmcx_Handle;const PName:PChar;const RReal,RImag :PDouble);stdcall;
var
rt : TComplex;
begin
rt:=TCompileComplex(hcmcx).GetParameterValue(PName);
RReal^:=rt.x;
RImag^:=rt.y;
end;
procedure VB_cmcx_GetParameterValueA(const PAddress:PTComplex;const RReal,RImag:PDouble); stdcall;
begin
RReal^:=PAddress^.x;
RImag^:=PAddress^.y;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -