| 1 |
unit baslibc; |
| 2 |
{$IFDEF FPC} |
| 3 |
{$MODE DELPHI}{$H+} |
| 4 |
{$ENDIF} |
| 5 |
{$INLINE ON} |
| 6 |
|
| 7 |
interface |
| 8 |
uses |
| 9 |
Classes, SysUtils, |
| 10 |
base,base2,textfile,baslib,mathc; |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
{*****************} |
| 15 |
{Numeric functions} |
| 16 |
{*****************} |
| 17 |
function CSQRT(const x:complex):complex; |
| 18 |
function EXP(const x:Complex):Complex;inline; overload; |
| 19 |
function LOG(const x:Complex):Complex;inline; overload; |
| 20 |
function Power(const Base,Exponent:Complex):Complex;inline; overload; |
| 21 |
function Power(const Base:double; const Exponent:Complex):Complex;inline; overload; |
| 22 |
function Power(const Base:complex; const Exponent:double):Complex;inline; overload; |
| 23 |
|
| 24 |
function SIN(const x:double):double;inline; overload; |
| 25 |
function COS(const x:double):double;inline; overload; |
| 26 |
function SINDEG(const x:double):double;inline; overload; |
| 27 |
function COSDEG(const x:double):double;inline; overload; |
| 28 |
|
| 29 |
function SIN(const x:Complex):double;inline; overload; |
| 30 |
function COS(const x:Complex):double;inline; overload; |
| 31 |
function SINDEG(const x:Complex):double;inline; overload; |
| 32 |
function COSDEG(const x:Complex):double;inline; overload; |
| 33 |
|
| 34 |
function deg(x:double):double; overload; |
| 35 |
function rad(x:double):double; overload; |
| 36 |
function deg(x:complex):double; overload; |
| 37 |
function rad(x:complex):double; overload; |
| 38 |
|
| 39 |
|
| 40 |
function SGN(const x:Complex):double;inline; overload; |
| 41 |
function TAN(const x:Complex):double;inline; overload; |
| 42 |
function COT(const x:Complex):double;inline; overload; |
| 43 |
function SEC(const x:Complex):double;inline; overload; |
| 44 |
function CSC(const x:Complex):double;inline; overload; |
| 45 |
function ATN(const x:Complex):double;inline; overload; |
| 46 |
function ACOS(const x:Complex):double;inline; overload; |
| 47 |
function ASIN(const x:Complex):double;inline; overload; |
| 48 |
function TANDEG(const x:Complex):double;inline;overload; |
| 49 |
function COTDEG(const x:Complex):double;inline;overload; |
| 50 |
function SECDEG(const x:Complex):double;inline;overload; |
| 51 |
function CSCDEG(const x:Complex):double;inline;overload; |
| 52 |
function ATNDEG(const x:Complex):double;inline;overload; |
| 53 |
function ACOSDEG(const x:Complex):double;inline;overload; |
| 54 |
function ASINDEG(const x:Complex):double;inline;overload; |
| 55 |
function ANGLE(const x,y:Complex):double;inline;overload; |
| 56 |
function ANGLEDEG(const x,y:Complex):double;inline;overload; |
| 57 |
function ANGLE(const x:complex; const y:double):double;inline;overload; |
| 58 |
function ANGLEDEG(const x:complex; const y:double):double;inline;overload; |
| 59 |
function ANGLE(const x:double; const y:complex):double;inline;overload; |
| 60 |
function ANGLEDEG(const x:double; const y:complex):double;inline;overload; |
| 61 |
function COSH(const x:Complex):double;inline; overload; |
| 62 |
function SINH(const x:Complex):double;inline; overload; |
| 63 |
function LOG2(const x:Complex):double;inline; overload; |
| 64 |
function LOG10(const x:Complex):double;inline; overload; |
| 65 |
function EPS(x:Complex):double;inline; overload; |
| 66 |
function BINT( x:Complex):double;inline; overload; |
| 67 |
function BCEIL(x:Complex):double;inline; overload; |
| 68 |
function ROUND( x:Complex):double; inline; overload; |
| 69 |
function ROUND( x,y:Complex):double; overload; |
| 70 |
function ROUND( x:double; y:Complex):double; overload; |
| 71 |
function ROUND( x:Complex; y:double):double; overload; |
| 72 |
function BMOD( x,y:Complex):double;inline; overload; |
| 73 |
function BMOD( x:double; y:Complex):double;inline; overload; |
| 74 |
function BMOD( x:Complex; y:double):double;inline; overload; |
| 75 |
function REMAINDER( x,y:Complex):double;inline; overload; |
| 76 |
function REMAINDER( x:double; y:Complex):double;inline; overload; |
| 77 |
function REMAINDER( x:Complex; y:double):double;inline; overload; |
| 78 |
function TRUNCATE( x,y:Complex):double;inline; overload; |
| 79 |
function TRUNCATE( x:double; y:Complex):double;inline; overload; |
| 80 |
function TRUNCATE( x:Complex; y:double):double;inline; overload; |
| 81 |
function BMIN(const x,y:Complex):double;inline; overload; |
| 82 |
function BMIN(const x:double; const y:Complex):double;inline; overload; |
| 83 |
function BMIN(const x:Complex; const y:double):double;inline; overload; |
| 84 |
function BMAX(const x,y:Complex):double;inline; overload; |
| 85 |
function BMAX(const x:double; const y:Complex):double;inline; overload; |
| 86 |
function BMAX(const x:Complex; const y:double):double;inline; overload; |
| 87 |
|
| 88 |
function FRAC(x:complex):double; inline; overload; |
| 89 |
function INT(x:complex):double; inline; overload; |
| 90 |
|
| 91 |
function PERM( n,r:Complex):double; overload; |
| 92 |
function PERM( n:double; r:Complex):double; overload; |
| 93 |
function PERM( n:Complex; r:double):double; overload; |
| 94 |
function COMB( n,r:Complex):double; overload; |
| 95 |
function COMB( n:double; r:Complex):double; overload; |
| 96 |
function COMB( n:Complex; r:double):double; overload; |
| 97 |
function FACT(const x:Complex):double; overload; |
| 98 |
|
| 99 |
|
| 100 |
{****************} |
| 101 |
{STRING Functions} |
| 102 |
{****************} |
| 103 |
function SubString(s:string; i1,i2:Complex):string; overload; |
| 104 |
function SubString(s:string; i1:double; i2:Complex):string; overload; |
| 105 |
function SubString(s:string; i1:complex; i2:double):string; overload; |
| 106 |
function SubStringByte(s:string; i1,i2:Complex):string; overload; |
| 107 |
function SubStringByte(s:string; i1:double; i2:Complex):string; overload; |
| 108 |
function SubStringByte(s:string; i1:complex; i2:double):string; overload; |
| 109 |
function STR_s(x:Complex):string; overload; |
| 110 |
function CHR_s(x:Complex):string; overload; |
| 111 |
function CHRbyte(x:Complex):string; overload; |
| 112 |
function USING_s(const s:string; x:Complex):string; overload; |
| 113 |
function USING_ss(const s:string; x:Complex):string; overload; |
| 114 |
function REPEAT_s(const s:string; x:Complex):string; overload; |
| 115 |
function BSTR_s(x:Complex; n:integer):string; overload; |
| 116 |
|
| 117 |
function Mid_s(s:string; i1,i2:Complex):string; overload; |
| 118 |
function Mid_s(s:string; i1:double; i2:Complex):string; overload; |
| 119 |
function Mid_s(s:string; i1:complex; i2:double):string; overload; |
| 120 |
function Mid_sByte(s:string; i1,i2:Complex):string; overload; |
| 121 |
function Mid_sByte(s:string; i1:double; i2:Complex):string; overload; |
| 122 |
function Mid_sByte(s:string; i1:complex; i2:double):string; overload; |
| 123 |
function Left_sByte(s:string; i:Complex):string; overload; |
| 124 |
function Left_s(s:string;i:Complex):string; overload; |
| 125 |
function Right_sByte(s:string; i:Complex):string; overload; |
| 126 |
function Right_s(s:string;i:Complex):string; overload; |
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
{String Variable} |
| 131 |
procedure SubstSubstringByte(var v:AnsiString; i,j:Complex; const s:ansistring); overload; |
| 132 |
procedure SubstSubstringByte(var v:AnsiString; i:double; j:Complex; const s:ansistring); overload; |
| 133 |
procedure SubstSubstringByte(var v:AnsiString; i:Complex; j:double; const s:ansistring); overload; |
| 134 |
procedure SubstSubstring(var v:AnsiString; i,j:Complex; const s:ansistring); overload; |
| 135 |
procedure SubstSubstring(var v:AnsiString; i:double; j:Complex; const s:ansistring); overload; |
| 136 |
procedure SubstSubstring(var v:AnsiString; i:Complex; j:double; const s:ansistring); overload; |
| 137 |
|
| 138 |
{Let Statements} |
| 139 |
procedure LETC(const p:Array of PComplex; x:Complex); |
| 140 |
|
| 141 |
{ Ask Statement} |
| 142 |
procedure AskFile(ch:TTextDEvice; |
| 143 |
expAccess,expDatum,expErasable,expFileType,expName, |
| 144 |
expOrganization,expPointer,expRecsize1,expRecType, |
| 145 |
expSetter,expCharin,expTypeahead,expEchoControl,expEcho:TStrVar; |
| 146 |
expMargin,expRecSize2,expZonewidth,expCharacterPending,expFilesize:PComplex); |
| 147 |
|
| 148 |
|
| 149 |
{Misc.} |
| 150 |
procedure Wait(n:Complex); overload; |
| 151 |
procedure swap(var x,y:Complex);overload; |
| 152 |
|
| 153 |
{TComplex} |
| 154 |
type |
| 155 |
TComplex = class |
| 156 |
value:Complex; |
| 157 |
constructor create(x:complex);overload; |
| 158 |
//constructor create(x:double);overload; |
| 159 |
function str:ansistring; |
| 160 |
end; |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
implementation |
| 165 |
uses math2sub; |
| 166 |
|
| 167 |
|
| 168 |
{*****************} |
| 169 |
{Numeric functions} |
| 170 |
{*****************} |
| 171 |
function CSQRT(const x:complex):complex; |
| 172 |
begin |
| 173 |
if x.x>=0.0 then |
| 174 |
if x.y=0.0 then |
| 175 |
begin |
| 176 |
result.y:=0; |
| 177 |
result.x:=sqrt(x.x) |
| 178 |
end |
| 179 |
else |
| 180 |
begin |
| 181 |
result.x:=sqrt((sqrt(sqr(x.x)+sqr(x.y))+x.x)/2.0); |
| 182 |
result.y:=x.y/(2.0*result.x); |
| 183 |
end |
| 184 |
else |
| 185 |
begin |
| 186 |
result.y:=sqrt((sqrt(sqr(x.x)+sqr(x.y))-x.x)/2.0); |
| 187 |
if x.y<0 then result.y:=-result.y; |
| 188 |
result.x:=x.y/(2.0*result.y); |
| 189 |
end; |
| 190 |
end; |
| 191 |
|
| 192 |
function SIN(const x:double):double;inline; overload; |
| 193 |
begin |
| 194 |
result:=system.sin(x) |
| 195 |
end; |
| 196 |
|
| 197 |
function COS(const x:double):double;inline; overload; |
| 198 |
begin |
| 199 |
result:=system.cos(x) |
| 200 |
end; |
| 201 |
|
| 202 |
function SINDEG(const x:double):double;inline; overload; |
| 203 |
begin |
| 204 |
result:=math2sub.SINDeg(x) |
| 205 |
end; |
| 206 |
|
| 207 |
function COSDEG(const x:double):double;inline; overload; |
| 208 |
begin |
| 209 |
result:=math2sub.COSDeg(x) |
| 210 |
end; |
| 211 |
|
| 212 |
function SIN(const x:Complex):double;inline; overload; |
| 213 |
begin |
| 214 |
result:=system.SIN(testreal(x)) |
| 215 |
end; |
| 216 |
|
| 217 |
function COS(const x:Complex):double;inline; overload; |
| 218 |
begin |
| 219 |
result:=system.COS(testreal(x)) |
| 220 |
end; |
| 221 |
|
| 222 |
function SINDEG(const x:Complex):double;inline; overload; |
| 223 |
begin |
| 224 |
result:=math2sub.SINDeg(testreal(x)) |
| 225 |
end; |
| 226 |
|
| 227 |
function COSDEG(const x:Complex):double;inline; overload; |
| 228 |
begin |
| 229 |
result:=math2sub.COSDeg(testreal(x)) |
| 230 |
end; |
| 231 |
|
| 232 |
function deg(x:double):double; |
| 233 |
begin |
| 234 |
result:=math2sub.deg(x); |
| 235 |
end; |
| 236 |
|
| 237 |
function rad(x:double):double; |
| 238 |
begin |
| 239 |
result:=math2sub.rad(x); |
| 240 |
end; |
| 241 |
|
| 242 |
function deg(x:complex):double; |
| 243 |
begin |
| 244 |
result:=math2sub.deg(testreal(x)) |
| 245 |
end; |
| 246 |
|
| 247 |
function rad(x:complex):double; |
| 248 |
begin |
| 249 |
result:=math2sub.rad(testreal(x)) |
| 250 |
end; |
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
function SGN(const x:Complex):double;inline; overload; |
| 255 |
begin |
| 256 |
result:=baslib.SGN(testreal(x)) |
| 257 |
end; |
| 258 |
|
| 259 |
function TAN(const x:Complex):double;inline; overload; |
| 260 |
begin |
| 261 |
result:=baslib.TAN(testreal(x)) |
| 262 |
end; |
| 263 |
|
| 264 |
function COT(const x:Complex):double;inline; overload; |
| 265 |
begin |
| 266 |
result:=baslib.COT(testreal(x)) |
| 267 |
end; |
| 268 |
|
| 269 |
function SEC(const x:Complex):double;inline; overload; |
| 270 |
begin |
| 271 |
result:=baslib.SEC(testreal(x)) |
| 272 |
end; |
| 273 |
|
| 274 |
function CSC(const x:Complex):double;inline; overload; |
| 275 |
begin |
| 276 |
result:=baslib.CSC(testreal(x)) |
| 277 |
end; |
| 278 |
|
| 279 |
function ATN(const x:Complex):double;inline; overload; |
| 280 |
begin |
| 281 |
result:=baslib.ATN(testreal(x)) |
| 282 |
end; |
| 283 |
|
| 284 |
function ACOS(const x:Complex):double;inline; overload; |
| 285 |
begin |
| 286 |
result:=baslib.ACOS(testreal(x)) |
| 287 |
end; |
| 288 |
|
| 289 |
function ASIN(const x:Complex):double;inline; overload; |
| 290 |
begin |
| 291 |
result:=baslib.TAN(testreal(x)) |
| 292 |
end; |
| 293 |
|
| 294 |
function TANDEG(const x:Complex):double;inline;overload; |
| 295 |
begin |
| 296 |
result:=baslib.TANDEG(testreal(x)) |
| 297 |
end; |
| 298 |
|
| 299 |
function COTDEG(const x:Complex):double;inline;overload; |
| 300 |
begin |
| 301 |
result:=baslib.COTDEG(testreal(x)) |
| 302 |
end; |
| 303 |
|
| 304 |
function SECDEG(const x:Complex):double;inline;overload; |
| 305 |
begin |
| 306 |
result:=baslib.SECDEG(testreal(x)) |
| 307 |
end; |
| 308 |
|
| 309 |
function CSCDEG(const x:Complex):double;inline;overload; |
| 310 |
begin |
| 311 |
result:=baslib.CSCDEG(testreal(x)) |
| 312 |
end; |
| 313 |
|
| 314 |
function ATNDEG(const x:Complex):double;inline;overload; |
| 315 |
begin |
| 316 |
result:=baslib.ATNDEG(testreal(x)) |
| 317 |
end; |
| 318 |
|
| 319 |
function ACOSDEG(const x:Complex):double;inline;overload; |
| 320 |
begin |
| 321 |
result:=baslib.ACOSDEG(testreal(x)) |
| 322 |
end; |
| 323 |
|
| 324 |
function ASINDEG(const x:Complex):double;inline;overload; |
| 325 |
begin |
| 326 |
result:=baslib.ASINDEG(testreal(x)) |
| 327 |
end; |
| 328 |
|
| 329 |
function ANGLE(const x,y:Complex):double;inline;overload; |
| 330 |
begin |
| 331 |
result:=baslib.ANGLE(testreal(x),testreal(y)) |
| 332 |
end; |
| 333 |
|
| 334 |
function ANGLEDEG(const x,y:Complex):double;inline;overload; |
| 335 |
begin |
| 336 |
result:=baslib.ANGLEDEG(testreal(x),testreal(y)) |
| 337 |
end; |
| 338 |
|
| 339 |
function ANGLE(const x:complex; const y:double):double;inline;overload; |
| 340 |
begin |
| 341 |
result:=baslib.ANGLE(testreal(x),testreal(y)) |
| 342 |
end; |
| 343 |
|
| 344 |
function ANGLEDEG(const x:complex; const y:double):double;inline;overload; |
| 345 |
begin |
| 346 |
result:=baslib.ANGLEDEG(testreal(x),testreal(y)) |
| 347 |
end; |
| 348 |
|
| 349 |
function ANGLE(const x:double; const y:complex):double;inline;overload; |
| 350 |
begin |
| 351 |
result:=baslib.ANGLE(testreal(x),testreal(y)) |
| 352 |
end; |
| 353 |
|
| 354 |
function ANGLEDEG(const x:double; const y:complex):double;inline;overload; |
| 355 |
begin |
| 356 |
result:=baslib.ANGLEDEG(testreal(x),testreal(y)) |
| 357 |
end; |
| 358 |
|
| 359 |
|
| 360 |
function COSH(const x:Complex):double;inline; overload; |
| 361 |
begin |
| 362 |
result:=baslib.COSH(testreal(x)) |
| 363 |
end; |
| 364 |
|
| 365 |
function SINH(const x:Complex):double;inline; overload; |
| 366 |
begin |
| 367 |
result:=baslib.SINH(testreal(x)) |
| 368 |
end; |
| 369 |
|
| 370 |
function EXP(const x:Complex):Complex;inline; overload; |
| 371 |
begin |
| 372 |
excode:=$03EB0BBC; // 1003 3004 |
| 373 |
result:=mathc.EXP(x); |
| 374 |
excode:=DefaultExcode |
| 375 |
end; |
| 376 |
|
| 377 |
function LOG(const x:Complex):Complex;inline; overload; |
| 378 |
begin |
| 379 |
excode:=$03EB0BBC; // 1003 3004 |
| 380 |
result:=mathc.LOG(x); |
| 381 |
excode:=DefaultExcode |
| 382 |
end; |
| 383 |
|
| 384 |
function LOG2(const x:Complex):double;inline; overload; |
| 385 |
begin |
| 386 |
result:=baslib.LOG2(testreal(x)) |
| 387 |
end; |
| 388 |
|
| 389 |
function LOG10(const x:Complex):double;inline; overload; |
| 390 |
begin |
| 391 |
result:=baslib.LOG10(testreal(x)) |
| 392 |
end; |
| 393 |
|
| 394 |
constructor TComplex.create(x:complex); |
| 395 |
begin |
| 396 |
inherited create; |
| 397 |
value:=x; |
| 398 |
end; |
| 399 |
|
| 400 |
function TComplex.str:ansistring; |
| 401 |
begin |
| 402 |
str:=CStr(value) + ' ' |
| 403 |
end; |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
function IntPower(const c:complex; i: int64): complex; |
| 408 |
var |
| 409 |
x,t:ExtComplex; |
| 410 |
begin |
| 411 |
x.initC(c); |
| 412 |
if i<0 then |
| 413 |
begin |
| 414 |
i:=-i; |
| 415 |
x.inverse; |
| 416 |
end; |
| 417 |
t.init(1,0); //Result := 1.0; |
| 418 |
while i > 0 do |
| 419 |
begin |
| 420 |
while not Odd(i) do |
| 421 |
begin |
| 422 |
i := i shr 1; |
| 423 |
x.square; // X := X * X |
| 424 |
end; |
| 425 |
Dec(i); |
| 426 |
t.multiply(@x); //Result := Result * X |
| 427 |
end; |
| 428 |
result.x:=t.x; result.y:=t.y |
| 429 |
end; |
| 430 |
|
| 431 |
function Power(const Base,Exponent:Complex):Complex;inline; overload; |
| 432 |
begin |
| 433 |
if (Exponent.x=0) and (Exponent.y=0) then |
| 434 |
result:=1.0 |
| 435 |
else if (Base.x=0)and (Base.y=0) and ((Exponent.y<>0) or (Exponent.x<0)) then |
| 436 |
setexception(3003) |
| 437 |
else if (Base.y=0) and (Base.x>0) then |
| 438 |
if Exponent.y=0 then |
| 439 |
result:=baslib.power(Base.x, Exponent.x) |
| 440 |
else |
| 441 |
result:=EXP(Exponent*ln(Base.x)) |
| 442 |
else if (Exponent.y=0) and (system.int(Exponent.x)=Exponent.x) then |
| 443 |
result:=IntPower(Base, system.Trunc(Exponent.x)) |
| 444 |
else if (Base.x=0)and (Base.y=0) and (Exponent.y=0.0) and (Exponent.x>0) then |
| 445 |
result:=0.0 |
| 446 |
else |
| 447 |
begin |
| 448 |
result:=0.0; |
| 449 |
if (Base.x=0)and (Base.y=0) then |
| 450 |
setexception(3003) |
| 451 |
else |
| 452 |
setexception(3002) ; |
| 453 |
end; |
| 454 |
end; |
| 455 |
|
| 456 |
function Power(const Base:double; const Exponent:Complex):Complex;inline; overload; |
| 457 |
begin |
| 458 |
if Exponent.y=0 then |
| 459 |
result:=baslib.Power(base, Exponent.x) |
| 460 |
else |
| 461 |
if (Base>0) then |
| 462 |
result:=EXP(Exponent*ln(Base)) |
| 463 |
else if (Exponent.y=0) and (system.int(Exponent.x)=Exponent.x) then |
| 464 |
result:=IntPower(Base, system.Trunc(Exponent.x)) |
| 465 |
else |
| 466 |
begin |
| 467 |
result:=0.0; |
| 468 |
if Base=0 then |
| 469 |
setexception(3003) |
| 470 |
else |
| 471 |
setexception(3002) ; |
| 472 |
end; |
| 473 |
end; |
| 474 |
|
| 475 |
function Power(const Base:complex; const Exponent:double):Complex;inline; overload; |
| 476 |
begin |
| 477 |
if Base.y=0 then |
| 478 |
result:=baslib.Power(Base.x, Exponent) |
| 479 |
else if (Exponent=0) then |
| 480 |
result:=1.0 |
| 481 |
else if (Base.x=0)and (Base.y=0) and ( (Exponent<0)) then |
| 482 |
setexception(3003) |
| 483 |
else if (system.int(Exponent)=Exponent) then |
| 484 |
result:=IntPower(Base, system.Trunc(Exponent)) |
| 485 |
else if (Base.x=0)and (Base.y=0) and (Exponent>0) then |
| 486 |
result:=0.0 |
| 487 |
else |
| 488 |
begin |
| 489 |
result:=0.0; |
| 490 |
if (Base.x=0)and (Base.y=0) then |
| 491 |
setexception(3003) |
| 492 |
else |
| 493 |
setexception(3002) ; |
| 494 |
end; |
| 495 |
end; |
| 496 |
|
| 497 |
function EPS(x:Complex):double;inline; overload; |
| 498 |
begin |
| 499 |
result:=baslib.EPS(testreal(x)) |
| 500 |
end; |
| 501 |
|
| 502 |
function BINT( x:Complex):double;inline; overload; |
| 503 |
begin |
| 504 |
result:=baslib.BINT(testreal(x)) |
| 505 |
end; |
| 506 |
|
| 507 |
function BCEIL(x:Complex):double;inline; overload; |
| 508 |
begin |
| 509 |
result:=baslib.BCEIL(testreal(x)) |
| 510 |
end; |
| 511 |
|
| 512 |
function BMOD( x,y:Complex):double;inline; overload; |
| 513 |
begin |
| 514 |
result:=baslib.BMOD(testreal(x), testreal(y)) |
| 515 |
end; |
| 516 |
function BMOD( x:double; y:Complex):double;inline; overload; |
| 517 |
begin |
| 518 |
result:=baslib.BMOD(testreal(x), testreal(y)) |
| 519 |
end; |
| 520 |
function BMOD( x:Complex; y:double):double;inline; overload; |
| 521 |
begin |
| 522 |
result:=baslib.BMOD(testreal(x), testreal(y)) |
| 523 |
end; |
| 524 |
|
| 525 |
function REMAINDER( x,y:Complex):double;inline; overload; |
| 526 |
begin |
| 527 |
result:=baslib.REMAINDER(testreal(x), testreal(y)) |
| 528 |
end; |
| 529 |
function REMAINDER( x:double; y:Complex):double;inline; overload; |
| 530 |
begin |
| 531 |
result:=baslib.REMAINDER(testreal(x), testreal(y)) |
| 532 |
end; |
| 533 |
function REMAINDER( x:Complex; y:double):double;inline; overload; |
| 534 |
begin |
| 535 |
result:=baslib.REMAINDER(testreal(x), testreal(y)) |
| 536 |
end; |
| 537 |
|
| 538 |
function ROUND( x:Complex):double;overload; inline;overload; |
| 539 |
begin |
| 540 |
result:=baslib.ROUND(testreal(x)) |
| 541 |
end; |
| 542 |
|
| 543 |
function ROUND( x,y:Complex):double; overload; overload; |
| 544 |
begin |
| 545 |
result:=baslib.ROUND(testreal(x), testreal(y)) |
| 546 |
end; |
| 547 |
function ROUND( x:double; y:Complex):double; overload; |
| 548 |
begin |
| 549 |
result:=baslib.ROUND(testreal(x), testreal(y)) |
| 550 |
end; |
| 551 |
function ROUND( x:Complex; y:double):double; overload; |
| 552 |
begin |
| 553 |
result:=baslib.ROUND(testreal(x), testreal(y)) |
| 554 |
end; |
| 555 |
|
| 556 |
function TRUNCATE( x,y:Complex):double;inline; overload; |
| 557 |
begin |
| 558 |
result:=baslib.TRUNCATE(testreal(x), testreal(y)) |
| 559 |
end; |
| 560 |
function TRUNCATE( x:double; y:Complex):double;inline; overload; |
| 561 |
begin |
| 562 |
result:=baslib.TRUNCATE(testreal(x), testreal(y)) |
| 563 |
end; |
| 564 |
function TRUNCATE( x:Complex; y:double):double;inline; overload; |
| 565 |
begin |
| 566 |
result:=baslib.TRUNCATE(testreal(x), testreal(y)) |
| 567 |
end; |
| 568 |
|
| 569 |
function BMIN(const x,y:Complex):double;inline; overload; |
| 570 |
begin |
| 571 |
result:=baslib.BMIN(testreal(x), testreal(y)) |
| 572 |
end; |
| 573 |
function BMIN(const x:double; const y:Complex):double;inline; overload; |
| 574 |
begin |
| 575 |
result:=baslib.BMIN(testreal(x), testreal(y)) |
| 576 |
end; |
| 577 |
function BMIN(const x:Complex; const y:double):double;inline; overload; |
| 578 |
begin |
| 579 |
result:=baslib.BMIN(testreal(x), testreal(y)) |
| 580 |
end; |
| 581 |
|
| 582 |
function BMAX(const x,y:Complex):double;inline; overload; |
| 583 |
begin |
| 584 |
result:=baslib.BMAX(testreal(x), testreal(y)) |
| 585 |
end; |
| 586 |
function BMAX(const x:double; const y:Complex):double;inline; overload; |
| 587 |
begin |
| 588 |
result:=baslib.BMAX(testreal(x), testreal(y)) |
| 589 |
end; |
| 590 |
function BMAX(const x:Complex; const y:double):double;inline; overload; |
| 591 |
begin |
| 592 |
result:=baslib.BMAX(testreal(x), testreal(y)) |
| 593 |
end; |
| 594 |
|
| 595 |
function FRAC(x:complex):double; inline; overload; |
| 596 |
begin |
| 597 |
result:=system.frac(testreal(x)) |
| 598 |
end; |
| 599 |
|
| 600 |
function INT(x:complex):double; inline; overload; |
| 601 |
begin |
| 602 |
result:=system.int(testreal(x)) |
| 603 |
end; |
| 604 |
|
| 605 |
|
| 606 |
function PERM( n,r:Complex):double; overload; |
| 607 |
begin |
| 608 |
result:=baslib.PERM(testreal(n), testreal(r)) |
| 609 |
end; |
| 610 |
function PERM( n:double; r:Complex):double; overload; |
| 611 |
begin |
| 612 |
result:=baslib.PERM(testreal(n), testreal(r)) |
| 613 |
end; |
| 614 |
function PERM( n:Complex; r:double):double; overload; |
| 615 |
begin |
| 616 |
result:=baslib.PERM(testreal(n), testreal(r)) |
| 617 |
end; |
| 618 |
|
| 619 |
function COMB( n,r:Complex):double; overload; |
| 620 |
begin |
| 621 |
result:=baslib.COMB(testreal(n), testreal(r)) |
| 622 |
end; |
| 623 |
function COMB( n:double; r:Complex):double; overload; |
| 624 |
begin |
| 625 |
result:=baslib.COMB(testreal(n), testreal(r)) |
| 626 |
end; |
| 627 |
function COMB( n:Complex; r:double):double; overload; |
| 628 |
begin |
| 629 |
result:=baslib.COMB(testreal(n), testreal(r)) |
| 630 |
end; |
| 631 |
|
| 632 |
function FACT(const x:Complex):double; overload; |
| 633 |
begin |
| 634 |
result:=baslib.FACT(testreal(x)) |
| 635 |
end; |
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
{****************} |
| 640 |
{STRING Functions} |
| 641 |
{****************} |
| 642 |
function SubString(s:string; i1,i2:Complex):string; overload; |
| 643 |
begin |
| 644 |
result:=SubString(s, testreal(i1),testreal(i2)) |
| 645 |
end; |
| 646 |
function SubString(s:string; i1:double; i2:Complex):string; overload; |
| 647 |
begin |
| 648 |
result:=SubString(s, testreal(i1),testreal(i2)) |
| 649 |
end; |
| 650 |
function SubString(s:string; i1:complex; i2:double):string; overload; |
| 651 |
begin |
| 652 |
result:=SubString(s, testreal(i1),testreal(i2)) |
| 653 |
end; |
| 654 |
|
| 655 |
function SubStringByte(s:string; i1,i2:Complex):string; overload; |
| 656 |
begin |
| 657 |
result:=SubStringByte(s, testreal(i1),testreal(i2)) |
| 658 |
end; |
| 659 |
function SubStringByte(s:string; i1:double; i2:Complex):string; overload; |
| 660 |
begin |
| 661 |
result:=SubStringByte(s, testreal(i1),testreal(i2)) |
| 662 |
end; |
| 663 |
function SubStringByte(s:string; i1:complex; i2:double):string; overload; |
| 664 |
begin |
| 665 |
result:=SubStringByte(s, testreal(i1),testreal(i2)) |
| 666 |
end; |
| 667 |
|
| 668 |
function STR_s(x:Complex):string; overload; |
| 669 |
begin |
| 670 |
result:=STR_s(testreal(x)) |
| 671 |
end; |
| 672 |
|
| 673 |
function CHR_s(x:Complex):string; overload; |
| 674 |
begin |
| 675 |
result:=CHR_s(testreal(x)) |
| 676 |
end; |
| 677 |
|
| 678 |
function CHRbyte(x:Complex):string; overload; |
| 679 |
begin |
| 680 |
result:=CHRbyte(testreal(x)) |
| 681 |
end; |
| 682 |
|
| 683 |
function USING_s(const s:string; x:Complex):string; overload; |
| 684 |
begin |
| 685 |
result:=USING_s(s, testreal(x)) |
| 686 |
end; |
| 687 |
|
| 688 |
function USING_ss(const s:string; x:Complex):string; overload; |
| 689 |
begin |
| 690 |
result:=USING_ss(s, testreal(x)) |
| 691 |
end; |
| 692 |
|
| 693 |
function REPEAT_s(const s:string; x:Complex):string; overload; |
| 694 |
begin |
| 695 |
result:=REPEAT_s(s, testreal(x)) |
| 696 |
end; |
| 697 |
|
| 698 |
function BSTR_s(x:Complex; n:integer):string; overload; |
| 699 |
begin |
| 700 |
result:=BSTR_s(testreal(x),n) |
| 701 |
end; |
| 702 |
|
| 703 |
function Mid_s(s:string; i1,i2:Complex):string; overload; |
| 704 |
begin |
| 705 |
result:=MID_s(s, testreal(i1),testreal(i2)) |
| 706 |
end; |
| 707 |
function Mid_s(s:string; i1:double; i2:Complex):string; overload; |
| 708 |
begin |
| 709 |
result:=MID_s(s, testreal(i1),testreal(i2)) |
| 710 |
end; |
| 711 |
function Mid_s(s:string; i1:complex; i2:double):string; overload; |
| 712 |
begin |
| 713 |
result:=MID_s(s, testreal(i1),testreal(i2)) |
| 714 |
end; |
| 715 |
|
| 716 |
function Mid_sByte(s:string; i1,i2:Complex):string; overload; |
| 717 |
begin |
| 718 |
result:=MID_sByte(s, testreal(i1),testreal(i2)) |
| 719 |
end; |
| 720 |
function Mid_sByte(s:string; i1:double; i2:Complex):string; overload; |
| 721 |
begin |
| 722 |
result:=MID_sByte(s, testreal(i1),testreal(i2)) |
| 723 |
end; |
| 724 |
function Mid_sByte(s:string; i1:complex; i2:double):string; overload; |
| 725 |
begin |
| 726 |
result:=MID_sByte(s, testreal(i1),testreal(i2)) |
| 727 |
end; |
| 728 |
|
| 729 |
function Left_sByte(s:string; i:Complex):string; overload; |
| 730 |
begin |
| 731 |
result:=Left_sByte(s, testreal(i)) |
| 732 |
end; |
| 733 |
|
| 734 |
function Left_s(s:string;i:Complex):string; overload; |
| 735 |
begin |
| 736 |
result:=Left_s(s, testreal(i)) |
| 737 |
end; |
| 738 |
|
| 739 |
function Right_sByte(s:string; i:Complex):string; overload; |
| 740 |
begin |
| 741 |
result:=Right_sByte(s, testreal(i)) |
| 742 |
end; |
| 743 |
|
| 744 |
function Right_s(s:string;i:Complex):string; overload; |
| 745 |
begin |
| 746 |
result:=Right_s(s, testreal(i)) |
| 747 |
end; |
| 748 |
|
| 749 |
{String Variable} |
| 750 |
procedure SubstSubstringByte(var v:AnsiString; i,j:Complex; const s:ansistring); overload; |
| 751 |
begin |
| 752 |
SubstSubstringByte(v, testreal(i), testreal(j), s) |
| 753 |
end; |
| 754 |
procedure SubstSubstringByte(var v:AnsiString; i:double; j:Complex; const s:ansistring); overload; |
| 755 |
begin |
| 756 |
SubstSubstringByte(v, testreal(i), testreal(j), s) |
| 757 |
end; |
| 758 |
procedure SubstSubstringByte(var v:AnsiString; i:Complex; j:double; const s:ansistring); overload; |
| 759 |
begin |
| 760 |
SubstSubstringByte(v, testreal(i), testreal(j), s) |
| 761 |
end; |
| 762 |
|
| 763 |
procedure SubstSubstring(var v:AnsiString; i,j:Complex; const s:ansistring); overload; |
| 764 |
begin |
| 765 |
SubstSubstring(v, testreal(i), testreal(j), s) |
| 766 |
end; |
| 767 |
procedure SubstSubstring(var v:AnsiString; i:double; j:Complex; const s:ansistring); overload; |
| 768 |
begin |
| 769 |
SubstSubstring(v, testreal(i), testreal(j), s) |
| 770 |
end; |
| 771 |
procedure SubstSubstring(var v:AnsiString; i:Complex; j:double; const s:ansistring); overload; |
| 772 |
begin |
| 773 |
SubstSubstring(v, testreal(i), testreal(j), s) |
| 774 |
end; |
| 775 |
|
| 776 |
{Let Statements} |
| 777 |
|
| 778 |
procedure LETC(const p:Array of PComplex; x:Complex); |
| 779 |
var |
| 780 |
i:integer; |
| 781 |
begin |
| 782 |
for i:=0 to High(p) do |
| 783 |
p[i]^:=x; |
| 784 |
end; |
| 785 |
|
| 786 |
|
| 787 |
{ Ask Statement} |
| 788 |
procedure AskFile(ch:TTextDEvice; |
| 789 |
expAccess,expDatum,expErasable,expFileType,expName, |
| 790 |
expOrganization,expPointer,expRecsize1,expRecType, |
| 791 |
expSetter,expCharin,expTypeahead,expEchoControl,expEcho:TStrVar; |
| 792 |
expMargin,expRecSize2,expZonewidth,expCharacterPending,expFilesize:PComplex); |
| 793 |
begin |
| 794 |
AskFile(ch, expAccess,expDatum,expErasable,expFileType,expName, |
| 795 |
expOrganization,expPointer,expRecsize1,expRecType, |
| 796 |
expSetter,expCharin,expTypeahead,expEchoControl,expEcho, |
| 797 |
@(expMargin^.x), @(expRecSize2^.x), @(expZonewidth^.x), |
| 798 |
@(expCharacterPending^.x), @(expFilesize^.x)) |
| 799 |
end; |
| 800 |
|
| 801 |
{Misc.} |
| 802 |
procedure Wait(n:Complex); overload; |
| 803 |
begin |
| 804 |
Wait(testreal(n)) |
| 805 |
end; |
| 806 |
|
| 807 |
procedure swap(var x,y:Complex);overload; |
| 808 |
begin |
| 809 |
swap(x.x, y.x); swap(x.y, y.y) |
| 810 |
end; |
| 811 |
|
| 812 |
|
| 813 |
end. |
| 814 |
|