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

  1. {Delphi function importer (compiletime)}
  2. unit ifpidelphi;
  3. {
  4.   Innerfuse Pascal Script Call unit
  5.   You may not copy a part of this unit, only use it as whole, with
  6.   Innerfuse Pascal Script Script Engine.
  7. }
  8. {$I ifps3_def.inc}
  9. interface
  10. uses
  11.   ifps3utl, ifps3common, ifpscomp;
  12.  
  13.  
  14. { Register a normal Delphi function at runtime. Decl should be the exact declaration of the
  15.   function. But since the const keyword is not support yet, you should leave that out.}
  16. function RegisterDelphiFunctionC(SE: TIFPSPascalCompiler; const Decl: string): Boolean;
  17. function RegisterDelphiFunctionC2(SE: TIFPSPascalCompiler; const Decl: string): PIFPSRegProc;
  18.  
  19. implementation
  20.  
  21. function RegisterDelphiFunctionC(SE: TIFPSPascalCompiler; const Decl: string): Boolean;
  22. begin
  23.   Result := RegisterDelphiFunctionC2(SE, Decl) <> nil;
  24. end;
  25. function RegisterDelphiFunctionC2(SE: TIFPSPascalCompiler; const Decl: string): PIFPSRegProc;
  26. var
  27.   p: PIFPSRegProc;
  28.   s: string;
  29. begin
  30.   p := Se.AddFunction(Decl);
  31.   if p = nil then begin Result := nil; exit; end;
  32.   s := p^.Decl;
  33.   if GRFW(s) = '-1' then
  34.   begin
  35.     p^.ImportDecl := p^.ImportDecl + #0;
  36.   end else
  37.     p^.ImportDecl := p^.ImportDecl + #1;
  38.   while length(s) > 0 do
  39.   begin
  40.     if s[1] = '!' then
  41.       p^.ImportDecl := p^.ImportDecl + #1
  42.     else
  43.       p^.ImportDecl := p^.ImportDecl + #0;
  44.     grfw(s);
  45.     grfw(s);
  46.   end;
  47.   p^.FExportName := True;
  48.   Result := p;
  49. end;
  50.  
  51. end.
  52.  
  53.