unit MCAD_Array; interface USES McadUser; type tFlag=(fAllocateReal, fAllocateImag); tFlags=set of tFlag; // Массив в MathCAD tComplexArray=class private prArray:COMPLEXARRAY; prRows,prCols:tMatrixIndex; prFlags:tFlags; procedure SetRows(r:cardinal); procedure SetCols(c:cardinal); procedure Allocate; procedure Deallocate; function GetAllocateReal:boolean; function GetAllocateImag:boolean; public constructor Create; destructor Destroy; override; procedure Reallocate; procedure Clear; function CopyTo(var Dest:tComplexArray):boolean; function CopyColumnTo(SrcCol,DstCol:tMatrixIndex; var Dest:tComplexArray):boolean; property Flags:tFlags read prFlags; property Rows:cardinal read prArray.Rows write SetRows; property Cols:cardinal read prArray.Cols write SetCols; property hReal:tPtrToMatrix read prArray.hReal; property hImag:tPtrToMatrix read prArray.hImag; property AllocateReal:boolean read GetAllocateReal; property AllocateImag:boolean read GetAllocateImag; end; implementation USES Mcad_MiscFuncs; constructor tComplexArray.Create; begin Inherited Create; prFlags:=[]; prArray.Rows:=0; prArray.Cols:=0; prArray.HReal:=NIL; prArray.HImag:=NIL; end; destructor tComplexArray.Destroy; begin Deallocate; Inherited Destroy; end; function tComplexArray.GetAllocateReal:boolean; begin Result:=fAllocateReal in Flags; end; function tComplexArray.GetAllocateImag:boolean; begin Result:=fAllocateImag in Flags; end; procedure tComplexArray.Deallocate; begin ArrayDeallocate(prArray); end; procedure tComplexArray.Allocate; begin if (prRows>0) and (prCols>0) and ((fAllocateReal in Flags) or (fAllocateImag in Flags)) then begin ArrayAllocate(prArray, prRows, prCols, (fAllocateReal in Flags),(fAllocateImag in Flags)); end; end; procedure tComplexArray.Reallocate; begin if (prRows=Rows) and (prCols>Rows) and (AllocateReal=Assigned(hReal)) and (AllocateImag=Assigned(hImag)) then begin Clear; end else begin end; end; procedure tComplexArray.SetRows; begin prRows:=r; Reallocate; end; procedure tComplexArray.SetCols; begin prCols:=c; Reallocate; end; procedure tComplexArray.Clear; begin end; function tComplexArray.CopyTo; begin end; function tComplexArray.CopyColumnTo; begin end; end.