home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / delphi / kompon / d456 / CAJSCRPT.ZIP / ifps3 / ifps3lib_stdr.pas < prev    next >
Pascal/Delphi Source File  |  2002-07-04  |  20KB  |  628 lines

  1. unit ifps3lib_stdr;
  2. {
  3.  
  4. Innerfuse Pascal Script III
  5. Copyright (C) 2000-2002 by Carlo Kok (ck@carlo-kok.com)
  6.  
  7. }
  8. {$I ifps3_def.inc}
  9.  
  10. interface
  11. uses
  12.   ifps3utl, ifps3, ifps3common;
  13.  
  14. { This function registers all standard functions. 
  15.   Call this function before loading your script into the executer.
  16.   } 
  17. procedure RegisterStandardLibrary_R(S: TIFPSExec);
  18.  
  19. implementation
  20.  
  21. type
  22.   TMYExec = class (TIFPSExec) end;
  23.  
  24. function Trim(const s: string): string;
  25. begin
  26.   Result := s;
  27.   while (Length(result) > 0) and (Result[1] = #32) do Delete(Result, 1, 1);
  28.   while (Length(result) > 0) and (Result[Length(Result)] = #32) do Delete(Result, Length(Result), 1);
  29. end;
  30. function FloatToStr(E: Extended): string;
  31. var
  32.   s: string;
  33. begin
  34.   Str(e:0:12, s);
  35.   result := s;
  36. end;
  37. //-------------------------------------------------------------------
  38.  
  39. function Padl(s: string; i: longInt): string;
  40. begin
  41.   result := StringOfChar(' ', i - length(result)) + s;
  42. end;
  43. //-------------------------------------------------------------------
  44.  
  45. function Padz(s: string; i: longInt): string;
  46. begin
  47.   result := StringOfChar('0', i - length(result)) + s;
  48. end;
  49. //-------------------------------------------------------------------
  50.  
  51. function Padr(s: string; i: longInt): string;
  52. begin
  53.   result := s + StringOfChar(' ', i - Length(s));
  54. end;
  55. //-------------------------------------------------------------------
  56.  
  57. function VarProc(Caller: TIFPSExec; p: PIFProcRec; Global, Stack: TIfList): Boolean;
  58. var
  59.   PStart: Cardinal;
  60.   Pp: PIFVariant;
  61. begin
  62.   if p^.Ext1 = Pointer(0) then
  63.   begin
  64.     PStart := Stack.Count -2;
  65.     pp := Stack.GetItem(PStart);
  66.     if (pp = nil) or (pp^.FType^.BaseType <> btVariant) then begin
  67.       Result := False;
  68.       Exit;
  69.     end;
  70.     Inc(PStart);
  71.     if pp^.tvariant^.FType = nil then LSetInt(Stack, PStart, 0) else
  72.     case pp^.TVariant^.FType^.BaseType of
  73.       btU8: LSetInt(Stack, PStart, 8);
  74.       btS8: LSetInt(Stack, PStart, 7);
  75.       btU16: LSetInt(Stack, PStart, 6);
  76.       btS16: LSetInt(Stack, PStart, 5);
  77.       btU32: LSetInt(Stack, PStart, 4);
  78.       btS32: LSetInt(Stack, PStart, 3);
  79.       btSingle: LSetInt(Stack, PStart, 9);
  80.       btDouble: LSetInt(Stack, PStart, 10);
  81.       btExtended: LSetInt(Stack, PStart, 11);
  82.       btPChar, btString: LSetInt(Stack, PStart, 1);
  83.       btRecord: LSetInt(Stack, PStart, 14);
  84.       btArray: LSetInt(Stack, PStart, 13);
  85.       btResourcePointer: LSetInt(Stack, PStart, 12);
  86.       {$IFNDEF NOINT64}
  87.       btS64: LSetInt(Stack, PStart, 2);
  88.       {$ENDIF}
  89.     else
  90.       LSetInt(Stack, PStart, 0);
  91.     end;
  92.     Result := True;
  93.   end else if p^.Ext1 = Pointer(1) then
  94.   begin
  95.     Pp := Stack.GetItem(Stack.Count-1);
  96.     if (pp = nil) or (pp^.FType^.BaseType <> btVariant) then
  97.     begin
  98.       Result := False;
  99.       exit;
  100.     end;
  101.     ChangeVariantType({$IFNDEF NOSMARTMM}caller.MemoryManager, {$ENDIF} pp^.tVariant, nil);
  102.     Result := True;
  103.   end else begin
  104.     Result := False;
  105.   end;
  106. end;
  107.  
  108.  
  109. function DefProc(Caller: TIFPSExec; p: PIFProcRec; Global, Stack: TIfList): Boolean;
  110. var
  111.   PStart: Cardinal;
  112.   temp: PIfVariant;
  113.   I: Longint;
  114.   b: Boolean;
  115.   E: Extended;
  116. begin
  117.   case Longint(p^.Ext1) of
  118.     0: // inttostr
  119.       begin
  120.         PStart := Stack.Count - 2;
  121.         LSetStr(Stack, PStart + 1, IntToStr(LGetInt(Stack, PStart)));
  122.         Result := True;
  123.       end;
  124.     1: // strtoint
  125.       begin
  126.         PStart := Stack.Count - 2;
  127.         LSetInt(Stack, PStart+1, StrToInt(LGetStr(Stack, PStart)));
  128.         Result := True;
  129.       end;
  130.     2: // strtointdef
  131.       begin
  132.         PStart := Stack.Count - 3;
  133.         LSetInt(Stack, PStart+2, StrToIntDef(LGetStr(Stack, PStart + 1), LGetInt(Stack, PStart)));
  134.         Result := True;
  135.       end;
  136.     3: // pos
  137.       begin
  138.         PStart := Stack.Count - 3;
  139.         LSetInt(Stack, PStart+2,Pos(LGetStr(Stack, PStart+1), LGetStr(Stack, PStart)));
  140.         Result := True;
  141.       end;
  142.     4: // copy
  143.       begin
  144.         PStart := Stack.Count - 4;
  145.         LSetStr(Stack, PStart + 3,Copy(LGetStr(Stack, PStart+2), LGetInt(Stack, PStart + 1), LGetInt(Stack, PStart)));
  146.         Result := True;
  147.       end;
  148.     5: //delete
  149.       begin
  150.         PStart := Stack.Count - 3;
  151.         temp := Stack.GetItem(PStart + 2);
  152.         if (temp = nil) or (temp^.FType^.BaseType <> btString) then begin
  153.           Result := False;
  154.           exit;
  155.         end;
  156.         Delete(string(temp^.tstring), LGetInt(Stack, PStart + 1), LGetInt(Stack, PStart));
  157.         Result := True;
  158.       end;
  159.     6: // insert
  160.       begin
  161.         PStart := Stack.Count - 3;
  162.         temp := Stack.GetItem(PStart + 1);
  163.         if (temp = nil) or (temp^.FType^.BaseType <> btString) then begin
  164.           Result := False;
  165.           exit;
  166.         end;
  167.         Insert(LGetStr(Stack, PStart + 2), string(temp^.tstring), LGetInt(Stack, PStart + 0));
  168.         Result := True;
  169.       end;
  170.     7: // StrGet
  171.       begin
  172.         PStart := Stack.Count - 3;
  173.         temp := Stack.GetItem(PStart + 1);
  174.         if (temp = nil) or (temp^.FType^.BaseType <> btString) then begin
  175.           Result := False;
  176.           exit;
  177.         end;
  178.         I := LGetInt(Stack, PStart);
  179.         if (i<1) or (i>length(string(temp^.tstring))) then
  180.         begin
  181.           Caller.CMD_Err2(erCustomError, 'Out Of String Range');
  182.           Result := False;
  183.           exit;
  184.         end;
  185.         LSetInt(Stack, PStart +2, Ord(string(temp^.tstring)[i]));
  186.         Result := True;
  187.       end;
  188.     8: // StrSet
  189.       begin
  190.         PStart := Stack.Count - 3;
  191.         temp := Stack.GetItem(PStart);
  192.         if (temp = nil) or (temp^.FType^.BaseType <> btString) then begin
  193.           Result := False;
  194.           Caller.CMD_Err2(erCustomError, 'Invalid Type');
  195.           exit;
  196.         end;
  197.         I := LGetInt(Stack, PStart + 1);
  198.         if (i<1) or (i>length(string(temp^.tstring))) then
  199.         begin
  200.           Caller.CMD_Err2(erCustomError, 'Out Of String Range');
  201.           Result := True;
  202.           exit;
  203.         end;
  204.         string(temp^.tstring)[i] := chr(LGetInt(Stack, PStart + 2));
  205.         Result := True;
  206.       end;
  207.     10: // Uppercase
  208.       begin
  209.         PStart := STack.Count -2;
  210.         LSetStr(Stack, PStart + 1, FastUpperCase(LGetStr(Stack, PStart)));
  211.         Result := True;
  212.       end;
  213.     11: // LowerCase
  214.       begin
  215.         PStart := STack.Count -2;
  216.         LSetStr(Stack, PStart + 1, FastLowercase(LGetStr(Stack, PStart)));
  217.         Result := True;
  218.       end;
  219.     12: // Trim
  220.       begin
  221.         PStart := STack.Count -2;
  222.         LSetStr(Stack, PStart + 1, Trim(LGetStr(Stack, PStart)));
  223.         Result := True;
  224.       end;
  225.     13: // Length
  226.       begin
  227.         PStart := Stack.Count - 2;
  228.         LSetInt(Stack, PStart + 1, Length(LGetStr(Stack, PStart)));
  229.         Result := True;
  230.       end;
  231.     14: // SetLength
  232.       begin
  233.         PStart := Stack.Count - 2;
  234.         temp := Stack.GetItem(PStart+1);
  235.         if (temp = nil) or (temp^.FType^.BaseType <> btString) then begin
  236.           Result := False;
  237.           exit;
  238.         end;
  239.         SetLength(string(temp^.tstring), LGetInt(Stack, PStart));
  240.         Result := True;
  241.       end;
  242.     15: // Sin
  243.       begin
  244.         PStart := Stack.Count - 2;
  245.         try
  246.           LSetReal(Stack, PStart + 1, Sin(LGetReal(Stack, PStart)));
  247.         except
  248.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  249.         end;
  250.         Result := True;
  251.       end;
  252.     16: // Cos
  253.       begin
  254.         PStart := Stack.Count - 2;
  255.         try
  256.           LSetReal(Stack, PStart + 1, Cos(LGetReal(Stack, PStart)));
  257.         except
  258.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  259.         end;
  260.         Result := True;
  261.       end;
  262.     17: // Sqrt
  263.       begin
  264.         PStart := Stack.Count - 2;
  265.         try
  266.           LSetReal(Stack, PStart + 1, Sqrt(LGetReal(Stack, PStart)));
  267.         except
  268.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  269.         end;
  270.         Result := True;
  271.       end;
  272.     18: // Round
  273.       begin
  274.         PStart := Stack.Count - 2;
  275.         try
  276.           LSetInt(Stack, PStart + 1, Round(LGetReal(Stack, PStart)));
  277.         except
  278.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  279.         end;
  280.         Result := True;
  281.       end;
  282.     19: // Trunc
  283.       begin
  284.         PStart := Stack.Count - 2;
  285.         try
  286.           LSetInt(Stack, PStart + 1, Trunc(LGetReal(Stack, PStart)));
  287.         except
  288.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  289.         end;
  290.         Result := True;
  291.       end;
  292.     20: // Int
  293.       begin
  294.         PStart := Stack.Count - 2;
  295.         try
  296.           LSetReal(Stack, PStart + 1, Int(LGetReal(Stack, PStart)));
  297.         except
  298.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  299.         end;
  300.         Result := True;
  301.       end;
  302.     21: // Pi
  303.       begin
  304.         PStart := Stack.Count - 1;
  305.         try
  306.           LSetReal(Stack, PStart, PI);
  307.         except
  308.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  309.         end;
  310.         Result := True;
  311.       end;
  312.     22: // Abs
  313.       begin
  314.         PStart := Stack.Count - 2;
  315.         try
  316.           LSetReal(Stack, PStart + 1, Abs(LGetReal(Stack, PStart)));
  317.         except
  318.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  319.         end;
  320.         Result := True;
  321.       end;
  322.     23: // StrToFloat
  323.       begin
  324.         PStart := Stack.Count - 2;
  325.         try
  326.           Val(LGetStr(Stack, PStart), E, I);
  327.           LSetReal(Stack, PStart + 1, E);
  328.         except
  329.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  330.         end;
  331.         Result := True;
  332.       end;
  333.     24: // FloatToStr
  334.       begin
  335.         PStart := Stack.Count - 2;
  336.         try
  337.           LSetStr(Stack, PStart + 1, FloatToStr(LGetReal(Stack, PStart)));
  338.         except
  339.           Caller.CMD_Err2(erCustomError, 'Floating Point Exception');
  340.         end;
  341.         Result := True;
  342.       end;
  343.     25: //  PadL
  344.       begin
  345.         PStart := Stack.Count - 3;
  346.         LSetStr(Stack, PStart + 2, Padl(LGetStr(Stack, PStart + 1), LGetUInt(Stack, PStart)));
  347.         Result := True;
  348.       end;
  349.     26: // PadR
  350.       begin
  351.         PStart := Stack.Count - 3;
  352.         LSetStr(Stack, PStart + 2, Padr(LGetStr(Stack, PStart + 1), LGetUInt(Stack, PStart)));
  353.         Result := True;
  354.       end;
  355.     27: // PadZ
  356.       begin
  357.         PStart := Stack.Count - 3;
  358.         LSetStr(Stack, PStart + 2, Padz(LGetStr(Stack, PStart + 1), LGetUInt(Stack, PStart)));
  359.         Result := True;
  360.       end;
  361.     28: // Replicate/StrOfChar
  362.       begin
  363.         PSTart := Stack.Count - 3;
  364.         LSetStr(Stack, PStart + 2, StringOfChar(Char(LGetInt(Stack, PStart + 1)), LGetInt(Stack, PStart)));
  365.         Result := True;
  366.       end;
  367.     29: // Assigned
  368.       begin
  369.         temp := Stack.GetItem(Stack.Count -2);
  370.         if Temp = nil then
  371.         begin
  372.           Result := False;
  373.           exit;
  374.         end;
  375.  
  376.         case temp^.FType^.BaseType of
  377.           btU8, btS8: b := Temp^.tu8 <> 0;
  378.           btU16, btS16: b := Temp^.tu16 <> 0;
  379.           btU32, btS32: b := Temp^.tu32 <> 0;
  380.           btString, btPChar: b := Temp^.tstring <> nil;
  381.           btArray: b := Temp^.tarray <> nil;
  382.           btPointer: b := Temp^.tpointer <> nil;
  383.           btResourcePointer: b := @temp^.tResourceFreeProc <> nil;
  384.         else
  385.           Result := False;
  386.           Exit;
  387.         end;
  388.         if b then
  389.           LSetInt(Stack, Stack.Count -1, 1)
  390.         else
  391.           LSetInt(Stack, Stack.Count -1, 0);
  392.         Result := True;
  393.       end;
  394.     30: begin {RaiseLastException}
  395.         TMYExec(Caller).ExceptionProc(TMYExec(Caller).ExProc, TMYExec(Caller).ExPos, TMYExec(Caller).ExEx, TMYExec(Caller).ExParam);
  396.         Result := True;
  397.     end;
  398.     31: begin {RaiseExeption}
  399.         TMYExec(Caller).CMD_Err2(TIFError(LGetInt(Stack, Stack.Count -1)), LGetStr(Stack, Stack.Count -2));
  400.         Result := True;
  401.     end;
  402.     32: begin {ExceptionType}
  403.         LSetInt(Stack, Stack.Count -1, Ord(TMyExec(Caller).ExEx));
  404.         Result := True;
  405.     end;
  406.     33: begin {ExceptionParam}
  407.         LSetstr(Stack, Stack.Count -1, TMyExec(Caller).ExParam);
  408.         Result := True;
  409.     end;
  410.     34: begin {ExceptionProc}
  411.         LSetInt(Stack, Stack.Count -1, TMyExec(Caller).ExProc);
  412.         Result := True;
  413.     end;
  414.     35: begin {ExceptionPos}
  415.         LSetInt(Stack, Stack.Count -1, TMyExec(Caller).ExPos);
  416.         Result := True;
  417.     end;
  418.     36:
  419.         begin {ExceptionToString}
  420.           LSetStr(Stack, Stack.Count -1, TIFErrorToString(TIFError(LGetInt(Stack, Stack.Count -2)), LGetStr(Stack, Stack.Count -3)));
  421.           Result := True;
  422.         end;
  423.  
  424.     else
  425.       Result := False;
  426.   end;
  427. end;
  428.  
  429. function GetArrayLength(Caller: TIFPSExec; p: PIFProcRec; Global, Stack: TIfList): Boolean;
  430. var
  431.   PStart: Cardinal;
  432.   n: PIfVariant;
  433. begin
  434.   PStart := Stack.Count - 2;
  435.   n := Stack.GetItem(PStart);
  436.   if n^.FType^.BaseType = btVariant then
  437.   begin
  438.     n := n^.tvariant;
  439.     if n^.ftype = nil then
  440.     begin
  441.       result := false; exit;
  442.     end;
  443.   end;
  444.   if n^.FType^.BaseType <>btArray then begin result := false; exit; end;
  445.  
  446.   if n^.tArray = nil then
  447.     LSetInt(Stack, PStart + 1, 0)
  448.   else
  449.     LSetInt(Stack, PStart + 1, pbtrecord(n^.TArray)^.FieldCount);
  450.   Result := True;
  451. end;
  452.  
  453. function min(const x,y: integer): integer;
  454. begin
  455.   if x < y then result := x else result := y;
  456. end;
  457.  
  458. function SetArrayLength(Caller: TIFPSExec; p: PIFProcRec; Global, Stack: TIfList): Boolean;
  459. var
  460.   PStart: Cardinal;
  461.   n: PIfVariant;
  462.   i, oldl: Integer;
  463.   r: pbtRecord;
  464. begin
  465.   PStart := Stack.Count - 2;
  466.   n := Stack.GetItem(PStart + 1);
  467.   if n^.FType^.BaseType = btVariant then
  468.   begin
  469.     n := n^.tvariant;
  470.     if n^.ftype = nil then
  471.     begin
  472.       result := false; exit;
  473.     end;
  474.   end;
  475.   if n^.FType^.BaseType <>btArray then begin result := false; exit; end;
  476.   if n^.tArray = nil then
  477.   begin
  478.     i := LGetInt(Stack, PStart);
  479.     if  i > 0 then
  480.     begin
  481.       try
  482.         GetMem(r, 4 + i * 4);
  483.       except
  484.         result := False;
  485.         exit;
  486.       end;
  487.       r^.FieldCount := i;
  488.       dec(i);
  489.       while i >= 0 do
  490.       begin
  491.         r^.Fields[i] := CreateVariant({$IFNDEF NOSMARTMM}Caller.MemoryManager, {$ENDIF}Caller.GetTypeNo(Cardinal(n^.FType^.Ext)));
  492.         if r^.Fields[i] = nil then
  493.         begin
  494.           while i < LGetInt(Stack, PStart) do
  495.           begin
  496.             DisposeVariant({$IFNDEF NOSMARTMM}Caller.MemoryManager, {$ENDIF}r.Fields[i]);
  497.             inc(i);
  498.           end;
  499.           Result := False;
  500.           exit;
  501.         end;
  502.         dec(i);
  503.       end;
  504.       n^.tArray := r;
  505.     end;
  506.   end else begin
  507.     r := n^.TArray;
  508.     oldl := LGetInt(Stack, PStart);
  509.     for i := oldl to r^.FieldCount -1 do
  510.     begin
  511.       DisposeVariant({$IFNDEF NOSMARTMM}Caller.MemoryManager, {$ENDIF} r^.Fields[i]);
  512.     end;
  513.     if oldl = 0 then
  514.     begin
  515.       FreeMem(r, 4 + 4 * r^.FieldCount);
  516.       n^.tArray := nil;
  517.     end else begin
  518.       i := oldl;
  519.       oldl := r^.FieldCount;
  520.       try
  521.         ReallocMem(r, 4 + 4 * i);
  522.       except
  523.         for i := 0 to Min(LGetInt(Stack, PStart), oldl)-1 do
  524.         begin
  525.           DisposeVariant({$IFNDEF NOSMARTMM}Caller.MemoryManager, {$ENDIF} r^.Fields[i]);
  526.         end;
  527.         FreeMem(r, 4 + 4 * LGetInt(Stack, PStart));
  528.         n^.tArray := nil;
  529.         result := false;
  530.         exit;
  531.       end;
  532.       r^.FieldCount := i;
  533.       for i := r^.FieldCount -1 downto oldl do
  534.       begin
  535.         r^.Fields[i] := CreateVariant({$IFNDEF NOSMARTMM}Caller.MemoryManager, {$ENDIF}Caller.GetTypeNo(Cardinal(n^.FType^.Ext)));
  536.         if r^.Fields[i] = nil then
  537.         begin
  538.           oldl := i;
  539.           while oldl < LGetInt(Stack, PStart) do
  540.           begin
  541.             DisposeVariant({$IFNDEF NOSMARTMM}Caller.MemoryManager, {$ENDIF}r.Fields[oldl]);
  542.             inc(oldl);
  543.           end;
  544.           Result := False;
  545.           exit;
  546.         end;
  547.       end;
  548.       n^.tArray := r;
  549.     end;
  550.   end;
  551.   Result := True;
  552. end;
  553. {
  554. Function StrGet(S : String; I : Integer) : Char;
  555. procedure StrSet(c : Char; I : Integer; var s : String);
  556. Function Uppercase(s : string) : string;
  557. Function Lowercase(s : string) : string;
  558. Function Trim(s : string) : string;
  559. Function Length(s : String) : Longint;
  560. procedure SetLength(var S: String; L: Longint);
  561. Function Sin(e : Extended) : Extended;
  562. Function Cos(e : Extended) : Extended;
  563. Function Sqrt(e : Extended) : Extended;
  564. Function Round(e : Extended) : Longint;
  565. Function Trunc(e : Extended) : Longint;
  566. Function Int(e : Extended) : Longint;
  567. Function Pi : Extended;
  568. Function Abs(e : Extended) : Extended;
  569. Function Sqrt(e : Extended) : Extended;
  570. function StrToFloat(s: string): Extended;
  571. Function FloatToStr(e : Extended) : String;
  572. Function Padl(s : string;I : longInt) : string;
  573. Function Padr(s : string;I : longInt) : string;
  574. Function Padz(s : string;I : longInt) : string;
  575. Function Replicate(c : char;I : longInt) : string;
  576. Function StringOfChar(c : char;I : longInt) : string;
  577. }
  578.  
  579. procedure RegisterStandardLibrary_R(S: TIFPSExec);
  580. begin
  581.   s.RegisterFunctionName('INTTOSTR', DefProc, Pointer(0), nil);
  582.   s.RegisterFunctionName('STRTOINT', DefProc, Pointer(1), nil);
  583.   s.RegisterFunctionName('STRTOINTDEF', DefProc, Pointer(2), nil);
  584.   s.RegisterFunctionName('POS', DefProc, Pointer(3), nil);
  585.   s.RegisterFunctionName('COPY', DefProc, Pointer(4), nil);
  586.   s.RegisterFunctionName('DELETE', DefProc, Pointer(5), nil);
  587.   s.RegisterFunctionName('INSERT', DefProc, Pointer(6), nil);
  588.  
  589.   s.RegisterFunctionName('STRGET', DefProc, Pointer(7), nil);
  590.   s.RegisterFunctionName('STRSET', DefProc, Pointer(8), nil);
  591.   s.RegisterFunctionName('UPPERCASE', DefProc, Pointer(10), nil);
  592.   s.RegisterFunctionName('LOWERCASE', DefProc, Pointer(11), nil);
  593.   s.RegisterFunctionName('TRIM', DefProc, Pointer(12), nil);
  594.   s.RegisterFunctionName('LENGTH', DefProc, Pointer(13), nil);
  595.   s.RegisterFunctionName('SETLENGTH', DefProc, Pointer(14), nil);
  596.   s.RegisterFunctionName('SIN', DefProc, Pointer(15), nil);
  597.   s.RegisterFunctionName('COS', DefProc, Pointer(16), nil);
  598.   s.RegisterFunctionName('SQRT', DefProc, Pointer(17), nil);
  599.   s.RegisterFunctionName('ROUND', DefProc, Pointer(18), nil);
  600.   s.RegisterFunctionName('TRUNC', DefProc, Pointer(19), nil);
  601.   s.RegisterFunctionName('INT', DefProc, Pointer(20), nil);
  602.   s.RegisterFunctionName('PI', DefProc, Pointer(21), nil);
  603.   s.RegisterFunctionName('ABS', DefProc, Pointer(22), nil);
  604.   s.RegisterFunctionName('STRTOFLOAT', DefProc, Pointer(23), nil);
  605.   s.RegisterFunctionName('FLOATTOSTR', DefProc, Pointer(24), nil);
  606.   s.RegisterFunctionName('PADL', DefProc, Pointer(25), nil);
  607.   s.RegisterFunctionName('PADR', DefProc, Pointer(26), nil);
  608.   s.RegisterFunctionName('PADZ', DefProc, Pointer(27), nil);
  609.   s.RegisterFunctionName('REPLICATE', DefProc, Pointer(28), nil);
  610.   s.RegisterFunctionName('STRINGOFCHAR', DefProc, Pointer(28), nil);
  611.   s.RegisterFunctionName('!ASSIGNED', DefProc, Pointer(29), nil);
  612.   s.RegisterFunctionName('VARGETTYPE', VarProc, Pointer(0), nil);
  613.   s.RegisterFunctionName('NULL', VarProc, Pointer(1), nil);
  614.  
  615.   s.RegisterFunctionName('GETARRAYLENGTH', GetArrayLength, nil, nil);
  616.   s.RegisterFunctionName('SETARRAYLENGTH', SetArrayLength, nil, nil);
  617.  
  618.   s.RegisterFunctionName('RAISELASTEXCEPTION', DefPRoc, Pointer(30), nil);
  619.   s.RegisterFunctionName('RAISEEXCEPTION', DefPRoc, Pointer(31), nil);
  620.   s.RegisterFunctionName('EXCEPTIONTYPE', DefPRoc, Pointer(32), nil);
  621.   s.RegisterFunctionName('EXCEPTIONPARAM', DefPRoc, Pointer(33), nil);
  622.   s.RegisterFunctionName('EXCEPTIONPROC', DefPRoc, Pointer(34), nil);
  623.   s.RegisterFunctionName('EXCEPTIONPOS', DefPRoc, Pointer(35), nil);
  624.   s.RegisterFunctionname('EXCEPTIONTOSTRING', DefProc, Pointer(36), nil);
  625. end;
  626.  
  627. end.
  628.