Remove sigc++ files from repository

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4893 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-08-07 16:40:54 +00:00
parent 22909c4ae1
commit 6ab18825ab
53 changed files with 0 additions and 6980 deletions

View File

@ -1,29 +0,0 @@
Makefile
Makefile.in
stamp-h*
.libs
.deps
*.lo
*.la
config.h
signal.h
slot.h
object_slot.h
func_slot.h
basic_signal.h
class_slot.h
signals.h
bind.h
convert.h
rettype.h
retbind.h
aclocal.m4
config.log
config.status
configure
libtool
sigc-config
stamp*
sigc++config.h
sigc++config.h.in
acinclude.m4

View File

@ -1,15 +0,0 @@
2001-07-25 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Makefile.am (%.h): generate the BUILT_SOURCES in top_srcdir, add
BUILT_SOURCES to EXTRA_DIST
2001-04-17 Allan Rae <rae@lyx.org>
* libsigc++-1.0.3 and important local changes kept. Outlining of
inline functions has been lost -- modify ../development/tools/
makeLyXsigc.sh if you want them back again.
2001-02-07 Lars Gullik Bjønnes <larsbj@lyx.org>
* configure.in (AC_ARG_ENABLE(threads)): disable threads by default.

View File

@ -1,12 +0,0 @@
These files are all collected together from a checked out copy of the
libsigc++ CVS repository by the ../development/tools/makeLyXsigc.sh file.
Some of these files are modified by that script. If you need to fix a bug in
the code then you should try to get the latest CVS libsigc++ and regenerate
this entire subpackage. If the problem still persists it may be necessary to
modify the generation script.
If an error is found while porting to a new platform read the doc/requirements
file.
Remember to contact the LyX developers list if you are having problems.
Allan. (ARRae)

View File

@ -1,40 +0,0 @@
SUBDIRS = macros
DISTCLEANFILES = *.orig *.rej *~ *.bak core config.log config.status \
slot.h object_slot.h func_slot.h class_slot.h basic_signal.h \
convert.h bind.h rettype.h retbind.h
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/configure \
$(srcdir)/sigc++config* $(srcdir)/stamp* $(srcdir)/aclocal.m4 \
$(srcdir)/acinclude.m4
ETAGS_ARGS = --lang=c++
INCLUDES = -I$(top_srcdir)/.. -I$(top_builddir)/..
M4_DIR = $(top_srcdir)/macros
M4_INCLUDES = -I$(M4_DIR)
BUILT_SOURCES = slot.h object_slot.h func_slot.h class_slot.h \
basic_signal.h \
convert.h bind.h rettype.h retbind.h
EXTRA_DIST = $(BUILT_SOURCES)
libsigc_la_SOURCES= $(BUILT_SOURCES) \
object.cc scope.cc marshal.cc slot.cc\
basic_signal.cc adaptor.cc thread.cc
libsigc_la_LDFLAGS = \
-no-undefined
noinst_LTLIBRARIES = libsigc.la
noinst_HEADERS = \
marshal.h handle_system.h signal_system.h \
$(BUILT_SOURCES) type.h\
handle.h object.h scope.h adaptor.h thread.h
Makefile: $(BUILT_SOURCES)
%.h: $(M4_DIR)/%.h.m4 $(M4_DIR)/template.macros.m4
$(M4) $(M4_INCLUDES) $(DEFINES) $< > $(top_builddir)/$@
all-local: $(noinst_LTLIBRARIES)

View File

@ -1,91 +0,0 @@
#ifndef _SIGC_CONFIG_H_
#define _SIGC_CONFIG_H_
#if 0
@TOP@
@BOTTOM@
#undef PACKAGE
#endif /* 0 */
#undef SIGC_MAJOR_VERSION
#undef SIGC_MINOR_VERSION
#undef SIGC_MICRO_VERSION
// detect common platforms
#if defined(_WIN32)
// Win32 compilers have a lot of varation
#if defined(__BORLANDC__)
#define LIBSIGC_BC
#define LIBSIGC_WIN32
#elif defined(_MSC_VER)
#define LIBSIGC_MSC
#define LIBSIGC_WIN32
#elif defined(__CYGWIN__)
#define LIBSIGC_UNIX
#else
#error "Unknown architecture (send me gcc --dumpspecs)"
#endif
#else
#define LIBSIGC_UNIX
#endif /* _WIN32 */
#ifdef LIBSIGC_UNIX
#undef SIGC_CXX_NAMESPACES
#undef SIGC_CXX_PARTIAL_SPEC
#undef SIGC_CXX_MEMBER_FUNC_TEMPLATES
#undef SIGC_CXX_MEMBER_CLASS_TEMPLATES
#undef SIGC_CXX_MUTABLE
#undef SIGC_CXX_FRIEND_TEMPLATES
#undef SIGC_CXX_TEMPLATE_CCTOR
#undef SIGC_CXX_INT_CTOR
#undef SIGC_CXX_VOID_RETURN
#undef SIGC_CXX_SPECIALIZE_REFERENCES
#undef SIGC_PTHREADS
#undef SIGC_PTHREAD_DCE
#ifdef SIGC_PTHREADS
#undef SIGC_PTHREAD_COND_ATTR
#undef SIGC_PTHREAD_COND_IMPL
#undef SIGC_PTHREAD_MUTEX_ATTR
#undef SIGC_PTHREAD_MUTEX_IMPL
#undef SIGC_PTHREAD_THREAD_ATTR
#undef SIGC_PTHREAD_THREAD_IMPL
#undef SIGC_PTHREAD_KEY_IMPL
#endif /* SIGC_PTHREADS */
#endif /* LIBSIGC_UNIX */
#ifdef LIBSIGC_BC
#define SIGC_CXX_NAMESPACES 1
#define SIGC_CXX_PARTIAL_SPEC 1
#define SIGC_CXX_MEMBER_FUNC_TEMPLATES 1
#define SIGC_CXX_MEMBER_CLASS_TEMPLATES 1
#define SIGC_CXX_MUTABLE 1
#define SIGC_CXX_FRIEND_TEMPLATES 1
#define SIGC_CXX_INT_CTOR 1
#define SIGC_CXX_VOID_RETURN 1
#define SIGC_CXX_SPECIALIZE_REFERENCES 1
#endif /* LIBSIGC_BC */
#ifdef LIBSIGC_MSC
#define SIGC_CXX_NAMESPACES 1
#define SIGC_CXX_MEMBER_FUNC_TEMPLATES 1
#define SIGC_CXX_MEMBER_CLASS_TEMPLATES 1
#define SIGC_CXX_MUTABLE 1
#define SIGC_CXX_TEMPLATE_CCTOR 1
#define SIGC_CXX_INT_CTOR 1
#endif /* LIBSIGC_MSC */
#ifdef LIBSIGC_WIN32
#ifdef LIBSIGC_EXPORTS
#define LIBSIGC_API __declspec(dllexport)
#define LIBSIGC_TMPL
#else
#define LIBSIGC_API __declspec(dllimport)
#define LIBSIGC_TMPL extern
#endif /* LIBSIGC_EXPORTS */
#else
#define LIBSIGC_API
#endif /* LIBSIGC_WIN32 */
#endif /* _SIGC_CONFIG_H_ */

View File

@ -1,38 +0,0 @@
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sigc++/bind.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif //SIGC_CXX_NAMESPACES
void AdaptorSlot_::copy_callback(SlotData* sdata,AdaptorNode* node)
{
sdata->list_.insert_direct(sdata->list_.begin(),node);
int i;
char *p1=(char*)&(node->data_),*p2=(char*)&(sdata->data_);
for (i=0;i<sizeof(Callback_)/sizeof(char);i++)
{ *p1=*p2; p1++; p2++; }
}
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif

View File

@ -1,43 +0,0 @@
// -*- c++ -*-
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _SIGC_ADAPTOR_H_
#define _SIGC_ADAPTOR_H_
#include <sigc++/slot.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
struct LIBSIGC_API AdaptorNode : public SlotNode
{
Callback_ data_;
};
struct LIBSIGC_API AdaptorSlot_
{
static void copy_callback(SlotData* sdata,AdaptorNode* node);
};
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif

View File

@ -1,71 +0,0 @@
// -*- c++ -*-
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sigc++/basic_signal.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif //SIGC_CXX_NAMESPACES
Signal_::Impl::Impl():incoming_(),outgoing_() {}
Signal_::Impl::~Impl() {}
Signal_::Signal_()
:impl(0)
{}
Signal_::~Signal_()
{
delete impl;
}
bool Signal_::empty() const
{
return (!impl||impl->outgoing_.empty());
}
void Signal_::clear()
{
if (impl)
impl->outgoing_.clear();
}
SlotData* Signal_::out_connect(SlotData *sd)
{
// we now reference the object
sd->connect();
// insert in list
if (!impl) impl=new Impl();
impl->outgoing_.insert_direct(impl->outgoing_.begin(),sd->sender());
return sd;
}
SlotData* Signal_::in_connect()
{
SlotData* sd=manage(new SlotData());
if (!impl) impl=new Impl();
impl->incoming_.insert_direct(impl->incoming_.end(),sd->receiver());
return sd;
}
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif

View File

@ -1,641 +0,0 @@
## (C) 1998 Stephan Kulow
## Modified by Tero Pulkkinen
## Modified by Karl Nelson
## Modified by makeLyXsigc.sh (Allan Rae)
AC_INIT(slot.cc)
AC_DEFUN(LYX_FIX_MAKEFILE_IN,[
## modify Makefile.in if need be -- since we still use automake
for dir in $srcdir $srcdir/macros ; do
( cd $dir ;
sed < Makefile.in > Makefile_tmp \
-e 's/all: all-redirect/all: all-@USE_INCLUDED_SIGC@\
all-yes: all-redirect\
all-no:/' ;
mv Makefile_tmp Makefile.in )
done
])
LYX_FIX_MAKEFILE_IN
define(AC_PUSH_LIB,[dnl
ifdef([__LIB__],,[define([__LIB__],0)])dnl
ac_save_LIBS[]__LIB__="$LIBS"
define([__LIB__],builtin(eval,(__LIB__ + 1)))dnl
LIBS="$1"])
define(AC_POP_LIB,[dnl
define([__LIB__],builtin(eval,(__LIB__ - 1)))dnl
LIBS="$ac_save_LIBS[]__LIB__"])
dnl
dnl Source packaging numbers
SIGC_MAJOR_VERSION=1
SIGC_MINOR_VERSION=0
SIGC_MICRO_VERSION=3
dnl Library extension
SIGC_RELEASE=1.0
SIGC_VERSION=$SIGC_MAJOR_VERSION.$SIGC_MINOR_VERSION.$SIGC_MICRO_VERSION
#
# +1 : ? : +1 == new interface that does not break old one
# +1 : ? : 0 == new interface that breaks old one
# ? : ? : 0 == no new interfaces, but breaks apps
# ? :+1 : ? == just some internal changes, nothing breaks but might work
# better
# CURRENT : REVISION : AGE
LIBSIGC_SO_VERSION=0:0:0
AC_SUBST(LIBSIGC_SO_VERSION, $LIBSIGC_SO_VERSION)
AC_SUBST(SIGC_RELEASE, $SIGC_RELEASE)
AC_SUBST(SIGC_VERSION)
AC_DEFINE_UNQUOTED(SIGC_MAJOR_VERSION, $SIGC_MAJOR_VERSION)
AC_DEFINE_UNQUOTED(SIGC_MINOR_VERSION, $SIGC_MINOR_VERSION)
AC_DEFINE_UNQUOTED(SIGC_MICRO_VERSION, $SIGC_MICRO_VERSION)
AC_CONFIG_AUX_DIR(../config)
dnl For automake.
VERSION=$SIGC_VERSION
PACKAGE=libsigc++
dnl Initialize automake stuff
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
dnl Specify a configuration file
AM_CONFIG_HEADER(sigc++config.h)
AC_ARG_WITH([included-libsigc],
[ --without-included-libsigc
Use the libsigc++ installed on the system
Used when libsigc++ is bundled with applications],
[sigc_use_included_libsigc=$withval],
[sigc_use_included_libsigc=yes])
if test x$sigc_use_included_libsigc = xno; then
## just change the setting for the Makefile
USE_INCLUDED_SIGC=no
AC_SUBST(USE_INCLUDED_SIGC)
else
###
### This else..fi goes till the end of the file!
###
USE_INCLUDED_SIGC=yes
AC_SUBST(USE_INCLUDED_SIGC)
AC_ARG_ENABLE(threads,
[ --enable-threads enables support threading.],
enable_threads=$enableval,enable_threads="no")
AC_ARG_ENABLE(checks,
[ --disable-checks disables unnecessary tests needed for bug reports.],
enable_checks=$enableval,enable_checks="yes"
)
AC_PROG_CC
AC_PROG_CPP
AM_DISABLE_SHARED
dnl Instruct build of dll for cygwin (libtool 1.3)
dnl Exports screw up badly on libtool 1.3, backing off to 1.2f
dnl A C_LIBTOOL_WIN32_DLL
dnl libtool does all checks with $CC, not with $CXX
dnl maybe this should be fixed in libtool, not here
AM_PROG_LIBTOOL
dnl On FreeBSD 3.0 (and perhaps some other systems) GNU m4 is
dnl called `gm4' where `m4' is the system's own m4.
AC_CHECK_PROGS(M4, gm4 m4, m4)
AC_PROG_CXX
AC_LANG_CPLUSPLUS
dnl Checking if linker supports global constructors
dnl This is largely information for me if someone files a bug report
if test "X$enable_checks" = "Xyes"; then
AC_MSG_CHECKING([if linker supports global constructors])
cat > mylib.$ac_ext <<EOF
#include <stdio.h>
struct A
{A() {printf("PASS\n");}
};
A a;
int foo()
{return 1;}
EOF
cat > mytest.$ac_ext <<EOF
#include <stdio.h>
extern int foo();
int main(int argc,char **argv)
{
int i=foo();
if (i!=1) printf("FAIL\n");
}
EOF
sh libtool --mode=compile $CXX -c mylib.$ac_ext >&5
sh libtool --mode=link $CXX -o libtest.la -rpath / -version-info 0 mylib.lo >&5
$CXX -c $CFLAGS $CPPFLAGS mytest.$ac_ext >&5
sh libtool --mode=link $CXX -o mytest mytest.o libtest.la >&5 2>/dev/null
if test -x mytest; then
myresult=`./mytest`
if test "X$myresult" = "XPASS"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN([
===================================================================
WARNING: This platform lacks support of construction of global
objects in shared librarys. Although not required by this library,
this is a serious problem for building C++ libraries. You will not
be able to use any shared libraries that contain global objects with
contructors.
See ftp://rtfm.mit.edu/pub/usenet/news.answers/g++-FAQ/plain
for details about this problem. Also for possible solutions
http://www.informatik.uni-frankfurt.de/~fp/Tcl/tcl-c++/tcl-c++.html
===================================================================
])
fi
else
AC_MSG_RESULT(unknown)
fi
rm -f mylib.* mytest.* libtest.la .libs/libtest* mytest .libs/mytest >&5
fi
AC_MSG_CHECKING(if C++ compiler uses std namespace )
AC_TRY_COMPILE(
[
#include <iostream>
namespace std{ void kludge(); }
using namespace std;
],[
cout << "test" << endl;
],[
ac_std_namespace=yes
AC_MSG_RESULT([yes])
],[
ac_std_namespace=maybe
])
if test "x$ac_std_namespace" = xmaybe ; then
AC_TRY_COMPILE(
[
#include <iostream.h>
namespace std{ void kludge(); }
using namespace std;
],[
cout << "test" << endl;
],[
ac_std_namespace=yes
AC_MSG_RESULT([yes])
AC_MSG_WARN([
===================================================================
WARNING: This compiler platform does not have the iostream library
in the std namespace. This presents a problem for writing portable
STL code. To run the demos, you will need to place a file with the
following in a file called "iostream" in your include directory.
---------------------------iostream--------------------------------
#ifndef IOSTREAM_KLUDGE
#define IOSTREAM_KLUDGE
#include <iostream.h>
namespace std { void iostream_kludge(); };
#endif
===================================================================
])
],[
ac_std_namespace=no
AC_MSG_RESULT([no])
AC_MSG_WARN([
===================================================================
WARNING: This compiler platform does not support iostream
or namespaces. You will not be able to run the demos as they
use STL. This does not affect use of the library, only the demos.
===================================================================
])
])
fi
dnl
dnl C++ compiler feature check start here
AC_MSG_CHECKING(if C++ compiler supports bool (required))
AC_TRY_COMPILE(
[
],[
bool b=true;
bool b1=false;
],[
ac_bool=yes
AC_MSG_RESULT([$ac_bool])
],[
config_error=yes
AC_MSG_RESULT([$ac_bool])
AC_WARN(bool type is not supported by your compiler)
])
AC_MSG_CHECKING([if C++ compiler supports const_cast<> (required)])
AC_TRY_COMPILE(
[
class foo;
],[
const foo *c=0;
foo *c1=const_cast<foo*>(c);
],[
ac_const_cast=yes
AC_MSG_RESULT([$ac_const_cast])
],[
AC_MSG_RESULT([$ac_const_cast])
AC_WARN(C++ compiler const_cast<> does not work)
config_error=yes
])
# Member function templates
AC_MSG_CHECKING(if C++ compiler supports member function templates)
AC_TRY_COMPILE(
[
class foo
{
public:
template <class T> void method(T t);
};
template <class T> void foo::method(T t) {t = 0;}
],[
],[
ac_member_func_templates=yes
AC_DEFINE(SIGC_CXX_MEMBER_FUNC_TEMPLATES)
AC_MSG_RESULT([$ac_member_func_templates])
],[
ac_member_func_templates=no
AC_MSG_RESULT([$ac_member_func_templates])
config_error=yes
AC_MSG_WARN([Test for member templates failed. This disables some methods that requires member template support. If your compiler should support member templates, see config.log to figure out why the test failed.])
])
# Member class templates
AC_MSG_CHECKING(if C++ compiler supports member class templates)
AC_TRY_COMPILE(
[
struct S
{
template <class T> struct A {};
template <class T> struct B {};
};
],[
],[
ac_member_class_templates=yes
AC_DEFINE(SIGC_CXX_MEMBER_CLASS_TEMPLATES)
AC_MSG_RESULT([$ac_member_class_templates])
],[
ac_member_class_templates=no
AC_MSG_RESULT([$ac_member_class_templates])
AC_MSG_WARN([Test for member templates failed. This disables some methods that requires member template support. If your compiler should support member templates, see config.log to figure out why the test failed.])
])
# Mutable
AC_MSG_CHECKING(if C++ compiler supports mutable)
AC_TRY_COMPILE(
[
class k {
mutable char *c;
public:
void foo() const { c=0; }
};
],[
],[
ac_cxx_mutable=yes
AC_DEFINE(SIGC_CXX_MUTABLE)
],[
ac_cxx_mutable=no
])
AC_MSG_RESULT([$ac_cxx_mutable])
# Partial Specialization
AC_MSG_CHECKING([if C++ compiler supports partial specialization(required)])
AC_TRY_COMPILE(
[
template<class T, class K>
class k {
public:
};
template<class T> class k<void,T> { };
],[
k<float, float> b;
k<void,void> a;
],[
ac_cxx_partial_specialization=yes
AC_MSG_RESULT([$ac_cxx_partial_specialization])
AC_DEFINE(SIGC_CXX_PARTIAL_SPEC)
],[
config_error=yes
ac_cxx_partial_specialization=no
AC_MSG_RESULT([$ac_cxx_partial_specialization])
AC_MSG_WARN([Partial specialization is needed for signal templates.])
])
AC_MSG_CHECKING(if C++ compiler supports name spaces)
AC_TRY_COMPILE(
[
namespace Check
{
int i;
}
],[
Check::i=1;
],[
ac_cxx_namespaces=yes
AC_MSG_RESULT([$ac_cxx_namespaces])
AC_DEFINE(SIGC_CXX_NAMESPACES)
],[
ac_cxx_namespaces=no
AC_MSG_RESULT([$ac_cxx_namespaces])
AC_MSG_WARN([Without namespaces all classes will be global.])
])
AC_MSG_CHECKING(if C++ compiler supports friend template)
AC_TRY_COMPILE(
[
struct A
{
template <class T>
friend T* gen();
};
],[
],[
ac_cxx_friend_templates=yes
AC_MSG_RESULT([$ac_cxx_friend_templates])
AC_DEFINE(SIGC_CXX_FRIEND_TEMPLATES)
],[
ac_cxx_friend_templates=no
AC_MSG_RESULT([$ac_cxx_friend_templates])
AC_MSG_WARN([Access to dynamic will not be controlled.])
])
AC_MSG_CHECKING(if C++ compiler has intrinsic constructors)
AC_TRY_COMPILE(
[
template<class T>
struct A
{ T t;
A(): t() {}
};
A<int> i;
],[
],[
AC_DEFINE(SIGC_CXX_INT_CTOR)
ac_cxx_tmpl_intctor=yes
],[
ac_cxx_tmpl_intctor=no
])
AC_MSG_RESULT([$ac_cxx_tmpl_intctor])
AC_MSG_CHECKING(if C++ compiler uses template copy ctor)
AC_TRY_COMPILE(
[
template <class T>
struct A
{
A(const A&) {}
template <class T1>
A(const T1&) {}
};
],[
],[
ac_cxx_template_cctor=no
],[
AC_DEFINE(SIGC_CXX_TEMPLATE_CCTOR)
ac_cxx_template_cctor=yes
])
AC_MSG_RESULT([$ac_cxx_template_cctor])
AC_MSG_CHECKING(if C++ compiler allows void returns)
AC_TRY_COMPILE(
[
void g(int *p)
{}
void h(int *p)
{return g(p);}
],[
],[
ac_cxx_void_return=yes
AC_DEFINE(SIGC_CXX_VOID_RETURN)
],[
ac_cxx_void_return=no
])
AC_MSG_RESULT([$ac_cxx_void_return])
AC_MSG_CHECKING(if C++ compiler allows specialization of references)
AC_TRY_COMPILE(
[
struct A {};
struct B {};
template <class T>
struct P
{
typedef A* ptr;
};
template <class T>
struct P<T&>
{
typedef B* ptr;
};
],[
A* a;
B* b;
P<int>::ptr p=a;
P<int&>::ptr q=b;
],[
ac_cxx_specialize_references=yes
AC_DEFINE(SIGC_CXX_SPECIALIZE_REFERENCES)
],[
ac_cxx_specialize_references=no
])
AC_MSG_RESULT([$ac_cxx_specialize_references])
dnl unused at the moment, disabled
dnl mirko, 99/1/15
dnl AC_MSG_CHECKING(if C++ compiler supports qualification of return types with templates)
dnl AC_TRY_COMPILE(
dnl [
dnl template<class T>
dnl class foo {
dnl public:
dnl typedef int iterator;
dnl iterator begin();
dnl };
dnl template<class T> foo<T>::iterator foo<T>::begin() { }
dnl ],[
dnl foo<int> f;
dnl f.begin();
dnl ],[
dnl ac_template_qualification=yes
dnl ],[
dnl AC_DEFINE(SIGC_CXX_NO_TEMPLATE_QUALIFICATION)
dnl ac_template_qualification=no
dnl ])
dnl AC_MSG_RESULT([$ac_template_qualification])
dnl unused at the moment, disabled
dnl mirko, 99/1/15
dnl AC_MSG_CHECKING(if C++ compiler supports static data inside templates)
dnl AC_TRY_LINK(
dnl [
dnl template<class T>
dnl class foo { public: static T a; };
dnl template<class T>
dnl static T foo<T>::a=0;
dnl ],[
dnl foo<int> b;
dnl ],[
dnl ac_static_templates=yes
dnl ],[
dnl AC_DEFINE(SIGC_CXX_NO_STATIC_TEMPLATES)
dnl ac_static_templates=no
dnl ])
dnl AC_MSG_RESULT([$ac_static_templates])
AC_MSG_CHECKING(if C++ environment provides all required features)
if test "x$config_error" = xyes ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Your compiler is not powerful enough to compile libsigc++. If it should be, see config.log for more information of why it failed.])
fi
AC_MSG_RESULT([yes])
dnl
dnl PTHREADS
dnl
AC_CHECK_HEADER(pthread.h,,[enable_threads="no"])
if test "x$enable_threads" = "xyes" ; then
enable_threads="no"
AC_CHECK_LIB(pthread,pthread_self,[enable_threads="yes";THREAD_LIB="-lpthread"])
AC_CHECK_LIB(cma,pthread_self,[enable_threads="yes";THREAD_LIB="-lcma"])
AC_PUSH_LIB($THREAD_LIB)
AC_CHECK_FUNC(pthread_keycreate,[AC_DEFINE(SIGC_PTHREAD_DCE)])
AC_POP_LIB()
AC_SUBST(THREAD_LIB)
fi
AC_MSG_CHECKING(if should compile with pthreads)
if test "x$enable_threads" = "xyes" ; then
AC_DEFINE(SIGC_PTHREADS)
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([sizes of threading elements])
# Check for size of threading elements so that we don't expose
# the implementation
AC_TRY_RUN([
#include <stdio.h>
#include <pthread.h>
#ifdef SIGC_PTHREAD_DCE
typedef pthread_condattr_t CondAttr;
typedef pthread_mutexattr_t MutexAttr;
typedef pthread_attr_t ThreadAttr;
#else
typedef pthread_condattr_t* CondAttr;
typedef pthread_mutexattr_t* MutexAttr;
typedef pthread_attr_t* ThreadAttr;
#endif
typedef pthread_mutex_t MutexImpl;
typedef pthread_cond_t CondImpl;
typedef pthread_key_t KeyImpl;
typedef pthread_t ThreadImpl;
int main()
{
FILE *fptr;
fptr=fopen("ac_thread.sh","w");
fprintf(fptr,"ac_thread_cond_attr_size=%d\n",sizeof(CondAttr));
fprintf(fptr,"ac_thread_cond_impl_size=%d\n",sizeof(CondImpl));
fprintf(fptr,"ac_thread_mutex_attr_size=%d\n",sizeof(MutexAttr));
fprintf(fptr,"ac_thread_mutex_impl_size=%d\n",sizeof(MutexImpl));
fprintf(fptr,"ac_thread_thread_attr_size=%d\n",sizeof(ThreadAttr));
fprintf(fptr,"ac_thread_thread_impl_size=%d\n",sizeof(ThreadImpl));
fprintf(fptr,"ac_thread_key_impl_size=%d\n",sizeof(KeyImpl));
return 0;
}
],[
. ./ac_thread.sh
rm ac_thread.sh
AC_MSG_RESULT(found)
],[
AC_MSG_RESULT(failed)
AC_ERROR(
[Could not compile a program with threads, please see config.log for details.
])
],
[
AC_MSG_RESULT(cross)
if test ! -f ac_thread.h; then
echo '
ac_thread_cond_attr_size=
ac_thread_cond_impl_size=
ac_thread_mutex_attr_size=
ac_thread_mutex_impl_size=
ac_thread_thread_attr_size=
ac_thread_thread_impl_size=
ac_thread_key_impl_size=
' > ./ac_thread.sh
AC_MSG_ERROR(
[You are attempting a cross compile, but the necessary information regarding
your thread library is not available. Please fill out the ac_thread.sh file.
])
else
. ./ac_thread.sh
fi
])
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_COND_ATTR,$ac_thread_cond_attr_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_COND_IMPL,$ac_thread_cond_impl_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_MUTEX_ATTR,$ac_thread_mutex_attr_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_MUTEX_IMPL,$ac_thread_mutex_impl_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_THREAD_ATTR,$ac_thread_thread_attr_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_THREAD_IMPL,$ac_thread_thread_impl_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_KEY_IMPL,$ac_thread_key_impl_size)
else
AC_MSG_RESULT([no])
fi
###
### This is the end of the massive if..then..else..fi
###
fi
AC_OUTPUT([Makefile
sigc-config
macros/Makefile
],[chmod a+x sigc-config])

View File

@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@ -1,141 +0,0 @@
Object & Handles
=================
In order for a signal to be connected to object, the object must
have Object somewhere in its inheritence tree.
class virtual Object
{
public:
bool is_dynamic();
bool is_floating();
Object();
virtual ~Object();
};
Objects are
- Reference counted
- Capable of deleting self if told to be managed.
Handles are used for internal memory management. They are a signature not
a real class so they can incapsulate any class that has the necessary
functions.
signature class Handle<ObjType,Policy>
{
public:
operator ObjType*();
ObjType operator *();
ObjType* operator ->();
bool connected();
Handle& operator =(ObjType*);
Handle& operator =(ObjType&);
Handle& operator =(const Handle<O,P> &);
Handle(ObjType*);
Handle(ObjType&);
Handle(const Handle<O,P>&);
};
Slots
======
Slots are an encapsulation of a callable object. A factory called slot()
builds Slots from object/methods, static functions and signals.
class Slot#<rettype,ARGS>: public Object
{
public:
rettype call(ARGS);
Slot#()
virtual ~Slot#()
};
Slots build up in a tree to contain a wide number of connection types.
There is a class of functions call Adaptors. Adaptors take a slot
and alter it to a different profile.
Planned adaptors
bind - bind callback data starting from the end.
extend - add dummy arguments to the end of a slot.
convert - convert the calling arguments with a function.
Internally slots are just handles to an internal abstract slot
type called Slot#_, which is a pimple on SlotData.
Slots can not be duplicated as they may have a large list of internal
data. You should not reuse a slot in multiple lists.
Signals
=======
A list of slots can be called with a signal. A signal is considered a
slot container.
class Signal#<RETURN,ARGS,Policy>
{
public:
typedef Slot#<RETURN,ARGS> InSlotType;
typedef Slot#<MARSH_RETURN,ARGS> OutSlotType;
OutSlotType slot();
Connection connect(InSlotType& s);
MARSH_RETURN emit(ARGS);
MARSH_RETURN operator()(ARGS); // alias for emit
Signal();
Signal(InSlotType& );
~Signal();
};
Two typedefs are specified InSlotType and OutSlotType. InSlotType
is the type taken by this signal for connections. OutSlotType
is the type of slot this function returns and is determented by
the Marshaller. In most cases InSlotType and OutSlotType match,
but this is not necessarily the case. Signals do not need to
have these typedefs, but it eases building new Signal classes from
them.
The basic methods shown there are
emit - call all slots contained within.
slot - give away a slot that receive incoming calls.
connect - insert a slot into the call list.
Slots are removed by calling disconnect on their connections.
There is also the ablity to have a marshaller that takes care of handling
signal callbacks. This functionality is dependent on the implementation
of the signal. For the basic signal type, the marshaller is a hidden
template parameter.
Connect() may also take optional implementation dependent arguments
for specifying behavior. For example, timeout.connect(slot(&foo),10)
where the second argument it a time in seconds is a good use of
optional connect flags.
Additional functionality may optionally be defined such as
ablity to check if there are any signals attached (empty()) or
remove all connected signals (clear()). However these are
not a requirement and are implementation dependent.
Connections
=============
Connections are given to the user on each connect to allow individual
connections to be broken or altered.
class Connection
{
public:
void disconnect();
Connection();
};
They are a handle to the data, so when the last connection goes away and
the slot is not yet properly held in a Signal the slot will go away.

View File

@ -1,4 +0,0 @@
Karl E. Nelson <kenelson@ece.ucdavis.edu>
Tero Pulkkinen <terop@students.cc.tut.fi>

View File

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -1,481 +0,0 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -1,44 +0,0 @@
This is a list of questions and answers that I have collected from
messages to my mailbox
---------------------------------------------------------------------
Q: Why isn't sigc++config.h installed with the rest of the headers?
A: Traditionally include files that are dependent on the compiler
or srchitecture belong under lib trees and not the include tree.
This allows machines to share include directories on large multiuser
systems.
Examples:
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.57/include
/usr/lib/glib/include
/usr/lib/qt/include
To access that file you should include a -I PREFIX/lib/sigc++/include
in your compiler switchs.
This can be done for you automatically through the use of
the sigc-config script.
c++ myfile.cc `sigc-config --cflags --libs`
Last, if you really don't like this just symlink the file into
PREFIX/include. (Don't copy or the next version of libsigc++
very likely won't work right!)
Q: Why on Visual C++ can do I get piles of errors when trying to
use classes which contain Signals?
A: Visual C++ requires all classes which are parameterized to be
explicitely exported. This is the same problem encountered
when using STL classes in VC++. Microsoft Knowledge Base
article Q168958 contains the solution.
(http://support.microsoft.com/support/kb/articles/Q168/9/58.ASP)
You will need to create an export file with all the signals,
slots, and parameterized functions explicitely instantiated
and include it in your library source. (Anyone have an example
of this?)

View File

@ -1,25 +0,0 @@
Libsigc++ - A Signal Framework for C++
Provides following features:
* compile time typesafe callbacks (faster than run time checks)
* typesafty violations line number reports correctly with
template names (no tracing template failures into headers)
* no compiler extensions or meta compilers required
* proper handling of dynamic objects and signals
(deleted objects will not cause seg faults)
* extendable API at any level
Slot, Connection, Object, and Signal
* extensions do not require alteration of basic components
to allow use of extensions
* User definable marshallers
* provides headers for up to 7 arguments and 2 callback data
* M4 Macros for building templates with various numbers
of arguements and callback data
* Easily build support for templates with number of arguments
and callback data not defined in library headers

View File

@ -1,8 +0,0 @@
Add back functionality for slot(Obj&,func) and slot(Obj*,func).
Get advanced signal code going. (with recursion checks and rest)
Get mapped signal code going. (anonymous union mapping to a class)
Add a cache to the Scope code so that it can be used for a
weak reference.

View File

@ -1,119 +0,0 @@
Here is a reference to the UML class diagram symbols:
(Taken from a number of sources.)
Class
-----
A Class description containing a
____________
| Class Name |
|------------|
| Attributes |
|------------|
| Operations |
|____________|
Association
-----------
An association represents a physical or conceptual connection
betwen objects. This is represented by a line between the two objects.
If the association has a name it would often be written on top.
AssocName
Class1 ----------- Class2
There is a possiblity of a multidirectional association that would be
represented by a diamond connecting the related sets.
Class1 -----<O>---- Class3
|
Class2
Arrows can be used to indicate the navigablity of a association.
So an arrow from one class to another would indicate that Class1
uses the services of Class2 but Class2 is not aware of Class1.
It also indicates that nature of Class2 scope. Since there
is no aggregation relationship here, Class2 may outlive Class1
instances. This would be used to indicate a pointer or reference
relationship.
Class1 -------> Class2
In some places it is necessary to represent that a Class can
be associated with a set instead of a single instance. This
will be represented by a star at the end of the association.
Class1 ------->* Class2
Composition (Strong Aggregation)
---------
This means that Class2 is a part of Class1. It is a strong form
of aggregation in that when Class1 is destroyed Class2 goes with it.
The symbol for a composition relationship is a diamond filled to an arrow.
Class1 <*>-----> Class2
Aggregation
-----------
A weaker form of aggregation than composition is represented with
an unfilled diamond. It still demotes the life time of Class2 is
restricted to Class1, but Class2 is not part of Class1. This may
be implemented by a pointer in Class1 to Class2 with the dtor
destroying Class2.
Class1 <>------> Class2
Inheritance
-----------
Inheratance is indicated with an triangle pointing up to the
class form which the other derives. (Having no triangles a
A will do.)
Class1
A
|
Class2
So now a quick example:
+--> Shape
| A
parent_ | |
| | points_
+--- Polygon <>------------->* Point
This would indicate that a Polygon is derived from a Shape. It also
indicates that Polygon can have a reference to a Shape. Further,
Polygon contains a set of Points that it is responsible for.
This might be implemented like
class Shape
{//...
};
class Polygon: public Shape
{
private:
Shape* parent_;
list<auto_ptr<Point>> points_;
public:
//...
};
References:
UML Class Diagrams
Robert C. Martin
Engineering Notebook Column
C++ Report, August, 1997
http://www.oma.com/PDF/umlClassDiagrams.pdf
OML Object Model
http://wwwis.cs.utwente.nl:8080/dmrg/MEE/misop007/

View File

@ -1,25 +0,0 @@
Okay here are the conventions for this project.
macros - all caps (MY_MACRO)
enum - same as macros
classes - cap each word lower others (Signal)
private classes - same as class with underscore or trailing _ (BasicSignal_Impl)
function - lowercase with underscore (foo_bar())
methods - lowercase with underscore (m.foo_bar())
data - lowercase (m.mydata)
private data - lowercase with trailing underscore (m.mydata_)
Namespaces are used where possible.
If namespaces are not available use a class to fake it unless
that is not allowed.
Format is GNU or modified GNU (indent first bracket)
class MyClass
{
MyClass();
}

View File

@ -1,80 +0,0 @@
Here are some UML diagrams of the relationships in Libsigc++:
Scopes, Handles, Objects:
------------------------
_________ scope_ _____________
| Scope |*<-------<> | Object_Impl |
| | obj_ | |
|_________|----------> | |
A (obj) | |
| +----> | |
| | |_____________|
| | A
__________ | |
________ scope_ | Limit |<>--+ *
|Handle |<*>------>| | _____________
| <Limit>| |__________| | Object |
| | | |
| | (obj) | |
| | (<>----------------------->) | |
|________| |_____________|
Okay here is what you are supposed to get out of this.
Object comes from Object_Impl with multiplicity (VI).
Handle<Limit> in this case forms a virtual aggregate relationship
with the Object it points to.
For future diagrams I would reduce this to
Handle<Limit> <>--------> Object
Other handle relationships are formed with different types of
scopes. Reference Count for example would have the same
diagram (but very different behavior.)
There is also a relation when the pointed to
object deletes itself when the object is removed. This is
a dependency that will be written as
A -----><> B
BasicSignal:
-----------
____________________ incoming_
| BasicSignal_::InOut| <>----------->* Slot
| |
| | outgoing_
|____________________| <>----------->* Slot
A
|
|
---------------------
| BasicSignal# |
| |
|_____________________|
It is clear from here that a BasicSignal is formed from a number of different
objects.
Connections between a BasicSignal and a Object method:
---------- ________
| SlotData | | Object |
|__________| |________|
A A
| |
| |
___________ _____________ |
|BasicSignal| outgoing_ | ObjectSlot# | ----------
|___________|<>-------->*| | | MyObject |
| |-------><>| |
___________ | | |__________|
|Connection |----------> |_____________|
|___________|

View File

@ -1,95 +0,0 @@
1.0 Marshallers
===============
Marshallers offer the opportunity to control the emittion process, and
collate return values. By default signals have a marshaller which does
nothing, and throws away all but the last return value.
A marshaller can be any class with:
struct SomeMarshal
{
// both typedefs must be defined.
typedef Type1 InType;
typedef Type2 OutType;
// Return final return code.
OutType value();
// Return value if marshaller does not get built
static OutType default_value();
// Captures return codes and returns TRUE to stop emittion.
bool marshal(const InType&);
SomeMarshal();
};
The function marshal() will be called with the return value of each slot
connected to the signal as they are called. The emittion process can be
stopped by marshal() returning true.
Once all the slots have been called, value() is called to determine what
to return to the emitter. If the signal gets called and there is
nothing attached the default_value() is used.
2.0 Possible uses
=================
A marshaller could stop emittion when the signal had been handled:
struct StopOnTrue
{
typedef bool InType;
typedef bool OutType;
OutType return_value_;
OutType value() { return return_value_; }
static OutType default_value() { return false; }
bool marshal(const InType& val) { return_value_ = val; return val; }
StopOnTrue() : return_value_(false) {}
};
marshal() here returns true as soon as one of the things connected to the
signal returns true. It also keeps track of whether anything stopped the
emittion in the return_value_ member. This way when something emits the
signal, it can tell whether the signal was dealt with (signal.emit()
returns true) or not (signal.emit() returns false).
Now, if OutType was a list or a vector, marshal() could push_back() all
the values, returning to the emitter all the return values rather than just
one.
3.0 Standard Marshallers
========================
The following marshallers are provided by default.
Marshal<void>
Marshal<T>
Marshal<R> (untested, may not be portable)
FixedMarshal<T,V>
FastMarshal<T>
where
- T can be a type, class, or pointer
- R can be a reference
- V is the initial value of the marshaller
which is returned if nothing is connected.
All of the standard defined marshallers, with the exception of
FastMarshal, check for a possiblity of a skipped return code via
RetCode::check_ignore(). You can cause a return code to be
ignored by the marshaller by setting RetCode::ignore() prior to returning
to a function. Please note that you must be sure that you are returning to
signal call to use ignore(). Calling at other times may result in other
functions incorrectly skipping.
The check_ignore function is thread safe which may induce
unnecessary delays in slot calling. To avoid this overhead
either define the signal to have a void return or
use a FastMarshal.
(This will all be replaced by an exeption mechanism at some point;
however, current compiler technology is too slow for this to
work.)

View File

@ -1,96 +0,0 @@
The following things are be available to powerusers.
- changing the return type of a slot
- changing the paramete types of slot
- signal overloading
- mixed type signals
=======================================================================
* Slot type changing
Slots can be made to change their input types based on a static function.
Example:
// write some conversion functions
int convert_mysignal_c(Callback1<int,const char*> *s,const string &str)
{return s->call(str.c_str());}
Slot1<int,const string&> myconvert(const Slot1<int,const char*> &s)
{return convert(s,convert_mysignal_c);}
Signal1<int,const string&> mysignal;
int foo(const char*);
mysignal.connect(myconvert(slot(foo));
* Signal overloading
One signal can have multiple behavior for a single signal name.
This is done with multiple inheritance.
Example:
class MyClass
{
public:
class MySig
:public Signal1<int,int>,
public Signal1<void,double>
{} mysig;
} myclass;
int foo(int);
void foo2(double);
myclass.mysig.connect(slot(foo));
myclass.mysig.connect(slot(foo2));
myclass.mysig(1); // calls foo
myclass.mysig(1.0); // calls foo2
* Mixed type signals
A signal can be made to accept a wide group of slots with similar data
types.
Example:
class A
{
public:
class MySig: public Signal1<int,string&>
{
static int _mysig_convert(Callback1<int,const char*> *s,
const string &str)
{return s->call(str.c_str());}
public:
Connection connect(const Slot1<int,const char*> &s)
{return connect(convert(s,_mysig_convert));}
} mysig;
};
int foo(const char* c);
int foo2(string& s);
mysig.connect(slot(foo)); // this is acceptable
mysig.connect(slot(foo2)); // this is also acceptable
string h="hello";
mysig(h); // calls both foo and foo2.
Still in works
----------------
* Signal overloading over classes
This should be extendable accross different levels of a class.
Example: (details still in progress)
* Signals with translation
Signals can be made to convert and proxy accross other systems.

View File

@ -1,145 +0,0 @@
The following things are required for Libsigc++.
A good compiler with the following features
- capable of handling numerous templates (>200)
- proper template specialization
- proper partial specialization
It works better with (but does not require)
- template friend specialization
- namespaces
- void returns
M4 to parse the header files if you wish to rebuild the headers from
macro source.
==================================================
Platform Issues:
A number of platforms do not support global C++ objects
in shared libraries. Although not required by this
library, it may result in problems when building C++
libraries on those platforms. The work arround is
to use statics in functions or pointers which must
be initialized.
Platforms known to have this bug include
NetBSD, HP-UX 9, HP-UX 10, Solaris without patch.
==================================================
Compiler Issues:
Cfront-based compilers: Fails
-----
Forget it, get a modern c++ compiler.
GNU G++ 2.7.2: Fails
-----
Upgrade, new versions of GNU G++ are easily and freely available:
GNU G++ 2.8.X or EGCS 1.1.2. A port to this compiler is possible
with effort.
GNU G++ 2.8: Works (Marginal)
namespaces: no
partial specialization: yes
void returns: yes
-----
Is known to work correctly, but some performance may be subpar.
Recommend upgrading to egcs 1.1.
GNU egcs 1.0: Works (Marginal)
namespaces: no
partial specialization: yes
void returns: yes
-----
Is known to work correctly, but some performance may be subpar.
Recommend upgrading to egcs 1.1.
GNU egcs 1.1: Works
namespaces: yes
partial specialization: yes
void returns: yes
-----
This is the development platform, so all functionality correct.
HP C++: Fails
-----
This is a cfront compiler. No where close.
Get a modern c++ compiler.
HP aC++ A.01.22: Works
namespaces: yes
partial specialization: yes
void returns: yes (only most recent version)
-----
HP improved template support thus allowing compilation.
Earlier compilers lacked support for void returns and proper
templates.
Missing <iostream> - use one below
MipsPro 7.3 Compler on Irix: Works (Marginal)
namespaces: yes
partial specialization: yes
void returns: no
-----
This compiler is barely within the range of usable compilers.
Requires compiling a specialization for all types in library
due to non-standard return behavior. Should be usable.
Requires a switch to get templates right.
Use
CC=cc CXX=CC CPPFLAGS="-ptused" ./configure
Missing <iostream> - use one below
SunPro C++ 4.1: Unknown
namespaces: no
partial specialization: no
-----
Unlikely considering lack of partial specialization.
Need more info.
SunPro C++ 5.0: Unknown
namespaces: yes
partial specialization: yes
-----
Need more info.
Visual C++ 5.0: Works (needs special distribution)
namespaces: yes
partial specialization: no
void returns: no
-----
Although not quite up to par, a port was completed and should
be the basis for porting back to other earlier compilers.
VC++ lacks the ablity to use optional class arguments so
marshallers must be explicitly declared. (see doc/win32)
==================================================
Some compilers have not yet fully adopted the standard header
files. (Usually because they lack some compiler feature
required for the standard header.) For those compilers a
kludge is necessary to make the same code compile on both
standard and non-standard headers. Add the following file
to the standard include path.
#ifndef IOSTREAM_KLUDGE
#define IOSTREAM_KLUDGE
#include <iostream.h>
namespace std { void iostream_kludge(); };
#endif

View File

@ -1,315 +0,0 @@
1.0 Signals
==============
Signals are used for communication between objects. Rather
that using messy pointers or pointers to member functions to implement
callbacks this library provides an elegant connection framework for
connecting between static functions, member functions and function objects.
To add to this all types of connections can be made with compile time
type checking through an extensable template set. Unlike other solutions
that break the C++ language and add incompatible extensions or code
generation, Libsigc++ uses only the standard C++ definitions. Thus it
will not decrease the ability of tools designed to parse the C++ language
to handle your code. Libsigc++ provides signal framework which solves
your problems with communication between objects. This signal framework
makes your objects reusable components which are independent of other
objects it communicates with. This means reducing coupling between
objects and resulting less dependencies and thus more reusable code.
1.1 How does the communication work?
------------------------------------
In the callback mechanism there's 3 separate entities involved.
sender
receiver
someone making connection between sender and receiver
In actual code, the sender specifies an interface which it can call when
it wants to tell other objects something. This interface is specified as
a function object and is called "Signal". Calling that interface is
called "emitting a signal".
The receiver of the signal can be almost anything. In Libsigc++ the
following objects can receive messages:
member function of any object derived from SigC::Object
function object derived from SigC::Object
static, global or friend function
static function object
member function to a static object
All connections share a common syntax through a factory that creates a
abstract function object called a "Slot."
signal.connect(slot(object,Object::&method));
signal.connect(slot(&function));
signal.connect(functionobject.slot())
Making a connection connects sender to the receiver. After that, if the
sender emits a signal, all methods, functions and function objects that
have been connected to that signal are called with the arguments given at
signal emission. Signature of both sender interface and receiver method
must match exactly to be able to make connection between them. If there's
type mismatches in the signatures, C++ compiler will give compile time
type error.
2.0 Implementation of signals
=============================
Signals are C++ function objects. Because signals are normal C++-objects,
you can use them in file scope, in function local scope - but they're
most used inside class scope. A signal definition is of form:
Signal2<void, int, float> buttonPressed;
where
2 = number of arguments
void = type of the return
int = type of the first parameter of the signal
float = type of the 2nd parameter of the signal
This way application programmers can specify interface for a signal.
A connection from a signal to a (member) function matching signal's
interface can be made:
void my_function(int param1, float param2);
buttonPressed.connect(slot(&my_function));
If the function is a member function, you'll need to specify the object
too. Note that this object's class needs to be derived from Signal:
MyClass myobject;
buttonPressed.connect(slot(myobject,&MyClass::my_function));
If the signal is inside an object, you'll need to specify it too:
obj.buttonPressed.connect(slot(myobject, &MyClass::my_function));
When connection between a signal and a function has been made, calling
the signal will make the system call all the connected functions with
given parameters. Of course many connections can be made to same signal
and the system will call all of them when the signal is called.
Calling a signal looks exactly like calling normal C++ function:
buttonPressed(10, 20.0);
or in case where you have the signal inside an object, call is in format:
obj.buttonPressed(10, 20.0);
An alternative method with a function name is also provided with
a method emit. This is to make it easier to distiguish and provides
a method name for STL connection calls.
obj.buttonPressed.emit(10, 20.0);
2.1 Signals with return types
------------------------------
All signals have a return type which may be void.
Signal1<int,int> signal;
That signal can be connected to the methods with the following signature:
int my_callback(int);
There are a few restrictions on the types of returns. Return
types must have:
a default constructor T t;
a copy constructor T t1,t2; t1=t2;
a reference form T t1; void func(T& t); func(t1);
A default ctor is required so that a temporary object can be
created to hold the return type. A copy constructor is required
so that the signal can be marshalled. A reference form is required
to pass the return types to the marshaller functions.
This means that the return type must not be a reference itself.
2.2 Connecting to a signals
-----------------------------
Because Libsigc++ signals use function objects heavily, there needs to be
way to connect a signal to another signal. Lets connect a button's
clicked()-signal to another button's clicked signal:
struct My_Button
{
Signal0<void> clicked;
} b1,b2;
b1.clicked.connect(b2.clicked.slot());
2.3 Summery
------------
Here is the summery of the properties of a signal
class Signal<Rettype,Args>
{
public:
Connection connect(const Slot<Rettype Args>&);
Slot<Rettype,Args> slot();
Rettype emit(Args);
Rettype operator()(Args);
};
Where:
Rettype is the return type of the signal.
Args are the arguments taken.
connect() inserts a slot with the same profile into the signal.
slot() returns a slot for connecting this signal to another.
emit() calls all slots in the signal.
3.0 Common errors in use of the signals
=======================================
Here are some common errors and an example of some of the errors that
they generate. (Do not take this as an example of proper use!
Errors similified for clarity. Your compiler messages will differ)
* Signature of function does not match signal
Return type?
arguments have correct type?
the signal has correct types?
Example error session:
void foo(int i);
Signal1<int,int> sig;
sig.connect(slot(foo));
>>foobar.cc: In function `int main()':
>>foobar.cc:17: no matching function for call to
`Signal1<int,int>::connect (Slot1<void,int> *)'
^^^^^^^^^^^^^^^^
Signiture of function
>>signal.h: candidates are:
Signal1<int,int>::connect<int, int> (Slot1<int,int> *)
^^^^^^^^^^^^^^
Signiture of Signal
* Using a reference as a return type
Example error session:
Signal1<int&,int> sig;
>>basic_signal.h: In method `int & Signal1_<int &,int>::Impl::
emit<int &, int>(int)':
>>signal.h:100: instantiated from here
>>basic_signal.h:244: `rc' declared as reference but not initialized
* Connecting object is not derived from SigC::Object
Example error session:
struct A {int foo(int);} a;
Signal1<int,int> sig;
sig.connect(slot(a,&A::foo));
foobar.cc:58: conversion from `A' to non-scalar type `Object' requested
* Forgot to name the connected function as a method.
Example error session:
struct A:public SigC::Object {int foo(int);} a;
Signal1<int,int> sig;
sig.connect(slot(a,foo)); // should be sig.connect(slot(a,&A::foo));
>>foobar.cc:47: no matching function for call to `slot (A &, int ()(int))'
* Forgot to use address of method on connection
Example error session:
struct A:public SigC::Object {int foo(int);} a;
Signal1<int,int> sig;
sig.connect(slot(a,A::foo)); // should be sig.connect(slot(a,&A::foo));
>> foobar.cc:23: warning: assuming & on `A::foo1(int)'
* Passed a pointer as object (**This is different from Gtk--**)
Example error session:
struct A:public SigC::Object {int foo(int);} a;
Signal1<int,int> sig;
sig.connect(slot(&a,&A::foo)); // should be sig.connect(slot(a,&A::foo));
>>foobar.cc:93: conversion from `A *' to non-scalar type `Object'
requested
>>object_slot.h:177: in passing argument 1 of
`slot<A, int, int>(Object &, int (A::*)(int))'
4.0 Connections
===============
4.1 Disconnecting signals
-------------------------
Every signal.connect()-function returns a Connection object,
which can be stored and it can be used to disconnect the connection
by calling function disconnect().
Connection c;
c=o.buttonPressed.connect(slot(&myfunction));
...
c.disconnect();
Its perfectly legal to just ignore the return value of connect() functions -
all bookeeping information used by signal system is released properly.
5.0 Adaptors
============
Often it is desirable to connect to a function and a signal
in which the signal and function signatures are not
exactly the same.
For example, it would be good to ignore the return type
of a function when placing it into a signal with a void return
type.
Fortunately, Libsigc++ provides a mechanism to accomplish this
type of connection. There is a broad class of slot "Adaptors".
These functions take a slot of one type and produce a slot of
another. Here are some sample adaptors provided:
bind(Slot, v1) - Passes v1 as last argument to Slot
(The number of arguments is reduced for the resulting slot)
bind(Slot, v1, v2) - Passes v1 and v2 as last arguments to Slot
Examples:
int func(float);
Signal1<void,float> sig1;
Signal1<int> sig2;
// cover up float argument
sig2.connect(bind(slot(&func),20.0f));

View File

@ -1,46 +0,0 @@
Libsigc++ compiles and runs under win32 (windows 95 and NT)
with the cygwin package available from Cygnus Solutions.
(http://sourceware.cygnus.com), Borland Builder 6 or Visual C++ 5.
Notes for egcs:
- A simlink is required from /bin/sh to $(CGYWIN_HOME)/bin/sh
for configure to run.
- A bug in libtool results in compiling the dll stubs with the
wrong compiler which results in a minor error. To fix
this, a repaired version of ltdll.c is distributed.
- The dll fails to compile with libtool >1.2d as a result of
a bug in libtool. A bug report of this is outstanding.
(use static libraries til fixed)
Notes for Microsoft Visual C++:
Microsoft Visual C++ does not provide partial specialization of
classes at this time which is a requirement for the regular
version of the library. Also it requires the format of the
package to be different then that of the standard GNU package.
A special distribution is therefore required.
Two project files for building the library and its tests
are located under the win32 directory. libsigc.dsp builds the
shared dll for the library. wintest.dsp builds a simple
test that runs through all the libraries features.
Unlike other platforms, VC++ does not support default
template arguments properly. Thus the marshaller for
signals (normally hidden) must be explicitly specified.
The files distributed with .cc extension require modification.
(To compile from CVS which uses native Unix .cc extensions
you can use the instructions found on
http://depc14.gsi.de/hades/msdev-cc-ending.htm)
Exporting another library using libsigc++ can be
fun because VC++ requires every symbol to appear
in the DLL that it uses. This is a well known problem and
is documented in the Microsoft Knowledge Base. The
instructions for exporting libsigc++ are basically the
same as those of STL class in Article #Q168958.
(http://support.microsoft.com/support/kb/articles/Q168/9/58.ASP)

View File

@ -1,113 +0,0 @@
#ifndef SIGCXX_HANDLE_H
#define SIGCXX_HANDLE_H
#include <sigc++/sigc++config.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
// Signiture for Handles
template <class Obj,class Scope_>
class Handle
{
protected:
Scope_ scope_;
public:
// access
Obj* obj()
{
return static_cast<Obj*>(scope_.cache());
}
Obj* obj() const
{
return static_cast<Obj*>(scope_.cache());
}
bool connected() const
{return (scope_.object()!=0);}
operator Obj*()
{return (obj());}
operator Obj*() const
{return (obj());}
Obj& operator*() const
{return *(obj());}
Obj* operator->() const
{return (obj());}
Scope_& scope()
{return scope_;}
const Scope_& scope() const
{return scope_;}
void disconnect()
{scope_.disconnect(0);}
// copy
Handle& operator =(Obj* obj)
{scope_.set(obj,obj,true); return *this;}
Handle& operator =(Obj& obj)
{scope_.set(&obj,&obj,false); return *this;}
#ifndef SIGC_CXX_TEMPLATE_CCTOR
Handle& operator =(const Handle& handle)
{
Obj *o=handle.obj();
scope_.set(o,o,false);
return *this;
}
#endif
template <class Obj2,class Scope2>
Handle& operator = (const Handle<Obj2,Scope2>& handle)
{
Obj *o=handle.obj();
scope_.set(o,o,false);
return *this;
}
// construct
Handle():scope_() {}
Handle(Obj *obj):scope_() {scope_.set(obj,obj,true);}
Handle(Obj &obj):scope_() {scope_.set(&obj,&obj,false);}
#ifndef SIGC_CXX_TEMPLATE_CCTOR
Handle(const Handle& handle)
:scope_()
{
Obj *o=handle.obj();
scope_.set(o,o,false);
}
#endif
template <class Obj2,class Scope2>
Handle(const Handle<Obj2,Scope2>& handle)
:scope_()
{
Obj *o=handle.obj();
scope_.set(o,o,false);
}
};
#define HANDLE_CTORS(X,T,P) \
public: \
X(T *t):Handle<T,P>(t) {} \
X(T &t):Handle<T,P>(t) {} \
template <class T2,class P2> \
X(const Handle<T2,P2> &h):Handle<T,P>(h) {} \
X& operator =(T *t) \
{return Handle<T,P>::operator=(t);} \
X& operator =(T &t) \
{return Handle<T,P>::operator=(t);} \
template <class T2,class P2> \
X& operator =(const Handle<T2,P2> &t) \
{return Handle<T,P>::operator=(t);}
//template <class T>
// class Ref:public Handle<T,Scopes::RefCount>
// {
// HANDLE_CTORS(Ref,T,Scopes::RefCount)
// };
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif

View File

@ -1,4 +0,0 @@
#include <sigc++/object.h>
#include <sigc++/scope.h>
#include <sigc++/handle.h>

View File

@ -1,21 +0,0 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include <stdio.h>
extern "C" {
BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
}
#include <cygwin/cygwin_dll.h>
DECLARE_CYGWIN_DLL( DllMain );
HINSTANCE __hDllInstance_base;
BOOL APIENTRY
DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
{
__hDllInstance_base = hInst;
return TRUE;
}

View File

@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@ -1,17 +0,0 @@
all-local:
templates = \
template.macros.m4 slot.h.m4 \
func_slot.h.m4 class_slot.h.m4 object_slot.h.m4 \
basic_signal.h.m4 \
bind.h.m4 rettype.h.m4 convert.h.m4 \
retbind.h.m4
noinst_HEADERS = $(templates)
EXTRA_DIST = README $(templates)
MAINTAINERCLEANFILES=$(srcdir)/Makefile.in

View File

@ -1,50 +0,0 @@
This directory contains files associated with building large numbers
of templates needed to represent different numbers of parameters.
The file signal.macros.m4 defines all necessary macros for construction
of templates with variable arguments.
These files will be placed in $(INCLUDE_DIR)/sigc++/macros for
reuse.
Requires:
Gnu M4 (others m4 may work)
Macros of particular interest:
IF(arg1,arg2[,arg3]) - if arg1 non-zero length print arg2, else arg3
LIST(arg0,cond0 [,arg1,cond1]) - generates comma seperated list with
conditions for each argument
ARG_CLASS([P1,P2, ... ]) - generates string "class P1,class P2"
ARG_BOTH([P1,P2, ... ]) - generates string "P1 p1,P2 p2"
ARG_TYPE([P1,P2, ... ]) - generates string "P1,P2"
ARG_NAME([P1,P2, ... ]) - generates string "p1,p2"
[name]NUM(arg) - prints name#, where # is items in arg
ARGS(P,n) - generates string [P1,P2,...Pn]
example:
To generalize this...
template<class P1,class P2> // needs to be inline for zero arguments
void Foo::func2(int (*f)(P1,P2),P1 p1,P2 p2)
{func(p1,p2);
}
Use this...
include(template.macros.m4)
define([FOO_FUNC],
[
IF([$1],template<ARG_CLASS($1)>,inline)
void Foo::[func]NUM($1)(LIST(int (*f)(ARG_TYPE($1)),1,ARG_BOTH($1),[$1]))
{func(ARG_NAME($1));
}
])
FOO_FUNC(ARGS(P,0))
FOO_FUNC(ARGS(P,1))
FOO_FUNC(ARGS(P,2))
(to prove it m4 this README file. Honest!)

View File

@ -1,228 +0,0 @@
dnl
dnl Basic Signal Templates
dnl
dnl Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
// -*- c++ -*-
dnl Ignore the next line
/* This is a generated file, do not edit. Generated from __file__ */
include(template.macros.m4)
#ifndef __header__
#define __header__
#include <sigc++/marshal.h>
#include <sigc++/slot.h>
QT_FIREWALL
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
/****************************************************************
***** Signals (build by macros)
****************************************************************/
// common part to all signals
class LIBSIGC_API Signal_
{
private:
Signal_(const Signal_&);
protected:
typedef ScopeList List;
struct LIBSIGC_API Impl
{
typedef ScopeList List;
List incoming_;
List outgoing_;
Impl();
~Impl();
};
Impl *impl;
SlotData* in_connect();
SlotData* out_connect(SlotData *s);
Signal_();
~Signal_();
public:
bool empty() const;
void clear();
};
dnl
dnl BASIC_SIGNAL([P1, P2, ...])
dnl
define([BASIC_SIGNAL],
[/****************************************************************
***** Signal NUM($1)
****************************************************************/
LINE(]__line__[)dnl
template <LIST(class R,1,ARG_CLASS($1),[$1],[typename Marsh=Marshal<R> ],1)>
class [Signal]NUM($1):public Signal_
{
public:
typedef __SLOT__(R,[$1]) InSlotType;
typedef __SLOT__(typename Marsh::OutType,[$1]) OutSlotType;
private:
#ifdef SIGC_CXX_PARTIAL_SPEC
typedef typename Marsh::OutType SType;
typedef R RType;
#else
typedef Trait<typename Marsh::OutType>::type SType;
typedef Trait<R>::type RType;
#endif
typedef typename InSlotType::Callback Callback;
typedef [Signal]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1],Marsh,1)> Self;
typedef CallDataObj2<typename OutSlotType::Func,Self> CallData;
static SType callback(LIST(void* d,1,ARG_BOTH($1),[$1]))
{
CallData* data=(CallData*)d;
return data->obj->emit(ARG_NAME($1));
}
public:
OutSlotType slot()
{
SlotData* tmp=in_connect();
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
data.callback=(typename OutSlotType::Func)callback;
data.obj=this;
return tmp;
}
Connection connect(const InSlotType &s)
{
return out_connect(s.data());
}
SType emit(ARG_REF($1));
SType operator()(ARG_REF($1))
{return emit(ARG_NAME($1));}
[Signal]NUM($1)() {}
[Signal]NUM($1)(const InSlotType &s) {connect(s);}
~[Signal]NUM($1)() {}
};
// emit
template <LIST(class R,1,ARG_CLASS($1),[$1],class Marsh,1)>
typename [Signal]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1],Marsh,1)>::SType [Signal]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1],Marsh,1)>::
emit(ARG_REF($1))
{
if (!impl||impl->outgoing_.empty()) return Marsh::default_value();
List &out=impl->outgoing_;
Marsh rc;
SlotData *data;
List::Iterator i=out.begin();
while (i!=out.end())
{
data=((SlotDependent*)(i.node()))->parent();
++i;
Callback& s=(Callback&)(data->callback());
if (rc.marshal(s.call(ARG_NAME($1)))) return rc.value();
}
return rc.value();
}
#ifdef SIGC_CXX_PARTIAL_SPEC
template <LIST(ARG_CLASS($1),[$1],[class Marsh],1)>
class [Signal]NUM($1)<LIST(void,1,ARG_TYPE($1),[$1],Marsh,1)>
:public Signal_
{
public:
typedef __SLOT__(void,[$1]) InSlotType;
typedef __SLOT__(void,[$1]) OutSlotType;
private:
typedef ifelse([$1],,,[typename ])InSlotType::Callback Callback;
typedef [Signal]NUM($1)<LIST(void,1,ARG_TYPE($1),[$1],Marsh,1)> Self;
typedef CallDataObj2<ifelse([$1],,,[typename ])OutSlotType::Func,Self> CallData;
static void callback(LIST(void* d,1,ARG_BOTH($1),[$1]))
{
CallData* data=(CallData*)d;
data->obj->emit(ARG_NAME($1));
}
public:
OutSlotType slot()
{
SlotData* tmp=in_connect();
CallData& data=reinterpret_cast<CallData&>(tmp->data_);
data.callback=callback;
data.obj=this;
return tmp;
}
Connection connect(const InSlotType &s)
{
return out_connect(s.data());
}
void emit(ARG_REF($1));
void operator()(ARG_REF($1))
{emit(ARG_NAME($1));}
[Signal]NUM($1)() {}
[Signal]NUM($1)(const InSlotType &s) {connect(s);}
~[Signal]NUM($1)() {}
};
// emit
template <LIST(ARG_CLASS($1),[$1],class Marsh,1)>
void [Signal]NUM($1)<LIST(void,1,ARG_TYPE($1),[$1],Marsh,1)>::
emit(ARG_REF($1))
{
if (!impl||impl->outgoing_.empty()) return;
List &out=impl->outgoing_;
SlotData *data;
List::Iterator i=out.begin();
while (i!=out.end())
{
data=((SlotDependent*)(i.node()))->parent();
++i;
Callback& s=(Callback&)(data->callback());
s.call(ARG_NAME($1));
}
}
#endif
])dnl
BASIC_SIGNAL(ARGS(P,0))
BASIC_SIGNAL(ARGS(P,1))
BASIC_SIGNAL(ARGS(P,2))
BASIC_SIGNAL(ARGS(P,3))
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
END_QT_FIREWALL
#endif // __header__

View File

@ -1,180 +0,0 @@
dnl
dnl Bind Slot Templates
dnl
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
// -*- c++ -*-
dnl Ignore the next line
/* This is a generated file, do not edit. Generated from __file__ */
include(template.macros.m4)
#ifndef __header__
#define __header__
/*
SigC::bind
-------------
bind() alters a Slot by fixing arguments to certain values.
Argument fixing starts from the last argument. The slot is
destroyed in the process and a new one is created, so references
holding onto the slot will no longer be valid.
Up to two arguments can be bound at a time with the default
header.
Simple Sample usage:
void f(int,int);
Slot2<void,int,int> s1=slot(f);
Slot1<void,int> s2=bind(s1,1); // s1 is invalid
s2(2); // call f with arguments 2,1
Multibinding usage:
void f(int,int);
Slot2<void,int,int> s1=slot(f);
Slot0<void> s2=bind(s1,1,2); // s1 is invalid
s2(); // call f with arguments 1,2
Type specified usage:
struct A {};
struct B :public A {};
B* b;
Slot0<void, A*> s1;
Slot0<void> s2=bind(s1, b); // B* converted to A*
*/
#include <sigc++/adaptor.h>
#include <sigc++/scope.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
define([FORMAT_ARG_CBASSIGN],[node->LOWER([$1])_=LOWER([$1]);])
define([FORMAT_ARG_CBNAME],[node->LOWER([$1])_])
define([FORMAT_ARG_CBBIND],[[$1] LOWER([$1])_;])
define([ARG_CBASSIGN],[PROT(ARG_LOOP([FORMAT_ARG_CBASSIGN],[[
]],$*))])
define([ARG_CBNAME],[PROT(ARG_LOOP([FORMAT_ARG_CBNAME],[[,]],$*))])
define([ARG_CBBIND],[PROT(ARG_LOOP([FORMAT_ARG_CBBIND],[[
]],$*))])
dnl
dnl ADAPTOR_BIND_SLOT([P1..PN],[C0..CM],[A0..AM])
dnl
define([ADAPTOR_BIND_SLOT],[dnl
/****************************************************************
***** Adaptor Bind Slot NUM($1) arguments, NUM($2) hidden arguments
****************************************************************/
ADAPTOR_BIND_SLOT_IMPL(R,[$1],[$2])
#ifndef SIGC_CXX_VOID_RETURN
#ifdef SIGC_CXX_PARTIAL_SPEC
ADAPTOR_BIND_SLOT_IMPL(void,[$1],[$2])
#endif
#endif
template <LIST(ARG_CLASS($3),[$3],[
]class R,1,[
]ARG_CLASS($1),[$1],[
]ARG_CLASS($2),[$2])>
inline
__SLOT__(R,[$1])
bind(const [Slot]eval(NUM($1)+NUM($2))<LIST(R,1,ARG_TYPE($1),[$1],ARG_TYPE($2),[$2])> &s,
ARG_BOTH($3))
{return [AdaptorBindSlot]NUM($1)[_]NUM($2)<LIST(R,1,[
]ARG_TYPE($1),[$1],[
]ARG_TYPE($2),[$2])>::create(s.data(),ARG_NAME($3));
}
])dnl
dnl
dnl ADAPTOR_BIND_SLOT_IMPL(R,[P1..PN],[C0..CN])
dnl
define([ADAPTOR_BIND_SLOT_IMPL],[dnl
LINE(]__line__[)dnl
ifelse($1,void,[dnl
template <LIST(ARG_CLASS($2),[$2],[
]ARG_CLASS($3),[$3])>
struct [AdaptorBindSlot]NUM($2)[_]NUM($3)
<LIST(void,1,ARG_TYPE($2),[$2],[
]ARG_TYPE($3),[$3])> : public AdaptorSlot_
],[dnl
template <LIST(class R,1,[
]ARG_CLASS($2),[$2],[
]ARG_CLASS($3),[$3])>
struct [AdaptorBindSlot]NUM($2)[_]NUM($3): public AdaptorSlot_
])dnl
{TYPEDEF_RTYPE($1,RType)
typedef __SLOT__($1,[$2]) SlotType;
typedef __SLOT__($1,[$2],[$3]) InSlotType;
struct Node:public AdaptorNode
{
ARG_CBBIND($3)
Node(ARG_BOTH($3))
: ARG_CBINIT($3)
{ }
};
typedef CallDataObj2<typename SlotType::Func,Node> CallData;
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
{
CallData* data=(CallData*)d;
Node* node=data->obj;
ifelse($1,void,,return) ((typename InSlotType::Callback&)(node->data_))(LIST(ARG_NAME($2),[$2],[
]ARG_CBNAME($3),[$3]));
}
static SlotData* create(SlotData *s,ARG_BOTH($3))
{
Node *node=new Node(ARG_NAME($3));
copy_callback(s,node);
CallData &data=reinterpret_cast<CallData&>(s->data_);
data.callback=&callback;
data.obj=node;
return s;
}
};
])dnl
ADAPTOR_BIND_SLOT(ARGS(P,0),ARGS(C,1),ARGS(A,1))
ADAPTOR_BIND_SLOT(ARGS(P,1),ARGS(C,1),ARGS(A,1))
ADAPTOR_BIND_SLOT(ARGS(P,2),ARGS(C,1),ARGS(A,1))
ADAPTOR_BIND_SLOT(ARGS(P,3),ARGS(C,1),ARGS(A,1))
ADAPTOR_BIND_SLOT(ARGS(P,0),ARGS(C,2),ARGS(A,2))
ADAPTOR_BIND_SLOT(ARGS(P,1),ARGS(C,2),ARGS(A,2))
ADAPTOR_BIND_SLOT(ARGS(P,2),ARGS(C,2),ARGS(A,2))
ADAPTOR_BIND_SLOT(ARGS(P,3),ARGS(C,2),ARGS(A,2))
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif

View File

@ -1,108 +0,0 @@
dnl
dnl Class Slot Templates
dnl
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
// -*- c++ -*-
dnl Ignore the next line
/* This is a generated file, do not edit. Generated from __file__ */
include(template.macros.m4)
#ifndef __header__
#define __header__
/*
SigC::slot_class() (class)
-----------------------
slot_class() can be applied to a class method to form a Slot with a
profile equivelent to the method. At the same time an instance
of that class must be specified. This is an unsafe interface.
This does NOT require that the class be derived from SigC::Object.
However, the object should be static with regards to the signal system.
(allocated within the global scope.) If it is not and a connected
slot is call it will result in a seg fault. If the object must
be destroyed before the connected slots, all connections must
be disconnected by hand.
Sample usage:
struct A
{
void foo(int,int);
} a;
Slot2<void,int,int> s=slot_class(a,&A::foo);
*/
#include <sigc++/object_slot.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
dnl
dnl CLASS_SLOT
dnl
define([CLASS_SLOT],[dnl
/****************************************************************
***** Class Slot NUM($1)
****************************************************************/
template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
struct [ClassSlot]NUM($1)_:public [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>
{
typedef [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)> Base;
typedef typename Base::InFunc InFunc;
static SlotData* create(Obj* obj,InFunc func)
{
if (!obj) return 0;
SlotData* tmp=manage(new SlotData());
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
data.callback=&callback;
data.obj=obj;
data.func=(Func)func;
return tmp;
}
};
template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
__SLOT__(R,[$1])
slot_class(Obj &obj,R (Obj::*func)(ARG_TYPE($1)))
{return [ClassSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>::create(&obj,func);
}
template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
__SLOT__(R,[$1])
slot_class(Obj *obj,R (Obj::*func)(ARG_TYPE($1)))
{return [ClassSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>::create(obj,func);
}
])dnl
CLASS_SLOT(ARGS(P,0))
CLASS_SLOT(ARGS(P,1))
CLASS_SLOT(ARGS(P,2))
CLASS_SLOT(ARGS(P,3))
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif

View File

@ -1,134 +0,0 @@
dnl
dnl Convert Slot Templates
dnl
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
// -*- c++ -*-
dnl Ignore the next line
/* This is a generated file, do not edit. Generated from __file__ */
include(template.macros.m4)
#ifndef __header__
#define __header__
/*
SigC::convert
-------------
convert() alters a Slot by assigning a conversion function
which can completely alter the parameter types of a slot.
Only convert functions for changing with same number of
arguments is compiled by default. See examples/custom_convert.h.m4
for details on how to build non standard ones.
Sample usage:
int my_string_to_char(Callback1<int,const char*> *d,const string &s)
int f(const char*);
string s=hello;
Slot1<int,const string &> s2=convert(slot(f),my_string_to_char);
s2(s);
*/
#include <sigc++/adaptor.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
dnl
dnl ADAPTOR_CONVERT_SLOT([P1..PN],[C0..CN])
dnl
define([ADAPTOR_CONVERT_SLOT],[dnl
/****************************************************************
***** Adaptor Convert Slot NUM($1)
****************************************************************/
ADAPTOR_CONVERT_SLOT_IMPL(R1,[$1],[$2])
#ifndef SIGC_CXX_VOID_RETURN
#ifdef SIGC_CXX_PARTIAL_SPEC
ADAPTOR_CONVERT_SLOT_IMPL(void,[$1],[$2])
#endif
#endif
template <LIST(class R1,1,ARG_CLASS($1),[$1],[
class R2],1,ARG_CLASS($2),[$2])>
__SLOT__(R1,[$1])
convert(const __SLOT__(R2,[$2]) &s,
[R1 (*func)](LIST([Callback]NUM($2)PROT(<LIST(R2,1,ARG_TYPE($2),[$2])>)*,1,ARG_TYPE($1),[$1])))
{return [AdaptorConvertSlot]NUM($1)[_]NUM($2)<LIST(R1,1,ARG_TYPE($1),[$1],[
R2],1,ARG_TYPE($2),[$2])>::create(s.obj(),func);
}
])dnl
dnl
dnl ADAPTOR_CONVERT_SLOT_IMPL(R,[P1..PN],[C0..CN])
dnl
define([ADAPTOR_CONVERT_SLOT_IMPL],[dnl
LINE(]__line__[)dnl
ifelse($1,void,[dnl
template <LIST(ARG_CLASS($2),[$2],[
class R2],1,ARG_CLASS($3),[$3])>
struct [AdaptorConvertSlot]NUM($2)[_]NUM($3)
<LIST(void,1,ARG_TYPE($2),[$2],[
R2],1,ARG_TYPE($3),[$3])>
: public AdaptorSlot_
],[dnl
template <LIST(class $1,1,ARG_CLASS($2),[$2],[
class R2],1,ARG_CLASS($3),[$3])>
struct [AdaptorConvertSlot]NUM($2)[_]NUM($3): public AdaptorSlot_
])dnl
{TYPEDEF_RTYPE($1,RType)
typedef __SLOT__($1,[$2]) SlotType;
typedef __SLOT__(R2,[$3]) InSlotType;
typedef typename InSlotType::Callback Callback;
typedef RType (*Func) (LIST(Callback*,1,ARG_TYPE($2),[$2]));
typedef $1 (*InFunc)(LIST(Callback*,1,ARG_TYPE($2),[$2]));
typedef CallDataObj3<typename SlotType::Func,Callback,Func> CallData;
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
{
CallData* data=(CallData*)d;
ifelse($1,void,,return) (data->func)(LIST(data->obj,1,ARG_NAME($2),[$2]));
}
static SlotData* create(SlotData *s,InFunc func)
{
SlotData* tmp=(SlotData*)s;
AdaptorNode *node=new AdaptorNode();
copy_callback(tmp,node);
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
data.callback=&callback;
data.func=(Func)func;
data.obj=(Callback*)&(node->data_);
return tmp;
}
};
])dnl
ADAPTOR_CONVERT_SLOT(ARGS(P,1),ARGS(Q,1))
ADAPTOR_CONVERT_SLOT(ARGS(P,2),ARGS(Q,2))
ADAPTOR_CONVERT_SLOT(ARGS(P,3),ARGS(Q,3))
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif

View File

@ -1,123 +0,0 @@
dnl
dnl Function slot templates
dnl
dnl Copyright (C) 1998 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
// -*- c++ -*-
dnl Ignore the next line
/* This is a generated file, do not edit. Generated from __file__ */
include(template.macros.m4)
#ifndef __header__
#define __header__
#include <sigc++/slot.h>
/*
SigC::slot() (function)
-----------------------
slot() can be applied to a function to form a Slot with a
profile equivelent to the function. To avoid warns be
sure to pass the address of the function.
Sample usage:
void foo(int,int);
Slot2<void,int,int> s=slot(&foo);
*/
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
// From which we build specific Slots and a set of
// functions for creating a slot of this type
dnl
dnl FUNCTION_SLOT([P1,P2,...])
dnl
define([FUNCTION_SLOT],[dnl
/****************************************************************
***** Function Slot NUM($1)
****************************************************************/
FUNCTION_SLOT_IMPL(R,[$1])
#ifndef SIGC_CXX_VOID_RETURN
#ifdef SIGC_CXX_PARTIAL_SPEC
FUNCTION_SLOT_IMPL(void,[$1])
#endif
#endif
template <LIST(class R,1,ARG_CLASS($1),[$1])>
inline __SLOT__(R,[$1])
slot(R (*func)(ARG_TYPE($1)))
{
return [FuncSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1])>::create(func);
}
])dnl
dnl
dnl FUNCTION_SLOT_IMPL(R,[P1,P2,...])
dnl
define([FUNCTION_SLOT_IMPL],[dnl
LINE(]__line__[)dnl
ifelse($1,void,[dnl
template <ARG_CLASS($2)>
struct [FuncSlot]NUM($2)_<LIST(void,1,ARG_TYPE($2),[$2])>
],[dnl
template <LIST(class R,1,ARG_CLASS($2),[$2])>
struct [FuncSlot]NUM($2)_
])dnl
{TYPEDEF_RTYPE($1,RType)
typedef $1 (*InFunc)(ARG_TYPE($2));
typedef RType (*Func)(ARG_TYPE($2));
typedef __SLOT__($1,[$2]) SlotType;
ifelse($1,void,[dnl
typedef CallDataFunc<IF([$2],[typename ])SlotType::Func,Func> CallData;
],[dnl
typedef CallDataFunc<typename SlotType::Func,Func> CallData;
])dnl
static RType callback(LIST(void* data,1,ARG_BOTH($2),[$2]))
{
ifelse($1,void,,return) (((CallData*)data)->func)(ARG_NAME($2));
}
static SlotData* create(InFunc func)
{
SlotData* tmp=manage(new SlotData());
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
data.callback=&callback;
data.func=(Func)func;
return tmp;
}
};
])dnl
FUNCTION_SLOT(ARGS(P,0))
FUNCTION_SLOT(ARGS(P,1))
FUNCTION_SLOT(ARGS(P,2))
FUNCTION_SLOT(ARGS(P,3))
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif // __header__

View File

@ -1,145 +0,0 @@
dnl
dnl Object Slot Templates
dnl
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
// -*- c++ -*-
dnl Ignore the next line
/* This is a generated file, do not edit. Generated from __file__ */
include(template.macros.m4)
#ifndef __header__
#define __header__
/*
SigC::slot() (obj)
-----------------------
slot() can be applied to a object method to form a Slot with a
profile equivelent to the method. At the same time an instance
of that object must be specified. The object must be derived
from SigC::Object.
Sample usage:
struct A: public SigC::Object
{
void foo(int,int);
} a;
Slot2<void,int,int> s=slot(a,&A::foo);
*/
#include <sigc++/slot.h>
#include <sigc++/scope.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
dnl
dnl OBJECT_SLOT
dnl
define([OBJECT_SLOT],[dnl
/****************************************************************
***** Object Slot NUM($1)
****************************************************************/
OBJECT_SLOT_IMPL(R,[$1])
#ifndef SIGC_CXX_VOID_RETURN
#ifdef SIGC_CXX_PARTIAL_SPEC
OBJECT_SLOT_IMPL(void,[$1])
#endif
#endif
template <LIST(class R,1,ARG_CLASS($1),[$1],[class O,class O2],1)>
inline __SLOT__(R,[$1])
slot(O* &obj,R (O2::*func)(ARG_TYPE($1)))
{
return [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],O2,1)>
::create(obj,func);
}
template <LIST(class R,1,ARG_CLASS($1),[$1],[class O,class O2],1)>
inline __SLOT__(R,[$1])
slot(O* const &obj,R (O2::*func)(ARG_TYPE($1)))
{
return [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],O2,1)>
::create(obj,func);
}
template <LIST(class R,1,ARG_CLASS($1),[$1],[class O,class O2],1)>
inline __SLOT__(R,[$1])
slot(O &obj,R (O2::*func)(ARG_TYPE($1)))
{
return [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],O2,1)>
::create(&obj,func);
}
])dnl
dnl
dnl OBJECT_SLOT_IMPL(R,[P1,P2,...])
dnl
define([OBJECT_SLOT_IMPL],[dnl
LINE(]__line__[)dnl
ifelse($1,void,[dnl
template <LIST(ARG_CLASS($2),[$2],class Obj,1)>
struct [ObjectSlot]NUM($2)_<LIST(void,1,ARG_TYPE($2),[$2],Obj,1)>
],[dnl
template <LIST(class R,1,ARG_CLASS($2),[$2],class Obj,1)>
struct [ObjectSlot]NUM($2)_
])dnl
{TYPEDEF_RTYPE($1,RType)
typedef $1 (Obj::*InFunc)(ARG_TYPE($2));
typedef RType (Obj::*Func)(ARG_TYPE($2));
typedef __SLOT__($1,[$2]) SlotType;
typedef CallDataObj3<typename SlotType::Func,Obj,Func> CallData;
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
{
CallData* data=(CallData*)d;
ifelse($1,void,,return) ((data->obj)->*(data->func))(ARG_NAME($2));
}
static SlotData* create(Obj* obj,InFunc func)
{
if (!obj) return 0;
SlotData* tmp=manage(new SlotData());
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
data.callback=&callback;
data.obj=obj;
data.func=(Func)func;
obj->register_data(tmp->receiver());
return tmp;
}
};
])dnl
OBJECT_SLOT(ARGS(P,0))
OBJECT_SLOT(ARGS(P,1))
OBJECT_SLOT(ARGS(P,2))
OBJECT_SLOT(ARGS(P,3))
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif

View File

@ -1,157 +0,0 @@
dnl
dnl Bind Slot Templates
dnl
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl Copyright (C) 2000 Carl Nygard <cnygard@bellatlantic.net>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
// -*- c++ -*-
dnl Ignore the next line
/* This is a generated file, do not edit. Generated from __file__ */
/* This was also shamelessly copied, hacked, munched, and carefully
* tweaked from KNelson's original bind.h.m4
* CJN 3.22.00
*/
include(template.macros.m4)
#ifndef __header__
#define __header__
/*
SigC::retbind
-------------
retbind() alters a Slot by fixing the return value to certain values
Return value fixing ignores any slot return value. The slot is
destroyed in the process and a new one is created, so references
holding onto the slot will no longer be valid.
Typecasting may be necessary to match arguments between the
slot and the binding return value. Types must be an exact match.
To insure the proper type, the type can be explicitly specified
on template instantation.
Simple Sample usage:
void f(int,int);
Slot2<void,int,int> s1=slot(f);
Slot1<int,int,int> s2=retbind(s1,1); // s1 is invalid
cout << "s2: " << s2(2,1) << endl;
Type specified usage:
struct A {};
struct B :public A {};
B* b;
Slot1<void> s1;
Slot0<A*> s2=retbind<A*>(s1,b); // B* must be told to match A*
*/
#include <sigc++/adaptor.h>
#include <sigc++/scope.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
dnl
dnl ADAPTOR_RETBIND_SLOT([P1..PN])
dnl
define([ADAPTOR_RETBIND_SLOT],[dnl
/****************************************************************
***** Adaptor RetBind Slot NUM($1) arguments
****************************************************************/
ADAPTOR_RETBIND_SLOT_IMPL(R,[$1])
#ifndef SIGC_CXX_VOID_RETURN
#ifdef SIGC_CXX_PARTIAL_SPEC
ADAPTOR_RETBIND_SLOT_IMPL(void,[$1])
#endif
#endif
template <LIST(class Ret,1,[
]class R,1,[
]ARG_CLASS($1),[$1])>
__SLOT__(Ret,[$1])
retbind(const [Slot]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1])> &s,
Ret ret)
{return [AdaptorRetBindSlot]NUM($1)<LIST(Ret,1,R,1,[
]ARG_TYPE($1),[$1])>::create(s.data(),ret);
}
])dnl
dnl
dnl ADAPTOR_RETBIND_SLOT_IMPL(R,[P1..PN])
dnl
define([ADAPTOR_RETBIND_SLOT_IMPL],[dnl
LINE(]__line__[)dnl
ifelse($1,void,[dnl
template <LIST(class Ret,1,ARG_CLASS($2),[$2])>
struct [AdaptorRetBindSlot]NUM($2)
<LIST(Ret,1,void,1,[
]ARG_TYPE($2),[$2])> : public AdaptorSlot_
],[dnl
template <LIST(class Ret,1,class $1,1,[
]ARG_CLASS($2),[$2])>
struct [AdaptorRetBindSlot]NUM($2): public AdaptorSlot_
])dnl
{TYPEDEF_RTYPE(Ret,RType)
typedef __SLOT__(Ret,[$2]) SlotType;
typedef __SLOT__($1,[$2]) InSlotType;
struct Node:public AdaptorNode
{
Ret ret_;
};
typedef CallDataObj2<typename SlotType::Func,Node> CallData;
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
{
CallData* data=(CallData*)d;
Node* node=data->obj;
((typename InSlotType::Callback&)(node->data_))(LIST(ARG_NAME($2),[$2]));
return node->ret_;
}
static SlotData* create(SlotData *s,Ret ret)
{
SlotData* tmp=(SlotData*)s;
Node *node=new Node();
copy_callback(tmp,node);
node->ret_ = ret;
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
data.callback=&callback;
data.obj=node;
return tmp;
}
};
])dnl
ADAPTOR_RETBIND_SLOT(ARGS(P,0))
ADAPTOR_RETBIND_SLOT(ARGS(P,1))
ADAPTOR_RETBIND_SLOT(ARGS(P,2))
ADAPTOR_RETBIND_SLOT(ARGS(P,3))
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif

View File

@ -1,145 +0,0 @@
dnl
dnl Adaptor Rettype Templates
dnl
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
// -*- c++ -*-
dnl Ignore the next line
/* This is a generated file, do not edit. Generated from __file__ */
include(template.macros.m4)
#ifndef __header__
#define __header__
/*
SigC::rettype
-------------
rettype() alters a Slot by changing the return type.
Only allowed conversions or conversions to void can properly
be implemented. The type must always be specified as a
template parameter.
Simple Sample usage:
int f(int);
Slot1<void,int> s1=rettype<void>(slot(&f));
Slot1<float,int> s2=rettype<float>(slot(&f));
*/
#include <sigc++/adaptor.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
define([FORMAT_ARG_CBASSIGN],[node->LOWER([$1])_=LOWER([$1]);])
define([FORMAT_ARG_CBNAME],[node->LOWER([$1])_])
define([FORMAT_ARG_CBBIND],[[$1] LOWER([$1])_;])
define([ARG_CBASSIGN],[PROT(ARG_LOOP([FORMAT_ARG_CBASSIGN],[[
]],$*))])
define([ARG_CBNAME],[PROT(ARG_LOOP([FORMAT_ARG_CBNAME],[[,]],$*))])
define([ARG_CBBIND],[PROT(ARG_LOOP([FORMAT_ARG_CBBIND],[[
]],$*))])
dnl
dnl ADAPTOR_RETTYPE_SLOT([P1..PN],[C0..CN])
dnl
define([ADAPTOR_RETTYPE_SLOT],[dnl
/****************************************************************
***** Adaptor Rettype Slot NUM($1)
****************************************************************/
ADAPTOR_RETTYPE_SLOT_IMPL(R1,[$1],[$2])
#ifndef SIGC_CXX_VOID_RETURN
#ifdef SIGC_CXX_PARTIAL_SPEC
ADAPTOR_RETTYPE_SLOT_IMPL(void,[$1],[$2])
#endif
#endif
LINE(]__line__[)dnl
template <LIST(class R1,1,class R2,1,ARG_CLASS($1),[$1])>
__SLOT__(R1,[$1])
rettype(const __SLOT__(R2,[$1]) &s)
{return [AdaptorRettypeSlot]NUM($1)_<LIST(R1,1,[
]ARG_TYPE($1),[$1],R2,1)>::create(s.obj());
}
])dnl
dnl
dnl ADAPTOR_RETTYPE_SLOT_IMPL(R,[P1..PN],[C0..CN])
dnl
define([ADAPTOR_RETTYPE_SLOT_IMPL],[dnl
LINE(]__line__[)dnl
ifelse($1,void,[dnl
template <LIST([
]ARG_CLASS($2),[$2],[
]class R2,1)>
struct [AdaptorRettypeSlot]NUM($2)[_]
<LIST(void,1,[
]ARG_TYPE($2),[$2],[
]R2,1)>
],[dnl
template <LIST(class R1,1,[
]ARG_CLASS($2),[$2],[
]class R2,1)>
struct [AdaptorRettypeSlot]NUM($2)[_]
])dnl
: public AdaptorSlot_
{TYPEDEF_RTYPE($1,RType)
typedef __SLOT__($1,[$2]) SlotType;
typedef __SLOT__(R2,[$2]) InSlotType;
typedef AdaptorNode Node;
typedef CallDataObj2<typename SlotType::Func,Node> CallData;
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
{
CallData* data=(CallData*)d;
Node* node=data->obj;
ifelse($1,void,[dnl
((typename InSlotType::Callback&)(node->data_))(ARG_NAME($2));
],[dnl
return RType(((typename InSlotType::Callback&)(node->data_))(ARG_NAME($2)));
])dnl
}
static SlotData* create(SlotData *s)
{
SlotData* tmp=(SlotData*)s;
Node *node=new Node();
copy_callback(tmp,node);
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
data.callback=&callback;
data.obj=node;
return tmp;
}
};
])dnl
ADAPTOR_RETTYPE_SLOT(ARGS(P,0))
ADAPTOR_RETTYPE_SLOT(ARGS(P,1))
ADAPTOR_RETTYPE_SLOT(ARGS(P,2))
ADAPTOR_RETTYPE_SLOT(ARGS(P,3))
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif

View File

@ -1,370 +0,0 @@
dnl
dnl Abstract Slot templates
dnl
dnl Copyright (C) 1998 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
// -*- c++ -*-
dnl Ignore the next line
/* This is a generated file, do not edit. Generated from __file__ */
include(template.macros.m4)
#ifndef __header__
#define __header__
/*
This file just gives the basic definition of Slots.
Callback# is the 4 byte data necessary for representing all
callback types.
CallData is a specific interpretation of the Callback data.
Slot_ is a pimple on SlotData containing an Object for
holding its referencees, a Dependency that removes the slot
when its caller or receiver die, and a Callback.
Slot is a handle to a Slot_.
*/
#include <sigc++/sigc++config.h>
#include <sigc++/type.h>
#include <sigc++/object.h>
#include <sigc++/handle.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
// Base node for a polymorphic list of "extra" data needed
// by various slots.
struct LIBSIGC_API SlotNode
{
void *next_;
SlotNode();
virtual ~SlotNode()=0;
};
struct LIBSIGC_API SlotIterator_
{
typedef SlotNode NodeType;
typedef SlotIterator_ Iterator;
NodeType *node_;
NodeType* node() {return node_;}
const NodeType* node() const {return node_;}
NodeType& operator*()
{return *node_;
}
const NodeType& operator*() const
{return *node_;
}
bool operator==(const Iterator& i) const
{return node_==i.node_;
}
bool operator!=(const Iterator& i) const
{return node_!=i.node_;
}
Iterator& operator++()
{
if (node_)
node_=(NodeType*)node_->next_;
return *this;
}
Iterator operator++(int)
{Iterator tmp=*this;
++*this;
return tmp;
}
Iterator& operator= (const Iterator& i)
{
node_=i.node_;
return *this;
}
SlotIterator_():node_(0) {}
SlotIterator_(NodeType *node):node_(node) {}
};
// This is a list for storing internal data for slots
struct LIBSIGC_API SlotList_
{
typedef SlotNode NodeType;
typedef SlotIterator_ Iterator;
NodeType* head_;
Iterator begin() {return ((NodeType*)head_);}
Iterator end() {return Iterator();}
const Iterator begin() const {return ((NodeType*)head_);}
const Iterator end() const {return Iterator();}
// this is best used at the begining of list.
Iterator insert_direct(Iterator pos,NodeType *n);
void clear();
bool empty() const {return head_==0;}
SlotList_():head_(0)
{}
~SlotList_()
{clear();}
private:
SlotList_(const SlotList_&);
};
struct SlotData;
// SlotDependent is an internal of SlotData used to unreference the
// Slot when either the sender or receiver have gone away
struct LIBSIGC_API SlotDependent:public ScopeNode
{
struct LIBSIGC_API Dep: public ScopeNode
{
SlotData *parent;
virtual void erase();
Dep() {}
virtual ~Dep();
} dep;
ScopeNode* receiver() {return &dep;}
ScopeNode* sender() {return this;}
SlotData* parent() {return dep.parent;}
bool connected()
{return (next_!=this);}
virtual void erase();
void set_parent(SlotData *s)
{dep.parent=s;}
SlotDependent(SlotData &s)
{dep.parent=&s;}
SlotDependent()
{}
virtual ~SlotDependent();
};
// common data to all callbacks.
struct Callback_
{
// callback function
void* (*func_)(void*);
struct O;
struct C1
{
void* (*f1)(void*);
};
struct C2
{
O* o;
void (O::*v)(void);
};
// Object pointer or function pointer
union {C1 a1; C2 a2;};
};
// All slots have the same base
struct LIBSIGC_API SlotData:public ObjectScoped
{
typedef SlotList_ List;
SlotDependent dep_;
ScopeNode* receiver() {return dep_.receiver();}
ScopeNode* sender() {return dep_.sender();}
// Called from signals to tell slot object it is connected
// invalidates list and sets weak reference
void connect();
List list_;
Callback_ data_;
Callback_& callback() {return data_;}
SlotData()
{dep_.set_parent(this);}
virtual ~SlotData();
};
typedef Scopes::Extend SlotExtend;
#ifdef LIBSIGC_MSC
#pragma warning(disable: 4231)
LIBSIGC_TMPL template class LIBSIGC_API Handle<SlotData,SlotExtend>;
#endif
class LIBSIGC_API Connection:protected Handle<SlotData,SlotExtend>
{
typedef Handle<SlotData,SlotExtend> Base;
public:
// hides virtual method
void disconnect() {if (obj()) obj()->invalid();}
bool connected() {return Base::connected ();}
Connection():Base() {}
Connection(SlotData *s):Base(s) {}
Connection(const Connection& s):Base(s) {}
};
// possible casts of Callback
template <class C,class F>
struct CallDataFunc
{
C callback;
F func;
};
template <class C,class O>
struct CallDataObj2
{
C callback;
O *obj;
};
template <class C,class O,class F>
struct CallDataObj3
{
C callback;
O* obj;
F func;
};
// from Abstract_Slots we build abstract slots
// with various lengths of arguments
// A slot is not concrete til it has a call
dnl
dnl SLOT([P1,P2,...])
dnl
define([SLOT],[dnl
/****************************************************************
***** Abstract Slot NUM($1)
****************************************************************/
SLOT_IMPL(R,[$1])
#ifndef SIGC_CXX_VOID_RETURN
#ifdef SIGC_CXX_PARTIAL_SPEC
SLOT_IMPL(void,[$1])
#endif
#endif
])dnl end SLOT
dnl
dnl SLOT_IMPL(R,[P1,P2,...])
dnl
define([SLOT_IMPL],[dnl
LINE(]__line__[)dnl
ifelse($1,void,[dnl
template <ARG_CLASS($2)>
struct [Callback]NUM($2)<LIST(void,1,ARG_TYPE($2),[$2])>:public Callback_
{
typedef void RType;
typedef RType (*Func)(LIST([void*],1,ARG_TYPE($2),[$2]));
inline RType call(ARG_REF($2))
{((Func)(func_))(LIST([(void*)this],1,ARG_NAME($2),[$2]));}
inline RType operator()(ARG_REF($2))
{((Func)(func_))(LIST([(void*)this],1,ARG_NAME($2),[$2]));}
};
],[dnl
template <LIST(class R,1,ARG_CLASS($2),[$2])>
struct [Callback]NUM($2):public Callback_
{
#ifdef SIGC_CXX_PARTIAL_SPEC
typedef R RType;
#else
typedef Trait<R>::type RType;
#endif
typedef RType (*Func)(LIST([void*],1,ARG_TYPE($2),[$2]));
inline RType call(ARG_REF($2))
{return ((Func)(func_))(LIST([(void*)this],1,ARG_NAME($2),[$2]));}
inline RType operator()(ARG_REF($2))
{return ((Func)(func_))(LIST([(void*)this],1,ARG_NAME($2),[$2]));}
};
])dnl
ifelse($1,void,[dnl
template <ARG_CLASS($2)>
class __SLOT__(void,[$2])
],[dnl
template <LIST(class R,1,ARG_CLASS($2),[$2])>
class [Slot]NUM($2)
])dnl
:public Handle<SlotData,SlotExtend>
{
public:
typedef Handle<SlotData,SlotExtend> Base;
typedef [Callback]NUM($2)<LIST($1,1,ARG_TYPE($2),[$2])> Callback;
typedef ifelse([$1$2],void,,typename) Callback::RType RType;
typedef RType (*Func)(LIST([void*],1,ARG_TYPE($2),[$2]));
SlotData* data() const {return (SlotData*)(scope_.object());}
[Slot]NUM($2)() {}
[Slot]NUM($2)(SlotData *s):Base(s) {}
[Slot]NUM($2)(const [Slot]NUM($2)& s):Base(s.obj()) {}
inline RType call(ARG_REF($2))
{
if (connected())
ifelse($1,void,[
((Callback&)(data()->callback())).call(ARG_NAME($2));
],[dnl
return ((Callback&)(data()->callback())).call(ARG_NAME($2));
return RType();
])dnl
}
inline RType operator()(ARG_REF($2))
{
if (connected())
ifelse($1,void,[
((Callback&)(data()->callback())).call(ARG_NAME($2));
],[dnl
return ((Callback&)(data()->callback())).call(ARG_NAME($2));
return RType();
])dnl
}
};
])dnl end SLOT_IMPL
SLOT(ARGS(P,0))
SLOT(ARGS(P,1))
SLOT(ARGS(P,2))
SLOT(ARGS(P,3))
SLOT(ARGS(P,4))
SLOT(ARGS(P,5))
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif // __header__

View File

@ -1,282 +0,0 @@
dnl-----------------------------------------------------------------------
dnl
dnl Karls M4 macros for the signal system used by gtk--
dnl
dnl Copyright (C) 1998 Karl Nelson <kenelson@ece.ucdavis.edu>
dnl Tero Pulkkinen
dnl
dnl Currently maintained by Tero Pulkkinen. <terop@modeemi.cs.tut.fi>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl-----------------------------------------------------------------------
dnl Recursion prevention. (Don't attempt to understand why this works!)
changequote(, )dnl
changequote([, ])dnl
pushdef([DIVERSION],divnum)dnl
divert(-1)dnl
ifdef([__template_macros__],[],[
define(__template_macros__)
dnl-----------------------------------------------------------------------
dnl
dnl M4 macros for general sanity
dnl
dnl M4 Quotas are hard to work with, so use braces like autoconf
dnl (which are matched by vi, emacs)
changequote(, )
changequote([, ])
dnl
dnl M4 comments conflict with compiler directives
changecom(, )
dnl BRACE(text) => [text]
dnl When we want something to appear with braces
define([BRACE],[[[$*]]])
dnl
dnl PROT(macro)
dnl If a macro generates an output with commas we need to protect it
dnl from being broken down and interpreted
define([PROT],[[$*]])
dnl
dnl LOWER(string)
dnl lowercase a string
define([LOWER],[translit([$*],[ABCDEFGHIJKLMNOPQRSTUVWXYZ],[abcdefghijklmnopqrstuvwxyz])])
dnl
dnl UPPER(string)
dnl uppercase a string
define([UPPER],[translit([$*],[abcdefghijklmnopqrstuvwxyz],[ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
define([UPPER_SAFE],[translit([$*],[abcdefghijklmnopqrstuvwxyz.-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ__])])
dnl
dnl BASENAME(string)
dnl extract the basename of a string
define([BASENAME],[patsubst([$*],[^.*/],[])])
dnl
dnl M4NAME(string)
dnl extract the basename of a string
define([M4NAME],[patsubst(BASENAME([$*]),[\.m4$],[])])
dnl NUM(arg,arg,...)
dnl M4 defines $# very badly (empty list=1). So we need a better one
define([NUM],[ifelse(len([$*]),0,0,[$#])])
dnl
dnl IF(cond,string1,string2)
dnl places string1 if length (without spaces) of cond is zero,
dnl else string2
define([IF],[ifelse(len(PROT(translit([$1],[ ]))),0,[$3],[$2])])
dnl define([IF],[ifelse(len(PROT(patsubst([$1],[ ]))),0,[$3],[$2])])
dnl
dnl minclude(filename)
dnl This includes only the macros from a file but throws away the output.
dnl Used to take the macros from a file without getting it extra output.
define([minclude],[IF([$1],[dnl
pushdef([CURRENT_DIVERSION],divnum)dnl
divert(-1)
include($1)
divert(CURRENT_DIVERSION)dnl
popdef([CURRENT_DIVERSION])dnl],[[minclude]])])
dnl
dnl makes the current filename into a string approprate for use as
dnl C identified define. (Defaults to this library name)
dnl
dnl example: (filename test.hh.m4)
dnl __header__ => SIGCXX_TEST_H
dnl __header__(MYHEAD) => MYHEAD_TEST_H
dnl define([__header__],[ifelse($1,,[SIGCXX],UPPER($1))[_]UPPER(patsubst(translit(BASENAME(__file__),[.-],[__]),[_m4],[]))])
define([__header__],[ifelse($1,,[SIGCXX],UPPER($1))[_]UPPER_SAFE(M4NAME(__file__))])
dnl
dnl Set of M4 macros for variable argument template building
dnl
dnl ARGS(name,number)
dnl Builds a comma seperated protected list of numbered names
dnl Use this as short hand to specify arguement names
dnl
dnl ARGS(arg,3) => ARG1,ARG2,ARG3
define([_ARGS],[ifelse(eval($2<$3),0,[$1$2],[$1$2,_ARGS($1,eval($2+1),$3)])])
define([ARGS],[ifelse(eval($2>0),1,[PROT(_ARGS(UPPER([$1]),1,$2))],[PROT])])
dnl
dnl LIST/C_LIST(string1,cond1,string2,cond2,...)
dnl These are intended for making extended argument lists
dnl parameters are in pairs, the first is output if the
dnl 2nd is nonzero length, the process is then repeated
dnl with the next set of arguments.
dnl
dnl Macro expansions that expand to result in commas must call
dnl PROT to prevent permature expansion. ARG* macros do
dnl this automatically. (If unsure, add braces until it stops
dnl interpreting inter macros, remove one set of braces, if
dnl still not right use PROT)
dnl
dnl C_LIST adds a comma in front
dnl (LIST is probably the most useful macro in the set.)
define([LIST],[ifelse($#,1,,len([$2]),0,[LIST(shift(shift($@)))],len([$1]),0,[LIST(shift(shift($@)))],[[$1]C_LIST(shift(shift($@)))])])
dnl
define([C_LIST],[ifelse($#,1,,len([$2]),0,[C_LIST(shift(shift($@)))],len([$1]),0,[C_LIST(shift(shift($@)))],[,[$1]C_LIST(shift(shift($@)))])])
dnl
dnl ARG_LOOP(macro_name,seperator,argument_list)
dnl Very powerful macro for construction of list of variables
dnl formated in specify ways. To use define a macro taking
dnl one variable which is called the format. The second argument
dnl is a seperator which will appear between each argument.
dnl The rest is then interpreted as arguments to form the list.
dnl
dnl Example:
dnl define([FOO],[foo([$1])])
dnl ARG_LOOP([FOO],[[, ]],A,B,C)
dnl
dnl Gives: foo(A), foo(B), foo(C)
dnl
define([_ARG_LOOP],[dnl
ifelse(NUM($*),0,,NUM($*),1,[dnl
indir(LOOP_FORMAT,[$1])],[dnl
indir(LOOP_FORMAT,[$1])[]LOOP_SEPERATOR[]_ARG_LOOP(shift($*))])])
define([ARG_LOOP],[dnl
pushdef([LOOP_FORMAT],[[$1]])dnl
pushdef([LOOP_SEPERATOR],[$2])dnl
_ARG_LOOP(shift(shift($*)))[]dnl
popdef([LOOP_FORMAT])dnl
popdef([LOOP_SEPERATOR])dnl
])
dnl
dnl Define some useful formats for use with ARG_LOOP.
define([FORMAT_ARG_CLASS],[class [$1]])
define([FORMAT_ARG_BOTH],[[$1] LOWER([$1])])
define([FORMAT_ARG_REF],[typename Trait<[$1]>::ref LOWER([$1])])
define([FORMAT_ARG_TYPE],[[$1]])
define([FORMAT_ARG_NAME],[LOWER($1)])
define([FORMAT_ARG_CBNAME],[LOWER($1)_])
define([FORMAT_ARG_CBDECL],[[$1] LOWER([$1])_;])
define([FORMAT_ARG_CBINIT],[LOWER([$1])_(LOWER([$1]))])
dnl
dnl The following functions generate various types of parameter lists
dnl For parameter lists
dnl ARG_CLASS([P1,P2]) -> class P1,class P2
dnl ARG_BOTH([P1,P2]) -> P1 p1,P2 p2
dnl ARG_TYPE([P1,P2]) -> P1,P2
dnl ARG_NAME([P1,P2]) -> p1,p2
dnl For callback lists
dnl ARG_CBNAME([C1,C2]) -> c1_,c2_
dnl ARG_CBINIT([C1,C2]) -> c1_(c1),c2_(c2)
dnl ARG_CBDECL([C1,C2]) -> C1 c1_; C2 c2_;
dnl
define([ARG_CLASS],[PROT(ARG_LOOP([FORMAT_ARG_CLASS],[[,]],$*))])
define([ARG_BOTH],[PROT(ARG_LOOP([FORMAT_ARG_BOTH],[[,]],$*))])
define([ARG_REF],[PROT(ARG_LOOP([FORMAT_ARG_REF],[[,]],$*))])
define([ARG_TYPE],[PROT([$*])])
define([ARG_NAME],[PROT(LOWER($*))])
define([ARG_CBNAME],[PROT(ARG_LOOP([FORMAT_ARG_CBNAME],[[,]],$*))])
define([ARG_CBDECL],[PROT(ARG_LOOP([FORMAT_ARG_CBDECL],[ ],$*))])
define([ARG_CBINIT],[PROT(ARG_LOOP([FORMAT_ARG_CBINIT],[[,]],$*))])
dnl
dnl C_* - the same with a comma in front
dnl (we should obsolete these, LIST is better)
define([C_ARG_CLASS], [ifelse(NUM($*),0,,[,ARG_CLASS($*)])])
define([C_ARG_BOTH],[ifelse(NUM($*),0,,[,ARG_BOTH($*)])])
define([C_ARG_TYPE],[ifelse(NUM($*),0,,[,ARG_TYPE($*)])])
define([C_ARG_NAME],[ifelse(NUM($*),0,,[,ARG_NAME($*)])])
define([C_ARG_CBNAME],[ifelse(NUM($*),0,,[,ARG_CNAME($*)])])
define([C_ARG_CBINIT],[ifelse(NUM($*),0,,[,ARG_INIT($*)])])
dnl
dnl T_DROP(string)
dnl Removes unnecessary <> with empty templates
dnl (occasionally useful)
define([T_DROP],[ifelse([$1],<>,,[$*])])
dnl
dnl DROP(string,drop)
dnl Removes unnecessary strings if they match drop
dnl (occasionally useful)
define([DROP],[ifelse([$1],[$2],,[$*])])
dnl
dnl LINE(linenum)
dnl places a #line statement if __debug__ set
dnl Use this at top of macro template and following
dnl macros that contain newlines.
dnl
dnl example:
dnl LINE(]__line__[)dnl
define([LINE],[ifdef([__debug__],[#line $1 "]__file__["
])])
dnl-----------------------------------------------------------------------
dnl Libsigc++ macros to simpilify typing of internal macros
define([TYPEDEF_RTYPE],[
ifelse($1,void,[dnl
typedef void $2;dnl
],[dnl
#ifdef SIGC_CXX_PARTIAL_SPEC
typedef $1 $2;
#else
typedef typename Trait<$1>::type $2;
#endif])])
define([__SLOT__],[dnl
ifelse([$2$3],,[Slot0<$1>],
[$3],,[Slot[]NUM($2)<$1,$2>],
[$2],,[Slot[]NUM($3)<$1,$3>],
[Slot[]eval(NUM($2)+NUM($3))<$1,$2,$3>])])
define([QT_FIREWALL],[dnl
// Qt steals a method name.
#ifdef SIGC_QT
#undef emit
#endif
#ifdef emit
#define SIGC_QT
#undef emit
#endif
])
define([END_QT_FIREWALL],[dnl
#ifdef SIGC_QT
#define emit
#endif
])
dnl-----------------------------------------------------------------------
dnl End of recursion protection. Do not put anything below this line.
])
divert(DIVERSION)dnl
popdef([DIVERSION])dnl

View File

@ -1,38 +0,0 @@
#include <sigc++/marshal.h>
#ifdef SIGC_PTHREADS
#include <sigc++/thread.h>
#endif
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
int ignore_(int value)
{
#ifdef SIGC_PTHREADS
static Threads::Private<int> ignore;
#else
static int ignore;
#endif
int rc=ignore;
ignore=value;
return rc;
}
int RetCode::check_ignore()
{
return ignore_(0);
}
void RetCode::ignore()
{
ignore_(1);
}
#ifdef SIGC_CXX_NAMESPACES
} /* namespace sigc */
#endif

View File

@ -1,209 +0,0 @@
#ifndef SIGCXX_MARSHALLER_H
#define SIGCXX_MARSHALLER_H
#include <sigc++/sigc++config.h>
#ifndef SIGC_CXX_PARTIAL_SPEC
#include <sigc++/slot.h>
#endif
#ifndef SIGC_CXX_INT_CTOR
#include <new>
#endif
#ifdef SIGC_PTHREADS
#include <sigc++/thread.h>
#endif
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
/*
All classes used to marshal return values should have the following
class SomeMarshal
{
// both typedefs must be defined.
typedef Type1 InType;
typedef Type2 OutType;
public:
// Return final return code.
OutType value();
// Captures return codes and returns TRUE to stop emittion.
bool marshal(const InType&);
SomeMarshal();
};
It is not necessary for the InType to match the OutType.
This is to allow for things like list capturing.
*/
/*******************************************************************
***** Marshal
*******************************************************************/
// A struct that holds an flag for determining
// if the return value is to be ignored.
class LIBSIGC_API RetCode
{
public:
static int check_ignore();
static void ignore();
};
// Basic Marshal class.
template <typename R>
class Marshal
{
public:
typedef R OutType;
#ifdef SIGC_CXX_PARTIAL_SPEC
typedef R InType;
protected:
typedef OutType OutType_;
#else
typedef Trait<R>::type InType;
protected:
typedef InType OutType_;
#endif
OutType_ value_;
public:
OutType_& value() {return value_;}
static OutType_ default_value()
#ifdef SIGC_CXX_INT_CTOR
{return OutType_();}
#else
{OutType_ r; new (&r) OutType_(); return r;}
#endif
// This captures return values. Return TRUE to stop emittion process.
bool marshal(const InType& newval)
{
if (!RetCode::check_ignore()) value_=newval;
return 0; // continue emittion process
};
Marshal()
#ifdef SIGC_CXX_INT_CTOR
:value_()
{RetCode::check_ignore();}
#else
{
RetCode::check_ignore();
new (&value_) OutType_();
}
#endif
};
#ifdef SIGC_CXX_SPECIALIZE_REFERENCES
// Basic Marshal class.
template <typename R>
class Marshal<R&>
{
public:
typedef R& OutType;
typedef R& InType;
R* value_;
OutType value() {return value_;}
static OutType default_value() {return Default;}
static R Default;
// This captures return values. Return TRUE to stop emittion process.
bool marshal(InType newval)
{
if (!RetCode::check_ignore()) value_=&newval;
return 0; // continue emittion process
};
Marshal()
:value_(&Default)
{RetCode::check_ignore();}
~Marshal()
{}
};
template <typename T> T Marshal<T&>::Default;
#endif
#ifdef SIGC_CXX_PARTIAL_SPEC
// dummy marshaller for void type.
template <>
class Marshal<void>
{
public:
Marshal()
{}
~Marshal()
{}
};
#endif
// starts with a fixed value
template <class R,R initial>
class FixedMarshal
{
public:
typedef R OutType;
typedef R InType;
R value_;
OutType& value() {return value_;}
static OutType default_value() { return initial; }
bool marshal(const InType& newval)
{
if (!RetCode::check_ignore()) value_=newval;
return 0; // continue emittion process
};
FixedMarshal()
:value_(initial)
{RetCode::check_ignore();}
~FixedMarshal()
{}
};
template <class R>
struct FastMarshal
{
typedef R OutType;
typedef R InType;
R value_;
OutType& value() {return value_;}
static OutType default_value()
#ifdef SIGC_CXX_INT_CTOR
{return R();}
#else
{R r; new (&r) R(); return r;}
#endif
bool marshal(const InType& newval)
{
value_=newval;
return 0; // continue emittion process
};
FastMarshal()
#ifdef SIGC_CXX_INT_CTOR
:value_()
{}
#else
{new (&value_) R();}
#endif
~FastMarshal()
{}
};
#ifdef SIGC_CXX_NAMESPACES
} // namespace sigc
#endif
#endif

View File

@ -1,176 +0,0 @@
// -*- c++ -*-
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sigc++/object.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif // SIGC_CXX_NAMESPACES
int sigc_major_version=SIGC_MAJOR_VERSION;
int sigc_minor_version=SIGC_MINOR_VERSION;
int sigc_micro_version=SIGC_MICRO_VERSION;
ObjectReferenced::ObjectReferenced():
obj_count_(0),
obj_dynamic_(0),obj_owned_(1),obj_floating_(1),obj_transfer_(0),
obj_invalid_(0),obj_destroyed_(0),obj_weak_(0)
{}
ObjectScoped::ObjectScoped():list_()
{}
ObjectReferenced::~ObjectReferenced()
{}
ObjectScoped::~ObjectScoped()
{
// we can't be destroyed again.
obj_destroyed_=1;
// trash the list.
invalid(1);
}
void ObjectReferenced::reference()
{
// if we exceed the int limit, we should unset dynamic_
if (!(++obj_count_))
obj_dynamic_=0;
}
void ObjectReferenced::unreference()
{
if (obj_count_
&& (!--obj_count_)
&& obj_dynamic_
&& !obj_floating_
&& !obj_destroyed_
)
{
obj_destroyed_=1;
delete this;
}
}
void ObjectScoped::register_data(ScopeNode *data)
{
list_.insert_direct(list_.end(),data);
}
void ObjectScoped::register_scope(Scope *scope,const Scope *parent)
{
if (!scope) return;
// check for invalid in progress
if (obj_invalid_)
return;
// reregistering a scope
if (scope->obj_==this)
{
if (obj_transfer_&&(ScopeNode*)parent==list_.begin().node())
{list_.swap_elements(const_cast<Scope*>(parent),scope);
obj_transfer_=0;
}
return;
}
if (obj_transfer_&&(ScopeNode*)parent==list_.begin().node())
{
list_.insert_direct(list_.begin(),scope);
obj_transfer_=0;
}
else
list_.insert_direct(list_.end(),scope);
// complete connection
scope->obj_=this;
scope->on_connect();
}
void ObjectScoped::unregister_scope(Scope *scope)
{
if (!scope) return;
// Check for loss of ownership
if (obj_owned_&&(ScopeNode*)scope==list_.begin().node())
obj_owned_=0;
list_.erase(scope);
scope->obj_=0;
}
void ObjectScoped::set_weak()
{
if (obj_weak_) return;
obj_weak_=1;
reference();
}
struct Invalid_
{
ObjectReferenced* r_;
Invalid_(ObjectReferenced& r): r_(&r)
{
r_->obj_invalid_=1;
r_->reference();
}
~Invalid_()
{
r_->obj_invalid_=0;
r_->unreference();
}
};
void ObjectScoped::invalid(bool level)
{
if (!level&&(obj_invalid_||!obj_dynamic_))
return;
List_::Iterator current=list_.begin();
List_::Iterator next=current;
if (current==list_.end()&&!obj_weak_)
return;
Invalid_ r(*this);
if (obj_weak_)
{
obj_weak_=0;
unreference();
}
while (current!=(list_.end()))
{
++next;
(*current).disconnect(level);
current=next;
}
}
Object::~Object()
{}
void ObjectReferenced::set_dynamic() {obj_dynamic_=1;}
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif // SIGC_CXX_NAMESPACES

View File

@ -1,153 +0,0 @@
// -*- c++ -*-
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef SIGCXX_OBJECT_H
#define SIGCXX_OBJECT_H
#include <sigc++/sigc++config.h>
#include <sigc++/scope.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
extern int sigc_micro_version;
extern int sigc_minor_version;
extern int sigc_major_version;
class Invalid_;
class LIBSIGC_API ObjectReferenced
{
friend class Reference;
friend class Scope;
friend class Invalid_;
#ifdef SIGC_CXX_FRIEND_TEMPLATES
template <class T>
friend T* manage(T*);
#endif
protected:
// count of current references
unsigned int obj_count_ :24;
// indicates object generated through an interface that marks dynamic
unsigned int obj_dynamic_ :1;
// indicates the pointed to scope is the owner
unsigned int obj_owned_ :1;
// indicates object not will delete when count reachs zero
unsigned int obj_floating_ :1;
// indicates the owned scope is surrendering ownership
unsigned int obj_transfer_ :1;
// indicates the object is doing a list clean up
unsigned int obj_invalid_ :1;
// indicates the object been destroyed
unsigned int obj_destroyed_ :1;
// indicates there is a weak reference
unsigned int obj_weak_ :1;
/*************************************************************/
#ifdef SIGC_CXX_FRIEND_TEMPLATES
protected:
#else
public:
#endif
// For the controller and scope
virtual void set_dynamic();
inline void set_sink() {obj_floating_=0;}
protected:
inline void register_ref(Reference *)
{
if (obj_transfer_)
{
obj_transfer_=0;
obj_owned_=0;
}
}
public:
virtual void reference();
virtual void unreference();
inline bool is_dynamic() {return obj_dynamic_;}
inline bool is_floating() {return obj_floating_;}
ObjectReferenced();
virtual ~ObjectReferenced();
};
class LIBSIGC_API ObjectScoped :public ObjectReferenced
{
friend class Scope;
typedef ScopeList List_;
private:
mutable List_ list_;
// interface for scopes
void register_scope(Scope *scope,const Scope *parent=0);
void unregister_scope(Scope *scope);
protected:
// This sets a very weak reference which is removed at next invalid
void set_weak();
public:
void register_data(ScopeNode* data);
// inform connections that object wishs to delete
void invalid(bool destroy=0);
ObjectScoped();
virtual ~ObjectScoped();
};
// There can only be one Scope_Object per any object
class LIBSIGC_API Object: public virtual ObjectScoped
{
public:
Object() {}
virtual ~Object();
};
// mark this a managable object
template <class T>
inline T* manage(T* t)
{
if (t) t->set_dynamic();
return t;
}
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif
#endif

View File

@ -1,280 +0,0 @@
// -*- c++ -*-
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sigc++/scope.h>
#include <sigc++/object.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif //SIGC_CXX_NAMESPACES
/*********************************************************/
Reference::~Reference() {if (obj_) obj_->unreference();}
void Reference::set_sink() {if (obj_) obj_->set_sink();}
void Reference::init(ObjectReferenced *obj)
{
obj_=obj;
cache_=0;
if (obj_)
{
obj_->register_ref(this);
obj_->reference();
}
}
void Reference::set(ObjectReferenced *obj,void* cache,bool is_ptr)
{
if (obj_==obj)
return;
if (obj_) obj_->unreference();
obj_=obj;
cache_=cache;
if (obj_)
{
obj_->register_ref(this);
obj_->reference();
if (is_ptr) obj_->set_sink();
}
}
/*********************************************************/
// object interaction properties
void Scope::reference() {if (obj_) obj_->reference();}
void Scope::unreference() {if (obj_) obj_->unreference();}
void Scope::set_sink() {if (obj_) obj_->set_sink();}
void Scope::invalid()
{
if (obj_)
object()->invalid();
}
void Scope::register_scope(ObjectScoped *obj)
{
if (obj)
obj->register_scope(this);
}
void Scope::register_scope(const Scope *parent)
{
if (parent&&parent->obj_)
parent->object()->register_scope(this,parent);
}
void Scope::unregister_scope()
{
if (obj_)
object()->unregister_scope(this);
}
/*********************************************************/
// object interaction properties
void Scope::set(ObjectScoped *obj,void* cache,bool)
{
if (obj_==obj)
return;
unregister_scope();
register_scope(obj);
cache_=(obj_?cache:0);
}
void ScopeNode::disconnect(bool dummy)
{}
void Scope::erase()
{
obj_=0;
cache_=0;
}
Scope::~Scope()
{}
/*********************************************************/
// These are here because they are virtual
void Scopes::Uncounted::disconnect(bool l)
{
unregister_scope();
}
Scopes::Uncounted::~Uncounted()
{
disconnect();
}
void Scopes::Extend::set(ObjectScoped *obj,void* cache,bool is_ptr)
{
Scope::set(obj,cache,is_ptr);
if (is_ptr) set_sink();
}
void Scopes::Extend::on_connect()
{
reference();
}
void Scopes::Extend::erase()
{
unreference();
Scope::erase();
}
void Scopes::Extend::disconnect(bool l)
{
unregister_scope();
}
Scopes::Extend::~Extend()
{
disconnect();
}
void Scopes::Limit::set(ObjectScoped *obj,void* cache,bool is_ptr)
{
Scope::set(obj,cache,is_ptr);
if (is_ptr) set_sink();
}
void Scopes::Limit::on_connect()
{
reference();
}
void Scopes::Limit::erase()
{
unreference();
Scope::erase();
}
void Scopes::Limit::disconnect(bool l)
{
invalid();
unregister_scope();
}
Scopes::Limit::~Limit()
{
disconnect();
}
/*****************************************************************/
inline void splice_node(ScopeNode *n1,ScopeNode *n2)
{
n1->next_=n2;
n2->prev_=n1;
}
inline void unlink_node(ScopeNode *n)
{
if (n->next_==n) return;
splice_node(n->prev_,n->next_);
n->prev_=n->next_=n;
}
void ScopeNode::remove_self() {unlink_node(this);}
ScopeNode::~ScopeNode() {unlink_node(this);}
void ScopeNode::erase() {}
DataNode::~DataNode() {}
void DataNode::erase() {delete this;}
ScopeIterator_ ScopeList::insert_direct(Iterator pos,NodeType *tmp)
{
if (!tmp) return tmp;
NodeType *after=pos.node();
NodeType *before=(NodeType*)(after->prev_);
splice_node(before,tmp);
splice_node(tmp,after);
return tmp;
}
ScopeIterator_ ScopeList::erase(Iterator pos)
{
NodeType* loc=pos.node();
Iterator tmp=pos;
if (!loc) return tmp;
++tmp;
unlink_node(loc);
loc->erase();
return tmp;
}
void ScopeList::swap_elements(Iterator p1,Iterator p2)
{
NodeType *loc1=p1.node();
NodeType *loc2=p2.node();
if (!loc1||!loc2) return;
NodeType *before1=(NodeType*)loc1->prev_;
NodeType *after1=(NodeType*)loc1->next_;
NodeType *before2=(NodeType*)loc2->prev_;
NodeType *after2=(NodeType*)loc2->next_;
if (before1==loc1)
{
// loc1 is a stray?
if (before2==loc2) return;
splice_node(loc2,loc2);
splice_node(before2,loc1);
splice_node(loc1,after2);
return;
}
if (before2==loc2)
{
// loc2 is a stray?
splice_node(loc1,loc1);
splice_node(before1,loc2);
splice_node(loc2,after1);
return;
}
if (loc1==before2)
{// loc1 is right before loc2
splice_node(before1,loc2);
splice_node(loc2,loc1);
splice_node(loc1,after2);
return;
}
if (loc2==before1)
{// loc2 is right before loc1
splice_node(before2,loc1);
splice_node(loc1,loc2);
splice_node(loc2,after1);
return;
}
splice_node(before1,loc2);
splice_node(loc2,after1);
splice_node(before2,loc1);
splice_node(loc1,after2);
}
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif

View File

@ -1,291 +0,0 @@
// -*- c++ -*-
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef SIGCXX_SCOPE_H
#define SIGCXX_SCOPE_H
#include <sigc++/sigc++config.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
struct LIBSIGC_API ScopeNode
{
mutable ScopeNode *prev_;
mutable ScopeNode *next_;
// removes self from list
void remove_self();
// Called to inform the item that it is erased
virtual void erase();
// inform scopes that invalid requested.
virtual void disconnect(bool destroy=0);
ScopeNode()
#ifdef LIBSIGC_WIN32
{prev_=next_=this;}
#else
:prev_(this),next_(this) {}
#endif
virtual ~ScopeNode();
private:
ScopeNode& operator=(const ScopeNode&);
ScopeNode(const ScopeNode&);
};
struct LIBSIGC_API DataNode: public ScopeNode
{
virtual void erase();
virtual ~DataNode();
};
/*******************************************************************
***** Basis Scope
*******************************************************************/
class ObjectScoped;
class ObjectReferenced;
class Object;
class Scope;
class LIBSIGC_API Reference
{
protected:
mutable ObjectReferenced* obj_;
mutable void* cache_;
public:
void set_sink();
void init(ObjectReferenced* obj);
void set(ObjectReferenced* obj,void* cache=0,bool ptr=false);
Reference& operator=(ObjectReferenced *obj) { set(obj); return *this; }
Reference& operator=(ObjectReferenced &obj) { set(&obj); return *this; }
Reference& operator=(const Reference& ref) { set(ref.obj_); return *this; };
ObjectReferenced* object() const {return obj_;}
void* cache() const {return cache_;}
Reference():obj_(0) {}
Reference(ObjectReferenced &obj)
{init(&obj);}
Reference(const Reference& ref)
{init(ref.obj_);}
~Reference();
};
class LIBSIGC_API Scope:public ScopeNode
{
friend class ObjectScoped;
Scope& operator=(const Scope& scope);
Scope(const Scope& scope);
protected:
void set(ObjectScoped* obj,void* cache,bool ptr);
mutable ObjectScoped* obj_;
mutable void* cache_;
virtual void on_connect()=0;
virtual void erase();
void register_scope(ObjectScoped *);
void register_scope(const Scope *parent=0);
void unregister_scope();
public:
void reference();
void unreference();
void set_sink();
ObjectScoped* object() const {return (ObjectScoped*)(obj_);}
void* cache() const {return cache_;}
// Inform object it should invalidate its list.
void invalid();
Scope():obj_(0),cache_(0) {}
virtual ~Scope();
};
/******************************************************
**** Common Scopes
*******************************************************
Available Scopes:
Uncounted - non-reference
Limit - Limits the lifetime of object to this scope
Sinks object.
Extend - Extends the lifetime of the object to this scope
Sinks object.
LimitOwned - Conditionally limits the lifetime of object
Sinks object.
FuncRef - Extends the lifetime, without sink
(intended for functions)
Reference - Extends the lifetime, with sink
AutoPtr - Shorthand for auto_ptr like scope.
RefCount - Shorthand for ref_ptr like scope.
******************************************************/
struct Scopes
{
class LIBSIGC_API Uncounted:public Scope
{
Uncounted& operator=(const Uncounted&);
Uncounted(const Uncounted&);
public:
virtual void disconnect(bool level=0);
Uncounted():Scope() {}
virtual ~Uncounted();
};
class LIBSIGC_API Extend:public Scope
{
Extend& operator=(const Extend&);
Extend(const Extend&);
protected:
virtual void on_connect();
virtual void erase();
public:
virtual void disconnect(bool level=0);
void set(ObjectScoped* obj,void* cache,bool ptr);
Extend():Scope() {}
virtual ~Extend();
};
class LIBSIGC_API Limit:public Scope
{
Limit& operator=(const Limit&);
Limit(const Limit&);
protected:
virtual void on_connect();
virtual void erase();
public:
virtual void disconnect(bool level=0);
void set(ObjectScoped* obj,void* cache,bool ptr);
Limit():Scope() {}
virtual ~Limit();
};
typedef Extend RefCount;
typedef Reference Lock;
};
/*************************************************************
***** Lists
*************************************************************/
// Stub for building polylists
// Iterator skeleton
struct LIBSIGC_API ScopeIterator_
{
typedef ScopeNode NodeType;
private:
NodeType *node_;
public:
inline NodeType* node() {return node_;}
inline const NodeType* node() const {return node_;}
inline NodeType& operator*()
{return *node_;
}
inline const NodeType& operator*() const
{return *node_;
}
inline bool operator==(const ScopeIterator_& i) const
{return node_==i.node_;
}
inline bool operator!=(const ScopeIterator_& i) const
{return node_!=i.node_;
}
inline ScopeIterator_& operator++()
{
if (node_)
node_=(NodeType*)node_->next_;
return *this;
}
ScopeIterator_ operator++(int)
{
ScopeIterator_ tmp=*this;
++*this;
return tmp;
}
ScopeIterator_& operator= (const ScopeIterator_& i)
{
node_=i.node_;
return *this;
}
ScopeIterator_(const ScopeIterator_ &n):node_(n.node_) {}
ScopeIterator_(NodeType *n):node_(n) {}
ScopeIterator_():node_(0) {}
};
class LIBSIGC_API ScopeList
{
public:
typedef ScopeNode NodeType;
typedef ScopeIterator_ Iterator;
ScopeNode node_;
inline Iterator begin() {return Iterator(node_.next_);}
inline Iterator end() {return Iterator(&node_);}
// insert item directly on list
Iterator insert_direct(Iterator pos,NodeType *n);
Iterator erase(Iterator pos);
void erase(Iterator start,Iterator stop)
{ while (start!=stop) start=erase(start); }
void swap_elements(Iterator p1,Iterator p2);
void clear()
{ erase(begin(),end()); }
bool empty() const {return node_.next_==&node_;}
ScopeList():node_() {}
~ScopeList() { clear(); }
private:
ScopeList(const ScopeList&);
};
#ifdef SIGC_CXX_NAMESPACES
} // namespace sigc
#endif
#endif

View File

@ -1,232 +0,0 @@
#!/bin/sh
af_libs=
af_cflags=
prefix=@prefix@
exec_prefix=@exec_prefix@
##
## Define usage()
##
usage()
{
cat <<EOF
Usage: sigc-config [OPTIONS] [LIBRARIES]
Options:
--cflags print pre-processor and compiler flags
--libs print library linking information
--libs-dirs only print the -L/-R part of --libs
--libs-names only print the -l part of --libs
--help display this help and exit
--macros print the path to m4 macros
--prefix[=DIR]
--exec_prefix[=DIR]
--version output sigc version information
Libraries:
sigc
EOF
exit $1
}
##
## Process options
##
parse()
{
# we must be called with at least one argument
if test $# -eq 0; then
usage 1 1>&2
fi
# at least one option should be selected
case "$1" in
--*)
;;
*)
usage 1 1>&2
;;
esac
# grab all -- arguments
while test $# -gt 0; do
case "$1" in
-*=*) af_optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) af_optarg= ;;
esac
case $1 in
--help)
usage 0 0>&2
;;
--cflags)
af_echo_cflags=yes
;;
--libs)
af_echo_libs_L=yes
af_echo_libs_l=yes
;;
--libs-dirs)
af_echo_libs_L=yes
;;
--libs-names)
af_echo_libs_l=yes
;;
--macros*)
echo -I @prefix@/include/sigc++/macros
exit
;;
--prefix=*)
prefix=$af_optarg
af_prefix_set=yes
;;
--prefix)
af_echo_prefix=yes
;;
--exec_prefix=*)
exec_prefix=$af_optarg
af_exec_prefix_set=yes
;;
--exec_prefix)
af_echo_exec_prefix=yes
;;
--version)
af_echo_version=yes
;;
--*)
usage 1 1>&2
;;
*)
break
;;
esac
shift
done
# if we have a default library use it
if test $# -eq 0; then
if test "X$af_lib_default" != "X"; then
af_lib__AF_LIB_DEFAULT=yes
return
fi
fi
while test $# -gt 0; do
case $1 in
sigc)
af_lib_sigc=yes
;;
*)
usage 1 1>&2
;;
esac
shift
done
}
print_result()
{
if test "X$af_echo_cflags" = "Xyes"; then
af_all_flags="$af_cflags"
fi
if test "X$af_echo_libs_L" = "Xyes" || test "X$af_echo_libs_l" = "Xyes"; then
af_all_flags="$af_all_flags $af_libs"
fi
if test -z "$af_all_flags" || test "X$af_all_flags" = "X "; then
exit 1
fi
# Straight out any possible duplicates, but be careful to
# get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz'
af_other_flags=
af_lib_L_flags=
af_rev_libs=
for i in $af_all_flags; do
case "$i" in
# a library, save it for later, in reverse order
-l*) af_rev_libs="$i $af_rev_libs" ;;
-L*|-R*)
if test "X$af_echo_libs_L" = "Xyes"; then
case " $af_lib_L_flags " in
*\ $i\ *) ;; # already there
*) af_lib_L_flags="$af_lib_L_flags $i" ;; # add it to output
esac
fi;;
*)
case " $af_other_flags " in
*\ $i\ *) ;; # already there
*) af_other_flags="$af_other_flags $i" ;; # add it to output
esac ;;
esac
done
af_ord_libs=
if test "X$af_echo_libs_l" = "Xyes"; then
for i in $af_rev_libs; do
case " $af_ord_libs " in
*\ $i\ *) ;; # already there
*) af_ord_libs="$i $af_ord_libs" ;; # add it to output in reverse order
esac
done
fi
echo $af_other_flags $af_lib_L_flags $af_ord_libs
}
##
## Main Body
##
parse $*
##
## Initialize names
##
if test "X$af_echo_prefix" = "Xyes"; then
echo $prefix
fi
if test "X$af_echo_exec_prefix" = "Xyes"; then
echo $exec_prefix
fi
if test "X$af_echo_version" = "Xyes"; then
echo @SIGC_VERSION@
exit 0
fi
##
## Libraries
##
#dummy because this should always be selected
if test "@includedir@" != /usr/include ; then
includes="-I@includedir@"
fi
if test "@libdir@" != /usr/lib ; then
libs="-L@libdir@"
fi
af_cflags="$af_cflags -I@libdir@/sigc++/include $includes"
af_libs="$libs -lsigc @THREAD_LIB@ $af_libs"
print_result
exit 0

View File

@ -1,36 +0,0 @@
/*************************************************************************
***** A Signal Framework for C++
**************************************************************************
Copyright 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
Based off of ideas from Gtk-- signal system by Tero Pulkkinen.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*************************************************************************/
#ifndef SIGCXX_SIGNAL_SYSTEM_H
#define SIGCXX_SIGNAL_SYSTEM_H
#include <sigc++/slot.h>
#include <sigc++/object_slot.h>
#include <sigc++/func_slot.h>
#include <sigc++/basic_signal.h>
#if 0
#include <sigc++/signals.h>
#endif
#endif

View File

@ -1,80 +0,0 @@
#include <sigc++/slot.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif // SIGC_CXX_NAMESPACES
SlotDependent::~SlotDependent()
{}
SlotDependent::Dep::~Dep()
{}
SlotNode::SlotNode(void):next_(0)
{}
SlotNode::~SlotNode(void)
{}
SlotData::~SlotData(void)
{}
void SlotDependent::Dep::erase()
{
parent->invalid();
}
void SlotDependent::erase()
{
dep.parent->invalid();
}
void SlotData::connect()
{
reference();
invalid();
set_weak();
unreference();
}
void SlotList_::clear()
{
Iterator current=begin();
Iterator next=current;
head_=0;
while (current!=end())
{
next++;
delete current.node();
current=next;
}
}
SlotList_::Iterator SlotList_::insert_direct(Iterator pos,NodeType *node)
{
NodeType *loc=pos.node();
if (pos==begin())
{
node->next_=head_;
head_=node;
}
else
{
Iterator i,j;
j=begin();
while (i=j++,j!=end()&&j!=pos);
NodeType *parent=i.node();
parent->next_=node;
node->next_=loc;
}
return Iterator(node);
}
#ifdef SIGC_CXX_NAMESPACES
} // namespace
#endif // SIGC_CXX_NAMESPACES

View File

@ -1,155 +0,0 @@
// -*- c++ -*-
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define SIGC_THREAD_IMPL
#include <sigc++/thread.h>
#ifdef SIGC_PTHREADS
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
namespace Threads
{
#endif
Mutex::Mutex(const MutexAttr attr)
{
pthread_mutex_init(&mutex_,attr.impl_);
}
// (needs work)
Mutex::~Mutex()
{destroy();}
int Mutex::lock() {return pthread_mutex_lock(&mutex_);}
int Mutex::trylock() {return pthread_mutex_trylock(&mutex_);}
int Mutex::unlock() {return pthread_mutex_unlock(&mutex_);}
int Mutex::destroy() {return pthread_mutex_destroy(&mutex_);}
Condition::Condition(const CondAttr &attr)
{
pthread_cond_init(&cond_,attr.impl_);
}
Condition::~Condition()
{destroy();}
int Condition::signal() {return pthread_cond_signal(&cond_);}
int Condition::broadcast() {return pthread_cond_broadcast(&cond_);}
int Condition::wait(Mutex &m) {return pthread_cond_wait(&cond_,m);}
int Condition::wait(Mutex &m,struct timespec* spec)
{return pthread_cond_timedwait(&cond_,m,spec);}
int Condition::destroy() {return pthread_cond_destroy(&cond_);}
void Semaphore::up()
{
access_.lock();
value_++;
access_.unlock();
sig_.signal();
}
void Semaphore::down()
{
access_.lock();
while (value_<1)
{sig_.wait(access_);}
value_--;
access_.unlock();
}
Semaphore::Semaphore(int value):value_(value) {}
Semaphore::~Semaphore() {}
void* Thread::call_main_(void* obj)
{
Thread *thread=(Thread*)obj;
return thread->main(thread->arg_);
}
Thread::Thread(const ThreadAttr &attr):attr_(attr) {}
Thread::~Thread() {}
int Thread::detach()
#ifdef SIGC_PTHREAD_DCE
{return pthread_detach(&thread_);}
#else
{return pthread_detach(thread_);}
#endif
int Thread::start(void* arg)
{
arg_=arg;
Thread *t=this;
return pthread_create(&thread_,attr_.impl_,call_main_,t);
}
void* Private_::get()
{
void* value;
#ifdef SIGC_PTHREAD_DCE
pthread_getspecific(key_,(pthread_addr_t*)(&value));
#else
value=(void*)(pthread_getspecific(key_));
#endif
return value;
}
void Private_::set(void *value)
{
pthread_setspecific(key_,value);
}
void Private_::create(void (*dtor)(void*))
{
#ifdef SIGC_PTHREAD_DCE
pthread_keycreate(&key_,dtor);
#else
pthread_key_create(&key_,dtor);
#endif
}
void Private_::destroy()
{
#ifndef SIGC_PTHREAD_DCE
pthread_key_delete(key_);
#endif
}
#ifdef SIGC_PTHREAD_DCE
MutexAttr Mutex::Default={pthread_mutexattr_default};
CondAttr Condition::Default={pthread_condattr_default};
ThreadAttr Thread::Default={pthread_attr_default};
#else
MutexAttr Mutex::Default={0};
CondAttr Condition::Default={0};
ThreadAttr Thread::Default={0};
#endif
#ifdef SIGC_CXX_NAMESPACES
}
}
#endif
#endif

View File

@ -1,242 +0,0 @@
// -*- c++ -*-
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef SIGCXX_THREAD_H
#define SIGCXX_THREAD_H
#include <sigc++/sigc++config.h>
#ifdef SIGC_PTHREADS
#ifdef SIGC_THREAD_IMPL
#include <pthread.h>
#else
#include <time.h>
#endif
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
namespace Threads
{
#else
#define Threads
#endif
#ifdef SIGC_THREAD_IMPL
#ifdef SIGC_PTHREAD_DCE
struct CondAttr { pthread_condattr_t impl_;};
struct MutexAttr { pthread_mutexattr_t impl_;};
struct ThreadAttr { pthread_attr_t impl_;};
#else
struct CondAttr { pthread_condattr_t* impl_;};
struct MutexAttr { pthread_mutexattr_t* impl_;};
struct ThreadAttr { pthread_attr_t* impl_;};
#endif
typedef pthread_mutex_t MutexImpl;
typedef pthread_cond_t CondImpl;
typedef pthread_key_t KeyImpl;
typedef pthread_t ThreadImpl;
#else
class CondAttr {unsigned char dummy[SIGC_PTHREAD_COND_ATTR];};
class CondImpl {unsigned char dummy[SIGC_PTHREAD_COND_IMPL];};
class MutexAttr {unsigned char dummy[SIGC_PTHREAD_MUTEX_ATTR];};
class MutexImpl {unsigned char dummy[SIGC_PTHREAD_MUTEX_IMPL];};
class ThreadAttr {unsigned char dummy[SIGC_PTHREAD_THREAD_ATTR];};
class ThreadImpl {unsigned char dummy[SIGC_PTHREAD_THREAD_IMPL];};
class KeyImpl {unsigned char dummy[SIGC_PTHREAD_KEY_IMPL];};
#endif
// Mutual Exclusion
class Mutex
{
typedef MutexImpl Impl;
private:
Impl mutex_;
int destroy();
public:
static MutexAttr Default;
#ifdef SIGC_THREAD_IMPL
operator Impl* () {return (Impl*)(&mutex_);}
#endif
Mutex(const MutexAttr attr=Default);
// (needs work)
~Mutex();
int lock();
int trylock();
int unlock();
};
// A lazy way to unlock at end of scope
struct MLock
{
Mutex &mutex_;
MLock(Mutex& mutex):mutex_(mutex) {mutex_.lock();}
~MLock() {mutex_.unlock();}
};
// Condition Variable
struct Condition
{
typedef CondImpl Impl;
private:
Impl cond_;
int destroy();
public:
static CondAttr Default;
#ifdef SIGC_THREAD_IMPL
operator Impl* () {return (Impl*)(&cond_);}
#endif
Condition(const CondAttr &attr=Default);
~Condition();
// restarts exactly one thread hung on condition
int signal();
// restarts all threads waiting on condition
int broadcast();
// unlocks a mutex while waiting on a condition, then reaquires lock.
int wait(Mutex &m);
// unlocks a mutex while waiting on a condition, then reaquires lock
// with a fixed maximum duration.
int wait(Mutex &m,struct timespec* spec);
};
// Integer Semaphore
struct Semaphore
{
int value_;
Condition sig_;
Mutex access_;
void up();
void down();
Semaphore(int value=1);
~Semaphore();
};
struct Private_
{
KeyImpl key_;
void* get();
void set(void *value);
void create(void (*dtor)(void*));
void destroy();
};
// Private is a thread split static.
template <class T>
class Private : private Private_
{
private:
static void dtor(void* v)
{
T* obj=(T*)v;
delete obj;
}
public:
T& operator =(const T& t)
{return (((T&)*this)=t);}
operator T& ()
{
T *value=(T*)get();
if (!value)
set((void*)(value=new T()));
return *(value);
}
Private() { create(&dtor); }
~Private() { destroy(); }
};
// int needs to initialized
template <>
class Private<int> : private Private_
{
private:
static void dtor(void* v)
{
int* obj=(int*)v;
delete obj;
}
public:
int& operator =(const int& t)
{return (((int&)*this)=t);}
operator int& ()
{
int *value=(int*)get();
if (!value)
set((void*)(value=new int(0)));
return *(value);
}
Private() { create(&dtor); }
~Private() { destroy(); }
};
struct Thread
{
protected:
typedef ThreadImpl Impl;
Impl thread_;
void* arg_;
ThreadAttr attr_;
static void* call_main_(void* obj);
public:
#ifdef SIGC_THREAD_IMPL
operator Impl* () {return &thread_;}
#endif
virtual void* main(void*)=0;
int detach();
static ThreadAttr Default;
// arg is for passing extra data to main, but never pass a
// local variable or address of local variable. Arg must
// be available throughout life of program.
int start(void* arg=0);
Thread(const ThreadAttr &attr=Default);
virtual ~Thread();
};
#ifdef SIGC_CXX_NAMESPACES
} /* namespace Threads */
} /* namespace SigC */
#endif
#endif /* SIGC_PTHREADS */
#endif /* SIGCXX_THREAD_H */

View File

@ -1,63 +0,0 @@
// -*- c++ -*-
/*
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef SIGCXX_TYPE_H
#define SIGCXX_TYPE_H
#include <sigc++/sigc++config.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
/* some classes for making parameter passing easier */
#ifdef SIGC_CXX_SPECIALIZE_REFERENCES
template <typename T>
struct Trait
{
typedef const T& ref;
typedef T type;
};
template <typename T>
struct Trait<T&>
{
typedef T& ref;
typedef T& type;
};
#else
template <typename T>
struct Trait
{
typedef T ref; // VC++ does not support reference typedef
typedef T type;
};
#endif
template <>
struct Trait<void>:public Trait<int>
{};
#ifdef SIGC_CXX_NAMESPACES
}
#endif
#endif