py-events.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Python interface to inferior events.
  2. Copyright (C) 2009-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef PYTHON_PY_EVENTS_H
  15. #define PYTHON_PY_EVENTS_H
  16. #include "command.h"
  17. #include "python-internal.h"
  18. #include "inferior.h"
  19. /* Stores a list of objects to be notified when the event for which this
  20. registry tracks occurs. */
  21. struct eventregistry_object
  22. {
  23. PyObject_HEAD
  24. PyObject *callbacks;
  25. };
  26. /* Struct holding references to event registries both in python and c.
  27. This is meant to be a singleton. */
  28. struct events_object
  29. {
  30. #define GDB_PY_DEFINE_EVENT(name) \
  31. eventregistry_object *name;
  32. #include "py-all-events.def"
  33. #undef GDB_PY_DEFINE_EVENT
  34. PyObject *module;
  35. };
  36. /* Python events singleton. */
  37. extern events_object gdb_py_events;
  38. extern eventregistry_object *create_eventregistry_object (void);
  39. extern int evregpy_no_listeners_p (eventregistry_object *registry);
  40. #endif /* PYTHON_PY_EVENTS_H */