From 7fe60435bce6595a9c58a9bfd8244d74b5320e96 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 15 Jan 2013 08:46:13 +0100 Subject: Import DirectFB141_2k11R3_beta5 --- Source/FusionDale/src/messenger/Makefile.am | 14 + Source/FusionDale/src/messenger/Makefile.in | 464 +++++++++++++++++++++ .../src/messenger/ifusiondalemessenger.c | 372 +++++++++++++++++ .../src/messenger/ifusiondalemessenger.h | 48 +++ 4 files changed, 898 insertions(+) create mode 100755 Source/FusionDale/src/messenger/Makefile.am create mode 100755 Source/FusionDale/src/messenger/Makefile.in create mode 100755 Source/FusionDale/src/messenger/ifusiondalemessenger.c create mode 100755 Source/FusionDale/src/messenger/ifusiondalemessenger.h (limited to 'Source/FusionDale/src/messenger') diff --git a/Source/FusionDale/src/messenger/Makefile.am b/Source/FusionDale/src/messenger/Makefile.am new file mode 100755 index 0000000..4e46d19 --- /dev/null +++ b/Source/FusionDale/src/messenger/Makefile.am @@ -0,0 +1,14 @@ +## Makefile.am for FusionDale/src/messenger + +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + $(FUSION_CFLAGS) + +noinst_LTLIBRARIES = \ + libfusiondalemessenger.la + +libfusiondalemessenger_la_SOURCES = \ + ifusiondalemessenger.c \ + ifusiondalemessenger.h diff --git a/Source/FusionDale/src/messenger/Makefile.in b/Source/FusionDale/src/messenger/Makefile.in new file mode 100755 index 0000000..0cee306 --- /dev/null +++ b/Source/FusionDale/src/messenger/Makefile.in @@ -0,0 +1,464 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/messenger +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libfusiondalemessenger_la_LIBADD = +am_libfusiondalemessenger_la_OBJECTS = ifusiondalemessenger.lo +libfusiondalemessenger_la_OBJECTS = \ + $(am_libfusiondalemessenger_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libfusiondalemessenger_la_SOURCES) +DIST_SOURCES = $(libfusiondalemessenger_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FUSIONDALE_BINARY_AGE = @FUSIONDALE_BINARY_AGE@ +FUSIONDALE_INTERFACE_AGE = @FUSIONDALE_INTERFACE_AGE@ +FUSIONDALE_MAJOR_VERSION = @FUSIONDALE_MAJOR_VERSION@ +FUSIONDALE_MICRO_VERSION = @FUSIONDALE_MICRO_VERSION@ +FUSIONDALE_MINOR_VERSION = @FUSIONDALE_MINOR_VERSION@ +FUSIONDALE_VERSION = @FUSIONDALE_VERSION@ +FUSION_CFLAGS = @FUSION_CFLAGS@ +FUSION_LIBS = @FUSION_LIBS@ +GREP = @GREP@ +INCLUDEDIR = @INCLUDEDIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULEDIR = @MODULEDIR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + $(FUSION_CFLAGS) + +noinst_LTLIBRARIES = \ + libfusiondalemessenger.la + +libfusiondalemessenger_la_SOURCES = \ + ifusiondalemessenger.c \ + ifusiondalemessenger.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/messenger/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/messenger/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libfusiondalemessenger.la: $(libfusiondalemessenger_la_OBJECTS) $(libfusiondalemessenger_la_DEPENDENCIES) + $(LINK) $(libfusiondalemessenger_la_OBJECTS) $(libfusiondalemessenger_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifusiondalemessenger.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Source/FusionDale/src/messenger/ifusiondalemessenger.c b/Source/FusionDale/src/messenger/ifusiondalemessenger.c new file mode 100755 index 0000000..60b94d6 --- /dev/null +++ b/Source/FusionDale/src/messenger/ifusiondalemessenger.c @@ -0,0 +1,372 @@ +/* + (c) Copyright 2006-2007 directfb.org + + All rights reserved. + + Written by Denis Oliver Kropp . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include + +#include +#include + +#include + +#include +#include +#include + +#include "ifusiondalemessenger.h" + +/**********************************************************************************************************************/ + +static void +IFusionDaleMessenger_Destruct( IFusionDaleMessenger *thiz ) +{ + IFusionDaleMessenger_data *data = thiz->priv; + + fd_messenger_port_detach( data->port, &data->port->local_reaction ); + + fd_messenger_port_unref( data->port ); + fd_messenger_unref( data->messenger ); + + DIRECT_DEALLOCATE_INTERFACE( thiz ); +} + +static DirectResult +IFusionDaleMessenger_AddRef( IFusionDaleMessenger *thiz ) +{ + DIRECT_INTERFACE_GET_DATA (IFusionDaleMessenger) + + data->ref++; + + return DR_OK; +} + +static DirectResult +IFusionDaleMessenger_Release( IFusionDaleMessenger *thiz ) +{ + DIRECT_INTERFACE_GET_DATA (IFusionDaleMessenger) + + if (--data->ref == 0) + IFusionDaleMessenger_Destruct( thiz ); + + return DR_OK; +} + +static DirectResult +IFusionDaleMessenger_RegisterEvent( IFusionDaleMessenger *thiz, + const char *name, + FDMessengerEventID *ret_id ) +{ + DirectResult ret; + CoreMessengerEvent *event; + + DIRECT_INTERFACE_GET_DATA(IFusionDaleMessenger) + + /* Check arguments. */ + if (!name || !ret_id) + return DR_INVARG; + + /* Lock the messenger. */ + ret = fd_messenger_lock( data->messenger ); + if (ret) + return ret; + + /* Try to lookup event by name. */ + ret = fd_messenger_lookup_event( data->messenger, name, &event ); + switch (ret) { + case DR_OK: + /* Event is found (already registered). */ + ret = DR_BUSY; + break; + + case DR_ITEMNOTFOUND: + /* Create a new event. */ + ret = fd_messenger_create_event( data->messenger, name, &event ); + if (ret == DR_OK) + break; + + /* fall through */ + + default: + /* Unexpected result. */ + fd_messenger_unlock( data->messenger ); + return ret; + } + + /* Keep track of our registration. */ + fd_messenger_port_add_event( data->port, event ); + + /* Return the event id. */ + *ret_id = event->id; + + /* Unlock the messenger. */ + fd_messenger_unlock( data->messenger ); + + return ret; +} + +static DirectResult +IFusionDaleMessenger_UnregisterEvent( IFusionDaleMessenger *thiz, + FDMessengerEventID event_id ) +{ + DirectResult ret; + + DIRECT_INTERFACE_GET_DATA(IFusionDaleMessenger) + + /* Check arguments */ + if (!event_id) + return DR_INVARG; + + /* Lock the messenger (has to happen before port is locked!). */ + ret = fd_messenger_lock( data->messenger ); + if (ret) + return ret; + + /* Let it go. */ + ret = fd_messenger_port_remove_event( data->port, event_id ); + + /* Unlock the messenger. */ + fd_messenger_unlock( data->messenger ); + + return ret; +} + +static DirectResult +IFusionDaleMessenger_IsEventRegistered( IFusionDaleMessenger *thiz, + const char *name ) +{ + DirectResult ret; + + DIRECT_INTERFACE_GET_DATA(IFusionDaleMessenger) + + /* Check arguments */ + if (!name) + return DR_INVARG; + + /* Lock the messenger. */ + ret = fd_messenger_lock( data->messenger ); + if (ret) + return ret; + + /* Try to lookup event by name. */ + ret = fd_messenger_lookup_event( data->messenger, name, NULL ); + + /* Unlock the messenger. */ + fd_messenger_unlock( data->messenger ); + + return ret; +} + +static DirectResult +IFusionDaleMessenger_RegisterListener( IFusionDaleMessenger *thiz, + FDMessengerEventID event_id, + FDMessengerEventCallback callback, + void *context, + FDMessengerListenerID *ret_id ) +{ + DirectResult ret; + DIRECT_INTERFACE_GET_DATA(IFusionDaleMessenger) + + /* Check arguments */ + if (!event_id || !callback || !ret_id) + return DR_INVARG; + + /* Lock the messenger (has to happen before port is locked!). */ + ret = fd_messenger_lock( data->messenger ); + if (ret) + return ret; + + ret = fd_messenger_port_add_listener( data->port, event_id, callback, context, ret_id ); + + /* Unlock the messenger. */ + fd_messenger_unlock( data->messenger ); + + return ret; +} + +static DirectResult +IFusionDaleMessenger_UnregisterListener( IFusionDaleMessenger *thiz, + FDMessengerListenerID listener_id ) +{ + DirectResult ret; + DIRECT_INTERFACE_GET_DATA(IFusionDaleMessenger) + + /* Check arguments */ + if (!listener_id) + return DR_INVARG; + + /* Lock the messenger (has to happen before port is locked!). */ + ret = fd_messenger_lock( data->messenger ); + if (ret) + return ret; + + ret = fd_messenger_port_remove_listener( data->port, listener_id ); + + /* Unlock the messenger. */ + fd_messenger_unlock( data->messenger ); + + return ret; +} + +static DirectResult +IFusionDaleMessenger_SendSimpleEvent( IFusionDaleMessenger *thiz, + FDMessengerEventID event_id, + int param ) +{ + DirectResult ret; + + DIRECT_INTERFACE_GET_DATA(IFusionDaleMessenger) + + /* Check arguments */ + if (!event_id) + return DR_INVARG; + + /* Lock the messenger (has to happen before port is locked!). */ + ret = fd_messenger_lock( data->messenger ); + if (ret) + return ret; + + /* Send the event. */ + ret = fd_messenger_port_send_event( data->port, event_id, param, NULL, 0 ); + + /* Unlock the messenger. */ + fd_messenger_unlock( data->messenger ); + + return ret; +} + +static DirectResult +IFusionDaleMessenger_SendEvent( IFusionDaleMessenger *thiz, + FDMessengerEventID event_id, + int param, + void *data_ptr, + unsigned int data_size ) +{ + DirectResult ret; + + DIRECT_INTERFACE_GET_DATA(IFusionDaleMessenger) + + /* Check arguments */ + if (!event_id || !data_ptr || !data_size) + return DR_INVARG; + + /* Lock the messenger (has to happen before port is locked!). */ + ret = fd_messenger_lock( data->messenger ); + if (ret) + return ret; + + /* Send the event. */ + ret = fd_messenger_port_send_event( data->port, event_id, param, data_ptr, data_size ); + + /* Unlock the messenger. */ + fd_messenger_unlock( data->messenger ); + + return ret; +} + +static DirectResult +IFusionDaleMessenger_AllocateData( IFusionDaleMessenger *thiz, + unsigned int data_size, + void **ret_data ) +{ + DirectResult ret; + void *data_ptr; + + DIRECT_INTERFACE_GET_DATA(IFusionDaleMessenger) + + /* Check arguments */ + if (!data_size || !ret_data) + return DR_INVARG; + + /* Lock the messenger. */ + ret = fd_messenger_lock( data->messenger ); + if (ret) + return ret; + + /* Allocate the message data. */ + data_ptr = SHCALLOC( data->messenger->shmpool, 1, data_size ); + + /* Unlock the messenger. */ + fd_messenger_unlock( data->messenger ); + + if (!data_ptr) + return D_OOSHM(); + + *ret_data = data_ptr; + + return DR_OK; +} + +DirectResult +IFusionDaleMessenger_Construct( IFusionDaleMessenger *thiz, + CoreDale *core, + CoreMessenger *messenger ) +{ + DirectResult ret; + CoreMessengerPort *port; + + /* Allocate interface data. */ + DIRECT_ALLOCATE_INTERFACE_DATA( thiz, IFusionDaleMessenger ); + + /* Increase messenger's reference counter. */ + ret = fd_messenger_ref( messenger ); + if (ret) + goto error; + + /* Create our port for the messenger. */ + ret = fd_messenger_port_create( core, messenger, &port ); + if (ret) + goto error_port; + + /* Initialize interface data. */ + data->ref = 1; + data->core = core; + data->messenger = messenger; + data->port = port; + + /* Assign interface pointers. */ + thiz->AddRef = IFusionDaleMessenger_AddRef; + thiz->Release = IFusionDaleMessenger_Release; + thiz->RegisterEvent = IFusionDaleMessenger_RegisterEvent; + thiz->UnregisterEvent = IFusionDaleMessenger_UnregisterEvent; + thiz->IsEventRegistered = IFusionDaleMessenger_IsEventRegistered; + thiz->RegisterListener = IFusionDaleMessenger_RegisterListener; + thiz->UnregisterListener = IFusionDaleMessenger_UnregisterListener; + thiz->SendSimpleEvent = IFusionDaleMessenger_SendSimpleEvent; + thiz->SendEvent = IFusionDaleMessenger_SendEvent; + thiz->AllocateData = IFusionDaleMessenger_AllocateData; + + return DR_OK; + + +error_port: + fd_messenger_unref( messenger ); + +error: + DIRECT_DEALLOCATE_INTERFACE( thiz ); + + return ret; +} + diff --git a/Source/FusionDale/src/messenger/ifusiondalemessenger.h b/Source/FusionDale/src/messenger/ifusiondalemessenger.h new file mode 100755 index 0000000..8e3f490 --- /dev/null +++ b/Source/FusionDale/src/messenger/ifusiondalemessenger.h @@ -0,0 +1,48 @@ +/* + (c) Copyright 2006-2007 directfb.org + + All rights reserved. + + Written by Denis Oliver Kropp . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __IFUSIONDALEMESSENGER_H__ +#define __IFUSIONDALEMESSENGER_H__ + +#include + +#include + +#include + +/* + * private data struct of IFusionDaleMessenger + */ +typedef struct { + int ref; /* reference counter */ + + CoreDale *core; + CoreMessenger *messenger; + CoreMessengerPort *port; +} IFusionDaleMessenger_data; + +DirectResult IFusionDaleMessenger_Construct( IFusionDaleMessenger *thiz, + CoreDale *core, + CoreMessenger *messenger ); + +#endif -- cgit