summaryrefslogtreecommitdiff
path: root/Source/FusionDale/src
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FusionDale/src')
-rwxr-xr-xSource/FusionDale/src/Makefile.am54
-rwxr-xr-xSource/FusionDale/src/Makefile.in645
-rwxr-xr-xSource/FusionDale/src/coma/Makefile.am32
-rwxr-xr-xSource/FusionDale/src/coma/Makefile.in518
-rwxr-xr-xSource/FusionDale/src/coma/coma.c750
-rwxr-xr-xSource/FusionDale/src/coma/coma.h111
-rwxr-xr-xSource/FusionDale/src/coma/coma_types.h35
-rwxr-xr-xSource/FusionDale/src/coma/component.c352
-rwxr-xr-xSource/FusionDale/src/coma/component.h105
-rwxr-xr-xSource/FusionDale/src/coma/icoma.c209
-rwxr-xr-xSource/FusionDale/src/coma/icoma.h47
-rwxr-xr-xSource/FusionDale/src/coma/icomacomponent.c340
-rwxr-xr-xSource/FusionDale/src/coma/icomacomponent.h60
-rwxr-xr-xSource/FusionDale/src/coma/policy.c206
-rwxr-xr-xSource/FusionDale/src/coma/policy.h53
-rwxr-xr-xSource/FusionDale/src/coma/thread.c96
-rwxr-xr-xSource/FusionDale/src/coma/thread.h66
-rwxr-xr-xSource/FusionDale/src/core/Makefile.am26
-rwxr-xr-xSource/FusionDale/src/core/Makefile.in509
-rwxr-xr-xSource/FusionDale/src/core/dale_core.c578
-rwxr-xr-xSource/FusionDale/src/core/dale_core.h72
-rwxr-xr-xSource/FusionDale/src/core/dale_types.h38
-rwxr-xr-xSource/FusionDale/src/core/messenger.c305
-rwxr-xr-xSource/FusionDale/src/core/messenger.h160
-rwxr-xr-xSource/FusionDale/src/core/messenger_port.c939
-rwxr-xr-xSource/FusionDale/src/core/messenger_port.h137
-rwxr-xr-xSource/FusionDale/src/fusiondale.c216
-rwxr-xr-xSource/FusionDale/src/ifusiondale.c228
-rwxr-xr-xSource/FusionDale/src/ifusiondale.h45
-rwxr-xr-xSource/FusionDale/src/messenger/Makefile.am14
-rwxr-xr-xSource/FusionDale/src/messenger/Makefile.in464
-rwxr-xr-xSource/FusionDale/src/messenger/ifusiondalemessenger.c372
-rwxr-xr-xSource/FusionDale/src/messenger/ifusiondalemessenger.h48
-rwxr-xr-xSource/FusionDale/src/misc/Makefile.am16
-rwxr-xr-xSource/FusionDale/src/misc/Makefile.in464
-rwxr-xr-xSource/FusionDale/src/misc/dale_config.c377
-rwxr-xr-xSource/FusionDale/src/misc/dale_config.h64
37 files changed, 8751 insertions, 0 deletions
diff --git a/Source/FusionDale/src/Makefile.am b/Source/FusionDale/src/Makefile.am
new file mode 100755
index 0000000..142712d
--- /dev/null
+++ b/Source/FusionDale/src/Makefile.am
@@ -0,0 +1,54 @@
+## Makefile.am for FusionDale/src
+
+SUBDIRS = coma core messenger misc
+
+INCLUDES = \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src \
+ $(FUSION_CFLAGS)
+
+
+lib_LTLIBRARIES = libfusiondale.la
+
+libfusiondale_la_SOURCES = \
+ fusiondale.c \
+ ifusiondale.c \
+ ifusiondale.h
+
+libfusiondale_la_LIBADD = \
+ $(FUSION_LIBS) \
+ coma/libfusiondalecoma.la \
+ core/libfusiondalecore.la \
+ messenger/libfusiondalemessenger.la \
+ misc/libfusiondalemisc.la
+
+libfusiondale_la_LDFLAGS = \
+ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+ -release $(LT_RELEASE)
+
+#
+## and now rebuild the static version with the *correct* object files
+#
+if BUILD_STATIC
+
+clean-local:
+ rm -f libfusiondale_fixed.a
+
+all-local: libfusiondale_fixed.a
+
+libfusiondale_fixed.a: .libs/libfusiondale.a
+ rm -f libfusiondale_fixed.a
+ ${AR} cru libfusiondale_fixed.a `find -name "*.o" | grep -v core | grep -v ifusion`
+ ${RANLIB} libfusiondale_fixed.a
+ cp -af libfusiondale_fixed.a .libs/libfusiondale.a
+
+.libs/libfusiondale.a: libfusiondale.la
+
+else
+
+clean-local:
+
+all-local:
+
+endif
diff --git a/Source/FusionDale/src/Makefile.in b/Source/FusionDale/src/Makefile.in
new file mode 100755
index 0000000..874ba1d
--- /dev/null
+++ b/Source/FusionDale/src/Makefile.in
@@ -0,0 +1,645 @@
+# 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
+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 =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libfusiondale_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ coma/libfusiondalecoma.la core/libfusiondalecore.la \
+ messenger/libfusiondalemessenger.la misc/libfusiondalemisc.la
+am_libfusiondale_la_OBJECTS = fusiondale.lo ifusiondale.lo
+libfusiondale_la_OBJECTS = $(am_libfusiondale_la_OBJECTS)
+libfusiondale_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libfusiondale_la_LDFLAGS) $(LDFLAGS) -o $@
+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 = $(libfusiondale_la_SOURCES)
+DIST_SOURCES = $(libfusiondale_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@
+SUBDIRS = coma core messenger misc
+INCLUDES = \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src \
+ $(FUSION_CFLAGS)
+
+lib_LTLIBRARIES = libfusiondale.la
+libfusiondale_la_SOURCES = \
+ fusiondale.c \
+ ifusiondale.c \
+ ifusiondale.h
+
+libfusiondale_la_LIBADD = \
+ $(FUSION_LIBS) \
+ coma/libfusiondalecoma.la \
+ core/libfusiondalecore.la \
+ messenger/libfusiondalemessenger.la \
+ misc/libfusiondalemisc.la
+
+libfusiondale_la_LDFLAGS = \
+ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+ -release $(LT_RELEASE)
+
+all: all-recursive
+
+.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/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_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
+libfusiondale.la: $(libfusiondale_la_OBJECTS) $(libfusiondale_la_DEPENDENCIES)
+ $(libfusiondale_la_LINK) -rpath $(libdir) $(libfusiondale_la_OBJECTS) $(libfusiondale_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fusiondale.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifusiondale.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
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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: ctags-recursive $(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
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool clean-local ctags \
+ ctags-recursive 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-libLTLIBRARIES install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-libLTLIBRARIES
+
+
+#
+#
+
+@BUILD_STATIC_TRUE@clean-local:
+@BUILD_STATIC_TRUE@ rm -f libfusiondale_fixed.a
+
+@BUILD_STATIC_TRUE@all-local: libfusiondale_fixed.a
+
+@BUILD_STATIC_TRUE@libfusiondale_fixed.a: .libs/libfusiondale.a
+@BUILD_STATIC_TRUE@ rm -f libfusiondale_fixed.a
+@BUILD_STATIC_TRUE@ ${AR} cru libfusiondale_fixed.a `find -name "*.o" | grep -v core | grep -v ifusion`
+@BUILD_STATIC_TRUE@ ${RANLIB} libfusiondale_fixed.a
+@BUILD_STATIC_TRUE@ cp -af libfusiondale_fixed.a .libs/libfusiondale.a
+
+@BUILD_STATIC_TRUE@.libs/libfusiondale.a: libfusiondale.la
+
+@BUILD_STATIC_FALSE@clean-local:
+
+@BUILD_STATIC_FALSE@all-local:
+# 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/coma/Makefile.am b/Source/FusionDale/src/coma/Makefile.am
new file mode 100755
index 0000000..8b4e814
--- /dev/null
+++ b/Source/FusionDale/src/coma/Makefile.am
@@ -0,0 +1,32 @@
+## Makefile.am for FusionDale/src/coma
+
+INCLUDES = \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src \
+ $(FUSION_CFLAGS)
+
+AM_CPPFLAGS = \
+ -DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+noinst_LTLIBRARIES = \
+ libfusiondalecoma.la
+
+comaincludedir = @INCLUDEDIR@/coma
+
+comainclude_HEADERS = \
+ coma.h \
+ coma_types.h \
+ component.h \
+ thread.h \
+ policy.h \
+ icoma.h \
+ icomacomponent.h
+
+libfusiondalecoma_la_SOURCES = \
+ coma.c \
+ component.c \
+ thread.c \
+ policy.c \
+ icoma.c \
+ icomacomponent.c
diff --git a/Source/FusionDale/src/coma/Makefile.in b/Source/FusionDale/src/coma/Makefile.in
new file mode 100755
index 0000000..e344022
--- /dev/null
+++ b/Source/FusionDale/src/coma/Makefile.in
@@ -0,0 +1,518 @@
+# 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/coma
+DIST_COMMON = $(comainclude_HEADERS) $(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)
+libfusiondalecoma_la_LIBADD =
+am_libfusiondalecoma_la_OBJECTS = coma.lo component.lo thread.lo \
+ policy.lo icoma.lo icomacomponent.lo
+libfusiondalecoma_la_OBJECTS = $(am_libfusiondalecoma_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 = $(libfusiondalecoma_la_SOURCES)
+DIST_SOURCES = $(libfusiondalecoma_la_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(comaincludedir)"
+comaincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(comainclude_HEADERS)
+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)
+
+AM_CPPFLAGS = \
+ -DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+noinst_LTLIBRARIES = \
+ libfusiondalecoma.la
+
+comaincludedir = @INCLUDEDIR@/coma
+comainclude_HEADERS = \
+ coma.h \
+ coma_types.h \
+ component.h \
+ thread.h \
+ policy.h \
+ icoma.h \
+ icomacomponent.h
+
+libfusiondalecoma_la_SOURCES = \
+ coma.c \
+ component.c \
+ thread.c \
+ policy.c \
+ icoma.c \
+ icomacomponent.c
+
+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/coma/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/coma/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
+libfusiondalecoma.la: $(libfusiondalecoma_la_OBJECTS) $(libfusiondalecoma_la_DEPENDENCIES)
+ $(LINK) $(libfusiondalecoma_la_OBJECTS) $(libfusiondalecoma_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coma.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/component.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icoma.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/policy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icomacomponent.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.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
+install-comaincludeHEADERS: $(comainclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(comaincludedir)" || $(MKDIR_P) "$(DESTDIR)$(comaincludedir)"
+ @list='$(comainclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(comaincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(comaincludedir)/$$f'"; \
+ $(comaincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(comaincludedir)/$$f"; \
+ done
+
+uninstall-comaincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(comainclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(comaincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(comaincludedir)/$$f"; \
+ done
+
+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) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(comaincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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-comaincludeHEADERS
+
+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: uninstall-comaincludeHEADERS
+
+.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-comaincludeHEADERS 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 uninstall-comaincludeHEADERS
+
+# 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/coma/coma.c b/Source/FusionDale/src/coma/coma.c
new file mode 100755
index 0000000..9c3eb76
--- /dev/null
+++ b/Source/FusionDale/src/coma/coma.c
@@ -0,0 +1,750 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <unistd.h>
+
+#include <pthread.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/signals.h>
+#include <direct/util.h>
+
+#include <fusion/arena.h>
+#include <fusion/build.h>
+#include <fusion/call.h>
+#include <fusion/conf.h>
+#include <fusion/fusion.h>
+#include <fusion/hash.h>
+#include <fusion/lock.h>
+#include <fusion/object.h>
+#include <fusion/reactor.h>
+#include <fusion/shmalloc.h>
+
+#include <coma/coma.h>
+#include <coma/component.h>
+#include <coma/thread.h>
+
+#include <misc/dale_config.h>
+
+
+D_DEBUG_DOMAIN( Coma_Core, "Coma/Core", "Coma Core" );
+
+/**********************************************************************************************************************/
+
+struct __COMA_ComaShared {
+ int magic;
+
+ FusionSkirmish lock;
+
+ FusionSHMPoolShared *shmpool;
+
+ FusionObjectPool *component_pool;
+ FusionHash *components;
+
+ FusionObjectPool *thread_pool;
+
+ FusionCall thread_mem_call;
+
+ FusionHash *allocations;
+};
+
+/**********************************************************************************************************************/
+
+static int coma_arena_initialize( FusionArena *arena,
+ void *ctx );
+static int coma_arena_join ( FusionArena *arena,
+ void *ctx );
+static int coma_arena_leave ( FusionArena *arena,
+ void *ctx,
+ bool emergency );
+static int coma_arena_shutdown ( FusionArena *arena,
+ void *ctx,
+ bool emergency );
+
+/**********************************************************************************************************************/
+
+static void tlshm_destroy( void *arg );
+
+/**********************************************************************************************************************/
+
+DirectResult
+coma_enter( FusionWorld *world, const char *name, Coma **ret_coma )
+{
+ Coma *coma;
+ char buf[128];
+ int ret = DR_OK;
+
+ D_ASSERT( world != NULL );
+ D_ASSERT( name != NULL );
+ D_ASSERT( ret_coma != NULL );
+
+ D_DEBUG_AT( Coma_Core, "%s()\n", __FUNCTION__ );
+
+ /* Allocate local coma structure. */
+ coma = D_CALLOC( 1, sizeof(Coma) );
+ if (!coma)
+ return D_OOM();
+
+ coma->world = world;
+ coma->fusion_id = fusion_id( world );
+ coma->name = D_STRDUP( name );
+
+ pthread_key_create( &coma->tlshm_key, tlshm_destroy );
+
+ D_MAGIC_SET( coma, Coma );
+
+ snprintf( buf, sizeof(buf), "Coma/%s", name );
+
+ /* Enter the Coma arena. */
+ if (fusion_arena_enter( world, buf, coma_arena_initialize, coma_arena_join,
+ coma, &coma->arena, &ret ) || ret)
+ {
+ D_MAGIC_CLEAR( coma );
+ D_FREE( coma->name );
+ D_FREE( coma );
+ return ret ? : DR_FUSION;
+ }
+
+ /* Return the coma. */
+ *ret_coma = coma;
+
+ return DR_OK;
+}
+
+DirectResult
+coma_exit( Coma *coma, bool emergency )
+{
+ D_MAGIC_ASSERT( coma, Coma );
+
+ D_DEBUG_AT( Coma_Core, "%s( %p, %semergency )\n", __FUNCTION__, coma, emergency ? "" : "no " );
+
+ /* Exit the Coma arena. */
+ fusion_arena_exit( coma->arena, coma_arena_shutdown, coma_arena_leave, coma, emergency, NULL );
+
+ D_FREE( coma->name );
+
+ D_MAGIC_CLEAR( coma );
+
+ /* Deallocate local coma structure. */
+ D_FREE( coma );
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+coma_create_component( Coma *coma,
+ const char *name,
+ ComaMethodFunc func,
+ int num_notifications,
+ void *ctx,
+ ComaComponent **ret_component )
+{
+ DirectResult ret;
+ ComaShared *shared;
+ ComaComponent *component;
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ D_DEBUG_AT( Coma_Core, "%s( %p, '%s' )\n", __FUNCTION__, coma, name );
+
+ shared = coma->shared;
+ D_MAGIC_ASSERT( shared, ComaShared );
+
+ ret = fusion_skirmish_prevail( &shared->lock );
+ if (ret)
+ return ret;
+
+ /* Check for existence first. */
+ component = fusion_hash_lookup( shared->components, name );
+ if (component) {
+ D_MAGIC_ASSERT( component, ComaComponent );
+ D_WARN( "component '%s' already exists", name );
+ fusion_skirmish_dismiss( &shared->lock );
+ return DR_BUSY;
+ }
+
+ /* Create component object. */
+ component = (ComaComponent*) fusion_object_create( shared->component_pool, coma->world );
+ if (!component) {
+ fusion_skirmish_dismiss( &shared->lock );
+ return DR_FUSION;
+ }
+
+ /* Initialize component object. */
+ ret = coma_component_init( component, coma, name, func, num_notifications, ctx );
+ if (ret) {
+ fusion_skirmish_dismiss( &shared->lock );
+ fusion_object_destroy( &component->object );
+ return ret;
+ }
+
+ /* Activate component object. */
+ fusion_object_activate( &component->object );
+
+ /* Insert new component into hash table. */
+ ret = fusion_hash_insert( shared->components, component->name, component );
+ if (ret) {
+ D_DERROR( ret, "Coma/Core: fusion_hash_insert( '%s', %p ) failed!\n", name, component );
+ fusion_skirmish_dismiss( &shared->lock );
+ coma_component_unref( component );
+ return ret;
+ }
+
+ ret = fusion_skirmish_notify( &shared->lock );
+ if (ret)
+ D_DERROR( ret, "Coma/Core: fusion_skirmish_notify() failed!\n" );
+
+ fusion_skirmish_dismiss( &shared->lock );
+
+ *ret_component = component;
+
+ return DR_OK;
+}
+
+DirectResult
+coma_get_component( Coma *coma,
+ const char *name,
+ unsigned int timeout,
+ ComaComponent **ret_component )
+{
+ DirectResult ret;
+ ComaShared *shared;
+ ComaComponent *component;
+
+ D_MAGIC_ASSERT( coma, Coma );
+ D_ASSERT( name != NULL );
+ D_ASSERT( ret_component != NULL );
+
+ D_DEBUG_AT( Coma_Core, "%s( %p, '%s' )\n", __FUNCTION__, coma, name );
+
+ shared = coma->shared;
+ D_MAGIC_ASSERT( shared, ComaShared );
+
+ /* Lock the manager. */
+ ret = fusion_skirmish_prevail( &shared->lock );
+ if (ret)
+ return ret;
+
+ /* Wait for the component to be added. */
+ while ((component = fusion_hash_lookup( shared->components, name )) == NULL) {
+ ret = fusion_skirmish_wait( &shared->lock, timeout );
+ if (ret)
+ return ret;
+ }
+
+ D_MAGIC_ASSERT( component, ComaComponent );
+
+ /* Increase component's ref counter. */
+ ret = coma_component_ref( component );
+ if (ret) {
+ fusion_skirmish_dismiss( &shared->lock );
+ return ret;
+ }
+
+ /* Unlock the manager. */
+ fusion_skirmish_dismiss( &shared->lock );
+
+
+ /* Lock the component. */
+ ret = fusion_skirmish_prevail( &component->lock );
+ if (ret) {
+ coma_component_unref( component );
+ return ret;
+ }
+
+ /* Wait for component to become active? */
+ while (!component->active) {
+ ret = fusion_skirmish_wait( &component->lock, timeout );
+ if (ret) {
+ coma_component_unref( component );
+ return ret;
+ }
+ }
+
+ /* Unlock the component. */
+ fusion_skirmish_dismiss( &component->lock );
+
+ *ret_component = component;
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+coma_allocate( Coma *coma,
+ unsigned int bytes,
+ void **ret_ptr )
+{
+ void *ptr;
+
+ ptr = SHCALLOC( coma->shared->shmpool, 1, bytes );
+ if (!ptr)
+ return D_OOSHM();
+
+ fusion_hash_insert( coma->shared->allocations, ptr, (void*) (unsigned long) bytes );
+
+ *ret_ptr = ptr;
+
+ return DR_OK;
+}
+
+DirectResult
+coma_deallocate( Coma *coma,
+ void *ptr )
+{
+ if (!fusion_hash_lookup( coma->shared->allocations, ptr ))
+ return DR_ITEMNOTFOUND;
+
+ fusion_hash_remove( coma->shared->allocations, ptr, NULL, NULL );
+
+ SHFREE( coma->shared->shmpool, ptr );
+
+ return DR_OK;
+}
+
+DirectResult
+coma_allocation_size ( Coma *coma,
+ void *ptr,
+ int *ret_size )
+{
+ int size;
+
+ size = (unsigned long) fusion_hash_lookup( coma->shared->allocations, ptr );
+ if (!size) {
+ D_WARN( "zero length from lookup of %p", ptr );
+ return DR_ITEMNOTFOUND;
+ }
+
+ *ret_size = size;
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static FusionCallHandlerResult
+thread_mem_call_handler( int caller,
+ int call_arg,
+ void *call_ptr,
+ void *ctx,
+ unsigned int serial,
+ int *ret_val )
+{
+ ComaThread *thread = call_ptr;
+
+ D_MAGIC_ASSERT( thread, ComaThread );
+
+ if (call_arg > 0) {
+ void *ptr = SHCALLOC( thread->shmpool, 1, call_arg );
+
+ if (!ptr) {
+ *ret_val = D_OOSHM();
+ return FCHR_RETURN;
+ }
+
+ if (thread->mem)
+ SHFREE( thread->shmpool, thread->mem );
+
+ thread->mem = ptr;
+ thread->mem_size = call_arg;
+ }
+ else {
+ if (thread->mem)
+ SHFREE( thread->shmpool, thread->mem );
+
+ thread->mem = NULL;
+ thread->mem_size = 0;
+ }
+
+ *ret_val = 0;
+
+ return FCHR_RETURN;
+}
+
+/**********************************************************************************************************************/
+
+static void
+tlshm_destroy( void *arg )
+{
+ ComaThread *thread = arg;
+
+ D_MAGIC_ASSERT( thread, ComaThread );
+
+ coma_thread_unref( thread );
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+coma_get_local( Coma *coma,
+ unsigned int bytes,
+ void **ret_ptr )
+{
+ int ret;
+ ComaShared *shared;
+ ComaThread *thread;
+
+ D_MAGIC_ASSERT( coma, Coma );
+ D_ASSERT( bytes > 0 );
+ D_ASSERT( ret_ptr != NULL );
+
+ shared = coma->shared;
+ D_MAGIC_ASSERT( shared, ComaShared );
+
+ thread = pthread_getspecific( coma->tlshm_key );
+ if (!thread) {
+ /* Create thread object. */
+ thread = (ComaThread*) fusion_object_create( shared->thread_pool, coma->world );
+ if (!thread)
+ return DR_FUSION;
+
+ /* Initialize thread object. */
+ ret = coma_thread_init( thread, coma );
+ if (ret) {
+ fusion_object_destroy( &thread->object );
+ return ret;
+ }
+
+ /* Activate component object. */
+ fusion_object_activate( &thread->object );
+
+
+ pthread_setspecific( coma->tlshm_key, thread );
+ }
+
+ D_MAGIC_ASSERT( thread, ComaThread );
+
+ if (thread->mem_size < bytes) {
+ ret = fusion_call_execute( &shared->thread_mem_call, FCEF_NONE, bytes, thread, &ret );
+ if (ret) {
+ D_DERROR( ret, "Coma/Core: Thread memory call to allocate %d bytes failed!\n", bytes );
+ return ret;
+ }
+ }
+
+ *ret_ptr = thread->mem;
+
+ return DR_OK;
+}
+
+DirectResult
+coma_free_local( Coma *coma )
+{
+ int ret;
+ ComaShared *shared;
+ ComaThread *thread;
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ shared = coma->shared;
+ D_MAGIC_ASSERT( shared, ComaShared );
+
+ thread = pthread_getspecific( coma->tlshm_key );
+ if (!thread)
+ return DR_ITEMNOTFOUND;
+
+ D_MAGIC_ASSERT( thread, ComaThread );
+
+ if (!thread->mem)
+ return DR_BUFFEREMPTY;
+
+ ret = fusion_call_execute( &shared->thread_mem_call, FCEF_NONE, 0, thread, &ret );
+ if (ret) {
+ D_DERROR( ret, "Coma/Core: Thread memory call to free %d bytes failed!\n", thread->mem_size );
+ return ret;
+ }
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+FusionSHMPoolShared *
+coma_shmpool( const Coma *coma )
+{
+ const ComaShared *shared;
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ shared = coma->shared;
+ D_MAGIC_ASSERT( shared, ComaShared );
+
+ return shared->shmpool;
+}
+
+FusionWorld *
+coma_world( const Coma *coma )
+{
+ D_MAGIC_ASSERT( coma, Coma );
+
+ return coma->world;
+}
+
+/**********************************************************************************************************************/
+
+void
+_coma_internal_remove_component( Coma *coma,
+ ComaComponent *component )
+{
+ DirectResult ret;
+ ComaShared *shared;
+
+ D_MAGIC_ASSERT( coma, Coma );
+ D_MAGIC_ASSERT( component, ComaComponent );
+
+ D_DEBUG_AT( Coma_Core, "%s( %p, '%s' )\n", __FUNCTION__, coma, component->name );
+
+ shared = coma->shared;
+ D_MAGIC_ASSERT( shared, ComaShared );
+
+ ret = fusion_skirmish_prevail( &shared->lock );
+ if (ret) {
+ D_DERROR( ret, "Coma/Core: Could not lock core to remove component!\n" );
+ return;
+ }
+
+ fusion_hash_remove( shared->components, component->name, NULL, NULL );
+
+ fusion_skirmish_dismiss( &shared->lock );
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+coma_initialize( Coma *coma )
+{
+ DirectResult ret;
+ ComaShared *shared;
+
+ D_DEBUG_AT( Coma_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ shared = coma->shared;
+ D_MAGIC_ASSERT( shared, ComaShared );
+
+ ret = fusion_hash_create( shared->shmpool, HASH_STRING, HASH_PTR, 7, &shared->components );
+ if (ret)
+ return ret;
+
+ fusion_hash_set_autofree( shared->components, false, false );
+
+ fusion_skirmish_init( &shared->lock, coma->name, coma->world );
+
+ shared->component_pool = coma_component_pool_create( coma );
+ shared->thread_pool = coma_thread_pool_create( coma );
+
+ fusion_call_init( &shared->thread_mem_call, thread_mem_call_handler, coma, coma->world );
+
+ fusion_hash_create( shared->shmpool, HASH_PTR, HASH_INT, 23, &shared->allocations );
+
+ return DR_OK;
+}
+
+static DirectResult
+coma_join( Coma *coma )
+{
+ D_DEBUG_AT( Coma_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ /* really nothing to be done here, yet ;) */
+
+ return DR_OK;
+}
+
+static DirectResult
+coma_leave( Coma *coma )
+{
+ D_DEBUG_AT( Coma_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ /* really nothing to be done here, yet ;) */
+
+ return DR_OK;
+}
+
+static DirectResult
+coma_shutdown( Coma *coma )
+{
+ ComaShared *shared;
+
+ D_DEBUG_AT( Coma_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ shared = coma->shared;
+ D_MAGIC_ASSERT( shared, ComaShared );
+
+ fusion_object_pool_destroy( shared->component_pool, coma->world );
+ fusion_object_pool_destroy( shared->thread_pool, coma->world );
+
+ fusion_skirmish_destroy( &shared->lock );
+
+ fusion_hash_destroy( shared->components );
+
+ fusion_call_destroy( &shared->thread_mem_call );
+
+ fusion_hash_destroy( shared->allocations );
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static int
+coma_arena_initialize( FusionArena *arena,
+ void *ctx )
+{
+ DirectResult ret;
+ Coma *coma = ctx;
+ ComaShared *shared;
+ FusionSHMPoolShared *pool;
+
+ D_DEBUG_AT( Coma_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ /* Create the shared memory pool first! */
+ ret = fusion_shm_pool_create( coma->world, "Coma Core",
+ fusiondale_config->coma_shmpool_size,
+ fusion_config->debugshm, &pool );
+ if (ret)
+ return ret;
+
+ /* Allocate shared structure in the new pool. */
+ shared = SHCALLOC( pool, 1, sizeof(ComaShared) );
+ if (!shared) {
+ fusion_shm_pool_destroy( coma->world, pool );
+ return D_OOSHM();
+ }
+
+ D_MAGIC_SET( shared, ComaShared );
+
+ coma->shared = shared;
+
+ shared->shmpool = pool;
+
+ /* Initialize. */
+ ret = coma_initialize( coma );
+ if (ret) {
+ SHFREE( pool, shared );
+ fusion_shm_pool_destroy( coma->world, pool );
+ return ret;
+ }
+
+ /* Register shared data. */
+ fusion_arena_add_shared_field( arena, "Core/Shared", shared );
+
+ return DR_OK;
+}
+
+static int
+coma_arena_shutdown( FusionArena *arena,
+ void *ctx,
+ bool emergency)
+{
+ DirectResult ret;
+ Coma *coma = ctx;
+ ComaShared *shared;
+ FusionSHMPoolShared *pool;
+
+ D_DEBUG_AT( Coma_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ shared = coma->shared;
+ D_MAGIC_ASSERT( shared, ComaShared );
+
+ pool = shared->shmpool;
+
+ /* Shutdown. */
+ ret = coma_shutdown( coma );
+ if (ret)
+ return ret;
+
+ D_MAGIC_CLEAR( shared );
+
+ SHFREE( pool, shared );
+
+ fusion_dbg_print_memleaks( pool );
+
+ fusion_shm_pool_destroy( coma->world, pool );
+
+ return DR_OK;
+}
+
+static int
+coma_arena_join( FusionArena *arena,
+ void *ctx )
+{
+ DirectResult ret;
+ Coma *coma = ctx;
+ ComaShared *shared;
+
+ D_DEBUG_AT( Coma_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ /* Get shared data. */
+ if (fusion_arena_get_shared_field( arena, "Core/Shared", (void*)&shared ))
+ return DR_FUSION;
+
+ coma->shared = shared;
+
+ /* Join. */
+ ret = coma_join( coma );
+ if (ret)
+ return ret;
+
+ return DR_OK;
+}
+
+static int
+coma_arena_leave( FusionArena *arena,
+ void *ctx,
+ bool emergency)
+{
+ DirectResult ret;
+ Coma *coma = ctx;
+
+ D_DEBUG_AT( Coma_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( coma, Coma );
+
+ /* Leave. */
+ ret = coma_leave( coma );
+ if (ret)
+ return ret;
+
+ return DR_OK;
+}
+
diff --git a/Source/FusionDale/src/coma/coma.h b/Source/FusionDale/src/coma/coma.h
new file mode 100755
index 0000000..06480f7
--- /dev/null
+++ b/Source/FusionDale/src/coma/coma.h
@@ -0,0 +1,111 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __COMA__COMA_H__
+#define __COMA__COMA_H__
+
+#include <fusiondale.h>
+
+#include <fusion/types.h>
+
+#include "coma_types.h"
+
+
+
+/*
+ * Coma initialization and deinitialization
+ */
+DirectResult coma_enter( FusionWorld *world,
+ const char *name,
+ Coma **ret_coma );
+
+DirectResult coma_exit ( Coma *coma,
+ bool emergency );
+
+/*
+ * Components
+ */
+DirectResult coma_create_component( Coma *coma,
+ const char *name,
+ ComaMethodFunc func,
+ int num_notifications,
+ void *ctx,
+ ComaComponent **ret_component );
+
+DirectResult coma_get_component ( Coma *coma,
+ const char *name,
+ unsigned int timeout,
+ ComaComponent **ret_component );
+
+DirectResult coma_allocate ( Coma *coma,
+ unsigned int bytes,
+ void **ret_ptr );
+
+DirectResult coma_deallocate ( Coma *coma,
+ void *ptr );
+
+DirectResult coma_allocation_size ( Coma *coma,
+ void *ptr,
+ int *ret_size );
+
+/*
+ * Thread local SHM
+ */
+DirectResult coma_get_local ( Coma *coma,
+ unsigned int bytes,
+ void **ret_ptr );
+
+DirectResult coma_free_local ( Coma *coma );
+
+/*
+ * Misc
+ */
+FusionWorld *coma_world ( const Coma *coma );
+FusionSHMPoolShared *coma_shmpool( const Coma *coma );
+
+
+/*
+ * Internal
+ */
+void _coma_internal_remove_component( Coma *coma,
+ ComaComponent *component );
+
+
+
+struct __COMA_Coma {
+ int magic;
+
+ char *name;
+
+ int fusion_id;
+
+ FusionWorld *world;
+ FusionArena *arena;
+
+ ComaShared *shared;
+
+ pthread_key_t tlshm_key;
+};
+
+
+#endif
diff --git a/Source/FusionDale/src/coma/coma_types.h b/Source/FusionDale/src/coma/coma_types.h
new file mode 100755
index 0000000..11a3fce
--- /dev/null
+++ b/Source/FusionDale/src/coma/coma_types.h
@@ -0,0 +1,35 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __COMA__COMA_TYPES_H__
+#define __COMA__COMA_TYPES_H__
+
+typedef struct __COMA_Coma Coma;
+typedef struct __COMA_ComaShared ComaShared;
+
+typedef struct __COMA_ComaComponent ComaComponent;
+typedef struct __COMA_ComaNotification ComaNotification;
+typedef struct __COMA_ComaThread ComaThread;
+
+#endif
+
diff --git a/Source/FusionDale/src/coma/component.c b/Source/FusionDale/src/coma/component.c
new file mode 100755
index 0000000..4e6a2fc
--- /dev/null
+++ b/Source/FusionDale/src/coma/component.c
@@ -0,0 +1,352 @@
+/*
+ (c) Copyright 2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/call.h>
+#include <fusion/fusion.h>
+#include <fusion/hash.h>
+#include <fusion/lock.h>
+#include <fusion/shmalloc.h>
+
+#include <coma/coma.h>
+#include <coma/component.h>
+
+D_DEBUG_DOMAIN( Coma_Component, "Coma/Component", "Coma Component" );
+
+/**********************************************************************************************************************/
+
+struct __COMA_ComaNotification {
+ int magic;
+
+ ComaNotificationID id;
+ ComaNotificationFlags flags;
+
+ ComaComponent *component;
+
+ ComaNotifyFunc notify_func;
+ void *notify_ctx;
+};
+
+/**********************************************************************************************************************/
+
+static const ReactionFunc coma_component_globals[] = {
+ NULL
+};
+
+static void
+component_destructor( FusionObject *object, bool zombie, void *ctx )
+{
+ Coma *coma = ctx;
+ ComaComponent *component = (ComaComponent*) object;
+
+ D_MAGIC_ASSERT( component, ComaComponent );
+
+ D_DEBUG_AT( Coma_Component, "%s( %p [%lu] )%s\n", __FUNCTION__, component, object->id, zombie ? " ZOMBIE!" : "" );
+
+ _coma_internal_remove_component( coma, component );
+
+ fusion_skirmish_destroy( &component->lock );
+
+ fusion_call_destroy( &component->method_call );
+ fusion_call_destroy( &component->notify_call );
+
+ if (component->notifications) {
+ D_ASSERT( component->num_notifications > 0 );
+
+ SHFREE( component->shmpool, component->notifications );
+ }
+ else
+ D_ASSERT( component->num_notifications == 0 );
+
+ SHFREE( component->shmpool, component->name );
+
+ D_MAGIC_CLEAR( component );
+
+ fusion_object_destroy( object );
+}
+
+FusionObjectPool *
+coma_component_pool_create( Coma *coma )
+{
+ return fusion_object_pool_create( "Component", sizeof(ComaComponent), sizeof(void*),
+ component_destructor, coma, coma_world(coma) );
+}
+
+/**********************************************************************************************************************/
+
+static FusionCallHandlerResult
+method_call_handler( int caller,
+ int call_arg,
+ void *call_ptr,
+ void *ctx,
+ unsigned int serial,
+ int *ret_val )
+{
+ ComaComponent *component = ctx;
+
+ D_MAGIC_ASSERT( component, ComaComponent );
+ D_ASSUME( component->active );
+ D_ASSERT( component->method_func != NULL );
+
+ component->method_func( component->method_ctx, call_arg, call_ptr, serial );
+
+ return FCHR_RETAIN;
+}
+
+static FusionCallHandlerResult
+notify_call_handler( int caller,
+ int call_arg,
+ void *call_ptr,
+ void *ctx,
+ unsigned int serial,
+ int *ret_val )
+{
+ ComaNotification *notification;
+ ComaComponent *component = ctx;
+
+ D_MAGIC_ASSERT( component, ComaComponent );
+ D_ASSUME( component->active );
+
+ D_ASSERT( call_arg >= 0 );
+ D_ASSERT( call_arg < component->num_notifications );
+
+ notification = &component->notifications[call_arg];
+
+ D_MAGIC_ASSERT( notification, ComaNotification );
+
+ if (notification->notify_func)
+ notification->notify_func( notification->notify_ctx, call_arg, call_ptr );
+
+ if (call_ptr && (notification->flags & CNF_DEALLOC_ARG))
+ SHFREE( component->shmpool, call_ptr );
+
+ return FCHR_RETURN;
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+coma_component_init( ComaComponent *component,
+ Coma *coma,
+ const char *name,
+ ComaMethodFunc func,
+ int num_notifications,
+ void *ctx )
+{
+ DirectResult ret;
+ FusionWorld *world;
+
+ D_ASSERT( component != NULL );
+ D_ASSERT( coma != NULL );
+ D_ASSERT( name != NULL );
+ D_ASSERT( func != NULL );
+ D_ASSERT( num_notifications >= 0 );
+
+ D_DEBUG_AT( Coma_Component, "%s( %p, %p, '%s', %p, %d, %p )\n", __FUNCTION__,
+ component, coma, name, func, num_notifications, ctx );
+
+ world = coma_world( coma );
+
+ component->shmpool = coma_shmpool( coma );
+
+ /* Initialize lock. */
+ ret = fusion_skirmish_init( &component->lock, "Component", world );
+ if (ret)
+ return ret;
+
+ /* Set name. */
+ component->name = SHSTRDUP( component->shmpool, name );
+ if (!component->name) {
+ ret = D_OOSHM();
+ goto error;
+ }
+
+ /* Create notification table. */
+ if (num_notifications) {
+ component->notifications = SHCALLOC( component->shmpool, num_notifications, sizeof(ComaNotification) );
+ if (!component->notifications) {
+ ret = D_OOSHM();
+ goto error;
+ }
+
+ component->num_notifications = num_notifications;
+ }
+
+ /* Remember creator. */
+ component->provider = fusion_id( world );
+
+ /* Initialize calls. */
+ fusion_call_init( &component->method_call, method_call_handler, component, world );
+ fusion_call_init( &component->notify_call, notify_call_handler, component, world );
+
+ /* Setup notification dispatch callback. */
+ fusion_reactor_set_dispatch_callback( component->object.reactor, &component->notify_call, NULL );
+
+ /* Change name of the reactor to something more specific than just "Component" from object pool. */
+ fusion_reactor_set_name( component->object.reactor, name );
+
+ /* Setup method invocation handler. */
+ component->method_func = func;
+ component->method_ctx = ctx;
+
+ D_MAGIC_SET( component, ComaComponent );
+
+ return DR_OK;
+
+
+error:
+ if (component->notifications)
+ SHFREE( component->shmpool, component->notifications );
+
+ if (component->name)
+ SHFREE( component->shmpool, component->name );
+
+ fusion_skirmish_destroy( &component->lock );
+
+ return ret;
+}
+
+DirectResult
+coma_component_lock( ComaComponent *component )
+{
+ D_MAGIC_ASSERT( component, ComaComponent );
+
+ return fusion_skirmish_prevail( &component->lock );
+}
+
+DirectResult
+coma_component_unlock( ComaComponent *component )
+{
+ D_MAGIC_ASSERT( component, ComaComponent );
+
+ return fusion_skirmish_dismiss( &component->lock );
+}
+
+DirectResult
+coma_component_activate( ComaComponent *component )
+{
+ DirectResult ret;
+
+ D_MAGIC_ASSERT( component, ComaComponent );
+ FUSION_SKIRMISH_ASSERT( &component->lock );
+ D_ASSUME( !component->active );
+
+ D_DEBUG_AT( Coma_Component, "%s( %p ) <- '%s'\n", __FUNCTION__, component, component->name );
+
+ if (component->active)
+ return DR_BUSY;
+
+ component->active = true;
+
+ ret = fusion_skirmish_notify( &component->lock );
+ if (ret)
+ D_DERROR( ret, "Coma/Component: fusion_skirmish_notify() failed!\n" );
+
+ return ret;
+}
+
+DirectResult
+coma_component_init_notification( ComaComponent *component,
+ ComaNotificationID id,
+ ComaNotifyFunc func,
+ void *ctx,
+ ComaNotificationFlags flags )
+{
+ ComaNotification *notification;
+
+ D_MAGIC_ASSERT( component, ComaComponent );
+ FUSION_SKIRMISH_ASSERT( &component->lock );
+ D_ASSUME( !component->active );
+
+ D_DEBUG_AT( Coma_Component, "%s( %p, %lu - %p )\n", __FUNCTION__, component, id, func );
+
+ if (id < 0 || id >= component->num_notifications)
+ return DR_LIMITEXCEEDED;
+
+ notification = &component->notifications[id];
+ if (notification->component) {
+ D_MAGIC_ASSERT( notification, ComaNotification );
+ return DR_BUSY;
+ }
+
+ notification->id = id;
+ notification->flags = flags;
+ notification->component = component;
+ notification->notify_func = func;
+ notification->notify_ctx = ctx;
+
+ D_MAGIC_SET( notification, ComaNotification );
+
+ return DR_OK;
+}
+
+DirectResult
+coma_component_call( ComaComponent *component,
+ ComaMethodID method,
+ void *arg,
+ int *ret_val )
+{
+ D_MAGIC_ASSERT( component, ComaComponent );
+ D_ASSUME( component->active );
+
+ D_DEBUG_AT( Coma_Component, "%s( %p, %lu - %p, %p )\n", __FUNCTION__, component, method, arg, ret_val );
+
+ return fusion_call_execute( &component->method_call, FCEF_NONE, method, arg, ret_val );
+}
+
+DirectResult
+coma_component_return( ComaComponent *component,
+ unsigned int serial,
+ int val )
+{
+ D_MAGIC_ASSERT( component, ComaComponent );
+ D_ASSUME( component->active );
+
+ D_DEBUG_AT( Coma_Component, "%s( %p, %u - %d )\n", __FUNCTION__, component, serial, val );
+
+ return fusion_call_return( &component->method_call, serial, val );
+}
+
+DirectResult
+coma_component_notify( ComaComponent *component,
+ ComaNotificationID id,
+ void *arg )
+{
+ D_MAGIC_ASSERT( component, ComaComponent );
+ D_ASSUME( component->active );
+
+ D_DEBUG_AT( Coma_Component, "%s( %p [%lu], %lu - %p )\n", __FUNCTION__,
+ component, component->object.id, id, arg );
+
+ D_ASSERT( id >= 0 );
+ D_ASSERT( id < component->num_notifications );
+
+ return coma_component_dispatch_channel( component, id, &arg, sizeof(void*), coma_component_globals );
+}
+
diff --git a/Source/FusionDale/src/coma/component.h b/Source/FusionDale/src/coma/component.h
new file mode 100755
index 0000000..56e5e01
--- /dev/null
+++ b/Source/FusionDale/src/coma/component.h
@@ -0,0 +1,105 @@
+/*
+ (c) Copyright 2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __COMA__COMPONENT_H__
+#define __COMA__COMPONENT_H__
+
+#include <fusiondale.h>
+
+#include <fusion/object.h>
+
+#include <coma/coma_types.h>
+
+
+struct __COMA_ComaComponent {
+ FusionObject object;
+
+ int magic;
+
+ FusionSHMPoolShared *shmpool;
+
+ FusionSkirmish lock;
+ bool active;
+
+ char *name; /* Name of the component. */
+
+ ComaNotification *notifications; /* Shared notification table. */
+ unsigned int num_notifications; /* Number of notifications. */
+
+ FusionID provider; /* Creator of the component. */
+
+ FusionCall method_call; /* Call used for method invocation. */
+ FusionCall notify_call; /* Call used for dispatch callbacks. */
+
+ ComaMethodFunc method_func; /* Function pointer for invocations. */
+ void *method_ctx; /* Context of invocation handler. */
+};
+
+/*
+ * Creates a pool of component objects.
+ */
+FusionObjectPool *coma_component_pool_create( Coma *coma );
+
+/*
+ * Generates coma_component_ref(), coma_component_attach() etc.
+ */
+FUSION_OBJECT_METHODS( ComaComponent, coma_component )
+
+
+
+/*
+ * Object initialization
+ */
+
+DirectResult coma_component_init ( ComaComponent *component,
+ Coma *coma,
+ const char *name,
+ ComaMethodFunc func,
+ int num_notifications,
+ void *ctx );
+
+DirectResult coma_component_lock ( ComaComponent *component );
+DirectResult coma_component_unlock ( ComaComponent *component );
+
+DirectResult coma_component_activate ( ComaComponent *component );
+
+DirectResult coma_component_init_notification( ComaComponent *component,
+ ComaNotificationID id,
+ ComaNotifyFunc func,
+ void *ctx,
+ ComaNotificationFlags flags );
+
+DirectResult coma_component_call ( ComaComponent *component,
+ ComaMethodID method,
+ void *arg,
+ int *ret_val );
+
+DirectResult coma_component_return ( ComaComponent *component,
+ unsigned int serial,
+ int val );
+
+DirectResult coma_component_notify ( ComaComponent *component,
+ ComaNotificationID id,
+ void *arg );
+
+#endif
diff --git a/Source/FusionDale/src/coma/icoma.c b/Source/FusionDale/src/coma/icoma.c
new file mode 100755
index 0000000..8295b14
--- /dev/null
+++ b/Source/FusionDale/src/coma/icoma.c
@@ -0,0 +1,209 @@
+/*
+ (c) Copyright 2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <unistd.h>
+
+#include <fusiondale.h>
+
+#include <direct/interface.h>
+
+#include <fusion/shmalloc.h>
+
+#include <coma/coma.h>
+#include <coma/component.h>
+
+#include <coma/icomacomponent.h>
+
+#include "icoma.h"
+
+
+
+static void
+IComa_Destruct( IComa *thiz )
+{
+ IComa_data *data = (IComa_data*)thiz->priv;
+
+ coma_exit( data->coma, false );
+
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IComa_AddRef( IComa *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA (IComa);
+
+ data->ref++;
+
+ return DR_OK;
+}
+
+static DirectResult
+IComa_Release( IComa *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA (IComa)
+
+ if (--data->ref == 0)
+ IComa_Destruct( thiz );
+
+ return DR_OK;
+}
+
+static DirectResult
+IComa_CreateComponent( IComa *thiz,
+ const char *name,
+ ComaMethodFunc func,
+ int num_notifications,
+ void *ctx,
+ IComaComponent **ret_interface )
+{
+ DirectResult ret;
+ ComaComponent *component;
+ IComaComponent *interface;
+
+ DIRECT_INTERFACE_GET_DATA(IComa)
+
+ /* Check arguments */
+ if (!ret_interface)
+ return DR_INVARG;
+
+ /* Create a new component. */
+ ret = coma_create_component( data->coma, name, func, num_notifications, ctx, &component );
+ if (ret)
+ return ret;
+
+ DIRECT_ALLOCATE_INTERFACE( interface, IComaComponent );
+
+ ret = IComaComponent_Construct( interface, data->coma, component, num_notifications );
+
+ coma_component_unref( component );
+
+ if (ret == DR_OK)
+ *ret_interface = interface;
+
+ return ret;
+}
+
+static DirectResult
+IComa_GetComponent( IComa *thiz,
+ const char *name,
+ unsigned int timeout,
+ IComaComponent **ret_interface )
+{
+ DirectResult ret;
+ ComaComponent *component;
+ IComaComponent *interface;
+
+ DIRECT_INTERFACE_GET_DATA(IComa)
+
+ /* Check arguments */
+ if (!ret_interface)
+ return DR_INVARG;
+
+ /* Get the component. */
+ ret = coma_get_component( data->coma, name, timeout, &component );
+ if (ret)
+ return ret;
+
+ DIRECT_ALLOCATE_INTERFACE( interface, IComaComponent );
+
+ ret = IComaComponent_Construct( interface, data->coma, component, component->num_notifications );
+
+ coma_component_unref( component );
+
+ if (ret == DR_OK)
+ *ret_interface = interface;
+
+ return DR_OK;
+}
+
+static DirectResult
+IComa_Allocate( IComa *thiz,
+ unsigned int bytes,
+ void **ret_ptr )
+{
+ DIRECT_INTERFACE_GET_DATA(IComa)
+
+ if (!bytes || !ret_ptr)
+ return DR_INVARG;
+
+ return coma_allocate( data->coma, bytes, ret_ptr );
+}
+
+static DirectResult
+IComa_Deallocate( IComa *thiz,
+ void *ptr )
+{
+ DIRECT_INTERFACE_GET_DATA(IComa)
+
+ if (!ptr)
+ return DR_INVARG;
+
+ return coma_deallocate( data->coma, ptr );
+}
+
+static DirectResult
+IComa_GetLocal( IComa *thiz,
+ unsigned int bytes,
+ void **ret_ptr )
+{
+ DIRECT_INTERFACE_GET_DATA(IComa)
+
+ if (!bytes || !ret_ptr)
+ return DR_INVARG;
+
+ return coma_get_local( data->coma, bytes, ret_ptr );
+}
+
+static DirectResult
+IComa_FreeLocal( IComa *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA(IComa)
+
+ return coma_free_local( data->coma );
+}
+
+DirectResult
+IComa_Construct( IComa *thiz, Coma *coma )
+{
+ /* Allocate interface data. */
+ DIRECT_ALLOCATE_INTERFACE_DATA( thiz, IComa );
+
+ /* Initialize interface data. */
+ data->ref = 1;
+ data->coma = coma;
+
+ /* Assign interface pointers. */
+ thiz->AddRef = IComa_AddRef;
+ thiz->Release = IComa_Release;
+ thiz->CreateComponent = IComa_CreateComponent;
+ thiz->GetComponent = IComa_GetComponent;
+ thiz->Allocate = IComa_Allocate;
+ thiz->Deallocate = IComa_Deallocate;
+ thiz->GetLocal = IComa_GetLocal;
+ thiz->FreeLocal = IComa_FreeLocal;
+
+ return DR_OK;
+}
diff --git a/Source/FusionDale/src/coma/icoma.h b/Source/FusionDale/src/coma/icoma.h
new file mode 100755
index 0000000..c228c5c
--- /dev/null
+++ b/Source/FusionDale/src/coma/icoma.h
@@ -0,0 +1,47 @@
+/*
+ (c) Copyright 2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __ICOMA_H__
+#define __ICOMA_H__
+
+#include <direct/hash.h>
+
+#include <fusiondale.h>
+
+#include <coma/coma_types.h>
+
+
+/*
+ * private data struct of IComa
+ */
+typedef struct {
+ int ref; /* reference counter */
+
+ Coma *coma;
+} IComa_data;
+
+
+DirectResult IComa_Construct( IComa *thiz,
+ Coma *coma );
+
+#endif
diff --git a/Source/FusionDale/src/coma/icomacomponent.c b/Source/FusionDale/src/coma/icomacomponent.c
new file mode 100755
index 0000000..a0bc3b2
--- /dev/null
+++ b/Source/FusionDale/src/coma/icomacomponent.c
@@ -0,0 +1,340 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <unistd.h>
+
+#include <fusiondale.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+
+#include <fusion/shmalloc.h>
+
+#include <coma/coma.h>
+#include <coma/component.h>
+
+#include "icomacomponent.h"
+
+/**********************************************************************************************************************/
+
+static ReactionResult IComaComponent_ListenerReaction( const void *msg_data,
+ void *ctx );
+
+/**********************************************************************************************************************/
+
+static void
+IComaComponent_Destruct( IComaComponent *thiz )
+{
+ int i;
+ IComaComponent_data *data = thiz->priv;
+
+ for (i=0; i<data->num_notifications; i++) {
+ if (data->listeners[i].func)
+ coma_component_detach( data->component, &data->listeners[i].reaction );
+ }
+
+ coma_component_unref( data->component );
+
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IComaComponent_AddRef( IComaComponent *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ data->ref++;
+
+ return DR_OK;
+}
+
+static DirectResult
+IComaComponent_Release( IComaComponent *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ if (--data->ref == 0)
+ IComaComponent_Destruct( thiz );
+
+ return DR_OK;
+}
+
+static DirectResult
+IComaComponent_InitNotification( IComaComponent *thiz,
+ ComaNotificationID id,
+ ComaNotifyFunc func,
+ void *ctx,
+ ComaNotificationFlags flags )
+{
+ DirectResult ret;
+
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ coma_component_lock( data->component );
+
+ ret = coma_component_init_notification( data->component, id, func, ctx, flags );
+
+ coma_component_unlock( data->component );
+
+ return ret;
+}
+
+static DirectResult
+IComaComponent_InitNotifications( IComaComponent *thiz,
+ const ComaNotificationInit *inits,
+ int num_inits,
+ void *ctx )
+{
+ int i;
+ DirectResult ret = DR_INVARG;
+
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ if (!inits || num_inits < 1)
+ return DR_INVARG;
+
+ coma_component_lock( data->component );
+
+ for (i=0; i<num_inits; i++) {
+ ret = coma_component_init_notification( data->component, inits[i].id,
+ inits[i].func, inits[i].ctx ? : ctx,
+ inits[i].flags );
+ if (ret)
+ break;
+ }
+
+ coma_component_unlock( data->component );
+
+ return ret;
+}
+
+static DirectResult
+IComaComponent_Call( IComaComponent *thiz,
+ ComaMethodID method,
+ void *arg,
+ int *ret_val )
+{
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ return coma_component_call( data->component, method, arg, ret_val );
+}
+
+static DirectResult
+IComaComponent_Return( IComaComponent *thiz,
+ int val,
+ unsigned int magic )
+{
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ return coma_component_return( data->component, magic, val );
+}
+
+static DirectResult
+IComaComponent_Notify( IComaComponent *thiz,
+ ComaNotificationID id,
+ void *arg )
+{
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ if (id < 0 || id >= data->num_notifications)
+ return DR_LIMITEXCEEDED;
+
+ return coma_component_notify( data->component, id, arg );
+}
+
+static DirectResult
+IComaComponent_Listen( IComaComponent *thiz,
+ ComaNotificationID id,
+ ComaListenerFunc func,
+ void *ctx )
+{
+ DirectResult ret;
+ ComaListener *listener;
+
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ if (id < 0 || id >= data->num_notifications)
+ return DR_LIMITEXCEEDED;
+
+ listener = &data->listeners[id];
+
+ if (listener->func)
+ return DR_BUSY;
+
+ ret = coma_component_attach_channel( data->component, id,
+ IComaComponent_ListenerReaction,
+ listener, &listener->reaction );
+ if (ret)
+ return ret;
+
+ listener->func = func;
+ listener->ctx = ctx;
+
+ return DR_OK;
+}
+
+static DirectResult
+IComaComponent_InitListeners( IComaComponent *thiz,
+ const ComaListenerInit *inits,
+ int num_inits,
+ void *ctx )
+{
+ int i;
+ DirectResult ret;
+ ComaListener *listener;
+
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ if (!inits || num_inits < 1)
+ return DR_INVARG;
+
+ for (i=0; i<num_inits; i++) {
+ if (inits[i].id < 0 || inits[i].id >= data->num_notifications)
+ return DR_LIMITEXCEEDED;
+
+ listener = &data->listeners[inits[i].id];
+
+ if (listener->func)
+ return DR_BUSY;
+
+ ret = coma_component_attach_channel( data->component, inits[i].id,
+ IComaComponent_ListenerReaction,
+ listener, &listener->reaction );
+ if (ret)
+ return ret;
+
+ listener->func = inits[i].func;
+ listener->ctx = inits[i].ctx ? : ctx;
+ }
+
+ return DR_OK;
+}
+
+static DirectResult
+IComaComponent_Unlisten( IComaComponent *thiz,
+ ComaNotificationID id )
+{
+ ComaListener *listener;
+
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ if (id < 0 || id >= data->num_notifications)
+ return DR_LIMITEXCEEDED;
+
+ listener = &data->listeners[id];
+
+ if (!listener->func)
+ return DR_ITEMNOTFOUND;
+
+ coma_component_detach( data->component, &listener->reaction );
+
+ listener->func = NULL;
+
+ return DR_OK;
+}
+
+static DirectResult
+IComaComponent_Activate( IComaComponent *thiz )
+{
+ DirectResult ret;
+
+ DIRECT_INTERFACE_GET_DATA (IComaComponent)
+
+ coma_component_lock( data->component );
+
+ ret = coma_component_activate( data->component );
+
+ coma_component_unlock( data->component );
+
+ return ret;
+}
+
+DirectResult
+IComaComponent_Construct( IComaComponent *thiz,
+ Coma *coma,
+ ComaComponent *component,
+ int num_notifications )
+{
+ DirectResult ret;
+
+ /* Allocate interface data. */
+ DIRECT_ALLOCATE_INTERFACE_DATA( thiz, IComaComponent );
+
+ ret = coma_component_ref( component );
+ if (ret) {
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+ return ret;
+ }
+
+ /* Initialize interface data. */
+ data->ref = 1;
+ data->coma = coma;
+ data->component = component;
+ data->num_notifications = num_notifications;
+ data->listeners = D_CALLOC( num_notifications, sizeof(ComaListener) );
+
+ if (!data->listeners) {
+ D_OOM();
+ coma_component_unref( component );
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+ return DR_NOLOCALMEMORY;
+ }
+
+ /* Assign interface pointers. */
+ thiz->AddRef = IComaComponent_AddRef;
+ thiz->Release = IComaComponent_Release;
+ thiz->InitNotification = IComaComponent_InitNotification;
+ thiz->InitNotifications = IComaComponent_InitNotifications;
+ thiz->Call = IComaComponent_Call;
+ thiz->Return = IComaComponent_Return;
+ thiz->Notify = IComaComponent_Notify;
+ thiz->Listen = IComaComponent_Listen;
+ thiz->InitListeners = IComaComponent_InitListeners;
+ thiz->Unlisten = IComaComponent_Unlisten;
+ thiz->Activate = IComaComponent_Activate;
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static ReactionResult
+IComaComponent_ListenerReaction( const void *msg_data,
+ void *ctx )
+{
+ void * const *p_arg = msg_data;
+ ComaListener *listener = ctx;
+
+ D_ASSERT( msg_data != NULL );
+ D_ASSERT( ctx != NULL );
+
+ D_ASSUME( listener->func != NULL );
+
+ if (listener->func)
+ listener->func( listener->ctx, *p_arg );
+
+ return RS_OK;
+}
+
diff --git a/Source/FusionDale/src/coma/icomacomponent.h b/Source/FusionDale/src/coma/icomacomponent.h
new file mode 100755
index 0000000..c5fa056
--- /dev/null
+++ b/Source/FusionDale/src/coma/icomacomponent.h
@@ -0,0 +1,60 @@
+/*
+ (c) Copyright 2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __ICOMACOMPONENT_H__
+#define __ICOMACOMPONENT_H__
+
+#include <fusiondale.h>
+
+#include <fusion/reactor.h>
+
+#include <coma/coma_types.h>
+
+typedef struct {
+ ComaListenerFunc func;
+ void *ctx;
+
+ Reaction reaction;
+} ComaListener;
+
+/*
+ * private data struct of IComaComponent
+ */
+typedef struct {
+ int ref; /* reference counter */
+
+ Coma *coma;
+
+ ComaComponent *component;
+
+ int num_notifications;
+
+ ComaListener *listeners;
+} IComaComponent_data;
+
+DirectResult IComaComponent_Construct( IComaComponent *thiz,
+ Coma *coma,
+ ComaComponent *component,
+ int num_notifications );
+
+#endif
diff --git a/Source/FusionDale/src/coma/policy.c b/Source/FusionDale/src/coma/policy.c
new file mode 100755
index 0000000..a324ac4
--- /dev/null
+++ b/Source/FusionDale/src/coma/policy.c
@@ -0,0 +1,206 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ 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 <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <pthread.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/util.h>
+
+#include <coma/policy.h>
+
+#include <misc/dale_config.h>
+
+/**********************************************************************************************************************/
+
+typedef struct {
+ DirectLink link;
+ char *name;
+ bool allowed;
+} PolicyEntry;
+
+/**********************************************************************************************************************/
+
+static pthread_mutex_t policies_lock = PTHREAD_MUTEX_INITIALIZER;
+static unsigned int policies_age = 1;
+static DirectLink *policies = NULL;
+
+/**********************************************************************************************************************/
+
+static PolicyEntry *
+lookup_policy( const char *name, bool sub )
+{
+ PolicyEntry *entry;
+
+ direct_list_foreach (entry, policies) {
+ if (! strcasecmp( entry->name, name ))
+ return entry;
+ }
+
+ /*
+ * If the policy being registered contains a slash, but didn't exactly match an entry
+ * in fusiondalerc, check to see if the policy is descended from an entry in fusiondalerc
+ * (e.g. 'ui/field/messages' matches 'ui' or 'ui/field')
+ */
+ if (sub && strchr(name, '/')) {
+ int passed_name_len = strlen( name );
+
+ direct_list_foreach (entry, policies) {
+ int entry_len = strlen( entry->name );
+ if ((passed_name_len > entry_len) &&
+ (name[entry_len] == '/') &&
+ (! strncasecmp( entry->name, name, entry_len))) {
+ return entry;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+static bool
+check_policy( ComaPolicy *policy )
+{
+ if (policy->age != policies_age) {
+ PolicyEntry *entry = lookup_policy( policy->name, true );
+
+ policy->allowed = entry ? entry->allowed : fusiondale_config->coma_policy;
+ policy->age = policies_age;
+ }
+
+ return policy->allowed;
+}
+
+/**********************************************************************************************************************/
+
+void
+coma_policy_config( const char *name, bool allow )
+{
+ PolicyEntry *entry;
+
+ pthread_mutex_lock( &policies_lock );
+
+ entry = lookup_policy( name, false );
+ if (!entry) {
+ entry = calloc( 1, sizeof(PolicyEntry) );
+ if (!entry) {
+ D_WARN( "out of memory" );
+ pthread_mutex_unlock( &policies_lock );
+ return;
+ }
+
+ entry->name = strdup( name );
+
+ direct_list_prepend( &policies, &entry->link );
+ }
+
+ entry->allowed = allow;
+
+ if (! ++policies_age)
+ policies_age++;
+
+ pthread_mutex_unlock( &policies_lock );
+}
+
+bool
+coma_policy_check( ComaPolicy *policy )
+{
+ bool allowed;
+
+ pthread_mutex_lock( &policies_lock );
+
+ allowed = check_policy( policy );
+
+ pthread_mutex_unlock( &policies_lock );
+
+ return allowed;
+}
+
+/**********************************************************************************************************************/
+
+bool
+coma_policy_check_manager( const char *manager )
+{
+ ComaPolicy policy = COMA_POLICY_INIT( manager );
+
+ return coma_policy_check( &policy );
+}
+
+bool
+coma_policy_check_component( const char *manager, const char *component )
+{
+ char *policy_name;
+
+ if (asprintf( &policy_name, "%s/%s", manager, component ) < 0)
+ return DR_FAILURE;
+
+ ComaPolicy policy = COMA_POLICY_INIT( policy_name );
+ bool allowed = coma_policy_check( &policy );
+
+ free( policy_name );
+
+ return allowed;
+}
+
+bool
+coma_policy_check_method( const char *manager, const char *component, unsigned int method )
+{
+ char *policy_name;
+
+ if (asprintf( &policy_name, "%s/%s/m%u", manager, component, method ) < 0)
+ return DR_FAILURE;
+
+ ComaPolicy policy = COMA_POLICY_INIT( policy_name );
+ bool allowed = coma_policy_check( &policy );
+
+ free( policy_name );
+
+ return allowed;
+}
+
+bool
+coma_policy_check_notification( const char *manager, const char *component, unsigned int notification )
+{
+ char *policy_name;
+
+ if (asprintf( &policy_name, "%s/%s/n%u", manager, component, notification ) < 0)
+ return DR_FAILURE;
+
+ ComaPolicy policy = COMA_POLICY_INIT( policy_name );
+ bool allowed = coma_policy_check( &policy );
+
+ free( policy_name );
+
+ return allowed;
+}
+
diff --git a/Source/FusionDale/src/coma/policy.h b/Source/FusionDale/src/coma/policy.h
new file mode 100755
index 0000000..5a916a0
--- /dev/null
+++ b/Source/FusionDale/src/coma/policy.h
@@ -0,0 +1,53 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ 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 __FUSIONDALE_COMA__POLICY_H__
+#define __FUSIONDALE_COMA__POLICY_H__
+
+#include <direct/types.h>
+
+
+typedef struct {
+ unsigned int age;
+ bool allowed;
+ const char *name;
+} ComaPolicy;
+
+#define COMA_POLICY_INIT( __name ) (ComaPolicy){ .age = 0, .name = (__name) }
+
+void coma_policy_config( const char *name, bool allow );
+bool coma_policy_check ( ComaPolicy *policy );
+
+bool coma_policy_check_manager ( const char *manager );
+bool coma_policy_check_component ( const char *manager, const char *component );
+bool coma_policy_check_method ( const char *manager, const char *component, unsigned int method );
+bool coma_policy_check_notification( const char *manager, const char *component, unsigned int notification );
+
+
+#endif
+
diff --git a/Source/FusionDale/src/coma/thread.c b/Source/FusionDale/src/coma/thread.c
new file mode 100755
index 0000000..6aaac18
--- /dev/null
+++ b/Source/FusionDale/src/coma/thread.c
@@ -0,0 +1,96 @@
+/*
+ (c) Copyright 2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/call.h>
+#include <fusion/fusion.h>
+#include <fusion/hash.h>
+#include <fusion/lock.h>
+#include <fusion/shmalloc.h>
+
+#include <coma/coma.h>
+#include <coma/thread.h>
+
+D_DEBUG_DOMAIN( Coma_Thread, "Coma/Thread", "Coma Thread" );
+
+/**********************************************************************************************************************/
+
+static const ReactionFunc coma_thread_globals[] = {
+ NULL
+};
+
+static void
+thread_destructor( FusionObject *object, bool zombie, void *ctx )
+{
+ ComaThread *thread = (ComaThread*) object;
+
+ D_MAGIC_ASSERT( thread, ComaThread );
+
+ D_DEBUG_AT( Coma_Thread, "%s( %p [%lu] )%s\n", __FUNCTION__, thread, object->id, zombie ? " ZOMBIE!" : "" );
+
+ if (thread->mem)
+ SHFREE( thread->shmpool, thread->mem );
+
+ D_MAGIC_CLEAR( thread );
+
+ fusion_object_destroy( object );
+}
+
+FusionObjectPool *
+coma_thread_pool_create( Coma *coma )
+{
+ return fusion_object_pool_create( "Thread", sizeof(ComaThread), sizeof(void*),
+ thread_destructor, coma, coma_world(coma) );
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+coma_thread_init( ComaThread *thread,
+ Coma *coma )
+{
+ FusionWorld *world;
+
+ D_ASSERT( thread != NULL );
+ D_ASSERT( coma != NULL );
+
+ D_DEBUG_AT( Coma_Thread, "%s( %p, %p )\n", __FUNCTION__, thread, coma );
+
+ world = coma_world( coma );
+
+ thread->shmpool = coma_shmpool( coma );
+
+ /* Remember creator. */
+ thread->fusion_id = fusion_id( world );
+
+ D_MAGIC_SET( thread, ComaThread );
+
+ return DR_OK;
+}
+
diff --git a/Source/FusionDale/src/coma/thread.h b/Source/FusionDale/src/coma/thread.h
new file mode 100755
index 0000000..0d33c18
--- /dev/null
+++ b/Source/FusionDale/src/coma/thread.h
@@ -0,0 +1,66 @@
+/*
+ (c) Copyright 2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __COMA__THREAD_H__
+#define __COMA__THREAD_H__
+
+#include <fusiondale.h>
+
+#include <fusion/object.h>
+
+#include <coma/coma_types.h>
+
+
+struct __COMA_ComaThread {
+ FusionObject object;
+
+ int magic;
+
+ FusionSHMPoolShared *shmpool;
+
+ FusionID fusion_id;
+
+ void *mem;
+ unsigned int mem_size;
+};
+
+/*
+ * Creates a pool of component threads.
+ */
+FusionObjectPool *coma_thread_pool_create( Coma *coma );
+
+/*
+ * Generates coma_thread_ref(), coma_thread_attach() etc.
+ */
+FUSION_OBJECT_METHODS( ComaThread, coma_thread )
+
+
+
+/*
+ * Object initialization
+ */
+
+DirectResult coma_thread_init( ComaThread *thread,
+ Coma *coma );
+
+#endif
diff --git a/Source/FusionDale/src/core/Makefile.am b/Source/FusionDale/src/core/Makefile.am
new file mode 100755
index 0000000..40d4753
--- /dev/null
+++ b/Source/FusionDale/src/core/Makefile.am
@@ -0,0 +1,26 @@
+## Makefile.am for FusionDale/src/core
+
+INCLUDES = \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src \
+ $(FUSION_CFLAGS)
+
+AM_CPPFLAGS = \
+ -DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+noinst_LTLIBRARIES = \
+ libfusiondalecore.la
+
+coreincludedir = @INCLUDEDIR@/core
+
+coreinclude_HEADERS = \
+ dale_core.h \
+ dale_types.h \
+ messenger.h \
+ messenger_port.h
+
+libfusiondalecore_la_SOURCES = \
+ dale_core.c \
+ messenger.c \
+ messenger_port.c
diff --git a/Source/FusionDale/src/core/Makefile.in b/Source/FusionDale/src/core/Makefile.in
new file mode 100755
index 0000000..b958396
--- /dev/null
+++ b/Source/FusionDale/src/core/Makefile.in
@@ -0,0 +1,509 @@
+# 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/core
+DIST_COMMON = $(coreinclude_HEADERS) $(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)
+libfusiondalecore_la_LIBADD =
+am_libfusiondalecore_la_OBJECTS = dale_core.lo messenger.lo \
+ messenger_port.lo
+libfusiondalecore_la_OBJECTS = $(am_libfusiondalecore_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 = $(libfusiondalecore_la_SOURCES)
+DIST_SOURCES = $(libfusiondalecore_la_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(coreincludedir)"
+coreincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(coreinclude_HEADERS)
+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)
+
+AM_CPPFLAGS = \
+ -DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+noinst_LTLIBRARIES = \
+ libfusiondalecore.la
+
+coreincludedir = @INCLUDEDIR@/core
+coreinclude_HEADERS = \
+ dale_core.h \
+ dale_types.h \
+ messenger.h \
+ messenger_port.h
+
+libfusiondalecore_la_SOURCES = \
+ dale_core.c \
+ messenger.c \
+ messenger_port.c
+
+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/core/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/core/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
+libfusiondalecore.la: $(libfusiondalecore_la_OBJECTS) $(libfusiondalecore_la_DEPENDENCIES)
+ $(LINK) $(libfusiondalecore_la_OBJECTS) $(libfusiondalecore_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dale_core.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messenger.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messenger_port.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
+install-coreincludeHEADERS: $(coreinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(coreincludedir)" || $(MKDIR_P) "$(DESTDIR)$(coreincludedir)"
+ @list='$(coreinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(coreincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(coreincludedir)/$$f'"; \
+ $(coreincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(coreincludedir)/$$f"; \
+ done
+
+uninstall-coreincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(coreinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(coreincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(coreincludedir)/$$f"; \
+ done
+
+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) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(coreincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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-coreincludeHEADERS
+
+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: uninstall-coreincludeHEADERS
+
+.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-coreincludeHEADERS 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 uninstall-coreincludeHEADERS
+
+# 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/core/dale_core.c b/Source/FusionDale/src/core/dale_core.c
new file mode 100755
index 0000000..792faac
--- /dev/null
+++ b/Source/FusionDale/src/core/dale_core.c
@@ -0,0 +1,578 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <unistd.h>
+
+#include <pthread.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/signals.h>
+#include <direct/util.h>
+
+#include <fusion/arena.h>
+#include <fusion/build.h>
+#include <fusion/conf.h>
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+#include <fusion/object.h>
+
+#include <core/dale_core.h>
+#include <core/messenger.h>
+#include <core/messenger_port.h>
+
+#include <misc/dale_config.h>
+
+
+#define FUSIONDALE_CORE_ABI 1
+
+D_DEBUG_DOMAIN( Dale_Core, "FusionDale/Core", "FusionDale Core" );
+
+/**********************************************************************************************************************/
+
+struct __FD_CoreDaleShared {
+ int magic;
+
+ FusionObjectPool *messenger_pool;
+ FusionObjectPool *messenger_port_pool;
+
+ FusionSHMPoolShared *shmpool;
+};
+
+struct __FD_CoreDale {
+ int magic;
+
+ int refs;
+
+ int fusion_id;
+
+ FusionWorld *world;
+ FusionArena *arena;
+
+ CoreDaleShared *shared;
+
+ bool master;
+
+ DirectSignalHandler *signal_handler;
+};
+
+/**********************************************************************************************************************/
+
+static DirectSignalHandlerResult fd_core_signal_handler( int num,
+ void *addr,
+ void *ctx );
+
+/**********************************************************************************************************************/
+
+static int fd_core_arena_initialize( FusionArena *arena,
+ void *ctx );
+static int fd_core_arena_join ( FusionArena *arena,
+ void *ctx );
+static int fd_core_arena_leave ( FusionArena *arena,
+ void *ctx,
+ bool emergency);
+static int fd_core_arena_shutdown ( FusionArena *arena,
+ void *ctx,
+ bool emergency);
+
+/**********************************************************************************************************************/
+
+static CoreDale *core_dale = NULL;
+static pthread_mutex_t core_dale_lock = PTHREAD_MUTEX_INITIALIZER;
+
+DirectResult
+fd_core_create( CoreDale **ret_core )
+{
+ int ret;
+ CoreDale *core = NULL;
+
+ D_ASSERT( ret_core != NULL );
+
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ /* Lock the core singleton mutex. */
+ pthread_mutex_lock( &core_dale_lock );
+
+ /* Core already created? */
+ if (core_dale) {
+ /* Increase its references. */
+ core_dale->refs++;
+
+ /* Return the core. */
+ *ret_core = core_dale;
+
+ /* Unlock the core singleton mutex. */
+ pthread_mutex_unlock( &core_dale_lock );
+
+ return DR_OK;
+ }
+
+ /* Allocate local core structure. */
+ core = D_CALLOC( 1, sizeof(CoreDale) );
+ if (!core) {
+ ret = D_OOM();
+ goto error;
+ }
+
+ ret = fusion_enter( fusiondale_config->session, FUSIONDALE_CORE_ABI,
+ fusiondale_config->force_slave ? FER_SLAVE : FER_ANY, &core->world );
+ if (ret)
+ goto error;
+
+ core->fusion_id = fusion_id( core->world );
+
+ fusiondale_config->session = fusion_world_index( core->world );
+
+#if FUSION_BUILD_MULTI
+ D_DEBUG_AT( Dale_Core, " -> world %d, fusion id %d\n", fusiondale_config->session, core->fusion_id );
+#endif
+
+ /* Initialize the references. */
+ core->refs = 1;
+
+ direct_signal_handler_add( -1, fd_core_signal_handler, core, &core->signal_handler );
+
+ D_MAGIC_SET( core, CoreDale );
+
+ /* Enter the FusionDale core arena. */
+ if (fusion_arena_enter( core->world, "FusionDale/Core",
+ fd_core_arena_initialize, fd_core_arena_join,
+ core, &core->arena, &ret ) || ret)
+ {
+ D_MAGIC_CLEAR( core );
+ ret = ret ? : DR_FUSION;
+ goto error;
+ }
+
+ /* Return the core and store the singleton. */
+ *ret_core = core_dale = core;
+
+ /* Unlock the core singleton mutex. */
+ pthread_mutex_unlock( &core_dale_lock );
+
+ return DR_OK;
+
+
+error:
+ if (core) {
+ if (core->world) {
+ direct_signal_handler_remove( core->signal_handler );
+ fusion_exit( core->world, false );
+ }
+
+ D_FREE( core );
+ }
+
+ pthread_mutex_unlock( &core_dale_lock );
+
+ return ret;
+}
+
+DirectResult
+fd_core_destroy( CoreDale *core, bool emergency )
+{
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core == core_dale );
+
+ D_DEBUG_AT( Dale_Core, "%s( %p, %semergency )\n", __FUNCTION__, core, emergency ? "" : "no " );
+
+ /* Lock the core singleton mutex. */
+ if (!emergency)
+ pthread_mutex_lock( &core_dale_lock );
+
+ /* Decrement and check references. */
+ if (!emergency && --core->refs) {
+ /* Unlock the core singleton mutex. */
+ pthread_mutex_unlock( &core_dale_lock );
+
+ return DR_OK;
+ }
+
+ direct_signal_handler_remove( core->signal_handler );
+
+ /* Exit the FusionDale core arena. */
+ if (fusion_arena_exit( core->arena, fd_core_arena_shutdown,
+ core->master ? NULL : fd_core_arena_leave,
+ core, emergency, NULL ) == DR_BUSY)
+ {
+ if (core->master) {
+ if (emergency) {
+ fusion_kill( core->world, 0, SIGKILL, 1000 );
+ }
+ else {
+ fusion_kill( core->world, 0, SIGTERM, 5000 );
+ fusion_kill( core->world, 0, SIGKILL, 2000 );
+ }
+ }
+
+ while (fusion_arena_exit( core->arena, fd_core_arena_shutdown,
+ core->master ? NULL : fd_core_arena_leave,
+ core, emergency, NULL ) == DR_BUSY)
+ {
+ D_ONCE( "waiting for FusionDale slaves to terminate" );
+ usleep( 100000 );
+ }
+ }
+
+ fusion_exit( core->world, emergency );
+
+ D_MAGIC_CLEAR( core );
+
+ /* Deallocate local core structure. */
+ D_FREE( core );
+
+ /* Clear the singleton. */
+ core_dale = NULL;
+
+ /* Unlock the core singleton mutex. */
+ if (!emergency)
+ pthread_mutex_unlock( &core_dale_lock );
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+CoreMessenger *
+fd_core_create_messenger( CoreDale *core )
+{
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core->shared != NULL );
+ D_ASSERT( core->shared->messenger_pool != NULL );
+
+ /* Create a new object in the messenger pool. */
+ return (CoreMessenger*) fusion_object_create( core->shared->messenger_pool, core->world );
+}
+
+CoreMessengerPort *
+fd_core_create_messenger_port( CoreDale *core )
+{
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core->shared != NULL );
+ D_ASSERT( core->shared->messenger_port_pool != NULL );
+
+ /* Create a new object in the messenger port pool. */
+ return (CoreMessengerPort*) fusion_object_create( core->shared->messenger_port_pool, core->world );
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+fd_core_enum_messengers( CoreDale *core,
+ FusionObjectCallback callback,
+ void *ctx )
+{
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core->shared != NULL );
+ D_ASSERT( core->shared->messenger_pool != NULL );
+
+ /* Enumerate objects in the messenger pool. */
+ return fusion_object_pool_enum( core->shared->messenger_pool, callback, ctx );
+}
+
+DirectResult
+fd_core_enum_messenger_ports( CoreDale *core,
+ FusionObjectCallback callback,
+ void *ctx )
+{
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core->shared != NULL );
+ D_ASSERT( core->shared->messenger_port_pool != NULL );
+
+ /* Enumerate objects in the messenger port pool. */
+ return fusion_object_pool_enum( core->shared->messenger_port_pool, callback, ctx );
+}
+
+DirectResult
+fd_core_get_messenger( CoreDale *core,
+ FusionObjectID object_id,
+ CoreMessenger **ret_messenger )
+{
+ DirectResult ret;
+ FusionObject *object;
+
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core->shared != NULL );
+ D_ASSERT( core->shared->messenger_port_pool != NULL );
+
+ D_ASSERT( ret_messenger != NULL );
+
+ /* Enumerate objects in the messenger port pool. */
+ ret = fusion_object_get( core->shared->messenger_pool, object_id, &object );
+ if (ret)
+ return ret;
+
+ D_MAGIC_ASSERT( (CoreMessenger*) object, CoreMessenger );
+
+ *ret_messenger = (CoreMessenger*) object;
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+FusionWorld *
+fd_core_world( CoreDale *core )
+{
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core->world != NULL );
+
+ return core->world;
+}
+
+FusionSHMPoolShared *
+fd_core_shmpool( CoreDale *core )
+{
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core->shared != NULL );
+ D_ASSERT( core->shared->shmpool != NULL );
+
+ return core->shared->shmpool;
+}
+
+/**********************************************************************************************************************/
+
+static DirectSignalHandlerResult
+fd_core_signal_handler( int num, void *addr, void *ctx )
+{
+ CoreDale *core = (CoreDale*) ctx;
+
+ D_DEBUG_AT( Dale_Core, "%s( %d, %p, %p )\n", __FUNCTION__, num, addr, ctx );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core->shared != NULL );
+ D_ASSERT( core == core_dale );
+
+ fd_core_destroy( core, true );
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+fd_core_initialize( CoreDale *core )
+{
+ CoreDaleShared *shared = core->shared;
+
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+
+ /* create a pool for messenger (port) objects */
+ shared->messenger_pool = fd_messenger_pool_create( core->world );
+ shared->messenger_port_pool = fd_messenger_port_pool_create( core->world );
+
+ return DR_OK;
+}
+
+static DirectResult
+fd_core_join( CoreDale *core )
+{
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+
+ /* really nothing to be done here, yet ;) */
+
+ return DR_OK;
+}
+
+static DirectResult
+fd_core_leave( CoreDale *core )
+{
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+
+ /* really nothing to be done here, yet ;) */
+
+ return DR_OK;
+}
+
+static DirectResult
+fd_core_shutdown( CoreDale *core )
+{
+ CoreDaleShared *shared;
+
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+ D_ASSERT( core->shared != NULL );
+
+ shared = core->shared;
+
+ D_ASSERT( shared->messenger_pool != NULL );
+
+ /* destroy messenger port object pool */
+ fusion_object_pool_destroy( shared->messenger_port_pool, core->world );
+
+ /* destroy messenger object pool */
+ fusion_object_pool_destroy( shared->messenger_pool, core->world );
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static int
+fd_core_arena_initialize( FusionArena *arena,
+ void *ctx )
+{
+ DirectResult ret;
+ CoreDale *core = ctx;
+ CoreDaleShared *shared;
+ FusionSHMPoolShared *pool;
+
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+
+ /* Create the shared memory pool first! */
+ ret = fusion_shm_pool_create( core->world, "FusionDale Main Pool", 0x1000000,
+ fusion_config->debugshm, &pool );
+ if (ret)
+ return ret;
+
+ /* Allocate shared structure in the new pool. */
+ shared = SHCALLOC( pool, 1, sizeof(CoreDaleShared) );
+ if (!shared) {
+ fusion_shm_pool_destroy( core->world, pool );
+ return D_OOSHM();
+ }
+
+ core->shared = shared;
+ core->master = true;
+
+ shared->shmpool = pool;
+
+ /* Initialize. */
+ ret = fd_core_initialize( core );
+ if (ret) {
+ SHFREE( pool, shared );
+ fusion_shm_pool_destroy( core->world, pool );
+ return ret;
+ }
+
+ /* Register shared data. */
+ fusion_arena_add_shared_field( arena, "Core/Shared", shared );
+
+ return DR_OK;
+}
+
+static int
+fd_core_arena_shutdown( FusionArena *arena,
+ void *ctx,
+ bool emergency)
+{
+ DirectResult ret;
+ CoreDale *core = ctx;
+ CoreDaleShared *shared;
+ FusionSHMPoolShared *pool;
+
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+
+ shared = core->shared;
+
+ pool = shared->shmpool;
+
+ if (!core->master) {
+ D_DEBUG( "FusionDale/Core: Refusing shutdown in slave.\n" );
+ return fd_core_leave( core );
+ }
+
+ /* Shutdown. */
+ ret = fd_core_shutdown( core );
+ if (ret)
+ return ret;
+
+ SHFREE( pool, shared );
+
+ fusion_dbg_print_memleaks( pool );
+
+ fusion_shm_pool_destroy( core->world, pool );
+
+ return DR_OK;
+}
+
+static int
+fd_core_arena_join( FusionArena *arena,
+ void *ctx )
+{
+ DirectResult ret;
+ CoreDale *core = ctx;
+ CoreDaleShared *shared;
+
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+
+ /* Get shared data. */
+ if (fusion_arena_get_shared_field( arena, "Core/Shared", (void*)&shared ))
+ return DR_FUSION;
+
+ core->shared = shared;
+
+ /* Join. */
+ ret = fd_core_join( core );
+ if (ret)
+ return ret;
+
+ return DR_OK;
+}
+
+static int
+fd_core_arena_leave( FusionArena *arena,
+ void *ctx,
+ bool emergency)
+{
+ DirectResult ret;
+ CoreDale *core = ctx;
+
+ D_DEBUG_AT( Dale_Core, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( core, CoreDale );
+
+ /* Leave. */
+ ret = fd_core_leave( core );
+ if (ret)
+ return ret;
+
+ return DR_OK;
+}
+
diff --git a/Source/FusionDale/src/core/dale_core.h b/Source/FusionDale/src/core/dale_core.h
new file mode 100755
index 0000000..e4ed3dd
--- /dev/null
+++ b/Source/FusionDale/src/core/dale_core.h
@@ -0,0 +1,72 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __FUSIONDALE_CORE_H__
+#define __FUSIONDALE_CORE_H__
+
+#include <fusiondale.h>
+
+#include <fusion/object.h>
+
+#include <core/dale_types.h>
+
+/*
+ * Core initialization and deinitialization
+ */
+DirectResult fd_core_create ( CoreDale **ret_core );
+DirectResult fd_core_destroy( CoreDale *core, bool emergency );
+
+/*
+ * Object creation
+ */
+CoreMessenger *fd_core_create_messenger ( CoreDale *core );
+CoreMessengerPort *fd_core_create_messenger_port( CoreDale *core );
+
+/*
+ * Object enumeration
+ */
+DirectResult fd_core_enum_messengers ( CoreDale *core,
+ FusionObjectCallback callback,
+ void *ctx );
+
+DirectResult fd_core_enum_messenger_ports( CoreDale *core,
+ FusionObjectCallback callback,
+ void *ctx );
+
+DirectResult fd_core_get_messenger ( CoreDale *core,
+ FusionObjectID object_id,
+ CoreMessenger **ret_messenger );
+
+
+/*
+ * Returns the Fusion World of the sound core.
+ */
+FusionWorld *fd_core_world( CoreDale *core );
+
+/*
+ * Returns the Fusion Shared Memory Pool of the sound core.
+ */
+FusionSHMPoolShared *fd_core_shmpool( CoreDale *core );
+
+
+#endif
diff --git a/Source/FusionDale/src/core/dale_types.h b/Source/FusionDale/src/core/dale_types.h
new file mode 100755
index 0000000..60efde4
--- /dev/null
+++ b/Source/FusionDale/src/core/dale_types.h
@@ -0,0 +1,38 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __FUSIONDALE__CORE__DALE_TYPES_H__
+#define __FUSIONDALE__CORE__DALE_TYPES_H__
+
+typedef struct __FD_CoreDale CoreDale;
+typedef struct __FD_CoreDaleShared CoreDaleShared;
+
+typedef struct __FD_CoreMessenger CoreMessenger;
+typedef struct __FD_CoreMessengerPort CoreMessengerPort;
+
+typedef struct __FD_CoreMessengerEvent CoreMessengerEvent;
+typedef struct __FD_CoreMessengerDispatch CoreMessengerDispatch;
+typedef struct __FD_CoreMessengerListener CoreMessengerListener;
+
+#endif
+
diff --git a/Source/FusionDale/src/core/messenger.c b/Source/FusionDale/src/core/messenger.c
new file mode 100755
index 0000000..adae677
--- /dev/null
+++ b/Source/FusionDale/src/core/messenger.c
@@ -0,0 +1,305 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/hash.h>
+#include <fusion/lock.h>
+#include <fusion/shmalloc.h>
+
+#include <core/dale_core.h>
+#include <core/messenger.h>
+#include <core/messenger_port.h>
+
+D_DEBUG_DOMAIN( DC_Mess, "Core/Messenger", "FusionDale Core Messenger" );
+
+/**********************************************************************************************************************/
+
+static void fd_messenger_notify( CoreMessenger *messenger,
+ CoreMessengerNotificationFlags flags,
+ CoreMessengerDispatch *dispatch );
+
+/**********************************************************************************************************************/
+
+static const ReactionFunc fd_messenger_globals[] = {
+/* 0 */ _fd_messenger_port_messenger_listener,
+ NULL
+};
+
+static void
+messenger_destructor( FusionObject *object, bool zombie, void *ctx )
+{
+ CoreMessenger *messenger = (CoreMessenger*) object;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ D_DEBUG_AT( DC_Mess, "%s( %p [%lu] )%s\n", __FUNCTION__, messenger, object->id, zombie ? " ZOMBIE!" : "" );
+
+ fusion_skirmish_destroy( &messenger->lock );
+
+ D_ASSERT( fusion_hash_size( messenger->hash ) == 0 );
+
+ fusion_hash_destroy( messenger->hash );
+
+ D_MAGIC_CLEAR( messenger );
+
+ fusion_object_destroy( object );
+}
+
+FusionObjectPool *
+fd_messenger_pool_create( const FusionWorld *world )
+{
+ return fusion_object_pool_create( "Messenger", sizeof(CoreMessenger),
+ sizeof(CoreMessengerNotification),
+ messenger_destructor, NULL, world );
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+fd_messenger_create( CoreDale *core,
+ CoreMessenger **ret_messenger )
+{
+ DirectResult ret;
+ CoreMessenger *messenger;
+
+ D_ASSERT( core != NULL );
+ D_ASSERT( ret_messenger != NULL );
+
+ D_DEBUG_AT( DC_Mess, "%s( %p )\n", __FUNCTION__, core );
+
+ /* Create messenger object. */
+ messenger = fd_core_create_messenger( core );
+ if (!messenger)
+ return DR_FUSION;
+
+ /* Initialize private data. */
+ messenger->shmpool = fd_core_shmpool( core );
+
+ /* Initialize lock. */
+ ret = fusion_skirmish_init( &messenger->lock, "Messenger", fd_core_world(core) );
+ if (ret)
+ goto error;
+
+ /* Initialize hash. */
+ ret = fusion_hash_create( messenger->shmpool, HASH_STRING, HASH_PTR, 11, &messenger->hash );
+ if (ret) {
+ D_DERROR( ret, "Core/Messenger: fusion_hash_create() failed!\n" );
+ goto error_hash;
+ }
+
+ /* Activate messenger object. */
+ fusion_object_activate( &messenger->object );
+
+ D_MAGIC_SET( messenger, CoreMessenger );
+
+ /* Return messenger object. */
+ *ret_messenger = messenger;
+
+ return DR_OK;
+
+
+error_hash:
+ fusion_skirmish_destroy( &messenger->lock );
+
+error:
+ fusion_object_destroy( &messenger->object );
+
+ return ret;
+}
+
+DirectResult
+fd_messenger_create_event( CoreMessenger *messenger,
+ const char *name,
+ CoreMessengerEvent **ret_event )
+{
+ DirectResult ret;
+ CoreMessengerEvent *event;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+ D_ASSERT( name != NULL );
+ D_ASSERT( ret_event != NULL );
+
+ /* Allocate event structure. */
+ event = SHCALLOC( messenger->shmpool, 1, sizeof(CoreMessengerEvent) );
+ if (!event)
+ return D_OOSHM();
+
+ /* Set back pointer. */
+ event->messenger = messenger;
+
+ /* Initialize event data. */
+ event->id = ++messenger->last_event;
+ event->name = SHSTRDUP( messenger->shmpool, name );
+
+ if (!event->name) {
+ ret = D_OOSHM();
+ goto error;
+ }
+
+ /* Insert event into hash table. */
+ ret = fusion_hash_insert( messenger->hash, event->name, event );
+ if (ret)
+ goto error;
+
+ /* Set magic. */
+ D_MAGIC_SET( event, CoreMessengerEvent );
+
+ /* Return new event. */
+ *ret_event = event;
+
+ return DR_OK;
+
+
+error:
+ if (event->name)
+ SHFREE( messenger->shmpool, event->name );
+
+ SHFREE( messenger->shmpool, event );
+
+ return ret;
+}
+
+DirectResult
+fd_messenger_destroy_event( CoreMessenger *messenger,
+ CoreMessengerEvent *event )
+{
+ DirectResult ret;
+ void *old_key;
+ void *old_value;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+ D_MAGIC_ASSERT( event, CoreMessengerEvent );
+
+ /* Remove event from hash table. */
+ ret = fusion_hash_remove( messenger->hash, event->name, &old_key, &old_value );
+ if (ret) {
+ D_BUG( "event '%s' [%lu] not found", event->name, event->id );
+ return ret;
+ }
+
+ D_ASSERT( old_key == event->name );
+ D_ASSERT( old_value == event );
+
+ D_ASSERT( event->name != NULL );
+
+ SHFREE( messenger->shmpool, event->name );
+
+ D_MAGIC_CLEAR( event );
+
+ SHFREE( messenger->shmpool, event );
+
+ return ret;
+}
+
+DirectResult
+fd_messenger_lookup_event( CoreMessenger *messenger,
+ const char *name,
+ CoreMessengerEvent **ret_event )
+{
+ CoreMessengerEvent *event;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+ D_ASSERT( name != NULL );
+
+ /* Lookup event in hash table. */
+ event = fusion_hash_lookup( messenger->hash, name );
+ if (!event)
+ return DR_ITEMNOTFOUND;
+
+ D_MAGIC_ASSERT( event, CoreMessengerEvent );
+
+ /* Can be NULL to just check for event existence. */
+ if (ret_event)
+ *ret_event = event;
+
+ return DR_OK;
+}
+
+DirectResult
+fd_messenger_dispatch_event( CoreMessenger *messenger,
+ CoreMessengerEvent *event,
+ int param,
+ void *data_ptr,
+ unsigned int data_size )
+{
+ CoreMessengerDispatch *dispatch;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+ D_MAGIC_ASSERT( event, CoreMessengerEvent );
+ D_ASSERT( event->id != FDM_EVENT_ID_NONE );
+ D_ASSERT( data_ptr != NULL || data_size == 0 );
+
+ /* Allocate dispatch structure. */
+ dispatch = SHCALLOC( messenger->shmpool, 1, sizeof(CoreMessengerDispatch) );
+ if (!dispatch)
+ return D_OOSHM();
+
+ /* Initialize dispatch structure. */
+ dispatch->event_id = event->id;
+ dispatch->param = param;
+ dispatch->data = data_ptr;
+ dispatch->data_size = data_size;
+
+ D_MAGIC_SET( dispatch, CoreMessengerDispatch );
+
+ direct_list_append( &event->dispatches, &dispatch->link );
+
+ fd_messenger_notify( messenger, CMNF_DISPATCH, dispatch );
+
+ if (!dispatch->count) {
+ direct_list_remove( &event->dispatches, &dispatch->link );
+
+ D_MAGIC_CLEAR( dispatch );
+
+ SHFREE( messenger->shmpool, dispatch );
+ }
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static void
+fd_messenger_notify( CoreMessenger *messenger,
+ CoreMessengerNotificationFlags flags,
+ CoreMessengerDispatch *dispatch )
+{
+ CoreMessengerNotification notification;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+ D_FLAGS_ASSERT( flags, CMNF_ALL );
+
+ D_DEBUG_AT( DC_Mess, "%s( %p [%lu], 0x%08x )\n", __FUNCTION__, messenger, messenger->object.id, flags );
+
+ notification.flags = flags;
+ notification.messenger = messenger;
+ notification.dispatch = dispatch;
+
+ fd_messenger_dispatch( messenger, &notification, fd_messenger_globals );
+}
+
diff --git a/Source/FusionDale/src/core/messenger.h b/Source/FusionDale/src/core/messenger.h
new file mode 100755
index 0000000..b960680
--- /dev/null
+++ b/Source/FusionDale/src/core/messenger.h
@@ -0,0 +1,160 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __FUSIONDALE_CORE_MESSENGER_H__
+#define __FUSIONDALE_CORE_MESSENGER_H__
+
+#include <fusiondale.h>
+
+#include <fusion/object.h>
+
+#include <core/dale_types.h>
+
+
+typedef enum {
+ CMNF_NONE = 0x00000000,
+
+ CMNF_DISPATCH = 0x00000001,
+
+ CMNF_ALL = 0x00000001
+} CoreMessengerNotificationFlags;
+
+typedef struct {
+ CoreMessengerNotificationFlags flags;
+ CoreMessenger *messenger;
+
+ CoreMessengerDispatch *dispatch;
+} CoreMessengerNotification;
+
+struct __FD_CoreMessenger {
+ FusionObject object;
+
+ int magic;
+
+ FusionSHMPoolShared *shmpool;
+
+ FusionSkirmish lock;
+ FusionHash *hash;
+ FDMessengerEventID last_event;
+};
+
+struct __FD_CoreMessengerEvent {
+ int magic;
+
+ CoreMessenger *messenger;
+
+ FDMessengerEventID id;
+ char *name;
+// unsigned int nodes;
+ DirectLink *nodes;
+
+ DirectLink *dispatches;
+};
+
+struct __FD_CoreMessengerDispatch {
+ DirectLink link;
+
+ int magic;
+
+ int count;
+
+ FDMessengerEventID event_id;
+
+ int param;
+ void *data;
+ unsigned int data_size;
+};
+
+/*
+ * Creates a pool of messenger objects.
+ */
+FusionObjectPool *fd_messenger_pool_create( const FusionWorld *world );
+
+/*
+ * Generates fd_messenger_ref(), fd_messenger_attach() etc.
+ */
+FUSION_OBJECT_METHODS( CoreMessenger, fd_messenger )
+
+
+
+/*
+ * Creation
+ */
+
+DirectResult fd_messenger_create( CoreDale *core,
+ CoreMessenger **ret_messenger );
+
+/*
+ * Events
+ */
+
+DirectResult fd_messenger_create_event ( CoreMessenger *messenger,
+ const char *name,
+ CoreMessengerEvent **ret_event );
+
+DirectResult fd_messenger_destroy_event( CoreMessenger *messenger,
+ CoreMessengerEvent *event );
+
+DirectResult fd_messenger_lookup_event ( CoreMessenger *messenger,
+ const char *name,
+ CoreMessengerEvent **ret_event );
+
+/*
+ * Dispatch
+ */
+
+DirectResult fd_messenger_dispatch_event( CoreMessenger *messenger,
+ CoreMessengerEvent *event,
+ int param,
+ void *data_ptr,
+ unsigned int data_size );
+
+/*
+ * Locking
+ */
+
+static inline DirectResult
+fd_messenger_lock( CoreMessenger *messenger )
+{
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ return fusion_skirmish_prevail( &messenger->lock );
+}
+
+static inline DirectResult
+fd_messenger_unlock( CoreMessenger *messenger )
+{
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ return fusion_skirmish_dismiss( &messenger->lock );
+}
+
+/*
+ * Global reactions
+ */
+typedef enum {
+ FD_MESSENGER_PORT_MESSENGER_LISTENER
+} FD_MESSENGER_GLOBALS;
+
+
+#endif
diff --git a/Source/FusionDale/src/core/messenger_port.c b/Source/FusionDale/src/core/messenger_port.c
new file mode 100755
index 0000000..41d7fe6
--- /dev/null
+++ b/Source/FusionDale/src/core/messenger_port.c
@@ -0,0 +1,939 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/hash.h>
+#include <fusion/lock.h>
+#include <fusion/shmalloc.h>
+
+#include <core/dale_core.h>
+#include <core/messenger.h>
+#include <core/messenger_port.h>
+
+D_DEBUG_DOMAIN( DC_MPort, "Core/MessngPort", "FusionDale Core Messenger Port" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+ DirectLink link;
+
+ int magic;
+
+ CoreMessengerPort *port;
+
+ CoreMessengerEvent *event;
+ unsigned int count; /* number of registrations */
+
+ DirectLink *listeners;
+
+ CoreMessengerDispatch *next_dispatch;
+} EventNode;
+
+typedef struct {
+ DirectLink link;
+
+ int magic;
+
+ EventNode *node;
+
+ FDMessengerEventCallback callback;
+ void *context;
+
+ FDMessengerListenerID id;
+
+ Reaction reaction;
+} EventListener;
+
+/**********************************************************************************************************************/
+
+static void fd_messenger_port_notify( CoreMessengerPort *port,
+ CoreMessengerPortNotificationFlags flags,
+ CoreMessengerDispatch *dispatch );
+
+/**********************************************************************************************************************/
+
+static ReactionResult fd_messenger_port_reaction( const void *msg_data,
+ void *ctx );
+
+/**********************************************************************************************************************/
+
+static void
+purge_node( CoreMessengerPort *port,
+ EventNode *node )
+{
+ DirectResult ret;
+ DirectLink *next;
+ void *old_value;
+ CoreMessenger *messenger;
+ CoreMessengerEvent *event;
+ EventListener *listener;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_MAGIC_ASSERT( node, EventNode );
+ D_MAGIC_ASSERT( node->event, CoreMessengerEvent );
+
+ messenger = port->messenger;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ event = node->event;
+
+ D_MAGIC_ASSERT( event, CoreMessengerEvent );
+
+ /* Remove event node from hash table. FIXME: 2nd lookup */
+ ret = fusion_hash_remove( port->nodes, (void*) node->event->id, NULL, &old_value );
+ if (ret)
+ D_BUG( "node for event id %lu not found", node->event->id );
+ else
+ D_ASSERT( old_value == node );
+
+ D_ASSUME( node->count > 0 );
+
+ if (node->count > 0) {
+ ret = fd_messenger_lock( messenger );
+ if (ret == DR_OK) {
+ CoreMessengerDispatch *dispatch;
+
+ /* Clear pending dispatches. */
+ direct_list_foreach_safe( dispatch, next, node->next_dispatch ) {
+ D_MAGIC_ASSERT( dispatch, CoreMessengerDispatch );
+
+ if (!--dispatch->count) {
+ if (dispatch->data)
+ SHFREE( messenger->shmpool, dispatch->data );
+
+ D_ASSUME( event->dispatches == &dispatch->link );
+
+ direct_list_remove( &event->dispatches, &dispatch->link );
+
+ D_MAGIC_CLEAR( dispatch );
+
+ SHFREE( messenger->shmpool, dispatch );
+ }
+ }
+
+ direct_list_remove( &event->nodes, &node->link );
+
+ /* Decrease registration counter. */
+ if (!/*--*/event->nodes)
+ fd_messenger_destroy_event( messenger, event );
+
+ fd_messenger_unlock( messenger );
+ }
+ else
+ D_BUG( "could not lock messenger" );
+
+ /* Clear listeners. */
+ direct_list_foreach_safe( listener, next, node->listeners ) {
+ D_MAGIC_ASSERT( listener, EventListener );
+
+ /* Remove listener from hash table. */
+ ret = fusion_hash_remove( port->listeners, (void*) listener->id, NULL, &old_value );
+ if (ret)
+ D_BUG( "listener id %lu not found", listener->id );
+ else
+ D_ASSERT( old_value == listener );
+
+ D_MAGIC_CLEAR( listener );
+
+ SHFREE( messenger->shmpool, listener );
+ }
+ }
+
+ D_MAGIC_CLEAR( node );
+
+ SHFREE( messenger->shmpool, node );
+}
+
+/**********************************************************************************************************************/
+
+static bool
+node_iterator( FusionHash *hash,
+ void *key,
+ void *value,
+ void *ctx )
+{
+ EventNode *node = value;
+ CoreMessengerPort *port = ctx;
+
+ D_MAGIC_ASSERT( node, EventNode );
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+
+ purge_node( port, node );
+
+ return false;
+}
+
+static void
+messenger_port_destructor( FusionObject *object, bool zombie, void *ctx )
+{
+ CoreMessengerPort *port = (CoreMessengerPort*) object;
+ CoreMessenger *messenger;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+
+ D_DEBUG_AT( DC_MPort, "%s( %p [%lu] )%s\n", __FUNCTION__, port, object->id, zombie ? " ZOMBIE!" : "" );
+
+ messenger = port->messenger;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ fd_messenger_detach_global( messenger, &port->reaction );
+
+ fusion_hash_iterate( port->nodes, node_iterator, port );
+
+ D_ASSUME( fusion_hash_size( port->nodes ) == 0 );
+ fusion_hash_destroy( port->nodes );
+
+ D_ASSUME( fusion_hash_size( port->listeners ) == 0 );
+ fusion_hash_destroy( port->listeners );
+
+ fd_messenger_unlink( &port->messenger );
+
+ D_MAGIC_CLEAR( port );
+
+ fusion_object_destroy( object );
+}
+
+FusionObjectPool *
+fd_messenger_port_pool_create( const FusionWorld *world )
+{
+ return fusion_object_pool_create( "Messenger Port", sizeof(CoreMessengerPort),
+ sizeof(CoreMessengerPortNotification),
+ messenger_port_destructor, NULL, world );
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+fd_messenger_port_create( CoreDale *core,
+ CoreMessenger *messenger,
+ CoreMessengerPort **ret_port )
+{
+ DirectResult ret;
+ CoreMessengerPort *port;
+
+ D_ASSERT( core != NULL );
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+ D_ASSERT( ret_port != NULL );
+
+ D_DEBUG_AT( DC_MPort, "%s( %p )\n", __FUNCTION__, core );
+
+ /* Create messenger port object. */
+ port = fd_core_create_messenger_port( core );
+ if (!port)
+ return DR_FUSION;
+
+ /* Set back pointer. */
+ ret = fd_messenger_link( &port->messenger, messenger );
+ if (ret)
+ goto error;
+
+ /* Initialize lock. */
+ port->lock = &messenger->lock;
+
+ /* Initialize event node hash. */
+ ret = fusion_hash_create( messenger->shmpool, HASH_INT, HASH_PTR, 11, &port->nodes );
+ if (ret) {
+ D_DERROR( ret, "Core/MessngPort: fusion_hash_create() failed!\n" );
+ goto error_hash;
+ }
+
+ /* Initialize listener hash. */
+ ret = fusion_hash_create( messenger->shmpool, HASH_INT, HASH_PTR, 11, &port->listeners );
+ if (ret) {
+ D_DERROR( ret, "Core/MessngPort: fusion_hash_create() failed!\n" );
+ goto error_hash2;
+ }
+
+ fusion_reactor_set_lock( port->object.reactor, port->lock );
+ fusion_reactor_direct( port->object.reactor, false );
+
+ /* Attach global reaction to process all events. */
+ ret = fd_messenger_attach_global( messenger, FD_MESSENGER_PORT_MESSENGER_LISTENER, port, &port->reaction );
+ if (ret)
+ goto error_attach_global;
+
+ /* Attach to the port to receive events that we listen to. */
+ ret = fd_messenger_port_attach( port, fd_messenger_port_reaction, port, &port->local_reaction );
+ if (ret)
+ goto error_attach;
+
+ /* Activate messenger port object. */
+ fusion_object_activate( &port->object );
+
+ D_MAGIC_SET( port, CoreMessengerPort );
+
+ /* Return messenger port object. */
+ *ret_port = port;
+
+ return DR_OK;
+
+
+error_attach:
+ fd_messenger_detach_global( messenger, &port->reaction );
+
+error_attach_global:
+ fusion_hash_destroy( port->listeners );
+
+error_hash2:
+ fusion_hash_destroy( port->nodes );
+
+error_hash:
+ fd_messenger_unlink( &port->messenger );
+
+error:
+ fusion_object_destroy( &port->object );
+
+ return ret;
+}
+
+DirectResult
+fd_messenger_port_add_event( CoreMessengerPort *port,
+ CoreMessengerEvent *event )
+{
+ DirectResult ret;
+ EventNode *node;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_MAGIC_ASSERT( event, CoreMessengerEvent );
+
+ /* Lock port. */
+ ret = fusion_skirmish_prevail( port->lock );
+ if (ret)
+ return ret;
+
+ /* Try to lookup existing event node. */
+ node = fusion_hash_lookup( port->nodes, (void*) event->id );
+ if (node) {
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+
+ /* Increase node counter. */
+ node->count++;
+ }
+ else {
+ CoreMessenger *messenger = port->messenger;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ /* Allocate node. */
+ node = SHCALLOC( messenger->shmpool, 1, sizeof(EventNode) );
+ if (!node) {
+ ret = D_OOSHM();
+ goto error;
+ }
+
+ /* Initialize node. */
+ node->port = port;
+ node->event = event;
+ node->count = 1;
+
+ /* Insert node into hash table. */
+ ret = fusion_hash_insert( port->nodes, (void*) event->id, node );
+ if (ret) {
+ SHFREE( messenger->shmpool, node );
+ goto error;
+ }
+
+ D_MAGIC_SET( node, EventNode );
+
+ direct_list_append( &event->nodes, &node->link );
+
+ /* Increase event's node counter. */
+ //event->nodes++;
+ }
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+
+ return DR_OK;
+
+
+error:
+ fusion_skirmish_dismiss( port->lock );
+
+ return ret;
+}
+
+DirectResult
+fd_messenger_port_remove_event( CoreMessengerPort *port,
+ FDMessengerEventID event_id )
+{
+ DirectResult ret;
+ EventNode *node;
+ CoreMessenger *messenger;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_ASSERT( event_id != FDM_EVENT_ID_NONE );
+
+ messenger = port->messenger;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ /* Lock port. */
+ ret = fusion_skirmish_prevail( port->lock );
+ if (ret)
+ return ret;
+
+ /* Lookup our event node. */
+ node = fusion_hash_lookup( port->nodes, (void*) event_id );
+ if (node) {
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+
+ if (node->count > 1)
+ node->count--;
+ else
+ purge_node( port, node );
+ }
+ else
+ D_BUG( "node for event id %lu not found", event_id );
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+
+ return DR_OK;
+}
+
+DirectResult
+fd_messenger_port_add_listener( CoreMessengerPort *port,
+ FDMessengerEventID event_id,
+ FDMessengerEventCallback callback,
+ void *context,
+ FDMessengerListenerID *ret_id )
+{
+ DirectResult ret;
+ CoreMessenger *messenger;
+ EventNode *node;
+ EventListener *listener = NULL;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_ASSERT( event_id != FDM_EVENT_ID_NONE );
+ D_ASSERT( callback != NULL );
+ D_ASSERT( ret_id != NULL );
+
+ messenger = port->messenger;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ /* Lock port. */
+ ret = fusion_skirmish_prevail( port->lock );
+ if (ret)
+ return ret;
+
+ /* Lookup our event node. */
+ node = fusion_hash_lookup( port->nodes, (void*) event_id );
+ if (node) {
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+
+ /* Allocate listener struct. */
+ listener = SHCALLOC( messenger->shmpool, 1, sizeof(EventListener) );
+ if (!listener) {
+ ret = D_OOSHM();
+ goto error;
+ }
+
+ /* Initialize listener. */
+ listener->node = node;
+ listener->callback = callback;
+ listener->context = context;
+ listener->id = ++port->last_listener;
+
+ /* Insert listener into hash table. */
+ ret = fusion_hash_insert( port->listeners, (void*) listener->id, listener );
+ if (ret)
+ goto error;
+
+ D_MAGIC_SET( listener, EventListener );
+
+ /* Append listener to event node. */
+ direct_list_append( &node->listeners, &listener->link );
+
+ *ret_id = listener->id;
+ }
+ else
+ D_BUG( "node for event id %lu not found", event_id );
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+
+ return DR_OK;
+
+
+error:
+ if (listener)
+ SHFREE( messenger->shmpool, listener );
+
+ fusion_skirmish_dismiss( port->lock );
+
+ return ret;
+}
+
+DirectResult
+fd_messenger_port_remove_listener( CoreMessengerPort *port,
+ FDMessengerListenerID listener_id )
+{
+ DirectResult ret;
+ void *old_value;
+ EventNode *node;
+ EventListener *listener;
+ CoreMessenger *messenger;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_ASSERT( listener_id != FDM_LISTENER_ID_NONE );
+
+ messenger = port->messenger;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ /* Lock port. */
+ ret = fusion_skirmish_prevail( port->lock );
+ if (ret)
+ return ret;
+
+ /* Remove listener from hash table. */
+ ret = fusion_hash_remove( port->listeners, (void*) listener_id, NULL, &old_value );
+ if (ret) {
+ D_BUG( "listener id %lu not found", listener_id );
+ fusion_skirmish_dismiss( port->lock );
+ return ret;
+ }
+
+ listener = old_value;
+
+ D_MAGIC_ASSERT( listener, EventListener );
+
+ node = listener->node;
+
+ D_MAGIC_ASSERT( node, EventNode );
+
+ /* Remove listener from event node. */
+ direct_list_remove( &node->listeners, &listener->link );
+
+ D_MAGIC_CLEAR( listener );
+
+ SHFREE( messenger->shmpool, listener );
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+
+ return DR_OK;
+}
+
+DirectResult
+fd_messenger_port_enum_listeners( CoreMessengerPort *port,
+ FDMessengerEventID event_id,
+ CoreMPListenerCallback callback,
+ void *context )
+{
+ DirectResult ret;
+ EventNode *node;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_ASSERT( event_id != FDM_EVENT_ID_NONE );
+ D_ASSERT( callback != NULL );
+
+ /* Lock port. */
+ ret = fusion_skirmish_prevail( port->lock );
+ if (ret)
+ return ret;
+
+ /* Lookup our event node. */
+ node = fusion_hash_lookup( port->nodes, (void*) event_id );
+ if (node) {
+ EventListener *listener;
+
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+
+ /* Loop through listeners for the event. */
+ direct_list_foreach( listener, node->listeners ) {
+ D_MAGIC_ASSERT( listener, EventListener );
+ D_ASSERT( listener->callback != NULL );
+
+ /* Pass each listener and its context to the enumeration callback. */
+ if (callback( port, listener->callback, listener->context, context ) == DENUM_CANCEL)
+ break;
+ }
+ }
+ else
+ D_BUG( "node for event id %lu not found", event_id );
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+
+ return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+fd_messenger_event_dispatch( CoreMessengerEvent *event,
+ int param,
+ void *data_ptr,
+ unsigned int data_size )
+{
+ CoreMessenger *messenger;
+ CoreMessengerDispatch *dispatch;
+ EventNode *node;
+ bool dispatched = false;
+
+ D_MAGIC_ASSERT( event, CoreMessengerEvent );
+ D_ASSERT( event->id != FDM_EVENT_ID_NONE );
+ D_ASSERT( data_ptr != NULL || data_size == 0 );
+
+ messenger = event->messenger;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ /* Allocate dispatch structure. */
+ dispatch = SHCALLOC( messenger->shmpool, 1, sizeof(CoreMessengerDispatch) );
+ if (!dispatch)
+ return D_OOSHM();
+
+ /* Initialize dispatch structure. */
+ dispatch->event_id = event->id;
+ dispatch->param = param;
+ dispatch->data = data_ptr;
+ dispatch->data_size = data_size;
+
+ D_MAGIC_SET( dispatch, CoreMessengerDispatch );
+
+ direct_list_append( &event->dispatches, &dispatch->link );
+
+ /* we need to determine the number of listeners first */
+ direct_list_foreach( node, event->nodes ) {
+
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+ D_ASSERT( node->event == event );
+
+ if (node->listeners) {
+ dispatch->count++;
+ }
+ }
+
+
+ direct_list_foreach( node, event->nodes ) {
+ CoreMessengerPort *port;
+
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+ D_ASSERT( node->event == event );
+
+ port = node->port;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+
+ /* Lock port. */
+ fusion_skirmish_prevail( port->lock );
+
+ if (node->listeners) {
+// dispatch->count++;
+
+ if (!node->next_dispatch)
+ node->next_dispatch = dispatch;
+
+ /* Dispatch event to reaction in the port's process. */
+ fd_messenger_port_notify( node->port, CMPNF_EVENT, dispatch );
+
+ dispatched = true;
+ }
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+ }
+
+
+
+ if (!dispatched) {
+ direct_list_remove( &event->dispatches, &dispatch->link );
+
+ D_MAGIC_CLEAR( dispatch );
+
+ SHFREE( messenger->shmpool, dispatch );
+ }
+
+ return DR_OK;
+}
+
+DirectResult
+fd_messenger_port_send_event( CoreMessengerPort *port,
+ FDMessengerEventID event_id,
+ int param,
+ void *data_ptr,
+ unsigned int data_size )
+{
+ DirectResult ret;
+ EventNode *node;
+ CoreMessenger *messenger;
+ CoreMessengerEvent *event;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_ASSERT( event_id != FDM_EVENT_ID_NONE );
+ D_ASSERT( data_ptr != NULL || data_size == 0 );
+
+ messenger = port->messenger;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ /* Lock port. */
+ ret = fusion_skirmish_prevail( port->lock );
+ if (ret)
+ return ret;
+
+ /* Lookup our event node. */
+ node = fusion_hash_lookup( port->nodes, (void*) event_id );
+ if (!node) {
+ D_BUG( "node for event id %lu not found", event_id );
+ fusion_skirmish_dismiss( port->lock );
+ return DR_BUG;
+ }
+
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+
+ event = node->event;
+
+ D_MAGIC_ASSERT( event, CoreMessengerEvent );
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+
+ ret = fd_messenger_event_dispatch( event, param, data_ptr, data_size );
+
+ return ret;
+}
+
+/**********************************************************************************************************************/
+
+static ReactionResult
+fd_messenger_port_reaction( const void *msg_data,
+ void *ctx )
+{
+ DirectResult ret;
+ const CoreMessengerPortNotification *notification = msg_data;
+ CoreMessengerPort *port = ctx;
+ EventNode *node;
+ EventListener *listener;
+ CoreMessenger *messenger;
+ CoreMessengerDispatch *dispatch;
+ CoreMessengerEvent *event;
+
+ D_ASSERT( notification != NULL );
+ D_ASSERT( notification->event_id != FDM_EVENT_ID_NONE );
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_MAGIC_ASSERT( port->messenger, CoreMessenger );
+
+ /* Lock port. */
+ ret = fusion_skirmish_prevail( port->lock );
+ if (ret) {
+ D_BUG( "could not lock port" );
+ return RS_REMOVE;
+ }
+
+ /* Lookup our event node. */
+ node = fusion_hash_lookup( port->nodes, (void*) notification->event_id );
+ if (!node) {
+ /* Probably purged while the message was pending. */
+ D_WARN( "node for event id %lu not found", notification->event_id );
+ fusion_skirmish_dismiss( port->lock );
+ return RS_OK;
+ }
+
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+
+ event = node->event;
+
+ D_MAGIC_ASSERT( event, CoreMessengerEvent );
+
+ messenger = event->messenger;
+
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+
+ D_ASSERT( node->next_dispatch == notification->dispatch );
+
+ dispatch = node->next_dispatch;
+
+ D_MAGIC_ASSERT( dispatch, CoreMessengerDispatch );
+ D_ASSERT( direct_list_contains_element_EXPENSIVE( event->dispatches, &dispatch->link ) );
+
+ /* Loop through listeners for the event. */
+ direct_list_foreach( listener, node->listeners ) {
+ D_MAGIC_ASSERT( listener, EventListener );
+ D_ASSERT( listener->callback != NULL );
+
+ /* Call each listener. */
+ listener->callback( dispatch->event_id, dispatch->param, dispatch->data,
+ dispatch->data_size, listener->context );
+ }
+
+ /* FIXME: Temporarily increase counter to avoid intermittent purge after the following unlock. */
+ node->count++;
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+
+
+ /* Lock messenger. (has to happen without the port being locked!) */
+ ret = fd_messenger_lock( messenger );
+ if (ret) {
+ D_BUG( "could not lock messenger" );
+ return RS_REMOVE;
+ }
+
+ /* Lock port. */
+ ret = fusion_skirmish_prevail( port->lock );
+ if (ret) {
+ D_BUG( "could not lock port" );
+ fd_messenger_unlock( messenger );
+ return RS_REMOVE;
+ }
+
+ /* FIXME: Due to the lock break, some might fail if port has been destroyed.
+ Probably remove this whole thing and use a reference counter per dispatch. */
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+ D_MAGIC_ASSERT( event, CoreMessengerEvent );
+ D_MAGIC_ASSERT( messenger, CoreMessenger );
+ D_MAGIC_ASSERT( dispatch, CoreMessengerDispatch );
+ D_ASSERT( direct_list_contains_element_EXPENSIVE( event->dispatches, &dispatch->link ) );
+
+ node->next_dispatch = (CoreMessengerDispatch*) dispatch->link.next;
+
+ if (node->count > 1) {
+ node->count--;
+
+ if (!--dispatch->count) {
+ if (dispatch->data)
+ SHFREE( messenger->shmpool, dispatch->data );
+
+ D_ASSUME( event->dispatches == &dispatch->link );
+
+ direct_list_remove( &event->dispatches, &dispatch->link );
+
+ D_MAGIC_CLEAR( dispatch );
+
+ SHFREE( messenger->shmpool, dispatch );
+ }
+ }
+ else
+ purge_node( port, node );
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+
+ /* Unlock messenger. */
+ fd_messenger_unlock( messenger );
+
+ return RS_OK;
+}
+
+/**********************************************************************************************************************/
+
+static void
+fd_messenger_port_notify( CoreMessengerPort *port,
+ CoreMessengerPortNotificationFlags flags,
+ CoreMessengerDispatch *dispatch )
+{
+ CoreMessengerPortNotification notification;
+
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+ D_FLAGS_ASSERT( flags, CMNF_ALL );
+
+ D_DEBUG_AT( DC_MPort, "%s( %p [%lu], 0x%08x )\n", __FUNCTION__, port, port->object.id, flags );
+
+ D_ASSERT( flags == CMPNF_EVENT );
+
+ notification.flags = flags;
+ notification.port = port;
+ notification.event_id = dispatch->event_id;
+ notification.param = dispatch->param;
+ notification.data = dispatch->data;
+ notification.data_size = dispatch->data_size;
+ notification.dispatch = dispatch;
+
+ fd_messenger_port_dispatch( port, &notification, NULL /* no globals so far */ );
+}
+
+/**********************************************************************************************************************/
+
+ReactionResult
+_fd_messenger_port_messenger_listener( const void *msg_data,
+ void *ctx )
+{
+ const CoreMessengerNotification *notification = msg_data;
+ CoreMessengerPort *port = ctx;
+ CoreMessengerDispatch *dispatch;
+ EventNode *node;
+ DirectResult ret;
+
+ D_ASSERT( notification != NULL );
+ D_MAGIC_ASSERT( port, CoreMessengerPort );
+
+ D_ASSERT( notification->flags == CMNF_DISPATCH );
+
+ dispatch = notification->dispatch;
+
+ D_MAGIC_ASSERT( dispatch, CoreMessengerDispatch );
+
+ /* Lock port. */
+ ret = fusion_skirmish_prevail( port->lock );
+ if (ret)
+ return RS_REMOVE;
+
+ /* Lookup event node to check if port has any listeners for this event.
+ TODO: Could be optimized by linking nodes into event and dispatch directly,
+ i.e. without this global reaction, but requires different locking. */
+ node = fusion_hash_lookup( port->nodes, (void*) dispatch->event_id );
+ if (node) {
+ D_MAGIC_ASSERT( node, EventNode );
+ D_ASSERT( node->count > 0 );
+
+ if (node->listeners) {
+ dispatch->count++;
+
+ if (!node->next_dispatch)
+ node->next_dispatch = dispatch;
+
+ /* Dispatch event to reaction in the port's process. */
+ fd_messenger_port_notify( port, CMPNF_EVENT, dispatch );
+ }
+ }
+
+ /* Unlock port. */
+ fusion_skirmish_dismiss( port->lock );
+
+ return RS_OK;
+}
+
diff --git a/Source/FusionDale/src/core/messenger_port.h b/Source/FusionDale/src/core/messenger_port.h
new file mode 100755
index 0000000..56a111e
--- /dev/null
+++ b/Source/FusionDale/src/core/messenger_port.h
@@ -0,0 +1,137 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __FUSIONDALE_CORE_MESSENGER_PORT_H__
+#define __FUSIONDALE_CORE_MESSENGER_PORT_H__
+
+#include <fusiondale.h>
+
+#include <fusion/object.h>
+#include <fusion/reactor.h>
+
+#include <core/dale_types.h>
+
+
+typedef enum {
+ CMPNF_NONE = 0x00000000,
+
+ CMPNF_EVENT = 0x00000001,
+
+ CMPNF_ALL = 0x00000001
+} CoreMessengerPortNotificationFlags;
+
+typedef struct {
+ CoreMessengerPortNotificationFlags flags;
+ CoreMessengerPort *port;
+
+ FDMessengerEventID event_id;
+ int param;
+ void *data;
+ unsigned int data_size;
+
+ CoreMessengerDispatch *dispatch; /* for integrity check with node's next_dispatch */
+} CoreMessengerPortNotification;
+
+struct __FD_CoreMessengerPort {
+ FusionObject object;
+
+ int magic;
+
+ CoreMessenger *messenger;
+
+ FusionSkirmish *lock;
+
+ FusionHash *nodes;
+ FusionHash *listeners;
+
+ FDMessengerEventID last_listener;
+
+ GlobalReaction reaction;
+ Reaction local_reaction;
+};
+
+typedef DirectEnumerationResult (*CoreMPListenerCallback)( CoreMessengerPort *port,
+ FDMessengerEventCallback listener,
+ void *listener_context,
+ void *context );
+
+/*
+ * Creates a pool of messenger port objects.
+ */
+FusionObjectPool *fd_messenger_port_pool_create( const FusionWorld *world );
+
+/*
+ * Generates fd_messenger_port_ref(), fd_messenger_port_attach() etc.
+ */
+FUSION_OBJECT_METHODS( CoreMessengerPort, fd_messenger_port )
+
+
+/*
+ * Creation
+ */
+
+DirectResult fd_messenger_port_create( CoreDale *core,
+ CoreMessenger *messenger,
+ CoreMessengerPort **ret_port );
+
+/*
+ * Events
+ */
+
+DirectResult fd_messenger_port_add_event ( CoreMessengerPort *port,
+ CoreMessengerEvent *event );
+
+DirectResult fd_messenger_port_remove_event( CoreMessengerPort *port,
+ FDMessengerEventID event_id );
+
+DirectResult fd_messenger_port_send_event ( CoreMessengerPort *port,
+ FDMessengerEventID event_id,
+ int param,
+ void *data_ptr,
+ unsigned int data_size );
+
+/*
+ * Listeners
+ */
+
+DirectResult fd_messenger_port_add_listener ( CoreMessengerPort *port,
+ FDMessengerEventID event_id,
+ FDMessengerEventCallback callback,
+ void *context,
+ FDMessengerListenerID *ret_id );
+
+DirectResult fd_messenger_port_remove_listener( CoreMessengerPort *port,
+ FDMessengerListenerID listener_id );
+
+DirectResult fd_messenger_port_enum_listeners ( CoreMessengerPort *port,
+ FDMessengerEventID event_id,
+ CoreMPListenerCallback callback,
+ void *context );
+
+/*
+ * Global reactions
+ */
+ReactionResult _fd_messenger_port_messenger_listener( const void *msg_data,
+ void *ctx );
+
+#endif
diff --git a/Source/FusionDale/src/fusiondale.c b/Source/FusionDale/src/fusiondale.c
new file mode 100755
index 0000000..b5e3a0c
--- /dev/null
+++ b/Source/FusionDale/src/fusiondale.c
@@ -0,0 +1,216 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <fusiondale.h>
+#include <fusiondale_version.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/log.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <ifusiondale.h>
+
+#include <misc/dale_config.h>
+
+
+IFusionDale *ifusiondale_singleton = NULL;
+
+/**************************************************************************************************/
+
+static DirectResult CreateRemote( const char *host, int session, IFusionDale **ret_interface );
+
+/**********************************************************************************************************************/
+
+/*
+ * Version checking
+ */
+const unsigned int fusiondale_major_version = FUSIONDALE_MAJOR_VERSION;
+const unsigned int fusiondale_minor_version = FUSIONDALE_MINOR_VERSION;
+const unsigned int fusiondale_micro_version = FUSIONDALE_MICRO_VERSION;
+const unsigned int fusiondale_binary_age = FUSIONDALE_BINARY_AGE;
+const unsigned int fusiondale_interface_age = FUSIONDALE_INTERFACE_AGE;
+
+const char *
+FusionDaleCheckVersion( unsigned int required_major,
+ unsigned int required_minor,
+ unsigned int required_micro )
+{
+ if (required_major > FUSIONDALE_MAJOR_VERSION)
+ return "FusionDale version too old (major mismatch)";
+ if (required_major < FUSIONDALE_MAJOR_VERSION)
+ return "FusionDale version too new (major mismatch)";
+ if (required_minor > FUSIONDALE_MINOR_VERSION)
+ return "FusionDale version too old (minor mismatch)";
+ if (required_minor < FUSIONDALE_MINOR_VERSION)
+ return "FusionDale version too new (minor mismatch)";
+ if (required_micro < FUSIONDALE_MICRO_VERSION - FUSIONDALE_BINARY_AGE)
+ return "FusionDale version too new (micro mismatch)";
+ if (required_micro > FUSIONDALE_MICRO_VERSION)
+ return "FusionDale version too old (micro mismatch)";
+
+ return NULL;
+}
+
+const char *
+FusionDaleUsageString( void )
+{
+ return fd_config_usage();
+}
+
+DirectResult
+FusionDaleInit( int *argc, char **argv[] )
+{
+#ifdef DSLINUX
+ IFusionDale_Requestor_ctor();
+#endif
+
+ return fd_config_init( argc, argv );
+}
+
+DirectResult
+FusionDaleSetOption( const char *name, const char *value )
+{
+ if (fusiondale_config == NULL) {
+ D_ERROR( "FusionDaleSetOption: FusionDaleInit has to be called first!\n" );
+ return DR_INIT;
+ }
+
+ if (ifusiondale_singleton) {
+ D_ERROR( "FusionDaleSetOption: FusionDaleCreate has already been called!\n" );
+ return DR_INIT;
+ }
+
+ if (!name)
+ return DR_INVARG;
+
+ return fd_config_set( name, value );
+}
+
+DirectResult
+FusionDaleCreate( IFusionDale **ret_interface )
+{
+ DirectResult ret;
+
+ if (!fusiondale_config) {
+ D_ERROR( "FusionDaleCreate: FusionDaleInit has to be called first!\n" );
+ return DR_INIT;
+ }
+
+ if (!ret_interface)
+ return DR_INVARG;
+
+ if (ifusiondale_singleton) {
+ ifusiondale_singleton->AddRef( ifusiondale_singleton );
+ *ret_interface = ifusiondale_singleton;
+ return DR_OK;
+ }
+
+#ifndef DIRECTFB_PURE_VOODOO
+ if (fusiondale_config->remote.host)
+ return CreateRemote( fusiondale_config->remote.host, fusiondale_config->remote.session, ret_interface );
+
+ if (!(direct_config->quiet & DMT_BANNER) && fusiondale_config->banner) {
+ direct_log_printf( NULL,
+ "\n"
+ " *--------------) FusionDale v%d.%d.%d (--------------*\n"
+ " (c) 2006-2007 directfb.org\n"
+ " -----------------------------------------------\n"
+ "\n",
+ FUSIONDALE_MAJOR_VERSION, FUSIONDALE_MINOR_VERSION, FUSIONDALE_MICRO_VERSION );
+ }
+
+ DIRECT_ALLOCATE_INTERFACE( ifusiondale_singleton, IFusionDale );
+
+ ret = IFusionDale_Construct( ifusiondale_singleton );
+ if (ret != DR_OK)
+ ifusiondale_singleton = NULL;
+
+ *ret_interface = ifusiondale_singleton;
+
+ return DR_OK;
+#else
+ return CreateRemote( fusiondale_config->remote.host ?: "", fusiondale_config->remote.session, ret_interface );
+#endif
+}
+
+DirectResult
+FusionDaleError( const char *msg, DirectResult error )
+{
+ if (msg)
+ fprintf( stderr, "(#) FusionDale Error [%s]: %s\n", msg, DirectResultString( error ) );
+ else
+ fprintf( stderr, "(#) FusionDale Error: %s\n", DirectResultString( error ) );
+
+ return error;
+}
+
+DirectResult
+FusionDaleErrorFatal( const char *msg, DirectResult error )
+{
+ FusionDaleError( msg, error );
+
+ exit( error );
+}
+
+const char *
+FusionDaleErrorString( DirectResult error )
+{
+ return DirectResultString( error );
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+CreateRemote( const char *host, int session, IFusionDale **ret_interface )
+{
+ DirectResult ret;
+ DirectInterfaceFuncs *funcs;
+ void *interface;
+
+ D_ASSERT( host != NULL );
+ D_ASSERT( ret_interface != NULL );
+
+ ret = DirectGetInterface( &funcs, "IFusionDale", "Requestor", NULL, NULL );
+ if (ret)
+ return ret;
+
+ ret = funcs->Allocate( &interface );
+ if (ret)
+ return ret;
+
+ ret = funcs->Construct( interface, host, session );
+ if (ret)
+ return ret;
+
+ *ret_interface = interface;
+
+ return DR_OK;
+}
+
diff --git a/Source/FusionDale/src/ifusiondale.c b/Source/FusionDale/src/ifusiondale.c
new file mode 100755
index 0000000..14a688f
--- /dev/null
+++ b/Source/FusionDale/src/ifusiondale.c
@@ -0,0 +1,228 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <unistd.h>
+
+#include <fusiondale.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+
+#include <core/dale_core.h>
+#include <core/messenger.h>
+
+#include <misc/dale_config.h>
+
+#include <messenger/ifusiondalemessenger.h>
+
+#include <coma/coma.h>
+#include <coma/icoma.h>
+
+#include "ifusiondale.h"
+
+
+
+static void
+IFusionDale_Destruct( IFusionDale *thiz )
+{
+ IFusionDale_data *data = (IFusionDale_data*)thiz->priv;
+
+ fd_core_destroy( data->core, false );
+
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+
+ if (ifusiondale_singleton == thiz)
+ ifusiondale_singleton = NULL;
+}
+
+static DirectResult
+IFusionDale_AddRef( IFusionDale *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA (IFusionDale);
+
+ data->ref++;
+
+ return DR_OK;
+}
+
+static DirectResult
+IFusionDale_Release( IFusionDale *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA (IFusionDale)
+
+ if (--data->ref == 0)
+ IFusionDale_Destruct( thiz );
+
+ return DR_OK;
+}
+
+static DirectResult
+IFusionDale_CreateMessenger( IFusionDale *thiz,
+ IFusionDaleMessenger **ret_interface )
+{
+ DirectResult ret;
+ CoreMessenger *messenger;
+ IFusionDaleMessenger *interface;
+
+ DIRECT_INTERFACE_GET_DATA(IFusionDale)
+
+ /* Check arguments */
+ if (!ret_interface)
+ return DR_INVARG;
+
+ /* Create a new messenger. */
+ ret = fd_messenger_create( data->core, &messenger );
+ if (ret)
+ return ret;
+
+ DIRECT_ALLOCATE_INTERFACE( interface, IFusionDaleMessenger );
+
+ ret = IFusionDaleMessenger_Construct( interface, data->core, messenger );
+
+ fd_messenger_unref( messenger );
+
+ if (ret)
+ return ret;
+
+ *ret_interface = interface;
+
+ return DR_OK;
+}
+
+static DirectResult
+IFusionDale_GetMessenger( IFusionDale *thiz,
+ IFusionDaleMessenger **ret_interface )
+{
+ DirectResult ret;
+ CoreMessenger *messenger, *tmp;
+ IFusionDaleMessenger *interface;
+
+ DIRECT_INTERFACE_GET_DATA(IFusionDale)
+
+ /* Check arguments */
+ if (!ret_interface)
+ return DR_INVARG;
+
+ /* Try to get the messenger. */
+ ret = fd_core_get_messenger( data->core, 1, &messenger );
+ switch (ret) {
+ case DR_OK:
+ break;
+
+ case DR_IDNOTFOUND:
+ /* Create a temporary messenger... */
+ ret = fd_messenger_create( data->core, &tmp );
+ if (ret)
+ return ret;
+
+ /* ...but get the first messenger, to work around race conditions... */
+ ret = fd_core_get_messenger( data->core, 1, &messenger );
+
+ /* ...and unref our temporary (most probably the same one). */
+ fd_messenger_unref( tmp );
+
+ if (ret)
+ return ret;
+ break;
+
+ default:
+ return ret;
+ }
+
+ DIRECT_ALLOCATE_INTERFACE( interface, IFusionDaleMessenger );
+
+ ret = IFusionDaleMessenger_Construct( interface, data->core, messenger );
+
+ fd_messenger_unref( messenger );
+
+ if (ret)
+ return ret;
+
+ *ret_interface = interface;
+
+ return DR_OK;
+}
+
+static DirectResult
+IFusionDale_EnterComa( IFusionDale *thiz,
+ const char *name,
+ IComa **ret_interface )
+{
+ DirectResult ret;
+ Coma *coma;
+ IComa *interface;
+
+ DIRECT_INTERFACE_GET_DATA(IFusionDale)
+
+ /* Check arguments */
+ if (!name || !ret_interface)
+ return DR_INVARG;
+
+ /* Enter the specified Coma. */
+ ret = coma_enter( fd_core_world( data->core ), name, &coma );
+ if (ret)
+ return ret;
+
+ DIRECT_ALLOCATE_INTERFACE( interface, IComa );
+
+ ret = IComa_Construct( interface, coma );
+ if (ret)
+ return ret;
+
+ *ret_interface = interface;
+
+ return DR_OK;
+}
+
+DirectResult
+IFusionDale_Construct( IFusionDale *thiz )
+{
+ DirectResult ret;
+
+ /* Allocate interface data. */
+ DIRECT_ALLOCATE_INTERFACE_DATA( thiz, IFusionDale );
+
+ /* Initialize interface data. */
+ data->ref = 1;
+
+ /* Create the core instance. */
+ ret = fd_core_create( &data->core );
+ if (ret) {
+ FusionDaleError( "FusionDale: fd_core_create() failed", ret );
+
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+
+ return ret;
+ }
+
+ /* Assign interface pointers. */
+ thiz->AddRef = IFusionDale_AddRef;
+ thiz->Release = IFusionDale_Release;
+ thiz->CreateMessenger = IFusionDale_CreateMessenger;
+ thiz->GetMessenger = IFusionDale_GetMessenger;
+ thiz->EnterComa = IFusionDale_EnterComa;
+
+ return DR_OK;
+}
diff --git a/Source/FusionDale/src/ifusiondale.h b/Source/FusionDale/src/ifusiondale.h
new file mode 100755
index 0000000..3e7fdb6
--- /dev/null
+++ b/Source/FusionDale/src/ifusiondale.h
@@ -0,0 +1,45 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __IFUSIONDALE_H__
+#define __IFUSIONDALE_H__
+
+#include <fusiondale.h>
+
+#include <core/dale_core.h>
+
+/*
+ * private data struct of IFusionDale
+ */
+typedef struct {
+ int ref; /* reference counter */
+
+ CoreDale *core;
+} IFusionDale_data;
+
+
+DirectResult IFusionDale_Construct( IFusionDale *thiz );
+
+extern IFusionDale *ifusiondale_singleton;
+
+#endif
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 <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <unistd.h>
+
+#include <fusiondale.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/dale_core.h>
+#include <core/messenger.h>
+#include <core/messenger_port.h>
+
+#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 <dok@directfb.org>.
+
+ 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 <fusiondale.h>
+
+#include <core/dale_types.h>
+
+#include <direct/types.h>
+
+/*
+ * 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
diff --git a/Source/FusionDale/src/misc/Makefile.am b/Source/FusionDale/src/misc/Makefile.am
new file mode 100755
index 0000000..72c8fbf
--- /dev/null
+++ b/Source/FusionDale/src/misc/Makefile.am
@@ -0,0 +1,16 @@
+## Makefile.am for FusionDale/src/misc
+
+INCLUDES = \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src \
+ $(FUSION_CFLAGS)
+
+AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\"
+
+noinst_LTLIBRARIES = \
+ libfusiondalemisc.la
+
+libfusiondalemisc_la_SOURCES = \
+ dale_config.c \
+ dale_config.h
diff --git a/Source/FusionDale/src/misc/Makefile.in b/Source/FusionDale/src/misc/Makefile.in
new file mode 100755
index 0000000..4b89119
--- /dev/null
+++ b/Source/FusionDale/src/misc/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/misc
+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)
+libfusiondalemisc_la_LIBADD =
+am_libfusiondalemisc_la_OBJECTS = dale_config.lo
+libfusiondalemisc_la_OBJECTS = $(am_libfusiondalemisc_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 = $(libfusiondalemisc_la_SOURCES)
+DIST_SOURCES = $(libfusiondalemisc_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)
+
+AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\"
+noinst_LTLIBRARIES = \
+ libfusiondalemisc.la
+
+libfusiondalemisc_la_SOURCES = \
+ dale_config.c \
+ dale_config.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/misc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/misc/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
+libfusiondalemisc.la: $(libfusiondalemisc_la_OBJECTS) $(libfusiondalemisc_la_DEPENDENCIES)
+ $(LINK) $(libfusiondalemisc_la_OBJECTS) $(libfusiondalemisc_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dale_config.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/misc/dale_config.c b/Source/FusionDale/src/misc/dale_config.c
new file mode 100755
index 0000000..96c9e3d
--- /dev/null
+++ b/Source/FusionDale/src/misc/dale_config.c
@@ -0,0 +1,377 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 <config.h>
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <fusiondale.h>
+
+#include <direct/conf.h>
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/conf.h>
+
+#include <coma/policy.h>
+
+#include "dale_config.h"
+
+
+FusionDaleConfig *fusiondale_config = NULL;
+
+static const char *config_usage =
+ "FusionDale version " FUSIONDALE_VERSION "\n"
+ "\n"
+ " --fd-help Output FusionDale usage information and exit\n"
+ " --fd:<option>[,<option>]... Pass options to FusionDale (see below)\n"
+ "\n"
+ "FusionDale options:\n"
+ "\n"
+ " coma-shmpool-size=<kb> Set the maximum size of the shared memory pool created by\n"
+ " each component manager (once for all EnterComa with same name)\n"
+ " session=<num> Select multi app world (-1 = new)\n"
+ " remote=<host>[:<session>] Select remote session to connect to\n"
+ " [no-]banner Show FusionDale banner on startup\n"
+ "\n";
+
+
+static DirectResult
+parse_args( const char *args )
+{
+ char *buf = alloca( strlen(args) + 1 );
+
+ strcpy( buf, args );
+
+ while (buf && buf[0]) {
+ DirectResult ret;
+ char *value;
+ char *next;
+
+ if ((next = strchr( buf, ',' )) != NULL)
+ *next++ = '\0';
+
+ if (strcmp (buf, "help") == 0) {
+ fprintf( stderr, config_usage );
+ exit(1);
+ }
+
+ if ((value = strchr( buf, '=' )) != NULL)
+ *value++ = '\0';
+
+ ret = fd_config_set( buf, value );
+ switch (ret) {
+ case DR_OK:
+ break;
+ case DR_UNSUPPORTED:
+ D_ERROR( "FusionDale/Config: Unknown option '%s'!\n", buf );
+ break;
+ default:
+ return ret;
+ }
+
+ buf = next;
+ }
+
+ return DR_OK;
+}
+
+static void
+config_allocate()
+{
+ if (fusiondale_config)
+ return;
+
+ fusiondale_config = D_CALLOC( 1, sizeof(FusionDaleConfig) );
+
+ fusiondale_config->session = 5; // FIXME!!!
+
+ fusiondale_config->banner = true;
+ fusiondale_config->coma_shmpool_size = 16 * 1024 * 1024;
+}
+
+const char*
+fd_config_usage( void )
+{
+ return config_usage;
+}
+
+DirectResult
+fd_config_set( const char *name, const char *value )
+{
+ if (!strcmp( name, "session" )) {
+ if (value) {
+ int session;
+
+ if (sscanf( value, "%d", &session ) < 1) {
+ D_ERROR( "FusionDale/Config 'session': "
+ "Could not parse value!\n");
+ return DR_INVARG;
+ }
+
+ fusiondale_config->session = session;
+ }
+ else {
+ D_ERROR( "FusionDale/Config 'session': "
+ "No value specified!\n" );
+ return DR_INVARG;
+ }
+ }
+ else if (strcmp (name, "remote" ) == 0) {
+ if (value) {
+ char host[128];
+ int session = 0;
+
+ if (sscanf( value, "%127s:%d", host, &session ) < 1) {
+ D_ERROR("FusionDale/Config 'remote': "
+ "Could not parse value (format is <host>[:<session>])!\n");
+ return DR_INVARG;
+ }
+
+ if (fusiondale_config->remote.host)
+ D_FREE( fusiondale_config->remote.host );
+
+ fusiondale_config->remote.host = D_STRDUP( host );
+ fusiondale_config->remote.session = session;
+ }
+ else {
+ fusiondale_config->remote.host = D_STRDUP( "" );
+ fusiondale_config->remote.session = 0;
+ }
+ }
+ else if (!strcmp( name, "coma-shmpool-size" )) {
+ if (value) {
+ int size_kb;
+
+ if (sscanf( value, "%d", &size_kb ) < 1) {
+ D_ERROR( "FusionDale/Config '%s': Could not parse value!\n", name);
+ return DR_INVARG;
+ }
+
+ fusiondale_config->coma_shmpool_size = size_kb * 1024;
+ }
+ else {
+ D_ERROR( "FusionDale/Config '%s': No value specified!\n", name );
+ return DR_INVARG;
+ }
+ }
+ else if (!strcmp( name, "banner" )) {
+ fusiondale_config->banner = true;
+ }
+ else if (!strcmp( name, "no-banner" )) {
+ fusiondale_config->banner = false;
+ }
+ else if (strcmp ( name, "force-slave" ) == 0) {
+ fusiondale_config->force_slave = true;
+ }
+ else if (strcmp ( name, "no-force-slave" ) == 0) {
+ fusiondale_config->force_slave = false;
+ }
+ else if (strcmp ( name, "coma-allow" ) == 0) {
+ if (value) {
+ coma_policy_config( value, true );
+ }
+ else {
+ fusiondale_config->coma_policy = true;
+ }
+ }
+ else if (strcmp ( name, "coma-deny" ) == 0) {
+ if (value) {
+ coma_policy_config( value, false );
+ }
+ else {
+ fusiondale_config->coma_policy = false;
+ }
+ } else
+ if (fusion_config_set( name, value ) && direct_config_set( name, value ))
+ return DR_UNSUPPORTED;
+
+ return DR_OK;
+}
+
+static DirectResult
+fd_config_read( const char *filename )
+{
+ DirectResult ret = DR_OK;
+ char line[400];
+ FILE *f;
+
+ f = fopen( filename, "r" );
+ if (!f) {
+ D_DEBUG( "FusionDale/Config: "
+ "Unable to open config file `%s'!\n", filename );
+ return DR_IO;
+ } else {
+// D_INFO( "FusionDale/Config: "
+// "Parsing config file '%s'.\n", filename );
+ }
+
+ while (fgets( line, 400, f )) {
+ char *name = line;
+ char *value = strchr( line, '=' );
+
+ if (value) {
+ *value++ = 0;
+ direct_trim( &value );
+ }
+
+ direct_trim( &name );
+
+ if (!*name || *name == '#')
+ continue;
+
+ ret = fd_config_set( name, value );
+ if (ret) {
+ if (ret == DR_UNSUPPORTED)
+ D_ERROR( "FusionDale/Config: In config file `%s': "
+ "Invalid option `%s'!\n", filename, name );
+ break;
+ }
+ }
+
+ fclose( f );
+
+ return ret;
+}
+
+DirectResult
+fd_config_init( int *argc, char **argv[] )
+{
+ DirectResult ret;
+ char *home = getenv( "HOME" );
+ char *prog = NULL;
+ char *fdargs;
+
+ if (fusiondale_config)
+ return DR_OK;
+
+ config_allocate();
+
+ /* Read system settings. */
+ ret = fd_config_read( SYSCONFDIR"/fusiondalerc" );
+ if (ret && ret != DR_IO)
+ return ret;
+
+ /* Read user settings. */
+ if (home) {
+ int len = strlen(home) + sizeof("/.fusiondalerc");
+ char buf[len];
+
+ snprintf( buf, len, "%s/.fusiondalerc", home );
+
+ ret = fd_config_read( buf );
+ if (ret && ret != DR_IO)
+ return ret;
+ }
+
+ /* Get application name. */
+ if (argc && *argc && argv && *argv) {
+ prog = strrchr( (*argv)[0], '/' );
+
+ if (prog)
+ prog++;
+ else
+ prog = (*argv)[0];
+ }
+
+ /* Read global application settings. */
+ if (prog && prog[0]) {
+ int len = sizeof(SYSCONFDIR"/fusiondalerc.") + strlen(prog);
+ char buf[len];
+
+ snprintf( buf, len, SYSCONFDIR"/fusiondalerc.%s", prog );
+
+ ret = fd_config_read( buf );
+ if (ret && ret != DR_IO)
+ return ret;
+ }
+
+ /* Read user application settings. */
+ if (home && prog && prog[0]) {
+ int len = strlen(home) + sizeof("/.fusiondalerc.") + strlen(prog);
+ char buf[len];
+
+ snprintf( buf, len, "%s/.fusiondalerc.%s", home, prog );
+
+ ret = fd_config_read( buf );
+ if (ret && ret != DR_IO)
+ return ret;
+ }
+
+ /* Read settings from environment variable. */
+ fdargs = getenv( "FDARGS" );
+ if (fdargs) {
+ ret = parse_args( fdargs );
+ if (ret)
+ return ret;
+ }
+
+ /* Read settings from command line. */
+ if (argc && argv) {
+ int i;
+
+ for (i = 1; i < *argc; i++) {
+
+ if (!strcmp( (*argv)[i], "--fd-help" )) {
+ fprintf( stderr, config_usage );
+ exit(1);
+ }
+
+ if (!strncmp( (*argv)[i], "--fd:", 5 )) {
+ ret = parse_args( (*argv)[i] + 5 );
+ if (ret)
+ return ret;
+
+ (*argv)[i] = NULL;
+ }
+ }
+
+ for (i = 1; i < *argc; i++) {
+ int k;
+
+ for (k = i; k < *argc; k++)
+ if ((*argv)[k] != NULL)
+ break;
+
+ if (k > i) {
+ int j;
+
+ k -= i;
+
+ for (j = i + k; j < *argc; j++)
+ (*argv)[j-k] = (*argv)[j];
+
+ *argc -= k;
+ }
+ }
+ }
+
+ return DR_OK;
+}
+
diff --git a/Source/FusionDale/src/misc/dale_config.h b/Source/FusionDale/src/misc/dale_config.h
new file mode 100755
index 0000000..777929e
--- /dev/null
+++ b/Source/FusionDale/src/misc/dale_config.h
@@ -0,0 +1,64 @@
+/*
+ (c) Copyright 2006-2007 directfb.org
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>.
+
+ 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 __FD__DALE_CONFIG_H__
+#define __FD__DALE_CONFIG_H__
+
+#include <fusiondale.h>
+
+typedef struct {
+ int session; /* select multi app world */
+
+ bool banner; /* startup banner */
+
+ bool force_slave;
+
+ int coma_shmpool_size; /* Set the maximum size of the shared memory pool created by
+ each component manager (once for all EnterComa with same name). */
+
+ struct {
+ char *host;
+ int session;
+ } remote;
+
+ bool coma_policy;
+} FusionDaleConfig;
+
+extern FusionDaleConfig *fusiondale_config;
+
+/*
+ * Allocate Config struct, fill with defaults and parse command line options
+ * for overrides. Options identified as FusionDale options are stripped out
+ * of the array.
+ */
+DirectResult fd_config_init( int *argc, char **argv[] );
+
+/*
+ * Set indiviual option. Used by config_init(), and FusionDaleSetOption()
+ */
+DirectResult fd_config_set( const char *name, const char *value );
+
+const char *fd_config_usage( void );
+
+#endif /* __FD__DALE_CONFIG_H__ */
+