summaryrefslogtreecommitdiff
path: root/Source/FusionDale/src/coma
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FusionDale/src/coma')
-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
15 files changed, 2980 insertions, 0 deletions
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