From f091b4226328612fa24e23cd421d60d0e0d0dcdc Mon Sep 17 00:00:00 2001 From: Andreas Volz Date: Tue, 29 Jul 2008 23:49:34 +0200 Subject: [PATCH] not longer needed --- include/dbus-c++/Ecore_Dispatcher.h | 49 ------------------- src/Ecore_Dispatcher.cpp | 76 ----------------------------- src/Makefile.am | 4 +- 3 files changed, 2 insertions(+), 127 deletions(-) delete mode 100644 include/dbus-c++/Ecore_Dispatcher.h delete mode 100644 src/Ecore_Dispatcher.cpp diff --git a/include/dbus-c++/Ecore_Dispatcher.h b/include/dbus-c++/Ecore_Dispatcher.h deleted file mode 100644 index 332dc4e..0000000 --- a/include/dbus-c++/Ecore_Dispatcher.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef ECORE_DISPATCHER_H -#define ECORE_DISPATCHER_H - -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 - -# include - -# define e_write(fd, buffer, count) \ - send((fd), (char *)(buffer), count, 0) - -# define e_read(fd, buffer, count) \ - recv((fd), (char *)(buffer), count, 0) - -#else - -# include -# include - -# define e_write(fd, buffer, count) \ - write((fd), (buffer), count) - -# define e_read(fd, buffer, count) \ - read((fd), (buffer), count) - -#endif /* _WIN32 */ - -struct _Ecore_Dispatcher -{ - int m_fd_read; - int m_fd_write; - size_t m_count; - void (*m_update_func) (void*/*, size_t*/); -}; - -typedef struct _Ecore_Dispatcher Ecore_Dispatcher; - -void ecore_dispatcher_init (Ecore_Dispatcher *dp, void (update) (void*/*, size_t*/)); -void ecore_dispatcher_signal (Ecore_Dispatcher *dp, void *data, size_t count); -void ecore_dispatcher_close (Ecore_Dispatcher *dp); - -#endif // ECORE_DISPATCHER_H - diff --git a/src/Ecore_Dispatcher.cpp b/src/Ecore_Dispatcher.cpp deleted file mode 100644 index 35d5523..0000000 --- a/src/Ecore_Dispatcher.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "../include/dbus-c++/Ecore_Dispatcher.h" - -#include -#include // TODO: port and protect for other systems - -// TODO: add deinit method to close handler - -#define BUFFER_GLOBAL_SIZE PIPE_BUF // defined in linux/limits.h - -int ecore_dispatcher_async_handler (void *data, Ecore_Fd_Handler *fdh) -{ - int fd; - Ecore_Dispatcher *dp_local = (Ecore_Dispatcher*) data; - char buf[dp_local->m_count]; - - fd = ecore_main_fd_handler_fd_get(fdh); - - int recBytes = 0; - - recBytes = e_read (fd, buf, dp_local->m_count); - - if (recBytes <= 0) - { - fprintf (stderr, "Error while reading pipe!\n"); - exit (1); - } - - assert (recBytes == (signed) dp_local->m_count); - - dp_local->m_update_func (buf/*, recBytes*/); - - return 1; -} - -void ecore_dispatcher_init (Ecore_Dispatcher *dp, void (update) (void*/*, size_t*/)) -{ - int fd[2]; - Ecore_Fd_Handler *fd_handler; - - dp->m_update_func = update; - - /* Create the file descriptors */ - if (pipe(fd) == 0) - { - dp->m_fd_read = fd[0]; - dp->m_fd_write = fd[1]; - - fcntl(dp->m_fd_read, F_SETFL, O_NONBLOCK); - fd_handler = ecore_main_fd_handler_add (dp->m_fd_read, - ECORE_FD_READ, - ecore_dispatcher_async_handler, - dp, - NULL, NULL); - - ecore_main_fd_handler_active_set(fd_handler, ECORE_FD_READ); - } - else - { - fprintf (stderr, "pipe() failed\n"); - exit (1); - } -} - -void ecore_dispatcher_close (Ecore_Dispatcher *dp) -{ - close (dp->m_fd_read); - close (dp->m_fd_write); -} - -void ecore_dispatcher_signal (Ecore_Dispatcher *dp, void *data, size_t count) -{ - dp->m_count = count; - - e_write (dp->m_fd_write, data, count); -} - diff --git a/src/Makefile.am b/src/Makefile.am index 5b78d1f..74ac218 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,8 +12,8 @@ GLIB_CPP = glib-integration.cpp endif if ENABLE_ECORE -ECORE_H = $(HEADER_DIR)/ecore-integration.h $(HEADER_DIR)/Ecore_Dispatcher.h -ECORE_CPP = ecore-integration.cpp Ecore_Dispatcher.cpp +ECORE_H = $(HEADER_DIR)/ecore-integration.h +ECORE_CPP = ecore-integration.cpp endif CONFIG_H = $(top_builddir)/include/dbus-c++/dbus-c++-config.h