symnot.pas 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {
  2. $Id$
  3. Copyright (c) 2002 by Daniel Mantione
  4. This unit contains support routines for the variable access
  5. notifier.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit symnot;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses cclasses,symbase,symtype;
  23. type Tnotification_flag=(vn_onread,vn_onwrite);
  24. Tnotification_flags=set of Tnotification_flag;
  25. Tnotification_callback=procedure(not_type:Tnotification_flag;
  26. symbol:Tsym) of object;
  27. Tnotification=class(Tlinkedlistitem)
  28. flags:Tnotification_flags;
  29. callback:Tnotification_callback;
  30. id:cardinal;
  31. constructor create(Aflags:Tnotification_flags;
  32. Acallback:Tnotification_callback);
  33. end;
  34. implementation
  35. var notification_counter:cardinal;
  36. constructor Tnotification.create(Aflags:Tnotification_flags;
  37. Acallback:Tnotification_callback);
  38. begin
  39. inherited create;
  40. flags:=Aflags;
  41. callback:=Acallback;
  42. id:=notification_counter;
  43. inc(notification_counter);
  44. end;
  45. begin
  46. notification_counter:=0;
  47. end.
  48. {
  49. $Log$
  50. Revision 1.1 2002-09-01 08:04:42 daniel
  51. + Added read/write notifications of variables. These will be usefull
  52. for providing information for several optimizations. For example
  53. the value of the loop variable of a for loop does matter is the
  54. variable is read after the for loop, but if it's no longer used
  55. or written, it doesn't matter and this can be used to optimize
  56. the loop code generation.
  57. }