unit uPSI_JavascriptObject;
{
This file has been generated by UnitParser v0.7, written by M. Knight
and updated by NP. v/d Spek and George Birbilis. 
Source Code from Carlo Kok has been used to implement various sections of
UnitParser. Components of ROPS are used in the construction of UnitParser,
code implementing the class wrapper is taken from Carlo Kok's conv utility

}
interface
 

 
uses
   SysUtils
  ,Classes
  ,uPSComponent
  ,uPSRuntime
  ,uPSCompiler
  ;
 
type 
(*----------------------------------------------------------------------------*)
  TPSImport_JavascriptObject = class(TPSPlugin)
  public
    procedure CompileImport1(CompExec: TPSScript); override;
    procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
  end;
 
 
{ compile-time registration functions }
procedure SIRegister_TJSObject(CL: TPSPascalCompiler);


{ run-time registration functions }
procedure RIRegister_TJSObject(CL: TPSRuntimeClassImporter);

implementation


uses
   Windows
  ,Messages
  ,Variants
  ,ActiveX
  ,ComObj
  ,JavascriptObject
  ;
 
 

(* === compile-time registration functions === *)

(*----------------------------------------------------------------------------*)
procedure SIRegister_TJSObject(CL: TPSPascalCompiler);
begin
  //with RegClassS(CL,'TInterfacedObject', 'TJSObject') do
  with CL.AddClassN(CL.FindClass('TInterfacedObject'),'TJSObject') do
  begin
    RegisterMethod('Function GetObject( PropertyName : string) : TJSObject;');
    RegisterMethod('Function GetString( PropertyName : string) : string;');
    RegisterMethod('procedure SetValue(PropertyName: string; Value: string);');

  end;
end;

(*----------------------------------------------------------------------------*)
procedure SIRegister_JavascriptObject(CL: TPSPascalCompiler);
begin
  SIRegister_TJSObject(CL);
end;

(* === run-time registration functions === *)

(*----------------------------------------------------------------------------*)
Function TJSObjectGetString_P(Self: TJSObject;  PropertyName : string) : string;
Begin Result := Self.GetString(PropertyName); END;

(*----------------------------------------------------------------------------*)
Function TJSObjectGetObject_P(Self: TJSObject;  PropertyName : string) : TJSObject;
Begin Result := Self.GetObject(PropertyName); END;

(*----------------------------------------------------------------------------*)
Procedure TJSObjectSetValue_P(Self: TJSObject;  PropertyName, Value : string);
Begin Self.SetValue(PropertyName); END;


procedure RIRegister_TJSObject(CL: TPSRuntimeClassImporter);
begin
  with CL.Add(TJSObject) do
  begin
    RegisterMethod(@TJSObjectGetObject_P, 'GetObject');
    RegisterMethod(@TJSObjectGetString_P, 'GetString');
    RegisterMethod(@TJSObjectSetValue_P, 'SetValue');
  end;
end;

(*----------------------------------------------------------------------------*)
procedure RIRegister_JavascriptObject(CL: TPSRuntimeClassImporter);
begin
  RIRegister_TJSObject(CL);
end;

 
 
{ TPSImport_JavascriptObject }
(*----------------------------------------------------------------------------*)
procedure TPSImport_JavascriptObject.CompileImport1(CompExec: TPSScript);
begin
  SIRegister_JavascriptObject(CompExec.Comp);
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_JavascriptObject.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter);
begin
  RIRegister_JavascriptObject(ri);
end;
(*----------------------------------------------------------------------------*)
 
 
end.