{--------------------------------------------------------------------------- The control program for mass-spectrometer MI1201-AGM (c) Copyright Aleksandrov O.E., 2001 Molecular Physics department, USTU, Ekaterinsburg, K-2, 620002, RUSSIA phone 75-47-15 E-mail: aleks@dpt.ustu.ru Программа управления масс-спектрометром МИ1201-АГМ (c) Собственность Александрова О.Е., 2001 620002, Екатеринбург, К-2, УГТУ, Кафедра молекулярной физики тел. 75-47-15 E-mail: aleks@dpt.ustu.ru ----------------------------------------------------------------------------} unit MCAD_MI1201_RangeCheck; interface uses Windows, McadUserTypes; type tCheck=(fReal, fInt, fMin, fMax, fPos, fNonZero); tChecks=set of tCheck; function CheckCS(const cs:COMPLEXSCALAR; Checks:tChecks; Min,Max:int64; ParNum:byte):lRESULT; function CheckCS_RIMP(const cs:COMPLEXSCALAR; Max:int64; ParNum:byte):lRESULT; function CheckCS_RIM(const cs:COMPLEXSCALAR; Max:int64; ParNum:byte):lRESULT; function CheckCS_RM(const cs:COMPLEXSCALAR; Max:int64; ParNum:byte):lRESULT; function CheckCS_RIMm(const cs:COMPLEXSCALAR; Min,Max:int64; ParNum:byte):lRESULT; function CheckCS_RMm(const cs:COMPLEXSCALAR; Min,Max:int64; ParNum:byte):lRESULT; function CheckCS_RIMZ(const cs:COMPLEXSCALAR; Max:int64; ParNum:byte):lRESULT; function CheckCS_RP(const cs:COMPLEXSCALAR; ParNum:byte):lRESULT; function CheckCS_R(const cs:COMPLEXSCALAR; ParNum:byte):lRESULT; function CheckS(const s:DOUBLE; Checks:tChecks; Min,Max:integer; ParNum:byte):lRESULT; function CheckS_IMP(const s:DOUBLE; Max:integer; ParNum:byte):lRESULT; function CheckS_IMmP(const s:DOUBLE; Min,Max:integer; ParNum:byte):lRESULT; implementation Uses MCAD_MI1201_Errors; function CheckIntAndMaxValue(const a:ComplexArray; MaxValue:cardinal):LRESULT; var i:byte; begin Result:=0; for i:=0 to Pred(a.rows) do begin if (Frac(a.hReal[0,i])<>0.0) then begin Result:=MakeErrorResult(ecMUST_BE_INTEGER, Succ(i)); Exit; end; if (Trunc(a.hReal[0,i])>(High(cardinal) div 2)) then begin Result:=MakeErrorResult(ecINVALID_PARAMETER_VALUE, Succ(i)); Exit; end; end; end; function CheckS; begin if (fInt in Checks) and (Frac(s)<>0.0) then Result:=MakeErrorResult(ecMUST_BE_INTEGER,ParNum) else if (fPos in Checks) and (s<0) then Result:=MakeErrorResult(ecMUST_BE_POSITIVE,ParNum) else if ((fMax in Checks) and (Trunc(s)>Max)) or ((fMin in Checks) and (Trunc(s)0.0) then Result:=MakeErrorResult(ecMUST_BE_REAL,ParNum) else if (fInt in Checks) and (Frac(cs.real)<>0.0) then Result:=MakeErrorResult(ecMUST_BE_INTEGER,ParNum) else if (fPos in Checks) and (cs.real<0) then Result:=MakeErrorResult(ecMUST_BE_POSITIVE,ParNum) else if ((fMax in Checks) and (Trunc(cs.real)>Max)) or ((fMin in Checks) and (Trunc(cs.real)