home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / zkuste / Delphi / navody / tt / objvm.exe / UNITS / ValueUtils.pas < prev    next >
Pascal/Delphi Source File  |  1998-06-26  |  2KB  |  67 lines

  1. {Useful procedures}
  2. unit ValueUtils;
  3.  
  4. interface
  5. uses
  6.      LangValue;
  7.  
  8. procedure ReturnTrue(s:IValStack;MustReturn:boolean);
  9. procedure ReturnBool(s:IValStack;MustReturn:boolean;a:boolean);
  10. procedure ReturnString(s:IValStack;MustReturn:boolean;const str:string);
  11. procedure ReturnVar(s:IValStack;MustReturn:boolean;avar:Variant);
  12. procedure SetObjectOf(val:ILangValue;a:TObject);
  13. function  GetObjectOf(val:ILangValue):TObject;
  14.  
  15. implementation
  16. uses VarLangValue,ObjectValue,VisualValue;
  17. procedure ReturnTrue(s:IValStack;MustReturn:boolean);
  18.           Var v:TVarLangValue;
  19.           begin
  20.             if MustReturn then
  21.             begin
  22.               v:=TVarLangValue.Create(nil);
  23.               v.AsBoolean:=True;
  24.               s.Push(v);
  25.             end;
  26.           end;
  27. procedure ReturnBool(s:IValStack;MustReturn:boolean;a:boolean);
  28.           Var v:TVarLangValue;
  29.           begin
  30.             if MustReturn then
  31.             begin
  32.               v:=TVarLangValue.Create(nil);
  33.               v.AsBoolean:=a;
  34.               s.Push(v);
  35.             end;
  36.           end;
  37. procedure ReturnString(s:IValStack;MustReturn:boolean;const str:string);
  38.           Var v:TVarLangValue;
  39.           begin
  40.             if MustReturn then
  41.             begin
  42.               v:=TVarLangValue.Create(nil);
  43.               v.AsString:=str;
  44.               s.Push(v);
  45.             end;
  46.           end;
  47. procedure ReturnVar(s:IValStack;MustReturn:boolean;avar:variant);
  48.           Var v:TVarLangValue;
  49.           begin
  50.             if MustReturn then
  51.             begin
  52.               v:=TVarLangValue.Create(nil);
  53.               v.AsVariant:=avar;
  54.               s.Push(v);
  55.             end;
  56.           end;
  57. procedure SetObjectOf;
  58.           begin
  59.             (((Val as TVisualValue).LangOwner) as TObjectValue ).Target:=a;
  60.           end;
  61. function  GetObjectOf;
  62.           begin
  63.             Result:=(((Val as TVisualValue).LangOwner)  as TObjectValue).Target;
  64.           end;
  65.  
  66. end.
  67.